@aplus-frontend/ui 7.17.2 → 7.17.4

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,6 +1,6 @@
1
- import { defineComponent as fe, useSlots as me, ref as k, shallowRef as he, computed as s, onMounted as ve, watch as ye, unref as l, createVNode as m, createElementBlock as M, createBlock as C, openBlock as h, toDisplayString as N, mergeProps as ge, h as Ce, createSlots as be, withCtx as v, createElementVNode as x, normalizeClass as y, createCommentVNode as P, resolveDynamicComponent as T, withModifiers as we, renderList as Oe, renderSlot as Se, normalizeProps as Fe, guardReactiveProps as Be } from "vue";
2
- import { Select as ke, Flex as q, Checkbox as L, Spin as Ne } from "@aplus-frontend/antdv";
3
- import { debounce as xe, isFunction as z, isArray as Ae, isNil as Ve, omit as R, isNumber as Ie } from "lodash-unified";
1
+ import { defineComponent as fe, useSlots as me, ref as k, shallowRef as he, computed as s, onMounted as ve, watch as ye, unref as o, createVNode as m, createElementBlock as M, createBlock as C, openBlock as h, toDisplayString as N, mergeProps as ge, h as Ce, createSlots as be, withCtx as v, createElementVNode as x, normalizeClass as y, createCommentVNode as P, resolveDynamicComponent as L, withModifiers as we, renderList as Oe, renderSlot as Se, normalizeProps as Fe, guardReactiveProps as Be } from "vue";
2
+ import { Select as ke, Flex as T, Checkbox as q, Spin as Ne } from "@aplus-frontend/antdv";
3
+ import { debounce as xe, isFunction as z, isArray as Ve, isNil as Ae, omit as R, isNumber as Ie } from "lodash-unified";
4
4
  import "../../config-provider/index.mjs";
5
5
  import "../../utils/index.mjs";
6
6
  import { useDevWarning as _e } from "../../utils/warning.mjs";
@@ -8,11 +8,11 @@ import "../../hooks/index.mjs";
8
8
  import { useDefaultPlaceholder as De } from "../hooks/use-default-placeholder.mjs";
9
9
  import Me from "../style/index.mjs";
10
10
  import { useSelectOptions as Pe } from "./use-select-options.mjs";
11
- import { isDef as A } from "../../utils/is.mjs";
11
+ import { isDef as V } from "../../utils/is.mjs";
12
12
  import { useNamespace as E } from "../../config-provider/hooks/use-namespace.mjs";
