@aplus-frontend/ui 7.16.0 → 7.17.1-beta.0

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 (71) hide show
  1. package/es/index.mjs +285 -281
  2. package/es/src/ap-field/cascader/index.vue.d.ts +60 -0
  3. package/es/src/ap-field/cascader/index.vue.mjs +217 -0
  4. package/es/src/ap-field/cascader/index.vue2.mjs +4 -0
  5. package/es/src/ap-field/cascader/read.vue.d.ts +8 -0
  6. package/es/src/ap-field/cascader/read.vue.mjs +4 -0
  7. package/es/src/ap-field/cascader/read.vue2.mjs +159 -0
  8. package/es/src/ap-field/cascader/use-options.d.ts +25 -0
  9. package/es/src/ap-field/cascader/use-options.mjs +66 -0
  10. package/es/src/ap-field/hooks/use-default-placeholder.d.ts +3 -1
  11. package/es/src/ap-field/hooks/use-default-placeholder.mjs +13 -8
  12. package/es/src/ap-field/index.d.ts +8 -2
  13. package/es/src/ap-field/index.mjs +72 -65
  14. package/es/src/ap-field/interface.d.ts +27 -1
  15. package/es/src/ap-field/select/index.vue.mjs +85 -87
  16. package/es/src/ap-field/tree-select/index.vue.mjs +43 -39
  17. package/es/src/ap-field/tree-select/use-request.mjs +22 -19
  18. package/es/src/ap-form/items/cascader/index.vue.d.ts +435 -0
  19. package/es/src/ap-form/items/cascader/index.vue.mjs +102 -0
  20. package/es/src/ap-form/items/cascader/index.vue2.mjs +4 -0
  21. package/es/src/ap-form/items/index.d.ts +2 -1
  22. package/es/src/ap-form/items/index.mjs +3 -2
  23. package/es/src/ap-form/items/interface.d.ts +6 -1
  24. package/es/src/ap-table/constants.d.ts +269 -4
  25. package/es/src/ap-table/constants.mjs +29 -26
  26. package/es/src/ap-table/interface.d.ts +5 -1
  27. package/es/src/ap-table/utils.d.ts +1 -1
  28. package/es/src/business/ag-grid-modal/interface.d.ts +4 -0
  29. package/es/src/business/ag-grid-modal/modal-layout/index.vue.d.ts +1 -0
  30. package/es/src/business/ag-grid-modal/modal-layout/index.vue2.mjs +25 -21
  31. package/es/src/business/ag-grid-modal/style/index.mjs +1 -1
  32. package/es/src/business/ag-grid-modal/utils.d.ts +1 -0
  33. package/es/src/index.mjs +250 -246
  34. package/es/src/version.d.ts +1 -1
  35. package/es/src/version.mjs +1 -1
  36. package/lib/index.js +1 -1
  37. package/lib/src/ap-field/cascader/index.vue.d.ts +60 -0
  38. package/lib/src/ap-field/cascader/index.vue.js +1 -0
  39. package/lib/src/ap-field/cascader/index.vue2.js +1 -0
  40. package/lib/src/ap-field/cascader/read.vue.d.ts +8 -0
  41. package/lib/src/ap-field/cascader/read.vue.js +1 -0
  42. package/lib/src/ap-field/cascader/read.vue2.js +1 -0
  43. package/lib/src/ap-field/cascader/use-options.d.ts +25 -0
  44. package/lib/src/ap-field/cascader/use-options.js +1 -0
  45. package/lib/src/ap-field/hooks/use-default-placeholder.d.ts +3 -1
  46. package/lib/src/ap-field/hooks/use-default-placeholder.js +1 -1
  47. package/lib/src/ap-field/index.d.ts +8 -2
  48. package/lib/src/ap-field/index.js +1 -1
  49. package/lib/src/ap-field/interface.d.ts +27 -1
  50. package/lib/src/ap-field/select/index.vue.js +1 -1
  51. package/lib/src/ap-field/tree-select/index.vue.js +1 -1
  52. package/lib/src/ap-field/tree-select/use-request.js +1 -1
  53. package/lib/src/ap-form/items/cascader/index.vue.d.ts +435 -0
  54. package/lib/src/ap-form/items/cascader/index.vue.js +1 -0
  55. package/lib/src/ap-form/items/cascader/index.vue2.js +1 -0
  56. package/lib/src/ap-form/items/index.d.ts +2 -1
  57. package/lib/src/ap-form/items/index.js +1 -1
  58. package/lib/src/ap-form/items/interface.d.ts +6 -1
  59. package/lib/src/ap-table/constants.d.ts +269 -4
  60. package/lib/src/ap-table/constants.js +1 -1
  61. package/lib/src/ap-table/interface.d.ts +5 -1
  62. package/lib/src/ap-table/utils.d.ts +1 -1
  63. package/lib/src/business/ag-grid-modal/interface.d.ts +4 -0
  64. package/lib/src/business/ag-grid-modal/modal-layout/index.vue.d.ts +1 -0
  65. package/lib/src/business/ag-grid-modal/modal-layout/index.vue2.js +1 -1
  66. package/lib/src/business/ag-grid-modal/style/index.js +1 -1
  67. package/lib/src/business/ag-grid-modal/utils.d.ts +1 -0
  68. package/lib/src/index.js +1 -1
  69. package/lib/src/version.d.ts +1 -1
  70. package/lib/src/version.js +1 -1
  71. package/package.json +4 -4
