cnhis-design-vue 3.1.14-beta.10 → 3.1.14-beta.11.2

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 (22) hide show
  1. package/es/packages/fabric-chart/src/FabricChart.vue_vue_type_script_setup_true_lang.js +2 -1
  2. package/es/packages/fabric-chart/src/hooks/useCenter.js +41 -25
  3. package/es/packages/fabric-chart/src/hooks/useEvent.js +8 -7
  4. package/es/packages/field-set/index.d.ts +2509 -5166
  5. package/es/packages/field-set/src/FieldSet.vue.d.ts +2492 -5169
  6. package/es/packages/field-set/src/FieldSet.vue_vue_type_script_setup_true_lang.js +334 -11
  7. package/es/packages/form-render/src/components/renderer/cascader.d.ts +2 -2
  8. package/es/packages/form-render/src/components/renderer/cascader.js +40 -47
  9. package/es/packages/form-render/src/components/renderer/select.js +8 -9
  10. package/es/packages/form-render/src/hooks/useAsyncQueue.js +1 -1
  11. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  12. package/es/packages/form-render/src/hooks/useFormItemDeps.d.ts +2 -2
  13. package/es/packages/form-render/src/hooks/useFormItemDeps.js +5 -6
  14. package/es/packages/info-header/src/HiddenContent.vue_vue_type_script_setup_true_lang.js +3 -2
  15. package/es/packages/info-header/src/InfoHeader.vue_vue_type_script_setup_true_lang.js +3 -2
  16. package/package.json +153 -153
  17. package/es/packages/field-set/src/NewFieldSet.js +0 -4
  18. package/es/packages/field-set/src/NewFieldSet.vue.d.ts +0 -2607
  19. package/es/packages/field-set/src/NewFieldSet.vue_vue_type_script_setup_true_lang.js +0 -299
  20. package/es/packages/field-set/src/OldFieldSet.js +0 -4
  21. package/es/packages/field-set/src/OldFieldSet.vue.d.ts +0 -2610
  22. package/es/packages/field-set/src/OldFieldSet.vue_vue_type_script_setup_true_lang.js +0 -330
@@ -1,20 +1,343 @@
1
- import { defineComponent, openBlock, createElementBlock, Fragment, createCommentVNode, createBlock, normalizeProps, mergeProps } from 'vue';
2
- import './OldFieldSet.js';
3
- import './NewFieldSet.js';
4
- import script$1 from './OldFieldSet.vue_vue_type_script_setup_true_lang.js';
5
- import script$2 from './NewFieldSet.vue_vue_type_script_setup_true_lang.js';
1
+ import { defineComponent, ref, computed, reactive, onMounted, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, normalizeClass, createCommentVNode, createBlock, normalizeStyle, toDisplayString, withDirectives, vShow, vModelSelect, vModelText, renderSlot, createTextVNode } from 'vue';
2
+ import { NSpin, NCheckbox, NTooltip, NButton } from 'naive-ui';
3
+ import Draggable from 'vuedraggable';
6
4
 
