hy-dispatch-ui-v3 0.2.66 → 0.2.67

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 (62) hide show
  1. package/dist/tailwind.css +25 -1
  2. package/es/components/hyBatchUploadDialog/batchUploadDialog.vue.mjs +174 -142
  3. package/es/components/hyButton/button.vue.mjs +16 -3
  4. package/es/components/hyButton/style/button.scss +2 -0
  5. package/es/components/hyForm/cpns/formItem.vue.mjs +96 -46
  6. package/es/components/hyForm/form.vue.mjs +22 -8
  7. package/es/components/hyForm/js/useAppForm.mjs +1 -1
  8. package/es/components/hyMap/js/index.mjs +6 -6
  9. package/es/components/hyMap/map.vue.mjs +14 -4
  10. package/es/components/hyOrgCascader/orgCascader.vue.mjs +7 -2
  11. package/es/components/hySearch/cpns/searchItem.vue.mjs +396 -324
  12. package/es/components/hySearch/search.vue.mjs +17 -7
  13. package/es/components/hySearch/style/search.scss +7 -0
  14. package/es/components/hyTable/cpns/virtualTable.vue.mjs +25 -6
  15. package/es/components/hyTable/js/index.mjs +11 -5
  16. package/es/components/hyTable/js/search.mjs +25 -1
  17. package/es/components/hyTable/table.vue.mjs +34 -13
  18. package/es/components/hyTableActionButton/tableActionButton.vue.mjs +9 -2
  19. package/es/components/hyTableForm/batchTableForm.vue.mjs +23 -2
  20. package/es/components/hyTableForm/js/useAppTableForm.mjs +1 -1
  21. package/es/components/hyTableForm/tableForm.vue.mjs +79 -33
  22. package/es/components/hyTree/js/index.mjs +118 -50
  23. package/es/components/hyTree/tree.vue.mjs +4 -2
  24. package/es/style/index.scss +0 -1
  25. package/es/style/tailwind.scss +0 -1
  26. package/es/utils/is.mjs +3 -1
  27. package/es/utils/map/hook/bigMap.mjs +2 -0
  28. package/es/utils/map/hook/gaode.mjs +51 -16
  29. package/es/utils/map/hook/leafletjs.mjs +15 -3
  30. package/es/utils/map/index.mjs +1 -1
  31. package/es/version.mjs +1 -1
  32. package/lib/components/hyBatchUploadDialog/batchUploadDialog.vue.js +173 -141
  33. package/lib/components/hyButton/button.vue.js +15 -2
  34. package/lib/components/hyButton/style/button.scss +2 -0
  35. package/lib/components/hyForm/cpns/formItem.vue.js +93 -43
  36. package/lib/components/hyForm/form.vue.js +21 -7
  37. package/lib/components/hyForm/js/useAppForm.js +1 -1
  38. package/lib/components/hyMap/js/index.js +5 -5
  39. package/lib/components/hyMap/map.vue.js +13 -3
  40. package/lib/components/hyOrgCascader/orgCascader.vue.js +7 -2
  41. package/lib/components/hySearch/cpns/searchItem.vue.js +394 -322
  42. package/lib/components/hySearch/search.vue.js +17 -7
  43. package/lib/components/hySearch/style/search.scss +7 -0
  44. package/lib/components/hyTable/cpns/virtualTable.vue.js +24 -5
  45. package/lib/components/hyTable/js/index.js +11 -4
  46. package/lib/components/hyTable/js/search.js +25 -1
  47. package/lib/components/hyTable/table.vue.js +33 -12
  48. package/lib/components/hyTableActionButton/tableActionButton.vue.js +9 -2
  49. package/lib/components/hyTableForm/batchTableForm.vue.js +23 -2
  50. package/lib/components/hyTableForm/js/useAppTableForm.js +1 -1
  51. package/lib/components/hyTableForm/tableForm.vue.js +78 -32
  52. package/lib/components/hyTree/js/index.js +118 -50
  53. package/lib/components/hyTree/tree.vue.js +4 -2
  54. package/lib/style/index.scss +0 -1
  55. package/lib/style/tailwind.scss +0 -1
  56. package/lib/utils/is.js +5 -3
  57. package/lib/utils/map/hook/bigMap.js +2 -0
  58. package/lib/utils/map/hook/gaode.js +51 -16
  59. package/lib/utils/map/hook/leafletjs.js +15 -3
  60. package/lib/utils/map/index.js +1 -1
  61. package/lib/version.js +1 -1
  62. package/package.json +2 -2