13
- import { useLocale as Te } from "../../config-provider/hooks/use-locale.mjs";
14
- import { useControllableValue as qe } from "../../hooks/useControllableValue.mjs";
15
- const Le = {
13
+ import { useLocale as Le } from "../../config-provider/hooks/use-locale.mjs";
14
+ import { useControllableValue as Te } from "../../hooks/useControllableValue.mjs";
15
+ const qe = {
16
16
  key: 0
17
17
  }, ze = ["onClick"], et = /* @__PURE__ */ fe({
18
18
  name: "ApFieldSelect",
@@ -188,24 +188,24 @@ const Le = {
188
188
  const b = me(), e = U, {
189
189
  deprecated: j
190
190
  } = _e("ApFieldSelect");
191
- j(!A(e.refetchOnFocus), "refetchOnFocus", "fetchOnFocus");
191
+ j(!V(e.refetchOnFocus), "refetchOnFocus", "fetchOnFocus");
192
192
  const {
193
193
  b: w
194
194
  } = E("field-select"), {
195
195
  b: d
196
- } = E("field-select-popup-option"), H = Me("field"), V = k(!1), I = k(!1), {
196
+ } = E("field-select-popup-option"), H = Me("field"), A = k(!1), I = k(!1), {
197
197
  t: _
198
- } = Te(), W = xe((t) => {
198
+ } = Le(), W = xe((t) => {
199
199
  if (!z(e.request))
200
200
  return;
201
201
  r += 1;
202
202
  const n = r;
203
- g([]), u.value = !0, e.request(t).then((o) => {
204
- r === n && (g(o), u.value = !1);
203
+ g([]), u.value = !0, e.request(t).then((l) => {
204
+ r === n && (g(l), u.value = !1);
205
205
  });
206
206
  }, e.searchDelay), G = (t, n) => {
207
- const o = e.fieldNames?.label || "label";
208
- return typeof n?.[o] == "string" && n[o].toLowerCase().indexOf(t.toLowerCase()) > -1;
207
+ const l = e.fieldNames?.label || "label";
208
+ return typeof n?.[l] == "string" && n[l].toLowerCase().indexOf(t.toLowerCase()) > -1;
209
209
  }, {
210
210
  options: p,
211
211
  updateOptions: g
@@ -220,16 +220,16 @@ const Le = {
220
220
  const n = r;
221
221
  try {
222
222
  t && g([]);
223
- const o = await e.request(void 0, e.params);
223
+ const l = await e.request(void 0, e.params);
224
224
  if (n !== r)
225
225
  return;
226
- g(o);
226
+ g(l);
227
227
  } finally {
228
228
  u.value = !1;
229
229
  }
230
230
  }
231
231
  function Y(t) {
232
- !V.value && r === 0 && e.lazy === "first-focus" ? i() : Q.value && !u.value && i(!0), e.onFocus?.(t), V.value = !0;
232
+ !A.value && r === 0 && e.lazy === "first-focus" ? i() : Q.value && !u.value && i(!0), e.onFocus?.(t), A.value = !0;
233
233
  }
234
234
  function Z(t) {
235
235
  if (!t) {
@@ -251,29 +251,29 @@ const Le = {
251
251
  const {
252
252
  value: f,
253
253
  updateValue: S
254
- } = qe(e, J), ee = De("Select", e), te = s(() => {
255
- const t = l(f);
254
+ } = Te(e, J), ee = De("Select", e), te = s(() => {
255
+ const t = o(f);
256
256
  if (!t)
257
257
  return e.emptyText;
258
- const n = e.fieldNames?.label || "label", o = e.fieldNames?.value || "value";
259
- return Ae(t) ? t.map((a) => l(p).find((pe) => pe[o] === a)?.[n]).filter(Boolean).join("、") || e.emptyText : l(p).find((a) => a[o] === t)?.[n] || e.emptyText;
258
+ const n = e.fieldNames?.label || "label", l = e.fieldNames?.value || "value";
259
+ return Ve(t) ? t.map((a) => o(p).find((pe) => pe[l] === a)?.[n]).filter(Boolean).join("、") || e.emptyText : o(p).find((a) => a[l] === t)?.[n] || e.emptyText;
260
260
  }), ne = s(() => {
261
261
  const t = !!e?.showSearch, n = e.searchMode;
262
- let o = {};
263
- return t && (o = n === "request" ? {
262
+ let l = {};
263
+ return t && (l = n === "request" ? {
264
264
  defaultActiveFirstOption: !1,
265
265
  onSearch: W,
266
266
  notFoundContent: u.value ? void 0 : null,
267
267
  filterOption: !1,
268
268
  suffixIcon: null
269
269
  } : {
270
- filterOption: Ve(e?.filterOption) ? G : e?.filterOption
270
+ filterOption: Ae(e?.filterOption) ? G : e?.filterOption
271
271
  }), {
272
- ...R(e, ["mode", "value", "onUpdate:value", "onSearch", "request", "searchMode", "onFocus", "onBeforeSelect"]),
273
- placeholder: l(ee),
274
- ...o
272
+ ...R(e, ["mode", "value", "onUpdate:value", "onSearch", "request", "searchMode", "onFocus", "onBeforeSelect", "onDropdownVisibleChange"]),
273
+ placeholder: o(ee),
274
+ ...l
275
275
  };
276
- }), oe = s(() => p.value.map((t) => t[e.fieldNames?.value || "value"])), F = s(() => p.value.filter((t) => !t.disabled).map((t) => t[e.fieldNames?.value || "value"])), D = s(() => !e.multiple || A(e.maxCount) ? !1 : Ie(e.addAll) ? oe.value.length >= e.addAll : !!e.addAll), le = s(() => e.multiple && e.allowOnlySelect && (!A(e.maxCount) || e.maxCount >= 1));
276
+ }), le = s(() => p.value.map((t) => t[e.fieldNames?.value || "value"])), F = s(() => p.value.filter((t) => !t.disabled).map((t) => t[e.fieldNames?.value || "value"])), D = s(() => !e.multiple || V(e.maxCount) ? !1 : Ie(e.addAll) ? le.value.length >= e.addAll : !!e.addAll), oe = s(() => e.multiple && e.allowOnlySelect && (!V(e.maxCount) || e.maxCount >= 1));
277
277
  function ae() {
278
278
  O.value?.focus();
279
279
  }
@@ -281,8 +281,8 @@ const Le = {
281
281
  O.value?.blur();
282
282
  }
283
283
  function B(t, n) {
284
- const o = e.fieldNames?.[n] ?? n;
285
- return t[o];
284
+ const l = e.fieldNames?.[n] ?? n;
285
+ return l === "groupLabel" ? t[l] ?? t.label : t[l];
286
286
  }
287
287
  function ue(t) {
288
288
  const n = B(t, "value");
@@ -296,14 +296,14 @@ const Le = {
296
296
  }, [B(t, t.options?.length ? "groupLabel" : "label")]);
297
297
  }
298
298
  const ie = s(() => {
299
- const t = l(f) || [], n = F.value;
300
- return n.length > 0 && n.every((o) => t.includes(o));
299
+ const t = o(f) || [], n = F.value;
300
+ return n.length > 0 && n.every((l) => t.includes(l));
301
301
  }), ce = s(() => {
302
- const t = l(f) || [], n = F.value, o = n.filter((c) => t.includes(c)).length;
303
- return o > 0 && o < n.length;
302
+ const t = o(f) || [], n = F.value, l = n.filter((c) => t.includes(c)).length;
303
+ return l > 0 && l < n.length;
304
304
  });
305
305
  function de() {
306
- const t = new Set(l(f) || []), n = F.value;
306
+ const t = new Set(o(f) || []), n = F.value;
307
307
  n.length > 0 && n.every((a) => t.has(a)) ? n.forEach((a) => t.delete(a)) : n.forEach((a) => t.add(a));
308
308
  const c = p.value.filter((a) => t.has(a[e.fieldNames?.value || "value"]));
309
309
  S([...t]), e.onChange?.([...t], c);
@@ -312,71 +312,71 @@ const Le = {
312
312
  focus: ae,
313
313
  blur: se,
314
314
  request: i
315
- }), (t, n) => t.mode === "read" ? (h(), M("span", Le, N(te.value), 1)) : (h(), C(l(ke), ge({
315
+ }), (t, n) => t.mode === "read" ? (h(), M("span", qe, N(te.value), 1)) : (h(), C(o(ke), ge({
316
316
  key: 1,
317
317
  ref_key: "selectRef",
318
318
  ref: O,
319
319
  "allow-clear": ""
320
320
  }, ne.value, {
321
321
  mode: X.value,
322
- value: l(f),
323
- options: l(p),
322
+ value: o(f),
323
+ options: o(p),
324
324
  loading: u.value,
325
325
  "menu-item-selected-icon": Ce("span"),
326
- "popup-class-name": `${l(w)("popup")} ${l(H)}`,
327
- "onUpdate:value": l(S),
326
+ "popup-class-name": `${o(w)("popup")} ${o(H)}`,
327
+ "onUpdate:value": o(S),
328
328
  onFocus: Y,
329
329
  onDropdownVisibleChange: Z
330
330
  }), be({
331
- option: v((o) => [x("div", {
332
- class: y(l(d)("outter"))
333
- }, [m(l(q), {
331
+ option: v((l) => [x("div", {
332
+ class: y(o(d)("outter"))
333
+ }, [m(o(T), {
334
334
  justify: "space-between",
335
335
  align: "center",
336
- class: y(l(d)("wrapper")),
336
+ class: y(o(d)("wrapper")),
337
337
  gap: 8
338
338
  }, {
339
- default: v(() => [m(l(q), {
339
+ default: v(() => [m(o(T), {
340
340
  gap: 8,
341
341
  align: "center",
342
- class: y(l(d)("content-wrapper"))
342
+ class: y(o(d)("content-wrapper"))
343
343
  }, {
344
- default: v(() => [D.value ? (h(), C(l(L), {
344
+ default: v(() => [D.value ? (h(), C(o(q), {
345
345
  key: 0,
346
- checked: l(f)?.includes(B(o, "value"))
347
- }, null, 8, ["checked"])) : P("", !0), (h(), C(T(re(o))))]),
346
+ checked: o(f)?.includes(B(l, "value"))
347
+ }, null, 8, ["checked"])) : P("", !0), (h(), C(L(re(l))))]),
348
348
  _: 2
349
- }, 1032, ["class"]), le.value && !o?.disabled ? (h(), M("span", {
349
+ }, 1032, ["class"]), oe.value && !l?.disabled ? (h(), M("span", {
350
350
  key: 0,
351
- class: y(l(d)("action")),
352
- onClick: we(() => ue(o), ["stop"])
353
- }, N(l(_)("ap.field.chooseOnly")), 11, ze)) : P("", !0)]),
351
+ class: y(o(d)("action")),
352
+ onClick: we(() => ue(l), ["stop"])
353
+ }, N(o(_)("ap.field.chooseOnly")), 11, ze)) : P("", !0)]),
354
354
  _: 2
355
355
  }, 1032, ["class"])], 2)]),
356
356
  _: 2
357
- }, [Oe(l(R)(b, ["option"]), (o, c) => ({
357
+ }, [Oe(o(R)(b, ["option"]), (l, c) => ({
358
358
  name: c,
359
359
  fn: v((a) => [Se(t.$slots, c, Fe(Be(a || {})))])
360
360
  })), u.value ? {
361
361
  name: "notFoundContent",
362
- fn: v(() => [m(l(Ne), {
362
+ fn: v(() => [m(o(Ne), {
363
363
  size: "small"
364
364
  })]),
365
365
  key: "0"
366
366
  } : void 0, D.value ? {
367
367
  name: "dropdownRender",
368
368
  fn: v(({
369
- menuNode: o
369
+ menuNode: l
370
370
  }) => [x("div", {
371
371
  tabindex: -1,
372
- class: y(l(w)("popup-all-option")),
372
+ class: y(o(w)("popup-all-option")),
373
373
  onClick: de
374
- }, [m(l(L), {
374
+ }, [m(o(q), {
375
375
  checked: ie.value,
376
376
  indeterminate: ce.value
377
377
  }, null, 8, ["checked", "indeterminate"]), x("span", {
378
- class: y(l(w)("popup-all-option-label"))
379
- }, N(l(_)("ap.field.selectAll")), 3)], 2), (h(), C(T(o)))]),
378
+ class: y(o(w)("popup-all-option-label"))
379
+ }, N(o(_)("ap.field.selectAll")), 3)], 2), (h(), C(L(l)))]),
380
380
  key: "1"
381
381
  } : void 0]), 1040, ["mode", "value", "options", "loading", "menu-item-selected-icon", "popup-class-name", "onUpdate:value"]));
382
382
  }
@@ -1,2 +1,2 @@
1
- declare const _default: "7.17.2";
1
+ declare const _default: "7.17.4";
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- const e = "7.17.2";
1
+ const e = "7.17.4";
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"),m=require("@aplus-frontend/antdv"),r=require("lodash-unified");require("../../config-provider/index.js");require("../../utils/index.js");const Z=require("../../utils/warning.js");require("../../hooks/index.js");const ee=require("../hooks/use-default-placeholder.js"),ne=require("../style/index.js"),te=require("./use-select-options.js"),S=require("../../utils/is.js"),F=require("../../config-provider/hooks/use-namespace.js"),oe=require("../../config-provider/hooks/use-locale.js"),le=require("../../hooks/useControllableValue.js"),ae={key:0},ue=["onClick"],se=e.defineComponent({name:"ApFieldSelect",__name:"index",props:{mode:{default:"edit"},class:{},style:{},emptyText:{default:"--"},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:{},request:{},multiple:{type:Boolean,default:void 0},value:{},"onUpdate:value":{},searchMode:{default:"filter"},refetchOnFocus:{type:Boolean,default:!1},fetchOnFocus:{type:Boolean,default:void 0},fetchOnOpen:{type:Boolean},lazy:{type:[Boolean,String],default:!1},addAll:{type:[Boolean,Number],default:5},params:{},searchDelay:{default:300},allowOnlySelect:{type:Boolean,default:!0}},emits:["update:value"],setup(x,{expose:V,emit:q}){let s=0;const v=e.useSlots(),n=x,{deprecated:A}=Z.useDevWarning("ApFieldSelect");A(!S.isDef(n.refetchOnFocus),"refetchOnFocus","fetchOnFocus");const{b:y}=F.useNamespace("field-select"),{b:d}=F.useNamespace("field-select-popup-option"),D=ne.default("field"),k=e.ref(!1),B=e.ref(!1),{t:O}=oe.useLocale(),_=r.debounce(t=>{if(!r.isFunction(n.request))return;s+=1;const o=s;h([]),u.value=!0,n.request(t).then(l=>{s===o&&(h(l),u.value=!1)})},n.searchDelay),I=(t,o)=>{const l=n.fieldNames?.label||"label";return typeof o?.[l]=="string"&&o[l].toLowerCase().indexOf(t.toLowerCase())>-1},{options:f,updateOptions:h}=te.useSelectOptions(n),C=e.shallowRef(),u=e.ref(n?.loading||!1),z=q,M=e.computed(()=>n.fetchOnFocus??n.refetchOnFocus),P=e.computed(()=>{if(n.multiple)return n.tokenSeparators?"tags":"multiple"});async function c(t=!0){if(!r.isFunction(n.request))return;u.value=!0,s+=1;const o=s;try{t&&h([]);const l=await n.request(void 0,n.params);if(o!==s)return;h(l)}finally{u.value=!1}}function T(t){!k.value&&s===0&&n.lazy==="first-focus"?c():M.value&&!u.value&&c(!0),n.onFocus?.(t),k.value=!0}function L(t){if(!t){n.onDropdownVisibleChange?.(t);return}!B.value&&s===0&&n.lazy==="first-open"?c():n.fetchOnOpen&&!u.value&&c(!0),n.onDropdownVisibleChange?.(t),B.value=!0}e.onMounted(()=>{if(!n.lazy){c();return}}),e.watch(()=>n.params,()=>{c()},{deep:!0});const{value:p,updateValue:g}=le.useControllableValue(n,z),R=ee.useDefaultPlaceholder("Select",n),E=e.computed(()=>{const t=e.unref(p);if(!t)return n.emptyText;const o=n.fieldNames?.label||"label",l=n.fieldNames?.value||"value";return r.isArray(t)?t.map(a=>e.unref(f).find(Y=>Y[l]===a)?.[o]).filter(Boolean).join("、")||n.emptyText:e.unref(f).find(a=>a[l]===t)?.[o]||n.emptyText}),U=e.computed(()=>{const t=!!n?.showSearch,o=n.searchMode;let l={};return t&&(l=o==="request"?{defaultActiveFirstOption:!1,onSearch:_,notFoundContent:u.value?void 0:null,filterOption:!1,suffixIcon:null}:{filterOption:r.isNil(n?.filterOption)?I:n?.filterOption}),{...r.omit(n,["mode","value","onUpdate:value","onSearch","request","searchMode","onFocus","onBeforeSelect"]),placeholder:e.unref(R),...l}}),j=e.computed(()=>f.value.map(t=>t[n.fieldNames?.value||"value"])),b=e.computed(()=>f.value.filter(t=>!t.disabled).map(t=>t[n.fieldNames?.value||"value"])),N=e.computed(()=>!n.multiple||S.isDef(n.maxCount)?!1:r.isNumber(n.addAll)?j.value.length>=n.addAll:!!n.addAll),K=e.computed(()=>n.multiple&&n.allowOnlySelect&&(!S.isDef(n.maxCount)||n.maxCount>=1));function $(){C.value?.focus()}function H(){C.value?.blur()}function w(t,o){const l=n.fieldNames?.[o]??o;return t[l]}function W(t){const o=w(t,"value");g(n.multiple?[o]:o),n.onChange?.([o],[t])}function G(t){return v.option?e.createVNode("div",{class:d("custom")},[v.option(t)]):e.createVNode("span",{class:d("label")},[w(t,t.options?.length?"groupLabel":"label")])}const J=e.computed(()=>{const t=e.unref(p)||[],o=b.value;return o.length>0&&o.every(l=>t.includes(l))}),Q=e.computed(()=>{const t=e.unref(p)||[],o=b.value,l=o.filter(i=>t.includes(i)).length;return l>0&&l<o.length});function X(){const t=new Set(e.unref(p)||[]),o=b.value;o.length>0&&o.every(a=>t.has(a))?o.forEach(a=>t.delete(a)):o.forEach(a=>t.add(a));const i=f.value.filter(a=>t.has(a[n.fieldNames?.value||"value"]));g([...t]),n.onChange?.([...t],i)}return V({focus:$,blur:H,request:c}),(t,o)=>t.mode==="read"?(e.openBlock(),e.createElementBlock("span",ae,e.toDisplayString(E.value),1)):(e.openBlock(),e.createBlock(e.unref(m.Select),e.mergeProps({key:1,ref_key:"selectRef",ref:C,"allow-clear":""},U.value,{mode:P.value,value:e.unref(p),options:e.unref(f),loading:u.value,"menu-item-selected-icon":e.h("span"),"popup-class-name":`${e.unref(y)("popup")} ${e.unref(D)}`,"onUpdate:value":e.unref(g),onFocus:T,onDropdownVisibleChange:L}),e.createSlots({option:e.withCtx(l=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(d)("outter"))},[e.createVNode(e.unref(m.Flex),{justify:"space-between",align:"center",class:e.normalizeClass(e.unref(d)("wrapper")),gap:8},{default:e.withCtx(()=>[e.createVNode(e.unref(m.Flex),{gap:8,align:"center",class:e.normalizeClass(e.unref(d)("content-wrapper"))},{default:e.withCtx(()=>[N.value?(e.openBlock(),e.createBlock(e.unref(m.Checkbox),{key:0,checked:e.unref(p)?.includes(w(l,"value"))},null,8,["checked"])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(G(l))))]),_:2},1032,["class"]),K.value&&!l?.disabled?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(d)("action")),onClick:e.withModifiers(()=>W(l),["stop"])},e.toDisplayString(e.unref(O)("ap.field.chooseOnly")),11,ue)):e.createCommentVNode("",!0)]),_:2},1032,["class"])],2)]),_:2},[e.renderList(e.unref(r.omit)(v,["option"]),(l,i)=>({name:i,fn:e.withCtx(a=>[e.renderSlot(t.$slots,i,e.normalizeProps(e.guardReactiveProps(a||{})))])})),u.value?{name:"notFoundContent",fn:e.withCtx(()=>[e.createVNode(e.unref(m.Spin),{size:"small"})]),key:"0"}:void 0,N.value?{name:"dropdownRender",fn:e.withCtx(({menuNode:l})=>[e.createElementVNode("div",{tabindex:-1,class:e.normalizeClass(e.unref(y)("popup-all-option")),onClick:X},[e.createVNode(e.unref(m.Checkbox),{checked:J.value,indeterminate:Q.value},null,8,["checked","indeterminate"]),e.createElementVNode("span",{class:e.normalizeClass(e.unref(y)("popup-all-option-label"))},e.toDisplayString(e.unref(O)("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","onUpdate:value"]))}});exports.default=se;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),m=require("@aplus-frontend/antdv"),r=require("lodash-unified");require("../../config-provider/index.js");require("../../utils/index.js");const Z=require("../../utils/warning.js");require("../../hooks/index.js");const ee=require("../hooks/use-default-placeholder.js"),ne=require("../style/index.js"),te=require("./use-select-options.js"),S=require("../../utils/is.js"),F=require("../../config-provider/hooks/use-namespace.js"),le=require("../../config-provider/hooks/use-locale.js"),oe=require("../../hooks/useControllableValue.js"),ae={key:0},ue=["onClick"],se=e.defineComponent({name:"ApFieldSelect",__name:"index",props:{mode:{default:"edit"},class:{},style:{},emptyText:{default:"--"},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:{},request:{},multiple:{type:Boolean,default:void 0},value:{},"onUpdate:value":{},searchMode:{default:"filter"},refetchOnFocus:{type:Boolean,default:!1},fetchOnFocus:{type:Boolean,default:void 0},fetchOnOpen:{type:Boolean},lazy:{type:[Boolean,String],default:!1},addAll:{type:[Boolean,Number],default:5},params:{},searchDelay:{default:300},allowOnlySelect:{type:Boolean,default:!0}},emits:["update:value"],setup(x,{expose:V,emit:q}){let s=0;const v=e.useSlots(),n=x,{deprecated:A}=Z.useDevWarning("ApFieldSelect");A(!S.isDef(n.refetchOnFocus),"refetchOnFocus","fetchOnFocus");const{b:y}=F.useNamespace("field-select"),{b:d}=F.useNamespace("field-select-popup-option"),D=ne.default("field"),k=e.ref(!1),B=e.ref(!1),{t:O}=le.useLocale(),_=r.debounce(t=>{if(!r.isFunction(n.request))return;s+=1;const l=s;h([]),u.value=!0,n.request(t).then(o=>{s===l&&(h(o),u.value=!1)})},n.searchDelay),I=(t,l)=>{const o=n.fieldNames?.label||"label";return typeof l?.[o]=="string"&&l[o].toLowerCase().indexOf(t.toLowerCase())>-1},{options:f,updateOptions:h}=te.useSelectOptions(n),g=e.shallowRef(),u=e.ref(n?.loading||!1),z=q,M=e.computed(()=>n.fetchOnFocus??n.refetchOnFocus),P=e.computed(()=>{if(n.multiple)return n.tokenSeparators?"tags":"multiple"});async function c(t=!0){if(!r.isFunction(n.request))return;u.value=!0,s+=1;const l=s;try{t&&h([]);const o=await n.request(void 0,n.params);if(l!==s)return;h(o)}finally{u.value=!1}}function L(t){!k.value&&s===0&&n.lazy==="first-focus"?c():M.value&&!u.value&&c(!0),n.onFocus?.(t),k.value=!0}function T(t){if(!t){n.onDropdownVisibleChange?.(t);return}!B.value&&s===0&&n.lazy==="first-open"?c():n.fetchOnOpen&&!u.value&&c(!0),n.onDropdownVisibleChange?.(t),B.value=!0}e.onMounted(()=>{if(!n.lazy){c();return}}),e.watch(()=>n.params,()=>{c()},{deep:!0});const{value:p,updateValue:C}=oe.useControllableValue(n,z),R=ee.useDefaultPlaceholder("Select",n),E=e.computed(()=>{const t=e.unref(p);if(!t)return n.emptyText;const l=n.fieldNames?.label||"label",o=n.fieldNames?.value||"value";return r.isArray(t)?t.map(a=>e.unref(f).find(Y=>Y[o]===a)?.[l]).filter(Boolean).join("、")||n.emptyText:e.unref(f).find(a=>a[o]===t)?.[l]||n.emptyText}),U=e.computed(()=>{const t=!!n?.showSearch,l=n.searchMode;let o={};return t&&(o=l==="request"?{defaultActiveFirstOption:!1,onSearch:_,notFoundContent:u.value?void 0:null,filterOption:!1,suffixIcon:null}:{filterOption:r.isNil(n?.filterOption)?I:n?.filterOption}),{...r.omit(n,["mode","value","onUpdate:value","onSearch","request","searchMode","onFocus","onBeforeSelect","onDropdownVisibleChange"]),placeholder:e.unref(R),...o}}),j=e.computed(()=>f.value.map(t=>t[n.fieldNames?.value||"value"])),b=e.computed(()=>f.value.filter(t=>!t.disabled).map(t=>t[n.fieldNames?.value||"value"])),N=e.computed(()=>!n.multiple||S.isDef(n.maxCount)?!1:r.isNumber(n.addAll)?j.value.length>=n.addAll:!!n.addAll),K=e.computed(()=>n.multiple&&n.allowOnlySelect&&(!S.isDef(n.maxCount)||n.maxCount>=1));function $(){g.value?.focus()}function H(){g.value?.blur()}function w(t,l){const o=n.fieldNames?.[l]??l;return o==="groupLabel"?t[o]??t.label:t[o]}function W(t){const l=w(t,"value");C(n.multiple?[l]:l),n.onChange?.([l],[t])}function G(t){return v.option?e.createVNode("div",{class:d("custom")},[v.option(t)]):e.createVNode("span",{class:d("label")},[w(t,t.options?.length?"groupLabel":"label")])}const J=e.computed(()=>{const t=e.unref(p)||[],l=b.value;return l.length>0&&l.every(o=>t.includes(o))}),Q=e.computed(()=>{const t=e.unref(p)||[],l=b.value,o=l.filter(i=>t.includes(i)).length;return o>0&&o<l.length});function X(){const t=new Set(e.unref(p)||[]),l=b.value;l.length>0&&l.every(a=>t.has(a))?l.forEach(a=>t.delete(a)):l.forEach(a=>t.add(a));const i=f.value.filter(a=>t.has(a[n.fieldNames?.value||"value"]));C([...t]),n.onChange?.([...t],i)}return V({focus:$,blur:H,request:c}),(t,l)=>t.mode==="read"?(e.openBlock(),e.createElementBlock("span",ae,e.toDisplayString(E.value),1)):(e.openBlock(),e.createBlock(e.unref(m.Select),e.mergeProps({key:1,ref_key:"selectRef",ref:g,"allow-clear":""},U.value,{mode:P.value,value:e.unref(p),options:e.unref(f),loading:u.value,"menu-item-selected-icon":e.h("span"),"popup-class-name":`${e.unref(y)("popup")} ${e.unref(D)}`,"onUpdate:value":e.unref(C),onFocus:L,onDropdownVisibleChange:T}),e.createSlots({option:e.withCtx(o=>[e.createElementVNode("div",{class:e.normalizeClass(e.unref(d)("outter"))},[e.createVNode(e.unref(m.Flex),{justify:"space-between",align:"center",class:e.normalizeClass(e.unref(d)("wrapper")),gap:8},{default:e.withCtx(()=>[e.createVNode(e.unref(m.Flex),{gap:8,align:"center",class:e.normalizeClass(e.unref(d)("content-wrapper"))},{default:e.withCtx(()=>[N.value?(e.openBlock(),e.createBlock(e.unref(m.Checkbox),{key:0,checked:e.unref(p)?.includes(w(o,"value"))},null,8,["checked"])):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(G(o))))]),_:2},1032,["class"]),K.value&&!o?.disabled?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(d)("action")),onClick:e.withModifiers(()=>W(o),["stop"])},e.toDisplayString(e.unref(O)("ap.field.chooseOnly")),11,ue)):e.createCommentVNode("",!0)]),_:2},1032,["class"])],2)]),_:2},[e.renderList(e.unref(r.omit)(v,["option"]),(o,i)=>({name:i,fn:e.withCtx(a=>[e.renderSlot(t.$slots,i,e.normalizeProps(e.guardReactiveProps(a||{})))])})),u.value?{name:"notFoundContent",fn:e.withCtx(()=>[e.createVNode(e.unref(m.Spin),{size:"small"})]),key:"0"}:void 0,N.value?{name:"dropdownRender",fn:e.withCtx(({menuNode:o})=>[e.createElementVNode("div",{tabindex:-1,class:e.normalizeClass(e.unref(y)("popup-all-option")),onClick:X},[e.createVNode(e.unref(m.Checkbox),{checked:J.value,indeterminate:Q.value},null,8,["checked","indeterminate"]),e.createElementVNode("span",{class:e.normalizeClass(e.unref(y)("popup-all-option-label"))},e.toDisplayString(e.unref(O)("ap.field.selectAll")),3)],2),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o)))]),key:"1"}:void 0]),1040,["mode","value","options","loading","menu-item-selected-icon","popup-class-name","onUpdate:value"]))}});exports.default=se;
@@ -1,2 +1,2 @@
1
- declare const _default: "7.17.2";
1
+ declare const _default: "7.17.4";
2
2
  export default _default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.17.2";exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.17.4";exports.default=e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "7.17.2",
3
+ "version": "7.17.4",
4
4
  "main": "./lib/index.js",
5
5
  "type": "module",
6
6
  "typings": "./lib/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "scroll-into-view-if-needed": "^3.1.0",
42
42
  "vue-virtual-scroller": "2.0.0-beta.8",
43
43
  "vuedraggable": "^4.1.0",
44
- "@aplus-frontend/utils": "1.0.65",
44
+ "@aplus-frontend/utils": "1.0.66",
45
45
  "@aplus-frontend/hooks": "1.0.7"
46
46
  },
47
47
  "peerDependencies": {