nuxt-hs-ui 2.12.7 → 4.0.0

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.
Files changed (131) hide show
  1. package/README.md +202 -14
  2. package/dist/module.d.mts +3 -4
  3. package/dist/module.json +9 -6
  4. package/dist/module.mjs +109 -99
  5. package/dist/runtime/assets/flatpickr-dark.css +1 -1
  6. package/dist/runtime/assets/main.css +1 -0
  7. package/dist/runtime/assets/tabulator-custom.css +1 -1
  8. package/dist/runtime/components/form/_select/hidden-item-toggle.vue +28 -0
  9. package/dist/runtime/components/form/_select/hidden-item-toggle.vue.d.ts +10 -0
  10. package/dist/runtime/components/form/_select/item-container.vue +63 -0
  11. package/dist/runtime/components/form/_select/item-container.vue.d.ts +19 -0
  12. package/dist/runtime/components/form/_select/item-label.vue +31 -0
  13. package/dist/runtime/components/form/_select/item-label.vue.d.ts +13 -0
  14. package/dist/runtime/components/form/_select/item-row.vue +62 -0
  15. package/dist/runtime/components/form/_select/item-row.vue.d.ts +34 -0
  16. package/dist/runtime/components/form/btn-line-loading.vue +62 -81
  17. package/dist/runtime/components/form/btn-line-loading.vue.d.ts +14 -0
  18. package/dist/runtime/components/form/btn.vue +411 -494
  19. package/dist/runtime/components/form/btn.vue.d.ts +0 -0
  20. package/dist/runtime/components/form/check-box.vue +200 -315
  21. package/dist/runtime/components/form/check-box.vue.d.ts +71 -0
  22. package/dist/runtime/components/form/check-list.vue +234 -364
  23. package/dist/runtime/components/form/check-list.vue.d.ts +99 -0
  24. package/dist/runtime/components/form/combo-box.vue +340 -0
  25. package/dist/runtime/components/form/combo-box.vue.d.ts +69 -0
  26. package/dist/runtime/components/form/datepicker.vue +717 -883
  27. package/dist/runtime/components/form/datepicker.vue.d.ts +122 -0
  28. package/dist/runtime/components/form/input-frame.vue +174 -258
  29. package/dist/runtime/components/form/input-frame.vue.d.ts +88 -0
  30. package/dist/runtime/components/form/radio.vue +451 -614
  31. package/dist/runtime/components/form/radio.vue.d.ts +62 -0
  32. package/dist/runtime/components/form/select-img-icon.vue +38 -53
  33. package/dist/runtime/components/form/select-img-icon.vue.d.ts +15 -0
  34. package/dist/runtime/components/form/select.vue +733 -579
  35. package/dist/runtime/components/form/select.vue.d.ts +63 -0
  36. package/dist/runtime/components/form/text-box.vue +266 -365
  37. package/dist/runtime/components/form/text-box.vue.d.ts +105 -0
  38. package/dist/runtime/components/form/textarea.vue +338 -421
  39. package/dist/runtime/components/form/textarea.vue.d.ts +98 -0
  40. package/dist/runtime/components/form/value-box.vue +512 -641
  41. package/dist/runtime/components/form/value-box.vue.d.ts +128 -0
  42. package/dist/runtime/components/interactive/alert.vue +49 -113
  43. package/dist/runtime/components/interactive/alert.vue.d.ts +30 -0
  44. package/dist/runtime/components/interactive/block-loading.vue +91 -119
  45. package/dist/runtime/components/interactive/block-loading.vue.d.ts +22 -0
  46. package/dist/runtime/components/interactive/dialog.vue +252 -407
  47. package/dist/runtime/components/interactive/dialog.vue.d.ts +3 -0
  48. package/dist/runtime/components/interactive/modal-bg.vue +72 -82
  49. package/dist/runtime/components/interactive/modal-bg.vue.d.ts +11 -0
  50. package/dist/runtime/components/interactive/modal.vue +121 -169
  51. package/dist/runtime/components/interactive/modal.vue.d.ts +38 -0
  52. package/dist/runtime/components/interactive/toast.vue +164 -206
  53. package/dist/runtime/components/interactive/toast.vue.d.ts +3 -0
  54. package/dist/runtime/components/interactive/window-loader.vue +61 -84
  55. package/dist/runtime/components/interactive/window-loader.vue.d.ts +3 -0
  56. package/dist/runtime/components/layout/accordion-down.vue +72 -0
  57. package/dist/runtime/components/layout/accordion-down.vue.d.ts +26 -0
  58. package/dist/runtime/components/layout/accordion.vue +47 -78
  59. package/dist/runtime/components/layout/accordion.vue.d.ts +22 -0
  60. package/dist/runtime/components/layout/aspect-box.vue +29 -58
  61. package/dist/runtime/components/layout/aspect-box.vue.d.ts +29 -0
  62. package/dist/runtime/components/layout/card-item.vue +148 -193
  63. package/dist/runtime/components/layout/card-item.vue.d.ts +0 -0
  64. package/dist/runtime/components/layout/card.vue +27 -42
  65. package/dist/runtime/components/layout/card.vue.d.ts +23 -0
  66. package/dist/runtime/components/layout/container.vue +25 -40
  67. package/dist/runtime/components/layout/container.vue.d.ts +35 -0
  68. package/dist/runtime/components/layout/divider-h.vue +30 -50
  69. package/dist/runtime/components/layout/divider-h.vue.d.ts +18 -0
  70. package/dist/runtime/components/misc/breadcrumb.vue +47 -95
  71. package/dist/runtime/components/misc/breadcrumb.vue.d.ts +22 -0
  72. package/dist/runtime/components/misc/tabulator.vue +122 -190
  73. package/dist/runtime/components/misc/tabulator.vue.d.ts +28 -0
  74. package/dist/runtime/components/misc/view-name-display.vue +53 -68
  75. package/dist/runtime/components/misc/view-name-display.vue.d.ts +14 -0
  76. package/dist/runtime/components/test.vue +13 -0
  77. package/dist/runtime/components/test.vue.d.ts +3 -0
  78. package/dist/runtime/composables/test.d.ts +8 -0
  79. package/dist/runtime/composables/test.js +12 -0
  80. package/dist/runtime/composables/use-hs-dialog.d.ts +3 -20
  81. package/dist/runtime/composables/use-hs-dialog.js +3 -9
  82. package/dist/runtime/composables/use-hs-is-mobile.d.ts +8 -2
  83. package/dist/runtime/composables/use-hs-is-mobile.js +43 -25
  84. package/dist/runtime/composables/use-hs-misc.d.ts +8 -38
  85. package/dist/runtime/composables/use-hs-misc.js +9 -61
  86. package/dist/runtime/composables/use-hs-modal.js +1 -3
  87. package/dist/runtime/composables/use-hs-multi-lang.d.ts +23 -40
  88. package/dist/runtime/composables/use-hs-multi-lang.js +30 -74
  89. package/dist/runtime/composables/use-hs-scroll-lock.d.ts +1 -1
  90. package/dist/runtime/composables/use-hs-scroll-lock.js +2 -1
  91. package/dist/runtime/composables/use-hs-toast.d.ts +2 -2
  92. package/dist/runtime/composables/use-hs-toast.js +12 -4
  93. package/dist/runtime/composables/use-pinia.d.ts +1 -0
  94. package/dist/runtime/composables/use-pinia.js +2 -0
  95. package/dist/runtime/plugin.d.ts +2 -0
  96. package/dist/runtime/plugin.js +4 -0
  97. package/dist/runtime/server/tsconfig.json +3 -3
  98. package/dist/runtime/types/dialog.d.ts +11 -20
  99. package/dist/runtime/types/dialog.js +2 -1
  100. package/dist/runtime/types/flatpickr/default.js +2 -23
  101. package/dist/runtime/types/flatpickr/ja.js +3 -37
  102. package/dist/runtime/types/toast.d.ts +1 -1
  103. package/dist/runtime/utils/dayjs.d.ts +8 -6
  104. package/dist/runtime/utils/dayjs.js +12 -5
  105. package/dist/runtime/utils/modal.d.ts +9 -28
  106. package/dist/runtime/utils/modal.js +7 -36
  107. package/dist/runtime/utils/multi-lang-object.d.ts +2 -2
  108. package/dist/runtime/utils/multi-lang-object.js +1 -5
  109. package/dist/runtime/utils/multi-lang.js +12 -22
  110. package/dist/runtime/utils/object.js +1 -1
  111. package/dist/runtime/utils/select-item.d.ts +3 -1
  112. package/dist/runtime/utils/stop-watch.js +6 -4
  113. package/dist/runtime/utils/string.js +4 -4
  114. package/dist/runtime/utils/tabulator.d.ts +1 -42
  115. package/dist/runtime/utils/tabulator.js +2 -99
  116. package/dist/runtime/utils/theme.d.ts +20 -20
  117. package/dist/runtime/utils/theme.js +180 -30
  118. package/dist/runtime/utils/tv.d.ts +1 -101
  119. package/dist/runtime/utils/tv.js +0 -22
  120. package/dist/types.d.mts +3 -1
  121. package/package.json +61 -119
  122. package/dist/module.cjs +0 -5
  123. package/dist/module.d.ts +0 -16
  124. package/dist/runtime/assets/vue-select.css +0 -1
  125. package/dist/runtime/components/misc/view-name-display-target.vue +0 -39
  126. package/dist/runtime/plugin/v-select.d.ts +0 -2
  127. package/dist/runtime/plugin/v-select.js +0 -5
  128. package/dist/runtime/style.css +0 -22
  129. package/dist/runtime/tailwind.css +0 -78
  130. package/dist/runtime/types/app.config.d.ts +0 -5
  131. package/dist/types.d.ts +0 -1
