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,393 +0,0 @@
1
- import { ElInput } from 'element-plus'
2
- import { computed, defineProps, useAttrs } from 'vue'
3
- import { commonPropsType, hasOwn, isElement } from '../../utils/index.js'
4
- import { ref } from 'vue';
5
- import { onMounted } from 'vue';
6
- import { getDomWidth } from '../../utils/dom.js';
7
- import { watch } from 'vue';
8
- import { nextTick } from 'vue';
9
- import { resolveComponent } from 'vue';
10
- import { onUnmounted } from 'vue';
11
-
12
- export default {
13
- inheritAttrs: false,
14
- props: {
15
- ...commonPropsType,
16
- ...ElInput.props,
17
- textAreaCnt: {
18
- type: [Number, String],
19
- default: 2,
20
- },
21
- // 是否在超出的时候展示tooltip
22
- showTooltip: {
23
- type: [String, Number],
24
- default: ''
25
- },
26
- // 是否使用金额显示
27
- showMoney: {
28
- type: [String, Number],
29
- default: ''
30
- },
31
- // 金额显示的分割,默认‘,’
32
- moneySeg: {
33
- type: [String],
34
- default: ','
35
- },
36
- // 金额显示的最小值
37
- min: {
38
- type: Number,
39
- default: -Infinity
40
- },
41
- // 金额显示的最大值
42
- max: {
43
- type: Number,
44
- default: Infinity
45
- },
46
- // 金额显示小数位数
47
- decimal: {
48
- type: Number,
49
- default: 2
50
- },
51
- // 金额显示时保留小数点0后缀
52
- decimalSuffix: {
53
- type: [Number, String],
54
- default: '0'
55
- },
56
- // 在显示金额的时候,可以显示的符号
57
- canShowFlag: {
58
- type: Array,
59
- default: ['na', '-']
60
- },
61
- // 金额显示是否显示货币符号
62
- showSymbol: {
63
- type: String,
64
- default: ''
65
- },
66
- // 货币符号
67
- symbol: {
68
- type: String,
69
- default: '¥'
70
- },
71
- // 符号位置:before/after
72
- symbolPosition: {
73
- type: String,
74
- default: 'before',
75
- validator: value => ['before', 'after'].includes(value)
76
- },
77
- },
78
- emits: ['update:modelValue'],
79
- setup(props, { emit, attrs, expose, slots }) {
80
- const isFocus = ref(false) // 是否是焦点状态
81
- const isEnter = ref(false) // 鼠标是否在内部
82
- const triggerRef = ref(null)
83
- const isOverflow = ref(false)
84
- const inputWrapRef = ref(null)
85
- const calcSpanRef = ref(null)
86
- const inputProps = computed(() => {
87
- const ret = Object.keys(ElInput.props).reduce((total, key) => {
88
- total[key] = props[key]
89
- return total
90
- }, {})
91
- if (props.config?.icon) {
92
- ret.suffixIcon = props.config?.icon
93
- }
94
- if (props.config?.maxLength) {
95
- ret.maxlength = parseInt(props.config.maxLength)
96
- }
97
- if (props.textAreaCnt) {
98
- ret.rows = parseInt(props.textAreaCnt)
99
- }
100
- return ret
101
- })
102
- const normalInputProps = computed(() => {
103
- const ret = {
104
- ...inputProps.value
105
- }
106
- delete ret.modelValue
107
- delete ret.suffixIcon
108
- delete ret.prefixIcon
109
- return ret
110
- })
111
- const showTooltip = computed(() => {
112
- return props?.showTooltip == '1'
113
- })
114
- // 这个是真实的值
115
- const modelValue = computed({
116
- get() {
117
- return props.modelValue
118
- },
119
- set(val) {
120
- emit('update:modelValue', val)
121
- }
122
- })
123
- // 开启金额展示的时候需要isFocus来控制格式的转换
124
- const currentVal = ref('')
125
- const displayValue = computed(() => {
126
- return props.showMoney == '1' ? (isFocus.value ? currentVal.value : formatValue(modelValue.value)) : modelValue.value
127
- })
128
- const isPagePopupAndSearch = computed(() => {
129
- return props.config?.lcpPagePopupMapVO && inputProps.value.suffixIcon == 'Search'
130
- })
131
- // 弹框是否只能支持点击icon进行触发,默认是
132
- const isOnlyIconClickFlag = computed(() => {
133
- return hasOwn(props.config, 'onlyIconClickFlag') ? props.config?.onlyIconClickFlag == '1' : true
134
- })
135
- // 输入点击弹框的情况下,是否仍然可以编辑
136
- const isPagePopupAlwayEdit = computed(() => {
137
- return props.config?.pagePopupEditFlag == '1'
138
- })
139
- const vmodelProps = computed(() => {
140
- const ret = {
141
- modelValue: displayValue.value
142
- }
143
- if (!(isPagePopupAndSearch.value && !isPagePopupAlwayEdit.value)) {
144
- ret['onUpdate:modelValue'] = (val) => {
145
- if (props.showMoney == '1') {
146
- currentVal.value = val
147
- } else {
148
- modelValue.value = val
149
- }
150
- }
151
- if (props.showMoney == '1') {
152
- ret['onFocus'] = () => {
153
- currentVal.value = modelValue.value
154
- }
155
- ret['onBlur'] = () => {
156
- modelValue.value = parseValue(formatValue(currentVal.value))
157
- }
158
- }
159
- } else {
160
- ret['onClear'] = () => {
161
- attrs?.onClear?.()
162
- modelValue.value = ''
163
- }
164
- }
165
- return ret
166
- })
167
- const inputWrapAttrs = computed(() => {
168
- return {
169
- class: attrs?.class,
170
- style: attrs?.style
171
- }
172
- })
173
- const normalAttrs = computed(() => {
174
- const ret = {
175
- ...attrs
176
- }
177
- delete ret.class
178
-
179
- const originFocus = ret['onFocus']
180
- ret['onFocus'] = (...arg) => {
181
- isFocus.value = true
182
- if (showTooltip.value) {
183
- triggerRef.value = arg?.[0]?.target
184
- }
185
- originFocus?.(...arg)
186
- }
187
- const originonBlur = ret['onBlur']
188
- ret['onBlur'] = (...arg) => {
189
- isFocus.value = false
190
- if (showTooltip.value) {
191
- if (!isEnter.value) {
192
- triggerRef.value = null
193
- }
194
- }
195
- originonBlur?.(...arg)
196
- }
197
-
198
- if (isPagePopupAndSearch.value && isOnlyIconClickFlag.value) {
199
- delete ret.onClick
200
- }
201
- if (ret.onWrapClick) {
202
- if (ret.onClick) {
203
- const originClick = ret.onClick
204
- ret.onClick = function(...arg) {
205
- originClick(...arg)
206
- ret.onWrapClick(...arg)
207
- }
208
- } else {
209
- ret.onClick = ret.onWrapClick
210
- }
211
- }
212
- return ret
213
- })
214
-
215
- const tooltipCalc = (() => {
216
- let unWatch = null
217
- let onResize = null
218
- return {
219
- clear: () => {
220
- unWatch && unWatch()
221
- onResize && window.removeEventListener('resize', onResize)
222
- },
223
- calc() {
224
- this.clear()
225
- let offset = 20
226
- if (!props.disabled && props.clearable) {
227
- offset = 50
228
- }
229
- let inputWrapWidth = getDomWidth(inputWrapRef.value, 0)
230
- let textLengthWidth = getDomWidth(calcSpanRef.value, 0 - offset)
231
- isOverflow.value = inputWrapWidth < textLengthWidth
232
-
233
- unWatch = watch(() => displayValue.value, (val) => {
234
- nextTick(() => {
235
- textLengthWidth = getDomWidth(calcSpanRef.value, 0 - offset)
236
- isOverflow.value = inputWrapWidth < textLengthWidth
237
- })
238
- })
239
- onResize = () => {
240
- inputWrapWidth = getDomWidth(inputWrapRef.value, 0)
241
- isOverflow.value = inputWrapWidth < textLengthWidth
242
- }
243
- window.addEventListener('resize', onResize)
244
- }
245
- }
246
- })()
247
-
248
- onMounted(() => {
249
- watch(showTooltip, (val) => {
250
- if (val) {
251
- tooltipCalc?.calc()
252
- }
253
- }, {
254
- immediate: true
255
- })
256
- })
257
- onUnmounted(() => {
258
- tooltipCalc?.clear()
259
- })
260
- const getInputSolts = () => {
261
- const ret = {
262
- ...slots
263
- }
264
- if (inputProps.value?.suffixIcon) {
265
- const suffixIcon = resolveComponent(inputProps.value.suffixIcon)
266
- ret.suffix = () => {
267
- const iconProps = {}
268
- if (isPagePopupAndSearch.value) {
269
- if (!props.disabled) {
270
- iconProps.onClick = attrs.onClick
271
- iconProps.style = {
272
- cursor: 'pointer'
273
- }
274
- }
275
- }
276
-
277
- return <el-icon {...iconProps}><suffixIcon /></el-icon>
278
- }
279
- }
280
- if (inputProps.value?.prefixIcon) {
281
- const prefixIcon = resolveComponent(inputProps.value.prefixIcon)
282
- ret.prefix = () => {
283
- return <el-icon><prefixIcon /></el-icon>
284
- }
285
- }
286
- return ret
287
- }
288
-
289
- // 格式化显示
290
- function formatValue(value) {
291
- if (props.canShowFlag?.includes(String(value).toLowerCase())) {
292
- return value
293
- }
294
- if (value === null || value === undefined) return ''
295
- let val = `${value}`.replace(props.moneySeg, '')
296
- val = parseFloat(val)
297
- if (isNaN(val)) {
298
- return ''
299
- }
300
-
301
- // 转换数字并限制范围
302
- val = Math.max(props.min, Math.min(props.max, val))
303
-
304
- // 处理千分位
305
- if (props.decimal != '-1') {
306
- val = val.toFixed(props.decimal)
307
- }
308
- if (props.decimalSuffix != '1') {
309
- val = parseFloat(val)
310
- }
311
- const parts = `${val}`.split('.')
312
- parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, props.moneySeg)
313
-
314
- // 添加货币符号
315
- const formatted = parts.join('.')
316
- return props.showSymbol == '1'
317
- ? props.symbolPosition === 'before'
318
- ? `${props.symbol} ${formatted}`
319
- : `${formatted} ${props.symbol}`
320
- : formatted
321
- }
322
-
323
- // 解析输入值
324
- function parseValue(value) {
325
- if (props.canShowFlag?.includes(String(value).toLowerCase())) {
326
- return value
327
- }
328
- if (value === undefined || value === null || value === '') {
329
- return ''
330
- }
331
- // 移除所有非数字字符(保留负号和小数点)
332
- let pointCount = 0
333
- const repVal = `${value}`.replace(/[^\d.-]/g, '').replace(/(\.\d*)/g, (a) => {
334
- const count = pointCount
335
- pointCount ++
336
- if (!count) {
337
- return a
338
- }
339
- return ''
340
- })
341
- const parsed = Number(repVal)
342
- return isNaN(parsed) ? '' : parsed
343
- }
344
-
345
- const inputWrapMouseEvents = computed(() => {
346
- const ret = {}
347
- if (showTooltip.value) {
348
- ret.onMouseenter = (e) => {
349
- isEnter.value = true
350
- triggerRef.value = e?.target
351
- }
352
- ret.onMouseleave = () => {
353
- isEnter.value = false
354
- if (!isFocus.value) {
355
- triggerRef.value = null
356
- }
357
- }
358
- }
359
- return ret
360
- })
361
- expose({
362
- click: (params) => {
363
- attrs?.onClick?.(null, params)
364
- }
365
- })
366
- return () => {
367
- return (
368
- <div class="input-contrainer" {...inputWrapAttrs.value}>
369
- <span ref={(e) => calcSpanRef.value = e} class="calc-span">{ displayValue.value }</span>
370
- {
371
- isOverflow.value ?
372
- <el-tooltip
373
- placement="top"
374
- visible={isOverflow.value && !!triggerRef.value}
375
- content={displayValue.value}
376
- virtualTriggering
377
- virtualRef={triggerRef.value}
378
- ></el-tooltip>
379
- : null
380
- }
381
- <div class="input-wrap" {...inputWrapMouseEvents.value} ref={(e) => inputWrapRef.value = e}>
382
- <ElInput {...vmodelProps.value} {...{...normalAttrs.value, ...normalInputProps.value}}>
383
- {
384
- getInputSolts()
385
- }
386
- </ElInput>
387
- </div>
388
- </div>
389
- )
390
- }
391
- }
392
- }
393
-
@@ -1,312 +0,0 @@
1
- import { ElInput } from 'element-plus'
2
- import { computed, defineProps, useAttrs } from 'vue'
3
- import { commonPropsType, hasOwn, isElement, parseFloatToString } from '../../utils/index.js'
4
- import { ref } from 'vue';
5
- import { onMounted } from 'vue';
6
- import { getDomWidth } from '../../utils/dom.js';
7
- import { watch } from 'vue';
8
- import { nextTick } from 'vue';
9
- import { resolveComponent } from 'vue';
10
- import { onUnmounted } from 'vue';
11
- import { useToolTip } from '../helper/calcTooltip.jsx';
12
-
13
- export default {
14
- inheritAttrs: false,
15
- props: {
16
- ...commonPropsType,
17
- ...ElInput.props,
18
- textAreaCnt: {
19
- type: [Number, String],
20
- default: 2,
21
- },
22
- // 是否在超出的时候展示tooltip
23
- showTooltip: {
24
- type: [String, Number],
25
- default: ''
26
- },
27
- // 是否使用金额显示
28
- showMoney: {
29
- type: [String, Number],
30
- default: ''
31
- },
32
- // 金额显示的分割,默认‘,’
33
- moneySeg: {
34
- type: [String],
35
- default: ','
36
- },
37
- // 金额显示的最小值
38
- min: {
39
- type: Number,
40
- default: -Infinity
41
- },
42
- // 金额显示的最大值
43
- max: {
44
- type: Number,
45
- default: Infinity
46
- },
47
- // 金额显示小数位数
48
- decimal: {
49
- type: Number,
50
- default: 2
51
- },
52
- // 金额显示时保留小数点0后缀
53
- keepLastZero: {
54
- type: [Number, String],
55
- default: '0'
56
- },
57
- // 在显示金额的时候,可以显示的符号
58
- canShowFlag: {
59
- type: Array,
60
- default: ['na', '-']
61
- },
62
- // 金额显示是否显示货币符号
63
- showSymbol: {
64
- type: String,
65
- default: ''
66
- },
67
- // 货币符号
68
- symbol: {
69
- type: String,
70
- default: '¥'
71
- },
72
- // 符号位置:before/after
73
- symbolPosition: {
74
- type: String,
75
- default: 'before',
76
- validator: value => ['before', 'after'].includes(value)
77
- },
78
- },
79
- emits: ['update:modelValue'],
80
- setup(props, { emit, attrs, expose, slots }) {
81
- const inputProps = computed(() => {
82
- const ret = Object.keys(ElInput.props).reduce((total, key) => {
83
- total[key] = props[key]
84
- return total
85
- }, {})
86
- if (props.config?.icon) {
87
- ret.suffixIcon = props.config?.icon
88
- }
89
- if (props.config?.maxLength) {
90
- ret.maxlength = parseInt(props.config.maxLength)
91
- }
92
- if (props.textAreaCnt) {
93
- ret.rows = parseInt(props.textAreaCnt)
94
- }
95
- return ret
96
- })
97
- const normalInputProps = computed(() => {
98
- const ret = {
99
- ...inputProps.value
100
- }
101
- delete ret.modelValue
102
- delete ret.suffixIcon
103
- delete ret.prefixIcon
104
- return ret
105
- })
106
- const showTooltip = computed(() => {
107
- return props?.showTooltip == '1'
108
- })
109
- // 这个是真实的值
110
- const modelValue = computed({
111
- get() {
112
- return props.modelValue
113
- },
114
- set(val) {
115
- emit('update:modelValue', val)
116
- }
117
- })
118
- // 开启金额展示的时候需要isFocus来控制格式的转换
119
- const currentVal = ref('')
120
- const isFocus = ref(false)
121
- const displayValue = computed(() => {
122
- return props.showMoney == '1' ? (isFocus.value ? currentVal.value : formatValue(modelValue.value)) : modelValue.value
123
- })
124
- const { generateTooltipWrap } = useToolTip({
125
- showTooltip,
126
- offset: computed(() => {
127
- let offset = 20
128
- if (!props.disabled && props.clearable) {
129
- offset = 50
130
- }
131
- return offset
132
- }),
133
- displayValue
134
- })
135
- const isPagePopupAndSearch = computed(() => {
136
- return props.config?.lcpPagePopupMapVO && inputProps.value.suffixIcon == 'Search'
137
- })
138
- // 弹框是否只能支持点击icon进行触发,默认是
139
- const isOnlyIconClickFlag = computed(() => {
140
- return hasOwn(props.config, 'onlyIconClickFlag') ? props.config?.onlyIconClickFlag == '1' : true
141
- })
142
- // 输入点击弹框的情况下,是否仍然可以编辑
143
- const isPagePopupAlwayEdit = computed(() => {
144
- return props.config?.pagePopupEditFlag == '1'
145
- })
146
- const vmodelProps = computed(() => {
147
- const ret = {
148
- modelValue: displayValue.value
149
- }
150
- if (!(isPagePopupAndSearch.value && !isPagePopupAlwayEdit.value)) {
151
- ret['onUpdate:modelValue'] = (val) => {
152
- if (props.showMoney == '1') {
153
- currentVal.value = val
154
- } else {
155
- modelValue.value = val
156
- }
157
- }
158
- if (props.showMoney == '1') {
159
- ret['onFocus'] = () => {
160
- if (modelValue.value === null || modelValue.value === undefined) {
161
- modelValue.value = ''
162
- }
163
- isFocus.value = true
164
- currentVal.value = modelValue.value
165
- }
166
- ret['onBlur'] = () => {
167
- isFocus.value = false
168
- modelValue.value = parseValue(formatValue(currentVal.value))
169
- }
170
- }
171
- } else {
172
- ret['onClear'] = () => {
173
- attrs?.onClear?.()
174
- modelValue.value = ''
175
- }
176
- }
177
- return ret
178
- })
179
- const inputWrapAttrs = computed(() => {
180
- return {
181
- class: attrs?.class,
182
- style: attrs?.style
183
- }
184
- })
185
- const normalAttrs = computed(() => {
186
- const ret = {
187
- ...attrs
188
- }
189
- delete ret.class
190
- delete ret.style
191
-
192
- if (isPagePopupAndSearch.value && isOnlyIconClickFlag.value) {
193
- delete ret.onClick
194
- }
195
- if (ret.onWrapClick) {
196
- if (ret.onClick) {
197
- const originClick = ret.onClick
198
- ret.onClick = function(...arg) {
199
- originClick(...arg)
200
- ret.onWrapClick(...arg)
201
- }
202
- } else {
203
- ret.onClick = ret.onWrapClick
204
- }
205
- }
206
- return ret
207
- })
208
-
209
- const getInputSolts = () => {
210
- const ret = {
211
- ...slots
212
- }
213
- if (inputProps.value?.suffixIcon) {
214
- const suffixIcon = resolveComponent(inputProps.value.suffixIcon)
215
- ret.suffix = () => {
216
- const iconProps = {}
217
- if (isPagePopupAndSearch.value) {
218
- if (!props.disabled) {
219
- iconProps.onClick = attrs.onClick
220
- iconProps.style = {
221
- cursor: 'pointer'
222
- }
223
- }
224
- }
225
-
226
- return <el-icon {...iconProps}><suffixIcon /></el-icon>
227
- }
228
- }
229
- if (inputProps.value?.prefixIcon) {
230
- const prefixIcon = resolveComponent(inputProps.value.prefixIcon)
231
- ret.prefix = () => {
232
- return <el-icon><prefixIcon /></el-icon>
233
- }
234
- }
235
- return ret
236
- }
237
-
238
- // 格式化显示
239
- function formatValue(value) {
240
- if (props.canShowFlag?.includes(String(value).toLowerCase())) {
241
- return value
242
- }
243
- if (value === null || value === undefined) return ''
244
- let val = `${value}`.replace(props.moneySeg, '')
245
- val = parseFloat(val)
246
- if (isNaN(val)) {
247
- return ''
248
- }
249
-
250
- // 转换数字并限制范围
251
- val = Math.max(props.min, Math.min(props.max, val))
252
- // 处理千分位
253
- if (props.decimal != '-1') {
254
- val = val.toFixed(props.decimal)
255
- }
256
- if (props.keepLastZero != '1') {
257
- val = parseFloatToString(val)
258
- }
259
- const parts = `${val}`.split('.')
260
- parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, props.moneySeg)
261
-
262
- // 添加货币符号
263
- const formatted = parts.join('.')
264
- return props.showSymbol == '1'
265
- ? props.symbolPosition === 'before'
266
- ? `${props.symbol} ${formatted}`
267
- : `${formatted} ${props.symbol}`
268
- : formatted
269
- }
270
-
271
- // 解析输入值
272
- function parseValue(value) {
273
- if (props.canShowFlag?.includes(String(value).toLowerCase())) {
274
- return value
275
- }
276
- if (value === undefined || value === null || value === '') {
277
- return ''
278
- }
279
- // 移除所有非数字字符(保留负号和小数点)
280
- let pointCount = 0
281
- const repVal = `${value}`.replace(/[^\d.-]/g, '').replace(/(\.\d*)/g, (a) => {
282
- const count = pointCount
283
- pointCount ++
284
- if (!count) {
285
- return a
286
- }
287
- return ''
288
- })
289
- const parsed = Number(repVal)
290
- return isNaN(parsed) ? '' : parseFloatToString(parsed)
291
- }
292
-
293
- expose({
294
- click: (params) => {
295
- attrs?.onClick?.(null, params)
296
- }
297
- })
298
- return () => {
299
- return generateTooltipWrap(
300
- <ElInput {...vmodelProps.value} {...{...normalAttrs.value, ...normalInputProps.value}}>
301
- {
302
- getInputSolts()
303
- }
304
- </ElInput>,
305
- {
306
- wrapAttrs: inputWrapAttrs.value
307
- }
308
- )
309
- }
310
- }
311
- }
312
-