hy-dispatch-ui-v3 0.2.65 → 0.2.66

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 (128) hide show
  1. package/dist/tailwind.css +26 -12
  2. package/es/api/organization.mjs +43 -0
  3. package/es/bussiness/hyAcquisitionStationTree/acquisitionStationTree.vue.mjs +245 -0
  4. package/es/bussiness/hyAcquisitionStationTree/index.mjs +7 -0
  5. package/es/bussiness/hyAcquisitionStationTree/js/index.mjs +124 -0
  6. package/es/bussiness/hyAcquisitionStationTree/style/acquisitionStationTree.scss +0 -0
  7. package/es/bussiness/hyDeviceTree/deviceTree.vue.mjs +249 -0
  8. package/es/bussiness/hyDeviceTree/index.mjs +7 -0
  9. package/es/bussiness/hyDeviceTree/js/index.mjs +126 -0
  10. package/es/bussiness/hyDeviceTree/style/deviceTree.scss +0 -0
  11. package/es/bussiness/hyOrgGroupTree/index.mjs +7 -0
  12. package/es/bussiness/hyOrgGroupTree/js/index.mjs +124 -0
  13. package/es/bussiness/hyOrgGroupTree/orgGroupTree.vue.mjs +245 -0
  14. package/es/bussiness/hyOrgGroupTree/style/orgGroupTree.scss +0 -0
  15. package/es/bussiness/hyPlanGroupDeviceTree/index.mjs +7 -0
  16. package/es/bussiness/hyPlanGroupDeviceTree/js/index.mjs +124 -0
  17. package/es/bussiness/hyPlanGroupDeviceTree/planGroupDeviceTree.vue.mjs +245 -0
  18. package/es/bussiness/hyPlanGroupDeviceTree/style/planGroupDeviceTree.scss +0 -0
  19. package/es/bussiness/hyUserTree/index.mjs +7 -0
  20. package/es/bussiness/hyUserTree/js/index.mjs +126 -0
  21. package/es/bussiness/hyUserTree/style/userTree.scss +0 -0
  22. package/es/bussiness/hyUserTree/userTree.vue.mjs +239 -0
  23. package/es/bussiness/index.mjs +5 -0
  24. package/es/components/hyBatchUploadDialog/batchUploadDialog.vue.mjs +18 -16
  25. package/es/components/hyButton/button.vue.mjs +3 -2
  26. package/es/components/hyButton/style/button.scss +70 -0
  27. package/es/components/hyConfirmDialog/confirmDialog.vue.mjs +1 -2
  28. package/es/components/hyForm/cpns/formItem.vue.mjs +198 -26
  29. package/es/components/hyForm/cpns/locationSelect.vue.mjs +8 -1
  30. package/es/components/hyForm/form.vue.mjs +74 -19
  31. package/es/components/hyForm/js/index.mjs +2 -1
  32. package/es/components/hyForm/js/useAppForm.mjs +2 -2
  33. package/es/components/hyIcon/style/icon.scss +1 -0
  34. package/es/components/hyNoPermissions/noPermissions.vue.mjs +1 -1
  35. package/es/components/hyNoPermissionsMap/noPermissionsMap.vue.mjs +1 -1
  36. package/es/components/hyOrgCascader/orgCascader.vue.mjs +69 -14
  37. package/es/components/hyRadioGroup/radioGroup.vue.mjs +5 -4
  38. package/es/components/hySearch/cpns/searchItem.vue.mjs +167 -11
  39. package/es/components/hySearch/js/index.mjs +2 -1
  40. package/es/components/hySearch/search.vue.mjs +60 -9
  41. package/es/components/hyTable/cpns/columnSelect.vue.mjs +21 -22
  42. package/es/components/hyTable/cpns/virtualTable.vue.mjs +10 -15
  43. package/es/components/hyTable/js/index.mjs +5 -12
  44. package/es/components/hyTable/js/search.mjs +3 -1
  45. package/es/components/hyTable/style/table.scss +13 -0
  46. package/es/components/hyTable/table.vue.mjs +21 -9
  47. package/es/components/hyTableActionButton/tableActionButton.vue.mjs +8 -10
  48. package/es/components/hyTableForm/batchTableForm.vue.mjs +13 -3
  49. package/es/components/hyTableForm/tableForm.vue.mjs +17 -11
  50. package/es/components/hyTour/index.mjs +7 -0
  51. package/es/components/hyTour/style/tour.scss +0 -0
  52. package/es/components/hyTour/tour.vue.mjs +23 -0
  53. package/es/components/hyTree/config/tree-config.mjs +5 -2
  54. package/es/components/hyTree/js/index.mjs +11 -7
  55. package/es/components/hyTree/tree.vue.mjs +18 -35
  56. package/es/components/index.mjs +1 -0
  57. package/es/index.mjs +6 -0
  58. package/es/static/hy-svg-icons/hy-icon-ops-linear-arrow.js +10 -0
  59. package/es/style/element/hy-element.scss +24 -3
  60. package/es/style/theme.scss +1 -0
  61. package/es/utils/map/hook/bigMap.mjs +9 -1
  62. package/es/utils/map/hook/gaode.mjs +9 -1
  63. package/es/utils/map/hook/leafletjs.mjs +10 -1
  64. package/es/version.mjs +1 -1
  65. package/lib/api/organization.js +47 -0
  66. package/lib/bussiness/hyAcquisitionStationTree/acquisitionStationTree.vue.js +249 -0
  67. package/lib/bussiness/hyAcquisitionStationTree/index.js +12 -0
  68. package/lib/bussiness/hyAcquisitionStationTree/js/index.js +126 -0
  69. package/lib/bussiness/hyAcquisitionStationTree/style/acquisitionStationTree.scss +0 -0
  70. package/lib/bussiness/hyDeviceTree/deviceTree.vue.js +253 -0
  71. package/lib/bussiness/hyDeviceTree/index.js +12 -0
  72. package/lib/bussiness/hyDeviceTree/js/index.js +128 -0
  73. package/lib/bussiness/hyDeviceTree/style/deviceTree.scss +0 -0
  74. package/lib/bussiness/hyOrgGroupTree/index.js +12 -0
  75. package/lib/bussiness/hyOrgGroupTree/js/index.js +126 -0
  76. package/lib/bussiness/hyOrgGroupTree/orgGroupTree.vue.js +249 -0
  77. package/lib/bussiness/hyOrgGroupTree/style/orgGroupTree.scss +0 -0
  78. package/lib/bussiness/hyPlanGroupDeviceTree/index.js +12 -0
  79. package/lib/bussiness/hyPlanGroupDeviceTree/js/index.js +126 -0
  80. package/lib/bussiness/hyPlanGroupDeviceTree/planGroupDeviceTree.vue.js +249 -0
  81. package/lib/bussiness/hyPlanGroupDeviceTree/style/planGroupDeviceTree.scss +0 -0
  82. package/lib/bussiness/hyUserTree/index.js +12 -0
  83. package/lib/bussiness/hyUserTree/js/index.js +128 -0
  84. package/lib/bussiness/hyUserTree/style/userTree.scss +0 -0
  85. package/lib/bussiness/hyUserTree/userTree.vue.js +243 -0
  86. package/lib/bussiness/index.js +14 -4
  87. package/lib/components/hyBatchUploadDialog/batchUploadDialog.vue.js +18 -16
  88. package/lib/components/hyButton/button.vue.js +3 -2
  89. package/lib/components/hyButton/style/button.scss +70 -0
  90. package/lib/components/hyConfirmDialog/confirmDialog.vue.js +0 -1
  91. package/lib/components/hyForm/cpns/formItem.vue.js +195 -23
  92. package/lib/components/hyForm/cpns/locationSelect.vue.js +8 -1
  93. package/lib/components/hyForm/form.vue.js +72 -17
  94. package/lib/components/hyForm/js/index.js +2 -0
  95. package/lib/components/hyForm/js/useAppForm.js +2 -2
  96. package/lib/components/hyIcon/style/icon.scss +1 -0
  97. package/lib/components/hyNoPermissions/noPermissions.vue.js +1 -1
  98. package/lib/components/hyNoPermissionsMap/noPermissionsMap.vue.js +1 -1
  99. package/lib/components/hyOrgCascader/orgCascader.vue.js +67 -12
  100. package/lib/components/hyRadioGroup/radioGroup.vue.js +5 -4
  101. package/lib/components/hySearch/cpns/searchItem.vue.js +164 -8
  102. package/lib/components/hySearch/js/index.js +2 -0
  103. package/lib/components/hySearch/search.vue.js +58 -7
  104. package/lib/components/hyTable/cpns/columnSelect.vue.js +20 -21
  105. package/lib/components/hyTable/cpns/virtualTable.vue.js +27 -32
  106. package/lib/components/hyTable/js/index.js +5 -12
  107. package/lib/components/hyTable/js/search.js +3 -1
  108. package/lib/components/hyTable/style/table.scss +13 -0
  109. package/lib/components/hyTable/table.vue.js +20 -8
  110. package/lib/components/hyTableActionButton/tableActionButton.vue.js +7 -9
  111. package/lib/components/hyTableForm/batchTableForm.vue.js +13 -3
  112. package/lib/components/hyTableForm/tableForm.vue.js +18 -12
  113. package/lib/components/hyTour/index.js +12 -0
  114. package/lib/components/hyTour/style/tour.scss +0 -0
  115. package/lib/components/hyTour/tour.vue.js +27 -0
  116. package/lib/components/hyTree/config/tree-config.js +5 -2
  117. package/lib/components/hyTree/js/index.js +11 -7
  118. package/lib/components/hyTree/tree.vue.js +18 -35
  119. package/lib/components/index.js +8 -6
  120. package/lib/index.js +67 -55
  121. package/lib/static/hy-svg-icons/hy-icon-ops-linear-arrow.js +10 -0
  122. package/lib/style/element/hy-element.scss +24 -3
  123. package/lib/style/theme.scss +1 -0
  124. package/lib/utils/map/hook/bigMap.js +9 -1
  125. package/lib/utils/map/hook/gaode.js +9 -1
  126. package/lib/utils/map/hook/leafletjs.js +10 -1
  127. package/lib/version.js +1 -1
  128. package/package.json +1 -1
