hy-dispatch-ui-v3 0.2.52 → 0.2.54

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 (116) hide show
  1. package/dist/tailwind.css +53 -0
  2. package/es/components/hyBatchUploadDialog/batchUploadDialog.vue.mjs +45 -11
  3. package/es/components/hyConfirmDialog/confirmDialog.vue.mjs +12 -22
  4. package/es/components/hyDialog/dialog.vue.mjs +9 -7
  5. package/es/components/hyForm/cpns/arrayItem.vue.mjs +5 -5
  6. package/es/components/hyForm/cpns/extraItem.vue.mjs +6 -1
  7. package/es/components/hyForm/cpns/formItem.vue.mjs +29 -14
  8. package/es/components/hyForm/js/index.mjs +29 -25
  9. package/es/components/hyForm/js/useAppForm.mjs +15 -30
  10. package/es/components/hyIconBox/iconBox.vue.mjs +1 -1
  11. package/es/components/hyIconBox/style/iconBox.scss +1 -1
  12. package/es/components/hyMap/index.mjs +6 -0
  13. package/es/components/hyMap/js/index.mjs +59 -0
  14. package/es/components/hyMap/map.vue.mjs +59 -0
  15. package/es/components/hyOrgCascader/js/index.mjs +53 -0
  16. package/es/components/hyOrgCascader/orgCascader.vue.mjs +22 -25
  17. package/es/components/hySearch/search.vue.mjs +6 -8
  18. package/es/components/hyTable/cpns/columnSelect.vue.mjs +10 -18
  19. package/es/components/hyTable/table.vue.mjs +8 -11
  20. package/es/components/hyTableActionButton/tableActionButton.vue.mjs +6 -3
  21. package/es/components/hyTableForm/batchTableForm.vue.mjs +182 -135
  22. package/es/components/hyTableForm/js/index.mjs +2 -2
  23. package/es/components/hyTableForm/tableForm.vue.mjs +29 -20
  24. package/es/components/hyTooltip/tooltip.vue.mjs +1 -1
  25. package/es/components/hyTree/js/index.mjs +6 -4
  26. package/es/components/hyTree/tree.vue.mjs +7 -1
  27. package/es/components/index.mjs +1 -0
  28. package/es/hooks/index.mjs +1 -0
  29. package/es/hooks/useApi.mjs +11 -5
  30. package/es/hooks/useAudioPlayerConfig.mjs +13 -5
  31. package/es/hooks/useEnsureHyIcon.mjs +11 -5
  32. package/es/hooks/useLocale.mjs +6 -5
  33. package/es/hooks/usePermissionMap.mjs +13 -5
  34. package/es/hooks/useSubscribe.mjs +28 -0
  35. package/es/hooks/useTooltipConfig.mjs +11 -5
  36. package/es/hooks/useUserAvatarMap.mjs +13 -5
  37. package/es/hooks/useVideoPlayerConfig.mjs +13 -5
  38. package/es/index.mjs +3 -2
  39. package/es/static/map/CFCASIPInput.min.js +258 -0
  40. package/es/static/map/MarkerCluster.css +75 -0
  41. package/es/static/map/bigemap.css +838 -0
  42. package/es/static/map/bigemap.js +5 -0
  43. package/es/static/map/bm.geometryutil.js +754 -0
  44. package/es/static/map/bmDraw.css +329 -0
  45. package/es/static/map/bmDraw.js +181 -0
  46. package/es/static/map/car.png +0 -0
  47. package/es/static/map/markercluster.js +2679 -0
  48. package/es/static/map/moveMarker.js +74 -0
  49. package/es/utils/form.mjs +38 -2
  50. package/es/utils/index.mjs +1 -2
  51. package/es/utils/map/hook/bigMap.mjs +1136 -0
  52. package/es/utils/map/hook/gaode.mjs +683 -0
  53. package/es/utils/map/hook/leafletjs.mjs +1336 -0
  54. package/es/utils/map/index.mjs +291 -0
  55. package/es/utils/map/js/mapProxy.mjs +38 -0
  56. package/es/utils/map/js/webgis.mjs +153 -0
  57. package/es/version.mjs +1 -1
  58. package/lib/components/hyBatchUploadDialog/batchUploadDialog.vue.js +46 -12
  59. package/lib/components/hyConfirmDialog/confirmDialog.vue.js +13 -23
  60. package/lib/components/hyDialog/dialog.vue.js +9 -7
  61. package/lib/components/hyForm/cpns/arrayItem.vue.js +4 -4
  62. package/lib/components/hyForm/cpns/extraItem.vue.js +6 -1
  63. package/lib/components/hyForm/cpns/formItem.vue.js +26 -11
  64. package/lib/components/hyForm/js/index.js +29 -23
  65. package/lib/components/hyForm/js/useAppForm.js +14 -29
  66. package/lib/components/hyIconBox/iconBox.vue.js +1 -1
  67. package/lib/components/hyIconBox/style/iconBox.scss +1 -1
  68. package/lib/components/hyMap/index.js +11 -0
  69. package/lib/components/hyMap/js/index.js +61 -0
  70. package/lib/components/hyMap/map.vue.js +63 -0
  71. package/lib/components/hyOrgCascader/js/index.js +56 -0
  72. package/lib/components/hyOrgCascader/orgCascader.vue.js +21 -24
  73. package/lib/components/hySearch/search.vue.js +4 -6
  74. package/lib/components/hyTable/cpns/columnSelect.vue.js +12 -20
  75. package/lib/components/hyTable/table.vue.js +17 -20
  76. package/lib/components/hyTableActionButton/tableActionButton.vue.js +5 -2
  77. package/lib/components/hyTableForm/batchTableForm.vue.js +181 -134
  78. package/lib/components/hyTableForm/js/index.js +1 -1
  79. package/lib/components/hyTableForm/tableForm.vue.js +29 -20
  80. package/lib/components/hyTooltip/tooltip.vue.js +1 -1
  81. package/lib/components/hyTree/js/index.js +6 -4
  82. package/lib/components/hyTree/tree.vue.js +7 -1
  83. package/lib/components/index.js +22 -20
  84. package/lib/hooks/index.js +3 -0
  85. package/lib/hooks/useApi.js +10 -4
  86. package/lib/hooks/useAudioPlayerConfig.js +12 -4
  87. package/lib/hooks/useEnsureHyIcon.js +10 -4
  88. package/lib/hooks/useLocale.js +5 -4
  89. package/lib/hooks/usePermissionMap.js +12 -4
  90. package/lib/hooks/useSubscribe.js +31 -0
  91. package/lib/hooks/useTooltipConfig.js +10 -4
  92. package/lib/hooks/useUserAvatarMap.js +12 -4
  93. package/lib/hooks/useVideoPlayerConfig.js +12 -4
  94. package/lib/index.js +27 -22
  95. package/lib/static/map/CFCASIPInput.min.js +258 -0
  96. package/lib/static/map/MarkerCluster.css +75 -0
  97. package/lib/static/map/bigemap.css +838 -0
  98. package/lib/static/map/bigemap.js +5 -0
  99. package/lib/static/map/bm.geometryutil.js +754 -0
  100. package/lib/static/map/bmDraw.css +329 -0
  101. package/lib/static/map/bmDraw.js +181 -0
  102. package/lib/static/map/car.png +0 -0
  103. package/lib/static/map/markercluster.js +2679 -0
  104. package/lib/static/map/moveMarker.js +74 -0
  105. package/lib/utils/form.js +38 -0
  106. package/lib/utils/index.js +2 -2
  107. package/lib/utils/map/hook/bigMap.js +1140 -0
  108. package/lib/utils/map/hook/gaode.js +687 -0
  109. package/lib/utils/map/hook/leafletjs.js +1360 -0
  110. package/lib/utils/map/index.js +298 -0
  111. package/lib/utils/map/js/mapProxy.js +44 -0
  112. package/lib/utils/map/js/webgis.js +162 -0
  113. package/lib/version.js +1 -1
  114. package/package.json +16 -1
  115. package/es/utils/bus.mjs +0 -5
  116. package/lib/utils/bus.js +0 -7
