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,521 +0,0 @@
1
- // @ts-nocheck
2
- import { createVNode, render } from 'vue'
3
- import { flatMap, get } from 'lodash-unified'
4
- import {
5
- hasOwn,
6
- isArray,
7
- isBoolean,
8
- isObject,
9
- throwError,
10
- } from 'element-plus/es/utils/index.mjs'
11
- import ElTooltip, {
12
- type ElTooltipProps,
13
- } from 'element-plus/es/components/tooltip/index.mjs'
14
- import type { Table } from './table/defaults'
15
- import type { TableColumnCtx } from './table-column/defaults'
16
-
17
- export type TableOverflowTooltipOptions = Partial<
18
- Pick<
19
- ElTooltipProps,
20
- | 'appendTo'
21
- | 'effect'
22
- | 'enterable'
23
- | 'hideAfter'
24
- | 'offset'
25
- | 'placement'
26
- | 'popperClass'
27
- | 'popperOptions'
28
- | 'showAfter'
29
- | 'showArrow'
30
- | 'transition'
31
- >
32
- >
33
-
34
- type RemovePopperFn = (() => void) & {
35
- trigger?: HTMLElement
36
- }
37
-
38
- export const getCell = function (event: Event) {
39
- return (event.target as HTMLElement)?.closest('td')
40
- }
41
-
42
- export const orderBy = function <T>(
43
- array: T[],
44
- sortKey: string,
45
- reverse: string | number,
46
- sortMethod,
47
- sortBy: string | (string | ((a: T, b: T, array?: T[]) => number))[]
48
- ) {
49
- if (
50
- !sortKey &&
51
- !sortMethod &&
52
- (!sortBy || (Array.isArray(sortBy) && !sortBy.length))
53
- ) {
54
- return array
55
- }
56
- if (typeof reverse === 'string') {
57
- reverse = reverse === 'descending' ? -1 : 1
58
- } else {
59
- reverse = reverse && reverse < 0 ? -1 : 1
60
- }
61
- const getKey = sortMethod
62
- ? null
63
- : function (value, index) {
64
- if (sortBy) {
65
- if (!Array.isArray(sortBy)) {
66
- sortBy = [sortBy]
67
- }
68
- return sortBy.map((by) => {
69
- if (typeof by === 'string') {
70
- return get(value, by)
71
- } else {
72
- return by(value, index, array)
73
- }
74
- })
75
- }
76
- if (sortKey !== '$key') {
77
- if (isObject(value) && '$value' in value) value = value.$value
78
- }
79
- return [isObject(value) ? get(value, sortKey) : value]
80
- }
81
- const compare = function (a, b) {
82
- if (sortMethod) {
83
- return sortMethod(a.value, b.value)
84
- }
85
- for (let i = 0, len = a.key.length; i < len; i++) {
86
- if (a.key[i] < b.key[i]) {
87
- return -1
88
- }
89
- if (a.key[i] > b.key[i]) {
90
- return 1
91
- }
92
- }
93
- return 0
94
- }
95
- return array
96
- .map((value, index) => {
97
- return {
98
- value,
99
- index,
100
- key: getKey ? getKey(value, index) : null,
101
- }
102
- })
103
- .sort((a, b) => {
104
- let order = compare(a, b)
105
- if (!order) {
106
- // make stable https://en.wikipedia.org/wiki/Sorting_algorithm#Stability
107
- order = a.index - b.index
108
- }
109
- return order * +reverse
110
- })
111
- .map((item) => item.value)
112
- }
113
-
114
- export const getColumnById = function <T>(
115
- table: {
116
- columns: TableColumnCtx<T>[]
117
- },
118
- columnId: string
119
- ): null | TableColumnCtx<T> {
120
- let column = null
121
- table.columns.forEach((item) => {
122
- if (item.id === columnId) {
123
- column = item
124
- }
125
- })
126
- return column
127
- }
128
-
129
- export const getColumnByKey = function <T>(
130
- table: {
131
- columns: TableColumnCtx<T>[]
132
- },
133
- columnKey: string
134
- ): TableColumnCtx<T> {
135
- let column = null
136
- for (let i = 0; i < table.columns.length; i++) {
137
- const item = table.columns[i]
138
- if (item.columnKey === columnKey) {
139
- column = item
140
- break
141
- }
142
- }
143
- if (!column)
144
- throwError('ElTable', `No column matching with column-key: ${columnKey}`)
145
- return column
146
- }
147
-
148
- export const getColumnByCell = function <T>(
149
- table: {
150
- columns: TableColumnCtx<T>[]
151
- },
152
- cell: HTMLElement,
153
- namespace: string
154
- ): null | TableColumnCtx<T> {
155
- const matches = (cell.className || '').match(
156
- new RegExp(`${namespace}-table_[^\\s]+`, 'gm')
157
- )
158
- if (matches) {
159
- return getColumnById(table, matches[0])
160
- }
161
- return null
162
- }
163
-
164
- export const getRowIdentity = <T>(
165
- row: T,
166
- rowKey: string | ((row: T) => any)
167
- ): string => {
168
- if (!row) throw new Error('Row is required when get row identity')
169
- if (typeof rowKey === 'string') {
170
- if (!rowKey.includes('.')) {
171
- return `${row[rowKey]}`
172
- }
173
- const key = rowKey.split('.')
174
- let current = row
175
- for (const element of key) {
176
- current = current[element]
177
- }
178
- return `${current}`
179
- } else if (typeof rowKey === 'function') {
180
- return rowKey.call(null, row)
181
- }
182
- }
183
-
184
- export const getKeysMap = function <T>(
185
- array: T[],
186
- rowKey: string
187
- ): Record<string, { row: T; index: number }> {
188
- const arrayMap = {}
189
- ;(array || []).forEach((row, index) => {
190
- arrayMap[getRowIdentity(row, rowKey)] = { row, index }
191
- })
192
- return arrayMap
193
- }
194
-
195
- export function mergeOptions<T, K>(defaults: T, config: K): T & K {
196
- const options = {} as T & K
197
- let key
198
- for (key in defaults) {
199
- options[key] = defaults[key]
200
- }
201
- for (key in config) {
202
- if (hasOwn(config as unknown as Record<string, any>, key)) {
203
- const value = config[key]
204
- if (typeof value !== 'undefined') {
205
- options[key] = value
206
- }
207
- }
208
- }
209
- return options
210
- }
211
-
212
- export function parseWidth(width: number | string): number | string {
213
- if (width === '') return width
214
- if (width !== undefined) {
215
- width = Number.parseInt(width as string, 10)
216
- if (Number.isNaN(width)) {
217
- width = ''
218
- }
219
- }
220
- return width
221
- }
222
-
223
- export function parseMinWidth(minWidth: number | string): number | string {
224
- if (minWidth === '') return minWidth
225
- if (minWidth !== undefined) {
226
- minWidth = parseWidth(minWidth)
227
- if (Number.isNaN(minWidth)) {
228
- minWidth = 80
229
- }
230
- }
231
- return minWidth
232
- }
233
-
234
- export function parseHeight(height: number | string) {
235
- if (typeof height === 'number') {
236
- return height
237
- }
238
- if (typeof height === 'string') {
239
- if (/^\d+(?:px)?$/.test(height)) {
240
- return Number.parseInt(height, 10)
241
- } else {
242
- return height
243
- }
244
- }
245
- return null
246
- }
247
-
248
- // https://github.com/reduxjs/redux/blob/master/src/compose.js
249
- export function compose(...funcs) {
250
- if (funcs.length === 0) {
251
- return (arg) => arg
252
- }
253
- if (funcs.length === 1) {
254
- return funcs[0]
255
- }
256
- return funcs.reduce(
257
- (a, b) =>
258
- (...args) =>
259
- a(b(...args))
260
- )
261
- }
262
-
263
- export function toggleRowStatus<T>(
264
- statusArr: T[],
265
- row: T,
266
- newVal: boolean
267
- ): boolean {
268
- let changed = false
269
- const index = statusArr.indexOf(row)
270
- const included = index !== -1
271
-
272
- const toggleStatus = (type: 'add' | 'remove') => {
273
- if (type === 'add') {
274
- statusArr.push(row)
275
- } else {
276
- statusArr.splice(index, 1)
277
- }
278
- changed = true
279
- if (isArray(row.children)) {
280
- row.children.forEach((item) => {
281
- toggleRowStatus(statusArr, item, newVal ?? !included)
282
- })
283
- }
284
- }
285
-
286
- if (isBoolean(newVal)) {
287
- if (newVal && !included) {
288
- toggleStatus('add')
289
- } else if (!newVal && included) {
290
- toggleStatus('remove')
291
- }
292
- } else {
293
- included ? toggleStatus('remove') : toggleStatus('add')
294
- }
295
- return changed
296
- }
297
-
298
- export function walkTreeNode(
299
- root,
300
- cb,
301
- childrenKey = 'children',
302
- lazyKey = 'hasChildren'
303
- ) {
304
- const isNil = (array) => !(Array.isArray(array) && array.length)
305
-
306
- function _walker(parent, children, level) {
307
- cb(parent, children, level)
308
- children.forEach((item) => {
309
- if (item[lazyKey]) {
310
- cb(item, null, level + 1)
311
- return
312
- }
313
- const children = item[childrenKey]
314
- if (!isNil(children)) {
315
- _walker(item, children, level + 1)
316
- }
317
- })
318
- }
319
-
320
- root.forEach((item) => {
321
- if (item[lazyKey]) {
322
- cb(item, null, 0)
323
- return
324
- }
325
- const children = item[childrenKey]
326
- if (!isNil(children)) {
327
- _walker(item, children, 0)
328
- }
329
- })
330
- }
331
-
332
- export let removePopper: RemovePopperFn | null = null
333
-
334
- export function createTablePopper(
335
- props: TableOverflowTooltipOptions,
336
- popperContent: string,
337
- trigger: HTMLElement,
338
- table: Table<[]>
339
- ) {
340
- if (removePopper?.trigger === trigger) {
341
- return
342
- }
343
- removePopper?.()
344
- const parentNode = table?.refs.tableWrapper
345
- const ns = parentNode?.dataset.prefix
346
- const popperOptions = {
347
- strategy: 'fixed',
348
- ...props.popperOptions,
349
- }
350
- const vm = createVNode(ElTooltip, {
351
- content: popperContent,
352
- virtualTriggering: true,
353
- virtualRef: trigger,
354
- appendTo: parentNode,
355
- placement: 'top',
356
- transition: 'none', // Default does not require transition
357
- offset: 0,
358
- hideAfter: 0,
359
- ...props,
360
- popperOptions,
361
- onHide: () => {
362
- removePopper?.()
363
- },
364
- })
365
- vm.appContext = { ...table.appContext, ...table }
366
- const container = document.createElement('div')
367
- render(vm, container)
368
- vm.component!.exposed!.onOpen()
369
- const scrollContainer = parentNode?.querySelector(`.${ns}-scrollbar__wrap`)
370
- removePopper = () => {
371
- render(null, container)
372
- scrollContainer?.removeEventListener('scroll', removePopper!)
373
- removePopper = null
374
- }
375
- removePopper.trigger = trigger
376
- scrollContainer?.addEventListener('scroll', removePopper)
377
- }
378
-
379
- function getCurrentColumns<T>(column: TableColumnCtx<T>): TableColumnCtx<T>[] {
380
- if (column.children) {
381
- return flatMap(column.children, getCurrentColumns)
382
- } else {
383
- return [column]
384
- }
385
- }
386
-
387
- function getColSpan<T>(colSpan: number, column: TableColumnCtx<T>) {
388
- return colSpan + column.colSpan
389
- }
390
-
391
- export const isFixedColumn = <T>(
392
- index: number,
393
- fixed: string | boolean,
394
- store: any,
395
- realColumns?: TableColumnCtx<T>[]
396
- ) => {
397
- let start = 0
398
- let after = index
399
- const columns = store.states.columns.value
400
- if (realColumns) {
401
- // fixed column supported in grouped header
402
- const curColumns = getCurrentColumns(realColumns[index])
403
- const preColumns = columns.slice(0, columns.indexOf(curColumns[0]))
404
-
405
- start = preColumns.reduce(getColSpan, 0)
406
- after = start + curColumns.reduce(getColSpan, 0) - 1
407
- } else {
408
- start = index
409
- }
410
- let fixedLayout
411
- switch (fixed) {
412
- case 'left':
413
- if (after < store.states.fixedLeafColumnsLength.value) {
414
- fixedLayout = 'left'
415
- }
416
- break
417
- case 'right':
418
- if (
419
- start >=
420
- columns.length - store.states.rightFixedLeafColumnsLength.value
421
- ) {
422
- fixedLayout = 'right'
423
- }
424
- break
425
- default:
426
- if (after < store.states.fixedLeafColumnsLength.value) {
427
- fixedLayout = 'left'
428
- } else if (
429
- start >=
430
- columns.length - store.states.rightFixedLeafColumnsLength.value
431
- ) {
432
- fixedLayout = 'right'
433
- }
434
- }
435
- return fixedLayout
436
- ? {
437
- direction: fixedLayout,
438
- start,
439
- after,
440
- }
441
- : {}
442
- }
443
-
444
- export const getFixedColumnsClass = <T>(
445
- namespace: string,
446
- index: number,
447
- fixed: string | boolean,
448
- store: any,
449
- realColumns?: TableColumnCtx<T>[],
450
- offset = 0
451
- ) => {
452
- const classes: string[] = []
453
- const { direction, start, after } = isFixedColumn(
454
- index,
455
- fixed,
456
- store,
457
- realColumns
458
- )
459
- if (direction) {
460
- const isLeft = direction === 'left'
461
- classes.push(`${namespace}-fixed-column--${direction}`)
462
- if (
463
- isLeft &&
464
- after + offset === store.states.fixedLeafColumnsLength.value - 1
465
- ) {
466
- classes.push('is-last-column')
467
- } else if (
468
- !isLeft &&
469
- start - offset ===
470
- store.states.columns.value.length -
471
- store.states.rightFixedLeafColumnsLength.value
472
- ) {
473
- classes.push('is-first-column')
474
- }
475
- }
476
- return classes
477
- }
478
-
479
- function getOffset<T>(offset: number, column: TableColumnCtx<T>) {
480
- return (
481
- offset +
482
- (column.realWidth === null || Number.isNaN(column.realWidth)
483
- ? Number(column.width)
484
- : column.realWidth)
485
- )
486
- }
487
-
488
- export const getFixedColumnOffset = <T>(
489
- index: number,
490
- fixed: string | boolean,
491
- store: any,
492
- realColumns?: TableColumnCtx<T>[]
493
- ) => {
494
- const {
495
- direction,
496
- start = 0,
497
- after = 0,
498
- } = isFixedColumn(index, fixed, store, realColumns)
499
- if (!direction) {
500
- return
501
- }
502
- const styles: any = {}
503
- const isLeft = direction === 'left'
504
- const columns = store.states.columns.value
505
- if (isLeft) {
506
- styles.left = columns.slice(0, start).reduce(getOffset, 0)
507
- } else {
508
- styles.right = columns
509
- .slice(after + 1)
510
- .reverse()
511
- .reduce(getOffset, 0)
512
- }
513
- return styles
514
- }
515
-
516
- export const ensurePosition = (style, key: string) => {
517
- if (!style) return
518
- if (!Number.isNaN(style[key])) {
519
- style[key] = `${style[key]}px`
520
- }
521
- }
@@ -1,5 +0,0 @@
1
- import '@element-plus/components/base/style/css'
2
- import '@element-plus/theme-chalk/el-table.css'
3
- import '@element-plus/components/checkbox/style/css'
4
- import '@element-plus/components/tooltip/style/css'
5
- import '@element-plus/components/scrollbar/style/css'
@@ -1,5 +0,0 @@
1
- import '@element-plus/components/base/style'
2
- import '@element-plus/theme-chalk/src/table.scss'
3
- import '@element-plus/components/checkbox/style'
4
- import '@element-plus/components/tooltip/style'
5
- import '@element-plus/components/scrollbar/style'
@@ -1,8 +0,0 @@
1
- import Tabs from './src/tabs.jsx'
2
- import TabPane from './src/tab-pane.vue'
3
-
4
- export default Tabs
5
-
6
- export {
7
- TabPane
8
- }
@@ -1,23 +0,0 @@
1
- // import type { ComputedRef, InjectionKey, Ref, Slots, UnwrapRef } from 'vue'
2
- // import type { TabsProps } from './tabs'
3
- // import type { TabPaneProps } from './tab-pane'
4
-
5
- // export type TabsPaneContext = UnwrapRef<{
6
- // uid: number
7
- // slots: Slots
8
- // props: TabPaneProps
9
- // paneName: ComputedRef<string | number | undefined>
10
- // active: ComputedRef<boolean>
11
- // index: Ref<string | undefined>
12
- // isClosable: ComputedRef<boolean>
13
- // }>
14
-
15
- // export interface TabsRootContext {
16
- // props: TabsProps
17
- // currentName: Ref<string | number>
18
- // registerPane: (pane: TabsPaneContext) => void
19
- // unregisterPane: (uid: number) => void
20
- // }
21
-
22
- export const tabsRootContextKey =
23
- Symbol('tabsRootContextKey')
@@ -1,8 +0,0 @@
1
- import { buildProps, definePropType, mutable } from 'element-plus/es/utils/index.mjs'
2
-
3
- export const tabBarProps = buildProps({
4
- tabs: {
5
- type: definePropType(Array),
6
- default: () => mutable([]),
7
- },
8
- })
@@ -1,92 +0,0 @@
1
- <template>
2
- <div
3
- ref="barRef"
4
- :class="[ns.e('active-bar'), ns.is(rootTabs.props.tabPosition)]"
5
- :style="barStyle"
6
- />
7
- </template>
8
-
9
- <script setup>
10
- import { getCurrentInstance, defineOptions, defineProps, inject, nextTick, ref, watch } from 'vue'
11
- import { useResizeObserver } from '@vueuse/core'
12
- import { capitalize, throwError } from 'element-plus/es/utils/index.mjs'
13
- import { useNamespace } from 'element-plus/es/hooks/index.mjs'
14
- import { tabsRootContextKey } from './constants.js'
15
- import { tabBarProps } from './tab-bar'
16
-
17
- // import type { CSSProperties } from 'vue'
18
-
19
- const COMPONENT_NAME = 'ElTabBar'
20
- defineOptions({
21
- name: COMPONENT_NAME,
22
- })
23
- const props = defineProps(tabBarProps)
24
-
25
- const instance = getCurrentInstance()
26
- const rootTabs = inject(tabsRootContextKey)
27
- if (!rootTabs) throwError(COMPONENT_NAME, '<el-tabs><el-tab-bar /></el-tabs>')
28
-
29
- const ns = useNamespace('tabs')
30
-
31
- const barRef = ref()
32
- const barStyle = ref()
33
-
34
- const getBarStyle = () => {
35
- let offset = 0
36
- let tabSize = 0
37
-
38
- const sizeName = ['top', 'bottom'].includes(rootTabs.props.tabPosition)
39
- ? 'width'
40
- : 'height'
41
- const sizeDir = sizeName === 'width' ? 'x' : 'y'
42
- const position = sizeDir === 'x' ? 'left' : 'top'
43
-
44
- props.tabs.every((tab) => {
45
- const $el = instance.parent?.refs?.[`tab-${tab.uid}`]
46
- if (!tab && !$el) return false
47
-
48
- if (!tab.active) {
49
- return true
50
- }
51
-
52
- offset = $el[`offset${capitalize(position)}`]
53
- tabSize = $el[`client${capitalize(sizeName)}`]
54
-
55
- const tabStyles = window.getComputedStyle($el)
56
-
57
- if (sizeName === 'width') {
58
- if (props.tabs.length > 1) {
59
- tabSize -=
60
- Number.parseFloat(tabStyles.paddingLeft) +
61
- Number.parseFloat(tabStyles.paddingRight)
62
- }
63
- offset += Number.parseFloat(tabStyles.paddingLeft)
64
- }
65
- return false
66
- })
67
-
68
- return {
69
- [sizeName]: `${tabSize}px`,
70
- transform: `translate${capitalize(sizeDir)}(${offset}px)`,
71
- }
72
- }
73
-
74
- const update = () => (barStyle.value = getBarStyle())
75
-
76
- watch(
77
- () => props.tabs,
78
- async () => {
79
- await nextTick()
80
- update()
81
- },
82
- { immediate: true }
83
- )
84
- useResizeObserver(barRef, () => update())
85
-
86
- defineExpose({
87
- /** @description tab root html element */
88
- ref: barRef,
89
- /** @description method to manually update tab bar style */
90
- update,
91
- })
92
- </script>