@@ -1,8 +1,9 @@
1
- import { useTemplateRef, computed, unref, openBlock, createElementBlock, normalizeClass, normalizeStyle, createBlock, withCtx, createCommentVNode, createElementVNode, renderSlot, toDisplayString, createVNode, Fragment, mergeProps } from 'vue';
2
- import { ElFormItem, ElSelect, ElRadioGroup, ElCheckboxGroup, ElSwitch, ElInputNumber, ElCascader } from 'element-plus';
1
+ import { inject, useTemplateRef, computed, ref, reactive, toRefs, onMounted, onBeforeUnmount, unref, openBlock, createElementBlock, normalizeClass, normalizeStyle, createBlock, createSlots, withCtx, createElementVNode, renderSlot, toDisplayString, createCommentVNode, createVNode, Fragment, mergeProps } from 'vue';
2
+ import { ElFormItem, ElSelect, ElIcon, ElSelectV2, ElRadioGroup, ElCheckboxGroup, ElSwitch, ElInputNumber, ElCascader } from 'element-plus';
3
+ import { Loading } from '@element-plus/icons-vue';
3
4
  import '../../../utils/index.mjs';
4
5
  import '../../index.mjs';
5
- import { isRequired, columnVisibleHandler, columnItemStyle, columnShowHandler, columnHelpHandler, isReadonly, renderText, isDisabled, optionsHandler } from '../js/index.mjs';
6
+ import { formContextKey, isRequired, optionsHandler, columnVisibleHandler, columnItemStyle, columnShowHandler, columnHelpHandler, isReadonly, renderText, isDisabled } from '../js/index.mjs';
6
7
  import '../../../hooks/index.mjs';
