@ibiz-template/vue3-util 0.4.3 → 0.4.5

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 (55) hide show
  1. package/dist/index.min.css +1 -1
  2. package/dist/index.system.min.js +1 -2
  3. package/es/index.mjs +4 -0
  4. package/es/panel-component/index.d.ts +2 -0
  5. package/es/panel-component/index.d.ts.map +1 -1
  6. package/es/panel-component/index.mjs +4 -0
  7. package/es/panel-component/nav-pos/nav-pos.controller.d.ts +10 -0
  8. package/es/panel-component/nav-pos/nav-pos.controller.d.ts.map +1 -1
  9. package/es/panel-component/nav-pos/nav-pos.controller.mjs +35 -17
  10. package/es/panel-component/panel-container-group/index.d.ts +29 -0
  11. package/es/panel-component/panel-container-group/index.d.ts.map +1 -0
  12. package/es/panel-component/panel-container-group/index.mjs +21 -0
  13. package/es/panel-component/panel-container-group/panel-container-group.controller.d.ts +32 -0
  14. package/es/panel-component/panel-container-group/panel-container-group.controller.d.ts.map +1 -0
  15. package/es/panel-component/panel-container-group/panel-container-group.controller.mjs +35 -0
  16. package/es/panel-component/panel-container-group/panel-container-group.css +1 -0
  17. package/es/panel-component/panel-container-group/panel-container-group.d.ts +29 -0
  18. package/es/panel-component/panel-container-group/panel-container-group.d.ts.map +1 -0
  19. package/es/panel-component/panel-container-group/panel-container-group.mjs +108 -0
  20. package/es/panel-component/panel-container-group/panel-container-group.provider.d.ts +16 -0
  21. package/es/panel-component/panel-container-group/panel-container-group.provider.d.ts.map +1 -0
  22. package/es/panel-component/panel-container-group/panel-container-group.provider.mjs +15 -0
  23. package/es/panel-component/panel-container-group/panel-container-group.state.d.ts +13 -0
  24. package/es/panel-component/panel-container-group/panel-container-group.state.d.ts.map +1 -0
  25. package/es/panel-component/panel-container-group/panel-container-group.state.mjs +7 -0
  26. package/es/panel-component/panel-rawitem/index.d.ts.map +1 -1
  27. package/es/panel-component/panel-rawitem/index.mjs +8 -0
  28. package/es/panel-component/panel-tab-page/index.d.ts +24 -0
  29. package/es/panel-component/panel-tab-page/index.d.ts.map +1 -0
  30. package/es/panel-component/panel-tab-page/index.mjs +13 -0
  31. package/es/panel-component/panel-tab-page/panel-tab-page.d.ts +26 -0
  32. package/es/panel-component/panel-tab-page/panel-tab-page.d.ts.map +1 -0
  33. package/es/panel-component/panel-tab-page/panel-tab-page.mjs +63 -0
  34. package/es/panel-component/panel-tab-page/panel-tab-page.provider.d.ts +14 -0
  35. package/es/panel-component/panel-tab-page/panel-tab-page.provider.d.ts.map +1 -0
  36. package/es/panel-component/panel-tab-page/panel-tab-page.provider.mjs +15 -0
  37. package/es/plugin/plugin-factory/plugin-factory.d.ts +36 -17
  38. package/es/plugin/plugin-factory/plugin-factory.d.ts.map +1 -1
  39. package/es/plugin/plugin-factory/plugin-factory.mjs +84 -53
  40. package/lib/index.cjs +21 -13
  41. package/package.json +6 -6
  42. package/src/panel-component/index.ts +2 -0
  43. package/src/panel-component/nav-pos/nav-pos.controller.ts +37 -17
  44. package/src/panel-component/panel-container-group/index.ts +22 -0
  45. package/src/panel-component/panel-container-group/panel-container-group.controller.ts +43 -0
  46. package/src/panel-component/panel-container-group/panel-container-group.provider.ts +30 -0
  47. package/src/panel-component/panel-container-group/panel-container-group.scss +91 -0
  48. package/src/panel-component/panel-container-group/panel-container-group.state.ts +12 -0
  49. package/src/panel-component/panel-container-group/panel-container-group.tsx +112 -0
  50. package/src/panel-component/panel-rawitem/index.ts +8 -0
  51. package/src/panel-component/panel-tab-page/index.ts +12 -0
  52. package/src/panel-component/panel-tab-page/panel-tab-page.provider.ts +27 -0
  53. package/src/panel-component/panel-tab-page/panel-tab-page.tsx +55 -0
  54. package/src/plugin/plugin-factory/plugin-factory.ts +87 -55
  55. package/dist/index.system.min.js.map +0 -1
