@aplus-frontend/ui 0.0.34 → 0.0.36

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 (33) hide show
  1. package/es/src/ap-field/date/index.vue.mjs +35 -33
  2. package/es/src/ap-field/date-range/index.vue.mjs +55 -53
  3. package/es/src/ap-field/hooks/use-default-placeholder.d.ts +16 -0
  4. package/es/src/ap-field/hooks/use-default-placeholder.mjs +25 -0
  5. package/es/src/ap-field/interface.d.ts +1 -0
  6. package/es/src/ap-field/number/index.vue.mjs +25 -23
  7. package/es/src/ap-field/select/index.vue.d.ts +2 -0
  8. package/es/src/ap-field/select/index.vue.mjs +63 -53
  9. package/es/src/ap-field/text/index.vue2.mjs +26 -24
  10. package/es/src/ap-field/text/password.vue.mjs +28 -26
  11. package/es/src/ap-field/text-area/index.vue.mjs +15 -13
  12. package/es/src/ap-form/ap-form.vue.d.ts +1 -1
  13. package/es/src/ap-form/ap-form.vue2.mjs +39 -39
  14. package/es/src/ap-form/interface.d.ts +1 -1
  15. package/es/src/ap-table/constants.d.ts +9 -0
  16. package/es/src/ap-table/hooks/use-table-paging.mjs +16 -16
  17. package/lib/src/ap-field/date/index.vue.js +1 -1
  18. package/lib/src/ap-field/date-range/index.vue.js +1 -1
  19. package/lib/src/ap-field/hooks/use-default-placeholder.d.ts +16 -0
  20. package/lib/src/ap-field/hooks/use-default-placeholder.js +1 -0
  21. package/lib/src/ap-field/interface.d.ts +1 -0
  22. package/lib/src/ap-field/number/index.vue.js +1 -1
  23. package/lib/src/ap-field/select/index.vue.d.ts +2 -0
  24. package/lib/src/ap-field/select/index.vue.js +1 -1
  25. package/lib/src/ap-field/text/index.vue2.js +1 -1
  26. package/lib/src/ap-field/text/password.vue.js +1 -1
  27. package/lib/src/ap-field/text-area/index.vue.js +1 -1
  28. package/lib/src/ap-form/ap-form.vue.d.ts +1 -1
  29. package/lib/src/ap-form/ap-form.vue2.js +1 -1
  30. package/lib/src/ap-form/interface.d.ts +1 -1
  31. package/lib/src/ap-table/constants.d.ts +9 -0
  32. package/lib/src/ap-table/hooks/use-table-paging.js +1 -1
  33. package/package.json +1 -1
@@ -1,13 +1,14 @@
1
- import { defineComponent as S, computed as i, unref as t, openBlock as v, createElementBlock as b, Fragment as _, createTextVNode as w, toDisplayString as M, createBlock as R, mergeProps as F, createSlots as A, renderList as x, withCtx as D, renderSlot as E, normalizeProps as V, guardReactiveProps as z } from "vue";
1
+ import { defineComponent as b, computed as i, unref as t, openBlock as v, createElementBlock as _, Fragment as w, createTextVNode as M, toDisplayString as R, createBlock as F, mergeProps as A, createSlots as D, renderList as x, withCtx as E, renderSlot as V, normalizeProps as z, guardReactiveProps as N } from "vue";
2
2
  import r from "dayjs";
3
- import { DatePicker as N } from "ant-design-vue";
4
- import { ApFieldDatePresetFormats as j, PRESET_FORMAT_MAP as I, PRESET_FORMAT_PICK_MAP as H, PRESET_FORMAT_TIME_MAP as U } from "./constant.mjs";
3
+ import { DatePicker as j } from "ant-design-vue";
4
+ import { ApFieldDatePresetFormats as I, PRESET_FORMAT_MAP as H, PRESET_FORMAT_PICK_MAP as U, PRESET_FORMAT_TIME_MAP as K } from "./constant.mjs";
5
5
  import "../../hooks/index.mjs";
