@aplus-frontend/ui 7.13.4 → 7.13.6

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.
@@ -1,15 +1,17 @@
1
- import { defineComponent as Z, ref as V, shallowRef as ee, computed as s, onMounted as oe, watch as te, unref as n, createElementBlock as I, createBlock as k, openBlock as p, toDisplayString as w, mergeProps as le, h as ne, createSlots as ae, withCtx as d, createVNode as C, normalizeClass as f, createCommentVNode as _, createElementVNode as F, withModifiers as re, renderList as se, renderSlot as ue, normalizeProps as ie, guardReactiveProps as de, resolveDynamicComponent as ce } from "vue";
2
- import { Select as pe, Flex as fe, Space as me, Checkbox as M, Spin as ve } from "@aplus-frontend/antdv";
3
- import { debounce as he, isFunction as P, isArray as ye, isNil as ge, omit as we, isNumber as Ce } from "lodash-unified";
1
+ import { defineComponent as te, ref as V, shallowRef as le, computed as r, onMounted as ae, watch as ne, unref as l, createElementBlock as I, createBlock as x, openBlock as f, toDisplayString as C, mergeProps as re, h as se, createSlots as ue, withCtx as c, createVNode as w, normalizeClass as p, createCommentVNode as _, createElementVNode as S, withModifiers as ie, renderList as ce, renderSlot as pe, normalizeProps as de, guardReactiveProps as fe, resolveDynamicComponent as me } from "vue";
2
+ import { Select as ve, Flex as M, Checkbox as P, Spin as he } from "@aplus-frontend/antdv";
3
+ import { debounce as ye, isFunction as D, isArray as ge, isNil as Ce, omit as we, isNumber as Se } from "lodash-unified";
4
4
  import "../../config-provider/index.mjs";
5
+ import "../../utils/index.mjs";
5
6
  import "../../hooks/index.mjs";