@@ -68,6 +68,15 @@ const _sfc_main = {
68
68
  const formContext = vue.inject(index.formContextKey);
69
69
  const formItemRef = vue.useTemplateRef("formItemRef");
70
70
  const orgCascaderRef = vue.useTemplateRef("orgCascaderRef");
71
+ const showMessage = vue.computed(() => {
72
+ if (columnConfig.value.optionsError) {
73
+ return true;
74
+ }
75
+ if (is.isBoolean(columnConfig.value.showMessage)) {
76
+ return columnConfig.value.showMessage;
77
+ }
78
+ return formContext.showMessage;
79
+ });
71
80
  const columnProp = vue.computed(() => {
72
81
  let field = is.isArray(props.column.field) ? props.column.field[0] : props.column.field;
73
82
  if (props.parentProp) {
@@ -112,36 +121,54 @@ const _sfc_main = {
112
121
  placeholder: form.columnPlaceholderHandler(props.column, props.model)
113
122
  };
114
123
  });
115
- const optionsLoading = vue.ref(false);
116
- const optionsError = vue.ref("");
117
- async function obtainOptions() {
118
- if (props.column.optionsFn) {
119
- if (!props.column.optionsFn || optionsLoading.value) return;
120
- optionsLoading.value = true;
121
- optionsError.value = "";
122
- props.column.attrs.options = [];
123
- try {
124
- props.column.attrs.options = await props.column.optionsFn(
125
- props.column,
126
- props.model
127
- );
128
- optionsError.value = "";
129
- } catch (err) {
130
- optionsError.value = "error";
131
- console.error(err);
132
- }
133
- } else if (props.column.type === "org-cascader") {
134
- if (orgCascaderRef.value) {
135
- optionsLoading.value = true;
136
- optionsError.value = "";
137
- try {
138
- await orgCascaderRef.value.getData();
139
- } catch {
140
- optionsError.value = "error";
124
+ async function obtainOptions(isMountedLoad = false) {
125
+ return new Promise(async (resolve, reject) => {
126
+ if (props.column.optionsFn) {
127
+ if (!props.column.optionsFn) return;
128
+ props.column.optionsLoading = true;
129
+ props.column.optionsError = "";
130
+ props.column.attrs.options = [];
131
+ if (!(isMountedLoad && props.column.isDefaultGetData === false)) {
132
+ try {
133
+ props.column.attrs.options = await props.column.optionsFn(
134
+ props.column,
135
+ props.model
136
+ );
137
+ props.column.optionsError = "";
138
+ resolve();
139
+ } catch (err) {
140
+ props.column.optionsError = "error";
141
+ console.error(err);
142
+ reject();
143
+ }
144
+ } else {
145
+ resolve();
146
+ }
147
+ } else if (props.column.type === "org-cascader") {
148
+ if (orgCascaderRef.value) {
149
+ props.column.optionsLoading = true;
150
+ props.column.optionsError = "";
151
+ try {
152
+ await orgCascaderRef.value.getData();
153
+ resolve();
154
+ } catch {
155
+ props.column.optionsError = "error";
156
+ reject();
157
+ }
158
+ } else {
159
+ resolve();
141
160
  }
161
+ } else {
162
+ resolve();
142
163
  }
164
+ props.column.optionsLoading = false;
165
+ });
166
+ }
167
+ function getOptionsHandler(props2, column) {
168
+ if (props2.column.optionsLoading) {
169
+ return [];
143
170
  }
144
- optionsLoading.value = false;
171
+ return index.optionsHandler(props2, props2.column);
145
172
  }
146
173
  function getColumnRuleHandler(column, model) {
147
174
  if (!index.isRequired(props, column) && formItemRef.value) {
@@ -154,6 +181,15 @@ const _sfc_main = {
154
181
  if (!onChange) return;
155
182
  onChange(props.column, props.model, props.index);
156
183
  }
184
+ async function onReloadOptions() {
185
+ if (props.column.optionsError === "error") {
186
+ try {
187
+ await obtainOptions();
188
+ } catch {
189
+ }
190
+ formContext?.emitOptionsStatus();
191
+ }
192
+ }
157
193
  const context = vue.reactive({
158
194
  ...vue.toRefs(props),
159
195
  columnProp,
@@ -161,16 +197,29 @@ const _sfc_main = {
161
197
  columnConfig,
162
198
  columnAttrs,
163
199
  obtainOptions,
164
- optionsLoading,
165
- optionsError,
200
+ optionsLoading: vue.computed(() => props.column.optionsLoading),
201
+ optionsError: vue.computed(() => props.column.optionsError),
166
202
  options: vue.computed(() => {
167
- return index.optionsHandler(props, props.column);
203
+ return getOptionsHandler(props, props.column);
168
204
  })
169
205
  });
170
206
  vue.onMounted(() => {
171
207
  if (propString.value) {
172
208
  formContext?.addField(context);
173
209
  }
210
+ vue.watch(
211
+ () => formContext.model.errorMsg,
212
+ () => {
213
+ const optionsError = props.column.optionsError;
214
+ if (optionsError === "error") {
215
+ props.column.optionsError = "";
216
+ setTimeout(() => {
217
+ props.column.optionsError = "error";
218
+ }, 1);
219
+ }
220
+ },
221
+ { immediate: true, deep: true }
222
+ );
174
223
  });
175
224
  vue.onBeforeUnmount(() => {
176
225
  formContext?.removeField(context);
@@ -192,7 +241,8 @@ const _sfc_main = {
192
241
  prop: columnProp.value,
193
242
  rules: getColumnRuleHandler(__props.column, props.model),
194
243
  style: vue.normalizeStyle(vue.unref(index.columnItemStyle)(props, __props.column)),
195
- error: optionsError.value
244
+ error: __props.column.optionsError,
245
+ "show-message": showMessage.value
196
246
  }, vue.createSlots({
197
247
  default: vue.withCtx(() => [
198
248
  vue.createElementVNode("div", { class: "w-full flex justify-between text-main" }, [
@@ -329,13 +379,13 @@ const _sfc_main = {
329
379
  "onUpdate:modelValue": ($event) => bindValue.value = $event
330
380
  }, columnAttrs.value, {
331
381
  disabled: vue.unref(index.isDisabled)(props, __props.column),
332
- options: vue.unref(index.optionsHandler)(props, __props.column),
382
+ options: getOptionsHandler(props, __props.column),
333
383
  onChange: onChangeHandler
334
384
  }), vue.createSlots({
335
385
  _: 2
336
386
  /* DYNAMIC */
337
387
  }, [
338
- optionsLoading.value ? {
388
+ __props.column.optionsLoading ? {
339
389
  name: "empty",
340
390
  fn: vue.withCtx(() => [
341
391
  vue.createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
@@ -368,13 +418,13 @@ const _sfc_main = {
368
418
  "onUpdate:modelValue": ($event) => bindValue.value = $event
369
419
  }, columnAttrs.value, {
370
420
  disabled: vue.unref(index.isDisabled)(props, __props.column),
371
- options: vue.unref(index.optionsHandler)(props, __props.column),
421
+ options: getOptionsHandler(props, __props.column),
372
422
  onChange: onChangeHandler
373
423
  }), vue.createSlots({
374
424
  _: 2
375
425
  /* DYNAMIC */
376
426
  }, [
377
- optionsLoading.value ? {
427
+ __props.column.optionsLoading ? {
378
428
  name: "empty",
379
429
  fn: vue.withCtx(() => [
380
430
  vue.createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
@@ -471,7 +521,7 @@ const _sfc_main = {
471
521
  "onUpdate:modelValue": ($event) => bindValue.value = $event
472
522
  }, columnAttrs.value, {
473
523
  disabled: vue.unref(index.isDisabled)(props, __props.column),
474
- options: vue.unref(index.optionsHandler)(props, __props.column),
524
+ options: getOptionsHandler(props, __props.column),
475
525
  onChange: onChangeHandler
476
526
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
477
527
  ],
@@ -487,7 +537,7 @@ const _sfc_main = {
487
537
  "onUpdate:modelValue": ($event) => bindValue.value = $event
488
538
  }, columnAttrs.value, {
489
539
  disabled: vue.unref(index.isDisabled)(props, __props.column),
490
- options: vue.unref(index.optionsHandler)(props, __props.column),
540
+ options: getOptionsHandler(props, __props.column),
491
541
  size: __props.size,
492
542
  onChange: onChangeHandler
493
543
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options", "size"])
@@ -504,7 +554,7 @@ const _sfc_main = {
504
554
  "onUpdate:modelValue": ($event) => bindValue.value = $event
505
555
  }, columnAttrs.value, {
506
556
  disabled: vue.unref(index.isDisabled)(props, __props.column),
507
- options: vue.unref(index.optionsHandler)(props, __props.column),
557
+ options: getOptionsHandler(props, __props.column),
508
558
  onChange: onChangeHandler
509
559
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "options"])
510
560
  ],
@@ -572,13 +622,13 @@ const _sfc_main = {
572
622
  }, columnAttrs.value, {
573
623
  class: "w-full",
574
624
  disabled: vue.unref(index.isDisabled)(props, __props.column),
575
- options: vue.unref(index.optionsHandler)(props, __props.column),
625
+ options: getOptionsHandler(props, __props.column),
576
626
  onChange: onChangeHandler
577
627
  }), vue.createSlots({
578
628
  _: 2
579
629
  /* DYNAMIC */
580
630
  }, [
581
- optionsLoading.value ? {
631
+ __props.column.optionsLoading ? {
582
632
  name: "empty",
583
633
  fn: vue.withCtx(() => [
584
634
  vue.createElementVNode("div", { class: "w-full flex items-center justify-center py-2 gap-1.5 text-main text-xs whitespace-nowrap" }, [
@@ -610,21 +660,21 @@ const _sfc_main = {
610
660
  _: 2
611
661
  /* DYNAMIC */
612
662
  }, [
613
- optionsError.value ? {
663
+ __props.column.optionsError ? {
614
664
  name: "error",
615
665
  fn: vue.withCtx(() => [
616
666
  vue.createElementVNode("div", { class: "hy-el-form-item__error" }, [
617
667
  vue.createElementVNode("span", null, "\u6570\u636E\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7"),
618
668
  vue.createElementVNode("span", {
619
669
  class: "text-theme cursor-pointer",
620
- onClick: obtainOptions
670
+ onClick: onReloadOptions
621
671
  }, "[\u91CD\u65B0\u52A0\u8F7D]"),
622
672
  vue.createElementVNode("span", null, "\u6216\u8054\u7CFB\u7BA1\u7406\u5458")
623
673
  ])
624
674
  ]),
625
675
  key: "0"
626
676
  } : void 0
627
- ]), 1032, ["id", "prop", "rules", "style", "error"])) : vue.createCommentVNode("v-if", true);
677
+ ]), 1032, ["id", "prop", "rules", "style", "error", "show-message"])) : vue.createCommentVNode("v-if", true);
628
678
  };
629
679
  }
630
680
  };
@@ -54,6 +54,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
54
54
  type: String,
55
55
  default: "default"
56
56
  // 'large' | 'default' | 'small'
57
+ },
58
+ showMessage: {
59
+ type: Boolean,
60
+ default: true
57
61
  }
58
62
  },
59
63
  emits: ["on-allMapSelect", "complete"],
@@ -92,7 +96,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
92
96
  fields.push(field);
93
97
  }
94
98
  const removeField = (field) => {
95
- if (vue.unref(field.columnAttrs)) {
99
+ if (field.propString) {
96
100
  fields.splice(fields.indexOf(field), 1);
97
101
  }
98
102
  };
@@ -102,21 +106,30 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
102
106
  (field) => field.propString && filterKeys.includes(field.propString)
103
107
  ) : fields2;
104
108
  }
105
- async function obtainOptionsFields(keys) {
109
+ async function obtainOptionsFields(keys, isMountedLoad = false) {
106
110
  const filteredFields = filterFields(fields, keys);
107
- await Promise.allSettled(filteredFields.map((field) => field.obtainOptions()));
111
+ await Promise.allSettled(
112
+ filteredFields.map((field) => field.obtainOptions(isMountedLoad))
113
+ );
108
114
  }
109
- async function getOptions() {
110
- await obtainOptionsFields();
115
+ async function getOptions(isMountedLoad = false) {
116
+ await obtainOptionsFields([], isMountedLoad);
117
+ emitOptionsStatus();
111
118
  }
112
119
  async function getOptionsFields(keys) {
113
120
  await obtainOptionsFields(keys);
121
+ emitOptionsStatus();
114
122
  }
115
123
  async function getOptionsError() {
116
124
  const filteredFields = fields.filter(
117
125
  (field) => field.propString && field.optionsError
118
126
  );
119
127
  await Promise.allSettled(filteredFields.map((field) => field.obtainOptions()));
128
+ emitOptionsStatus();
129
+ }
130
+ function emitOptionsStatus() {
131
+ const hasError = fields.some((item) => item.optionsError === "error");
132
+ emits("optionsStatus", { result: !hasError });
120
133
  }
121
134
  vue.provide(
122
135
  index.formContextKey,
@@ -124,11 +137,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
124
137
  ...vue.toRefs(props),
125
138
  emits,
126
139
  addField,
127
- removeField
140
+ removeField,
141
+ emitOptionsStatus
128
142
  })
129
143
  );
130
144
  vue.onMounted(() => {
131
- getOptions();
145
+ getOptions(true);
132
146
  });
133
147
  __expose({
134
148
  validate: async (callback) => {
@@ -25,7 +25,7 @@ function appFormItemHandler(column = {}) {
25
25
  return {
26
26
  ...column,
27
27
  attrs: {
28
- maxlength: attrs.type === "textarea" ? 255 : attrs.type === "text" ? 100 : void 0,
28
+ maxlength: attrs.type === "text" ? 256 : void 0,
29
29
  ...attrs
30
30
  }
31
31
  };
@@ -9,8 +9,8 @@ const useAppMapWrapper = (hy) => {
9
9
  mapRef,
10
10
  emits
11
11
  } = hy;
12
- const hyMap = null;
13
- const map = null;
12
+ let hyMap = vue.shallowRef(null);
13
+ let map = vue.shallowRef(null);
14
14
  function newMap(mapType) {
15
15
  const mapFilters = [
16
16
  {
@@ -94,7 +94,7 @@ const useAppMapWrapper = (hy) => {
94
94
  filter: "saturate(180%) brightness(105%) contrast(115%)"
95
95
  }
96
96
  ];
97
- hy.hyMap = new index.InitMap({
97
+ hy.hyMap.value = new index.InitMap({
98
98
  ...mapConfig,
99
99
  mapType,
100
100
  BM: window.BM
@@ -117,7 +117,7 @@ const useAppMapWrapper = (hy) => {
117
117
  }, 800);
118
118
  }
119
119
  function initMap() {
120
- hy.map = hy.hyMap.InitMap(mapRef.value, {
120
+ hy.map.value = hy.hyMap.value.InitMap(mapRef.value, {
121
121
  minZoom: mapConfig.minZoom || 8,
122
122
  maxZoom: mapConfig.maxZoom || 18,
123
123
  center: mapConfig.center || {
@@ -127,7 +127,7 @@ const useAppMapWrapper = (hy) => {
127
127
  zoom: mapConfig.zoom || 14,
128
128
  completeCallbacks: () => {
129
129
  vue.nextTick(() => {
130
- emits("complete", hy.hyMap, hy.map);
130
+ emits("complete", hy.hyMap.value, hy.map.value);
131
131
  });
132
132
  }
133
133
  });
@@ -4,8 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var vue = require('vue');
6
6
  require('../../hooks/index.js');
7
+ require('../../index.js');
7
8
  var index = require('./js/index.js');
8
9
  var useMixins = require('../../hooks/useMixins.js');
10
+ var index$1 = require('../hyNoPermissionsMap/index.js');
9
11
  var useMapConfig = require('../../hooks/useMapConfig.js');
10
12
 
11
13
  import "../../static/map/bigemap.css";
@@ -48,13 +50,21 @@ const _sfc_main = {
48
50
  [index.useAppMapWrapper]
49
51
  );
50
52
  vue.onMounted(() => {
51
- newMap(props.mapType);
53
+ if (props.mapType !== "nomap") {
54
+ newMap(props.mapType);
55
+ }
56
+ });
57
+ vue.onBeforeUnmount(() => {
58
+ map.value?.removeMap();
59
+ map.value = null;
60
+ hyMap.value = null;
52
61
  });
53
62
  return (_ctx, _cache) => {
54
63
  return vue.openBlock(), vue.createElementBlock("div", { class: "w-full h-full box-border border-border border relative" }, [
55
- vue.createElementVNode(
64
+ props.mapType !== "nomap" ? (vue.openBlock(), vue.createElementBlock(
56
65
  "div",
57
66
  {
67
+ key: 0,
58
68
  ref_key: "mapRef",
59
69
  ref: mapRef,
60
70
  class: "w-full h-full rounded overflow-hidden"
@@ -62,7 +72,7 @@ const _sfc_main = {
62
72
  null,
63
73
  512
64
74
  /* NEED_PATCH */
65
- )
75
+ )) : (vue.openBlock(), vue.createBlock(vue.unref(index$1.HyNoPermissionsMap), { key: 1 }))
66
76
  ]);
67
77
  };
68
78
  }
@@ -79,6 +79,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
79
79
  default: () => {
80
80
  return true;
81
81
  }
82
+ },
83
+ onVisibleChange: {
84
+ type: Function
82
85
  }
83
86
  }, {
84
87
  "modelValue": { type: [Array, String, Number] },
@@ -143,6 +146,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
143
146
  }
144
147
  function onVisibleChangeHandler(type) {
145
148
  focusType.value = type;
149
+ onVisibleChange(type);
146
150
  }
147
151
  if (props.defaultGetData) {
148
152
  getCascaderData();
@@ -264,7 +268,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
264
268
  filterable: "",
265
269
  "show-all-levels": false,
266
270
  "virtual-scroll": "",
267
- onChange: onChangeHanlder
271
+ onChange: onChangeHanlder,
272
+ onVisibleChange: __props.onVisibleChange
268
273
  }, vue.createSlots({
269
274
  _: 2
270
275
  /* DYNAMIC */
@@ -288,7 +293,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
288
293
  ]),
289
294
  key: "0"
290
295
  } : void 0
291
- ]), 1032, ["modelValue", "onUpdate:modelValue", "class", "size", "options", "clearable", "disabled", "placeholder"]))
296
+ ]), 1032, ["modelValue", "onUpdate:modelValue", "class", "size", "options", "clearable", "disabled", "placeholder", "onVisibleChange"]))
292
297
  ]);
293
298
  };
294
299
  }