resolver-egretimp-plus 0.1.119 → 0.1.121

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 (225) hide show
  1. package/dist/h5/index.js +18 -18
  2. package/dist/web/index.js +11 -11
  3. package/package.json +1 -1
  4. package/src/components/options/OptionsDefault.vue +0 -1
  5. package/src/components/packages-web/CustomComponentCycle.vue +38 -33
  6. package/src/components/packages-web/CustomComponentCycleTabPane.vue +40 -33
  7. package/src/components/packages-web/CustomComponentPlain.vue +6 -5
  8. package/src/components/packages-web/CustomComponentTable.jsx +48 -40
  9. package/src/components/packages-web/ElInput copy.jsx +0 -1
  10. package/src/components/packages-web/ElInput.jsx +0 -1
  11. package/src/config.js +2 -0
  12. package/src/hooks/pageConfig.js +10 -4
  13. package/src/index.jsx +15 -10
  14. package/src/renderer.jsx +4 -1
  15. package/src/resolver-common.vue +22 -2
  16. package/src/rules/rulesDriver.js +4 -0
  17. package/src/utils/common.js +13 -0
  18. package/src/utils/render.jsx +196 -96
  19. package/src-bak/analysisComponent.jsx +0 -343
  20. package/src-bak/api/builtIn.js +0 -10
  21. package/src-bak/bpm/bpmInstance.js +0 -388
  22. package/src-bak/bpm/udc-sdk-esm/cjs/impl/application.js +0 -8
  23. package/src-bak/bpm/udc-sdk-esm/cjs/impl/component.js +0 -97
  24. package/src-bak/bpm/udc-sdk-esm/cjs/impl/datasource.js +0 -88
  25. package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/index.js +0 -3
  26. package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/UdcComponent.js +0 -76
  27. package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/index.js +0 -201
  28. package/src-bak/bpm/udc-sdk-esm/cjs/impl/index.js +0 -69
  29. package/src-bak/bpm/udc-sdk-esm/cjs/impl/page.js +0 -56
  30. package/src-bak/bpm/udc-sdk-esm/cjs/impl/utils.js +0 -76
  31. package/src-bak/bpm/udc-sdk-esm/cjs/index.js +0 -46
  32. package/src-bak/bpm/udc-sdk-esm/cjs/utils.js +0 -21
  33. package/src-bak/components/childDialog/index.js +0 -39
  34. package/src-bak/components/childDialog/src/index.vue +0 -185
  35. package/src-bak/components/cmiFormItem/index.js +0 -1
  36. package/src-bak/components/cmiFormItem/src/index.vue +0 -112
  37. package/src-bak/components/confirmInstance-H5/index.js +0 -53
  38. package/src-bak/components/confirmInstance-H5/src/index.vue +0 -54
  39. package/src-bak/components/helper/FormPolyfill.jsx +0 -25
  40. package/src-bak/components/helper/calcTooltip.jsx +0 -134
  41. package/src-bak/components/helper/dock.js +0 -141
  42. package/src-bak/components/helper/eventOrchestration.js +0 -763
  43. package/src-bak/components/helper/resolver.js +0 -163
  44. package/src-bak/components/helper/table.jsx +0 -103
  45. package/src-bak/components/icons/date.vue +0 -33
  46. package/src-bak/components/icons/info.vue +0 -62
  47. package/src-bak/components/icons/loading.vue +0 -19
  48. package/src-bak/components/icons/question-filled.vue +0 -8
  49. package/src-bak/components/loading/index.js +0 -6
  50. package/src-bak/components/loading/loading.js +0 -98
  51. package/src-bak/components/loading/loading.scss +0 -74
  52. package/src-bak/components/loading/loading.vue +0 -89
  53. package/src-bak/components/loadingComponent/LoadingComponent.vue +0 -33
  54. package/src-bak/components/modal/index.js +0 -9
  55. package/src-bak/components/modal/modal.scss +0 -195
  56. package/src-bak/components/modal/modal.vue +0 -201
  57. package/src-bak/components/options/OptionsDefault.vue +0 -47
  58. package/src-bak/components/packages-H5/CmiButton.vue +0 -120
  59. package/src-bak/components/packages-H5/CmiCalendar.vue +0 -152
  60. package/src-bak/components/packages-H5/CmiCell.vue +0 -87
  61. package/src-bak/components/packages-H5/CmiCheckbox.vue +0 -82
  62. package/src-bak/components/packages-H5/CmiDatetimePicker.vue +0 -98
  63. package/src-bak/components/packages-H5/CmiDivider.vue +0 -30
  64. package/src-bak/components/packages-H5/CmiDropdownMenu.vue +0 -58
  65. package/src-bak/components/packages-H5/CmiInput.vue +0 -69
  66. package/src-bak/components/packages-H5/CmiLink.vue +0 -28
  67. package/src-bak/components/packages-H5/CmiPicker.vue +0 -229
  68. package/src-bak/components/packages-H5/CmiRadio.vue +0 -29
  69. package/src-bak/components/packages-H5/CmiSearch.vue +0 -39
  70. package/src-bak/components/packages-H5/CmiSelect.vue +0 -84
  71. package/src-bak/components/packages-H5/CustomComponentCardH5.vue +0 -129
  72. package/src-bak/components/packages-H5/CustomComponentColH5.vue +0 -8
  73. package/src-bak/components/packages-H5/CustomComponentCollapseH5.vue +0 -141
  74. package/src-bak/components/packages-H5/CustomComponentFormLayoutH5.vue +0 -54
  75. package/src-bak/components/packages-H5/CustomComponentTabPaneH5.vue +0 -38
  76. package/src-bak/components/packages-H5/CustomComponentTableH5.vue +0 -352
  77. package/src-bak/components/packages-H5/CustomComponentTabsH5.vue +0 -170
  78. package/src-bak/components/packages-web/CustomComponentCard.vue +0 -40
  79. package/src-bak/components/packages-web/CustomComponentCol.vue +0 -66
  80. package/src-bak/components/packages-web/CustomComponentCollapse.vue +0 -164
  81. package/src-bak/components/packages-web/CustomComponentCycle.vue +0 -95
  82. package/src-bak/components/packages-web/CustomComponentCycleTabPane.vue +0 -155
  83. package/src-bak/components/packages-web/CustomComponentDialog.vue +0 -192
  84. package/src-bak/components/packages-web/CustomComponentEditor.vue +0 -50
  85. package/src-bak/components/packages-web/CustomComponentFileExport.vue +0 -60
  86. package/src-bak/components/packages-web/CustomComponentFileImport.vue +0 -60
  87. package/src-bak/components/packages-web/CustomComponentFormLayout.vue +0 -65
  88. package/src-bak/components/packages-web/CustomComponentGrid.vue +0 -29
  89. package/src-bak/components/packages-web/CustomComponentGridCol.vue +0 -29
  90. package/src-bak/components/packages-web/CustomComponentInputDialog.vue +0 -144
  91. package/src-bak/components/packages-web/CustomComponentNativeTabPane.vue +0 -84
  92. package/src-bak/components/packages-web/CustomComponentPlain.vue +0 -247
  93. package/src-bak/components/packages-web/CustomComponentRow.vue +0 -83
  94. package/src-bak/components/packages-web/CustomComponentSelectEmployees.vue +0 -203
  95. package/src-bak/components/packages-web/CustomComponentSendMail.vue +0 -62
  96. package/src-bak/components/packages-web/CustomComponentSteps.vue +0 -41
  97. package/src-bak/components/packages-web/CustomComponentTabPane.vue +0 -20
  98. package/src-bak/components/packages-web/CustomComponentTable.jsx +0 -814
  99. package/src-bak/components/packages-web/CustomComponentTabs.vue +0 -126
  100. package/src-bak/components/packages-web/CustomComponentTree.vue +0 -28
  101. package/src-bak/components/packages-web/ElButton.vue +0 -146
  102. package/src-bak/components/packages-web/ElCheckbox.vue +0 -97
  103. package/src-bak/components/packages-web/ElDatePicker.vue +0 -93
  104. package/src-bak/components/packages-web/ElInput copy.jsx +0 -393
  105. package/src-bak/components/packages-web/ElInput.jsx +0 -312
  106. package/src-bak/components/packages-web/ElInputNumber.vue +0 -81
  107. package/src-bak/components/packages-web/ElPagination.vue +0 -61
  108. package/src-bak/components/packages-web/ElRadio.vue +0 -47
  109. package/src-bak/components/packages-web/ElSelect.jsx +0 -249
  110. package/src-bak/components/packages-web/ElSelect_bak.vue +0 -155
  111. package/src-bak/components/packages-web/ElText.jsx +0 -187
  112. package/src-bak/components/packages-web/ElTextaa.vue +0 -169
  113. package/src-bak/components/packages-web/ElTimePicker.vue +0 -39
  114. package/src-bak/components/patchComponents-H5.js +0 -46
  115. package/src-bak/components/patchComponents-web.js +0 -46
  116. package/src-bak/components/simpleFormItemPc/index.js +0 -1
  117. package/src-bak/components/simpleFormItemPc/src/index.vue +0 -94
  118. package/src-bak/components/table/index.ts +0 -29
  119. package/src-bak/components/table/src/composables/use-scrollbar.ts +0 -30
  120. package/src-bak/components/table/src/config.ts +0 -256
  121. package/src-bak/components/table/src/filter-panel.vue +0 -260
  122. package/src-bak/components/table/src/h-helper.ts +0 -34
  123. package/src-bak/components/table/src/layout-observer.ts +0 -78
  124. package/src-bak/components/table/src/store/current.ts +0 -85
  125. package/src-bak/components/table/src/store/expand.ts +0 -76
  126. package/src-bak/components/table/src/store/helper.ts +0 -74
  127. package/src-bak/components/table/src/store/index.ts +0 -246
  128. package/src-bak/components/table/src/store/tree.ts +0 -230
  129. package/src-bak/components/table/src/store/watcher.ts +0 -543
  130. package/src-bak/components/table/src/table/defaults.ts +0 -402
  131. package/src-bak/components/table/src/table/key-render-helper.ts +0 -27
  132. package/src-bak/components/table/src/table/style-helper.ts +0 -378
  133. package/src-bak/components/table/src/table/utils-helper.ts +0 -47
  134. package/src-bak/components/table/src/table-body/defaults.ts +0 -52
  135. package/src-bak/components/table/src/table-body/events-helper.ts +0 -203
  136. package/src-bak/components/table/src/table-body/index.ts +0 -119
  137. package/src-bak/components/table/src/table-body/render-helper.ts +0 -283
  138. package/src-bak/components/table/src/table-body/styles-helper.ts +0 -164
  139. package/src-bak/components/table/src/table-column/defaults.ts +0 -237
  140. package/src-bak/components/table/src/table-column/index.ts +0 -202
  141. package/src-bak/components/table/src/table-column/render-helper.ts +0 -214
  142. package/src-bak/components/table/src/table-column/watcher-helper.ts +0 -88
  143. package/src-bak/components/table/src/table-footer/index.ts +0 -128
  144. package/src-bak/components/table/src/table-footer/mapState-helper.ts +0 -33
  145. package/src-bak/components/table/src/table-footer/style-helper.ts +0 -51
  146. package/src-bak/components/table/src/table-header/event-helper.ts +0 -213
  147. package/src-bak/components/table/src/table-header/index.ts +0 -244
  148. package/src-bak/components/table/src/table-header/style.helper.ts +0 -119
  149. package/src-bak/components/table/src/table-header/utils-helper.ts +0 -94
  150. package/src-bak/components/table/src/table-layout.ts +0 -259
  151. package/src-bak/components/table/src/table.vue +0 -389
  152. package/src-bak/components/table/src/tableColumn.ts +0 -3
  153. package/src-bak/components/table/src/tokens.ts +0 -5
  154. package/src-bak/components/table/src/util.ts +0 -521
  155. package/src-bak/components/table/style/css.ts +0 -5
  156. package/src-bak/components/table/style/index.ts +0 -5
  157. package/src-bak/components/tabs/index.js +0 -8
  158. package/src-bak/components/tabs/src/constants.js +0 -23
  159. package/src-bak/components/tabs/src/tab-bar.js +0 -8
  160. package/src-bak/components/tabs/src/tab-bar.vue +0 -92
  161. package/src-bak/components/tabs/src/tab-nav.jsx +0 -424
  162. package/src-bak/components/tabs/src/tab-pane.js +0 -16
  163. package/src-bak/components/tabs/src/tab-pane.vue +0 -80
  164. package/src-bak/components/tabs/src/tabs.jsx +0 -223
  165. package/src-bak/components/tabs/style/css.js +0 -2
  166. package/src-bak/components/tabs/style/index.js +0 -2
  167. package/src-bak/components/thirdPartyFrame/index.js +0 -32
  168. package/src-bak/components/thirdPartyFrame/src/ThirdPartyFrame.vue +0 -125
  169. package/src-bak/enums/index.js +0 -16
  170. package/src-bak/hooks/configLoad.js +0 -45
  171. package/src-bak/hooks/index.js +0 -189
  172. package/src-bak/hooks/mock.js +0 -6960
  173. package/src-bak/hooks/pageConfig.js +0 -127
  174. package/src-bak/index.jsx +0 -443
  175. package/src-bak/renderer.jsx +0 -77
  176. package/src-bak/resolver-H5.vue +0 -88
  177. package/src-bak/resolver-common.vue +0 -129
  178. package/src-bak/resolver-web.vue +0 -91
  179. package/src-bak/rules/eventsSupplement.js +0 -573
  180. package/src-bak/rules/parseCondition.js +0 -378
  181. package/src-bak/rules/ruleUtils.js +0 -273
  182. package/src-bak/rules/rulesDriver.js +0 -139
  183. package/src-bak/rulesImp/events.js +0 -588
  184. package/src-bak/rulesImp/index.js +0 -33
  185. package/src-bak/rulesImp/ruleInstance.js +0 -231
  186. package/src-bak/rulesImp/ruleUtils.js +0 -124
  187. package/src-bak/theme/element/components/button.scss +0 -122
  188. package/src-bak/theme/element/components/card.scss +0 -8
  189. package/src-bak/theme/element/components/checkbox.scss +0 -19
  190. package/src-bak/theme/element/components/collapse.scss +0 -174
  191. package/src-bak/theme/element/components/common.scss +0 -30
  192. package/src-bak/theme/element/components/cycle.scss +0 -0
  193. package/src-bak/theme/element/components/date.scss +0 -13
  194. package/src-bak/theme/element/components/dialog.scss +0 -44
  195. package/src-bak/theme/element/components/form.scss +0 -104
  196. package/src-bak/theme/element/components/index.scss +0 -55
  197. package/src-bak/theme/element/components/input.scss +0 -36
  198. package/src-bak/theme/element/components/message.scss +0 -48
  199. package/src-bak/theme/element/components/pagination.scss +0 -47
  200. package/src-bak/theme/element/components/popper.scss +0 -3
  201. package/src-bak/theme/element/components/radio.scss +0 -40
  202. package/src-bak/theme/element/components/scrollbar.scss +0 -14
  203. package/src-bak/theme/element/components/select.scss +0 -82
  204. package/src-bak/theme/element/components/steps.scss +0 -6
  205. package/src-bak/theme/element/components/table.scss +0 -218
  206. package/src-bak/theme/element/components/tabs.scss +0 -128
  207. package/src-bak/theme/element/components/tag.scss +0 -6
  208. package/src-bak/theme/element/components/text.scss +0 -20
  209. package/src-bak/theme/element/components/textarea.scss +0 -3
  210. package/src-bak/theme/element/components/tree.scss +0 -0
  211. package/src-bak/theme/element/index.scss +0 -55
  212. package/src-bak/utils/cipher.js +0 -141
  213. package/src-bak/utils/common.js +0 -664
  214. package/src-bak/utils/const.js +0 -259
  215. package/src-bak/utils/defaultVal.js +0 -92
  216. package/src-bak/utils/dom.js +0 -36
  217. package/src-bak/utils/format.js +0 -19
  218. package/src-bak/utils/index.js +0 -4
  219. package/src-bak/utils/is.js +0 -74
  220. package/src-bak/utils/loadModule.js +0 -75
  221. package/src-bak/utils/preserveFunc.js +0 -33
  222. package/src-bak/utils/render.jsx +0 -1138
  223. package/src-bak/utils/request.js +0 -136
  224. package/src-bak/utils/respone.js +0 -70
  225. package/src-bak/utils/valid.js +0 -89