package/dist/tailwind.css CHANGED
@@ -148,6 +148,18 @@
148
148
  }
149
149
  }
150
150
 
151
+ .sr-only {
152
+ position: absolute;
153
+ width: 1px;
154
+ height: 1px;
155
+ padding: 0;
156
+ margin: -1px;
157
+ overflow: hidden;
158
+ clip: rect(0, 0, 0, 0);
159
+ white-space: nowrap;
160
+ border-width: 0;
161
+ }
162
+
151
163
  .visible {
152
164
  visibility: visible;
153
165
  }
@@ -452,6 +464,10 @@
452
464
  height: 12px !important;
453
465
  }
454
466
 
467
+ .\!h-\[18px\] {
468
+ height: 18px !important;
469
+ }
470
+
455
471
  .\!h-\[20px\] {
456
472
  height: 20px !important;
457
473
  }
@@ -484,6 +500,10 @@
484
500
  height: 0.125rem;
485
501
  }
486
502
 
503
+ .h-1 {
504
+ height: 0.25rem;
505
+ }
506
+
487
507
  .h-1\.5 {
488
508
  height: 0.375rem;
489
509
  }
@@ -644,6 +664,10 @@
644
664
  width: 0.125rem;
645
665
  }
646
666
 
667
+ .w-1 {
668
+ width: 0.25rem;
669
+ }
670
+
647
671
  .w-1\.5 {
648
672
  width: 0.375rem;
649
673
  }
@@ -783,6 +807,10 @@
783
807
  cursor: pointer;
784
808
  }
785
809
 
810
+ .cursor-wait {
811
+ cursor: wait;
812
+ }
813
+
786
814
  .select-none {
787
815
  -webkit-user-select: none;
788
816
  -moz-user-select: none;
@@ -1048,6 +1076,10 @@
1048
1076
  padding: 0px !important;
1049
1077
  }
1050
1078
 
