nuxt-hs-ui 2.0.37 → 2.1.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/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.15.0"
6
6
  },
7
- "version": "2.0.37",
7
+ "version": "2.1.1",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -32,7 +32,6 @@ const props = withDefaults(defineProps<Props>(), {
32
32
  show: false,
33
33
  mounted: true,
34
34
  zIndex: undefined,
35
- focusLock: false,
36
35
  closeable: false,
37
36
  });
38
37
 
@@ -5,6 +5,7 @@ interface StoreState {
5
5
  fallBack: string;
6
6
  dateFormat: string;
7
7
  isInit: boolean;
8
+ showLog: boolean;
8
9
  };
9
10
  }
10
11
  export declare const useHsMultiLang: import("pinia").StoreDefinition<"HsMultiLang", StoreState, {
@@ -14,6 +15,7 @@ export declare const useHsMultiLang: import("pinia").StoreDefinition<"HsMultiLan
14
15
  fallBack: string;
15
16
  dateFormat: string;
16
17
  isInit: boolean;
18
+ showLog: boolean;
17
19
  };
18
20
  } & import("pinia").PiniaCustomStateProperties<StoreState>): string;
19
21
  dateFormat(state: {
@@ -22,6 +24,7 @@ export declare const useHsMultiLang: import("pinia").StoreDefinition<"HsMultiLan
22
24
  fallBack: string;
23
25
  dateFormat: string;
24
26
  isInit: boolean;
27
+ showLog: boolean;
25
28
  };
26
29
  } & import("pinia").PiniaCustomStateProperties<StoreState>): string;
27
30
  }, {
@@ -11,7 +11,8 @@ export const useHsMultiLang = defineStore("HsMultiLang", {
11
11
  lang: "ja",
12
12
  fallBack: "ja",
13
13
  dateFormat: "YYYY-MM-DD",
14
- isInit: false
14
+ isInit: false,
15
+ showLog: false
15
16
  }
16
17
  };
17
18
  },
@@ -28,6 +29,9 @@ export const useHsMultiLang = defineStore("HsMultiLang", {
28
29
  init(arg) {
29
30
  const state = this.state;
30
31
  if (state.isInit) return;
32
+ if (arg.lang !== void 0) {
33
+ state.lang = arg.lang;
34
+ }
31
35
  const changeLangFunc = arg.changeLangFunc === void 0 ? (lang) => {
32
36
  if (lang === "ja") {
33
37
  dayjs.locale(ja);
@@ -48,9 +52,14 @@ export const useHsMultiLang = defineStore("HsMultiLang", {
48
52
  const state = this.state;
49
53
  return computed(() => {
50
54
  if (lang) {
51
- return GetTextByMultiLang(text, lang, state.fallBack);
55
+ return GetTextByMultiLang(text, lang, state.fallBack, state.showLog);
52
56
  }
53
- return GetTextByMultiLang(text, state.lang, state.fallBack);
57
+ return GetTextByMultiLang(
58
+ text,
59
+ state.lang,
60
+ state.fallBack,
61
+ state.showLog
62
+ );
54
63
  });
55
64
  }
56
65
  // ---------------------
@@ -1,7 +1,7 @@
1
1
  export type MultiLang = string | {
2
2
  [key: string]: string;
3
3
  };
4
- export declare const GetTextByMultiLang: (text: MultiLang, lang: string, fallBackLang?: string | undefined) => string;
4
+ export declare const GetTextByMultiLang: (text: MultiLang, lang: string, fallBackLang?: string | undefined, showLog?: boolean) => string;
5
5
  /**
6
6
  * 複数のマルチ言語データを結合します
7
7
  * @returns MultiLangオブジェクト
@@ -1,23 +1,27 @@
1
1
  const isObject = (value) => {
2
2
  return value !== null && typeof value === "object";
3
3
  };
4
- export const GetTextByMultiLang = (text, lang, fallBackLang) => {
4
+ export const GetTextByMultiLang = (text, lang, fallBackLang, showLog) => {
5
5
  if (!isObject(text)) {
6
6
  return String(text);
7
7
  }
8
8
  if (lang in text) {
9
9
  return text[lang];
10
10
  } else if (fallBackLang !== void 0 && fallBackLang in text) {
11
- console.error(
12
- `GetTextByMultiLang :: Language fallback [${lang} -> en]`,
13
- text
14
- );
11
+ if (showLog === true) {
12
+ console.error(
13
+ `GetTextByMultiLang :: Language fallback [${lang} -> en]`,
14
+ text
15
+ );
16
+ }
15
17
  return text[fallBackLang] || "";
16
18
  } else {
17
- console.error(
18
- `GetTextByMultiLang :: Language Error [${lang} -> en]`,
19
- text
20
- );
19
+ if (showLog === true) {
20
+ console.error(
21
+ `GetTextByMultiLang :: Language Error [${lang} -> en]`,
22
+ text
23
+ );
24
+ }
21
25
  return JSON.stringify(text);
22
26
  }
23
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-hs-ui",
3
- "version": "2.0.37",
3
+ "version": "2.1.1",
4
4
  "description": "My new Nuxt module",
5
5
  "repository": "https://github.com/hare-systems-ryo/nuxt-hs-ui",
6
6
  "license": "MIT",
@@ -152,4 +152,4 @@
152
152
  "vitest": "^2.1.8",
153
153
  "vue-tsc": "^2.2.0"
154
154
  }
155
- }
155
+ }