nuxt-hs-ui 2.0.30 → 2.0.32

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.30",
7
+ "version": "2.0.32",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -9,7 +9,8 @@
9
9
  // [ node-modules ]
10
10
  import dayjs from "dayjs/esm/index";
11
11
  // flatpickr cdn 経由で使用する
12
- // import flatpickr from "flatpickr";
12
+ import flatpickr from "flatpickr";
13
+ // import monthSelectPlugin from "flatpickr/dist/plugins/monthSelect";
13
14
  // [ vueuse ]
14
15
  import { useMounted } from "@vueuse/core";
15
16
  // [ NUXT ]
@@ -22,12 +23,16 @@ import {
22
23
  onMounted,
23
24
  nextTick,
24
25
  onUnmounted,
25
- useHead,
26
+ // useHead,
26
27
  } from "#imports";
27
28
  // [ utils ]
28
29
  import { Sleep } from "../../utils/com";
29
30
  import type { ClassType } from "../../utils/class-style";
30
31
  import { GetTimeShiftValue, Dayjs, DayjsInit } from "../../utils/dayjs";
32
+ // [ utils ]
33
+
34
+ import { ja } from "../../types/flatpickr/ja";
35
+ import { en } from "../../types/flatpickr/default";
31
36
  // [ composables ]
32
37
  import { useHsMisc } from "../../composables/use-hs-misc";
33
38
  import { useHsFocus } from "../../composables/use-hs-focus";
@@ -36,16 +41,16 @@ import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
36
41
  // [ Components ]
37
42
  import InputFrame from "./input-frame.vue";
38
43
 
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
- });
44
+ // useHead({
45
+ // script: [
46
+ // //
47
+ // // https://npmcdn.com/flatpickr@4.6.13/dist/plugins/monthSelect/index.js
48
+ // //{ src: `https://npmcdn.com/flatpickr/dist/flatpickr.min.js` },
49
+ // { src: `https://npmcdn.com/flatpickr/dist/plugins/monthSelect` },
50
+ // { src: `https://npmcdn.com/flatpickr/dist/l10n/ja.js` },
51
+ // { src: `https://npmcdn.com/flatpickr/dist/l10n/default.js` },
52
+ // ],
53
+ // });
49
54
 
50
55
  // ----------------------------------------------------------------------------
51
56
  // [ nac-stroe ]
