@pisell/utils 1.0.60 → 1.0.61
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/es/componentStorage.d.ts +29 -0
- package/es/componentStorage.js +114 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/locales.d.ts +1 -5
- package/es/locales.js +8 -3
- package/lib/componentStorage.d.ts +29 -0
- package/lib/componentStorage.js +124 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/locales.d.ts +1 -5
- package/lib/locales.js +8 -3
- package/package.json +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** 生成存储 key 的路径后缀:pathname 或 pathname#memory_key(来自 URL memory_key 参数) */
|
|
2
|
+
export declare function getStorageKeySuffix(): string;
|
|
3
|
+
/**
|
|
4
|
+
* 生成组件实例的存储 key。
|
|
5
|
+
* @param componentId 组件实例 id(如 __id)
|
|
6
|
+
* @param prefix 前缀,如 'table-setting'、'record-board-column-visibility'
|
|
7
|
+
*/
|
|
8
|
+
export declare function getComponentStorageKey(componentId: string, prefix: string): string;
|
|
9
|
+
export interface ColumnSettingStorageItem {
|
|
10
|
+
key: string;
|
|
11
|
+
dataIndex: string;
|
|
12
|
+
title?: unknown;
|
|
13
|
+
titleString?: string;
|
|
14
|
+
isShow: boolean;
|
|
15
|
+
sortIndex?: number;
|
|
16
|
+
fixed?: 'left' | 'right' | boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function saveColumnSettingToLocal(params: {
|
|
19
|
+
componentId: string;
|
|
20
|
+
columnSetting: ColumnSettingStorageItem[];
|
|
21
|
+
}): void;
|
|
22
|
+
export declare function getColumnSettingFromLocal(componentId?: string): ColumnSettingStorageItem[] | null;
|
|
23
|
+
export declare function clearColumnSettingFromLocal(componentId?: string): void;
|
|
24
|
+
export declare function saveColumnVisibilityToLocal(params: {
|
|
25
|
+
componentId: string;
|
|
26
|
+
columnVisibility: Record<string, boolean>;
|
|
27
|
+
}): void;
|
|
28
|
+
export declare function getColumnVisibilityFromLocal(componentId?: string): Record<string, boolean> | null;
|
|
29
|
+
export declare function clearColumnVisibilityFromLocal(componentId?: string): void;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
/**
|
|
3
|
+
* 组件级 localStorage 存储:列设置、列显隐等。
|
|
4
|
+
* 供 pisellDataSourceContainer、pisellRecordBoard 等复用,key 含 pathname 与 memory_key 以区分页面。
|
|
5
|
+
*/
|
|
6
|
+
import { isJson } from "./typeUtils";
|
|
7
|
+
|
|
8
|
+
/** 生成存储 key 的路径后缀:pathname 或 pathname#memory_key(来自 URL memory_key 参数) */
|
|
9
|
+
export function getStorageKeySuffix() {
|
|
10
|
+
if (typeof window === 'undefined' || typeof window.location === 'undefined') {
|
|
11
|
+
return '/';
|
|
12
|
+
}
|
|
13
|
+
var _window$location = window.location,
|
|
14
|
+
pathname = _window$location.pathname,
|
|
15
|
+
search = _window$location.search;
|
|
16
|
+
var appendPath = pathname || '/';
|
|
17
|
+
var memoryKey = '';
|
|
18
|
+
try {
|
|
19
|
+
var params = new URLSearchParams(search || '');
|
|
20
|
+
var mk = params.get('memory_key');
|
|
21
|
+
if (mk && mk.trim() !== '') memoryKey = mk.trim();
|
|
22
|
+
} catch (_unused) {
|
|
23
|
+
// ignore
|
|
24
|
+
}
|
|
25
|
+
return memoryKey ? "".concat(appendPath, "#").concat(memoryKey) : appendPath;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 生成组件实例的存储 key。
|
|
30
|
+
* @param componentId 组件实例 id(如 __id)
|
|
31
|
+
* @param prefix 前缀,如 'table-setting'、'record-board-column-visibility'
|
|
32
|
+
*/
|
|
33
|
+
export function getComponentStorageKey(componentId, prefix) {
|
|
34
|
+
if (typeof window === 'undefined' || typeof window.location === 'undefined') {
|
|
35
|
+
return "".concat(prefix, "-").concat(componentId);
|
|
36
|
+
}
|
|
37
|
+
var suffix = getStorageKeySuffix();
|
|
38
|
+
return "".concat(prefix, "-").concat(componentId, "-").concat(suffix);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ---------- 列设置(DataSourceContainer Table 列显隐+排序等,数组格式) ----------
|
|
42
|
+
|
|
43
|
+
export function saveColumnSettingToLocal(params) {
|
|
44
|
+
var componentId = params.componentId,
|
|
45
|
+
columnSetting = params.columnSetting;
|
|
46
|
+
if (!componentId) return;
|
|
47
|
+
if (typeof window === 'undefined' || !window.localStorage) return;
|
|
48
|
+
var storageKey = getComponentStorageKey(componentId, 'table-setting');
|
|
49
|
+
var data = {
|
|
50
|
+
column_setting: columnSetting,
|
|
51
|
+
updatedAt: Date.now()
|
|
52
|
+
};
|
|
53
|
+
try {
|
|
54
|
+
window.localStorage.setItem(storageKey, JSON.stringify(data));
|
|
55
|
+
} catch (_unused2) {
|
|
56
|
+
// ignore
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export function getColumnSettingFromLocal(componentId) {
|
|
60
|
+
if (!componentId) return null;
|
|
61
|
+
if (typeof window === 'undefined' || !window.localStorage) return null;
|
|
62
|
+
var storageKey = getComponentStorageKey(componentId, 'table-setting');
|
|
63
|
+
var raw = window.localStorage.getItem(storageKey);
|
|
64
|
+
if (raw && isJson(raw)) {
|
|
65
|
+
var data = JSON.parse(raw);
|
|
66
|
+
var arr = data === null || data === void 0 ? void 0 : data.column_setting;
|
|
67
|
+
return Array.isArray(arr) ? arr : null;
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
export function clearColumnSettingFromLocal(componentId) {
|
|
72
|
+
if (!componentId) return;
|
|
73
|
+
if (typeof window === 'undefined' || !window.localStorage) return;
|
|
74
|
+
var storageKey = getComponentStorageKey(componentId, 'table-setting');
|
|
75
|
+
window.localStorage.removeItem(storageKey);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ---------- 列显隐(RecordBoard,Record<列 key, boolean> 格式) ----------
|
|
79
|
+
|
|
80
|
+
var RECORD_BOARD_VISIBILITY_PREFIX = 'record-board-column-visibility';
|
|
81
|
+
export function saveColumnVisibilityToLocal(params) {
|
|
82
|
+
var componentId = params.componentId,
|
|
83
|
+
columnVisibility = params.columnVisibility;
|
|
84
|
+
if (!componentId) return;
|
|
85
|
+
if (typeof window === 'undefined' || !window.localStorage) return;
|
|
86
|
+
var storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
|
|
87
|
+
var data = {
|
|
88
|
+
column_visibility: columnVisibility,
|
|
89
|
+
updatedAt: Date.now()
|
|
90
|
+
};
|
|
91
|
+
try {
|
|
92
|
+
window.localStorage.setItem(storageKey, JSON.stringify(data));
|
|
93
|
+
} catch (_unused3) {
|
|
94
|
+
// ignore
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export function getColumnVisibilityFromLocal(componentId) {
|
|
98
|
+
if (!componentId) return null;
|
|
99
|
+
if (typeof window === 'undefined' || !window.localStorage) return null;
|
|
100
|
+
var storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
|
|
101
|
+
var raw = window.localStorage.getItem(storageKey);
|
|
102
|
+
if (raw && isJson(raw)) {
|
|
103
|
+
var data = JSON.parse(raw);
|
|
104
|
+
var vis = data === null || data === void 0 ? void 0 : data.column_visibility;
|
|
105
|
+
return vis && _typeof(vis) === 'object' && vis !== null ? vis : null;
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
export function clearColumnVisibilityFromLocal(componentId) {
|
|
110
|
+
if (!componentId) return;
|
|
111
|
+
if (typeof window === 'undefined' || !window.localStorage) return;
|
|
112
|
+
var storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
|
|
113
|
+
window.localStorage.removeItem(storageKey);
|
|
114
|
+
}
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
|
@@ -6,6 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
export * from "./otherUtils";
|
|
8
8
|
export * from "./typeUtils";
|
|
9
|
+
export * from "./componentStorage";
|
|
9
10
|
export * from "./document";
|
|
10
11
|
export * from "./date";
|
|
11
12
|
export * from "./platform";
|
package/es/locales.d.ts
CHANGED
package/es/locales.js
CHANGED
|
@@ -8,7 +8,9 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
8
8
|
var localeMaps = {
|
|
9
9
|
en: {},
|
|
10
10
|
'zh-CN': {},
|
|
11
|
-
'zh-HK': {}
|
|
11
|
+
'zh-HK': {},
|
|
12
|
+
'ja': {},
|
|
13
|
+
'pt': {}
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
// 当前语言
|
|
@@ -24,7 +26,9 @@ var formatLocale = function formatLocale(_locale) {
|
|
|
24
26
|
'zh-CN': 'zh-CN',
|
|
25
27
|
'zh-HK': 'zh-HK',
|
|
26
28
|
'zh-TW': 'zh-HK',
|
|
27
|
-
'en-US': 'en'
|
|
29
|
+
'en-US': 'en',
|
|
30
|
+
'ja': 'ja',
|
|
31
|
+
'pt': 'pt'
|
|
28
32
|
};
|
|
29
33
|
return obj[_locale] || 'en';
|
|
30
34
|
};
|
|
@@ -62,7 +66,8 @@ var init = function init(_localeMaps, _locale) {
|
|
|
62
66
|
* @Date: 2024-01-17 21:39
|
|
63
67
|
*/
|
|
64
68
|
var getText = function getText(id) {
|
|
65
|
-
|
|
69
|
+
var _localeMaps2;
|
|
70
|
+
return localeMap[id] || ((_localeMaps2 = localeMaps) === null || _localeMaps2 === void 0 || (_localeMaps2 = _localeMaps2['en']) === null || _localeMaps2 === void 0 ? void 0 : _localeMaps2[id]) || id;
|
|
66
71
|
};
|
|
67
72
|
export var locales = {
|
|
68
73
|
init: init,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** 生成存储 key 的路径后缀:pathname 或 pathname#memory_key(来自 URL memory_key 参数) */
|
|
2
|
+
export declare function getStorageKeySuffix(): string;
|
|
3
|
+
/**
|
|
4
|
+
* 生成组件实例的存储 key。
|
|
5
|
+
* @param componentId 组件实例 id(如 __id)
|
|
6
|
+
* @param prefix 前缀,如 'table-setting'、'record-board-column-visibility'
|
|
7
|
+
*/
|
|
8
|
+
export declare function getComponentStorageKey(componentId: string, prefix: string): string;
|
|
9
|
+
export interface ColumnSettingStorageItem {
|
|
10
|
+
key: string;
|
|
11
|
+
dataIndex: string;
|
|
12
|
+
title?: unknown;
|
|
13
|
+
titleString?: string;
|
|
14
|
+
isShow: boolean;
|
|
15
|
+
sortIndex?: number;
|
|
16
|
+
fixed?: 'left' | 'right' | boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function saveColumnSettingToLocal(params: {
|
|
19
|
+
componentId: string;
|
|
20
|
+
columnSetting: ColumnSettingStorageItem[];
|
|
21
|
+
}): void;
|
|
22
|
+
export declare function getColumnSettingFromLocal(componentId?: string): ColumnSettingStorageItem[] | null;
|
|
23
|
+
export declare function clearColumnSettingFromLocal(componentId?: string): void;
|
|
24
|
+
export declare function saveColumnVisibilityToLocal(params: {
|
|
25
|
+
componentId: string;
|
|
26
|
+
columnVisibility: Record<string, boolean>;
|
|
27
|
+
}): void;
|
|
28
|
+
export declare function getColumnVisibilityFromLocal(componentId?: string): Record<string, boolean> | null;
|
|
29
|
+
export declare function clearColumnVisibilityFromLocal(componentId?: string): void;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/componentStorage.ts
|
|
20
|
+
var componentStorage_exports = {};
|
|
21
|
+
__export(componentStorage_exports, {
|
|
22
|
+
clearColumnSettingFromLocal: () => clearColumnSettingFromLocal,
|
|
23
|
+
clearColumnVisibilityFromLocal: () => clearColumnVisibilityFromLocal,
|
|
24
|
+
getColumnSettingFromLocal: () => getColumnSettingFromLocal,
|
|
25
|
+
getColumnVisibilityFromLocal: () => getColumnVisibilityFromLocal,
|
|
26
|
+
getComponentStorageKey: () => getComponentStorageKey,
|
|
27
|
+
getStorageKeySuffix: () => getStorageKeySuffix,
|
|
28
|
+
saveColumnSettingToLocal: () => saveColumnSettingToLocal,
|
|
29
|
+
saveColumnVisibilityToLocal: () => saveColumnVisibilityToLocal
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(componentStorage_exports);
|
|
32
|
+
var import_typeUtils = require("./typeUtils");
|
|
33
|
+
function getStorageKeySuffix() {
|
|
34
|
+
if (typeof window === "undefined" || typeof window.location === "undefined") {
|
|
35
|
+
return "/";
|
|
36
|
+
}
|
|
37
|
+
const { pathname, search } = window.location;
|
|
38
|
+
const appendPath = pathname || "/";
|
|
39
|
+
let memoryKey = "";
|
|
40
|
+
try {
|
|
41
|
+
const params = new URLSearchParams(search || "");
|
|
42
|
+
const mk = params.get("memory_key");
|
|
43
|
+
if (mk && mk.trim() !== "") memoryKey = mk.trim();
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
return memoryKey ? `${appendPath}#${memoryKey}` : appendPath;
|
|
47
|
+
}
|
|
48
|
+
function getComponentStorageKey(componentId, prefix) {
|
|
49
|
+
if (typeof window === "undefined" || typeof window.location === "undefined") {
|
|
50
|
+
return `${prefix}-${componentId}`;
|
|
51
|
+
}
|
|
52
|
+
const suffix = getStorageKeySuffix();
|
|
53
|
+
return `${prefix}-${componentId}-${suffix}`;
|
|
54
|
+
}
|
|
55
|
+
function saveColumnSettingToLocal(params) {
|
|
56
|
+
const { componentId, columnSetting } = params;
|
|
57
|
+
if (!componentId) return;
|
|
58
|
+
if (typeof window === "undefined" || !window.localStorage) return;
|
|
59
|
+
const storageKey = getComponentStorageKey(componentId, "table-setting");
|
|
60
|
+
const data = { column_setting: columnSetting, updatedAt: Date.now() };
|
|
61
|
+
try {
|
|
62
|
+
window.localStorage.setItem(storageKey, JSON.stringify(data));
|
|
63
|
+
} catch {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function getColumnSettingFromLocal(componentId) {
|
|
67
|
+
if (!componentId) return null;
|
|
68
|
+
if (typeof window === "undefined" || !window.localStorage) return null;
|
|
69
|
+
const storageKey = getComponentStorageKey(componentId, "table-setting");
|
|
70
|
+
const raw = window.localStorage.getItem(storageKey);
|
|
71
|
+
if (raw && (0, import_typeUtils.isJson)(raw)) {
|
|
72
|
+
const data = JSON.parse(raw);
|
|
73
|
+
const arr = data == null ? void 0 : data.column_setting;
|
|
74
|
+
return Array.isArray(arr) ? arr : null;
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
function clearColumnSettingFromLocal(componentId) {
|
|
79
|
+
if (!componentId) return;
|
|
80
|
+
if (typeof window === "undefined" || !window.localStorage) return;
|
|
81
|
+
const storageKey = getComponentStorageKey(componentId, "table-setting");
|
|
82
|
+
window.localStorage.removeItem(storageKey);
|
|
83
|
+
}
|
|
84
|
+
var RECORD_BOARD_VISIBILITY_PREFIX = "record-board-column-visibility";
|
|
85
|
+
function saveColumnVisibilityToLocal(params) {
|
|
86
|
+
const { componentId, columnVisibility } = params;
|
|
87
|
+
if (!componentId) return;
|
|
88
|
+
if (typeof window === "undefined" || !window.localStorage) return;
|
|
89
|
+
const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
|
|
90
|
+
const data = { column_visibility: columnVisibility, updatedAt: Date.now() };
|
|
91
|
+
try {
|
|
92
|
+
window.localStorage.setItem(storageKey, JSON.stringify(data));
|
|
93
|
+
} catch {
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function getColumnVisibilityFromLocal(componentId) {
|
|
97
|
+
if (!componentId) return null;
|
|
98
|
+
if (typeof window === "undefined" || !window.localStorage) return null;
|
|
99
|
+
const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
|
|
100
|
+
const raw = window.localStorage.getItem(storageKey);
|
|
101
|
+
if (raw && (0, import_typeUtils.isJson)(raw)) {
|
|
102
|
+
const data = JSON.parse(raw);
|
|
103
|
+
const vis = data == null ? void 0 : data.column_visibility;
|
|
104
|
+
return vis && typeof vis === "object" && vis !== null ? vis : null;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
function clearColumnVisibilityFromLocal(componentId) {
|
|
109
|
+
if (!componentId) return;
|
|
110
|
+
if (typeof window === "undefined" || !window.localStorage) return;
|
|
111
|
+
const storageKey = getComponentStorageKey(componentId, RECORD_BOARD_VISIBILITY_PREFIX);
|
|
112
|
+
window.localStorage.removeItem(storageKey);
|
|
113
|
+
}
|
|
114
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
115
|
+
0 && (module.exports = {
|
|
116
|
+
clearColumnSettingFromLocal,
|
|
117
|
+
clearColumnVisibilityFromLocal,
|
|
118
|
+
getColumnSettingFromLocal,
|
|
119
|
+
getColumnVisibilityFromLocal,
|
|
120
|
+
getComponentStorageKey,
|
|
121
|
+
getStorageKeySuffix,
|
|
122
|
+
saveColumnSettingToLocal,
|
|
123
|
+
saveColumnVisibilityToLocal
|
|
124
|
+
});
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __export(src_exports, {
|
|
|
26
26
|
module.exports = __toCommonJS(src_exports);
|
|
27
27
|
__reExport(src_exports, require("./otherUtils"), module.exports);
|
|
28
28
|
__reExport(src_exports, require("./typeUtils"), module.exports);
|
|
29
|
+
__reExport(src_exports, require("./componentStorage"), module.exports);
|
|
29
30
|
__reExport(src_exports, require("./document"), module.exports);
|
|
30
31
|
__reExport(src_exports, require("./date"), module.exports);
|
|
31
32
|
__reExport(src_exports, require("./platform"), module.exports);
|
|
@@ -59,6 +60,7 @@ var getPisellUtilsConfig = () => {
|
|
|
59
60
|
setPisellUtilsConfig,
|
|
60
61
|
...require("./otherUtils"),
|
|
61
62
|
...require("./typeUtils"),
|
|
63
|
+
...require("./componentStorage"),
|
|
62
64
|
...require("./document"),
|
|
63
65
|
...require("./date"),
|
|
64
66
|
...require("./platform"),
|
package/lib/locales.d.ts
CHANGED
package/lib/locales.js
CHANGED
|
@@ -25,7 +25,9 @@ module.exports = __toCommonJS(locales_exports);
|
|
|
25
25
|
var localeMaps = {
|
|
26
26
|
en: {},
|
|
27
27
|
"zh-CN": {},
|
|
28
|
-
"zh-HK": {}
|
|
28
|
+
"zh-HK": {},
|
|
29
|
+
"ja": {},
|
|
30
|
+
"pt": {}
|
|
29
31
|
};
|
|
30
32
|
var locale = "en";
|
|
31
33
|
var localeMap = {};
|
|
@@ -35,7 +37,9 @@ var formatLocale = (_locale) => {
|
|
|
35
37
|
"zh-CN": "zh-CN",
|
|
36
38
|
"zh-HK": "zh-HK",
|
|
37
39
|
"zh-TW": "zh-HK",
|
|
38
|
-
"en-US": "en"
|
|
40
|
+
"en-US": "en",
|
|
41
|
+
"ja": "ja",
|
|
42
|
+
"pt": "pt"
|
|
39
43
|
};
|
|
40
44
|
return obj[_locale] || "en";
|
|
41
45
|
};
|
|
@@ -52,7 +56,8 @@ var init = (_localeMaps, _locale) => {
|
|
|
52
56
|
localeMap = localeMaps[locale];
|
|
53
57
|
};
|
|
54
58
|
var getText = (id) => {
|
|
55
|
-
|
|
59
|
+
var _a;
|
|
60
|
+
return localeMap[id] || ((_a = localeMaps == null ? void 0 : localeMaps["en"]) == null ? void 0 : _a[id]) || id;
|
|
56
61
|
};
|
|
57
62
|
var locales = {
|
|
58
63
|
init,
|