@@ -1,9 +1,10 @@
1
- import dayjs from "dayjs/esm/index";
2
- export type Dayjs = dayjs.Dayjs;
3
- export type QUnitType = dayjs.QUnitType;
4
- export type OpUnitType = dayjs.OpUnitType;
5
- export declare const DayjsInit: (f?: boolean) => void;
6
- export declare const defaultTimezone = "Asia/Tokyo";
1
+ import _dayjs from 'dayjs/esm/index';
2
+ import ja from 'dayjs/esm/locale/ja.js';
3
+ export declare const dayjs: typeof _dayjs;
4
+ export type Dayjs = _dayjs.Dayjs;
5
+ export type QUnitType = _dayjs.QUnitType;
6
+ export type OpUnitType = _dayjs.OpUnitType;
7
+ export declare const DayjsInit: (f?: boolean, defaultTimezone?: string) => void;
7
8
  /** dayjsオブジェクト生成 */
8
9
  export declare const Dayjs: (arg?: string | number | Dayjs | Date | null | undefined, format?: string | undefined) => Dayjs;
9
10
  /** dayjsオブジェクト生成
@@ -37,6 +38,7 @@ export declare const DayjsFormat: (date: string | null | Date, f?: string, nullT
37
38
  */
38
39
  export declare const DayjsFormatNullable: (date: string | null | Date, f?: string) => string | null;
