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,393 @@
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
+
@@ -0,0 +1,312 @@
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
+