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
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import "../assets/MazPickerTime.css";
|
|
2
|
-
import { defineComponent, ref, computed, watch, nextTick, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createElementVNode, normalizeStyle, createBlock, withModifiers, withCtx, createTextVNode, toDisplayString } from "vue";
|
|
3
|
-
import { d as dayjs, f as findNearestNumberInList, s as scrollToTarget, _ as _export_sfc } from "./MazPicker-50fc11d1.mjs";
|
|
4
|
-
import MazBtn from "./MazBtn-0e02f0da.mjs";
|
|
5
|
-
const _hoisted_1 = { class: "m-picker-time__column__items" };
|
|
6
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
-
__name: "MazPickerTime",
|
|
8
|
-
props: {
|
|
9
|
-
modelValue: {
|
|
10
|
-
type: [String, Object],
|
|
11
|
-
default: void 0
|
|
12
|
-
},
|
|
13
|
-
calendarDate: { type: String, required: true },
|
|
14
|
-
formatterOptions: {
|
|
15
|
-
type: Object,
|
|
16
|
-
required: true
|
|
17
|
-
},
|
|
18
|
-
locale: { type: String, required: true },
|
|
19
|
-
color: { type: String, required: true },
|
|
20
|
-
isOpen: { type: Boolean, required: true },
|
|
21
|
-
hasDate: { type: Boolean, required: true },
|
|
22
|
-
minuteInterval: { type: Number, required: true },
|
|
23
|
-
disabledHours: { type: Array, default: void 0 },
|
|
24
|
-
format: { type: String, required: true },
|
|
25
|
-
isHour12: { type: Boolean, required: true },
|
|
26
|
-
minDate: { type: String, default: void 0 },
|
|
27
|
-
maxDate: { type: String, default: void 0 },
|
|
28
|
-
disabled: { type: Boolean, required: true }
|
|
29
|
-
},
|
|
30
|
-
emits: ["update:model-value"],
|
|
31
|
-
setup(__props, { emit: __emit }) {
|
|
32
|
-
const props = __props;
|
|
33
|
-
const findNearestHour = (hour) => {
|
|
34
|
-
if (!props.disabledHours) {
|
|
35
|
-
return hour;
|
|
36
|
-
}
|
|
37
|
-
const hourList = Array.from({ length: 24 }, (_v, i) => i).filter(
|
|
38
|
-
(hour2) => {
|
|
39
|
-
var _a;
|
|
40
|
-
return !((_a = props.disabledHours) == null ? void 0 : _a.includes(hour2));
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
const nearHour = findNearestNumberInList(hourList, hour);
|
|
44
|
-
if (nearHour !== hour) {
|
|
45
|
-
selectTime("hour", dayjs(currentDate.value).set("hour", nearHour));
|
|
46
|
-
}
|
|
47
|
-
return nearHour;
|
|
48
|
-
};
|
|
49
|
-
const emits = __emit;
|
|
50
|
-
const MazPickerTime2 = ref();
|
|
51
|
-
const dividerHeight = ref();
|
|
52
|
-
const currentHour = computed(() => {
|
|
53
|
-
return typeof currentDate.value === "string" ? findNearestHour(dayjs(currentDate.value).get("hour")) : void 0;
|
|
54
|
-
});
|
|
55
|
-
const currentMinute = computed(
|
|
56
|
-
() => typeof currentDate.value === "string" ? findNearestNumberInList(
|
|
57
|
-
minutes.value.map(({ value }) => value.get("minute")),
|
|
58
|
-
dayjs(currentDate.value).get("minute")
|
|
59
|
-
) : void 0
|
|
60
|
-
);
|
|
61
|
-
const getHour12or24 = (hourValue) => {
|
|
62
|
-
if (props.isHour12) {
|
|
63
|
-
const isPm = currentAmpm.value === "pm";
|
|
64
|
-
const newValue = isPm ? hourValue + 12 : hourValue;
|
|
65
|
-
return newValue === 12 ? 0 : newValue === 24 ? 12 : newValue;
|
|
66
|
-
} else {
|
|
67
|
-
return hourValue;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
const hours = computed(() => {
|
|
71
|
-
return Array.from({ length: props.isHour12 ? 12 : 24 }, (_v, i) => i).map((hour) => {
|
|
72
|
-
const hourBase = hour + (props.isHour12 ? 1 : 0);
|
|
73
|
-
const hour12or24 = getHour12or24(hourBase);
|
|
74
|
-
const hourValue = dayjs(currentDate.value).set("hour", hour12or24);
|
|
75
|
-
const isDisabled = isDisableHour(hour12or24) || (props.minDate && currentDate.value ? dayjs(props.minDate).isAfter(hourValue, "hour") : false) || (props.maxDate && currentDate.value ? dayjs(props.maxDate).isBefore(hourValue, "hour") : false);
|
|
76
|
-
return {
|
|
77
|
-
label: `${hourBase < 10 ? "0" : ""}${hourBase}`,
|
|
78
|
-
value: dayjs(currentDate.value).set("hour", hour12or24),
|
|
79
|
-
isDisabled
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
const minutes = computed(() => {
|
|
84
|
-
const length = Math.floor(60 / props.minuteInterval) - 0;
|
|
85
|
-
return Array.from({ length }, (_v, i) => i * props.minuteInterval).map((minute) => {
|
|
86
|
-
const minuteValue = dayjs(currentDate.value).set("minute", minute);
|
|
87
|
-
const isDisabled = (props.minDate && currentDate.value ? dayjs(props.minDate).isAfter(minuteValue, "minute") : false) || (props.maxDate && currentDate.value ? dayjs(props.maxDate).isBefore(minuteValue, "minute") : false);
|
|
88
|
-
return {
|
|
89
|
-
label: `${minute < 10 ? "0" : ""}${minute}`,
|
|
90
|
-
value: minuteValue,
|
|
91
|
-
isDisabled
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
const currentAmpm = computed(() => {
|
|
96
|
-
return typeof currentHour.value === "number" ? currentHour.value >= 12 ? "pm" : "am" : void 0;
|
|
97
|
-
});
|
|
98
|
-
const ampm = computed(
|
|
99
|
-
() => props.isHour12 ? [
|
|
100
|
-
{ label: "AM", value: "am" },
|
|
101
|
-
{ label: "PM", value: "pm" }
|
|
102
|
-
] : []
|
|
103
|
-
);
|
|
104
|
-
const columns = computed(() => {
|
|
105
|
-
const columns2 = [
|
|
106
|
-
{
|
|
107
|
-
identifier: "hour",
|
|
108
|
-
values: hours.value
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
identifier: "minute",
|
|
112
|
-
values: minutes.value
|
|
113
|
-
}
|
|
114
|
-
];
|
|
115
|
-
if (props.isHour12) {
|
|
116
|
-
columns2.push({
|
|
117
|
-
identifier: "ampm",
|
|
118
|
-
values: ampm.value
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return columns2;
|
|
122
|
-
});
|
|
123
|
-
const currentDate = computed({
|
|
124
|
-
get: () => props.modelValue,
|
|
125
|
-
set: (value) => {
|
|
126
|
-
emits("update:model-value", value);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
watch(
|
|
130
|
-
() => props.isOpen,
|
|
131
|
-
async (value) => {
|
|
132
|
-
var _a;
|
|
133
|
-
if (value) {
|
|
134
|
-
await nextTick();
|
|
135
|
-
if (MazPickerTime2.value) {
|
|
136
|
-
const item = MazPickerTime2.value.querySelector(
|
|
137
|
-
`.m-picker-time__column .m-btn`
|
|
138
|
-
);
|
|
139
|
-
const itemHeight = item == null ? void 0 : item.offsetHeight;
|
|
140
|
-
const timePickerHeight = (_a = MazPickerTime2.value) == null ? void 0 : _a.offsetHeight;
|
|
141
|
-
const divHeight = timePickerHeight / 2 - itemHeight / 2;
|
|
142
|
-
dividerHeight.value = divHeight / 16;
|
|
143
|
-
}
|
|
144
|
-
scrollColumns(false);
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
{ immediate: true }
|
|
148
|
-
);
|
|
149
|
-
watch(
|
|
150
|
-
() => props.modelValue,
|
|
151
|
-
async (value, oldValue) => {
|
|
152
|
-
if (value !== oldValue) {
|
|
153
|
-
await nextTick();
|
|
154
|
-
scrollColumns(true);
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
{ immediate: true }
|
|
158
|
-
);
|
|
159
|
-
const scrollColumns = (hasSmoothEffect) => {
|
|
160
|
-
scrollColumn("hour", hasSmoothEffect);
|
|
161
|
-
scrollColumn("minute", hasSmoothEffect);
|
|
162
|
-
if (props.isHour12) {
|
|
163
|
-
scrollColumn("ampm", hasSmoothEffect);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
const isDisableHour = (value) => {
|
|
167
|
-
return (props.disabledHours && props.disabledHours.includes(value)) ?? false;
|
|
168
|
-
};
|
|
169
|
-
const isSelected = (identifier, value) => {
|
|
170
|
-
if (value === "am" || value === "pm") {
|
|
171
|
-
return currentAmpm.value === value;
|
|
172
|
-
} else if (identifier === "hour") {
|
|
173
|
-
return currentHour.value === value.get(identifier);
|
|
174
|
-
} else if (identifier === "minute") {
|
|
175
|
-
return currentMinute.value === value.get(identifier);
|
|
176
|
-
}
|
|
177
|
-
return false;
|
|
178
|
-
};
|
|
179
|
-
const scrollColumn = async (identifier, hasSmoothEffect = true) => {
|
|
180
|
-
if (MazPickerTime2.value) {
|
|
181
|
-
const column = MazPickerTime2.value.querySelector(`.m-picker-time__column__${identifier}`);
|
|
182
|
-
const selectedButton = MazPickerTime2.value.querySelector(
|
|
183
|
-
`.m-picker-time__column__${identifier} .--is-selected`
|
|
184
|
-
);
|
|
185
|
-
if (dividerHeight.value && column && selectedButton && MazPickerTime2.value) {
|
|
186
|
-
await nextTick();
|
|
187
|
-
scrollToTarget(column, selectedButton, dividerHeight.value * 16, hasSmoothEffect);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
const selectTime = async (identifier, value) => {
|
|
192
|
-
const newDate = dayjs(currentDate.value);
|
|
193
|
-
if (identifier === "hour" && typeof value === "object") {
|
|
194
|
-
currentDate.value = newDate.set("hour", value.get("hour")).format();
|
|
195
|
-
}
|
|
196
|
-
if (identifier === "minute" && typeof value === "object") {
|
|
197
|
-
const dateWithNewMinute = newDate.set("minute", value.get("minute"));
|
|
198
|
-
currentDate.value = dateWithNewMinute.format();
|
|
199
|
-
}
|
|
200
|
-
if (identifier === "ampm" && (currentAmpm.value !== value || !currentHour.value)) {
|
|
201
|
-
if (value === "am") {
|
|
202
|
-
currentDate.value = newDate.set("hour", newDate.get("hour")).subtract(12, "hour").format();
|
|
203
|
-
}
|
|
204
|
-
if (value === "pm") {
|
|
205
|
-
const baseHour = newDate.get("hour");
|
|
206
|
-
const newHour = baseHour + 12 > 12 && baseHour + 12 < 24 ? baseHour + 12 : baseHour === 0 ? 12 : baseHour;
|
|
207
|
-
currentDate.value = newDate.set("hour", newHour).format();
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
await nextTick();
|
|
211
|
-
scrollColumn(identifier);
|
|
212
|
-
};
|
|
213
|
-
return (_ctx, _cache) => {
|
|
214
|
-
return openBlock(), createElementBlock(
|
|
215
|
-
"div",
|
|
216
|
-
{
|
|
217
|
-
ref_key: "MazPickerTime",
|
|
218
|
-
ref: MazPickerTime2,
|
|
219
|
-
class: normalizeClass(["m-picker-time", { "--has-date": __props.hasDate }])
|
|
220
|
-
},
|
|
221
|
-
[
|
|
222
|
-
(openBlock(true), createElementBlock(
|
|
223
|
-
Fragment,
|
|
224
|
-
null,
|
|
225
|
-
renderList(columns.value, ({ values, identifier }, i) => {
|
|
226
|
-
return openBlock(), createElementBlock(
|
|
227
|
-
"div",
|
|
228
|
-
{
|
|
229
|
-
key: i,
|
|
230
|
-
class: normalizeClass(["m-picker-time__column", [`m-picker-time__column__${identifier}`]])
|
|
231
|
-
},
|
|
232
|
-
[
|
|
233
|
-
createElementVNode(
|
|
234
|
-
"div",
|
|
235
|
-
{
|
|
236
|
-
style: normalizeStyle({ height: `${dividerHeight.value}rem` }),
|
|
237
|
-
class: "m-picker-time__column__divider"
|
|
238
|
-
},
|
|
239
|
-
null,
|
|
240
|
-
4
|
|
241
|
-
/* STYLE */
|
|
242
|
-
),
|
|
243
|
-
createElementVNode("div", _hoisted_1, [
|
|
244
|
-
(openBlock(true), createElementBlock(
|
|
245
|
-
Fragment,
|
|
246
|
-
null,
|
|
247
|
-
renderList(values, ({ value, label, isDisabled }, unitIndex) => {
|
|
248
|
-
return openBlock(), createBlock(MazBtn, {
|
|
249
|
-
key: unitIndex,
|
|
250
|
-
size: "xs",
|
|
251
|
-
color: isSelected(identifier, value) ? __props.color : "transparent",
|
|
252
|
-
class: normalizeClass({ "--is-selected": isSelected(identifier, value) }),
|
|
253
|
-
disabled: isDisabled || __props.disabled,
|
|
254
|
-
type: "button",
|
|
255
|
-
onClick: withModifiers(($event) => selectTime(identifier, value), ["stop"])
|
|
256
|
-
}, {
|
|
257
|
-
default: withCtx(() => [
|
|
258
|
-
createTextVNode(
|
|
259
|
-
toDisplayString(label),
|
|
260
|
-
1
|
|
261
|
-
/* TEXT */
|
|
262
|
-
)
|
|
263
|
-
]),
|
|
264
|
-
_: 2
|
|
265
|
-
/* DYNAMIC */
|
|
266
|
-
}, 1032, ["color", "class", "disabled", "onClick"]);
|
|
267
|
-
}),
|
|
268
|
-
128
|
|
269
|
-
/* KEYED_FRAGMENT */
|
|
270
|
-
))
|
|
271
|
-
]),
|
|
272
|
-
createElementVNode(
|
|
273
|
-
"div",
|
|
274
|
-
{
|
|
275
|
-
style: normalizeStyle({ height: `${dividerHeight.value}rem` }),
|
|
276
|
-
class: "m-picker-time__column__divider"
|
|
277
|
-
},
|
|
278
|
-
null,
|
|
279
|
-
4
|
|
280
|
-
/* STYLE */
|
|
281
|
-
)
|
|
282
|
-
],
|
|
283
|
-
2
|
|
284
|
-
/* CLASS */
|
|
285
|
-
);
|
|
286
|
-
}),
|
|
287
|
-
128
|
|
288
|
-
/* KEYED_FRAGMENT */
|
|
289
|
-
))
|
|
290
|
-
],
|
|
291
|
-
2
|
|
292
|
-
/* CLASS */
|
|
293
|
-
);
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
const MazPickerTime_vue_vue_type_style_index_0_scoped_3b0c1ed8_lang = "";
|
|
298
|
-
const MazPickerTime = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3b0c1ed8"]]);
|
|
299
|
-
export {
|
|
300
|
-
MazPickerTime as default
|
|
301
|
-
};
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import "../assets/MazPickerYearSwitcher.css";
|
|
2
|
-
import { defineComponent, ref, computed, openBlock, createElementBlock, createElementVNode, createVNode, withModifiers, withCtx, unref, Fragment, renderList, createBlock, normalizeClass, createTextVNode, toDisplayString } from "vue";
|
|
3
|
-
import { d as dayjs, a as date, i as isSameDate, _ as _export_sfc } from "./MazPicker-50fc11d1.mjs";
|
|
4
|
-
import MazBtn from "./MazBtn-0e02f0da.mjs";
|
|
5
|
-
import { X as XIcon } from "./x-mark-3b05101b.mjs";
|
|
6
|
-
import { C as ChevronLeftIcon } from "./MazPickerCalendar-cacb361c.mjs";
|
|
7
|
-
const _hoisted_1 = { class: "maz-picker-year-switcher" };
|
|
8
|
-
const _hoisted_2 = { class: "maz-picker-year-switcher__header" };
|
|
9
|
-
const _hoisted_3 = { class: "maz-flex maz-space-x-2" };
|
|
10
|
-
const _hoisted_4 = { class: "maz-picker-year-switcher__main" };
|
|
11
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
-
__name: "MazPickerYearSwitcher",
|
|
13
|
-
props: {
|
|
14
|
-
color: { type: String, required: true },
|
|
15
|
-
locale: { type: String, required: true },
|
|
16
|
-
calendarDate: { type: String, required: true }
|
|
17
|
-
},
|
|
18
|
-
emits: ["update:calendar-date", "close"],
|
|
19
|
-
setup(__props, { emit: __emit }) {
|
|
20
|
-
const props = __props;
|
|
21
|
-
const emits = __emit;
|
|
22
|
-
const currentDateTmp = ref(props.calendarDate);
|
|
23
|
-
const years = computed(() => {
|
|
24
|
-
return Array.from({ length: 15 }, (_v, i) => i - 7).map((yearNumber) => {
|
|
25
|
-
const currentYear = dayjs(currentDateTmp.value).get("year");
|
|
26
|
-
const dateYear = dayjs(currentDateTmp.value).set("year", currentYear + yearNumber);
|
|
27
|
-
return {
|
|
28
|
-
label: date(dateYear.format(), props.locale, {
|
|
29
|
-
year: "numeric"
|
|
30
|
-
}),
|
|
31
|
-
date: dateYear
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
const selectYear = (date2) => {
|
|
36
|
-
emits("update:calendar-date", dayjs(date2).format());
|
|
37
|
-
emits("close");
|
|
38
|
-
};
|
|
39
|
-
const previousYears = () => {
|
|
40
|
-
currentDateTmp.value = dayjs(currentDateTmp.value).subtract(7, "year").format();
|
|
41
|
-
};
|
|
42
|
-
const nextYears = () => {
|
|
43
|
-
currentDateTmp.value = dayjs(currentDateTmp.value).add(7, "year").format();
|
|
44
|
-
};
|
|
45
|
-
return (_ctx, _cache) => {
|
|
46
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
47
|
-
createElementVNode("div", _hoisted_2, [
|
|
48
|
-
createElementVNode("div", _hoisted_3, [
|
|
49
|
-
createVNode(MazBtn, {
|
|
50
|
-
size: "xs",
|
|
51
|
-
color: "transparent",
|
|
52
|
-
type: "button",
|
|
53
|
-
onClick: withModifiers(previousYears, ["stop"])
|
|
54
|
-
}, {
|
|
55
|
-
default: withCtx(() => [
|
|
56
|
-
createVNode(unref(ChevronLeftIcon), { class: "maz-text-lg" })
|
|
57
|
-
]),
|
|
58
|
-
_: 1
|
|
59
|
-
/* STABLE */
|
|
60
|
-
}, 8, ["onClick"]),
|
|
61
|
-
createVNode(MazBtn, {
|
|
62
|
-
size: "xs",
|
|
63
|
-
color: "transparent",
|
|
64
|
-
type: "button",
|
|
65
|
-
onClick: withModifiers(nextYears, ["stop"])
|
|
66
|
-
}, {
|
|
67
|
-
default: withCtx(() => [
|
|
68
|
-
createVNode(unref(ChevronLeftIcon), { class: "maz-rotate-180 maz-text-lg" })
|
|
69
|
-
]),
|
|
70
|
-
_: 1
|
|
71
|
-
/* STABLE */
|
|
72
|
-
}, 8, ["onClick"])
|
|
73
|
-
]),
|
|
74
|
-
createVNode(MazBtn, {
|
|
75
|
-
size: "xs",
|
|
76
|
-
color: "transparent",
|
|
77
|
-
type: "button",
|
|
78
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.$emit("close", $event), ["stop"]))
|
|
79
|
-
}, {
|
|
80
|
-
default: withCtx(() => [
|
|
81
|
-
createVNode(unref(XIcon), { class: "maz-text-lg" })
|
|
82
|
-
]),
|
|
83
|
-
_: 1
|
|
84
|
-
/* STABLE */
|
|
85
|
-
})
|
|
86
|
-
]),
|
|
87
|
-
createElementVNode("div", _hoisted_4, [
|
|
88
|
-
(openBlock(true), createElementBlock(
|
|
89
|
-
Fragment,
|
|
90
|
-
null,
|
|
91
|
-
renderList(years.value, (year) => {
|
|
92
|
-
return openBlock(), createBlock(MazBtn, {
|
|
93
|
-
key: year.label,
|
|
94
|
-
size: "sm",
|
|
95
|
-
type: "button",
|
|
96
|
-
class: normalizeClass({
|
|
97
|
-
"--is-selected": unref(isSameDate)(year.date, __props.calendarDate, "year")
|
|
98
|
-
}),
|
|
99
|
-
color: unref(isSameDate)(year.date, __props.calendarDate, "year") ? __props.color : "transparent",
|
|
100
|
-
onClick: withModifiers(($event) => selectYear(year.date), ["stop"])
|
|
101
|
-
}, {
|
|
102
|
-
default: withCtx(() => [
|
|
103
|
-
createTextVNode(
|
|
104
|
-
toDisplayString(year.label),
|
|
105
|
-
1
|
|
106
|
-
/* TEXT */
|
|
107
|
-
)
|
|
108
|
-
]),
|
|
109
|
-
_: 2
|
|
110
|
-
/* DYNAMIC */
|
|
111
|
-
}, 1032, ["class", "color", "onClick"]);
|
|
112
|
-
}),
|
|
113
|
-
128
|
|
114
|
-
/* KEYED_FRAGMENT */
|
|
115
|
-
))
|
|
116
|
-
])
|
|
117
|
-
]);
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
const MazPickerYearSwitcher_vue_vue_type_style_index_0_scoped_698468b9_lang = "";
|
|
122
|
-
const MazPickerYearSwitcher = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-698468b9"]]);
|
|
123
|
-
export {
|
|
124
|
-
MazPickerYearSwitcher as default
|
|
125
|
-
};
|