@ibiz-template/mob-vue3-components 0.7.41-alpha.21 → 0.7.41-alpha.22

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 (181) hide show
  1. package/dist/ibiz-markdown-editor-COU_MxNu.js +2 -0
  2. package/dist/ibiz-markdown-editor-COU_MxNu.js.map +1 -0
  3. package/dist/index-Bn7VkqJp.js +76 -0
  4. package/dist/index-Bn7VkqJp.js.map +1 -0
  5. package/dist/{index-BkzKmBm3.js → index-ChdHGLJI.js} +2 -2
  6. package/dist/{index-BkzKmBm3.js.map → index-ChdHGLJI.js.map} +1 -1
  7. package/dist/index-Dd7yiMzY.js +2 -0
  8. package/dist/index-Dd7yiMzY.js.map +1 -0
  9. package/dist/index.es-D0mZvSDS.js +14 -0
  10. package/dist/index.es-D0mZvSDS.js.map +1 -0
  11. package/dist/index.min.css +9 -9
  12. package/dist/index.system.min.js +1 -1
  13. package/dist/{quill-D-355-KZ.js → quill-BOA7ZLOz.js} +2 -2
  14. package/dist/{quill-D-355-KZ.js.map → quill-BOA7ZLOz.js.map} +1 -1
  15. package/dist/{quill-editor-DyVF1l3P.js → quill-editor-DcZd_lqh.js} +2 -2
  16. package/dist/{quill-editor-DyVF1l3P.js.map → quill-editor-DcZd_lqh.js.map} +1 -1
  17. package/dist/quill-editor-preview-DghpeKpg.js +2 -0
  18. package/dist/quill-editor-preview-DghpeKpg.js.map +1 -0
  19. package/dist/{tree-sdPuTW-7.js → tree-BTa0bMPr.js} +2 -2
  20. package/dist/{tree-sdPuTW-7.js.map → tree-BTa0bMPr.js.map} +1 -1
  21. package/dist/xlsx-util-CQaOn5OK.js +105 -0
  22. package/dist/xlsx-util-CQaOn5OK.js.map +1 -0
  23. package/es/_virtual/FileSaver.min.mjs +3 -0
  24. package/es/_virtual/index12.mjs +2 -2
  25. package/es/_virtual/index14.mjs +2 -2
  26. package/es/_virtual/index18.mjs +2 -2
  27. package/es/_virtual/index19.mjs +2 -2
  28. package/es/common/split-trigger/split-trigger.css +1 -1
  29. package/es/common/tab-layout/tab-default-layout/tab-default-layout.mjs +1 -0
  30. package/es/common/tab-layout/tab-sidebar-layout/tab-sidebar-layout.css +1 -1
  31. package/es/common/view-message/view-message.mjs +1 -1
  32. package/es/control/app-menu-icon-view/app-menu-icon-view.css +1 -1
  33. package/es/control/app-menu-icon-view/app-menu-icon-view.mjs +1 -1
  34. package/es/control/app-menu-list-view/app-menu-list-view.css +1 -1
  35. package/es/control/calendar/calendar.css +1 -1
  36. package/es/control/calendar/calendar.mjs +1 -1
  37. package/es/control/caption-bar/caption-bar.css +1 -1
  38. package/es/control/dashboard/custom-dashboard-design/custom-dashboard-design.css +1 -1
  39. package/es/control/dashboard/dashboard.css +1 -1
  40. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
  41. package/es/control/data-view/data-view.css +1 -1
  42. package/es/control/drbar/drbar.css +1 -1
  43. package/es/control/drtab/drtab.controller.mjs +1 -1
  44. package/es/control/drtab/drtab.css +1 -1
  45. package/es/control/list/md-ctrl/md-ctrl.css +1 -1
  46. package/es/control/search-bar/filter-tree/filter-tree.css +1 -1
  47. package/es/control/search-bar/search-bar.css +1 -1
  48. package/es/control/tab-exp-panel/tab-exp-panel.css +1 -1
  49. package/es/control/toolbar/toolbar-render-util.mjs +4 -0
  50. package/es/control/toolbar/toolbar.css +1 -1
  51. package/es/control/tree/tree.css +1 -1
  52. package/es/control/wizard-panel/wizard-panel.css +1 -1
  53. package/es/editor/array/ibiz-array/ibiz-array.css +1 -1
  54. package/es/editor/data-picker/picker-editor.controller.mjs +1 -1
  55. package/es/editor/html/quill-editor/quill-editor.css +1 -1
  56. package/es/editor/html/quill-editor-preview/quill-editor-preview.css +1 -1
  57. package/es/editor/html/quill-editor-preview/quill-editor-preview.mjs +1 -2
  58. package/es/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.mjs +3 -1
  59. package/es/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
  60. package/es/editor/stepper/ibiz-stepper/ibiz-stepper.css +1 -1
  61. package/es/editor/text-box/ibiz-input-number/ibiz-input-number.css +1 -1
  62. package/es/editor/text-box/input/input.mjs +33 -2
  63. package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.css +1 -1
  64. package/es/editor/upload/ibiz-file-upload/ibiz-file-upload.mjs +1 -1
  65. package/es/ibiz-vue3.mjs +1 -0
  66. package/es/index.mjs +3 -0
  67. package/es/locale/en/index.mjs +23 -0
  68. package/es/locale/zh-CN/index.mjs +26 -1
  69. package/es/mob-app/components/modal-router-shell/modal-router-shell.mjs +2 -2
  70. package/es/mob-app/guard/auth-guard/auth-guard.mjs +206 -194
  71. package/es/mob-app/guard/auth-guard/dyna-auth-guard.mjs +65 -0
  72. package/es/mob-app/guard/index.mjs +1 -0
  73. package/es/mob-app/index.mjs +1 -0
  74. package/es/mob-app/main.mjs +14 -1
  75. package/es/mob-app/router/index.mjs +6 -4
  76. package/es/node_modules/.pnpm/@amap_amap-jsapi-loader@1.0.1_patch_hash_73bpcwbs2m5ip4qppmz6a7epsa/node_modules/@amap/amap-jsapi-loader/dist/index.mjs +1 -1
  77. package/es/node_modules/.pnpm/@ibiz-template-plugin_ibiz-mob-ai-chat@0.0.1_cherry-markdown@0.8.58_interactjs@1.10.27_qx-uti_xgmgjpxet4ghyc7txs4jkjxilq/node_modules/@ibiz-template-plugin/ibiz-mob-ai-chat/dist/index.es.mjs +4425 -0
  78. package/es/node_modules/.pnpm/dingtalk-jsapi@3.2.0/node_modules/dingtalk-jsapi/lib/packages/frame-talk-client-pc/index.mjs +1 -1
  79. package/es/node_modules/.pnpm/file-saver@2.0.5/node_modules/file-saver/dist/FileSaver.min.mjs +15 -0
  80. package/es/node_modules/.pnpm/lodash.clonedeep@4.5.0/node_modules/lodash.clonedeep/index.mjs +1 -1
  81. package/es/node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.mjs +1 -1
  82. package/es/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx.mjs +24580 -0
  83. package/es/panel-component/view-content-panel-container/view-content-panel-container.css +1 -1
  84. package/es/panel-component/view-content-panel-container/view-content-panel-container.mjs +18 -4
  85. package/es/util/ai-chat-util/ai-chat-util.mjs +932 -0
  86. package/es/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
  87. package/es/util/ai-chat-util/ai-feedback/ai-feedback.mjs +140 -0
  88. package/es/util/app-drawer/app-drawer-component.mjs +7 -17
  89. package/es/util/app-modal/app-modal-component.mjs +4 -2
  90. package/es/util/app-util/app-util.mjs +76 -6
  91. package/es/util/index.mjs +2 -0
  92. package/es/util/list-util/list-render-util.mjs +1 -1
  93. package/es/util/user-route-util/user-route-util.mjs +55 -0
  94. package/es/util/xlsx-util/xlsx-util.mjs +163 -0
  95. package/es/view/portal-view/portal-view.mjs +3 -2
  96. package/es/view-engine/mob-calendar-view.engine.mjs +4 -0
  97. package/es/view-engine/mob-pickup-md-view.engine.mjs +1 -0
  98. package/lib/_virtual/FileSaver.min.cjs +5 -0
  99. package/lib/_virtual/index12.cjs +2 -2
  100. package/lib/_virtual/index14.cjs +2 -2
  101. package/lib/_virtual/index18.cjs +2 -2
  102. package/lib/_virtual/index19.cjs +2 -2
  103. package/lib/common/split-trigger/split-trigger.css +1 -1
  104. package/lib/common/tab-layout/tab-default-layout/tab-default-layout.cjs +1 -0
  105. package/lib/common/tab-layout/tab-sidebar-layout/tab-sidebar-layout.css +1 -1
  106. package/lib/common/view-message/view-message.cjs +1 -1
  107. package/lib/control/app-menu-icon-view/app-menu-icon-view.cjs +1 -1
  108. package/lib/control/app-menu-icon-view/app-menu-icon-view.css +1 -1
  109. package/lib/control/app-menu-list-view/app-menu-list-view.css +1 -1
  110. package/lib/control/calendar/calendar.cjs +1 -1
  111. package/lib/control/calendar/calendar.css +1 -1
  112. package/lib/control/caption-bar/caption-bar.css +1 -1
  113. package/lib/control/dashboard/custom-dashboard-design/custom-dashboard-design.css +1 -1
  114. package/lib/control/dashboard/dashboard.css +1 -1
  115. package/lib/control/dashboard/portlet/portlet-layout/portlet-layout.css +1 -1
  116. package/lib/control/data-view/data-view.css +1 -1
  117. package/lib/control/drbar/drbar.css +1 -1
  118. package/lib/control/drtab/drtab.controller.cjs +1 -1
  119. package/lib/control/drtab/drtab.css +1 -1
  120. package/lib/control/list/md-ctrl/md-ctrl.css +1 -1
  121. package/lib/control/search-bar/filter-tree/filter-tree.css +1 -1
  122. package/lib/control/search-bar/search-bar.css +1 -1
  123. package/lib/control/tab-exp-panel/tab-exp-panel.css +1 -1
  124. package/lib/control/toolbar/toolbar-render-util.cjs +4 -0
  125. package/lib/control/toolbar/toolbar.css +1 -1
  126. package/lib/control/tree/tree.css +1 -1
  127. package/lib/control/wizard-panel/wizard-panel.css +1 -1
  128. package/lib/editor/array/ibiz-array/ibiz-array.css +1 -1
  129. package/lib/editor/data-picker/picker-editor.controller.cjs +1 -1
  130. package/lib/editor/html/quill-editor/quill-editor.css +1 -1
  131. package/lib/editor/html/quill-editor-preview/quill-editor-preview.cjs +1 -2
  132. package/lib/editor/html/quill-editor-preview/quill-editor-preview.css +1 -1
  133. package/lib/editor/markdown/ibiz-markdown-editor/ibiz-markdown-editor.cjs +3 -1
  134. package/lib/editor/slider/ibiz-slider/ibiz-slider.css +1 -1
  135. package/lib/editor/stepper/ibiz-stepper/ibiz-stepper.css +1 -1
  136. package/lib/editor/text-box/ibiz-input-number/ibiz-input-number.css +1 -1
  137. package/lib/editor/text-box/input/input.cjs +32 -1
  138. package/lib/editor/upload/ibiz-file-upload/ibiz-file-upload.cjs +1 -1
  139. package/lib/editor/upload/ibiz-file-upload/ibiz-file-upload.css +1 -1
  140. package/lib/ibiz-vue3.cjs +1 -0
  141. package/lib/index.cjs +7 -0
  142. package/lib/locale/en/index.cjs +23 -0
  143. package/lib/locale/zh-CN/index.cjs +26 -1
  144. package/lib/mob-app/components/modal-router-shell/modal-router-shell.cjs +2 -2
  145. package/lib/mob-app/guard/auth-guard/auth-guard.cjs +206 -194
  146. package/lib/mob-app/guard/auth-guard/dyna-auth-guard.cjs +67 -0
  147. package/lib/mob-app/guard/index.cjs +2 -0
  148. package/lib/mob-app/index.cjs +2 -0
  149. package/lib/mob-app/main.cjs +14 -1
  150. package/lib/mob-app/router/index.cjs +6 -4
  151. package/lib/node_modules/.pnpm/@amap_amap-jsapi-loader@1.0.1_patch_hash_73bpcwbs2m5ip4qppmz6a7epsa/node_modules/@amap/amap-jsapi-loader/dist/index.cjs +1 -1
  152. package/lib/node_modules/.pnpm/@ibiz-template-plugin_ibiz-mob-ai-chat@0.0.1_cherry-markdown@0.8.58_interactjs@1.10.27_qx-uti_xgmgjpxet4ghyc7txs4jkjxilq/node_modules/@ibiz-template-plugin/ibiz-mob-ai-chat/dist/index.es.cjs +4427 -0
  153. package/lib/node_modules/.pnpm/dingtalk-jsapi@3.2.0/node_modules/dingtalk-jsapi/lib/packages/frame-talk-client-pc/index.cjs +1 -1
  154. package/lib/node_modules/.pnpm/file-saver@2.0.5/node_modules/file-saver/dist/FileSaver.min.cjs +20 -0
  155. package/lib/node_modules/.pnpm/lodash.clonedeep@4.5.0/node_modules/lodash.clonedeep/index.cjs +1 -1
  156. package/lib/node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.cjs +1 -1
  157. package/lib/node_modules/.pnpm/xlsx@0.18.5/node_modules/xlsx/xlsx.cjs +24599 -0
  158. package/lib/panel-component/view-content-panel-container/view-content-panel-container.cjs +18 -4
  159. package/lib/panel-component/view-content-panel-container/view-content-panel-container.css +1 -1
  160. package/lib/util/ai-chat-util/ai-chat-util.cjs +934 -0
  161. package/lib/util/ai-chat-util/ai-feedback/ai-feedback.cjs +142 -0
  162. package/lib/util/ai-chat-util/ai-feedback/ai-feedback.css +1 -0
  163. package/lib/util/app-drawer/app-drawer-component.cjs +7 -17
  164. package/lib/util/app-modal/app-modal-component.cjs +4 -2
  165. package/lib/util/app-util/app-util.cjs +75 -5
  166. package/lib/util/index.cjs +5 -0
  167. package/lib/util/list-util/list-render-util.cjs +1 -1
  168. package/lib/util/user-route-util/user-route-util.cjs +58 -0
  169. package/lib/util/xlsx-util/xlsx-util.cjs +166 -0
  170. package/lib/view/portal-view/portal-view.cjs +3 -2
  171. package/lib/view-engine/mob-calendar-view.engine.cjs +4 -0
  172. package/lib/view-engine/mob-pickup-md-view.engine.cjs +1 -0
  173. package/package.json +12 -9
  174. package/dist/ibiz-markdown-editor-DMe7ZdYW.js +0 -2
  175. package/dist/ibiz-markdown-editor-DMe7ZdYW.js.map +0 -1
  176. package/dist/index-CADWRoaa.js +0 -76
  177. package/dist/index-CADWRoaa.js.map +0 -1
  178. package/dist/index-ugd4IDkI.js +0 -2
  179. package/dist/index-ugd4IDkI.js.map +0 -1
  180. package/dist/quill-editor-preview-3eAbHBYz.js +0 -2
  181. package/dist/quill-editor-preview-3eAbHBYz.js.map +0 -1
