@ibiz-template/vue3-components 0.6.1-alpha.3 → 0.6.2-dev.0

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 (52) hide show
  1. package/dist/index-NdPkOMvL.js +4 -0
  2. package/dist/index.min.css +1 -1
  3. package/dist/index.system.min.js +1 -1
  4. package/dist/{xlsx-util-E-30JfqY.js → xlsx-util-HHwgsM7j.js} +1 -1
  5. package/es/common/no-data/no-data.css +1 -1
  6. package/es/control/dashboard/custom-dashboard-container/custom-dashboard-container.d.ts +3 -0
  7. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-repeater/repeater-grid/repeater-grid.d.ts +25 -0
  8. package/es/control/gantt/gantt.d.ts +1 -1
  9. package/es/control/gantt/index.d.ts +1 -1
  10. package/es/control/grid/grid/grid.css +1 -1
  11. package/es/control/grid/grid/grid.mjs +2 -2
  12. package/es/control/tab-exp-panel/tab-exp-panel.mjs +1 -1
  13. package/es/index.mjs +1 -0
  14. package/es/panel-component/index-actions/index-actions.css +1 -1
  15. package/es/panel-component/panel-index-view-search/panel-index-view-search.mjs +2 -9
  16. package/es/util/open-view-util/open-view-util.d.ts +1 -1
  17. package/es/util/open-view-util/open-view-util.mjs +6 -2
  18. package/es/view/login-view/login-view.mjs +3 -3
  19. package/es/web-app/components/modal-router-shell/modal-router-shell.mjs +4 -2
  20. package/es/web-app/components/router-shell/router-shell.d.ts +8 -3999
  21. package/es/web-app/components/router-shell/router-shell.mjs +4 -4
  22. package/es/web-app/guard/auth-guard/auth-guard.d.ts +88 -9
  23. package/es/web-app/guard/auth-guard/auth-guard.mjs +183 -134
  24. package/es/web-app/guard/auth-guard/dyna-auth-guard.d.ts +6 -0
  25. package/es/web-app/guard/auth-guard/dyna-auth-guard.mjs +67 -0
  26. package/es/web-app/guard/index.d.ts +1 -0
  27. package/es/web-app/guard/index.mjs +1 -0
  28. package/es/web-app/index.d.ts +1 -0
  29. package/es/web-app/index.mjs +2 -0
  30. package/es/web-app/main.d.ts +4 -1
  31. package/es/web-app/main.mjs +10 -1
  32. package/es/web-app/router/index.d.ts +2 -0
  33. package/es/web-app/router/index.mjs +7 -5
  34. package/lib/common/no-data/no-data.css +1 -1
  35. package/lib/control/grid/grid/grid.cjs +2 -2
  36. package/lib/control/grid/grid/grid.css +1 -1
  37. package/lib/control/tab-exp-panel/tab-exp-panel.cjs +1 -1
  38. package/lib/index.cjs +2 -0
  39. package/lib/panel-component/index-actions/index-actions.css +1 -1
  40. package/lib/panel-component/panel-index-view-search/panel-index-view-search.cjs +2 -9
  41. package/lib/util/open-view-util/open-view-util.cjs +6 -2
  42. package/lib/view/login-view/login-view.cjs +3 -3
  43. package/lib/web-app/components/modal-router-shell/modal-router-shell.cjs +4 -2
  44. package/lib/web-app/components/router-shell/router-shell.cjs +4 -4
  45. package/lib/web-app/guard/auth-guard/auth-guard.cjs +182 -133
  46. package/lib/web-app/guard/auth-guard/dyna-auth-guard.cjs +69 -0
  47. package/lib/web-app/guard/index.cjs +2 -0
  48. package/lib/web-app/index.cjs +3 -0
  49. package/lib/web-app/main.cjs +10 -1
  50. package/lib/web-app/router/index.cjs +7 -5
  51. package/package.json +6 -6
  52. package/dist/index-_HUj1AMZ.js +0 -4