6
- import { isNil as y, omit as K } from "lodash-unified";
7
- import { formatDayWithTimezone as $ } from "./helper.mjs";
8
- import { getTimeFormatToZone as L } from "@aplus-frontend/utils";
9
- import { useControllableValue as W } from "../../hooks/useControllableValue.mjs";
10
- const te = /* @__PURE__ */ S({
6
+ import { isNil as y, omit as $ } from "lodash-unified";
7
+ import { formatDayWithTimezone as L } from "./helper.mjs";
8
+ import { getTimeFormatToZone as W } from "@aplus-frontend/utils";
9
+ import { useDefaultPlaceholder as Y } from "../hooks/use-default-placeholder.mjs";
10
+ import { useControllableValue as Z } from "../../hooks/useControllableValue.mjs";
11
+ const le = /* @__PURE__ */ b({
11
12
  name: "ApFieldDate",
12
13
  __name: "index",
13
14
  props: {
@@ -86,19 +87,19 @@ const te = /* @__PURE__ */ S({
86
87
  },
87
88
  emits: ["update:value"],
88
89
  setup(h, { emit: B }) {
89
- const e = h, k = B, { value: m, updateValue: p } = W(e, k), l = i(
90
- () => j.indexOf(e.format) > -1
90
+ const e = h, k = B, { value: p, updateValue: m } = Z(e, k), P = Y("Date", e), l = i(
91
+ () => I.indexOf(e.format) > -1
91
92
  ), d = i(
92
- () => l.value ? I[e.format] : e.format
93
+ () => l.value ? H[e.format] : e.format
93
94
  ), f = i(() => {
94
- if (y(t(m)))
95
+ if (y(t(p)))
95
96
  return;
96
- let o = r(t(m));
97
- return e.timezone && (o = r(L(t(m), e.timezone))), o;
98
- }), g = i(() => t(l) ? e.picker ?? H[e.format] : e.picker), O = i(() => {
99
- const o = t(l) ? U[e.format] : {};
97
+ let o = r(t(p));
98
+ return e.timezone && (o = r(W(t(p), e.timezone))), o;
99
+ }), g = i(() => t(l) ? e.picker ?? U[e.format] : e.picker), O = i(() => {
100
+ const o = t(l) ? K[e.format] : {};
100
101
  return {
101
- ...K(e, [
102
+ ...$(e, [
102
103
  "value",
103
104
  "defaultValue",
104
105
  "onChange",
@@ -107,46 +108,47 @@ const te = /* @__PURE__ */ S({
107
108
  "onUpdate:value",
108
109
  "mode"
109
110
  ]),
111
+ placeholder: t(P),
110
112
  ...o
111
113
  };
112
- }), c = $(e.timezone);
113
- function P(o) {
114
+ }), c = L(e.timezone);
115
+ function C(o) {
114
116
  if (y(o)) {
115
- p(null);
117
+ m(null);
116
118
  return;
117
119
  }
118
120
  const a = r(o);
119
- t(l) ? p(c(a, t(d))) : p(a.valueOf());
121
+ t(l) ? m(c(a, t(d))) : m(a.valueOf());
120
122
  }
121
- function C(o, a) {
123
+ function T(o, a) {
122
124
  var s;
123
125
  const u = r(o), n = o ? t(l) ? c(u, t(d)) : u.valueOf() : null;
124
126
  (s = e.onChange) == null || s.call(e, n, a);
125
127
  }
126
- function T(o) {
128
+ function S(o) {
127
129
  var n;
128
130
  const a = r(o), u = o ? t(l) ? c(a, t(d)) : a.valueOf() : null;
129
131
  (n = e.onOk) == null || n.call(e, u);
130
132
  }
131
- return (o, a) => o.mode === "read" ? (v(), b(_, { key: 0 }, [
132
- w(M(f.value ? t(r)(f.value).format(d.value) : o.emptyText), 1)
133
- ], 64)) : (v(), R(t(N), F({ key: 1 }, O.value, {
133
+ return (o, a) => o.mode === "read" ? (v(), _(w, { key: 0 }, [
134
+ M(R(f.value ? t(r)(f.value).format(d.value) : o.emptyText), 1)
135
+ ], 64)) : (v(), F(t(j), A({ key: 1 }, O.value, {
134
136
  value: f.value,
135
137
  format: d.value,
136
- "onUpdate:value": P,
137
- onChange: C,
138
- onOk: T,
138
+ "onUpdate:value": C,
139
+ onChange: T,
140
+ onOk: S,
139
141
  picker: g.value
140
- }), A({ _: 2 }, [
142
+ }), D({ _: 2 }, [
141
143
  x(o.$slots, (u, n) => ({
142
144
  name: n,
143
- fn: D((s) => [
144
- E(o.$slots, n, V(z(s || {})))
145
+ fn: E((s) => [
146
+ V(o.$slots, n, z(N(s || {})))
145
147
  ])
146
148
  }))
147
149
  ]), 1040, ["value", "format", "picker"]));
148
150
  }
149
151
  });
150
152
  export {
151
- te as default
153
+ le as default
152
154
  };
@@ -1,15 +1,16 @@
1
- import { defineComponent as x, computed as c, unref as t, openBlock as g, createElementBlock as k, Fragment as B, createTextVNode as O, toDisplayString as C, renderSlot as T, createVNode as V, createBlock as I, mergeProps as j, createSlots as U, renderList as H, withCtx as $, normalizeProps as K, guardReactiveProps as L } from "vue";
2
- import { ApFieldDatePresetFormats as W, PRESET_FORMAT_MAP as Y, PRESET_FORMAT_PICK_MAP as Z, PRESET_FORMAT_TIME_MAP as q } from "../date/constant.mjs";
1
+ import { defineComponent as V, computed as c, unref as t, openBlock as h, createElementBlock as k, Fragment as B, createTextVNode as O, toDisplayString as P, renderSlot as T, createVNode as I, createBlock as j, mergeProps as U, createSlots as H, renderList as $, withCtx as K, normalizeProps as L, guardReactiveProps as W } from "vue";
2
+ import { ApFieldDatePresetFormats as Y, PRESET_FORMAT_MAP as Z, PRESET_FORMAT_PICK_MAP as q, PRESET_FORMAT_TIME_MAP as G } from "../date/constant.mjs";
3
3
  import "../../hooks/index.mjs";
4
- import { isNil as S, omit as b, isString as f } from "lodash-unified";
5
- import u from "dayjs";
6
- import { DatePicker as G } from "ant-design-vue";
7
- import { formatDayWithTimezone as J, formatValue as D } from "../date/helper.mjs";
8
- import { SwapRightOutlined as Q } from "@ant-design/icons-vue";
9
- import { omitUndefined as X } from "../../utils/index.mjs";
10
- import { getTimeFormatToZone as M } from "@aplus-frontend/utils";
11
- import { useControllableValue as ee } from "../../hooks/useControllableValue.mjs";
12
- const fe = /* @__PURE__ */ x({
4
+ import { isNil as D, omit as S, isString as f } from "lodash-unified";
5
+ import i from "dayjs";
6
+ import { DatePicker as J } from "ant-design-vue";
7
+ import { formatDayWithTimezone as Q, formatValue as b } from "../date/helper.mjs";
8
+ import { SwapRightOutlined as X } from "@ant-design/icons-vue";
9
+ import { omitUndefined as ee } from "../../utils/index.mjs";
10
+ import { getTimeFormatToZone as R } from "@aplus-frontend/utils";
11
+ import { useDefaultPlaceholder as oe } from "../hooks/use-default-placeholder.mjs";
12
+ import { useControllableValue as te } from "../../hooks/useControllableValue.mjs";
13
+ const ve = /* @__PURE__ */ V({
13
14
  __name: "index",
14
15
  props: {
15
16
  mode: { default: "edit" },
@@ -88,26 +89,26 @@ const fe = /* @__PURE__ */ x({
88
89
  timezone: {}
89
90
  },
90
91
  emits: ["update:value"],
91
- setup(R, { emit: w }) {
92
- const o = R, _ = w, i = c(
93
- () => W.indexOf(o.format) > -1
92
+ setup(M, { emit: w }) {
93
+ const o = M, _ = w, u = c(
94
+ () => Y.indexOf(o.format) > -1
94
95
  ), r = c(
95
- () => i.value ? Y[o.format] : o.format
96
- ), { value: p, updateValue: h } = ee(
96
+ () => u.value ? Z[o.format] : o.format
97
+ ), { value: p, updateValue: g } = te(
97
98
  o,
98
99
  _
99
- ), m = J(o.timezone), v = c(() => {
100
+ ), A = oe("DateRange", o), m = Q(o.timezone), v = c(() => {
100
101
  var l, d;
101
102
  const e = t(p);
102
- if (S(e) || !(e != null && e.length))
103
+ if (D(e) || !(e != null && e.length))
103
104
  return e;
104
- const n = o.timezone ? M(t(p)[0], o.timezone) : (l = t(p)) == null ? void 0 : l[0], a = o.timezone ? M(t(p)[1], o.timezone) : (d = t(p)) == null ? void 0 : d[1];
105
- return [u(n), u(a)];
106
- }), A = c(() => t(i) ? o.picker ?? Z[o.format] : o.picker), F = c(() => {
107
- const e = t(i) ? q[o.format] : {};
105
+ const n = o.timezone ? R(t(p)[0], o.timezone) : (l = t(p)) == null ? void 0 : l[0], a = o.timezone ? R(t(p)[1], o.timezone) : (d = t(p)) == null ? void 0 : d[1];
106
+ return [i(n), i(a)];
107
+ }), F = c(() => t(u) ? o.picker ?? q[o.format] : o.picker), z = c(() => {
108
+ const e = t(u) ? G[o.format] : {};
108
109
  return {
109
- ...X(
110
- b(o, [
110
+ ...ee(
111
+ S(o, [
111
112
  "value",
112
113
  "onUpdate:value",
113
114
  "onChange",
@@ -116,58 +117,59 @@ const fe = /* @__PURE__ */ x({
116
117
  "mode"
117
118
  ])
118
119
  ),
120
+ placeholder: t(A),
119
121
  ...e
120
122
  };
121
123
  });
122
- function z(e) {
124
+ function E(e) {
123
125
  if (!e) {
124
- h(e);
126
+ g(e);
125
127
  return;
126
128
  }
127
- let n = f(e[0]) ? u(e[0]) : e[0], a = f(e[1]) ? u(e[1]) : e[1];
128
- t(i) ? h([
129
+ let n = f(e[0]) ? i(e[0]) : e[0], a = f(e[1]) ? i(e[1]) : e[1];
130
+ t(u) ? g([
129
131
  m(n, t(r)),
130
132
  m(a, t(r), !1)
131
- ]) : h([D(n), D(a)]);
133
+ ]) : g([b(n), b(a)]);
132
134
  }
133
- function E(e) {
135
+ function N(e) {
134
136
  var s;
135
- const n = f(e[0]) ? u(e[0]) : e[0], a = f(e[1]) ? u(e[1]) : e[1], l = e[0] ? t(i) ? m(n, t(r)) : n.valueOf() : null, d = e[1] ? t(i) ? m(a, t(r), !1) : a.valueOf() : null;
137
+ const n = f(e[0]) ? i(e[0]) : e[0], a = f(e[1]) ? i(e[1]) : e[1], l = e[0] ? t(u) ? m(n, t(r)) : n.valueOf() : null, d = e[1] ? t(u) ? m(a, t(r), !1) : a.valueOf() : null;
136
138
  (s = o.onOk) == null || s.call(o, [l, d]);
137
139
  }
138
- function N(e, n) {
139
- var y, P;
140
- if (S(e)) {
140
+ function x(e, n) {
141
+ var y, C;
142
+ if (D(e)) {
141
143
  (y = o.onChange) == null || y.call(o, e, n);
142
144
  return;
143
145
  }
144
- const a = f(e[0]) ? u(e[0]) : e[0], l = f(e[1]) ? u(e[1]) : e[1], d = e[0] ? t(i) ? m(a, t(r)) : a.valueOf() : null, s = e[1] ? t(i) ? m(l, t(r), !1) : l.valueOf() : null;
145
- (P = o.onChange) == null || P.call(o, [d, s], n);
146
+ const a = f(e[0]) ? i(e[0]) : e[0], l = f(e[1]) ? i(e[1]) : e[1], d = e[0] ? t(u) ? m(a, t(r)) : a.valueOf() : null, s = e[1] ? t(u) ? m(l, t(r), !1) : l.valueOf() : null;
147
+ (C = o.onChange) == null || C.call(o, [d, s], n);
146
148
  }
147
149
  return (e, n) => {
148
150
  var a, l;
149
- return e.mode === "read" ? (g(), k(B, { key: 0 }, [
150
- v.value ? (g(), k(B, { key: 0 }, [
151
- O(C((a = v.value[0]) == null ? void 0 : a.format(r.value)) + " ", 1),
151
+ return e.mode === "read" ? (h(), k(B, { key: 0 }, [
152
+ v.value ? (h(), k(B, { key: 0 }, [
153
+ O(P((a = v.value[0]) == null ? void 0 : a.format(r.value)) + " ", 1),
152
154
  T(e.$slots, "readModeSeparator", {}, () => [
153
- V(t(Q))
155
+ I(t(X))
154
156
  ]),
155
- O(" " + C((l = v.value[1]) == null ? void 0 : l.format(r.value)), 1)
156
- ], 64)) : (g(), k(B, { key: 1 }, [
157
- O(C(e.emptyText), 1)
157
+ O(" " + P((l = v.value[1]) == null ? void 0 : l.format(r.value)), 1)
158
+ ], 64)) : (h(), k(B, { key: 1 }, [
159
+ O(P(e.emptyText), 1)
158
160
  ], 64))
159
- ], 64)) : (g(), I(t(G).RangePicker, j({ key: 1 }, F.value, {
161
+ ], 64)) : (h(), j(t(J).RangePicker, U({ key: 1 }, z.value, {
160
162
  value: v.value,
161
- "onUpdate:value": z,
162
- onChange: N,
163
- picker: A.value,
163
+ "onUpdate:value": E,
164
+ onChange: x,
165
+ picker: F.value,
164
166
  format: r.value,
165
- onOk: E
166
- }), U({ _: 2 }, [
167
- H(t(b)(e.$slots, "readModeSeparator"), (d, s) => ({
167
+ onOk: N
168
+ }), H({ _: 2 }, [
169
+ $(t(S)(e.$slots, "readModeSeparator"), (d, s) => ({
168
170
  name: s,
169
- fn: $((y) => [
170
- T(e.$slots, s, K(L(y || {})))
171
+ fn: K((y) => [
172
+ T(e.$slots, s, L(W(y || {})))
171
173
  ])
172
174
  }))
173
175
  ]), 1040, ["value", "picker", "format"]));
@@ -175,5 +177,5 @@ const fe = /* @__PURE__ */ x({
175
177
  }
176
178
  });
177
179
  export {
178
- fe as default
180
+ ve as default
179
181
  };
@@ -0,0 +1,16 @@
1
+ import { ComputedRef } from 'vue';
2
+ import { ApFieldTextPasswordProps, ApFieldTextProps, ApFieldTextAreaProps, ApFieldNumberProps, ApFieldDateProps, ApFieldDateRangeProps, ApFieldSelectProps, BasicApFieldProps } from '../interface';
3
+
4
+ type FieldType = {
5
+ Text: ApFieldTextProps;
6
+ TextArea: ApFieldTextAreaProps;
7
+ Number: ApFieldNumberProps;
8
+ Date: ApFieldDateProps;
9
+ DateRange: ApFieldDateRangeProps;
10
+ Select: ApFieldSelectProps;
11
+ TextPassword: ApFieldTextPasswordProps;
12
+ };
13
+ export declare const useDefaultPlaceholder: <FieldName extends keyof FieldType>(fieldName: FieldName, props: BasicApFieldProps<{
14
+ placeholder?: FieldType[FieldName]['placeholder'];
15
+ }>) => ComputedRef<FieldType[FieldName]["placeholder"] | undefined>;
16
+ export {};
@@ -0,0 +1,25 @@
1
+ import { computed as r } from "vue";
2
+ import "../../config-provider/index.mjs";
3
+ import { isDef as c } from "../../utils/index.mjs";
4
+ import { useLocale as n } from "../../config-provider/hooks/use-locale.mjs";
5
+ const s = ["Select", "Date"], i = [
6
+ "Text",
7
+ "TextArea",
8
+ "Number",
9
+ "TextPassword"
10
+ ], p = (o, t) => {
11
+ const { t: e } = n();
12
+ return r(() => {
13
+ if (c(t.placeholder))
14
+ return t.placeholder;
15
+ if (o === "DateRange")
16
+ return [e("ap.common.chooseText"), e("ap.common.chooseText")];
17
+ if (s.includes(o))
18
+ return e("ap.common.chooseText");
19
+ if (i.includes(o))
20
+ return e("ap.common.inputText");
21
+ });
22
+ };
23
+ export {
24
+ p as useDefaultPlaceholder
25
+ };
@@ -108,6 +108,7 @@ export type ApFieldSelectProps = BasicApFieldProps<Omit<SelectProps, 'mode' | 'v
108
108
  export type ApFieldSelectSlots = {
109
109
  focus: () => void;
110
110
  blur: () => void;
111
+ request: (clear?: boolean) => Promise<void>;
111
112
  };
112
113
  export type ApFieldSliderProps = BasicApFieldProps<SliderProps> & {
113
114
  emptyText?: string;
@@ -1,14 +1,15 @@
1
- import { defineComponent as h, ref as C, computed as x, unref as o, openBlock as r, createElementBlock as n, Fragment as N, normalizeClass as d, renderSlot as s, createCommentVNode as m, createElementVNode as V, toDisplayString as $, createBlock as D, mergeProps as P, createSlots as R, renderList as A, withCtx as I, normalizeProps as U, guardReactiveProps as z } from "vue";
2
- import { InputNumber as E } from "ant-design-vue";
1
+ import { defineComponent as C, ref as N, computed as x, unref as o, openBlock as r, createElementBlock as n, Fragment as D, normalizeClass as d, renderSlot as s, createCommentVNode as m, createElementVNode as P, toDisplayString as V, createBlock as $, mergeProps as R, createSlots as A, renderList as I, withCtx as U, normalizeProps as z, guardReactiveProps as E } from "vue";
2
+ import { InputNumber as F } from "ant-design-vue";
3
3
  import "../../hooks/index.mjs";
4
- import { isNil as F, omit as M } from "lodash-unified";
5
- import { toDecimalMark as T } from "@fruits-chain/utils";
6
- import { addZeroToDecimalPlaces as _ } from "./helper.mjs";
4
+ import { isNil as M, omit as T } from "lodash-unified";
5
+ import { toDecimalMark as _ } from "@fruits-chain/utils";
6
+ import { addZeroToDecimalPlaces as w } from "./helper.mjs";
7
7
  import "../../config-provider/index.mjs";
8
8
  import "./style.css";
9
- import { useNamespace as w } from "../../config-provider/hooks/use-namespace.mjs";
10
- import { useControllableValue as L } from "../../hooks/useControllableValue.mjs";
11
- const Y = /* @__PURE__ */ h({
9
+ import { useDefaultPlaceholder as L } from "../hooks/use-default-placeholder.mjs";
10
+ import { useNamespace as Z } from "../../config-provider/hooks/use-namespace.mjs";
11
+ import { useControllableValue as j } from "../../hooks/useControllableValue.mjs";
12
+ const oe = /* @__PURE__ */ C({
12
13
  name: "ApFieldNumber",
13
14
  __name: "index",
14
15
  props: {
@@ -56,15 +57,15 @@ const Y = /* @__PURE__ */ h({
56
57
  },
57
58
  emits: ["update:value"],
58
59
  setup(f, { expose: c, emit: y }) {
59
- const v = y, { b: i } = w("field-number"), t = f, l = C(), { value: u, updateValue: B } = L(
60
+ const v = y, { b: i } = Z("field-number"), t = f, l = N(), { value: u, updateValue: b } = j(
60
61
  t,
61
62
  v
62
- ), b = x(() => {
63
+ ), B = L("Number", t), h = x(() => {
63
64
  let e = o(u);
64
- if (F(e))
65
+ if (M(e))
65
66
  return t.emptyText;
66
- let a = t.thousands ? T(e, t.precision) : String(e);
67
- return t.precision && t.limitDecimalsRetain && (a = _(a, t.precision)), a;
67
+ let a = t.thousands ? _(e, t.precision) : String(e);
68
+ return t.precision && t.limitDecimalsRetain && (a = w(a, t.precision)), a;
68
69
  });
69
70
  function k() {
70
71
  var e;
@@ -74,35 +75,36 @@ const Y = /* @__PURE__ */ h({
74
75
  var e;
75
76
  (e = l.value) == null || e.blur();
76
77
  }
77
- return c({ focus: k, blur: g }), (e, a) => e.mode === "read" ? (r(), n(N, { key: 0 }, [
78
+ return c({ focus: k, blur: g }), (e, a) => e.mode === "read" ? (r(), n(D, { key: 0 }, [
78
79
  e.$slots.prefix ? (r(), n("span", {
79
80
  key: 0,
80
81
  class: d(o(i)("label-left"))
81
82
  }, [
82
83
  s(e.$slots, "prefix")
83
84
  ], 2)) : m("", !0),
84
- V("span", null, $(b.value), 1),
85
+ P("span", null, V(h.value), 1),
85
86
  e.$slots.addonAfter ? (r(), n("span", {
86
87
  key: 1,
87
88
  class: d(o(i)("label-right"))
88
89
  }, [
89
90
  s(e.$slots, "addonAfter")
90
91
  ], 2)) : m("", !0)
91
- ], 64)) : (r(), D(o(E), P({ key: 1 }, o(M)(t, ["value", "onUpdate:value"]), {
92
+ ], 64)) : (r(), $(o(F), R({ key: 1 }, o(T)(t, ["value", "onUpdate:value"]), {
93
+ placeholder: o(B),
92
94
  value: o(u),
93
- "onUpdate:value": o(B),
95
+ "onUpdate:value": o(b),
94
96
  ref_key: "inputRef",
95
97
  ref: l
96
- }), R({ _: 2 }, [
97
- A(e.$slots, (Z, p) => ({
98
+ }), A({ _: 2 }, [
99
+ I(e.$slots, (q, p) => ({
98
100
  name: p,
99
- fn: I((S) => [
100
- s(e.$slots, p, U(z(S || {})))
101
+ fn: U((S) => [
102
+ s(e.$slots, p, z(E(S || {})))
101
103
  ])
102
104
  }))
103
- ]), 1040, ["value", "onUpdate:value"]));
105
+ ]), 1040, ["placeholder", "value", "onUpdate:value"]));
104
106
  }
105
107
  });
106
108
  export {
107
- Y as default
109
+ oe as default
108
110
  };
@@ -15,6 +15,7 @@ type ApFieldSelectSlots = {
15
15
  optionLabel: any;
16
16
  default: any;
17
17
  };
18
+ declare function requestIfNeeded(clear?: boolean): Promise<void>;
18
19
  declare function focus(): void;
19
20
  declare function blur(): void;
20
21
  declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldSelectProps>, {
@@ -38,6 +39,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
38
39
  }>, {
39
40
  focus: typeof focus;
40
41
  blur: typeof blur;
42
+ request: typeof requestIfNeeded;
41
43
  }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
42
44
  "update:value": (...args: any[]) => void;
43
45
  }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFieldSelectProps>, {
@@ -1,10 +1,11 @@
1
- import { defineComponent as P, ref as c, onMounted as k, computed as p, unref as r, openBlock as m, createElementBlock as A, toDisplayString as M, createBlock as N, mergeProps as O, createSlots as T, renderList as q, withCtx as v, renderSlot as _, normalizeProps as R, guardReactiveProps as U, createVNode as D } from "vue";
2
- import { debounce as L, isFunction as h, isArray as z, isNil as K, omit as H } from "lodash-unified";
3
- import { Select as $, Spin as j } from "ant-design-vue";
1
+ import { defineComponent as k, ref as c, onMounted as q, computed as m, unref as a, openBlock as v, createElementBlock as A, toDisplayString as M, createBlock as O, mergeProps as T, createSlots as _, renderList as R, withCtx as h, renderSlot as D, normalizeProps as U, guardReactiveProps as L, createVNode as z } from "vue";
2
+ import { debounce as K, isFunction as y, isArray as H, isNil as $, omit as j } from "lodash-unified";
3
+ import { Select as E, Spin as W } from "ant-design-vue";
4
4
  import "../../hooks/index.mjs";
5
- import { omitUndefined as E } from "../../utils/index.mjs";
6
- import { useControllableValue as W } from "../../hooks/useControllableValue.mjs";
7
- const G = { key: 0 }, oe = /* @__PURE__ */ P({
5
+ import { omitUndefined as G } from "../../utils/index.mjs";
6
+ import { useDefaultPlaceholder as J } from "../hooks/use-default-placeholder.mjs";
7
+ import { useControllableValue as Q } from "../../hooks/useControllableValue.mjs";
8
+ const X = { key: 0 }, ae = /* @__PURE__ */ k({
8
9
  name: "ApFieldSelect",
9
10
  __name: "index",
10
11
  props: {
@@ -90,61 +91,68 @@ const G = { key: 0 }, oe = /* @__PURE__ */ P({
90
91
  searchMode: { default: "filter" }
91
92
  },
92
93
  emits: ["update:value"],
93
- setup(y, { expose: w, emit: g }) {
94
+ setup(w, { expose: S, emit: g }) {
94
95
  let i = 0;
95
- const S = L((o) => {
96
- if (!h(e.request))
96
+ const B = K((o) => {
97
+ if (!y(e.request))
97
98
  return;
98
99
  i += 1;
99
100
  const t = i;
100
- u.value = [], a.value = !0, e.request(o).then((l) => {
101
- i === t && (u.value = l);
101
+ r.value = [], u.value = !0, e.request(o).then((l) => {
102
+ i === t && (r.value = l);
102
103
  }).finally(() => {
103
- a.value = !1;
104
+ u.value = !1;
104
105
  });
105
- }, 300), e = y, B = (o, t) => {
106
+ }, 300), e = w, b = (o, t) => {
106
107
  var n;
107
108
  const l = ((n = e.fieldNames) == null ? void 0 : n.label) || "label";
108
109
  return typeof (t == null ? void 0 : t.label) == "string" && t[l].indexOf(o) > -1;
109
- }, u = c((e == null ? void 0 : e.options) || []), d = c(), a = c((e == null ? void 0 : e.loading) || !1), b = g;
110
- k(() => {
111
- if (h(e.request)) {
112
- a.value = !0, i += 1;
113
- const o = i;
114
- e.request().then((t) => {
115
- o === i && (u.value = t);
116
- }).finally(() => {
117
- a.value = !1;
118
- });
110
+ }, r = c((e == null ? void 0 : e.options) || []), d = c(), u = c((e == null ? void 0 : e.loading) || !1), C = g;
111
+ async function f(o = !0) {
112
+ if (!y(e.request))
113
+ return;
114
+ u.value = !0, i += 1;
115
+ const t = i;
116
+ try {
117
+ o && (r.value = []);
118
+ const l = await e.request();
119
+ if (t !== i)
120
+ return;
121
+ r.value = l;
122
+ } finally {
123
+ u.value = !1;
119
124
  }
125
+ }
126
+ q(() => {
127
+ f();
120
128
  });
121
- const { value: f, updateValue: C } = W(e, b), x = p(() => {
122
- const o = r(f);
129
+ const { value: p, updateValue: x } = Q(e, C), F = J("Select", e), I = m(() => {
130
+ const o = a(p);
123
131
  if (!o)
124
132
  return e.emptyText;
125
- if (z(o))
133
+ if (H(o))
126
134
  return o.map(
127
135
  (l) => {
128
136
  var n;
129
- return (n = r(u).find((s) => s.value === l)) == null ? void 0 : n.label;
137
+ return (n = a(r).find((s) => s.value === l)) == null ? void 0 : n.label;
130
138
  }
131
139
  ).filter(Boolean).join("、") || e.emptyText;
132
- const t = r(u).find((l) => l.value === o);
140
+ const t = a(r).find((l) => l.value === o);
133
141
  return (t == null ? void 0 : t.label) || e.emptyText;
134
- }), F = p(() => {
142
+ }), P = m(() => {
135
143
  const o = !!(e != null && e.showSearch), t = e.searchMode;
136
144
  let l = {};
137
145
  return o && (l = t === "request" ? {
138
146
  showArrow: !1,
139
147
  defaultActiveFirstOption: !1,
140
- onSearch: S,
141
- notFoundContent: a.value ? void 0 : null
148
+ onSearch: B,
149
+ notFoundContent: u.value ? void 0 : null
142
150
  } : {
143
151
  showArrow: !0,
144
- filterOption: K(e == null ? void 0 : e.filterOption) ? B : e == null ? void 0 : e.filterOption
152
+ filterOption: $(e == null ? void 0 : e.filterOption) ? b : e == null ? void 0 : e.filterOption
145
153
  }), {
146
- ...E(
147
- H(e, [
154
+ ...G(
155
+ j(e, [
148
156
  "mode",
149
157
  "value",
150
158
  "onUpdate:value",
@@ -153,42 +161,44 @@ const G = { key: 0 }, oe = /* @__PURE__ */ P({
153
161
  "searchMode"
154
162
  ])
155
163
  ),
164
+ placeholder: a(F),
156
165
  ...l
157
166
  };
158
167
  });
159
- function I() {
168
+ function V() {
160
169
  var o;
161
170
  (o = d.value) == null || o.focus();
162
171
  }
163
- function V() {
172
+ function N() {
164
173
  var o;
165
174
  (o = d.value) == null || o.blur();
166
175
  }
167
- return w({
168
- focus: I,
169
- blur: V
170
- }), (o, t) => o.mode === "read" ? (m(), A("span", G, M(x.value), 1)) : (m(), N(r($), O({
176
+ return S({
177
+ focus: V,
178
+ blur: N,
179
+ request: f
180
+ }), (o, t) => o.mode === "read" ? (v(), A("span", X, M(I.value), 1)) : (v(), O(a(E), T({
171
181
  key: 1,
172
182
  "allow-clear": "",
173
183
  ref_key: "selectRef",
174
184
  ref: d
175
- }, F.value, {
185
+ }, P.value, {
176
186
  mode: o.multiple ? "multiple" : void 0,
177
- value: r(f),
178
- "onUpdate:value": r(C),
179
- options: u.value,
180
- loading: a.value
181
- }), T({ _: 2 }, [
182
- q(o.$slots, (l, n) => ({
187
+ value: a(p),
188
+ "onUpdate:value": a(x),
189
+ options: r.value,
190
+ loading: u.value
191
+ }), _({ _: 2 }, [
192
+ R(o.$slots, (l, n) => ({
183
193
  name: n,
184
- fn: v((s) => [
185
- _(o.$slots, n, R(U(s || {})))
194
+ fn: h((s) => [
195
+ D(o.$slots, n, U(L(s || {})))
186
196
  ])
187
197
  })),
188
- a.value ? {
198
+ u.value ? {
189
199
  name: "notFoundContent",
190
- fn: v(() => [
191
- D(r(j), { size: "small" })
200
+ fn: h(() => [
201
+ z(a(W), { size: "small" })
192
202
  ]),
193
203
  key: "0"
194
204
  } : void 0
@@ -196,5 +206,5 @@ const G = { key: 0 }, oe = /* @__PURE__ */ P({
196
206
  }
197
207
  });
198
208
  export {
199
- oe as default
209
+ ae as default
200
210
  };