hy-dispatch-ui-v3 0.2.64 → 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 +75 -68
  55. package/es/components/hyTree/tree.vue.mjs +19 -36
  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 +75 -68
  118. package/lib/components/hyTree/tree.vue.js +19 -36
  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
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vue = require('vue');
6
6
  var elementPlus = require('element-plus');
7
- require('@element-plus/icons-vue');
8
7
  require('../../hooks/index.js');
9
8
  require('../../utils/index.js');
10
9
  var formItem = require('./cpns/formItem.vue.js');
@@ -59,8 +58,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
59
58
  },
60
59
  emits: ["on-allMapSelect", "complete"],
61
60
  setup(__props, { expose: __expose, emit: __emit }) {
62
- const emit = __emit;
63
61
  const props = __props;
62
+ const emits = __emit;
64
63
  const { t } = useLocale.useLocale();
65
64
  const formTemplateRef = vue.useTemplateRef("formTemplateRef");
66
65
  const formColumnMap = vue.computed(() => {
@@ -83,52 +82,108 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
83
82
  const allMapSelect = vue.ref(false);
84
83
  function setMapSize() {
85
84
  allMapSelect.value = !allMapSelect.value;
86
- emit("on-allMapSelect", allMapSelect.value);
85
+ emits("on-allMapSelect", allMapSelect.value);
87
86
  }
88
87
  function complete() {
89
- emit("complete");
88
+ emits("complete");
90
89
  }
90
+ const fields = vue.reactive([]);
91
+ function addField(field) {
92
+ fields.push(field);
93
+ }
94
+ const removeField = (field) => {
95
+ if (vue.unref(field.columnAttrs)) {
96
+ fields.splice(fields.indexOf(field), 1);
97
+ }
98
+ };
99
+ function filterFields(fields2 = [], keys = []) {
100
+ const filterKeys = keys.map((prop) => is.isArray(prop) ? prop.join(".") : prop);
101
+ return filterKeys.length ? fields2.filter(
102
+ (field) => field.propString && filterKeys.includes(field.propString)
103
+ ) : fields2;
104
+ }
105
+ async function obtainOptionsFields(keys) {
106
+ const filteredFields = filterFields(fields, keys);
107
+ await Promise.allSettled(filteredFields.map((field) => field.obtainOptions()));
108
+ }
109
+ async function getOptions() {
110
+ await obtainOptionsFields();
111
+ }
112
+ async function getOptionsFields(keys) {
113
+ await obtainOptionsFields(keys);
114
+ }
115
+ async function getOptionsError() {
116
+ const filteredFields = fields.filter(
117
+ (field) => field.propString && field.optionsError
118
+ );
119
+ await Promise.allSettled(filteredFields.map((field) => field.obtainOptions()));
120
+ }
121
+ vue.provide(
122
+ index.formContextKey,
123
+ vue.reactive({
124
+ ...vue.toRefs(props),
125
+ emits,
126
+ addField,
127
+ removeField
128
+ })
129
+ );
130
+ vue.onMounted(() => {
131
+ getOptions();
132
+ });
91
133
  __expose({
92
134
  validate: async (callback) => {
93
135
  await vue.nextTick();
94
136
  return vue.unref(formTemplateRef).validate(callback);
95
137
  },
96
- validateField: async (fields) => {
138
+ validateField: async (fields2) => {
97
139
  await vue.nextTick();
98
- return vue.unref(formTemplateRef).validateField(fields);
140
+ return vue.unref(formTemplateRef).validateField(fields2);
99
141
  },
100
- resetFields: async (fields) => {
142
+ resetFields: async (fields2) => {
101
143
  let columns = props.columns || [];
102
- if (fields && fields?.length) {
103
- columns = fields.map((key) => formColumnMap.value.get(key)).filter(Boolean);
144
+ if (fields2 && fields2?.length) {
145
+ columns = fields2.map((key) => formColumnMap.value.get(key)).filter(Boolean);
104
146
  }
105
147
  useAppForm.resetAppFormValue(columns, props.model);
106
- vue.unref(formTemplateRef).clearValidate(fields);
148
+ vue.unref(formTemplateRef).clearValidate(fields2);
107
149
  },
108
- scrollToField: async (fields) => {
150
+ scrollToField: async (fields2) => {
109
151
  await vue.nextTick();
110
- vue.unref(formTemplateRef).scrollToField(fields);
152
+ vue.unref(formTemplateRef).scrollToField(fields2);
111
153
  },
112
- clearValidate: async (fields) => {
154
+ clearValidate: async (fields2) => {
113
155
  await vue.nextTick();
114
- vue.unref(formTemplateRef).clearValidate(fields);
156
+ vue.unref(formTemplateRef).clearValidate(fields2);
115
157
  },
116
158
  fields: vue.computed(() => {
117
159
  return vue.unref(formTemplateRef)?.fields || [];
118
160
  }),
119
- getField: async (fields) => {
161
+ getField: async (fields2) => {
120
162
  await vue.nextTick();
121
- return vue.unref(formTemplateRef).getField(fields);
163
+ return vue.unref(formTemplateRef).getField(fields2);
122
164
  },
123
165
  setMarker: (latlng) => {
124
166
  if (locationSelectRef.value) {
125
167
  is.isArray(locationSelectRef.value) ? locationSelectRef.value.map((item) => item.setMarker(latlng)) : locationSelectRef.value.setMarker(latlng);
126
168
  }
127
- }
169
+ },
170
+ clearMarker: () => {
171
+ if (locationSelectRef.value) {
172
+ is.isArray(locationSelectRef.value) ? locationSelectRef.value.map((item) => item.clearMarker()) : locationSelectRef.value.clearMarker();
173
+ }
174
+ },
128
175
  // setInitialValue: async (value) => {
129
176
  // await nextTick()
130
177
  // unref(formTemplateRef).setInitialValue(value)
131
178
  // }
179
+ getOptions,
180
+ getOptionsFields,
181
+ getOptionsError,
182
+ getOptionsByField: (field) => {
183
+ const [target] = filterFields(fields, [field]);
184
+ if (!target) return null;
185
+ return target.options;
186
+ }
132
187
  });
133
188
  return (_ctx, _cache) => {
134
189
  return vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElForm), vue.mergeProps({
@@ -8,6 +8,7 @@ var is = require('../../../utils/is.js');
8
8
  var form = require('../../../utils/form.js');
9
9
  var useLocale = require('../../../hooks/useLocale.js');
10
10
 
11
+ const formContextKey = /* @__PURE__ */ Symbol("formContextKey");
11
12
  function columnItemStyle(props, column) {
12
13
  const style = {};
13
14
  let span = handler.funRunHandler(column.span, column, props.model);
@@ -125,6 +126,7 @@ exports.columnHelpHandler = columnHelpHandler;
125
126
  exports.columnItemStyle = columnItemStyle;
126
127
  exports.columnShowHandler = columnShowHandler;
127
128
  exports.columnVisibleHandler = columnVisibleHandler;
129
+ exports.formContextKey = formContextKey;
128
130
  exports.isDisabled = isDisabled;
129
131
  exports.isReadonly = isReadonly;
130
132
  exports.isRequired = isRequired;
@@ -29,7 +29,7 @@ function appFormItemHandler(column = {}) {
29
29
  ...attrs
30
30
  }
31
31
  };
32
- } else if (/^(radio|radio-group|checkbox|select)$/.test(column.type)) {
32
+ } else if (/^(radio|radio-group|checkbox|select|select-v2)$/.test(column.type)) {
33
33
  return {
34
34
  ...column,
35
35
  attrs: {
@@ -43,7 +43,7 @@ function appFormItemHandler(column = {}) {
43
43
  }
44
44
  }
45
45
  };
46
- } else if (/^(extra)$/.test(column.type) || /^(location-select)$/.test(column.type)) {
46
+ } else if (/^(extra|location-select)$/.test(column.type)) {
47
47
  return {
48
48
  ...column,
49
49
  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 {
@@ -30,7 +30,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
30
30
  return vue.openBlock(), vue.createElementBlock("div", { class: "w-full h-full bg-background-2 text-auxiliary text-base flex flex-col items-center justify-center" }, [
31
31
  vue.createVNode(vue.unref(index.HyIcon), {
32
32
  "svg-name": __props.svgName,
33
- "class-name": "!w-[46px] !h-[46px]"
33
+ "class-name": "!w-[56px] !h-[56px]"
34
34
  }, null, 8, ["svg-name"]),
35
35
  vue.createElementVNode("div", { class: "text-center mt-[12px]" }, [
36
36
  vue.createElementVNode(
@@ -30,7 +30,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
30
30
  return vue.openBlock(), vue.createElementBlock("div", { class: "w-full h-full bg-background-2 text-auxiliary text-base flex flex-col items-center justify-center" }, [
31
31
  vue.createVNode(vue.unref(index.HyIcon), {
32
32
  "svg-name": __props.svgName,
33
- "class-name": "!w-[46px] !h-[46px]"
33
+ "class-name": "!w-[56px] !h-[56px]"
34
34
  }, null, 8, ["svg-name"]),
35
35
  vue.createElementVNode("div", { class: "text-center mt-[12px]" }, [
36
36
  vue.createElementVNode(
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vue = require('vue');
6
6
  var elementPlus = require('element-plus');
7
+ var iconsVue = require('@element-plus/icons-vue');
7
8
  require('../../hooks/index.js');
8
9
  var index = require('./js/index.js');
9
10
  var useSubscribe = require('../../hooks/useSubscribe.js');
@@ -84,7 +85,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
84
85
  "modelModifiers": {}
85
86
  }),
86
87
  emits: /* @__PURE__ */ vue.mergeModels(["change"], ["update:modelValue"]),
87
- setup(__props, { emit: __emit }) {
88
+ setup(__props, { expose: __expose, emit: __emit }) {
88
89
  const props = __props;
89
90
  const emits = __emit;
90
91
  const { subOrgCascader, unsubOrgCascader } = useSubscribe.useSubscribe();
@@ -99,11 +100,20 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
99
100
  const target = cascaderValueMap.value.get(modelValue.value);
100
101
  return target?.companyName;
101
102
  });
102
- async function getCascaderData() {
103
- loading.value = true;
104
- const data = await index.getOrgTreeSimple();
105
- handlerData(data || []);
106
- loading.value = false;
103
+ function getCascaderData() {
104
+ return new Promise(async (resolve, reject) => {
105
+ loading.value = true;
106
+ try {
107
+ cascaderOptions.value = [];
108
+ const data = await index.getOrgTreeSimple();
109
+ handlerData(data || []);
110
+ resolve();
111
+ } catch (err) {
112
+ console.error(err);
113
+ reject();
114
+ }
115
+ loading.value = false;
116
+ });
107
117
  }
108
118
  function handlerData(data) {
109
119
  const { cascaderData, cascaderDataMap } = index.orgTreeDatahandler(data);
@@ -157,6 +167,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
157
167
  vue.onUnmounted(() => {
158
168
  unsubOrgCascader(getCascaderData);
159
169
  });
170
+ __expose({
171
+ getData: getCascaderData
172
+ });
160
173
  return (_ctx, _cache) => {
161
174
  return vue.openBlock(), vue.createElementBlock("div", { class: "relative" }, [
162
175
  __props.contentType ? (vue.openBlock(), vue.createElementBlock("div", {
@@ -190,7 +203,30 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
190
203
  "virtual-scroll": "",
191
204
  onChange: onChangeHanlder,
192
205
  onVisibleChange: ($event) => onVisibleChangeHandler($event)
193
- }, null, 8, ["modelValue", "onUpdate:modelValue", "size", "options", "disabled", "clearable", "placeholder", "onVisibleChange"])
206
+ }, vue.createSlots({
207
+ _: 2
208
+ /* DYNAMIC */
209
+ }, [
210
+ loading.value ? {
211
+ name: "empty",
212
+ fn: vue.withCtx(() => [
213
+ vue.createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
214
+ vue.createVNode(vue.unref(elementPlus.ElIcon), {
215
+ size: "16",
216
+ class: "is-loading text-theme"
217
+ }, {
218
+ default: vue.withCtx(() => [
219
+ vue.createVNode(vue.unref(iconsVue.Loading))
220
+ ]),
221
+ _: 1
222
+ /* STABLE */
223
+ }),
224
+ vue.createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u52A0\u8F7D\u4E2D")
225
+ ])
226
+ ]),
227
+ key: "0"
228
+ } : void 0
229
+ ]), 1032, ["modelValue", "onUpdate:modelValue", "size", "options", "disabled", "clearable", "placeholder", "onVisibleChange"])
194
230
  ],
195
231
  4
196
232
  /* STYLE */
@@ -229,11 +265,30 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
229
265
  "show-all-levels": false,
230
266
  "virtual-scroll": "",
231
267
  onChange: onChangeHanlder
232
- }, null, 8, ["modelValue", "onUpdate:modelValue", "class", "size", "options", "clearable", "disabled", "placeholder"])),
233
- loading.value ? (vue.openBlock(), vue.createElementBlock("div", {
234
- key: 2,
235
- class: "absolute left-0 right-0 top-0 bottom-0 cursor-wait"
236
- })) : vue.createCommentVNode("v-if", true)
268
+ }, vue.createSlots({
269
+ _: 2
270
+ /* DYNAMIC */
271
+ }, [
272
+ loading.value ? {
273
+ name: "empty",
274
+ fn: vue.withCtx(() => [
275
+ vue.createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
276
+ vue.createVNode(vue.unref(elementPlus.ElIcon), {
277
+ size: "16",
278
+ class: "is-loading text-theme"
279
+ }, {
280
+ default: vue.withCtx(() => [
281
+ vue.createVNode(vue.unref(iconsVue.Loading))
282
+ ]),
283
+ _: 1
284
+ /* STABLE */
285
+ }),
286
+ vue.createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u52A0\u8F7D\u4E2D")
287
+ ])
288
+ ]),
289
+ key: "0"
290
+ } : void 0
291
+ ]), 1032, ["modelValue", "onUpdate:modelValue", "class", "size", "options", "clearable", "disabled", "placeholder"]))
237
292
  ]);
238
293
  };
239
294
  }
@@ -45,8 +45,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
45
45
  };
46
46
  });
47
47
  function switchSelect(target) {
48
- modelValue.value = target[radioProps.value.value];
49
- emits("change", modelValue.value);
48
+ const value = target[radioProps.value.value];
49
+ if (modelValue.value === value) return;
50
+ modelValue.value = value;
51
+ emits("change", value);
50
52
  }
51
53
  async function sliderHandler() {
52
54
  selectIndex.value = props.options.findIndex((item) => {
@@ -57,7 +59,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
57
59
  if (slider) {
58
60
  const proportion = 100 / props.options.length;
59
61
  const left = selectIndex.value > 0 ? selectIndex.value * proportion : 0;
60
- console.log("proportion", proportion, left, selectIndex.value);
61
62
  slider.style.left = `${left}%`;
62
63
  }
63
64
  }
@@ -85,7 +86,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
85
86
  vue.renderList(__props.options, (item, index) => {
86
87
  return vue.openBlock(), vue.createElementBlock("li", {
87
88
  key: index,
88
- class: "w-0 flex-1 flex items-center justify-center text-main clickBox",
89
+ class: "w-0 flex-1 flex items-center justify-center text-main user-select-none clickBox",
89
90
  onClick: ($event) => switchSelect(item, index, $event)
90
91
  }, [
91
92
  vue.renderSlot(_ctx.$slots, "default", {
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vue = require('vue');
6
6
  var elementPlus = require('element-plus');
7
+ var iconsVue = require('@element-plus/icons-vue');
7
8
  require('../../../utils/index.js');
8
9
  require('../../index.js');
9
10
  var index = require('../js/index.js');
@@ -38,10 +39,16 @@ const _sfc_main = {
38
39
  setup(__props, { emit: __emit }) {
39
40
  const props = __props;
40
41
  const emits = __emit;
42
+ const formContext = vue.inject(index.formContextKey);
43
+ const orgCascaderRef = vue.useTemplateRef("orgCascaderRef");
41
44
  const columnProp = vue.computed(() => {
42
45
  let field = is.isArray(props.column.field) ? props.column.field[0] : props.column.field;
43
46
  return field;
44
47
  });
48
+ const propString = vue.computed(() => {
49
+ if (!columnProp.value) return "";
50
+ return is.isArray(columnProp.value) ? columnProp.value.join(".") : columnProp.value;
51
+ });
45
52
  const bindValue = vue.computed({
46
53
  get() {
47
54
  const prop = is.isArray(props.column.field) ? props.column.field[0] : props.column.field;
@@ -62,6 +69,12 @@ const _sfc_main = {
62
69
  form.setValueByProp(props.model, prop, val);
63
70
  }
64
71
  });
72
+ const columnConfig = vue.computed(() => {
73
+ return {
74
+ ...props.column,
75
+ attrs: columnAttrs.value
76
+ };
77
+ });
65
78
  const columnAttrs = vue.computed(() => {
66
79
  return {
67
80
  ...props.column.attrs,
@@ -69,8 +82,42 @@ const _sfc_main = {
69
82
  placeholder: form.columnPlaceholderHandler(props.column, props.model)
70
83
  };
71
84
  });
85
+ const optionsLoading = vue.ref(false);
86
+ const optionsError = vue.ref("");
87
+ async function obtainOptions() {
88
+ if (props.column.optionsFn) {
89
+ if (!props.column.optionsFn || optionsLoading.value) return;
90
+ optionsLoading.value = true;
91
+ optionsError.value = "";
92
+ props.column.attrs.options = [];
93
+ try {
94
+ props.column.attrs.options = await props.column.optionsFn(
95
+ props.column,
96
+ props.model
97
+ );
98
+ optionsError.value = "";
99
+ } catch (err) {
100
+ optionsError.value = "error";
101
+ console.error(err);
102
+ }
103
+ } else if (props.column.type === "org-cascader") {
104
+ if (orgCascaderRef.value) {
105
+ optionsLoading.value = true;
106
+ optionsError.value = "";
107
+ try {
108
+ await orgCascaderRef.value.getData();
109
+ } catch {
110
+ optionsError.value = "error";
111
+ }
112
+ }
113
+ }
114
+ optionsLoading.value = false;
115
+ }
72
116
  function onChangeHandler(value, column) {
117
+ const { onChange } = props.column;
73
118
  emits("search");
119
+ if (!onChange) return;
120
+ onChange(props.column, props.model, props.index);
74
121
  }
75
122
  function onKeydownEnterHander(e) {
76
123
  emits("search");
@@ -90,6 +137,27 @@ const _sfc_main = {
90
137
  }
91
138
  emits("search");
92
139
  }
140
+ const context = vue.reactive({
141
+ ...vue.toRefs(props),
142
+ columnProp,
143
+ propString,
144
+ columnConfig,
145
+ columnAttrs,
146
+ obtainOptions,
147
+ optionsLoading,
148
+ optionsError,
149
+ options: vue.computed(() => {
150
+ return index.optionsHandler(props, props.column);
151
+ })
152
+ });
153
+ vue.onMounted(() => {
154
+ if (propString.value) {
155
+ formContext?.addField(context);
156
+ }
157
+ });
158
+ vue.onBeforeUnmount(() => {
159
+ formContext?.removeField(context);
160
+ });
93
161
  return (_ctx, _cache) => {
94
162
  return vue.unref(index.columnShowHandler)(props, __props.column) ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElFormItem), {
95
163
  key: 0,
@@ -113,7 +181,7 @@ const _sfc_main = {
113
181
  }])
114
182
  },
115
183
  [
116
- __props.column.labelSlot && _ctx.$slots[__props.column.labelSlot] ? vue.renderSlot(_ctx.$slots, __props.column.labelSlot, { column: __props.column }, void 0, void 0, 0) : (vue.openBlock(), vue.createElementBlock(
184
+ __props.column.labelSlot && _ctx.$slots[__props.column.labelSlot] ? vue.renderSlot(_ctx.$slots, __props.column.labelSlot, { column: columnConfig.value }, void 0, void 0, 0) : (vue.openBlock(), vue.createElementBlock(
117
185
  "span",
118
186
  { key: 1 },
119
187
  vue.toDisplayString(vue.unref(form.columnLabelHandler)(__props.column, props.model)),
@@ -133,7 +201,7 @@ const _sfc_main = {
133
201
  },
134
202
  [
135
203
  vue.createCommentVNode(" \u81EA\u5B9A\u4E49\u5177\u540D\u63D2\u69FD "),
136
- __props.column.slot ? vue.renderSlot(_ctx.$slots, __props.column.slot, { column: __props.column }, void 0, void 0, 0) : __props.column.type === "input" ? (vue.openBlock(), vue.createElementBlock(
204
+ __props.column.slot ? vue.renderSlot(_ctx.$slots, __props.column.slot, { column: columnConfig.value }, void 0, void 0, 0) : __props.column.type === "input" ? (vue.openBlock(), vue.createElementBlock(
137
205
  vue.Fragment,
138
206
  { key: 1 },
139
207
  [
@@ -161,13 +229,75 @@ const _sfc_main = {
161
229
  disabled: vue.unref(index.isDisabled)(props, __props.column),
162
230
  options: vue.unref(index.optionsHandler)(props, __props.column),
163
231
  onChange: ($event) => onChangeHandler($event, __props.column)
164
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options", "onChange"])
232
+ }), vue.createSlots({
233
+ _: 2
234
+ /* DYNAMIC */
235
+ }, [
236
+ optionsLoading.value ? {
237
+ name: "empty",
238
+ fn: vue.withCtx(() => [
239
+ vue.createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
240
+ vue.createVNode(vue.unref(elementPlus.ElIcon), {
241
+ size: "16",
242
+ class: "is-loading text-theme"
243
+ }, {
244
+ default: vue.withCtx(() => [
245
+ vue.createVNode(vue.unref(iconsVue.Loading))
246
+ ]),
247
+ _: 1
248
+ /* STABLE */
249
+ }),
250
+ vue.createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u52A0\u8F7D\u4E2D")
251
+ ])
252
+ ]),
253
+ key: "0"
254
+ } : void 0
255
+ ]), 1040, ["modelValue", "onUpdate:modelValue", "disabled", "options", "onChange"])
165
256
  ],
166
257
  2112
167
258
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
168
- )) : __props.column.type === "date-picker" ? (vue.openBlock(), vue.createElementBlock(
259
+ )) : __props.column.type === "select-v2" ? (vue.openBlock(), vue.createElementBlock(
169
260
  vue.Fragment,
170
261
  { key: 3 },
262
+ [
263
+ vue.createCommentVNode(" \u865A\u62DF\u5316\u9009\u62E9\u6846 "),
264
+ vue.createVNode(vue.unref(elementPlus.ElSelectV2), vue.mergeProps({
265
+ modelValue: bindValue.value,
266
+ "onUpdate:modelValue": ($event) => bindValue.value = $event
267
+ }, columnAttrs.value, {
268
+ disabled: vue.unref(index.isDisabled)(props, __props.column),
269
+ options: vue.unref(index.optionsHandler)(props, __props.column),
270
+ onChange: onChangeHandler
271
+ }), vue.createSlots({
272
+ _: 2
273
+ /* DYNAMIC */
274
+ }, [
275
+ optionsLoading.value ? {
276
+ name: "empty",
277
+ fn: vue.withCtx(() => [
278
+ vue.createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
279
+ vue.createVNode(vue.unref(elementPlus.ElIcon), {
280
+ size: "16",
281
+ class: "is-loading text-theme"
282
+ }, {
283
+ default: vue.withCtx(() => [
284
+ vue.createVNode(vue.unref(iconsVue.Loading))
285
+ ]),
286
+ _: 1
287
+ /* STABLE */
288
+ }),
289
+ vue.createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u52A0\u8F7D\u4E2D")
290
+ ])
291
+ ]),
292
+ key: "0"
293
+ } : void 0
294
+ ]), 1040, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
295
+ ],
296
+ 2112
297
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
298
+ )) : __props.column.type === "date-picker" ? (vue.openBlock(), vue.createElementBlock(
299
+ vue.Fragment,
300
+ { key: 4 },
171
301
  [
172
302
  vue.createCommentVNode(" \u65E5\u671F\u9009\u62E9\u6846 "),
173
303
  [
@@ -203,7 +333,7 @@ const _sfc_main = {
203
333
  /* STABLE_FRAGMENT */
204
334
  )) : __props.column.type === "time-picker" ? (vue.openBlock(), vue.createElementBlock(
205
335
  vue.Fragment,
206
- { key: 4 },
336
+ { key: 5 },
207
337
  [
208
338
  vue.createCommentVNode(" \u65F6\u95F4\u9009\u62E9\u6846 "),
209
339
  columnAttrs.value.isRange ? (vue.openBlock(), vue.createBlock(vue.unref(index$3.HyTimePicker), vue.mergeProps({
@@ -232,10 +362,12 @@ const _sfc_main = {
232
362
  /* STABLE_FRAGMENT */
233
363
  )) : __props.column.type === "org-cascader" ? (vue.openBlock(), vue.createElementBlock(
234
364
  vue.Fragment,
235
- { key: 5 },
365
+ { key: 6 },
236
366
  [
237
367
  vue.createCommentVNode(" \u90E8\u95E8\u7EA7\u8054\u9009\u62E9\u6846 "),
238
368
  vue.createVNode(vue.unref(index$4.HyOrgCascader), vue.mergeProps({
369
+ ref_key: "orgCascaderRef",
370
+ ref: orgCascaderRef,
239
371
  modelValue: bindValue.value,
240
372
  "onUpdate:modelValue": ($event) => bindValue.value = $event
241
373
  }, columnAttrs.value, {
@@ -247,17 +379,41 @@ const _sfc_main = {
247
379
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
248
380
  )) : __props.column.type === "cascader" ? (vue.openBlock(), vue.createElementBlock(
249
381
  vue.Fragment,
250
- { key: 6 },
382
+ { key: 7 },
251
383
  [
252
384
  vue.createCommentVNode(" \u7EA7\u8054\u9009\u62E9\u6846 "),
253
385
  vue.createVNode(vue.unref(elementPlus.ElCascader), vue.mergeProps({
254
386
  modelValue: bindValue.value,
255
387
  "onUpdate:modelValue": ($event) => bindValue.value = $event
256
388
  }, columnAttrs.value, {
389
+ style: { "width": "100%" },
257
390
  disabled: vue.unref(index.isDisabled)(props, __props.column),
258
391
  options: vue.unref(index.optionsHandler)(props, __props.column),
259
392
  onChange: onChangeHandler
260
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
393
+ }), vue.createSlots({
394
+ _: 2
395
+ /* DYNAMIC */
396
+ }, [
397
+ optionsLoading.value ? {
398
+ name: "empty",
399
+ fn: vue.withCtx(() => [
400
+ vue.createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
401
+ vue.createVNode(vue.unref(elementPlus.ElIcon), {
402
+ size: "16",
403
+ class: "is-loading text-theme"
404
+ }, {
405
+ default: vue.withCtx(() => [
406
+ vue.createVNode(vue.unref(iconsVue.Loading))
407
+ ]),
408
+ _: 1
409
+ /* STABLE */
410
+ }),
411
+ vue.createElementVNode("span", null, "\u6570\u636E\u6B63\u5728\u52A0\u8F7D\u4E2D")
412
+ ])
413
+ ]),
414
+ key: "0"
415
+ } : void 0
416
+ ]), 1040, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
261
417
  ],
262
418
  2112
263
419
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
@@ -7,6 +7,7 @@ require('../../../hooks/index.js');
7
7
  var is = require('../../../utils/is.js');
8
8
  var useResizeObserver = require('../../../hooks/useResizeObserver.js');
9
9
 
10
+ const formContextKey = /* @__PURE__ */ Symbol("formContextKey");
10
11
  function columnItemStyle(props, column) {
11
12
  const { width } = column;
12
13
  const style = {};
@@ -143,6 +144,7 @@ function optionsHandler(props, column) {
143
144
  exports.columnItemInputStyle = columnItemInputStyle;
144
145
  exports.columnItemStyle = columnItemStyle;
145
146
  exports.columnShowHandler = columnShowHandler;
147
+ exports.formContextKey = formContextKey;
146
148
  exports.isDisabled = isDisabled;
147
149
  exports.isEmptyValue = isEmptyValue;
148
150
  exports.isSelectedTimeRange = isSelectedTimeRange;