hy-dispatch-ui-v3 0.1.6 → 0.2.1

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 (160) hide show
  1. package/README.md +47 -0
  2. package/dist/tailwind.css +349 -4
  3. package/es/components/appAudioPlayer/appAudioPlayer.vue.mjs +462 -0
  4. package/es/components/appAudioPlayer/index.mjs +6 -0
  5. package/es/components/appAudioPlayer/js/index.mjs +327 -0
  6. package/es/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
  7. package/es/components/appButton/style/appButton.scss +0 -1
  8. package/es/components/appConfigProvider/appConfigProvider.vue.mjs +22 -1
  9. package/es/components/appCutter/appCutter.vue.mjs +202 -129
  10. package/es/components/appDatePicker/appDatePicker.vue.mjs +1 -1
  11. package/es/components/appForm/appForm.vue.mjs +132 -209
  12. package/es/components/appForm/cpns/appFormItem.vue.mjs +312 -0
  13. package/es/components/appForm/cpns/arrayItem.vue.mjs +305 -0
  14. package/es/components/appForm/cpns/extraItem.vue.mjs +140 -0
  15. package/es/components/appForm/js/index.mjs +46 -24
  16. package/es/components/appForm/js/useAppForm.mjs +30 -6
  17. package/es/components/appForm/style/appForm.scss +53 -0
  18. package/es/components/appIcon/appIcon.vue.mjs +0 -1
  19. package/es/components/appIconBox/style/appIconBox.scss +0 -1
  20. package/es/components/appInput/appInput.vue.mjs +99 -0
  21. package/es/components/appInput/index.mjs +6 -0
  22. package/es/components/appMenu/appMenu.vue.mjs +129 -0
  23. package/es/components/appMenu/index.mjs +6 -0
  24. package/es/components/appMenu/style/appMenu.scss +145 -0
  25. package/es/components/appOrgCascader/appOrgCascader.vue.mjs +14 -10
  26. package/es/components/appSearch/appSearch.vue.mjs +55 -211
  27. package/es/components/appSearch/cpns/appSearchItem.vue.mjs +238 -0
  28. package/es/components/appSearch/js/index.mjs +20 -8
  29. package/es/components/appSearch/js/useAppSearch.mjs +10 -5
  30. package/es/components/appSearch/style/appSearch.scss +10 -0
  31. package/es/components/appTable/appTable.vue.mjs +312 -158
  32. package/es/components/appTable/cpns/columnSelect.vue.mjs +151 -156
  33. package/es/components/appTable/cpns/columnSelectItem.vue2.mjs +104 -110
  34. package/es/components/appTable/cpns/headerItem.vue.mjs +98 -0
  35. package/es/components/appTable/cpns/virtualTable.vue.mjs +560 -0
  36. package/es/components/appTable/js/index.mjs +46 -20
  37. package/es/components/appTable/js/search.mjs +1 -2
  38. package/es/components/appTable/js/useAppTable.mjs +58 -14
  39. package/es/components/appTable/style/appTable.scss +16 -0
  40. package/es/components/appTooltip/appTooltip.vue.mjs +24 -13
  41. package/es/components/appTree/appTree.vue.mjs +304 -0
  42. package/es/components/appTree/index.mjs +6 -0
  43. package/es/components/appTree/js/index.mjs +531 -0
  44. package/es/components/appUserAvatar/appUserAvatar.vue.mjs +9 -8
  45. package/es/components/appUserAvatar/style/appUserAvatar.scss +0 -1
  46. package/es/components/appVideoPlayer/appVideoPlayer.vue.mjs +645 -0
  47. package/es/components/appVideoPlayer/cpns/mediaLoading.vue.mjs +35 -0
  48. package/es/components/appVideoPlayer/index.mjs +6 -0
  49. package/es/components/appVideoPlayer/js/index.mjs +426 -0
  50. package/es/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
  51. package/es/components/appVideoPlayer/style/mediaLoading.scss +62 -0
  52. package/es/components/index.mjs +5 -0
  53. package/es/hooks/index.mjs +3 -0
  54. package/es/hooks/useApi.mjs +4 -4
  55. package/es/hooks/useAudioPlayerConfig.mjs +12 -0
  56. package/es/hooks/useGlobalConfig.mjs +18 -7
  57. package/es/hooks/useLocale.mjs +3 -11
  58. package/es/hooks/useMixins.mjs +1 -1
  59. package/es/hooks/usePermissionMap.mjs +12 -0
  60. package/es/hooks/useUserAvatarMap.mjs +2 -3
  61. package/es/hooks/useVideoPlayerConfig.mjs +12 -0
  62. package/es/index.mjs +13 -4
  63. package/es/locale/en.mjs +52 -3
  64. package/es/locale/zh_CN.mjs +48 -3
  65. package/es/make-installer.mjs +2 -0
  66. package/es/static/hy-svg-icons.js +462 -0
  67. package/es/static/index.js +2 -0
  68. package/es/static/protocolcheck.js +247 -0
  69. package/es/style/element/element.scss +9 -0
  70. package/es/style/element/index.scss +6 -3
  71. package/es/style/index.scss +11 -0
  72. package/es/style/theme.scss +73 -0
  73. package/es/utils/date.mjs +25 -1
  74. package/es/utils/file.mjs +5 -4
  75. package/es/utils/form.mjs +52 -0
  76. package/es/utils/handler.mjs +22 -2
  77. package/es/utils/index.mjs +5 -4
  78. package/es/utils/is.mjs +23 -2
  79. package/es/version.mjs +1 -1
  80. package/lib/components/appAudioPlayer/appAudioPlayer.vue.js +466 -0
  81. package/lib/components/appAudioPlayer/index.js +11 -0
  82. package/lib/components/appAudioPlayer/js/index.js +329 -0
  83. package/lib/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
  84. package/lib/components/appButton/style/appButton.scss +0 -1
  85. package/lib/components/appConfigProvider/appConfigProvider.vue.js +22 -1
  86. package/lib/components/appCutter/appCutter.vue.js +201 -128
  87. package/lib/components/appDatePicker/appDatePicker.vue.js +1 -1
  88. package/lib/components/appForm/appForm.vue.js +129 -206
  89. package/lib/components/appForm/cpns/appFormItem.vue.js +316 -0
  90. package/lib/components/appForm/cpns/arrayItem.vue.js +309 -0
  91. package/lib/components/appForm/cpns/extraItem.vue.js +144 -0
  92. package/lib/components/appForm/js/index.js +48 -23
  93. package/lib/components/appForm/js/useAppForm.js +30 -6
  94. package/lib/components/appForm/style/appForm.scss +53 -0
  95. package/lib/components/appIcon/appIcon.vue.js +0 -1
  96. package/lib/components/appIconBox/style/appIconBox.scss +0 -1
  97. package/lib/components/appInput/appInput.vue.js +103 -0
  98. package/lib/components/appInput/index.js +11 -0
  99. package/lib/components/appMenu/appMenu.vue.js +133 -0
  100. package/lib/components/appMenu/index.js +11 -0
  101. package/lib/components/appMenu/style/appMenu.scss +145 -0
  102. package/lib/components/appOrgCascader/appOrgCascader.vue.js +14 -10
  103. package/lib/components/appSearch/appSearch.vue.js +51 -207
  104. package/lib/components/appSearch/cpns/appSearchItem.vue.js +242 -0
  105. package/lib/components/appSearch/js/index.js +20 -7
  106. package/lib/components/appSearch/js/useAppSearch.js +10 -5
  107. package/lib/components/appSearch/style/appSearch.scss +10 -0
  108. package/lib/components/appTable/appTable.vue.js +319 -165
  109. package/lib/components/appTable/cpns/columnSelect.vue.js +151 -156
  110. package/lib/components/appTable/cpns/columnSelectItem.vue2.js +105 -111
  111. package/lib/components/appTable/cpns/headerItem.vue.js +102 -0
  112. package/lib/components/appTable/cpns/virtualTable.vue.js +564 -0
  113. package/lib/components/appTable/js/index.js +47 -19
  114. package/lib/components/appTable/js/search.js +1 -2
  115. package/lib/components/appTable/js/useAppTable.js +57 -13
  116. package/lib/components/appTable/style/appTable.scss +16 -0
  117. package/lib/components/appTooltip/appTooltip.vue.js +23 -12
  118. package/lib/components/appTree/appTree.vue.js +308 -0
  119. package/lib/components/appTree/index.js +11 -0
  120. package/lib/components/appTree/js/index.js +533 -0
  121. package/lib/components/appUserAvatar/appUserAvatar.vue.js +9 -8
  122. package/lib/components/appUserAvatar/style/appUserAvatar.scss +0 -1
  123. package/lib/components/appVideoPlayer/appVideoPlayer.vue.js +649 -0
  124. package/lib/components/appVideoPlayer/cpns/mediaLoading.vue.js +39 -0
  125. package/lib/components/appVideoPlayer/index.js +11 -0
  126. package/lib/components/appVideoPlayer/js/index.js +429 -0
  127. package/lib/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
  128. package/lib/components/appVideoPlayer/style/mediaLoading.scss +62 -0
  129. package/lib/components/index.js +42 -32
  130. package/lib/hooks/index.js +9 -0
  131. package/lib/hooks/useApi.js +4 -4
  132. package/lib/hooks/useAudioPlayerConfig.js +15 -0
  133. package/lib/hooks/useGlobalConfig.js +18 -7
  134. package/lib/hooks/useLocale.js +3 -11
  135. package/lib/hooks/useMixins.js +1 -1
  136. package/lib/hooks/usePermissionMap.js +15 -0
  137. package/lib/hooks/useUserAvatarMap.js +1 -2
  138. package/lib/hooks/useVideoPlayerConfig.js +15 -0
  139. package/lib/index.js +59 -33
  140. package/lib/locale/en.js +52 -3
  141. package/lib/locale/zh_CN.js +48 -3
  142. package/lib/make-installer.js +2 -0
  143. package/lib/static/hy-svg-icons.js +459 -8
  144. package/lib/static/index.js +5 -0
  145. package/lib/static/protocolcheck.js +249 -0
  146. package/lib/style/element/element.scss +9 -0
  147. package/lib/style/element/index.scss +6 -3
  148. package/lib/style/index.scss +11 -0
  149. package/lib/style/theme.scss +73 -0
  150. package/lib/utils/date.js +25 -0
  151. package/lib/utils/file.js +4 -4
  152. package/lib/utils/form.js +57 -0
  153. package/lib/utils/handler.js +22 -1
  154. package/lib/utils/index.js +8 -1
  155. package/lib/utils/is.js +23 -1
  156. package/lib/version.js +1 -1
  157. package/package.json +25 -9
  158. package/es/config/index.mjs +0 -1
  159. package/es/static/hy-svg-icons.mjs +0 -11
  160. package/lib/config/index.js +0 -2
