This commit is contained in:
Yuri Kuznetsov
2023-06-24 17:20:20 +03:00
parent 91a2216d27
commit e0606e20d8
4 changed files with 18 additions and 2 deletions
@@ -48,10 +48,18 @@ class LoaderParamsProvider
foreach ($this->metadata->get(['app', 'jsLibs'], []) as $key => $item) {
$id = $item['amdId'] ?? null;
/** @var ?string[] $aliases */
$aliases = $item['aliases'] ?? null;
if ($id) {
$map->$id = 'lib!' . $key;
}
if ($aliases) {
foreach ($aliases as $alias) {
$map->$alias = 'lib!' . $key;
}
}
}
return $map;
@@ -115,7 +115,8 @@
"path": "client/lib/bootstrap-colorpicker.js",
"exportsTo": "$.fn",
"exportsAs": "colorpicker",
"amdId": "bootstrap-colorpicker"
"amdId": "bootstrap-colorpicker",
"aliases": ["lib!Colorpicker"]
},
"exif-js": {
"path": "client/lib/exif.js",
+1 -1
View File
@@ -39,7 +39,7 @@ class ColorpickerFieldView extends VarcharFieldView {
setup() {
super.setup();
this.wait(Espo.loader.requirePromise('lib!Colorpicker'));
this.wait(Espo.loader.requirePromise('lib!bootstrap-colorpicker'));
}
afterRender() {
+7
View File
@@ -48,6 +48,13 @@
"amdId": {
"type": "string",
"description": "An AMD ID. Needs to be specified if the module uses a named define function or other 3rd party modules require that ID."
},
"aliases": {
"type": "array",
"items": {
"type": "string"
},
"description": "Module IDs the lib will be available by. Can be useful for backward compatibility."
}
}
}