@@ -22,14 +22,6 @@ class PluginFactory {
22
22
  * @type {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,51 @@ 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
+ * @author chitanda
65
+ * @date 2023-12-05 16:12:04
66
+ * @protected
67
+ * @type {Map<string, Promise<boolean>>}
68
+ */
69
+ this.loadQueue = /* @__PURE__ */ new Map();
70
+ }
71
+ /**
72
+ * 是否忽略插件加载
73
+ *
74
+ * @author chitanda
75
+ * @date 2023-12-04 16:12:48
76
+ * @protected
77
+ * @param {string} pluginPath
78
+ * @return {*} {boolean}
79
+ */
80
+ isIgnore(pluginPath) {
81
+ return this.ignoreRules.some((rule) => {
82
+ if (typeof rule === "string") {
83
+ return pluginPath === rule;
84
+ }
85
+ return rule.test(pluginPath);
86
+ });
87
+ }
88
+ /**
89
+ * 设置本地开发忽略远程加载的插件
90
+ *
91
+ * @author chitanda
92
+ * @date 2023-12-04 17:12:49
93
+ * @param {(string | RegExp)} rule
94
+ */
95
+ setDevIgnore(rule) {
96
+ this.ignoreRules.push(rule);
60
97
  }
61
98
  /**
62
99
  * 注册视图默认插件
@@ -110,17 +147,6 @@ class PluginFactory {
110
147
  inst.use(code);
111
148
  });
112
149
  }
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
150
  /**
125
151
  * 加载插件
126
152
  *
@@ -133,13 +159,35 @@ class PluginFactory {
133
159
  if (plugin.runtimeObject === true) {
134
160
  const pluginRef = plugin;
135
161
  if (pluginRef) {
162
+ const rtObjectName = pluginRef.rtobjectName;
163
+ const rtObjectRepo = pluginRef.rtobjectRepo;
164
+ if (this.isIgnore(rtObjectRepo)) {
165
+ return true;
166
+ }
167
+ if (this.pluginCache.has(rtObjectName)) {
168
+ return true;
169
+ }
170
+ if (this.loadQueue.has(rtObjectRepo)) {
171
+ const p = await this.loadQueue.get(rtObjectRepo);
172
+ try {
173
+ const result = await p;
174
+ return result;
175
+ } catch (error) {
176
+ return false;
177
+ }
178
+ }
136
179
  try {
137
- await this.loadPluginRef(
180
+ const p = this.loadPluginRef(
138
181
  pluginRef.rtobjectName,
139
182
  pluginRef.rtobjectRepo
140
183
  );
184
+ this.loadQueue.set(rtObjectRepo, p);
185
+ const result = await p;
186
+ return result;
141
187
  } catch (error) {
142
188
  throw new RuntimeModelError(pluginRef, `\u914D\u7F6E\u52A0\u8F7D\u5931\u8D25`);
189
+ } finally {
190
+ this.loadQueue.delete(rtObjectRepo);
143
191
  }
144
192
  }
145
193
  }
@@ -154,14 +202,14 @@ class PluginFactory {
154
202
  * @return {*} {Promise<boolean>}
155
203
  */
156
204
  async loadPluginRef(rtObjectName, rtObjectRepo) {
205
+ if (this.isIgnore(rtObjectRepo)) {
206
+ return true;
207
+ }
157
208
  if (this.pluginCache.has(rtObjectName)) {
158
209
  return true;
159
210
  }
160
211
  let configData = null;
161
- const fn = this.devPackages.get(rtObjectName);
162
- if (fn) {
163
- configData = await fn();
164
- } else {
212
+ {
165
213
  const pluginPath = rtObjectRepo;
166
214
  const configUrl = this.urlReg.test(pluginPath) ? `${pluginPath}/package.json` : `${ibiz.env.pluginBaseUrl}/${pathBrowserify.join(pluginPath, "package.json")}`;
167
215
  const res = await ibiz.net.axios({
@@ -201,15 +249,9 @@ class PluginFactory {
201
249
  */
202
250
  async loadScript(remotePlugin) {
203
251
  const pluginPath = remotePlugin.repo;
204
- const { name, version, system, module, styles } = remotePlugin.config;
252
+ const { name, system, styles = [] } = remotePlugin.config;
205
253
  let scriptUrl = "";
206
- if (this.devPackages.has(name)) {
207
- scriptUrl = pathBrowserify.join(`${name}@${version}`, module);
208
- } else if (ibiz.env.dev) {
209
- scriptUrl = this.urlReg.test(pluginPath) ? `${pluginPath}/${pathBrowserify.join(module)}` : `${ibiz.env.pluginBaseUrl}/${pluginPath}/${pathBrowserify.join(module)}`;
210
- } else {
211
- scriptUrl = pathBrowserify.join(pluginPath, system);
212
- }
254
+ scriptUrl = pathBrowserify.join(pluginPath, system);
213
255
  if (scriptUrl) {
214
256
  if (this.cache.has(scriptUrl)) {
215
257
  return;
@@ -219,27 +261,16 @@ class PluginFactory {
219
261
  const styleUrls = (typeof styles === "string" ? [styles] : styles).map(
220
262
  (styleUrl) => this.parseUrl(path.join(pluginPath, styleUrl))
221
263
  );
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) {
227
- data = await import(
228
- /* @vite-ignore */
229
- scriptUrl
230
- );
231
- } else {
232
- System.addImportMap({
233
- imports: {
234
- [name]: url
235
- },
236
- styles: {
237
- [name]: styleUrls
238
- }
239
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
240
- });
241
- data = await System.import(name);
242
- }
264
+ System.addImportMap({
265
+ imports: {
266
+ [name]: url
267
+ },
268
+ styles: {
269
+ [name]: styleUrls
270
+ }
271
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
272
+ });
273
+ data = await System.import(name);
243
274
  if (data) {
244
275
  if (data.default) {
245
276
  this.setPluginCode(data.default);
package/lib/index.cjs CHANGED
@@ -45,12 +45,16 @@ var index$8 = require('./panel-component/grid-container/index.cjs');
45
45
  var panelContainerImage_state = require('./panel-component/panel-container-image/panel-container-image.state.cjs');
46
46
  var panelContainerImage_controller = require('./panel-component/panel-container-image/panel-container-image.controller.cjs');
47
47
  var index$9 = require('./panel-component/panel-container-image/index.cjs');
48
+ var panelContainerGroup_state = require('./panel-component/panel-container-group/panel-container-group.state.cjs');
49
+ var panelContainerGroup_controller = require('./panel-component/panel-container-group/panel-container-group.controller.cjs');
50
+ var index$a = require('./panel-component/panel-container-group/index.cjs');
51
+ var index$b = require('./panel-component/panel-tab-page/index.cjs');
48
52
  var appRedirectView = require('./view/app-redirect-view/app-redirect-view.cjs');
49
- var index$a = require('./view/common/index.cjs');
53
+ var index$c = require('./view/common/index.cjs');
50
54
  var todoRedirect = require('./view/todo-redirect/todo-redirect.cjs');
51
- var index$b = require('./view/portal-view/index.cjs');
52
- var index$c = require('./control/panel/view-layout-panel/index.cjs');
53
- var index$d = require('./control/panel/panel/index.cjs');
55
+ var index$d = require('./view/portal-view/index.cjs');
56
+ var index$e = require('./control/panel/view-layout-panel/index.cjs');
57
+ var index$f = require('./control/panel/panel/index.cjs');
54
58
  var pluginFactory = require('./plugin/plugin-factory/plugin-factory.cjs');
55
59
  var clickOutside = require('./use/click-outside/click-outside.cjs');
56
60
  var useControlController = require('./use/control/use-control-controller/use-control-controller.cjs');
@@ -58,7 +62,7 @@ var event = require('./use/event/event.cjs');
58
62
  var focusBlur = require('./use/focus-blur/focus-blur.cjs');
59
63
  var namespace = require('./use/namespace/namespace.cjs');
60
64
  var route = require('./use/route/route.cjs');
61
- var index$e = require('./use/util/index.cjs');
65
+ var index$g = require('./use/util/index.cjs');
62
66
  var useViewController = require('./use/view/use-view-controller/use-view-controller.cjs');
63
67
  var vue = require('./use/vue/vue.cjs');
64
68
  var overlayContainer = require('./util/overlay-container/overlay-container.cjs');
@@ -72,7 +76,7 @@ var render = require('./util/render/render.cjs');
72
76
  var overlayViewUtil = require('./util/overlay-view-util/overlay-view-util.cjs');
73
77
  var appStore = require('./util/store/app-store/app-store.cjs');
74
78
  var uiStore = require('./util/store/ui-store/ui-store.cjs');
75
- var index$f = require('./util/store/index.cjs');
79
+ var index$h = require('./util/store/index.cjs');
76
80
  var common = require('./props/common.cjs');
77
81
  var textBox = require('./props/editor/text-box.cjs');
78
82
  var span = require('./props/editor/span.cjs');
@@ -138,12 +142,16 @@ exports.IBizGridContainer = index$8.IBizGridContainer;
138
142
  exports.PanelContainerImageState = panelContainerImage_state.PanelContainerImageState;
139
143
  exports.PanelContainerImageController = panelContainerImage_controller.PanelContainerImageController;
140
144
  exports.IBizPanelContainerImage = index$9.IBizPanelContainerImage;
145
+ exports.PanelContainerGroupState = panelContainerGroup_state.PanelContainerGroupState;
146
+ exports.PanelContainerGroupController = panelContainerGroup_controller.PanelContainerGroupController;
147
+ exports.IBizPanelContainerGroup = index$a.IBizPanelContainerGroup;
148
+ exports.IBizPanelTabPage = index$b.IBizPanelTabPage;
141
149
  exports.AppRedirectView = appRedirectView.AppRedirectView;
142
- exports.IBizView = index$a.IBizView;
150
+ exports.IBizView = index$c.IBizView;
143
151
  exports.TodoRedirect = todoRedirect.TodoRedirect;
144
- exports.IBizPortalView = index$b.IBizPortalView;
145
- exports.IBizViewLayoutPanelControl = index$c.IBizViewLayoutPanelControl;
146
- exports.IBizPanelControl = index$d.IBizPanelControl;
152
+ exports.IBizPortalView = index$d.IBizPortalView;
153
+ exports.IBizViewLayoutPanelControl = index$e.IBizViewLayoutPanelControl;
154
+ exports.IBizPanelControl = index$f.IBizPanelControl;
147
155
  exports.PluginFactory = pluginFactory.PluginFactory;
148
156
  exports.useClickOutside = clickOutside.useClickOutside;
149
157
  exports.useControlController = useControlController.useControlController;
@@ -152,8 +160,8 @@ exports.useFocusAndBlur = focusBlur.useFocusAndBlur;
152
160
  exports.useNamespace = namespace.useNamespace;
153
161
  exports.useRouteKey = route.useRouteKey;
154
162
  exports.useRouterQuery = route.useRouterQuery;
155
- exports.useCtx = index$e.useCtx;
156
- exports.useMobCtx = index$e.useMobCtx;
163
+ exports.useCtx = index$g.useCtx;
164
+ exports.useMobCtx = index$g.useMobCtx;
157
165
  exports.useViewController = useViewController.useViewController;
158
166
  exports.EmptyVNode = vue.EmptyVNode;
159
167
  exports.getOrigin = vue.getOrigin;
@@ -187,7 +195,7 @@ exports.openViewModal = overlayViewUtil.openViewModal;
187
195
  exports.openViewPopover = overlayViewUtil.openViewPopover;
188
196
  exports.useAppStore = appStore.useAppStore;
189
197
  exports.useUIStore = uiStore.useUIStore;
190
- exports.piniaInstance = index$f.piniaInstance;
198
+ exports.piniaInstance = index$h.piniaInstance;
191
199
  exports.RequiredProp = common.RequiredProp;
192
200
  exports.getGridInputIpProps = textBox.getGridInputIpProps;
193
201
  exports.getGridInputNumberProps = textBox.getGridInputNumberProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/vue3-util",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "vue3 工具包",
5
5
  "type": "module",
6
6
  "module": "es/index.mjs",
@@ -31,10 +31,10 @@
31
31
  "license": "MIT",
32
32
  "devDependencies": {
33
33
  "@ibiz-template/cli": "0.3.2",
34
- "@ibiz-template/core": "^0.4.0",
35
- "@ibiz-template/runtime": "^0.4.3",
34
+ "@ibiz-template/core": "^0.4.5",
35
+ "@ibiz-template/runtime": "^0.4.5",
36
36
  "@ibiz-template/theme": "^0.4.0",
37
- "@ibiz/model-core": "^0.0.22",
37
+ "@ibiz/model-core": "^0.0.24",
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.24",
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": "ed51e5098f87bc6805cf39d4edc6aec1c2bbf7d0"
64
+ "gitHead": "28b2af793771fa7be9fac2e1c8396081f4002230"
65
65
  }
@@ -8,3 +8,5 @@ export * from './multi-data-container';
8
8
  export * from './single-data-container';
9
9
  export * from './grid-container';
10
10
  export * from './panel-container-image';
11
+ export * from './panel-container-group';
12
+ export * from './panel-tab-page';
@@ -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
  /**
@@ -0,0 +1,22 @@
1
+ import { App } from 'vue';
2
+ import { registerPanelItemProvider } from '@ibiz-template/runtime';
3
+ import { PanelContainerGroupState } from './panel-container-group.state';
4
+ import { PanelContainerGroupProvider } from './panel-container-group.provider';
5
+ import { PanelContainerGroupController } from './panel-container-group.controller';
6
+ import { PanelContainerGroup } from './panel-container-group';
7
+ import { withInstall } from '../../util';
8
+
9
+ export { PanelContainerGroupState, PanelContainerGroupController };
10
+
11
+ export const IBizPanelContainerGroup = withInstall(
12
+ PanelContainerGroup,
13
+ function (v: App) {
14
+ v.component(PanelContainerGroup.name, PanelContainerGroup);
15
+ registerPanelItemProvider(
16
+ 'CONTAINER_CONTAINER_GROUP',
17
+ () => new PanelContainerGroupProvider(),
18
+ );
19
+ },
20
+ );
21
+
22
+ export default IBizPanelContainerGroup;
@@ -0,0 +1,43 @@
1
+ import { PanelItemController } from '@ibiz-template/runtime';
2
+ import { IPanelContainer } from '@ibiz/model-core';
3
+ import { PanelContainerGroupState } from './panel-container-group.state';
4
+
5
+ /**
6
+ * 面板分组容器控制器
7
+ *
8
+ * @export
9
+ * @class PanelContainerGroupController
10
+ * @extends {PanelItemController}
11
+ */
12
+ export class PanelContainerGroupController extends PanelItemController<IPanelContainer> {
13
+ declare state: PanelContainerGroupState;
14
+
15
+ protected createState(): PanelContainerGroupState {
16
+ return new PanelContainerGroupState(this.parent?.state);
17
+ }
18
+
19
+ /**
20
+ * 禁用关闭
21
+ *
22
+ * @author chitanda
23
+ * @date 2022-09-14 14:09:51
24
+ * @readonly
25
+ * @type {boolean}
26
+ */
27
+ get disableClose(): boolean {
28
+ const { titleBarCloseMode: mode } = this.model;
29
+ return mode === 0 || mode === undefined;
30
+ }
31
+
32
+ /**
33
+ * 是否默认展开分组
34
+ *
35
+ * @author chitanda
36
+ * @date 2022-09-14 14:09:09
37
+ * @readonly
38
+ */
39
+ get defaultExpansion(): boolean {
40
+ const { titleBarCloseMode: mode } = this.model;
41
+ return this.disableClose || mode === 1;
42
+ }
43
+ }
@@ -0,0 +1,30 @@
1
+ import {
2
+ IPanelItemProvider,
3
+ PanelController,
4
+ PanelItemController,
5
+ } from '@ibiz-template/runtime';
6
+ import { IPanelContainer } from '@ibiz/model-core';
7
+ import { PanelContainerGroupController } from './panel-container-group.controller';
8
+
9
+ /**
10
+ * 面板分组容器适配器
11
+ *
12
+ * @author lxm
13
+ * @date 2022-09-19 22:09:03
14
+ * @export
15
+ * @class PanelContainerGroupProvider
16
+ * @implements {EditorProvider}
17
+ */
18
+ export class PanelContainerGroupProvider implements IPanelItemProvider {
19
+ component: string = 'IBizPanelContainerGroup';
20
+
21
+ async createController(
22
+ panelItem: IPanelContainer,
23
+ panel: PanelController,
24
+ parent: PanelItemController | undefined,
25
+ ): Promise<PanelItemController> {
26
+ const c = new PanelContainerGroupController(panelItem, panel, parent);
27
+ await c.init();
28
+ return c;
29
+ }
30
+ }
@@ -0,0 +1,91 @@
1
+ $panel-container-group: (
2
+ 'bg-color': transparent,
3
+ );
4
+
5
+ $panel-container-group-header: (
6
+ 'bg-color': transparent,
7
+ 'padding': getCssVar(spacing, base, tight),
8
+ 'border-color': getCssVar('color', 'border'),
9
+ 'height': 49px,
10
+ );
11
+
12
+ $panel-container-group-caption: (
13
+ 'text-color': getCssVar(color, text, 0),
14
+ 'font-size': getCssVar('font-size', 'header-5'),
15
+ 'font-weight': getCssVar(font-weight, bold),
16
+ );
17
+
18
+ $panel-container-group-content: (
19
+ 'bg-color': transparent,
20
+ 'padding': getCssVar(spacing, tight),
21
+ );
22
+
23
+ @include b(panel-container-group) {
24
+ @include set-component-css-var('panel-container-group', $panel-container-group);
25
+ @include set-component-css-var('panel-container-group-header', $panel-container-group-header);
26
+ @include set-component-css-var('panel-container-group-caption', $panel-container-group-caption);
27
+ @include set-component-css-var('panel-container-group-content', $panel-container-group-content);
28
+ }
29
+
30
+ @include b(panel-container-group) {
31
+ height: 100%;
32
+ background-color: getCssVar('panel-container-group', 'bg-color');
33
+ border-radius: getCssVar('border-radius', 'base');
34
+
35
+ @include e(caption) {
36
+ @include utils-ellipsis;
37
+
38
+ font-size: getCssVar('panel-container-group-caption', 'font-size');
39
+ font-weight: getCssVar('panel-container-group-caption', 'font-weight');
40
+ color: getCssVar('panel-container-group-caption', 'text-color');
41
+ }
42
+ }
43
+
44
+ // 折叠相关样式
45
+ @include b(panel-container-group-collapse) {
46
+ > .#{bem(panel-container-group-content)} {
47
+ display: block;
48
+ }
49
+
50
+ @include when(collapse) {
51
+ > .#{bem(panel-container-group-content)} {
52
+ display: none;
53
+ }
54
+ }
55
+ }
56
+
57
+ @include b(panel-container-group-header) {
58
+ @include flex;
59
+
60
+ height: getCssVar('panel-container-group-header', 'height');
61
+ padding: getCssVar('panel-container-group-header', 'padding');
62
+ margin: getCssVar('panel-container-group-header', 'margin');
63
+ border-bottom: 1px solid getCssVar('panel-container-group-header', 'border-color');
64
+
65
+ @include e((left, right)) {
66
+ display: inline-block;
67
+ width: 50%;
68
+ }
69
+
70
+ @include e(right) {
71
+ text-align: right;
72
+ @include flex(row, flex-end, center);
73
+ }
74
+ }
75
+
76
+ @include b(panel-container-group-content) {
77
+ width: 100%;
78
+ height: 100%;
79
+ @include e(row){
80
+ width: 100%;
81
+ height: 100%;
82
+ }
83
+ }
84
+
85
+ .#{bem('panel-container-group', '', 'show-header')} {
86
+ > .#{bem('panel-container-group-content')} {
87
+ height: calc(100% - getCssVar('panel-container-group-header', 'height'));
88
+ padding: getCssVar('panel-container-group-content', 'padding');
89
+ background-color: getCssVar('panel-container-group-content', 'bg-color');
90
+ }
91
+ }
@@ -0,0 +1,12 @@
1
+ import { PanelItemState } from '@ibiz-template/runtime';
2
+
3
+ /**
4
+ * 面板分组容器状态
5
+ *
6
+ * @author lxm
7
+ * @date 2023-02-07 06:04:27
8
+ * @export
9
+ * @class PanelContainerGroupState
10
+ * @extends {PanelItemState}
11
+ */
12
+ export class PanelContainerGroupState extends PanelItemState {}