maz-ui 3.22.4 → 3.23.1
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/components/MazAvatar.mjs +2 -2
- package/components/MazBackdrop.mjs +67 -107
- package/components/MazBadge.mjs +41 -50
- package/components/MazBottomSheet.mjs +2 -2
- package/components/MazBtn.mjs +2 -2
- package/components/MazCard.mjs +2 -2
- package/components/MazCarousel.mjs +2 -2
- package/components/MazChart.mjs +53 -63
- package/components/MazCheckbox.mjs +84 -128
- package/components/MazDialog.mjs +2 -2
- package/components/MazDialogPromise.mjs +3 -3
- package/components/MazDrawer.mjs +2 -2
- package/components/MazDropdown.mjs +2 -2
- package/components/MazDropzone.mjs +2 -2
- package/components/MazFullscreenLoader.mjs +14 -18
- package/components/MazGallery.mjs +352 -558
- package/components/MazIcon.mjs +76 -140
- package/components/MazInput.mjs +2 -2
- package/components/MazInputNumber.mjs +72 -99
- package/components/MazInputPrice.mjs +2 -2
- package/components/MazInputTags.mjs +2 -2
- package/components/MazLazyImg.mjs +2 -2
- package/components/MazPhoneNumberInput.mjs +2 -2
- package/components/MazPicker.mjs +2 -2
- package/components/MazRadio.mjs +65 -94
- package/components/MazRadioButtons.mjs +64 -78
- package/components/MazSelect.mjs +2 -2
- package/components/MazSlider.mjs +213 -325
- package/components/MazSpinner.mjs +25 -34
- package/components/MazStepper.mjs +2 -2
- package/components/MazSwitch.mjs +43 -60
- package/components/MazTabs.mjs +16 -25
- package/components/MazTabsBar.mjs +2 -2
- package/components/MazTabsContent.mjs +34 -43
- package/components/MazTabsContentItem.mjs +49 -63
- package/components/MazTextarea.mjs +124 -169
- package/components/MazTransitionExpand.mjs +36 -54
- package/components/assets/MazBackdrop.css +1 -1
- package/components/assets/MazBottomSheet.css +1 -1
- package/components/assets/MazDialog.css +1 -1
- package/components/assets/MazDialogPromise.css +1 -1
- package/components/assets/MazDrawer.css +1 -1
- package/components/assets/MazPhoneNumberInput.css +1 -1
- package/components/assets/MazSelect.css +1 -1
- package/components/chunks/MazAvatar-1636f58b.mjs +126 -0
- package/components/chunks/MazBottomSheet-c24f92f8.mjs +217 -0
- package/components/chunks/MazBtn-124f3700.mjs +153 -0
- package/components/chunks/MazBtn-1e61862b.mjs +153 -0
- package/components/chunks/MazBtn-2d1d1ba5.mjs +153 -0
- package/components/chunks/MazBtn-3d74f737.mjs +153 -0
- package/components/chunks/MazBtn-4a447126.mjs +153 -0
- package/components/chunks/MazBtn-555928ed.mjs +153 -0
- package/components/chunks/MazBtn-571454f6.mjs +153 -0
- package/components/chunks/MazBtn-5e426592.mjs +153 -0
- package/components/chunks/MazBtn-683effc1.mjs +153 -0
- package/components/chunks/MazBtn-6905cc39.mjs +153 -0
- package/components/chunks/MazBtn-6ce4cfd3.mjs +153 -0
- package/components/chunks/MazBtn-74656d5b.mjs +153 -0
- package/components/chunks/MazBtn-7706b2da.mjs +158 -0
- package/components/chunks/MazBtn-a7a913dd.mjs +153 -0
- package/components/chunks/MazBtn-fb3c7af8.mjs +153 -0
- package/components/chunks/MazCard-bcc36489.mjs +214 -0
- package/components/chunks/MazCarousel-6da75122.mjs +107 -0
- package/components/chunks/MazCheckbox-040dc2c4.mjs +117 -0
- package/components/chunks/MazCheckbox-3a2b48b4.mjs +117 -0
- package/components/chunks/MazDialog-44eda544.mjs +250 -0
- package/components/chunks/MazDialogPromise-eec5acde.mjs +419 -0
- package/components/chunks/MazDrawer-b628b37e.mjs +206 -0
- package/components/chunks/MazDropdown-6f2248b0.mjs +345 -0
- package/components/chunks/MazDropzone-8cac10a6.mjs +242 -0
- package/components/chunks/MazGallery-6b8ecedf.mjs +617 -0
- package/components/chunks/MazIcon-52a76873.mjs +101 -0
- package/components/chunks/MazIcon-95e31ff8.mjs +96 -0
- package/components/chunks/MazInput-1ed4f946.mjs +283 -0
- package/components/chunks/MazInput-8a217995.mjs +271 -0
- package/components/chunks/MazInput-c51881ea.mjs +278 -0
- package/components/chunks/MazInputPrice-cd348d46.mjs +392 -0
- package/components/chunks/MazInputTags-aa95fae7.mjs +446 -0
- package/components/chunks/MazLazyImg-0412ab38.mjs +259 -0
- package/components/chunks/MazLazyImg-47d3449a.mjs +254 -0
- package/components/chunks/MazPhoneNumberInput-e1bf46f9.mjs +1216 -0
- package/components/chunks/MazPicker-e4620d8b.mjs +1140 -0
- package/components/chunks/MazPickerCalendar-da62262c.mjs +535 -0
- package/components/chunks/MazPickerHeader-a2e041eb.mjs +186 -0
- package/components/chunks/MazPickerMonthSwitcher-5bf8bd08.mjs +97 -0
- package/components/chunks/MazPickerShortcuts-7f95430e.mjs +74 -0
- package/components/chunks/MazPickerTime-717402ae.mjs +219 -0
- package/components/chunks/MazPickerYearSwitcher-85f97b6d.mjs +106 -0
- package/components/chunks/MazSelect-6ff6bb96.mjs +652 -0
- package/components/chunks/MazSpinner-054f948c.mjs +39 -0
- package/components/chunks/MazSpinner-059ee1d2.mjs +39 -0
- package/components/chunks/MazSpinner-08ee440b.mjs +39 -0
- package/components/chunks/MazSpinner-13403729.mjs +39 -0
- package/components/chunks/MazSpinner-44011019.mjs +39 -0
- package/components/chunks/MazSpinner-452a1534.mjs +39 -0
- package/components/chunks/MazSpinner-4c02cfd2.mjs +39 -0
- package/components/chunks/MazSpinner-51aa73ca.mjs +39 -0
- package/components/chunks/MazSpinner-6d1d24d5.mjs +39 -0
- package/components/chunks/MazSpinner-6e7c4705.mjs +39 -0
- package/components/chunks/MazSpinner-7895f54f.mjs +39 -0
- package/components/chunks/MazSpinner-7eee202e.mjs +39 -0
- package/components/chunks/MazSpinner-805e14a6.mjs +39 -0
- package/components/chunks/MazSpinner-85080b43.mjs +39 -0
- package/components/chunks/MazSpinner-a13a50c9.mjs +39 -0
- package/components/chunks/MazSpinner-a6d61cee.mjs +43 -0
- package/components/chunks/MazSpinner-c67b05bb.mjs +39 -0
- package/components/chunks/MazSpinner-caa33afc.mjs +39 -0
- package/components/chunks/MazSpinner-cb8fbe9a.mjs +39 -0
- package/components/chunks/MazSpinner-d9ef329f.mjs +39 -0
- package/components/chunks/MazStepper-39f018f3.mjs +191 -0
- package/components/chunks/MazTabsBar-27965f16.mjs +132 -0
- package/components/chunks/MazTransitionExpand-55cfbecb.mjs +41 -0
- package/components/chunks/MazTransitionExpand-cd24498f.mjs +41 -0
- package/components/chunks/_plugin-vue_export-helper-dad06003.mjs +9 -0
- package/components/chunks/check-31d7ba2f.mjs +30 -0
- package/components/chunks/check-c9b483c0.mjs +30 -0
- package/components/chunks/{check-circle-7acfa4c4.mjs → check-circle-59c383ed.mjs} +10 -12
- package/components/chunks/chevron-down-2b60111a.mjs +30 -0
- package/components/chunks/chevron-left-39b4621e.mjs +30 -0
- package/components/chunks/chevron-right-949a60fa.mjs +30 -0
- package/components/chunks/debounce-19c516b6.mjs +11 -0
- package/components/chunks/examples.mobile.json-f63d22fb.mjs +4 -0
- package/components/chunks/{exclamation-circle-2e115536.mjs → exclamation-circle-e2620aab.mjs} +10 -12
- package/components/chunks/{exclamation-triangle-10eb48dc.mjs → exclamation-triangle-21bf116a.mjs} +10 -12
- package/components/chunks/{eye-fbb13657.mjs → eye-dc12ce09.mjs} +12 -15
- package/components/chunks/{eye-slash-342420ff.mjs → eye-slash-fa42a017.mjs} +10 -12
- package/components/chunks/{magnifying-glass-5dffa35e.mjs → magnifying-glass-908981c0.mjs} +10 -12
- package/components/chunks/minus-e71140e1.mjs +30 -0
- package/components/chunks/no-photography-4c6c77cf.mjs +4 -0
- package/components/chunks/{no-photography-b0d08d6f.mjs → no-photography-be94ddda.mjs} +12 -15
- package/components/chunks/{no-symbol-975ce547.mjs → no-symbol-87477ad0.mjs} +10 -12
- package/components/chunks/{pencil-2f766dc8.mjs → pencil-4c35b4e7.mjs} +10 -12
- package/components/chunks/plus-c20544c3.mjs +30 -0
- package/components/chunks/x-mark-35f2f1e7.mjs +30 -0
- package/components/chunks/x-mark-7761acf4.mjs +29 -0
- package/modules/chunks/MazBtn-2f302422.cjs +1 -0
- package/modules/chunks/MazBtn-760c3b29.mjs +153 -0
- package/modules/chunks/MazIcon-0bd6b78e.mjs +96 -0
- package/modules/chunks/MazIcon-599a907f.cjs +1 -0
- package/modules/chunks/MazSpinner-03bd76bd.mjs +39 -0
- package/modules/chunks/MazSpinner-6ffa8db1.cjs +1 -0
- package/modules/chunks/{arrow-top-right-on-square-32bbe5a1.mjs → arrow-top-right-on-square-15191934.mjs} +10 -12
- package/modules/chunks/arrow-top-right-on-square-8e4ea6e2.cjs +1 -0
- package/modules/chunks/chevron-left-36731110.cjs +1 -0
- package/modules/chunks/chevron-left-39b4621e.mjs +30 -0
- package/modules/chunks/index-6a90ef88.mjs +1618 -0
- package/modules/chunks/index-794680d2.cjs +124 -0
- package/modules/chunks/{link-4eb05848.mjs → link-bb14441d.mjs} +10 -12
- package/modules/chunks/link-c7791a2a.cjs +1 -0
- package/modules/chunks/no-photography-0f6fcaf4.cjs +1 -0
- package/modules/chunks/no-photography-4c6c77cf.mjs +4 -0
- package/modules/chunks/x-mark-35f2f1e7.mjs +30 -0
- package/modules/chunks/x-mark-a28deca5.cjs +1 -0
- package/modules/index.cjs +1 -0
- package/modules/index.mjs +42 -42
- package/nuxt/index.json +1 -1
- package/package.json +14 -4
- package/types/resolvers/index.d.ts +1 -0
- package/types/resolvers/unplugin-vue-components-resolver.d.ts +8 -0
- package/types/utils/index.d.ts +3 -0
- package/components/chunks/MazAvatar-358d78d4.mjs +0 -138
- package/components/chunks/MazBottomSheet-61090f4a.mjs +0 -267
- package/components/chunks/MazBtn-0e02f0da.mjs +0 -184
- package/components/chunks/MazBtn-1daf9063.mjs +0 -184
- package/components/chunks/MazBtn-2f4fa942.mjs +0 -184
- package/components/chunks/MazBtn-31c6b731.mjs +0 -184
- package/components/chunks/MazBtn-48382169.mjs +0 -184
- package/components/chunks/MazBtn-4e1e116e.mjs +0 -184
- package/components/chunks/MazBtn-50abc4c5.mjs +0 -184
- package/components/chunks/MazBtn-84e12b6a.mjs +0 -184
- package/components/chunks/MazBtn-b42e3575.mjs +0 -184
- package/components/chunks/MazBtn-b56a7278.mjs +0 -184
- package/components/chunks/MazBtn-bbd6e9c8.mjs +0 -184
- package/components/chunks/MazBtn-cf0c8fcb.mjs +0 -184
- package/components/chunks/MazBtn-d92908b2.mjs +0 -191
- package/components/chunks/MazBtn-f48da79c.mjs +0 -184
- package/components/chunks/MazBtn-fec4c3b7.mjs +0 -184
- package/components/chunks/MazCard-4331dca0.mjs +0 -237
- package/components/chunks/MazCarousel-7825c7c9.mjs +0 -133
- package/components/chunks/MazCheckbox-ab5ddda2.mjs +0 -153
- package/components/chunks/MazCheckbox-e0bbe6ec.mjs +0 -153
- package/components/chunks/MazDialog-83e54b8c.mjs +0 -290
- package/components/chunks/MazDialogPromise-6967e821.mjs +0 -474
- package/components/chunks/MazDrawer-d778b3d2.mjs +0 -256
- package/components/chunks/MazDropdown-6f4482d7.mjs +0 -426
- package/components/chunks/MazDropzone-d1bb62dc.mjs +0 -325
- package/components/chunks/MazGallery-b2dc4286.mjs +0 -821
- package/components/chunks/MazIcon-b779da0a.mjs +0 -159
- package/components/chunks/MazIcon-bda198b4.mjs +0 -165
- package/components/chunks/MazInput-713b00d0.mjs +0 -326
- package/components/chunks/MazInput-b9386887.mjs +0 -341
- package/components/chunks/MazInput-c33627dd.mjs +0 -334
- package/components/chunks/MazInputPrice-452297f5.mjs +0 -481
- package/components/chunks/MazInputTags-7a463b81.mjs +0 -526
- package/components/chunks/MazLazyImg-6e395356.mjs +0 -336
- package/components/chunks/MazLazyImg-e0d8b6d0.mjs +0 -329
- package/components/chunks/MazPhoneNumberInput-48fe2445.mjs +0 -1536
- package/components/chunks/MazPicker-50fc11d1.mjs +0 -1352
- package/components/chunks/MazPickerCalendar-cacb361c.mjs +0 -689
- package/components/chunks/MazPickerHeader-63d45179.mjs +0 -216
- package/components/chunks/MazPickerMonthSwitcher-913c6e2c.mjs +0 -110
- package/components/chunks/MazPickerShortcuts-c6fabfc6.mjs +0 -88
- package/components/chunks/MazPickerTime-5e4475da.mjs +0 -301
- package/components/chunks/MazPickerYearSwitcher-dd4fa89c.mjs +0 -125
- package/components/chunks/MazSelect-2e5cd411.mjs +0 -850
- package/components/chunks/MazSpinner-022d7bee.mjs +0 -46
- package/components/chunks/MazSpinner-100c99b8.mjs +0 -46
- package/components/chunks/MazSpinner-191ad23b.mjs +0 -46
- package/components/chunks/MazSpinner-3155378b.mjs +0 -46
- package/components/chunks/MazSpinner-339a9006.mjs +0 -46
- package/components/chunks/MazSpinner-53979e96.mjs +0 -46
- package/components/chunks/MazSpinner-68d2f2ac.mjs +0 -46
- package/components/chunks/MazSpinner-6b563b22.mjs +0 -46
- package/components/chunks/MazSpinner-7cdc13e7.mjs +0 -46
- package/components/chunks/MazSpinner-8859d658.mjs +0 -46
- package/components/chunks/MazSpinner-8e180605.mjs +0 -52
- package/components/chunks/MazSpinner-9950424b.mjs +0 -46
- package/components/chunks/MazSpinner-c8270a93.mjs +0 -46
- package/components/chunks/MazSpinner-cb491238.mjs +0 -46
- package/components/chunks/MazSpinner-cb6f99f3.mjs +0 -46
- package/components/chunks/MazSpinner-ce4be8f1.mjs +0 -46
- package/components/chunks/MazSpinner-e5a9f319.mjs +0 -46
- package/components/chunks/MazSpinner-e92bd359.mjs +0 -46
- package/components/chunks/MazSpinner-eea9056d.mjs +0 -46
- package/components/chunks/MazSpinner-f1e69f29.mjs +0 -46
- package/components/chunks/MazStepper-4c19dbfc.mjs +0 -255
- package/components/chunks/MazTabsBar-3c2e2d69.mjs +0 -157
- package/components/chunks/MazTransitionExpand-474b00d4.mjs +0 -57
- package/components/chunks/MazTransitionExpand-f9e5a2d6.mjs +0 -57
- package/components/chunks/_plugin-vue_export-helper-cc2b3d55.mjs +0 -10
- package/components/chunks/check-8da249b1.mjs +0 -32
- package/components/chunks/check-f2fcce10.mjs +0 -32
- package/components/chunks/chevron-down-a78b9604.mjs +0 -32
- package/components/chunks/chevron-left-3365d59b.mjs +0 -32
- package/components/chunks/chevron-right-02f9e837.mjs +0 -32
- package/components/chunks/debounce-7d66ffa9.mjs +0 -12
- package/components/chunks/examples.mobile.json-618ba782.mjs +0 -4
- package/components/chunks/minus-c9cdee90.mjs +0 -32
- package/components/chunks/no-photography-7f2be516.mjs +0 -4
- package/components/chunks/plus-b1b0a5a8.mjs +0 -32
- package/components/chunks/x-mark-3b05101b.mjs +0 -31
- package/components/chunks/x-mark-c6ff45dd.mjs +0 -32
- package/modules/chunks/MazBtn-90ffd148.mjs +0 -184
- package/modules/chunks/MazIcon-988edef7.mjs +0 -159
- package/modules/chunks/MazSpinner-a16a3d8f.mjs +0 -46
- package/modules/chunks/chevron-left-3365d59b.mjs +0 -32
- package/modules/chunks/index-b1625fc2.mjs +0 -2315
- package/modules/chunks/no-photography-7f2be516.mjs +0 -4
- package/modules/chunks/x-mark-c6ff45dd.mjs +0 -32
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import "../assets/MazInputTags.css";
|
|
2
|
+
import { computed as u, defineComponent as O, defineAsyncComponent as w, ref as B, getCurrentInstance as ee, onMounted as te, useSlots as ae, openBlock as i, createElementBlock as v, normalizeClass as V, normalizeStyle as le, createElementVNode as $, renderSlot as T, createVNode as b, unref as m, createCommentVNode as y, withDirectives as re, mergeProps as D, toHandlers as ne, vModelDynamic as oe, createTextVNode as F, toDisplayString as L, createBlock as N, withModifiers as P, withCtx as x, TransitionGroup as ie, Fragment as se, renderList as ue, withKeys as q } from "vue";
|
|
3
|
+
function de(e, n) {
|
|
4
|
+
let o;
|
|
5
|
+
return function(...l) {
|
|
6
|
+
clearTimeout(o), o = setTimeout(() => {
|
|
7
|
+
e.apply(this, l);
|
|
8
|
+
}, n);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const ce = ({
|
|
12
|
+
componentName: e,
|
|
13
|
+
instance: n,
|
|
14
|
+
providedId: o
|
|
15
|
+
}) => u(() => o ?? `${e}-${n == null ? void 0 : n.uid}`), me = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "m-input-wrapper-left"
|
|
18
|
+
}, fe = { class: "m-input-wrapper-input" }, ve = ["id", "type", "name", "placeholder", "aria-label", "disabled", "readonly", "required"], ye = { key: 0 }, be = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "m-input-wrapper-right"
|
|
21
|
+
}, ge = /* @__PURE__ */ O({
|
|
22
|
+
inheritAttrs: !1,
|
|
23
|
+
__name: "MazInput",
|
|
24
|
+
props: {
|
|
25
|
+
style: { type: [String, Array, Object], default: void 0 },
|
|
26
|
+
class: { type: String, default: void 0 },
|
|
27
|
+
modelValue: {
|
|
28
|
+
type: [String, Number, Boolean],
|
|
29
|
+
default: void 0
|
|
30
|
+
},
|
|
31
|
+
placeholder: { type: String, default: void 0 },
|
|
32
|
+
color: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: "primary"
|
|
35
|
+
},
|
|
36
|
+
label: { type: String, default: void 0 },
|
|
37
|
+
name: { type: String, default: "input" },
|
|
38
|
+
type: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "text",
|
|
41
|
+
validator: (e) => [
|
|
42
|
+
"text",
|
|
43
|
+
"date",
|
|
44
|
+
"number",
|
|
45
|
+
"tel",
|
|
46
|
+
"search",
|
|
47
|
+
"url",
|
|
48
|
+
"password",
|
|
49
|
+
"month",
|
|
50
|
+
"time",
|
|
51
|
+
"week",
|
|
52
|
+
"email"
|
|
53
|
+
].includes(e)
|
|
54
|
+
},
|
|
55
|
+
required: { type: Boolean, default: !1 },
|
|
56
|
+
disabled: { type: Boolean, default: !1 },
|
|
57
|
+
readonly: { type: Boolean, default: !1 },
|
|
58
|
+
id: { type: String, default: void 0 },
|
|
59
|
+
error: { type: Boolean, default: !1 },
|
|
60
|
+
success: { type: Boolean, default: !1 },
|
|
61
|
+
warning: { type: Boolean, default: !1 },
|
|
62
|
+
hint: { type: String, default: void 0 },
|
|
63
|
+
inputClasses: { type: String, default: void 0 },
|
|
64
|
+
noBorder: { type: Boolean, default: !1 },
|
|
65
|
+
noRadius: { type: Boolean, default: !1 },
|
|
66
|
+
size: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: "md",
|
|
69
|
+
validator: (e) => ["mini", "xs", "sm", "md", "lg", "xl"].includes(e)
|
|
70
|
+
},
|
|
71
|
+
debounce: { type: Boolean, default: !1 },
|
|
72
|
+
debounceDelay: { type: Number, default: 500 },
|
|
73
|
+
validButton: { type: Boolean, default: !1 },
|
|
74
|
+
validButtonLoading: { type: Boolean, default: !1 },
|
|
75
|
+
autoFocus: { type: Boolean, default: !1 },
|
|
76
|
+
borderActive: { type: Boolean, default: !1 },
|
|
77
|
+
leftIcon: { type: String, default: void 0 },
|
|
78
|
+
rightIcon: { type: String, default: void 0 }
|
|
79
|
+
},
|
|
80
|
+
emits: ["focus", "blur", "update:model-value", "click", "change", "update"],
|
|
81
|
+
setup(e, { emit: n }) {
|
|
82
|
+
const o = w(() => import("./MazBtn-555928ed.mjs")), l = w(() => import("./MazIcon-52a76873.mjs")), g = w(() => import("./eye-slash-fa42a017.mjs")), f = w(() => import("./eye-dc12ce09.mjs")), k = w(() => import("./check-c9b483c0.mjs")), t = e, p = n, h = B(!1), z = B(!1), s = B(), r = ee(), d = ce({
|
|
83
|
+
componentName: "MazInput",
|
|
84
|
+
instance: r,
|
|
85
|
+
providedId: t.id
|
|
86
|
+
});
|
|
87
|
+
te(() => {
|
|
88
|
+
var a;
|
|
89
|
+
t.autoFocus && ((a = s.value) == null || a.focus());
|
|
90
|
+
});
|
|
91
|
+
const S = u(() => t.class), C = u(() => t.type === "password"), J = u(() => h.value ? "text" : t.type), U = u(() => {
|
|
92
|
+
if (!t.noBorder) {
|
|
93
|
+
if (t.error)
|
|
94
|
+
return "maz-border-danger";
|
|
95
|
+
if (t.success)
|
|
96
|
+
return "maz-border-success";
|
|
97
|
+
if (t.warning)
|
|
98
|
+
return "maz-border-warning";
|
|
99
|
+
if (z.value || t.borderActive) {
|
|
100
|
+
if (t.color === "black")
|
|
101
|
+
return "maz-border-black";
|
|
102
|
+
if (t.color === "danger")
|
|
103
|
+
return "maz-border-danger";
|
|
104
|
+
if (t.color === "info")
|
|
105
|
+
return "maz-border-info";
|
|
106
|
+
if (t.color === "primary")
|
|
107
|
+
return "maz-border-primary";
|
|
108
|
+
if (t.color === "secondary")
|
|
109
|
+
return "maz-border-secondary";
|
|
110
|
+
if (t.color === "success")
|
|
111
|
+
return "maz-border-success";
|
|
112
|
+
if (t.color === "warning")
|
|
113
|
+
return "maz-border-warning";
|
|
114
|
+
if (t.color === "white")
|
|
115
|
+
return "maz-border-white";
|
|
116
|
+
}
|
|
117
|
+
return "--default-border";
|
|
118
|
+
}
|
|
119
|
+
}), M = ae(), K = u(() => {
|
|
120
|
+
const { required: a, placeholder: c } = t;
|
|
121
|
+
if (c)
|
|
122
|
+
return a ? `${c} *` : c;
|
|
123
|
+
}), R = u(() => t.modelValue !== void 0 && t.modelValue !== ""), A = u({
|
|
124
|
+
get: () => t.modelValue,
|
|
125
|
+
set: (a) => _(a)
|
|
126
|
+
}), j = u(() => (!!t.label || !!t.hint) && (z.value || !!R.value || !!t.placeholder || ["date", "month", "week"].includes(t.type))), G = u(() => !!t.label || !!t.hint), H = () => !!M["right-icon"] || C.value || !!M["valid-button"] || t.validButton || !!t.rightIcon, X = () => !!M["left-icon"] || !!t.leftIcon, Q = (a) => {
|
|
127
|
+
p("focus", a), z.value = !0;
|
|
128
|
+
}, W = (a) => {
|
|
129
|
+
p("blur", a), z.value = !1;
|
|
130
|
+
}, Y = (a) => p("change", a), Z = de((a) => {
|
|
131
|
+
p("update:model-value", a);
|
|
132
|
+
}, t.debounceDelay), _ = (a) => {
|
|
133
|
+
if (t.debounce)
|
|
134
|
+
return Z(a);
|
|
135
|
+
p("update:model-value", a);
|
|
136
|
+
};
|
|
137
|
+
return (a, c) => (i(), v(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
class: V(["m-input", [
|
|
141
|
+
{
|
|
142
|
+
"--is-focused": z.value || e.borderActive,
|
|
143
|
+
"--should-up": j.value,
|
|
144
|
+
"--has-label": G.value,
|
|
145
|
+
"--is-disabled": e.disabled,
|
|
146
|
+
"--is-readonly": e.readonly,
|
|
147
|
+
"--has-z-2": e.error || e.warning || e.success,
|
|
148
|
+
"--has-state": e.error || e.warning || e.success
|
|
149
|
+
},
|
|
150
|
+
S.value,
|
|
151
|
+
`--${e.color}`,
|
|
152
|
+
`--${e.size}`
|
|
153
|
+
]]),
|
|
154
|
+
style: le(e.style)
|
|
155
|
+
},
|
|
156
|
+
[
|
|
157
|
+
$(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
class: V(["m-input-wrapper", [e.inputClasses, U.value, { "maz-rounded": !e.noRadius }]])
|
|
161
|
+
},
|
|
162
|
+
[
|
|
163
|
+
X() ? (i(), v("div", me, [
|
|
164
|
+
a.$slots["left-icon"] || e.leftIcon ? T(a.$slots, "left-icon", { key: 0 }, () => [
|
|
165
|
+
b(m(l), {
|
|
166
|
+
name: e.leftIcon,
|
|
167
|
+
class: "maz-text-xl maz-text-muted"
|
|
168
|
+
}, null, 8, ["name"])
|
|
169
|
+
], !0) : y("v-if", !0)
|
|
170
|
+
])) : y("v-if", !0),
|
|
171
|
+
$("div", fe, [
|
|
172
|
+
re($("input", D({
|
|
173
|
+
id: m(d),
|
|
174
|
+
ref_key: "input",
|
|
175
|
+
ref: s,
|
|
176
|
+
"onUpdate:modelValue": c[0] || (c[0] = (I) => A.value = I),
|
|
177
|
+
type: J.value,
|
|
178
|
+
name: e.name
|
|
179
|
+
}, a.$attrs, {
|
|
180
|
+
placeholder: K.value,
|
|
181
|
+
"aria-label": e.label || e.placeholder,
|
|
182
|
+
disabled: e.disabled,
|
|
183
|
+
readonly: e.readonly,
|
|
184
|
+
required: e.required,
|
|
185
|
+
class: "m-input-input"
|
|
186
|
+
}, ne({
|
|
187
|
+
blur: W,
|
|
188
|
+
focus: Q,
|
|
189
|
+
change: Y
|
|
190
|
+
}, !0), {
|
|
191
|
+
onClick: c[1] || (c[1] = (I) => a.$emit("click", I))
|
|
192
|
+
}), null, 16, ve), [
|
|
193
|
+
[oe, A.value]
|
|
194
|
+
]),
|
|
195
|
+
e.label || e.hint ? (i(), v(
|
|
196
|
+
"span",
|
|
197
|
+
{
|
|
198
|
+
key: 0,
|
|
199
|
+
ref: "label",
|
|
200
|
+
class: V(["m-input-label", [
|
|
201
|
+
{
|
|
202
|
+
"maz-text-danger-600": e.error,
|
|
203
|
+
"maz-text-success-600": e.success,
|
|
204
|
+
"maz-text-warning-600": e.warning
|
|
205
|
+
}
|
|
206
|
+
]])
|
|
207
|
+
},
|
|
208
|
+
[
|
|
209
|
+
F(
|
|
210
|
+
L(e.hint || e.label) + " ",
|
|
211
|
+
1
|
|
212
|
+
/* TEXT */
|
|
213
|
+
),
|
|
214
|
+
e.required ? (i(), v("sup", ye, "*")) : y("v-if", !0)
|
|
215
|
+
],
|
|
216
|
+
2
|
|
217
|
+
/* CLASS */
|
|
218
|
+
)) : y("v-if", !0)
|
|
219
|
+
]),
|
|
220
|
+
H() ? (i(), v("div", be, [
|
|
221
|
+
a.$slots["right-icon"] || e.rightIcon ? T(a.$slots, "right-icon", { key: 0 }, () => [
|
|
222
|
+
b(m(l), {
|
|
223
|
+
name: e.rightIcon,
|
|
224
|
+
class: "maz-text-xl maz-text-muted"
|
|
225
|
+
}, null, 8, ["name"])
|
|
226
|
+
], !0) : y("v-if", !0),
|
|
227
|
+
C.value ? (i(), N(m(o), {
|
|
228
|
+
key: 1,
|
|
229
|
+
color: "transparent",
|
|
230
|
+
tabindex: "-1",
|
|
231
|
+
size: "mini",
|
|
232
|
+
onClick: c[2] || (c[2] = P((I) => h.value = !h.value, ["stop"]))
|
|
233
|
+
}, {
|
|
234
|
+
default: x(() => [
|
|
235
|
+
h.value ? (i(), N(m(g), {
|
|
236
|
+
key: 0,
|
|
237
|
+
class: "maz-text-xl maz-text-muted"
|
|
238
|
+
})) : (i(), N(m(f), {
|
|
239
|
+
key: 1,
|
|
240
|
+
class: "maz-text-xl maz-text-muted"
|
|
241
|
+
}))
|
|
242
|
+
]),
|
|
243
|
+
_: 1
|
|
244
|
+
/* STABLE */
|
|
245
|
+
})) : y("v-if", !0),
|
|
246
|
+
a.$slots["valid-button"] || e.validButton ? T(a.$slots, "valid-button", { key: 2 }, () => [
|
|
247
|
+
b(m(o), {
|
|
248
|
+
color: "transparent",
|
|
249
|
+
disabled: e.disabled,
|
|
250
|
+
tabindex: "-1",
|
|
251
|
+
loading: e.validButtonLoading,
|
|
252
|
+
class: "m-input-valid-button",
|
|
253
|
+
size: "mini",
|
|
254
|
+
type: "submit"
|
|
255
|
+
}, {
|
|
256
|
+
default: x(() => [
|
|
257
|
+
b(m(k), { class: "maz-text-2xl maz-text-normal" })
|
|
258
|
+
]),
|
|
259
|
+
_: 1
|
|
260
|
+
/* STABLE */
|
|
261
|
+
}, 8, ["disabled", "loading"])
|
|
262
|
+
], !0) : y("v-if", !0)
|
|
263
|
+
])) : y("v-if", !0)
|
|
264
|
+
],
|
|
265
|
+
2
|
|
266
|
+
/* CLASS */
|
|
267
|
+
)
|
|
268
|
+
],
|
|
269
|
+
6
|
|
270
|
+
/* CLASS, STYLE */
|
|
271
|
+
));
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
const E = (e, n) => {
|
|
275
|
+
const o = e.__vccOpts || e;
|
|
276
|
+
for (const [l, g] of n)
|
|
277
|
+
o[l] = g;
|
|
278
|
+
return o;
|
|
279
|
+
}, pe = /* @__PURE__ */ E(ge, [["__scopeId", "data-v-32fa5093"]]), ze = {
|
|
280
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
281
|
+
width: "1em",
|
|
282
|
+
height: "1em",
|
|
283
|
+
fill: "none",
|
|
284
|
+
viewBox: "0 0 24 24"
|
|
285
|
+
}, he = /* @__PURE__ */ $(
|
|
286
|
+
"path",
|
|
287
|
+
{
|
|
288
|
+
stroke: "currentColor",
|
|
289
|
+
"stroke-linecap": "round",
|
|
290
|
+
"stroke-linejoin": "round",
|
|
291
|
+
"stroke-width": "1.5",
|
|
292
|
+
d: "M6 18 18 6M6 6l12 12"
|
|
293
|
+
},
|
|
294
|
+
null,
|
|
295
|
+
-1
|
|
296
|
+
/* HOISTED */
|
|
297
|
+
), we = [
|
|
298
|
+
he
|
|
299
|
+
];
|
|
300
|
+
function ke(e, n) {
|
|
301
|
+
return i(), v("svg", ze, [...we]);
|
|
302
|
+
}
|
|
303
|
+
const Be = { render: ke }, xe = /* @__PURE__ */ O({
|
|
304
|
+
__name: "MazInputTags",
|
|
305
|
+
props: {
|
|
306
|
+
// Input value, can be a `Array` of `String` or `null`
|
|
307
|
+
modelValue: {
|
|
308
|
+
type: Array,
|
|
309
|
+
default: void 0
|
|
310
|
+
},
|
|
311
|
+
// input placeholder
|
|
312
|
+
placeholder: { type: String, default: void 0 },
|
|
313
|
+
label: { type: String, default: void 0 },
|
|
314
|
+
// When is `true` the input is disable
|
|
315
|
+
disabled: { type: Boolean, default: !1 },
|
|
316
|
+
// When is `true` the input has the error style (red)
|
|
317
|
+
error: { type: Boolean, default: !1 },
|
|
318
|
+
success: { type: Boolean, default: !1 },
|
|
319
|
+
warning: { type: Boolean, default: !1 },
|
|
320
|
+
size: {
|
|
321
|
+
type: String,
|
|
322
|
+
default: "md",
|
|
323
|
+
validator: (e) => ["mini", "xs", "sm", "md", "lg", "xl"].includes(e)
|
|
324
|
+
},
|
|
325
|
+
color: {
|
|
326
|
+
type: String,
|
|
327
|
+
default: "primary"
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
emits: ["update:model-value"],
|
|
331
|
+
setup(e, { emit: n }) {
|
|
332
|
+
const o = w(() => import("./MazBtn-555928ed.mjs")), l = e, g = B(!1), f = B(), k = n, t = (s) => {
|
|
333
|
+
if (f.value) {
|
|
334
|
+
s.preventDefault();
|
|
335
|
+
const r = f.value.trim().split(",").map((d) => d.trim() === "," ? void 0 : d.trim()).filter(Boolean);
|
|
336
|
+
k("update:model-value", l.modelValue ? [...l.modelValue, ...r] : [...r]), f.value = void 0;
|
|
337
|
+
}
|
|
338
|
+
}, p = u(() => {
|
|
339
|
+
if (l.error)
|
|
340
|
+
return "maz-border-danger";
|
|
341
|
+
if (l.success)
|
|
342
|
+
return "maz-border-success";
|
|
343
|
+
if (l.warning)
|
|
344
|
+
return "maz-border-warning";
|
|
345
|
+
if (g.value) {
|
|
346
|
+
if (l.color === "primary")
|
|
347
|
+
return "maz-border-primary";
|
|
348
|
+
if (l.color === "secondary")
|
|
349
|
+
return "maz-border-secondary";
|
|
350
|
+
if (l.color === "info")
|
|
351
|
+
return "maz-border-info";
|
|
352
|
+
if (l.color === "danger")
|
|
353
|
+
return "maz-border-danger";
|
|
354
|
+
if (l.color === "success")
|
|
355
|
+
return "maz-border-success";
|
|
356
|
+
if (l.color === "warning")
|
|
357
|
+
return "maz-border-warning";
|
|
358
|
+
if (l.color === "black")
|
|
359
|
+
return "maz-border-black";
|
|
360
|
+
if (l.color === "white")
|
|
361
|
+
return "maz-border-white";
|
|
362
|
+
}
|
|
363
|
+
return "maz-border-gray-200";
|
|
364
|
+
}), h = () => {
|
|
365
|
+
if (!f.value || f.value === "") {
|
|
366
|
+
const s = JSON.parse(JSON.stringify(l.modelValue));
|
|
367
|
+
s.pop(), k("update:model-value", s);
|
|
368
|
+
}
|
|
369
|
+
}, z = (s) => {
|
|
370
|
+
const r = JSON.parse(JSON.stringify(l.modelValue));
|
|
371
|
+
r.splice(s, 1), k("update:model-value", r);
|
|
372
|
+
};
|
|
373
|
+
return (s, r) => (i(), v(
|
|
374
|
+
"div",
|
|
375
|
+
{
|
|
376
|
+
class: V(["m-input-tags", [p.value, `--${e.color}`]]),
|
|
377
|
+
onFocusCapture: r[1] || (r[1] = (d) => g.value = !0),
|
|
378
|
+
onBlurCapture: r[2] || (r[2] = (d) => g.value = !1)
|
|
379
|
+
},
|
|
380
|
+
[
|
|
381
|
+
b(ie, { name: "maz-tags" }, {
|
|
382
|
+
default: x(() => [
|
|
383
|
+
(i(!0), v(
|
|
384
|
+
se,
|
|
385
|
+
null,
|
|
386
|
+
ue(e.modelValue, (d, S) => (i(), v("div", {
|
|
387
|
+
key: `tag-${S}`
|
|
388
|
+
}, [
|
|
389
|
+
b(m(o), {
|
|
390
|
+
class: "m-input-tags__tag",
|
|
391
|
+
disabled: e.disabled,
|
|
392
|
+
size: e.size,
|
|
393
|
+
color: e.color,
|
|
394
|
+
onClick: P((C) => z(S), ["stop"])
|
|
395
|
+
}, {
|
|
396
|
+
default: x(() => [
|
|
397
|
+
F(
|
|
398
|
+
L(d),
|
|
399
|
+
1
|
|
400
|
+
/* TEXT */
|
|
401
|
+
)
|
|
402
|
+
]),
|
|
403
|
+
"right-icon": x(() => [
|
|
404
|
+
b(m(Be), { class: "m-input-tags__tag__icon" })
|
|
405
|
+
]),
|
|
406
|
+
_: 2
|
|
407
|
+
/* DYNAMIC */
|
|
408
|
+
}, 1032, ["disabled", "size", "color", "onClick"])
|
|
409
|
+
]))),
|
|
410
|
+
128
|
|
411
|
+
/* KEYED_FRAGMENT */
|
|
412
|
+
))
|
|
413
|
+
]),
|
|
414
|
+
_: 1
|
|
415
|
+
/* STABLE */
|
|
416
|
+
}),
|
|
417
|
+
b(pe, D({
|
|
418
|
+
key: "input-tags",
|
|
419
|
+
modelValue: f.value,
|
|
420
|
+
"onUpdate:modelValue": r[0] || (r[0] = (d) => f.value = d)
|
|
421
|
+
}, s.$attrs, {
|
|
422
|
+
placeholder: e.placeholder,
|
|
423
|
+
label: e.label,
|
|
424
|
+
"aria-label": e.label || e.placeholder,
|
|
425
|
+
error: e.error,
|
|
426
|
+
disabled: e.disabled,
|
|
427
|
+
color: e.color,
|
|
428
|
+
size: e.size,
|
|
429
|
+
"no-border": "",
|
|
430
|
+
class: "m-input-tags__input maz-flex-1",
|
|
431
|
+
onKeydown: [
|
|
432
|
+
q(t, ["enter"]),
|
|
433
|
+
q(h, ["delete"])
|
|
434
|
+
]
|
|
435
|
+
}), null, 16, ["modelValue", "placeholder", "label", "aria-label", "error", "disabled", "color", "size", "onKeydown"])
|
|
436
|
+
],
|
|
437
|
+
34
|
|
438
|
+
/* CLASS, HYDRATE_EVENTS */
|
|
439
|
+
));
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
const Ve = /* @__PURE__ */ E(xe, [["__scopeId", "data-v-82c91368"]]);
|
|
443
|
+
export {
|
|
444
|
+
Ve as M,
|
|
445
|
+
E as _
|
|
446
|
+
};
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var f = (a, e, t) => e in a ? u(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var i = (a, e, t) => (f(a, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
import "../assets/MazLazyImg.css";
|
|
5
|
+
import { defineComponent as v, defineAsyncComponent as p, computed as A, withDirectives as I, openBlock as d, createElementBlock as c, normalizeClass as b, Fragment as y, renderList as C, createElementVNode as E, mergeProps as L, createVNode as O, unref as h, createCommentVNode as z, renderSlot as P } from "vue";
|
|
6
|
+
const w = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", B = {
|
|
7
|
+
baseClass: "m-lazy-img",
|
|
8
|
+
loadedClass: "m-lazy-loaded",
|
|
9
|
+
loadingClass: "m-lazy-loading",
|
|
10
|
+
errorClass: "m-lazy-error",
|
|
11
|
+
noPhotoClass: "m-lazy-no-photo",
|
|
12
|
+
noPhoto: !1,
|
|
13
|
+
observerOnce: !0,
|
|
14
|
+
loadOnce: !1,
|
|
15
|
+
noUseErrorPhoto: !1,
|
|
16
|
+
observerOptions: {
|
|
17
|
+
threshold: 0.1
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
class S {
|
|
21
|
+
constructor(e = {}) {
|
|
22
|
+
i(this, "observers", []);
|
|
23
|
+
i(this, "defaultOptions", B);
|
|
24
|
+
i(this, "options");
|
|
25
|
+
i(this, "onImgLoadedCallback");
|
|
26
|
+
i(this, "onImgErrorCallback");
|
|
27
|
+
i(this, "hasImgLoaded", !1);
|
|
28
|
+
this.options = this.buildOptions(e), this.onImgLoadedCallback = this.imageIsLoaded.bind(this), this.onImgErrorCallback = this.imageHasError.bind(this);
|
|
29
|
+
}
|
|
30
|
+
async loadErrorPhoto() {
|
|
31
|
+
const { default: e } = await import("./no-photography-4c6c77cf.mjs");
|
|
32
|
+
return e;
|
|
33
|
+
}
|
|
34
|
+
buildOptions(e) {
|
|
35
|
+
return {
|
|
36
|
+
...this.defaultOptions,
|
|
37
|
+
...e,
|
|
38
|
+
observerOptions: {
|
|
39
|
+
...this.defaultOptions.observerOptions,
|
|
40
|
+
...e.observerOptions
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
removeClass(e, t) {
|
|
45
|
+
e.classList.remove(t);
|
|
46
|
+
}
|
|
47
|
+
addClass(e, t) {
|
|
48
|
+
e.classList.add(t);
|
|
49
|
+
}
|
|
50
|
+
removeAllStateClasses(e) {
|
|
51
|
+
this.removeClass(e, this.options.loadedClass), this.removeClass(e, this.options.loadingClass), this.removeClass(e, this.options.errorClass), this.removeClass(e, this.options.noPhotoClass);
|
|
52
|
+
}
|
|
53
|
+
setBaseClass(e) {
|
|
54
|
+
this.addClass(e, this.options.baseClass);
|
|
55
|
+
}
|
|
56
|
+
imageIsLoading(e) {
|
|
57
|
+
var t, s;
|
|
58
|
+
this.addClass(e, this.options.loadingClass), (s = (t = this.options).onLoading) == null || s.call(t, e);
|
|
59
|
+
}
|
|
60
|
+
imageHasNoPhoto(e) {
|
|
61
|
+
this.removeClass(e, this.options.loadingClass), this.addClass(e, this.options.noPhotoClass), this.setDefaultPhoto(e);
|
|
62
|
+
}
|
|
63
|
+
imageIsLoaded(e) {
|
|
64
|
+
var t, s;
|
|
65
|
+
this.hasImgLoaded = !0, this.removeClass(e, this.options.loadingClass), this.addClass(e, this.options.loadedClass), (s = (t = this.options).onLoaded) == null || s.call(t, e);
|
|
66
|
+
}
|
|
67
|
+
imageHasError(e, t) {
|
|
68
|
+
var s, o;
|
|
69
|
+
console.warn("[maz-ui][MazLazyImg] Error while loading image", t), this.removeClass(e, this.options.loadingClass), this.addClass(e, this.options.errorClass), (o = (s = this.options).onError) == null || o.call(s, e), this.setDefaultPhoto(e);
|
|
70
|
+
}
|
|
71
|
+
getImageUrl(e, t) {
|
|
72
|
+
const s = this.getImgElement(e).getAttribute("data-lazy-src");
|
|
73
|
+
if (s)
|
|
74
|
+
return s;
|
|
75
|
+
t.value;
|
|
76
|
+
const o = typeof t.value == "object" ? t.value.src : t.value;
|
|
77
|
+
return o || console.warn("[maz-ui][MazLazyImg] src url is not defined"), o;
|
|
78
|
+
}
|
|
79
|
+
async setPictureSourceUrls(e) {
|
|
80
|
+
const t = e.querySelectorAll("source");
|
|
81
|
+
if (t.length > 0)
|
|
82
|
+
for await (const s of t) {
|
|
83
|
+
const o = s.getAttribute("data-lazy-srcset");
|
|
84
|
+
o ? s.srcset = o : console.warn(
|
|
85
|
+
'[maz-ui][MazLazyImg] the "[data-lazy-srcset]" attribute is not provided on "<source />"'
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
else
|
|
89
|
+
console.warn(
|
|
90
|
+
'[maz-ui][MazLazyImg] No "<source />" elements provided into the "<picture />" element'
|
|
91
|
+
), this.imageHasError(e);
|
|
92
|
+
}
|
|
93
|
+
hasBgImgMode(e) {
|
|
94
|
+
return e.arg === "bg-image";
|
|
95
|
+
}
|
|
96
|
+
isPictureElement(e) {
|
|
97
|
+
return e instanceof HTMLPictureElement;
|
|
98
|
+
}
|
|
99
|
+
getImgElement(e) {
|
|
100
|
+
return this.isPictureElement(e) ? e.querySelector("img") : e;
|
|
101
|
+
}
|
|
102
|
+
async setDefaultPhoto(e) {
|
|
103
|
+
if (this.options.noUseErrorPhoto)
|
|
104
|
+
return;
|
|
105
|
+
const t = this.options.errorPhoto ?? await this.loadErrorPhoto(), s = e.querySelectorAll("source");
|
|
106
|
+
if (s.length > 0)
|
|
107
|
+
for await (const o of s)
|
|
108
|
+
o.srcset = t;
|
|
109
|
+
else
|
|
110
|
+
this.setImgSrc(e, t);
|
|
111
|
+
}
|
|
112
|
+
addEventListenerToImg(e) {
|
|
113
|
+
const t = this.getImgElement(e);
|
|
114
|
+
t.addEventListener("load", () => this.onImgLoadedCallback(e), {
|
|
115
|
+
once: !0
|
|
116
|
+
}), t.addEventListener("error", (s) => this.onImgErrorCallback(e, s), { once: !0 });
|
|
117
|
+
}
|
|
118
|
+
async loadImage(e, t) {
|
|
119
|
+
if (this.imageIsLoading(e), this.isPictureElement(e))
|
|
120
|
+
this.addEventListenerToImg(e), await this.setPictureSourceUrls(e);
|
|
121
|
+
else {
|
|
122
|
+
const s = this.getImageUrl(e, t);
|
|
123
|
+
if (!s)
|
|
124
|
+
return this.imageHasError(e);
|
|
125
|
+
this.hasBgImgMode(t) ? (e.style.backgroundImage = `url('${s}')`, this.imageIsLoaded(e)) : (this.addEventListenerToImg(e), this.setImgSrc(e, s));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
setImgSrc(e, t) {
|
|
129
|
+
const s = this.getImgElement(e);
|
|
130
|
+
s.src = t;
|
|
131
|
+
}
|
|
132
|
+
handleIntersectionObserver(e, t, s, o) {
|
|
133
|
+
var l, r;
|
|
134
|
+
this.observers.push(o);
|
|
135
|
+
for (const n of s)
|
|
136
|
+
if (n.isIntersecting) {
|
|
137
|
+
if ((r = (l = this.options).onIntersecting) == null || r.call(l, n.target), this.options.observerOnce && o.unobserve(e), this.options.loadOnce && this.hasImgLoaded)
|
|
138
|
+
return;
|
|
139
|
+
this.loadImage(e, t);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
createObserver(e, t) {
|
|
143
|
+
const s = (r, n) => {
|
|
144
|
+
this.handleIntersectionObserver(e, t, r, n);
|
|
145
|
+
}, o = this.options.observerOptions;
|
|
146
|
+
new IntersectionObserver(s, o).observe(e);
|
|
147
|
+
}
|
|
148
|
+
async imageHandler(e, t, s) {
|
|
149
|
+
if (s === "update")
|
|
150
|
+
for await (const o of this.observers)
|
|
151
|
+
o.unobserve(e);
|
|
152
|
+
window.IntersectionObserver ? this.createObserver(e, t) : this.loadImage(e, t);
|
|
153
|
+
}
|
|
154
|
+
async bindUpdateHandler(e, t, s) {
|
|
155
|
+
if (this.options.noPhoto)
|
|
156
|
+
return this.imageHasNoPhoto(e);
|
|
157
|
+
await this.imageHandler(e, t, s);
|
|
158
|
+
}
|
|
159
|
+
async add(e, t) {
|
|
160
|
+
if (this.hasBgImgMode(t) && this.isPictureElement(e))
|
|
161
|
+
throw new Error(`[MazLazyImg] You can't use the "bg-image" mode with "<picture />" element`);
|
|
162
|
+
setTimeout(() => this.setBaseClass(e), 0), e.getAttribute("src") || this.setImgSrc(e, w), await this.bindUpdateHandler(e, t, "bind");
|
|
163
|
+
}
|
|
164
|
+
async update(e, t) {
|
|
165
|
+
t.value !== t.oldValue && (this.hasImgLoaded = !1, this.removeAllStateClasses(e), await this.bindUpdateHandler(e, t, "update"));
|
|
166
|
+
}
|
|
167
|
+
remove(e, t) {
|
|
168
|
+
this.hasImgLoaded = !1, this.hasBgImgMode(t) && (e.style.backgroundImage = ""), this.removeAllStateClasses(e);
|
|
169
|
+
for (const s of this.observers)
|
|
170
|
+
s.unobserve(e);
|
|
171
|
+
this.observers = [];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
let m;
|
|
175
|
+
const H = {
|
|
176
|
+
created(a, e) {
|
|
177
|
+
const t = typeof e.value == "object" ? e.value : {};
|
|
178
|
+
m = new S(t), m.add(a, e);
|
|
179
|
+
},
|
|
180
|
+
updated(a, e) {
|
|
181
|
+
m.update(a, e);
|
|
182
|
+
},
|
|
183
|
+
unmounted(a, e) {
|
|
184
|
+
m.remove(a, e);
|
|
185
|
+
}
|
|
186
|
+
}, M = ["data-lazy-srcset", "media"], k = ["alt"], U = {
|
|
187
|
+
key: 0,
|
|
188
|
+
class: "m-lazy-img-component-loader"
|
|
189
|
+
}, T = /* @__PURE__ */ v({
|
|
190
|
+
__name: "MazLazyImg",
|
|
191
|
+
props: {
|
|
192
|
+
image: { type: [String, Object], default: void 0 },
|
|
193
|
+
alt: { type: String, default: void 0 },
|
|
194
|
+
noPhoto: { type: Boolean, default: !1 },
|
|
195
|
+
noLoader: { type: Boolean, default: !1 },
|
|
196
|
+
noObserverOnce: { type: Boolean, default: !1 },
|
|
197
|
+
loadOnce: { type: Boolean, default: !1 },
|
|
198
|
+
imageHeightFull: { type: Boolean, default: !1 },
|
|
199
|
+
observerOptions: { type: Object, default: null }
|
|
200
|
+
},
|
|
201
|
+
emits: ["intersecting", "loading", "loaded", "error"],
|
|
202
|
+
setup(a) {
|
|
203
|
+
const e = p(() => import("./MazSpinner-a13a50c9.mjs")), t = a, s = A(() => {
|
|
204
|
+
var o;
|
|
205
|
+
return typeof t.image == "string" ? [{ srcset: t.image }] : (o = t.image) == null ? void 0 : o.sources;
|
|
206
|
+
});
|
|
207
|
+
return (o, l) => I((d(), c(
|
|
208
|
+
"picture",
|
|
209
|
+
{
|
|
210
|
+
class: b(["m-lazy-img-component", { "-use-loader": !a.noLoader, "--height-full": a.imageHeightFull }])
|
|
211
|
+
},
|
|
212
|
+
[
|
|
213
|
+
(d(!0), c(
|
|
214
|
+
y,
|
|
215
|
+
null,
|
|
216
|
+
C(s.value, ({ srcset: r, media: n }, g) => (d(), c("source", {
|
|
217
|
+
key: g,
|
|
218
|
+
"data-lazy-srcset": r,
|
|
219
|
+
media: n
|
|
220
|
+
}, null, 8, M))),
|
|
221
|
+
128
|
|
222
|
+
/* KEYED_FRAGMENT */
|
|
223
|
+
)),
|
|
224
|
+
E("img", L(o.$attrs, {
|
|
225
|
+
src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
226
|
+
loading: "lazy",
|
|
227
|
+
alt: a.alt
|
|
228
|
+
}), null, 16, k),
|
|
229
|
+
a.noLoader ? z("v-if", !0) : (d(), c("div", U, [
|
|
230
|
+
O(h(e), { size: "2em" })
|
|
231
|
+
])),
|
|
232
|
+
P(o.$slots, "default", {}, void 0, !0)
|
|
233
|
+
],
|
|
234
|
+
2
|
|
235
|
+
/* CLASS */
|
|
236
|
+
)), [
|
|
237
|
+
[h(H), {
|
|
238
|
+
noPhoto: a.noPhoto,
|
|
239
|
+
observerOnce: !a.noObserverOnce,
|
|
240
|
+
loadOnce: a.loadOnce,
|
|
241
|
+
onIntersecting: (r) => o.$emit("intersecting", r),
|
|
242
|
+
onLoading: (r) => o.$emit("loading", r),
|
|
243
|
+
onLoaded: (r) => o.$emit("loaded", r),
|
|
244
|
+
onError: (r) => o.$emit("error", r),
|
|
245
|
+
observerOptions: a.observerOptions
|
|
246
|
+
}]
|
|
247
|
+
]);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
const _ = (a, e) => {
|
|
251
|
+
const t = a.__vccOpts || a;
|
|
252
|
+
for (const [s, o] of e)
|
|
253
|
+
t[s] = o;
|
|
254
|
+
return t;
|
|
255
|
+
}, j = /* @__PURE__ */ _(T, [["__scopeId", "data-v-3bfe9795"]]);
|
|
256
|
+
export {
|
|
257
|
+
j as M,
|
|
258
|
+
_
|
|
259
|
+
};
|