@aplus-frontend/ui 0.5.12 → 0.5.14

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 (77) hide show
  1. package/es/index.mjs +16 -12
  2. package/es/src/ap-button/interface.d.ts +1 -1
  3. package/es/src/ap-descriptions/ap-descriptions.vue.mjs +35 -32
  4. package/es/src/ap-descriptions/formatter/index.mjs +31 -31
  5. package/es/src/ap-field/interface.d.ts +10 -2
  6. package/es/src/ap-field/select/index.vue.d.ts +1 -0
  7. package/es/src/ap-field/select/index.vue.mjs +96 -91
  8. package/es/src/ap-modal/index.mjs +33 -15
  9. package/es/src/ap-modal/utils/confirm.d.ts +17 -0
  10. package/es/src/ap-modal/utils/confirm.mjs +110 -0
  11. package/es/src/ap-modal/utils/createModal.mjs +2 -1
  12. package/es/src/ap-modal/utils/destroyFns.d.ts +2 -0
  13. package/es/src/ap-modal/utils/destroyFns.mjs +4 -0
  14. package/es/src/ap-table/constants.d.ts +3 -0
  15. package/es/src/business/ap-ladder/ApLadder.vue.d.ts +2 -2
  16. package/es/src/business/ap-ladder/index.d.ts +6 -6
  17. package/es/src/config-provider/config-provider.d.ts +11 -0
  18. package/es/src/config-provider/css-var.d.ts +11 -0
  19. package/es/src/config-provider/css-var.mjs +35 -13
  20. package/es/src/config-provider/index.d.ts +55 -0
  21. package/es/src/index.d.ts +1 -0
  22. package/es/src/index.mjs +258 -253
  23. package/es/src/text/context.d.ts +10 -0
  24. package/es/src/text/context.mjs +17 -0
  25. package/es/src/text/group.vue.d.ts +28 -0
  26. package/es/src/text/group.vue.mjs +37 -0
  27. package/es/src/text/group.vue2.mjs +4 -0
  28. package/es/src/text/index.d.ts +4 -0
  29. package/es/src/text/index.mjs +3 -0
  30. package/es/src/text/index.vue.d.ts +34 -0
  31. package/es/src/text/index.vue.mjs +118 -0
  32. package/es/src/text/index.vue2.mjs +4 -0
  33. package/es/src/text/interface.d.ts +47 -0
  34. package/es/src/text/interface.mjs +1 -0
  35. package/lib/index.js +1 -1
  36. package/lib/src/ap-button/interface.d.ts +1 -1
  37. package/lib/src/ap-descriptions/ap-descriptions.vue.js +1 -1
  38. package/lib/src/ap-descriptions/formatter/index.js +1 -1
  39. package/lib/src/ap-field/interface.d.ts +10 -2
  40. package/lib/src/ap-field/select/index.vue.d.ts +1 -0
  41. package/lib/src/ap-field/select/index.vue.js +1 -1
  42. package/lib/src/ap-modal/index.js +1 -1
  43. package/lib/src/ap-modal/utils/confirm.d.ts +17 -0
  44. package/lib/src/ap-modal/utils/confirm.js +1 -0
  45. package/lib/src/ap-modal/utils/createModal.js +1 -1
  46. package/lib/src/ap-modal/utils/destroyFns.d.ts +2 -0
  47. package/lib/src/ap-modal/utils/destroyFns.js +1 -0
  48. package/lib/src/ap-table/constants.d.ts +3 -0
  49. package/lib/src/business/ap-ladder/ApLadder.vue.d.ts +2 -2
  50. package/lib/src/business/ap-ladder/index.d.ts +6 -6
  51. package/lib/src/config-provider/config-provider.d.ts +11 -0
  52. package/lib/src/config-provider/css-var.d.ts +11 -0
  53. package/lib/src/config-provider/css-var.js +1 -1
  54. package/lib/src/config-provider/index.d.ts +55 -0
  55. package/lib/src/index.d.ts +1 -0
  56. package/lib/src/index.js +1 -1
  57. package/lib/src/text/context.d.ts +10 -0
  58. package/lib/src/text/context.js +1 -0
  59. package/lib/src/text/group.vue.d.ts +28 -0
  60. package/lib/src/text/group.vue.js +1 -0
  61. package/lib/src/text/group.vue2.js +1 -0
  62. package/lib/src/text/index.d.ts +4 -0
  63. package/lib/src/text/index.js +1 -0
  64. package/lib/src/text/index.vue.d.ts +34 -0
  65. package/lib/src/text/index.vue.js +1 -0
  66. package/lib/src/text/index.vue2.js +1 -0
  67. package/lib/src/text/interface.d.ts +47 -0
  68. package/lib/src/text/interface.js +1 -0
  69. package/package.json +2 -2
  70. package/theme/ap-descriptions/ap-descriptions.css +3 -0
  71. package/theme/ap-descriptions/ap-descriptions.less +4 -0
  72. package/theme/index.css +61 -0
  73. package/theme/index.less +2 -0
  74. package/theme/text/group.css +14 -0
  75. package/theme/text/group.less +19 -0
  76. package/theme/text/index.css +44 -0
  77. package/theme/text/index.less +49 -0