1079
+ .p-1 {
1080
+ padding: 0.25rem;
1081
+ }
1082
+
1051
1083
  .p-5 {
1052
1084
  padding: 1.25rem;
1053
1085
  }
@@ -1329,6 +1361,12 @@
1329
1361
  text-decoration-line: underline;
1330
1362
  }
1331
1363
 
1364
+ .shadow {
1365
+ --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
1366
+ --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);
1367
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
1368
+ }
1369
+
1332
1370
  .shadow-\[0_0_4px_0\] {
1333
1371
  --tw-shadow: 0 0 4px 0;
1334
1372
  --tw-shadow-colored: 0 0 4px 0 var(--tw-shadow-color);
@@ -1372,6 +1410,21 @@
1372
1410
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
1373
1411
  }
1374
1412
 
1413
+ .grayscale {
1414
+ --tw-grayscale: grayscale(100%);
1415
+ filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
1416
+ }
1417
+
1418
+ .invert {
1419
+ --tw-invert: invert(100%);
1420
+ filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
1421
+ }
1422
+
1423
+ .sepia {
1424
+ --tw-sepia: sepia(100%);
1425
+ filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
1426
+ }
1427
+
1375
1428
  .filter {
1376
1429
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
1377
1430
  }
@@ -1,10 +1,10 @@
1
- import { defineComponent, useTemplateRef, useModel, ref, openBlock, createBlock, unref, mergeProps, createSlots, withCtx, renderList, renderSlot, normalizeProps, guardReactiveProps, createCommentVNode, createVNode, createTextVNode, toDisplayString, createElementBlock, mergeModels } from 'vue';
1
+ import { defineComponent, useTemplateRef, useModel, ref, openBlock, createBlock, unref, mergeProps, createSlots, withCtx, renderList, renderSlot, normalizeProps, guardReactiveProps, createCommentVNode, createTextVNode, createVNode, toDisplayString, createElementBlock, createElementVNode, mergeModels } from 'vue';
2
2
  import { ElIcon } from 'element-plus';
3
3
  import { Warning } from '@element-plus/icons-vue';
4
4
  import { HyDialog } from '../hyDialog/index.mjs';
5
5
  import { HyBatchTableForm } from '../hyTableForm/index.mjs';
6
- import { HyTooltip } from '../hyTooltip/index.mjs';
7
6
  import { HyButton } from '../hyButton/index.mjs';
7
+ import { HyTooltip } from '../hyTooltip/index.mjs';
8
8
 
9
9
  import "./style/batchUploadDialog.scss";
10
10
 
@@ -100,11 +100,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
100
100
  const emits = __emit;
101
101
  const batchTableFormRef = useTemplateRef("batchTableFormRef");
102
102
  const visible = useModel(__props, "modelValue");
103
- const showSubmit = ref(false);
103
+ const HyDialogRef = useTemplateRef("HyDialogRef");
104
+ const currentStep = ref(1);
104
105
  const isSubmitting = ref(false);
106
+ const totalElements = ref(0);
105
107
  const failedCount = ref(0);
106
108
  const failedStatus = ref(null);
107
- const HyDialogRef = useTemplateRef("HyDialogRef");
108
109
  function setDragLevelIndex(dragLevel) {
109
110
  HyDialogRef.value.setDragLevelIndex(dragLevel);
110
111
  }
@@ -115,26 +116,26 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
115
116
  emits("onDialogMousedown", e);
116
117
  }
117
118
  async function show() {
118
- visible.value = true;
119
- showSubmit.value = false;
119
+ currentStep.value = 1;
120
120
  failedCount.value = 0;
121
+ totalElements.value = 0;
121
122
  failedStatus.value = null;
123
+ visible.value = true;
122
124
  }
123
125
  function onTableUploadingHandler(...args) {
124
126
  emits("uploading", ...args);
125
127
  }
126
128
  function onTableUploadedHandler(...args) {
127
- showSubmit.value = true;
128
129
  emits("uploaded", ...args);
129
130
  }
130
131
  function onTableResetHandler(...args) {
131
132
  failedCount.value = 0;
132
133
  failedStatus.value = null;
133
- showSubmit.value = false;
134
134
  emits("reset", ...args);
135
135
  }
136
136
  function onTableValidateHandler(params) {
137
137
  const { row, prop, isValid, message, total, success, failed } = params;
138
+ totalElements.value = total;
138
139
  failedCount.value = failed;
139
140
  failedStatus.value = !failed ? null : failedStatus.value || "validate";
140
141
  emits("validate", params);
@@ -156,10 +157,18 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
156
157
  isSubmitting.value = false;
157
158
  emits("submit", params);
158
159
  }
160
+ function onNextStep() {
161
+ batchTableFormRef.value.nextStep();
162
+ }
159
163
  async function onSubmitHandler() {
160
164
  const res = await batchTableFormRef.value.validate();
161
165
  if (props.uploadType === "custom") {
162
- return { ...res, result: res.total === res.success };
166
+ const dataSource = batchTableFormRef.value.getTableDataSource();
167
+ onTableSubmitHandler({
168
+ ...res,
169
+ result: res.total === res.success,
170
+ dataSource
171
+ });
163
172
  } else {
164
173
  batchTableFormRef.value.submitDataSource();
165
174
  }
@@ -225,11 +234,34 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
225
234
  1
226
235
  /* TEXT */
227
236
  ))
