@ibiz-template/vue3-util 0.4.3-dev.1 → 0.4.4

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.
@@ -99,6 +99,16 @@ export declare class NavPosController extends PanelItemController<IPanelRawItem>
99
99
  * @memberof NavPosController
100
100
  */
101
101
  get routeDepth(): number | undefined;
102
+ /**
103
+ * 计算缓存 key 标识
104
+ *
105
+ * @author chitanda
106
+ * @date 2023-12-03 13:12:25
107
+ * @protected
108
+ * @param {INavViewMsg} msg
109
+ * @return {*} {string}
110
+ */
111
+ protected calcCacheKey(msg: INavViewMsg): string;
102
112
  /**
103
113
  * 路由改变
104
114
  *
@@ -1 +1 @@
1
- {"version":3,"file":"nav-pos.controller.d.ts","sourceRoot":"","sources":["../../../src/panel-component/nav-pos/nav-pos.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,MAAM,EAGN,0BAA0B,EAE1B,WAAW,EAEX,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,6BAA6B,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGnE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAK9C;;;;;;GAMG;AACH,qBAAa,gBACX,SAAQ,mBAAmB,CAAC,aAAa,CACzC,YAAW,0BAA0B;IAErC;;;;;OAKG;IACK,KAAK,EAAE,WAAW,CAAC;IAE3B;;;;;OAKG;IACH,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAM;IAE3C;;;;;OAKG;IACH,aAAa,EAAG,WAAW,CAAC;IAE5B;;;;;OAKG;IACH,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,WAAW,EAAE,MAAM,EAAE,CAAM;IAE3B;;;;;;;OAOG;IACH,aAAa,EAAE,KAAK,CAAM;IAE1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,WAAW,GAAG,IAAI;IAkBxC;;;;;OAKG;IACH,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IA0C9C;;;;;OAKG;IACH,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAM/C;;;;;;;OAOG;IACH,SAAS,CAAC,mBAAmB,IAAI,IAAI;CAWtC"}
@@ -125,6 +125,21 @@ class NavPosController extends PanelItemController {
125
125
  get routeDepth() {
126
126
  return this.panel.view.modal.routeDepth;
127
127
  }
128
+ /**
129
+ * 计算缓存 key 标识
130
+ *
131
+ * @author chitanda
132
+ * @date 2023-12-03 13:12:25
133
+ * @protected
134
+ * @param {INavViewMsg} msg
135
+ * @return {*} {string}
136
+ */
137
+ calcCacheKey(msg) {
138
+ if (msg) {
139
+ return `${msg.viewId}___${msg.key}`;
140
+ }
141
+ return "";
142
+ }
128
143
  /**
129
144
  * 路由改变
130
145
  *
@@ -132,8 +147,9 @@ class NavPosController extends PanelItemController {
132
147
  */
133
148
  onRouteChange(route) {
134
149
  if (this.curNavViewMsg) {
135
- this.state.currentKey = this.curNavViewMsg.key;
136
- this.state.navViewMsgs[this.curNavViewMsg.key].fullPath = route.fullPath;
150
+ const cacheKey = this.calcCacheKey(this.curNavViewMsg);
151
+ this.state.currentKey = cacheKey;
152
+ this.state.navViewMsgs[cacheKey].fullPath = route.fullPath;
137
153
  }
138
154
  }
139
155
  /**
@@ -146,27 +162,28 @@ class NavPosController extends PanelItemController {
146
162
  */
