@epxing/core 5.3.0-beta.2 → 5.3.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/API.md +715 -714
  2. package/README.md +3 -1
  3. package/dist/.cache/route-chart-release/frontend/frame/public/js/ecStat.min.js +4 -0
  4. package/dist/.cache/route-chart-release/frontend/frame/public/js/echarts-wordcloud.min.js +6 -0
  5. package/dist/.cache/route-chart-release/frontend/frame/public/js/echarts.min.js +49 -0
  6. package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
  7. package/dist/_virtual/jsencrypt.min.js +1 -1
  8. package/dist/assets/role_select-DTqRlFNz.webp +0 -0
  9. package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/jsencrypt@3.5.4/_vendor/jsencrypt/bin/jsencrypt.min.js +1 -1
  10. package/dist/src/RootApp.js +54 -0
  11. package/dist/src/api/createHttp.js +6 -0
  12. package/dist/src/app-ui-settings.js +49 -0
  13. package/dist/src/axios.js +10 -15
  14. package/dist/src/chart-runtime-assets.js +19 -0
  15. package/dist/src/chart-runtime-sources.js +8 -0
  16. package/dist/src/create-app.js +3 -6
  17. package/dist/src/index.js +2 -0
  18. package/dist/src/loadComponent.js +2 -2
  19. package/dist/src/menu-route.js +11 -0
  20. package/dist/src/mixins/component.js +3 -0
  21. package/dist/src/navigation-context.js +47 -0
  22. package/dist/src/navigation.js +43 -12
  23. package/dist/src/package-install.js +3 -2
  24. package/dist/src/plugins/element-plus.js +8 -8
  25. package/dist/src/public-api.js +4 -2
  26. package/dist/src/route-components.js +9 -0
  27. package/dist/src/router/config.js +7 -8
  28. package/dist/src/runtime-services.js +1 -1
  29. package/dist/src/runtime-utils/meta.js +3 -0
  30. package/dist/src/runtime-utils/pdf.viewer.js +31 -15
  31. package/dist/src/runtime-utils/util.js +28 -5
  32. package/dist/src/shared-packages.js +1 -3
  33. package/dist/src/store/modules/list.js +25 -3
  34. package/dist/src/store/modules/meta.js +49 -7
  35. package/dist/src/style-presets.js +4 -4
  36. package/dist/src/ui-settings.js +90 -18
  37. package/dist/src/views/App.js +48 -0
  38. package/dist/src/views/AppRoleSelect.js +233 -0
  39. package/dist/src/views/Error.js +210 -0
  40. package/dist/src/views/Module.js +173 -0
  41. package/dist/style.css +251 -0
  42. package/package.json +4 -4
  43. package/src/RootApp.vue +75 -0
  44. package/src/api/createHttp.js +7 -0
  45. package/src/api/index.js +47 -47
  46. package/src/app-ui-settings.js +31 -0
  47. package/src/axios.js +311 -318
  48. package/src/chart-runtime-assets.js +13 -0
  49. package/src/chart-runtime-sources.js +5 -0
  50. package/src/create-app.js +3 -7
  51. package/src/index.js +28 -28
  52. package/src/install.js +157 -157
  53. package/src/loadComponent.js +187 -187
  54. package/src/loadLibrary.js +99 -99
  55. package/src/menu-route.js +12 -1
  56. package/src/mixins/component.js +1464 -1461
  57. package/src/navigation-context.js +49 -0
  58. package/src/navigation.js +208 -176
  59. package/src/package-install.js +2 -1
  60. package/src/plugins/element-plus.js +302 -302
  61. package/src/plugins/frame.js +178 -178
  62. package/src/public-api.js +1 -0
  63. package/src/route-components.js +7 -0
  64. package/src/router/config.js +861 -864
  65. package/src/router/public.js +1 -1
  66. package/src/runtime-services.js +1 -1
  67. package/src/runtime-utils/fieldFactory.js +179 -179
  68. package/src/runtime-utils/meta.js +399 -378
  69. package/src/runtime-utils/pdf.viewer.js +672 -644
  70. package/src/runtime-utils/util.js +1359 -1330
  71. package/src/shared-packages.js +1 -3
  72. package/src/store/modules/config.js +351 -351
  73. package/src/store/modules/list.js +30 -3
  74. package/src/store/modules/locale.js +236 -236
  75. package/src/store/modules/meta.js +314 -265
  76. package/src/style-presets.js +4 -4
  77. package/src/ui-settings.js +84 -23
  78. package/src/views/App.vue +53 -0
  79. package/src/views/AppRoleSelect.vue +334 -0
  80. package/src/views/Error.vue +63 -0
  81. package/src/views/Module.vue +210 -0
  82. package/src/xss.js +26 -26
  83. package/types/app.d.ts +10 -10
  84. package/types/axios.d.ts +1 -1
  85. package/types/component-mixin.d.ts +1 -1
  86. package/types/field-factory.d.ts +1 -1
  87. package/types/global-mixin.d.ts +1 -1
  88. package/types/http.d.ts +1 -1
  89. package/types/index.d.ts +3 -0
  90. package/types/meta.d.ts +1 -1
  91. package/types/navigation.d.ts +21 -21
  92. package/types/pdf-viewer.d.ts +1 -1
  93. package/types/runtime.d.ts +13 -13
  94. package/types/store.d.ts +1 -1
  95. package/types/util.d.ts +2 -2
  96. /package/dist/{build → .cache/route-chart-release/frontend/frame/build}/stubs/empty-components.js +0 -0
  97. /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-icons.names.js +0 -0
  98. /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-plus.lazy.js +0 -0
  99. /package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/element-plus@2.14.3_vue@3.5.39_typescript@5.9.3_/_vendor/element-plus/dist/locale/en.js +0 -0
  100. /package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/element-plus@2.14.3_vue@3.5.39_typescript@5.9.3_/_vendor/element-plus/dist/locale/zh-cn.js +0 -0