@@ -1,664 +0,0 @@
1
-
2
- import { intersectionWith, isEqual, mergeWith, unionWith, isArray, cloneDeep, debounce } from 'lodash-es'
3
- import { isDate } from './is'
4
- import { isRef } from 'vue'
5
- export {
6
- debounce,
7
- cloneDeep,
8
- unionWith
9
- }
10
-
11
- function cached(fn) {
12
- const cache = Object.create(null)
13
- return function cachedFn(str) {
14
- const hit = cache[str]
15
- /* eslint-disable no-return-assign */
16
- return hit || (cache[str] = fn(str))
17
- }
18
- }
19
-
20
- export function normalPixel(pixel) {
21
- if (!pixel) return null
22
- const width = Number(pixel)
23
- if (!isNaN(width)) {
24
- return width + 'px'
25
- } else {
26
- let endFlags = ['px', '%', 'vh', 'vw', 'rem', 'em']
27
- const findFlag = endFlags.find(flag => pixel?.endsWith(flag))
28
- if (findFlag) {
29
- return parseInt(pixel) + findFlag
30
- }
31
- return null
32
- }
33
- }
34
-
35
- export function isNonRefType(value) {
36
- const type = typeof value;
37
- if (type === 'undefined' || type === 'boolean' || type === 'number' || type === 'string' || type === 'symbol' || type === 'bigint') {
38
- return true;
39
- }
40
- return false;
41
- }
42
-
43
- /**
44
- * Camelize a hyphen-delimited string.
45
- */
46
- const camelizeRE = /-(\w)/g
47
- /* eslint-disable prefer-arrow-callback */
48
- export const camelize = cached(function (str) {
49
- /* eslint-disable prefer-arrow-callback */
50
- return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : '' })
51
- })
52
-
53
- /**
54
- * Capitalize a string.
55
- */
56
- export const capitalize = cached(function (str) {
57
- return str.charAt(0).toUpperCase() + str.slice(1)
58
- })
59
-
60
- // 标记数组中的是否有对应的组件
61
- export function findComponent(comps, comp) {
62
- const compsToObj = comps.reduce((ret, key, idx) => {ret[key] = idx; return ret}, {})
63
- const resolveIdx = resolveAssetComponents(compsToObj, comp)
64
- return (resolveIdx === undefined || resolveIdx === null) ? -1 : resolveIdx
65
- }
66
-
67
- export function isPatchComponent(components, config) {
68
- return (findComponent(components, config?.renderby) !== -1 || findComponent(components, config?.metaType) !== -1)
69
- }
70
-
71
- //
72
- export function resolveAssetComponents(
73
- components,
74
- id
75
- ) {
76
- if (typeof id !== 'string') {
77
- return null
78
- }
79
- const assets = components
80
- if (assets[id] !== undefined && assets[id] !== null) {
81
- return assets[id]
82
- }
83
- const camelizedId = camelize(id)
84
- if (assets[camelizedId] !== undefined && assets[camelizedId] !== null) {
85
- return assets[camelizedId]
86
- }
87
- const PascalCaseId = capitalize(camelizedId)
88
- if (assets[PascalCaseId] !== undefined && assets[PascalCaseId] !== null) {
89
- return assets[PascalCaseId]
90
- }
91
- // function isVueInstance(Cotr) {
92
- // return Cotr.prototype instanceof Vue
93
- // }
94
- return null
95
- }
96
-
97
- // 把所有组件都转换为大驼峰的组件
98
- export function normalCapitalizeComponent(component) {
99
- if (typeof component !== 'string') {
100
- return component
101
- }
102
- return capitalize(camelize(component))
103
- }
104
-
105
- // 对应两个组件名是否为同一个
106
- export function compareComponet(comp1, comp2) {
107
- if (typeof comp1 !== 'string' || typeof comp2 !== 'string') {
108
- return false
109
- }
110
- const transComp1 = capitalize(camelize(comp1))
111
- const transComp2 = capitalize(camelize(comp2))
112
- return transComp1 === transComp2
113
- }
114
-
115
- const hasOwnProperty = Object.prototype.hasOwnProperty
116
- export function hasOwn(obj, key) {
117
- return hasOwnProperty.call(obj, key)
118
- }
119
-
120
- export function isPlainObject(obj) {
121
- return Object.prototype.toString.call(obj) === '[object Object]' && obj !== null && obj !== undefined
122
- }
123
-
124
- export function formatDate(date, fmt) {
125
- if (!date) {
126
- return ''
127
- }
128
- if (!isDate(date)) {
129
- date = new Date(date)
130
- }
131
- if (/(y+)/.test(fmt)) {
132
- fmt = fmt.replace(RegExp.$1, (`${date.getFullYear()}`).substr(4 - RegExp.$1.length))
133
- }
134
- const o = {
135
- 'M+': date.getMonth() + 1,
136
- 'd+': date.getDate(),
137
- 'h+': date.getHours(),
138
- 'm+': date.getMinutes(),
139
- 's+': date.getSeconds()
140
- }
141
- Object.keys(o).forEach(k => {
142
- const str = `${o[k]}`
143
- if (new RegExp(`(${k})`).test(fmt)) {
144
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str))
145
- }
146
- })
147
- return fmt
148
- }
149
-
150
- export const formatAmount = (val, data) => {
151
- if (!data) {
152
- return val
153
- }
154
- if (typeof val !== "string" && typeof val !== "number") {
155
- return val
156
- }
157
- let params = isPlainObject(data) ? data : { decimals: 2, isThousandth: true }
158
- let str = String(val).replace(/[^\d\.\-\e\E]/g, "")
159
- if (params?.decimals || params?.decimals == 0) {
160
- str = parseFloat(str).toFixed(params.decimals).toString()
161
- }
162
- let reg = /(\d)(?=(?:\d{3})+$)/g
163
- let arr = str.split(".")
164
- if (params?.isThousandth) {
165
- if (arr[0]) {
166
- arr[0] = arr[0].replace(reg, "$1,")
167
- }
168
- }
169
- return arr.join(".")
170
- }
171
-
172
- function padLeftZero(str) {
173
- return (`00${str}`).substr(str.length)
174
- }
175
-
176
- /**
177
- * Recursively merge two objects.
178
- * 递归合并两个对象。
179
- *
180
- * @param source The source object to merge from. 要合并的源对象。
181
- * @param target The target object to merge into. 目标对象,合并后结果存放于此。
182
- * @param mergeArrays How to merge arrays. Default is "replace".
183
- * 如何合并数组。默认为replace。
184
- * - "union": Union the arrays. 对数组执行并集操作。
185
- * - "intersection": Intersect the arrays. 对数组执行交集操作。
186
- * - "concat": Concatenate the arrays. 连接数组。
187
- * - "replace": Replace the source array with the target array. 用目标数组替换源数组。
188
- * @returns The merged object. 合并后的对象。
189
- */
190
- export function deepMerge(
191
- source,
192
- target,
193
- mergeArrays, // 'union' | 'intersection' | 'concat' | 'replace' = 'replace'
194
- ) {
195
- if (!target) {
196
- return source;
197
- }
198
- if (!source) {
199
- return target;
200
- }
201
- let ret = mergeWith(source, target, (sourceValue, targetValue) => {
202
- if (!targetValue) {
203
- return sourceValue
204
- }
205
- if (!sourceValue) {
206
- return targetValue
207
- }
208
- if (isArray(targetValue) && isArray(sourceValue)) {
209
- switch (mergeArrays) {
210
- case 'union':
211
- return unionWith(sourceValue, targetValue, isEqual);
212
- case 'intersection':
213
- return intersectionWith(sourceValue, targetValue, isEqual);
214
- case 'concat':
215
- return sourceValue.concat(targetValue);
216
- case 'replace':
217
- return targetValue;
218
- default:
219
- throw new Error(`Unknown merge array strategy: ${mergeArrays}`);
220
- }
221
- }
222
- if (isPlainObject(targetValue) && isPlainObject(sourceValue)) {
223
- return deepMerge(sourceValue, targetValue, mergeArrays);
224
- }
225
- return targetValue;
226
- });
227
- if (Array.isArray(source)) {
228
- if (ret && !Array.isArray(ret)) {
229
- let arr = []
230
- Object.keys(ret).forEach(key => {
231
- arr[key] = ret[key]
232
- })
233
- ret = arr
234
- }
235
- }
236
- return ret
237
- }
238
-
239
- export function modelValueDeepMerge(
240
- source,
241
- target,
242
- ) {
243
- let ret = target
244
- if (typeof source === 'object' && typeof target === 'object') {
245
- ret = mergeWith(source, target, (sourceValue, targetValue) => {
246
- if (isArray(sourceValue) && isArray(targetValue)) {
247
- const ret = []
248
- let idx = 0
249
- for(;idx < sourceValue.length && idx < targetValue.length; idx ++) {
250
- ret.push(modelValueDeepMerge(sourceValue[idx], targetValue[idx]))
251
- }
252
- if (idx < sourceValue.length) {
253
- ret.push(...sourceValue.slice(idx))
254
- } else {
255
- ret.push(...targetValue.slice(idx))
256
- }
257
- return ret
258
- }
259
- if (isPlainObject(targetValue) && isPlainObject(sourceValue)) {
260
- return modelValueDeepMerge(sourceValue, targetValue);
261
- }
262
- return targetValue;
263
- });
264
- }
265
-
266
- if (Array.isArray(source)) {
267
- if (ret && !Array.isArray(ret)) {
268
- let arr = []
269
- Object.keys(ret).forEach(key => {
270
- arr[key] = ret[key]
271
- })
272
- ret = arr
273
- }
274
- }
275
- return ret
276
- }
277
-
278
- export function isFnStr(str) {
279
- // 匹配具名函数和匿名函数(但不包括箭头函数)
280
- const functionRegex = /^\s*(?:function\s*(?:\w+\s*)?\([^()]*\)\s*\{[\s\S]*?\})\s*$/
281
- // 匹配箭头函数
282
- const arrowFunctionRegex = /^\s*\((?:\s*\w+(?:\s*=\s*\w+)?\s*(?:,\s*)?)*\)\s*=>\s*(?:\{[\s\S]*?\}|[\s\S]+?)\s*$/;
283
- return functionRegex.test(str) || arrowFunctionRegex.test(str)
284
- }
285
-
286
- export function extractFunctionBody(funcStr) {
287
- // 正则表达式用于匹配函数体
288
- const bodyRegex = /(?<={)(.*)(?=})/s;
289
- const match = bodyRegex.exec(funcStr);
290
- if (match && match.length > 1) {
291
- return match[1].trim(); // 返回匹配到的函数体
292
- }
293
- return null; // 如果没有匹配到,返回null
294
- }
295
-
296
- export function isPromise(fn) {
297
- return fn && typeof fn.then === 'function';
298
- }
299
-
300
- export function getDate(...arg) {
301
- return new Date(...arg)
302
- }
303
- // 生成唯一值
304
- export function generateUniqueId() {
305
- return `${formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')}-${getUuid()}`;
306
- }
307
-
308
- export function getUuid () {
309
- if (typeof crypto === 'object') {
310
- if (typeof crypto.randomUUID === 'function') {
311
- return crypto.randomUUID();
312
- }
313
- if (typeof crypto.getRandomValues === 'function' && typeof Uint8Array === 'function') {
314
- const callback = (c) => {
315
- const num = Number(c);
316
- return (num ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (num / 4)))).toString(16);
317
- };
318
- return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, callback);
319
- }
320
- }
321
- let timestamp = new Date().getTime();
322
- let perforNow = (typeof performance !== 'undefined' && performance.now && performance.now() * 1000) || 0;
323
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
324
- let random = Math.random() * 16;
325
- if (timestamp > 0) {
326
- random = (timestamp + random) % 16 | 0;
327
- timestamp = Math.floor(timestamp / 16);
328
- } else {
329
- random = (perforNow + random) % 16 | 0;
330
- perforNow = Math.floor(perforNow / 16);
331
- }
332
- return (c === 'x' ? random : (random & 0x3) | 0x8).toString(16);
333
- });
334
- }
335
-
336
- export function getConfigOptions(config, selects) {
337
- const referenceOptions = config.referenceOptions
338
- const selectKey = config.selectKey
339
- let optionItemsList = []
340
- try {
341
- optionItemsList = JSON.parse(config?.optionItems || '[]').map(item => {
342
- return {
343
- columnValue: item.value,
344
- columnDesc_zh: item.label,
345
- columnDesc: item.label_en || item.label,
346
- columnStatus: item.columnStatus
347
- }
348
- })
349
- } catch (error) {
350
- optionItemsList = []
351
- }
352
- const options = (selects?.value && selects?.value?.[selectKey]) || (selects?.value && selects?.value?.[`${config.metaCode}ListValue`]) || (selects?.value && selects?.value?.[referenceOptions]) || optionItemsList || []
353
- const priOptions = config?.priOptions
354
- return priOptions || options
355
- // const disabled = calcDisable(config, props.mode)
356
- // if (disabled) {
357
- // return options
358
- // } else {
359
- // return options.filter(item => !(item.columnStatus == '0' || item.columnStatus == '2'))
360
- // }
361
- }
362
-
363
- export function definePrivatelyProp(obj, key, value, options) {
364
- obj[key] = value
365
- const op = options || {}
366
- Object.defineProperty(obj, key, {
367
- value,
368
- writable: true,
369
- enumerable: false,
370
- configurable: true,
371
- ...op
372
- })
373
- }
374
-
375
- export function setValueDeep(obj, key = '', val) {
376
- let isChange = false
377
- if (key && obj) {
378
- let beginObj = obj
379
- if (isRef(obj)) {
380
- beginObj = obj.value
381
- }
382
- const keyArr = key.split('->')
383
- keyArr.reduce((ret, code, idx) => {
384
- if (idx === keyArr.length - 1) {
385
- const matchs = code.match(/(.+)\[(\d+)\]/)
386
- if (matchs) {
387
- const cod = matchs[1]
388
- const idx = matchs[2]
389
- !ret[cod] && (ret[cod] = [])
390
-
391
- if (!(isNonRefType(ret[cod][idx]) && isNonRefType(val) && ret[cod][idx] === val)) {
392
- isChange = true
393
- ret[cod][idx] = val
394
- }
395
- } else {
396
- if (!(isNonRefType(ret[code]) && isNonRefType(val) && ret[code] === val)) {
397
- isChange = true
398
- ret[code] = val
399
- }
400
- }
401
- } else {
402
- const matchs = code.match(/(.+)\[(\d+)\]/)
403
- if (matchs) {
404
- const cod = matchs[1]
405
- const idx = matchs[2]
406
- !ret[cod] && (ret[cod] = [])
407
- !ret[cod][idx] && (ret[cod][idx] = {})
408
- return ret[cod][idx]
409
- } else {
410
- !ret[code] && (ret[code] = {})
411
- return ret[code]
412
- }
413
- }
414
- }, beginObj)
415
- if (isRef(obj)) {
416
- obj.value = beginObj
417
- }
418
- }
419
- return isChange
420
- }
421
- export function getValueDeep(obj, key) {
422
- if (!key) {
423
- return obj
424
- }
425
- const keyArr = key.split('->') || []
426
- return keyArr.reduce((ret, code) => {
427
- if (!ret) {
428
- return ret
429
- }
430
- const matchs = code.match(/(.+)\[(\d+)\]/)
431
- if (matchs) {
432
- const cod = matchs[1]
433
- const idx = matchs[2]
434
- return ret?.[cod]?.[idx]
435
- } else {
436
- return ret[code]
437
- }
438
- }, obj)
439
- }
440
-
441
- // 深度清空对象上面的属性
442
-
443
- export function createEmptyCopy(source, cache = new WeakMap()) {
444
- // 处理非对象类型(基础类型)
445
- if (source === null || typeof source !== 'object') {
446
- switch (typeof source) {
447
- case 'string': return '';
448
- case 'number': return '';
449
- case 'boolean': return null;
450
- default: return null; // undefined, symbol, function 等返回 null
451
- }
452
- }
453
-
454
- // 处理循环引用:如果已缓存,直接返回缓存的副本
455
- if (cache.has(source)) {
456
- return cache.get(source);
457
- }
458
-
459
- // 根据类型创建空结构
460
- let copy;
461
- if (Array.isArray(source)) {
462
- // 数组:递归处理每个元素
463
- copy = [];
464
- cache.set(source, copy); // 缓存当前对象,避免循环引用
465
- copy.push(...source.map(item => createEmptyCopy(item, cache)));
466
- } else if (source instanceof Date) {
467
- // Date:返回初始时间(可选)
468
- copy = null;
469
- } else if (source instanceof Set) {
470
- // Set:清空为空的 Set
471
- copy = new Set();
472
- } else if (source instanceof Map) {
473
- // Map:清空为空的 Map
474
- copy = new Map();
475
- } else {
476
- // 普通对象:递归处理每个属性
477
- copy = {};
478
- cache.set(source, copy);
479
- for (const key of Object.keys(source)) {
480
- const val = createEmptyCopy(source[key], cache)
481
- if ( val !== null && val !== undefined) {
482
- copy[key] = val
483
- }
484
- }
485
- }
486
-
487
- return copy;
488
- }
489
-
490
- export function parseFloatToString(input) {
491
- // 1. 处理输入类型
492
- if (input === null || input === undefined) return "NaN";
493
- const str = String(input).trim();
494
-
495
- // 2. 匹配浮点数(包括科学计数法)
496
- const floatRegex = /^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/;
497
- const match = str.match(floatRegex);
498
- if (!match) return "NaN";
499
-
500
- // 3. 处理科学计数法
501
- let numberStr = match[0];
502
- if (/e/i.test(numberStr)) {
503
- numberStr = convertScientificNotation(numberStr);
504
- }
505
-
506
- // 4. 规范化结果(去除多余的前导/后缀零)
507
- return normalizeNumberString(numberStr);
508
- }
509
-
510
- // 科学计数法转普通数字字符串
511
- function convertScientificNotation(sciStr) {
512
- const [base, expPart] = sciStr.split(/e/gi);
513
- const exponent = expPart ? parseInt(expPart, 10) : 0;
514
-
515
- let [integer, decimal = ""] = base.split(".");
516
- const isNegative = integer.startsWith("-");
517
- if (isNegative) integer = integer.slice(1);
518
-
519
- // 合并整数和小数部分
520
- let numStr = integer + decimal;
521
- const decimalPos = integer.length;
522
-
523
- // 计算新小数点位置
524
- const newPos = decimalPos + exponent;
525
-
526
- // 处理不同情况
527
- if (newPos >= numStr.length) {
528
- // 右移超出:补零
529
- return (isNegative ? "-" : "") + numStr + "0".repeat(newPos - numStr.length);
530
- } else if (newPos <= 0) {
531
- // 左移超出:补零
532
- const zeros = "0".repeat(-newPos);
533
- return (isNegative ? "-" : "") + "0." + zeros + numStr;
534
- } else {
535
- // 插入小数点
536
- return (isNegative ? "-" : "") +
537
- numStr.slice(0, newPos) +
538
- (numStr.slice(newPos) ? "." + numStr.slice(newPos) : "");
539
- }
540
- }
541
-
542
- // 规范化数字字符串
543
- function normalizeNumberString(numStr) {
544
- // 处理空字符串
545
- if (numStr === "") return "0";
546
-
547
- // 分解符号、整数和小数部分
548
- const isNegative = numStr.startsWith("-");
549
- const cleanStr = isNegative ? numStr.slice(1) : numStr;
550
- let [integer, decimal] = cleanStr.split(".");
551
-
552
- // 处理整数部分前导零
553
- integer = integer.replace(/^0+/, "") || "0";
554
-
555
- // 处理小数部分后缀零
556
- decimal = (decimal || "").replace(/0+$/, "");
557
-
558
- // 组合结果
559
- let result = "";
560
- result += isNegative ? "-" : "";
561
- result += integer;
562
- result += decimal ? "." + decimal : "";
563
-
564
- // 特殊处理 ".5" -> "0.5"
565
- if (result.startsWith(".")) result = "0" + result;
566
- if (result.startsWith("-.")) result = "-0" + result.slice(1);
567
-
568
- return result;
569
- }
570
-
571
-
572
- export function getPathVal(obj = {}, path, separator = '.') {
573
- let paths = path
574
- if (typeof path === 'string') {
575
- paths = path.split(separator)
576
- }
577
- return paths.reduce((ret, key) => {
578
- if (ret) {
579
- const match = key.match(/^(\w+)\[(\d+)\]/)
580
- if (match) {
581
- return ret[match[1]]?.[match[2]]
582
- }
583
- return ret[key]
584
- }
585
- return null
586
- }, obj) ?? ''
587
- }
588
- export function assignmentPathVal(obj = {}, path, val) {
589
- let paths = path
590
- if (typeof path === 'string') {
591
- paths = path.split('.')
592
- }
593
- let currentObj = obj
594
- paths.forEach((item, idx) => {
595
- if (idx + 1 === paths.length) {
596
- currentObj[item] = val ?? ''
597
- } else {
598
- if (!currentObj[item]) {
599
- currentObj[item] = {}
600
- }
601
- currentObj = currentObj[item]
602
- }
603
- })
604
- }
605
-
606
- export function eleIsOverflow(e) {
607
- // 判断是否text-overflow, 如果是就显示tooltip
608
- const cellChild = e.target
609
- if (!cellChild.childNodes.length) {
610
- return
611
- }
612
- // use range width instead of scrollWidth to determine whether the text is overflowing
613
- // to address a potential FireFox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1074543#c3
614
- const range = document.createRange()
615
- range.setStart(cellChild, 0)
616
- range.setEnd(cellChild, cellChild.childNodes.length)
617
-
618
- let { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect()
619
- const offsetWidth = rangeWidth - Math.floor(rangeWidth)
620
- let { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect()
621
- cellChildWidth = Math.ceil(cellChildWidth)
622
- if (offsetWidth < 0.001) {
623
- rangeWidth = Math.floor(rangeWidth)
624
- }
625
- const offsetHeight = rangeHeight - Math.floor(rangeHeight)
626
- if (offsetHeight < 0.001) {
627
- rangeHeight = Math.floor(rangeHeight)
628
- }
629
-
630
- const { top, left, right, bottom } = getPadding(cellChild)
631
- const horizontalPadding = left + right
632
- const verticalPadding = top + bottom
633
-
634
- let ret = {}
635
- if (
636
- isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) ||
637
- isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) ||
638
- // When using a high-resolution screen, it is possible that a returns cellChild.scrollWidth value of 1921 and
639
- // cellChildWidth returns a value of 1920.994140625. #16856 #16673
640
- isGreaterThan(cellChild.scrollWidth, cellChildWidth)
641
- ) {
642
- ret.overflow = true
643
- ret.content = cellChild.innerText || cellChild.textContent
644
- }
645
- return ret
646
- }
647
-
648
- function getPadding(el) {
649
- const style = window.getComputedStyle(el, null)
650
- const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0
651
- const paddingRight = Number.parseInt(style.paddingRight, 10) || 0
652
- const paddingTop = Number.parseInt(style.paddingTop, 10) || 0
653
- const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0
654
- return {
655
- left: paddingLeft,
656
- right: paddingRight,
657
- top: paddingTop,
658
- bottom: paddingBottom,
659
- }
660
- }
661
-
662
- function isGreaterThan(a, b, epsilon = 0.01) {
663
- return a - b > epsilon
664
- }