@aplus-frontend/ui 7.13.3 → 7.13.5

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 ne, watch as ae, unref as n, createElementBlock as I, createBlock as k, openBlock as p, toDisplayString as C, mergeProps as re, h as se, createSlots as ue, withCtx as c, createVNode as w, normalizeClass as f, createCommentVNode as _, createElementVNode as x, withModifiers as ie, renderList as ce, renderSlot as de, normalizeProps as pe, 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
+ s += 1;
117
+ const l = s;
116
118
  v([]), a.value = !0, e.request(o).then((t) => {
117
- r === l && (v(t), a.value = !1);
119
+ s === l && (v(t), a.value = !1);
118
120
  });
119
- }, e.searchDelay), z = (o, l) => {
121
+ }, e.searchDelay), $ = (o, l) => {
120
122
  const t = e.fieldNames?.label || "label";
121
123
  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(() => {
124
+ }, { options: m, updateOptions: v } = ke(e), S = le(), a = 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
+ a.value = !0, s += 1;
132
+ const l = 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 (l !== s)
135
137
  return;
136
138
  v(t);
137
139
  } finally {
138
140
  a.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 && !a.value && h(!0);
143
145
  }
144
- oe(() => {
146
+ ne(() => {
145
147
  e.lazy || h();
146
- }), te(
148
+ }), ae(
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(() => {
157
+ const { value: i, updateValue: y } = Fe(e, K), H = be("Select", e), W = r(() => {
156
158
  const o = n(i);
157
159
  if (!o)
158
160
  return e.emptyText;
159
161
  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
+ return ge(o) ? o.map(
163
+ (d) => n(m).find((oe) => oe[t] === d)?.[l]
162
164
  ).filter(Boolean).join("、") || e.emptyText : n(m).find(
163
- (c) => c[t] === o
165
+ (d) => d[t] === o
164
166
  )?.[l] || e.emptyText;
165
- }), H = s(() => {
167
+ }), G = r(() => {
166
168
  const o = !!e?.showSearch, l = e.searchMode;
167
169
  let t = {};
168
170
  return o && (t = l === "request" ? {
169
171
  defaultActiveFirstOption: !1,
170
- onSearch: L,
172
+ onSearch: U,
171
173
  notFoundContent: a.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,118 +186,124 @@ const Oe = { key: 0 }, xe = ["onClick"], ze = /* @__PURE__ */ Z({
184
186
  "onFocus",
185
187
  "onBeforeSelect"
186
188
  ]),
187
- placeholder: n(j),
189
+ placeholder: n(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
+ ), 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() {
194
198
  S.value?.focus();
195
199
  }
196
- function G() {
200
+ function X() {
197
201
  S.value?.blur();
198
202
  }
199
203
  function b(o, l) {
200
204
  const t = e.fieldNames?.[l] ?? l;
201
205
  return o[t];
202
206
  }
203
- function J(o) {
207
+ function Y(o) {
204
208
  const l = b(o, "value");
205
209
  y(e.multiple ? [l] : l);
206
210
  }
207
- const A = s(() => {
211
+ const A = r(() => {
208
212
  const o = n(i) || [], l = g.value;
209
213
  return l.length > 0 && l.every((t) => o.includes(t));
210
- }), Q = s(() => (n(i) || []).length > 0 && !A.value);
211
- function X() {
214
+ }), Z = r(() => (n(i) || []).length > 0 && !A.value);
215
+ function ee() {
212
216
  console.log("123");
213
217
  const o = n(i) || [], l = g.value;
214
218
  l.length && l.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, l) => o.mode === "read" ? (p(), I("span", Ne, C(W.value), 1)) : (p(), k(n(ve), re({
221
225
  key: 1,
222
226
  ref_key: "selectRef",
223
227
  ref: S,
224
228
  "allow-clear": ""
225
- }, H.value, {
226
- mode: $.value,
229
+ }, G.value, {
230
+ mode: j.value,
227
231
  value: n(i),
228
232
  options: n(m),
229
233
  loading: a.value,
230
- "menu-item-selected-icon": ne("span"),
231
- "popup-class-name": `${n(u)("popup")} ${n(R)}`,
232
- open: N.value,
234
+ "menu-item-selected-icon": se("span"),
235
+ "popup-class-name": `${n(u)("popup")} ${n(z)}`,
236
+ open: O.value,
233
237
  "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), {
238
+ onFocus: E,
239
+ onDropdownVisibleChange: l[0] || (l[0] = (t) => O.value = t)
240
+ }), ue({
241
+ option: c((t) => [
242
+ w(n(M), {
239
243
  justify: "space-between",
240
244
  align: "center",
241
245
  class: f(n(u)("popup-option-wrapper")),
242
246
  gap: 8
243
247
  }, {
244
- default: d(() => [
245
- C(n(me), null, {
246
- default: d(() => [
247
- x.value ? (p(), k(n(M), {
248
+ default: c(() => [
249
+ w(n(M), {
250
+ gap: 8,
251
+ align: "center"
252
+ }, {
253
+ default: c(() => [
254
+ N.value ? (p(), k(n(P), {
248
255
  key: 0,
249
256
  checked: n(i)?.includes(
250
257
  b(t, "value")
251
258
  )
252
259
  }, null, 8, ["checked"])) : _("", !0),
253
- F("span", {
260
+ x("span", {
254
261
  class: f(n(u)("popup-option-label"))
255
- }, w(b(t, "label")), 3)
262
+ }, C(b(t, "label")), 3)
256
263
  ]),
257
264
  _: 2
258
265
  }, 1024),
259
- o.multiple && o.allowOnlySelect ? (p(), I("span", {
266
+ J.value ? (p(), I("span", {
260
267
  key: 0,
261
268
  class: f(n(u)("popup-option-action")),
262
- onClick: re(() => J(t), ["stop"])
263
- }, w(n(O)("ap.field.chooseOnly")), 11, xe)) : _("", !0)
269
+ onClick: ie(() => Y(t), ["stop"])
270
+ }, C(n(F)("ap.field.chooseOnly")), 11, Ae)) : _("", !0)
264
271
  ]),
265
272
  _: 2
266
273
  }, 1032, ["class"])
267
274
  ]),
268
275
  _: 2
269
276
  }, [
270
- se(o.$slots, (t, B) => ({
277
+ ce(o.$slots, (t, B) => ({
271
278
  name: B,
272
- fn: d((c) => [
273
- ue(o.$slots, B, ie(de(c || {})))
279
+ fn: c((d) => [
280
+ de(o.$slots, B, pe(fe(d || {})))
274
281
  ])
275
282
  })),
276
283
  a.value ? {
277
284
  name: "notFoundContent",
278
- fn: d(() => [
279
- C(n(ve), { size: "small" })
285
+ fn: c(() => [
286
+ w(n(he), { size: "small" })
280
287
  ]),
281
288
  key: "0"
282
289
  } : void 0,
283
- x.value ? {
290
+ N.value ? {
284
291
  name: "dropdownRender",
285
- fn: d(({ menuNode: t }) => [
286
- F("button", {
292
+ fn: c(({ menuNode: t }) => [
293
+ x("div", {
294
+ tabindex: -1,
287
295
  class: f(n(u)("popup-all-option")),
288
- onClick: X
296
+ onClick: ee
289
297
  }, [
290
- C(n(M), {
298
+ w(n(P), {
291
299
  checked: A.value,
292
- indeterminate: Q.value
300
+ indeterminate: Z.value
293
301
  }, null, 8, ["checked", "indeterminate"]),
294
- F("span", {
302
+ x("span", {
295
303
  class: f(n(u)("popup-all-option-label"))
296
- }, w(n(O)("ap.field.selectAll")), 3)
304
+ }, C(n(F)("ap.field.selectAll")), 3)
297
305
  ], 2),
298
- (p(), k(ce(t)))
306
+ (p(), k(me(t)))
299
307
  ]),
300
308
  key: "1"
301
309
  } : void 0
@@ -303,5 +311,5 @@ const Oe = { key: 0 }, xe = ["onClick"], ze = /* @__PURE__ */ Z({
303
311
  }
304
312
  });
305
313
  export {
306
- ze as default
314
+ Ke as default
307
315
  };
@@ -1,27 +1,27 @@
1
- import { singleRow as l } from "../../style/index.mjs";
1
+ import { singleRow as a } from "../../style/index.mjs";
2
2
  const n = (i) => {
3
- const { componentCls: p } = i, o = `${p}-select-popup`;
3
+ const { componentCls: o } = i, p = `${o}-select-popup`;
4
4
  return {
5
- [`${o}`]: {
5
+ [`${p}`]: {
6
6
  padding: i.space,
7
- [`${o}-all-option`]: {
7
+ [`${p}-all-option`]: {
8
8
  width: "100%",
9
9
  display: "inline-flex",
10
10
  cursor: "pointer",
11
11
  paddingInline: i.space,
12
12
  paddingBlock: i.spaceSM,
13
- [`${o}-all-option-label`]: {
13
+ [`${p}-all-option-label`]: {
14
14
  paddingInline: i.space
15
15
  }
16
16
  },
17
- [`${o}-option-wrapper`]: {
17
+ [`${p}-option-wrapper`]: {
18
18
  height: "22px"
19
19
  },
20
- [`${o}-option-label`]: {
21
- ...l(i),
20
+ [`${p}-option-label`]: {
21
+ ...a(i),
22
22
  color: "inherit"
23
23
  },
24
- [`${o}-option-action`]: {
24
+ [`${p}-option-action`]: {
25
25
  display: "none",
26
26
  color: i.colorPrimary,
27
27
  paddingInline: i.spaceSM,
@@ -32,18 +32,18 @@ const n = (i) => {
32
32
  borderRadius: "2px"
33
33
  }
34
34
  },
35
- "div.ant-select-item:not(:last-child)": {
35
+ "div.ant-select-item": {
36
36
  paddingInline: i.space,
37
37
  paddingBlock: i.spaceXS,
38
38
  fontWeight: "normal !important",
39
39
  marginBottom: i.spaceXS,
40
40
  "&:hover": {
41
- [`${o}-option-action`]: {
41
+ [`${p}-option-action`]: {
42
42
  display: "inline"
43
43
  }
44
44
  },
45
- "&.ant-select-item-option-selected:not(.ant-select-item-option-disabled)": {
46
- color: i.colorPrimary
45
+ "&:last-child": {
46
+ marginBottom: 0
47
47
  }
48
48
  }
49
49
  }
@@ -1,2 +1,2 @@
1
- declare const _default: "7.13.3";
1
+ declare const _default: "7.13.5";
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- const e = "7.13.3";
1
+ const e = "7.13.5";
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:O}){let u=0;const o=B,{b:s}=K.useNamespace("field-select"),V=$.default("field"),w=e.ref(!1),{t:S}=H.useLocale(),x=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=O,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:x,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(V)}`,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("button",{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"),r=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:s}=W.useNamespace("field-select"),F=K.default("field"),w=e.ref(!1),{t:S}=G.useLocale(),V=r.debounce(o=>{if(!r.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(!r.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 r.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:V,notFoundContent:a.value?void 0:null,filterOption:!1,suffixIcon:null}:{filterOption:r.isNil(t?.filterOption)?q:t?.filterOption}),{...r.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:r.isNumber(t.addAll)?h.value.length>=t.addAll:!!t.addAll),T=e.computed(()=>t.multiple&&t.allowOnlySelect&&(!B.isDef(t.maxCount)||t.maxCount>=1));function z(){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:z,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(s)("popup")} ${e.unref(F)}`,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.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(s)("popup-option-label"))},e.toDisplayString(C(l,"label")),3)]),_:2},1024),T.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(s)("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",{tabindex:-1,class:e.normalizeClass(e.unref(s)("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(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=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:not(:last-child)":{paddingInline:i.space,paddingBlock:i.spaceXS,fontWeight:"normal !important",marginBottom:i.spaceXS,"&:hover":{[`${e}-option-action`]:{display:"inline"}},"&.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:e}=i,o=`${e}-select-popup`;return{[`${o}`]:{padding:i.space,[`${o}-all-option`]:{width:"100%",display:"inline-flex",cursor:"pointer",paddingInline:i.space,paddingBlock:i.spaceSM,[`${o}-all-option-label`]:{paddingInline:i.space}},[`${o}-option-wrapper`]:{height:"22px"},[`${o}-option-label`]:{...l.singleRow(i),color:"inherit"},[`${o}-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":{[`${o}-option-action`]:{display:"inline"}},"&:last-child":{marginBottom:0}}}}};exports.genSelectStyle=n;
@@ -1,2 +1,2 @@
1
- declare const _default: "7.13.3";
1
+ declare const _default: "7.13.5";
2
2
  export default _default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.13.3";exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.13.5";exports.default=e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "7.13.3",
3
+ "version": "7.13.5",
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.4",
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.4",
55
55
  "@aplus-frontend/icon": "^2.0.6",
56
56
  "@aplus-frontend/oss": "^2.0.1",
57
57
  "@emotion/serialize": "^1.3.3",