237
+ ])) : currentStep.value === 2 && !totalElements.value ? (openBlock(), createElementBlock("div", {
238
+ key: 1,
239
+ class: "flex items-center gap-1.5 text-xs text-warning"
240
+ }, [
241
+ createVNode(unref(ElIcon), null, {
242
+ default: withCtx(() => [
243
+ createVNode(unref(Warning))
244
+ ]),
245
+ _: 1
246
+ /* STABLE */
247
+ }),
248
+ createElementVNode("span", null, "\u5F53\u524D\u672A\u5BFC\u5165\u6570\u636E\uFF0C\u8BF7\u60A8\u5BFC\u5165\u6DFB\u52A0\u6570\u636E")
228
249
  ])) : createCommentVNode("v-if", true)
229
250
  ]),
230
251
  "operate-right-box": withCtx(() => [
231
- showSubmit.value ? (openBlock(), createBlock(unref(HyTooltip), {
252
+ currentStep.value === 1 ? (openBlock(), createBlock(unref(HyButton), {
232
253
  key: 0,
254
+ type: "primary",
255
+ class: "!min-w-[120px]",
256
+ onClick: onNextStep
257
+ }, {
258
+ default: withCtx(() => [
259
+ createTextVNode("\u8FDB\u5165\u6DFB\u52A0")
260
+ ]),
261
+ _: 1
262
+ /* STABLE */
263
+ })) : currentStep.value === 2 ? (openBlock(), createBlock(unref(HyTooltip), {
264
+ key: 1,
233
265
  disabled: !isSubmitting.value,
234
266
  content: "\u6570\u636E\u6B63\u5728\u5BFC\u5165\u4E2D\uFF0C\u8BF7\u7A0D\u7B49"
235
267
  }, {
@@ -260,6 +292,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
260
292
  key: 0,
261
293
  ref_key: "batchTableFormRef",
262
294
  ref: batchTableFormRef,
295
+ step: currentStep.value,
296
+ "onUpdate:step": ($event) => currentStep.value = $event,
263
297
  tableColumns: __props.tableColumns,
264
298
  formColumns: __props.formColumns,
265
299
  rules: __props.rules,
@@ -288,7 +322,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
288
322
  ])
289
323
  };
290
324
  })
291
- ]), 1032, ["tableColumns", "formColumns", "rules", "emptyText", "fontSize", "rowClickExpand", "columnNum", "size", "beforeDataHandle", "submit-handler"])) : createCommentVNode("v-if", true)
325
+ ]), 1032, ["step", "onUpdate:step", "tableColumns", "formColumns", "rules", "emptyText", "fontSize", "rowClickExpand", "columnNum", "size", "beforeDataHandle", "submit-handler"])) : createCommentVNode("v-if", true)
292
326
  ]),
293
327
  _: 2
294
328
  /* DYNAMIC */
@@ -1,7 +1,7 @@
1
- import { defineComponent, useModel, ref, openBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, createVNode, normalizeClass, toDisplayString, createElementBlock, createTextVNode, createCommentVNode, withModifiers, mergeModels } from 'vue';
2
- import { ElDialog, ElIcon } from 'element-plus';
3
- import { Warning, CircleClose } from '@element-plus/icons-vue';
1
+ import { defineComponent, useModel, ref, openBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, createCommentVNode, createVNode, normalizeStyle, normalizeClass, toDisplayString, createElementBlock, createTextVNode, withModifiers, mergeModels } from 'vue';
2
+ import { ElDialog } from 'element-plus';
4
3
  import { useLocale } from '../../hooks/useLocale.mjs';
4
+ import { HyIcon } from '../hyIcon/index.mjs';
5
5
  import { HyButton } from '../hyButton/index.mjs';
6
6
 
