| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781 |
- import { w as N, _ as v, $ as B, aU as F, o as M, bd as L, I as R, J as E, bc as G, M as W } from "./index2.js";
- import { ref as H, shallowRef as X, watchEffect as U } from "vue";
- function ae() {
- const e = (t) => {
- e.current = t;
- };
- return e;
- }
- function le(e, t) {
- if (!e) return [];
- const n = e.slice(), r = n.indexOf(t);
- return r >= 0 && n.splice(r, 1), n;
- }
- function se(e, t) {
- const n = (e || []).slice();
- return n.indexOf(t) === -1 && n.push(t), n;
- }
- function I(e) {
- return e.split("-");
- }
- function D(e, t) {
- return `${e}-${t}`;
- }
- function q(e) {
- return e && e.type && e.type.isTreeNode;
- }
- function ce(e, t) {
- const n = [], r = t[e];
- function o() {
- (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).forEach((f) => {
- let {
- key: d,
- children: u
- } = f;
- n.push(d), o(u);
- });
- }
- return o(r.children), n;
- }
- function J(e) {
- if (e.parent) {
- const t = I(e.pos);
- return Number(t[t.length - 1]) === e.parent.children.length - 1;
- }
- return !1;
- }
- function V(e) {
- const t = I(e.pos);
- return Number(t[t.length - 1]) === 0;
- }
- function de(e, t, n, r, o, i, f, d, u, s) {
- var l;
- const {
- clientX: a,
- clientY: c
- } = e, {
- top: h,
- height: p
- } = e.target.getBoundingClientRect(), g = ((s === "rtl" ? -1 : 1) * (((o == null ? void 0 : o.x) || 0) - a) - 12) / r;
- let y = d[n.eventKey];
- if (c < h + p / 2) {
- const k = f.findIndex((A) => A.key === y.key), O = k <= 0 ? 0 : k - 1, z = f[O].key;
- y = d[z];
- }
- const S = y.key, C = y, m = y.key;
- let $ = 0, P = 0;
- if (!u.has(S))
- for (let k = 0; k < g && J(y); k += 1)
- y = y.parent, P += 1;
- const x = t.eventData, w = y.node;
- let K = !0;
- return V(y) && y.level === 0 && c < h + p / 2 && i({
- dragNode: x,
- dropNode: w,
- dropPosition: -1
- }) && y.key === n.eventKey ? $ = -1 : (C.children || []).length && u.has(m) ? i({
- dragNode: x,
- dropNode: w,
- dropPosition: 0
- }) ? $ = 0 : K = !1 : P === 0 ? g > -1.5 ? i({
- dragNode: x,
- dropNode: w,
- dropPosition: 1
- }) ? $ = 1 : K = !1 : i({
- dragNode: x,
- dropNode: w,
- dropPosition: 0
- }) ? $ = 0 : i({
- dragNode: x,
- dropNode: w,
- dropPosition: 1
- }) ? $ = 1 : K = !1 : i({
- dragNode: x,
- dropNode: w,
- dropPosition: 1
- }) ? $ = 1 : K = !1, {
- dropPosition: $,
- dropLevelOffset: P,
- dropTargetKey: y.key,
- dropTargetPos: y.pos,
- dragOverNodeKey: m,
- dropContainerKey: $ === 0 ? null : ((l = y.parent) === null || l === void 0 ? void 0 : l.key) || null,
- dropAllowed: K
- };
- }
- function fe(e, t) {
- if (!e) return;
- const {
- multiple: n
- } = t;
- return n ? e.slice() : e.length ? [e[0]] : e;
- }
- function ue(e) {
- if (!e)
- return null;
- let t;
- if (Array.isArray(e))
- t = {
- checkedKeys: e,
- halfCheckedKeys: void 0
- };
- else if (typeof e == "object")
- t = {
- checkedKeys: e.checked || void 0,
- halfCheckedKeys: e.halfChecked || void 0
- };
- else
- return N(!1, "`checkedKeys` is not an array or an object"), null;
- return t;
- }
- function pe(e, t) {
- const n = /* @__PURE__ */ new Set();
- function r(o) {
- if (n.has(o)) return;
- const i = t[o];
- if (!i) return;
- n.add(o);
- const {
- parent: f,
- node: d
- } = i;
- d.disabled || f && r(f.key);
- }
- return (e || []).forEach((o) => {
- r(o);
- }), [...n];
- }
- var Y = function(e, t) {
- var n = {};
- for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++)
- t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (n[r[o]] = e[r[o]]);
- return n;
- };
- function T(e, t) {
- return e != null ? e : t;
- }
- function j(e) {
- const {
- title: t,
- _title: n,
- key: r,
- children: o
- } = e || {}, i = t || "title";
- return {
- title: i,
- _title: n || [i],
- key: r || "key",
- children: o || "children"
- };
- }
- function he(e) {
- function t() {
- let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
- return B(n).map((o) => {
- var i, f, d, u;
- if (!q(o))
- return N(!o, "Tree/TreeNode can only accept TreeNode as children."), null;
- const s = o.children || {}, l = o.key, a = {};
- for (const [k, O] of Object.entries(o.props))
- a[F(k)] = O;
- const {
- isLeaf: c,
- checkable: h,
- selectable: p,
- disabled: b,
- disableCheckbox: g
- } = a, y = {
- isLeaf: c || c === "" || void 0,
- checkable: h || h === "" || void 0,
- selectable: p || p === "" || void 0,
- disabled: b || b === "" || void 0,
- disableCheckbox: g || g === "" || void 0
- }, S = v(v({}, a), y), {
- title: C = (i = s.title) === null || i === void 0 ? void 0 : i.call(s, S),
- icon: m = (f = s.icon) === null || f === void 0 ? void 0 : f.call(s, S),
- switcherIcon: $ = (d = s.switcherIcon) === null || d === void 0 ? void 0 : d.call(s, S)
- } = a, P = Y(a, ["title", "icon", "switcherIcon"]), x = (u = s.default) === null || u === void 0 ? void 0 : u.call(s), w = v(v(v({}, P), {
- title: C,
- icon: m,
- switcherIcon: $,
- key: l,
- isLeaf: c
- }), y), K = t(x);
- return K.length && (w.children = K), w;
- });
- }
- return t(e);
- }
- function ye(e, t, n) {
- const {
- _title: r,
- key: o,
- children: i
- } = j(n), f = new Set(t === !0 ? [] : t), d = [];
- function u(s) {
- let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
- return s.map((a, c) => {
- const h = D(l ? l.pos : "0", c), p = T(a[o], h);
- let b;
- for (let y = 0; y < r.length; y += 1) {
- const S = r[y];
- if (a[S] !== void 0) {
- b = a[S];
- break;
- }
- }
- const g = v(v({}, M(a, [...r, o, i])), {
- title: b,
- key: p,
- parent: l,
- pos: h,
- children: null,
- data: a,
- isStart: [...l ? l.isStart : [], c === 0],
- isEnd: [...l ? l.isEnd : [], c === s.length - 1]
- });
- return d.push(g), t === !0 || f.has(p) ? g.children = u(a[i] || [], g) : g.children = [], g;
- });
- }
- return u(e), d;
- }
- function Q(e, t, n) {
- let r = {};
- typeof n == "object" ? r = n : r = {
- externalGetKey: n
- }, r = r || {};
- const {
- childrenPropName: o,
- externalGetKey: i,
- fieldNames: f
- } = r, {
- key: d,
- children: u
- } = j(f), s = o || u;
- let l;
- i ? typeof i == "string" ? l = (c) => c[i] : typeof i == "function" && (l = (c) => i(c)) : l = (c, h) => T(c[d], h);
- function a(c, h, p, b) {
- const g = c ? c[s] : e, y = c ? D(p.pos, h) : "0", S = c ? [...b, c] : [];
- if (c) {
- const C = l(c, y), m = {
- node: c,
- index: h,
- pos: y,
- key: C,
- parentPos: p.node ? p.pos : null,
- level: p.level + 1,
- nodes: S
- };
- t(m);
- }
- g && g.forEach((C, m) => {
- a(C, m, {
- node: c,
- pos: y,
- level: p ? p.level + 1 : -1
- }, S);
- });
- }
- a(null);
- }
- function ge(e) {
- let {
- initWrapper: t,
- processEntity: n,
- onProcessFinished: r,
- externalGetKey: o,
- childrenPropName: i,
- fieldNames: f
- } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, d = arguments.length > 2 ? arguments[2] : void 0;
- const u = o || d, s = {}, l = {};
- let a = {
- posEntities: s,
- keyEntities: l
- };
- return t && (a = t(a) || a), Q(e, (c) => {
- const {
- node: h,
- index: p,
- pos: b,
- key: g,
- parentPos: y,
- level: S,
- nodes: C
- } = c, m = {
- node: h,
- nodes: C,
- index: p,
- key: g,
- pos: b,
- level: S
- }, $ = T(g, b);
- s[b] = m, l[$] = m, m.parent = s[y], m.parent && (m.parent.children = m.parent.children || [], m.parent.children.push(m)), n && n(m, a);
- }, {
- externalGetKey: u,
- childrenPropName: i,
- fieldNames: f
- }), r && r(a), a;
- }
- function be(e, t) {
- let {
- expandedKeysSet: n,
- selectedKeysSet: r,
- loadedKeysSet: o,
- loadingKeysSet: i,
- checkedKeysSet: f,
- halfCheckedKeysSet: d,
- dragOverNodeKey: u,
- dropPosition: s,
- keyEntities: l
- } = t;
- const a = l[e];
- return {
- eventKey: e,
- expanded: n.has(e),
- selected: r.has(e),
- loaded: o.has(e),
- loading: i.has(e),
- checked: f.has(e),
- halfChecked: d.has(e),
- pos: String(a ? a.pos : ""),
- parent: a.parent,
- // [Legacy] Drag props
- // Since the interaction of drag is changed, the semantic of the props are
- // not accuracy, I think it should be finally removed
- dragOver: u === e && s === 0,
- dragOverGapTop: u === e && s === -1,
- dragOverGapBottom: u === e && s === 1
- };
- }
- function me(e) {
- const {
- data: t,
- expanded: n,
- selected: r,
- checked: o,
- loaded: i,
- loading: f,
- halfChecked: d,
- dragOver: u,
- dragOverGapTop: s,
- dragOverGapBottom: l,
- pos: a,
- active: c,
- eventKey: h
- } = e, p = v(v({
- dataRef: t
- }, t), {
- expanded: n,
- selected: r,
- checked: o,
- loaded: i,
- loading: f,
- halfChecked: d,
- dragOver: u,
- dragOverGapTop: s,
- dragOverGapBottom: l,
- pos: a,
- active: c,
- eventKey: h,
- key: h
- });
- return "props" in p || Object.defineProperty(p, "props", {
- get() {
- return N(!1, "Second param return from event is node data instead of TreeNode instance. Please read value directly instead of reading from `props`."), e;
- }
- }), p;
- }
- function _(e, t) {
- const n = /* @__PURE__ */ new Set();
- return e.forEach((r) => {
- t.has(r) || n.add(r);
- }), n;
- }
- function Z(e) {
- const {
- disabled: t,
- disableCheckbox: n,
- checkable: r
- } = e || {};
- return !!(t || n) || r === !1;
- }
- function ee(e, t, n, r) {
- const o = new Set(e), i = /* @__PURE__ */ new Set();
- for (let d = 0; d <= n; d += 1)
- (t.get(d) || /* @__PURE__ */ new Set()).forEach((s) => {
- const {
- key: l,
- node: a,
- children: c = []
- } = s;
- o.has(l) && !r(a) && c.filter((h) => !r(h.node)).forEach((h) => {
- o.add(h.key);
- });
- });
- const f = /* @__PURE__ */ new Set();
- for (let d = n; d >= 0; d -= 1)
- (t.get(d) || /* @__PURE__ */ new Set()).forEach((s) => {
- const {
- parent: l,
- node: a
- } = s;
- if (r(a) || !s.parent || f.has(s.parent.key))
- return;
- if (r(s.parent.node)) {
- f.add(l.key);
- return;
- }
- let c = !0, h = !1;
- (l.children || []).filter((p) => !r(p.node)).forEach((p) => {
- let {
- key: b
- } = p;
- const g = o.has(b);
- c && !g && (c = !1), !h && (g || i.has(b)) && (h = !0);
- }), c && o.add(l.key), h && i.add(l.key), f.add(l.key);
- });
- return {
- checkedKeys: Array.from(o),
- halfCheckedKeys: Array.from(_(i, o))
- };
- }
- function te(e, t, n, r, o) {
- const i = new Set(e);
- let f = new Set(t);
- for (let u = 0; u <= r; u += 1)
- (n.get(u) || /* @__PURE__ */ new Set()).forEach((l) => {
- const {
- key: a,
- node: c,
- children: h = []
- } = l;
- !i.has(a) && !f.has(a) && !o(c) && h.filter((p) => !o(p.node)).forEach((p) => {
- i.delete(p.key);
- });
- });
- f = /* @__PURE__ */ new Set();
- const d = /* @__PURE__ */ new Set();
- for (let u = r; u >= 0; u -= 1)
- (n.get(u) || /* @__PURE__ */ new Set()).forEach((l) => {
- const {
- parent: a,
- node: c
- } = l;
- if (o(c) || !l.parent || d.has(l.parent.key))
- return;
- if (o(l.parent.node)) {
- d.add(a.key);
- return;
- }
- let h = !0, p = !1;
- (a.children || []).filter((b) => !o(b.node)).forEach((b) => {
- let {
- key: g
- } = b;
- const y = i.has(g);
- h && !y && (h = !1), !p && (y || f.has(g)) && (p = !0);
- }), h || i.delete(a.key), p && f.add(a.key), d.add(a.key);
- });
- return {
- checkedKeys: Array.from(i),
- halfCheckedKeys: Array.from(_(f, i))
- };
- }
- function ve(e, t, n, r, o, i) {
- const f = [];
- let d;
- d = Z;
- const u = new Set(e.filter((l) => {
- const a = !!n[l];
- return a || f.push(l), a;
- }));
- L(!f.length, `Tree missing follow keys: ${f.slice(0, 100).map((l) => `'${l}'`).join(", ")}`);
- let s;
- return t === !0 ? s = ee(u, o, r, d) : s = te(u, t.halfCheckedKeys, o, r, d), s;
- }
- function Se(e) {
- const t = H(0), n = X();
- return U(() => {
- const r = /* @__PURE__ */ new Map();
- let o = 0;
- const i = e.value || {};
- for (const f in i)
- if (Object.prototype.hasOwnProperty.call(i, f)) {
- const d = i[f], {
- level: u
- } = d;
- let s = r.get(u);
- s || (s = /* @__PURE__ */ new Set(), r.set(u, s)), s.add(d), o = Math.max(o, u);
- }
- t.value = o, n.value = r;
- }), {
- maxLevel: t,
- levelEntities: n
- };
- }
- const ne = new W("antCheckboxEffect", {
- "0%": {
- transform: "scale(1)",
- opacity: 0.5
- },
- "100%": {
- transform: "scale(1.6)",
- opacity: 0
- }
- }), re = (e) => {
- const {
- checkboxCls: t
- } = e, n = `${t}-wrapper`;
- return [
- // ===================== Basic =====================
- {
- // Group
- [`${t}-group`]: v(v({}, E(e)), {
- display: "inline-flex",
- flexWrap: "wrap",
- columnGap: e.marginXS,
- // Group > Grid
- [`> ${e.antCls}-row`]: {
- flex: 1
- }
- }),
- // Wrapper
- [n]: v(v({}, E(e)), {
- display: "inline-flex",
- alignItems: "baseline",
- cursor: "pointer",
- // Fix checkbox & radio in flex align #30260
- "&:after": {
- display: "inline-block",
- width: 0,
- overflow: "hidden",
- content: "'\\a0'"
- },
- // Checkbox near checkbox
- [`& + ${n}`]: {
- marginInlineStart: 0
- },
- [`&${n}-in-form-item`]: {
- 'input[type="checkbox"]': {
- width: 14,
- height: 14
- // FIXME: magic
- }
- }
- }),
- // Wrapper > Checkbox
- [t]: v(v({}, E(e)), {
- position: "relative",
- whiteSpace: "nowrap",
- lineHeight: 1,
- cursor: "pointer",
- // To make alignment right when `controlHeight` is changed
- // Ref: https://github.com/ant-design/ant-design/issues/41564
- alignSelf: "center",
- // Wrapper > Checkbox > input
- [`${t}-input`]: {
- position: "absolute",
- // Since baseline align will get additional space offset,
- // we need to move input to top to make it align with text.
- // Ref: https://github.com/ant-design/ant-design/issues/38926#issuecomment-1486137799
- inset: 0,
- zIndex: 1,
- cursor: "pointer",
- opacity: 0,
- margin: 0,
- [`&:focus-visible + ${t}-inner`]: v({}, G(e))
- },
- // Wrapper > Checkbox > inner
- [`${t}-inner`]: {
- boxSizing: "border-box",
- position: "relative",
- top: 0,
- insetInlineStart: 0,
- display: "block",
- width: e.checkboxSize,
- height: e.checkboxSize,
- direction: "ltr",
- backgroundColor: e.colorBgContainer,
- border: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,
- borderRadius: e.borderRadiusSM,
- borderCollapse: "separate",
- transition: `all ${e.motionDurationSlow}`,
- "&:after": {
- boxSizing: "border-box",
- position: "absolute",
- top: "50%",
- insetInlineStart: "21.5%",
- display: "table",
- width: e.checkboxSize / 14 * 5,
- height: e.checkboxSize / 14 * 8,
- border: `${e.lineWidthBold}px solid ${e.colorWhite}`,
- borderTop: 0,
- borderInlineStart: 0,
- transform: "rotate(45deg) scale(0) translate(-50%,-50%)",
- opacity: 0,
- content: '""',
- transition: `all ${e.motionDurationFast} ${e.motionEaseInBack}, opacity ${e.motionDurationFast}`
- }
- },
- // Wrapper > Checkbox + Text
- "& + span": {
- paddingInlineStart: e.paddingXS,
- paddingInlineEnd: e.paddingXS
- }
- })
- },
- // ================= Indeterminate =================
- {
- [t]: {
- "&-indeterminate": {
- // Wrapper > Checkbox > inner
- [`${t}-inner`]: {
- "&:after": {
- top: "50%",
- insetInlineStart: "50%",
- width: e.fontSizeLG / 2,
- height: e.fontSizeLG / 2,
- backgroundColor: e.colorPrimary,
- border: 0,
- transform: "translate(-50%, -50%) scale(1)",
- opacity: 1,
- content: '""'
- }
- }
- }
- }
- },
- // ===================== Hover =====================
- {
- // Wrapper
- [`${n}:hover ${t}:after`]: {
- visibility: "visible"
- },
- // Wrapper & Wrapper > Checkbox
- [`
- ${n}:not(${n}-disabled),
- ${t}:not(${t}-disabled)
- `]: {
- [`&:hover ${t}-inner`]: {
- borderColor: e.colorPrimary
- }
- },
- [`${n}:not(${n}-disabled)`]: {
- [`&:hover ${t}-checked:not(${t}-disabled) ${t}-inner`]: {
- backgroundColor: e.colorPrimaryHover,
- borderColor: "transparent"
- },
- [`&:hover ${t}-checked:not(${t}-disabled):after`]: {
- borderColor: e.colorPrimaryHover
- }
- }
- },
- // ==================== Checked ====================
- {
- // Wrapper > Checkbox
- [`${t}-checked`]: {
- [`${t}-inner`]: {
- backgroundColor: e.colorPrimary,
- borderColor: e.colorPrimary,
- "&:after": {
- opacity: 1,
- transform: "rotate(45deg) scale(1) translate(-50%,-50%)",
- transition: `all ${e.motionDurationMid} ${e.motionEaseOutBack} ${e.motionDurationFast}`
- }
- },
- // Checked Effect
- "&:after": {
- position: "absolute",
- top: 0,
- insetInlineStart: 0,
- width: "100%",
- height: "100%",
- borderRadius: e.borderRadiusSM,
- visibility: "hidden",
- border: `${e.lineWidthBold}px solid ${e.colorPrimary}`,
- animationName: ne,
- animationDuration: e.motionDurationSlow,
- animationTimingFunction: "ease-in-out",
- animationFillMode: "backwards",
- content: '""',
- transition: `all ${e.motionDurationSlow}`
- }
- },
- [`
- ${n}-checked:not(${n}-disabled),
- ${t}-checked:not(${t}-disabled)
- `]: {
- [`&:hover ${t}-inner`]: {
- backgroundColor: e.colorPrimaryHover,
- borderColor: "transparent"
- },
- [`&:hover ${t}:after`]: {
- borderColor: e.colorPrimaryHover
- }
- }
- },
- // ==================== Disable ====================
- {
- // Wrapper
- [`${n}-disabled`]: {
- cursor: "not-allowed"
- },
- // Wrapper > Checkbox
- [`${t}-disabled`]: {
- // Wrapper > Checkbox > input
- [`&, ${t}-input`]: {
- cursor: "not-allowed",
- // Disabled for native input to enable Tooltip event handler
- // ref: https://github.com/ant-design/ant-design/issues/39822#issuecomment-1365075901
- pointerEvents: "none"
- },
- // Wrapper > Checkbox > inner
- [`${t}-inner`]: {
- background: e.colorBgContainerDisabled,
- borderColor: e.colorBorder,
- "&:after": {
- borderColor: e.colorTextDisabled
- }
- },
- "&:after": {
- display: "none"
- },
- "& + span": {
- color: e.colorTextDisabled
- },
- [`&${t}-indeterminate ${t}-inner::after`]: {
- background: e.colorTextDisabled
- }
- }
- }
- ];
- };
- function $e(e, t) {
- const n = R(t, {
- checkboxCls: `.${e}`,
- checkboxSize: t.controlInteractiveSize
- });
- return [re(n)];
- }
- export {
- ve as a,
- he as b,
- ge as c,
- pe as d,
- ae as e,
- j as f,
- $e as g,
- be as h,
- me as i,
- T as j,
- ye as k,
- fe as l,
- le as m,
- ce as n,
- de as o,
- ue as p,
- se as q,
- I as r,
- Se as u
- };
|