@@ -69,7 +74,8 @@ type Props = {
69
74
  // ----------------------------------------------------------------------------
70
75
  // Input 種類別
71
76
  textAlign?: "left" | "center" | "right";
72
- mode?: "all" | "date" | "time" | "month";
77
+ mode?: "all" | "date" | "time";
78
+ // mode?: "all" | "date" | "time" | "month";
73
79
  /** mode=time の場合、[HH:mm:ss.SSS] に固定 */
74
80
  dataFormat?: string;
75
81
  /** mode=time の場合、[HH:mm] に固定 */
@@ -209,7 +215,7 @@ const state = reactive<State>({
209
215
  date: null,
210
216
  option: {
211
217
  dateFormat: "Z",
212
- locale: "ja",
218
+ locale: ja,
213
219
  time_24hr: true,
214
220
  minDate: undefined,
215
221
  maxDate: undefined,
@@ -348,23 +354,20 @@ const initFlatPickerOption = () => {
348
354
  state.option.noCalendar = true;
349
355
  }
350
356
  }
351
- if (props.mode === "month") {
352
- state.option.disableMobile = true;
353
- }
354
357
  if (props.disableMobile) {
355
358
  state.option.disableMobile = true;
356
359
  }
357
- if (props.mode === "month") {
358
- const monthSelectPlugin = (window as any).monthSelectPlugin;
359
- state.option.plugins = [
360
- new monthSelectPlugin({
361
- shorthand: true, // デフォルトはfalse
362
- dateFormat: "m.y", // デフォルトは"F Y"
363
- altFormat: "F Y", // デフォルトは"F Y"
364
- theme: "dark", // デフォルトは"light"
365
- }),
366
- ];
367
- }
360
+ // if (props.mode === "month") {
361
+ // state.option.disableMobile = true;
362
+ // state.option.plugins = [
363
+ // new MonthSelectPlugin({
364
+ // shorthand: true, // デフォルトはfalse
365
+ // dateFormat: "m.y", // デフォルトは"F Y"
366
+ // altFormat: "F Y", // デフォルトは"F Y"
367
+ // theme: "dark", // デフォルトは"light"
368
+ // }),
369
+ // ];
370
+ // }
368
371
  };
369
372
 
370
373
  const onOpen = () => {
@@ -401,15 +404,14 @@ const generateFlatPickerOption = () => {
401
404
  switch (multiLang.state.lang) {
402
405
  case "jp":
403
406
  case "ja":
404
- state.option.locale = "ja";
407
+ state.option.locale = ja;
405
408
  break;
406
409
  default:
407
- state.option.locale = "en";
410
+ state.option.locale = en;
408
411
  break;
409
412
  }
410
413
  // state.option.position = 'above';
411
414
  // state.option.static = true;
412
- const flatpickr = (window as any).flatpickr;
413
415
  state.picker = flatpickr(inputElement.value, state.option);
414
416
  state.picker.config.onChange.push(onChange);
415
417
  state.picker.config.onOpen.push(onOpen);
@@ -503,10 +505,10 @@ const datePickerToday = () => {
503
505
  if (props.readonly === true) return;
504
506
  if (props.disabled === true) return;
505
507
  if (state.date !== null) return;
506
- let inputValue = dayjs();
507
- if (props.mode === "month") {
508
- inputValue = inputValue.startOf("month");
509
- }
508
+ const inputValue = dayjs();
509
+ // if (props.mode === "month") {
510
+ // inputValue = inputValue.startOf("month");
511
+ // }
510
512
  const d = getShiftDayjs(inputValue);
511
513
  if (checkDate(d.format("YYYY-MM-DD")) === false) {
512
514
  Toast.Warning(
@@ -843,10 +845,11 @@ const computedIsFocusOpenBtn = computed(() => {
843
845
  "
844
846
  @click.stop="datePickerToday()"
845
847
  >
846
- {{ props.mode === "month" ? "Now" : "Today" }}
848
+ <!-- {{ props.mode === "month" ? "Now" : "Today" }} -->
849
+ Today
847
850
  </span>
848
851
  </div>
849
- <template v-if="slots['right-icons']" #right-icons>
852
+ <template #right-icons>
850
853
  <template v-if="!props.hideDeleteBtn && !props.readonly">
851
854
  <div
852
855
  :class="
@@ -0,0 +1 @@
1
+ export declare const en: any;
@@ -0,0 +1,70 @@
1
+ export const en = {
2
+ weekdays: {
3
+ shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
4
+ longhand: [
5
+ "Sunday",
6
+ "Monday",
7
+ "Tuesday",
8
+ "Wednesday",
9
+ "Thursday",
10
+ "Friday",
11
+ "Saturday"
12
+ ]
13
+ },
14
+ months: {
15
+ shorthand: [
16
+ "Jan",
17
+ "Feb",
18
+ "Mar",
19
+ "Apr",
20
+ "May",
21
+ "Jun",
22
+ "Jul",
23
+ "Aug",
24
+ "Sep",
25
+ "Oct",
26
+ "Nov",
27
+ "Dec"
28
+ ],
29
+ longhand: [
30
+ "January",
31
+ "February",
32
+ "March",
33
+ "April",
34
+ "May",
35
+ "June",
36
+ "July",
37
+ "August",
38
+ "September",
39
+ "October",
40
+ "November",
41
+ "December"
42
+ ]
43
+ },
44
+ daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
45
+ firstDayOfWeek: 0,
46
+ ordinal: (nth) => {
47
+ const s = nth % 100;
48
+ if (s > 3 && s < 21) return "th";
49
+ switch (s % 10) {
50
+ case 1:
51
+ return "st";
52
+ case 2:
53
+ return "nd";
54
+ case 3:
55
+ return "rd";
56
+ default:
57
+ return "th";
58
+ }
59
+ },
60
+ rangeSeparator: " to ",
61
+ weekAbbreviation: "Wk",
62
+ scrollTitle: "Scroll to increment",
63
+ toggleTitle: "Click to toggle",
64
+ amPM: ["AM", "PM"],
65
+ yearAriaLabel: "Year",
66
+ monthAriaLabel: "Month",
67
+ hourAriaLabel: "Hour",
68
+ minuteAriaLabel: "Minute",
69
+ time_24hr: false
70
+ };
@@ -0,0 +1,17 @@
1
+ export declare const ja: {
2
+ weekdays: {
3
+ shorthand: string[];
4
+ longhand: string[];
5
+ };
6
+ months: {
7
+ shorthand: string[];
8
+ longhand: string[];
9
+ };
10
+ time_24hr: boolean;
11
+ rangeSeparator: string;
12
+ monthAriaLabel: string;
13
+ amPM: string[];
14
+ yearAriaLabel: string;
15
+ hourAriaLabel: string;
16
+ minuteAriaLabel: string;
17
+ };
@@ -0,0 +1,51 @@
1
+ export const ja = {
2
+ weekdays: {
3
+ shorthand: ["\u65E5", "\u6708", "\u706B", "\u6C34", "\u6728", "\u91D1", "\u571F"],
4
+ longhand: [
5
+ "\u65E5\u66DC\u65E5",
6
+ "\u6708\u66DC\u65E5",
7
+ "\u706B\u66DC\u65E5",
8
+ "\u6C34\u66DC\u65E5",
9
+ "\u6728\u66DC\u65E5",
10
+ "\u91D1\u66DC\u65E5",
11
+ "\u571F\u66DC\u65E5"
12
+ ]
13
+ },
14
+ months: {
15
+ shorthand: [
16
+ "1\u6708",
17
+ "2\u6708",
18
+ "3\u6708",
19
+ "4\u6708",
20
+ "5\u6708",
21
+ "6\u6708",
22
+ "7\u6708",
23
+ "8\u6708",
24
+ "9\u6708",
25
+ "10\u6708",
26
+ "11\u6708",
27
+ "12\u6708"
28
+ ],
29
+ longhand: [
30
+ "1\u6708",
31
+ "2\u6708",
32
+ "3\u6708",
33
+ "4\u6708",
34
+ "5\u6708",
35
+ "6\u6708",
36
+ "7\u6708",
37
+ "8\u6708",
38
+ "9\u6708",
39
+ "10\u6708",
40
+ "11\u6708",
41
+ "12\u6708"
42
+ ]
43
+ },
44
+ time_24hr: true,
45
+ rangeSeparator: " \u304B\u3089 ",
46
+ monthAriaLabel: "\u6708",
47
+ amPM: ["\u5348\u524D", "\u5348\u5F8C"],
48
+ yearAriaLabel: "\u5E74",
49
+ hourAriaLabel: "\u6642\u9593",
50
+ minuteAriaLabel: "\u5206"
51
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-hs-ui",
3
- "version": "2.0.30",
3
+ "version": "2.0.32",
4
4
  "description": "My new Nuxt module",
5
5
  "repository": "https://github.com/hare-systems-ryo/nuxt-hs-ui",
6
6
  "license": "MIT",