UNPKG

@coderlt/form-designer

Version:

基于vue3的设计器,可视化开发页面表单

1,722 lines 60.6 kB
import { i as I } from "./interopRequireDefault-40f894e3.js"; import { r as z } from "./_vue_commonjs-external-eb7fec7f.js"; import { r as G, a as oe, c as Re } from "./public_api-1267ff2a.js"; import { r as le, a as De } from "./index-f96a976e.js"; import { a as ce } from "./index-74b3b9ac.js"; import { d as Y, h as _e, b as ue, t as ke, r as Fe, a as Ee, f as Le, e as qe } from "./useConfigInject-d85d8c62.js"; import { b as $e, a as Oe } from "./PortalWrapper-9d2c005f.js"; import { r as Ie } from "./KeyCode-5c436a1d.js"; import { r as We } from "./index-0e1c5170.js"; import { r as ze } from "./raf-dd6c1047.js"; import { r as Ae } from "./FormItemContext-6c3deaca.js"; function je(p, g) { for (var P = 0; P < g.length; P++) { const S = g[P]; if (typeof S != "string" && !Array.isArray(S)) { for (const C in S) if (C !== "default" && !(C in p)) { const _ = Object.getOwnPropertyDescriptor(S, C); _ && Object.defineProperty(p, C, _.get ? _ : { enumerable: !0, get: () => S[C] }); } } } return Object.freeze(Object.defineProperty(p, Symbol.toStringTag, { value: "Module" })); } var X = {}, J = {}, Q = {}, he; function Me() { if (he) return Q; he = 1; var p = I; Object.defineProperty(Q, "__esModule", { value: !0 }), Q.default = void 0; var g = z, P = p(G()); const S = (_, M) => { let { attrs: B } = M; const { included: x, vertical: O, style: i, class: f } = B; let { length: y, offset: s, reverse: h } = B; y < 0 && (h = !h, y = Math.abs(y), s = 100 - s); const d = O ? { [h ? "top" : "bottom"]: `${s}%`, [h ? "bottom" : "top"]: "auto", height: `${y}%` } : { [h ? "right" : "left"]: `${s}%`, [h ? "left" : "right"]: "auto", width: `${y}%` }, c = (0, P.default)((0, P.default)({}, i), d); return x ? (0, g.createVNode)("div", { class: f, style: c }, null) : null; }; S.inheritAttrs = !1; var C = S; return Q.default = C, Q; } var se = {}, Z = {}, pe; function Ue() { if (pe) return Z; pe = 1; var p = I; Object.defineProperty(Z, "__esModule", { value: !0 }), Z.default = void 0; var g = z, P = p(G()), S = p(Y()), C = p(_e()); const _ = (x, O, i, f, y, s) => { (0, C.default)(i ? f > 0 : !0, "Slider", "`Slider[step]` should be a positive number in order to make Slider[dots] work."); const h = Object.keys(O).map(parseFloat).sort((d, c) => d - c); if (i && f) for (let d = y; d <= s; d += f) h.indexOf(d) === -1 && h.push(d); return h; }, M = (x, O) => { let { attrs: i } = O; const { prefixCls: f, vertical: y, reverse: s, marks: h, dots: d, step: c, included: t, lowerBound: a, upperBound: o, max: n, min: u, dotStyle: e, activeDotStyle: r } = i, l = n - u, v = _(y, h, d, c, u, n).map((m) => { const b = `${Math.abs(m - u) / l * 100}%`, $ = !t && m === o || t && m <= o && m >= a; let T = y ? (0, P.default)((0, P.default)({}, e), { [s ? "top" : "bottom"]: b }) : (0, P.default)((0, P.default)({}, e), { [s ? "right" : "left"]: b }); $ && (T = (0, P.default)((0, P.default)({}, T), r)); const V = (0, S.default)({ [`${f}-dot`]: !0, [`${f}-dot-active`]: $, [`${f}-dot-reverse`]: s }); return (0, g.createVNode)("span", { class: V, style: T, key: m }, null); }); return (0, g.createVNode)("div", { class: `${f}-step` }, [v]); }; M.inheritAttrs = !1; var B = M; return Z.default = B, Z; } var ee = {}, ve; function Ge() { if (ve) return ee; ve = 1; var p = I; Object.defineProperty(ee, "__esModule", { value: !0 }), ee.default = void 0; var g = z, P = p(oe()), S = p(G()), C = p($e()), _ = p(Y()), M = ue(); const B = (O, i) => { let { attrs: f, slots: y } = i; const { class: s, vertical: h, reverse: d, marks: c, included: t, upperBound: a, lowerBound: o, max: n, min: u, onClickLabel: e } = f, r = Object.keys(c), l = y.mark, v = n - u, m = r.map(parseFloat).sort((b, $) => b - $).map((b) => { const $ = typeof c[b] == "function" ? c[b]() : c[b], T = typeof $ == "object" && !(0, M.isValidElement)($); let V = T ? $.label : $; if (!V && V !== 0) return null; l && (V = l({ point: b, label: V })); const H = !t && b === a || t && b <= a && b >= o, R = (0, _.default)({ [`${s}-text`]: !0, [`${s}-text-active`]: H }), F = { marginBottom: "-50%", [d ? "top" : "bottom"]: `${(b - u) / v * 100}%` }, N = { transform: `translateX(${d ? "50%" : "-50%"})`, msTransform: `translateX(${d ? "50%" : "-50%"})`, [d ? "right" : "left"]: `${(b - u) / v * 100}%` }, E = h ? F : N, q = T ? (0, S.default)((0, S.default)({}, E), $.style) : E, W = { [C.default ? "onTouchstartPassive" : "onTouchstart"]: (L) => e(L, b) }; return (0, g.createVNode)("span", (0, P.default)({ class: R, style: q, key: b, onMousedown: (L) => e(L, b) }, W), [V]); }); return (0, g.createVNode)("div", { class: s }, [m]); }; B.inheritAttrs = !1; var x = B; return ee.default = x, ee; } var te = {}, me; function Ve() { if (me) return te; me = 1; var p = I; Object.defineProperty(te, "__esModule", { value: !0 }), te.default = void 0; var g = z, P = p(oe()), S = p(G()), C = p(Y()), _ = p(le()), M = p(Oe()), B = (0, g.defineComponent)({ compatConfig: { MODE: 3 }, name: "Handle", inheritAttrs: !1, props: { prefixCls: String, vertical: { type: Boolean, default: void 0 }, offset: Number, disabled: { type: Boolean, default: void 0 }, min: Number, max: Number, value: Number, tabindex: _.default.oneOfType([_.default.number, _.default.string]), reverse: { type: Boolean, default: void 0 }, ariaLabel: String, ariaLabelledBy: String, ariaValueTextFormatter: Function, onMouseenter: { type: Function }, onMouseleave: { type: Function }, onMousedown: { type: Function } }, setup(x, O) { let { attrs: i, emit: f, expose: y } = O; const s = (0, g.shallowRef)(!1), h = (0, g.shallowRef)(), d = () => { document.activeElement === h.value && (s.value = !0); }, c = (l) => { s.value = !1, f("blur", l); }, t = () => { s.value = !1; }, a = () => { var l; (l = h.value) === null || l === void 0 || l.focus(); }, o = () => { var l; (l = h.value) === null || l === void 0 || l.blur(); }, n = () => { s.value = !0, a(); }, u = (l) => { l.preventDefault(), a(), f("mousedown", l); }; y({ focus: a, blur: o, clickFocus: n, ref: h }); let e = null; (0, g.onMounted)(() => { e = (0, M.default)(document, "mouseup", d); }), (0, g.onBeforeUnmount)(() => { e == null || e.remove(); }); const r = (0, g.computed)(() => { const { vertical: l, offset: v, reverse: m } = x; return l ? { [m ? "top" : "bottom"]: `${v}%`, [m ? "bottom" : "top"]: "auto", transform: m ? null : "translateY(+50%)" } : { [m ? "right" : "left"]: `${v}%`, [m ? "left" : "right"]: "auto", transform: `translateX(${m ? "+" : "-"}50%)` }; }); return () => { const { prefixCls: l, disabled: v, min: m, max: b, value: $, tabindex: T, ariaLabel: V, ariaLabelledBy: H, ariaValueTextFormatter: R, onMouseenter: F, onMouseleave: N } = x, E = (0, C.default)(i.class, { [`${l}-handle-click-focused`]: s.value }), q = { "aria-valuemin": m, "aria-valuemax": b, "aria-valuenow": $, "aria-disabled": !!v }, W = [i.style, r.value]; let L = T || 0; (v || T === null) && (L = null); let D; R && (D = R($)); const K = (0, S.default)((0, S.default)((0, S.default)((0, S.default)({}, i), { role: "slider", tabindex: L }), q), { class: E, onBlur: c, onKeydown: t, onMousedown: u, onMouseenter: F, onMouseleave: N, ref: h, style: W }); return (0, g.createVNode)("div", (0, P.default)((0, P.default)({}, K), {}, { "aria-label": V, "aria-labelledby": H, "aria-valuetext": D }), null); }; } }); return te.default = B, te; } var k = {}, ge; function fe() { if (ge) return k; ge = 1; var p = I; Object.defineProperty(k, "__esModule", { value: !0 }), k.calculateNextValue = s, k.ensureValueInRange = i, k.ensureValuePrecision = f, k.getClosestPoint = _, k.getHandleCenterPosition = O, k.getKeyboardValueMutator = h, k.getMousePosition = B, k.getPrecision = M, k.getTouchPosition = x, k.isEventFromHandle = P, k.isNotTouchEvent = C, k.isValueOutOfRange = S, k.pauseEvent = y; var g = p(Ie()); function P(d, c) { try { return Object.keys(c).some((t) => d.target === c[t].ref); } catch { return !1; } } function S(d, c) { let { min: t, max: a } = c; return d < t || d > a; } function C(d) { return d.touches.length > 1 || d.type.toLowerCase() === "touchend" && d.touches.length > 0; } function _(d, c) { let { marks: t, step: a, min: o, max: n } = c; const u = Object.keys(t).map(parseFloat); if (a !== null) { const r = Math.pow(10, M(a)), l = Math.floor((n * r - o * r) / (a * r)), v = Math.min((d - o) / a, l), m = Math.round(v) * a + o; u.push(m); } const e = u.map((r) => Math.abs(d - r)); return u[e.indexOf(Math.min(...e))]; } function M(d) { const c = d.toString(); let t = 0; return c.indexOf(".") >= 0 && (t = c.length - c.indexOf(".") - 1), t; } function B(d, c) { let t = 1; return window.visualViewport && (t = +(window.visualViewport.width / document.body.getBoundingClientRect().width).toFixed(2)), (d ? c.clientY : c.pageX) / t; } function x(d, c) { let t = 1; return window.visualViewport && (t = +(window.visualViewport.width / document.body.getBoundingClientRect().width).toFixed(2)), (d ? c.touches[0].clientY : c.touches[0].pageX) / t; } function O(d, c) { const t = c.getBoundingClientRect(); return d ? t.top + t.height * 0.5 : window.pageXOffset + t.left + t.width * 0.5; } function i(d, c) { let { max: t, min: a } = c; return d <= a ? a : d >= t ? t : d; } function f(d, c) { const { step: t } = c, a = isFinite(_(d, c)) ? _(d, c) : 0; return t === null ? a : parseFloat(a.toFixed(M(t))); } function y(d) { d.stopPropagation(), d.preventDefault(); } function s(d, c, t) { const a = { increase: (u, e) => u + e, decrease: (u, e) => u - e }, o = a[d](Object.keys(t.marks).indexOf(JSON.stringify(c)), 1), n = Object.keys(t.marks)[o]; return t.step ? a[d](c, t.step) : Object.keys(t.marks).length && t.marks[n] ? t.marks[n] : c; } function h(d, c, t) { const a = "increase", o = "decrease"; let n = a; switch (d.keyCode) { case g.default.UP: n = c && t ? o : a; break; case g.default.RIGHT: n = !c && t ? o : a; break; case g.default.DOWN: n = c && t ? a : o; break; case g.default.LEFT: n = !c && t ? a : o; break; case g.default.END: return (u, e) => e.max; case g.default.HOME: return (u, e) => e.min; case g.default.PAGE_UP: return (u, e) => u + e.step * 2; case g.default.PAGE_DOWN: return (u, e) => u - e.step * 2; default: return; } return (u, e) => s(n, u, e); } return k; } var be; function Te() { if (be) return se; be = 1; var p = I; Object.defineProperty(se, "__esModule", { value: !0 }), se.default = o; var g = z, P = p(oe()), S = p(G()), C = p(Y()), _ = p(le()), M = p(Oe()), B = p(_e()), x = ue(), O = p(Ue()), i = p(Ge()), f = p(Ve()), y = c(fe()), s = p(ce()), h = p($e()); function d(n) { if (typeof WeakMap != "function") return null; var u = /* @__PURE__ */ new WeakMap(), e = /* @__PURE__ */ new WeakMap(); return (d = function(r) { return r ? e : u; })(n); } function c(n, u) { if (!u && n && n.__esModule) return n; if (n === null || typeof n != "object" && typeof n != "function") return { default: n }; var e = d(u); if (e && e.has(n)) return e.get(n); var r = {}, l = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var v in n) if (v !== "default" && Object.prototype.hasOwnProperty.call(n, v)) { var m = l ? Object.getOwnPropertyDescriptor(n, v) : null; m && (m.get || m.set) ? Object.defineProperty(r, v, m) : r[v] = n[v]; } return r.default = n, e && e.set(n, r), r; } var t = function(n, u) { var e = {}; for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && u.indexOf(r) < 0 && (e[r] = n[r]); if (n != null && typeof Object.getOwnPropertySymbols == "function") for (var l = 0, r = Object.getOwnPropertySymbols(n); l < r.length; l++) u.indexOf(r[l]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[l]) && (e[r[l]] = n[r[l]]); return e; }; function a() { } function o(n) { const u = { id: String, min: Number, max: Number, step: Number, marks: _.default.object, included: { type: Boolean, default: void 0 }, prefixCls: String, disabled: { type: Boolean, default: void 0 }, handle: Function, dots: { type: Boolean, default: void 0 }, vertical: { type: Boolean, default: void 0 }, reverse: { type: Boolean, default: void 0 }, minimumTrackStyle: _.default.object, maximumTrackStyle: _.default.object, handleStyle: _.default.oneOfType([_.default.object, _.default.arrayOf(_.default.object)]), trackStyle: _.default.oneOfType([_.default.object, _.default.arrayOf(_.default.object)]), railStyle: _.default.object, dotStyle: _.default.object, activeDotStyle: _.default.object, autofocus: { type: Boolean, default: void 0 }, draggableTrack: { type: Boolean, default: void 0 } }; return (0, g.defineComponent)({ compatConfig: { MODE: 3 }, name: "CreateSlider", mixins: [s.default, n], inheritAttrs: !1, props: (0, x.initDefaultProps)(u, { prefixCls: "rc-slider", min: 0, max: 100, step: 1, marks: {}, included: !0, disabled: !1, dots: !1, vertical: !1, reverse: !1, trackStyle: [{}], handleStyle: [{}], railStyle: {}, dotStyle: {}, activeDotStyle: {} }), emits: ["change", "blur", "focus"], data() { const { step: e, max: r, min: l } = this, v = isFinite(r - l) ? (r - l) % e === 0 : !0; return (0, B.default)(e && Math.floor(e) === e ? v : !0, `Slider[max] - Slider[min] (${r - l}) should be a multiple of Slider[step] (${e})`), this.handlesRefs = {}, {}; }, mounted() { this.$nextTick(() => { this.document = this.sliderRef && this.sliderRef.ownerDocument; const { autofocus: e, disabled: r } = this; e && !r && this.focus(); }); }, beforeUnmount() { this.$nextTick(() => { this.removeDocumentEvents(); }); }, methods: { defaultHandle(e) { var { index: r, directives: l, className: v, style: m } = e, b = t(e, ["index", "directives", "className", "style"]); if (delete b.dragging, b.value === null) return null; const $ = (0, S.default)((0, S.default)({}, b), { class: v, style: m, key: r }); return (0, g.createVNode)(f.default, $, null); }, onDown(e, r) { let l = r; const { draggableTrack: v, vertical: m } = this.$props, { bounds: b } = this.$data, $ = v && this.positionGetValue ? this.positionGetValue(l) || [] : [], T = y.isEventFromHandle(e, this.handlesRefs); if (this.dragTrack = v && b.length >= 2 && !T && !$.map((V, H) => { const R = H ? !0 : V >= b[H]; return H === $.length - 1 ? V <= b[H] : R; }).some((V) => !V), this.dragTrack) this.dragOffset = l, this.startBounds = [...b]; else { if (!T) this.dragOffset = 0; else { const V = y.getHandleCenterPosition(m, e.target); this.dragOffset = l - V, l = V; } this.onStart(l); } }, onMouseDown(e) { if (e.button !== 0) return; this.removeDocumentEvents(); const r = this.$props.vertical, l = y.getMousePosition(r, e); this.onDown(e, l), this.addDocumentMouseEvents(); }, onTouchStart(e) { if (y.isNotTouchEvent(e)) return; const r = this.vertical, l = y.getTouchPosition(r, e); this.onDown(e, l), this.addDocumentTouchEvents(), y.pauseEvent(e); }, onFocus(e) { const { vertical: r } = this; if (y.isEventFromHandle(e, this.handlesRefs) && !this.dragTrack) { const l = y.getHandleCenterPosition(r, e.target); this.dragOffset = 0, this.onStart(l), y.pauseEvent(e), this.$emit("focus", e); } }, onBlur(e) { this.dragTrack || this.onEnd(), this.$emit("blur", e); }, onMouseUp() { this.handlesRefs[this.prevMovedHandleIndex] && this.handlesRefs[this.prevMovedHandleIndex].clickFocus(); }, onMouseMove(e) { if (!this.sliderRef) { this.onEnd(); return; } const r = y.getMousePosition(this.vertical, e); this.onMove(e, r - this.dragOffset, this.dragTrack, this.startBounds); }, onTouchMove(e) { if (y.isNotTouchEvent(e) || !this.sliderRef) { this.onEnd(); return; } const r = y.getTouchPosition(this.vertical, e); this.onMove(e, r - this.dragOffset, this.dragTrack, this.startBounds); }, onKeyDown(e) { this.sliderRef && y.isEventFromHandle(e, this.handlesRefs) && this.onKeyboard(e); }, onClickMarkLabel(e, r) { e.stopPropagation(), this.onChange({ sValue: r }), this.setState({ sValue: r }, () => this.onEnd(!0)); }, getSliderStart() { const e = this.sliderRef, { vertical: r, reverse: l } = this, v = e.getBoundingClientRect(); return r ? l ? v.bottom : v.top : window.pageXOffset + (l ? v.right : v.left); }, getSliderLength() { const e = this.sliderRef; if (!e) return 0; const r = e.getBoundingClientRect(); return this.vertical ? r.height : r.width; }, addDocumentTouchEvents() { this.onTouchMoveListener = (0, M.default)(this.document, "touchmove", this.onTouchMove), this.onTouchUpListener = (0, M.default)(this.document, "touchend", this.onEnd); }, addDocumentMouseEvents() { this.onMouseMoveListener = (0, M.default)(this.document, "mousemove", this.onMouseMove), this.onMouseUpListener = (0, M.default)(this.document, "mouseup", this.onEnd); }, removeDocumentEvents() { this.onTouchMoveListener && this.onTouchMoveListener.remove(), this.onTouchUpListener && this.onTouchUpListener.remove(), this.onMouseMoveListener && this.onMouseMoveListener.remove(), this.onMouseUpListener && this.onMouseUpListener.remove(); }, focus() { var e; this.$props.disabled || (e = this.handlesRefs[0]) === null || e === void 0 || e.focus(); }, blur() { this.$props.disabled || Object.keys(this.handlesRefs).forEach((e) => { var r, l; (l = (r = this.handlesRefs[e]) === null || r === void 0 ? void 0 : r.blur) === null || l === void 0 || l.call(r); }); }, calcValue(e) { const { vertical: r, min: l, max: v } = this, m = Math.abs(Math.max(e, 0) / this.getSliderLength()); return r ? (1 - m) * (v - l) + l : m * (v - l) + l; }, calcValueByPos(e) { const l = (this.reverse ? -1 : 1) * (e - this.getSliderStart()); return this.trimAlignValue(this.calcValue(l)); }, calcOffset(e) { const { min: r, max: l } = this, v = (e - r) / (l - r); return Math.max(0, v * 100); }, saveSlider(e) { this.sliderRef = e; }, saveHandle(e, r) { this.handlesRefs[e] = r; } }, render() { const { prefixCls: e, marks: r, dots: l, step: v, included: m, disabled: b, vertical: $, reverse: T, min: V, max: H, maximumTrackStyle: R, railStyle: F, dotStyle: N, activeDotStyle: E, id: q } = this, { class: W, style: L } = this.$attrs, { tracks: D, handles: K } = this.renderSlider(), ie = (0, C.default)(e, W, { [`${e}-with-marks`]: Object.keys(r).length, [`${e}-disabled`]: b, [`${e}-vertical`]: $, [`${e}-horizontal`]: !$ }), de = { vertical: $, marks: r, included: m, lowerBound: this.getLowerBound(), upperBound: this.getUpperBound(), max: H, min: V, reverse: T, class: `${e}-mark`, onClickLabel: b ? a : this.onClickMarkLabel }, Ne = { [h.default ? "onTouchstartPassive" : "onTouchstart"]: b ? a : this.onTouchStart }; return (0, g.createVNode)("div", (0, P.default)((0, P.default)({ id: q, ref: this.saveSlider, tabindex: "-1", class: ie }, Ne), {}, { onMousedown: b ? a : this.onMouseDown, onMouseup: b ? a : this.onMouseUp, onKeydown: b ? a : this.onKeyDown, onFocus: b ? a : this.onFocus, onBlur: b ? a : this.onBlur, style: L }), [(0, g.createVNode)("div", { class: `${e}-rail`, style: (0, S.default)((0, S.default)({}, R), F) }, null), D, (0, g.createVNode)(O.default, { prefixCls: e, vertical: $, reverse: T, marks: r, dots: l, step: v, included: m, lowerBound: this.getLowerBound(), upperBound: this.getUpperBound(), max: H, min: V, dotStyle: N, activeDotStyle: E }, null), K, (0, g.createVNode)(i.default, de, { mark: this.$slots.mark }), (0, x.getSlot)(this)]); } }); } return se; } var ye; function Ke() { if (ye) return J; ye = 1; var p = I; Object.defineProperty(J, "__esModule", { value: !0 }), J.default = void 0; var g = z, P = p(G()), S = p(le()), C = p(ce()), _ = ue(), M = p(Me()), B = p(Te()), x = i(fe()); function O(s) { if (typeof WeakMap != "function") return null; var h = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(); return (O = function(c) { return c ? d : h; })(s); } function i(s, h) { if (!h && s && s.__esModule) return s; if (s === null || typeof s != "object" && typeof s != "function") return { default: s }; var d = O(h); if (d && d.has(s)) return d.get(s); var c = {}, t = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var a in s) if (a !== "default" && Object.prototype.hasOwnProperty.call(s, a)) { var o = t ? Object.getOwnPropertyDescriptor(s, a) : null; o && (o.get || o.set) ? Object.defineProperty(c, a, o) : c[a] = s[a]; } return c.default = s, d && d.set(s, c), c; } const f = (0, g.defineComponent)({ compatConfig: { MODE: 3 }, name: "Slider", mixins: [C.default], inheritAttrs: !1, props: { defaultValue: Number, value: Number, disabled: { type: Boolean, default: void 0 }, autofocus: { type: Boolean, default: void 0 }, tabindex: S.default.oneOfType([S.default.number, S.default.string]), reverse: { type: Boolean, default: void 0 }, min: Number, max: Number, ariaLabelForHandle: String, ariaLabelledByForHandle: String, ariaValueTextFormatterForHandle: String, startPoint: Number }, emits: ["beforeChange", "afterChange", "change"], data() { const s = this.defaultValue !== void 0 ? this.defaultValue : this.min, h = this.value !== void 0 ? this.value : s; return { sValue: this.trimAlignValue(h), dragging: !1 }; }, watch: { value: { handler(s) { this.setChangeValue(s); }, deep: !0 }, min() { const { sValue: s } = this; this.setChangeValue(s); }, max() { const { sValue: s } = this; this.setChangeValue(s); } }, methods: { setChangeValue(s) { const h = s !== void 0 ? s : this.sValue, d = this.trimAlignValue(h, this.$props); d !== this.sValue && (this.setState({ sValue: d }), x.isValueOutOfRange(h, this.$props) && this.$emit("change", d)); }, onChange(s) { const h = !(0, _.hasProp)(this, "value"), d = s.sValue > this.max ? (0, P.default)((0, P.default)({}, s), { sValue: this.max }) : s; h && this.setState(d); const c = d.sValue; this.$emit("change", c); }, onStart(s) { this.setState({ dragging: !0 }); const { sValue: h } = this; this.$emit("beforeChange", h); const d = this.calcValueByPos(s); this.startValue = d, this.startPosition = s, d !== h && (this.prevMovedHandleIndex = 0, this.onChange({ sValue: d })); }, onEnd(s) { const { dragging: h } = this; this.removeDocumentEvents(), (h || s) && this.$emit("afterChange", this.sValue), this.setState({ dragging: !1 }); }, onMove(s, h) { x.pauseEvent(s); const { sValue: d } = this, c = this.calcValueByPos(h); c !== d && this.onChange({ sValue: c }); }, onKeyboard(s) { const { reverse: h, vertical: d } = this.$props, c = x.getKeyboardValueMutator(s, d, h); if (c) { x.pauseEvent(s); const { sValue: t } = this, a = c(t, this.$props), o = this.trimAlignValue(a); if (o === t) return; this.onChange({ sValue: o }), this.$emit("afterChange", o), this.onEnd(); } }, getLowerBound() { const s = this.$props.startPoint || this.$props.min; return this.$data.sValue > s ? s : this.$data.sValue; }, getUpperBound() { return this.$data.sValue < this.$props.startPoint ? this.$props.startPoint : this.$data.sValue; }, trimAlignValue(s) { let h = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; if (s === null) return null; const d = (0, P.default)((0, P.default)({}, this.$props), h), c = x.ensureValueInRange(s, d); return x.ensureValuePrecision(c, d); }, getTrack(s) { let { prefixCls: h, reverse: d, vertical: c, included: t, minimumTrackStyle: a, mergedTrackStyle: o, length: n, offset: u } = s; return (0, g.createVNode)(M.default, { class: `${h}-track`, vertical: c, included: t, offset: u, reverse: d, length: n, style: (0, P.default)((0, P.default)({}, a), o) }, null); }, renderSlider() { const { prefixCls: s, vertical: h, included: d, disabled: c, minimumTrackStyle: t, trackStyle: a, handleStyle: o, tabindex: n, ariaLabelForHandle: u, ariaLabelledByForHandle: e, ariaValueTextFormatterForHandle: r, min: l, max: v, startPoint: m, reverse: b, handle: $, defaultHandle: T } = this, V = $ || T, { sValue: H, dragging: R } = this, F = this.calcOffset(H), N = V({ class: `${s}-handle`, prefixCls: s, vertical: h, offset: F, value: H, dragging: R, disabled: c, min: l, max: v, reverse: b, index: 0, tabindex: n, ariaLabel: u, ariaLabelledBy: e, ariaValueTextFormatter: r, style: o[0] || o, ref: (W) => this.saveHandle(0, W), onFocus: this.onFocus, onBlur: this.onBlur }), E = m !== void 0 ? this.calcOffset(m) : 0, q = a[0] || a; return { tracks: this.getTrack({ prefixCls: s, reverse: b, vertical: h, included: d, offset: E, minimumTrackStyle: t, mergedTrackStyle: q, length: F - E }), handles: N }; } } }); var y = (0, B.default)(f); return J.default = y, J; } var re = {}, Se; function Xe() { if (Se) return re; Se = 1; var p = I; Object.defineProperty(re, "__esModule", { value: !0 }), re.default = void 0; var g = z, P = p(G()), S = p(Y()), C = y(le()), _ = p(ce()), M = ue(), B = p(Me()), x = p(Te()), O = y(fe()), i = p(ke()); function f(t) { if (typeof WeakMap != "function") return null; var a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(); return (f = function(n) { return n ? o : a; })(t); } function y(t, a) { if (!a && t && t.__esModule) return t; if (t === null || typeof t != "object" && typeof t != "function") return { default: t }; var o = f(a); if (o && o.has(t)) return o.get(t); var n = {}, u = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var e in t) if (e !== "default" && Object.prototype.hasOwnProperty.call(t, e)) { var r = u ? Object.getOwnPropertyDescriptor(t, e) : null; r && (r.get || r.set) ? Object.defineProperty(n, e, r) : n[e] = t[e]; } return n.default = t, o && o.set(t, n), n; } const s = (t) => { let { value: a, handle: o, bounds: n, props: u } = t; const { allowCross: e, pushable: r } = u, l = Number(r), v = O.ensureValueInRange(a, u); let m = v; return !e && o != null && n !== void 0 && (o > 0 && v <= n[o - 1] + l && (m = n[o - 1] + l), o < n.length - 1 && v >= n[o + 1] - l && (m = n[o + 1] - l)), O.ensureValuePrecision(m, u); }, h = { defaultValue: C.default.arrayOf(C.default.number), value: C.default.arrayOf(C.default.number), count: Number, pushable: (0, C.withUndefined)(C.default.oneOfType([C.default.looseBool, C.default.number])), allowCross: { type: Boolean, default: void 0 }, disabled: { type: Boolean, default: void 0 }, reverse: { type: Boolean, default: void 0 }, tabindex: C.default.arrayOf(C.default.number), prefixCls: String, min: Number, max: Number, autofocus: { type: Boolean, default: void 0 }, ariaLabelGroupForHandles: Array, ariaLabelledByGroupForHandles: Array, ariaValueTextFormatterGroupForHandles: Array, draggableTrack: { type: Boolean, default: void 0 } }, d = (0, g.defineComponent)({ compatConfig: { MODE: 3 }, name: "Range", mixins: [_.default], inheritAttrs: !1, props: (0, i.default)(h, { count: 1, allowCross: !0, pushable: !1, tabindex: [], draggableTrack: !1, ariaLabelGroupForHandles: [], ariaLabelledByGroupForHandles: [], ariaValueTextFormatterGroupForHandles: [] }), emits: ["beforeChange", "afterChange", "change"], displayName: "Range", data() { const { count: t, min: a, max: o } = this, n = Array(...Array(t + 1)).map(() => a), u = (0, M.hasProp)(this, "defaultValue") ? this.defaultValue : n; let { value: e } = this; e === void 0 && (e = u); const r = e.map((v, m) => s({ value: v, handle: m, props: this.$props })); return { sHandle: null, recent: r[0] === o ? 0 : r.length - 1, bounds: r }; }, watch: { value: { handler(t) { const { bounds: a } = this; this.setChangeValue(t || a); }, deep: !0 }, min() { const { value: t } = this; this.setChangeValue(t || this.bounds); }, max() { const { value: t } = this; this.setChangeValue(t || this.bounds); } }, methods: { setChangeValue(t) { const { bounds: a } = this; let o = t.map((n, u) => s({ value: n, handle: u, bounds: a, props: this.$props })); if (a.length === o.length) { if (o.every((n, u) => n === a[u])) return null; } else o = t.map((n, u) => s({ value: n, handle: u, props: this.$props })); if (this.setState({ bounds: o }), t.some((n) => O.isValueOutOfRange(n, this.$props))) { const n = t.map((u) => O.ensureValueInRange(u, this.$props)); this.$emit("change", n); } }, onChange(t) { if (!(0, M.hasProp)(this, "value")) this.setState(t); else { const u = {}; ["sHandle", "recent"].forEach((e) => { t[e] !== void 0 && (u[e] = t[e]); }), Object.keys(u).length && this.setState(u); } const n = (0, P.default)((0, P.default)({}, this.$data), t).bounds; this.$emit("change", n); }, positionGetValue(t) { const a = this.getValue(), o = this.calcValueByPos(t), n = this.getClosestBound(o), u = this.getBoundNeedMoving(o, n), e = a[u]; if (o === e) return null; const r = [...a]; return r[u] = o, r; }, onStart(t) { const { bounds: a } = this; this.$emit("beforeChange", a); const o = this.calcValueByPos(t); this.startValue = o, this.startPosition = t; const n = this.getClosestBound(o); this.prevMovedHandleIndex = this.getBoundNeedMoving(o, n), this.setState({ sHandle: this.prevMovedHandleIndex, recent: this.prevMovedHandleIndex }); const u = a[this.prevMovedHandleIndex]; if (o === u) return; const e = [...a]; e[this.prevMovedHandleIndex] = o, this.onChange({ bounds: e }); }, onEnd(t) { const { sHandle: a } = this; this.removeDocumentEvents(), a || (this.dragTrack = !1), (a !== null || t) && this.$emit("afterChange", this.bounds), this.setState({ sHandle: null }); }, onMove(t, a, o, n) { O.pauseEvent(t); const { $data: u, $props: e } = this, r = e.max || 100, l = e.min || 0; if (o) { let T = e.vertical ? -a : a; T = e.reverse ? -T : T; const V = r - Math.max(...n), H = l - Math.min(...n), R = Math.min(Math.max(T / (this.getSliderLength() / 100), H), V), F = n.map((N) => Math.floor(Math.max(Math.min(N + R, r), l))); u.bounds.map((N, E) => N === F[E]).some((N) => !N) && this.onChange({ bounds: F }); return; } const { bounds: v, sHandle: m } = this, b = this.calcValueByPos(a), $ = v[m]; b !== $ && this.moveTo(b); }, onKeyboard(t) { const { reverse: a, vertical: o } = this.$props, n = O.getKeyboardValueMutator(t, o, a); if (n) { O.pauseEvent(t); const { bounds: u, sHandle: e } = this, r = u[e === null ? this.recent : e], l = n(r, this.$props), v = s({ value: l, handle: e, bounds: u, props: this.$props }); if (v === r) return; const m = !0; this.moveTo(v, m); } }, getClosestBound(t) { const { bounds: a } = this; let o = 0; for (let n = 1; n < a.length - 1; n += 1) t >= a[n] && (o = n); return Math.abs(a[o + 1] - t) < Math.abs(a[o] - t) && (o += 1), o; }, getBoundNeedMoving(t, a) { const { bounds: o, recent: n } = this; let u = a; const e = o[a + 1] === o[a]; return e && o[n] === o[a] && (u = n), e && t !== o[a + 1] && (u = t < o[a + 1] ? a : a + 1), u; }, getLowerBound() { return this.bounds[0]; }, getUpperBound() { const { bounds: t } = this; return t[t.length - 1]; }, /** * Returns an array of possible slider points, taking into account both * `marks` and `step`. The result is cached. */ getPoints() { const { marks: t, step: a, min: o, max: n } = this, u = this.internalPointsCache; if (!u || u.marks !== t || u.step !== a) { const e = (0, P.default)({}, t); if (a !== null) for (let l = o; l <= n; l += a) e[l] = l; const r = Object.keys(e).map(parseFloat); r.sort((l, v) => l - v), this.internalPointsCache = { marks: t, step: a, points: r }; } return this.internalPointsCache.points; }, moveTo(t, a) { const o = [...this.bounds], { sHandle: n, recent: u } = this, e = n === null ? u : n; o[e] = t; let r = e; this.$props.pushable !== !1 ? this.pushSurroundingHandles(o, r) : this.$props.allowCross && (o.sort((l, v) => l - v), r = o.indexOf(t)), this.onChange({ recent: r, sHandle: r, bounds: o }), a && (this.$emit("afterChange", o), this.setState({}, () => { this.handlesRefs[r].focus(); }), this.onEnd()); }, pushSurroundingHandles(t, a) { const o = t[a], { pushable: n } = this, u = Number(n); let e = 0; if (t[a + 1] - o < u && (e = 1), o - t[a - 1] < u && (e = -1), e === 0) return; const r = a + e, l = e * (t[r] - o); this.pushHandle(t, r, e, u - l) || (t[a] = t[r] - e * u); }, pushHandle(t, a, o, n) { const u = t[a]; let e = t[a]; for (; o * (e - u) < n; ) { if (!this.pushHandleOnePoint(t, a, o)) return t[a] = u, !1; e = t[a]; } return !0; }, pushHandleOnePoint(t, a, o) { const n = this.getPoints(), e = n.indexOf(t[a]) + o; if (e >= n.length || e < 0) return !1; const r = a + o, l = n[e], { pushable: v } = this, m = Number(v), b = o * (t[r] - l); return this.pushHandle(t, r, o, m - b) ? (t[a] = l, !0) : !1; }, trimAlignValue(t) { const { sHandle: a, bounds: o } = this; return s({ value: t, handle: a, bounds: o, props: this.$props }); }, ensureValueNotConflict(t, a, o) { let { allowCross: n, pushable: u } = o; const e = this.$data || {}, { bounds: r } = e; if (t = t === void 0 ? e.sHandle : t, u = Number(u), !n && t != null && r !== void 0) { if (t > 0 && a <= r[t - 1] + u) return r[t - 1] + u; if (t < r.length - 1 && a >= r[t + 1] - u) return r[t + 1] - u; } return a; }, getTrack(t) { let { bounds: a, prefixCls: o, reverse: n, vertical: u, included: e, offsets: r, trackStyle: l } = t; return a.slice(0, -1).map((v, m) => { const b = m + 1, $ = (0, S.default)({ [`${o}-track`]: !0, [`${o}-track-${b}`]: !0 }); return (0, g.createVNode)(B.default, { class: $, vertical: u, reverse: n, included: e, offset: r[b - 1], length: r[b] - r[b - 1], style: l[m], key: b }, null); }); }, renderSlider() { const { sHandle: t, bounds: a, prefixCls: o, vertical: n, included: u, disabled: e, min: r, max: l, reverse: v, handle: m, defaultHandle: b, trackStyle: $, handleStyle: T, tabindex: V, ariaLabelGroupForHandles: H, ariaLabelledByGroupForHandles: R, ariaValueTextFormatterGroupForHandles: F } = this, N = m || b, E = a.map((L) => this.calcOffset(L)), q = `${o}-handle`, W = a.map((L, D) => { let K = V[D] || 0; (e || V[D] === null) && (K = null); const ie = t === D; return N({ class: (0, S.default)({ [q]: !0, [`${q}-${D + 1}`]: !0, [`${q}-dragging`]: ie }), prefixCls: o, vertical: n, dragging: ie, offset: E[D], value: L, index: D, tabindex: K, min: r, max: l, reverse: v, disabled: e, style: T[D], ref: (de) => this.saveHandle(D, de), onFocus: this.onFocus, onBlur: this.onBlur, ariaLabel: H[D], ariaLabelledBy: R[D], ariaValueTextFormatter: F[D] }); }); return { tracks: this.getTrack({ bounds: a, prefixCls: o, reverse: v, vertical: n, included: u, offsets: E, trackStyle: $ }), handles: W }; } } }); var c = (0, x.default)(d); return re.default = c, re; } var ae = {}, xe; function Ye() { if (xe) return ae; xe = 1; var p = I; Object.defineProperty(ae, "__esModule", { value: !0 }), ae.default = void 0; var g = z, P = p(oe()), S = M(We()), C = p(ze()); function _(x) { if (typeof WeakMap != "function") return null; var O = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(); return (_ = function(f) { return f ? i : O; })(x); } function M(x, O) { if (!O && x && x.__esModule) return x; if (x === null || typeof x != "object" && typeof x != "function") return { default: x }; var i = _(O); if (i && i.has(x)) return i.get(x); var f = {}, y = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var s in x) if (s !== "default" && Object.prototype.hasOwnProperty.call(x, s)) { var h = y ? Object.getOwnPropertyDescriptor(x, s) : null; h && (h.get || h.set) ? Object.defineProperty(f, s, h) : f[s] = x[s]; } return f.default = x, i && i.set(x, f), f; } var B = (0, g.defineComponent)({ compatConfig: { MODE: 3 }, name: "SliderTooltip", inheritAttrs: !1, props: (0, S.tooltipProps)(), setup(x, O) { let { attrs: i, slots: f } = O; const y = (0, g.ref)(null), s = (0, g.ref)(null); function h() { C.default.cancel(s.value), s.value = null; } function d() { s.value = (0, C.default)(() => { var t; (t = y.value) === null || t === void 0 || t.forcePopupAlign(), s.value = null; }); } const c = () => { h(), x.open && d(); }; return (0, g.watch)([() => x.open, () => x.title], () => { c(); }, { flush: "post", immediate: !0 }), (0, g.onActivated)(() => { c(); }), (0, g.onBeforeUnmount)(() => { h(); }), () => (0, g.createVNode)(S.default, (0, P.default)((0, P.default)({ ref: y }, x), i), f); } }); return ae.default = B, ae; } var ne = {}, Pe; function Je() { if (Pe) return ne; Pe = 1; var p = I; Object.defineProperty(ne, "__esModule", { value: !0 }), ne.default = void 0; var g = p(G()), P = Re, S = Fe(), C = Ee(); const _ = (i) => { const { componentCls: f, controlSize: y, dotSize: s, marginFull: h, marginPart: d, colorFillContentHover: c } = i; return { [f]: (0, g.default)((0, g.default)({}, (0, C.resetComponent)(i)), { position: "relative", height: y, margin: `${d}px ${h}px`, padding: 0, cursor: "pointer", touchAction: "none", "&-vertical": { margin: `${h}px ${d}px` }, [`${f}-rail`]: { position: "absolute", backgroundColor: i.colorFillTertiary, borderRadius: i.borderRadiusXS, transition: `background-color ${i.motionDurationMid}` }, [`${f}-track`]: { position: "absolute", backgroundColor: i.colorPrimaryBorder, borderRadius: i.borderRadiusXS, transition: `background-color ${i.motionDurationMid}` }, "&:hover": { [`${f}-rail`]: { backgroundColor: i.colorFillSecondary }, [`${f}-track`]: { backgroundColor: i.colorPrimaryBorderHover }, [`${f}-dot`]: { borderColor: c }, [`${f}-handle::after`]: { boxShadow: `0 0 0 ${i.handleLineWidth}px ${i.colorPrimaryBorderHover}` }, [`${f}-dot-active`]: { borderColor: i.colorPrimary } }, [`${f}-handle`]: { position: "absolute", width: i.handleSize, height: i.handleSize, outline: "none", [`${f}-dragging`]: { zIndex: 1 }, // 扩大选区 "&::before": { content: '""', position: "absolute", insetInlineStart: -i.handleLineWidth, insetBlockStart: -i.handleLineWidth, width: i.handleSize + i.handleLineWidth * 2, height: i.handleSize + i.handleLineWidth * 2, backgroundColor: "transparent" }, "&::after": { content: '""', position: "absolute", insetBlockStart: 0, insetInlineStart: 0, width: i.handleSize, height: i.handleSize, backgroundColor: i.colorBgElevated, boxShadow: `0 0 0 ${i.handleLineWidth}px ${i.colorPrimaryBorder}`, borderRadius: "50%", cursor: "pointer", transition: ` inset-inline-start ${i.motionDurationMid}, inset-block-start ${i.motionDurationMid}, width ${i.motionDurationMid}, height ${i.motionDurationMid}, box-sh