@@ -1,3 +1,5 @@
1
+ import "./cascader/index.vue2.mjs";
2
+ import "./cascader/read.vue.mjs";
1
3
  import "./checkbox/index.vue2.mjs";
2
4
  import "./checkbox/read.vue.mjs";
3
5
  import "./date/index.vue2.mjs";
@@ -25,75 +27,80 @@ import "./text-area/read.vue.mjs";
25
27
  import "./tree-select/index.vue2.mjs";
26
28
  import "./tree-select/read.vue.mjs";
27
29
  import "./interface.mjs";
28
- import i from "./second/read.vue2.mjs";
30
+ import i from "./cascader/read.vue2.mjs";
31
+ import r from "./second/read.vue2.mjs";
29
32
  import o from "./text/read-password.vue2.mjs";
30
- import r from "./tree-select/read.vue2.mjs";
31
- import t from "./switch/read.vue2.mjs";
32
- import e from "./select/read.vue2.mjs";
33
- import p from "./checkbox/read.vue2.mjs";
34
- import a from "./radio/read.vue2.mjs";
35
- import f from "./date-range/read.vue2.mjs";
36
- import _ from "./date/read.vue2.mjs";
37
- import c from "./number/read.vue2.mjs";
38
- import s from "./text-area/read.vue2.mjs";
39
- import n from "./text/read.vue2.mjs";
40
- import d from "./second/index.vue.mjs";
41
- import l from "./tree-select/index.vue.mjs";
42
- import $ from "./rate/index.vue.mjs";
43
- import A from "./segmented/index.vue.mjs";
44
- import F from "./slider/index.vue.mjs";
45
- import S from "./switch/index.vue.mjs";
46
- import x from "./select/index.vue.mjs";
47
- import R from "./checkbox/index.vue.mjs";
48
- import T from "./radio/index.vue.mjs";
49
- import b from "./date-range/index.vue.mjs";
50
- import h from "./date/index.vue.mjs";
51
- import g from "./number/index.vue.mjs";
52
- import D from "./text-area/index.vue.mjs";
53
- const gm = {
54
- Text: n,
55
- TextArea: s,
56
- Number: c,
57
- Date: _,
58
- DateRange: f,
59
- Radio: a,
60
- Checkbox: p,
61
- Select: e,
62
- Switch: t,
63
- TreeSelect: r,
33
+ import t from "./tree-select/read.vue2.mjs";
34
+ import e from "./switch/read.vue2.mjs";
35
+ import p from "./select/read.vue2.mjs";
36
+ import a from "./checkbox/read.vue2.mjs";
37
+ import f from "./radio/read.vue2.mjs";
38
+ import _ from "./date-range/read.vue2.mjs";
39
+ import c from "./date/read.vue2.mjs";
40
+ import s from "./number/read.vue2.mjs";
41
+ import n from "./text-area/read.vue2.mjs";
42
+ import d from "./text/read.vue2.mjs";
43
+ import l from "./cascader/index.vue.mjs";
44
+ import $ from "./second/index.vue.mjs";
45
+ import A from "./tree-select/index.vue.mjs";
46
+ import F from "./rate/index.vue.mjs";
47
+ import S from "./segmented/index.vue.mjs";
48
+ import x from "./slider/index.vue.mjs";
49
+ import R from "./switch/index.vue.mjs";
50
+ import T from "./select/index.vue.mjs";
51
+ import b from "./checkbox/index.vue.mjs";
52
+ import h from "./radio/index.vue.mjs";
53
+ import g from "./date-range/index.vue.mjs";
54
+ import C from "./date/index.vue.mjs";
55
+ import D from "./number/index.vue.mjs";
56
+ import k from "./text-area/index.vue.mjs";
57
+ const Nm = {
58
+ Text: d,
59
+ TextArea: n,
60
+ Number: s,
61
+ Date: c,
62
+ DateRange: _,
63
+ Radio: f,
64
+ Checkbox: a,
65
+ Select: p,
66
+ Switch: e,
67
+ TreeSelect: t,
64
68
  Password: o,
65
- Second: i
66
- }, Dm = {
69
+ Second: r,
70
+ Cascader: i
71
+ }, jm = {
67
72
  Text: m,
68
- TextArea: D,
69
- Number: g,
70
- Date: h,
71
- DateRange: b,
72
- Radio: T,
73
- Checkbox: R,
74
- Select: x,
75
- Switch: S,
76
- Slider: F,
77
- Segmented: A,
78
- Rate: $,
79
- TreeSelect: l,
80
- Second: d
73
+ TextArea: k,
74
+ Number: D,
75
+ Date: C,
76
+ DateRange: g,
77
+ Radio: h,
78
+ Checkbox: b,
79
+ Select: T,
80
+ Switch: R,
81
+ Slider: x,
82
+ Segmented: S,
83
+ Rate: F,
84
+ TreeSelect: A,
85
+ Second: $,
86
+ Cascader: l
81
87
  };
82
88
  export {
83
- Dm as ApField,
84
- R as ApFieldCheckbox,
85
- h as ApFieldDate,
86
- b as ApFieldDateRange,
87
- g as ApFieldNumber,
88
- T as ApFieldRadio,
89
- $ as ApFieldRate,
90
- gm as ApFieldRead,
91
- d as ApFieldSecond,
92
- A as ApFieldSegmented,
93
- x as ApFieldSelect,
94
- F as ApFieldSlider,
95
- S as ApFieldSwitch,
89
+ jm as ApField,
90
+ l as ApFieldCascader,
91
+ b as ApFieldCheckbox,
92
+ C as ApFieldDate,
93
+ g as ApFieldDateRange,
94
+ D as ApFieldNumber,
95
+ h as ApFieldRadio,
96
+ F as ApFieldRate,
97
+ Nm as ApFieldRead,
98
+ $ as ApFieldSecond,
99
+ S as ApFieldSegmented,
100
+ T as ApFieldSelect,
101
+ x as ApFieldSlider,
102
+ R as ApFieldSwitch,
96
103
  m as ApFieldText,
97
- D as ApFieldTextArea,
98
- l as ApFieldTreeSelect
104
+ k as ApFieldTextArea,
105
+ A as ApFieldTreeSelect
99
106
  };
@@ -1,5 +1,6 @@
1
- import { InputProps, CheckboxGroupProps, DatePickerProps, InputNumberProps, RadioGroupProps, SwitchProps, TextAreaProps, SelectProps, PopconfirmProps, SliderProps, SegmentedProps, RateProps, TreeSelectProps } from '@aplus-frontend/antdv';
1
+ import { InputProps, CheckboxGroupProps, DatePickerProps, InputNumberProps, RadioGroupProps, SwitchProps, TextAreaProps, SelectProps, PopconfirmProps, SliderProps, SegmentedProps, RateProps, TreeSelectProps, CascaderProps } from '@aplus-frontend/antdv';
2
2
  import { RangePickerProps } from '@aplus-frontend/antdv/es/date-picker/dayjs';
3
+ import { DefaultOptionType } from '@aplus-frontend/antdv/es/select';
3
4
  import { InputFocusOptions } from '@aplus-frontend/antdv/es/vc-input/utils/commonUtils';
4
5
  import { RangeValue } from '@aplus-frontend/antdv/es/vc-picker/interface';
5
6
  import { SharedTimeProps } from '@aplus-frontend/antdv/es/vc-picker/panels/TimePanel';
@@ -287,4 +288,29 @@ export type ApFieldSecondProps = BasicApFieldProps<Omit<InputNumberProps, 'mode'
287
288
  emptyText?: string;
288
289
  };
