@nocobase/plugin-client 0.8.1-alpha.4 → 0.9.0-alpha.2
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/LICENSE +661 -201
- package/lib/antd.d.ts +1 -0
- package/lib/antd.js +20 -0
- package/lib/cron.d.ts +1 -0
- package/lib/cron.js +35 -0
- package/lib/cronstrue.d.ts +1 -0
- package/lib/cronstrue.js +88 -0
- package/lib/locale/en-US.json +1261 -0
- package/lib/locale/index.d.ts +2 -0
- package/lib/locale/index.js +10 -0
- package/lib/locale/zh-CN.json +1237 -0
- package/lib/moment-locale.d.ts +1 -0
- package/lib/moment-locale.js +149 -0
- package/lib/resource.d.ts +1 -0
- package/lib/resource.js +159 -0
- package/lib/server.js +56 -3
- package/package.json +5 -11
package/lib/antd.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getAntdLocale: (lang: any) => any;
|
package/lib/antd.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getAntdLocale = void 0;
|
|
7
|
+
|
|
8
|
+
const getAntdLocale = lang => {
|
|
9
|
+
const lng = lang.replace('-', '_');
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
require.resolve(`antd/lib/locale/${lng}`);
|
|
13
|
+
|
|
14
|
+
return require(`antd/lib/locale/${lng}`).default;
|
|
15
|
+
} catch (error) {
|
|
16
|
+
return require(`antd/lib/locale/en_US`).default;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.getAntdLocale = getAntdLocale;
|
package/lib/cron.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCronLocale: (lang: string) => any;
|
package/lib/cron.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCronLocale = void 0;
|
|
7
|
+
|
|
8
|
+
const getCronLocale = lang => {
|
|
9
|
+
let packageName = '@nocobase/client';
|
|
10
|
+
let locale = null;
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
var _require$cron;
|
|
14
|
+
|
|
15
|
+
const file = `${packageName}/src/locale`;
|
|
16
|
+
|
|
17
|
+
require.resolve(file);
|
|
18
|
+
|
|
19
|
+
locale = (_require$cron = require(file).cron) === null || _require$cron === void 0 ? void 0 : _require$cron[lang];
|
|
20
|
+
} catch (error) {
|
|
21
|
+
try {
|
|
22
|
+
var _require$cron2;
|
|
23
|
+
|
|
24
|
+
const file = `${packageName}/lib/locale`;
|
|
25
|
+
|
|
26
|
+
require.resolve(file);
|
|
27
|
+
|
|
28
|
+
locale = (_require$cron2 = require(file).cron) === null || _require$cron2 === void 0 ? void 0 : _require$cron2[lang];
|
|
29
|
+
} catch (error) {}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return locale || require('react-js-cron/dist/cjs/locale').DEFAULT_LOCALE_EN;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.getCronLocale = getCronLocale;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getCronstrueLocale: (lang: any) => {};
|
package/lib/cronstrue.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getCronstrueLocale = void 0;
|
|
7
|
+
|
|
8
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
9
|
+
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
|
+
|
|
14
|
+
const methods = ['atX0SecondsPastTheMinuteGt20', 'atX0MinutesPastTheHourGt20', 'commaMonthX0ThroughMonthX1', 'commaYearX0ThroughYearX1', 'use24HourTimeFormatByDefault', 'anErrorOccuredWhenGeneratingTheExpressionD', 'everyMinute', 'everyHour', 'atSpace', 'everyMinuteBetweenX0AndX1', 'at', 'spaceAnd', 'everySecond', 'everyX0Seconds', 'secondsX0ThroughX1PastTheMinute', 'atX0SecondsPastTheMinute', 'everyX0Minutes', 'minutesX0ThroughX1PastTheHour', 'atX0MinutesPastTheHour', 'everyX0Hours', 'betweenX0AndX1', 'atX0', 'commaEveryDay', 'commaEveryX0DaysOfTheWeek', 'commaX0ThroughX1', 'commaAndX0ThroughX1', 'first', 'second', 'third', 'fourth', 'fifth', 'commaOnThe', 'spaceX0OfTheMonth', 'lastDay', 'commaOnTheLastX0OfTheMonth', 'commaOnlyOnX0', 'commaAndOnX0', 'commaEveryX0Months', 'commaOnlyInX0', 'commaOnTheLastDayOfTheMonth', 'commaOnTheLastWeekdayOfTheMonth', 'commaDaysBeforeTheLastDayOfTheMonth', 'firstWeekday', 'weekdayNearestDayX0', 'commaOnTheX0OfTheMonth', 'commaEveryX0Days', 'commaBetweenDayX0AndX1OfTheMonth', 'commaOnDayX0OfTheMonth', 'commaEveryHour', 'commaEveryX0Years', 'commaStartingX0', 'daysOfTheWeek', 'monthsOfTheYear'];
|
|
15
|
+
const langs = {
|
|
16
|
+
af: 'af',
|
|
17
|
+
ar: 'ar',
|
|
18
|
+
be: 'be',
|
|
19
|
+
ca: 'ca',
|
|
20
|
+
cs: 'cs',
|
|
21
|
+
da: 'da',
|
|
22
|
+
de: 'de',
|
|
23
|
+
'en-US': 'en',
|
|
24
|
+
es: 'es',
|
|
25
|
+
fa: 'fa',
|
|
26
|
+
fi: 'fi',
|
|
27
|
+
fr: 'fr',
|
|
28
|
+
he: 'he',
|
|
29
|
+
hu: 'hu',
|
|
30
|
+
id: 'id',
|
|
31
|
+
it: 'it',
|
|
32
|
+
'ja-JP': 'ja',
|
|
33
|
+
ko: 'ko',
|
|
34
|
+
nb: 'nb',
|
|
35
|
+
nl: 'nl',
|
|
36
|
+
pl: 'pl',
|
|
37
|
+
pt_BR: 'pt_BR',
|
|
38
|
+
pt_PT: 'pt_PT',
|
|
39
|
+
ro: 'ro',
|
|
40
|
+
'ru-RU': 'ru',
|
|
41
|
+
sk: 'sk',
|
|
42
|
+
sl: 'sl',
|
|
43
|
+
sv: 'sv',
|
|
44
|
+
sw: 'sw',
|
|
45
|
+
'th-TH': 'th',
|
|
46
|
+
'tr-TR': 'tr',
|
|
47
|
+
uk: 'uk',
|
|
48
|
+
'zh-CN': 'zh_CN',
|
|
49
|
+
'zh-TW': 'zh_TW'
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const getCronstrueLocale = lang => {
|
|
53
|
+
const lng = langs[lang] || 'en';
|
|
54
|
+
|
|
55
|
+
const Locale = require(`cronstrue/locales/${lng}`);
|
|
56
|
+
|
|
57
|
+
let locale;
|
|
58
|
+
|
|
59
|
+
if (Locale === null || Locale === void 0 ? void 0 : Locale.default) {
|
|
60
|
+
locale = Locale.default.locales[lng];
|
|
61
|
+
} else {
|
|
62
|
+
const L = Locale[lng];
|
|
63
|
+
locale = new L();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const items = {};
|
|
67
|
+
|
|
68
|
+
var _iterator = _createForOfIteratorHelper(methods),
|
|
69
|
+
_step;
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
73
|
+
const method = _step.value;
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
items[method] = locale[method]();
|
|
77
|
+
} catch (error) {}
|
|
78
|
+
}
|
|
79
|
+
} catch (err) {
|
|
80
|
+
_iterator.e(err);
|
|
81
|
+
} finally {
|
|
82
|
+
_iterator.f();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return items;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
exports.getCronstrueLocale = getCronstrueLocale;
|