@@ -1,64 +1,119 @@
1
1
  import { HttpError, getAppCookie, CoreConst } from '@ibiz-template/core';
2
- import { ModelHelper } from '@ibiz-template/model-helper';
3
2
  import { mergeDeepRight } from 'ramda';
4
3
  import { AppHooks } from '@ibiz-template/vue3-util';
5
4
  import { updateDevToolConfig } from '@ibiz-template/devtool';
6
- import { i18n } from '../../../locale/index.mjs';
7
5
  import { AuthGuardHooks } from '../auth-guard-hooks.mjs';
8
6
 
9
7
  "use strict";
10
- async function loadAppData(context) {
11
- let res;
12
- if (context && Object.keys(context).length > 0) {
13
- res = await ibiz.net.get("/appdata", context);
14
- } else {
15
- res = await ibiz.net.get("/appdata");
16
- }
17
- if (res.ok) {
18
- ibiz.appData = res.data;
19
- if (window.location.search && window.location.search.indexOf("srfignoredevtool=true") !== -1)
20
- return;
21
- updateDevToolConfig();
8
+ class AuthGuard {
9
+ /**
10
+ * @description 总的入口校验
11
+ * @param {IParams} appContext
12
+ * @param {boolean} [permission=true]
13
+ * @returns {*} {Promise<boolean>}
14
+ * @memberof AuthGuard
15
+ */
16
+ async verify(appContext, permission = true) {
17
+ if (permission) {
18
+ let result = true;
19
+ try {
20
+ if (ibiz.env.enableAnonymous) {
21
+ await this.anonymousValidate(appContext);
22
+ } else {
23
+ await this.appInit(appContext);
24
+ }
25
+ } catch (error) {
26
+ result = false;
27
+ error.tag = "APPINIT";
28
+ ibiz.util.error.handle(error);
29
+ }
30
+ return result;
31
+ }
32
+ if (ibiz.env.enableAnonymous) {
33
+ try {
34
+ await this.anonymousValidate(appContext);
35
+ } catch (error) {
36
+ error.tag = "APPINIT";
37
+ ibiz.util.error.handle(error);
38
+ return false;
39
+ }
40
+ } else {
41
+ await this.initModel(appContext, false);
42
+ }
43
+ return true;
22
44
  }
23
- }
24
- async function loadOrgData() {
25
- const res = await ibiz.net.get(`/uaa/getbydcsystem/${ibiz.env.dcSystem}`);
26
- if (res.ok) {
27
- const orgDataItems = res.data;
28
- if (orgDataItems) {
29
- const [data] = orgDataItems;
30
- ibiz.orgData = data;
45
+ /**
46
+ * @description 加载应用数据
47
+ * @param {IParams} [context]
48
+ * @returns {*} {Promise<void>}
49
+ * @memberof AuthGuard
50
+ */
51
+ async loadAppData(context) {
52
+ let res;
53
+ if (context && Object.keys(context).length > 0) {
54
+ res = await ibiz.net.get("/appdata", context);
55
+ } else {
56
+ res = await ibiz.net.get("/appdata");
57
+ }
58
+ if (res.ok) {
59
+ ibiz.appData = res.data;
60
+ ibiz.appData.context.modeldesigndefaultmode = "close";
61
+ if (window.location.search && window.location.search.indexOf("srfignoredevtool=true") !== -1)
62
+ return;
63
+ updateDevToolConfig();
31
64
  }
32
65
  }
33
- }
34
- async function loadTheme() {
35
- const app = ibiz.hub.getApp();
36
- const uiThemes = app.model.appUIThemes || [];
37
- if (uiThemes.length > 0) {
38
- const colorThemes = uiThemes.filter((uiTheme) => {
39
- return uiTheme.themeParams && uiTheme.themeParams["icon-theme"] !== "true";
40
- });
41
- if (colorThemes.length > 0) {
42
- for (let index = 0; index < colorThemes.length; index++) {
43
- const colorTheme = colorThemes[index];
44
- await ibiz.util.theme.loadTheme(colorTheme);
66
+ /**
67
+ * @description 加载组织数据
68
+ * @returns {*} {Promise<void>}
69
+ * @memberof AuthGuard
70
+ */
71
+ async loadOrgData() {
72
+ const res = await ibiz.net.get(`/uaa/getbydcsystem/${ibiz.env.dcSystem}`);
73
+ if (res.ok) {
74
+ const orgDataItems = res.data;
75
+ if (orgDataItems) {
76
+ const [data] = orgDataItems;
77
+ ibiz.orgData = data;
45
78
  }
46
79
  }
47
- const iconThemes = uiThemes.filter((uiTheme) => {
48
- return uiTheme.themeParams && uiTheme.themeParams["icon-theme"] === "true";
49
- });
50
- if (iconThemes.length > 0) {
51
- for (let index = 0; index < iconThemes.length; index++) {
52
- const iconTheme = iconThemes[index];
53
- await ibiz.util.theme.loadTheme(iconTheme, "ICON");
80
+ }
81
+ /**
82
+ * @description 加载主题插件
83
+ * @returns {*} {Promise<void>}
84
+ * @memberof AuthGuard
85
+ */
86
+ async loadTheme() {
87
+ const app = ibiz.hub.getApp();
88
+ const uiThemes = app.model.appUIThemes || [];
89
+ if (uiThemes.length > 0) {
90
+ const colorThemes = uiThemes.filter((uiTheme) => {
91
+ return uiTheme.themeParams && uiTheme.themeParams["icon-theme"] !== "true";
92
+ });
93
+ if (colorThemes.length > 0) {
94
+ for (let index = 0; index < colorThemes.length; index++) {
95
+ const colorTheme = colorThemes[index];
96
+ await ibiz.util.theme.loadTheme(colorTheme);
97
+ }
98
+ }
99
+ const iconThemes = uiThemes.filter((uiTheme) => {
100
+ return uiTheme.themeParams && uiTheme.themeParams["icon-theme"] === "true";
101
+ });
102
+ if (iconThemes.length > 0) {
103
+ for (let index = 0; index < iconThemes.length; index++) {
104
+ const iconTheme = iconThemes[index];
105
+ await ibiz.util.theme.loadTheme(iconTheme, "ICON");
106
+ }
54
107
  }
55
108
  }
56
109
  }
57
- }
58
- let helper;
59
- async function initEnvironment() {
60
- if (helper) {
61
- const app = await helper.getAppModel();
110
+ /**
111
+ * @description 根据应用自定义参数解析成环境变量
112
+ * @param {IApplication} app
113
+ * @returns {*} {Promise<void>}
114
+ * @memberof AuthGuard
115
+ */
116
+ async initEnvironment(app) {
62
117
  const userParam = app.userParam;
63
118
  if (userParam) {
64
119
  Object.keys(userParam).forEach((key) => {
@@ -81,172 +136,129 @@ async function initEnvironment() {
81
136
  ibiz.log.setLevel(ibiz.env.logLevel);
82
137
  }
83
138
  }
84
- }
85
- async function initModel(context, permission = true) {
86
- if (!helper) {
87
- helper = new ModelHelper(
88
- async (url) => {
89
- if (ibiz.env.isLocalModel) {
90
- const res2 = await ibiz.net.getModel(`./model${url}`);
91
- return res2.data;
92
- }
93
- const res = await ibiz.net.get(
94
- `${ibiz.env.remoteModelUrl}${url}`,
95
- void 0,
96
- permission ? {} : { srfdcsystem: ibiz.env.dcSystem }
97
- );
98
- return res.data;
99
- },
100
- ibiz.env.appId,
101
- context,
102
- permission
103
- );
104
- const app = await ibiz.hub.getAppAsync(ibiz.env.appId);
105
- await initEnvironment();
106
- await AppHooks.initedApp.call({ context, app });
107
- const appModel = app.model;
108
- ibiz.env.isMob = appModel.mobileApp === true;
109
- if (ibiz.env.isEnableMultiLan) {
110
- const lang = ibiz.i18n.getLang();
111
- const m = await helper.getPSAppLang(lang.replace("-", "_").toUpperCase());
112
- const items = m.languageItems || [];
113
- const data = {};
114
- items.forEach((item) => {
115
- data[item.lanResTag] = item.content;
116
- });
117
- i18n.global.mergeLocaleMessage(lang, data);
118
- }
119
- const module = await import('@ibiz-template/mob-theme');
120
- const theme = module.default || module;
121
- AppHooks.useComponent.callSync(null, theme);
122
- if (ibiz.config.theme)
123
- ibiz.util.theme.setTheme(ibiz.config.theme);
124
- if (appModel.appUIThemes) {
125
- await loadTheme();
126
- }
127
- if (app.model.title) {
128
- ibiz.util.setBrowserTitle("");
139
+ /**
140
+ * @description 初始化模型
141
+ * @param {IParams} context
142
+ * @param {boolean} [_permission=true]
143
+ * @returns {*} {Promise<void>}
144
+ * @memberof AuthGuard
145
+ */
146
+ async initModel(context, _permission = true) {
147
+ }
148
+ /**
149
+ * @description 应用参数初始化
150
+ * @param {IParams} context
151
+ * @returns {*} {Promise<void>}
152
+ * @memberof AuthGuard
153
+ */
154
+ async appInit(context) {
155
+ await AppHooks.beforeInitApp.call({ context });
156
+ await AuthGuardHooks.beforeAuth.call(null, null);
157
+ if (ibiz.env.isSaaSMode === true) {
158
+ await this.loadOrgData();
129
159
  }
160
+ await this.loadAppData(context);
161
+ await AuthGuardHooks.afterAuth.call(null, null);
162
+ await AppHooks.authedApp.call({ context });
163
+ await this.initModel(context);
164
+ await ibiz.auth.extendLogin(context);
165
+ await ibiz.hub.notice.init();
130
166
  }
131
- }
132
- async function appInit(context) {
133
- await AppHooks.beforeInitApp.call({ context });
134
- await AuthGuardHooks.beforeAuth.call(null, null);
135
- if (ibiz.env.isSaaSMode === true) {
136
- await loadOrgData();
167
+ /**
168
+ * @description 抛401异常
169
+ */
170
+ throw401() {
171
+ throw new HttpError({
172
+ response: {
173
+ status: 401,
174
+ statusText: ibiz.i18n.t("mobApp.authGuard.noPermission")
175
+ }
176
+ });
137
177
  }
138
- await loadAppData(context);
139
- await AuthGuardHooks.afterAuth.call(null, null);
140
- await AppHooks.authedApp.call({ context });
141
- await initModel(context);
142
- await ibiz.auth.extendLogin(context);
143
- await ibiz.hub.notice.init();
144
- }
145
- function throw401() {
146
- throw new HttpError({
147
- response: {
148
- status: 401,
149
- statusText: ibiz.i18n.t("mobApp.authGuard.noPermission")
150
- }
151
- });
152
- }
153
- async function anonymousValidate(context) {
154
- const authInfo = ibiz.auth.getAuthInfo();
155
- if (authInfo && !authInfo.isAnonymous) {
156
- try {
157
- await appInit(context);
158
- return;
159
- } catch (error) {
160
- const { status } = error;
161
- if (status === 401) {
162
- const refreshToken = getAppCookie(CoreConst.REFRESH_TOKEN);
163
- if (refreshToken) {
164
- await ibiz.auth.refreshToken();
165
- await appInit(context);
166
- return;
178
+ /**
179
+ * @description 匿名登录
180
+ * @param {IParams} context
181
+ * @returns {*} {Promise<void>}
182
+ */
183
+ async anonymousValidate(context) {
184
+ const authInfo = ibiz.auth.getAuthInfo();
185
+ if (authInfo && !authInfo.isAnonymous) {
186
+ try {
187
+ await this.appInit(context);
188
+ return;
189
+ } catch (error) {
190
+ const { status } = error;
191
+ if (status === 401) {
192
+ const refreshToken = getAppCookie(CoreConst.REFRESH_TOKEN);
193
+ if (refreshToken) {
194
+ await ibiz.auth.refreshToken();
195
+ await this.appInit(context);
196
+ return;
197
+ }
198
+ ibiz.auth.clearAuthData();
199
+ } else {
200
+ throw error;
167
201
  }
168
- ibiz.auth.clearAuthData();
169
- } else {
170
- throw error;
171
202
  }
172
203
  }
173
- }
174
- if (authInfo == null ? void 0 : authInfo.token) {
175
- try {
176
- await appInit(context);
177
- } catch (error) {
178
- const { status } = error;
179
- if (status === 401) {
180
- const loginResult = await ibiz.auth.anonymousLogin();
181
- if (!loginResult) {
182
- throw401();
183
- return;
204
+ if (authInfo == null ? void 0 : authInfo.token) {
205
+ try {
206
+ await this.appInit(context);
207
+ } catch (error) {
208
+ const { status } = error;
209
+ if (status === 401) {
210
+ const loginResult = await ibiz.auth.anonymousLogin();
211
+ if (!loginResult) {
212
+ this.throw401();
213
+ return;
214
+ }
215
+ await this.appInit(context);
216
+ } else {
217
+ throw error;
184
218
  }
185
- await appInit(context);
186
- } else {
187
- throw error;
188
219
  }
189
220
  }
190
- }
191
- if (!authInfo || !authInfo.token) {
192
- const loginResult = await ibiz.auth.anonymousLogin();
193
- if (!loginResult) {
194
- throw401();
195
- return;
196
- }
197
- await appInit(context);
198
- }
199
- const urlPaths = window.location.hash.split("/");
200
- const viewName = urlPaths[urlPaths.length - 2];
201
- let viewModel;
202
- try {
203
- if (["#", "index"].includes(viewName) && ibiz.hub.defaultPage) {
204
- viewModel = await ibiz.hub.getAppView(ibiz.hub.defaultPage.id);
205
- } else {
206
- viewModel = await ibiz.hub.getAppView(viewName);
221
+ if (!authInfo || !authInfo.token) {
222
+ const loginResult = await ibiz.auth.anonymousLogin();
223
+ if (!loginResult) {
224
+ this.throw401();
225
+ return;
226
+ }
227
+ await this.appInit(context);
207
228
  }
208
- } catch (error) {
209
- ibiz.log.error(error);
210
- }
211
- if (!viewModel) {
212
- ibiz.log.error(
213
- `\u627E\u4E0D\u5230\u89C6\u56FE\u6A21\u578B${viewName},\u8BF7\u786E\u4FDD\u8BE5\u89C6\u56FE\u914D\u7F6E\u4E86\u533F\u540D\u8BBF\u95EE\u548C\u7528\u6237\u5F15\u7528`
214
- );
215
- throw401();
216
- return;
217
- }
218
- if (viewModel.accUserMode !== 3) {
219
- throw401();
220
- }
221
- }
222
- async function AuthGuard(appContext, permission = true) {
223
- if (permission) {
224
- let result = true;
229
+ const urlPaths = window.location.hash.split("/");
230
+ const viewName = urlPaths[urlPaths.length - 2];
231
+ let viewModel;
225
232
  try {
226
- if (ibiz.env.enableAnonymous) {
227
- await anonymousValidate(appContext);
233
+ if (["#", "index"].includes(viewName) && ibiz.hub.defaultPage) {
234
+ viewModel = await ibiz.hub.getAppView(ibiz.hub.defaultPage.id);
228
235
  } else {
229
- await appInit(appContext);
236
+ viewModel = await ibiz.hub.getAppView(viewName);
230
237
  }
231
238
  } catch (error) {
232
- result = false;
233
- error.tag = "APPINIT";
234
- ibiz.util.error.handle(error);
239
+ ibiz.log.error(error);
240
+ }
241
+ if (!viewModel) {
242
+ ibiz.log.error(
243
+ `\u627E\u4E0D\u5230\u89C6\u56FE\u6A21\u578B${viewName},\u8BF7\u786E\u4FDD\u8BE5\u89C6\u56FE\u914D\u7F6E\u4E86\u533F\u540D\u8BBF\u95EE\u548C\u7528\u6237\u5F15\u7528`
244
+ );
245
+ this.throw401();
246
+ return;
247
+ }
248
+ if (viewModel.accUserMode !== 3) {
249
+ this.throw401();
235
250
  }
236
- return result;
237
251
  }
238
- if (ibiz.env.enableAnonymous) {
239
- try {
240
- await anonymousValidate(appContext);
241
- } catch (error) {
242
- error.tag = "APPINIT";
243
- ibiz.util.error.handle(error);
244
- return false;
252
+ async initTheme(appModel) {
253
+ const module = await import('@ibiz-template/mob-theme');
254
+ const theme = module.default || module;
255
+ AppHooks.useComponent.callSync(null, theme);
256
+ if (ibiz.config.theme)
257
+ ibiz.util.theme.setTheme(ibiz.config.theme);
258
+ if (appModel.appUIThemes) {
259
+ await this.loadTheme();
245
260
  }
246
- } else {
247
- await initModel(appContext, false);
248
261
  }
249
- return true;
250
262
  }
251
263
 
252
264
  export { AuthGuard };
@@ -0,0 +1,65 @@
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(context, permission = true) {
20
+ if (!this.hasModelInit || this.hasModelInit && this.noPermissionModel !== permission) {
21
+ const helper = new ModelHelper(
22
+ async (url) => {
23
+ if (ibiz.env.isLocalModel) {
24
+ const res2 = await ibiz.net.getModel(`./model${url}`);
25
+ return res2.data;
26
+ }
27
+ const res = await ibiz.net.get(
28
+ `${ibiz.env.remoteModelUrl}${url}`,
29
+ void 0,
30
+ permission ? {} : { srfdcsystem: ibiz.env.dcSystem }
31
+ );
32
+ return res.data;
33
+ },
34
+ ibiz.env.appId,
35
+ context,
36
+ permission
37
+ );
38
+ const app = await ibiz.hub.getAppAsync(ibiz.env.appId);
39
+ await this.initEnvironment(app);
40
+ await AppHooks.initedApp.call({ context, app });
41
+ const appModel = app.model;
42
+ ibiz.env.isMob = appModel.mobileApp === true;
43
+ if (ibiz.env.isEnableMultiLan) {
44
+ const lang = ibiz.i18n.getLang();
45
+ const m = await helper.getPSAppLang(
46
+ lang.replace("-", "_").toUpperCase()
47
+ );
48
+ const items = m.languageItems || [];
49
+ const data = {};
50
+ items.forEach((item) => {
51
+ data[item.lanResTag] = item.content;
52
+ });
53
+ i18n.global.mergeLocaleMessage(lang, data);
54
+ }
55
+ await this.initTheme(app);
56
+ if (app.model.title) {
57
+ ibiz.util.setBrowserTitle("");
58
+ }
59
+ }
60
+ this.noPermissionModel = permission;
61
+ this.hasModelInit = true;
62
+ }
63
+ }
64
+
65
+ export { DynaAuthGuard };
@@ -1,4 +1,5 @@
1
1
  export { AuthGuard } from './auth-guard/auth-guard.mjs';
2
+ export { DynaAuthGuard } from './auth-guard/dyna-auth-guard.mjs';
2
3
  export { AuthGuardHooks } from './auth-guard-hooks.mjs';
3
4
 
4
5
  "use strict";
@@ -1,5 +1,6 @@
1
1
  export { runApp } from './main.mjs';
2
2
  import './guard/index.mjs';
3
3
  export { AuthGuardHooks } from './guard/auth-guard-hooks.mjs';
4
+ export { AuthGuard } from './guard/auth-guard/auth-guard.mjs';
4
5
 
5
6
  "use strict";
@@ -8,7 +8,9 @@ import { createVueApp } from './create-vue-app.mjs';
8
8
  import { AppRouter } from './router/index.mjs';
9
9
  import './util/index.mjs';
10
10
  import '../util/index.mjs';
11
+ import './guard/index.mjs';
11
12
  import { UnauthorizedHandler } from './util/unauthorized-handler/unauthorized-handler.mjs';
13
+ import { DynaAuthGuard } from './guard/auth-guard/dyna-auth-guard.mjs';
12
14
  import { AppUtil } from '../util/app-util/app-util.mjs';
13
15
  import { OpenViewUtil } from '../util/open-view-util/open-view-util.mjs';
14
16
  import { MessageUtil } from '../util/message-util/message-util.mjs';
@@ -19,9 +21,10 @@ import { LoadingUtil } from '../util/loading-util/loading-util.mjs';
19
21
  import { OverlayController } from '../util/overlay-controller/overlay-controller.mjs';
20
22
  import { FullscreenUtil } from '../util/fullscreen/fullscreen-util.mjs';
21
23
  import { QrcodeUtil } from '../util/qrcode-util/qrcode-util.mjs';
24
+ import { AIChatUtil } from '../util/ai-chat-util/ai-chat-util.mjs';
22
25
 
23
26
  "use strict";
24
- async function runApp(plugins) {
27
+ async function runApp(plugins, opts) {
25
28
  AppHooks.createApp.tap((_, app2) => {
26
29
  if (plugins) {
27
30
  plugins.forEach((plugin) => {
@@ -59,6 +62,15 @@ async function runApp(plugins) {
59
62
  });
60
63
  await attachEnvironmentConfig();
61
64
  install$2();
65
+ let authGuard;
66
+ if (opts == null ? void 0 : opts.getAuthGuard) {
67
+ authGuard = opts.getAuthGuard();
68
+ } else {
69
+ authGuard = new DynaAuthGuard();
70
+ }
71
+ AppRouter.setAuthGuard(
72
+ (context, notLogin) => authGuard.verify(context, notLogin)
73
+ );
62
74
  const router = AppRouter.getRouter();
63
75
  app.use(router);
64
76
  listenOpenDevTool(router);
@@ -76,6 +88,7 @@ async function runApp(plugins) {
76
88
  return app.config.globalProperties.$textFormat(value, code);
77
89
  };
78
90
  ibiz.qrcodeUtil = new QrcodeUtil();
91
+ ibiz.aiChatUtil = new AIChatUtil();
79
92
  await ibiz.i18n.init();
80
93
  app.mount("#app");
81
94
  }
@@ -3,11 +3,9 @@ import { Modal, ViewMode, RouteConst } from '@ibiz-template/runtime';
3
3
  import { isNilOrEmpty } from 'qx-util';
4
4
  import { AppRedirectView } from '@ibiz-template/vue3-util';
5
5
  import qs from 'qs';
6
- import '../guard/index.mjs';
7
6
  import '../components/index.mjs';
8
7
  import '../../view/index.mjs';
9
8
  import '../../util/index.mjs';
10
- import { AuthGuard } from '../guard/auth-guard/auth-guard.mjs';
11
9
  import { View404 } from '../../view/404-view/404-view.mjs';
12
10
  import { ModalRouterShell } from '../components/modal-router-shell/modal-router-shell.mjs';
13
11
  import { RouterShell } from '../components/router-shell/router-shell.mjs';
@@ -36,6 +34,9 @@ const getPropsCallback = (depth) => {
36
34
  });
37
35
  };
38
36
  class AppRouter {
37
+ static setAuthGuard(authGuard) {
38
+ this.authGuard = authGuard;
39
+ }
39
40
  static getAppContext(route) {
40
41
  let appContext = {};
41
42
  if (route.params.appContext && route.params.appContext !== ibiz.env.routePlaceholder) {
@@ -59,7 +60,7 @@ class AppRouter {
59
60
  if (!isNilOrEmpty(ibiz.appData)) {
60
61
  next();
61
62
  } else {
62
- const authority = await AuthGuard(this.getAppContext(_to));
63
+ const authority = await this.authGuard(this.getAppContext(_to));
63
64
  if (authority) {
64
65
  next();
65
66
  } else {
@@ -155,7 +156,7 @@ class AppRouter {
155
156
  name: "loginView",
156
157
  meta: { preset: true },
157
158
  beforeEnter: async (_to, _from, next) => {
158
- await AuthGuard(this.getAppContext(_to), false);
159
+ await this.authGuard(this.getAppContext(_to), false);
159
160
  next();
160
161
  },
161
162
  component: LoginView
@@ -216,5 +217,6 @@ class AppRouter {
216
217
  }
217
218
  }
218
219
  __publicField(AppRouter, "router");
220
+ __publicField(AppRouter, "authGuard");
219
221
 
220
222
  export { AppRouter };
@@ -1,5 +1,5 @@
1
1
  import { commonjsGlobal, getDefaultExportFromCjs } from '../../../../../../../_virtual/_commonjsHelpers.mjs';
2
- import { __module as dist$1 } from '../../../../../../../_virtual/index12.mjs';
2
+ import { __module as dist$1 } from '../../../../../../../_virtual/index14.mjs';
3
3
 
4
4
  /*
5
5
  *****************************************************************************