@pisell/core 1.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.
- package/README.md +1 -0
- package/es/config.d.ts +3 -0
- package/es/config.js +14 -0
- package/es/date/config.d.ts +3 -0
- package/es/date/config.js +21 -0
- package/es/date/index.d.ts +7 -0
- package/es/date/index.js +22 -0
- package/es/date/type.d.ts +7 -0
- package/es/date/type.js +1 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/locales/config.d.ts +24 -0
- package/es/locales/config.js +57 -0
- package/es/locales/en.d.ts +2 -0
- package/es/locales/en.js +1 -0
- package/es/locales/index.d.ts +55 -0
- package/es/locales/index.js +74 -0
- package/es/locales/type.d.ts +9 -0
- package/es/locales/type.js +1 -0
- package/es/locales/zh-CN.d.ts +2 -0
- package/es/locales/zh-CN.js +1 -0
- package/es/locales/zh-HK.d.ts +2 -0
- package/es/locales/zh-HK.js +1 -0
- package/es/type.d.ts +2 -0
- package/es/type.js +1 -0
- package/lib/config.d.ts +3 -0
- package/lib/config.js +36 -0
- package/lib/date/config.d.ts +3 -0
- package/lib/date/config.js +43 -0
- package/lib/date/index.d.ts +7 -0
- package/lib/date/index.js +50 -0
- package/lib/date/type.d.ts +7 -0
- package/lib/date/type.js +17 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +42 -0
- package/lib/locales/config.d.ts +24 -0
- package/lib/locales/config.js +63 -0
- package/lib/locales/en.d.ts +2 -0
- package/lib/locales/en.js +25 -0
- package/lib/locales/index.d.ts +55 -0
- package/lib/locales/index.js +69 -0
- package/lib/locales/type.d.ts +9 -0
- package/lib/locales/type.js +17 -0
- package/lib/locales/zh-CN.d.ts +2 -0
- package/lib/locales/zh-CN.js +25 -0
- package/lib/locales/zh-HK.d.ts +2 -0
- package/lib/locales/zh-HK.js +25 -0
- package/lib/type.d.ts +2 -0
- package/lib/type.js +17 -0
- package/package.json +30 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @pisell/core
|
package/es/config.d.ts
ADDED
package/es/config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
var defaultConfig = {};
|
|
8
|
+
var config = _objectSpread({}, defaultConfig);
|
|
9
|
+
export var setConfig = function setConfig(newConfig) {
|
|
10
|
+
config = _objectSpread(_objectSpread({}, config), newConfig);
|
|
11
|
+
};
|
|
12
|
+
export var getConfig = function getConfig() {
|
|
13
|
+
return config;
|
|
14
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
var defaultConfig = {
|
|
8
|
+
locale: 'en',
|
|
9
|
+
defaultFormats: {
|
|
10
|
+
'en': 'HH:mm DD/MM/YYYY',
|
|
11
|
+
'zh-CN': 'YYYY-MM-DD HH:mm',
|
|
12
|
+
'zh-HK': 'YYYY-MM-DD HH:mm'
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var config = _objectSpread({}, defaultConfig);
|
|
16
|
+
export var setConfig = function setConfig(newConfig) {
|
|
17
|
+
config = _objectSpread(_objectSpread({}, config), newConfig);
|
|
18
|
+
};
|
|
19
|
+
export var getConfig = function getConfig() {
|
|
20
|
+
return config;
|
|
21
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DateConfig } from './type';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
getConfig: () => DateConfig;
|
|
4
|
+
setConfig: (newConfig: Partial<DateConfig>) => void;
|
|
5
|
+
format: (date: any, locale?: string | undefined, format?: string | undefined) => string;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
package/es/date/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import dayjs from "dayjs";
|
|
8
|
+
import { getConfig, setConfig } from "./config";
|
|
9
|
+
import "../locales";
|
|
10
|
+
var format = function format(date, locale, _format) {
|
|
11
|
+
var config = getConfig();
|
|
12
|
+
var _config = _objectSpread(_objectSpread({}, config), {}, {
|
|
13
|
+
locale: locale || config.locale,
|
|
14
|
+
format: _format || config.defaultFormats[config.locale]
|
|
15
|
+
});
|
|
16
|
+
return dayjs(date).format(_config.defaultFormats[_config.locale]);
|
|
17
|
+
};
|
|
18
|
+
export default {
|
|
19
|
+
getConfig: getConfig,
|
|
20
|
+
setConfig: setConfig,
|
|
21
|
+
format: format
|
|
22
|
+
};
|
package/es/date/type.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/es/index.d.ts
ADDED
package/es/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LocaleConfig } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* @title: 默认配置
|
|
4
|
+
* @description:
|
|
5
|
+
* @return {*}
|
|
6
|
+
* @Author: zhiwei.Wang
|
|
7
|
+
*/
|
|
8
|
+
export declare const defaultConfig: LocaleConfig;
|
|
9
|
+
/**
|
|
10
|
+
* @title: 设置配置
|
|
11
|
+
* @description:
|
|
12
|
+
* @param {Partial} newConfig
|
|
13
|
+
* @return {*}
|
|
14
|
+
* @Author: zhiwei.Wang
|
|
15
|
+
*/
|
|
16
|
+
export declare const setConfig: (newConfig: Partial<LocaleConfig>) => LocaleConfig;
|
|
17
|
+
/**
|
|
18
|
+
* @title: 获取配置
|
|
19
|
+
* @description:
|
|
20
|
+
* @param {*} LocaleConfig
|
|
21
|
+
* @return {*}
|
|
22
|
+
* @Author: zhiwei.Wang
|
|
23
|
+
*/
|
|
24
|
+
export declare const getConfig: () => LocaleConfig;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import en from "./en";
|
|
8
|
+
import zhCN from "./zh-CN";
|
|
9
|
+
import zhHK from "./zh-HK";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @title: 默认配置
|
|
13
|
+
* @description:
|
|
14
|
+
* @return {*}
|
|
15
|
+
* @Author: zhiwei.Wang
|
|
16
|
+
*/
|
|
17
|
+
export var defaultConfig = {
|
|
18
|
+
// 当前语言
|
|
19
|
+
locale: 'en',
|
|
20
|
+
// 语言包
|
|
21
|
+
texts: {
|
|
22
|
+
'en': en,
|
|
23
|
+
'zh-CN': zhCN,
|
|
24
|
+
'zh-HK': zhHK
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @title: 当前配置
|
|
30
|
+
* @description:
|
|
31
|
+
* @return {*}
|
|
32
|
+
* @Author: zhiwei.Wang
|
|
33
|
+
*/
|
|
34
|
+
var config = _objectSpread({}, defaultConfig);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @title: 设置配置
|
|
38
|
+
* @description:
|
|
39
|
+
* @param {Partial} newConfig
|
|
40
|
+
* @return {*}
|
|
41
|
+
* @Author: zhiwei.Wang
|
|
42
|
+
*/
|
|
43
|
+
export var setConfig = function setConfig(newConfig) {
|
|
44
|
+
config = _objectSpread(_objectSpread({}, config), newConfig);
|
|
45
|
+
return config;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @title: 获取配置
|
|
50
|
+
* @description:
|
|
51
|
+
* @param {*} LocaleConfig
|
|
52
|
+
* @return {*}
|
|
53
|
+
* @Author: zhiwei.Wang
|
|
54
|
+
*/
|
|
55
|
+
export var getConfig = function getConfig() {
|
|
56
|
+
return config;
|
|
57
|
+
};
|
package/es/locales/en.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Locale } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* @title: 获取当前语言
|
|
4
|
+
* @description:
|
|
5
|
+
* @return {*}
|
|
6
|
+
* @Author: zhiwei.Wang
|
|
7
|
+
*/
|
|
8
|
+
export declare const getLocale: () => Locale;
|
|
9
|
+
/**
|
|
10
|
+
* @title: 当前语言包
|
|
11
|
+
* @description:
|
|
12
|
+
* @param {Locale} locale
|
|
13
|
+
* @return {*}
|
|
14
|
+
* @Author: zhiwei.Wang
|
|
15
|
+
*/
|
|
16
|
+
export declare const getCurrentTexts: (locale?: Locale) => {
|
|
17
|
+
[key: string]: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @title: 设置语言
|
|
21
|
+
* @description:
|
|
22
|
+
* @param {Locale} locale 语言
|
|
23
|
+
* @param {boolean} reload 是否强制刷新
|
|
24
|
+
* @return {*}
|
|
25
|
+
* @Author: zhiwei.Wang
|
|
26
|
+
*/
|
|
27
|
+
export declare const setLocale: (locale: Locale, reload?: boolean) => void;
|
|
28
|
+
/**
|
|
29
|
+
* @title: 获取多语言
|
|
30
|
+
* @description:
|
|
31
|
+
* @param {string} id
|
|
32
|
+
* @param {Locale} locale
|
|
33
|
+
* @return {*}
|
|
34
|
+
* @Author: zhiwei.Wang
|
|
35
|
+
*/
|
|
36
|
+
export declare const getText: (id: string, locale?: Locale) => string;
|
|
37
|
+
/**
|
|
38
|
+
* @title: 是否为中文
|
|
39
|
+
* @description:
|
|
40
|
+
* @return {*}
|
|
41
|
+
* @Author: zhiwei.Wang
|
|
42
|
+
*/
|
|
43
|
+
export declare const isCN: () => boolean;
|
|
44
|
+
declare const _default: {
|
|
45
|
+
getLocale: () => string;
|
|
46
|
+
getCurrentTexts: (locale?: string | undefined) => {
|
|
47
|
+
[key: string]: string;
|
|
48
|
+
};
|
|
49
|
+
setLocale: (locale: string, reload?: boolean) => void;
|
|
50
|
+
getText: (id: string, locale?: string | undefined) => string;
|
|
51
|
+
isCN: () => boolean;
|
|
52
|
+
getConfig: () => import("./type").LocaleConfig;
|
|
53
|
+
setConfig: (newConfig: Partial<import("./type").LocaleConfig>) => import("./type").LocaleConfig;
|
|
54
|
+
};
|
|
55
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { getConfig, setConfig } from "./config";
|
|
2
|
+
/**
|
|
3
|
+
* @title: 获取当前语言
|
|
4
|
+
* @description:
|
|
5
|
+
* @return {*}
|
|
6
|
+
* @Author: zhiwei.Wang
|
|
7
|
+
*/
|
|
8
|
+
export var getLocale = function getLocale() {
|
|
9
|
+
return getConfig().locale;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @title: 当前语言包
|
|
14
|
+
* @description:
|
|
15
|
+
* @param {Locale} locale
|
|
16
|
+
* @return {*}
|
|
17
|
+
* @Author: zhiwei.Wang
|
|
18
|
+
*/
|
|
19
|
+
export var getCurrentTexts = function getCurrentTexts(locale) {
|
|
20
|
+
var config = getConfig();
|
|
21
|
+
return config.texts[locale || config.locale];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @title: 设置语言
|
|
26
|
+
* @description:
|
|
27
|
+
* @param {Locale} locale 语言
|
|
28
|
+
* @param {boolean} reload 是否强制刷新
|
|
29
|
+
* @return {*}
|
|
30
|
+
* @Author: zhiwei.Wang
|
|
31
|
+
*/
|
|
32
|
+
export var setLocale = function setLocale(locale) {
|
|
33
|
+
var reload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
34
|
+
setConfig({
|
|
35
|
+
locale: locale
|
|
36
|
+
});
|
|
37
|
+
if (reload) {
|
|
38
|
+
window.location.reload();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @title: 获取多语言
|
|
45
|
+
* @description:
|
|
46
|
+
* @param {string} id
|
|
47
|
+
* @param {Locale} locale
|
|
48
|
+
* @return {*}
|
|
49
|
+
* @Author: zhiwei.Wang
|
|
50
|
+
*/
|
|
51
|
+
export var getText = function getText(id, locale) {
|
|
52
|
+
var _getCurrentTexts;
|
|
53
|
+
return ((_getCurrentTexts = getCurrentTexts(locale)) === null || _getCurrentTexts === void 0 ? void 0 : _getCurrentTexts[id]) || id;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @title: 是否为中文
|
|
58
|
+
* @description:
|
|
59
|
+
* @return {*}
|
|
60
|
+
* @Author: zhiwei.Wang
|
|
61
|
+
*/
|
|
62
|
+
export var isCN = function isCN() {
|
|
63
|
+
var locale = getLocale();
|
|
64
|
+
return locale === 'zh-CN' || locale === 'zh-HK';
|
|
65
|
+
};
|
|
66
|
+
export default {
|
|
67
|
+
getLocale: getLocale,
|
|
68
|
+
getCurrentTexts: getCurrentTexts,
|
|
69
|
+
setLocale: setLocale,
|
|
70
|
+
getText: getText,
|
|
71
|
+
isCN: isCN,
|
|
72
|
+
getConfig: getConfig,
|
|
73
|
+
setConfig: setConfig
|
|
74
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default {};
|
package/es/type.d.ts
ADDED
package/es/type.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/config.d.ts
ADDED
package/lib/config.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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/config.ts
|
|
20
|
+
var config_exports = {};
|
|
21
|
+
__export(config_exports, {
|
|
22
|
+
getConfig: () => getConfig,
|
|
23
|
+
setConfig: () => setConfig
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(config_exports);
|
|
26
|
+
var defaultConfig = {};
|
|
27
|
+
var config = { ...defaultConfig };
|
|
28
|
+
var setConfig = (newConfig) => {
|
|
29
|
+
config = { ...config, ...newConfig };
|
|
30
|
+
};
|
|
31
|
+
var getConfig = () => config;
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
getConfig,
|
|
35
|
+
setConfig
|
|
36
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
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/date/config.ts
|
|
20
|
+
var config_exports = {};
|
|
21
|
+
__export(config_exports, {
|
|
22
|
+
getConfig: () => getConfig,
|
|
23
|
+
setConfig: () => setConfig
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(config_exports);
|
|
26
|
+
var defaultConfig = {
|
|
27
|
+
locale: "en",
|
|
28
|
+
defaultFormats: {
|
|
29
|
+
"en": "HH:mm DD/MM/YYYY",
|
|
30
|
+
"zh-CN": "YYYY-MM-DD HH:mm",
|
|
31
|
+
"zh-HK": "YYYY-MM-DD HH:mm"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var config = { ...defaultConfig };
|
|
35
|
+
var setConfig = (newConfig) => {
|
|
36
|
+
config = { ...config, ...newConfig };
|
|
37
|
+
};
|
|
38
|
+
var getConfig = () => config;
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
getConfig,
|
|
42
|
+
setConfig
|
|
43
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DateConfig } from './type';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
getConfig: () => DateConfig;
|
|
4
|
+
setConfig: (newConfig: Partial<DateConfig>) => void;
|
|
5
|
+
format: (date: any, locale?: string | undefined, format?: string | undefined) => string;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/date/index.ts
|
|
30
|
+
var date_exports = {};
|
|
31
|
+
__export(date_exports, {
|
|
32
|
+
default: () => date_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(date_exports);
|
|
35
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
36
|
+
var import_config = require("./config");
|
|
37
|
+
var format = (date, locale, format2) => {
|
|
38
|
+
const config = (0, import_config.getConfig)();
|
|
39
|
+
const _config = {
|
|
40
|
+
...config,
|
|
41
|
+
locale: locale || config.locale,
|
|
42
|
+
format: format2 || config.defaultFormats[config.locale]
|
|
43
|
+
};
|
|
44
|
+
return (0, import_dayjs.default)(date).format(_config.defaultFormats[_config.locale]);
|
|
45
|
+
};
|
|
46
|
+
var date_default = {
|
|
47
|
+
getConfig: import_config.getConfig,
|
|
48
|
+
setConfig: import_config.setConfig,
|
|
49
|
+
format
|
|
50
|
+
};
|
package/lib/date/type.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/date/type.ts
|
|
16
|
+
var type_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(type_exports);
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/index.ts
|
|
30
|
+
var src_exports = {};
|
|
31
|
+
__export(src_exports, {
|
|
32
|
+
date: () => import_date.default,
|
|
33
|
+
locales: () => import_locales.default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
var import_date = __toESM(require("./date"));
|
|
37
|
+
var import_locales = __toESM(require("./locales"));
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
date,
|
|
41
|
+
locales
|
|
42
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LocaleConfig } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* @title: 默认配置
|
|
4
|
+
* @description:
|
|
5
|
+
* @return {*}
|
|
6
|
+
* @Author: zhiwei.Wang
|
|
7
|
+
*/
|
|
8
|
+
export declare const defaultConfig: LocaleConfig;
|
|
9
|
+
/**
|
|
10
|
+
* @title: 设置配置
|
|
11
|
+
* @description:
|
|
12
|
+
* @param {Partial} newConfig
|
|
13
|
+
* @return {*}
|
|
14
|
+
* @Author: zhiwei.Wang
|
|
15
|
+
*/
|
|
16
|
+
export declare const setConfig: (newConfig: Partial<LocaleConfig>) => LocaleConfig;
|
|
17
|
+
/**
|
|
18
|
+
* @title: 获取配置
|
|
19
|
+
* @description:
|
|
20
|
+
* @param {*} LocaleConfig
|
|
21
|
+
* @return {*}
|
|
22
|
+
* @Author: zhiwei.Wang
|
|
23
|
+
*/
|
|
24
|
+
export declare const getConfig: () => LocaleConfig;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/locales/config.ts
|
|
30
|
+
var config_exports = {};
|
|
31
|
+
__export(config_exports, {
|
|
32
|
+
defaultConfig: () => defaultConfig,
|
|
33
|
+
getConfig: () => getConfig,
|
|
34
|
+
setConfig: () => setConfig
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(config_exports);
|
|
37
|
+
var import_en = __toESM(require("./en"));
|
|
38
|
+
var import_zh_CN = __toESM(require("./zh-CN"));
|
|
39
|
+
var import_zh_HK = __toESM(require("./zh-HK"));
|
|
40
|
+
var defaultConfig = {
|
|
41
|
+
// 当前语言
|
|
42
|
+
locale: "en",
|
|
43
|
+
// 语言包
|
|
44
|
+
texts: {
|
|
45
|
+
"en": import_en.default,
|
|
46
|
+
"zh-CN": import_zh_CN.default,
|
|
47
|
+
"zh-HK": import_zh_HK.default
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var config = {
|
|
51
|
+
...defaultConfig
|
|
52
|
+
};
|
|
53
|
+
var setConfig = (newConfig) => {
|
|
54
|
+
config = { ...config, ...newConfig };
|
|
55
|
+
return config;
|
|
56
|
+
};
|
|
57
|
+
var getConfig = () => config;
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
defaultConfig,
|
|
61
|
+
getConfig,
|
|
62
|
+
setConfig
|
|
63
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
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/locales/en.ts
|
|
20
|
+
var en_exports = {};
|
|
21
|
+
__export(en_exports, {
|
|
22
|
+
default: () => en_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(en_exports);
|
|
25
|
+
var en_default = {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Locale } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* @title: 获取当前语言
|
|
4
|
+
* @description:
|
|
5
|
+
* @return {*}
|
|
6
|
+
* @Author: zhiwei.Wang
|
|
7
|
+
*/
|
|
8
|
+
export declare const getLocale: () => Locale;
|
|
9
|
+
/**
|
|
10
|
+
* @title: 当前语言包
|
|
11
|
+
* @description:
|
|
12
|
+
* @param {Locale} locale
|
|
13
|
+
* @return {*}
|
|
14
|
+
* @Author: zhiwei.Wang
|
|
15
|
+
*/
|
|
16
|
+
export declare const getCurrentTexts: (locale?: Locale) => {
|
|
17
|
+
[key: string]: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @title: 设置语言
|
|
21
|
+
* @description:
|
|
22
|
+
* @param {Locale} locale 语言
|
|
23
|
+
* @param {boolean} reload 是否强制刷新
|
|
24
|
+
* @return {*}
|
|
25
|
+
* @Author: zhiwei.Wang
|
|
26
|
+
*/
|
|
27
|
+
export declare const setLocale: (locale: Locale, reload?: boolean) => void;
|
|
28
|
+
/**
|
|
29
|
+
* @title: 获取多语言
|
|
30
|
+
* @description:
|
|
31
|
+
* @param {string} id
|
|
32
|
+
* @param {Locale} locale
|
|
33
|
+
* @return {*}
|
|
34
|
+
* @Author: zhiwei.Wang
|
|
35
|
+
*/
|
|
36
|
+
export declare const getText: (id: string, locale?: Locale) => string;
|
|
37
|
+
/**
|
|
38
|
+
* @title: 是否为中文
|
|
39
|
+
* @description:
|
|
40
|
+
* @return {*}
|
|
41
|
+
* @Author: zhiwei.Wang
|
|
42
|
+
*/
|
|
43
|
+
export declare const isCN: () => boolean;
|
|
44
|
+
declare const _default: {
|
|
45
|
+
getLocale: () => string;
|
|
46
|
+
getCurrentTexts: (locale?: string | undefined) => {
|
|
47
|
+
[key: string]: string;
|
|
48
|
+
};
|
|
49
|
+
setLocale: (locale: string, reload?: boolean) => void;
|
|
50
|
+
getText: (id: string, locale?: string | undefined) => string;
|
|
51
|
+
isCN: () => boolean;
|
|
52
|
+
getConfig: () => import("./type").LocaleConfig;
|
|
53
|
+
setConfig: (newConfig: Partial<import("./type").LocaleConfig>) => import("./type").LocaleConfig;
|
|
54
|
+
};
|
|
55
|
+
export default _default;
|
|
@@ -0,0 +1,69 @@
|
|
|
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/locales/index.ts
|
|
20
|
+
var locales_exports = {};
|
|
21
|
+
__export(locales_exports, {
|
|
22
|
+
default: () => locales_default,
|
|
23
|
+
getCurrentTexts: () => getCurrentTexts,
|
|
24
|
+
getLocale: () => getLocale,
|
|
25
|
+
getText: () => getText,
|
|
26
|
+
isCN: () => isCN,
|
|
27
|
+
setLocale: () => setLocale
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(locales_exports);
|
|
30
|
+
var import_config = require("./config");
|
|
31
|
+
var getLocale = () => {
|
|
32
|
+
return (0, import_config.getConfig)().locale;
|
|
33
|
+
};
|
|
34
|
+
var getCurrentTexts = (locale) => {
|
|
35
|
+
let config = (0, import_config.getConfig)();
|
|
36
|
+
return config.texts[locale || config.locale];
|
|
37
|
+
};
|
|
38
|
+
var setLocale = (locale, reload = false) => {
|
|
39
|
+
(0, import_config.setConfig)({ locale });
|
|
40
|
+
if (reload) {
|
|
41
|
+
window.location.reload();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var getText = (id, locale) => {
|
|
46
|
+
var _a;
|
|
47
|
+
return ((_a = getCurrentTexts(locale)) == null ? void 0 : _a[id]) || id;
|
|
48
|
+
};
|
|
49
|
+
var isCN = () => {
|
|
50
|
+
let locale = getLocale();
|
|
51
|
+
return locale === "zh-CN" || locale === "zh-HK";
|
|
52
|
+
};
|
|
53
|
+
var locales_default = {
|
|
54
|
+
getLocale,
|
|
55
|
+
getCurrentTexts,
|
|
56
|
+
setLocale,
|
|
57
|
+
getText,
|
|
58
|
+
isCN,
|
|
59
|
+
getConfig: import_config.getConfig,
|
|
60
|
+
setConfig: import_config.setConfig
|
|
61
|
+
};
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
getCurrentTexts,
|
|
65
|
+
getLocale,
|
|
66
|
+
getText,
|
|
67
|
+
isCN,
|
|
68
|
+
setLocale
|
|
69
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/locales/type.ts
|
|
16
|
+
var type_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(type_exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
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/locales/zh-CN.ts
|
|
20
|
+
var zh_CN_exports = {};
|
|
21
|
+
__export(zh_CN_exports, {
|
|
22
|
+
default: () => zh_CN_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(zh_CN_exports);
|
|
25
|
+
var zh_CN_default = {};
|
|
@@ -0,0 +1,25 @@
|
|
|
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/locales/zh-HK.ts
|
|
20
|
+
var zh_HK_exports = {};
|
|
21
|
+
__export(zh_HK_exports, {
|
|
22
|
+
default: () => zh_HK_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(zh_HK_exports);
|
|
25
|
+
var zh_HK_default = {};
|
package/lib/type.d.ts
ADDED
package/lib/type.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/type.ts
|
|
16
|
+
var type_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(type_exports);
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pisell/core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"module": "./es/index.js",
|
|
7
|
+
"types": "./lib/index.d.ts",
|
|
8
|
+
"typings": "./lib/index.d.ts",
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"react": "^18.0.0",
|
|
11
|
+
"father": "^4.1.0",
|
|
12
|
+
"dayjs": "^1.11.9",
|
|
13
|
+
"axios": "^1.7.2",
|
|
14
|
+
"js-md5": "^0.8.3"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {},
|
|
17
|
+
"files": [
|
|
18
|
+
"es",
|
|
19
|
+
"lib",
|
|
20
|
+
"package.json",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "father build",
|
|
28
|
+
"dev": "father dev"
|
|
29
|
+
}
|
|
30
|
+
}
|