@@ -3,7 +3,7 @@ import routes, { beforeEach } from './config'
3
3
 
4
4
  export const routerConfig = { routes, beforeEach }
5
5
 
6
- // 平台路由使用延迟注册的 component/business 视图,由产品按需安装。
6
+ // 基础路由页由 core 安装;页面渲染组件和可选业务视图由产品按需安装。
7
7
  export function createFrameRouter (options = {}) {
8
8
  const { beforeEach: guard = beforeEach, ...routerOptions } = options
9
9
  const router = createRouter({ history: createWebHashHistory(), routes, ...routerOptions })
@@ -41,7 +41,7 @@ export function registerRouteComponents (components) {
41
41
  export function runtimeRouteComponent (name) {
42
42
  return async () => {
43
43
  const component = routeComponents.get(name)
44
- if (!component) throw new Error(`[epx/core] 路由组件 ${name} 尚未注册,请安装 component/business 或传入 routeComponents`)
44
+ if (!component) throw new Error(`[epx/core] 路由组件 ${name} 尚未注册,请安装提供该页面的 components/business 包或传入 routeComponents`)
45
45
  return component
46
46
  }
47
47
  }
@@ -1,179 +1,179 @@
1
- import { runtimeStore } from '../runtime-services'
2
- import { ADD_LIST, ADD_META } from '@epxing/core/src/store/actions'
3
- import { isString } from 'lodash-es'
4
- export class FieldFactory {
5
- constructor (store = runtimeStore) {
6
- this.store = store
7
- }
8
- // 创建字段配置
9
- async createFields ({ fields, fieldScope, meta, pageType = 'DETAIL', metaId = '', metaViewId, hiddenFields = [], defaultFieldConfigs = {}, type = 'list' }) {
10
- const fieldConfigMaps = []
11
- let metaView = null
12
- // 走 getter 而不是直接读 state,读取本身会刷新缓存的「最近使用」记录,避免被淘汰
13
- let newMeta = meta || this.store.getters.getMetaById(`${metaId}`)
14
- if (!newMeta) {
15
- newMeta = await this.store.dispatch({ // 加回调
16
- type: ADD_META,
17
- metaId: metaId
18
- })
19
- }
20
- if (newMeta.metaView) {
21
- metaView = newMeta.metaView[metaViewId]
22
- }
23
- const metaViewFieldMap = {}
24
-
25
- if (metaView && metaView.fields) {
26
- const metaViewFields = JSON.parse(metaView.fields)
27
- metaViewFields.forEach(item => {
28
- if (typeof item !== 'string') {
29
- metaViewFieldMap[item.attriName] = item
30
- }
31
- })
32
- }
33
- if (!fields || Object.keys(fields).length === 0) {
34
- const allFields = [...type === 'form' ? newMeta.getFormFields() : newMeta.getListFields()]
35
- if (metaView && metaView.listFields) {
36
- fields = JSON.parse(metaView.listFields)
37
- if (!fields || fields.length === 0) fields = allFields
38
- } else {
39
- fields = allFields
40
- }
41
- }
42
- const metaKeyName = newMeta.getKey()
43
- const metaKeyType = newMeta.getKeyType()
44
- for (let i = 0; i < fields.length; i++) {
45
- let fieldConfig = {} // 字段配置信息
46
- const field = fields[i]
47
- if (field === null || field === undefined) continue
48
- const metaViewFieldConfig = metaViewFieldMap[field.attriName || field] || {}
49
- if (isString(field)) {
50
- fieldConfig = { attriName: field, ...metaViewFieldConfig }
51
- } else {
52
- fieldConfig = { ...field, ...metaViewFieldConfig }
53
- }
54
- if (fieldConfig.type === 'meta') {
55
- const relation = newMeta.relatedEntitys.find(item => item.flag === fieldConfig.attriName)
56
- if (relation) {
57
- if (!fieldConfig.attriLabel) fieldConfig.attriLabel = relation.title
58
- }
59
- }
60
- if (!fieldConfig.attriName) {
61
- continue
62
- }
63
- if (defaultFieldConfigs[fieldConfig.attriName]) {
64
- fieldConfig = { ...defaultFieldConfigs[fieldConfig.attriName], ...fieldConfig }
65
- }
66
-
67
- if (fieldConfig.attriName === metaKeyName && (fieldConfig.state || pageType) !== 'SEARCH' && fieldConfig.state !== 'DETAIL') {
68
- if (metaKeyType !== 'assigned') {
69
- fieldConfig.state = 'HIDDEN'
70
- } else {
71
- const { dataType } = newMeta.attributes[metaKeyName]
72
- if (dataType === 'derive') {
73
- if (pageType === 'EDIT' || pageType === 'ADD') {
74
- fieldConfig.state = 'HIDDEN'
75
- }
76
- }
77
- }
78
- }
79
- if (!fieldConfig.state) fieldConfig.state = pageType
80
-
81
- const isHidden = hiddenFields.find(item => fieldConfig.attriName === (item.attriName || item))
82
- if (isHidden) {
83
- fieldConfig.state = 'HIDDEN'
84
- }
85
-
86
- // 无效字段
87
- if (fieldConfig.state && fieldConfig.state === 'INVALID') {
88
- fieldConfigMaps.push(fieldConfig)
89
- continue
90
- }
91
-
92
- // 隐含字段
93
- // if (fieldConfig.state && fieldConfig.state === 'HIDDEN') {
94
- // fieldConfigMaps.push(fieldConfig)
95
- // continue
96
- // }
97
-
98
- let fieldFromMetaId = newMeta.getId()
99
- let fieldFromMeta = newMeta
100
- let fieldName = fieldConfig.attriName
101
-
102
- if (fieldName.indexOf('|') > -1) { // 关联字段
103
- const fieldNameArray = fieldName.split('|')
104
- fieldName = fieldNameArray[fieldNameArray.length - 1]
105
- for (let i = 0; i < fieldNameArray.length - 1; i++) {
106
- fieldFromMetaId = fieldFromMeta.getRelationIdByMetaId(fieldNameArray[i])
107
- if (!fieldFromMetaId) break
108
- fieldFromMeta = this.store.getters.getMetaById(fieldFromMetaId)
109
- if (!fieldFromMeta) {
110
- fieldFromMeta = await this.store.dispatch({ // 加回调
111
- type: ADD_META,
112
- metaId: fieldFromMetaId
113
- })
114
- }
115
- }
116
- }
117
- fieldConfig = this.createFieldConfig({ fieldFromMeta, fieldConfig: { ...fieldConfig }, fieldName })
118
- // 判断字段权限
119
- if (fieldScope && fieldConfig.type !== 'meta') {
120
- const type = fieldConfig.state === 'ADD' || fieldConfig.state === 'EDIT' ? '2' : '1'
121
- const scope = fieldScope[type]
122
- if (scope) {
123
- if (fieldConfig.dataType !== 'custom' && !scope.includes(fieldConfig.attriName)) {
124
- continue
125
- }
126
- }
127
- }
128
- if (fieldConfig.attriLabel) {
129
- fieldConfigMaps.push(fieldConfig)
130
- }
131
- }
132
- return fieldConfigMaps
133
- }
134
-
135
- createFieldConfig ({ fieldFromMeta, fieldConfig, fieldName }) {
136
- const attribute = fieldFromMeta.getAttribute(fieldName) || {}
137
- attribute.entityId = fieldFromMeta.id
138
- fieldConfig.attribute = { ...attribute, ...(fieldConfig.attribute || {}) }
139
- if (!fieldConfig.attriLabel) fieldConfig.attriLabel = attribute.label
140
- // if(!fieldConfig.fieldName) fieldConfig.fieldName = fieldName;
141
- if (!fieldConfig.dataType) fieldConfig.dataType = attribute.dataType
142
- if (!fieldConfig.codeKey) {
143
- if (fieldConfig.dataType === 'list') fieldConfig.codeKey = attribute.codeKey
144
- else fieldConfig.codeKey = attribute.relatedEntity || attribute.codeKey
145
- }
146
- if (!fieldConfig.isRequired) fieldConfig.isRequired = attribute.isRequired
147
- if (fieldConfig.state === 'EDIT' || fieldConfig.state === 'ADD' || fieldConfig.state === 'SEARCH') {
148
- if (fieldConfig.dataType === 'list' || fieldConfig.dataType === 'treeList' || fieldConfig.dataType === 'radio' || fieldConfig.dataType === 'multibox') {
149
- this.setList(fieldConfig.dataType, fieldConfig.codeKey, fieldConfig.attribute)
150
- } else if (fieldConfig.dataType === 'object') {
151
- // this.setList(fieldConfig.dataType, fieldConfig.codeKey)
152
- }
153
- }
154
-
155
- if (fieldConfig.dataType === 'formula') {
156
- fieldConfig.submitValue = false
157
- if (fieldConfig.state === 'EDIT' || fieldConfig.state === 'ADD') {
158
- fieldConfig.state = 'HIDDEN'
159
- }
160
- }
161
- if (fieldConfig.fieldLabel) fieldConfig.attriLabel = fieldConfig.fieldLabel
162
- if (fieldConfig.emptyText) fieldConfig.placeholder = fieldConfig.emptyText
163
- return fieldConfig
164
- }
165
-
166
- setList (dataType, codeKey, { optionType }) {
167
- this.store.dispatch({
168
- type: ADD_LIST,
169
- key: codeKey,
170
- dataType: optionType || dataType
171
- })
172
- }
173
- }
174
-
175
- export function createFieldFactory (store) {
176
- return new FieldFactory(store)
177
- }
178
-
179
- export default createFieldFactory()
1
+ import { runtimeStore } from '../runtime-services'
2
+ import { ADD_LIST, ADD_META } from '@epxing/core/src/store/actions'
3
+ import { isString } from 'lodash-es'
4
+ export class FieldFactory {
5
+ constructor (store = runtimeStore) {
6
+ this.store = store
7
+ }
8
+ // 创建字段配置
9
+ async createFields ({ fields, fieldScope, meta, pageType = 'DETAIL', metaId = '', metaViewId, hiddenFields = [], defaultFieldConfigs = {}, type = 'list' }) {
10
+ const fieldConfigMaps = []
11
+ let metaView = null
12
+ // 走 getter 而不是直接读 state,读取本身会刷新缓存的「最近使用」记录,避免被淘汰
13
+ let newMeta = meta || this.store.getters.getMetaById(`${metaId}`)
14
+ if (!newMeta) {
15
+ newMeta = await this.store.dispatch({ // 加回调
16
+ type: ADD_META,
17
+ metaId: metaId
18
+ })
19
+ }
20
+ if (newMeta.metaView) {
21
+ metaView = newMeta.metaView[metaViewId]
22
+ }
23
+ const metaViewFieldMap = {}
24
+
25
+ if (metaView && metaView.fields) {
26
+ const metaViewFields = JSON.parse(metaView.fields)
27
+ metaViewFields.forEach(item => {
28
+ if (typeof item !== 'string') {
29
+ metaViewFieldMap[item.attriName] = item
30
+ }
31
+ })
32
+ }
33
+ if (!fields || Object.keys(fields).length === 0) {
34
+ const allFields = [...type === 'form' ? newMeta.getFormFields() : newMeta.getListFields()]
35
+ if (metaView && metaView.listFields) {
36
+ fields = JSON.parse(metaView.listFields)
37
+ if (!fields || fields.length === 0) fields = allFields
38
+ } else {
39
+ fields = allFields
40
+ }
41
+ }
42
+ const metaKeyName = newMeta.getKey()
43
+ const metaKeyType = newMeta.getKeyType()
44
+ for (let i = 0; i < fields.length; i++) {
45
+ let fieldConfig = {} // 字段配置信息
46
+ const field = fields[i]
47
+ if (field === null || field === undefined) continue
48
+ const metaViewFieldConfig = metaViewFieldMap[field.attriName || field] || {}
49
+ if (isString(field)) {
50
+ fieldConfig = { attriName: field, ...metaViewFieldConfig }
51
+ } else {
52
+ fieldConfig = { ...field, ...metaViewFieldConfig }
53
+ }
54
+ if (fieldConfig.type === 'meta') {
55
+ const relation = newMeta.relatedEntitys.find(item => item.flag === fieldConfig.attriName)
56
+ if (relation) {
57
+ if (!fieldConfig.attriLabel) fieldConfig.attriLabel = relation.title
58
+ }
59
+ }
60
+ if (!fieldConfig.attriName) {
61
+ continue
62
+ }
63
+ if (defaultFieldConfigs[fieldConfig.attriName]) {
64
+ fieldConfig = { ...defaultFieldConfigs[fieldConfig.attriName], ...fieldConfig }
65
+ }
66
+
67
+ if (fieldConfig.attriName === metaKeyName && (fieldConfig.state || pageType) !== 'SEARCH' && fieldConfig.state !== 'DETAIL') {
68
+ if (metaKeyType !== 'assigned') {
69
+ fieldConfig.state = 'HIDDEN'
70
+ } else {
71
+ const { dataType } = newMeta.attributes[metaKeyName]
72
+ if (dataType === 'derive') {
73
+ if (pageType === 'EDIT' || pageType === 'ADD') {
74
+ fieldConfig.state = 'HIDDEN'
75
+ }
76
+ }
77
+ }
78
+ }
79
+ if (!fieldConfig.state) fieldConfig.state = pageType
80
+
81
+ const isHidden = hiddenFields.find(item => fieldConfig.attriName === (item.attriName || item))
82
+ if (isHidden) {
83
+ fieldConfig.state = 'HIDDEN'
84
+ }
85
+
86
+ // 无效字段
87
+ if (fieldConfig.state && fieldConfig.state === 'INVALID') {
88
+ fieldConfigMaps.push(fieldConfig)
89
+ continue
90
+ }
91
+
92
+ // 隐含字段
93
+ // if (fieldConfig.state && fieldConfig.state === 'HIDDEN') {
94
+ // fieldConfigMaps.push(fieldConfig)
95
+ // continue
96
+ // }
97
+
98
+ let fieldFromMetaId = newMeta.getId()
99
+ let fieldFromMeta = newMeta
100
+ let fieldName = fieldConfig.attriName
101
+
102
+ if (fieldName.indexOf('|') > -1) { // 关联字段
103
+ const fieldNameArray = fieldName.split('|')
104
+ fieldName = fieldNameArray[fieldNameArray.length - 1]
105
+ for (let i = 0; i < fieldNameArray.length - 1; i++) {
106
+ fieldFromMetaId = fieldFromMeta.getRelationIdByMetaId(fieldNameArray[i])
107
+ if (!fieldFromMetaId) break
108
+ fieldFromMeta = this.store.getters.getMetaById(fieldFromMetaId)
109
+ if (!fieldFromMeta) {
110
+ fieldFromMeta = await this.store.dispatch({ // 加回调
111
+ type: ADD_META,
112
+ metaId: fieldFromMetaId
113
+ })
114
+ }
115
+ }
116
+ }
117
+ fieldConfig = this.createFieldConfig({ fieldFromMeta, fieldConfig: { ...fieldConfig }, fieldName })
118
+ // 判断字段权限
119
+ if (fieldScope && fieldConfig.type !== 'meta') {
120
+ const type = fieldConfig.state === 'ADD' || fieldConfig.state === 'EDIT' ? '2' : '1'
121
+ const scope = fieldScope[type]
122
+ if (scope) {
123
+ if (fieldConfig.dataType !== 'custom' && !scope.includes(fieldConfig.attriName)) {
124
+ continue
125
+ }
126
+ }
127
+ }
128
+ if (fieldConfig.attriLabel) {
129
+ fieldConfigMaps.push(fieldConfig)
130
+ }
131
+ }
132
+ return fieldConfigMaps
133
+ }
134
+
135
+ createFieldConfig ({ fieldFromMeta, fieldConfig, fieldName }) {
136
+ const attribute = fieldFromMeta.getAttribute(fieldName) || {}
137
+ attribute.entityId = fieldFromMeta.id
138
+ fieldConfig.attribute = { ...attribute, ...(fieldConfig.attribute || {}) }
139
+ if (!fieldConfig.attriLabel) fieldConfig.attriLabel = attribute.label
140
+ // if(!fieldConfig.fieldName) fieldConfig.fieldName = fieldName;
141
+ if (!fieldConfig.dataType) fieldConfig.dataType = attribute.dataType
142
+ if (!fieldConfig.codeKey) {
143
+ if (fieldConfig.dataType === 'list') fieldConfig.codeKey = attribute.codeKey
144
+ else fieldConfig.codeKey = attribute.relatedEntity || attribute.codeKey
145
+ }
146
+ if (!fieldConfig.isRequired) fieldConfig.isRequired = attribute.isRequired
147
+ if (fieldConfig.state === 'EDIT' || fieldConfig.state === 'ADD' || fieldConfig.state === 'SEARCH') {
148
+ if (fieldConfig.dataType === 'list' || fieldConfig.dataType === 'treeList' || fieldConfig.dataType === 'radio' || fieldConfig.dataType === 'multibox') {
149
+ this.setList(fieldConfig.dataType, fieldConfig.codeKey, fieldConfig.attribute)
150
+ } else if (fieldConfig.dataType === 'object') {
151
+ // this.setList(fieldConfig.dataType, fieldConfig.codeKey)
152
+ }
153
+ }
154
+
155
+ if (fieldConfig.dataType === 'formula') {
156
+ fieldConfig.submitValue = false
157
+ if (fieldConfig.state === 'EDIT' || fieldConfig.state === 'ADD') {
158
+ fieldConfig.state = 'HIDDEN'
159
+ }
160
+ }
161
+ if (fieldConfig.fieldLabel) fieldConfig.attriLabel = fieldConfig.fieldLabel
162
+ if (fieldConfig.emptyText) fieldConfig.placeholder = fieldConfig.emptyText
163
+ return fieldConfig
164
+ }
165
+
166
+ setList (dataType, codeKey, { optionType }) {
167
+ this.store.dispatch({
168
+ type: ADD_LIST,
169
+ key: codeKey,
170
+ dataType: optionType || dataType
171
+ })
172
+ }
173
+ }
174
+
175
+ export function createFieldFactory (store) {
176
+ return new FieldFactory(store)
177
+ }
178
+
179
+ export default createFieldFactory()