147
163
  setNavViewMsgs(navViewMsg) {
148
164
  navViewMsg.isRoutePushed = navViewMsg.isRoutePushed === true;
149
- if (this.state.navViewMsgs[navViewMsg.key]) {
150
- mergeLeft(this.state.navViewMsgs[navViewMsg.key], navViewMsg);
165
+ const cacheKey = this.calcCacheKey(navViewMsg);
166
+ if (this.state.navViewMsgs[cacheKey]) {
167
+ mergeLeft(this.state.navViewMsgs[cacheKey], navViewMsg);
151
168
  excludeKeys.forEach((key) => {
152
169
  if (Object.prototype.hasOwnProperty.call(navViewMsg, key)) {
153
- this.state.navViewMsgs[navViewMsg.key][key] = void 0;
170
+ this.state.navViewMsgs[cacheKey][key] = void 0;
154
171
  }
155
172
  });
156
173
  } else {
157
- this.state.navViewMsgs[navViewMsg.key] = navViewMsg;
174
+ this.state.navViewMsgs[cacheKey] = navViewMsg;
158
175
  if (this.getExpItemIsCache(navViewMsg)) {
159
- this.state.cacheKeys.push(navViewMsg.key);
176
+ this.state.cacheKeys.push(cacheKey);
160
177
  }
161
- this.viewModals[navViewMsg.key] = new Modal({
178
+ this.viewModals[cacheKey] = new Modal({
162
179
  mode: this.routeDepth ? ViewMode.ROUTE : ViewMode.EMBED,
163
180
  routeDepth: this.routeDepth ? this.routeDepth + 1 : void 0,
164
181
  dismiss: () => {
165
- this.dismiss(navViewMsg.key);
182
+ this.dismiss(cacheKey);
166
183
  }
167
184
  });
168
185
  }
169
- this.curNavViewMsg = this.state.navViewMsgs[navViewMsg.key];
186
+ this.curNavViewMsg = this.state.navViewMsgs[cacheKey];
170
187
  }
171
188
  /**
172
189
  * 自身的dismiss相关操作
@@ -198,7 +215,7 @@ class NavPosController extends PanelItemController {
198
215
  */
199
216
  openView(openViewMsg) {
200
217
  if (!openViewMsg.key) {
201
- this.state.currentKey = openViewMsg.key;
218
+ this.state.currentKey = this.calcCacheKey(openViewMsg);
202
219
  if (this.routeDepth && this.state.routeOpen) {
203
220
  this.toBlankRoute();
204
221
  }
@@ -217,11 +234,12 @@ class NavPosController extends PanelItemController {
217
234
  * @memberof NavPosController
218
235
  */
219
236
  openViewByPath(openViewMsg) {
237
+ const cacheKey = this.calcCacheKey(openViewMsg);
220
238
  this.setNavViewMsgs(openViewMsg);
221
239
  const isRoutePushed = openViewMsg.isRoutePushed === true;
222
240
  if (isRoutePushed) {
223
- this.state.currentKey = openViewMsg.key;
224
- this.state.navViewMsgs[this.curNavViewMsg.key].fullPath = this.route.fullPath;
241
+ this.state.currentKey = cacheKey;
242
+ this.state.navViewMsgs[this.calcCacheKey(this.curNavViewMsg)].fullPath = this.route.fullPath;
225
243
  return;
226
244
  }
227
245
  if (openViewMsg.is404) {
@@ -229,15 +247,15 @@ class NavPosController extends PanelItemController {
229
247
  this.router.push(`${selfPath}/404`);
230
248
  } else if (
231
249
  // 如果启用缓存并且有之前存过的fullPath则push回fullPath。
232
- this.state.navViewMsgs[openViewMsg.key].fullPath && this.getExpItemIsCache(openViewMsg)
250
+ this.state.navViewMsgs[cacheKey].fullPath && this.getExpItemIsCache(openViewMsg)
233
251
  ) {
234
- this.router.push(this.state.navViewMsgs[openViewMsg.key].fullPath);
252
+ this.router.push(this.state.navViewMsgs[cacheKey].fullPath);
235
253
  } else {
236
254
  const tempContext = Object.assign(openViewMsg.context.clone(), {
237
255
  toRouteDepth: this.routeDepth + 1
238
256
  });
239
257
  if (this.getExpItemIsCache(openViewMsg)) {
240
- this.state.cacheKeys.push(openViewMsg.key);
258
+ this.state.cacheKeys.push(cacheKey);
241
259
  }
242
260
  ibiz.commands.execute(
243
261
  OpenAppViewCommand.TAG,
@@ -256,7 +274,7 @@ class NavPosController extends PanelItemController {
256
274
  */
257
275
  openViewByModel(openViewMsg) {
258
276
  this.setNavViewMsgs(openViewMsg);
259
- this.state.currentKey = openViewMsg.key;
277
+ this.state.currentKey = this.calcCacheKey(openViewMsg);
260
278
  }
261
279
  /**
262
280
  * 处理自定义补充参数 [{key:'name',value:'data'}] => {name:'data'}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/panel-component/panel-rawitem/index.ts"],"names":[],"mappings":"AAMA,cAAc,4BAA4B,CAAC;AAE3C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;aAO3B,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/panel-component/panel-rawitem/index.ts"],"names":[],"mappings":"AAMA,cAAc,4BAA4B,CAAC;AAE3C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;aAe3B,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
@@ -13,6 +13,14 @@ const IBizPanelRawItem = withInstall(PanelRawItem, function(v) {
13
13
  "RAWITEM_STATIC_IMAGE",
14
14
  () => new PanelRawItemProvider()
15
15
  );
16
+ registerPanelItemProvider(
17
+ "RAWITEM_STATIC_LABEL",
18
+ () => new PanelRawItemProvider()
19
+ );
20
+ registerPanelItemProvider(
21
+ "RAWITEM_STATIC_TEXT",
22
+ () => new PanelRawItemProvider()
23
+ );
16
24
  });
17
25
 
18
26
  export { IBizPanelRawItem, IBizPanelRawItem as default };
@@ -27,14 +27,6 @@ export declare class PluginFactory implements IPluginFactory {
27
27
  * @type {Map<string, boolean>}
28
28
  */
29
29
  protected cache: Map<string, boolean>;
30
- /**
31
- * 本地开发测试包,只在本地开发生效
32
- *
33
- * @author chitanda
34
- * @date 2022-11-02 21:11:41
35
- * @protected
36
- */
37
- protected devPackages: Map<string, () => Promise<unknown>>;
38
30
  /**
39
31
  * 插件缓存
40
32
  *
@@ -62,6 +54,33 @@ export declare class PluginFactory implements IPluginFactory {
62
54
  * @type {Map<string, IPluginItem>}
63
55
  */
64
56
  protected predefinedPlugins: Map<string, IPluginItem>;
57
+ /**
58
+ * 忽略加载的插件规则,支持正则。配配规则为插件包地址,如:@ibiz-template-vue/vue3-plugin-*
59
+ *
60
+ * @author chitanda
61
+ * @date 2023-12-04 15:12:58
62
+ * @protected
63
+ * @type {((string | RegExp)[])}
64
+ */
65
+ protected ignoreRules: (string | RegExp)[];
66
+ /**
67
+ * 是否忽略插件加载
68
+ *
69
+ * @author chitanda
70
+ * @date 2023-12-04 16:12:48
71
+ * @protected
72
+ * @param {string} pluginPath
73
+ * @return {*} {boolean}
74
+ */
75
+ protected isIgnore(pluginPath: string): boolean;
76
+ /**
77
+ * 设置本地开发忽略远程加载的插件
78
+ *
79
+ * @author chitanda
80
+ * @date 2023-12-04 17:12:49
81
+ * @param {(string | RegExp)} rule
82
+ */
83
+ setDevIgnore(rule: string | RegExp): void;
65
84
  /**
66
85
  * 注册视图默认插件
67
86
  *
@@ -96,15 +115,6 @@ export declare class PluginFactory implements IPluginFactory {
96
115
  * @param {Plugin} code
97
116
  */
98
117
  protected setPluginCode(code: Plugin): void;
99
- /**
100
- * 设置开发插件,用于本地调试
101
- *
102
- * @author chitanda
103
- * @date 2022-11-02 21:11:56
104
- * @param {string} name
105
- * @param {() => Promise<unknown>} fn
106
- */
107
- setDevPlugin(name: string, fn: () => Promise<unknown>): void;
108
118
  /**
109
119
  * 加载插件
110
120
  *
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-factory.d.ts","sourceRoot":"","sources":["../../../src/plugin/plugin-factory/plugin-factory.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,WAAW,EAEX,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAmB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAElC;;;;;;;GAOG;AACH,qBAAa,aAAc,YAAW,cAAc;IAClD;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,SAA0B;IAE1C;;;;;;;OAOG;IACH,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAa;IAElD;;;;;;OAMG;IACH,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAa;IAEvE;;;;;;;OAOG;IACH,SAAS,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAa;IAEjE;;;;;;;OAOG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,CAAM;IAErC;;;;;;;OAOG;IACH,SAAS,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAa;IAElE;;;;;;OAMG;IACH,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{Map<string, boolean>}
23
23
  */
24
24
  this.cache = /* @__PURE__ */ new Map();
25
- /**
26
- * 本地开发测试包,只在本地开发生效
27
- *
28
- * @author chitanda
29
- * @date 2022-11-02 21:11:41
30
- * @protected
31
- */
32
- this.devPackages = /* @__PURE__ */ new Map();
33
25
  /**
34
26
  * 插件缓存
35
27
  *
@@ -57,6 +49,42 @@ class PluginFactory {
57
49
  * @type {Map<string, IPluginItem>}
58
50
  */
59
51
  this.predefinedPlugins = /* @__PURE__ */ new Map();
52
+ /**
53
+ * 忽略加载的插件规则,支持正则。配配规则为插件包地址,如:@ibiz-template-vue/vue3-plugin-*
54
+ *
55
+ * @author chitanda
56
+ * @date 2023-12-04 15:12:58
57
+ * @protected
58
+ * @type {((string | RegExp)[])}
59
+ */
60
+ this.ignoreRules = [];
61
+ }
62
+ /**
63
+ * 是否忽略插件加载
64
+ *
65
+ * @author chitanda
66
+ * @date 2023-12-04 16:12:48
67
+ * @protected
68
+ * @param {string} pluginPath
69
+ * @return {*} {boolean}
70
+ */
71
+ isIgnore(pluginPath) {
72
+ return this.ignoreRules.some((rule) => {
73
+ if (typeof rule === "string") {
74
+ return pluginPath === rule;
75
+ }
76
+ return rule.test(pluginPath);
77
+ });
78
+ }
79
+ /**
80
+ * 设置本地开发忽略远程加载的插件
81
+ *
82
+ * @author chitanda
83
+ * @date 2023-12-04 17:12:49
84
+ * @param {(string | RegExp)} rule
85
+ */
86
+ setDevIgnore(rule) {
87
+ this.ignoreRules.push(rule);
60
88
  }
61
89
  /**
62
90
  * 注册视图默认插件
@@ -110,17 +138,6 @@ class PluginFactory {
110
138
  inst.use(code);
111
139
  });
112
140
  }
113
- /**
114
- * 设置开发插件,用于本地调试
115
- *
116
- * @author chitanda
117
- * @date 2022-11-02 21:11:56
118
- * @param {string} name
119
- * @param {() => Promise<unknown>} fn
120
- */
121
- setDevPlugin(name, fn) {
122
- this.devPackages.set(name, fn);
123
- }
124
141
  /**
125
142
  * 加载插件
126
143
  *
@@ -154,14 +171,14 @@ class PluginFactory {
154
171
  * @return {*} {Promise<boolean>}
155
172
  */
156
173
  async loadPluginRef(rtObjectName, rtObjectRepo) {
174
+ if (this.isIgnore(rtObjectRepo)) {
175
+ return true;
176
+ }
157
177
  if (this.pluginCache.has(rtObjectName)) {
158
178
  return true;
159
179
  }
160
180
  let configData = null;
161
- const fn = this.devPackages.get(rtObjectName);
162
- if (fn) {
163
- configData = await fn();
164
- } else {
181
+ {
165
182
  const pluginPath = rtObjectRepo;
166
183
  const configUrl = this.urlReg.test(pluginPath) ? `${pluginPath}/package.json` : `${ibiz.env.pluginBaseUrl}/${pathBrowserify.join(pluginPath, "package.json")}`;
167
184
  const res = await ibiz.net.axios({
@@ -201,11 +218,9 @@ class PluginFactory {
201
218
  */
202
219
  async loadScript(remotePlugin) {
203
220
  const pluginPath = remotePlugin.repo;
204
- const { name, version, system, module, styles } = remotePlugin.config;
221
+ const { name, system, module, styles } = remotePlugin.config;
205
222
  let scriptUrl = "";
206
- if (this.devPackages.has(name)) {
207
- scriptUrl = pathBrowserify.join(`${name}@${version}`, module);
208
- } else if (ibiz.env.dev) {
223
+ if (ibiz.env.dev) {
209
224
  scriptUrl = this.urlReg.test(pluginPath) ? `${pluginPath}/${pathBrowserify.join(module)}` : `${ibiz.env.pluginBaseUrl}/${pluginPath}/${pathBrowserify.join(module)}`;
210
225
  } else {
211
226
  scriptUrl = pathBrowserify.join(pluginPath, system);
@@ -219,11 +234,7 @@ class PluginFactory {
219
234
  const styleUrls = (typeof styles === "string" ? [styles] : styles).map(
220
235
  (styleUrl) => this.parseUrl(path.join(pluginPath, styleUrl))
221
236
  );
222
- if (this.devPackages.has(name)) {
223
- const fn = this.devPackages.get(name);
224
- data = await fn();
225
- this.cache.set(scriptUrl, true);
226
- } else if (ibiz.env.dev) {
237
+ if (ibiz.env.dev) {
227
238
  data = await import(
228
239
  /* @vite-ignore */
229
240
  scriptUrl
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/vue3-util",
3
- "version": "0.4.3-dev.1",
3
+ "version": "0.4.4",
4
4
  "description": "vue3 工具包",
5
5
  "type": "module",
6
6
  "module": "es/index.mjs",
@@ -32,9 +32,9 @@
32
32
  "devDependencies": {
33
33
  "@ibiz-template/cli": "0.3.2",
34
34
  "@ibiz-template/core": "^0.4.0",
35
- "@ibiz-template/runtime": "^0.4.3-dev.1",
35
+ "@ibiz-template/runtime": "^0.4.4",
36
36
  "@ibiz-template/theme": "^0.4.0",
37
- "@ibiz/model-core": "^0.0.22",
37
+ "@ibiz/model-core": "^0.0.23",
38
38
  "@types/path-browserify": "^1.0.2",
39
39
  "@types/qs": "^6.9.10",
40
40
  "@types/systemjs": "^6.13.5",
@@ -51,7 +51,7 @@
51
51
  "peerDependencies": {
52
52
  "@ibiz-template/core": "^0.4.0",
53
53
  "@ibiz-template/runtime": "^0.4.0",
54
- "@ibiz/model-core": "^0.0.22",
54
+ "@ibiz/model-core": "^0.0.23",
55
55
  "dayjs": "^1.11.10",
56
56
  "path-browserify": "^1.0.1",
57
57
  "pinia": "^2.1.7",
@@ -61,5 +61,5 @@
61
61
  "vue": "^3.3.4",
62
62
  "vue-router": "^4.2.4"
63
63
  },
64
- "gitHead": "2a8d1bf53f9d3ac19722a0fc2da1da1cccf634f0"
64
+ "gitHead": "283c09417c873f27c58087f33a93466940c1b002"
65
65
  }
@@ -187,6 +187,22 @@ export class NavPosController
187
187
  return this.panel.view.modal.routeDepth;
188
188
  }
189
189
 
190
+ /**
191
+ * 计算缓存 key 标识
192
+ *
193
+ * @author chitanda
194
+ * @date 2023-12-03 13:12:25
195
+ * @protected
196
+ * @param {INavViewMsg} msg
197
+ * @return {*} {string}
198
+ */
199
+ protected calcCacheKey(msg: INavViewMsg): string {
200
+ if (msg) {
201
+ return `${msg.viewId}___${msg.key}`;
202
+ }
203
+ return '';
204
+ }
205
+
190
206
  /**
191
207
  * 路由改变
192
208
  *
@@ -195,11 +211,13 @@ export class NavPosController
195
211
  onRouteChange(route: RouteLocationNormalizedLoaded): void {
196
212
  // 没有当前导航视图信息时不做任何处理
197
213
  if (this.curNavViewMsg) {
214
+ const cacheKey = this.calcCacheKey(this.curNavViewMsg);
215
+
198
216
  // 路由打开的视图,currentKey在路由变更之后改值。此时新建的视图才能识别到跳转之后的路由。
199
- this.state.currentKey = this.curNavViewMsg.key;
217
+ this.state.currentKey = cacheKey;
200
218
 
201
219
  // 更新fullPath信息
202
- this.state.navViewMsgs[this.curNavViewMsg.key].fullPath = route.fullPath;
220
+ this.state.navViewMsgs[cacheKey].fullPath = route.fullPath;
203
221
  }
204
222
  }
205
223
 
@@ -214,33 +232,34 @@ export class NavPosController
214
232
  setNavViewMsgs(navViewMsg: INavViewMsg): void {
215
233
  // isRoutePushed没传的时候给false
216
234
  navViewMsg.isRoutePushed = navViewMsg.isRoutePushed === true;
217
- if (this.state.navViewMsgs[navViewMsg.key]) {
218
- mergeLeft(this.state.navViewMsgs[navViewMsg.key], navViewMsg);
235
+ const cacheKey = this.calcCacheKey(navViewMsg);
236
+ if (this.state.navViewMsgs[cacheKey]) {
237
+ mergeLeft(this.state.navViewMsgs[cacheKey], navViewMsg);
219
238
  // 部分属性这次没传就是undefined
220
239
  excludeKeys.forEach(key => {
221
240
  if (Object.prototype.hasOwnProperty.call(navViewMsg, key)) {
222
- this.state.navViewMsgs[navViewMsg.key][key] = undefined;
241
+ this.state.navViewMsgs[cacheKey][key] = undefined;
223
242
  }
224
243
  });
225
244
  } else {
226
245
  // 不存在的走新建流程
227
- this.state.navViewMsgs[navViewMsg.key] = navViewMsg;
246
+ this.state.navViewMsgs[cacheKey] = navViewMsg;
228
247
  if (this.getExpItemIsCache(navViewMsg)) {
229
248
  // 往缓存keys里添加新视图的key
230
- this.state.cacheKeys.push(navViewMsg.key);
249
+ this.state.cacheKeys.push(cacheKey);
231
250
  }
232
- this.viewModals[navViewMsg.key] = new Modal({
251
+ this.viewModals[cacheKey] = new Modal({
233
252
  mode: this.routeDepth ? ViewMode.ROUTE : ViewMode.EMBED,
234
253
  routeDepth: this.routeDepth ? this.routeDepth + 1 : undefined,
235
254
  dismiss: () => {
236
255
  // 执行对应key的dismiss方法
237
- this.dismiss(navViewMsg.key);
256
+ this.dismiss(cacheKey);
238
257
  },
239
258
  });
240
259
  }
241
260
 
242
261
  // todo 换个方式
243
- this.curNavViewMsg = this.state.navViewMsgs[navViewMsg.key];
262
+ this.curNavViewMsg = this.state.navViewMsgs[cacheKey];
244
263
  }
245
264
 
246
265
  /**
@@ -277,7 +296,7 @@ export class NavPosController
277
296
  openView(openViewMsg: INavViewMsg): void {
278
297
  // 当key为空时,直接切换currentKey,绘制null
279
298
  if (!openViewMsg.key) {
280
- this.state.currentKey = openViewMsg.key;
299
+ this.state.currentKey = this.calcCacheKey(openViewMsg);
281
300
  if (this.routeDepth && this.state.routeOpen) {
282
301
  this.toBlankRoute();
283
302
  }
@@ -299,12 +318,13 @@ export class NavPosController
299
318
  * @memberof NavPosController
300
319
  */
301
320
  openViewByPath(openViewMsg: INavViewMsg): void {
321
+ const cacheKey = this.calcCacheKey(openViewMsg);
302
322
  this.setNavViewMsgs(openViewMsg);
303
323
  const isRoutePushed = openViewMsg.isRoutePushed === true;
304
324
  // * 外部跳转过了的场景不需要这边跳转路由了,直接处理后续内容。
305
325
  if (isRoutePushed) {
306
- this.state.currentKey = openViewMsg.key;
307
- this.state.navViewMsgs[this.curNavViewMsg.key].fullPath =
326
+ this.state.currentKey = cacheKey;
327
+ this.state.navViewMsgs[this.calcCacheKey(this.curNavViewMsg)].fullPath =
308
328
  this.route.fullPath;
309
329
  return;
310
330
  }
@@ -315,17 +335,17 @@ export class NavPosController
315
335
  this.router.push(`${selfPath}/404`);
316
336
  } else if (
317
337
  // 如果启用缓存并且有之前存过的fullPath则push回fullPath。
318
- this.state.navViewMsgs[openViewMsg.key].fullPath &&
338
+ this.state.navViewMsgs[cacheKey].fullPath &&
319
339
  this.getExpItemIsCache(openViewMsg)
320
340
  ) {
321
- this.router.push(this.state.navViewMsgs[openViewMsg.key].fullPath!);
341
+ this.router.push(this.state.navViewMsgs[cacheKey].fullPath!);
322
342
  } else {
323
343
  // 走视图路由打开逻辑计算并push
324
344
  const tempContext = Object.assign(openViewMsg.context!.clone(), {
325
345
  toRouteDepth: this.routeDepth! + 1,
326
346
  });
327
347
  if (this.getExpItemIsCache(openViewMsg)) {
328
- this.state.cacheKeys.push(openViewMsg.key);
348
+ this.state.cacheKeys.push(cacheKey);
329
349
  }
330
350
  ibiz.commands.execute(
331
351
  OpenAppViewCommand.TAG,
@@ -348,7 +368,7 @@ export class NavPosController
348
368
  openViewByModel(openViewMsg: INavViewMsg): void {
349
369
  this.setNavViewMsgs(openViewMsg);
350
370
  // 切换currentKey,重新渲染openViewMsg
351
- this.state.currentKey = openViewMsg.key;
371
+ this.state.currentKey = this.calcCacheKey(openViewMsg);
352
372
  }
353
373
 
354
374
  /**
@@ -13,6 +13,14 @@ export const IBizPanelRawItem = withInstall(PanelRawItem, function (v: App) {
13
13
  'RAWITEM_STATIC_IMAGE',
14
14
  () => new PanelRawItemProvider(),
15
15
  );
16
+ registerPanelItemProvider(
17
+ 'RAWITEM_STATIC_LABEL',
18
+ () => new PanelRawItemProvider(),
19
+ );
20
+ registerPanelItemProvider(
21
+ 'RAWITEM_STATIC_TEXT',
22
+ () => new PanelRawItemProvider(),
23
+ );
16
24
  });
17
25
 
18
26
  export default IBizPanelRawItem;
@@ -37,15 +37,6 @@ export class PluginFactory implements IPluginFactory {
37
37
  */
38
38
  protected cache: Map<string, boolean> = new Map();
39
39
 
40
- /**
41
- * 本地开发测试包,只在本地开发生效
42
- *
43
- * @author chitanda
44
- * @date 2022-11-02 21:11:41
45
- * @protected
46
- */
47
- protected devPackages: Map<string, () => Promise<unknown>> = new Map();
48
-
49
40
  /**
50
41
  * 插件缓存
51
42
  *
@@ -76,6 +67,45 @@ export class PluginFactory implements IPluginFactory {
76
67
  */
77
68
  protected predefinedPlugins: Map<string, IPluginItem> = new Map();
78
69
 
70
+ /**
71
+ * 忽略加载的插件规则,支持正则。配配规则为插件包地址,如:@ibiz-template-vue/vue3-plugin-*
72
+ *
73
+ * @author chitanda
74
+ * @date 2023-12-04 15:12:58
75
+ * @protected
76
+ * @type {((string | RegExp)[])}
77
+ */
78
+ protected ignoreRules: (string | RegExp)[] = [];
79
+
80
+ /**
81
+ * 是否忽略插件加载
82
+ *
83
+ * @author chitanda
84
+ * @date 2023-12-04 16:12:48
85
+ * @protected
86
+ * @param {string} pluginPath
87
+ * @return {*} {boolean}
88
+ */
89
+ protected isIgnore(pluginPath: string): boolean {
90
+ return this.ignoreRules.some(rule => {
91
+ if (typeof rule === 'string') {
92
+ return pluginPath === rule;
93
+ }
94
+ return rule.test(pluginPath);
95
+ });
96
+ }
97
+
98
+ /**
99
+ * 设置本地开发忽略远程加载的插件
100
+ *
101
+ * @author chitanda
102
+ * @date 2023-12-04 17:12:49
103
+ * @param {(string | RegExp)} rule
104
+ */
105
+ setDevIgnore(rule: string | RegExp): void {
106
+ this.ignoreRules.push(rule);
107
+ }
108
+
79
109
  /**
80
110
  * 注册视图默认插件
81
111
  *
@@ -132,18 +162,6 @@ export class PluginFactory implements IPluginFactory {
132
162
  });
133
163
  }
134
164
 
135
- /**
136
- * 设置开发插件,用于本地调试
137
- *
138
- * @author chitanda
139
- * @date 2022-11-02 21:11:56
140
- * @param {string} name
141
- * @param {() => Promise<unknown>} fn
142
- */
143
- setDevPlugin(name: string, fn: () => Promise<unknown>): void {
144
- this.devPackages.set(name, fn);
145
- }
146
-
147
165
  /**
148
166
  * 加载插件
149
167
  *
@@ -181,14 +199,14 @@ export class PluginFactory implements IPluginFactory {
181
199
  rtObjectName: string,
182
200
  rtObjectRepo: string,
183
201
  ): Promise<boolean> {
202
+ if (this.isIgnore(rtObjectRepo)) {
203
+ return true;
204
+ }
184
205
  if (this.pluginCache.has(rtObjectName)) {
185
206
  return true;
186
207
  }
187
208
  let configData: unknown = null;
188
- const fn = this.devPackages.get(rtObjectName);
189
- if (fn) {
190
- configData = await fn();
191
- } else {
209
+ {
192
210
  const pluginPath: string = rtObjectRepo;
193
211
  const configUrl = this.urlReg.test(pluginPath)
194
212
  ? `${pluginPath}/package.json`
@@ -231,11 +249,9 @@ export class PluginFactory implements IPluginFactory {
231
249
  */
232
250
  protected async loadScript(remotePlugin: RemotePluginItem): Promise<void> {
233
251
  const pluginPath: string = remotePlugin.repo;
234
- const { name, version, system, module, styles } = remotePlugin.config;
252
+ const { name, system, module, styles } = remotePlugin.config;
235
253
  let scriptUrl = '';
236
- if (this.devPackages.has(name)) {
237
- scriptUrl = join(`${name}@${version}`, module);
238
- } else if (ibiz.env.dev) {
254
+ if (ibiz.env.dev) {
239
255
  scriptUrl = this.urlReg.test(pluginPath)
240
256
  ? `${pluginPath}/${join(module)}`
241
257
  : `${ibiz.env.pluginBaseUrl}/${pluginPath}/${join(module)}`;
@@ -251,13 +267,7 @@ export class PluginFactory implements IPluginFactory {
251
267
  const styleUrls = (typeof styles === 'string' ? [styles] : styles).map(
252
268
  styleUrl => this.parseUrl(path.join(pluginPath, styleUrl)),
253
269
  );
254
- // 本地开发模式下的包引用加载
255
- if (this.devPackages.has(name)) {
256
- const fn = this.devPackages.get(name)!;
257
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
258
- data = (await fn()) as any;
259
- this.cache.set(scriptUrl, true);
260
- } else if (ibiz.env.dev) {
270
+ if (ibiz.env.dev) {
261
271
  data = await import(/* @vite-ignore */ scriptUrl);
262
272
  } else {
263
273
  System.addImportMap({