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

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