5
+ const _hoisted_1 = { class: "fields-set-content" };
6
+ const _hoisted_2 = { class: "fields-table" };
7
+ const _hoisted_3 = /* @__PURE__ */ createElementVNode("span", {
8
+ class: "width-show",
9
+ style: { "width": "4%" }
10
+ }, null, -1);
11
+ const _hoisted_4 = /* @__PURE__ */ createElementVNode("span", { class: "width-large" }, "\u6240\u6709\u5B57\u6BB5", -1);
12
+ const _hoisted_5 = { class: "width-show" };
13
+ const _hoisted_6 = /* @__PURE__ */ createTextVNode(" \u663E\u793A ");
14
+ const _hoisted_7 = { class: "width-show" };
15
+ const _hoisted_8 = /* @__PURE__ */ createTextVNode(" \u6392\u5E8F ");
16
+ const _hoisted_9 = /* @__PURE__ */ createElementVNode("span", { class: "width-showed" }, "\u56FA\u5B9A", -1);
17
+ const _hoisted_10 = /* @__PURE__ */ createElementVNode("span", { class: "width-word" }, "\u81EA\u5B9A\u4E49\u6807\u9898", -1);
18
+ const _hoisted_11 = /* @__PURE__ */ createElementVNode("span", { class: "width-showed" }, "\u5217\u5BBD", -1);
19
+ const _hoisted_12 = ["onClick"];
20
+ const _hoisted_13 = { class: "width-show drag-icon-wrap" };
21
+ const _hoisted_14 = /* @__PURE__ */ createElementVNode("span", {
22
+ class: "iconfont icon-a-menzhenyishengzhanxitongtubiaotuozhuai",
23
+ style: { "color": "#000" }
24
+ }, null, -1);
25
+ const _hoisted_15 = /* @__PURE__ */ createElementVNode("span", null, "\u62D6\u62FD\u8C03\u6574\u987A\u5E8F", -1);
26
+ const _hoisted_16 = /* @__PURE__ */ createElementVNode("span", { style: { "width": "14px", "margin-right": "6px" } }, null, -1);
27
+ const _hoisted_17 = { class: "width-show" };
28
+ const _hoisted_18 = { class: "width-show" };
29
+ const _hoisted_19 = { class: "width-showed" };
30
+ const _hoisted_20 = ["onUpdate:modelValue"];
31
+ const _hoisted_21 = /* @__PURE__ */ createElementVNode("option", { value: "NONE" }, "\u4E0D\u56FA\u5B9A", -1);
32
+ const _hoisted_22 = /* @__PURE__ */ createElementVNode("option", { value: "LEFT" }, "\u5DE6\u56FA\u5B9A", -1);
33
+ const _hoisted_23 = /* @__PURE__ */ createElementVNode("option", { value: "RIGHT" }, "\u53F3\u56FA\u5B9A", -1);
34
+ const _hoisted_24 = [
35
+ _hoisted_21,
36
+ _hoisted_22,
37
+ _hoisted_23
38
+ ];
39
+ const _hoisted_25 = { class: "width-word" };
40
+ const _hoisted_26 = ["onUpdate:modelValue"];
41
+ const _hoisted_27 = { class: "width-showed" };
42
+ const _hoisted_28 = ["onUpdate:modelValue"];
43
+ const _hoisted_29 = {
44
+ key: 0,
45
+ class: "check-options"
46
+ };
47
+ const _hoisted_30 = { class: "btn-operate" };
48
+ const _hoisted_31 = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
49
+ const _hoisted_32 = /* @__PURE__ */ createTextVNode("\u4FDD\u5B58");
7
50
  var script = /* @__PURE__ */ defineComponent({
8
51
  __name: "FieldSet",
9
52
  props: {
10
- type: { type: String, required: false, default: "old" }
53
+ fields: {
54
+ type: Array,
55
+ default: function() {
56
+ return [];
57
+ }
58
+ },
59
+ menuSource: {
60
+ type: String,
61
+ default: ""
62
+ },
63
+ drawerDirection: {
64
+ type: String,
65
+ default: "right"
66
+ },
67
+ footerFlag: {
68
+ type: Boolean,
69
+ default: true
70
+ },
71
+ type: {
72
+ type: String,
73
+ default: "old"
74
+ }
11
75
  },
12
- setup(__props) {
76
+ emits: ["onSave", "onClose"],
77
+ setup(__props, { expose, emit }) {
78
+ const props = __props;
79
+ const fieldsMapping = {
80
+ sid: "id",
81
+ columnName: "name",
82
+ isShow: "show",
83
+ isSort: "sort",
84
+ isFixed: "fixedShow",
85
+ colWidth: "columnWidth"
86
+ };
87
+ const settingView = ref(null);
88
+ const realityFields = computed(() => {
89
+ const result = props.fields ? JSON.parse(JSON.stringify(props.fields)) : [];
90
+ if (props.type == "old") {
91
+ Object.keys(fieldsMapping).forEach((key) => {
92
+ result.forEach((item) => {
93
+ if (Reflect.has(item, key)) {
94
+ item[fieldsMapping[key]] = item[key];
95
+ Reflect.deleteProperty(item, key);
96
+ }
97
+ });
98
+ });
99
+ }
100
+ return result;
101
+ });
102
+ const state = reactive({
103
+ spinning: false,
104
+ isCustomSearch: true,
105
+ clickItem: {},
106
+ fields: realityFields.value
107
+ });
108
+ const leftStyle = (ele) => {
109
+ return {
110
+ background: state.clickItem.id === ele.id ? "#f2f2f2" : void 0
111
+ };
112
+ };
113
+ const showCheckBox = (key) => {
114
+ return state.fields.some((i) => Object.prototype.hasOwnProperty.call(i, key));
115
+ };
116
+ const hideTab = () => {
117
+ var _a, _b;
118
+ if (props.drawerDirection === "right") {
119
+ (_a = settingView.value) == null ? void 0 : _a.style.setProperty("margin", "auto");
120
+ } else {
121
+ (_b = settingView.value) == null ? void 0 : _b.style.setProperty("margin", "auto");
122
+ }
123
+ };
124
+ const getTableFields = () => {
125
+ if (props.type == "old") {
126
+ let tableFields = [];
127
+ if (state.fields.length > 0) {
128
+ state.fields.forEach((item, i) => {
129
+ tableFields.push({
130
+ id: item.id,
131
+ field: item.name,
132
+ visible: item.show,
133
+ sequence: i,
134
+ sortable: item.sort,
135
+ title: item.alias || item.title,
136
+ fixed: item.fixedWay,
137
+ minWidth: item.columnWidth
138
+ });
139
+ });
140
+ }
141
+ return tableFields;
142
+ } else {
143
+ return state.fields;
144
+ }
145
+ };
146
+ const handleFieldSave = () => {
147
+ emit("onSave", { tableFields: getTableFields() });
148
+ };
149
+ const onCancle = () => {
150
+ emit("onClose");
151
+ };
152
+ const calculateCheck = (key) => {
153
+ if (!state.fields.length)
154
+ return false;
155
+ return state.fields.every((i) => {
156
+ if (!Object.prototype.hasOwnProperty.call(i, key))
157
+ return true;
158
+ return i[key];
159
+ });
160
+ };
161
+ const handleAllCheck = (e, key) => {
162
+ const value = e;
163
+ const data = state.fields.map((i) => {
164
+ if (Object.prototype.hasOwnProperty.call(i, key)) {
165
+ i[key] = value;
166
+ }
167
+ return i;
168
+ });
169
+ state.fields = data;
170
+ };
171
+ const handleFieldClick = (item) => {
172
+ state.clickItem = item;
173
+ };
174
+ onMounted(() => {
175
+ hideTab();
176
+ });
177
+ expose({
178
+ getTableFields
179
+ });
13
180
  return (_ctx, _cache) => {
14
- return openBlock(), createElementBlock(Fragment, null, [
15
- createCommentVNode(' <component :is="currentComp"></component> '),
16
- __props.type == "old" ? (openBlock(), createBlock(script$1, normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), null, 16)) : (openBlock(), createBlock(script$2, normalizeProps(mergeProps({ key: 1 }, _ctx.$attrs)), null, 16))
17
- ], 2112);
181
+ return openBlock(), createElementBlock("div", {
182
+ ref_key: "settingView",
183
+ ref: settingView,
184
+ class: "c-field-set"
185
+ }, [
186
+ createVNode(unref(NSpin), {
187
+ show: state.spinning,
188
+ tip: "...",
189
+ style: { "width": "100%", "height": "100%" }
190
+ }, {
191
+ default: withCtx(() => [
192
+ createElementVNode("div", _hoisted_1, [
193
+ createElementVNode("div", _hoisted_2, [
194
+ createElementVNode("div", {
195
+ class: normalizeClass(["setting-title", { "seting-title-api": !state.isCustomSearch }])
196
+ }, [
197
+ _hoisted_3,
198
+ createCommentVNode(" \u5B57\u6BB5\u540D\u79F0 "),
199
+ _hoisted_4,
200
+ createCommentVNode(" \u663E\u793A "),
201
+ createElementVNode("span", _hoisted_5, [
202
+ showCheckBox("show") ? (openBlock(), createBlock(unref(NCheckbox), {
203
+ key: 0,
204
+ checked: calculateCheck("show"),
205
+ "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => handleAllCheck($event, "show"))
206
+ }, null, 8, ["checked"])) : createCommentVNode("v-if", true),
207
+ _hoisted_6
208
+ ]),
209
+ createCommentVNode(" \u6392\u5E8F "),
210
+ createElementVNode("span", _hoisted_7, [
211
+ showCheckBox("sort") ? (openBlock(), createBlock(unref(NCheckbox), {
212
+ key: 0,
213
+ checked: calculateCheck("sort"),
214
+ "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => handleAllCheck($event, "sort"))
215
+ }, null, 8, ["checked"])) : createCommentVNode("v-if", true),
216
+ _hoisted_8
217
+ ]),
218
+ createCommentVNode(" \u56FA\u5B9A "),
219
+ _hoisted_9,
220
+ createCommentVNode(" \u81EA\u5B9A\u4E49\u6807\u9898 "),
221
+ _hoisted_10,
222
+ createCommentVNode(" \u5217\u5BBD "),
223
+ _hoisted_11
224
+ ], 2),
225
+ createElementVNode("div", {
226
+ ref: "setShow",
227
+ class: normalizeClass(["set-show", { "set-show-api": !state.isCustomSearch }])
228
+ }, [
229
+ createVNode(unref(Draggable), {
230
+ list: state.fields,
231
+ animation: "150",
232
+ "item-key": "id",
233
+ tag: "ul"
234
+ }, {
235
+ item: withCtx(({ element }) => [
236
+ createElementVNode("li", {
237
+ class: "left-style",
238
+ style: normalizeStyle(leftStyle(element)),
239
+ onClick: ($event) => handleFieldClick(element)
240
+ }, [
241
+ createElementVNode("span", _hoisted_13, [
242
+ createVNode(unref(NTooltip), { trigger: "hover" }, {
243
+ trigger: withCtx(() => [
244
+ _hoisted_14
245
+ ]),
246
+ default: withCtx(() => [
247
+ _hoisted_15
248
+ ]),
249
+ _: 1
250
+ })
251
+ ]),
252
+ createCommentVNode(" \u5B57\u6BB5\u540D\u79F0 "),
253
+ createElementVNode("span", {
254
+ class: normalizeClass(["width-large title-item", { blue: element.extraField }])
255
+ }, [
256
+ _hoisted_16,
257
+ createElementVNode("span", null, toDisplayString(element.title), 1)
258
+ ], 2),
259
+ createCommentVNode(" \u663E\u793A "),
260
+ createElementVNode("span", _hoisted_17, [
261
+ withDirectives(createVNode(unref(NCheckbox), {
262
+ checked: element.show,
263
+ "onUpdate:checked": ($event) => element.show = $event
264
+ }, null, 8, ["checked", "onUpdate:checked"]), [
265
+ [vShow, element.id != "0001"]
266
+ ])
267
+ ]),
268
+ createCommentVNode(" \u6392\u5E8F "),
269
+ createElementVNode("span", _hoisted_18, [
270
+ withDirectives(createVNode(unref(NCheckbox), {
271
+ checked: element.sort,
272
+ "onUpdate:checked": ($event) => element.sort = $event,
273
+ disabled: element.notParticipatingSort == 1
274
+ }, null, 8, ["checked", "onUpdate:checked", "disabled"]), [
275
+ [vShow, element.id != "0001"]
276
+ ])
277
+ ]),
278
+ createCommentVNode(" \u56FA\u5B9A "),
279
+ createElementVNode("span", _hoisted_19, [
280
+ withDirectives(createElementVNode("select", {
281
+ "onUpdate:modelValue": ($event) => element.fixedWay = $event,
282
+ class: "is-sort-style"
283
+ }, _hoisted_24, 8, _hoisted_20), [
284
+ [vModelSelect, element.fixedWay]
285
+ ])
286
+ ]),
287
+ createCommentVNode(" \u81EA\u5B9A\u4E49\u6807\u9898 "),
288
+ createElementVNode("span", _hoisted_25, [
289
+ withDirectives(createElementVNode("input", {
290
+ "onUpdate:modelValue": ($event) => element.alias = $event,
291
+ class: "alias-style"
292
+ }, null, 8, _hoisted_26), [
293
+ [vShow, element.id != "0001"],
294
+ [vModelText, element.alias]
295
+ ])
296
+ ]),
297
+ createCommentVNode(" \u5217\u5BBD "),
298
+ createElementVNode("span", _hoisted_27, [
299
+ withDirectives(createElementVNode("input", {
300
+ "onUpdate:modelValue": ($event) => element.columnWidth = $event,
301
+ class: "alias-style col-width-style"
302
+ }, null, 8, _hoisted_28), [
303
+ [vModelText, element.columnWidth]
304
+ ])
305
+ ])
306
+ ], 12, _hoisted_12)
307
+ ]),
308
+ _: 1
309
+ }, 8, ["list"])
310
+ ], 2)
311
+ ]),
312
+ props.footerFlag ? (openBlock(), createElementBlock("div", _hoisted_29, [
313
+ createElementVNode("div", _hoisted_30, [
314
+ renderSlot(_ctx.$slots, "footer", {}, () => [
315
+ createVNode(unref(NButton), {
316
+ style: { "margin-right": "8px" },
317
+ onClick: onCancle
318
+ }, {
319
+ default: withCtx(() => [
320
+ _hoisted_31
321
+ ]),
322
+ _: 1
323
+ }),
324
+ createVNode(unref(NButton), {
325
+ type: "primary",
326
+ onClick: handleFieldSave
327
+ }, {
328
+ default: withCtx(() => [
329
+ _hoisted_32
330
+ ]),
331
+ _: 1
332
+ })
333
+ ])
334
+ ])
335
+ ])) : createCommentVNode("v-if", true)
336
+ ])
337
+ ]),
338
+ _: 3
339
+ }, 8, ["show"])
340
+ ], 512);
18
341
  };
19
342
  }
20
343
  });
