nuxt-hs-ui 2.0.28 → 2.0.30
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/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -8,10 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
// [ node-modules ]
|
|
10
10
|
import dayjs from "dayjs/esm/index";
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
import { Japanese as ja } from "flatpickr/dist/l10n/ja";
|
|
14
|
-
// import { english as en } from "flatpickr/dist/l10n/default";
|
|
11
|
+
// flatpickr cdn 経由で使用する
|
|
12
|
+
// import flatpickr from "flatpickr";
|
|
15
13
|
// [ vueuse ]
|
|
16
14
|
import { useMounted } from "@vueuse/core";
|
|
17
15
|
// [ NUXT ]
|
|
@@ -27,6 +25,7 @@ import {
|
|
|
27
25
|
useHead,
|
|
28
26
|
} from "#imports";
|
|
29
27
|
// [ utils ]
|
|
28
|
+
import { Sleep } from "../../utils/com";
|
|
30
29
|
import type { ClassType } from "../../utils/class-style";
|
|
31
30
|
import { GetTimeShiftValue, Dayjs, DayjsInit } from "../../utils/dayjs";
|
|
32
31
|
// [ composables ]
|
|
@@ -40,6 +39,9 @@ import InputFrame from "./input-frame.vue";
|
|
|
40
39
|
useHead({
|
|
41
40
|
script: [
|
|
42
41
|
//
|
|
42
|
+
// https://npmcdn.com/flatpickr@4.6.13/dist/plugins/monthSelect/index.js
|
|
43
|
+
{ src: `https://npmcdn.com/flatpickr/dist/flatpickr.min.js` },
|
|
44
|
+
{ src: `https://npmcdn.com/flatpickr/dist/plugins/monthSelect` },
|
|
43
45
|
{ src: `https://npmcdn.com/flatpickr/dist/l10n/ja.js` },
|
|
44
46
|
{ src: `https://npmcdn.com/flatpickr/dist/l10n/default.js` },
|
|
45
47
|
],
|
|
@@ -57,7 +59,7 @@ const hsMisc = useHsMisc();
|
|
|
57
59
|
const isMounted = useMounted();
|
|
58
60
|
// ----------------------------------------------------------------------------
|
|
59
61
|
// flatpickr
|
|
60
|
-
const MonthSelectPlugin: any = monthSelectPlugin;
|
|
62
|
+
// const MonthSelectPlugin: any = monthSelectPlugin;
|
|
61
63
|
const timeDateFormat = "YYYY-MM-DD HH:mm:ss.SSS";
|
|
62
64
|
const timeOutputDateFormat = "HH:mm:ss.SSS";
|
|
63
65
|
const timeShowDateFormat = "HH:mm";
|
|
@@ -207,7 +209,7 @@ const state = reactive<State>({
|
|
|
207
209
|
date: null,
|
|
208
210
|
option: {
|
|
209
211
|
dateFormat: "Z",
|
|
210
|
-
locale: ja,
|
|
212
|
+
locale: "ja",
|
|
211
213
|
time_24hr: true,
|
|
212
214
|
minDate: undefined,
|
|
213
215
|
maxDate: undefined,
|
|
@@ -263,12 +265,11 @@ watch(
|
|
|
263
265
|
computed(() => {
|
|
264
266
|
return [props.minDate, props.maxDate, multiLang.state.lang];
|
|
265
267
|
}).value,
|
|
266
|
-
() => {
|
|
268
|
+
async () => {
|
|
267
269
|
// console.log('computed', props.minDate, props.maxDate, isMounted.value);
|
|
268
270
|
if (!isMounted.value) return;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}, 1);
|
|
271
|
+
await Sleep(1);
|
|
272
|
+
resetPicekr();
|
|
272
273
|
}
|
|
273
274
|
);
|
|
274
275
|
|
|
@@ -354,8 +355,9 @@ const initFlatPickerOption = () => {
|
|
|
354
355
|
state.option.disableMobile = true;
|
|
355
356
|
}
|
|
356
357
|
if (props.mode === "month") {
|
|
358
|
+
const monthSelectPlugin = (window as any).monthSelectPlugin;
|
|
357
359
|
state.option.plugins = [
|
|
358
|
-
new
|
|
360
|
+
new monthSelectPlugin({
|
|
359
361
|
shorthand: true, // デフォルトはfalse
|
|
360
362
|
dateFormat: "m.y", // デフォルトは"F Y"
|
|
361
363
|
altFormat: "F Y", // デフォルトは"F Y"
|
|
@@ -397,18 +399,17 @@ const generateFlatPickerOption = () => {
|
|
|
397
399
|
if (inputElement.value != null) {
|
|
398
400
|
dayjs.locale(multiLang.state.lang);
|
|
399
401
|
switch (multiLang.state.lang) {
|
|
402
|
+
case "jp":
|
|
400
403
|
case "ja":
|
|
401
404
|
state.option.locale = "ja";
|
|
402
405
|
break;
|
|
403
|
-
case "en":
|
|
404
|
-
state.option.locale = "en";
|
|
405
|
-
break;
|
|
406
406
|
default:
|
|
407
407
|
state.option.locale = "en";
|
|
408
408
|
break;
|
|
409
409
|
}
|
|
410
410
|
// state.option.position = 'above';
|
|
411
411
|
// state.option.static = true;
|
|
412
|
+
const flatpickr = (window as any).flatpickr;
|
|
412
413
|
state.picker = flatpickr(inputElement.value, state.option);
|
|
413
414
|
state.picker.config.onChange.push(onChange);
|
|
414
415
|
state.picker.config.onOpen.push(onOpen);
|
|
@@ -624,11 +625,15 @@ watch(computedActivate, (value) => {
|
|
|
624
625
|
}
|
|
625
626
|
});
|
|
626
627
|
|
|
627
|
-
onMounted(() => {
|
|
628
|
+
onMounted(async () => {
|
|
629
|
+
await Sleep(1);
|
|
630
|
+
// setTimeout(() => {
|
|
628
631
|
initFlatPickerOption();
|
|
629
632
|
generateFlatPickerOption();
|
|
633
|
+
// }, 1);
|
|
630
634
|
});
|
|
631
|
-
onUnmounted(() => {
|
|
635
|
+
onUnmounted(async () => {
|
|
636
|
+
await Sleep(1);
|
|
632
637
|
if (state.picker != null) {
|
|
633
638
|
state.picker.destroy();
|
|
634
639
|
state.picker = null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
|
|
2
2
|
export default _default;
|