39
40
  export declare const DayjsSetLocal: (lang?: "ja" | "en") => void;
41
+ export declare const GetLocal: (lang?: "ja" | "en") => ja.Locale;
40
42
  export declare const DayjsSetTimezone: (tz?: string) => void;
41
43
  /** Prismaの日付型の条件式を生成する関数 */
42
44
  export declare const DayjsBetweenWhereQuery: (arg: {
@@ -1,11 +1,12 @@
1
- import dayjs from "dayjs/esm/index";
1
+ import _dayjs from "dayjs/esm/index";
2
2
  import utc from "dayjs/esm/plugin/utc";
3
3
  import timezone from "dayjs/esm/plugin/timezone";
4
4
  import advancedFormat from "dayjs/esm/plugin/advancedFormat";
5
5
  import ja from "dayjs/esm/locale/ja.js";
6
6
  import en from "dayjs/esm/locale/en.js";
7
+ export const dayjs = _dayjs;
7
8
  let init = false;
8
- export const DayjsInit = (f = false) => {
9
+ export const DayjsInit = (f = false, defaultTimezone = "Asia/Tokyo") => {
9
10
  if (init && !f) return;
10
11
  init = true;
11
12
  dayjs.extend(utc);
@@ -14,7 +15,6 @@ export const DayjsInit = (f = false) => {
14
15
  dayjs.tz.setDefault(defaultTimezone);
15
16
  dayjs.locale(ja);
16
17
  };
17
- export const defaultTimezone = "Asia/Tokyo";
18
18
  export const Dayjs = (arg, format) => {
19
19
  if (arg === null || arg === void 0) return dayjs(arg, format);
20
20
  return dayjs(arg, format);
@@ -47,7 +47,7 @@ export const DayjsDiff = (date, diff, unit) => {
47
47
  return null;
48
48
  }
49
49
  };
50
- export const GetTimeShiftValue = (date, timeZone = defaultTimezone) => {
50
+ export const GetTimeShiftValue = (date, timeZone = "Asia/Tokyo") => {
51
51
  if (date === null) return 0;
52
52
  const format = `YYYY-MM-DD HH:mm`;
53
53
  const a = date.format(format);
@@ -98,7 +98,14 @@ export const DayjsSetLocal = (lang) => {
98
98
  dayjs.locale(ja);
99
99
  }
100
100
  };
101
- export const DayjsSetTimezone = (tz = defaultTimezone) => {
101
+ export const GetLocal = (lang) => {
102
+ if (lang === "en") {
103
+ return en;
104
+ } else {
105
+ return ja;
106
+ }
107
+ };
108
+ export const DayjsSetTimezone = (tz = "Asia/Tokyo") => {
102
109
  dayjs.tz.setDefault(tz);
103
110
  };
104
111
  export const DayjsBetweenWhereQuery = (arg) => {
@@ -38,46 +38,27 @@ onMounted(() => {
38
38
  });
39
39
 
40
40
  -------------------------------------------- */
41
- type OptionalFunction<T> = ((state: T) => undefined | boolean) | ((state: T) => Promise<undefined | boolean>) | null;
41
+ type OptionalFunction<T> = ((state?: T) => void) | ((state?: T) => boolean) | ((state?: T) => Promise<boolean>) | ((state?: T) => Promise<void>);
42
+ type OptionalAfterFunction<T> = (state?: T) => Promise<void> | void;
42
43
  export interface ModalControl<T = any> {
43
- /**
44
- * showBefre,showAfter がasync付きならasync付き関数になります。
45
- */
46
- show: (() => undefined) | (() => Promise<undefined>);
44
+ show: () => Promise<undefined>;
47
45
  /**
48
46
  * showBefore モーダルが開く前に実行される関数
49
47
  * - true をreturnするとモーダルを開く処理は中止される
50
48
  */
51
- showBefore: OptionalFunction<T>;
52
- showAfter: OptionalFunction<T>;
53
- /**
54
- * closeBefore,closeAfter がasync付きならasync付き関数になります。
55
- */
56
- close: (() => undefined) | (() => Promise<undefined>);
49
+ showBefore: OptionalFunction<T> | null;
50
+ showAfter: OptionalAfterFunction<T> | null;
51
+ close: () => Promise<undefined>;
57
52
  /**
58
53
  * closeBefore モーダルが閉じる前に実行される関数
59
54
  * - true をreturnするとモーダルを閉じる処理は中止される
60
55
  */
61
- closeBefore: OptionalFunction<T>;
62
- closeAfter: OptionalFunction<T>;
56
+ closeBefore: OptionalFunction<T> | null;
57
+ closeAfter: OptionalAfterFunction<T> | null;
63
58
  isShow: boolean;
64
59
  state: T;
65
60
  }
66
- export declare const InitModalControl: <T = any>(arg?: {
67
- state?: T;
68
- /**
69
- * showBefore モーダルが開く前に実行される関数
70
- * - true をreturnするとモーダルを開く処理は中止される
71
- */
72
- showBefore?: OptionalFunction<T>;
73
- showAfter?: OptionalFunction<T>;
74
- /**
75
- * closeBefore モーダルが閉じる前に実行される関数
76
- * - true をreturnするとモーダルを閉じる処理は中止される
77
- */
78
- closeBefore?: OptionalFunction<T>;
79
- closeAfter?: OptionalFunction<T>;
80
- }) => ModalControl<T>;
61
+ export declare const InitModalControl: <T = any>(state?: T) => ModalControl<T>;
81
62
  /**
82
63
  * modalオブジェクトの初期化
83
64
  * @param modal ModalControlが含まれるReactiveオブジェクト
@@ -1,4 +1,4 @@
1
- export const InitModalControl = (arg) => {
1
+ export const InitModalControl = (state) => {
2
2
  const noneInitMessage = "\u304C\u521D\u671F\u5316\u3055\u308C\u3066\u3044\u307E\u305B\u3093";
3
3
  return {
4
4
  show: () => console.log("[show]" + noneInitMessage),
@@ -8,31 +8,15 @@ export const InitModalControl = (arg) => {
8
8
  closeBefore: null,
9
9
  closeAfter: null,
10
10
  isShow: false,
11
- state: null,
12
- ...arg
11
+ state: state || null
13
12
  };
14
13
  };
15
- const isAsync = (func) => {
16
- try {
17
- if (func === null) return false;
18
- if (func === void 0) return false;
19
- if (!("constructor" in func)) return false;
20
- return func.constructor.name === "AsyncFunction";
21
- } catch {
22
- return false;
23
- }
24
- };
25
14
  export const InitModals = (modal, nextTick) => {
26
15
  Object.keys(modal).forEach((key) => {
27
16
  const m = modal[key];
28
17
  m.show = async () => {
29
18
  if (m.showBefore) {
30
- if (isAsync(m.showBefore)) {
31
- if (await m.showBefore(m.state) === true) {
32
- console.info("\u30E2\u30FC\u30C0\u30EB\u306EShow\u52D5\u4F5C\u306F\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u307E\u3057\u305F");
33
- return;
34
- }
35
- } else if (m.showBefore(m.state) === true) {
19
+ if (await m.showBefore(m.state) === true) {
36
20
  console.info("\u30E2\u30FC\u30C0\u30EB\u306EShow\u52D5\u4F5C\u306F\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u307E\u3057\u305F");
37
21
  return;
38
22
  }
@@ -40,20 +24,11 @@ export const InitModals = (modal, nextTick) => {
40
24
  m.isShow = true;
41
25
  if (!m.showAfter) return;
42
26
  await nextTick();
43
- if (isAsync(m.showAfter)) {
44
- await m.showAfter(m.state);
45
- } else {
46
- m.showAfter(m.state);
47
- }
27
+ await m.showAfter(m.state);
48
28
  };
49
29
  m.close = async () => {
50
30
  if (m.closeBefore) {
51
- if (isAsync(m.closeBefore)) {
52
- if (await m.closeBefore(m.state) === true) {
53
- console.info("\u30E2\u30FC\u30C0\u30EB\u306EClose\u52D5\u4F5C\u306F\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u307E\u3057\u305F");
54
- return;
55
- }
56
- } else if (m.closeBefore(m.state) === true) {
31
+ if (await m.closeBefore(m.state) === true) {
57
32
  console.info("\u30E2\u30FC\u30C0\u30EB\u306EClose\u52D5\u4F5C\u306F\u30AD\u30E3\u30F3\u30BB\u30EB\u3055\u308C\u307E\u3057\u305F");
58
33
  return;
59
34
  }
@@ -61,12 +36,8 @@ export const InitModals = (modal, nextTick) => {
61
36
  m.isShow = false;
62
37
  await nextTick();
63
38
  if (!m.closeAfter) return;
64
- if (isAsync(m.closeAfter)) {
65
- await m.closeAfter(m.state);
66
- } else {
67
- m.closeAfter(m.state);
68
- }
69
- return void 0;
39
+ await m.closeAfter(m.state);
40
+ return;
70
41
  };
71
42
  });
72
43
  };
@@ -1,5 +1,5 @@
1
- import type { SelectItem } from "./select-item.js";
2
- import { type MultiLang } from "./multi-lang.js";
1
+ import type { SelectItem } from './select-item.js';
2
+ import { type MultiLang } from './multi-lang.js';
3
3
  export type KeyNumber = {
4
4
  [key: string]: number;
5
5
  };
@@ -11,11 +11,7 @@ export const ValueToTextByMap = (keyMultilang, code, lang, fallBackLang) => {
11
11
  if (lang === void 0) {
12
12
  return keyMultilang[code];
13
13
  } else if (lang in keyMultilang[code]) {
14
- return GetTextByMultiLang(
15
- keyMultilang[code],
16
- lang,
17
- fallBackLang
18
- );
14
+ return GetTextByMultiLang(keyMultilang[code], lang, fallBackLang);
19
15
  }
20
16
  }
21
17
  return "";
@@ -6,21 +6,15 @@ export const GetTextByMultiLang = (text, lang, fallBackLang, showLog) => {
6
6
  return String(text);
7
7
  }
8
8
  if (lang in text) {
9
- return text[lang];
9
+ return text[lang] || "";
10
10
  } else if (fallBackLang !== void 0 && fallBackLang in text) {
11
11
  if (showLog === true) {
12
- console.error(
13
- `GetTextByMultiLang :: Language fallback [${lang} -> en]`,
14
- text
15
- );
12
+ console.error(`GetTextByMultiLang :: Language fallback [${lang} -> en]`, text);
16
13
  }
17
14
  return text[fallBackLang] || "";
18
15
  } else {
19
16
  if (showLog === true) {
20
- console.error(
21
- `GetTextByMultiLang :: Language Error [${lang} -> en]`,
22
- text
23
- );
17
+ console.error(`GetTextByMultiLang :: Language Error [${lang} -> en]`, text);
24
18
  }
25
19
  return JSON.stringify(text);
26
20
  }
@@ -28,11 +22,9 @@ export const GetTextByMultiLang = (text, lang, fallBackLang, showLog) => {
28
22
  export const JoinMultiLang = (list, seq = "\n") => {
29
23
  if (Array.isArray(list) === false) return "";
30
24
  if (list.length === 0) return "";
31
- const temp = list.map(
32
- (row) => {
33
- return { type: isObject(row) ? "object" : "string", multiLang: row };
34
- }
35
- );
25
+ const temp = list.map((row) => {
26
+ return { type: isObject(row) ? "object" : "string", multiLang: row };
27
+ });
36
28
  const langList = temp.reduce((ret, row) => {
37
29
  if (row.type === "string") return ret;
38
30
  Object.keys(row.multiLang).forEach((key) => {
@@ -51,6 +43,7 @@ export const JoinMultiLang = (list, seq = "\n") => {
51
43
  if (row.type === "string") {
52
44
  if (row.multiLang !== "") {
53
45
  langList.forEach((lang) => {
46
+ multiData[lang] ||= [];
54
47
  multiData[lang].push(String(row.multiLang));
55
48
  });
56
49
  }
@@ -59,24 +52,21 @@ export const JoinMultiLang = (list, seq = "\n") => {
59
52
  const langText = row.multiLang;
60
53
  if (lang in langText) {
61
54
  if (!langText[lang]) return;
55
+ multiData[lang] ||= [];
62
56
  multiData[lang].push(langText[lang]);
63
57
  } else if ("ja" in langText) {
64
58
  if (!langText.ja) return;
59
+ multiData[lang] ||= [];
65
60
  multiData[lang].push(langText.ja);
66
- console.error(
67
- `JoinMultiLang :: Language fallback [${lang} -> ja]`,
68
- row.multiLang
69
- );
61
+ console.error(`JoinMultiLang :: Language fallback [${lang} -> ja]`, row.multiLang);
70
62
  } else {
71
- console.error(
72
- `JoinMultiLang :: Language Error [${lang} -> ja]`,
73
- row.multiLang
74
- );
63
+ console.error(`JoinMultiLang :: Language Error [${lang} -> ja]`, row.multiLang);
75
64
  }
76
65
  });
77
66
  }
78
67
  });
79
68
  return Object.keys(multiData).reduce((ret, lang) => {
69
+ multiData[lang] ||= [];
80
70
  ret[lang] = multiData[lang].join(seq);
81
71
  return ret;
82
72
  }, {});
@@ -45,7 +45,7 @@ export const ObjectCompare = (a, b) => {
45
45
  }
46
46
  const sorted = Object.entries(obj).sort();
47
47
  for (const i in sorted) {
48
- const val = sorted[i][1];
48
+ const val = sorted?.[i]?.[1] || void 0;
49
49
  if (typeof val === "object") {
50
50
  sorted[i][1] = objectSort(val);
51
51
  }
@@ -1,4 +1,4 @@
1
- import type { MultiLang } from "./multi-lang.js";
1
+ import type { MultiLang } from './multi-lang.js';
2
2
  export interface SelectItem<IdType extends number | string = number> {
3
3
  readonly id: IdType;
4
4
  /**
@@ -20,6 +20,8 @@ export interface SelectItem<IdType extends number | string = number> {
20
20
  *
21
21
  */
22
22
  hidden?: boolean;
23
+ groupId?: string;
24
+ groupLabel?: MultiLang;
23
25
  /**
24
26
  * 削除非表示 : true = 非表示。
25
27
  * ただし選択要素は表示する
@@ -5,14 +5,16 @@ const convertms = (i) => {
5
5
  } else {
6
6
  let ret = a[0];
7
7
  ret += ".";
8
- if (a[1].length === 1) {
8
+ if (a[1]?.length === 1) {
9
9
  return ret + a[1] + "00";
10
- } else if (a[1].length === 2) {
10
+ } else if (a[1]?.length === 2) {
11
11
  return ret + a[1] + "0";
12
- } else if (a[1].length === 3) {
12
+ } else if (a[1]?.length === 3) {
13
13
  return ret + a[1];
14
- } else {
14
+ } else if (a[1]) {
15
15
  return ret + a[1].slice(-3);
16
+ } else {
17
+ return ret;
16
18
  }
17
19
  }
18
20
  };
@@ -6,7 +6,7 @@ export const CutLen = (text, len, addWard = "") => {
6
6
  export const LenB = (str) => {
7
7
  let len = 0;
8
8
  for (let i = 0; i < str.length; i++) {
9
- if (str[i].match(/[ -~]/)) {
9
+ if (str[i]?.match(/[ -~]/)) {
10
10
  len += 1;
11
11
  } else {
12
12
  len += 2;
@@ -20,7 +20,7 @@ export const CutLenB = (text, len, w = void 0) => {
20
20
  w = w === void 0 ? "..." : w;
21
21
  let tempStr = "";
22
22
  for (let i = 0; i < text.length; i++) {
23
- if (text[i].match(/[ -~]/)) {
23
+ if (text[i]?.match(/[ -~]/)) {
24
24
  if (LenB(tempStr + w) + 1 > len) {
25
25
  break;
26
26
  }
@@ -41,7 +41,7 @@ export const PaddingLeft = (text, len, w, ryaku = "") => {
41
41
  } else {
42
42
  let str = "";
43
43
  for (let i = 0; i < text.length; i++) {
44
- if (text[text.length - i - 1].match(/[ -~]/)) {
44
+ if (text[text.length - i - 1]?.match(/[ -~]/)) {
45
45
  if (LenB(str) + 1 > len) {
46
46
  break;
47
47
  }
@@ -63,7 +63,7 @@ export const PaddingRight = (text, len, w, ryaku = "") => {
63
63
  } else {
64
64
  let str = "";
65
65
  for (let i = 0; i < text.length; i++) {
66
- if (text[i].match(/[ -~]/)) {
66
+ if (text[i]?.match(/[ -~]/)) {
67
67
  if (LenB(str) + 1 > len) {
68
68
  break;
69
69
  }
@@ -1,17 +1,4 @@
1
- export type { TabulatorFull as Tabulator } from "tabulator-tables";
2
- import { type Theme } from "../utils/theme.js";
3
- /**
4
- * セル内部にボタンを配置した時用
5
- */
6
- export declare const cellMouseOut: (e: any) => void;
7
- /**
8
- * セル内部にボタンを配置した時用
9
- */
10
- export declare const cellMouseUp: (e: any) => void;
11
- /**
12
- * セル内部にボタンを配置した時用
13
- */
14
- export declare const cellMouseDown: (e: any) => void;
1
+ export type { TabulatorFull as Tabulator } from 'tabulator-tables';
15
2
  export interface SortItem<T> {
16
3
  key: T;
17
4
  order: 1 | -1;
@@ -41,9 +28,6 @@ export declare const TabulatorInitEmitFunc: () => {
41
28
  };
42
29
  export declare const Option: (option?: any) => any;
43
30
  export declare const Func: {
44
- cellMouseOut: (e: any) => void;
45
- cellMouseUp: (e: any) => void;
46
- cellMouseDown: (e: any) => void;
47
31
  ColumnsDisplay: (field?: string | undefined, width?: number | undefined) => {
48
32
  headerSort: boolean;
49
33
  download: boolean;
@@ -60,9 +44,6 @@ export declare const Func: {
60
44
  Option: (option?: any) => any;
61
45
  };
62
46
  export declare const TabulatorFunc: {
63
- cellMouseOut: (e: any) => void;
64
- cellMouseUp: (e: any) => void;
65
- cellMouseDown: (e: any) => void;
66
47
  ColumnsDisplay: (field?: string | undefined, width?: number | undefined) => {
67
48
  headerSort: boolean;
68
49
  download: boolean;
@@ -85,28 +66,6 @@ export declare const ReplaceFolderName: (str: string) => string;
85
66
  export declare const SortIconClassName: <T>(uid: string) => (key: T) => string;
86
67
  export declare const GetCellHtml: (html: string, style?: string) => string;
87
68
  export declare const GetHeaderHtml: (html: string, style?: string) => string;
88
- /** Data-Row-Table ボタン列 */
89
- export declare const GetListTableBtnSetting: (arg: {
90
- detailUrl: string | null;
91
- mode: "select" | "detail";
92
- actionBtnTheme: Theme;
93
- componentName: string;
94
- TabulatorFunc: typeof TabulatorFunc;
95
- emit: any;
96
- size: string;
97
- }) => {
98
- title: string;
99
- formatter: (cell: any) => string;
100
- cellClick: (e: any, cell: any) => void;
101
- cellMouseUp: (e: any) => void;
102
- cellMouseOut: (e: any) => void;
103
- cellMouseDown: (e: any) => void;
104
- headerSort: boolean;
105
- download: boolean;
106
- field: string | undefined;
107
- width: string | undefined;
108
- minWidth: string | undefined;
109
- };
110
69
  /** List用 並べ替え処理 */
111
70
  export declare const ListOriginSortItems: <T>(arg: {
112
71
  a: T;
@@ -1,38 +1,4 @@
1
- import { Int } from "./number.js";
2
1
  import { ObjectCopy } from "./object.js";
3
- import { useHsMultiLang } from "../composables/use-hs-multi-lang.js";
4
- import { GetGolorCode } from "../utils/theme.js";
5
- export const cellMouseOut = (e) => {
6
- const elm = e.target;
7
- const overlays = elm.querySelectorAll("span.overlay");
8
- Array.from(overlays).forEach((child) => {
9
- child.classList.remove("flash");
10
- });
11
- };
12
- export const cellMouseUp = (e) => {
13
- const elm = e.target;
14
- const overlays = elm.querySelectorAll("span.overlay");
15
- Array.from(overlays).forEach((child) => {
16
- child.classList.remove("flash");
17
- });
18
- };
19
- export const cellMouseDown = (e) => {
20
- const elm = e.target;
21
- if (elm.classList.contains("table-cell-btn") === true) {
22
- const offsetX = e.offsetX;
23
- const offsetY = e.offsetY;
24
- const width = Int(elm.clientWidth) + 20;
25
- const overlays = elm.querySelectorAll("span.overlay");
26
- Array.from(overlays).forEach((child) => {
27
- child.style.top = `${-width + offsetY}px`;
28
- child.style.left = `${-width + offsetX}px`;
29
- child.style.width = `${width * 2}px`;
30
- child.style.height = `${width * 2}px`;
31
- child.classList.add("flash");
32
- setTimeout(() => child.classList.remove("flash"), 1e4);
33
- });
34
- }
35
- };
36
2
  export const ColumnsPropsDisplay = {
37
3
  headerSort: false,
38
4
  download: false
@@ -164,9 +130,6 @@ export const Option = (option) => {
164
130
  );
165
131
  };
166
132
  export const Func = {
167
- cellMouseOut,
168
- cellMouseUp,
169
- cellMouseDown,
170
133
  ColumnsDisplay,
171
134
  InitEmitFunc,
172
135
  Option
@@ -187,68 +150,8 @@ export const SortIconClassName = (uid) => {
187
150
  return `table-sort-${uid}-` + key;
188
151
  };
189
152
  };
190
- export const GetCellHtml = (html, style = "") => `<div class="v-cell-container" style="--row-height:28px;${style}">{replace}</div>`.replace(
191
- /\{replace\}/g,
192
- html
193
- );
194
- export const GetHeaderHtml = (html, style = "") => `<div class="v-cell-container" style="--row-height:28px;${style}">{replace}</div>`.replace(
195
- /\{replace\}/g,
196
- html
197
- );
198
- export const GetListTableBtnSetting = (arg) => {
199
- const {
200
- detailUrl,
201
- mode,
202
- actionBtnTheme,
203
- componentName,
204
- TabulatorFunc: TabulatorFunc2,
205
- emit,
206
- size
207
- } = arg;
208
- const storeMultiLang = useHsMultiLang();
209
- const tx = storeMultiLang.tx;
210
- return {
211
- ...TabulatorFunc2.ColumnsDisplay("", 100),
212
- title: ``,
213
- formatter: (cell) => {
214
- const row = cell.getRow().getData();
215
- const herf = (() => {
216
- if (mode !== "detail") return "";
217
- if (!detailUrl) return "";
218
- return `href="${detailUrl.replace(/new$/, "")}${row.pId}"`;
219
- })();
220
- const style = [
221
- `border:solid 2px ${GetGolorCode(actionBtnTheme)}`,
222
- `color:${GetGolorCode(actionBtnTheme)}`,
223
- `width:100%`
224
- ].join(";");
225
- const overlayBg = `bg-${actionBtnTheme}`;
226
- const caption = mode === "detail" ? tx({ ja: "\u8A73\u7D30", en: "Detail" }).value : tx({ ja: "\u9078\u629E", en: "Select" }).value;
227
- const icon = mode === "detail" ? `<i class="fa-solid fa-window-restore me-1"></i>` : `<i class="fa-solid fa-pen-to-square me-1"></i>`;
228
- return GetCellHtml(`
229
- <div class="v-cell-row" style="--row-size:${size};">
230
- <div class="v-cell" style="width:100%">
231
- <a class="table-cell-btn cursor-pointer" style="${style}" onclick="window.${componentName}_func(event);" ${herf}>
232
- ${icon}${caption}
233
- <span class='overlay ${overlayBg}'></span>
234
- </a>
235
- </div>
236
- </div>
237
- `);
238
- },
239
- cellClick: (e, cell) => {
240
- if (window[`${componentName}_flag`] === true) return;
241
- const row = cell.getRow().getData();
242
- if (e.target.classList.contains("table-cell-btn") === true) {
243
- emit("selected-id", row.id);
244
- emit("select-private-id", row.pId);
245
- }
246
- },
247
- cellMouseUp: TabulatorFunc2.cellMouseUp,
248
- cellMouseOut: TabulatorFunc2.cellMouseOut,
249
- cellMouseDown: TabulatorFunc2.cellMouseDown
250
- };
251
- };
153
+ export const GetCellHtml = (html, style = "") => `<div class="v-cell-container" style="--row-height:28px;${style}">{replace}</div>`.replace(/\{replace\}/g, html);
154
+ export const GetHeaderHtml = (html, style = "") => `<div class="v-cell-container" style="--row-height:28px;${style}">{replace}</div>`.replace(/\{replace\}/g, html);
252
155
  export const ListOriginSortItems = (arg) => {
253
156
  const { a, b, sortCount, SortReverse, sort } = arg;
254
157
  for (let i = 0; i < sortCount; i++) {
@@ -1,21 +1,21 @@
1
- export declare const Theme: {
2
- readonly main0: "main0";
3
- readonly main1: "main1";
4
- readonly main2: "main2";
5
- readonly main3: "main3";
6
- readonly accent1: "accent1";
7
- readonly accent2: "accent2";
8
- readonly info: "info";
9
- readonly link: "link";
10
- readonly download: "download";
11
- readonly success: "success";
12
- readonly warn: "warn";
13
- readonly error: "error";
14
- readonly white: "white";
15
- readonly black: "black";
16
- readonly dark: "dark";
17
- readonly back: "back";
1
+ import type { ThemeColor } from '#build/nuxt-hs-ui-next/types/theme';
2
+ export declare const GetColorCode: (theme: ThemeColor) => string;
3
+ export type { ThemeColor } from '#build/nuxt-hs-ui-next/types/theme';
4
+ export declare const Theme: Record<ThemeColor, ThemeColor>;
5
+ export declare function GetTextColor(bgHex: string, over?: string): '#000000' | '#ffffff';
6
+ export declare function pickTextColor(bgHex: string, over?: string): '#000000' | '#ffffff';
7
+ export declare function lighten(hex: string, delta?: number): string;
8
+ export declare function darken(hex: string, delta?: number): string;
9
+ export declare const microLighten: (hex: string) => string;
10
+ export declare const microDarken: (hex: string) => string;
11
+ export declare function MakeAlertColors(baseHex: string, opts?: {
12
+ tone?: 'soft' | 'ink';
13
+ bgDelta?: number;
14
+ inkDelta?: number;
15
+ borderDelta?: number;
16
+ over?: string;
17
+ }): {
18
+ bg: string;
19
+ text: string;
20
+ border: string;
18
21
  };
19
- export type Theme = (typeof Theme)[keyof typeof Theme];
20
- export declare const ThemeKyes: [keyof typeof Theme];
21
- export declare const GetGolorCode: (code: string) => any;