289
290
  export type ApFieldSecondExpose = ApiFieldNumberExpose;
291
+ export type ApFieldCascaderProps = BasicApFieldProps<Omit<CascaderProps, 'loadData'>> & {
292
+ emptyText?: string;
293
+ /**
294
+ * 手动请求节点数据
295
+ * @param currentNode 当前选中项
296
+ * @param clear 请求数据时是否清空数据
297
+ * @returns
298
+ */
299
+ request?: (selectOptions?: DefaultOptionType[], extraParams?: Recordable) => Promise<CascaderProps['options']>;
300
+ /**
301
+ * 是否跳过首次加载数据
302
+ */
303
+ lazy?: boolean;
304
+ /**
305
+ * 发起request额外的请求,变更后会自动重新发器请求
306
+ */
307
+ params?: Recordable;
308
+ /**
309
+ * 是否动态加载选项
310
+ */
311
+ loadData?: boolean;
312
+ };
313
+ export type ApFieldCascaderExpose = Omit<CommonApFieldExpose, 'request'> & {
314
+ request: (selectOptions?: DefaultOptionType[] | undefined, clear?: boolean) => Promise<void>;
315
+ };
290
316
  export {};
@@ -1,20 +1,20 @@
1
- import { defineComponent as pe, useSlots as fe, ref as k, shallowRef as me, computed as s, onMounted as he, watch as ve, unref as n, createVNode as f, createElementBlock as M, createBlock as C, openBlock as m, toDisplayString as B, mergeProps as ye, h as ge, createSlots as Ce, withCtx as h, createElementVNode as N, normalizeClass as v, createCommentVNode as P, resolveDynamicComponent as T, withModifiers as be, renderList as we, renderSlot as Se, normalizeProps as Fe, guardReactiveProps as Oe } from "vue";
2
- import { Select as ke, Flex as q, Checkbox as L, Spin as Be } from "@aplus-frontend/antdv";
3
- import { debounce as Ne, isFunction as R, isArray as xe, isNil as Ae, omit as z, isNumber as Ve } from "lodash-unified";
1
+ import { defineComponent as de, useSlots as pe, ref as _, shallowRef as fe, computed as s, onMounted as me, watch as he, unref as n, createVNode as f, createElementBlock as M, createBlock as C, openBlock as m, toDisplayString as k, mergeProps as ve, h as ye, createSlots as ge, withCtx as h, createElementVNode as B, normalizeClass as v, createCommentVNode as P, resolveDynamicComponent as D, withModifiers as Ce, renderList as be, renderSlot as Se, normalizeProps as we, guardReactiveProps as Fe } from "vue";
2
+ import { Select as Oe, Flex as T, Checkbox as q, Spin as ke } from "@aplus-frontend/antdv";
3
+ import { debounce as Be, isFunction as L, isArray as Ne, isNil as xe, omit as R, isNumber as Ae } from "lodash-unified";
4
4
  import "../../config-provider/index.mjs";
