@ibiz-template/runtime 0.7.41-alpha.127 → 0.7.41-alpha.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/index.esm.js +59 -11
  2. package/dist/index.system.min.js +1 -1
  3. package/out/config/global-config.d.ts +7 -1
  4. package/out/config/global-config.d.ts.map +1 -1
  5. package/out/config/global-config.js +20 -0
  6. package/out/interface/api/common/global-config/i-api-global-common-config.d.ts +8 -0
  7. package/out/interface/api/common/global-config/i-api-global-common-config.d.ts.map +1 -1
  8. package/out/interface/api/common/global-config/i-api-global-config.d.ts +7 -0
  9. package/out/interface/api/common/global-config/i-api-global-config.d.ts.map +1 -1
  10. package/out/interface/api/common/global-config/i-api-global-img-assets.d.ts +92 -0
  11. package/out/interface/api/common/global-config/i-api-global-img-assets.d.ts.map +1 -0
  12. package/out/interface/api/common/global-config/i-api-global-img-assets.js +1 -0
  13. package/out/interface/api/common/global-config/index.d.ts +1 -0
  14. package/out/interface/api/common/global-config/index.d.ts.map +1 -1
  15. package/out/interface/common/i-global-config/i-global-img-assets.d.ts +10 -0
  16. package/out/interface/common/i-global-config/i-global-img-assets.d.ts.map +1 -0
  17. package/out/interface/common/i-global-config/i-global-img-assets.js +1 -0
  18. package/out/interface/common/i-global-config/index.d.ts +1 -0
  19. package/out/interface/common/i-global-config/index.d.ts.map +1 -1
  20. package/out/interface/common/i-global-config/index.js +1 -0
  21. package/out/interface/common/index.d.ts +1 -1
  22. package/out/interface/common/index.d.ts.map +1 -1
  23. package/out/register/custom-register.d.ts.map +1 -1
  24. package/out/register/custom-register.js +5 -0
  25. package/out/utils/theme-util/theme-util.d.ts +9 -1
  26. package/out/utils/theme-util/theme-util.d.ts.map +1 -1
  27. package/out/utils/theme-util/theme-util.js +38 -12
  28. package/package.json +2 -2
  29. package/src/config/global-config.ts +22 -0
  30. package/src/interface/api/common/global-config/i-api-global-common-config.ts +9 -0
  31. package/src/interface/api/common/global-config/i-api-global-config.ts +8 -0
  32. package/src/interface/api/common/global-config/i-api-global-img-assets.ts +102 -0
  33. package/src/interface/api/common/global-config/index.ts +1 -0
  34. package/src/interface/common/i-global-config/i-global-img-assets.ts +9 -0
  35. package/src/interface/common/i-global-config/index.ts +1 -0
  36. package/src/interface/common/index.ts +1 -0
  37. package/src/register/custom-register.ts +5 -0
  38. package/src/utils/theme-util/theme-util.ts +39 -12
@@ -12,3 +12,4 @@ export * from './i-global-common-config';
12
12
  export * from './i-global-flow-drtab-config';
13
13
  export * from './i-global-mob-config';
14
14
  export * from './i-global-img-cpmpress-config';
15
+ export * from './i-global-img-assets';
@@ -29,6 +29,7 @@ export type {
29
29
  IGlobalFlowDrtabConfig,
30
30
  IGlobalMobConfig,
31
31
  IGlobalImgCompressConfig,
32
+ IGlobalImgAssets,
32
33
  } from './i-global-config';
33
34
  export type { IDataAbilityParams } from './i-data-ability-params/i-data-ability-params';
34
35
  export type { IAppConfigService } from './i-app-config-service/i-app-config-service';