@@ -17,7 +17,7 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
17
17
  type: PropType<AnyObject[]>;
18
18
  default: () => never[];
19
19
  };
20
- deep: {
20
+ depth: {
21
21
  type: (NumberConstructor | StringConstructor)[];
22
22
  required: true;
23
23
  };
@@ -34,7 +34,7 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
34
34
  type: PropType<AnyObject[]>;
35
35
  default: () => never[];
36
36
  };
37
- deep: {
37
+ depth: {
38
38
  type: (NumberConstructor | StringConstructor)[];
39
39
  required: true;
40
40
  };
@@ -1,8 +1,8 @@
1
1
  import { defineComponent, ref, inject, computed, watch, createVNode } from 'vue';
2
2
  import { isField } from '@formily/core';
3
- import { isObject } from 'lodash-es';
3
+ import { isEqual } from 'lodash-es';
4
4
  import { InjectAsyncQueue } from '../../constants/index.js';
5
- import { assignUpdateValue, formRenderLog, traverseDependKey } from '../../utils/index.js';
5
+ import { assignUpdateValue, traverseDependKey } from '../../utils/index.js';
6
6
  import { connect, mapProps } from '@formily/vue';
7
7
  import { NCascader } from 'naive-ui';
8
8
  import { useFormField } from '../../hooks/useFormField.js';
@@ -14,7 +14,7 @@ const script = defineComponent({
14
14
  type: Array,
15
15
  default: () => []
16
16
  },
17
- deep: {
17
+ depth: {
18
18
  type: [Number, String],
19
19
  required: true
20
20
  },
@@ -32,55 +32,41 @@ const script = defineComponent({
32
32
  slots,
33
33
  emit
34
34
  }) {
35
- const _options = ref(null);
35
+ const remoteOptions = ref(null);
36
36
  const asyncQueue = inject(InjectAsyncQueue);
37
37
  const {
38
38
  field,
39
39
  title
40
40
  } = useFormField();
41
41
  async function fetchData(option) {
42
- if (!option && _options.value)
42
+ if (!option && remoteOptions.value)
43
43
  return;
44
- const config = props.urlConfig;
45
- if (!config)
44
+ if (!configFor(props))
46
45
  return;
47
- if (!isObject(config)) {
48
- formRenderLog(`invalid urlConfig (${config}) in CASCADER => ${title.value}`, "warn");
46
+ if (deepFor(option) + 1 >= deepFor(props))
49
47
  return;
50
- }
51
- if (deepFor(option) + 1 >= props.deep)
52
- return;
53
- let data = await asyncQueue.addAsync({
54
- ...createRequestParams(deepFor(option), config, option),
55
- key: title.value
56
- });
57
- if (!Array.isArray(data)) {
58
- data = [];
59
- }
60
- if (!data.length && isObject(option)) {
48
+ const data = await asyncQueue.addAsync(createRequestParams(deepFor(option), configFor(props), title.value, option));
49
+ if (!data.length && option) {
61
50
  option.isLeaf = true;
62
51
  updateValue(null, null, getOptionChain(option));
63
52
  show.value = false;
64
53
  return;
65
54
  }
66
55
  const result = data.map((item) => optionNormalize(item, deepFor(option)));
67
- option ? option.children = result : _options.value = result;
68
- function deepFor(option2) {
69
- var _a;
70
- return (_a = option2 == null ? void 0 : option2.depth) != null ? _a : -1;
71
- }
72
- function createRequestParams(deep, config2, option2) {
56
+ option ? option.children = result : remoteOptions.value = result;
57
+ function createRequestParams(deep, config, key, option2) {
73
58
  const params = {
74
59
  lvlnr: deep + 1 + ""
75
60
  };
76
- if (option2 && config2.dependKey) {
77
- traverseDependKey(config2.dependKey, (dependKey, valueKey2) => {
61
+ if (option2 && config.dependKey) {
62
+ traverseDependKey(config.dependKey, (dependKey, valueKey2) => {
78
63
  params[valueKey2] = option2[dependKey];
79
64
  });
80
65
  }
81
66
  return {
82
67
  params,
83
- ...config2
68
+ ...config,
69
+ key
84
70
  };
85
71
  }
86
72
  function getOptionChain(option2) {
@@ -92,30 +78,39 @@ const script = defineComponent({
92
78
  }
93
79
  return result2;
94
80
  }
95
- function optionNormalize(data2, deep) {
81
+ function optionNormalize(data2, depth) {
96
82
  return {
97
83
  [labelKey.value]: data2[labelKey.value],
98
84
  [valueKey.value]: data2[valueKey.value],
99
- depth: deep + 1,
85
+ depth: depth + 1,
100
86
  parent: option,
101
- isLeaf: deep + 2 >= props.deep
87
+ isLeaf: depth + 2 >= deepFor(props)
102
88
  };
103
89
  }
90
+ function configFor(target) {
91
+ return target.urlConfig;
92
+ }
93
+ function deepFor(target) {
94
+ var _a;
95
+ return (_a = target == null ? void 0 : target.depth) != null ? _a : -1;
96
+ }
104
97
  }
105
- const renderOptions = computed(() => {
106
- return _options.value || props.options || [];
98
+ const parsedOptions = computed(() => {
99
+ return remoteOptions.value || props.options || [];
107
100
  });
108
101
  watch(() => props.value, (n, o) => {
109
102
  var _a, _b;
110
- if (n != null && o == null) {
111
- fetchData();
112
- }
113
- if (isField(field.value) && field.value.visited) {
114
- (_b = (_a = field.value).validate) == null ? void 0 : _b.call(_a);
115
- }
103
+ n != null && o == null && fetchData();
104
+ isField(field.value) && field.value.visited && ((_b = (_a = field.value).validate) == null ? void 0 : _b.call(_a));
116
105
  }, {
117
106
  immediate: true
118
107
  });
108
+ watch(() => props.urlConfig, async (config, oldConfig) => {
109
+ if (isEqual(config, oldConfig))
110
+ return;
111
+ remoteOptions.value = null;
112
+ await fetchData();
113
+ });
119
114
  const labelKey = computed(() => {
120
115
  var _a, _b;
121
116
  return (_b = (_a = props.urlConfig) == null ? void 0 : _a.nameKey) != null ? _b : "text";
@@ -127,13 +122,11 @@ const script = defineComponent({
127
122
  const _value = computed(() => {
128
123
  try {
129
124
  const parsed = Array.isArray(props.value) ? props.value : JSON.parse(props.value || "");
130
- if (Array.isArray(parsed)) {
131
- return parsed.map((option) => option[labelKey.value]).join(" / ");
132
- } else {
133
- return [];
134
- }
125
+ if (!Array.isArray(parsed) || !parsed.length)
126
+ return null;
127
+ return parsed.map((option) => option[labelKey.value]).join(" / ");
135
128
  } catch (e) {
136
- return "";
129
+ return null;
137
130
  }
138
131
  });
139
132
  function updateValue(_, __, options) {
@@ -168,7 +161,7 @@ const script = defineComponent({
168
161
  "remote": true,
169
162
  "labelField": labelKey.value,
170
163
  "valueField": valueKey.value,
171
- "options": renderOptions.value,
164
+ "options": parsedOptions.value,
172
165
  "checkStrategy": "child",
173
166
  "onLoad": fetchData,
174
167
  "onFocus": focusDecorator(props.onFocus),
@@ -1,9 +1,8 @@
1
- import { defineComponent, ref, inject, computed, watch, nextTick, createVNode } from 'vue';
1
+ import { defineComponent, ref, watch, inject, computed, nextTick, createVNode } from 'vue';
2
2
  import { isField } from '@formily/core';
3
- import { cloneDeep } from 'lodash-es';
3
+ import { isEqual, cloneDeep } from 'lodash-es';
4
4
  import { InjectAsyncQueue, InjectionFormItemDepsCollector, InjectionChangeContextCollector } from '../../constants/index.js';
5
- import { assignUpdateValue, formRenderLog, traverseDependKey } from '../../utils/index.js';
6
- import { isObject } from '@vueuse/core';
5
+ import { assignUpdateValue, traverseDependKey } from '../../utils/index.js';
7
6
  import { connect, mapProps } from '@formily/vue';
8
7
  import { NSelect } from 'naive-ui';
9
8
  import { useFormField } from '../../hooks/useFormField.js';
@@ -32,6 +31,7 @@ const script = defineComponent({
32
31
  emit
33
32
  }) {
34
33
  const remoteOptions = ref(null);
34
+ watch(remoteOptions, (o) => console.log("remoteOption", o));
35
35
  const lastSearch = ref("");
36
36
  const asyncQueue = inject(InjectAsyncQueue);
37
37
  const {
@@ -52,10 +52,6 @@ const script = defineComponent({
52
52
  if (!config) {
53
53
  return remoteOptions.value = null;
54
54
  }
55
- if (!isObject(config)) {
56
- formRenderLog(`invalid urlConfig (${config}) in SELECT => ${title.value}`, "warn");
57
- return remoteOptions.value = null;
58
- }
59
55
  try {
60
56
  remoteOptions.value = await asyncQueue.addAsync({
61
57
  ...createParams(config, field.value),
@@ -86,13 +82,16 @@ const script = defineComponent({
86
82
  return filterOption(props.options, lastSearch.value);
87
83
  });
88
84
  const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
89
- watch(() => props.urlConfig, (config) => {
85
+ watch(() => props.urlConfig, (config, oldConfig) => {
86
+ if (isEqual(config, oldConfig))
87
+ return;
90
88
  remoteOptions.value = null;
91
89
  config && formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], async () => {
92
90
  remoteOptions.value = null;
93
91
  await nextTick();
94
92
  props.value != null && await fetchData();
95
93
  });
94
+ config && fetchData();
96
95
  }, {
97
96
  immediate: true
98
97
  });
@@ -120,7 +120,7 @@ function useAsyncQueue() {
120
120
  const { data, success } = res;
121
121
  if (!success)
122
122
  throw res;
123
- cb(void 0, data);
123
+ cb(void 0, Array.isArray(data) ? data : []);
124
124
  } catch (e) {
125
125
  cb(new Error(`Request error => ${e}`));
126
126
  removeCache();
@@ -80,7 +80,7 @@ function useFieldListAdaptor(collector, uuid) {
80
80
  const schema = createStandardSchema(item);
81
81
  Object.assign(schema["x-component-props"], {
82
82
  urlConfig: item.urlConfig,
83
- deep: (_a = item.wordbook) == null ? void 0 : _a.level_num,
83
+ depth: (_a = item.wordbook) == null ? void 0 : _a.level_num,
84
84
  options: item.option
85
85
  });
86
86
  return schema;
@@ -1,7 +1,7 @@
1
- import { Func } from '../../../../../es/src/types';
1
+ import { ArrayAble, Func } from '../../../../../es/src/types';
2
2
  export declare class FormItemDepsCollector {
3
3
  private readonly collector;
4
- setDeps(key: string, dependKey: string | string[], callback: Func): void;
4
+ setDeps(key: string, dependKeys: ArrayAble<string> | Record<string, string> | ArrayAble<Record<'paramName' | 'paramValue', string>>, callback: Func): void;
5
5
  trigger(dependKey: string, payload?: any): void;
6
6
  }
7
7
  export declare function useFormItemDeps(): {
@@ -1,16 +1,15 @@
1
1
  import { isFunction } from 'lodash-es';
2
- import { arrayed } from '../../../../packages/form-render/src/utils';
2
+ import { traverseDependKey } from '../../../../packages/form-render/src/utils';
3
3
 
4
4
  class FormItemDepsCollector {
5
5
  constructor() {
6
6
  this.collector = /* @__PURE__ */ new Map();
7
7
  }
8
- setDeps(key, dependKey, callback) {
9
- dependKey = arrayed(dependKey);
10
- dependKey.forEach((dependKey2) => {
11
- const map = this.collector.get(dependKey2) || /* @__PURE__ */ new Map();
8
+ setDeps(key, dependKeys, callback) {
9
+ traverseDependKey(dependKeys, (dependKey) => {
10
+ const map = this.collector.get(dependKey) || /* @__PURE__ */ new Map();
12
11
  map.set(key, callback);
13
- this.collector.set(dependKey2, map);
12
+ this.collector.set(dependKey, map);
14
13
  });
15
14
  }
16
15
  trigger(dependKey, payload) {
@@ -1,5 +1,6 @@
1
1
  import { defineComponent, ref, computed, openBlock, createElementBlock, normalizeStyle, unref, createElementVNode, createVNode, normalizeClass } from 'vue';
2
- import InfoEllipsis from '../../../packages/info-header/src/InfoEllipsis.vue';
2
+ import './InfoEllipsis.js';
3
+ import script$1 from './InfoEllipsis.vue_vue_type_script_setup_true_lang.js';
3
4
 
4
5
  const _hoisted_1 = { class: "c-info-header__hidden--content" };
5
6
  var script = /* @__PURE__ */ defineComponent({
@@ -46,7 +47,7 @@ var script = /* @__PURE__ */ defineComponent({
46
47
  style: normalizeStyle(unref(wrapperStyle))
47
48
  }, [
48
49
  createElementVNode("div", _hoisted_1, [
49
- createVNode(InfoEllipsis, {
50
+ createVNode(script$1, {
50
51
  "content-style": unref(parsedContentStyle),
51
52
  content: unref(displayContent),
52
53
  tip: __props.tip