sakana-element 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -25
- package/dist/es/{Alert-C76ZWSVk.js → Alert-DfLsJvQD.js} +2 -2
- package/dist/es/Avatar-Ci4OKsv7.js +9 -0
- package/dist/es/{Badge-CoFWwBwv.js → Badge-B4wEToK6.js} +2 -2
- package/dist/es/{Breadcrumb-BtrwTVKW.js → Breadcrumb-BFzww8jd.js} +2 -2
- package/dist/es/{Button-S_31-UWJ.js → Button-DbFviVWb.js} +3 -3
- package/dist/es/{Card-DcW6nHYD.js → Card-ClRqKkc_.js} +2 -2
- package/dist/es/ChatBubble-DFEV_lVI.js +9 -0
- package/dist/es/Checkbox-l86YI3Fr.js +51 -0
- package/dist/es/{Collapse-DsS7M-m3.js → Collapse-B67v6RSE.js} +4 -4
- package/dist/es/{ConfigProvider-BgIewHXP.js → ConfigProvider-BCoGbcS5.js} +2 -2
- package/dist/es/Diff-BLiniLom.js +64 -0
- package/dist/es/Divider-DDSOHv8G.js +9 -0
- package/dist/es/Drawer-apeXw6EO.js +40 -0
- package/dist/es/Dropdown-By9qIErf.js +104 -0
- package/dist/es/{FileInput-BQ59woas.js → FileInput-CZ5jTfB_.js} +3 -3
- package/dist/es/Filter-B_1zU4Dq.js +40 -0
- package/dist/es/Form-B_XDnSjK.js +123 -0
- package/dist/es/{Icon-DpJyuj7c.js → Icon-D6qRB3pq.js} +1 -1
- package/dist/es/Indicator-C6Ip4dpP.js +9 -0
- package/dist/es/{Input-CiE4bPJN.js → Input-bThwBbNZ.js} +7 -7
- package/dist/es/Kbd-DXNjs7at.js +13 -0
- package/dist/es/{Link-B9B2APZq.js → Link-08Ee61Fv.js} +1 -1
- package/dist/es/{Loading-BW99pE5N.js → Loading-ByI9mjss.js} +13 -13
- package/dist/es/Message-CGG-lV5I.js +152 -0
- package/dist/es/Notification-B4clKY5h.js +69 -0
- package/dist/es/{Overlay-BRDSWspM.js → Overlay-6iPenJB1.js} +1 -1
- package/dist/es/Pixelate-A8J7jxDW.js +39 -0
- package/dist/es/Popconfirm-gcHGcOTz.js +23 -0
- package/dist/es/Progress-DFUBJQ4X.js +12 -0
- package/dist/es/Radio-CLBa1XIM.js +33 -0
- package/dist/es/Resizable-BWrFr2oj.js +151 -0
- package/dist/es/{Select-Dwqv8isB.js → Select-BtLqds1d.js} +20 -20
- package/dist/es/Skeleton-CGUQv3nQ.js +15 -0
- package/dist/es/{Switch-B1Gnv1tB.js → Switch-CZJ-S77_.js} +3 -3
- package/dist/es/Table-lHbxiyGq.js +10 -0
- package/dist/es/Tooltip-CdPqNYdn.js +74 -0
- package/dist/es/Validator-7ZT_nXDZ.js +40 -0
- package/dist/es/hooks-pU4JmsO3.js +171 -0
- package/dist/es/index.js +107 -70
- package/dist/es/utils-BXICIEsD.js +139 -0
- package/dist/es/{vendor-DXmGx29U.js → vendor-DrBJKLFW.js} +254 -210
- package/dist/index.css +1 -1
- package/dist/theme/Avatar.css +13 -43
- package/dist/theme/Badge.css +151 -151
- package/dist/theme/Breadcrumb.css +46 -4
- package/dist/theme/Button.css +72 -8
- package/dist/theme/Card.css +177 -93
- package/dist/theme/ChatBubble.css +218 -0
- package/dist/theme/Checkbox.css +604 -0
- package/dist/theme/Collapse.css +96 -96
- package/dist/theme/Diff.css +110 -0
- package/dist/theme/Divider.css +150 -0
- package/dist/theme/Drawer.css +206 -0
- package/dist/theme/Dropdown.css +359 -75
- package/dist/theme/FileInput.css +32 -0
- package/dist/theme/Filter.css +598 -0
- package/dist/theme/Indicator.css +159 -0
- package/dist/theme/Input.css +414 -406
- package/dist/theme/Kbd.css +104 -0
- package/dist/theme/Link.css +22 -3
- package/dist/theme/Loading.css +50 -12
- package/dist/theme/Message.css +250 -41
- package/dist/theme/Notification.css +232 -42
- package/dist/theme/Popconfirm.css +23 -7
- package/dist/theme/Progress.css +278 -0
- package/dist/theme/Radio.css +492 -0
- package/dist/theme/Resizable.css +95 -0
- package/dist/theme/Select.css +198 -88
- package/dist/theme/Skeleton.css +192 -0
- package/dist/theme/Switch.css +22 -3
- package/dist/theme/Table.css +680 -0
- package/dist/theme/Tooltip.css +150 -26
- package/dist/theme/Validator.css +25 -0
- package/dist/types/components/Avatar/types.d.ts +0 -2
- package/dist/types/components/ChatBubble/constants.d.ts +2 -0
- package/dist/types/components/ChatBubble/index.d.ts +27 -0
- package/dist/types/components/ChatBubble/types.d.ts +10 -0
- package/dist/types/components/Checkbox/constants.d.ts +5 -0
- package/dist/types/components/Checkbox/index.d.ts +94 -0
- package/dist/types/components/Checkbox/types.d.ts +46 -0
- package/dist/types/components/Collapse/index.d.ts +5 -5
- package/dist/types/components/Diff/constants.d.ts +4 -0
- package/dist/types/components/Diff/index.d.ts +67 -0
- package/dist/types/components/Diff/types.d.ts +29 -0
- package/dist/types/components/Divider/index.d.ts +30 -0
- package/dist/types/components/Divider/types.d.ts +10 -0
- package/dist/types/components/Drawer/constants.d.ts +1 -0
- package/dist/types/components/Drawer/index.d.ts +72 -0
- package/dist/types/components/Drawer/types.d.ts +20 -0
- package/dist/types/components/Dropdown/index.d.ts +13 -3
- package/dist/types/components/Dropdown/types.d.ts +3 -0
- package/dist/types/components/Dropdown/useDropdownKeyboard.d.ts +8 -0
- package/dist/types/components/FileInput/index.d.ts +5 -5
- package/dist/types/components/Filter/constants.d.ts +5 -0
- package/dist/types/components/Filter/index.d.ts +59 -0
- package/dist/types/components/Filter/types.d.ts +38 -0
- package/dist/types/components/Indicator/constants.d.ts +2 -0
- package/dist/types/components/Indicator/index.d.ts +28 -0
- package/dist/types/components/Indicator/types.d.ts +10 -0
- package/dist/types/components/Input/index.d.ts +10 -10
- package/dist/types/components/Kbd/constants.d.ts +3 -0
- package/dist/types/components/Kbd/index.d.ts +24 -0
- package/dist/types/components/Kbd/types.d.ts +10 -0
- package/dist/types/components/Message/methods.d.ts +2 -0
- package/dist/types/components/Message/types.d.ts +7 -1
- package/dist/types/components/MessageBox/types.d.ts +14 -2
- package/dist/types/components/Notification/methods.d.ts +3 -0
- package/dist/types/components/Notification/types.d.ts +8 -2
- package/dist/types/components/Pixelate/constants.d.ts +2 -0
- package/dist/types/components/Pixelate/index.d.ts +71 -0
- package/dist/types/components/Pixelate/types.d.ts +23 -0
- package/dist/types/components/Popconfirm/index.d.ts +18 -9
- package/dist/types/components/Popconfirm/types.d.ts +2 -1
- package/dist/types/components/Progress/constants.d.ts +2 -0
- package/dist/types/components/Progress/index.d.ts +50 -0
- package/dist/types/components/Progress/types.d.ts +22 -0
- package/dist/types/components/Radio/constants.d.ts +5 -0
- package/dist/types/components/Radio/index.d.ts +88 -0
- package/dist/types/components/Radio/types.d.ts +43 -0
- package/dist/types/components/Resizable/constants.d.ts +3 -0
- package/dist/types/components/Resizable/index.d.ts +135 -0
- package/dist/types/components/Resizable/types.d.ts +52 -0
- package/dist/types/components/Select/index.d.ts +32 -23
- package/dist/types/components/Skeleton/index.d.ts +36 -0
- package/dist/types/components/Skeleton/types.d.ts +12 -0
- package/dist/types/components/Switch/index.d.ts +5 -5
- package/dist/types/components/Table/index.d.ts +27 -0
- package/dist/types/components/Table/types.d.ts +20 -0
- package/dist/types/components/Tooltip/index.d.ts +9 -3
- package/dist/types/components/Tooltip/types.d.ts +7 -0
- package/dist/types/components/Validator/index.d.ts +52 -0
- package/dist/types/components/Validator/types.d.ts +13 -0
- package/dist/types/components/index.d.ts +15 -0
- package/dist/types/hooks/index.d.ts +3 -1
- package/dist/types/hooks/useDraggable.d.ts +7 -0
- package/dist/types/hooks/useFocusTrap.d.ts +5 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/instance-management.d.ts +40 -0
- package/dist/types/utils/pixelate.d.ts +10 -0
- package/dist/types/utils/style.d.ts +1 -0
- package/dist/umd/index.css +1 -1
- package/dist/umd/index.css.gz +0 -0
- package/dist/umd/index.umd.cjs +4 -4
- package/dist/umd/index.umd.cjs.gz +0 -0
- package/package.json +59 -59
- package/dist/es/Avatar-CxsRW-wl.js +0 -9
- package/dist/es/Dropdown-GcomGMAI.js +0 -40
- package/dist/es/Form-j90EzLXU.js +0 -122
- package/dist/es/Message-DCNnTUje.js +0 -123
- package/dist/es/Notification-CBzY5904.js +0 -58
- package/dist/es/Popconfirm-DF6d2ORS.js +0 -23
- package/dist/es/Tooltip-k6gKnMyt.js +0 -74
- package/dist/es/hooks-BaG7l8K5.js +0 -116
- package/dist/es/utils-bsCscZfS.js +0 -84
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { c as e, r as l, w as a } from "./utils-BXICIEsD.js";
|
|
2
|
+
import { defineComponent as i, useSlots as t, inject as u, computed as o, createElementBlock as s, openBlock as r, normalizeStyle as d, normalizeClass as n, createElementVNode as v, createCommentVNode as c, unref as m, renderSlot as p, createTextVNode as f, toDisplayString as b, provide as y, createVNode as h, Fragment as k, renderList as x, createBlock as V } from "vue";
|
|
3
|
+
import { P as g } from "./Icon-D6qRB3pq.js";
|
|
4
|
+
import { u as _ } from "./hooks-pU4JmsO3.js";
|
|
5
|
+
const A = Symbol("filterContext"), z = { "active-color": "color", "active-border-color": "dark" }, F = ["type", "aria-checked", "id", "name", "disabled", "checked"], P = { key: 0, class: "px-filter-item__label" }, $ = i({ name: "PxFilterItem", inheritAttrs: false, __name: "FilterItem", props: { value: {}, label: {}, disabled: { type: Boolean } }, setup(a2) {
|
|
6
|
+
const i2 = a2, y2 = t(), h2 = u(A, void 0), k2 = !!h2, x2 = _().value, V2 = o((() => (h2 == null ? void 0 : h2.multiple.value) ?? false)), g2 = o((() => {
|
|
7
|
+
if (!k2) return false;
|
|
8
|
+
const e2 = h2.modelValue.value;
|
|
9
|
+
return V2.value ? Array.isArray(e2) && e2.includes(i2.value) : e2 === i2.value;
|
|
10
|
+
})), $2 = o((() => !!k2 && !V2.value && h2.hasSelection.value && !g2.value)), j2 = o((() => !!(h2 == null ? void 0 : h2.disabled.value) || (i2.disabled ?? false))), B2 = o((() => h2 == null ? void 0 : h2.size.value)), C2 = o((() => h2 == null ? void 0 : h2.type.value)), E = o((() => h2 == null ? void 0 : h2.color.value)), I = o((() => h2 == null ? void 0 : h2.name.value)), S = o((() => {
|
|
11
|
+
const a3 = E.value;
|
|
12
|
+
if (!a3) return {};
|
|
13
|
+
const i3 = e(a3);
|
|
14
|
+
return l(i3, "px-filter-item", z);
|
|
15
|
+
}));
|
|
16
|
+
function w() {
|
|
17
|
+
!j2.value && k2 && (V2.value ? h2.changeEvent(i2.value) : h2.changeEvent(g2.value ? void 0 : i2.value));
|
|
18
|
+
}
|
|
19
|
+
return (e2, l2) => (r(), s("div", { class: n(["px-filter-item", { [`px-filter-item--${B2.value}`]: B2.value, [`px-filter-item--${C2.value}`]: C2.value, "is-active": g2.value, "is-disabled": j2.value, "is-hidden": $2.value }]), style: d(S.value), onClick: w }, [v("input", { class: "px-filter-item__original", type: V2.value ? "checkbox" : "radio", "aria-checked": g2.value, id: m(x2), name: I.value, disabled: j2.value, checked: g2.value }, null, 8, F), e2.label || m(y2).default ? (r(), s("span", P, [p(e2.$slots, "default", {}, (() => [f(b(e2.label), 1)]))])) : c("", true)], 6));
|
|
20
|
+
} }), j = ["role"], B = a(i({ name: "PxFilter", __name: "Filter", props: { modelValue: {}, options: {}, name: {}, disabled: { type: Boolean, default: false }, size: {}, type: {}, color: {}, multiple: { type: Boolean, default: false } }, emits: ["update:modelValue", "change"], setup(e2, { emit: l2 }) {
|
|
21
|
+
const a2 = e2, i2 = l2, t2 = o((() => a2.multiple ? Array.isArray(a2.modelValue) && a2.modelValue.length > 0 : void 0 !== a2.modelValue)), u2 = (e3) => {
|
|
22
|
+
if (a2.multiple) {
|
|
23
|
+
const l3 = Array.isArray(a2.modelValue) ? [...a2.modelValue] : [];
|
|
24
|
+
if (void 0 === e3) return i2("update:modelValue", []), void i2("change", []);
|
|
25
|
+
const t3 = l3.indexOf(e3);
|
|
26
|
+
t3 >= 0 ? l3.splice(t3, 1) : l3.push(e3), i2("update:modelValue", l3), i2("change", l3);
|
|
27
|
+
} else i2("update:modelValue", e3), i2("change", e3);
|
|
28
|
+
};
|
|
29
|
+
function d2() {
|
|
30
|
+
u2(void 0);
|
|
31
|
+
}
|
|
32
|
+
return y(A, { modelValue: o((() => a2.modelValue)), disabled: o((() => a2.disabled)), size: o((() => a2.size)), type: o((() => a2.type)), color: o((() => a2.color)), name: o((() => a2.name)), multiple: o((() => a2.multiple)), hasSelection: t2, changeEvent: u2 }), (e3, l3) => {
|
|
33
|
+
var _a;
|
|
34
|
+
return r(), s("div", { class: n(["px-filter", { "is-collapsed": !e3.multiple && t2.value }]), role: e3.multiple ? "group" : "radiogroup" }, [t2.value ? (r(), s("div", { key: 0, class: "px-filter__reset", onClick: d2 }, [h(g, { icon: "close" })])) : c("", true), ((_a = e3.options) == null ? void 0 : _a.length) ? (r(true), s(k, { key: 1 }, x(e3.options, ((e4) => (r(), V($, { key: e4.value, value: e4.value, label: e4.label, disabled: e4.disabled }, null, 8, ["value", "label", "disabled"])))), 128)) : p(e3.$slots, "default", { key: 2 })], 10, j);
|
|
35
|
+
};
|
|
36
|
+
} })), C = a($);
|
|
37
|
+
export {
|
|
38
|
+
B as P,
|
|
39
|
+
C as a
|
|
40
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { inject as e, defineComponent as s, reactive as r, toRefs as t, provide as a, createElementBlock as l, openBlock as o, normalizeClass as i, renderSlot as u, useCssVars as n, computed as d, useSlots as c, ref as p, onMounted as m, onUnmounted as v, normalizeStyle as f, unref as h, createBlock as b, createCommentVNode as g, createElementVNode as y, resolveDynamicComponent as x, withCtx as _, createTextVNode as q, toDisplayString as P, nextTick as k } from "vue";
|
|
2
|
+
import { d as F, _ as I, w } from "./utils-BXICIEsD.js";
|
|
3
|
+
import { f as j, b as $, s as B, c as A, d as S, i as W, e as M, g as V, h as z, j as C, k as O, l as T, p as D } from "./vendor-DrBJKLFW.js";
|
|
4
|
+
import { u as E } from "./hooks-pU4JmsO3.js";
|
|
5
|
+
import { z as R } from "zod";
|
|
6
|
+
import { P as G } from "./Icon-D6qRB3pq.js";
|
|
7
|
+
const H = Symbol("formContext"), J = Symbol("formItemContext");
|
|
8
|
+
function K() {
|
|
9
|
+
return { form: e(H, void 0), formItem: e(J, void 0) };
|
|
10
|
+
}
|
|
11
|
+
const L = s({ name: "PxForm", __name: "Form", props: { model: {}, rules: {}, disabled: { type: Boolean }, inline: { type: Boolean }, statusIcon: { type: Boolean }, labelWidth: {}, labelPosition: { default: "right" }, labelSuffix: {}, showMessage: { type: Boolean, default: true }, hideRequiredAsterisk: { type: Boolean, default: false }, requiredAsteriskPosition: { default: "left" } }, emits: ["validate"], setup(e2, { expose: s2, emit: n2 }) {
|
|
12
|
+
const d2 = n2, c2 = [], p2 = async (e3, s3) => {
|
|
13
|
+
try {
|
|
14
|
+
const r2 = await (async function(e4 = []) {
|
|
15
|
+
let s4 = {};
|
|
16
|
+
for (const r3 of e4) try {
|
|
17
|
+
await r3.validate("");
|
|
18
|
+
} catch (e5) {
|
|
19
|
+
s4 = { ...s4, ...e5 };
|
|
20
|
+
}
|
|
21
|
+
return !B(Object.keys(s4)) || Promise.reject(s4);
|
|
22
|
+
})(m2(c2, e3 ?? []));
|
|
23
|
+
return true === r2 && (s3 == null ? void 0 : s3(r2)), r2;
|
|
24
|
+
} catch (e4) {
|
|
25
|
+
if (e4 instanceof Error) throw e4;
|
|
26
|
+
const r2 = e4;
|
|
27
|
+
return s3 == null ? void 0 : s3(false, r2), Promise.reject(r2);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
function m2(e3, s3) {
|
|
31
|
+
return B(s3) ? $(e3, ((e4) => A(s3, e4.prop))) : e3;
|
|
32
|
+
}
|
|
33
|
+
const v2 = r({ ...t(e2), emits: d2, addField: (e3) => {
|
|
34
|
+
e3.prop && c2.push(e3);
|
|
35
|
+
}, removeField: (e3) => {
|
|
36
|
+
e3.prop && c2.splice(c2.indexOf(e3), 1);
|
|
37
|
+
} });
|
|
38
|
+
return a(H, v2), s2({ validate: async (e3) => p2([], e3), validateField: p2, resetFields: (e3) => {
|
|
39
|
+
j(m2(c2, e3 ?? []), ((e4) => e4.resetField()));
|
|
40
|
+
}, clearValidate: (e3) => {
|
|
41
|
+
j(m2(c2, e3 ?? []), ((e4) => e4.clearValidate()));
|
|
42
|
+
} }), (e3, s3) => (o(), l("form", { class: i(["px-form", { "is-inline": e3.inline }]) }, [u(e3.$slots, "default")], 2));
|
|
43
|
+
} }), N = ["aria-describedby"], Q = { class: "px-form-item__input-wrap" }, U = ["id"], X = I(s({ name: "PxFormItem", __name: "FormItem", props: { prop: {}, label: {}, for: {}, labelWidth: {}, disabled: { type: Boolean }, required: { type: Boolean, default: void 0 }, showMessage: { type: Boolean, default: true }, error: {}, rules: {} }, setup(s2, { expose: I2 }) {
|
|
44
|
+
n(((e2) => ({ ac9c6e38: le.value })));
|
|
45
|
+
const w2 = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]), j2 = s2, K2 = c(), L2 = e(H), X2 = E().value, Y2 = p("init"), Z2 = p(""), ee = p([]), se = (e2) => {
|
|
46
|
+
return e2 && j2.prop && !W(V(e2, j2.prop)) ? (s3 = j2.prop, (T(s3) ? s3 : s3.split(".")).some(((e3) => w2.has(e3))) ? (F("PxFormItem", `Prop path "${j2.prop}" contains a dangerous segment and was rejected.`), null) : V(e2, j2.prop)) : null;
|
|
47
|
+
var s3;
|
|
48
|
+
}, re = d((() => !(!j2.label && !K2.label))), te = d((() => j2.for || (ee.value.length ? ee.value[0] : ""))), ae = d((() => `${j2.label ?? ""}${(L2 == null ? void 0 : L2.labelSuffix) ?? ""}`)), le = d((() => {
|
|
49
|
+
const e2 = (e3) => z(e3) ? `${e3}px` : C(e3, "px") ? e3 : `${e3}px`;
|
|
50
|
+
return j2.labelWidth ? e2(j2.labelWidth) : (L2 == null ? void 0 : L2.labelWidth) ? e2(L2 == null ? void 0 : L2.labelWidth) : "150px";
|
|
51
|
+
})), oe = d((() => (L2 == null ? void 0 : L2.labelPosition) ?? "right")), ie = d((() => "top" === oe.value)), ue = d((() => ie.value ? { width: "100%", textAlign: "left", padding: "0 0 8px 0" } : { textAlign: "left" === oe.value ? "left" : "right" })), ne = d((() => (L2 == null ? void 0 : L2.disabled) || j2.disabled)), de = d((() => {
|
|
52
|
+
const e2 = L2 == null ? void 0 : L2.model;
|
|
53
|
+
return se(e2);
|
|
54
|
+
})), ce = d((() => j2.prop ? S(j2.prop) ? j2.prop : j2.prop.join(".") : "")), pe = d((() => {
|
|
55
|
+
const { required: e2 } = j2, s3 = [];
|
|
56
|
+
j2.rules && s3.push(...j2.rules);
|
|
57
|
+
const r2 = L2 == null ? void 0 : L2.rules;
|
|
58
|
+
if (r2 && j2.prop) {
|
|
59
|
+
const e3 = se(r2);
|
|
60
|
+
e3 && s3.push(...e3);
|
|
61
|
+
}
|
|
62
|
+
if (!W(e2)) {
|
|
63
|
+
const r3 = $(M(s3, ((e3, s4) => [e3, s4])), ((e3) => A(D(e3[0]), "required")));
|
|
64
|
+
if (B(r3)) for (const t2 of r3) {
|
|
65
|
+
const [r4, a2] = t2;
|
|
66
|
+
r4.required !== e2 && (s3[a2] = { ...r4, required: e2 });
|
|
67
|
+
}
|
|
68
|
+
else s3.push({ required: e2 });
|
|
69
|
+
}
|
|
70
|
+
return s3;
|
|
71
|
+
})), me = d((() => W(j2.required) ? B($(pe.value, ((e2) => e2.required))) > 0 : j2.required));
|
|
72
|
+
let ve = null, fe = false;
|
|
73
|
+
const he = async (e2, s3) => {
|
|
74
|
+
if (fe || !j2.prop || ne.value) return false;
|
|
75
|
+
if (!Y2.value) return s3 == null ? void 0 : s3(false), false;
|
|
76
|
+
const r2 = (function(e3) {
|
|
77
|
+
const s4 = pe.value;
|
|
78
|
+
return s4 ? $(s4, ((s5) => !(s5 == null ? void 0 : s5.trigger) || !e3 || (T(s5.trigger) ? s5.trigger.includes(e3) : s5.trigger === e3))) : [];
|
|
79
|
+
})(e2);
|
|
80
|
+
return B(r2) ? (Y2.value = "validating", (async function(e3) {
|
|
81
|
+
var _a;
|
|
82
|
+
const s4 = de.value;
|
|
83
|
+
for (const r3 of e3) {
|
|
84
|
+
let e4 = r3.schema ?? null;
|
|
85
|
+
if (!e4 && r3.required && (e4 = R.string({ message: r3.message ?? "This field is required" }).min(1, r3.message ?? "This field is required")), !e4) continue;
|
|
86
|
+
const t2 = e4.safeParse(s4);
|
|
87
|
+
if (!t2.success) {
|
|
88
|
+
const e5 = r3.message ?? ((_a = t2.error.issues[0]) == null ? void 0 : _a.message) ?? "Validation failed";
|
|
89
|
+
Y2.value = "error", Z2.value = e5;
|
|
90
|
+
const s5 = { errors: [{ field: ce.value, message: e5 }], fields: { [ce.value]: [{ message: e5 }] } };
|
|
91
|
+
return L2 == null ? void 0 : L2.emits("validate", j2, false, e5), Promise.reject(s5);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return Y2.value = "success", L2 == null ? void 0 : L2.emits("validate", j2, true, ""), true;
|
|
95
|
+
})(r2).then((() => (s3 == null ? void 0 : s3(true), true))).catch(((e3) => {
|
|
96
|
+
const { fields: r3 } = e3;
|
|
97
|
+
return s3 == null ? void 0 : s3(false, r3), Promise.reject(r3);
|
|
98
|
+
}))) : (s3 == null ? void 0 : s3(true), true);
|
|
99
|
+
}, be = () => {
|
|
100
|
+
const e2 = L2 == null ? void 0 : L2.model;
|
|
101
|
+
e2 && ce.value && !W(V(e2, ce.value)) && (fe = true, e2[ce.value] = O(ve)), k((() => ge()));
|
|
102
|
+
}, ge = () => {
|
|
103
|
+
Y2.value = "init", Z2.value = "", fe = false;
|
|
104
|
+
}, ye = r({ ...t(j2), disabled: ne.value, validate: he, resetField: be, clearValidate: ge, addInputId: (e2) => {
|
|
105
|
+
A(ee.value, e2) || ee.value.push(e2);
|
|
106
|
+
}, removeInputId: (e2) => {
|
|
107
|
+
ee.value = $(ee.value, ((s3) => s3 !== e2));
|
|
108
|
+
} });
|
|
109
|
+
return m((() => {
|
|
110
|
+
j2.prop && (L2 == null ? void 0 : L2.addField(ye), ve = de.value);
|
|
111
|
+
})), v((() => {
|
|
112
|
+
j2.prop && (L2 == null ? void 0 : L2.removeField(ye));
|
|
113
|
+
})), a(J, ye), I2({ validateMessage: Z2, validateStatus: Y2, validate: he, resetField: be, clearValidate: ge }), (e2, s3) => {
|
|
114
|
+
var _a, _b, _c, _d, _e;
|
|
115
|
+
return o(), l("div", { class: i(["px-form-item", { "is-error": "error" === Y2.value, "is-success": "success" === Y2.value, "is-disabled": ne.value, "is-required": me.value, "asterisk-left": "left" === ((_a = h(L2)) == null ? void 0 : _a.requiredAsteriskPosition), "asterisk-right": "right" === ((_b = h(L2)) == null ? void 0 : _b.requiredAsteriskPosition) }]), style: f(ie.value ? { flexDirection: "column" } : {}) }, [re.value ? (o(), b(x(te.value ? "label" : "div"), { key: 0, class: "px-form-item__label", style: f(ue.value), id: h(X2), for: te.value }, { default: _((() => [u(e2.$slots, "label", { label: ae.value }, (() => [q(P(ae.value), 1)]), true)])), _: 3 }, 8, ["style", "id", "for"])) : g("", true), y("div", { class: "px-form-item__content", style: f(ie.value ? { width: "100%" } : {}), "aria-describedby": "error" === Y2.value ? `form-item-error-${h(X2)}` : void 0 }, [y("div", Q, [u(e2.$slots, "default", { validate: he }, void 0, true), ((_c = h(L2)) == null ? void 0 : _c.statusIcon) && "success" === Y2.value ? (o(), b(G, { key: 0, icon: "check", class: "px-form-item__status-icon is-success", size: "sm" })) : g("", true), ((_d = h(L2)) == null ? void 0 : _d.statusIcon) && "error" === Y2.value ? (o(), b(G, { key: 1, icon: "close", class: "px-form-item__status-icon is-error", size: "sm" })) : g("", true)]), "error" === Y2.value ? (o(), l("div", { key: 0, class: "px-form-item__error-msg", id: `form-item-error-${h(X2)}` }, [((_e = h(L2)) == null ? void 0 : _e.showMessage) && e2.showMessage ? u(e2.$slots, "error", { key: 0, error: Z2.value }, (() => [q(P(Z2.value), 1)]), true) : g("", true)], 8, U)) : g("", true)], 12, N)], 6);
|
|
116
|
+
};
|
|
117
|
+
} }), [["__scopeId", "data-v-0e2bbb22"]]), Y = w(L), Z = w(X);
|
|
118
|
+
export {
|
|
119
|
+
J as F,
|
|
120
|
+
Y as P,
|
|
121
|
+
Z as a,
|
|
122
|
+
K as u
|
|
123
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as v, g as h, s as l, _ as o, w, f as r } from "./utils-BXICIEsD.js";
|
|
2
2
|
import { defineComponent as t, computed as H, createElementBlock as m, openBlock as s, mergeProps as z } from "vue";
|
|
3
3
|
const n = { xs: 12, sm: 18, md: 24, lg: 36, xl: 48, "2xl": 72, "1x": 24, "2x": 48, "3x": 72 }, V = ["innerHTML"], g = { key: 1, class: "px-icon__fallback" }, e = o(t({ name: "PxIcon", inheritAttrs: false, __name: "Icon", props: { icon: {}, size: { default: "md" }, rotation: {}, flip: {}, spin: { type: Boolean }, pulse: { type: Boolean }, bounce: { type: Boolean }, shake: { type: Boolean }, beat: { type: Boolean }, fade: { type: Boolean }, type: {}, color: {} }, setup(o2) {
|
|
4
4
|
const w2 = o2, r2 = H((() => v(w2.icon))), t2 = H((() => {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { r as o, c as i, _ as e, w as t } from "./utils-BXICIEsD.js";
|
|
2
|
+
import { defineComponent as a, useSlots as s, computed as n, createElementBlock as r, openBlock as p, normalizeClass as c, renderSlot as l, createCommentVNode as d, createElementVNode as f, normalizeStyle as _ } from "vue";
|
|
3
|
+
const x = { "bg-color": "color", "border-color": "dark", "shadow-color": "dark" }, u = t(e(a({ name: "PxIndicator", __name: "Indicator", props: { placement: { default: "top-end" }, type: { default: "primary" }, color: {}, offset: {}, inline: { type: Boolean }, processing: { type: Boolean } }, setup(e2) {
|
|
4
|
+
const t2 = e2, a2 = s(), u2 = n((() => !a2.indicator)), m = n((() => t2.color ? o(i(t2.color), "px-indicator", x) : {})), v = n((() => t2.offset ? { "--px-indicator-offset-x": `${t2.offset[0]}px`, "--px-indicator-offset-y": `${t2.offset[1]}px` } : {}));
|
|
5
|
+
return (o2, i2) => (p(), r("div", { class: c(["px-indicator", { "is-inline": o2.inline }]) }, [l(o2.$slots, "default", {}, void 0, true), o2.processing && u2.value ? (p(), r("span", { key: 0, class: c(["px-indicator__ping", [`px-indicator__ping--${o2.placement}`, `px-indicator__ping--${o2.type}`]]), style: _([m.value, v.value]) }, null, 6)) : d("", true), f("div", { class: c(["px-indicator__item", [`px-indicator__item--${o2.placement}`, `px-indicator__item--${o2.type}`, { "is-dot": u2.value, "is-processing": o2.processing }]]), style: _([m.value, v.value]) }, [l(o2.$slots, "indicator", {}, void 0, true)], 6)], 2));
|
|
6
|
+
} }), [["__scopeId", "data-v-84fa8f8b"]]));
|
|
7
|
+
export {
|
|
8
|
+
u as P
|
|
9
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as e, r as o, d as a, w as l } from "./utils-
|
|
2
|
-
import { defineComponent as s, ref as r, shallowRef as u, useAttrs as t, computed as p, watch as n, createElementBlock as d, openBlock as c, normalizeStyle as i, normalizeClass as f, unref as v, withDirectives as m, Fragment as y, createCommentVNode as h, createElementVNode as x, renderSlot as _, mergeProps as w, vModelDynamic as k, createBlock as b, withModifiers as
|
|
3
|
-
import {
|
|
4
|
-
import { u as P } from "./Form-
|
|
5
|
-
import { P as j } from "./Icon-
|
|
6
|
-
import { q as C, f as F } from "./vendor-
|
|
1
|
+
import { c as e, r as o, d as a, w as l } from "./utils-BXICIEsD.js";
|
|
2
|
+
import { defineComponent as s, ref as r, shallowRef as u, useAttrs as t, computed as p, watch as n, createElementBlock as d, openBlock as c, normalizeStyle as i, normalizeClass as f, unref as v, withDirectives as m, Fragment as y, createCommentVNode as h, createElementVNode as x, renderSlot as _, mergeProps as w, vModelDynamic as k, createBlock as b, withModifiers as $, vModelText as g, nextTick as B } from "vue";
|
|
3
|
+
import { e as V, u as I } from "./hooks-pU4JmsO3.js";
|
|
4
|
+
import { u as P } from "./Form-B_XDnSjK.js";
|
|
5
|
+
import { P as j } from "./Icon-D6qRB3pq.js";
|
|
6
|
+
import { q as C, f as F } from "./vendor-DrBJKLFW.js";
|
|
7
7
|
const R = /* @__PURE__ */ new Set(["primary", "success", "warning", "danger", "info"]), z = { default: { "border-color": "color", "hover-border-color": "dark", "focus-border-color": "dark", "shadow-color": "dark", "focus-shadow-color": "dark" }, ghost: { "border-color": "transparent", "hover-border-color": "color", "focus-border-color": "dark", "shadow-color": "transparent", "focus-shadow-color": "dark" } }, M = { key: 0, class: "px-input__prepend" }, U = { key: 0, class: "px-input__prefix" }, q = ["id", "type", "disabled", "readonly", "autocomplete", "placeholder", "autofocus", "form"], A = { key: 1, class: "px-input__suffix" }, S = { key: 1, class: "px-input__append" }, D = ["id", "disabled", "readonly", "autocomplete", "placeholder", "autofocus", "form"], E = s({ name: "PxInput", inheritAttrs: false, __name: "Input", props: { id: {}, modelValue: {}, type: { default: "text" }, size: {}, color: {}, ghost: { type: Boolean }, disabled: { type: Boolean }, clearable: { type: Boolean }, showPassword: { type: Boolean }, placeholder: {}, readonly: { type: Boolean }, autocomplete: { default: "off" }, autofocus: { type: Boolean }, form: {} }, emits: ["update:modelValue", "input", "change", "focus", "blur", "clear"], setup(l2, { expose: s2, emit: E2 }) {
|
|
8
8
|
const G2 = l2, H = E2, J = r(G2.modelValue), K = r(false), L = u(), N = u(), O = t(), { formItem: Q } = P(), T = p((() => L.value || N.value)), W = p((() => G2.disabled)), X = p((() => R.has(G2.color ?? ""))), Y = p((() => !!G2.color && !X.value)), Z = p((() => {
|
|
9
9
|
if (!Y.value) return {};
|
|
@@ -34,7 +34,7 @@ const R = /* @__PURE__ */ new Set(["primary", "success", "warning", "danger", "i
|
|
|
34
34
|
}, select: () => {
|
|
35
35
|
var _a;
|
|
36
36
|
(_a = T.value) == null ? void 0 : _a.select();
|
|
37
|
-
}, clear: ue }), (e2, o2) => (c(), d("div", { class: f(["px-input", { [`px-input--${e2.type}`]: e2.type, [`px-input--${e2.size}`]: e2.size, [`px-input--${e2.color}`]: X.value, "is-ghost": e2.ghost, "is-disabled": W.value, "is-prepend": e2.$slots.prepend, "is-append": e2.$slots.append, "is-prefix": e2.$slots.prefix, "is-suffix": e2.$slots.suffix, "is-focus": v(le) }]), style: i(Z.value) }, ["textarea" !== e2.type ? (c(), d(y, { key: 0 }, [e2.$slots.prepend ? (c(), d("div", M, [_(e2.$slots, "prepend")])) : h("", true), x("div", { class: "px-input__wrapper", ref_key: "wrapperRef", ref: ae }, [e2.$slots.prefix ? (c(), d("span", U, [_(e2.$slots, "prefix")])) : h("", true), m(x("input", w({ class: "px-input__inner", ref_key: "inputRef", ref: L, id: v(I)().value, type: e2.showPassword ? K.value ? "text" : "password" : e2.type, disabled: W.value, readonly: e2.readonly, autocomplete: e2.autocomplete, placeholder: e2.placeholder, autofocus: e2.autofocus, form: e2.form, "onUpdate:modelValue": o2[0] || (o2[0] = (e3) => J.value = e3) }, v(O), { onInput: te, onChange: pe, onFocus: o2[1] || (o2[1] = (...e3) => v(se) && v(se)(...e3)), onBlur: o2[2] || (o2[2] = (...e3) => v(re) && v(re)(...e3)) }), null, 16, q), [[k, J.value]]), e2.$slots.suffix || ee.value || oe.value ? (c(), d("span", A, [_(e2.$slots, "suffix"), ee.value ? (c(), b(j, { key: 0, icon: "close-box", class: "px-input__clear", onClick: ue, onMousedown:
|
|
37
|
+
}, clear: ue }), (e2, o2) => (c(), d("div", { class: f(["px-input", { [`px-input--${e2.type}`]: e2.type, [`px-input--${e2.size}`]: e2.size, [`px-input--${e2.color}`]: X.value, "is-ghost": e2.ghost, "is-disabled": W.value, "is-prepend": e2.$slots.prepend, "is-append": e2.$slots.append, "is-prefix": e2.$slots.prefix, "is-suffix": e2.$slots.suffix, "is-focus": v(le) }]), style: i(Z.value) }, ["textarea" !== e2.type ? (c(), d(y, { key: 0 }, [e2.$slots.prepend ? (c(), d("div", M, [_(e2.$slots, "prepend")])) : h("", true), x("div", { class: "px-input__wrapper", ref_key: "wrapperRef", ref: ae }, [e2.$slots.prefix ? (c(), d("span", U, [_(e2.$slots, "prefix")])) : h("", true), m(x("input", w({ class: "px-input__inner", ref_key: "inputRef", ref: L, id: v(I)().value, type: e2.showPassword ? K.value ? "text" : "password" : e2.type, disabled: W.value, readonly: e2.readonly, autocomplete: e2.autocomplete, placeholder: e2.placeholder, autofocus: e2.autofocus, form: e2.form, "onUpdate:modelValue": o2[0] || (o2[0] = (e3) => J.value = e3) }, v(O), { onInput: te, onChange: pe, onFocus: o2[1] || (o2[1] = (...e3) => v(se) && v(se)(...e3)), onBlur: o2[2] || (o2[2] = (...e3) => v(re) && v(re)(...e3)) }), null, 16, q), [[k, J.value]]), e2.$slots.suffix || ee.value || oe.value ? (c(), d("span", A, [_(e2.$slots, "suffix"), ee.value ? (c(), b(j, { key: 0, icon: "close-box", class: "px-input__clear", onClick: ue, onMousedown: $(v(C), ["prevent"]) }, null, 8, ["onMousedown"])) : h("", true), oe.value && K.value ? (c(), b(j, { key: 1, icon: "eye", class: "px-input__password", onClick: ne })) : h("", true), oe.value && !K.value ? (c(), b(j, { key: 2, icon: "eye-closed", class: "px-input__password", onClick: ne })) : h("", true)])) : h("", true)], 512), e2.$slots.append ? (c(), d("div", S, [_(e2.$slots, "append")])) : h("", true)], 64)) : m((c(), d("textarea", w({ key: 1, class: "px-textarea__wrapper", ref_key: "textareaRef", ref: N, id: v(I)().value, disabled: W.value, readonly: e2.readonly, autocomplete: e2.autocomplete, placeholder: e2.placeholder, autofocus: e2.autofocus, form: e2.form, "onUpdate:modelValue": o2[3] || (o2[3] = (e3) => J.value = e3) }, v(O), { onInput: te, onChange: pe, onFocus: o2[4] || (o2[4] = (...e3) => v(se) && v(se)(...e3)), onBlur: o2[5] || (o2[5] = (...e3) => v(re) && v(re)(...e3)) }), null, 16, D)), [[g, J.value]])], 6));
|
|
38
38
|
} }), G = l(E);
|
|
39
39
|
export {
|
|
40
40
|
G as P,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { _ as l, w as e } from "./utils-BXICIEsD.js";
|
|
2
|
+
import { defineComponent as a, computed as s, createElementBlock as b, openBlock as t, normalizeClass as o, createCommentVNode as n, Fragment as d, renderList as p, createVNode as r, unref as c, createElementVNode as i, toDisplayString as k, renderSlot as u } from "vue";
|
|
3
|
+
import { P as f } from "./Icon-D6qRB3pq.js";
|
|
4
|
+
const _ = { command: { label: "⌘" }, shift: { label: "⇧" }, ctrl: { label: "Ctrl" }, alt: { label: "⌥" }, option: { label: "⌥" }, enter: { label: "↵" }, delete: { label: "⌫" }, escape: { label: "Esc" }, tab: { label: "Tab" }, capslock: { label: "Caps" }, up: { label: "▲", icon: "arrow-up" }, down: { label: "▼", icon: "arrow-down" }, left: { label: "◀", icon: "arrow-left" }, right: { label: "▶", icon: "arrow-right" }, space: { label: "Space" }, win: { label: "⊞" }, fn: { label: "Fn" }, home: { label: "Home" }, end: { label: "End" }, pageup: { label: "PgUp" }, pagedown: { label: "PgDn" } }, m = /* @__PURE__ */ new Set(["up", "down", "left", "right"]), w = { key: 0, class: "px-kbd__key" }, x = { key: 1, class: "px-kbd__key" }, y = ["title"], g = { key: 0, class: "px-kbd__key" }, h = e(l(a({ name: "PxKbd", __name: "Kbd", props: { size: { default: "default" }, keys: {} }, setup(l2) {
|
|
5
|
+
const e2 = l2, a2 = s((() => ({ [`px-kbd--${e2.size}`]: "default" !== e2.size })));
|
|
6
|
+
function h2(l3) {
|
|
7
|
+
return m.has(l3);
|
|
8
|
+
}
|
|
9
|
+
return (l3, e3) => (t(), b("span", { class: o(["px-kbd", a2.value]) }, [(t(true), b(d, null, p(l3.keys, ((l4) => (t(), b(d, { key: l4 }, [h2(l4) ? (t(), b("kbd", w, [r(f, { icon: c(_)[l4].icon, size: "xs" }, null, 8, ["icon"])])) : (t(), b("kbd", x, [i("abbr", { title: l4, class: "px-kbd__abbr" }, k(c(_)[l4].label), 9, y)]))], 64)))), 128)), l3.$slots.default ? (t(), b("kbd", g, [u(l3.$slots, "default", {}, void 0, true)])) : n("", true)], 2));
|
|
10
|
+
} }), [["__scopeId", "data-v-fa07bd0e"]]));
|
|
11
|
+
export {
|
|
12
|
+
h as P
|
|
13
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as e, c as o, _ as t, w as l } from "./utils-
|
|
1
|
+
import { r as e, c as o, _ as t, w as l } from "./utils-BXICIEsD.js";
|
|
2
2
|
import { defineComponent as r, computed as a, createElementBlock as i, openBlock as s, normalizeStyle as d, normalizeClass as n, renderSlot as c } from "vue";
|
|
3
3
|
const p = ["href", "target"], u = l(t(r({ name: "PxLink", __name: "Link", props: { type: {}, underline: { type: Boolean, default: true }, disabled: { type: Boolean }, href: {}, target: {}, color: {} }, emits: ["click"], setup(t2, { emit: l2 }) {
|
|
4
4
|
const r2 = t2, u2 = l2, k = { "text-color": "color", "hover-color": "dark" }, f = a((() => r2.color ? e(o(r2.color), "px-link", k) : {})), m = (e2) => {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { _ as e, w as n } from "./utils-
|
|
2
|
-
import { defineComponent as t, computed as o, createElementBlock as
|
|
3
|
-
import {
|
|
4
|
-
import { i as _, d as $, r as A, u as I } from "./vendor-
|
|
1
|
+
import { _ as e, w as n } from "./utils-BXICIEsD.js";
|
|
2
|
+
import { defineComponent as t, computed as o, createElementBlock as a, openBlock as i, normalizeStyle as l, normalizeClass as r, createElementVNode as s, useCssVars as d, createBlock as c, Transition as u, withCtx as p, withDirectives as b, createCommentVNode as m, toDisplayString as f, vShow as v, nextTick as g, ref as x, reactive as y, createApp as k } from "vue";
|
|
3
|
+
import { a as L } from "./hooks-pU4JmsO3.js";
|
|
4
|
+
import { i as _, d as $, r as A, u as I } from "./vendor-DrBJKLFW.js";
|
|
5
5
|
const h = e(t({ name: "PxLoadingIndicator", __name: "LoadingIndicator", props: { variant: { default: "spinner" }, size: { default: "md" }, type: { default: "primary" }, color: {} }, setup(e2) {
|
|
6
6
|
const n2 = e2, t2 = o((() => n2.color ? { "--px-loading-indicator-color": n2.color } : {}));
|
|
7
|
-
return (e3, n3) => (
|
|
7
|
+
return (e3, n3) => (i(), a("span", { class: r(["px-loading-indicator", [`px-loading-indicator--${e3.variant}`, `px-loading-indicator--${e3.size}`, `px-loading-indicator--${e3.type}`]]), style: l(t2.value), role: "status", "aria-label": "Loading" }, n3[0] || (n3[0] = [s("span", { class: "px-loading-indicator__inner" }, null, -1)]), 6));
|
|
8
8
|
} }), [["__scopeId", "data-v-1435ecee"]]), z = { class: "px-loading__spinner" }, C = { key: 1, class: "px-loading-text" }, P = t({ name: "PxLoading", inheritAttrs: false, __name: "Loading", props: { visible: {}, background: {}, spinner: {}, text: {}, fullscreen: {}, lock: {}, beforeClose: { type: Function }, closed: { type: Function }, target: {}, body: { type: Boolean }, zIndex: {}, onAfterLeave: { type: Function } }, setup(e2) {
|
|
9
9
|
d(((e3) => ({ d4003bba: e3.background, b5c47826: e3.zIndex })));
|
|
10
10
|
const n2 = e2;
|
|
11
|
-
return (e3, t2) => (
|
|
11
|
+
return (e3, t2) => (i(), c(u, { name: "fade-in-linear", onAfterLeave: e3.onAfterLeave }, { default: p((() => [b(s("div", { class: r(["px-loading px-loading__mask", { "is-fullscreen": e3.fullscreen }]), role: "status", "aria-live": "polite" }, [s("div", z, [false !== n2.spinner ? (i(), c(h, { key: 0, variant: "spinner", size: "lg" })) : m("", true), e3.text ? (i(), a("p", C, f(e3.text), 1)) : m("", true)])], 2), [[v, n2.visible.value]])])), _: 1 }, 8, ["onAfterLeave"]));
|
|
12
12
|
} }), j = "px-loading-parent--relative", F = "px-loading-parent--hiden", N = "px-loading-numb", w = /* @__PURE__ */ new Map(), { nextZIndex: S } = L(3e3);
|
|
13
13
|
function T(e2 = document.body) {
|
|
14
14
|
e2.classList.remove(F);
|
|
@@ -30,10 +30,10 @@ function B(e2 = {}) {
|
|
|
30
30
|
})(n2 == null ? void 0 : n2.parent), w.has(t2)) return w.get(t2);
|
|
31
31
|
const o2 = (function(e3) {
|
|
32
32
|
const n3 = x(e3.visible), t3 = x(false), o3 = () => {
|
|
33
|
-
t3.value &&
|
|
34
|
-
},
|
|
33
|
+
t3.value && i2();
|
|
34
|
+
}, a2 = y({ ...e3, onAfterLeave: o3 }), i2 = () => {
|
|
35
35
|
var _a2, _b;
|
|
36
|
-
const e4 =
|
|
36
|
+
const e4 = a2.parent;
|
|
37
37
|
!(function(e5 = document.body) {
|
|
38
38
|
const n4 = V(e5);
|
|
39
39
|
if (n4) {
|
|
@@ -49,13 +49,13 @@ function B(e2 = {}) {
|
|
|
49
49
|
}), 1), w.delete(e4 ?? document.body), (_b = (_a2 = s2.$el) == null ? void 0 : _a2.parentNode) == null ? void 0 : _b.removeChild(s2.$el), r2.unmount());
|
|
50
50
|
};
|
|
51
51
|
let l2;
|
|
52
|
-
const r2 = k(P, { ...
|
|
52
|
+
const r2 = k(P, { ...a2, zIndex: a2.fullscreen ? S() : void 0, visible: n3 }), s2 = r2.mount(document.createElement("div"));
|
|
53
53
|
return { get $el() {
|
|
54
54
|
return s2.$el;
|
|
55
55
|
}, vm: s2, close: () => {
|
|
56
56
|
var _a2;
|
|
57
57
|
e3.beforeClose && !e3.beforeClose() || (t3.value = true, clearTimeout(l2), l2 = A(o3), n3.value = false, (_a2 = e3.closed) == null ? void 0 : _a2.call(e3));
|
|
58
|
-
}, visible: n3, setText: (e4) =>
|
|
58
|
+
}, visible: n3, setText: (e4) => a2.text = e4 };
|
|
59
59
|
})({ ...n2, closed: () => {
|
|
60
60
|
var _a2;
|
|
61
61
|
(_a2 = n2.closed) == null ? void 0 : _a2.call(n2), n2.fullscreen && (q = null);
|
|
@@ -70,8 +70,8 @@ function B(e2 = {}) {
|
|
|
70
70
|
}
|
|
71
71
|
const E = Symbol("loading");
|
|
72
72
|
function M(e2, n2) {
|
|
73
|
-
const t2 = (n3) => e2.getAttribute(`px-loading-${n3}`), o2 = (e3) => n2.modifiers[e3],
|
|
74
|
-
e2[E] = { options:
|
|
73
|
+
const t2 = (n3) => e2.getAttribute(`px-loading-${n3}`), o2 = (e3) => n2.modifiers[e3], a2 = o2("fullscreen"), i2 = { text: t2("text"), spinner: t2("spinner"), background: t2("background"), target: a2 ? void 0 : e2, body: o2("body"), lock: o2("lock"), fullscreen: a2 };
|
|
74
|
+
e2[E] = { options: i2, instance: B(i2) };
|
|
75
75
|
}
|
|
76
76
|
const Z = { mounted(e2, n2) {
|
|
77
77
|
n2.value && M(e2, n2);
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { t as e, b as o, R as t, h as s, i as n, j as a } from "./utils-BXICIEsD.js";
|
|
2
|
+
import { defineComponent as l, ref as i, computed as r, watch as c, onMounted as u, onBeforeUnmount as p, createBlock as d, openBlock as f, Transition as m, withCtx as g, withDirectives as y, createElementVNode as v, normalizeStyle as x, normalizeClass as b, createVNode as h, createElementBlock as B, createCommentVNode as _, renderSlot as C, unref as w, withModifiers as k, vShow as I, shallowReactive as T, isVNode as P, h as $, render as O, reactive as M, nextTick as z, createTextVNode as A, toDisplayString as E, resolveDynamicComponent as j, withKeys as L, Fragment as V } from "vue";
|
|
3
|
+
import { f as D, a as N, u as R, g as S, h as H, i as K, b as Z } from "./hooks-pU4JmsO3.js";
|
|
4
|
+
import { P as U } from "./Icon-D6qRB3pq.js";
|
|
5
|
+
import { v as q, u as F, f as G, d as J, w as Q, g as W, x as X, i as Y, y as ee, z as oe, A as te, B as se } from "./vendor-DrBJKLFW.js";
|
|
6
|
+
import { b as ne } from "./Button-DbFviVWb.js";
|
|
7
|
+
import { _ as ae } from "./Input-bThwBbNZ.js";
|
|
8
|
+
import { P as le } from "./Overlay-6iPenJB1.js";
|
|
9
|
+
const ie = ["aria-live"], re = { class: "px-message__content" }, ce = { key: 0, class: "px-message__close" }, ue = l({ name: "PxMessage", __name: "Message", props: { id: {}, message: {}, duration: { default: 3e3 }, showClose: { type: Boolean }, center: { type: Boolean }, type: { default: "info" }, offset: { default: 10 }, zIndex: {}, transitionName: { default: "fade-up" }, plain: { type: Boolean }, ghost: { type: Boolean }, icon: {}, showTimer: { type: Boolean, default: true }, onDestroy: {} }, setup(s2, { expose: n2 }) {
|
|
10
|
+
const a2 = s2, l2 = i(false), T2 = i(), P2 = i(0), { topOffset: $2, bottomOffset: O2 } = D({ getLastBottomOffset: q(ve, a2), offset: a2.offset, boxHeight: P2 }), M2 = r((() => a2.icon ?? e.get(a2.type) ?? "circle-info")), z2 = r((() => ({ top: o($2.value), zIndex: a2.zIndex })));
|
|
11
|
+
let A2;
|
|
12
|
+
function E2() {
|
|
13
|
+
0 !== a2.duration && (A2 = F(L2, a2.duration));
|
|
14
|
+
}
|
|
15
|
+
function j2() {
|
|
16
|
+
clearTimeout(A2);
|
|
17
|
+
}
|
|
18
|
+
function L2() {
|
|
19
|
+
j2(), l2.value = false;
|
|
20
|
+
}
|
|
21
|
+
return c(l2, ((e2) => {
|
|
22
|
+
e2 || (P2.value = -a2.offset);
|
|
23
|
+
})), u((() => {
|
|
24
|
+
l2.value = true, E2();
|
|
25
|
+
})), p((() => j2())), n2({ close: L2, bottomOffset: O2 }), (e2, o2) => (f(), d(m, { name: e2.transitionName, onEnter: o2[0] || (o2[0] = (e3) => P2.value = T2.value.getBoundingClientRect().height), onAfterLeave: o2[1] || (o2[1] = (o3) => !l2.value && e2.onDestroy()) }, { default: g((() => [y(v("div", { ref_key: "messageRef", ref: T2, class: b(["px-message", { [`px-message--${e2.type}`]: e2.type, "is-close": e2.showClose, "text-center": e2.center, "is-plain": e2.plain, "is-ghost": e2.ghost }]), style: x(z2.value), role: "alert", "aria-live": "danger" === e2.type || "warning" === e2.type ? "assertive" : "polite", onMouseenter: j2, onMouseleave: E2 }, [h(U, { class: "px-message__icon", icon: M2.value }, null, 8, ["icon"]), v("div", re, [C(e2.$slots, "default", {}, (() => [e2.message ? (f(), d(w(t), { key: 0, vNode: e2.message }, null, 8, ["vNode"])) : _("", true)]))]), e2.showClose ? (f(), B("div", ce, [h(U, { icon: "close", onClick: k(L2, ["stop"]) })])) : _("", true), e2.showTimer && e2.duration > 0 ? (f(), B("div", { key: 1, class: "px-message__timer", style: x({ animationDuration: `${e2.duration}ms` }) }, null, 4)) : _("", true)], 46, ie), [[I, l2.value]])])), _: 3 }, 8, ["name"]));
|
|
26
|
+
} }), pe = ["info", "success", "warning", "danger", "error"], de = T([]), { nextZIndex: fe } = N(), me = n((() => de.length ? de[de.length - 1] : void 0)), ge = { type: "info", duration: 3e3, offset: 10, transitionName: "fade-up" }, ye = (e2) => {
|
|
27
|
+
const o2 = !e2 || P(e2) || J(e2) ? { message: e2 } : e2;
|
|
28
|
+
return { ...ge, ...o2 };
|
|
29
|
+
};
|
|
30
|
+
function ve() {
|
|
31
|
+
const e2 = Q(de, { id: this.id });
|
|
32
|
+
return e2 <= 0 ? 0 : W(de, [e2 - 1, "vm", "exposed", "bottomOffset", "value"]);
|
|
33
|
+
}
|
|
34
|
+
const xe = (e2 = {}) => {
|
|
35
|
+
const o2 = ye(e2), t2 = (!e2 || P(e2) || J(e2) ? {} : e2).max;
|
|
36
|
+
return t2 && t2 > 0 && s(de, t2), ((e3) => {
|
|
37
|
+
const o3 = R().value, t3 = document.createElement("div"), s2 = { ...e3, id: o3, zIndex: fe(), onDestroy: () => {
|
|
38
|
+
const e4 = Q(de, { id: o3 });
|
|
39
|
+
-1 !== e4 && (de.splice(e4, 1), O(null, t3), me.unregister());
|
|
40
|
+
} }, n2 = $(ue, s2);
|
|
41
|
+
O(n2, t3), document.body.appendChild(t3.firstElementChild);
|
|
42
|
+
const a2 = n2.component, l2 = { close: () => a2.exposed.close() }, i2 = { props: s2, id: o3, vm: a2, vnode: n2, handler: l2 };
|
|
43
|
+
return de.push(i2), me.register(), i2;
|
|
44
|
+
})(o2).handler;
|
|
45
|
+
};
|
|
46
|
+
G(pe, ((e2) => {
|
|
47
|
+
X(xe, e2, ((o2) => {
|
|
48
|
+
const t2 = ye(o2);
|
|
49
|
+
return xe({ ...t2, type: e2 });
|
|
50
|
+
}));
|
|
51
|
+
})), xe.closeAll = function(e2) {
|
|
52
|
+
G(de, ((o2) => {
|
|
53
|
+
e2 ? o2.props.type === e2 && o2.handler.close() : o2.handler.close();
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
const be = a(xe, "$message"), he = { class: "px-message-box__content" }, Be = { key: 1, class: "px-message-box__message" }, _e = { class: "px-message-box__input" }, Ce = { key: 0, class: "px-message-box__error" }, we = { class: "px-message-box__footer" }, ke = l({ name: "PxMessageBox", inheritAttrs: false, __name: "MessageBox", props: { visible: {}, doClose: {}, doAction: {}, destroy: {}, title: {}, message: {}, type: {}, boxType: { default: "" }, icon: {}, callback: {}, showClose: { type: Boolean, default: true }, showInput: { type: Boolean }, showCancelButton: { type: Boolean }, showConfirmButton: { type: Boolean, default: true }, cancelButtonText: {}, confirmButtonText: {}, cancelButtonLoading: { type: Boolean }, confirmButtonLoading: { type: Boolean }, cancelButtonDisabled: { type: Boolean }, confirmButtonDisabled: { type: Boolean }, cancelButtonType: {}, confirmButtonType: { default: "primary" }, roundButton: { type: Boolean, default: false }, center: { type: Boolean }, lockScroll: { type: Boolean, default: true }, closeOnClickModal: { type: Boolean, default: true }, inputPlaceholder: {}, inputValue: { default: "" }, inputType: {}, buttonSize: {}, beforeClose: {}, customClass: {}, customStyle: {}, width: {}, closeOnPressEscape: { type: Boolean, default: true }, inputSchema: {}, inputErrorMessage: {}, distinguishCancelAndClose: { type: Boolean, default: true }, overlayClass: {}, closeOnHashChange: { type: Boolean, default: true }, draggable: { type: Boolean, default: false }, footer: {} }, setup(o2) {
|
|
57
|
+
const s2 = o2, n2 = S(), { doAction: a2 } = s2, { nextZIndex: l2 } = N(), u2 = i(), p2 = i(), T2 = i(), P2 = i(), $2 = R(), O2 = `msgbox-title-${R().value}`, D2 = M({ ...s2, zIndex: l2() }), q2 = r((() => {
|
|
58
|
+
var _a;
|
|
59
|
+
return ((_a = s2.visible) == null ? void 0 : _a.value) ?? false;
|
|
60
|
+
})), F2 = r((() => !!D2.message)), G2 = r((() => D2.icon ?? e.get(D2.type ?? ""))), J2 = r((() => ({ ...D2.customStyle, ...D2.width ? { "--px-message-box-width": "number" == typeof D2.width ? `${D2.width}px` : D2.width } : {} }))), Q2 = i(""), { activate: W2, deactivate: X2 } = H(u2), { reset: oe2 } = K(r((() => D2.draggable ? u2.value : void 0)), r((() => D2.draggable ? p2.value : void 0)), { constrainToViewport: true });
|
|
61
|
+
function te2() {
|
|
62
|
+
s2.closeOnClickModal && re2();
|
|
63
|
+
}
|
|
64
|
+
function se2(e2) {
|
|
65
|
+
if ("textarea" !== D2.inputType) return e2.preventDefault(), ie2("confirm");
|
|
66
|
+
}
|
|
67
|
+
function ie2(e2) {
|
|
68
|
+
if ("confirm" !== e2 || !D2.showInput || (function() {
|
|
69
|
+
var _a;
|
|
70
|
+
if (!D2.inputSchema) return true;
|
|
71
|
+
const e3 = D2.inputSchema.safeParse(D2.inputValue ?? "");
|
|
72
|
+
return e3.success ? (Q2.value = "", true) : (Q2.value = D2.inputErrorMessage ?? ((_a = e3.error.issues[0]) == null ? void 0 : _a.message) ?? n2.value.t("messagebox.error"), false);
|
|
73
|
+
})()) if (ee(s2.beforeClose)) {
|
|
74
|
+
const o3 = "confirm" === e2 ? "confirmButtonLoading" : "cancel" === e2 ? "cancelButtonLoading" : void 0;
|
|
75
|
+
let t2;
|
|
76
|
+
o3 && (D2[o3] = true);
|
|
77
|
+
try {
|
|
78
|
+
t2 = s2.beforeClose(e2, D2, (() => {
|
|
79
|
+
o3 && (D2[o3] = false), a2(e2, D2.inputValue);
|
|
80
|
+
}));
|
|
81
|
+
} catch {
|
|
82
|
+
return void (o3 && (D2[o3] = false));
|
|
83
|
+
}
|
|
84
|
+
t2 instanceof Promise && t2.catch((() => {
|
|
85
|
+
o3 && (D2[o3] = false);
|
|
86
|
+
}));
|
|
87
|
+
} else a2(e2, D2.inputValue);
|
|
88
|
+
}
|
|
89
|
+
function re2() {
|
|
90
|
+
ie2(false === D2.distinguishCancelAndClose ? "cancel" : "close");
|
|
91
|
+
}
|
|
92
|
+
return c((() => {
|
|
93
|
+
var _a;
|
|
94
|
+
return (_a = s2.visible) == null ? void 0 : _a.value;
|
|
95
|
+
}), ((e2) => {
|
|
96
|
+
e2 ? (D2.zIndex = l2(), oe2(), z((() => {
|
|
97
|
+
var _a, _b, _c;
|
|
98
|
+
"prompt" === s2.boxType ? (_a = T2.value) == null ? void 0 : _a.focus() : (_c = (_b = P2.value) == null ? void 0 : _b.$el) == null ? void 0 : _c.focus(), W2();
|
|
99
|
+
}))) : (X2(), Q2.value = "");
|
|
100
|
+
})), Z(document, "keydown", ((e2) => {
|
|
101
|
+
D2.closeOnPressEscape && q2.value && "Escape" === e2.key && re2();
|
|
102
|
+
})), Z(window, "hashchange", (() => {
|
|
103
|
+
D2.closeOnHashChange && q2.value && re2();
|
|
104
|
+
})), (e2, o3) => (f(), d(m, { name: "fade-in-linear", onAfterLeave: e2.destroy }, { default: g((() => [y(h(le, { "z-index": D2.zIndex, "overlay-class": D2.overlayClass, mask: "" }, { default: g((() => [v("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": O2, class: "px-overlay-message-box", onClick: te2 }, [v("div", { ref_key: "rootRef", ref: u2, class: b(["px-message-box", { "is-center": D2.center, "is-draggable": D2.draggable }, D2.type ? `px-message-box--${D2.type}` : "", D2.customClass]), style: x(J2.value), onClick: o3[5] || (o3[5] = k((() => {
|
|
105
|
+
}), ["stop"])) }, [w(Y)(D2.title) ? _("", true) : (f(), B("div", { key: 0, ref_key: "headerRef", ref: p2, class: "px-message-box__header" }, [v("div", { class: "px-message-box__title", id: O2 }, [G2.value && D2.center ? (f(), d(U, { key: 0, class: b({ [`px-icon-${D2.type}`]: D2.type }), icon: G2.value }, null, 8, ["class", "icon"])) : _("", true), A(" " + E(D2.title), 1)]), e2.showClose ? (f(), B("button", { key: 0, class: "px-message-box__header-btn", onClick: k(re2, ["stop"]) }, [h(U, { icon: "close" })])) : _("", true)], 512)), v("div", he, [G2.value && !D2.center && F2.value ? (f(), d(U, { key: 0, class: b({ [`px-icon-${D2.type}`]: D2.type }), icon: G2.value }, null, 8, ["class", "icon"])) : _("", true), F2.value ? (f(), B("div", Be, [C(e2.$slots, "default", {}, (() => [(f(), d(j(D2.showInput ? "label" : "p"), { for: D2.showInput ? w($2) : void 0 }, { default: g((() => [A(E(D2.message), 1)])), _: 1 }, 8, ["for"]))]))])) : _("", true)]), y(v("div", _e, [h(ae, { modelValue: D2.inputValue, "onUpdate:modelValue": o3[0] || (o3[0] = (e3) => D2.inputValue = e3), ref_key: "inputRef", ref: T2, placeholder: D2.inputPlaceholder, type: D2.inputType, onKeyup: L(se2, ["enter"]) }, null, 8, ["modelValue", "placeholder", "type"]), Q2.value ? (f(), B("div", Ce, E(Q2.value), 1)) : _("", true)], 512), [[I, D2.showInput]]), v("div", we, [D2.footer ? (f(), d(w(t), { key: 0, vNode: D2.footer }, null, 8, ["vNode"])) : (f(), B(V, { key: 1 }, [D2.showCancelButton ? (f(), d(ne, { key: 0, class: "px-message-box__footer-btn px-message-box__cancel-btn", type: D2.cancelButtonType, round: D2.roundButton, loading: D2.cancelButtonLoading, onClick: o3[1] || (o3[1] = (e3) => ie2("cancel")), onKeydown: o3[2] || (o3[2] = L(k(((e3) => ie2("cancel")), ["prevent"]), ["enter"])) }, { default: g((() => [A(E(D2.cancelButtonText || w(n2).t("messagebox.cancel")), 1)])), _: 1 }, 8, ["type", "round", "loading"])) : _("", true), y(h(ne, { ref_key: "confirmBtnRef", ref: P2, class: "px-message-box__footer-btn px-message-box__confirm-btn", type: D2.confirmButtonType ?? "primary", round: D2.roundButton, loading: D2.confirmButtonLoading, onClick: o3[3] || (o3[3] = (e3) => ie2("confirm")), onKeydown: o3[4] || (o3[4] = L(k(((e3) => ie2("confirm")), ["prevent"]), ["enter"])) }, { default: g((() => [A(E(D2.confirmButtonText || w(n2).t("messagebox.confirm")), 1)])), _: 1 }, 8, ["type", "round", "loading"]), [[I, D2.showConfirmButton]])], 64))])], 6)])])), _: 3 }, 8, ["z-index", "overlay-class"]), [[I, q2.value]])])), _: 3 }, 8, ["onAfterLeave"]));
|
|
106
|
+
} }), Ie = /* @__PURE__ */ new Map();
|
|
107
|
+
function Te(e2) {
|
|
108
|
+
let o2;
|
|
109
|
+
J(e2) || P(e2) ? e2 = { message: e2 } : o2 = e2.callback;
|
|
110
|
+
const t2 = new Promise(((t3, s2) => {
|
|
111
|
+
const n2 = (function(e3) {
|
|
112
|
+
const o3 = document.createElement("div"), t4 = (function(e4, o4) {
|
|
113
|
+
const t5 = i(false), s4 = ee(e4 == null ? void 0 : e4.message) || P(e4 == null ? void 0 : e4.message), n3 = h(ke, { ...e4, visible: t5 }, s4 ? { default: (a2 = e4.message, ee(a2) ? a2 : () => a2) } : void 0);
|
|
114
|
+
var a2;
|
|
115
|
+
return O(n3, o4), document.body.appendChild(o4.firstElementChild), n3.component;
|
|
116
|
+
})({ ...e3, doClose: () => {
|
|
117
|
+
s3.visible.value = false;
|
|
118
|
+
}, doAction: (o4, t5) => {
|
|
119
|
+
const n3 = Ie.get(s3);
|
|
120
|
+
let a2;
|
|
121
|
+
z((() => s3.doClose())), a2 = e3.showInput ? { value: t5, action: o4 } : o4, e3.callback ? e3.callback(a2) : "cancel" !== o4 && "close" !== o4 ? n3 == null ? void 0 : n3.resolve(a2) : n3 == null ? void 0 : n3.reject(o4);
|
|
122
|
+
}, destroy: () => {
|
|
123
|
+
O(null, o3), Ie.delete(s3);
|
|
124
|
+
} }, o3), s3 = t4 == null ? void 0 : t4.proxy;
|
|
125
|
+
return s3.visible.value = true, s3;
|
|
126
|
+
})(e2);
|
|
127
|
+
Ie.set(n2, { options: e2, callback: o2, resolve: t3, reject: s2 });
|
|
128
|
+
}));
|
|
129
|
+
return t2.catch((() => {
|
|
130
|
+
})), t2;
|
|
131
|
+
}
|
|
132
|
+
const Pe = { alert: { closeOnClickModal: false }, confirm: { showCancelButton: true }, prompt: { showCancelButton: true, showInput: true } };
|
|
133
|
+
G(["alert", "confirm", "prompt"], ((e2) => {
|
|
134
|
+
return X(Te, e2, (o2 = e2, (e3, t2, s2) => {
|
|
135
|
+
let n2 = "";
|
|
136
|
+
return te(t2) ? (s2 = t2, n2 = "") : n2 = se(t2) ? "" : t2, Te(oe({ title: n2, message: e3, type: "", boxType: o2, ...Pe[o2] }, s2));
|
|
137
|
+
}));
|
|
138
|
+
var o2;
|
|
139
|
+
})), X(Te, "close", (() => {
|
|
140
|
+
Ie.forEach(((e2, o2) => {
|
|
141
|
+
o2.doClose();
|
|
142
|
+
})), Ie.clear();
|
|
143
|
+
}));
|
|
144
|
+
const $e = Te;
|
|
145
|
+
X($e, "install", ((e2) => {
|
|
146
|
+
e2.config.globalProperties.$msgbox = Te, e2.config.globalProperties.$messagebox = Te, e2.config.globalProperties.$alert = Te.alert, e2.config.globalProperties.$confirm = Te.confirm, e2.config.globalProperties.$prompt = Te.prompt;
|
|
147
|
+
}));
|
|
148
|
+
export {
|
|
149
|
+
be as P,
|
|
150
|
+
$e as a,
|
|
151
|
+
pe as m
|
|
152
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { t, b as o, R as e, _ as n, h as i, i as s, j as a } from "./utils-BXICIEsD.js";
|
|
2
|
+
import { defineComponent as l, ref as r, computed as c, onMounted as p, onBeforeUnmount as f, createBlock as d, openBlock as u, Transition as m, withCtx as h, withDirectives as v, createElementVNode as g, normalizeStyle as x, normalizeClass as y, createVNode as _, createElementBlock as C, createCommentVNode as w, toDisplayString as b, renderSlot as k, unref as I, withModifiers as N, vShow as z, isVNode as B, h as j, render as E, shallowReactive as O } from "vue";
|
|
3
|
+
import { f as $, a as D, u as T } from "./hooks-pU4JmsO3.js";
|
|
4
|
+
import { P as M } from "./Icon-D6qRB3pq.js";
|
|
5
|
+
import { v as P, u as R, f as A, d as L, w as W, g as H, x as Z } from "./vendor-DrBJKLFW.js";
|
|
6
|
+
const q = ["aria-live"], F = { class: "px-notification__text" }, G = { class: "px-notification__title" }, J = { class: "px-notification__content" }, K = { key: 0, class: "px-notification__close" }, Q = n(l({ name: "PxNotification", __name: "Notification", props: { title: {}, id: {}, zIndex: {}, position: { default: "top-right" }, type: { default: "info" }, message: {}, duration: { default: 3e3 }, showClose: { type: Boolean, default: true }, offset: { default: 20 }, transitionName: { default: "fade" }, icon: {}, plain: { type: Boolean }, ghost: { type: Boolean }, showTimer: { type: Boolean, default: true }, onClick: {}, onClose: {}, onDestroy: {} }, setup(n2, { expose: i2 }) {
|
|
7
|
+
const s2 = n2, a2 = r(false), l2 = r(), B2 = r(0), { topOffset: j2, bottomOffset: E2 } = $({ getLastBottomOffset: P(it, s2), offset: s2.offset, boxHeight: B2 }), O2 = c((() => s2.icon ?? t.get(s2.type) ?? "circle-info")), D2 = c((() => s2.position.endsWith("right") ? "right" : "left")), T2 = c((() => s2.position.startsWith("top") ? "top" : "bottom")), A2 = c((() => ({ [T2.value]: o(j2.value), zIndex: s2.zIndex })));
|
|
8
|
+
let L2;
|
|
9
|
+
function W2() {
|
|
10
|
+
0 !== s2.duration && (L2 = R(Z2, s2.duration));
|
|
11
|
+
}
|
|
12
|
+
function H2() {
|
|
13
|
+
clearTimeout(L2);
|
|
14
|
+
}
|
|
15
|
+
function Z2() {
|
|
16
|
+
H2(), a2.value = false;
|
|
17
|
+
}
|
|
18
|
+
return p((() => {
|
|
19
|
+
a2.value = true, W2();
|
|
20
|
+
})), f((() => H2())), i2({ bottomOffset: E2, close: Z2 }), (t2, o2) => (u(), d(m, { name: `px-notification-${t2.transitionName}`, onAfterLeave: o2[1] || (o2[1] = (o3) => !a2.value && t2.onDestroy()), onEnter: o2[2] || (o2[2] = (t3) => B2.value = l2.value.getBoundingClientRect().height) }, { default: h((() => [v(g("div", { ref_key: "notifyRef", ref: l2, class: y(["px-notification", { [`px-notification--${t2.type}`]: t2.type, [D2.value]: true, "show-close": t2.showClose, "is-plain": t2.plain, "is-ghost": t2.ghost }]), style: x(A2.value), role: "alert", "aria-live": "danger" === t2.type || "warning" === t2.type ? "assertive" : "polite", onClick: o2[0] || (o2[0] = (...o3) => t2.onClick && t2.onClick(...o3)), onMouseenter: H2, onMouseleave: W2 }, [_(M, { icon: O2.value, class: "px-notification__icon" }, null, 8, ["icon"]), g("div", F, [g("div", G, b(t2.title), 1), g("div", J, [k(t2.$slots, "default", {}, (() => [t2.message ? (u(), d(I(e), { key: 0, vNode: t2.message }, null, 8, ["vNode"])) : w("", true)]), true)])]), t2.showClose ? (u(), C("div", K, [_(M, { icon: "close", onClick: N(Z2, ["stop"]) })])) : w("", true), t2.showTimer && t2.duration > 0 ? (u(), C("div", { key: 1, class: "px-notification__timer", style: x({ animationDuration: `${t2.duration}ms` }) }, null, 4)) : w("", true)], 46, q), [[z, a2.value]])])), _: 3 }, 8, ["name"]));
|
|
21
|
+
} }), [["__scopeId", "data-v-5c4c1be5"]]), S = ["info", "success", "warning", "danger", "error"], U = ["top-right", "top-left", "bottom-right", "bottom-left"], V = /* @__PURE__ */ new Map();
|
|
22
|
+
A(U, ((t2) => {
|
|
23
|
+
V.set(t2, O([]));
|
|
24
|
+
}));
|
|
25
|
+
const { nextZIndex: X } = D(), Y = s((() => {
|
|
26
|
+
let t2;
|
|
27
|
+
return V.forEach(((o2) => {
|
|
28
|
+
if (o2.length) {
|
|
29
|
+
const e2 = o2[o2.length - 1];
|
|
30
|
+
(!t2 || e2.props.zIndex > t2.props.zIndex) && (t2 = e2);
|
|
31
|
+
}
|
|
32
|
+
})), t2;
|
|
33
|
+
})), tt = { title: "", type: "info", duration: 3e3, offset: 20, position: "top-right", transitionName: "fade", showClose: true, showTimer: true }, ot = (t2) => {
|
|
34
|
+
const o2 = !t2 || B(t2) || L(t2) ? { message: t2 } : t2;
|
|
35
|
+
return { ...tt, ...o2 };
|
|
36
|
+
}, et = (t2) => V.get(t2), nt = (t2 = {}) => {
|
|
37
|
+
const o2 = ot(t2), e2 = (!t2 || B(t2) || L(t2) ? {} : t2).max, n2 = o2.position || "top-right";
|
|
38
|
+
return e2 && e2 > 0 && i(et(n2), e2), ((t3) => {
|
|
39
|
+
const o3 = T().value, e3 = document.createElement("div"), n3 = et(t3.position || "top-right"), i2 = { ...t3, id: o3, zIndex: X(), onDestroy: () => {
|
|
40
|
+
const t4 = W(n3, { id: o3 });
|
|
41
|
+
-1 !== t4 && (n3.splice(t4, 1), E(null, e3), Y.unregister());
|
|
42
|
+
} }, s2 = j(Q, i2);
|
|
43
|
+
E(s2, e3), document.body.appendChild(e3.firstElementChild);
|
|
44
|
+
const a2 = s2.component, l2 = { close: () => a2.exposed.close() }, r2 = { props: i2, id: o3, vm: a2, vnode: s2, handler: l2 };
|
|
45
|
+
return n3.push(r2), Y.register(), r2;
|
|
46
|
+
})(o2).handler;
|
|
47
|
+
};
|
|
48
|
+
function it() {
|
|
49
|
+
const t2 = et(this.position || "top-right"), o2 = W(t2, { id: this.id });
|
|
50
|
+
return o2 <= 0 ? 0 : H(t2, [o2 - 1, "vm", "exposed", "bottomOffset", "value"]);
|
|
51
|
+
}
|
|
52
|
+
A(S, ((t2) => {
|
|
53
|
+
Z(nt, t2, ((o2) => {
|
|
54
|
+
const e2 = ot(o2);
|
|
55
|
+
return nt({ ...e2, type: t2 });
|
|
56
|
+
}));
|
|
57
|
+
})), nt.closeAll = function(t2) {
|
|
58
|
+
V.forEach(((o2) => {
|
|
59
|
+
A(o2, ((o3) => {
|
|
60
|
+
t2 ? o3.props.type === t2 && o3.handler.close() : o3.handler.close();
|
|
61
|
+
}));
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
const st = a(nt, "$notify");
|
|
65
|
+
export {
|
|
66
|
+
st as P,
|
|
67
|
+
U as a,
|
|
68
|
+
S as n
|
|
69
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as e, createElementBlock as s, openBlock as o, normalizeStyle as t, normalizeClass as a, renderSlot as l } from "vue";
|
|
2
|
-
import { _ as i } from "./utils-
|
|
2
|
+
import { _ as i } from "./utils-BXICIEsD.js";
|
|
3
3
|
const d = i(e({ name: "PxOverlay", __name: "Overlay", props: { mask: { type: Boolean, default: true }, zIndex: {}, overlayClass: {} }, emits: ["click"], setup(e2, { emit: i2 }) {
|
|
4
4
|
const d2 = i2;
|
|
5
5
|
function n(e3) {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { b as e, p as t, w as n } from "./utils-BXICIEsD.js";
|
|
2
|
+
import { defineComponent as a, ref as r, computed as i, watch as l, createElementBlock as u, openBlock as o, normalizeStyle as s, createElementVNode as c } from "vue";
|
|
3
|
+
const g = ["src"], d = n(a({ name: "PxPixelate", __name: "Pixelate", props: { src: {}, pixelSize: { default: 8 }, width: {}, height: {}, grayscale: { type: Boolean, default: false }, palette: {}, background: { default: "#FFFFFF" } }, emits: ["rendered", "error"], setup(n2, { expose: a2, emit: d2 }) {
|
|
4
|
+
const h = n2, p = d2, f = r(), v = r(), m = r(false), x = i((() => {
|
|
5
|
+
const t2 = {};
|
|
6
|
+
return null != h.width && (t2.width = e(h.width) ?? ""), null != h.height && (t2.height = e(h.height) ?? ""), t2;
|
|
7
|
+
})), y = i((() => {
|
|
8
|
+
const e2 = { "image-rendering": "pixelated" };
|
|
9
|
+
return null != h.width && (e2.width = "100%"), null != h.height && (e2.height = "100%"), e2;
|
|
10
|
+
}));
|
|
11
|
+
function w() {
|
|
12
|
+
const e2 = f.value, n3 = v.value;
|
|
13
|
+
e2 && n3 && m.value && (t(e2, n3, { pixelSize: h.pixelSize, grayscale: h.grayscale, palette: h.palette, background: h.background }), p("rendered"));
|
|
14
|
+
}
|
|
15
|
+
function k() {
|
|
16
|
+
m.value = true, w();
|
|
17
|
+
}
|
|
18
|
+
function F(e2) {
|
|
19
|
+
p("error", e2);
|
|
20
|
+
}
|
|
21
|
+
return l((() => [h.pixelSize, h.grayscale, h.palette, h.background]), (() => {
|
|
22
|
+
m.value && w();
|
|
23
|
+
})), l((() => h.src), (() => {
|
|
24
|
+
m.value = false;
|
|
25
|
+
})), a2({ render: function() {
|
|
26
|
+
w();
|
|
27
|
+
}, canvasRef: f, originRef: v, getSize: function() {
|
|
28
|
+
const e2 = f.value;
|
|
29
|
+
return { width: (e2 == null ? void 0 : e2.width) ?? 0, height: (e2 == null ? void 0 : e2.height) ?? 0 };
|
|
30
|
+
}, getImageData: function() {
|
|
31
|
+
const e2 = f.value;
|
|
32
|
+
if (!e2 || !m.value) return null;
|
|
33
|
+
const t2 = e2.getContext("2d");
|
|
34
|
+
return t2 ? t2.getImageData(0, 0, e2.width, e2.height) : null;
|
|
35
|
+
} }), (e2, t2) => (o(), u("div", { class: "px-pixelate", style: s(x.value) }, [c("canvas", { ref_key: "canvasRef", ref: f, style: s(y.value) }, null, 4), c("img", { ref_key: "originRef", ref: v, src: e2.src, style: { display: "none" }, crossorigin: "anonymous", onLoad: k, onError: F }, null, 40, g)], 4));
|
|
36
|
+
} }));
|
|
37
|
+
export {
|
|
38
|
+
d as P
|
|
39
|
+
};
|