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,81 +0,0 @@
1
- <template>
2
- <ElInputNumber v-bind="{...inputNumberProps, ...attrs}" @blur="normalValue" :class="[textAlignClass]" :key="updateKey" v-model="inputNumberValue">
3
- <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
4
- <slot :name="key" v-bind="scope"></slot>
5
- </template>
6
- </ElInputNumber>
7
- </template>
8
- <script setup>
9
- import { ElInputNumber } from 'element-plus'
10
- import { useAttrs, computed, ref, useSlots } from 'vue'
11
- import { commonPropsType, isDate } from '../../utils/index.js'
12
-
13
- const slots = useSlots()
14
- const props = defineProps({
15
- textAlign: {
16
- type: String, // left、right
17
- default: ''
18
- },
19
- ...ElInputNumber.props,
20
- ...commonPropsType,
21
- step: [String, Number],
22
- precision: [String, Number],
23
- modeValue: [String, Number]
24
- })
25
- const textAlignClass = computed(() => {
26
- return props.textAlign === 'right' ? 'text-right' :
27
- props.textAlign === 'left' ? 'text-left' : ''
28
- })
29
- const inputNumberProps = computed(() => {
30
- const ret = Object.keys(ElInputNumber.props).reduce((ret, key) => {
31
- ret[key] = props[key]
32
- return ret
33
- }, {})
34
- if (props.config?.maxValue && !isNaN(props.config.maxValue)) {
35
- ret.max =parseFloat(props.config.maxValue)
36
- }
37
- if (props.config?.minValue && !isNaN(props.config.minValue)) {
38
- ret.min = parseFloat(props.config.minValue)
39
- }
40
- if (props.config?.precise && !isNaN(props.config.precise)) {
41
- ret.precision = parseInt(props.config.precise)
42
- }
43
- if (ret.step) {
44
- ret.step = parseFloat(ret.step)
45
- }
46
- return ret
47
- })
48
- const attrs = useAttrs()
49
- const modeValue = defineModel()
50
- const inputNumberValue = computed({
51
- get() {
52
- return parseFloat(modeValue.value)
53
- },
54
- set(val) {
55
- modeValue.value = val
56
- }
57
- })
58
- // 目前有问题,可以输入--跟e字符串
59
- const updateKey = ref(false)
60
- const normalValue = () => {
61
- if (modeValue.value === null) {
62
- updateKey.value = !updateKey.value
63
- }
64
- }
65
- </script>
66
- <style lang="scss">
67
- .text-right {
68
- .el-input__wrapper {
69
- input {
70
- text-align: right;
71
- }
72
- }
73
- }
74
- .text-left {
75
- .el-input__wrapper {
76
- input {
77
- text-align: left;
78
- }
79
- }
80
- }
81
- </style>
@@ -1,61 +0,0 @@
1
- <script setup>
2
- import { ElPagination } from 'element-plus'
3
- import { computed, defineProps, useAttrs, useSlots } from 'vue'
4
- import { commonPropsType, hasOwn } from '../../utils/index.js'
5
-
6
- const props = defineProps({
7
- ...commonPropsType,
8
- ...ElPagination.props,
9
- })
10
- const slots = useSlots()
11
- const calcProps = computed(() => {
12
- const ret = Object.keys(ElPagination.props).reduce((total, key) => {
13
- total[key] = props[key]
14
- return total
15
- }, {})
16
- if (!props.config['page-sizes'] && !props.config['pageSizes']) {
17
- ret['pageSizes'] = [5, 10, 20, 30]
18
- }
19
- if (!ret.layout || typeof ret.layout !== 'string') {
20
- ret.layout = 'total'
21
- }
22
- if (props.config?.showSizer == '1' || props.config?.showJumper == '1') {
23
- const layoutArr = ret.layout ? ret.layout.split(',') : []
24
- if (props.config?.showSizer == '1') {
25
- if (!layoutArr.some(item => item.trim() === 'sizes')) {
26
- layoutArr.splice(1, 0, 'sizes')
27
- }
28
- }
29
- if (!layoutArr.some(item => item.trim() === 'prev')) {
30
- layoutArr.splice(2, 0, 'prev')
31
- }
32
- if (!layoutArr.some(item => item.trim() === 'pager')) {
33
- layoutArr.splice(3, 0, 'pager')
34
- }
35
- if (!layoutArr.some(item => item.trim() === 'next')) {
36
- layoutArr.splice(4, 0, 'next')
37
- }
38
- if (props.config?.showJumper == '1') {
39
- if (!layoutArr.some(item => item.trim() === 'jumper')) {
40
- layoutArr.push('jumper')
41
- }
42
- }
43
- ret.layout = layoutArr.join(',')
44
- }
45
-
46
- if (!hasOwn(props.config, 'background')) {
47
- ret.background = true
48
- }
49
- return ret
50
- })
51
- const attrs = useAttrs()
52
- const modelValue = defineModel()
53
-
54
- </script>
55
- <template>
56
- <ElPagination v-bind="{...attrs, ...calcProps}">
57
- <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
58
- <slot :name="key" v-bind="scope"></slot>
59
- </template>
60
- </ElPagination>
61
- </template>
@@ -1,47 +0,0 @@
1
- <template>
2
- <el-radio-group v-bind="{...radioGroupProps, ...attrs}" v-model="modeValue">
3
- <CurrentRadio v-for="option in props.options"
4
- :key="option.columnValue"
5
- :value="option.columnValue"
6
- >
7
- {{lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}}
8
- <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
9
- <slot :name="key" v-bind="scope"></slot>
10
- </template>
11
- </CurrentRadio>
12
- </el-radio-group>
13
- </template>
14
- <script setup>
15
- import { ElRadioGroup, ElRadio, ElRadioButton } from 'element-plus'
16
- import { useAttrs, computed, inject, useSlots } from 'vue'
17
- import { commonPropsType, hasOwn } from '../../utils/index.js'
18
-
19
- const props = defineProps({
20
- ...ElRadioGroup.props,
21
- ...commonPropsType,
22
- })
23
- const slots = useSlots()
24
- // 两种样式,一种是button,一种是default,默认为default
25
- const type = computed(() => {
26
- return props.config.type || 'default'
27
- })
28
-
29
- const CurrentRadio = computed(() => {
30
- return type.value === 'button' ? ElRadioButton : ElRadio
31
- })
32
-
33
- const lang = inject('lang')
34
-
35
- const radioGroupProps = computed(() => {
36
- const ret = Object.keys(ElRadioGroup.props).reduce((ret, key) => {
37
- ret[key] = props[key]
38
- return ret
39
- }, {})
40
- if (!hasOwn(ret, 'value')) {
41
- ret.value = '1'
42
- }
43
- return ret
44
- })
45
- const attrs = useAttrs()
46
- const modeValue = defineModel()
47
- </script>
@@ -1,249 +0,0 @@
1
- import { ElSelect, ElOption, ElSelectV2 } from 'element-plus'
2
- import { computed, inject, onMounted, watch} from 'vue'
3
- import { commonPropsType, hasOwn, isArray, isNumber, isPlainObject, isString, VALUE_TYPES } from '../../utils/index.js'
4
- import OptionsDefault from '../options/optionsDefault.vue'
5
-
6
- export default {
7
- inheritAttrs: false,
8
- props: {
9
- ...ElSelectV2.props,
10
- ...ElSelect.props,
11
- ...commonPropsType,
12
- multiple: [String, Boolean, Number],
13
- filterable: [String, Boolean, Number],
14
- multipleLimit: [String, Number],
15
- rangeOptions: Array,
16
- excludeOptions: Array,
17
- // 多选的分割符号
18
- separator: {
19
- type: [String],
20
- default: ','
21
- },
22
- virtualized: {
23
- type: [String, Boolean, Number],
24
- default: ''
25
- }
26
- },
27
- emits: ['update:modelValue'],
28
- setup(props, { emit, attrs, expose, slots }) {
29
- // 这个是真实的值
30
- const modelValue = computed({
31
- get() {
32
- let val = props.modelValue
33
- if (!props.hidden) {
34
- if (isStrVal.value) {
35
- if (isPlainObject(val) || isArray(val)) {
36
- try {
37
- val = Object.values(val).join(props.separator)
38
- emit('update:modelValue', val)
39
- } catch (error) {
40
- val = val
41
- }
42
- }
43
- } else {
44
- if ((val && isString(val)) || isNumber(val)) {
45
- val = `${val}`?.split(props.separator)
46
- if (isObject.value) {
47
- val = val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {})
48
- }
49
- emit('update:modelValue', val)
50
- }
51
- }
52
- }
53
- return val
54
- },
55
- set(val) {
56
- emit('update:modelValue', val)
57
- }
58
- })
59
- const separator = computed(() => {
60
- return props.separator
61
- })
62
- const valueTypes = computed(() => {
63
- return props.config?.valueType
64
- })
65
- // 值是list 还是,连起来的string
66
- const isStrVal = computed(() => {
67
- // valueType 值为 list 或者 string
68
- return valueTypes.value !== VALUE_TYPES.LIST && valueTypes.value !== VALUE_TYPES.OBJECT
69
- })
70
- const isObject = computed(() => {
71
- return valueTypes.value === VALUE_TYPES.OBJECT
72
- })
73
-
74
- // 是否为多选
75
- const isMutiple = computed(() => {
76
- if (typeof props.multiple === 'boolean') {
77
- return props.multiple
78
- }
79
- return props.multiple == '1'
80
- })
81
-
82
- const options = computed(() => {
83
- let list = props.options
84
- if (props.rangeOptions && props.rangeOptions.length) {
85
- list = list?.filter?.(item => props.rangeOptions?.some(subValue => subValue == item.columnValue))
86
- }
87
- if (props.excludeOptions && props.excludeOptions.length) {
88
- list = list?.filter?.(item => !(props.excludeOptions?.some(subValue => subValue == item.columnValue)))
89
- }
90
- return list
91
- })
92
-
93
- const isVirtualized = computed(() => {
94
- if (typeof props.virtualized === 'boolean') {
95
- return props.virtualized
96
- }
97
- return props.virtualized == '1'
98
- })
99
-
100
- const currentComp = computed(() => {
101
- return isVirtualized.value ? ElSelectV2 : ElSelect
102
- })
103
-
104
- const value = computed({
105
- get() {
106
- if (isMutiple.value) {
107
- if (hasOwn(props.config, 'isMatch')) {
108
- // 如果是多选情况,不需要使用isMatch进行判断,所以这里需要进行清除
109
- props.config.isMatch = true
110
- }
111
- const val = modelValue.value || ''
112
- return val ?
113
- (
114
- isStrVal.value ?
115
- val.split(separator.value) :
116
- (
117
- isObject.value ?
118
- Object.values(val || {}) :
119
- val
120
- )
121
- ) :
122
- []
123
- } else {
124
- if (modelValue.value !== null && modelValue.value !== undefined) {
125
- if (options.value?.some(item => item.columnValue == modelValue.value)) {
126
- props.config.isMatch = true
127
- return `${modelValue.value}`
128
- } else {
129
- props.config.isMatch = false
130
- return ''
131
- }
132
- } else {
133
- return ''
134
- }
135
- }
136
- },
137
- set(val) {
138
- if (isMutiple.value) {
139
- modelValue.value = isStrVal.value ?
140
- val.join(separator.value) :
141
- (
142
- isObject.value ?
143
- val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {}) :
144
- val
145
- )
146
- } else {
147
- modelValue.value = val
148
- }
149
- }
150
- })
151
-
152
- const selectProps = computed(() => {
153
- // let props = ElSelect.props
154
- // if (isVirtualized.value) {
155
- // props = ElSelectV2.props
156
- // }
157
- // 不同通过上面注释代码进行赋值,可能是ElSelectV2.props、ElSelect.props不能复制给其他的
158
-
159
- const attrs = Object.keys(isVirtualized.value ? ElSelectV2.props : ElSelect.props).reduce((ret, key) => {
160
- ret[key] = props[key]
161
- return ret
162
- }, {})
163
- if (attrs.placeholder === null || attrs.placeholder === undefined) {
164
- attrs.placeholder = ''
165
- }
166
- if (typeof attrs.filterable !== 'boolean') {
167
- attrs.filterable = attrs.filterable == '1'
168
- }
169
- if (typeof attrs.multiple === 'string') {
170
- attrs.multiple = attrs.multiple == '1'
171
- }
172
- if (!attrs['suffix-icon'] && !attrs.suffixIcon) {
173
- delete attrs.suffixIcon
174
- delete attrs['suffix-icon']
175
- }
176
- attrs.multipleLimit = Number(parseInt(attrs.multipleLimit || 0))
177
- if (isVirtualized.value) {
178
- // 返回虚拟select需要的options
179
- attrs.options = options.value?.map(option => {
180
- return {
181
- ...option,
182
- value: option.columnValue,
183
- label: lang?.value?.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc,
184
- disabled: option.columnStatus == '0' || option.columnStatus == '2'
185
- }
186
- })
187
- }
188
- return attrs
189
- })
190
- const lang = inject('lang')
191
- const clear = () => {
192
- modelValue.value = ''
193
- }
194
- const getRenderSlots = function () {
195
- const optionsSlotKeys = {
196
- optionDefault: 'default'
197
- }
198
- const optionsSlots = {}
199
- const selectSlots = {}
200
- Object.keys(slots).forEach(key => {
201
- if (Object.keys(optionsSlotKeys).includes(key)) {
202
- optionsSlots[optionsSlotKeys[key]] = slots[key]
203
- } else {
204
- selectSlots[key] = slots[key]
205
- }
206
- })
207
-
208
- if (isVirtualized.value) {
209
- const originDef = selectSlots.default
210
- selectSlots.default = ({ item: option }) => {
211
- return (
212
- <OptionsDefault label={lang?.value?.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}>
213
- {
214
- originDef?.(option)
215
- }
216
- </OptionsDefault>
217
- )
218
- }
219
- } else {
220
- selectSlots.default = () => options.value?.map(option => {
221
- return (
222
- <ElOption
223
- key={option.columnValue}
224
- label={lang?.value?.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}
225
- value={option.columnValue}
226
- disabled={option.columnStatus == '0' || option.columnStatus == '2'}
227
- >
228
- <OptionsDefault label={lang?.value?.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc}>
229
- {
230
- optionsSlots?.default?.(option)
231
- }
232
- </OptionsDefault>
233
- </ElOption>
234
- )
235
- })
236
- }
237
- return selectSlots
238
- }
239
- return () => {
240
- return (
241
- <currentComp.value class="custom-self-select" { ...{...attrs, ...selectProps.value }} v-model={value.value} onClear={clear}>
242
- {
243
- getRenderSlots()
244
- }
245
- </currentComp.value>
246
- )
247
- }
248
- }
249
- }
@@ -1,155 +0,0 @@
1
- <template>
2
- <ElSelect class="custom-self-select" v-bind="{...attrs, ...selectProps }" v-model="value" @clear="clear">
3
- <ElOption v-for="option in options"
4
- :key="option.columnValue"
5
- :label="lang.indexOf('zh') > -1 ? option.columnDesc_zh : option.columnDesc"
6
- :value="option.columnValue"
7
- :disabled="option.columnStatus == '0' || option.columnStatus == '2'"
8
- >
9
- <template v-for="(_, key) in optionsSlots" :key="key" v-slot:[key]="scope">
10
- <slot :name="key" v-bind="scope"></slot>
11
- </template>
12
- </ElOption>
13
- <template v-for="(_, key) in slots" :key="key" v-slot:[key]="scope">
14
- <slot :name="key" v-bind="scope"></slot>
15
- </template>
16
- </ElSelect>
17
- </template>
18
- <script setup>
19
- import { ElSelect, ElOption } from 'element-plus'
20
- import { computed, defineProps, inject, useAttrs, useSlots } from 'vue'
21
- import { commonPropsType, getComponentSolt } from '../../utils/index.js'
22
-
23
- const VALUE_TYPES = {
24
- LIST: 'list',
25
- OBJECT: 'object',
26
- STRING: 'string',
27
- }
28
- const slots = useSlots()
29
- const optionsSlots = computed(() => {
30
- return getComponentSolt({
31
- config: props.config,
32
- slotKey: 'optionsSlots'
33
- }) || {}
34
- })
35
- const modelValue = defineModel()
36
- const props = defineProps({
37
- ...ElSelect.props,
38
- ...commonPropsType,
39
- multiple: [String, Boolean],
40
- filterable: [String, Boolean],
41
- multipleLimit: [String, Number],
42
- rangeOptions: Array,
43
- excludeOptions: Array,
44
- // 多选的分割符号
45
- separator: {
46
- type: [String],
47
- default: ','
48
- }
49
- })
50
- const attrs = useAttrs()
51
- const separator = computed(() => {
52
- return props.separator
53
- })
54
- const valueTypes = computed(() => {
55
- return props.config?.valueType
56
- })
57
- // 值是list 还是,连起来的string
58
- const isStrVal = computed(() => {
59
- // valueType 值为 list 或者 string
60
- return valueTypes.value !== VALUE_TYPES.LIST && valueTypes.value !== VALUE_TYPES.OBJECT
61
- })
62
- const isObject = computed(() => {
63
- return valueTypes.value === VALUE_TYPES.OBJECT
64
- })
65
-
66
- // 是否为多选
67
- const isMutiple = computed(() => {
68
- return props.multiple == '1'
69
- })
70
-
71
- const options = computed(() => {
72
- let list = props.options
73
- if (props.rangeOptions && props.rangeOptions.length) {
74
- list = list?.filter?.(item => props.rangeOptions?.some(subValue => subValue == item.columnValue))
75
- }
76
- if (props.excludeOptions && props.excludeOptions.length) {
77
- list = list?.filter?.(item => !(props.excludeOptions?.some(subValue => subValue == item.columnValue)))
78
- }
79
- return list
80
- })
81
-
82
- const value = computed({
83
- get() {
84
- if (isMutiple.value) {
85
- const val = modelValue.value || ''
86
- return val ?
87
- (
88
- isStrVal.value ?
89
- val.split(separator.value) :
90
- (
91
- isObject.value ?
92
- Object.values(val || {}) :
93
- val
94
- )
95
- ) :
96
- []
97
- } else {
98
- if (modelValue.value !== null && modelValue.value !== undefined) {
99
- if (options.value?.some(item => item.columnValue == modelValue.value)) {
100
- props.config.isMatch = true
101
- return `${modelValue.value}`
102
- } else {
103
- props.config.isMatch = false
104
- return ''
105
- }
106
- } else {
107
- return ''
108
- }
109
- }
110
- },
111
- set(val) {
112
- if (isMutiple.value) {
113
- modelValue.value = isStrVal.value ?
114
- val.join(separator.value) :
115
- (
116
- isObject.value ?
117
- val?.reduce((ret, item, idx) => {ret[idx] = item; return ret;}, {}) :
118
- val
119
- )
120
- } else {
121
- modelValue.value = val
122
- }
123
- }
124
- })
125
-
126
- const selectProps = computed(() => {
127
- const attrs = Object.keys(ElSelect.props).reduce((ret, key) => {
128
- ret[key] = props[key]
129
- return ret
130
- }, {})
131
- if (attrs.placeholder === null || attrs.placeholder === undefined) {
132
- attrs.placeholder = ''
133
- }
134
- if (typeof attrs.filterable === 'string') {
135
- attrs.filterable = attrs.filterable == '1'
136
- }
137
- if (typeof attrs.multiple === 'string') {
138
- attrs.multiple = attrs.multiple == '1'
139
- }
140
- if (!attrs['suffix-icon'] && !attrs.suffixIcon) {
141
- delete attrs.suffixIcon
142
- delete attrs['suffix-icon']
143
- }
144
- attrs.multipleLimit = Number(parseInt(attrs.multipleLimit || 0))
145
- return attrs
146
- })
147
- const lang = inject('lang')
148
- const clear = () => {
149
- modelValue.value = ''
150
- }
151
- </script>
152
- <style lang="scss">
153
- .custom-self-select {
154
- }
155
- </style>