resolver-egretimp-plus 0.1.113 → 0.1.115

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 (219) hide show
  1. package/dist/h5/index.js +1 -1
  2. package/dist/theme/element/index.css +1 -1
  3. package/dist/theme/element/src/components/common.scss +4 -0
  4. package/dist/theme/element/src/components/text.scss +17 -0
  5. package/dist/web/index.js +2 -2
  6. package/package.json +1 -1
  7. package/src/analysisComponent.jsx +2 -1
  8. package/src/components/helper/table.jsx +26 -23
  9. package/src/components/packages-H5/CustomComponentCollapseH5.vue +6 -2
  10. package/src/components/packages-web/ElText.jsx +0 -1
  11. package/src/theme/element/components/common.scss +4 -0
  12. package/src/theme/element/components/text.scss +17 -0
  13. package/src-bak/analysisComponent.jsx +343 -0
  14. package/src-bak/api/builtIn.js +10 -0
  15. package/src-bak/bpm/bpmInstance.js +388 -0
  16. package/src-bak/bpm/udc-sdk-esm/cjs/impl/application.js +8 -0
  17. package/src-bak/bpm/udc-sdk-esm/cjs/impl/component.js +97 -0
  18. package/src-bak/bpm/udc-sdk-esm/cjs/impl/datasource.js +88 -0
  19. package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/index.js +3 -0
  20. package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/UdcComponent.js +76 -0
  21. package/src-bak/bpm/udc-sdk-esm/cjs/impl/iframe/udcSdkForIframe/index.js +201 -0
  22. package/src-bak/bpm/udc-sdk-esm/cjs/impl/index.js +69 -0
  23. package/src-bak/bpm/udc-sdk-esm/cjs/impl/page.js +56 -0
  24. package/src-bak/bpm/udc-sdk-esm/cjs/impl/utils.js +76 -0
  25. package/src-bak/bpm/udc-sdk-esm/cjs/index.js +46 -0
  26. package/src-bak/bpm/udc-sdk-esm/cjs/utils.js +21 -0
  27. package/src-bak/components/childDialog/index.js +39 -0
  28. package/src-bak/components/childDialog/src/index.vue +185 -0
  29. package/src-bak/components/cmiFormItem/index.js +1 -0
  30. package/src-bak/components/cmiFormItem/src/index.vue +112 -0
  31. package/src-bak/components/confirmInstance-H5/index.js +53 -0
  32. package/src-bak/components/confirmInstance-H5/src/index.vue +54 -0
  33. package/src-bak/components/helper/FormPolyfill.jsx +25 -0
  34. package/src-bak/components/helper/calcTooltip.jsx +134 -0
  35. package/src-bak/components/helper/dock.js +141 -0
  36. package/src-bak/components/helper/eventOrchestration.js +763 -0
  37. package/src-bak/components/helper/resolver.js +163 -0
  38. package/src-bak/components/helper/table.jsx +103 -0
  39. package/src-bak/components/icons/date.vue +33 -0
  40. package/src-bak/components/icons/info.vue +62 -0
  41. package/src-bak/components/icons/loading.vue +19 -0
  42. package/src-bak/components/icons/question-filled.vue +8 -0
  43. package/src-bak/components/loading/index.js +6 -0
  44. package/src-bak/components/loading/loading.js +98 -0
  45. package/src-bak/components/loading/loading.scss +74 -0
  46. package/src-bak/components/loading/loading.vue +89 -0
  47. package/src-bak/components/loadingComponent/LoadingComponent.vue +33 -0
  48. package/src-bak/components/modal/index.js +9 -0
  49. package/src-bak/components/modal/modal.scss +195 -0
  50. package/src-bak/components/modal/modal.vue +201 -0
  51. package/src-bak/components/options/OptionsDefault.vue +47 -0
  52. package/src-bak/components/packages-H5/CmiButton.vue +120 -0
  53. package/src-bak/components/packages-H5/CmiCalendar.vue +152 -0
  54. package/src-bak/components/packages-H5/CmiCell.vue +87 -0
  55. package/src-bak/components/packages-H5/CmiCheckbox.vue +82 -0
  56. package/src-bak/components/packages-H5/CmiDatetimePicker.vue +98 -0
  57. package/src-bak/components/packages-H5/CmiDivider.vue +30 -0
  58. package/src-bak/components/packages-H5/CmiDropdownMenu.vue +58 -0
  59. package/src-bak/components/packages-H5/CmiInput.vue +69 -0
  60. package/src-bak/components/packages-H5/CmiLink.vue +28 -0
  61. package/src-bak/components/packages-H5/CmiPicker.vue +229 -0
  62. package/src-bak/components/packages-H5/CmiRadio.vue +29 -0
  63. package/src-bak/components/packages-H5/CmiSearch.vue +39 -0
  64. package/src-bak/components/packages-H5/CmiSelect.vue +84 -0
  65. package/src-bak/components/packages-H5/CustomComponentCardH5.vue +129 -0
  66. package/src-bak/components/packages-H5/CustomComponentColH5.vue +8 -0
  67. package/src-bak/components/packages-H5/CustomComponentCollapseH5.vue +137 -0
  68. package/src-bak/components/packages-H5/CustomComponentFormLayoutH5.vue +54 -0
  69. package/src-bak/components/packages-H5/CustomComponentTabPaneH5.vue +38 -0
  70. package/src-bak/components/packages-H5/CustomComponentTableH5.vue +352 -0
  71. package/src-bak/components/packages-H5/CustomComponentTabsH5.vue +170 -0
  72. package/src-bak/components/packages-web/CustomComponentCard.vue +40 -0
  73. package/src-bak/components/packages-web/CustomComponentCol.vue +66 -0
  74. package/src-bak/components/packages-web/CustomComponentCollapse.vue +164 -0
  75. package/src-bak/components/packages-web/CustomComponentCycle.vue +95 -0
  76. package/src-bak/components/packages-web/CustomComponentCycleTabPane.vue +155 -0
  77. package/src-bak/components/packages-web/CustomComponentDialog.vue +192 -0
  78. package/src-bak/components/packages-web/CustomComponentEditor.vue +50 -0
  79. package/src-bak/components/packages-web/CustomComponentFileExport.vue +60 -0
  80. package/src-bak/components/packages-web/CustomComponentFileImport.vue +60 -0
  81. package/src-bak/components/packages-web/CustomComponentFormLayout.vue +65 -0
  82. package/src-bak/components/packages-web/CustomComponentGrid.vue +29 -0
  83. package/src-bak/components/packages-web/CustomComponentGridCol.vue +29 -0
  84. package/src-bak/components/packages-web/CustomComponentInputDialog.vue +144 -0
  85. package/src-bak/components/packages-web/CustomComponentNativeTabPane.vue +84 -0
  86. package/src-bak/components/packages-web/CustomComponentPlain.vue +243 -0
  87. package/src-bak/components/packages-web/CustomComponentRow.vue +83 -0
  88. package/src-bak/components/packages-web/CustomComponentSelectEmployees.vue +203 -0
  89. package/src-bak/components/packages-web/CustomComponentSendMail.vue +62 -0
  90. package/src-bak/components/packages-web/CustomComponentSteps.vue +41 -0
  91. package/src-bak/components/packages-web/CustomComponentTabPane.vue +20 -0
  92. package/src-bak/components/packages-web/CustomComponentTable.jsx +813 -0
  93. package/src-bak/components/packages-web/CustomComponentTabs.vue +126 -0
  94. package/src-bak/components/packages-web/CustomComponentTree.vue +28 -0
  95. package/src-bak/components/packages-web/ElButton.vue +146 -0
  96. package/src-bak/components/packages-web/ElCheckbox.vue +97 -0
  97. package/src-bak/components/packages-web/ElDatePicker.vue +93 -0
  98. package/src-bak/components/packages-web/ElInput copy.jsx +393 -0
  99. package/src-bak/components/packages-web/ElInput.jsx +312 -0
  100. package/src-bak/components/packages-web/ElInputNumber.vue +81 -0
  101. package/src-bak/components/packages-web/ElPagination.vue +61 -0
  102. package/src-bak/components/packages-web/ElRadio.vue +47 -0
  103. package/src-bak/components/packages-web/ElSelect.jsx +249 -0
  104. package/src-bak/components/packages-web/ElSelect_bak.vue +155 -0
  105. package/src-bak/components/packages-web/ElText.jsx +187 -0
  106. package/src-bak/components/packages-web/ElTextaa.vue +169 -0
  107. package/src-bak/components/packages-web/ElTimePicker.vue +39 -0
  108. package/src-bak/components/patchComponents-H5.js +46 -0
  109. package/src-bak/components/patchComponents-web.js +46 -0
  110. package/src-bak/components/simpleFormItemPc/index.js +1 -0
  111. package/src-bak/components/simpleFormItemPc/src/index.vue +94 -0
  112. package/src-bak/components/table/index.ts +29 -0
  113. package/src-bak/components/table/src/composables/use-scrollbar.ts +30 -0
  114. package/src-bak/components/table/src/config.ts +256 -0
  115. package/src-bak/components/table/src/filter-panel.vue +260 -0
  116. package/src-bak/components/table/src/h-helper.ts +34 -0
  117. package/src-bak/components/table/src/layout-observer.ts +78 -0
  118. package/src-bak/components/table/src/store/current.ts +85 -0
  119. package/src-bak/components/table/src/store/expand.ts +76 -0
  120. package/src-bak/components/table/src/store/helper.ts +74 -0
  121. package/src-bak/components/table/src/store/index.ts +246 -0
  122. package/src-bak/components/table/src/store/tree.ts +230 -0
  123. package/src-bak/components/table/src/store/watcher.ts +543 -0
  124. package/src-bak/components/table/src/table/defaults.ts +402 -0
  125. package/src-bak/components/table/src/table/key-render-helper.ts +27 -0
  126. package/src-bak/components/table/src/table/style-helper.ts +378 -0
  127. package/src-bak/components/table/src/table/utils-helper.ts +47 -0
  128. package/src-bak/components/table/src/table-body/defaults.ts +52 -0
  129. package/src-bak/components/table/src/table-body/events-helper.ts +203 -0
  130. package/src-bak/components/table/src/table-body/index.ts +119 -0
  131. package/src-bak/components/table/src/table-body/render-helper.ts +283 -0
  132. package/src-bak/components/table/src/table-body/styles-helper.ts +164 -0
  133. package/src-bak/components/table/src/table-column/defaults.ts +237 -0
  134. package/src-bak/components/table/src/table-column/index.ts +202 -0
  135. package/src-bak/components/table/src/table-column/render-helper.ts +214 -0
  136. package/src-bak/components/table/src/table-column/watcher-helper.ts +88 -0
  137. package/src-bak/components/table/src/table-footer/index.ts +128 -0
  138. package/src-bak/components/table/src/table-footer/mapState-helper.ts +33 -0
  139. package/src-bak/components/table/src/table-footer/style-helper.ts +51 -0
  140. package/src-bak/components/table/src/table-header/event-helper.ts +213 -0
  141. package/src-bak/components/table/src/table-header/index.ts +244 -0
  142. package/src-bak/components/table/src/table-header/style.helper.ts +119 -0
  143. package/src-bak/components/table/src/table-header/utils-helper.ts +94 -0
  144. package/src-bak/components/table/src/table-layout.ts +259 -0
  145. package/src-bak/components/table/src/table.vue +389 -0
  146. package/src-bak/components/table/src/tableColumn.ts +3 -0
  147. package/src-bak/components/table/src/tokens.ts +5 -0
  148. package/src-bak/components/table/src/util.ts +521 -0
  149. package/src-bak/components/table/style/css.ts +5 -0
  150. package/src-bak/components/table/style/index.ts +5 -0
  151. package/src-bak/components/tabs/index.js +8 -0
  152. package/src-bak/components/tabs/src/constants.js +23 -0
  153. package/src-bak/components/tabs/src/tab-bar.js +8 -0
  154. package/src-bak/components/tabs/src/tab-bar.vue +92 -0
  155. package/src-bak/components/tabs/src/tab-nav.jsx +424 -0
  156. package/src-bak/components/tabs/src/tab-pane.js +16 -0
  157. package/src-bak/components/tabs/src/tab-pane.vue +80 -0
  158. package/src-bak/components/tabs/src/tabs.jsx +223 -0
  159. package/src-bak/components/tabs/style/css.js +2 -0
  160. package/src-bak/components/tabs/style/index.js +2 -0
  161. package/src-bak/components/thirdPartyFrame/index.js +32 -0
  162. package/src-bak/components/thirdPartyFrame/src/ThirdPartyFrame.vue +125 -0
  163. package/src-bak/enums/index.js +16 -0
  164. package/src-bak/hooks/configLoad.js +45 -0
  165. package/src-bak/hooks/index.js +189 -0
  166. package/src-bak/hooks/mock.js +6960 -0
  167. package/src-bak/hooks/pageConfig.js +127 -0
  168. package/src-bak/index.jsx +440 -0
  169. package/src-bak/renderer.jsx +77 -0
  170. package/src-bak/resolver-H5.vue +88 -0
  171. package/src-bak/resolver-common.vue +129 -0
  172. package/src-bak/resolver-web.vue +91 -0
  173. package/src-bak/rules/eventsSupplement.js +573 -0
  174. package/src-bak/rules/parseCondition.js +378 -0
  175. package/src-bak/rules/ruleUtils.js +273 -0
  176. package/src-bak/rules/rulesDriver.js +118 -0
  177. package/src-bak/rulesImp/events.js +588 -0
  178. package/src-bak/rulesImp/index.js +33 -0
  179. package/src-bak/rulesImp/ruleInstance.js +231 -0
  180. package/src-bak/rulesImp/ruleUtils.js +124 -0
  181. package/src-bak/theme/element/components/button.scss +122 -0
  182. package/src-bak/theme/element/components/card.scss +8 -0
  183. package/src-bak/theme/element/components/checkbox.scss +19 -0
  184. package/src-bak/theme/element/components/collapse.scss +174 -0
  185. package/src-bak/theme/element/components/common.scss +30 -0
  186. package/src-bak/theme/element/components/cycle.scss +0 -0
  187. package/src-bak/theme/element/components/date.scss +13 -0
  188. package/src-bak/theme/element/components/dialog.scss +44 -0
  189. package/src-bak/theme/element/components/form.scss +104 -0
  190. package/src-bak/theme/element/components/index.scss +55 -0
  191. package/src-bak/theme/element/components/input.scss +36 -0
  192. package/src-bak/theme/element/components/message.scss +48 -0
  193. package/src-bak/theme/element/components/pagination.scss +47 -0
  194. package/src-bak/theme/element/components/popper.scss +3 -0
  195. package/src-bak/theme/element/components/radio.scss +40 -0
  196. package/src-bak/theme/element/components/scrollbar.scss +14 -0
  197. package/src-bak/theme/element/components/select.scss +82 -0
  198. package/src-bak/theme/element/components/steps.scss +6 -0
  199. package/{src/components/styles/CustomComponenTable.scss → src-bak/theme/element/components/table.scss} +90 -13
  200. package/src-bak/theme/element/components/tabs.scss +128 -0
  201. package/src-bak/theme/element/components/tag.scss +6 -0
  202. package/{src/components/styles → src-bak/theme/element/components}/text.scss +3 -3
  203. package/src-bak/theme/element/components/textarea.scss +3 -0
  204. package/src-bak/theme/element/components/tree.scss +0 -0
  205. package/src-bak/theme/element/index.scss +55 -0
  206. package/src-bak/utils/cipher.js +141 -0
  207. package/src-bak/utils/common.js +664 -0
  208. package/src-bak/utils/const.js +259 -0
  209. package/src-bak/utils/defaultVal.js +92 -0
  210. package/src-bak/utils/dom.js +36 -0
  211. package/src-bak/utils/format.js +19 -0
  212. package/src-bak/utils/index.js +4 -0
  213. package/src-bak/utils/is.js +74 -0
  214. package/src-bak/utils/loadModule.js +75 -0
  215. package/src-bak/utils/preserveFunc.js +33 -0
  216. package/src-bak/utils/render.jsx +1138 -0
  217. package/src-bak/utils/request.js +136 -0
  218. package/src-bak/utils/respone.js +70 -0
  219. package/src-bak/utils/valid.js +89 -0
@@ -0,0 +1,521 @@
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
+ }
@@ -0,0 +1,5 @@
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'
@@ -0,0 +1,5 @@
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'
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,23 @@
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')
@@ -0,0 +1,8 @@
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
+ })
@@ -0,0 +1,92 @@
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>