7
8
  import { useLocale } from '../../../hooks/useLocale.mjs';
8
9
  import { isArray } from '../../../utils/is.mjs';
@@ -60,7 +61,9 @@ const _sfc_main = {
60
61
  setup(__props) {
61
62
  const { t } = useLocale();
62
63
  const props = __props;
64
+ const formContext = inject(formContextKey);
63
65
  const formItemRef = useTemplateRef("formItemRef");
66
+ const orgCascaderRef = useTemplateRef("orgCascaderRef");
64
67
  const columnProp = computed(() => {
65
68
  let field = isArray(props.column.field) ? props.column.field[0] : props.column.field;
66
69
  if (props.parentProp) {
@@ -68,6 +71,10 @@ const _sfc_main = {
68
71
  }
69
72
  return field;
70
73
  });
74
+ const propString = computed(() => {
75
+ if (!columnProp.value) return "";
76
+ return isArray(columnProp.value) ? columnProp.value.join(".") : columnProp.value;
77
+ });
71
78
  const bindValue = computed({
72
79
  get() {
73
80
  const prop = isArray(props.column.field) ? props.column.field[0] : props.column.field;
@@ -88,6 +95,12 @@ const _sfc_main = {
88
95
  setValueByProp(props.model, prop, val);
89
96
  }
90
97
  });
98
+ const columnConfig = computed(() => {
99
+ return {
100
+ ...props.column,
101
+ attrs: columnAttrs.value
102
+ };
103
+ });
91
104
  const columnAttrs = computed(() => {
92
105
  return {
93
106
  ...props.column.attrs,
@@ -95,6 +108,37 @@ const _sfc_main = {
95
108
  placeholder: columnPlaceholderHandler(props.column, props.model)
96
109
  };
97
110
  });
111
+ const optionsLoading = ref(false);
112
+ const optionsError = ref("");
113
+ async function obtainOptions() {
114
+ if (props.column.optionsFn) {
115
+ if (!props.column.optionsFn || optionsLoading.value) return;
116
+ optionsLoading.value = true;
117
+ optionsError.value = "";
118
+ props.column.attrs.options = [];
119
+ try {
120
+ props.column.attrs.options = await props.column.optionsFn(
121
+ props.column,
122
+ props.model
123
+ );
124
+ optionsError.value = "";
125
+ } catch (err) {
126
+ optionsError.value = "error";
127
+ console.error(err);
128
+ }
129
+ } else if (props.column.type === "org-cascader") {
130
+ if (orgCascaderRef.value) {
131
+ optionsLoading.value = true;
132
+ optionsError.value = "";
133
+ try {
134
+ await orgCascaderRef.value.getData();
135
+ } catch {
136
+ optionsError.value = "error";
137
+ }
138
+ }
139
+ }
140
+ optionsLoading.value = false;
141
+ }
98
142
  function getColumnRuleHandler(column, model) {
99
143
  if (!isRequired(props, column) && formItemRef.value) {
100
144
  formItemRef.value.clearValidate();
@@ -104,8 +148,29 @@ const _sfc_main = {
104
148
  function onChangeHandler() {
105
149
  const { onChange } = props.column;
106
150
  if (!onChange) return;
107
- onChange(props.column, props.model);
151
+ onChange(props.column, props.model, props.index);
108
152
  }
153
+ const context = reactive({
154
+ ...toRefs(props),
155
+ columnProp,
156
+ propString,
157
+ columnConfig,
158
+ columnAttrs,
159
+ obtainOptions,
160
+ optionsLoading,
161
+ optionsError,
162
+ options: computed(() => {
163
+ return optionsHandler(props, props.column);
164
+ })
165
+ });
166
+ onMounted(() => {
167
+ if (propString.value) {
168
+ formContext?.addField(context);
169
+ }
170
+ });
171
+ onBeforeUnmount(() => {
172
+ formContext?.removeField(context);
173
+ });
109
174
  return (_ctx, _cache) => {
110
175
  return !unref(columnVisibleHandler)(props, __props.column) ? (openBlock(), createElementBlock("div", {
111
176
  key: 0,
@@ -122,14 +187,14 @@ const _sfc_main = {
122
187
  id: __props.column.id,
123
188
  prop: columnProp.value,
124
189
  rules: getColumnRuleHandler(__props.column, props.model),
125
- style: normalizeStyle(unref(columnItemStyle)(props, __props.column))
126
- }, {
190
+ style: normalizeStyle(unref(columnItemStyle)(props, __props.column)),
191
+ error: optionsError.value
192
+ }, createSlots({
127
193
  default: withCtx(() => [
128
- createCommentVNode(" \u8868\u5355\u9879label "),
129
194
  createElementVNode("div", { class: "w-full flex justify-between text-main" }, [
130
195
  createElementVNode("div", { class: "flex items-center" }, [
131
196
  renderSlot(_ctx.$slots, __props.column.labelSlot, {
132
- column: __props.column,
197
+ column: columnConfig.value,
133
198
  model: __props.model,
134
199
  required: unref(isRequired)(props, __props.column)
135
200
  }, () => [
@@ -158,7 +223,11 @@ const _sfc_main = {
158
223
  1
159
224
  /* TEXT */
160
225
  )) : createCommentVNode("v-if", true),
161
- renderSlot(_ctx.$slots, __props.column.tooltipContentSlot)
226
+ renderSlot(_ctx.$slots, __props.column.tooltipContentSlot, {
227
+ column: columnConfig.value,
228
+ model: __props.model,
229
+ required: unref(isRequired)(props, __props.column)
230
+ })
162
231
  ]),
163
232
  default: withCtx(() => [
164
233
  createElementVNode("span", { class: "text-xs text-theme ml-2" }, [
@@ -184,13 +253,12 @@ const _sfc_main = {
184
253
  class: "ml-2 flex items-center"
185
254
  }, [
186
255
  renderSlot(_ctx.$slots, __props.column.rightSlot, {
187
- column: __props.column,
256
+ column: columnConfig.value,
188
257
  model: __props.model,
189
258
  required: unref(isRequired)(props, __props.column)
190
259
  })
191
260
  ])) : createCommentVNode("v-if", true)
192
261
  ]),
193
- createCommentVNode(" \u5185\u5BB9\u4EC5\u67E5\u770B "),
194
262
  unref(isReadonly)(props, __props.column) || !__props.column.type && !__props.column.slot ? (openBlock(), createElementBlock(
195
263
  "div",
196
264
  {
@@ -226,9 +294,10 @@ const _sfc_main = {
226
294
  Fragment,
227
295
  { key: 1 },
228
296
  [
297
+ createCommentVNode(" \u8868\u5355\u9879 "),
229
298
  createCommentVNode(" \u81EA\u5B9A\u4E49\u5177\u540D\u63D2\u69FD "),
230
299
  __props.column.slot && _ctx.$slots[__props.column.slot] ? renderSlot(_ctx.$slots, __props.column.slot, {
231
- column: __props.column,
300
+ column: columnConfig.value,
232
301
  model: __props.model,
233
302
  required: unref(isRequired)(props, __props.column)
234
303
  }, void 0, void 0, 0) : __props.column.type === "input" ? (openBlock(), createElementBlock(
@@ -258,13 +327,75 @@ const _sfc_main = {
258
327
  disabled: unref(isDisabled)(props, __props.column),
259
328
  options: unref(optionsHandler)(props, __props.column),
260
329
  onChange: onChangeHandler
261
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
330
+ }), createSlots({
331
+ _: 2
332
+ /* DYNAMIC */
333
+ }, [
334
+ optionsLoading.value ? {
335
+ name: "empty",
336
+ fn: withCtx(() => [
337
+ createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
338
+ createVNode(unref(ElIcon), {
339
+ size: "16",
340
+ class: "is-loading text-theme"
341
+ }, {
342
+ default: withCtx(() => [
343
+ createVNode(unref(Loading))
344
+ ]),
345
+ _: 1
346
+ /* STABLE */
347
+ }),
348
+ createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u52A0\u8F7D\u4E2D")
349
+ ])
350
+ ]),
351
+ key: "0"
352
+ } : void 0
353
+ ]), 1040, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
262
354
  ],
263
355
  2112
264
356
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
265
- )) : __props.column.type === "date-picker" ? (openBlock(), createElementBlock(
357
+ )) : __props.column.type === "select-v2" ? (openBlock(), createElementBlock(
266
358
  Fragment,
267
359
  { key: 3 },
360
+ [
361
+ createCommentVNode(" \u865A\u62DF\u5316\u9009\u62E9\u6846 "),
362
+ createVNode(unref(ElSelectV2), mergeProps({
363
+ modelValue: bindValue.value,
364
+ "onUpdate:modelValue": ($event) => bindValue.value = $event
365
+ }, columnAttrs.value, {
366
+ disabled: unref(isDisabled)(props, __props.column),
367
+ options: unref(optionsHandler)(props, __props.column),
368
+ onChange: onChangeHandler
369
+ }), createSlots({
370
+ _: 2
371
+ /* DYNAMIC */
372
+ }, [
373
+ optionsLoading.value ? {
374
+ name: "empty",
375
+ fn: withCtx(() => [
376
+ createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
377
+ createVNode(unref(ElIcon), {
378
+ size: "16",
379
+ class: "is-loading text-theme"
380
+ }, {
381
+ default: withCtx(() => [
382
+ createVNode(unref(Loading))
383
+ ]),
384
+ _: 1
385
+ /* STABLE */
386
+ }),
387
+ createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u52A0\u8F7D\u4E2D")
388
+ ])
389
+ ]),
390
+ key: "0"
391
+ } : void 0
392
+ ]), 1040, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
393
+ ],
394
+ 2112
395
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
396
+ )) : __props.column.type === "date-picker" ? (openBlock(), createElementBlock(
397
+ Fragment,
398
+ { key: 4 },
268
399
  [
269
400
  createCommentVNode(" \u65E5\u671F\u9009\u62E9\u6846 "),
270
401
  ["datetimerange", "daterange", "monthrange", "yearrange"].includes(
@@ -297,7 +428,7 @@ const _sfc_main = {
297
428
  /* STABLE_FRAGMENT */
298
429
  )) : __props.column.type === "time-picker" ? (openBlock(), createElementBlock(
299
430
  Fragment,
300
- { key: 4 },
431
+ { key: 5 },
301
432
  [
302
433
  createCommentVNode(" \u65F6\u95F4\u9009\u62E9\u6846 "),
303
434
  columnAttrs.value.isRange ? (openBlock(), createBlock(unref(HyTimePicker), mergeProps({
@@ -328,7 +459,7 @@ const _sfc_main = {
328
459
  /* STABLE_FRAGMENT */
329
460
  )) : __props.column.type === "radio" ? (openBlock(), createElementBlock(
330
461
  Fragment,
331
- { key: 5 },
462
+ { key: 6 },
332
463
  [
333
464
  createCommentVNode(" \u5355\u9009 "),
334
465
  createVNode(unref(ElRadioGroup), mergeProps({
@@ -344,7 +475,7 @@ const _sfc_main = {
344
475
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
345
476
  )) : __props.column.type === "radio-group" ? (openBlock(), createElementBlock(
346
477
  Fragment,
347
- { key: 6 },
478
+ { key: 7 },
348
479
  [
349
480
  createCommentVNode(" \u5355\u9009\u6309\u94AE "),
350
481
  createVNode(unref(HyRadioGroup), mergeProps({
@@ -361,7 +492,7 @@ const _sfc_main = {
361
492
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
362
493
  )) : __props.column.type === "checkbox" ? (openBlock(), createElementBlock(
363
494
  Fragment,
364
- { key: 7 },
495
+ { key: 8 },
365
496
  [
366
497
  createCommentVNode(" \u591A\u9009 "),
367
498
  createVNode(unref(ElCheckboxGroup), mergeProps({
@@ -377,7 +508,7 @@ const _sfc_main = {
377
508
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
378
509
  )) : __props.column.type === "switch" ? (openBlock(), createElementBlock(
379
510
  Fragment,
380
- { key: 8 },
511
+ { key: 9 },
381
512
  [
382
513
  createCommentVNode(" \u5F00\u5173 "),
383
514
  createVNode(unref(ElSwitch), mergeProps({
@@ -395,7 +526,7 @@ const _sfc_main = {
395
526
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
396
527
  )) : __props.column.type === "input-number" ? (openBlock(), createElementBlock(
397
528
  Fragment,
398
- { key: 9 },
529
+ { key: 10 },
399
530
  [
400
531
  createCommentVNode(" \u6570\u5B57\u8F93\u5165\u6846 "),
401
532
  createVNode(unref(ElInputNumber), mergeProps({
@@ -410,10 +541,12 @@ const _sfc_main = {
410
541
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
411
542
  )) : __props.column.type === "org-cascader" ? (openBlock(), createElementBlock(
412
543
  Fragment,
413
- { key: 10 },
544
+ { key: 11 },
414
545
  [
415
546
  createCommentVNode(" \u90E8\u95E8\u7EA7\u8054\u9009\u62E9\u6846 "),
416
547
  createVNode(unref(HyOrgCascader), mergeProps({
548
+ ref_key: "orgCascaderRef",
549
+ ref: orgCascaderRef,
417
550
  modelValue: bindValue.value,
418
551
  "onUpdate:modelValue": ($event) => bindValue.value = $event,
419
552
  class: "w-full"
@@ -426,17 +559,41 @@ const _sfc_main = {
426
559
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
427
560
  )) : __props.column.type === "cascader" ? (openBlock(), createElementBlock(
428
561
  Fragment,
429
- { key: 11 },
562
+ { key: 12 },
430
563
  [
431
564
  createCommentVNode(" \u7EA7\u8054\u9009\u62E9\u6846 "),
432
565
  createVNode(unref(ElCascader), mergeProps({
433
566
  modelValue: bindValue.value,
434
567
  "onUpdate:modelValue": ($event) => bindValue.value = $event
435
568
  }, columnAttrs.value, {
569
+ class: "w-full",
436
570
  disabled: unref(isDisabled)(props, __props.column),
437
571
  options: unref(optionsHandler)(props, __props.column),
438
572
  onChange: onChangeHandler
439
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
573
+ }), createSlots({
574
+ _: 2
575
+ /* DYNAMIC */
576
+ }, [
577
+ optionsLoading.value ? {
578
+ name: "empty",
579
+ fn: withCtx(() => [
580
+ createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
581
+ createVNode(unref(ElIcon), {
582
+ size: "16",
583
+ class: "is-loading text-theme"
584
+ }, {
585
+ default: withCtx(() => [
586
+ createVNode(unref(Loading))
587
+ ]),
588
+ _: 1
589
+ /* STABLE */
590
+ }),
591
+ createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u52A0\u8F7D\u4E2D")
592
+ ])
593
+ ]),
594
+ key: "0"
595
+ } : void 0
596
+ ]), 1040, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
440
597
  ],
441
598
  2112
442
599
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
@@ -446,9 +603,24 @@ const _sfc_main = {
446
603
  /* STABLE_FRAGMENT */
447
604
  ))
448
605
  ]),
449
- _: 3
450
- /* FORWARDED */
451
- }, 8, ["id", "prop", "rules", "style"])) : createCommentVNode("v-if", true);
606
+ _: 2
607
+ /* DYNAMIC */
608
+ }, [
609
+ optionsError.value ? {
610
+ name: "error",
611
+ fn: withCtx(() => [
612
+ createElementVNode("div", { class: "hy-el-form-item__error" }, [
613
+ createElementVNode("span", null, "\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7"),
614
+ createElementVNode("span", {
615
+ class: "text-theme cursor-pointer",
616
+ onClick: obtainOptions
617
+ }, "[\u91CD\u65B0\u52A0\u8F7D]"),
618
+ createElementVNode("span", null, "\u6216\u8054\u7CFB\u7BA1\u7406\u5458")
619
+ ])
620
+ ]),
621
+ key: "0"
622
+ } : void 0
623
+ ]), 1032, ["id", "prop", "rules", "style", "error"])) : createCommentVNode("v-if", true);
452
624
  };
453
625
  }
454
626
  };
@@ -232,6 +232,12 @@ const _sfc_main = {
232
232
  map.setView({ lat, lng }, mapConfig.maxZoom || 18);
233
233
  }
234
234
  }
235
+ function clearMarker() {
236
+ if (marker) {
237
+ marker.remove();
238
+ marker = null;
239
+ }
240
+ }
235
241
  function setMapSize() {
236
242
  emits("setMapSize");
237
243
  setTimeout(() => {
@@ -249,7 +255,8 @@ const _sfc_main = {
249
255
  hyMap = null;
250
256
  });
251
257
  __expose({
252
- setMarker
258
+ setMarker,
259
+ clearMarker
253
260
  });
254
261
  return (_ctx, _cache) => {
255
262
  return openBlock(), createElementBlock("div", { class: "w-full h-full flex flex-col" }, [
@@ -1,13 +1,12 @@
1
- import { defineComponent, useTemplateRef, computed, ref, nextTick, unref, openBlock, createBlock, mergeProps, withCtx, createElementVNode, normalizeStyle, createCommentVNode, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString, createVNode, createSlots, renderSlot } from 'vue';
1
+ import { defineComponent, useTemplateRef, computed, ref, reactive, unref, provide, toRefs, onMounted, nextTick, openBlock, createBlock, mergeProps, withCtx, createElementVNode, normalizeStyle, createCommentVNode, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString, createVNode, createSlots, renderSlot } from 'vue';
2
2
  import { ElForm, ElDivider } from 'element-plus';
3
- import '@element-plus/icons-vue';
4
3
  import '../../hooks/index.mjs';
5
4
  import '../../utils/index.mjs';
6
5
  import _sfc_main$4 from './cpns/formItem.vue.mjs';
7
6
  import _sfc_main$1 from './cpns/extraItem.vue.mjs';
8
7
  import _sfc_main$2 from './cpns/arrayItem.vue.mjs';
9
8
  import _sfc_main$3 from './cpns/locationSelect.vue.mjs';
10
- import { columnShowHandler, columnItemStyle } from './js/index.mjs';
9
+ import { formContextKey, columnShowHandler, columnItemStyle } from './js/index.mjs';
11
10
  import { resetAppFormValue } from './js/useAppForm.mjs';
12
11
  import { useLocale } from '../../hooks/useLocale.mjs';
13
12
  import { isArray, isNumber } from '../../utils/is.mjs';
@@ -55,8 +54,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
55
54
  },
56
55
  emits: ["on-allMapSelect", "complete"],
57
56
  setup(__props, { expose: __expose, emit: __emit }) {
58
- const emit = __emit;
59
57
  const props = __props;
58
+ const emits = __emit;
60
59
  const { t } = useLocale();
61
60
  const formTemplateRef = useTemplateRef("formTemplateRef");
62
61
  const formColumnMap = computed(() => {
@@ -79,52 +78,108 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
79
78
  const allMapSelect = ref(false);
80
79
  function setMapSize() {
81
80
  allMapSelect.value = !allMapSelect.value;
82
- emit("on-allMapSelect", allMapSelect.value);
81
+ emits("on-allMapSelect", allMapSelect.value);
83
82
  }
84
83
  function complete() {
85
- emit("complete");
84
+ emits("complete");
86
85
  }
86
+ const fields = reactive([]);
87
+ function addField(field) {
88
+ fields.push(field);
89
+ }
90
+ const removeField = (field) => {
91
+ if (unref(field.columnAttrs)) {
92
+ fields.splice(fields.indexOf(field), 1);
93
+ }
94
+ };
95
+ function filterFields(fields2 = [], keys = []) {
96
+ const filterKeys = keys.map((prop) => isArray(prop) ? prop.join(".") : prop);
97
+ return filterKeys.length ? fields2.filter(
98
+ (field) => field.propString && filterKeys.includes(field.propString)
99
+ ) : fields2;
100
+ }
101
+ async function obtainOptionsFields(keys) {
102
+ const filteredFields = filterFields(fields, keys);
103
+ await Promise.allSettled(filteredFields.map((field) => field.obtainOptions()));
104
+ }
105
+ async function getOptions() {
106
+ await obtainOptionsFields();
107
+ }
108
+ async function getOptionsFields(keys) {
109
+ await obtainOptionsFields(keys);
110
+ }
111
+ async function getOptionsError() {
112
+ const filteredFields = fields.filter(
113
+ (field) => field.propString && field.optionsError
114
+ );
115
+ await Promise.allSettled(filteredFields.map((field) => field.obtainOptions()));
116
+ }
117
+ provide(
118
+ formContextKey,
119
+ reactive({
120
+ ...toRefs(props),
121
+ emits,
122
+ addField,
123
+ removeField
124
+ })
125
+ );
126
+ onMounted(() => {
127
+ getOptions();
128
+ });
87
129
  __expose({
88
130
  validate: async (callback) => {
89
131
  await nextTick();
90
132
  return unref(formTemplateRef).validate(callback);
91
133
  },
92
- validateField: async (fields) => {
134
+ validateField: async (fields2) => {
93
135
  await nextTick();
94
- return unref(formTemplateRef).validateField(fields);
136
+ return unref(formTemplateRef).validateField(fields2);
95
137
  },
96
- resetFields: async (fields) => {
138
+ resetFields: async (fields2) => {
97
139
  let columns = props.columns || [];
98
- if (fields && fields?.length) {
99
- columns = fields.map((key) => formColumnMap.value.get(key)).filter(Boolean);
140
+ if (fields2 && fields2?.length) {
141
+ columns = fields2.map((key) => formColumnMap.value.get(key)).filter(Boolean);
100
142
  }
101
143
  resetAppFormValue(columns, props.model);
102
- unref(formTemplateRef).clearValidate(fields);
144
+ unref(formTemplateRef).clearValidate(fields2);
103
145
  },
104
- scrollToField: async (fields) => {
146
+ scrollToField: async (fields2) => {
105
147
  await nextTick();
106
- unref(formTemplateRef).scrollToField(fields);
148
+ unref(formTemplateRef).scrollToField(fields2);
107
149
  },
108
- clearValidate: async (fields) => {
150
+ clearValidate: async (fields2) => {
109
151
  await nextTick();
110
- unref(formTemplateRef).clearValidate(fields);
152
+ unref(formTemplateRef).clearValidate(fields2);
111
153
  },
112
154
  fields: computed(() => {
113
155
  return unref(formTemplateRef)?.fields || [];
114
156
  }),
115
- getField: async (fields) => {
157
+ getField: async (fields2) => {
116
158
  await nextTick();
117
- return unref(formTemplateRef).getField(fields);
159
+ return unref(formTemplateRef).getField(fields2);
118
160
  },
119
161
  setMarker: (latlng) => {
120
162
  if (locationSelectRef.value) {
121
163
  isArray(locationSelectRef.value) ? locationSelectRef.value.map((item) => item.setMarker(latlng)) : locationSelectRef.value.setMarker(latlng);
122
164
  }
123
- }
165
+ },
166
+ clearMarker: () => {
167
+ if (locationSelectRef.value) {
168
+ isArray(locationSelectRef.value) ? locationSelectRef.value.map((item) => item.clearMarker()) : locationSelectRef.value.clearMarker();
169
+ }
170
+ },
124
171
  // setInitialValue: async (value) => {
125
172
  // await nextTick()
126
173
  // unref(formTemplateRef).setInitialValue(value)
127
174
  // }
175
+ getOptions,
176
+ getOptionsFields,
177
+ getOptionsError,
178
+ getOptionsByField: (field) => {
179
+ const [target] = filterFields(fields, [field]);
180
+ if (!target) return null;
181
+ return target.options;
182
+ }
128
183
  });
129
184
  return (_ctx, _cache) => {
130
185
  return openBlock(), createBlock(unref(ElForm), mergeProps({
@@ -6,6 +6,7 @@ import { isNumber, isBoolean, isFunction, isString, isArray, isObject } from '..
6
6
  import { columnRuleHandler, getValueByProp } from '../../../utils/form.mjs';
7
7
  import { useLocale } from '../../../hooks/useLocale.mjs';
8
8
 
9
+ const formContextKey = /* @__PURE__ */ Symbol("formContextKey");
9
10
  function columnItemStyle(props, column) {
10
11
  const style = {};
11
12
  let span = funRunHandler(column.span, column, props.model);
@@ -119,4 +120,4 @@ function optionsHandler(props, column) {
119
120
  return [];
120
121
  }
121
122
 
122
- export { columnHelpHandler, columnItemStyle, columnShowHandler, columnVisibleHandler, isDisabled, isReadonly, isRequired, optionsHandler, renderAddLabel, renderArrayItemLabel, renderText };
123
+ export { columnHelpHandler, columnItemStyle, columnShowHandler, columnVisibleHandler, formContextKey, isDisabled, isReadonly, isRequired, optionsHandler, renderAddLabel, renderArrayItemLabel, renderText };
@@ -27,7 +27,7 @@ function appFormItemHandler(column = {}) {
27
27
  ...attrs
28
28
  }
29
29
  };
30
- } else if (/^(radio|radio-group|checkbox|select)$/.test(column.type)) {
30
+ } else if (/^(radio|radio-group|checkbox|select|select-v2)$/.test(column.type)) {
31
31
  return {
32
32
  ...column,
33
33
  attrs: {
@@ -41,7 +41,7 @@ function appFormItemHandler(column = {}) {
41
41
  }
42
42
  }
43
43
  };
44
- } else if (/^(extra)$/.test(column.type) || /^(location-select)$/.test(column.type)) {
44
+ } else if (/^(extra|location-select)$/.test(column.type)) {
45
45
  return {
46
46
  ...column,
47
47
  children: (column.children || []).map((item) => appFormItemHandler(item))
@@ -6,6 +6,7 @@
6
6
  overflow: hidden;
7
7
  fill: currentColor;
8
8
  outline: none;
9
+ flex-shrink: 0;
9
10
  }
10
11
  .hy-button {
11
12
  .hy-icon {
@@ -26,7 +26,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
26
26
  return openBlock(), createElementBlock("div", { class: "w-full h-full bg-background-2 text-auxiliary text-base flex flex-col items-center justify-center" }, [
27
27
  createVNode(unref(HyIcon), {
28
28
  "svg-name": __props.svgName,
29
- "class-name": "!w-[46px] !h-[46px]"
29
+ "class-name": "!w-[56px] !h-[56px]"
30
30
  }, null, 8, ["svg-name"]),
31
31
  createElementVNode("div", { class: "text-center mt-[12px]" }, [
32
32
  createElementVNode(
@@ -26,7 +26,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
26
26
  return openBlock(), createElementBlock("div", { class: "w-full h-full bg-background-2 text-auxiliary text-base flex flex-col items-center justify-center" }, [
27
27
  createVNode(unref(HyIcon), {
28
28
  "svg-name": __props.svgName,
29
- "class-name": "!w-[46px] !h-[46px]"
29
+ "class-name": "!w-[56px] !h-[56px]"
30
30
  }, null, 8, ["svg-name"]),
31
31
  createElementVNode("div", { class: "text-center mt-[12px]" }, [
32
32
  createElementVNode(