@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,66 +1,121 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@ibiz-template/core');
4
- var modelHelper = require('@ibiz-template/model-helper');
5
4
  var ramda = require('ramda');
6
5
  var vue3Util = require('@ibiz-template/vue3-util');
7
6
  var devtool = require('@ibiz-template/devtool');
8
- var index = require('../../../locale/index.cjs');
9
7
  var authGuardHooks = require('../auth-guard-hooks.cjs');
10
8
 
11
9
  "use strict";
12
- async function loadAppData(context) {
13
- let res;
14
- if (context && Object.keys(context).length > 0) {
15
- res = await ibiz.net.get("/appdata", context);
16
- } else {
17
- res = await ibiz.net.get("/appdata");
18
- }
19
- if (res.ok) {
20
- ibiz.appData = res.data;
21
- if (window.location.search && window.location.search.indexOf("srfignoredevtool=true") !== -1)
22
- return;
23
- devtool.updateDevToolConfig();
10
+ class AuthGuard {
11
+ /**
12
+ * @description 总的入口校验
13
+ * @param {IParams} appContext
14
+ * @param {boolean} [permission=true]
15
+ * @returns {*} {Promise<boolean>}
16
+ * @memberof AuthGuard
17
+ */
18
+ async verify(appContext, permission = true) {
19
+ if (permission) {
20
+ let result = true;
21
+ try {
22
+ if (ibiz.env.enableAnonymous) {
23
+ await this.anonymousValidate(appContext);
24
+ } else {
25
+ await this.appInit(appContext);
26
+ }
27
+ } catch (error) {
28
+ result = false;
29
+ error.tag = "APPINIT";
30
+ ibiz.util.error.handle(error);
31
+ }
32
+ return result;
33
+ }
34
+ if (ibiz.env.enableAnonymous) {
35
+ try {
36
+ await this.anonymousValidate(appContext);
37
+ } catch (error) {
38
+ error.tag = "APPINIT";
39
+ ibiz.util.error.handle(error);
40
+ return false;
41
+ }
42
+ } else {
43
+ await this.initModel(appContext, false);
44
+ }
45
+ return true;
24
46
  }
25
- }
26
- async function loadOrgData() {
27
- const res = await ibiz.net.get(`/uaa/getbydcsystem/${ibiz.env.dcSystem}`);
28
- if (res.ok) {
29
- const orgDataItems = res.data;
30
- if (orgDataItems) {
31
- const [data] = orgDataItems;
32
- ibiz.orgData = data;
47
+ /**
48
+ * @description 加载应用数据
49
+ * @param {IParams} [context]
50
+ * @returns {*} {Promise<void>}
51
+ * @memberof AuthGuard
52
+ */
53
+ async loadAppData(context) {
54
+ let res;
55
+ if (context && Object.keys(context).length > 0) {
56
+ res = await ibiz.net.get("/appdata", context);
57
+ } else {
58
+ res = await ibiz.net.get("/appdata");
59
+ }
60
+ if (res.ok) {
61
+ ibiz.appData = res.data;
62
+ ibiz.appData.context.modeldesigndefaultmode = "close";
63
+ if (window.location.search && window.location.search.indexOf("srfignoredevtool=true") !== -1)
64
+ return;
65
+ devtool.updateDevToolConfig();
33
66
  }
34
67
  }
35
- }
36
- async function loadTheme() {
37
- const app = ibiz.hub.getApp();
38
- const uiThemes = app.model.appUIThemes || [];
39
- if (uiThemes.length > 0) {
40
- const colorThemes = uiThemes.filter((uiTheme) => {
41
- return uiTheme.themeParams && uiTheme.themeParams["icon-theme"] !== "true";
42
- });
43
- if (colorThemes.length > 0) {
44
- for (let index = 0; index < colorThemes.length; index++) {
45
- const colorTheme = colorThemes[index];
46
- await ibiz.util.theme.loadTheme(colorTheme);
68
+ /**
69
+ * @description 加载组织数据
70
+ * @returns {*} {Promise<void>}
71
+ * @memberof AuthGuard
72
+ */
73
+ async loadOrgData() {
74
+ const res = await ibiz.net.get(`/uaa/getbydcsystem/${ibiz.env.dcSystem}`);
75
+ if (res.ok) {
76
+ const orgDataItems = res.data;
77
+ if (orgDataItems) {
78
+ const [data] = orgDataItems;
79
+ ibiz.orgData = data;
47
80
  }
48
81
  }
49
- const iconThemes = uiThemes.filter((uiTheme) => {
50
- return uiTheme.themeParams && uiTheme.themeParams["icon-theme"] === "true";
51
- });
52
- if (iconThemes.length > 0) {
53
- for (let index = 0; index < iconThemes.length; index++) {
54
- const iconTheme = iconThemes[index];
55
- await ibiz.util.theme.loadTheme(iconTheme, "ICON");
82
+ }
83
+ /**
84
+ * @description 加载主题插件
85
+ * @returns {*} {Promise<void>}
86
+ * @memberof AuthGuard
87
+ */
88
+ async loadTheme() {
89
+ const app = ibiz.hub.getApp();
90
+ const uiThemes = app.model.appUIThemes || [];
91
+ if (uiThemes.length > 0) {
92
+ const colorThemes = uiThemes.filter((uiTheme) => {
93
+ return uiTheme.themeParams && uiTheme.themeParams["icon-theme"] !== "true";
94
+ });
95
+ if (colorThemes.length > 0) {
96
+ for (let index = 0; index < colorThemes.length; index++) {
97
+ const colorTheme = colorThemes[index];
98
+ await ibiz.util.theme.loadTheme(colorTheme);
99
+ }
100
+ }
101
+ const iconThemes = uiThemes.filter((uiTheme) => {
102
+ return uiTheme.themeParams && uiTheme.themeParams["icon-theme"] === "true";
103
+ });
104
+ if (iconThemes.length > 0) {
105
+ for (let index = 0; index < iconThemes.length; index++) {
106
+ const iconTheme = iconThemes[index];
107
+ await ibiz.util.theme.loadTheme(iconTheme, "ICON");
108
+ }
56
109
  }
57
110
  }
58
111
  }
59
- }
60
- let helper;
61
- async function initEnvironment() {
62
- if (helper) {
63
- const app = await helper.getAppModel();
112
+ /**
113
+ * @description 根据应用自定义参数解析成环境变量
114
+ * @param {IApplication} app
115
+ * @returns {*} {Promise<void>}
116
+ * @memberof AuthGuard
117
+ */
118
+ async initEnvironment(app) {
64
119
  const userParam = app.userParam;
65
120
  if (userParam) {
66
121
  Object.keys(userParam).forEach((key) => {
@@ -83,172 +138,129 @@ async function initEnvironment() {
83
138
  ibiz.log.setLevel(ibiz.env.logLevel);
84
139
  }
85
140
  }
86
- }
87
- async function initModel(context, permission = true) {
88
- if (!helper) {
89
- helper = new modelHelper.ModelHelper(
90
- async (url) => {
91
- if (ibiz.env.isLocalModel) {
92
- const res2 = await ibiz.net.getModel(`./model${url}`);
93
- return res2.data;
94
- }
95
- const res = await ibiz.net.get(
96
- `${ibiz.env.remoteModelUrl}${url}`,
97
- void 0,
98
- permission ? {} : { srfdcsystem: ibiz.env.dcSystem }
99
- );
100
- return res.data;
101
- },
102
- ibiz.env.appId,
103
- context,
104
- permission
105
- );
106
- const app = await ibiz.hub.getAppAsync(ibiz.env.appId);
107
- await initEnvironment();
108
- await vue3Util.AppHooks.initedApp.call({ context, app });
109
- const appModel = app.model;
110
- ibiz.env.isMob = appModel.mobileApp === true;
111
- if (ibiz.env.isEnableMultiLan) {
112
- const lang = ibiz.i18n.getLang();
113
- const m = await helper.getPSAppLang(lang.replace("-", "_").toUpperCase());
114
- const items = m.languageItems || [];
115
- const data = {};
116
- items.forEach((item) => {
117
- data[item.lanResTag] = item.content;
118
- });
119
- index.i18n.global.mergeLocaleMessage(lang, data);
120
- }
121
- const module = await import('@ibiz-template/mob-theme');
122
- const theme = module.default || module;
123
- vue3Util.AppHooks.useComponent.callSync(null, theme);
124
- if (ibiz.config.theme)
125
- ibiz.util.theme.setTheme(ibiz.config.theme);
126
- if (appModel.appUIThemes) {
127
- await loadTheme();
128
- }
129
- if (app.model.title) {
130
- ibiz.util.setBrowserTitle("");
141
+ /**
142
+ * @description 初始化模型
143
+ * @param {IParams} context
144
+ * @param {boolean} [_permission=true]
145
+ * @returns {*} {Promise<void>}
146
+ * @memberof AuthGuard
147
+ */
148
+ async initModel(context, _permission = true) {
149
+ }
150
+ /**
151
+ * @description 应用参数初始化
152
+ * @param {IParams} context
153
+ * @returns {*} {Promise<void>}
154
+ * @memberof AuthGuard
155
+ */
156
+ async appInit(context) {
157
+ await vue3Util.AppHooks.beforeInitApp.call({ context });
158
+ await authGuardHooks.AuthGuardHooks.beforeAuth.call(null, null);
159
+ if (ibiz.env.isSaaSMode === true) {
160
+ await this.loadOrgData();
131
161
  }
162
+ await this.loadAppData(context);
163
+ await authGuardHooks.AuthGuardHooks.afterAuth.call(null, null);
164
+ await vue3Util.AppHooks.authedApp.call({ context });
165
+ await this.initModel(context);
166
+ await ibiz.auth.extendLogin(context);
167
+ await ibiz.hub.notice.init();
132
168
  }
133
- }
134
- async function appInit(context) {
135
- await vue3Util.AppHooks.beforeInitApp.call({ context });
136
- await authGuardHooks.AuthGuardHooks.beforeAuth.call(null, null);
137
- if (ibiz.env.isSaaSMode === true) {
138
- await loadOrgData();
169
+ /**
170
+ * @description 抛401异常
171
+ */
172
+ throw401() {
173
+ throw new core.HttpError({
174
+ response: {
175
+ status: 401,
176
+ statusText: ibiz.i18n.t("mobApp.authGuard.noPermission")
177
+ }
178
+ });
139
179
  }
140
- await loadAppData(context);
141
- await authGuardHooks.AuthGuardHooks.afterAuth.call(null, null);
142
- await vue3Util.AppHooks.authedApp.call({ context });
143
- await initModel(context);
144
- await ibiz.auth.extendLogin(context);
145
- await ibiz.hub.notice.init();
146
- }
147
- function throw401() {
148
- throw new core.HttpError({
149
- response: {
150
- status: 401,
151
- statusText: ibiz.i18n.t("mobApp.authGuard.noPermission")
152
- }
153
- });
154
- }
155
- async function anonymousValidate(context) {
156
- const authInfo = ibiz.auth.getAuthInfo();
157
- if (authInfo && !authInfo.isAnonymous) {
158
- try {
159
- await appInit(context);
160
- return;
161
- } catch (error) {
162
- const { status } = error;
163
- if (status === 401) {
164
- const refreshToken = core.getAppCookie(core.CoreConst.REFRESH_TOKEN);
165
- if (refreshToken) {
166
- await ibiz.auth.refreshToken();
167
- await appInit(context);
168
- return;
180
+ /**
181
+ * @description 匿名登录
182
+ * @param {IParams} context
183
+ * @returns {*} {Promise<void>}
184
+ */
185
+ async anonymousValidate(context) {
186
+ const authInfo = ibiz.auth.getAuthInfo();
187
+ if (authInfo && !authInfo.isAnonymous) {
188
+ try {
189
+ await this.appInit(context);
190
+ return;
191
+ } catch (error) {
192
+ const { status } = error;
193
+ if (status === 401) {
194
+ const refreshToken = core.getAppCookie(core.CoreConst.REFRESH_TOKEN);
195
+ if (refreshToken) {
196
+ await ibiz.auth.refreshToken();
197
+ await this.appInit(context);
198
+ return;
199
+ }
200
+ ibiz.auth.clearAuthData();
201
+ } else {
202
+ throw error;
169
203
  }
170
- ibiz.auth.clearAuthData();
171
- } else {
172
- throw error;
173
204
  }
174
205
  }
175
- }
176
- if (authInfo == null ? void 0 : authInfo.token) {
177
- try {
178
- await appInit(context);
179
- } catch (error) {
180
- const { status } = error;
181
- if (status === 401) {
182
- const loginResult = await ibiz.auth.anonymousLogin();
183
- if (!loginResult) {
184
- throw401();
185
- return;
206
+ if (authInfo == null ? void 0 : authInfo.token) {
207
+ try {
208
+ await this.appInit(context);
209
+ } catch (error) {
210
+ const { status } = error;
211
+ if (status === 401) {
212
+ const loginResult = await ibiz.auth.anonymousLogin();
213
+ if (!loginResult) {
214
+ this.throw401();
215
+ return;
216
+ }
217
+ await this.appInit(context);
218
+ } else {
219
+ throw error;
186
220
  }
187
- await appInit(context);
188
- } else {
189
- throw error;
190
221
  }
191
222
  }
192
- }
193
- if (!authInfo || !authInfo.token) {
194
- const loginResult = await ibiz.auth.anonymousLogin();
195
- if (!loginResult) {
196
- throw401();
197
- return;
198
- }
199
- await appInit(context);
200
- }
201
- const urlPaths = window.location.hash.split("/");
202
- const viewName = urlPaths[urlPaths.length - 2];
203
- let viewModel;
204
- try {
205
- if (["#", "index"].includes(viewName) && ibiz.hub.defaultPage) {
206
- viewModel = await ibiz.hub.getAppView(ibiz.hub.defaultPage.id);
207
- } else {
208
- viewModel = await ibiz.hub.getAppView(viewName);
223
+ if (!authInfo || !authInfo.token) {
224
+ const loginResult = await ibiz.auth.anonymousLogin();
225
+ if (!loginResult) {
226
+ this.throw401();
227
+ return;
228
+ }
229
+ await this.appInit(context);
209
230
  }
210
- } catch (error) {
211
- ibiz.log.error(error);
212
- }
213
- if (!viewModel) {
214
- ibiz.log.error(
215
- `\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`
216
- );
217
- throw401();
218
- return;
219
- }
220
- if (viewModel.accUserMode !== 3) {
221
- throw401();
222
- }
223
- }
224
- async function AuthGuard(appContext, permission = true) {
225
- if (permission) {
226
- let result = true;
231
+ const urlPaths = window.location.hash.split("/");
232
+ const viewName = urlPaths[urlPaths.length - 2];
233
+ let viewModel;
227
234
  try {
228
- if (ibiz.env.enableAnonymous) {
229
- await anonymousValidate(appContext);
235
+ if (["#", "index"].includes(viewName) && ibiz.hub.defaultPage) {
236
+ viewModel = await ibiz.hub.getAppView(ibiz.hub.defaultPage.id);
230
237
  } else {
231
- await appInit(appContext);
238
+ viewModel = await ibiz.hub.getAppView(viewName);
232
239
  }
233
240
  } catch (error) {
234
- result = false;
235
- error.tag = "APPINIT";
236
- ibiz.util.error.handle(error);
241
+ ibiz.log.error(error);
242
+ }
243
+ if (!viewModel) {
244
+ ibiz.log.error(
245
+ `\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`
246
+ );
247
+ this.throw401();
248
+ return;
249
+ }
250
+ if (viewModel.accUserMode !== 3) {
251
+ this.throw401();
237
252
  }
238
- return result;
239
253
  }
240
- if (ibiz.env.enableAnonymous) {
241
- try {
242
- await anonymousValidate(appContext);
243
- } catch (error) {
244
- error.tag = "APPINIT";
245
- ibiz.util.error.handle(error);
246
- return false;
254
+ async initTheme(appModel) {
255
+ const module = await import('@ibiz-template/mob-theme');
256
+ const theme = module.default || module;
257
+ vue3Util.AppHooks.useComponent.callSync(null, theme);
258
+ if (ibiz.config.theme)
259
+ ibiz.util.theme.setTheme(ibiz.config.theme);
260
+ if (appModel.appUIThemes) {
261
+ await this.loadTheme();
247
262
  }
248
- } else {
249
- await initModel(appContext, false);
250
263
  }
251
- return true;
252
264
  }
253
265
 
254
266
  exports.AuthGuard = AuthGuard;
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ var modelHelper = require('@ibiz-template/model-helper');
4
+ var vue3Util = require('@ibiz-template/vue3-util');
5
+ var authGuard = require('./auth-guard.cjs');
6
+ var index = require('../../../locale/index.cjs');
7
+
8
+ "use strict";
9
+ var __defProp = Object.defineProperty;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __publicField = (obj, key, value) => {
12
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13
+ return value;
14
+ };
15
+ class DynaAuthGuard extends authGuard.AuthGuard {
16
+ constructor() {
17
+ super(...arguments);
18
+ __publicField(this, "hasModelInit", false);
19
+ __publicField(this, "noPermissionModel", false);
20
+ }
21
+ async initModel(context, permission = true) {
22
+ if (!this.hasModelInit || this.hasModelInit && this.noPermissionModel !== permission) {
23
+ const helper = new modelHelper.ModelHelper(
24
+ async (url) => {
25
+ if (ibiz.env.isLocalModel) {
26
+ const res2 = await ibiz.net.getModel(`./model${url}`);
27
+ return res2.data;
28
+ }
29
+ const res = await ibiz.net.get(
30
+ `${ibiz.env.remoteModelUrl}${url}`,
31
+ void 0,
32
+ permission ? {} : { srfdcsystem: ibiz.env.dcSystem }
33
+ );
34
+ return res.data;
35
+ },
36
+ ibiz.env.appId,
37
+ context,
38
+ permission
39
+ );
40
+ const app = await ibiz.hub.getAppAsync(ibiz.env.appId);
41
+ await this.initEnvironment(app);
42
+ await vue3Util.AppHooks.initedApp.call({ context, app });
43
+ const appModel = app.model;
44
+ ibiz.env.isMob = appModel.mobileApp === true;
45
+ if (ibiz.env.isEnableMultiLan) {
46
+ const lang = ibiz.i18n.getLang();
47
+ const m = await helper.getPSAppLang(
48
+ lang.replace("-", "_").toUpperCase()
49
+ );
50
+ const items = m.languageItems || [];
51
+ const data = {};
52
+ items.forEach((item) => {
53
+ data[item.lanResTag] = item.content;
54
+ });
55
+ index.i18n.global.mergeLocaleMessage(lang, data);
56
+ }
57
+ await this.initTheme(app);
58
+ if (app.model.title) {
59
+ ibiz.util.setBrowserTitle("");
60
+ }
61
+ }
62
+ this.noPermissionModel = permission;
63
+ this.hasModelInit = true;
64
+ }
65
+ }
66
+
67
+ exports.DynaAuthGuard = DynaAuthGuard;
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var authGuard = require('./auth-guard/auth-guard.cjs');
4
+ var dynaAuthGuard = require('./auth-guard/dyna-auth-guard.cjs');
4
5
  var authGuardHooks = require('./auth-guard-hooks.cjs');
5
6
 
6
7
  "use strict";
7
8
 
8
9
  exports.AuthGuard = authGuard.AuthGuard;
10
+ exports.DynaAuthGuard = dynaAuthGuard.DynaAuthGuard;
9
11
  exports.AuthGuardHooks = authGuardHooks.AuthGuardHooks;
@@ -3,8 +3,10 @@
3
3
  var main = require('./main.cjs');
4
4
  require('./guard/index.cjs');
5
5
  var authGuardHooks = require('./guard/auth-guard-hooks.cjs');
6
+ var authGuard = require('./guard/auth-guard/auth-guard.cjs');
6
7
 
7
8
  "use strict";
8
9
 
9
10
  exports.runApp = main.runApp;
10
11
  exports.AuthGuardHooks = authGuardHooks.AuthGuardHooks;
12
+ exports.AuthGuard = authGuard.AuthGuard;
@@ -10,7 +10,9 @@ var createVueApp = require('./create-vue-app.cjs');
10
10
  var index = require('./router/index.cjs');
11
11
  require('./util/index.cjs');
12
12
  require('../util/index.cjs');
13
+ require('./guard/index.cjs');
13
14
  var unauthorizedHandler = require('./util/unauthorized-handler/unauthorized-handler.cjs');
15
+ var dynaAuthGuard = require('./guard/auth-guard/dyna-auth-guard.cjs');
14
16
  var appUtil = require('../util/app-util/app-util.cjs');
15
17
  var openViewUtil = require('../util/open-view-util/open-view-util.cjs');
16
18
  var messageUtil = require('../util/message-util/message-util.cjs');
@@ -21,9 +23,10 @@ var loadingUtil = require('../util/loading-util/loading-util.cjs');
21
23
  var overlayController = require('../util/overlay-controller/overlay-controller.cjs');
22
24
  var fullscreenUtil = require('../util/fullscreen/fullscreen-util.cjs');
23
25
  var qrcodeUtil = require('../util/qrcode-util/qrcode-util.cjs');
26
+ var aiChatUtil = require('../util/ai-chat-util/ai-chat-util.cjs');
24
27
 
25
28
  "use strict";
26
- async function runApp(plugins) {
29
+ async function runApp(plugins, opts) {
27
30
  vue3Util.AppHooks.createApp.tap((_, app2) => {
28
31
  if (plugins) {
29
32
  plugins.forEach((plugin) => {
@@ -61,6 +64,15 @@ async function runApp(plugins) {
61
64
  });
62
65
  await attachEnvironmentConfig.attachEnvironmentConfig();
63
66
  devtool.install();
67
+ let authGuard;
68
+ if (opts == null ? void 0 : opts.getAuthGuard) {
69
+ authGuard = opts.getAuthGuard();
70
+ } else {
71
+ authGuard = new dynaAuthGuard.DynaAuthGuard();
72
+ }
73
+ index.AppRouter.setAuthGuard(
74
+ (context, notLogin) => authGuard.verify(context, notLogin)
75
+ );
64
76
  const router = index.AppRouter.getRouter();
65
77
  app.use(router);
66
78
  devtool.listenOpenDevTool(router);
@@ -78,6 +90,7 @@ async function runApp(plugins) {
78
90
  return app.config.globalProperties.$textFormat(value, code);
79
91
  };
80
92
  ibiz.qrcodeUtil = new qrcodeUtil.QrcodeUtil();
93
+ ibiz.aiChatUtil = new aiChatUtil.AIChatUtil();
81
94
  await ibiz.i18n.init();
82
95
  app.mount("#app");
83
96
  }
@@ -5,11 +5,9 @@ var runtime = require('@ibiz-template/runtime');
5
5
  var qxUtil = require('qx-util');
6
6
  var vue3Util = require('@ibiz-template/vue3-util');
7
7
  var qs = require('qs');
8
- require('../guard/index.cjs');
9
8
  require('../components/index.cjs');
10
9
  require('../../view/index.cjs');
11
10
  require('../../util/index.cjs');
12
- var authGuard = require('../guard/auth-guard/auth-guard.cjs');
13
11
  var _404View = require('../../view/404-view/404-view.cjs');
14
12
  var modalRouterShell = require('../components/modal-router-shell/modal-router-shell.cjs');
15
13
  var routerShell = require('../components/router-shell/router-shell.cjs');
@@ -38,6 +36,9 @@ const getPropsCallback = (depth) => {
38
36
  });
39
37
  };
40
38
  class AppRouter {
39
+ static setAuthGuard(authGuard) {
40
+ this.authGuard = authGuard;
41
+ }
41
42
  static getAppContext(route) {
42
43
  let appContext = {};
43
44
  if (route.params.appContext && route.params.appContext !== ibiz.env.routePlaceholder) {
@@ -61,7 +62,7 @@ class AppRouter {
61
62
  if (!qxUtil.isNilOrEmpty(ibiz.appData)) {
62
63
  next();
63
64
  } else {
64
- const authority = await authGuard.AuthGuard(this.getAppContext(_to));
65
+ const authority = await this.authGuard(this.getAppContext(_to));
65
66
  if (authority) {
66
67
  next();
67
68
  } else {
@@ -157,7 +158,7 @@ class AppRouter {
157
158
  name: "loginView",
158
159
  meta: { preset: true },
159
160
  beforeEnter: async (_to, _from, next) => {
160
- await authGuard.AuthGuard(this.getAppContext(_to), false);
161
+ await this.authGuard(this.getAppContext(_to), false);
161
162
  next();
162
163
  },
163
164
  component: loginView.LoginView
@@ -218,5 +219,6 @@ class AppRouter {
218
219
  }
219
220
  }
220
221
  __publicField(AppRouter, "router");
222
+ __publicField(AppRouter, "authGuard");
221
223
 
222
224
  exports.AppRouter = AppRouter;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _commonjsHelpers = require('../../../../../../../_virtual/_commonjsHelpers.cjs');
6
- var index = require('../../../../../../../_virtual/index12.cjs');
6
+ var index = require('../../../../../../../_virtual/index14.cjs');
7
7
 
8
8
  /*
9
9
  *****************************************************************************