| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298 |
- import { d, l as Nn, P as s, av as Vn, _ as Q, c as fe, p as qe, J as Ze, aw as Ln, K as C, i as An, n as Hn, ax as Wn, af as Kn, A as _n, ad as jn, ac as Un, ay as Xn, az as Gn, aA as je, aB as Ue, r as Fe, aC as Yn, aD as Qn, aE as Jn, aF as qn, t as Pe, m as Z, aG as ke, g as Zn, v as kn } from "./index2.js";
- import { defineComponent as ce, computed as N, ref as ue, createVNode as f, cloneVNode as eo, isVNode as no, inject as De, provide as Ee, shallowRef as W, watchEffect as en, onMounted as re, watch as ae, createTextVNode as Te, Fragment as he, onBeforeUnmount as Oe, isRef as oo, reactive as Xe, toRefs as to } from "vue";
- import { B as io } from "./BaseInput.js";
- import { c as nn } from "./createRef.js";
- import { i as lo } from "./isMobile.js";
- function Ge(e, n) {
- const {
- key: o
- } = e;
- let t;
- return "value" in e && ({
- value: t
- } = e), o != null ? o : t !== void 0 ? t : `rc-index-key-${n}`;
- }
- function ao(e, n) {
- const {
- label: o,
- value: t,
- options: i
- } = e || {};
- return {
- label: o || (n ? "children" : "label"),
- value: t || "value",
- options: i || "options"
- };
- }
- function qo(e) {
- let {
- fieldNames: n,
- childrenAsData: o
- } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
- const t = [], {
- label: i,
- value: l,
- options: p
- } = ao(n, !1);
- function m(I, g) {
- I.forEach((a) => {
- const x = a[i];
- if (g || !(p in a)) {
- const $ = a[l];
- t.push({
- key: Ge(a, t.length),
- groupOption: g,
- data: a,
- label: x,
- value: $
- });
- } else {
- let $ = x;
- $ === void 0 && o && ($ = a.label), t.push({
- key: Ge(a, t.length),
- group: !0,
- data: a,
- label: $
- }), m(a[p], !0);
- }
- });
- }
- return m(e, !1), t;
- }
- function Zo(e) {
- const n = d({}, e);
- return "props" in n || Object.defineProperty(n, "props", {
- get() {
- return Nn(!1, "Return type is option instead of Option instance. Please read value directly instead of reading from `props`."), n;
- }
- }), n;
- }
- function ro(e, n) {
- if (!n || !n.length)
- return null;
- let o = !1;
- function t(l, p) {
- let [m, ...I] = p;
- if (!m)
- return [l];
- const g = l.split(m);
- return o = o || g.length > 1, g.reduce((a, x) => [...a, ...t(x, I)], []).filter((a) => a);
- }
- const i = t(e, n);
- return o ? i : null;
- }
- var uo = function(e, n) {
- var o = {};
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (o[t] = e[t]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
- n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (o[t[i]] = e[t[i]]);
- return o;
- };
- const so = (e) => {
- const n = e === !0 ? 0 : 1;
- return {
- bottomLeft: {
- points: ["tl", "bl"],
- offset: [0, 4],
- overflow: {
- adjustX: n,
- adjustY: 1
- }
- },
- bottomRight: {
- points: ["tr", "br"],
- offset: [0, 4],
- overflow: {
- adjustX: n,
- adjustY: 1
- }
- },
- topLeft: {
- points: ["bl", "tl"],
- offset: [0, -4],
- overflow: {
- adjustX: n,
- adjustY: 1
- }
- },
- topRight: {
- points: ["br", "tr"],
- offset: [0, -4],
- overflow: {
- adjustX: n,
- adjustY: 1
- }
- }
- };
- }, co = ce({
- name: "SelectTrigger",
- inheritAttrs: !1,
- props: {
- dropdownAlign: Object,
- visible: {
- type: Boolean,
- default: void 0
- },
- disabled: {
- type: Boolean,
- default: void 0
- },
- dropdownClassName: String,
- dropdownStyle: s.object,
- placement: String,
- empty: {
- type: Boolean,
- default: void 0
- },
- prefixCls: String,
- popupClassName: String,
- animation: String,
- transitionName: String,
- getPopupContainer: Function,
- dropdownRender: Function,
- containerWidth: Number,
- dropdownMatchSelectWidth: s.oneOfType([Number, Boolean]).def(!0),
- popupElement: s.any,
- direction: String,
- getTriggerDOMNode: Function,
- onPopupVisibleChange: Function,
- onPopupMouseEnter: Function,
- onPopupFocusin: Function,
- onPopupFocusout: Function
- },
- setup(e, n) {
- let {
- slots: o,
- attrs: t,
- expose: i
- } = n;
- const l = N(() => {
- const {
- dropdownMatchSelectWidth: m
- } = e;
- return so(m);
- }), p = ue();
- return i({
- getPopupElement: () => p.value
- }), () => {
- const m = d(d({}, e), t), {
- empty: I = !1
- } = m, g = uo(m, ["empty"]), {
- visible: a,
- dropdownAlign: x,
- prefixCls: $,
- popupElement: P,
- dropdownClassName: h,
- dropdownStyle: S,
- direction: b = "ltr",
- placement: c,
- dropdownMatchSelectWidth: v,
- containerWidth: T,
- dropdownRender: y,
- animation: O,
- transitionName: F,
- getPopupContainer: w,
- getTriggerDOMNode: U,
- onPopupVisibleChange: E,
- onPopupMouseEnter: V,
- onPopupFocusin: R,
- onPopupFocusout: Y
- } = g, L = `${$}-dropdown`;
- let X = P;
- y && (X = y({
- menuNode: P,
- props: e
- }));
- const D = O ? `${L}-${O}` : F, B = d({
- minWidth: `${T}px`
- }, S);
- return typeof v == "number" ? B.width = `${v}px` : v && (B.width = `${T}px`), f(Vn, Q(Q({}, e), {}, {
- showAction: E ? ["click"] : [],
- hideAction: E ? ["click"] : [],
- popupPlacement: c || (b === "rtl" ? "bottomRight" : "bottomLeft"),
- builtinPlacements: l.value,
- prefixCls: L,
- popupTransitionName: D,
- popupAlign: x,
- popupVisible: a,
- getPopupContainer: w,
- popupClassName: fe(h, {
- [`${L}-empty`]: I
- }),
- popupStyle: B,
- getTriggerDOMNode: U,
- onPopupVisibleChange: E
- }), {
- default: o.default,
- popup: () => f("div", {
- ref: p,
- onMouseenter: V,
- onFocusin: R,
- onFocusout: Y
- }, [X])
- });
- };
- }
- }), se = (e, n) => {
- let {
- slots: o
- } = n;
- var t;
- const {
- class: i,
- customizeIcon: l,
- customizeIconProps: p,
- onMousedown: m,
- onClick: I
- } = e;
- let g;
- return typeof l == "function" ? g = l(p) : g = no(l) ? eo(l) : l, f("span", {
- class: i,
- onMousedown: (a) => {
- a.preventDefault(), m && m(a);
- },
- style: {
- userSelect: "none",
- WebkitUserSelect: "none"
- },
- unselectable: "on",
- onClick: I,
- "aria-hidden": !0
- }, [g !== void 0 ? g : f("span", {
- class: i.split(/\s+/).map((a) => `${a}-icon`)
- }, [(t = o.default) === null || t === void 0 ? void 0 : t.call(o)])]);
- };
- se.inheritAttrs = !1;
- se.displayName = "TransBtn";
- se.props = {
- class: String,
- customizeIcon: s.any,
- customizeIconProps: s.any,
- onMousedown: Function,
- onClick: Function
- };
- const po = {
- inputRef: s.any,
- prefixCls: String,
- id: String,
- inputElement: s.VueNode,
- disabled: {
- type: Boolean,
- default: void 0
- },
- autofocus: {
- type: Boolean,
- default: void 0
- },
- autocomplete: String,
- editable: {
- type: Boolean,
- default: void 0
- },
- activeDescendantId: String,
- value: String,
- open: {
- type: Boolean,
- default: void 0
- },
- tabindex: s.oneOfType([s.number, s.string]),
- /** Pass accessibility props to input */
- attrs: s.object,
- onKeydown: {
- type: Function
- },
- onMousedown: {
- type: Function
- },
- onChange: {
- type: Function
- },
- onPaste: {
- type: Function
- },
- onCompositionstart: {
- type: Function
- },
- onCompositionend: {
- type: Function
- },
- onFocus: {
- type: Function
- },
- onBlur: {
- type: Function
- }
- }, on = ce({
- compatConfig: {
- MODE: 3
- },
- name: "SelectInput",
- inheritAttrs: !1,
- props: po,
- setup(e) {
- let n = null;
- const o = De("VCSelectContainerEvent");
- return () => {
- var t;
- const {
- prefixCls: i,
- id: l,
- inputElement: p,
- disabled: m,
- tabindex: I,
- autofocus: g,
- autocomplete: a,
- editable: x,
- activeDescendantId: $,
- value: P,
- onKeydown: h,
- onMousedown: S,
- onChange: b,
- onPaste: c,
- onCompositionstart: v,
- onCompositionend: T,
- onFocus: y,
- onBlur: O,
- open: F,
- inputRef: w,
- attrs: U
- } = e;
- let E = p || f(io, null, null);
- const V = E.props || {}, {
- onKeydown: R,
- onInput: Y,
- onFocus: L,
- onBlur: X,
- onMousedown: D,
- onCompositionstart: B,
- onCompositionend: oe,
- style: te
- } = V;
- return E = qe(E, d(d(d(d(d({
- type: "search"
- }, V), {
- id: l,
- ref: w,
- disabled: m,
- tabindex: I,
- lazy: !1,
- autocomplete: a || "off",
- autofocus: g,
- class: fe(`${i}-selection-search-input`, (t = E == null ? void 0 : E.props) === null || t === void 0 ? void 0 : t.class),
- role: "combobox",
- "aria-expanded": F,
- "aria-haspopup": "listbox",
- "aria-owns": `${l}_list`,
- "aria-autocomplete": "list",
- "aria-controls": `${l}_list`,
- "aria-activedescendant": $
- }), U), {
- value: x ? P : "",
- readonly: !x,
- unselectable: x ? null : "on",
- style: d(d({}, te), {
- opacity: x ? null : 0
- }),
- onKeydown: (M) => {
- h(M), R && R(M);
- },
- onMousedown: (M) => {
- S(M), D && D(M);
- },
- onInput: (M) => {
- b(M), Y && Y(M);
- },
- onCompositionstart(M) {
- v(M), B && B(M);
- },
- onCompositionend(M) {
- T(M), oe && oe(M);
- },
- onPaste: c,
- onFocus: function() {
- clearTimeout(n), L && L(arguments.length <= 0 ? void 0 : arguments[0]), y && y(arguments.length <= 0 ? void 0 : arguments[0]), o == null || o.focus(arguments.length <= 0 ? void 0 : arguments[0]);
- },
- onBlur: function() {
- for (var M = arguments.length, J = new Array(M), ie = 0; ie < M; ie++)
- J[ie] = arguments[ie];
- n = setTimeout(() => {
- X && X(J[0]), O && O(J[0]), o == null || o.blur(J[0]);
- }, 100);
- }
- }), E.type === "textarea" ? {} : {
- type: "search"
- }), !0, !0), E;
- };
- }
- }), tn = Symbol("TreeSelectLegacyContextPropsKey");
- function ko(e) {
- return Ee(tn, e);
- }
- function Me() {
- return De(tn, {});
- }
- const fo = {
- id: String,
- prefixCls: String,
- values: s.array,
- open: {
- type: Boolean,
- default: void 0
- },
- searchValue: String,
- inputRef: s.any,
- placeholder: s.any,
- disabled: {
- type: Boolean,
- default: void 0
- },
- mode: String,
- showSearch: {
- type: Boolean,
- default: void 0
- },
- autofocus: {
- type: Boolean,
- default: void 0
- },
- autocomplete: String,
- activeDescendantId: String,
- tabindex: s.oneOfType([s.number, s.string]),
- compositionStatus: Boolean,
- removeIcon: s.any,
- choiceTransitionName: String,
- maxTagCount: s.oneOfType([s.number, s.string]),
- maxTagTextLength: Number,
- maxTagPlaceholder: s.any.def(() => (e) => `+ ${e.length} ...`),
- tagRender: Function,
- onToggleOpen: {
- type: Function
- },
- onRemove: Function,
- onInputChange: Function,
- onInputPaste: Function,
- onInputKeyDown: Function,
- onInputMouseDown: Function,
- onInputCompositionStart: Function,
- onInputCompositionEnd: Function
- }, Ye = (e) => {
- e.preventDefault(), e.stopPropagation();
- }, mo = ce({
- name: "MultipleSelectSelector",
- inheritAttrs: !1,
- props: fo,
- setup(e) {
- const n = W(), o = W(0), t = W(!1), i = Me(), l = N(() => `${e.prefixCls}-selection`), p = N(() => e.open || e.mode === "tags" ? e.searchValue : ""), m = N(() => e.mode === "tags" || e.showSearch && (e.open || t.value)), I = ue("");
- en(() => {
- I.value = p.value;
- }), re(() => {
- ae(I, () => {
- o.value = n.value.scrollWidth;
- }, {
- flush: "post",
- immediate: !0
- });
- });
- function g(h, S, b, c, v) {
- return f("span", {
- class: fe(`${l.value}-item`, {
- [`${l.value}-item-disabled`]: b
- }),
- title: typeof h == "string" || typeof h == "number" ? h.toString() : void 0
- }, [f("span", {
- class: `${l.value}-item-content`
- }, [S]), c && f(se, {
- class: `${l.value}-item-remove`,
- onMousedown: Ye,
- onClick: v,
- customizeIcon: e.removeIcon
- }, {
- default: () => [Te("×")]
- })]);
- }
- function a(h, S, b, c, v, T) {
- var y;
- const O = (w) => {
- Ye(w), e.onToggleOpen(!open);
- };
- let F = T;
- return i.keyEntities && (F = ((y = i.keyEntities[h]) === null || y === void 0 ? void 0 : y.node) || {}), f("span", {
- key: h,
- onMousedown: O
- }, [e.tagRender({
- label: S,
- value: h,
- disabled: b,
- closable: c,
- onClose: v,
- option: F
- })]);
- }
- function x(h) {
- const {
- disabled: S,
- label: b,
- value: c,
- option: v
- } = h, T = !e.disabled && !S;
- let y = b;
- if (typeof e.maxTagTextLength == "number" && (typeof b == "string" || typeof b == "number")) {
- const F = String(y);
- F.length > e.maxTagTextLength && (y = `${F.slice(0, e.maxTagTextLength)}...`);
- }
- const O = (F) => {
- var w;
- F && F.stopPropagation(), (w = e.onRemove) === null || w === void 0 || w.call(e, h);
- };
- return typeof e.tagRender == "function" ? a(c, y, S, T, O, v) : g(b, y, S, T, O);
- }
- function $(h) {
- const {
- maxTagPlaceholder: S = (c) => `+ ${c.length} ...`
- } = e, b = typeof S == "function" ? S(h) : S;
- return g(b, b, !1);
- }
- const P = (h) => {
- const S = h.target.composing;
- I.value = h.target.value, S || e.onInputChange(h);
- };
- return () => {
- const {
- id: h,
- prefixCls: S,
- values: b,
- open: c,
- inputRef: v,
- placeholder: T,
- disabled: y,
- autofocus: O,
- autocomplete: F,
- activeDescendantId: w,
- tabindex: U,
- compositionStatus: E,
- onInputPaste: V,
- onInputKeyDown: R,
- onInputMouseDown: Y,
- onInputCompositionStart: L,
- onInputCompositionEnd: X
- } = e, D = f("div", {
- class: `${l.value}-search`,
- style: {
- width: o.value + "px"
- },
- key: "input"
- }, [f(on, {
- inputRef: v,
- open: c,
- prefixCls: S,
- id: h,
- inputElement: null,
- disabled: y,
- autofocus: O,
- autocomplete: F,
- editable: m.value,
- activeDescendantId: w,
- value: I.value,
- onKeydown: R,
- onMousedown: Y,
- onChange: P,
- onPaste: V,
- onCompositionstart: L,
- onCompositionend: X,
- tabindex: U,
- attrs: Ze(e, !0),
- onFocus: () => t.value = !0,
- onBlur: () => t.value = !1
- }, null), f("span", {
- ref: n,
- class: `${l.value}-search-mirror`,
- "aria-hidden": !0
- }, [I.value, Te(" ")])]), B = f(Ln, {
- prefixCls: `${l.value}-overflow`,
- data: b,
- renderItem: x,
- renderRest: $,
- suffix: D,
- itemKey: "key",
- maxCount: e.maxTagCount,
- key: "overflow"
- }, null);
- return f(he, null, [B, !b.length && !p.value && !E && f("span", {
- class: `${l.value}-placeholder`
- }, [T])]);
- };
- }
- }), go = {
- inputElement: s.any,
- id: String,
- prefixCls: String,
- values: s.array,
- open: {
- type: Boolean,
- default: void 0
- },
- searchValue: String,
- inputRef: s.any,
- placeholder: s.any,
- compositionStatus: {
- type: Boolean,
- default: void 0
- },
- disabled: {
- type: Boolean,
- default: void 0
- },
- mode: String,
- showSearch: {
- type: Boolean,
- default: void 0
- },
- autofocus: {
- type: Boolean,
- default: void 0
- },
- autocomplete: String,
- activeDescendantId: String,
- tabindex: s.oneOfType([s.number, s.string]),
- activeValue: String,
- backfill: {
- type: Boolean,
- default: void 0
- },
- optionLabelRender: Function,
- onInputChange: Function,
- onInputPaste: Function,
- onInputKeyDown: Function,
- onInputMouseDown: Function,
- onInputCompositionStart: Function,
- onInputCompositionEnd: Function
- }, Re = ce({
- name: "SingleSelector",
- setup(e) {
- const n = W(!1), o = N(() => e.mode === "combobox"), t = N(() => o.value || e.showSearch), i = N(() => {
- let a = e.searchValue || "";
- return o.value && e.activeValue && !n.value && (a = e.activeValue), a;
- }), l = Me();
- ae([o, () => e.activeValue], () => {
- o.value && (n.value = !1);
- }, {
- immediate: !0
- });
- const p = N(() => e.mode !== "combobox" && !e.open && !e.showSearch ? !1 : !!i.value || e.compositionStatus), m = N(() => {
- const a = e.values[0];
- return a && (typeof a.label == "string" || typeof a.label == "number") ? a.label.toString() : void 0;
- }), I = () => {
- if (e.values[0])
- return null;
- const a = p.value ? {
- visibility: "hidden"
- } : void 0;
- return f("span", {
- class: `${e.prefixCls}-selection-placeholder`,
- style: a
- }, [e.placeholder]);
- }, g = (a) => {
- a.target.composing || (n.value = !0, e.onInputChange(a));
- };
- return () => {
- var a, x, $, P;
- const {
- inputElement: h,
- prefixCls: S,
- id: b,
- values: c,
- inputRef: v,
- disabled: T,
- autofocus: y,
- autocomplete: O,
- activeDescendantId: F,
- open: w,
- tabindex: U,
- optionLabelRender: E,
- onInputKeyDown: V,
- onInputMouseDown: R,
- onInputPaste: Y,
- onInputCompositionStart: L,
- onInputCompositionEnd: X
- } = e, D = c[0];
- let B = null;
- if (D && l.customSlots) {
- const oe = (a = D.key) !== null && a !== void 0 ? a : D.value, te = ((x = l.keyEntities[oe]) === null || x === void 0 ? void 0 : x.node) || {};
- B = l.customSlots[($ = te.slots) === null || $ === void 0 ? void 0 : $.title] || l.customSlots.title || D.label, typeof B == "function" && (B = B(te));
- } else
- B = E && D ? E(D.option) : D == null ? void 0 : D.label;
- return f(he, null, [f("span", {
- class: `${S}-selection-search`
- }, [f(on, {
- inputRef: v,
- prefixCls: S,
- id: b,
- open: w,
- inputElement: h,
- disabled: T,
- autofocus: y,
- autocomplete: O,
- editable: t.value,
- activeDescendantId: F,
- value: i.value,
- onKeydown: V,
- onMousedown: R,
- onChange: g,
- onPaste: Y,
- onCompositionstart: L,
- onCompositionend: X,
- tabindex: U,
- attrs: Ze(e, !0)
- }, null)]), !o.value && D && !p.value && f("span", {
- class: `${S}-selection-item`,
- title: m.value
- }, [f(he, {
- key: (P = D.key) !== null && P !== void 0 ? P : D.value
- }, [B])]), I()]);
- };
- }
- });
- Re.props = go;
- Re.inheritAttrs = !1;
- function ho(e) {
- return ![
- // System function button
- C.ESC,
- C.SHIFT,
- C.BACKSPACE,
- C.TAB,
- C.WIN_KEY,
- C.ALT,
- C.META,
- C.WIN_KEY_RIGHT,
- C.CTRL,
- C.SEMICOLON,
- C.EQUALS,
- C.CAPS_LOCK,
- C.CONTEXT_MENU,
- // F1-F12
- C.F1,
- C.F2,
- C.F3,
- C.F4,
- C.F5,
- C.F6,
- C.F7,
- C.F8,
- C.F9,
- C.F10,
- C.F11,
- C.F12
- ].includes(e);
- }
- function ln() {
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 250, n = null, o;
- Oe(() => {
- clearTimeout(o);
- });
- function t(i) {
- (i || n === null) && (n = i), clearTimeout(o), o = setTimeout(() => {
- n = null;
- }, e);
- }
- return [() => n, t];
- }
- const vo = ce({
- name: "Selector",
- inheritAttrs: !1,
- props: {
- id: String,
- prefixCls: String,
- showSearch: {
- type: Boolean,
- default: void 0
- },
- open: {
- type: Boolean,
- default: void 0
- },
- /** Display in the Selector value, it's not same as `value` prop */
- values: s.array,
- multiple: {
- type: Boolean,
- default: void 0
- },
- mode: String,
- searchValue: String,
- activeValue: String,
- inputElement: s.any,
- autofocus: {
- type: Boolean,
- default: void 0
- },
- activeDescendantId: String,
- tabindex: s.oneOfType([s.number, s.string]),
- disabled: {
- type: Boolean,
- default: void 0
- },
- placeholder: s.any,
- removeIcon: s.any,
- // Tags
- maxTagCount: s.oneOfType([s.number, s.string]),
- maxTagTextLength: Number,
- maxTagPlaceholder: s.any,
- tagRender: Function,
- optionLabelRender: Function,
- /** Check if `tokenSeparators` contains `\n` or `\r\n` */
- tokenWithEnter: {
- type: Boolean,
- default: void 0
- },
- // Motion
- choiceTransitionName: String,
- onToggleOpen: {
- type: Function
- },
- /** `onSearch` returns go next step boolean to check if need do toggle open */
- onSearch: Function,
- onSearchSubmit: Function,
- onRemove: Function,
- onInputKeyDown: {
- type: Function
- },
- /**
- * @private get real dom for trigger align.
- * This may be removed after React provides replacement of `findDOMNode`
- */
- domRef: Function
- },
- setup(e, n) {
- let {
- expose: o
- } = n;
- const t = nn(), i = ue(!1), [l, p] = ln(0), m = (c) => {
- const {
- which: v
- } = c;
- (v === C.UP || v === C.DOWN) && c.preventDefault(), e.onInputKeyDown && e.onInputKeyDown(c), v === C.ENTER && e.mode === "tags" && !i.value && !e.open && e.onSearchSubmit(c.target.value), ho(v) && e.onToggleOpen(!0);
- }, I = () => {
- p(!0);
- };
- let g = null;
- const a = (c) => {
- e.onSearch(c, !0, i.value) !== !1 && e.onToggleOpen(!0);
- }, x = () => {
- i.value = !0;
- }, $ = (c) => {
- i.value = !1, e.mode !== "combobox" && a(c.target.value);
- }, P = (c) => {
- let {
- target: {
- value: v
- }
- } = c;
- if (e.tokenWithEnter && g && /[\r\n]/.test(g)) {
- const T = g.replace(/[\r\n]+$/, "").replace(/\r\n/g, " ").replace(/[\r\n]/g, " ");
- v = v.replace(T, g);
- }
- g = null, a(v);
- }, h = (c) => {
- const {
- clipboardData: v
- } = c;
- g = v.getData("text");
- }, S = (c) => {
- let {
- target: v
- } = c;
- v !== t.current && (document.body.style.msTouchAction !== void 0 ? setTimeout(() => {
- t.current.focus();
- }) : t.current.focus());
- }, b = (c) => {
- const v = l();
- c.target !== t.current && !v && c.preventDefault(), (e.mode !== "combobox" && (!e.showSearch || !v) || !e.open) && (e.open && e.onSearch("", !0, !1), e.onToggleOpen());
- };
- return o({
- focus: () => {
- t.current.focus();
- },
- blur: () => {
- t.current.blur();
- }
- }), () => {
- const {
- prefixCls: c,
- domRef: v,
- mode: T
- } = e, y = {
- inputRef: t,
- onInputKeyDown: m,
- onInputMouseDown: I,
- onInputChange: P,
- onInputPaste: h,
- compositionStatus: i.value,
- onInputCompositionStart: x,
- onInputCompositionEnd: $
- }, O = T === "multiple" || T === "tags" ? f(mo, Q(Q({}, e), y), null) : f(Re, Q(Q({}, e), y), null);
- return f("div", {
- ref: v,
- class: `${c}-selector`,
- onClick: S,
- onMousedown: b
- }, [O]);
- };
- }
- });
- function So(e, n, o) {
- function t(i) {
- var l, p, m;
- let I = i.target;
- I.shadowRoot && i.composed && (I = i.composedPath()[0] || I);
- const g = [(l = e[0]) === null || l === void 0 ? void 0 : l.value, (m = (p = e[1]) === null || p === void 0 ? void 0 : p.value) === null || m === void 0 ? void 0 : m.getPopupElement()];
- n.value && g.every((a) => a && !a.contains(I) && a !== I) && o(!1);
- }
- re(() => {
- window.addEventListener("mousedown", t);
- }), Oe(() => {
- window.removeEventListener("mousedown", t);
- });
- }
- function bo() {
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 10;
- const n = W(!1);
- let o;
- const t = () => {
- clearTimeout(o);
- };
- return re(() => {
- t();
- }), [n, (l, p) => {
- t(), o = setTimeout(() => {
- n.value = l, p && p();
- }, e);
- }, t];
- }
- const an = Symbol("BaseSelectContextKey");
- function yo(e) {
- return Ee(an, e);
- }
- function et() {
- return De(an, {});
- }
- function wo(e) {
- if (!oo(e)) return Xe(e);
- const n = new Proxy({}, {
- get(o, t, i) {
- return Reflect.get(e.value, t, i);
- },
- set(o, t, i) {
- return e.value[t] = i, !0;
- },
- deleteProperty(o, t) {
- return Reflect.deleteProperty(e.value, t);
- },
- has(o, t) {
- return Reflect.has(e.value, t);
- },
- ownKeys() {
- return Object.keys(e.value);
- },
- getOwnPropertyDescriptor() {
- return {
- enumerable: !0,
- configurable: !0
- };
- }
- });
- return Xe(n);
- }
- var Io = function(e, n) {
- var o = {};
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && n.indexOf(t) < 0 && (o[t] = e[t]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
- n.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (o[t[i]] = e[t[i]]);
- return o;
- };
- const Co = ["value", "onChange", "removeIcon", "placeholder", "autofocus", "maxTagCount", "maxTagTextLength", "maxTagPlaceholder", "choiceTransitionName", "onInputKeyDown", "onPopupScroll", "tabindex", "OptionList", "notFoundContent"], xo = () => ({
- prefixCls: String,
- id: String,
- omitDomProps: Array,
- // >>> Value
- displayValues: Array,
- onDisplayValuesChange: Function,
- // >>> Active
- /** Current dropdown list active item string value */
- activeValue: String,
- /** Link search input with target element */
- activeDescendantId: String,
- onActiveValueChange: Function,
- // >>> Search
- searchValue: String,
- /** Trigger onSearch, return false to prevent trigger open event */
- onSearch: Function,
- /** Trigger when search text match the `tokenSeparators`. Will provide split content */
- onSearchSplit: Function,
- maxLength: Number,
- OptionList: s.any,
- /** Tell if provided `options` is empty */
- emptyOptions: Boolean
- }), $o = () => ({
- showSearch: {
- type: Boolean,
- default: void 0
- },
- tagRender: {
- type: Function
- },
- optionLabelRender: {
- type: Function
- },
- direction: {
- type: String
- },
- // MISC
- tabindex: Number,
- autofocus: Boolean,
- notFoundContent: s.any,
- placeholder: s.any,
- onClear: Function,
- choiceTransitionName: String,
- // >>> Mode
- mode: String,
- // >>> Status
- disabled: {
- type: Boolean,
- default: void 0
- },
- loading: {
- type: Boolean,
- default: void 0
- },
- // >>> Open
- open: {
- type: Boolean,
- default: void 0
- },
- defaultOpen: {
- type: Boolean,
- default: void 0
- },
- onDropdownVisibleChange: {
- type: Function
- },
- // >>> Customize Input
- /** @private Internal usage. Do not use in your production. */
- getInputElement: {
- type: Function
- },
- /** @private Internal usage. Do not use in your production. */
- getRawInputElement: {
- type: Function
- },
- // >>> Selector
- maxTagTextLength: Number,
- maxTagCount: {
- type: [String, Number]
- },
- maxTagPlaceholder: s.any,
- // >>> Search
- tokenSeparators: {
- type: Array
- },
- // >>> Icons
- allowClear: {
- type: Boolean,
- default: void 0
- },
- showArrow: {
- type: Boolean,
- default: void 0
- },
- inputIcon: s.any,
- /** Clear all icon */
- clearIcon: s.any,
- /** Selector remove icon */
- removeIcon: s.any,
- // >>> Dropdown
- animation: String,
- transitionName: String,
- dropdownStyle: {
- type: Object
- },
- dropdownClassName: String,
- dropdownMatchSelectWidth: {
- type: [Boolean, Number],
- default: void 0
- },
- dropdownRender: {
- type: Function
- },
- dropdownAlign: Object,
- placement: {
- type: String
- },
- getPopupContainer: {
- type: Function
- },
- // >>> Focus
- showAction: {
- type: Array
- },
- onBlur: {
- type: Function
- },
- onFocus: {
- type: Function
- },
- // >>> Rest Events
- onKeyup: Function,
- onKeydown: Function,
- onMousedown: Function,
- onPopupScroll: Function,
- onInputKeyDown: Function,
- onMouseenter: Function,
- onMouseleave: Function,
- onClick: Function
- }), Po = () => d(d({}, xo()), $o());
- function To(e) {
- return e === "tags" || e === "multiple";
- }
- const nt = ce({
- compatConfig: {
- MODE: 3
- },
- name: "BaseSelect",
- inheritAttrs: !1,
- props: An(Po(), {
- showAction: [],
- notFoundContent: "Not Found"
- }),
- setup(e, n) {
- let {
- attrs: o,
- expose: t,
- slots: i
- } = n;
- const l = N(() => To(e.mode)), p = N(() => e.showSearch !== void 0 ? e.showSearch : l.value || e.mode === "combobox"), m = W(!1);
- re(() => {
- m.value = lo();
- });
- const I = Me(), g = W(null), a = nn(), x = W(null), $ = W(null), P = W(null), h = ue(!1), [S, b, c] = bo();
- t({
- focus: () => {
- var r;
- (r = $.value) === null || r === void 0 || r.focus();
- },
- blur: () => {
- var r;
- (r = $.value) === null || r === void 0 || r.blur();
- },
- scrollTo: (r) => {
- var u;
- return (u = P.value) === null || u === void 0 ? void 0 : u.scrollTo(r);
- }
- });
- const y = N(() => {
- var r;
- if (e.mode !== "combobox")
- return e.searchValue;
- const u = (r = e.displayValues[0]) === null || r === void 0 ? void 0 : r.value;
- return typeof u == "string" || typeof u == "number" ? String(u) : "";
- }), O = e.open !== void 0 ? e.open : e.defaultOpen, F = W(O), w = W(O), U = (r) => {
- F.value = e.open !== void 0 ? e.open : r, w.value = F.value;
- };
- ae(() => e.open, () => {
- U(e.open);
- });
- const E = N(() => !e.notFoundContent && e.emptyOptions);
- en(() => {
- w.value = F.value, (e.disabled || E.value && w.value && e.mode === "combobox") && (w.value = !1);
- });
- const V = N(() => E.value ? !1 : w.value), R = (r) => {
- const u = r !== void 0 ? r : !w.value;
- w.value !== u && !e.disabled && (U(u), e.onDropdownVisibleChange && e.onDropdownVisibleChange(u), !u && de.value && (de.value = !1, b(!1, () => {
- J.value = !1, h.value = !1;
- })));
- }, Y = N(() => (e.tokenSeparators || []).some((r) => [`
- `, `\r
- `].includes(r))), L = (r, u, z) => {
- var A, _;
- let H = !0, j = r;
- (A = e.onActiveValueChange) === null || A === void 0 || A.call(e, null);
- const K = z ? null : ro(r, e.tokenSeparators);
- return e.mode !== "combobox" && K && (j = "", (_ = e.onSearchSplit) === null || _ === void 0 || _.call(e, K), R(!1), H = !1), e.onSearch && y.value !== j && e.onSearch(j, {
- source: u ? "typing" : "effect"
- }), H;
- }, X = (r) => {
- var u;
- !r || !r.trim() || (u = e.onSearch) === null || u === void 0 || u.call(e, r, {
- source: "submit"
- });
- };
- ae(w, () => {
- !w.value && !l.value && e.mode !== "combobox" && L("", !1, !1);
- }, {
- immediate: !0,
- flush: "post"
- }), ae(() => e.disabled, () => {
- F.value && e.disabled && U(!1), e.disabled && !h.value && b(!1);
- }, {
- immediate: !0
- });
- const [D, B] = ln(), oe = function(r) {
- var u;
- const z = D(), {
- which: A
- } = r;
- if (A === C.ENTER && (e.mode !== "combobox" && r.preventDefault(), w.value || R(!0)), B(!!y.value), A === C.BACKSPACE && !z && l.value && !y.value && e.displayValues.length) {
- const K = [...e.displayValues];
- let k = null;
- for (let G = K.length - 1; G >= 0; G -= 1) {
- const ee = K[G];
- if (!ee.disabled) {
- K.splice(G, 1), k = ee;
- break;
- }
- }
- k && e.onDisplayValuesChange(K, {
- type: "remove",
- values: [k]
- });
- }
- for (var _ = arguments.length, H = new Array(_ > 1 ? _ - 1 : 0), j = 1; j < _; j++)
- H[j - 1] = arguments[j];
- w.value && P.value && P.value.onKeydown(r, ...H), (u = e.onKeydown) === null || u === void 0 || u.call(e, r, ...H);
- }, te = function(r) {
- for (var u = arguments.length, z = new Array(u > 1 ? u - 1 : 0), A = 1; A < u; A++)
- z[A - 1] = arguments[A];
- w.value && P.value && P.value.onKeyup(r, ...z), e.onKeyup && e.onKeyup(r, ...z);
- }, M = (r) => {
- const u = e.displayValues.filter((z) => z !== r);
- e.onDisplayValuesChange(u, {
- type: "remove",
- values: [r]
- });
- }, J = W(!1), ie = function() {
- b(!0), e.disabled || (e.onFocus && !J.value && e.onFocus(...arguments), e.showAction && e.showAction.includes("focus") && R(!0)), J.value = !0;
- }, de = ue(!1), un = function() {
- if (de.value || (h.value = !0, b(!1, () => {
- J.value = !1, h.value = !1, R(!1);
- }), e.disabled))
- return;
- const r = y.value;
- r && (e.mode === "tags" ? e.onSearch(r, {
- source: "submit"
- }) : e.mode === "multiple" && e.onSearch("", {
- source: "blur"
- })), e.onBlur && e.onBlur(...arguments);
- }, sn = () => {
- de.value = !0;
- }, cn = () => {
- de.value = !1;
- };
- Ee("VCSelectContainerEvent", {
- focus: ie,
- blur: un
- });
- const q = [];
- re(() => {
- q.forEach((r) => clearTimeout(r)), q.splice(0, q.length);
- }), Oe(() => {
- q.forEach((r) => clearTimeout(r)), q.splice(0, q.length);
- });
- const dn = function(r) {
- var u, z;
- const {
- target: A
- } = r, _ = (u = x.value) === null || u === void 0 ? void 0 : u.getPopupElement();
- if (_ && _.contains(A)) {
- const k = setTimeout(() => {
- var G;
- const ee = q.indexOf(k);
- ee !== -1 && q.splice(ee, 1), c(), !m.value && !_.contains(document.activeElement) && ((G = $.value) === null || G === void 0 || G.focus());
- });
- q.push(k);
- }
- for (var H = arguments.length, j = new Array(H > 1 ? H - 1 : 0), K = 1; K < H; K++)
- j[K - 1] = arguments[K];
- (z = e.onMousedown) === null || z === void 0 || z.call(e, r, ...j);
- }, ve = W(null), pn = () => {
- };
- return re(() => {
- ae(V, () => {
- var r;
- if (V.value) {
- const u = Math.ceil((r = g.value) === null || r === void 0 ? void 0 : r.offsetWidth);
- ve.value !== u && !Number.isNaN(u) && (ve.value = u);
- }
- }, {
- immediate: !0,
- flush: "post"
- });
- }), So([g, x], V, R), yo(wo(d(d({}, to(e)), {
- open: w,
- triggerOpen: V,
- showSearch: p,
- multiple: l,
- toggleOpen: R
- }))), () => {
- const r = d(d({}, e), o), {
- prefixCls: u,
- id: z,
- open: A,
- defaultOpen: _,
- mode: H,
- // Search related
- showSearch: j,
- searchValue: K,
- onSearch: k,
- // Icons
- allowClear: G,
- clearIcon: ee,
- showArrow: Be,
- inputIcon: fn,
- // Others
- disabled: Se,
- loading: me,
- getInputElement: ze,
- getPopupContainer: mn,
- placement: gn,
- // Dropdown
- animation: hn,
- transitionName: vn,
- dropdownStyle: Sn,
- dropdownClassName: bn,
- dropdownMatchSelectWidth: yn,
- dropdownRender: wn,
- dropdownAlign: In,
- showAction: Vo,
- direction: Cn,
- // Tags
- tokenSeparators: Lo,
- tagRender: xn,
- optionLabelRender: $n,
- // Events
- onPopupScroll: Ao,
- onDropdownVisibleChange: Ho,
- onFocus: Wo,
- onBlur: Ko,
- onKeyup: _o,
- onKeydown: jo,
- onMousedown: Uo,
- onClear: be,
- omitDomProps: ye,
- getRawInputElement: Ne,
- displayValues: ge,
- onDisplayValuesChange: Pn,
- emptyOptions: Tn,
- activeDescendantId: Fn,
- activeValue: Dn,
- OptionList: En
- } = r, On = Io(r, ["prefixCls", "id", "open", "defaultOpen", "mode", "showSearch", "searchValue", "onSearch", "allowClear", "clearIcon", "showArrow", "inputIcon", "disabled", "loading", "getInputElement", "getPopupContainer", "placement", "animation", "transitionName", "dropdownStyle", "dropdownClassName", "dropdownMatchSelectWidth", "dropdownRender", "dropdownAlign", "showAction", "direction", "tokenSeparators", "tagRender", "optionLabelRender", "onPopupScroll", "onDropdownVisibleChange", "onFocus", "onBlur", "onKeyup", "onKeydown", "onMousedown", "onClear", "omitDomProps", "getRawInputElement", "displayValues", "onDisplayValuesChange", "emptyOptions", "activeDescendantId", "activeValue", "OptionList"]), Ve = H === "combobox" && ze && ze() || null, pe = typeof Ne == "function" && Ne(), we = d({}, On);
- let Le;
- pe && (Le = (ne) => {
- R(ne);
- }), Co.forEach((ne) => {
- delete we[ne];
- }), ye == null || ye.forEach((ne) => {
- delete we[ne];
- });
- const Ae = Be !== void 0 ? Be : me || !l.value && H !== "combobox";
- let He;
- Ae && (He = f(se, {
- class: fe(`${u}-arrow`, {
- [`${u}-arrow-loading`]: me
- }),
- customizeIcon: fn,
- customizeIconProps: {
- loading: me,
- searchValue: y.value,
- open: w.value,
- focused: S.value,
- showSearch: p.value
- }
- }, null));
- let We;
- const Mn = () => {
- be == null || be(), Pn([], {
- type: "clear",
- values: ge
- }), L("", !1, !1);
- };
- !Se && G && (ge.length || y.value) && (We = f(se, {
- class: `${u}-clear`,
- onMousedown: Mn,
- customizeIcon: ee
- }, {
- default: () => [Te("×")]
- }));
- const Rn = f(En, {
- ref: P
- }, d(d({}, I.customSlots), {
- option: i.option
- })), Bn = fe(u, o.class, {
- [`${u}-focused`]: S.value,
- [`${u}-multiple`]: l.value,
- [`${u}-single`]: !l.value,
- [`${u}-allow-clear`]: G,
- [`${u}-show-arrow`]: Ae,
- [`${u}-disabled`]: Se,
- [`${u}-loading`]: me,
- [`${u}-open`]: w.value,
- [`${u}-customize-input`]: Ve,
- [`${u}-show-search`]: p.value
- }), Ke = f(co, {
- ref: x,
- disabled: Se,
- prefixCls: u,
- visible: V.value,
- popupElement: Rn,
- containerWidth: ve.value,
- animation: hn,
- transitionName: vn,
- dropdownStyle: Sn,
- dropdownClassName: bn,
- direction: Cn,
- dropdownMatchSelectWidth: yn,
- dropdownRender: wn,
- dropdownAlign: In,
- placement: gn,
- getPopupContainer: mn,
- empty: Tn,
- getTriggerDOMNode: () => a.current,
- onPopupVisibleChange: Le,
- onPopupMouseEnter: pn,
- onPopupFocusin: sn,
- onPopupFocusout: cn
- }, {
- default: () => pe ? Hn(pe) && qe(pe, {
- ref: a
- }, !1, !0) : f(vo, Q(Q({}, e), {}, {
- domRef: a,
- prefixCls: u,
- inputElement: Ve,
- ref: $,
- id: z,
- showSearch: p.value,
- mode: H,
- activeDescendantId: Fn,
- tagRender: xn,
- optionLabelRender: $n,
- values: ge,
- open: w.value,
- onToggleOpen: R,
- activeValue: Dn,
- searchValue: y.value,
- onSearch: L,
- onSearchSubmit: X,
- onRemove: M,
- tokenWithEnter: Y.value
- }), null)
- });
- let Ie;
- return pe ? Ie = Ke : Ie = f("div", Q(Q({}, we), {}, {
- class: Bn,
- ref: g,
- onMousedown: dn,
- onKeydown: oe,
- onKeyup: te
- }), [S.value && !w.value && f("span", {
- style: {
- width: 0,
- height: 0,
- position: "absolute",
- overflow: "hidden",
- opacity: 0
- },
- "aria-live": "polite"
- }, [`${ge.map((ne) => {
- let {
- label: _e,
- value: zn
- } = ne;
- return ["number", "string"].includes(typeof _e) ? _e : zn;
- }).join(", ")}`]), Ke, He, We]), Ie;
- };
- }
- });
- let Qe = 0;
- const Fo = process.env.NODE_ENV !== "test" && Wn();
- function Do() {
- let e;
- return Fo ? (e = Qe, Qe += 1) : e = "TEST_OR_SSR", e;
- }
- function ot() {
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ue("");
- const n = `rc_select_${Do()}`;
- return e.value || n;
- }
- function tt(e) {
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
- const {
- loading: o,
- multiple: t,
- prefixCls: i,
- hasFeedback: l,
- feedbackIcon: p,
- showArrow: m
- } = e, I = e.suffixIcon || n.suffixIcon && n.suffixIcon(), g = e.clearIcon || n.clearIcon && n.clearIcon(), a = e.menuItemSelectedIcon || n.menuItemSelectedIcon && n.menuItemSelectedIcon(), x = e.removeIcon || n.removeIcon && n.removeIcon(), $ = g != null ? g : f(Kn, null, null), P = (c) => f(he, null, [m !== !1 && c, l && p]);
- let h = null;
- if (I !== void 0)
- h = P(I);
- else if (o)
- h = P(f(_n, {
- spin: !0
- }, null));
- else {
- const c = `${i}-suffix`;
- h = (v) => {
- let {
- open: T,
- showSearch: y
- } = v;
- return P(T && y ? f(Xn, {
- class: c
- }, null) : f(Gn, {
- class: c
- }, null));
- };
- }
- let S = null;
- a !== void 0 ? S = a : t ? S = f(jn, null, null) : S = null;
- let b = null;
- return x !== void 0 ? b = x : b = f(Un, null, null), {
- clearIcon: $,
- suffixIcon: h,
- itemIcon: S,
- removeIcon: b
- };
- }
- const Je = (e) => {
- const {
- controlPaddingHorizontal: n
- } = e;
- return {
- position: "relative",
- display: "block",
- minHeight: e.controlHeight,
- padding: `${(e.controlHeight - e.fontSize * e.lineHeight) / 2}px ${n}px`,
- color: e.colorText,
- fontWeight: "normal",
- fontSize: e.fontSize,
- lineHeight: e.lineHeight,
- boxSizing: "border-box"
- };
- }, Eo = (e) => {
- const {
- antCls: n,
- componentCls: o
- } = e, t = `${o}-item`;
- return [
- {
- [`${o}-dropdown`]: d(d({}, Fe(e)), {
- position: "absolute",
- top: -9999,
- zIndex: e.zIndexPopup,
- boxSizing: "border-box",
- padding: e.paddingXXS,
- overflow: "hidden",
- fontSize: e.fontSize,
- // Fix select render lag of long text in chrome
- // https://github.com/ant-design/ant-design/issues/11456
- // https://github.com/ant-design/ant-design/issues/11843
- fontVariant: "initial",
- backgroundColor: e.colorBgElevated,
- borderRadius: e.borderRadiusLG,
- outline: "none",
- boxShadow: e.boxShadowSecondary,
- [`
- &${n}-slide-up-enter${n}-slide-up-enter-active${o}-dropdown-placement-bottomLeft,
- &${n}-slide-up-appear${n}-slide-up-appear-active${o}-dropdown-placement-bottomLeft
- `]: {
- animationName: qn
- },
- [`
- &${n}-slide-up-enter${n}-slide-up-enter-active${o}-dropdown-placement-topLeft,
- &${n}-slide-up-appear${n}-slide-up-appear-active${o}-dropdown-placement-topLeft
- `]: {
- animationName: Jn
- },
- [`&${n}-slide-up-leave${n}-slide-up-leave-active${o}-dropdown-placement-bottomLeft`]: {
- animationName: Qn
- },
- [`&${n}-slide-up-leave${n}-slide-up-leave-active${o}-dropdown-placement-topLeft`]: {
- animationName: Yn
- },
- "&-hidden": {
- display: "none"
- },
- "&-empty": {
- color: e.colorTextDisabled
- },
- // ========================= Options =========================
- [`${t}-empty`]: d(d({}, Je(e)), {
- color: e.colorTextDisabled
- }),
- [`${t}`]: d(d({}, Je(e)), {
- cursor: "pointer",
- transition: `background ${e.motionDurationSlow} ease`,
- borderRadius: e.borderRadiusSM,
- // =========== Group ============
- "&-group": {
- color: e.colorTextDescription,
- fontSize: e.fontSizeSM,
- cursor: "default"
- },
- // =========== Option ===========
- "&-option": {
- display: "flex",
- "&-content": d({
- flex: "auto"
- }, Pe),
- "&-state": {
- flex: "none"
- },
- [`&-active:not(${t}-option-disabled)`]: {
- backgroundColor: e.controlItemBgHover
- },
- [`&-selected:not(${t}-option-disabled)`]: {
- color: e.colorText,
- fontWeight: e.fontWeightStrong,
- backgroundColor: e.controlItemBgActive,
- [`${t}-option-state`]: {
- color: e.colorPrimary
- }
- },
- "&-disabled": {
- [`&${t}-option-selected`]: {
- backgroundColor: e.colorBgContainerDisabled
- },
- color: e.colorTextDisabled,
- cursor: "not-allowed"
- },
- "&-grouped": {
- paddingInlineStart: e.controlPaddingHorizontal * 2
- }
- }
- }),
- // =========================== RTL ===========================
- "&-rtl": {
- direction: "rtl"
- }
- })
- },
- // Follow code may reuse in other components
- je(e, "slide-up"),
- je(e, "slide-down"),
- Ue(e, "move-up"),
- Ue(e, "move-down")
- ];
- }, le = 2;
- function rn(e) {
- let {
- controlHeightSM: n,
- controlHeight: o,
- lineWidth: t
- } = e;
- const i = (o - n) / 2 - t, l = Math.ceil(i / 2);
- return [i, l];
- }
- function Ce(e, n) {
- const {
- componentCls: o,
- iconCls: t
- } = e, i = `${o}-selection-overflow`, l = e.controlHeightSM, [p] = rn(e), m = n ? `${o}-${n}` : "";
- return {
- [`${o}-multiple${m}`]: {
- fontSize: e.fontSize,
- /**
- * Do not merge `height` & `line-height` under style with `selection` & `search`, since chrome
- * may update to redesign with its align logic.
- */
- // =========================== Overflow ===========================
- [i]: {
- position: "relative",
- display: "flex",
- flex: "auto",
- flexWrap: "wrap",
- maxWidth: "100%",
- "&-item": {
- flex: "none",
- alignSelf: "center",
- maxWidth: "100%",
- display: "inline-flex"
- }
- },
- // ========================= Selector =========================
- [`${o}-selector`]: {
- display: "flex",
- flexWrap: "wrap",
- alignItems: "center",
- // Multiple is little different that horizontal is follow the vertical
- padding: `${p - le}px ${le * 2}px`,
- borderRadius: e.borderRadius,
- [`${o}-show-search&`]: {
- cursor: "text"
- },
- [`${o}-disabled&`]: {
- background: e.colorBgContainerDisabled,
- cursor: "not-allowed"
- },
- "&:after": {
- display: "inline-block",
- width: 0,
- margin: `${le}px 0`,
- lineHeight: `${l}px`,
- content: '"\\a0"'
- }
- },
- [`
- &${o}-show-arrow ${o}-selector,
- &${o}-allow-clear ${o}-selector
- `]: {
- paddingInlineEnd: e.fontSizeIcon + e.controlPaddingHorizontal
- },
- // ======================== Selections ========================
- [`${o}-selection-item`]: {
- position: "relative",
- display: "flex",
- flex: "none",
- boxSizing: "border-box",
- maxWidth: "100%",
- height: l,
- marginTop: le,
- marginBottom: le,
- lineHeight: `${l - e.lineWidth * 2}px`,
- background: e.colorFillSecondary,
- border: `${e.lineWidth}px solid ${e.colorSplit}`,
- borderRadius: e.borderRadiusSM,
- cursor: "default",
- transition: `font-size ${e.motionDurationSlow}, line-height ${e.motionDurationSlow}, height ${e.motionDurationSlow}`,
- userSelect: "none",
- marginInlineEnd: le * 2,
- paddingInlineStart: e.paddingXS,
- paddingInlineEnd: e.paddingXS / 2,
- [`${o}-disabled&`]: {
- color: e.colorTextDisabled,
- borderColor: e.colorBorder,
- cursor: "not-allowed"
- },
- // It's ok not to do this, but 24px makes bottom narrow in view should adjust
- "&-content": {
- display: "inline-block",
- marginInlineEnd: e.paddingXS / 2,
- overflow: "hidden",
- whiteSpace: "pre",
- textOverflow: "ellipsis"
- },
- "&-remove": d(d({}, ke()), {
- display: "inline-block",
- color: e.colorIcon,
- fontWeight: "bold",
- fontSize: 10,
- lineHeight: "inherit",
- cursor: "pointer",
- [`> ${t}`]: {
- verticalAlign: "-0.2em"
- },
- "&:hover": {
- color: e.colorIconHover
- }
- })
- },
- // ========================== Input ==========================
- [`${i}-item + ${i}-item`]: {
- [`${o}-selection-search`]: {
- marginInlineStart: 0
- }
- },
- [`${o}-selection-search`]: {
- display: "inline-flex",
- position: "relative",
- maxWidth: "100%",
- marginInlineStart: e.inputPaddingHorizontalBase - p,
- "\n &-input,\n &-mirror\n ": {
- height: l,
- fontFamily: e.fontFamily,
- lineHeight: `${l}px`,
- transition: `all ${e.motionDurationSlow}`
- },
- "&-input": {
- width: "100%",
- minWidth: 4.1
- // fix search cursor missing
- },
- "&-mirror": {
- position: "absolute",
- top: 0,
- insetInlineStart: 0,
- insetInlineEnd: "auto",
- zIndex: 999,
- whiteSpace: "pre",
- visibility: "hidden"
- }
- },
- // ======================= Placeholder =======================
- [`${o}-selection-placeholder `]: {
- position: "absolute",
- top: "50%",
- insetInlineStart: e.inputPaddingHorizontalBase,
- insetInlineEnd: e.inputPaddingHorizontalBase,
- transform: "translateY(-50%)",
- transition: `all ${e.motionDurationSlow}`
- }
- }
- };
- }
- function Oo(e) {
- const {
- componentCls: n
- } = e, o = Z(e, {
- controlHeight: e.controlHeightSM,
- controlHeightSM: e.controlHeightXS,
- borderRadius: e.borderRadiusSM,
- borderRadiusSM: e.borderRadiusXS
- }), [, t] = rn(e);
- return [
- Ce(e),
- // ======================== Small ========================
- // Shared
- Ce(o, "sm"),
- // Padding
- {
- [`${n}-multiple${n}-sm`]: {
- [`${n}-selection-placeholder`]: {
- insetInlineStart: e.controlPaddingHorizontalSM - e.lineWidth,
- insetInlineEnd: "auto"
- },
- // https://github.com/ant-design/ant-design/issues/29559
- [`${n}-selection-search`]: {
- marginInlineStart: t
- }
- }
- },
- // ======================== Large ========================
- // Shared
- Ce(Z(e, {
- fontSize: e.fontSizeLG,
- controlHeight: e.controlHeightLG,
- controlHeightSM: e.controlHeight,
- borderRadius: e.borderRadiusLG,
- borderRadiusSM: e.borderRadius
- }), "lg")
- ];
- }
- function xe(e, n) {
- const {
- componentCls: o,
- inputPaddingHorizontalBase: t,
- borderRadius: i
- } = e, l = e.controlHeight - e.lineWidth * 2, p = Math.ceil(e.fontSize * 1.25), m = n ? `${o}-${n}` : "";
- return {
- [`${o}-single${m}`]: {
- fontSize: e.fontSize,
- // ========================= Selector =========================
- [`${o}-selector`]: d(d({}, Fe(e)), {
- display: "flex",
- borderRadius: i,
- [`${o}-selection-search`]: {
- position: "absolute",
- top: 0,
- insetInlineStart: t,
- insetInlineEnd: t,
- bottom: 0,
- "&-input": {
- width: "100%"
- }
- },
- [`
- ${o}-selection-item,
- ${o}-selection-placeholder
- `]: {
- padding: 0,
- lineHeight: `${l}px`,
- transition: `all ${e.motionDurationSlow}`,
- // Firefox inline-block position calculation is not same as Chrome & Safari. Patch this:
- "@supports (-moz-appearance: meterbar)": {
- lineHeight: `${l}px`
- }
- },
- [`${o}-selection-item`]: {
- position: "relative",
- userSelect: "none"
- },
- [`${o}-selection-placeholder`]: {
- transition: "none",
- pointerEvents: "none"
- },
- // For common baseline align
- [[
- "&:after",
- /* For '' value baseline align */
- `${o}-selection-item:after`,
- /* For undefined value baseline align */
- `${o}-selection-placeholder:after`
- ].join(",")]: {
- display: "inline-block",
- width: 0,
- visibility: "hidden",
- content: '"\\a0"'
- }
- }),
- [`
- &${o}-show-arrow ${o}-selection-item,
- &${o}-show-arrow ${o}-selection-placeholder
- `]: {
- paddingInlineEnd: p
- },
- // Opacity selection if open
- [`&${o}-open ${o}-selection-item`]: {
- color: e.colorTextPlaceholder
- },
- // ========================== Input ==========================
- // We only change the style of non-customize input which is only support by `combobox` mode.
- // Not customize
- [`&:not(${o}-customize-input)`]: {
- [`${o}-selector`]: {
- width: "100%",
- height: e.controlHeight,
- padding: `0 ${t}px`,
- [`${o}-selection-search-input`]: {
- height: l
- },
- "&:after": {
- lineHeight: `${l}px`
- }
- }
- },
- [`&${o}-customize-input`]: {
- [`${o}-selector`]: {
- "&:after": {
- display: "none"
- },
- [`${o}-selection-search`]: {
- position: "static",
- width: "100%"
- },
- [`${o}-selection-placeholder`]: {
- position: "absolute",
- insetInlineStart: 0,
- insetInlineEnd: 0,
- padding: `0 ${t}px`,
- "&:after": {
- display: "none"
- }
- }
- }
- }
- }
- };
- }
- function Mo(e) {
- const {
- componentCls: n
- } = e, o = e.controlPaddingHorizontalSM - e.lineWidth;
- return [
- xe(e),
- // ======================== Small ========================
- // Shared
- xe(Z(e, {
- controlHeight: e.controlHeightSM,
- borderRadius: e.borderRadiusSM
- }), "sm"),
- // padding
- {
- [`${n}-single${n}-sm`]: {
- [`&:not(${n}-customize-input)`]: {
- [`${n}-selection-search`]: {
- insetInlineStart: o,
- insetInlineEnd: o
- },
- [`${n}-selector`]: {
- padding: `0 ${o}px`
- },
- // With arrow should provides `padding-right` to show the arrow
- [`&${n}-show-arrow ${n}-selection-search`]: {
- insetInlineEnd: o + e.fontSize * 1.5
- },
- [`
- &${n}-show-arrow ${n}-selection-item,
- &${n}-show-arrow ${n}-selection-placeholder
- `]: {
- paddingInlineEnd: e.fontSize * 1.5
- }
- }
- }
- },
- // ======================== Large ========================
- // Shared
- xe(Z(e, {
- controlHeight: e.controlHeightLG,
- fontSize: e.fontSizeLG,
- borderRadius: e.borderRadiusLG
- }), "lg")
- ];
- }
- const Ro = (e) => {
- const {
- componentCls: n
- } = e;
- return {
- position: "relative",
- backgroundColor: e.colorBgContainer,
- border: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,
- transition: `all ${e.motionDurationMid} ${e.motionEaseInOut}`,
- input: {
- cursor: "pointer"
- },
- [`${n}-show-search&`]: {
- cursor: "text",
- input: {
- cursor: "auto",
- color: "inherit"
- }
- },
- [`${n}-disabled&`]: {
- color: e.colorTextDisabled,
- background: e.colorBgContainerDisabled,
- cursor: "not-allowed",
- [`${n}-multiple&`]: {
- background: e.colorBgContainerDisabled
- },
- input: {
- cursor: "not-allowed"
- }
- }
- };
- }, $e = function(e, n) {
- let o = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
- const {
- componentCls: t,
- borderHoverColor: i,
- outlineColor: l,
- antCls: p
- } = n, m = o ? {
- [`${t}-selector`]: {
- borderColor: i
- }
- } : {};
- return {
- [e]: {
- [`&:not(${t}-disabled):not(${t}-customize-input):not(${p}-pagination-size-changer)`]: d(d({}, m), {
- [`${t}-focused& ${t}-selector`]: {
- borderColor: i,
- boxShadow: `0 0 0 ${n.controlOutlineWidth}px ${l}`,
- borderInlineEndWidth: `${n.controlLineWidth}px !important`,
- outline: 0
- },
- [`&:hover ${t}-selector`]: {
- borderColor: i,
- borderInlineEndWidth: `${n.controlLineWidth}px !important`
- }
- })
- }
- };
- }, Bo = (e) => {
- const {
- componentCls: n
- } = e;
- return {
- [`${n}-selection-search-input`]: {
- margin: 0,
- padding: 0,
- background: "transparent",
- border: "none",
- outline: "none",
- appearance: "none",
- "&::-webkit-search-cancel-button": {
- display: "none",
- "-webkit-appearance": "none"
- }
- }
- };
- }, zo = (e) => {
- const {
- componentCls: n,
- inputPaddingHorizontalBase: o,
- iconCls: t
- } = e;
- return {
- [n]: d(d({}, Fe(e)), {
- position: "relative",
- display: "inline-block",
- cursor: "pointer",
- [`&:not(${n}-customize-input) ${n}-selector`]: d(d({}, Ro(e)), Bo(e)),
- // [`&:not(&-disabled):hover ${selectCls}-selector`]: {
- // ...genHoverStyle(token),
- // },
- // ======================== Selection ========================
- [`${n}-selection-item`]: d({
- flex: 1,
- fontWeight: "normal"
- }, Pe),
- // ======================= Placeholder =======================
- [`${n}-selection-placeholder`]: d(d({}, Pe), {
- flex: 1,
- color: e.colorTextPlaceholder,
- pointerEvents: "none"
- }),
- // ========================== Arrow ==========================
- [`${n}-arrow`]: d(d({}, ke()), {
- position: "absolute",
- top: "50%",
- insetInlineStart: "auto",
- insetInlineEnd: o,
- height: e.fontSizeIcon,
- marginTop: -e.fontSizeIcon / 2,
- color: e.colorTextQuaternary,
- fontSize: e.fontSizeIcon,
- lineHeight: 1,
- textAlign: "center",
- pointerEvents: "none",
- display: "flex",
- alignItems: "center",
- [t]: {
- verticalAlign: "top",
- transition: `transform ${e.motionDurationSlow}`,
- "> svg": {
- verticalAlign: "top"
- },
- [`&:not(${n}-suffix)`]: {
- pointerEvents: "auto"
- }
- },
- [`${n}-disabled &`]: {
- cursor: "not-allowed"
- },
- "> *:not(:last-child)": {
- marginInlineEnd: 8
- // FIXME: magic
- }
- }),
- // ========================== Clear ==========================
- [`${n}-clear`]: {
- position: "absolute",
- top: "50%",
- insetInlineStart: "auto",
- insetInlineEnd: o,
- zIndex: 1,
- display: "inline-block",
- width: e.fontSizeIcon,
- height: e.fontSizeIcon,
- marginTop: -e.fontSizeIcon / 2,
- color: e.colorTextQuaternary,
- fontSize: e.fontSizeIcon,
- fontStyle: "normal",
- lineHeight: 1,
- textAlign: "center",
- textTransform: "none",
- background: e.colorBgContainer,
- cursor: "pointer",
- opacity: 0,
- transition: `color ${e.motionDurationMid} ease, opacity ${e.motionDurationSlow} ease`,
- textRendering: "auto",
- "&:before": {
- display: "block"
- },
- "&:hover": {
- color: e.colorTextTertiary
- }
- },
- "&:hover": {
- [`${n}-clear`]: {
- opacity: 1
- }
- }
- }),
- // ========================= Feedback ==========================
- [`${n}-has-feedback`]: {
- [`${n}-clear`]: {
- insetInlineEnd: o + e.fontSize + e.paddingXXS
- }
- }
- };
- }, No = (e) => {
- const {
- componentCls: n
- } = e;
- return [
- {
- [n]: {
- // ==================== BorderLess ====================
- [`&-borderless ${n}-selector`]: {
- backgroundColor: "transparent !important",
- borderColor: "transparent !important",
- boxShadow: "none !important"
- },
- // ==================== In Form ====================
- [`&${n}-in-form-item`]: {
- width: "100%"
- }
- }
- },
- // =====================================================
- // == LTR ==
- // =====================================================
- // Base
- zo(e),
- // Single
- Mo(e),
- // Multiple
- Oo(e),
- // Dropdown
- Eo(e),
- // =====================================================
- // == RTL ==
- // =====================================================
- {
- [`${n}-rtl`]: {
- direction: "rtl"
- }
- },
- // =====================================================
- // == Status ==
- // =====================================================
- $e(n, Z(e, {
- borderHoverColor: e.colorPrimaryHover,
- outlineColor: e.controlOutline
- })),
- $e(`${n}-status-error`, Z(e, {
- borderHoverColor: e.colorErrorHover,
- outlineColor: e.colorErrorOutline
- }), !0),
- $e(`${n}-status-warning`, Z(e, {
- borderHoverColor: e.colorWarningHover,
- outlineColor: e.colorWarningOutline
- }), !0),
- // =====================================================
- // == Space Compact ==
- // =====================================================
- kn(e, {
- borderElCls: `${n}-selector`,
- focusElCls: `${n}-focused`
- })
- ];
- }, it = Zn("Select", (e, n) => {
- let {
- rootPrefixCls: o
- } = n;
- const t = Z(e, {
- rootPrefixCls: o,
- inputPaddingHorizontalBase: e.paddingSM - 1
- });
- return [No(t)];
- }, (e) => ({
- zIndexPopup: e.zIndexPopupBase + 50
- }));
- export {
- nt as B,
- se as T,
- ot as a,
- $o as b,
- it as c,
- Zo as d,
- qo as e,
- ao as f,
- tt as g,
- Me as h,
- To as i,
- ko as j,
- wo as t,
- et as u
- };
|