@nocobase/client 0.9.0-alpha.1 → 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.
Files changed (39) hide show
  1. package/es/antd-config-provider/index.d.ts +3 -1
  2. package/es/antd-config-provider/index.js +25 -6
  3. package/es/antd-config-provider/loadConstrueLocale.d.ts +1 -0
  4. package/es/antd-config-provider/loadConstrueLocale.js +293 -0
  5. package/es/i18n/i18n.js +7 -12
  6. package/es/index.d.ts +1 -1
  7. package/es/index.js +2 -2
  8. package/es/locale/en_US.d.ts +104 -28
  9. package/es/locale/en_US.js +104 -28
  10. package/es/locale/index.d.ts +201 -4
  11. package/es/locale/index.js +191 -58
  12. package/es/schema-component/antd/association-filter/AssociationFilter.Item.js +12 -3
  13. package/es/schema-component/antd/cron/Cron.d.ts +0 -1
  14. package/es/schema-component/antd/cron/Cron.js +16 -19
  15. package/es/schema-component/antd/cron/locale/index.d.ts +37 -0
  16. package/es/schema-component/antd/cron/locale/index.js +6 -0
  17. package/es/schema-component/antd/filter/useFilterActionProps.js +10 -6
  18. package/es/schema-component/antd/table-v2/TableBlockDesigner.js +24 -8
  19. package/es/system-settings/SystemSettingsShortcut.js +1 -1
  20. package/lib/antd-config-provider/index.d.ts +3 -1
  21. package/lib/antd-config-provider/index.js +40 -6
  22. package/lib/antd-config-provider/loadConstrueLocale.d.ts +1 -0
  23. package/lib/antd-config-provider/loadConstrueLocale.js +304 -0
  24. package/lib/i18n/i18n.js +7 -14
  25. package/lib/index.d.ts +1 -1
  26. package/lib/index.js +13 -13
  27. package/lib/locale/en_US.d.ts +104 -28
  28. package/lib/locale/en_US.js +104 -28
  29. package/lib/locale/index.d.ts +201 -4
  30. package/lib/locale/index.js +197 -67
  31. package/lib/schema-component/antd/association-filter/AssociationFilter.Item.js +12 -3
  32. package/lib/schema-component/antd/cron/Cron.d.ts +0 -1
  33. package/lib/schema-component/antd/cron/Cron.js +19 -24
  34. package/lib/schema-component/antd/cron/locale/index.d.ts +37 -0
  35. package/lib/schema-component/antd/cron/locale/index.js +18 -0
  36. package/lib/schema-component/antd/filter/useFilterActionProps.js +10 -6
  37. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +25 -8
  38. package/lib/system-settings/SystemSettingsShortcut.js +1 -1
  39. package/package.json +6 -5
@@ -1,3 +1,15 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ 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); }
6
+
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+
11
+ 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; }
12
+
1
13
  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; }
2
14
 
3
15
  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; }
@@ -9,6 +21,7 @@ import { useField, useFieldSchema } from '@formily/react';
9
21
  import React from 'react';
10
22
  import { useTranslation } from 'react-i18next';
11
23
  import { useTableBlockContext } from '../../../block-provider';
24
+ import { mergeFilter } from '../../../block-provider/SharedFilterProvider';
12
25
  import { useCollection } from '../../../collection-manager';
13
26
  import { useCollectionFilterOptions, useSortFields } from '../../../collection-manager/action-hooks';
14
27
  import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
@@ -87,17 +100,20 @@ export var TableBlockDesigner = function TableBlockDesigner() {
87
100
  }
88
101
  },