package/es/index.mjs CHANGED
@@ -117,12 +117,14 @@ import { default as Ut } from "./src/resize-observer/index.vue.mjs";
117
117
  import { default as Vt } from "./src/ap-grid/index.vue.mjs";
118
118
  import { default as _t } from "./src/ap-grid/editable/index.vue.mjs";
119
119
  import { default as $t } from "./src/ap-grid/editable/form-item.vue.mjs";
120
- import { useMessage as qt } from "./src/hooks/useMessage.mjs";
121
- import { useControllableValue as Qt } from "./src/hooks/useControllableValue.mjs";
122
- import { useManualRef as Yt } from "./src/hooks/useManualRef.mjs";
123
- import { useThrottleRef as ep } from "./src/hooks/useThrottleRef.mjs";
124
- import { useFullScreen as rp } from "./src/hooks/useFullScreen.mjs";
125
- import { useResize as pp } from "./src/hooks/useResize.mjs";
120
+ import { default as qt } from "./src/text/index.vue.mjs";
121
+ import { default as Qt } from "./src/text/group.vue.mjs";
122
+ import { useMessage as Yt } from "./src/hooks/useMessage.mjs";
123
+ import { useControllableValue as ep } from "./src/hooks/useControllableValue.mjs";
124
+ import { useManualRef as rp } from "./src/hooks/useManualRef.mjs";
125
+ import { useThrottleRef as pp } from "./src/hooks/useThrottleRef.mjs";
126
+ import { useFullScreen as fp } from "./src/hooks/useFullScreen.mjs";
127
+ import { useResize as lp } from "./src/hooks/useResize.mjs";
126
128
  const a = {
127
129
  install: (r) => {
128
130
  for (const t in o) {
@@ -213,6 +215,8 @@ export {
213
215
  Zo as ApTableModal,
214
216
  So as ApTag,
215
217
  go as ApTagGroup,
218
+ qt as ApText,
219
+ Qt as ApTextGroup,
216
220
  zr as ApTitle,
217
221
  Xo as ApTransformDataHelper,
218
222
  Ro as ApUpload,
@@ -261,20 +265,20 @@ export {
261
265
  l as pathMap,
262
266
  F as provideGlobalConfig,
263
267
  g as translate,
264
- Qt as useControllableValue,
265
- rp as useFullScreen,
268
+ ep as useControllableValue,
269
+ fp as useFullScreen,
266
270
  E as useGetDerivedNamespace,
267
271
  I as useGlobalConfig,
268
272
  D as useLocale,
269
- Yt as useManualRef,
270
- qt as useMessage,
273
+ rp as useManualRef,
274
+ Yt as useMessage,
271
275
  R as useNamespace,
272
276
  jr as usePageListApGrid,
273
277
  Wr as usePageListApTable,
274
- pp as useResize,
278
+ lp as useResize,
275
279
  or as useTableModal,
276
280
  It as useTablePaging,
277
281
  Hr as useTableRefresh,
278
282
  tr as useTableSelectModal,
279
- ep as useThrottleRef
283
+ pp as useThrottleRef
280
284
  };
@@ -13,6 +13,6 @@ export type ApButtonSlots = {
13
13
  };
14
14
  export type ApConfirButtonProps = ApButtonProps & {
15
15
  title: ModalFuncProps['title'];
16
- content: ModalFuncProps['content'];
16
+ content?: ModalFuncProps['content'];
17
17
  confirmProps?: ModalFuncProps;
18
18
  };
@@ -1,13 +1,13 @@
1
- import { defineComponent as T, createElementBlock as i, openBlock as l, normalizeStyle as _, normalizeClass as d, unref as o, createVNode as w, mergeProps as E, withCtx as b, Fragment as p, renderList as M, createBlock as c, createCommentVNode as j, h as u, renderSlot as x, resolveDynamicComponent as z } from "vue";
2
- import { Descriptions as A, DescriptionsItem as m } from "@aplus-frontend/antdv";
3
- import { mixinsAttachmentExtraProps as F, transformValue as G, isEmptyWithType as L } from "./helper.mjs";
1
+ import { defineComponent as B, createElementBlock as i, openBlock as r, normalizeStyle as E, normalizeClass as d, unref as l, createVNode as _, mergeProps as w, withCtx as b, Fragment as p, renderList as M, createBlock as c, createCommentVNode as j, h as u, renderSlot as z, resolveDynamicComponent as A } from "vue";
2
+ import { Descriptions as F, DescriptionsItem as m } from "@aplus-frontend/antdv";
3
+ import { mixinsAttachmentExtraProps as G, transformValue as L, isEmptyWithType as R } from "./helper.mjs";
4
4
  import { get as S } from "lodash-unified";
5
5
  import "./help-message/index.vue.mjs";
6
6
  import "../config-provider/index.mjs";
7
7
  import { useGlobalConfig as f } from "../config-provider/hooks/use-global-config.mjs";
8
- import { useNamespace as R } from "../config-provider/hooks/use-namespace.mjs";
9
- import $ from "./help-message/index.vue2.mjs";
10
- const I = { key: 0 }, Y = /* @__PURE__ */ T({
8
+ import { useNamespace as $ } from "../config-provider/hooks/use-namespace.mjs";
9
+ import I from "./help-message/index.vue2.mjs";
10
+ const O = { key: 0 }, Z = /* @__PURE__ */ B({
11
11
  __name: "ap-descriptions",
12
12
  props: {
13
13
  descriptionsProps: {},
@@ -17,25 +17,28 @@ const I = { key: 0 }, Y = /* @__PURE__ */ T({
17
17
  className: {}
18
18
  },
19
19
  setup(g) {
20
- const n = g, v = f("uiMode", "admin"), C = f("apDescriptions"), k = f("downloadCenterTriggerConfig"), { m: P, b: N, be: D } = R("ap-descriptions"), V = (e = {}) => {
21
- var r;
22
- let s = "";
23
- return ((r = n.descriptionsProps) == null ? void 0 : r.layout) === "vertical" && (s = "start"), {
24
- justifyContent: s,
20
+ const n = g, v = f("uiMode", "admin"), C = f("apDescriptions"), k = f("downloadCenterTriggerConfig"), { m: P, b: N, be: D } = $("ap-descriptions"), T = (e = {}) => {
21
+ var s;
22
+ let o = "";
23
+ return ((s = n.descriptionsProps) == null ? void 0 : s.layout) === "vertical" && (o = "start"), {
24
+ justifyContent: o,
25
25
  ...e
26
26
  };
27
27
  }, y = (e) => {
28
28
  var t, a;
29
- const s = S(n.dataSource, e.field);
29
+ const o = S(n.dataSource, e.field);
30
30
  if (e.customRender)
31
31
  return e.customRender(n.dataSource);
32
- e.valueType === "attachment" && (e.extraProps = F(e.extraProps, {
32
+ e.valueType === "attachment" && (e.extraProps = G(e.extraProps, {
33
33
  fromConfig: (t = C.value) == null ? void 0 : t.downloadFile,
34
34
  fromGlobal: (a = k.value) == null ? void 0 : a.trigger
35
35
  }));
36
- const r = e.format ? e.format(s, n.dataSource || {}) : s;
37
- return G({ value: r, record: n.dataSource }, e);
38
- }, B = (e) => {
36
+ const s = e.format ? e.format(o, n.dataSource || {}) : o;
37
+ return L({ value: s, record: n.dataSource }, e);
38
+ }, V = (e) => {
39
+ var o;
40
+ return e.valueType === "text" && !!((o = e.extraProps) != null && o.ellipsis);
41
+ }, x = (e) => {
39
42
  if (e.visible != null) {
40
43
  if (typeof e.visible == "boolean")
41
44
  return e.visible;
@@ -47,29 +50,29 @@ const I = { key: 0 }, Y = /* @__PURE__ */ T({
47
50
  }
48
51
  return !0;
49
52
  };
50
- return (e, s) => {
51
- var r;
52
- return l(), i("div", {
53
- class: d([e.className, o(N)(), o(P)(o(v))]),
54
- style: _(e.style)
53
+ return (e, o) => {
54
+ var s;
55
+ return r(), i("div", {
56
+ class: d([e.className, l(N)(), l(P)(l(v))]),
57
+ style: E(e.style)
55
58
  }, [
56
- w(o(A), E(e.descriptionsProps, {
57
- "label-style": V({ ...((r = e.descriptionsProps) == null ? void 0 : r.labelStyle) || {} })
59
+ _(l(F), w(e.descriptionsProps, {
60
+ "label-style": T({ ...((s = e.descriptionsProps) == null ? void 0 : s.labelStyle) || {} })
58
61
  }), {
59
62
  default: b(() => [
60
- (l(!0), i(p, null, M(e.schemas, (t, a) => (l(), i(p, {
63
+ (r(!0), i(p, null, M(e.schemas, (t, a) => (r(), i(p, {
61
64
  key: t.field || "empty" + a
62
65
  }, [
63
- t.valueType === "empty" ? (l(), c(o(m), {
66
+ t.valueType === "empty" ? (r(), c(l(m), {
64
67
  key: 0,
65
68
  "content-style": t.contentStyle,
66
69
  "label-style": t.labelStyle,
67
70
  span: t.span
68
- }, null, 8, ["content-style", "label-style", "span"])) : B(t) ? (l(), c(o(m), {
71
+ }, null, 8, ["content-style", "label-style", "span"])) : x(t) ? (r(), c(l(m), {
69
72
  key: 1,
70
- class: d(o(D)("item", "ellipsis")),
73
+ class: d(V(t) ? l(D)("item", "ellipsis") : ""),
71
74
  label: t.label ? u(p, [
72
- u($, {
75
+ u(I, {
73
76
  helpMessage: t.helpMessage,
74
77
  label: t.label
75
78
  })
@@ -79,13 +82,13 @@ const I = { key: 0 }, Y = /* @__PURE__ */ T({
79
82
  "label-style": t.labelStyle
80
83
  }, {
81
84
  default: b(() => [
82
- o(L)(o(S)(e.dataSource, t.field), t) ? (l(), i("span", I, "--")) : (l(), i(p, { key: 1 }, [
83
- t.contentSlotName ? x(e.$slots, t.contentSlotName, {
85
+ l(R)(l(S)(e.dataSource, t.field), t) ? (r(), i("span", O, "--")) : (r(), i(p, { key: 1 }, [
86
+ t.contentSlotName ? z(e.$slots, t.contentSlotName, {
84
87
  key: 0,
85
88
  index: a,
86
89
  item: y(t),
87
90
  record: e.dataSource
88
- }) : (l(), c(z(
91
+ }) : (r(), c(A(
89
92
  u(p, [
90
93
  t.prefix,
91
94
  y(t),
@@ -105,5 +108,5 @@ const I = { key: 0 }, Y = /* @__PURE__ */ T({
105
108
  }
106
109
  });
107
110
  export {
108
- Y as default
111
+ Z as default
109
112
  };
@@ -1,13 +1,13 @@
1
- import { createVNode as p } from "vue";
1
+ import { createVNode as f } from "vue";
2
2
  import { getTimeFormatToZone as g } from "@aplus-frontend/utils";
3
- import { isBoolean as h, merge as f, get as l, debounce as Y } from "lodash-unified";
3
+ import { isBoolean as h, merge as p, get as l, debounce as Y } from "lodash-unified";
4
4
  import { formatString as A } from "./utils.mjs";
5
5
  import { toDecimalMark as b } from "@fruits-chain/utils";
6
6
  import { TypographyParagraph as M } from "@aplus-frontend/antdv";
7
7
  function S({
8
8
  value: t
9
9
  }, n) {
10
- if (!n)
10
+ if (!(n != null && n.ellipsis))
11
11
  return t;
12
12
  const r = {
13
13
  ...n,
@@ -20,7 +20,7 @@ function S({
20
20
  tooltip: t
21
21
  } : !1
22
22
  };
23
- return p(M, r, null);
23
+ return f(M, r, null);
24
24
  }
25
25
  function D({
26
26
  value: t
@@ -28,7 +28,7 @@ function D({
28
28
  var o;
29
29
  const {
30
30
  joinSymbol: r
31
- } = f({
31
+ } = p({
32
32
  joinSymbol: " "
33
33
  }, n);
34
34
  return (o = t == null ? void 0 : t.join) == null ? void 0 : o.call(t, r);
@@ -39,7 +39,7 @@ function u({
39
39
  const {
40
40
  zoneAlias: r,
41
41
  format: o
42
- } = f({
42
+ } = p({
43
43
  zoneAlias: "LA",
44
44
  format: "YYYY-MM-DD HH:mm:ss"
45
45
  }, n);
@@ -51,13 +51,13 @@ function y({
51
51
  }, r) {
52
52
  const {
53
53
  fieldList: o,
54
- templateString: e = "{0}",
55
- formatter: i
56
- } = r, s = (o == null ? void 0 : o.map((m, c) => {
57
- const a = l(n, m);
58
- return i ? i(a, c) : a;
54
+ templateString: i = "{0}",
55
+ formatter: e
56
+ } = r, s = (o == null ? void 0 : o.map((m, a) => {
57
+ const c = l(n, m);
58
+ return e ? e(c, a) : c;
59
59
  })) || [];
60
- return s.length === 0 && s.push(t), A(e, s);
60
+ return s.length === 0 && s.push(t), A(i, s);
61
61
  }
62
62
  function j({
63
63
  value: t,
@@ -65,22 +65,22 @@ function j({
65
65
  }, r) {
66
66
  const {
67
67
  fieldList: o,
68
- format: e = "YYYY-MM-DD HH:mm:ss",
69
- joinSymbol: i = "~",
68
+ format: i = "YYYY-MM-DD HH:mm:ss",
69
+ joinSymbol: e = "~",
70
70
  zoneAlias: s = "LA"
71
- } = r, m = Array.isArray(e) ? e : [e, e];
71
+ } = r, m = Array.isArray(i) ? i : [i, i];
72
72
  return y({
73
73
  value: t,
74
74
  record: n
75
75
  }, {
76
76
  fieldList: o,
77
- templateString: `{0} ${i} {1}`,
78
- formatter(c, a) {
77
+ templateString: `{0} ${e} {1}`,
78
+ formatter(a, c) {
79
79
  return u({
80
- value: c,
80
+ value: a,
81
81
  record: n
82
82
  }, {
83
- format: m[a],
83
+ format: m[c],
84
84
  zoneAlias: s
85
85
  });
86
86
  }
@@ -92,16 +92,16 @@ function k({
92
92
  const {
93
93
  urlPath: r = "url",
94
94
  namePath: o = "name",
95
- style: e,
96
- downloadFile: i,
95
+ style: i,
96
+ downloadFile: e,
97
97
  className: s
98
- } = n, m = l(t, o), c = l(t, r), a = Y(() => {
99
- i == null || i(c, m);
98
+ } = n, m = l(t, o), a = l(t, r), c = Y(() => {
99
+ e == null || e(a, m);
100
100
  }, 500);
101
- return p("span", {
102
- style: e,
101
+ return f("span", {
102
+ style: i,
103
103
  class: [s, "ap-descriptions-item-content__link "],
104
- onClick: a
104
+ onClick: c
105
105
  }, [m]);
106
106
  }
107
107
  function H({
@@ -111,16 +111,16 @@ function H({
111
111
  style: r = {},
112
112
  precision: o
113
113
  } = n;
114
- let e = "";
114
+ let i = "";
115
115
  try {
116
- e = b(t, o);
116
+ i = b(t, o);
117
117
  } catch {
118
- e = t;
118
+ i = t;
119
119
  }
120
- return p("span", {
120
+ return f("span", {
121
121
  style: r,
122
122
  class: "ap-descriptions-item-content__number"
123
- }, [e]);
123
+ }, [i]);
124
124
  }
125
125
  const N = {
126
126
  text: S,
@@ -3,7 +3,7 @@ import { InputFocusOptions } from '@aplus-frontend/antdv/es/vc-input/utils/commo
3
3
  import { ApFormatPresetType } from './date/interface';
4
4
  import { RangeValue } from '@aplus-frontend/antdv/es/vc-picker/interface';
5
5
  import { RangePickerProps } from '@aplus-frontend/antdv/es/date-picker/dayjs';
6
- import { LiteralUnion } from '../type';
6
+ import { LiteralUnion, Recordable } from '../type';
7
7
  import { InputPasswordProps } from './text/input-password-props';
8
8
  import { ZoneAlias } from '@aplus-frontend/utils';
9
9
  export type FieldMode = 'read' | 'edit';
@@ -114,7 +114,7 @@ export type ApFieldDateRangeProps = BasicApFieldProps<Omit<RangePickerProps, 'va
114
114
  };
115
115
  export type ApFieldSelectProps = BasicApFieldProps<Omit<SelectProps, 'mode' | 'value' | 'onUpdate:value' | 'onSearch'>> & {
116
116
  emptyText?: string;
117
- request?: (value?: string) => Promise<SelectProps['options']>;
117
+ request?: (value?: string, extraParams?: Recordable) => Promise<SelectProps['options']>;
118
118
  multiple?: boolean;
119
119
  value?: SelectProps['value'];
120
120
  'onUpdate:value'?: SelectProps['onUpdate:value'];
@@ -134,6 +134,14 @@ export type ApFieldSelectProps = BasicApFieldProps<Omit<SelectProps, 'mode' | 'v
134
134
  * 添加一个名为全部的节点(只在多选的情况下有效)
135
135
  */
136
136
  addAll?: boolean | number;
137
+ /**
138
+ * 发起request额外的请求,变更后会自动重新发器请求
139
+ */
140
+ params?: Recordable;
141
+ /**
142
+ * 发起搜索的时间间隔默认300ms
143
+ */
144
+ searchDelay?: number;
137
145
  };
138
146
  export type ApFieldSelectExpose = {
139
147
  focus: () => void;
@@ -464,6 +464,7 @@ declare const __VLS_component: DefineComponent<ApFieldSelectProps, {
464
464
  emptyText: string;
465
465
  searchMode: "filter" | "request";
466
466
  refetchOnFocus: boolean;
467
+ searchDelay: number;
467
468
  }, {}, {}, {}, string, ComponentProvideOptions, false, {
468
469
  selectRef: CreateComponentPublicInstanceWithMixins<Readonly< ExtractPropTypes<{
469
470
  value: {
@@ -1,12 +1,11 @@
1
- import { defineComponent as z, ref as B, onMounted as D, computed as f, unref as n, createElementBlock as E, createBlock as K, openBlock as C, toDisplayString as H, mergeProps as $, createSlots as j, renderList as W, withCtx as F, renderSlot as Y, normalizeProps as G, guardReactiveProps as J, createVNode as Q } from "vue";
2
- import { debounce as X, isFunction as b, isArray as Z, isNil as ee, omit as te } from "lodash-unified";
3
- import { Select as oe, Spin as le } from "@aplus-frontend/antdv";
1
+ import { defineComponent as z, ref as B, onMounted as E, watch as U, computed as p, unref as a, createElementBlock as K, createBlock as H, openBlock as C, toDisplayString as $, mergeProps as j, createSlots as W, renderList as Y, withCtx as F, renderSlot as G, normalizeProps as J, guardReactiveProps as Q, createVNode as X } from "vue";
2
+ import { debounce as Z, isFunction as b, isArray as ee, isNil as te, omit as oe } from "lodash-unified";
3
+ import { Select as le, Spin as ae } from "@aplus-frontend/antdv";
4
4
  import "../../hooks/index.mjs";
5
- import { omitUndefined as ne } from "../../utils/index.mjs";
6
- import { useDefaultPlaceholder as ae } from "../hooks/use-default-placeholder.mjs";
7
- import { useSelectOptions as re, SELECT_ALL_VALUE_KEY as p } from "./use-select-options.mjs";
5
+ import { useDefaultPlaceholder as ne } from "../hooks/use-default-placeholder.mjs";
6
+ import { useSelectOptions as re, SELECT_ALL_VALUE_KEY as m } from "./use-select-options.mjs";
8
7
  import { useControllableValue as ue } from "../../hooks/useControllableValue.mjs";
9
- const ie = { key: 0 }, ye = /* @__PURE__ */ z({
8
+ const ie = { key: 0 }, he = /* @__PURE__ */ z({
10
9
  name: "ApFieldSelect",
11
10
  __name: "index",
12
11
  props: {
@@ -93,34 +92,34 @@ const ie = { key: 0 }, ye = /* @__PURE__ */ z({
93
92
  searchMode: { default: "filter" },
94
93
  refetchOnFocus: { type: Boolean, default: !1 },
95
94
  lazy: { type: Boolean, default: !1 },
96
- addAll: { type: [Boolean, Number] }
95
+ addAll: { type: [Boolean, Number] },
96
+ params: {},
97
+ searchDelay: { default: 300 }
97
98
  },
98
99
  emits: ["update:value"],
99
100
  setup(N, { expose: O, emit: A }) {
100
101
  let u = 0;
101
- const V = X((e) => {
102
- if (!b(t.request))
102
+ const e = N, V = Z((t) => {
103
+ if (!b(e.request))
103
104
  return;
104
105
  u += 1;
105
106
  const o = u;
106
- s([]), r.value = !0, t.request(e).then((l) => {
107
- u === o && s(l);
108
- }).finally(() => {
109
- r.value = !1;
107
+ s([]), r.value = !0, e.request(t).then((l) => {
108
+ u === o && (s(l), r.value = !1);
110
109
  });
111
- }, 300), t = N, x = (e, o) => {
112
- var a;
113
- const l = ((a = t.fieldNames) == null ? void 0 : a.label) || "label";
114
- return typeof (o == null ? void 0 : o[l]) == "string" && o[l].toLowerCase().indexOf(e.toLowerCase()) > -1;
115
- }, { options: i, updateOptions: s } = re(t), m = B(), r = B((t == null ? void 0 : t.loading) || !1), I = A;
116
- async function v(e = !0) {
117
- if (!b(t.request))
110
+ }, e.searchDelay), x = (t, o) => {
111
+ var n;
112
+ const l = ((n = e.fieldNames) == null ? void 0 : n.label) || "label";
113
+ return typeof (o == null ? void 0 : o[l]) == "string" && o[l].toLowerCase().indexOf(t.toLowerCase()) > -1;
114
+ }, { options: i, updateOptions: s } = re(e), v = B(), r = B((e == null ? void 0 : e.loading) || !1), I = A;
115
+ async function d(t = !0) {
116
+ if (!b(e.request))
118
117
  return;
119
118
  r.value = !0, u += 1;
120
119
  const o = u;
121
120
  try {
122
- e && s([]);
123
- const l = await t.request();
121
+ t && s([]);
122
+ const l = await e.request(void 0, e.params);
124
123
  if (o !== u)
125
124
  return;
126
125
  s(l);
@@ -128,115 +127,121 @@ const ie = { key: 0 }, ye = /* @__PURE__ */ z({
128
127
  r.value = !1;
129
128
  }
130
129
  }
131
- function P(e) {
130
+ function P(t) {
132
131
  var o;
133
- (o = t.onFocus) == null || o.call(t, e), t.refetchOnFocus && u > 0 && !r.value && v(!0);
132
+ (o = e.onFocus) == null || o.call(e, t), e.refetchOnFocus && u > 0 && !r.value && d(!0);
134
133
  }
135
- D(() => {
136
- t.lazy || v();
137
- });
138
- const { value: d, updateValue: h } = ue(t, I), k = ae("Select", t), L = f(() => {
139
- var c, g;
140
- const e = n(d);
141
- if (!e)
142
- return t.emptyText;
143
- const o = ((c = t.fieldNames) == null ? void 0 : c.label) || "label", l = ((g = t.fieldNames) == null ? void 0 : g.value) || "value";
144
- if (Z(e))
145
- return e.map(
134
+ E(() => {
135
+ e.lazy || d();
136
+ }), U(
137
+ () => e.params,
138
+ () => {
139
+ d();
140
+ },
141
+ {
142
+ deep: !0
143
+ }
144
+ );
145
+ const { value: c, updateValue: h } = ue(e, I), k = ne("Select", e), L = p(() => {
146
+ var f, g;
147
+ const t = a(c);
148
+ if (!t)
149
+ return e.emptyText;
150
+ const o = ((f = e.fieldNames) == null ? void 0 : f.label) || "label", l = ((g = e.fieldNames) == null ? void 0 : g.value) || "value";
151
+ if (ee(t))
152
+ return t.map(
146
153
  (y) => {
147
154
  var w;
148
- return (w = n(i).find((U) => U[l] === y)) == null ? void 0 : w[o];
155
+ return (w = a(i).find((R) => R[l] === y)) == null ? void 0 : w[o];
149
156
  }
150
- ).filter(Boolean).join("、") || t.emptyText;
151
- const a = n(i).find(
152
- (y) => y[l] === e
157
+ ).filter(Boolean).join("、") || e.emptyText;
158
+ const n = a(i).find(
159
+ (y) => y[l] === t
153
160
  );
154
- return (a == null ? void 0 : a[o]) || t.emptyText;
155
- }), T = f(() => {
156
- const e = !!(t != null && t.showSearch), o = t.searchMode;
161
+ return (n == null ? void 0 : n[o]) || e.emptyText;
162
+ }), T = p(() => {
163
+ const t = !!(e != null && e.showSearch), o = e.searchMode;
157
164
  let l = {};
158
- return e && (l = o === "request" ? {
165
+ return t && (l = o === "request" ? {
159
166
  showArrow: !1,
160
167
  defaultActiveFirstOption: !1,
161
168
  onSearch: V,
162
169
  notFoundContent: r.value ? void 0 : null
163
170
  } : {
164
171
  showArrow: !0,
165
- filterOption: ee(t == null ? void 0 : t.filterOption) ? x : t == null ? void 0 : t.filterOption
172
+ filterOption: te(e == null ? void 0 : e.filterOption) ? x : e == null ? void 0 : e.filterOption
166
173
  }), {
167
- ...ne(
168
- te(t, [
169
- "mode",
170
- "value",
171
- "onUpdate:value",
172
- "onSearch",
173
- "request",
174
- "searchMode",
175
- "onFocus",
176
- "onBeforeSelect"
177
- ])
178
- ),
179
- placeholder: n(k),
174
+ ...oe(e, [
175
+ "mode",
176
+ "value",
177
+ "onUpdate:value",
178
+ "onSearch",
179
+ "request",
180
+ "searchMode",
181
+ "onFocus",
182
+ "onBeforeSelect"
183
+ ]),
184
+ placeholder: a(k),
180
185
  ...l
181
186
  };
182
- }), S = f(
183
- () => i.value.map((e) => {
187
+ }), S = p(
188
+ () => i.value.map((t) => {
184
189
  var o;
185
- return e[((o = t.fieldNames) == null ? void 0 : o.value) || "value"];
186
- }).filter((e) => e !== p)
187
- ), _ = f(() => {
188
- if (!t.multiple || !t.addAll)
189
- return n(d);
190
+ return t[((o = e.fieldNames) == null ? void 0 : o.value) || "value"];
191
+ }).filter((t) => t !== m)
192
+ ), _ = p(() => {
193
+ if (!e.multiple || !e.addAll)
194
+ return a(c);
190
195
  if (i.value.some(
191
- (e) => {
196
+ (t) => {
192
197
  var o;
193
- return e[((o = t.fieldNames) == null ? void 0 : o.value) || "value"] === p;
198
+ return t[((o = e.fieldNames) == null ? void 0 : o.value) || "value"] === m;
194
199
  }
195
200
  )) {
196
- const e = n(S), o = n(d) || [];
197
- if (e.length && e.every((l) => o == null ? void 0 : o.includes(l)))
198
- return [p];
201
+ const t = a(S), o = a(c) || [];
202
+ if (t.length && t.every((l) => o == null ? void 0 : o.includes(l)))
203
+ return [m];
199
204
  }
200
- return n(d);
205
+ return a(c);
201
206
  });
202
- function q(e) {
203
- return t.multiple && e.includes(p) ? h(n(S)) : h(e);
207
+ function q(t) {
208
+ return e.multiple && t.includes(m) ? h(a(S)) : h(t);
204
209
  }
205
210
  function M() {
206
- var e;
207
- (e = m.value) == null || e.focus();
211
+ var t;
212
+ (t = v.value) == null || t.focus();
208
213
  }
209
- function R() {
210
- var e;
211
- (e = m.value) == null || e.blur();
214
+ function D() {
215
+ var t;
216
+ (t = v.value) == null || t.blur();
212
217
  }
213
218
  return O({
214
219
  focus: M,
215
- blur: R,
216
- request: v
217
- }), (e, o) => e.mode === "read" ? (C(), E("span", ie, H(L.value), 1)) : (C(), K(n(oe), $({
220
+ blur: D,
221
+ request: d
222
+ }), (t, o) => t.mode === "read" ? (C(), K("span", ie, $(L.value), 1)) : (C(), H(a(le), j({
218
223
  key: 1,
219
224
  ref_key: "selectRef",
220
- ref: m,
225
+ ref: v,
221
226
  "allow-clear": ""
222
227
  }, T.value, {
223
- mode: e.multiple ? "multiple" : void 0,
228
+ mode: t.multiple ? "multiple" : void 0,
224
229
  value: _.value,
225
- options: n(i),
230
+ options: a(i),
226
231
  loading: r.value,
227
232
  "onUpdate:value": q,
228
233
  onFocus: P
229
- }), j({ _: 2 }, [
230
- W(e.$slots, (l, a) => ({
231
- name: a,
232
- fn: F((c) => [
233
- Y(e.$slots, a, G(J(c || {})))
234
+ }), W({ _: 2 }, [
235
+ Y(t.$slots, (l, n) => ({
236
+ name: n,
237
+ fn: F((f) => [
238
+ G(t.$slots, n, J(Q(f || {})))
234
239
  ])
235
240
  })),
236
241
  r.value ? {
237
242
  name: "notFoundContent",
238
243
  fn: F(() => [
239
- Q(n(le), { size: "small" })
244
+ X(a(ae), { size: "small" })
240
245
  ]),
241
246
  key: "0"
242
247
  } : void 0
@@ -244,5 +249,5 @@ const ie = { key: 0 }, ye = /* @__PURE__ */ z({
244
249
  }
245
250
  });
246
251
  export {
247
- ye as default
252
+ he as default
248
253
  };