nuxt-hs-ui 2.0.29 → 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
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.15.0"
6
6
  },
7
- "version": "2.0.29",
7
+ "version": "2.0.30",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -8,10 +8,8 @@
8
8
 
9
9
  // [ node-modules ]
10
10
  import dayjs from "dayjs/esm/index";
11
- import flatpickr from "flatpickr";
12
- import monthSelectPlugin from "flatpickr/dist/plugins/monthSelect";
13
- import { Japanese as ja } from "flatpickr/dist/l10n/ja.js";
14
- import { english as en } from "flatpickr/dist/l10n/default.js";
11
+ // flatpickr cdn 経由で使用する
12
+ // import flatpickr from "flatpickr";
15
13
  // [ vueuse ]
16
14
  import { useMounted } from "@vueuse/core";
17
15
  // [ NUXT ]
@@ -24,9 +22,10 @@ import {
24
22
  onMounted,
25
23
  nextTick,
26
24
  onUnmounted,
27
- // useHead,
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 ]
@@ -37,15 +36,16 @@ import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
37
36
  // [ Components ]
38
37
  import InputFrame from "./input-frame.vue";
39
38
 
40
- // useHead({
41
- // script: [
42
- // //
43
-
44
- // { src: `https://npmcdn.com/flatpickr/dist/flatpickr.min.js` },
45
- // { src: `https://npmcdn.com/flatpickr/dist/l10n/ja.js` },
46
- // { src: `https://npmcdn.com/flatpickr/dist/l10n/default.js` },
47
- // ],
48
- // });
39
+ useHead({
40
+ script: [
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` },
45
+ { src: `https://npmcdn.com/flatpickr/dist/l10n/ja.js` },
46
+ { src: `https://npmcdn.com/flatpickr/dist/l10n/default.js` },
47
+ ],
48
+ });
49
49
 
50
50
  // ----------------------------------------------------------------------------
51
51
  // [ nac-stroe ]
@@ -59,7 +59,7 @@ const hsMisc = useHsMisc();
59
59
  const isMounted = useMounted();
60
60
  // ----------------------------------------------------------------------------
61
61
  // flatpickr
62
- const MonthSelectPlugin: any = monthSelectPlugin;
62
+ // const MonthSelectPlugin: any = monthSelectPlugin;
63
63
  const timeDateFormat = "YYYY-MM-DD HH:mm:ss.SSS";
64
64
  const timeOutputDateFormat = "HH:mm:ss.SSS";
65
65
  const timeShowDateFormat = "HH:mm";
@@ -209,7 +209,7 @@ const state = reactive<State>({
209
209
  date: null,
210
210
  option: {
211
211
  dateFormat: "Z",
212
- locale: ja,
212
+ locale: "ja",
213
213
  time_24hr: true,
214
214
  minDate: undefined,
215
215
  maxDate: undefined,
@@ -265,12 +265,11 @@ watch(
265
265
  computed(() => {
266
266
  return [props.minDate, props.maxDate, multiLang.state.lang];
267
267
  }).value,
268
- () => {
268
+ async () => {
269
269
  // console.log('computed', props.minDate, props.maxDate, isMounted.value);
270
270
  if (!isMounted.value) return;
271
- setTimeout(() => {
272
- resetPicekr();
273
- }, 1);
271
+ await Sleep(1);
272
+ resetPicekr();
274
273
  }
275
274
  );
276
275
 
@@ -356,8 +355,9 @@ const initFlatPickerOption = () => {
356
355
  state.option.disableMobile = true;
357
356
  }
358
357
  if (props.mode === "month") {
358
+ const monthSelectPlugin = (window as any).monthSelectPlugin;
359
359
  state.option.plugins = [
360
- new MonthSelectPlugin({
360
+ new monthSelectPlugin({
361
361
  shorthand: true, // デフォルトはfalse
362
362
  dateFormat: "m.y", // デフォルトは"F Y"
363
363
  altFormat: "F Y", // デフォルトは"F Y"
@@ -401,14 +401,15 @@ const generateFlatPickerOption = () => {
401
401
  switch (multiLang.state.lang) {
402
402
  case "jp":
403
403
  case "ja":
404
- state.option.locale = ja;
404
+ state.option.locale = "ja";
405
405
  break;
406
406
  default:
407
- state.option.locale = en;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-hs-ui",
3
- "version": "2.0.29",
3
+ "version": "2.0.30",
4
4
  "description": "My new Nuxt module",
5
5
  "repository": "https://github.com/hare-systems-ryo/nuxt-hs-ui",
6
6
  "license": "MIT",