89
102
  onSubmit: function onSubmit(_ref) {
90
- var _service$params2, _schema2;
103
+ var _service$params2, _service$params2$, _service$params3, _schema2;
91
104
 
92
105
  var filter = _ref.filter;
93
106
  var params = field.decoratorProps.params || {};
94
107
  params.filter = filter;
95
108
  field.decoratorProps.params = params;
96
109
  fieldSchema['x-decorator-props']['params'] = params;
97
- service.run(_objectSpread(_objectSpread({}, (_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : _service$params2[0]), {}, {
98
- filter: filter,
110
+ var filters = ((_service$params2 = service.params) === null || _service$params2 === void 0 ? void 0 : (_service$params2$ = _service$params2[1]) === null || _service$params2$ === void 0 ? void 0 : _service$params2$.filters) || {};
111
+ service.run(_objectSpread(_objectSpread({}, (_service$params3 = service.params) === null || _service$params3 === void 0 ? void 0 : _service$params3[0]), {}, {
112
+ filter: mergeFilter([].concat(_toConsumableArray(Object.values(filters)), [filter])),
99
113
  page: 1
100
- }));
114
+ }), {
115
+ filters: filters
116
+ });
101
117
  dn.emit('patch', {
102
118
  schema: (_schema2 = {}, _defineProperty(_schema2, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema2, 'x-decorator-props', fieldSchema['x-decorator-props']), _schema2)
103
119
  });
@@ -174,7 +190,7 @@ export var TableBlockDesigner = function TableBlockDesigner() {
174
190
  }
175
191
  },
176
192
  onSubmit: function onSubmit(_ref2) {
177
- var _schema3, _service$params3;
193
+ var _schema3, _service$params4;
178
194
 
179
195
  var sort = _ref2.sort;
180
196
  var sortArr = sort.map(function (item) {
@@ -187,7 +203,7 @@ export var TableBlockDesigner = function TableBlockDesigner() {
187
203
  dn.emit('patch', {
188
204
  schema: (_schema3 = {}, _defineProperty(_schema3, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema3, 'x-decorator-props', fieldSchema['x-decorator-props']), _schema3)
189
205
  });
190
- service.run(_objectSpread(_objectSpread({}, (_service$params3 = service.params) === null || _service$params3 === void 0 ? void 0 : _service$params3[0]), {}, {
206
+ service.run(_objectSpread(_objectSpread({}, (_service$params4 = service.params) === null || _service$params4 === void 0 ? void 0 : _service$params4[0]), {}, {
191
207
  sort: sortArr
192
208
  }));
193
209
  }
@@ -211,13 +227,13 @@ export var TableBlockDesigner = function TableBlockDesigner() {
211
227
  value: 200
212
228
  }],
213
229
  onChange: function onChange(pageSize) {
214
- var _service$params4, _schema4;
230
+ var _service$params5, _schema4;
215
231
 
216
232
  var params = field.decoratorProps.params || {};
217
233
  params.pageSize = pageSize;
218
234
  field.decoratorProps.params = params;
219
235
  fieldSchema['x-decorator-props']['params'] = params;
220
- service.run(_objectSpread(_objectSpread({}, (_service$params4 = service.params) === null || _service$params4 === void 0 ? void 0 : _service$params4[0]), {}, {
236
+ service.run(_objectSpread(_objectSpread({}, (_service$params5 = service.params) === null || _service$params5 === void 0 ? void 0 : _service$params5[0]), {}, {
221
237
  pageSize: pageSize,
222
238
  page: 1
223
239
  }));
@@ -34,7 +34,7 @@ import locale from '../locale';
34
34
  import { ActionContext, SchemaComponent, useActionContext } from '../schema-component';
35
35
  var langs = Object.keys(locale).map(function (lang) {
36
36
  return {
37
- label: locale[lang].label,
37
+ label: "".concat(locale[lang].label, " (").concat(lang, ")"),
38
38
  value: lang
39
39
  };
40
40
  });
@@ -1,2 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
+ export declare const AppLangContext: React.Context<any>;
3
+ export declare const useAppLangContext: () => any;
2
4
  export declare function AntdConfigProvider(props: any): JSX.Element;
@@ -1,22 +1,31 @@
1
1
  "use strict";
2
2
 
3
+ 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); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.AntdConfigProvider = AntdConfigProvider;
9
+ exports.useAppLangContext = exports.AppLangContext = void 0;
7
10
 
8
11
  var _antd = require("antd");
9
12
 
10
- var _react = _interopRequireDefault(require("react"));
13
+ var _moment = _interopRequireDefault(require("moment"));
14
+
15
+ var _react = _interopRequireWildcard(require("react"));
11
16
 
12
17
  var _reactI18next = require("react-i18next");
13
18
 
14
19
  var _apiClient = require("../api-client");
15
20
 
16
- var _locale = _interopRequireDefault(require("../locale"));
21
+ var _loadConstrueLocale = require("./loadConstrueLocale");
17
22
 
18
23
  var _excluded = ["remoteLocale"];
19
24
 
25
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
26
+
27
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
28
+
20
29
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
30
 
22
31
  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; }
@@ -29,7 +38,18 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
29
38
 
30
39
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
31
40
 
41
+ var AppLangContext = /*#__PURE__*/(0, _react.createContext)({});
42
+ exports.AppLangContext = AppLangContext;
43
+
44
+ var useAppLangContext = function useAppLangContext() {
45
+ return (0, _react.useContext)(AppLangContext);
46
+ };
47
+
48
+ exports.useAppLangContext = useAppLangContext;
49
+
32
50
  function AntdConfigProvider(props) {
51
+ var _data$data9;
52
+
33
53
  var remoteLocale = props.remoteLocale,
34
54
  others = _objectWithoutProperties(props, _excluded);
35
55
 
@@ -42,7 +62,7 @@ function AntdConfigProvider(props) {
42
62
  url: 'app:getLang'
43
63
  }, {
44
64
  onSuccess: function onSuccess(data) {
45
- var _data$data;
65
+ var _data$data, _data$data4, _data$data7, _data$data8;
46
66
 
47
67
  var locale = api.auth.locale;
48
68
 
@@ -52,18 +72,32 @@ function AntdConfigProvider(props) {
52
72
  api.auth.setLocale(data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.lang);
53
73
  i18n.changeLanguage(data === null || data === void 0 ? void 0 : (_data$data3 = data.data) === null || _data$data3 === void 0 ? void 0 : _data$data3.lang);
54
74
  }
75
+
76
+ Object.keys((data === null || data === void 0 ? void 0 : (_data$data4 = data.data) === null || _data$data4 === void 0 ? void 0 : _data$data4.resources) || {}).forEach(function (key) {
77
+ var _data$data5, _data$data6;
78
+
79
+ i18n.addResources(data === null || data === void 0 ? void 0 : (_data$data5 = data.data) === null || _data$data5 === void 0 ? void 0 : _data$data5.lang, key, (data === null || data === void 0 ? void 0 : (_data$data6 = data.data) === null || _data$data6 === void 0 ? void 0 : _data$data6.resources[key]) || {});
80
+ });
81
+ (0, _loadConstrueLocale.loadConstrueLocale)(data === null || data === void 0 ? void 0 : data.data);
82
+
83
+ _moment.default.locale(data === null || data === void 0 ? void 0 : (_data$data7 = data.data) === null || _data$data7 === void 0 ? void 0 : _data$data7.moment);
84
+
85
+ window['cronLocale'] = data === null || data === void 0 ? void 0 : (_data$data8 = data.data) === null || _data$data8 === void 0 ? void 0 : _data$data8.cron;
55
86
  },
56
87
  manual: !remoteLocale
57
88
  }),
89
+ data = _useRequest.data,
58
90
  loading = _useRequest.loading;
59
91
 
60
92
  if (loading) {
61
93
  return /*#__PURE__*/_react.default.createElement(_antd.Spin, null);
62
94
  }
63
95
 
64
- return /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, _objectSpread(_objectSpread({
96
+ return /*#__PURE__*/_react.default.createElement(AppLangContext.Provider, {
97
+ value: data === null || data === void 0 ? void 0 : data.data
98
+ }, /*#__PURE__*/_react.default.createElement(_antd.ConfigProvider, _objectSpread(_objectSpread({
65
99
  dropdownMatchSelectWidth: false
66
100
  }, others), {}, {
67
- locale: _locale.default[i18n.language].antd
68
- }), props.children);
101
+ locale: (data === null || data === void 0 ? void 0 : (_data$data9 = data.data) === null || _data$data9 === void 0 ? void 0 : _data$data9.antd) || {}
102
+ }), props.children));
69
103
  }
@@ -0,0 +1 @@
1
+ export declare const loadConstrueLocale: (data: any) => void;
@@ -0,0 +1,304 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loadConstrueLocale = void 0;
7
+
8
+ var _cronstrue = _interopRequireDefault(require("cronstrue"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
+
14
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
15
+
16
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
17
+
18
+ var CronstrueLocale = /*#__PURE__*/function () {
19
+ function CronstrueLocale(data) {
20
+ _classCallCheck(this, CronstrueLocale);
21
+
22
+ this.data = void 0;
23
+ this.data = data;
24
+ }
25
+
26
+ _createClass(CronstrueLocale, [{
27
+ key: "atX0SecondsPastTheMinuteGt20",
28
+ value: function atX0SecondsPastTheMinuteGt20() {
29
+ return this.data['atX0SecondsPastTheMinuteGt20'];
30
+ }
31
+ }, {
32
+ key: "atX0MinutesPastTheHourGt20",
33
+ value: function atX0MinutesPastTheHourGt20() {
34
+ return this.data['atX0MinutesPastTheHourGt20'];
35
+ }
36
+ }, {
37
+ key: "commaMonthX0ThroughMonthX1",
38
+ value: function commaMonthX0ThroughMonthX1() {
39
+ return this.data['commaMonthX0ThroughMonthX1'];
40
+ }
41
+ }, {
42
+ key: "commaYearX0ThroughYearX1",
43
+ value: function commaYearX0ThroughYearX1() {
44
+ return this.data['commaYearX0ThroughYearX1'];
45
+ }
46
+ }, {
47
+ key: "use24HourTimeFormatByDefault",
48
+ value: function use24HourTimeFormatByDefault() {
49
+ return this.data['use24HourTimeFormatByDefault'];
50
+ }
51
+ }, {
52
+ key: "anErrorOccuredWhenGeneratingTheExpressionD",
53
+ value: function anErrorOccuredWhenGeneratingTheExpressionD() {
54
+ return this.data['anErrorOccuredWhenGeneratingTheExpressionD'];
55
+ }
56
+ }, {
57
+ key: "everyMinute",
58
+ value: function everyMinute() {
59
+ return this.data['everyMinute'];
60
+ }
61
+ }, {
62
+ key: "everyHour",
63
+ value: function everyHour() {
64
+ return this.data['everyHour'];
65
+ }
66
+ }, {
67
+ key: "atSpace",
68
+ value: function atSpace() {
69
+ return this.data['atSpace'];
70
+ }
71
+ }, {
72
+ key: "everyMinuteBetweenX0AndX1",
73
+ value: function everyMinuteBetweenX0AndX1() {
74
+ return this.data['everyMinuteBetweenX0AndX1'];
75
+ }
76
+ }, {
77
+ key: "at",
78
+ value: function at() {
79
+ return this.data['at'];
80
+ }
81
+ }, {
82
+ key: "spaceAnd",
83
+ value: function spaceAnd() {
84
+ return this.data['spaceAnd'];
85
+ }
86
+ }, {
87
+ key: "everySecond",
88
+ value: function everySecond() {
89
+ return this.data['everySecond'];
90
+ }
91
+ }, {
92
+ key: "everyX0Seconds",
93
+ value: function everyX0Seconds() {
94
+ return this.data['everyX0Seconds'];
95
+ }
96
+ }, {
97
+ key: "secondsX0ThroughX1PastTheMinute",
98
+ value: function secondsX0ThroughX1PastTheMinute() {
99
+ return this.data['secondsX0ThroughX1PastTheMinute'];
100
+ }
101
+ }, {
102
+ key: "atX0SecondsPastTheMinute",
103
+ value: function atX0SecondsPastTheMinute() {
104
+ return this.data['atX0SecondsPastTheMinute'];
105
+ }
106
+ }, {
107
+ key: "everyX0Minutes",
108
+ value: function everyX0Minutes() {
109
+ return this.data['everyX0Minutes'];
110
+ }
111
+ }, {
112
+ key: "minutesX0ThroughX1PastTheHour",
113
+ value: function minutesX0ThroughX1PastTheHour() {
114
+ return this.data['minutesX0ThroughX1PastTheHour'];
115
+ }
116
+ }, {
117
+ key: "atX0MinutesPastTheHour",
118
+ value: function atX0MinutesPastTheHour() {
119
+ return this.data['atX0MinutesPastTheHour'];
120
+ }
121
+ }, {
122
+ key: "everyX0Hours",
123
+ value: function everyX0Hours() {
124
+ return this.data['everyX0Hours'];
125
+ }
126
+ }, {
127
+ key: "betweenX0AndX1",
128
+ value: function betweenX0AndX1() {
129
+ return this.data['betweenX0AndX1'];
130
+ }
131
+ }, {
132
+ key: "atX0",
133
+ value: function atX0() {
134
+ return this.data['atX0'];
135
+ }
136
+ }, {
137
+ key: "commaEveryDay",
138
+ value: function commaEveryDay() {
139
+ return this.data['commaEveryDay'];
140
+ }
141
+ }, {
142
+ key: "commaEveryX0DaysOfTheWeek",
143
+ value: function commaEveryX0DaysOfTheWeek() {
144
+ return this.data['commaEveryX0DaysOfTheWeek'];
145
+ }
146
+ }, {
147
+ key: "commaX0ThroughX1",
148
+ value: function commaX0ThroughX1() {
149
+ return this.data['commaX0ThroughX1'];
150
+ }
151
+ }, {
152
+ key: "commaAndX0ThroughX1",
153
+ value: function commaAndX0ThroughX1() {
154
+ return this.data['commaAndX0ThroughX1'];
155
+ }
156
+ }, {
157
+ key: "first",
158
+ value: function first() {
159
+ return this.data['first'];
160
+ }
161
+ }, {
162
+ key: "second",
163
+ value: function second() {
164
+ return this.data['second'];
165
+ }
166
+ }, {
167
+ key: "third",
168
+ value: function third() {
169
+ return this.data['third'];
170
+ }
171
+ }, {
172
+ key: "fourth",
173
+ value: function fourth() {
174
+ return this.data['fourth'];
175
+ }
176
+ }, {
177
+ key: "fifth",
178
+ value: function fifth() {
179
+ return this.data['fifth'];
180
+ }
181
+ }, {
182
+ key: "commaOnThe",
183
+ value: function commaOnThe() {
184
+ return this.data['commaOnThe'];
185
+ }
186
+ }, {
187
+ key: "spaceX0OfTheMonth",
188
+ value: function spaceX0OfTheMonth() {
189
+ return this.data['spaceX0OfTheMonth'];
190
+ }
191
+ }, {
192
+ key: "lastDay",
193
+ value: function lastDay() {
194
+ return this.data['lastDay'];
195
+ }
196
+ }, {
197
+ key: "commaOnTheLastX0OfTheMonth",
198
+ value: function commaOnTheLastX0OfTheMonth() {
199
+ return this.data['commaOnTheLastX0OfTheMonth'];
200
+ }
201
+ }, {
202
+ key: "commaOnlyOnX0",
203
+ value: function commaOnlyOnX0() {
204
+ return this.data['commaOnlyOnX0'];
205
+ }
206
+ }, {
207
+ key: "commaAndOnX0",
208
+ value: function commaAndOnX0() {
209
+ return this.data['commaAndOnX0'];
210
+ }
211
+ }, {
212
+ key: "commaEveryX0Months",
213
+ value: function commaEveryX0Months() {
214
+ return this.data['commaEveryX0Months'];
215
+ }
216
+ }, {
217
+ key: "commaOnlyInX0",
218
+ value: function commaOnlyInX0() {
219
+ return this.data['commaOnlyInX0'];
220
+ }
221
+ }, {
222
+ key: "commaOnTheLastDayOfTheMonth",
223
+ value: function commaOnTheLastDayOfTheMonth() {
224
+ return this.data['commaOnTheLastDayOfTheMonth'];
225
+ }
226
+ }, {
227
+ key: "commaOnTheLastWeekdayOfTheMonth",
228
+ value: function commaOnTheLastWeekdayOfTheMonth() {
229
+ return this.data['commaOnTheLastWeekdayOfTheMonth'];
230
+ }
231
+ }, {
232
+ key: "commaDaysBeforeTheLastDayOfTheMonth",
233
+ value: function commaDaysBeforeTheLastDayOfTheMonth() {
234
+ return this.data['commaDaysBeforeTheLastDayOfTheMonth'];
235
+ }
236
+ }, {
237
+ key: "firstWeekday",
238
+ value: function firstWeekday() {
239
+ return this.data['firstWeekday'];
240
+ }
241
+ }, {
242
+ key: "weekdayNearestDayX0",
243
+ value: function weekdayNearestDayX0() {
244
+ return this.data['weekdayNearestDayX0'];
245
+ }
246
+ }, {
247
+ key: "commaOnTheX0OfTheMonth",
248
+ value: function commaOnTheX0OfTheMonth() {
249
+ return this.data['commaOnTheX0OfTheMonth'];
250
+ }
251
+ }, {
252
+ key: "commaEveryX0Days",
253
+ value: function commaEveryX0Days() {
254
+ return this.data['commaEveryX0Days'];
255
+ }
256
+ }, {
257
+ key: "commaBetweenDayX0AndX1OfTheMonth",
258
+ value: function commaBetweenDayX0AndX1OfTheMonth() {
259
+ return this.data['commaBetweenDayX0AndX1OfTheMonth'];
260
+ }
261
+ }, {
262
+ key: "commaOnDayX0OfTheMonth",
263
+ value: function commaOnDayX0OfTheMonth() {
264
+ return this.data['commaOnDayX0OfTheMonth'];
265
+ }
266
+ }, {
267
+ key: "commaEveryHour",
268
+ value: function commaEveryHour() {
269
+ return this.data['commaEveryHour'];
270
+ }
271
+ }, {
272
+ key: "commaEveryX0Years",
273
+ value: function commaEveryX0Years() {
274
+ return this.data['commaEveryX0Years'];
275
+ }
276
+ }, {
277
+ key: "commaStartingX0",
278
+ value: function commaStartingX0() {
279
+ return this.data['commaStartingX0'];
280
+ }
281
+ }, {
282
+ key: "daysOfTheWeek",
283
+ value: function daysOfTheWeek() {
284
+ return this.data['daysOfTheWeek'];
285
+ }
286
+ }, {
287
+ key: "monthsOfTheYear",
288
+ value: function monthsOfTheYear() {
289
+ return this.data['monthsOfTheYear'];
290
+ }
291
+ }]);
292
+
293
+ return CronstrueLocale;
294
+ }();
295
+
296
+ var loadConstrueLocale = function loadConstrueLocale(data) {
297
+ _cronstrue.default.initialize({
298
+ load: function load(availableLocales) {
299
+ availableLocales[data === null || data === void 0 ? void 0 : data.lang] = new CronstrueLocale(data === null || data === void 0 ? void 0 : data.cronstrue);
300
+ }
301
+ });
302
+ };
303
+
304
+ exports.loadConstrueLocale = loadConstrueLocale;
package/lib/i18n/i18n.js CHANGED
@@ -7,8 +7,6 @@ exports.i18n = void 0;
7
7
 
8
8
  var _i18next = _interopRequireDefault(require("i18next"));
9
9
 
10
- var _moment = _interopRequireDefault(require("moment"));
11
-
12
10
  var _reactI18next = require("react-i18next");
13
11
 
14
12
  var _locale = _interopRequireDefault(require("../locale"));
@@ -24,27 +22,22 @@ var resources = {};
24
22
  Object.keys(_locale.default).forEach(function (lang) {
25
23
  resources[lang] = _locale.default[lang].resources;
26
24
  });
27
- i18n.use(_reactI18next.initReactI18next).init({
25
+ i18n // .use(Backend)
26
+ .use(_reactI18next.initReactI18next).init({
28
27
  lng: localStorage.getItem('NOCOBASE_LOCALE') || 'en-US',
29
28
  // debug: true,
30
29
  defaultNS: 'client',
30
+ // backend: {
31
+ // // for all available options read the backend's repository readme file
32
+ // loadPath: '/api/locales/{{lng}}/{{ns}}.json',
33
+ // },
31
34
  // parseMissingKeyHandler: (key) => {
32
35
  // console.log('parseMissingKeyHandler', `'${key}': '${key}',`);
33
36
  // return key;
34
37
  // },
35
38
  // ns: ['client'],
36
- resources: resources
39
+ resources: {}
37
40
  });
38
-
39
- function setMomentLng(language) {
40
- var lng = _locale.default[language || 'en-US'].moment || 'en';
41
- log(lng);
42
-
43
- _moment.default.locale(lng);
44
- }
45
-
46
- setMomentLng(localStorage.getItem('NOCOBASE_LOCALE'));
47
41
  i18n.on('languageChanged', function (lng) {
48
42
  localStorage.setItem('NOCOBASE_LOCALE', lng);
49
- setMomentLng(lng);
50
43
  });
package/lib/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import './global.less';
3
3
  export * from './acl';
4
4
  export * from './antd-config-provider';
5
5
  export * from './api-client';
6
+ export * from './appInfo';
6
7
  export * from './application';
7
8
  export * from './async-data-provider';
8
9
  export * from './block-provider';
@@ -25,4 +26,3 @@ export * from './schema-templates';
25
26
  export * from './settings-form';
26
27
  export * from './system-settings';
27
28
  export * from './user';
28
- export * from './appInfo';
package/lib/index.js CHANGED
@@ -47,6 +47,19 @@ Object.keys(_apiClient).forEach(function (key) {
47
47
  });
48
48
  });
49
49
 
50
+ var _appInfo = require("./appInfo");
51
+
52
+ Object.keys(_appInfo).forEach(function (key) {
53
+ if (key === "default" || key === "__esModule") return;
54
+ if (key in exports && exports[key] === _appInfo[key]) return;
55
+ Object.defineProperty(exports, key, {
56
+ enumerable: true,
57
+ get: function get() {
58
+ return _appInfo[key];
59
+ }
60
+ });
61
+ });
62
+
50
63
  var _application = require("./application");
51
64
 
52
65
  Object.keys(_application).forEach(function (key) {
@@ -331,17 +344,4 @@ Object.keys(_user).forEach(function (key) {
331
344
  return _user[key];
332
345
  }
333
346
  });
334
- });
335
-
336
- var _appInfo = require("./appInfo");
337
-
338
- Object.keys(_appInfo).forEach(function (key) {
339
- if (key === "default" || key === "__esModule") return;
340
- if (key in exports && exports[key] === _appInfo[key]) return;
341
- Object.defineProperty(exports, key, {
342
- enumerable: true,
343
- get: function get() {
344
- return _appInfo[key];
345
- }
346
- });
347
347
  });