6
- import { useDefaultPlaceholder as Se } from "../hooks/use-default-placeholder.mjs";
7
- import be from "../style/index.mjs";
8
- import { useSelectOptions as Be } from "./use-select-options.mjs";
9
- import { useNamespace as ke } from "../../config-provider/hooks/use-namespace.mjs";
10
- import { useLocale as Fe } from "../../config-provider/hooks/use-locale.mjs";
11
- import { useControllableValue as Ne } from "../../hooks/useControllableValue.mjs";
12
- const Oe = { key: 0 }, xe = ["onClick"], ze = /* @__PURE__ */ Z({
7
+ import { useDefaultPlaceholder as be } from "../hooks/use-default-placeholder.mjs";
8
+ import Be from "../style/index.mjs";
9
+ import { useSelectOptions as ke } from "./use-select-options.mjs";
10
+ import { useNamespace as xe } from "../../config-provider/hooks/use-namespace.mjs";
11
+ import { useLocale as Oe } from "../../config-provider/hooks/use-locale.mjs";
12
+ import { useControllableValue as Fe } from "../../hooks/useControllableValue.mjs";
13
+ import { isDef as T } from "../../utils/is.mjs";
14
+ const Ne = { key: 0 }, Ae = ["onClick"], Ke = /* @__PURE__ */ te({
13
15
  name: "ApFieldSelect",
14
16
  __name: "index",
15
17
  props: {
@@ -106,44 +108,44 @@ const Oe = { key: 0 }, xe = ["onClick"], ze = /* @__PURE__ */ Z({
106
108
  allowOnlySelect: { type: Boolean, default: !0 }
107
109
  },
108
110
  emits: ["update:value"],
109
- setup(T, { expose: q, emit: D }) {
110
- let r = 0;
111
- const e = T, { b: u } = ke("field-select"), R = be("field"), N = V(!1), { t: O } = Fe(), L = he((o) => {
112
- if (!P(e.request))
111
+ setup(q, { expose: R, emit: L }) {
112
+ let s = 0;
113
+ const e = q, { b: u } = xe("field-select"), z = Be("field"), O = V(!1), { t: F } = Oe(), U = ye((o) => {
114
+ if (!D(e.request))
113
115
  return;
114
- r += 1;
115
- const l = r;
116
- v([]), a.value = !0, e.request(o).then((t) => {
117
- r === l && (v(t), a.value = !1);
116
+ s += 1;
117
+ const a = s;
118
+ v([]), n.value = !0, e.request(o).then((t) => {
119
+ s === a && (v(t), n.value = !1);
118
120
  });
119
- }, e.searchDelay), z = (o, l) => {
121
+ }, e.searchDelay), $ = (o, a) => {
120
122
  const t = e.fieldNames?.label || "label";
121
- return typeof l?.[t] == "string" && l[t].toLowerCase().indexOf(o.toLowerCase()) > -1;
122
- }, { options: m, updateOptions: v } = Be(e), S = ee(), a = V(e?.loading || !1), U = D, $ = s(() => {
123
+ return typeof a?.[t] == "string" && a[t].toLowerCase().indexOf(o.toLowerCase()) > -1;
124
+ }, { options: m, updateOptions: v } = ke(e), b = le(), n = V(e?.loading || !1), K = L, j = r(() => {
123
125
  if (e.multiple)
124
126
  return e.tokenSeparators ? "tags" : "multiple";
125
127
  });
126
128
  async function h(o = !0) {
127
- if (!P(e.request))
129
+ if (!D(e.request))
128
130
  return;
129
- a.value = !0, r += 1;
130
- const l = r;
131
+ n.value = !0, s += 1;
132
+ const a = s;
131
133
  try {
132
134
  o && v([]);
133
135
  const t = await e.request(void 0, e.params);
134
- if (l !== r)
136
+ if (a !== s)
135
137
  return;
136
138
  v(t);
137
139
  } finally {
138
- a.value = !1;
140
+ n.value = !1;
139
141
  }
140
142
  }
141
- function K(o) {
142
- e.onFocus?.(o), e.refetchOnFocus && r > 0 && !a.value && h(!0);
143
+ function E(o) {
144
+ e.onFocus?.(o), e.refetchOnFocus && s > 0 && !n.value && h(!0);
143
145
  }
144
- oe(() => {
146
+ ae(() => {
145
147
  e.lazy || h();
146
- }), te(
148
+ }), ne(
147
149
  () => e.params,
148
150
  () => {
149
151
  h();
@@ -152,27 +154,27 @@ const Oe = { key: 0 }, xe = ["onClick"], ze = /* @__PURE__ */ Z({
152
154
  deep: !0
153
155
  }
154
156
  );
155
- const { value: i, updateValue: y } = Ne(e, U), j = Se("Select", e), E = s(() => {
156
- const o = n(i);
157
+ const { value: i, updateValue: y } = Fe(e, K), H = be("Select", e), W = r(() => {
158
+ const o = l(i);
157
159
  if (!o)
158
160
  return e.emptyText;
159
- const l = e.fieldNames?.label || "label", t = e.fieldNames?.value || "value";
160
- return ye(o) ? o.map(
161
- (c) => n(m).find((Y) => Y[t] === c)?.[l]
162
- ).filter(Boolean).join("、") || e.emptyText : n(m).find(
163
- (c) => c[t] === o
164
- )?.[l] || e.emptyText;
165
- }), H = s(() => {
166
- const o = !!e?.showSearch, l = e.searchMode;
161
+ const a = e.fieldNames?.label || "label", t = e.fieldNames?.value || "value";
162
+ return ge(o) ? o.map(
163
+ (d) => l(m).find((oe) => oe[t] === d)?.[a]
164
+ ).filter(Boolean).join("、") || e.emptyText : l(m).find(
165
+ (d) => d[t] === o
166
+ )?.[a] || e.emptyText;
167
+ }), G = r(() => {
168
+ const o = !!e?.showSearch, a = e.searchMode;
167
169
  let t = {};
168
- return o && (t = l === "request" ? {
170
+ return o && (t = a === "request" ? {
169
171
  defaultActiveFirstOption: !1,
170
- onSearch: L,
171
- notFoundContent: a.value ? void 0 : null,
172
+ onSearch: U,
173
+ notFoundContent: n.value ? void 0 : null,
172
174
  filterOption: !1,
173
175
  suffixIcon: null
174
176
  } : {
175
- filterOption: ge(e?.filterOption) ? z : e?.filterOption
177
+ filterOption: Ce(e?.filterOption) ? $ : e?.filterOption
176
178
  }), {
177
179
  ...we(e, [
178
180
  "mode",
@@ -184,119 +186,129 @@ const Oe = { key: 0 }, xe = ["onClick"], ze = /* @__PURE__ */ Z({
184
186
  "onFocus",
185
187
  "onBeforeSelect"
186
188
  ]),
187
- placeholder: n(j),
189
+ placeholder: l(H),
188
190
  ...t
189
191
  };
190
- }), g = s(
192
+ }), g = r(
191
193
  () => m.value.map((o) => o[e.fieldNames?.value || "value"])
192
- ), x = s(() => e.multiple ? Ce(e.addAll) ? g.value.length >= e.addAll : !!e.addAll : !1);
193
- function W() {
194
- S.value?.focus();
194
+ ), N = r(() => !e.multiple || T(e.maxCount) ? !1 : Se(e.addAll) ? g.value.length >= e.addAll : !!e.addAll), J = r(
195
+ () => e.multiple && e.allowOnlySelect && (!T(e.maxCount) || e.maxCount >= 1)
196
+ );
197
+ function Q() {
198
+ b.value?.focus();
195
199
  }
196
- function G() {
197
- S.value?.blur();
200
+ function X() {
201
+ b.value?.blur();
198
202
  }
199
- function b(o, l) {
200
- const t = e.fieldNames?.[l] ?? l;
203
+ function B(o, a) {
204
+ const t = e.fieldNames?.[a] ?? a;
201
205
  return o[t];
202
206
  }
203
- function J(o) {
204
- const l = b(o, "value");
205
- y(e.multiple ? [l] : l);
207
+ function Y(o) {
208
+ const a = B(o, "value");
209
+ y(e.multiple ? [a] : a);
206
210
  }
207
- const A = s(() => {
208
- const o = n(i) || [], l = g.value;
209
- return l.length > 0 && l.every((t) => o.includes(t));
210
- }), Q = s(() => (n(i) || []).length > 0 && !A.value);
211
- function X() {
211
+ const A = r(() => {
212
+ const o = l(i) || [], a = g.value;
213
+ return a.length > 0 && a.every((t) => o.includes(t));
214
+ }), Z = r(() => (l(i) || []).length > 0 && !A.value);
215
+ function ee() {
212
216
  console.log("123");
213
- const o = n(i) || [], l = g.value;
214
- l.length && l.every((t) => o?.includes(t)) ? y([]) : y(g.value);
217
+ const o = l(i) || [], a = g.value;
218
+ a.length && a.every((t) => o?.includes(t)) ? y([]) : y(g.value);
215
219
  }
216
- return q({
217
- focus: W,
218
- blur: G,
220
+ return R({
221
+ focus: Q,
222
+ blur: X,
219
223
  request: h
220
- }), (o, l) => o.mode === "read" ? (p(), I("span", Oe, w(E.value), 1)) : (p(), k(n(pe), le({
224
+ }), (o, a) => o.mode === "read" ? (f(), I("span", Ne, C(W.value), 1)) : (f(), x(l(ve), re({
221
225
  key: 1,
222
226
  ref_key: "selectRef",
223
- ref: S,
227
+ ref: b,
224
228
  "allow-clear": ""
225
- }, H.value, {
226
- mode: $.value,
227
- value: n(i),
228
- options: n(m),
229
- loading: a.value,
230
- "menu-item-selected-icon": ne("span"),
231
- "popup-class-name": `${n(u)("popup")} ${n(R)}`,
232
- open: N.value,
233
- "onUpdate:value": n(y),
234
- onFocus: K,
235
- onDropdownVisibleChange: l[0] || (l[0] = (t) => N.value = t)
236
- }), ae({
237
- option: d((t) => [
238
- C(n(fe), {
229
+ }, G.value, {
230
+ mode: j.value,
231
+ value: l(i),
232
+ options: l(m),
233
+ loading: n.value,
234
+ "menu-item-selected-icon": se("span"),
235
+ "popup-class-name": `${l(u)("popup")} ${l(z)}`,
236
+ open: O.value,
237
+ virtual: !1,
238
+ "onUpdate:value": l(y),
239
+ onFocus: E,
240
+ onDropdownVisibleChange: a[0] || (a[0] = (t) => O.value = t)
241
+ }), ue({
242
+ option: c((t) => [
243
+ w(l(M), {
239
244
  justify: "space-between",
240
245
  align: "center",
241
- class: f(n(u)("popup-option-wrapper")),
246
+ class: p(l(u)("popup-option-wrapper")),
242
247
  gap: 8
243
248
  }, {
244
- default: d(() => [
245
- C(n(me), null, {
246
- default: d(() => [
247
- x.value ? (p(), k(n(M), {
249
+ default: c(() => [
250
+ w(l(M), {
251
+ gap: 8,
252
+ align: "center"
253
+ }, {
254
+ default: c(() => [
255
+ N.value ? (f(), x(l(P), {
248
256
  key: 0,
249
- checked: n(i)?.includes(
250
- b(t, "value")
257
+ checked: l(i)?.includes(
258
+ B(t, "value")
251
259
  )
252
260
  }, null, 8, ["checked"])) : _("", !0),
253
- F("span", {
254
- class: f(n(u)("popup-option-label"))
255
- }, w(b(t, "label")), 3)
261
+ S("span", {
262
+ class: p(l(u)("popup-option-label"))
263
+ }, C(B(t, "label")), 3)
256
264
  ]),
257
265
  _: 2
258
266
  }, 1024),
259
- o.multiple && o.allowOnlySelect ? (p(), I("span", {
267
+ J.value ? (f(), I("span", {
260
268
  key: 0,
261
- class: f(n(u)("popup-option-action")),
262
- onClick: re(() => J(t), ["stop"])
263
- }, w(n(O)("ap.field.chooseOnly")), 11, xe)) : _("", !0)
269
+ class: p(l(u)("popup-option-action")),
270
+ onClick: ie(() => Y(t), ["stop"])
271
+ }, C(l(F)("ap.field.chooseOnly")), 11, Ae)) : _("", !0)
264
272
  ]),
265
273
  _: 2
266
274
  }, 1032, ["class"])
267
275
  ]),
268
276
  _: 2
269
277
  }, [
270
- se(o.$slots, (t, B) => ({
271
- name: B,
272
- fn: d((c) => [
273
- ue(o.$slots, B, ie(de(c || {})))
278
+ ce(o.$slots, (t, k) => ({
279
+ name: k,
280
+ fn: c((d) => [
281
+ pe(o.$slots, k, de(fe(d || {})))
274
282
  ])
275
283
  })),
276
- a.value ? {
284
+ n.value ? {
277
285
  name: "notFoundContent",
278
- fn: d(() => [
279
- C(n(ve), { size: "small" })
286
+ fn: c(() => [
287
+ w(l(he), { size: "small" })
280
288
  ]),
281
289
  key: "0"
282
290
  } : void 0,
283
- x.value ? {
291
+ N.value ? {
284
292
  name: "dropdownRender",
285
- fn: d(({ menuNode: t }) => [
286
- F("div", {
287
- tabindex: -1,
288
- class: f(n(u)("popup-all-option")),
289
- onClick: X
293
+ fn: c(({ menuNode: t }) => [
294
+ S("div", {
295
+ class: p(l(u)("popup-all-option-wrapper"))
290
296
  }, [
291
- C(n(M), {
292
- checked: A.value,
293
- indeterminate: Q.value
294
- }, null, 8, ["checked", "indeterminate"]),
295
- F("span", {
296
- class: f(n(u)("popup-all-option-label"))
297
- }, w(n(O)("ap.field.selectAll")), 3)
297
+ S("div", {
298
+ tabindex: -1,
299
+ class: p(l(u)("popup-all-option")),
300
+ onClick: ee
301
+ }, [
302
+ w(l(P), {
303
+ checked: A.value,
304
+ indeterminate: Z.value
305
+ }, null, 8, ["checked", "indeterminate"]),
306
+ S("span", {
307
+ class: p(l(u)("popup-all-option-label"))
308
+ }, C(l(F)("ap.field.selectAll")), 3)
309
+ ], 2)
298
310
  ], 2),
299
- (p(), k(ce(t)))
311
+ (f(), x(me(t)))
300
312
  ]),
301
313
  key: "1"
302
314
  } : void 0
@@ -304,5 +316,5 @@ const Oe = { key: 0 }, xe = ["onClick"], ze = /* @__PURE__ */ Z({
304
316
  }
305
317
  });
306
318
  export {
307
- ze as default
319
+ Ke as default
308
320
  };
@@ -1,27 +1,32 @@
1
1
  import { singleRow as l } from "../../style/index.mjs";
2
2
  const n = (i) => {
3
- const { componentCls: p } = i, o = `${p}-select-popup`;
3
+ const { componentCls: a } = i, p = `${a}-select-popup`;
4
4
  return {
5
- [`${o}`]: {
6
- padding: i.space,
7
- [`${o}-all-option`]: {
5
+ [`${p}`]: {
6
+ // padding: token.space,
7
+ padding: 0,
8
+ [`${p}-all-option-wrapper`]: {
9
+ padding: i.space,
10
+ paddingBlockEnd: i.spaceXS
11
+ },
12
+ [`${p}-all-option`]: {
8
13
  width: "100%",
9
14
  display: "inline-flex",
10
15
  cursor: "pointer",
11
16
  paddingInline: i.space,
12
17
  paddingBlock: i.spaceSM,
13
- [`${o}-all-option-label`]: {
18
+ [`${p}-all-option-label`]: {
14
19
  paddingInline: i.space
15
20
  }
16
21
  },
17
- [`${o}-option-wrapper`]: {
22
+ [`${p}-option-wrapper`]: {
18
23
  height: "22px"
19
24
  },
20
- [`${o}-option-label`]: {
25
+ [`${p}-option-label`]: {
21
26
  ...l(i),
22
27
  color: "inherit"
23
28
  },
24
- [`${o}-option-action`]: {
29
+ [`${p}-option-action`]: {
25
30
  display: "none",
26
31
  color: i.colorPrimary,
27
32
  paddingInline: i.spaceSM,
@@ -37,16 +42,14 @@ const n = (i) => {
37
42
  paddingBlock: i.spaceXS,
38
43
  fontWeight: "normal !important",
39
44
  marginBottom: i.spaceXS,
45
+ marginInline: i.space,
40
46
  "&:hover": {
41
- [`${o}-option-action`]: {
47
+ [`${p}-option-action`]: {
42
48
  display: "inline"
43
49
  }
44
50
  },
45
51
  "&:last-child": {
46
- marginBottom: 0
47
- },
48
- "&.ant-select-item-option-selected:not(.ant-select-item-option-disabled)": {
49
- color: i.colorPrimary
52
+ marginBottom: i.space
50
53
  }
51
54
  }
52
55
  }
@@ -1,2 +1,2 @@
1
- declare const _default: "7.13.4";
1
+ declare const _default: "7.13.6";
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- const e = "7.13.4";
1
+ const e = "7.13.6";
2
2
  export {
3
3
  e as default
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c=require("@aplus-frontend/antdv"),r=require("lodash-unified");require("../../config-provider/index.js");require("../../hooks/index.js");const U=require("../hooks/use-default-placeholder.js"),$=require("../style/index.js"),j=require("./use-select-options.js"),K=require("../../config-provider/hooks/use-namespace.js"),H=require("../../config-provider/hooks/use-locale.js"),W=require("../../hooks/useControllableValue.js"),G={key:0},J=["onClick"],Q=e.defineComponent({name:"ApFieldSelect",__name:"index",props:{mode:{default:"edit"},class:{},style:{},defaultValue:{},notFoundContent:{},suffixIcon:{},itemIcon:{},size:{},bordered:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:void 0},variant:{},maxCount:{},transitionName:{},choiceTransitionName:{},popupClassName:{},dropdownClassName:{},placement:{},status:{},children:{},listHeight:{},onMouseenter:{},onMouseleave:{},tabindex:{},onClick:{},onFocus:{},onBlur:{},onChange:{},onKeydown:{},onKeyup:{},onMousedown:{},onSelect:{},open:{type:Boolean,default:void 0},animation:{},direction:{},disabled:{type:Boolean,default:void 0},prefixCls:{},id:{},autofocus:{type:Boolean,default:void 0},getPopupContainer:{},virtual:{type:Boolean,default:void 0},dropdownMatchSelectWidth:{},placeholder:{},loading:{type:Boolean,default:void 0},prefix:{},clearIcon:{},allowClear:{type:Boolean,default:!0},fieldNames:{},inputValue:{},searchValue:{},autoClearSearchValue:{type:Boolean,default:void 0},onDeselect:{},onActive:{},filterOption:{},filterSort:{},optionFilterProp:{},optionLabelProp:{},options:{},defaultActiveFirstOption:{type:Boolean,default:void 0},listItemHeight:{},onClickOption:{},menuItemSelectedIcon:{},labelInValue:{type:Boolean,default:void 0},showSearch:{type:Boolean,default:void 0},tagRender:{},optionLabelRender:{},onClear:{},defaultOpen:{type:Boolean,default:void 0},onDropdownVisibleChange:{},maxTagTextLength:{},maxTagCount:{},maxTagPlaceholder:{},tokenSeparators:{},removeIcon:{},dropdownStyle:{},dropdownRender:{},dropdownAlign:{},showAction:{},onPopupScroll:{},onInputKeyDown:{},emptyText:{default:"--"},request:{},multiple:{type:Boolean,default:void 0},value:{},"onUpdate:value":{},searchMode:{default:"filter"},refetchOnFocus:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},addAll:{type:[Boolean,Number],default:5},params:{},searchDelay:{default:300},allowOnlySelect:{type:Boolean,default:!0}},emits:["update:value"],setup(B,{expose:N,emit:x}){let u=0;const o=B,{b:s}=K.useNamespace("field-select"),O=$.default("field"),w=e.ref(!1),{t:S}=H.useLocale(),V=r.debounce(t=>{if(!r.isFunction(o.request))return;u+=1;const n=u;f([]),a.value=!0,o.request(t).then(l=>{u===n&&(f(l),a.value=!1)})},o.searchDelay),F=(t,n)=>{const l=o.fieldNames?.label||"label";return typeof n?.[l]=="string"&&n[l].toLowerCase().indexOf(t.toLowerCase())>-1},{options:p,updateOptions:f}=j.useSelectOptions(o),y=e.shallowRef(),a=e.ref(o?.loading||!1),q=x,A=e.computed(()=>{if(o.multiple)return o.tokenSeparators?"tags":"multiple"});async function m(t=!0){if(!r.isFunction(o.request))return;a.value=!0,u+=1;const n=u;try{t&&f([]);const l=await o.request(void 0,o.params);if(n!==u)return;f(l)}finally{a.value=!1}}function I(t){o.onFocus?.(t),o.refetchOnFocus&&u>0&&!a.value&&m(!0)}e.onMounted(()=>{o.lazy||m()}),e.watch(()=>o.params,()=>{m()},{deep:!0});const{value:i,updateValue:v}=W.useControllableValue(o,q),_=U.useDefaultPlaceholder("Select",o),D=e.computed(()=>{const t=e.unref(i);if(!t)return o.emptyText;const n=o.fieldNames?.label||"label",l=o.fieldNames?.value||"value";return r.isArray(t)?t.map(d=>e.unref(p).find(E=>E[l]===d)?.[n]).filter(Boolean).join("、")||o.emptyText:e.unref(p).find(d=>d[l]===t)?.[n]||o.emptyText}),M=e.computed(()=>{const t=!!o?.showSearch,n=o.searchMode;let l={};return t&&(l=n==="request"?{defaultActiveFirstOption:!1,onSearch:V,notFoundContent:a.value?void 0:null,filterOption:!1,suffixIcon:null}:{filterOption:r.isNil(o?.filterOption)?F:o?.filterOption}),{...r.omit(o,["mode","value","onUpdate:value","onSearch","request","searchMode","onFocus","onBeforeSelect"]),placeholder:e.unref(_),...l}}),h=e.computed(()=>p.value.map(t=>t[o.fieldNames?.value||"value"])),b=e.computed(()=>o.multiple?r.isNumber(o.addAll)?h.value.length>=o.addAll:!!o.addAll:!1);function P(){y.value?.focus()}function T(){y.value?.blur()}function g(t,n){const l=o.fieldNames?.[n]??n;return t[l]}function z(t){const n=g(t,"value");v(o.multiple?[n]:n)}const k=e.computed(()=>{const t=e.unref(i)||[],n=h.value;return n.length>0&&n.every(l=>t.includes(l))}),L=e.computed(()=>(e.unref(i)||[]).length>0&&!k.value);function R(){console.log("123");const t=e.unref(i)||[],n=h.value;n.length&&n.every(l=>t?.includes(l))?v([]):v(h.value)}return N({focus:P,blur:T,request:m}),(t,n)=>t.mode==="read"?(e.openBlock(),e.createElementBlock("span",G,e.toDisplayString(D.value),1)):(e.openBlock(),e.createBlock(e.unref(c.Select),e.mergeProps({key:1,ref_key:"selectRef",ref:y,"allow-clear":""},M.value,{mode:A.value,value:e.unref(i),options:e.unref(p),loading:a.value,"menu-item-selected-icon":e.h("span"),"popup-class-name":`${e.unref(s)("popup")} ${e.unref(O)}`,open:w.value,"onUpdate:value":e.unref(v),onFocus:I,onDropdownVisibleChange:n[0]||(n[0]=l=>w.value=l)}),e.createSlots({option:e.withCtx(l=>[e.createVNode(e.unref(c.Flex),{justify:"space-between",align:"center",class:e.normalizeClass(e.unref(s)("popup-option-wrapper")),gap:8},{default:e.withCtx(()=>[e.createVNode(e.unref(c.Space),null,{default:e.withCtx(()=>[b.value?(e.openBlock(),e.createBlock(e.unref(c.Checkbox),{key:0,checked:e.unref(i)?.includes(g(l,"value"))},null,8,["checked"])):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(e.unref(s)("popup-option-label"))},e.toDisplayString(g(l,"label")),3)]),_:2},1024),t.multiple&&t.allowOnlySelect?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(s)("popup-option-action")),onClick:e.withModifiers(()=>z(l),["stop"])},e.toDisplayString(e.unref(S)("ap.field.chooseOnly")),11,J)):e.createCommentVNode("",!0)]),_:2},1032,["class"])]),_:2},[e.renderList(t.$slots,(l,C)=>({name:C,fn:e.withCtx(d=>[e.renderSlot(t.$slots,C,e.normalizeProps(e.guardReactiveProps(d||{})))])})),a.value?{name:"notFoundContent",fn:e.withCtx(()=>[e.createVNode(e.unref(c.Spin),{size:"small"})]),key:"0"}:void 0,b.value?{name:"dropdownRender",fn:e.withCtx(({menuNode:l})=>[e.createElementVNode("div",{tabindex:-1,class:e.normalizeClass(e.unref(s)("popup-all-option")),onClick:R},[e.createVNode(e.unref(c.Checkbox),{checked:k.value,indeterminate:L.value},null,8,["checked","indeterminate"]),e.createElementVNode("span",{class:e.normalizeClass(e.unref(s)("popup-all-option-label"))},e.toDisplayString(e.unref(S)("ap.field.selectAll")),3)],2),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l)))]),key:"1"}:void 0]),1040,["mode","value","options","loading","menu-item-selected-icon","popup-class-name","open","onUpdate:value"]))}});exports.default=Q;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c=require("@aplus-frontend/antdv"),s=require("lodash-unified");require("../../config-provider/index.js");require("../../utils/index.js");require("../../hooks/index.js");const j=require("../hooks/use-default-placeholder.js"),K=require("../style/index.js"),H=require("./use-select-options.js"),W=require("../../config-provider/hooks/use-namespace.js"),G=require("../../config-provider/hooks/use-locale.js"),J=require("../../hooks/useControllableValue.js"),B=require("../../utils/is.js"),Q={key:0},X=["onClick"],Y=e.defineComponent({name:"ApFieldSelect",__name:"index",props:{mode:{default:"edit"},class:{},style:{},defaultValue:{},notFoundContent:{},suffixIcon:{},itemIcon:{},size:{},bordered:{type:Boolean,default:void 0},showArrow:{type:Boolean,default:void 0},variant:{},maxCount:{},transitionName:{},choiceTransitionName:{},popupClassName:{},dropdownClassName:{},placement:{},status:{},children:{},listHeight:{},onMouseenter:{},onMouseleave:{},tabindex:{},onClick:{},onFocus:{},onBlur:{},onChange:{},onKeydown:{},onKeyup:{},onMousedown:{},onSelect:{},open:{type:Boolean,default:void 0},animation:{},direction:{},disabled:{type:Boolean,default:void 0},prefixCls:{},id:{},autofocus:{type:Boolean,default:void 0},getPopupContainer:{},virtual:{type:Boolean,default:void 0},dropdownMatchSelectWidth:{},placeholder:{},loading:{type:Boolean,default:void 0},prefix:{},clearIcon:{},allowClear:{type:Boolean,default:!0},fieldNames:{},inputValue:{},searchValue:{},autoClearSearchValue:{type:Boolean,default:void 0},onDeselect:{},onActive:{},filterOption:{},filterSort:{},optionFilterProp:{},optionLabelProp:{},options:{},defaultActiveFirstOption:{type:Boolean,default:void 0},listItemHeight:{},onClickOption:{},menuItemSelectedIcon:{},labelInValue:{type:Boolean,default:void 0},showSearch:{type:Boolean,default:void 0},tagRender:{},optionLabelRender:{},onClear:{},defaultOpen:{type:Boolean,default:void 0},onDropdownVisibleChange:{},maxTagTextLength:{},maxTagCount:{},maxTagPlaceholder:{},tokenSeparators:{},removeIcon:{},dropdownStyle:{},dropdownRender:{},dropdownAlign:{},showAction:{},onPopupScroll:{},onInputKeyDown:{},emptyText:{default:"--"},request:{},multiple:{type:Boolean,default:void 0},value:{},"onUpdate:value":{},searchMode:{default:"filter"},refetchOnFocus:{type:Boolean,default:!1},lazy:{type:Boolean,default:!1},addAll:{type:[Boolean,Number],default:5},params:{},searchDelay:{default:300},allowOnlySelect:{type:Boolean,default:!0}},emits:["update:value"],setup(x,{expose:N,emit:O}){let u=0;const t=x,{b:r}=W.useNamespace("field-select"),V=K.default("field"),w=e.ref(!1),{t:S}=G.useLocale(),F=s.debounce(o=>{if(!s.isFunction(t.request))return;u+=1;const n=u;f([]),a.value=!0,t.request(o).then(l=>{u===n&&(f(l),a.value=!1)})},t.searchDelay),q=(o,n)=>{const l=t.fieldNames?.label||"label";return typeof n?.[l]=="string"&&n[l].toLowerCase().indexOf(o.toLowerCase())>-1},{options:p,updateOptions:f}=H.useSelectOptions(t),y=e.shallowRef(),a=e.ref(t?.loading||!1),A=O,_=e.computed(()=>{if(t.multiple)return t.tokenSeparators?"tags":"multiple"});async function m(o=!0){if(!s.isFunction(t.request))return;a.value=!0,u+=1;const n=u;try{o&&f([]);const l=await t.request(void 0,t.params);if(n!==u)return;f(l)}finally{a.value=!1}}function I(o){t.onFocus?.(o),t.refetchOnFocus&&u>0&&!a.value&&m(!0)}e.onMounted(()=>{t.lazy||m()}),e.watch(()=>t.params,()=>{m()},{deep:!0});const{value:i,updateValue:v}=J.useControllableValue(t,A),D=j.useDefaultPlaceholder("Select",t),M=e.computed(()=>{const o=e.unref(i);if(!o)return t.emptyText;const n=t.fieldNames?.label||"label",l=t.fieldNames?.value||"value";return s.isArray(o)?o.map(d=>e.unref(p).find($=>$[l]===d)?.[n]).filter(Boolean).join("、")||t.emptyText:e.unref(p).find(d=>d[l]===o)?.[n]||t.emptyText}),P=e.computed(()=>{const o=!!t?.showSearch,n=t.searchMode;let l={};return o&&(l=n==="request"?{defaultActiveFirstOption:!1,onSearch:F,notFoundContent:a.value?void 0:null,filterOption:!1,suffixIcon:null}:{filterOption:s.isNil(t?.filterOption)?q:t?.filterOption}),{...s.omit(t,["mode","value","onUpdate:value","onSearch","request","searchMode","onFocus","onBeforeSelect"]),placeholder:e.unref(D),...l}}),h=e.computed(()=>p.value.map(o=>o[t.fieldNames?.value||"value"])),b=e.computed(()=>!t.multiple||B.isDef(t.maxCount)?!1:s.isNumber(t.addAll)?h.value.length>=t.addAll:!!t.addAll),z=e.computed(()=>t.multiple&&t.allowOnlySelect&&(!B.isDef(t.maxCount)||t.maxCount>=1));function T(){y.value?.focus()}function L(){y.value?.blur()}function C(o,n){const l=t.fieldNames?.[n]??n;return o[l]}function R(o){const n=C(o,"value");v(t.multiple?[n]:n)}const k=e.computed(()=>{const o=e.unref(i)||[],n=h.value;return n.length>0&&n.every(l=>o.includes(l))}),E=e.computed(()=>(e.unref(i)||[]).length>0&&!k.value);function U(){console.log("123");const o=e.unref(i)||[],n=h.value;n.length&&n.every(l=>o?.includes(l))?v([]):v(h.value)}return N({focus:T,blur:L,request:m}),(o,n)=>o.mode==="read"?(e.openBlock(),e.createElementBlock("span",Q,e.toDisplayString(M.value),1)):(e.openBlock(),e.createBlock(e.unref(c.Select),e.mergeProps({key:1,ref_key:"selectRef",ref:y,"allow-clear":""},P.value,{mode:_.value,value:e.unref(i),options:e.unref(p),loading:a.value,"menu-item-selected-icon":e.h("span"),"popup-class-name":`${e.unref(r)("popup")} ${e.unref(V)}`,open:w.value,virtual:!1,"onUpdate:value":e.unref(v),onFocus:I,onDropdownVisibleChange:n[0]||(n[0]=l=>w.value=l)}),e.createSlots({option:e.withCtx(l=>[e.createVNode(e.unref(c.Flex),{justify:"space-between",align:"center",class:e.normalizeClass(e.unref(r)("popup-option-wrapper")),gap:8},{default:e.withCtx(()=>[e.createVNode(e.unref(c.Flex),{gap:8,align:"center"},{default:e.withCtx(()=>[b.value?(e.openBlock(),e.createBlock(e.unref(c.Checkbox),{key:0,checked:e.unref(i)?.includes(C(l,"value"))},null,8,["checked"])):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(e.unref(r)("popup-option-label"))},e.toDisplayString(C(l,"label")),3)]),_:2},1024),z.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(r)("popup-option-action")),onClick:e.withModifiers(()=>R(l),["stop"])},e.toDisplayString(e.unref(S)("ap.field.chooseOnly")),11,X)):e.createCommentVNode("",!0)]),_:2},1032,["class"])]),_:2},[e.renderList(o.$slots,(l,g)=>({name:g,fn:e.withCtx(d=>[e.renderSlot(o.$slots,g,e.normalizeProps(e.guardReactiveProps(d||{})))])})),a.value?{name:"notFoundContent",fn:e.withCtx(()=>[e.createVNode(e.unref(c.Spin),{size:"small"})]),key:"0"}:void 0,b.value?{name:"dropdownRender",fn:e.withCtx(({menuNode:l})=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(r)("popup-all-option-wrapper"))},[e.createElementVNode("div",{tabindex:-1,class:e.normalizeClass(e.unref(r)("popup-all-option")),onClick:U},[e.createVNode(e.unref(c.Checkbox),{checked:k.value,indeterminate:E.value},null,8,["checked","indeterminate"]),e.createElementVNode("span",{class:e.normalizeClass(e.unref(r)("popup-all-option-label"))},e.toDisplayString(e.unref(S)("ap.field.selectAll")),3)],2)],2),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l)))]),key:"1"}:void 0]),1040,["mode","value","options","loading","menu-item-selected-icon","popup-class-name","open","onUpdate:value"]))}});exports.default=Y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../../style/index.js"),n=i=>{const{componentCls:o}=i,e=`${o}-select-popup`;return{[`${e}`]:{padding:i.space,[`${e}-all-option`]:{width:"100%",display:"inline-flex",cursor:"pointer",paddingInline:i.space,paddingBlock:i.spaceSM,[`${e}-all-option-label`]:{paddingInline:i.space}},[`${e}-option-wrapper`]:{height:"22px"},[`${e}-option-label`]:{...l.singleRow(i),color:"inherit"},[`${e}-option-action`]:{display:"none",color:i.colorPrimary,paddingInline:i.spaceSM,paddingBlock:i.spaceXXS,"&:hover":{background:i.colorPrimary,color:"#fff",borderRadius:"2px"}},"div.ant-select-item":{paddingInline:i.space,paddingBlock:i.spaceXS,fontWeight:"normal !important",marginBottom:i.spaceXS,"&:hover":{[`${e}-option-action`]:{display:"inline"}},"&:last-child":{marginBottom:0},"&.ant-select-item-option-selected:not(.ant-select-item-option-disabled)":{color:i.colorPrimary}}}}};exports.genSelectStyle=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../../style/index.js"),n=i=>{const{componentCls:a}=i,p=`${a}-select-popup`;return{[`${p}`]:{padding:0,[`${p}-all-option-wrapper`]:{padding:i.space,paddingBlockEnd:i.spaceXS},[`${p}-all-option`]:{width:"100%",display:"inline-flex",cursor:"pointer",paddingInline:i.space,paddingBlock:i.spaceSM,[`${p}-all-option-label`]:{paddingInline:i.space}},[`${p}-option-wrapper`]:{height:"22px"},[`${p}-option-label`]:{...l.singleRow(i),color:"inherit"},[`${p}-option-action`]:{display:"none",color:i.colorPrimary,paddingInline:i.spaceSM,paddingBlock:i.spaceXXS,"&:hover":{background:i.colorPrimary,color:"#fff",borderRadius:"2px"}},"div.ant-select-item":{paddingInline:i.space,paddingBlock:i.spaceXS,fontWeight:"normal !important",marginBottom:i.spaceXS,marginInline:i.space,"&:hover":{[`${p}-option-action`]:{display:"inline"}},"&:last-child":{marginBottom:i.space}}}}};exports.genSelectStyle=n;
@@ -1,2 +1,2 @@
1
- declare const _default: "7.13.4";
1
+ declare const _default: "7.13.6";
2
2
  export default _default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.13.4";exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.13.6";exports.default=e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "7.13.4",
3
+ "version": "7.13.6",
4
4
  "main": "./lib/index.js",
5
5
  "type": "module",
6
6
  "files": [
@@ -44,14 +44,14 @@
44
44
  "@aplus-frontend/utils": "1.0.65"
45
45
  },
46
46
  "peerDependencies": {
47
- "@aplus-frontend/antdv": "^2.0.3",
47
+ "@aplus-frontend/antdv": "^2.0.5",
48
48
  "@aplus-frontend/icon": "^2.0.6",
49
49
  "@aplus-frontend/oss": "^2.0.1",
50
50
  "vue": "^3.5.21",
51
51
  "vxe-table": "^4.13.37"
52
52
  },
53
53
  "devDependencies": {
54
- "@aplus-frontend/antdv": "^2.0.3",
54
+ "@aplus-frontend/antdv": "^2.0.5",
55
55
  "@aplus-frontend/icon": "^2.0.6",
56
56
  "@aplus-frontend/oss": "^2.0.1",
57
57
  "@emotion/serialize": "^1.3.3",