5
5
  import "../../utils/index.mjs";
6
- import { useDevWarning as Ie } from "../../utils/warning.mjs";
6
+ import { useDevWarning as Ve } from "../../utils/warning.mjs";
7
7
  import "../../hooks/index.mjs";
8
- import { useDefaultPlaceholder as _e } from "../hooks/use-default-placeholder.mjs";
9
- import De from "../style/index.mjs";
8
+ import { useDefaultPlaceholder as Ie } from "../hooks/use-default-placeholder.mjs";
9
+ import _e from "../style/index.mjs";
10
10
  import { useSelectOptions as Me } from "./use-select-options.mjs";
11
- import { isDef as x } from "../../utils/is.mjs";
12
- import { useNamespace as E } from "../../config-provider/hooks/use-namespace.mjs";
11
+ import { isDef as N } from "../../utils/is.mjs";
12
+ import { useNamespace as z } from "../../config-provider/hooks/use-namespace.mjs";
13
13
  import { useLocale as Pe } from "../../config-provider/hooks/use-locale.mjs";
14
- import { useControllableValue as Te } from "../../hooks/useControllableValue.mjs";
15
- const qe = {
14
+ import { useControllableValue as De } from "../../hooks/useControllableValue.mjs";
15
+ const Te = {
16
16
  key: 0
17
- }, Le = ["onClick"], Ze = /* @__PURE__ */ pe({
17
+ }, qe = ["onClick"], Ye = /* @__PURE__ */ de({
18
18
  name: "ApFieldSelect",
19
19
  __name: "index",
20
20
  props: {
@@ -177,41 +177,41 @@ const qe = {
177
177
  }
178
178
  },
179
179
  emits: ["update:value"],
180
- setup(U, {
181
- expose: $,
182
- emit: K
180
+ setup(E, {
181
+ expose: U,
182
+ emit: $
183
183
  }) {
184
184
  let r = 0;
185
- const A = fe(), e = U, {
186
- deprecated: j
187
- } = Ie("ApFieldSelect");
188
- j(!x(e.refetchOnFocus), "refetchOnFocus", "fetchOnFocus");
185
+ const x = pe(), e = E, {
186
+ deprecated: K
187
+ } = Ve("ApFieldSelect");
188
+ K(!N(e.refetchOnFocus), "refetchOnFocus", "fetchOnFocus");
189
189
  const {
190
190
  b
191
- } = E("field-select"), {
191
+ } = z("field-select"), {
192
192
  b: c
193
- } = E("field-select-popup-option"), H = De("field"), V = k(!1), I = k(!1), {
194
- t: _
195
- } = Pe(), W = Ne((t) => {
196
- if (!R(e.request))
193
+ } = z("field-select-popup-option"), j = _e("field"), A = _(!1), {
194
+ t: V
195
+ } = Pe(), H = Be((t) => {
196
+ if (!L(e.request))
197
197
  return;
198
198
  r += 1;
199
199
  const o = r;
200
200
  g([]), u.value = !0, e.request(t).then((l) => {
201
201
  r === o && (g(l), u.value = !1);
202
202
  });
203
- }, e.searchDelay), G = (t, o) => {
203
+ }, e.searchDelay), W = (t, o) => {
204
204
  const l = e.fieldNames?.label || "label";
205
205
  return typeof o?.[l] == "string" && o[l].toLowerCase().indexOf(t.toLowerCase()) > -1;
206
206
  }, {
207
207
  options: d,
208
208
  updateOptions: g
209
- } = Me(e), w = me(), u = k(e?.loading || !1), J = K, Q = s(() => e.fetchOnFocus ?? e.refetchOnFocus), X = s(() => {
209
+ } = Me(e), S = fe(), u = _(e?.loading || !1), G = $, J = s(() => e.fetchOnFocus ?? e.refetchOnFocus), Q = s(() => {
210
210
  if (e.multiple)
211
211
  return e.tokenSeparators ? "tags" : "multiple";
212
212
  });
213
213
  async function y(t = !0) {
214
- if (!R(e.request))
214
+ if (!L(e.request))
215
215
  return;
216
216
  u.value = !0, r += 1;
217
217
  const o = r;
@@ -225,153 +225,151 @@ const qe = {
225
225
  u.value = !1;
226
226
  }
227
227
  }
228
- function Y(t) {
229
- !I.value && r === 0 && e.lazy === "first-focus" ? y() : Q.value && !u.value && y(!0), e.onFocus?.(t), I.value = !0;
228
+ function X(t) {
229
+ !A.value && r === 0 && e.lazy === "first-focus" ? y() : J.value && !u.value && y(!0), e.onFocus?.(t), A.value = !0;
230
230
  }
231
- he(() => {
231
+ me(() => {
232
232
  if (!e.lazy) {
233
233
  y();
234
234
  return;
235
235
  }
236
- }), ve(() => e.params, () => {
236
+ }), he(() => e.params, () => {
237
237
  y();
238
238
  }, {
239
239
  deep: !0
240
240
  });
241
241
  const {
242
242
  value: p,
243
- updateValue: S
244
- } = Te(e, J), Z = _e("Select", e), ee = s(() => {
243
+ updateValue: w
244
+ } = De(e, G), Y = Ie("Select", e), Z = s(() => {
245
245
  const t = n(p);
246
246
  if (!t)
247
247
  return e.emptyText;
248
248
  const o = e.fieldNames?.label || "label", l = e.fieldNames?.value || "value";
249
- return xe(t) ? t.map((a) => n(d).find((de) => de[l] === a)?.[o]).filter(Boolean).join("、") || e.emptyText : n(d).find((a) => a[l] === t)?.[o] || e.emptyText;
250
- }), te = s(() => {
249
+ return Ne(t) ? t.map((a) => n(d).find((ce) => ce[l] === a)?.[o]).filter(Boolean).join("、") || e.emptyText : n(d).find((a) => a[l] === t)?.[o] || e.emptyText;
250
+ }), ee = s(() => {
251
251
  const t = !!e?.showSearch, o = e.searchMode;
252
252
  let l = {};
253
253
  return t && (l = o === "request" ? {
254
254
  defaultActiveFirstOption: !1,
255
- onSearch: W,
255
+ onSearch: H,
256
256
  notFoundContent: u.value ? void 0 : null,
257
257
  filterOption: !1,
258
258
  suffixIcon: null
259
259
  } : {
260
- filterOption: Ae(e?.filterOption) ? G : e?.filterOption
260
+ filterOption: xe(e?.filterOption) ? W : e?.filterOption
261
261
  }), {
262
- ...z(e, ["mode", "value", "onUpdate:value", "onSearch", "request", "searchMode", "onFocus", "onBeforeSelect"]),
263
- placeholder: n(Z),
262
+ ...R(e, ["mode", "value", "onUpdate:value", "onSearch", "request", "searchMode", "onFocus", "onBeforeSelect"]),
263
+ placeholder: n(Y),
264
264
  ...l
265
265
  };
266
- }), oe = s(() => d.value.map((t) => t[e.fieldNames?.value || "value"])), F = s(() => d.value.filter((t) => !t.disabled).map((t) => t[e.fieldNames?.value || "value"])), D = s(() => !e.multiple || x(e.maxCount) ? !1 : Ve(e.addAll) ? oe.value.length >= e.addAll : !!e.addAll), le = s(() => e.multiple && e.allowOnlySelect && (!x(e.maxCount) || e.maxCount >= 1));
267
- function ne() {
268
- w.value?.focus();
266
+ }), te = s(() => d.value.map((t) => t[e.fieldNames?.value || "value"])), F = s(() => d.value.filter((t) => !t.disabled).map((t) => t[e.fieldNames?.value || "value"])), I = s(() => !e.multiple || N(e.maxCount) ? !1 : Ae(e.addAll) ? te.value.length >= e.addAll : !!e.addAll), oe = s(() => e.multiple && e.allowOnlySelect && (!N(e.maxCount) || e.maxCount >= 1));
267
+ function le() {
268
+ S.value?.focus();
269
269
  }
270
- function ae() {
271
- w.value?.blur();
270
+ function ne() {
271
+ S.value?.blur();
272
272
  }
273
273
  function O(t, o) {
274
274
  const l = e.fieldNames?.[o] ?? o;
275
275
  return t[l];
276
276
  }
277
- function se(t) {
277
+ function ae(t) {
278
278
  const o = O(t, "value");
279
- S(e.multiple ? [o] : o), e.onChange?.([o], [t]);
279
+ w(e.multiple ? [o] : o), e.onChange?.([o], [t]);
280
280
  }
281
- function ue(t) {
282
- return A.option ? f("div", {
281
+ function se(t) {
282
+ return x.option ? f("div", {
283
283
  class: c("custom")
284
- }, [A.option(t)]) : f("span", {
284
+ }, [x.option(t)]) : f("span", {
285
285
  class: c("label")
286
286
  }, [O(t, "label")]);
287
287
  }
288
- const re = s(() => {
288
+ const ue = s(() => {
289
289
  const t = n(p) || [], o = F.value;
290
290
  return o.length > 0 && o.every((l) => t.includes(l));
291
- }), ie = s(() => {
291
+ }), re = s(() => {
292
292
  const t = n(p) || [], o = F.value, l = o.filter((i) => t.includes(i)).length;
293
293
  return l > 0 && l < o.length;
294
294
  });
295
- function ce() {
295
+ function ie() {
296
296
  const t = new Set(n(p) || []), o = F.value;
297
297
  o.length > 0 && o.every((a) => t.has(a)) ? o.forEach((a) => t.delete(a)) : o.forEach((a) => t.add(a));
298
298
  const i = d.value.filter((a) => t.has(a[e.fieldNames?.value || "value"]));
299
- S([...t]), e.onChange?.([...t], i);
299
+ w([...t]), e.onChange?.([...t], i);
300
300
  }
301
- return $({
302
- focus: ne,
303
- blur: ae,
301
+ return U({
302
+ focus: le,
303
+ blur: ne,
304
304
  request: y
305
- }), (t, o) => t.mode === "read" ? (m(), M("span", qe, B(ee.value), 1)) : (m(), C(n(ke), ye({
305
+ }), (t, o) => t.mode === "read" ? (m(), M("span", Te, k(Z.value), 1)) : (m(), C(n(Oe), ve({
306
306
  key: 1,
307
307
  ref_key: "selectRef",
308
- ref: w,
308
+ ref: S,
309
309
  "allow-clear": ""
310
- }, te.value, {
311
- mode: X.value,
310
+ }, ee.value, {
311
+ mode: Q.value,
312
312
  value: n(p),
313
313
  options: n(d),
314
314
  loading: u.value,
315
- "menu-item-selected-icon": ge("span"),
316
- "popup-class-name": `${n(b)("popup")} ${n(H)}`,
317
- open: V.value,
318
- "onUpdate:value": n(S),
319
- onFocus: Y,
320
- onDropdownVisibleChange: o[0] || (o[0] = (l) => V.value = l)
321
- }), Ce({
322
- option: h((l) => [N("div", {
315
+ "menu-item-selected-icon": ye("span"),
316
+ "popup-class-name": `${n(b)("popup")} ${n(j)}`,
317
+ "onUpdate:value": n(w),
318
+ onFocus: X
319
+ }), ge({
320
+ option: h((l) => [B("div", {
323
321
  class: v(n(c)("outter"))
324
- }, [f(n(q), {
322
+ }, [f(n(T), {
325
323
  justify: "space-between",
326
324
  align: "center",
327
325
  class: v(n(c)("wrapper")),
328
326
  gap: 8
329
327
  }, {
330
- default: h(() => [f(n(q), {
328
+ default: h(() => [f(n(T), {
331
329
  gap: 8,
332
330
  align: "center",
333
331
  class: v(n(c)("content-wrapper"))
334
332
  }, {
335
- default: h(() => [D.value ? (m(), C(n(L), {
333
+ default: h(() => [I.value ? (m(), C(n(q), {
336
334
  key: 0,
337
335
  checked: n(p)?.includes(O(l, "value"))
338
- }, null, 8, ["checked"])) : P("", !0), (m(), C(T(ue(l))))]),
336
+ }, null, 8, ["checked"])) : P("", !0), (m(), C(D(se(l))))]),
339
337
  _: 2
340
- }, 1032, ["class"]), le.value && !l?.disabled ? (m(), M("span", {
338
+ }, 1032, ["class"]), oe.value && !l?.disabled ? (m(), M("span", {
341
339
  key: 0,
342
340
  class: v(n(c)("action")),
343
- onClick: be(() => se(l), ["stop"])
344
- }, B(n(_)("ap.field.chooseOnly")), 11, Le)) : P("", !0)]),
341
+ onClick: Ce(() => ae(l), ["stop"])
342
+ }, k(n(V)("ap.field.chooseOnly")), 11, qe)) : P("", !0)]),
345
343
  _: 2
346
344
  }, 1032, ["class"])], 2)]),
347
345
  _: 2
348
- }, [we(n(z)(t.$slots, ["option"]), (l, i) => ({
346
+ }, [be(n(R)(t.$slots, ["option"]), (l, i) => ({
349
347
  name: i,
350
- fn: h((a) => [Se(t.$slots, i, Fe(Oe(a || {})))])
348
+ fn: h((a) => [Se(t.$slots, i, we(Fe(a || {})))])
351
349
  })), u.value ? {
352
350
  name: "notFoundContent",
353
- fn: h(() => [f(n(Be), {
351
+ fn: h(() => [f(n(ke), {
354
352
  size: "small"
355
353
  })]),
356
354
  key: "0"
357
- } : void 0, D.value ? {
355
+ } : void 0, I.value ? {
358
356
  name: "dropdownRender",
359
357
  fn: h(({
360
358
  menuNode: l
361
- }) => [N("div", {
359
+ }) => [B("div", {
362
360
  tabindex: -1,
363
361
  class: v(n(b)("popup-all-option")),
364
- onClick: ce
365
- }, [f(n(L), {
366
- checked: re.value,
367
- indeterminate: ie.value
368
- }, null, 8, ["checked", "indeterminate"]), N("span", {
362
+ onClick: ie
363
+ }, [f(n(q), {
364
+ checked: ue.value,
365
+ indeterminate: re.value
366
+ }, null, 8, ["checked", "indeterminate"]), B("span", {
369
367
  class: v(n(b)("popup-all-option-label"))
370
- }, B(n(_)("ap.field.selectAll")), 3)], 2), (m(), C(T(l)))]),
368
+ }, k(n(V)("ap.field.selectAll")), 3)], 2), (m(), C(D(l)))]),
371
369
  key: "1"
372
- } : void 0]), 1040, ["mode", "value", "options", "loading", "menu-item-selected-icon", "popup-class-name", "open", "onUpdate:value"]));
370
+ } : void 0]), 1040, ["mode", "value", "options", "loading", "menu-item-selected-icon", "popup-class-name", "onUpdate:value"]));
373
371
  }
374
372
  });
375
373
  export {
376
- Ze as default
374
+ Ye as default
377
375
  };
@@ -1,13 +1,14 @@
1
- import { isVNode as R, defineComponent as A, useSlots as F, shallowRef as _, computed as E, unref as e, createVNode as d, Fragment as g, createBlock as v, openBlock as S, resolveDynamicComponent as K, mergeProps as U, createSlots as z, renderList as M, withCtx as w, renderSlot as j, normalizeProps as q, guardReactiveProps as O } from "vue";
2
- import { Space as $, Tag as H, TreeSelect as W, Spin as G } from "@aplus-frontend/antdv";
3
- import { isArray as J, omit as Q } from "lodash-unified";
1
+ import { isVNode as A, defineComponent as F, useSlots as _, shallowRef as E, computed as K, unref as e, createVNode as r, Fragment as g, createBlock as S, openBlock as v, resolveDynamicComponent as U, mergeProps as z, createSlots as M, renderList as j, withCtx as w, renderSlot as q, normalizeProps as O, guardReactiveProps as $ } from "vue";
2
+ import { Space as H, Tag as W, TreeSelect as G, Spin as J } from "@aplus-frontend/antdv";
3
+ import { isArray as Q, omit as X } from "lodash-unified";
4
4
  import "../../hooks/index.mjs";
5
- import { useRequest as X } from "./use-request.mjs";
6
- import { useControllableValue as Y } from "../../hooks/useControllableValue.mjs";
7
- function B(r) {
8
- return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !R(r);
5
+ import { useDefaultPlaceholder as Y } from "../hooks/use-default-placeholder.mjs";
6
+ import { useRequest as Z } from "./use-request.mjs";
7
+ import { useControllableValue as ee } from "../../hooks/useControllableValue.mjs";
8
+ function B(d) {
9
+ return typeof d == "function" || Object.prototype.toString.call(d) === "[object Object]" && !A(d);
9
10
  }
10
- const de = /* @__PURE__ */ A({
11
+ const ie = /* @__PURE__ */ F({
11
12
  name: "ApFieldTreeSelect",
12
13
  __name: "index",
13
14
  props: {
@@ -173,80 +174,83 @@ const de = /* @__PURE__ */ A({
173
174
  }
174
175
  },
175
176
  emits: ["update:value"],
176
- setup(r, {
177
- expose: x,
178
- emit: C
177
+ setup(d, {
178
+ expose: C,
179
+ emit: x
179
180
  }) {
180
- const o = r, N = F(), T = C, p = _(), {
181
+ const n = d, N = _(), T = x, p = E(), {
181
182
  value: f,
182
183
  updateValue: b
183
- } = Y(o, T), {
184
+ } = ee(n, T), D = Y("TreeSelect", n), {
184
185
  treeData: c,
185
186
  loading: m,
186
187
  request: y
187
- } = X(o), D = E(() => {
188
+ } = Z(n), V = K(() => {
188
189
  let t;
189
- const u = e(f), i = J(u) ? u : [u].filter(Boolean);
190
+ const u = e(f), i = Q(u) ? u : [u].filter(Boolean);
190
191
  if (!i.length)
191
- return d(g, null, [o.emptyText]);
192
- const n = [], s = o.fieldNames?.label || "label", L = o.fieldNames?.value || "value";
192
+ return r(g, null, [n.emptyText]);
193
+ const o = [], s = n.fieldNames?.label || "label", R = n.fieldNames?.value || "value";
193
194
  function h(a) {
194
195
  for (const l of a) {
195
- if (i.find((P) => P === l[L]) && n.push(l[s]), n.length === i.length)
196
+ if (i.find((L) => L === l[R]) && o.push(l[s]), o.length === i.length)
196
197
  return;
197
198
  l.children?.length && h(l.children);
198
199
  }
199
200
  }
200
- return h(e(c)), n.length ? n.length === 1 ? d("span", null, [n[0]]) : d($, {
201
+ return h(e(c)), o.length ? o.length === 1 ? r("span", null, [o[0]]) : r(H, {
201
202
  size: 4
202
- }, B(t = n.map((a, l) => d(H, {
203
- style: "margin-right: 0px",
203
+ }, B(t = o.map((a, l) => r(W, {
204
+ style: {
205
+ marginRight: 0
206
+ },
204
207
  key: `${a}-${l}`
205
208
  }, B(a) ? a : {
206
209
  default: () => [a]
207
210
  }))) ? t : {
208
211
  default: () => [t]
209
- }) : d(g, null, [o.emptyText]);
212
+ }) : r(g, null, [n.emptyText]);
210
213
  });
211
- function V() {
214
+ function k() {
212
215
  p.value?.focus?.();
213
216
  }
214
- function k() {
217
+ function I() {
215
218
  p.value?.blur?.();
216
219
  }
217
- function I(t) {
220
+ function P(t) {
218
221
  return y(t);
219
222
  }
220
- return x({
223
+ return C({
221
224
  request: y,
222
- focus: V,
223
- blur: k
224
- }), (t, u) => t.mode === "read" ? (S(), v(K(D.value), {
225
+ focus: k,
226
+ blur: I
227
+ }), (t, u) => t.mode === "read" ? (v(), S(U(V.value), {
225
228
  key: 0
226
- })) : (S(), v(e(W), U({
229
+ })) : (v(), S(e(G), z({
227
230
  key: 1
228
- }, e(Q)(o, ["onUpdate:value", "value", "treeData", "loadData"]), {
231
+ }, e(X)(n, ["onUpdate:value", "value", "treeData", "loadData"]), {
229
232
  ref_key: "treeSelectRef",
230
233
  ref: p,
231
234
  value: e(f),
232
235
  "tree-data": e(c),
233
236
  loading: e(m),
234
- "load-data": t.loadData ? I : void 0,
237
+ placeholder: e(D),
238
+ "load-data": t.loadData ? P : void 0,
235
239
  "onUpdate:value": e(b)
236
- }), z({
240
+ }), M({
237
241
  _: 2
238
- }, [M(N, (i, n) => ({
239
- name: n,
240
- fn: w((s) => [j(t.$slots, n, q(O(s || {})))])
242
+ }, [j(N, (i, o) => ({
243
+ name: o,
244
+ fn: w((s) => [q(t.$slots, o, O($(s || {})))])
241
245
  })), e(m) ? {
242
246
  name: "notFoundContent",
243
- fn: w(() => [d(e(G), {
247
+ fn: w(() => [r(e(J), {
244
248
  size: "small"
245
249
  })]),
246
250
  key: "0"
247
- } : void 0]), 1040, ["value", "tree-data", "loading", "load-data", "onUpdate:value"]));
251
+ } : void 0]), 1040, ["value", "tree-data", "loading", "placeholder", "load-data", "onUpdate:value"]));
248
252
  }
249
253
  });
250
254
  export {
251
- de as default
255
+ ie as default
252
256
  };