7
7
  const __default__ = defineComponent({
@@ -157,15 +157,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
157
157
  onClick: onCloseHandler
158
158
  },
159
159
  [
160
- createVNode(unref(ElIcon), {
161
- size: "18",
162
- color: "rgb(var(--hy-danger-2))"
163
- }, {
164
- default: withCtx(() => [
165
- createVNode(unref(CircleClose))
166
- ]),
167
- _: 1
168
- /* STABLE */
160
+ createVNode(unref(HyIcon), {
161
+ "svg-name": "layout-dialog-close-v2",
162
+ "class-name": "!w-[18px] !h-[18px]"
169
163
  })
170
164
  ],
171
165
  2
@@ -176,16 +170,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
176
170
  default: withCtx(() => [
177
171
  createElementVNode("div", { class: "flex flex-col items-center justify-between pt-[37px] pb-[27px]" }, [
178
172
  createElementVNode("div", { class: "flex flex-col items-center text-main" }, [
179
- createVNode(unref(ElIcon), {
180
- size: "40",
181
- color: __props.iconColor
182
- }, {
183
- default: withCtx(() => [
184
- createVNode(unref(Warning))
185
- ]),
186
- _: 1
187
- /* STABLE */
188
- }, 8, ["color"]),
173
+ createCommentVNode(' <el-icon size="40" :color="iconColor"><Warning /></el-icon> '),
174
+ createVNode(unref(HyIcon), {
175
+ "svg-name": "dispatch-share1-prompt",
176
+ class: "!w-[40px] !h-[40px]",
177
+ style: normalizeStyle({ color: __props.iconColor })
178
+ }, null, 8, ["style"]),
189
179
  createElementVNode(
190
180
  "div",
191
181
  {
@@ -221,13 +221,15 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
221
221
  class: normalizeClass(["box-border w-full border-0 border-b border-solid border-background-3 px-4 py-[10px] text-main text-sm font-bold flex justify-between items-center relative", { "!justify-center": __props.titleAlign === "center" }])
222
222
  },
223
223
  [
224
- createElementVNode(
225
- "div",
226
- { class: "flex-grow w-0 mr-2 over_one_line" },
227
- toDisplayString(__props.title),
228
- 1
229
- /* TEXT */
230
- ),
224
+ createElementVNode("div", { class: "flex-grow w-0 mr-2 over_one_line" }, [
225
+ renderSlot(_ctx.$slots, "title", {}, () => [
226
+ createTextVNode(
227
+ toDisplayString(__props.title),
228
+ 1
229
+ /* TEXT */
230
+ )
231
+ ])
232
+ ]),
231
233
  createElementVNode("div", { class: "text-lg cursor-pointer" }, [
232
234
  renderSlot(_ctx.$slots, "title-operate-box"),
233
235
  __props.ifShrink ? (openBlock(), createBlock(unref(HyIcon), {
@@ -1,13 +1,12 @@
1
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
2
  import { ElIcon } from 'element-plus';
3
3
  import { Delete, Top, Bottom, CirclePlus } from '@element-plus/icons-vue';
4
- import { isRequired, renderArrayItemLabel, renderAddLabel } from '../js/index.mjs';
4
+ import { isRequired, columnHelpHandler, renderArrayItemLabel, renderAddLabel } from '../js/index.mjs';
5
5
  import _sfc_main$1 from './formItem.vue.mjs';
6
6
  import { resetAppFormValue } from '../js/useAppForm.mjs';
7
7
  import { useLocale } from '../../../hooks/useLocale.mjs';
8
8
  import { setValueByProp, getValueByProp } from '../../../utils/form.mjs';
9
9
  import { isNumber, isArray } from '../../../utils/is.mjs';
10
- import { funRunHandler } from '../../../utils/handler.mjs';
11
10
  import { HyTooltip } from '../../hyTooltip/index.mjs';
12
11
 
13
12
  const _sfc_main = {
@@ -105,11 +104,11 @@ const _sfc_main = {
105
104
  /* TEXT */
106
105
  )
107
106
  ]),
108
- unref(funRunHandler)(__props.column.help) ? (openBlock(), createBlock(unref(HyTooltip), {
107
+ unref(columnHelpHandler)(props, __props.column) ? (openBlock(), createBlock(unref(HyTooltip), {
109
108
  key: 0,
110
109
  "is-always": "",
111
110
  overLine: 1,
112
- content: unref(funRunHandler)(__props.column.help)
111
+ content: unref(columnHelpHandler)(props, __props.column)
113
112
  }, {
114
113
  default: withCtx(() => [
115
114
  createVNode(unref(ElIcon), {
@@ -252,6 +251,7 @@ const _sfc_main = {
252
251
  "parent-prop": __props.column.field,
253
252
  index,
254
253
  loading: __props.loading,
254
+ size: __props.size,
255
255
  disabled: __props.disabled,
256
256
  readonly: __props.readonly,
257
257
  level: 3
@@ -267,7 +267,7 @@ const _sfc_main = {
267
267
  ])
268
268
  };
269
269
  })
270
- ]), 1032, ["model", "column", "rules", "parent-prop", "index", "loading", "disabled", "readonly"]);
270
+ ]), 1032, ["model", "column", "rules", "parent-prop", "index", "loading", "size", "disabled", "readonly"]);
271
271
  }),
272
272
  128
273
273
  /* KEYED_FRAGMENT */
@@ -35,6 +35,10 @@ const _sfc_main = {
35
35
  readonly: {
36
36
  type: Boolean,
37
37
  default: false
38
+ },
39
+ size: {
40
+ type: String,
41
+ default: "default"
38
42
  }
39
43
  },
40
44
  setup(__props) {
@@ -114,6 +118,7 @@ const _sfc_main = {
114
118
  model: __props.model,
115
119
  column: item,
116
120
  rules: __props.rules,
121
+ size: __props.size,
117
122
  loading: __props.loading,
118
123
  disabled: __props.disabled,
119
124
  readonly: __props.readonly
@@ -129,7 +134,7 @@ const _sfc_main = {
129
134
  ])
130
135
  };
131
136
  })
132
- ]), 1032, ["model", "column", "rules", "loading", "disabled", "readonly"]);
137
+ ]), 1032, ["model", "column", "rules", "size", "loading", "disabled", "readonly"]);
133
138
  }),
134
139
  128
135
140
  /* KEYED_FRAGMENT */
@@ -1,10 +1,9 @@
1
- import { computed, unref, openBlock, createBlock, normalizeStyle, withCtx, createCommentVNode, createElementVNode, renderSlot, toDisplayString, createElementBlock, createVNode, normalizeClass, Fragment, mergeProps } from 'vue';
1
+ import { useTemplateRef, computed, unref, openBlock, createBlock, normalizeStyle, withCtx, createCommentVNode, createElementVNode, renderSlot, toDisplayString, createElementBlock, createVNode, normalizeClass, Fragment, mergeProps } from 'vue';
2
2
  import { ElFormItem, ElIcon, ElSelect, ElRadioGroup, ElCheckboxGroup, ElSwitch, ElInputNumber } from 'element-plus';
3
3
  import { QuestionFilled } from '@element-plus/icons-vue';
4
- import { columnShowHandler, columnItemStyle, isRequired, renderText, isDisabled, optionsHandler } from '../js/index.mjs';
4
+ import { columnShowHandler, columnItemStyle, isRequired, columnHelpHandler, isReadonly, renderText, isDisabled, optionsHandler } from '../js/index.mjs';
5
5
  import { isArray } from '../../../utils/is.mjs';
6
- import { setValueByProp, getValueByProp } from '../../../utils/form.mjs';
7
- import { funRunHandler } from '../../../utils/handler.mjs';
6
+ import { setValueByProp, getValueByProp, columnRuleHandler } from '../../../utils/form.mjs';
8
7
  import { HyTooltip } from '../../hyTooltip/index.mjs';
9
8
  import { HyInput } from '../../hyInput/index.mjs';
10
9
  import { HyDatePicker } from '../../hyDatePicker/index.mjs';
@@ -47,10 +46,15 @@ const _sfc_main = {
47
46
  level: {
48
47
  type: Number,
49
48
  default: 2
49
+ },
50
+ size: {
51
+ type: String,
52
+ default: "default"
50
53
  }
51
54
  },
52
55
  setup(__props) {
53
56
  const props = __props;
57
+ const formItemRef = useTemplateRef("formItemRef");
54
58
  const columnProp = computed(() => {
55
59
  let field = isArray(props.column.field) ? props.column.field[0] : props.column.field;
56
60
  if (props.parentProp) {
@@ -78,7 +82,13 @@ const _sfc_main = {
78
82
  setValueByProp(props.model, prop, val);
79
83
  }
80
84
  });
81
- function onChangeHandler(...args) {
85
+ function getColumnRuleHandler(column, model) {
86
+ if (!isRequired(props, column) && formItemRef.value) {
87
+ formItemRef.value.clearValidate();
88
+ }
89
+ return columnRuleHandler(column, model);
90
+ }
91
+ function onChangeHandler() {
82
92
  const { onChange } = props.column;
83
93
  if (!onChange) return;
84
94
  onChange(props.column, props.model);
@@ -86,8 +96,10 @@ const _sfc_main = {
86
96
  return (_ctx, _cache) => {
87
97
  return unref(columnShowHandler)(props, __props.column) ? (openBlock(), createBlock(unref(ElFormItem), {
88
98
  key: 0,
89
- rules: __props.column.rules,
99
+ ref_key: "formItemRef",
100
+ ref: formItemRef,
90
101
  prop: columnProp.value,
102
+ rules: getColumnRuleHandler(__props.column, props.model),
91
103
  style: normalizeStyle(unref(columnItemStyle)(props, __props.column))
92
104
  }, {
93
105
  default: withCtx(() => [
@@ -111,11 +123,11 @@ const _sfc_main = {
111
123
  key: 0,
112
124
  class: "label-required"
113
125
  })) : createCommentVNode("v-if", true),
114
- unref(funRunHandler)(__props.column.help) ? (openBlock(), createBlock(unref(HyTooltip), {
126
+ unref(columnHelpHandler)(props, __props.column) ? (openBlock(), createBlock(unref(HyTooltip), {
115
127
  key: 1,
116
128
  "is-always": "",
117
129
  overLine: 1,
118
- content: unref(funRunHandler)(__props.column.help)
130
+ content: unref(columnHelpHandler)(props, __props.column)
119
131
  }, {
120
132
  default: withCtx(() => [
121
133
  createVNode(unref(ElIcon), {
@@ -146,14 +158,14 @@ const _sfc_main = {
146
158
  ])) : createCommentVNode("v-if", true)
147
159
  ]),
148
160
  createCommentVNode(" \u5185\u5BB9\u4EC5\u67E5\u770B "),
149
- __props.column.readonly || __props.readonly || !__props.column.type && !__props.column.slot ? (openBlock(), createElementBlock(
161
+ unref(isReadonly)(props, __props.column) || !__props.column.type && !__props.column.slot ? (openBlock(), createElementBlock(
150
162
  "div",
151
163
  {
152
164
  key: 0,
153
165
  class: normalizeClass(["w-full flex items-center text-main px-2", {
154
- "min-h-[40px]": _ctx.size === "large",
155
- "min-h-[32px]": _ctx.size === "default",
156
- "min-h-[24px]": _ctx.size === "small",
166
+ "min-h-[40px]": __props.size === "large",
167
+ "min-h-[32px]": __props.size === "default",
168
+ "min-h-[24px]": __props.size === "small",
157
169
  "bg-background": __props.level === 1,
158
170
  "bg-background-2": __props.level === 2,
159
171
  "bg-background-3": __props.level === 3,
@@ -320,7 +332,10 @@ const _sfc_main = {
320
332
  createCommentVNode(" \u5F00\u5173 "),
321
333
  createVNode(unref(ElSwitch), mergeProps({
322
334
  modelValue: bindValue.value,
323
- "onUpdate:modelValue": ($event) => bindValue.value = $event
335
+ "onUpdate:modelValue": ($event) => bindValue.value = $event,
336
+ "inline-prompt": "",
337
+ width: "80",
338
+ style: { "--hy-el-switch-on-color": "#5ab95f", "--hy-el-switch-off-color": "rgba(var(--hy-background), 1)" }
324
339
  }, __props.column.attrs, {
325
340
  disabled: unref(isDisabled)(props, __props.column),
326
341
  onChange: onChangeHandler
@@ -367,7 +382,7 @@ const _sfc_main = {
367
382
  ]),
368
383
  _: 3
369
384
  /* FORWARDED */
370
- }, 8, ["rules", "prop", "style"])) : createCommentVNode("v-if", true);
385
+ }, 8, ["prop", "rules", "style"])) : createCommentVNode("v-if", true);
371
386
  };
372
387
  }
373
388
  };
@@ -1,6 +1,7 @@
1
1
  import { unref } from 'vue';
2
2
  import { funRunHandler } from '../../../utils/handler.mjs';
3
- import { isNumber, isBoolean, isFunction, isArray, isObject } from '../../../utils/is.mjs';
3
+ import { isNumber, isBoolean, isFunction, isArray, isObject, isString } from '../../../utils/is.mjs';
4
+ import { columnRuleHandler, getValueByProp } from '../../../utils/form.mjs';
4
5
  import { useLocale } from '../../../hooks/useLocale.mjs';
5
6
 
6
7
  function columnItemStyle(props, column) {
@@ -26,15 +27,29 @@ function columnShowHandler(props, column) {
26
27
  if (isFunction(show)) return show(column, props.model);
27
28
  return true;
28
29
  }
30
+ function columnHelpHandler(props, column) {
31
+ const help = unref(column.help);
32
+ if (isString(help)) return help;
33
+ if (isFunction(help)) return help(column, props.model);
34
+ return;
35
+ }
36
+ function isReadonly(props, column) {
37
+ if (props.readonly) return props.readonly;
38
+ const readonly = unref(column.readonly);
39
+ if (isBoolean(readonly)) return readonly;
40
+ if (isFunction(readonly)) return readonly(column, props.model);
41
+ return false;
42
+ }
29
43
  function isRequired(props, column) {
30
- let { readonly, field, rules } = column;
31
- if (props.readonly || readonly) {
44
+ let { field } = column;
45
+ let rules = columnRuleHandler(column, props.model);
46
+ if (isReadonly(props, column)) {
32
47
  return false;
33
48
  }
34
49
  if (Array.isArray(field)) {
35
50
  return field.find((key) => isRequired(props, { ...column, field: key }));
36
51
  }
37
- rules = isArray(rules) && rules?.length || isObject(rules) ? rules : props.rules?.[field];
52
+ rules = isArray(rules) && rules?.length ? rules : props.rules?.[field];
38
53
  if (isArray(rules)) {
39
54
  return rules.some((item) => item.required);
40
55
  }
@@ -53,39 +68,28 @@ function isDisabled(props, column) {
53
68
  function renderText(props, column = {}) {
54
69
  const { type, field, customRender } = column;
55
70
  const { props: fieldNames } = column.attrs || {};
71
+ const columnValue = getValueByProp(props.model, field);
56
72
  if (customRender && typeof customRender === "function") {
57
73
  return customRender({
58
74
  column,
59
75
  model: props.model,
60
- value: props.model[field]
76
+ value: columnValue
61
77
  });
62
78
  }
63
- if (type === "range-picker") {
64
- const [start, end] = field;
65
- return props.model?.[start] ? `${props.model?.[start]} ~ ${props.model?.[end]}` : "";
66
- }
67
- if (type === "location") {
68
- const [lon, lat] = field;
69
- return [props.model[lon], props.model[lat]].filter(Boolean).join("\uFF0C");
70
- }
71
79
  if (/^(select|radio|checkbox)$/.test(type)) {
72
80
  const optionList = optionsHandler(props, column);
73
81
  const target = optionList.find(
74
- (item) => item[fieldNames.value] === props.model?.[field]
82
+ (item) => item[fieldNames.value] === columnValue
75
83
  );
76
- return target?.[fieldNames.label] || props.model?.[field] || "";
77
- }
78
- if (/^dept-select(-all)?$/.test(type)) {
79
- const dict = /^dept-select$/.test(type) ? deptTreeDict.value : deptTreeAllDict.value;
80
- return dict[props.model?.[field]] || props.model?.[field] || "";
81
- }
82
- if (type === "area-select") {
83
- return areaTreeDict.value[props.model?.[field]] || props.model?.[field] || "";
84
+ return target?.[fieldNames.label] || columnValue || "";
84
85
  }
85
86
  if (Array.isArray(field)) {
86
- return field.map((key) => props.model?.[key] || "").filter(Boolean).join(" - ");
87
+ return field.map((key) => getValueByProp(props.model, key) || "").filter(Boolean).join(" - ");
88
+ }
89
+ if (type === "switch") {
90
+ return columnValue === column.attrs.activeValue ? column.attrs.activeText : column.attrs.inactiveText;
87
91
  }
88
- return props.model?.[field] || props.model?.[field] || "";
92
+ return columnValue || "";
89
93
  }
90
94
  function renderArrayItemLabel(props, column, index) {
91
95
  const { t } = useLocale();
@@ -106,4 +110,4 @@ function optionsHandler(props, column) {
106
110
  return [];
107
111
  }
108
112
 
109
- export { columnItemStyle, columnShowHandler, isDisabled, isRequired, optionsHandler, renderAddLabel, renderArrayItemLabel, renderText };
113
+ export { columnHelpHandler, columnItemStyle, columnShowHandler, isDisabled, isReadonly, isRequired, optionsHandler, renderAddLabel, renderArrayItemLabel, renderText };
@@ -1,6 +1,6 @@
1
1
  import { unref, toRef } from 'vue';
2
2
  import { funRunHandler, mergeDeep } from '../../../utils/handler.mjs';
3
- import { isArray, isObject } from '../../../utils/is.mjs';
3
+ import { isArray } from '../../../utils/is.mjs';
4
4
  import { genValueByProp } from '../../../utils/form.mjs';
5
5
  import { useLocale } from '../../../hooks/useLocale.mjs';
6
6
 
@@ -32,34 +32,6 @@ const genPlaceholderHandler = (config) => {
32
32
  }
33
33
  return { placeholder, startPlaceholder, endPlaceholder };
34
34
  };
35
- const genRuleRequiredMsgHandler = (config) => {
36
- const { t } = useLocale();
37
- const { type, prop, label } = config || {};
38
- if (!prop || !prop?.length) return "";
39
- switch (type) {
40
- case "input":
41
- case "input-number":
42
- return t("hy.pleaseEnterPlaceholder", [label]);
43
- case "select":
44
- case "radio":
45
- case "checkbox":
46
- case "date-picker":
47
- return t("hy.pleaseSelectPlaceholder", [label]);
48
- default:
49
- return t("hy.cannotBeEmpty", [label]);
50
- }
51
- };
52
- const rulesHandler = (config) => {
53
- let { rules, required } = config || {};
54
- rules = isArray(rules) ? [...rules] : isObject(rules) ? [rules] : [];
55
- if (!rules.some((item) => item.required) && required) {
56
- rules.unshift({
57
- required: true,
58
- message: genRuleRequiredMsgHandler(config)
59
- });
60
- }
61
- return rules;
62
- };
63
35
  function appFormItemHandler(column = {}) {
64
36
  const label = genDefaultLabel(column);
65
37
  const { placeholder} = genPlaceholderHandler({ ...column, label });
@@ -71,7 +43,7 @@ function appFormItemHandler(column = {}) {
71
43
  field: column.prop,
72
44
  label,
73
45
  readonly: column.readonly || false,
74
- rules: rulesHandler(column),
46
+ rules: column.rules,
75
47
  attrs
76
48
  }
77
49
  );
@@ -109,6 +81,17 @@ function appFormItemHandler(column = {}) {
109
81
  ...column,
110
82
  children: (column.children || []).map((item) => appFormItemHandler(item))
111
83
  };
84
+ } else if (/^switch$/.test(column.type)) {
85
+ column = {
86
+ ...column,
87
+ attrs: {
88
+ activeText: "\u5F00\u542F",
89
+ inactiveText: "\u5173\u95ED",
90
+ activeValue: true,
91
+ inactiveValue: false,
92
+ ...attrs
93
+ }
94
+ };
112
95
  }
113
96
  return column;
114
97
  }
@@ -122,6 +105,8 @@ const resetAppFormValue = (columns = [], obj = {}) => {
122
105
  const childValue = resetAppFormValue(item.children);
123
106
  obj[item.prop] = [childValue];
124
107
  }
108
+ } else if (item.type === "extra") {
109
+ resetAppFormValue(item.children, obj);
125
110
  } else if (Array.isArray(item.prop)) {
126
111
  for (let i = 0; i < item.prop.length; i++) {
127
112
  genValueByProp(