@@ -81,22 +81,22 @@ const RouterShell = /* @__PURE__ */ defineComponent({
81
81
  context,
82
82
  params,
83
83
  srfnav,
84
- viewModel
84
+ viewConfig
85
85
  } = this.viewData;
86
86
  const props = mergeDeepLeft({
87
87
  ...this.$props,
88
88
  ...this.$attrs,
89
89
  context,
90
90
  params,
91
- modelData: viewModel,
92
- key: viewModel.codeName
91
+ viewId: viewConfig.id,
92
+ key: viewConfig.codeName
93
93
  }, {
94
94
  state: {
95
95
  srfnav
96
96
  }
97
97
  });
98
98
  return createVNode(Fragment, null, [h(resolveComponent("IBizViewShell"), props, this.$slots), this.isActivated && createVNode(resolveComponent("router-view"), {
99
- "key": viewModel.codeName,
99
+ "key": viewConfig.codeName,
100
100
  "name": RouteConst.ROUTE_MODAL_TAG,
101
101
  "modal": this.routeModal
102
102
  }, null)]);
@@ -1,9 +1,88 @@
1
- /**
2
- * 应用权限守卫
3
- *
4
- * @author chitanda
5
- * @date 2022-10-28 10:10:29
6
- * @export
7
- * @return {*} {Promise<boolean>}
8
- */
9
- export declare function AuthGuard(notLogin?: boolean): Promise<boolean>;
1
+ import { IApplication } from '@ibiz/model-core';
2
+ import { ModelLoaderProvider } from '@ibiz-template/runtime';
3
+ export declare class AuthGuard {
4
+ /**
5
+ * 是否是全代码模式
6
+ * @author lxm
7
+ * @date 2024-02-21 11:16:08
8
+ * @type {boolean}
9
+ */
10
+ isFullCode: boolean;
11
+ /**
12
+ * 自定义模型加载
13
+ * @author lxm
14
+ * @date 2024-02-21 11:16:17
15
+ * @type {ModelLoaderProvider}
16
+ */
17
+ customModelLoader?: ModelLoaderProvider;
18
+ constructor(opts?: {
19
+ isFullCode: boolean;
20
+ customModelLoader: ModelLoaderProvider;
21
+ });
22
+ /**
23
+ * 总的入口校验
24
+ * @author lxm
25
+ * @date 2024-02-21 10:43:55
26
+ * @param {boolean} notLogin
27
+ * @return {*} {Promise<boolean>}
28
+ */
29
+ verify(notLogin?: boolean): Promise<boolean>;
30
+ /**
31
+ * 匿名登录相关校验逻辑,不通过会抛异常
32
+ * @author lxm
33
+ * @date 2024-01-03 07:29:30
34
+ * @return {*} {Promise<void>}
35
+ */
36
+ anonymousValidate(): Promise<void>;
37
+ /**
38
+ * 应用参数初始化
39
+ *
40
+ * @author chitanda
41
+ * @date 2022-07-20 19:07:54
42
+ * @return {*} {Promise<void>}
43
+ */
44
+ appInit(): Promise<void>;
45
+ /**
46
+ * 初始化模型
47
+ * @author lxm
48
+ * @date 2024-02-21 10:48:36
49
+ * @param {boolean} [permission=true]
50
+ * @return {*} {Promise<void>}
51
+ */
52
+ initModel(_permission?: boolean): Promise<void>;
53
+ /**
54
+ * 加载应用数据
55
+ *
56
+ * @author chitanda
57
+ * @date 2022-07-20 20:07:50
58
+ * @return {*} {Promise<void>}
59
+ */
60
+ loadAppData(): Promise<void>;
61
+ /**
62
+ * 加载组织数据
63
+ *
64
+ * @author chitanda
65
+ * @date 2022-07-20 20:07:44
66
+ * @return {*} {Promise<void>}
67
+ */
68
+ loadOrgData(): Promise<void>;
69
+ initTheme(appModel: IApplication): Promise<void>;
70
+ /**
71
+ * 加载主题插件
72
+ *
73
+ * @author chitanda
74
+ * @date 2023-12-03 01:12:38
75
+ * @protected
76
+ * @return {*} {Promise<void>}
77
+ */
78
+ loadTheme(): Promise<void>;
79
+ /**
80
+ * 根据应用自定义参数解析成环境变量
81
+ *
82
+ * @author chitanda
83
+ * @date 2023-11-24 19:11:50
84
+ * @return {*} {Promise<void>}
85
+ */
86
+ initEnvironment(app: IApplication): Promise<void>;
87
+ throw401(): void;
88
+ }
@@ -1,37 +1,187 @@
1
- import { HttpError, RuntimeError } from '@ibiz-template/core';
2
- import { ModelHelper } from '@ibiz-template/model-helper';
1
+ import { RuntimeError, HttpError } from '@ibiz-template/core';
3
2
  import { mergeDeepRight } from 'ramda';
4
3
  import { AppHooks } from '@ibiz-template/vue3-util';
5
- import { i18n } from '../../../locale/index.mjs';
6
4
 
7
5
  "use strict";
8
- async function loadAppData() {
9
- const res = await ibiz.net.get("/appdata");
10
- if (res.ok) {
11
- ibiz.appData = res.data;
6
+ var __defProp = Object.defineProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __publicField = (obj, key, value) => {
9
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
10
+ return value;
11
+ };
12
+ class AuthGuard {
13
+ constructor(opts) {
14
+ /**
15
+ * 是否是全代码模式
16
+ * @author lxm
17
+ * @date 2024-02-21 11:16:08
18
+ * @type {boolean}
19
+ */
20
+ __publicField(this, "isFullCode", false);
21
+ /**
22
+ * 自定义模型加载
23
+ * @author lxm
24
+ * @date 2024-02-21 11:16:17
25
+ * @type {ModelLoaderProvider}
26
+ */
27
+ __publicField(this, "customModelLoader");
28
+ this.isFullCode = (opts == null ? void 0 : opts.isFullCode) || false;
29
+ this.customModelLoader = (opts == null ? void 0 : opts.customModelLoader) || void 0;
30
+ if (this.customModelLoader) {
31
+ ibiz.hub.registerModelLoaderProvider(this.customModelLoader);
32
+ }
12
33
  }
13
- }
14
- async function loadOrgData() {
15
- const res = await ibiz.net.get("/uaa/getbydcsystem/".concat(ibiz.env.dcSystem));
16
- if (res.ok) {
17
- const orgDataItems = res.data;
18
- if (orgDataItems) {
19
- const [data] = orgDataItems;
20
- ibiz.orgData = data;
34
+ /**
35
+ * 总的入口校验
36
+ * @author lxm
37
+ * @date 2024-02-21 10:43:55
38
+ * @param {boolean} notLogin
39
+ * @return {*} {Promise<boolean>}
40
+ */
41
+ async verify(notLogin = true) {
42
+ if (notLogin) {
43
+ let result = true;
44
+ try {
45
+ if (ibiz.env.enableAnonymous) {
46
+ await this.anonymousValidate();
47
+ }
48
+ await this.appInit();
49
+ } catch (error) {
50
+ result = false;
51
+ ibiz.util.error.handle(error);
52
+ }
53
+ return result;
21
54
  }
55
+ await this.initModel(false);
56
+ return true;
22
57
  }
23
- }
24
- async function loadTheme() {
25
- const app = ibiz.hub.getApp();
26
- const uiThemes = app.model.appUIThemes || [];
27
- if (uiThemes.length > 0) {
28
- const theme = uiThemes[0];
29
- await ibiz.util.theme.loadTheme(theme);
58
+ /**
59
+ * 匿名登录相关校验逻辑,不通过会抛异常
60
+ * @author lxm
61
+ * @date 2024-01-03 07:29:30
62
+ * @return {*} {Promise<void>}
63
+ */
64
+ async anonymousValidate() {
65
+ const authInfo = ibiz.auth.getAuthInfo();
66
+ if (authInfo && !authInfo.isAnonymous) {
67
+ return;
68
+ }
69
+ await this.initModel(false);
70
+ const urlPaths = window.location.hash.split("/");
71
+ const viewName = urlPaths[urlPaths.length - 2];
72
+ let viewModel;
73
+ if (viewName !== "#") {
74
+ try {
75
+ viewModel = await ibiz.hub.getAppView(viewName);
76
+ } catch (error) {
77
+ ibiz.log.error(error);
78
+ }
79
+ }
80
+ if (!viewModel) {
81
+ ibiz.log.error(
82
+ "\u627E\u4E0D\u5230\u89C6\u56FE\u6A21\u578B".concat(viewName, ",\u8BF7\u786E\u4FDD\u8BE5\u89C6\u56FE\u914D\u7F6E\u4E86\u533F\u540D\u8BBF\u95EE\u548C\u7528\u6237\u5F15\u7528")
83
+ );
84
+ this.throw401();
85
+ return;
86
+ }
87
+ if (viewModel.accUserMode !== 3) {
88
+ this.throw401();
89
+ }
90
+ if (!authInfo) {
91
+ const loginResult = await ibiz.auth.anonymousLogin();
92
+ if (!loginResult) {
93
+ throw new RuntimeError("\u533F\u540D\u7528\u6237\u767B\u5F55\u5931\u8D25");
94
+ }
95
+ }
30
96
  }
31
- }
32
- async function initEnvironment(helper) {
33
- if (helper) {
34
- const app = await helper.getAppModel();
97
+ /**
98
+ * 应用参数初始化
99
+ *
100
+ * @author chitanda
101
+ * @date 2022-07-20 19:07:54
102
+ * @return {*} {Promise<void>}
103
+ */
104
+ async appInit() {
105
+ if (ibiz.env.isSaaSMode === true) {
106
+ await this.loadOrgData();
107
+ }
108
+ await this.loadAppData();
109
+ await this.initModel();
110
+ await ibiz.auth.extendLogin();
111
+ await ibiz.hub.notice.init();
112
+ }
113
+ /**
114
+ * 初始化模型
115
+ * @author lxm
116
+ * @date 2024-02-21 10:48:36
117
+ * @param {boolean} [permission=true]
118
+ * @return {*} {Promise<void>}
119
+ */
120
+ async initModel(_permission = true) {
121
+ }
122
+ /**
123
+ * 加载应用数据
124
+ *
125
+ * @author chitanda
126
+ * @date 2022-07-20 20:07:50
127
+ * @return {*} {Promise<void>}
128
+ */
129
+ async loadAppData() {
130
+ const res = await ibiz.net.get("/appdata");
131
+ if (res.ok) {
132
+ ibiz.appData = res.data;
133
+ }
134
+ }
135
+ /**
136
+ * 加载组织数据
137
+ *
138
+ * @author chitanda
139
+ * @date 2022-07-20 20:07:44
140
+ * @return {*} {Promise<void>}
141
+ */
142
+ async loadOrgData() {
143
+ const res = await ibiz.net.get("/uaa/getbydcsystem/".concat(ibiz.env.dcSystem));
144
+ if (res.ok) {
145
+ const orgDataItems = res.data;
146
+ if (orgDataItems) {
147
+ const [data] = orgDataItems;
148
+ ibiz.orgData = data;
149
+ }
150
+ }
151
+ }
152
+ async initTheme(appModel) {
153
+ if (!appModel.appUIThemes) {
154
+ const module = await import('@ibiz-template/web-theme');
155
+ const theme = module.default || module;
156
+ AppHooks.useComponent.callSync(null, theme);
157
+ } else {
158
+ await this.loadTheme();
159
+ }
160
+ }
161
+ /**
162
+ * 加载主题插件
163
+ *
164
+ * @author chitanda
165
+ * @date 2023-12-03 01:12:38
166
+ * @protected
167
+ * @return {*} {Promise<void>}
168
+ */
169
+ async loadTheme() {
170
+ const app = ibiz.hub.getApp();
171
+ const uiThemes = app.model.appUIThemes || [];
172
+ if (uiThemes.length > 0) {
173
+ const theme = uiThemes[0];
174
+ await ibiz.util.theme.loadTheme(theme);
175
+ }
176
+ }
177
+ /**
178
+ * 根据应用自定义参数解析成环境变量
179
+ *
180
+ * @author chitanda
181
+ * @date 2023-11-24 19:11:50
182
+ * @return {*} {Promise<void>}
183
+ */
184
+ async initEnvironment(app) {
35
185
  const userParam = app.userParam;
36
186
  if (userParam) {
37
187
  Object.keys(userParam).forEach((key) => {
@@ -54,116 +204,15 @@ async function initEnvironment(helper) {
54
204
  ibiz.log.setLevel(ibiz.env.logLevel);
55
205
  }
56
206
  }
57
- }
58
- let hasModelInit = false;
59
- let noPermissionModel = false;
60
- async function initModel(permission = true) {
61
- if (!hasModelInit || hasModelInit && noPermissionModel !== permission) {
62
- ibiz.hub.reset();
63
- const helper = new ModelHelper(
64
- async (url, params) => {
65
- const res = await ibiz.net.get(
66
- "".concat(ibiz.env.remoteModelUrl).concat(url),
67
- params,
68
- permission ? {} : { srfdcsystem: ibiz.env.dcSystem }
69
- );
70
- return res.data;
71
- },
72
- ibiz.env.appId,
73
- permission
74
- );
75
- await initEnvironment(helper);
76
- const app = await ibiz.hub.getAppAsync(ibiz.env.appId);
77
- const appModel = app.model;
78
- ibiz.env.isMob = appModel.mobileApp === true;
79
- if (ibiz.env.isEnableMultiLan) {
80
- const lang = ibiz.i18n.getLang();
81
- const m = await helper.getPSAppLang(lang.replace("-", "_").toUpperCase());
82
- const items = m.languageItems || [];
83
- const data = {};
84
- items.forEach((item) => {
85
- data[item.lanResTag] = item.content;
86
- });
87
- i18n.global.mergeLocaleMessage(lang, data);
88
- }
89
- if (!appModel.appUIThemes) {
90
- const module = await import('@ibiz-template/web-theme');
91
- const theme = module.default || module;
92
- AppHooks.useComponent.callSync(null, theme);
93
- } else {
94
- await loadTheme();
95
- }
96
- }
97
- noPermissionModel = permission;
98
- hasModelInit = true;
99
- }
100
- async function appInit() {
101
- if (ibiz.env.isSaaSMode === true) {
102
- await loadOrgData();
103
- }
104
- await loadAppData();
105
- await initModel();
106
- await ibiz.auth.extendLogin();
107
- await ibiz.hub.notice.init();
108
- }
109
- function throw401() {
110
- throw new HttpError({
111
- response: {
112
- status: 401,
113
- statusText: "\u65E0\u6743\u9650\u8BBF\u95EE\uFF01"
114
- }
115
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
116
- });
117
- }
118
- async function anonymousValidate() {
119
- const authInfo = ibiz.auth.getAuthInfo();
120
- if (authInfo && !authInfo.isAnonymous) {
121
- return;
122
- }
123
- await initModel(false);
124
- const urlPaths = window.location.hash.split("/");
125
- const viewName = urlPaths[urlPaths.length - 2];
126
- let viewModel;
127
- if (viewName !== "#") {
128
- try {
129
- viewModel = await ibiz.hub.getAppView(viewName);
130
- } catch (error) {
131
- ibiz.log.error(error);
132
- }
133
- }
134
- if (!viewModel) {
135
- ibiz.log.error(
136
- "\u627E\u4E0D\u5230\u89C6\u56FE\u6A21\u578B".concat(viewName, ",\u8BF7\u786E\u4FDD\u8BE5\u89C6\u56FE\u914D\u7F6E\u4E86\u533F\u540D\u8BBF\u95EE\u548C\u7528\u6237\u5F15\u7528")
137
- );
138
- throw401();
139
- return;
140
- }
141
- if (viewModel.accUserMode !== 3) {
142
- throw401();
143
- }
144
- if (!authInfo) {
145
- const loginResult = await ibiz.auth.anonymousLogin();
146
- if (!loginResult) {
147
- throw new RuntimeError("\u533F\u540D\u7528\u6237\u767B\u5F55\u5931\u8D25");
148
- }
149
- }
150
- }
151
- async function AuthGuard(notLogin = true) {
152
- if (notLogin) {
153
- let result = true;
154
- try {
155
- if (ibiz.env.enableAnonymous) {
156
- await anonymousValidate();
207
+ throw401() {
208
+ throw new HttpError({
209
+ response: {
210
+ status: 401,
211
+ statusText: "\u65E0\u6743\u9650\u8BBF\u95EE\uFF01"
157
212
  }
158
- await appInit();
159
- } catch (error) {
160
- result = false;
161
- ibiz.util.error.handle(error);
162
- }
163
- return result;
213
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
214
+ });
164
215
  }
165
- await initModel(false);
166
- return true;
167
216
  }
168
217
 
169
218
  export { AuthGuard };
@@ -0,0 +1,6 @@
1
+ import { AuthGuard } from './auth-guard';
2
+ export declare class DynaAuthGuard extends AuthGuard {
3
+ hasModelInit: boolean;
4
+ noPermissionModel: boolean;
5
+ initModel(permission?: boolean): Promise<void>;
6
+ }
@@ -0,0 +1,67 @@
1
+ import { ModelHelper } from '@ibiz-template/model-helper';
2
+ import { AppHooks } from '@ibiz-template/vue3-util';
3
+ import { AuthGuard } from './auth-guard.mjs';
4
+ import { i18n } from '../../../locale/index.mjs';
5
+
6
+ "use strict";
7
+ var __defProp = Object.defineProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __publicField = (obj, key, value) => {
10
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
11
+ return value;
12
+ };
13
+ class DynaAuthGuard extends AuthGuard {
14
+ constructor() {
15
+ super(...arguments);
16
+ __publicField(this, "hasModelInit", false);
17
+ __publicField(this, "noPermissionModel", false);
18
+ }
19
+ async initModel(permission = true) {
20
+ if (!this.hasModelInit || this.hasModelInit && this.noPermissionModel !== permission) {
21
+ ibiz.hub.reset();
22
+ const helper = new ModelHelper(
23
+ async (url, params) => {
24
+ const res = await ibiz.net.get(
25
+ "".concat(ibiz.env.remoteModelUrl).concat(url),
26
+ params,
27
+ permission ? {} : { srfdcsystem: ibiz.env.dcSystem }
28
+ );
29
+ return res.data;
30
+ },
31
+ ibiz.env.appId,
32
+ permission
33
+ );
34
+ const tempApp = await helper.getAppModel();
35
+ await this.initEnvironment(tempApp);
36
+ const app = await ibiz.hub.getAppAsync(ibiz.env.appId);
37
+ const appModel = app.model;
38
+ ibiz.env.isMob = appModel.mobileApp === true;
39
+ if (ibiz.env.isEnableMultiLan) {
40
+ const lang = ibiz.i18n.getLang();
41
+ const m = await helper.getPSAppLang(
42
+ lang.replace("-", "_").toUpperCase()
43
+ );
44
+ const items = m.languageItems || [];
45
+ const data = {};
46
+ items.forEach((item) => {
47
+ data[item.lanResTag] = item.content;
48
+ });
49
+ i18n.global.mergeLocaleMessage(lang, data);
50
+ }
51
+ if (!appModel.appUIThemes) {
52
+ const module = await import('@ibiz-template/web-theme');
53
+ const theme = module.default || module;
54
+ AppHooks.useComponent.callSync(null, theme);
55
+ } else {
56
+ await this.loadTheme();
57
+ }
58
+ if (app.model.title) {
59
+ ibiz.util.setBrowserTitle("");
60
+ }
61
+ }
62
+ this.noPermissionModel = permission;
63
+ this.hasModelInit = true;
64
+ }
65
+ }
66
+
67
+ export { DynaAuthGuard };
@@ -1 +1,2 @@
1
1
  export { AuthGuard } from './auth-guard/auth-guard';
2
+ export { DynaAuthGuard } from './auth-guard/dyna-auth-guard';
@@ -1,3 +1,4 @@
1
1
  export { AuthGuard } from './auth-guard/auth-guard.mjs';
2
+ export { DynaAuthGuard } from './auth-guard/dyna-auth-guard.mjs';
2
3
 
3
4
  "use strict";
@@ -1 +1,2 @@
1
+ export { AuthGuard } from './guard';
1
2
  export { runApp } from './main';
@@ -1,3 +1,5 @@
1
+ import './guard/index.mjs';
1
2
  export { runApp } from './main.mjs';
3
+ export { AuthGuard } from './guard/auth-guard/auth-guard.mjs';
2
4
 
3
5
  "use strict";
@@ -1,2 +1,5 @@
1
1
  import { Plugin } from 'vue';
2
- export declare function runApp(plugins?: Plugin[]): Promise<void>;
2
+ import { AuthGuard } from './guard';
3
+ export declare function runApp(plugins?: Plugin[], opts?: {
4
+ getAuthGuard: () => AuthGuard;
5
+ }): Promise<void>;
@@ -7,6 +7,8 @@ import App from './App.mjs';
7
7
  import './util/index.mjs';
8
8
  import { AppRouter } from './router/index.mjs';
9
9
  import '../util/index.mjs';
10
+ import './guard/index.mjs';
11
+ import { DynaAuthGuard } from './guard/auth-guard/dyna-auth-guard.mjs';
10
12
  import { OpenViewUtil } from '../util/open-view-util/open-view-util.mjs';
11
13
  import { MessageUtil } from '../util/message-util/message-util.mjs';
12
14
  import { ModalUtil } from '../util/modal-util/modal-util.mjs';
@@ -18,7 +20,7 @@ import { OverlayController } from '../util/overlay-controller/overlay-controller
18
20
  import { UnauthorizedHandler } from './util/unauthorized-handler/unauthorized-handler.mjs';
19
21
 
20
22
  "use strict";
21
- async function runApp(plugins) {
23
+ async function runApp(plugins, opts) {
22
24
  AppHooks.createApp.tap((_, app2) => {
23
25
  if (plugins) {
24
26
  plugins.forEach((plugin) => {
@@ -43,6 +45,13 @@ async function runApp(plugins) {
43
45
  });
44
46
  });
45
47
  await attachEnvironmentConfig();
48
+ let authGuard;
49
+ if (opts == null ? void 0 : opts.getAuthGuard) {
50
+ authGuard = opts.getAuthGuard();
51
+ } else {
52
+ authGuard = new DynaAuthGuard();
53
+ }
54
+ AppRouter.setAuthGuard((notLogin) => authGuard.verify(notLogin));
46
55
  app.use(AppRouter.getRouter());
47
56
  ibiz.openView = new OpenViewUtil(AppRouter.getRouter());
48
57
  ibiz.message = new MessageUtil();
@@ -2,5 +2,7 @@ import { Router } from 'vue-router';
2
2
  import 'nprogress/nprogress.css';
3
3
  export declare class AppRouter {
4
4
  private static router?;
5
+ private static authGuard;
6
+ static setAuthGuard(authGuard: (notLogin?: boolean) => Promise<boolean>): void;
5
7
  static getRouter(): Router;
6
8
  }
@@ -2,11 +2,9 @@ import { createWebHashHistory, createRouter } from 'vue-router';
2
2
  import { AppRedirectView } from '@ibiz-template/vue3-util';
3
3
  import { RouteConst } from '@ibiz-template/runtime';
4
4
  import NProgress from '../../node_modules/.pnpm/nprogress@0.2.0/node_modules/nprogress/nprogress.mjs';
5
- import '../guard/index.mjs';
6
5
  import '../../view/index.mjs';
7
6
  import '../components/index.mjs';
8
7
  import 'nprogress/nprogress.css';
9
- import { AuthGuard } from '../guard/auth-guard/auth-guard.mjs';
10
8
  import { LoginView } from '../../view/login-view/login-view.mjs';
11
9
  import { View404 } from '../../view/404-view/404-view.mjs';
12
10
  import { RouterShell } from '../components/router-shell/router-shell.mjs';
@@ -20,6 +18,9 @@ var __publicField = (obj, key, value) => {
20
18
  return value;
21
19
  };
22
20
  class AppRouter {
21
+ static setAuthGuard(authGuard) {
22
+ this.authGuard = authGuard;
23
+ }
23
24
  static getRouter() {
24
25
  const placeholder = ibiz.env.routePlaceholder;
25
26
  const paramReg = "[^/]+=[^/]+|".concat(placeholder);
@@ -37,7 +38,7 @@ class AppRouter {
37
38
  path: "/login",
38
39
  name: "loginView",
39
40
  beforeEnter: async (_to, _from, next) => {
40
- await AuthGuard(false);
41
+ await this.authGuard(false);
41
42
  next();
42
43
  },
43
44
  component: LoginView
@@ -51,7 +52,7 @@ class AppRouter {
51
52
  path: "/appredirectview",
52
53
  name: "appRedirectView",
53
54
  beforeEnter: async (_to, _from, next) => {
54
- const authority = await AuthGuard();
55
+ const authority = await this.authGuard();
55
56
  if (authority) {
56
57
  next();
57
58
  } else {
@@ -63,7 +64,7 @@ class AppRouter {
63
64
  {
64
65
  path: "/:appContext(".concat(paramReg, ")/:view1(").concat(viewReg, ")/:params1(").concat(paramReg, ")"),
65
66
  beforeEnter: async (_to, _from, next) => {
66
- const authority = await AuthGuard();
67
+ const authority = await this.authGuard();
67
68
  if (authority) {
68
69
  next();
69
70
  } else {
@@ -196,5 +197,6 @@ class AppRouter {
196
197
  }
197
198
  }
198
199
  __publicField(AppRouter, "router");
200
+ __publicField(AppRouter, "authGuard");
199
201
 
200
202
  export { AppRouter };
@@ -1 +1 @@
1
- .ibiz-no-data{width:100%;height:100%}.ibiz-no-data .el-empty__description p{color:var(--ibiz-color-text-3)}
1
+ .ibiz-no-data{width:100%;height:100%}.ibiz-no-data .el-empty__description p{color:var(--ibiz-color-text-3)}.ibiz-no-data .el-empty__image{width:100%;max-width:var(--el-empty-image-width)}
@@ -168,7 +168,7 @@ const GridControl = /* @__PURE__ */ vue.defineComponent({
168
168
  "emptyTextLanguageRes": c.model.emptyTextLanguageRes
169
169
  }, null);
170
170
  }
171
- return null;
171
+ return vue.createVNode("div", null, null);
172
172
  };
173
173
  const {
174
174
  tableData,
@@ -238,7 +238,7 @@ const GridControl = /* @__PURE__ */ vue.defineComponent({
238
238
  enablePagingBar
239
239
  } = this.c.model;
240
240
  return vue.createVNode(vue.resolveComponent("iBizControlBase"), {
241
- "class": [this.ns.is("show-header", !hideHeader), this.ns.is("enable-page", enablePagingBar), this.ns.is("enable-group", this.c.model.enableGroup), this.ns.is("single-select", state.singleSelect), this.ns.is("enable-customized", this.c.model.enableCustomized)],
241
+ "class": [this.ns.is("show-header", !hideHeader), this.ns.is("enable-page", enablePagingBar), this.ns.is("enable-group", this.c.model.enableGroup), this.ns.is("single-select", state.singleSelect), this.ns.is("empty", state.items.length === 0), this.ns.is("enable-customized", this.c.model.enableCustomized)],
242
242
  "controller": this.c,
243
243
  "style": this.headerCssVars
244
244
  }, {