@@ -0,0 +1,312 @@
1
+ import { computed, unref, openBlock, createBlock, normalizeStyle, withCtx, createCommentVNode, createElementVNode, renderSlot, toDisplayString, createElementBlock, createVNode, Fragment, mergeProps } from 'vue';
2
+ import { ElFormItem, ElIcon, ElSelect, ElRadioGroup, ElCheckboxGroup, ElSwitch, ElInputNumber } from 'element-plus';
3
+ import { QuestionFilled } from '@element-plus/icons-vue';
4
+ import { AppDatePicker } from '../../appDatePicker/index.mjs';
5
+ import { AppOrgCascader } from '../../appOrgCascader/index.mjs';
6
+ import { columnShowHandler, columnItemStyle, isRequired, renderText, isDisabled, optionsHandler } from '../js/index.mjs';
7
+ import { setValueByProp, getValueByProp } from '../../../utils/form.mjs';
8
+ import { AppTooltip } from '../../appTooltip/index.mjs';
9
+ import { AppInput } from '../../appInput/index.mjs';
10
+ import { isArray } from '../../../utils/is.mjs';
11
+ import { funRunHandler } from '../../../utils/handler.mjs';
12
+
13
+ const _sfc_main = {
14
+ __name: "appFormItem",
15
+ props: {
16
+ model: {
17
+ type: Object,
18
+ default: () => ({})
19
+ },
20
+ column: {
21
+ type: Object,
22
+ default: () => ({})
23
+ },
24
+ parentProp: {
25
+ type: String
26
+ },
27
+ index: {
28
+ type: Number
29
+ },
30
+ loading: {
31
+ type: Boolean,
32
+ default: false
33
+ },
34
+ readonly: {
35
+ type: Boolean,
36
+ default: false
37
+ }
38
+ },
39
+ setup(__props) {
40
+ const props = __props;
41
+ const columnProp = computed(() => {
42
+ let field = isArray(props.column.field) ? props.column.field[0] : props.column.field;
43
+ if (props.parentProp) {
44
+ field = [props.parentProp, props.index, field];
45
+ }
46
+ return field;
47
+ });
48
+ const bindValue = computed({
49
+ get() {
50
+ const prop = isArray(props.column.field) ? props.column.field[0] : props.column.field;
51
+ return getValueByProp(props.model, prop);
52
+ },
53
+ set(val) {
54
+ const prop = isArray(props.column.field) ? props.column.field[0] : props.column.field;
55
+ setValueByProp(props.model, prop, val);
56
+ }
57
+ });
58
+ const bindValue2 = computed({
59
+ get() {
60
+ const prop = isArray(props.column.field) ? props.column.field[1] : props.column.field;
61
+ return getValueByProp(props.model, prop);
62
+ },
63
+ set(val) {
64
+ const prop = isArray(props.column.field) ? props.column.field[1] : props.column.field;
65
+ setValueByProp(props.model, prop, val);
66
+ }
67
+ });
68
+ function onChangeHandler(...args) {
69
+ const { onChange } = props.column;
70
+ if (!onChange) return;
71
+ onChange(props.column, props.model);
72
+ }
73
+ return (_ctx, _cache) => {
74
+ return unref(columnShowHandler)(props, __props.column) ? (openBlock(), createBlock(unref(ElFormItem), {
75
+ key: 0,
76
+ rules: __props.column.rules,
77
+ prop: columnProp.value,
78
+ style: normalizeStyle(unref(columnItemStyle)(props, __props.column))
79
+ }, {
80
+ default: withCtx(() => [
81
+ createCommentVNode(" \u8868\u5355\u9879label "),
82
+ createElementVNode("div", { class: "w-full flex justify-between text-main" }, [
83
+ createElementVNode("div", { class: "flex items-center" }, [
84
+ renderSlot(_ctx.$slots, __props.column.labelSlot, {
85
+ column: __props.column,
86
+ model: __props.model,
87
+ required: unref(isRequired)(props, __props.column)
88
+ }, () => [
89
+ createElementVNode(
90
+ "span",
91
+ { class: "text-main" },
92
+ toDisplayString(__props.column.label),
93
+ 1
94
+ /* TEXT */
95
+ )
96
+ ]),
97
+ unref(isRequired)(props, __props.column) ? (openBlock(), createElementBlock("span", {
98
+ key: 0,
99
+ class: "label-required"
100
+ })) : createCommentVNode("v-if", true),
101
+ unref(funRunHandler)(__props.column.help) ? (openBlock(), createBlock(unref(AppTooltip), {
102
+ key: 1,
103
+ "is-always": "",
104
+ content: unref(funRunHandler)(__props.column.help)
105
+ }, {
106
+ default: withCtx(() => [
107
+ createVNode(unref(ElIcon), {
108
+ size: "14",
109
+ color: "rgba(var(--hy-theme))",
110
+ class: "ml-1.5"
111
+ }, {
112
+ default: withCtx(() => [
113
+ createVNode(unref(QuestionFilled))
114
+ ]),
115
+ _: 1
116
+ /* STABLE */
117
+ })
118
+ ]),
119
+ _: 1
120
+ /* STABLE */
121
+ }, 8, ["content"])) : createCommentVNode("v-if", true)
122
+ ]),
123
+ __props.column.rightSlot && _ctx.$slots[__props.column.rightSlot] ? (openBlock(), createElementBlock("div", {
124
+ key: 0,
125
+ class: "ml-2"
126
+ }, [
127
+ renderSlot(_ctx.$slots, __props.column.rightSlot, {
128
+ column: __props.column,
129
+ model: __props.model,
130
+ required: unref(isRequired)(props, __props.column)
131
+ })
132
+ ])) : createCommentVNode("v-if", true)
133
+ ]),
134
+ createCommentVNode(" \u5185\u5BB9\u4EC5\u67E5\u770B "),
135
+ __props.column.readonly || __props.readonly || !__props.column.type && !__props.column.slot ? (openBlock(), createElementBlock("div", {
136
+ key: 0,
137
+ class: "w-full text-main h-[32px]"
138
+ }, [
139
+ unref(renderText)(props, __props.column) ? (openBlock(), createElementBlock(
140
+ "span",
141
+ { key: 0 },
142
+ toDisplayString(unref(renderText)(props, __props.column)),
143
+ 1
144
+ /* TEXT */
145
+ )) : (openBlock(), createElementBlock("span", {
146
+ key: 1,
147
+ class: "text-auxiliary"
148
+ }, "- -"))
149
+ ])) : (openBlock(), createElementBlock(
150
+ Fragment,
151
+ { key: 1 },
152
+ [
153
+ createCommentVNode(" \u81EA\u5B9A\u4E49\u5177\u540D\u63D2\u69FD "),
154
+ __props.column.slot && _ctx.$slots[__props.column.slot] ? renderSlot(_ctx.$slots, __props.column.slot, {
155
+ key: 0,
156
+ column: __props.column,
157
+ model: __props.model,
158
+ required: unref(isRequired)(props, __props.column)
159
+ }) : __props.column.type === "input" ? (openBlock(), createElementBlock(
160
+ Fragment,
161
+ { key: 1 },
162
+ [
163
+ createCommentVNode(" \u8F93\u5165\u6846 "),
164
+ createVNode(unref(AppInput), mergeProps({
165
+ modelValue: bindValue.value,
166
+ "onUpdate:modelValue": ($event) => bindValue.value = $event
167
+ }, __props.column.attrs, {
168
+ disabled: unref(isDisabled)(props, __props.column),
169
+ onChange: onChangeHandler
170
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])
171
+ ],
172
+ 2112
173
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
174
+ )) : __props.column.type === "select" ? (openBlock(), createElementBlock(
175
+ Fragment,
176
+ { key: 2 },
177
+ [
178
+ createCommentVNode(" \u9009\u62E9\u6846 "),
179
+ createVNode(unref(ElSelect), mergeProps({
180
+ modelValue: bindValue.value,
181
+ "onUpdate:modelValue": ($event) => bindValue.value = $event
182
+ }, __props.column.attrs, {
183
+ disabled: unref(isDisabled)(props, __props.column),
184
+ options: unref(optionsHandler)(props, __props.column),
185
+ onChange: onChangeHandler
186
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
187
+ ],
188
+ 2112
189
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
190
+ )) : __props.column.type === "date-picker" ? (openBlock(), createElementBlock(
191
+ Fragment,
192
+ { key: 3 },
193
+ [
194
+ createCommentVNode(" \u65E5\u671F\u9009\u62E9\u6846 "),
195
+ ["datetimerange", "daterange", "monthrange", "yearrange"].includes(
196
+ __props.column.attrs?.type
197
+ ) && unref(isArray)(__props.column.field) ? (openBlock(), createBlock(unref(AppDatePicker), mergeProps({
198
+ key: 0,
199
+ start: bindValue.value,
200
+ "onUpdate:start": ($event) => bindValue.value = $event,
201
+ end: bindValue2.value,
202
+ "onUpdate:end": ($event) => bindValue2.value = $event,
203
+ "is-range": true,
204
+ style: { "width": "100%" }
205
+ }, __props.column.attrs, {
206
+ disabled: unref(isDisabled)(props, __props.column),
207
+ onChange: onChangeHandler
208
+ }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled"])) : (openBlock(), createBlock(unref(AppDatePicker), mergeProps({
209
+ key: 1,
210
+ modelValue: bindValue.value,
211
+ "onUpdate:modelValue": ($event) => bindValue.value = $event,
212
+ "is-range": false,
213
+ style: { "width": "100%" }
214
+ }, __props.column.attrs, {
215
+ disabled: unref(isDisabled)(props, __props.column),
216
+ onChange: onChangeHandler
217
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"]))
218
+ ],
219
+ 64
220
+ /* STABLE_FRAGMENT */
221
+ )) : __props.column.type === "radio" ? (openBlock(), createElementBlock(
222
+ Fragment,
223
+ { key: 4 },
224
+ [
225
+ createCommentVNode(" \u5355\u9009 "),
226
+ createVNode(unref(ElRadioGroup), mergeProps({
227
+ modelValue: bindValue.value,
228
+ "onUpdate:modelValue": ($event) => bindValue.value = $event
229
+ }, __props.column.attrs, {
230
+ disabled: unref(isDisabled)(props, __props.column),
231
+ options: unref(optionsHandler)(props, __props.column),
232
+ onChange: onChangeHandler
233
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
234
+ ],
235
+ 2112
236
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
237
+ )) : __props.column.type === "checkbox" ? (openBlock(), createElementBlock(
238
+ Fragment,
239
+ { key: 5 },
240
+ [
241
+ createCommentVNode(" \u591A\u9009 "),
242
+ createVNode(unref(ElCheckboxGroup), mergeProps({
243
+ modelValue: bindValue.value,
244
+ "onUpdate:modelValue": ($event) => bindValue.value = $event
245
+ }, __props.column.attrs, {
246
+ disabled: unref(isDisabled)(props, __props.column),
247
+ options: unref(optionsHandler)(props, __props.column),
248
+ onChange: onChangeHandler
249
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
250
+ ],
251
+ 2112
252
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
253
+ )) : __props.column.type === "switch" ? (openBlock(), createElementBlock(
254
+ Fragment,
255
+ { key: 6 },
256
+ [
257
+ createCommentVNode(" \u5F00\u5173 "),
258
+ createVNode(unref(ElSwitch), mergeProps({
259
+ modelValue: bindValue.value,
260
+ "onUpdate:modelValue": ($event) => bindValue.value = $event
261
+ }, __props.column.attrs, {
262
+ disabled: unref(isDisabled)(props, __props.column),
263
+ onChange: onChangeHandler
264
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])
265
+ ],
266
+ 2112
267
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
268
+ )) : __props.column.type === "input-number" ? (openBlock(), createElementBlock(
269
+ Fragment,
270
+ { key: 7 },
271
+ [
272
+ createCommentVNode(" \u6570\u5B57\u8F93\u5165\u6846 "),
273
+ createVNode(unref(ElInputNumber), mergeProps({
274
+ modelValue: bindValue.value,
275
+ "onUpdate:modelValue": ($event) => bindValue.value = $event
276
+ }, __props.column.attrs, {
277
+ disabled: unref(isDisabled)(props, __props.column),
278
+ onChange: onChangeHandler
279
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])
280
+ ],
281
+ 2112
282
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
283
+ )) : __props.column.type === "org-cascader" ? (openBlock(), createElementBlock(
284
+ Fragment,
285
+ { key: 8 },
286
+ [
287
+ createCommentVNode(" \u90E8\u95E8\u7EA7\u8054\u9009\u62E9\u6846 "),
288
+ createVNode(unref(AppOrgCascader), mergeProps({
289
+ modelValue: bindValue.value,
290
+ "onUpdate:modelValue": ($event) => bindValue.value = $event,
291
+ class: "w-full"
292
+ }, __props.column.attrs, {
293
+ disabled: unref(isDisabled)(props, __props.column),
294
+ onChange: onChangeHandler
295
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])
296
+ ],
297
+ 2112
298
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
299
+ )) : createCommentVNode("v-if", true)
300
+ ],
301
+ 64
302
+ /* STABLE_FRAGMENT */
303
+ ))
304
+ ]),
305
+ _: 3
306
+ /* FORWARDED */
307
+ }, 8, ["rules", "prop", "style"])) : createCommentVNode("v-if", true);
308
+ };
309
+ }
310
+ };
311
+
312
+ export { _sfc_main as default };
@@ -0,0 +1,305 @@
1
+ import { computed, useTemplateRef, ref, resolveComponent, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot, unref, toDisplayString, createBlock, withCtx, createVNode, createCommentVNode, normalizeStyle, Fragment, renderList, createSlots, mergeProps } from 'vue';
2
+ import { ElIcon } from 'element-plus';
3
+ import { Delete, Top, Bottom, CirclePlus } from '@element-plus/icons-vue';
4
+ import { isRequired, renderArrayItemLabel, renderAddLabel } from '../js/index.mjs';
5
+ import _sfc_main$1 from './appFormItem.vue.mjs';
6
+ import { resetAppFormValue } from '../js/useAppForm.mjs';
7
+ import { useLocale } from '../../../hooks/useLocale.mjs';
8
+ import { setValueByProp, getValueByProp } from '../../../utils/form.mjs';
9
+ import { isNumber, isArray } from '../../../utils/is.mjs';
10
+ import { funRunHandler } from '../../../utils/handler.mjs';
11
+ import { AppTooltip } from '../../appTooltip/index.mjs';
12
+
13
+ const _sfc_main = {
14
+ __name: "arrayItem",
15
+ props: {
16
+ model: {
17
+ type: Object,
18
+ default: () => ({})
19
+ },
20
+ column: {
21
+ type: Object,
22
+ default: () => ({})
23
+ },
24
+ columnNum: {
25
+ type: Number,
26
+ default: 1
27
+ },
28
+ loading: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+ readonly: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ size: {
37
+ type: String,
38
+ default: "default"
39
+ }
40
+ },
41
+ setup(__props) {
42
+ const props = __props;
43
+ const { t } = useLocale();
44
+ const bindValue = computed({
45
+ get() {
46
+ const prop = props.column.field;
47
+ return getValueByProp(props.model, prop);
48
+ },
49
+ set(val) {
50
+ const prop = props.column.field;
51
+ setValueByProp(props.model, prop, val);
52
+ }
53
+ });
54
+ const containerRef = useTemplateRef("containerRef");
55
+ ref(0);
56
+ ref(false);
57
+ ref(null);
58
+ const containerStyle = computed(() => {
59
+ const columnNum = isNumber(props.column.columnNum) && props.column.columnNum > 0 ? props.column.columnNum : isNumber(props.columnNum) && props.columnNum > 0 ? props.columnNum || 1 : 1;
60
+ return {
61
+ gridTemplateColumns: `repeat(${columnNum}, minmax(0, 1fr))`
62
+ };
63
+ });
64
+ function onAddItemHandler() {
65
+ if (!isArray(bindValue.value)) {
66
+ bindValue.value = [];
67
+ }
68
+ bindValue.value.push(resetAppFormValue(props.column.children));
69
+ }
70
+ function onDeleteItemHandler(index) {
71
+ bindValue.value.splice(index, 1);
72
+ }
73
+ function onSwapItemHandler(index, index2) {
74
+ const list = bindValue.value;
75
+ list[index] = list.splice(index2, 1, list[index])[0];
76
+ }
77
+ return (_ctx, _cache) => {
78
+ const _component_QuestionFilled = resolveComponent("QuestionFilled");
79
+ return openBlock(), createElementBlock("div", null, [
80
+ createElementVNode(
81
+ "div",
82
+ {
83
+ class: normalizeClass(["w-full flex justify-between text-main", [__props.size === "small" ? "text-xs" : "text-sm"]])
84
+ },
85
+ [
86
+ createElementVNode("div", { class: "flex items-center" }, [
87
+ renderSlot(_ctx.$slots, __props.column.labelSlot, {
88
+ column: __props.column,
89
+ model: __props.model,
90
+ required: unref(isRequired)(props, __props.column)
91
+ }, () => [
92
+ createElementVNode(
93
+ "span",
94
+ { class: "text-main" },
95
+ toDisplayString(__props.column.label),
96
+ 1
97
+ /* TEXT */
98
+ )
99
+ ]),
100
+ unref(funRunHandler)(__props.column.help) ? (openBlock(), createBlock(unref(AppTooltip), {
101
+ key: 0,
102
+ "is-always": "",
103
+ content: unref(funRunHandler)(__props.column.help)
104
+ }, {
105
+ default: withCtx(() => [
106
+ createVNode(unref(ElIcon), {
107
+ size: "14",
108
+ color: "rgba(var(--hy-theme))",
109
+ class: "ml-1.5"
110
+ }, {
111
+ default: withCtx(() => [
112
+ createVNode(_component_QuestionFilled)
113
+ ]),
114
+ _: 1
115
+ /* STABLE */
116
+ })
117
+ ]),
118
+ _: 1
119
+ /* STABLE */
120
+ }, 8, ["content"])) : createCommentVNode("v-if", true)
121
+ ]),
122
+ __props.column.rightSlot && _ctx.$slots[__props.column.rightSlot] ? (openBlock(), createElementBlock("div", {
123
+ key: 0,
124
+ class: "ml-2"
125
+ }, [
126
+ renderSlot(_ctx.$slots, __props.column.rightSlot, {
127
+ column: __props.column,
128
+ model: __props.model,
129
+ required: unref(isRequired)(props, __props.column)
130
+ })
131
+ ])) : createCommentVNode("v-if", true)
132
+ ],
133
+ 2
134
+ /* CLASS */
135
+ ),
136
+ createElementVNode(
137
+ "div",
138
+ {
139
+ class: "overflow-y-auto scroll-body",
140
+ style: normalizeStyle({ maxHeight: `${__props.column.height || 500}px` })
141
+ },
142
+ [
143
+ (openBlock(true), createElementBlock(
144
+ Fragment,
145
+ null,
146
+ renderList(bindValue.value, (item, index) => {
147
+ return openBlock(), createElementBlock(
148
+ "div",
149
+ {
150
+ key: index,
151
+ class: normalizeClass(["bg-background-2 rounded-[6px] border border-border my-1.5", [__props.size === "small" ? "px-4 pt-2" : " pt-3 px-5"]])
152
+ },
153
+ [
154
+ createElementVNode("div", { class: "flex items-center min-h-[36px]" }, [
155
+ createElementVNode("div", { class: "flex items-center gap-2 text-xs" }, [
156
+ createElementVNode(
157
+ "div",
158
+ { class: "w-4 h-4 rounded-full border-[2px] border-theme text-theme font-bold flex items-center justify-center" },
159
+ toDisplayString(index + 1),
160
+ 1
161
+ /* TEXT */
162
+ ),
163
+ renderSlot(_ctx.$slots, __props.column.itemLabelSlot, {
164
+ column: __props.column,
165
+ index
166
+ }, () => [
167
+ createElementVNode(
168
+ "span",
169
+ { class: "text-auxiliary" },
170
+ toDisplayString(unref(renderArrayItemLabel)(props, __props.column, index)),
171
+ 1
172
+ /* TEXT */
173
+ )
174
+ ])
175
+ ]),
176
+ createElementVNode("div", { class: "flex items-center gap-3 ml-auto" }, [
177
+ bindValue.value.length > 1 || props.column.emptyChildren ? (openBlock(), createElementBlock("div", {
178
+ key: 0,
179
+ class: "clickBox bg-background py-0.5 px-1.5 rounded",
180
+ onClick: ($event) => onDeleteItemHandler(index)
181
+ }, [
182
+ createVNode(unref(ElIcon), {
183
+ size: "14",
184
+ color: "rgb(var(--hy-danger-2))"
185
+ }, {
186
+ default: withCtx(() => [
187
+ createVNode(unref(Delete))
188
+ ]),
189
+ _: 1
190
+ /* STABLE */
191
+ })
192
+ ], 8, ["onClick"])) : createCommentVNode("v-if", true),
193
+ bindValue.value.length > 1 ? (openBlock(), createElementBlock("div", {
194
+ key: 1,
195
+ class: "flex flex-col justify-center"
196
+ }, [
197
+ index !== 0 ? (openBlock(), createBlock(unref(ElIcon), {
198
+ key: 0,
199
+ size: "16",
200
+ class: "text-auxiliary hover:text-main clickBox",
201
+ onClick: ($event) => onSwapItemHandler(index, index - 1)
202
+ }, {
203
+ default: withCtx(() => [
204
+ createVNode(unref(Top))
205
+ ]),
206
+ _: 1
207
+ /* STABLE */
208
+ }, 8, ["onClick"])) : createCommentVNode("v-if", true),
209
+ index !== bindValue.value.length - 1 ? (openBlock(), createBlock(unref(ElIcon), {
210
+ key: 1,
211
+ size: "16",
212
+ class: "text-auxiliary hover:text-main clickBox",
213
+ onClick: ($event) => onSwapItemHandler(index, index + 1)
214
+ }, {
215
+ default: withCtx(() => [
216
+ createVNode(unref(Bottom))
217
+ ]),
218
+ _: 1
219
+ /* STABLE */
220
+ }, 8, ["onClick"])) : createCommentVNode("v-if", true)
221
+ ])) : createCommentVNode("v-if", true)
222
+ ])
223
+ ]),
224
+ createElementVNode(
225
+ "div",
226
+ {
227
+ ref_for: true,
228
+ ref_key: "containerRef",
229
+ ref: containerRef,
230
+ class: "grid gap-x-6",
231
+ style: normalizeStyle(containerStyle.value)
232
+ },
233
+ [
234
+ (openBlock(true), createElementBlock(
235
+ Fragment,
236
+ null,
237
+ renderList(__props.column.children, (citem, cindex) => {
238
+ return openBlock(), createBlock(_sfc_main$1, {
239
+ key: cindex,
240
+ model: item,
241
+ column: citem,
242
+ "parent-prop": __props.column.field,
243
+ index,
244
+ loading: __props.loading,
245
+ readonly: __props.readonly
246
+ }, createSlots({
247
+ _: 2
248
+ /* DYNAMIC */
249
+ }, [
250
+ renderList(_ctx.$slots, (_, slotName) => {
251
+ return {
252
+ name: slotName,
253
+ fn: withCtx((scope) => [
254
+ renderSlot(_ctx.$slots, slotName, mergeProps({ ref_for: true }, scope))
255
+ ])
256
+ };
257
+ })
258
+ ]), 1032, ["model", "column", "parent-prop", "index", "loading", "readonly"]);
259
+ }),
260
+ 128
261
+ /* KEYED_FRAGMENT */
262
+ ))
263
+ ],
264
+ 4
265
+ /* STYLE */
266
+ )
267
+ ],
268
+ 2
269
+ /* CLASS */
270
+ );
271
+ }),
272
+ 128
273
+ /* KEYED_FRAGMENT */
274
+ ))
275
+ ],
276
+ 4
277
+ /* STYLE */
278
+ ),
279
+ createElementVNode("div", { class: "flex justify-center mt-2.5" }, [
280
+ createElementVNode("span", {
281
+ onClick: ($event) => onAddItemHandler(),
282
+ class: "flex items-center justify-center clickBox text-success"
283
+ }, [
284
+ createVNode(unref(ElIcon), null, {
285
+ default: withCtx(() => [
286
+ createVNode(unref(CirclePlus))
287
+ ]),
288
+ _: 1
289
+ /* STABLE */
290
+ }),
291
+ createElementVNode(
292
+ "span",
293
+ { style: { "margin-left": "6px" } },
294
+ toDisplayString(unref(renderAddLabel)(props, __props.column)),
295
+ 1
296
+ /* TEXT */
297
+ )
298
+ ], 8, ["onClick"])
299
+ ])
300
+ ]);
301
+ };
302
+ }
303
+ };
304
+
305
+ export { _sfc_main as default };