@@ -32,6 +32,11 @@ export class CustomRegister {
32
32
  * @memberof CustomRegister
33
33
  */
34
34
  static getRegisterKey(registerType: string, opts: IRegisterParams): string {
35
+ // 如果自定义扩展标记,则直接返回
36
+ const { mainModel } = opts;
37
+ if (mainModel && (mainModel as IData).customExtTag) {
38
+ return (mainModel as IData).customExtTag;
39
+ }
35
40
  switch (registerType) {
36
41
  case VIEW_PROVIDER_PREFIX:
37
42
  return this.calcExtensionViewKey(opts);
@@ -44,7 +44,7 @@ export class ThemeUtil implements IApiThemeUtil {
44
44
  /**
45
45
  * @description 加载主题插件
46
46
  * @param {IAppUITheme} theme
47
- * @param {('COLOR' | 'ICON')} [type='COLOR'] 颜色主题|图标主题,默认值为颜色主题
47
+ * @param {('COLOR' | 'ICON')} [type='COLOR'] 颜色主题|图标主题,默认值为颜色主题,颜色主题包含远程插件和主题变量共存的情况,主题变量的优先级大于远程插件的优先级
48
48
  * @returns {*} {Promise<void>}
49
49
  * @memberof ThemeUtil
50
50
  */
@@ -56,21 +56,48 @@ export class ThemeUtil implements IApiThemeUtil {
56
56
  const path = data['theme-package-path'] || theme.themeUrl;
57
57
  delete data.appId;
58
58
  delete data['theme-package-path'];
59
- await ibiz.plugin.loadPlugin({
60
- runtimeObject: true,
61
- rtobjectName: theme.themeTag!,
62
- rtobjectRepo: path,
63
- } as unknown as ISysPFPlugin);
59
+ // 远程主题插件
60
+ if (path) {
61
+ await ibiz.plugin.loadPlugin({
62
+ runtimeObject: true,
63
+ rtobjectName: theme.themeTag!,
64
+ rtobjectRepo: path,
65
+ } as unknown as ISysPFPlugin);
66
+ }
64
67
  if (type === 'COLOR') {
65
68
  this.setThemeParams(theme, data);
69
+ // 内置样式变量主题
70
+ if (theme.cssStyle) {
71
+ this.setThemeCssStyle(theme);
72
+ }
66
73
  this.setTheme(theme.themeTag!);
67
- // 只计算颜色主题插件
68
74
  this.pluginTheme.push(theme);
69
75
  } else {
70
76
  this.html.classList.add(theme.themeTag!);
71
77
  }
72
78
  }
73
79
 
80
+ /**
81
+ * @description 设置主题变量
82
+ * @protected
83
+ * @param {IAppUITheme} theme
84
+ * @returns {*} {void}
85
+ * @memberof ThemeUtil
86
+ */
87
+ protected setThemeCssStyle(theme: IAppUITheme): void {
88
+ // 加上 var-css 后缀,避免与 setThemeParams 生成的主题参数 style 标签 id 冲突
89
+ const styleId = `${theme.themeTag}-var-css`;
90
+ const themeStyle = document.getElementById(styleId);
91
+ if (themeStyle) {
92
+ return;
93
+ }
94
+ const style = document.createElement('style');
95
+ style.id = styleId;
96
+ style.type = 'text/css';
97
+ style.innerHTML = theme.cssStyle!;
98
+ document.head.appendChild(style);
99
+ }
100
+
74
101
  /**
75
102
  * @description 设置额外修改的主题参数
76
103
  * @protected
@@ -95,11 +122,11 @@ export class ThemeUtil implements IApiThemeUtil {
95
122
  }
96
123
  }
97
124
  content += '}';
98
- const script = document.createElement('style');
99
- script.id = theme.themeTag!;
100
- script.type = 'text/css';
101
- script.innerHTML = content;
102
- document.head.appendChild(script);
125
+ const style = document.createElement('style');
126
+ style.id = theme.themeTag!;
127
+ style.type = 'text/css';
128
+ style.innerHTML = content;
129
+ document.head.appendChild(style);
103
130
  }
104
131
 
105
132
  /**