@nocobase/client 0.7.0-alpha.80 → 0.7.0-alpha.83

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 (95) hide show
  1. package/es/acl/ACLProvider.js +10 -15
  2. package/es/antd-config-provider/index.js +7 -4
  3. package/es/api-client/APIClient.d.ts +2 -30
  4. package/es/api-client/APIClient.js +30 -158
  5. package/es/api-client/hooks/useResource.d.ts +1 -1
  6. package/es/block-provider/hooks/index.d.ts +3 -0
  7. package/es/block-provider/hooks/index.js +233 -168
  8. package/es/collection-manager/Configuration/AddFieldAction.js +27 -9
  9. package/es/collection-manager/Configuration/EditFieldAction.js +25 -8
  10. package/es/collection-manager/hooks/useCollection.d.ts +1 -1
  11. package/es/i18n/i18n.js +3 -3
  12. package/es/locale/en_US.d.ts +10 -0
  13. package/es/locale/en_US.js +11 -1
  14. package/es/locale/index.d.ts +44 -0
  15. package/es/locale/zh_CN.d.ts +34 -0
  16. package/es/locale/zh_CN.js +35 -1
  17. package/es/schema-component/antd/action/Action.Designer.js +33 -13
  18. package/es/schema-component/antd/action/utils.d.ts +2 -0
  19. package/es/schema-component/antd/action/utils.js +60 -0
  20. package/es/schema-component/antd/date-picker/util.d.ts +2 -1
  21. package/es/schema-component/antd/date-picker/util.js +4 -2
  22. package/es/schema-initializer/buttons/FormActionInitializers.d.ts +84 -0
  23. package/es/schema-initializer/buttons/FormActionInitializers.js +63 -0
  24. package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.d.ts +26 -0
  25. package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +21 -0
  26. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +21 -0
  27. package/es/schema-settings/SchemaSettings.js +48 -16
  28. package/es/user/CurrentUser.js +1 -1
  29. package/es/user/LanguageSettings.js +4 -3
  30. package/es/user/SigninPage.js +3 -14
  31. package/es/user/SwitchRole.js +2 -26
  32. package/es/workflow/triggers/collection.js +1 -0
  33. package/es/workflow/triggers/index.js +2 -0
  34. package/es/workflow/triggers/schedule.d.ts +25 -0
  35. package/es/workflow/triggers/schedule.js +531 -0
  36. package/lib/acl/ACLProvider.js +9 -15
  37. package/lib/antd-config-provider/index.js +6 -3
  38. package/lib/api-client/APIClient.d.ts +2 -30
  39. package/lib/api-client/APIClient.js +26 -160
  40. package/lib/api-client/hooks/useResource.d.ts +1 -1
  41. package/lib/block-provider/hooks/index.d.ts +3 -0
  42. package/lib/block-provider/hooks/index.js +238 -169
  43. package/lib/collection-manager/Configuration/AddFieldAction.js +27 -9
  44. package/lib/collection-manager/Configuration/EditFieldAction.js +25 -8
  45. package/lib/collection-manager/hooks/useCollection.d.ts +1 -1
  46. package/lib/i18n/i18n.js +3 -3
  47. package/lib/locale/en_US.d.ts +10 -0
  48. package/lib/locale/en_US.js +11 -1
  49. package/lib/locale/index.d.ts +44 -0
  50. package/lib/locale/zh_CN.d.ts +34 -0
  51. package/lib/locale/zh_CN.js +35 -1
  52. package/lib/schema-component/antd/action/Action.Designer.js +34 -13
  53. package/lib/schema-component/antd/action/utils.d.ts +2 -0
  54. package/lib/schema-component/antd/action/utils.js +67 -0
  55. package/lib/schema-component/antd/date-picker/util.d.ts +2 -1
  56. package/lib/schema-component/antd/date-picker/util.js +6 -1
  57. package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +84 -0
  58. package/lib/schema-initializer/buttons/FormActionInitializers.js +63 -0
  59. package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.d.ts +26 -0
  60. package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +21 -0
  61. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +21 -0
  62. package/lib/schema-settings/SchemaSettings.js +49 -16
  63. package/lib/user/CurrentUser.js +1 -1
  64. package/lib/user/LanguageSettings.js +4 -3
  65. package/lib/user/SigninPage.js +3 -14
  66. package/lib/user/SwitchRole.js +2 -27
  67. package/lib/workflow/triggers/collection.js +1 -0
  68. package/lib/workflow/triggers/index.js +3 -0
  69. package/lib/workflow/triggers/schedule.d.ts +25 -0
  70. package/lib/workflow/triggers/schedule.js +554 -0
  71. package/package.json +4 -3
  72. package/src/acl/ACLProvider.tsx +4 -5
  73. package/src/antd-config-provider/index.tsx +4 -2
  74. package/src/api-client/APIClient.ts +2 -120
  75. package/src/block-provider/hooks/index.ts +106 -69
  76. package/src/collection-manager/Configuration/AddFieldAction.tsx +18 -0
  77. package/src/collection-manager/Configuration/EditFieldAction.tsx +19 -0
  78. package/src/i18n/i18n.ts +3 -3
  79. package/src/locale/en_US.ts +11 -1
  80. package/src/locale/zh_CN.ts +39 -1
  81. package/src/schema-component/antd/action/Action.Designer.tsx +33 -1
  82. package/src/schema-component/antd/action/utils.ts +68 -0
  83. package/src/schema-component/antd/date-picker/util.ts +4 -3
  84. package/src/schema-initializer/SchemaInitializer.tsx +2 -2
  85. package/src/schema-initializer/buttons/FormActionInitializers.tsx +66 -0
  86. package/src/schema-initializer/buttons/ReadPrettyFormActionInitializers.tsx +22 -0
  87. package/src/schema-initializer/buttons/TableActionColumnInitializers.tsx +22 -0
  88. package/src/schema-settings/SchemaSettings.tsx +40 -29
  89. package/src/user/CurrentUser.tsx +1 -1
  90. package/src/user/LanguageSettings.tsx +1 -0
  91. package/src/user/SigninPage.tsx +2 -7
  92. package/src/user/SwitchRole.tsx +2 -6
  93. package/src/workflow/triggers/collection.tsx +1 -1
  94. package/src/workflow/triggers/index.tsx +2 -0
  95. package/src/workflow/triggers/schedule.tsx +422 -0
@@ -91,6 +91,7 @@ export declare const FormActionInitializers: {
91
91
  redirecting: boolean;
92
92
  successMessage: string;
93
93
  };
94
+ requestSettings?: undefined;
94
95
  };
95
96
  'x-component-props': {
96
97
  useProps: string;
@@ -99,6 +100,33 @@ export declare const FormActionInitializers: {
99
100
  type?: undefined;
100
101
  properties?: undefined;
101
102
  };
103
+ } | {
104
+ type: string;
105
+ title: string;
106
+ component: string;
107
+ schema: {
108
+ title: string;
109
+ 'x-component': string;
110
+ 'x-action': string;
111
+ 'x-designer': string;
112
+ 'x-action-settings': {
113
+ requestSettings: {};
114
+ onSuccess: {
115
+ manualClose: boolean;
116
+ redirecting: boolean;
117
+ successMessage: string;
118
+ };
119
+ assignedValues?: undefined;
120
+ skipValidator?: undefined;
121
+ };
122
+ 'x-component-props': {
123
+ useProps: string;
124
+ openMode?: undefined;
125
+ };
126
+ type?: undefined;
127
+ properties?: undefined;
128
+ 'x-designer-props'?: undefined;
129
+ };
102
130
  })[];
103
131
  })[];
104
132
  };
@@ -195,6 +223,33 @@ export declare const CreateFormActionInitializers: {
195
223
  redirecting: boolean;
196
224
  successMessage: string;
197
225
  };
226
+ requestSettings?: undefined;
227
+ };
228
+ 'x-component-props': {
229
+ useProps: string;
230
+ openMode?: undefined;
231
+ };
232
+ type?: undefined;
233
+ properties?: undefined;
234
+ };
235
+ } | {
236
+ type: string;
237
+ title: string;
238
+ component: string;
239
+ schema: {
240
+ title: string;
241
+ 'x-component': string;
242
+ 'x-action': string;
243
+ 'x-designer': string;
244
+ 'x-action-settings': {
245
+ requestSettings: {};
246
+ onSuccess: {
247
+ manualClose: boolean;
248
+ redirecting: boolean;
249
+ successMessage: string;
250
+ };
251
+ assignedValues?: undefined;
252
+ skipValidator?: undefined;
198
253
  };
199
254
  'x-component-props': {
200
255
  useProps: string;
@@ -202,6 +257,7 @@ export declare const CreateFormActionInitializers: {
202
257
  };
203
258
  type?: undefined;
204
259
  properties?: undefined;
260
+ 'x-designer-props'?: undefined;
205
261
  };
206
262
  })[];
207
263
  })[];
@@ -299,6 +355,33 @@ export declare const UpdateFormActionInitializers: {
299
355
  redirecting: boolean;
300
356
  successMessage: string;
301
357
  };
358
+ requestSettings?: undefined;
359
+ };
360
+ 'x-component-props': {
361
+ useProps: string;
362
+ openMode?: undefined;
363
+ };
364
+ type?: undefined;
365
+ properties?: undefined;
366
+ };
367
+ } | {
368
+ type: string;
369
+ title: string;
370
+ component: string;
371
+ schema: {
372
+ title: string;
373
+ 'x-component': string;
374
+ 'x-action': string;
375
+ 'x-designer': string;
376
+ 'x-action-settings': {
377
+ requestSettings: {};
378
+ onSuccess: {
379
+ manualClose: boolean;
380
+ redirecting: boolean;
381
+ successMessage: string;
382
+ };
383
+ assignedValues?: undefined;
384
+ skipValidator?: undefined;
302
385
  };
303
386
  'x-component-props': {
304
387
  useProps: string;
@@ -306,6 +389,7 @@ export declare const UpdateFormActionInitializers: {
306
389
  };
307
390
  type?: undefined;
308
391
  properties?: undefined;
392
+ 'x-designer-props'?: undefined;
309
393
  };
310
394
  })[];
311
395
  })[];
@@ -98,6 +98,27 @@ var FormActionInitializers = {
98
98
  useProps: '{{ useCreateActionProps }}'
99
99
  }
100
100
  }
101
+ }, {
102
+ type: 'item',
103
+ title: '{{t("Custom request")}}',
104
+ component: 'CustomizeActionInitializer',
105
+ schema: {
106
+ title: '{{ t("Custom request") }}',
107
+ 'x-component': 'Action',
108
+ 'x-action': 'customize:form:request',
109
+ 'x-designer': 'Action.Designer',
110
+ 'x-action-settings': {
111
+ requestSettings: {},
112
+ onSuccess: {
113
+ manualClose: false,
114
+ redirecting: false,
115
+ successMessage: '{{t("Request success")}}'
116
+ }
117
+ },
118
+ 'x-component-props': {
119
+ useProps: '{{ useCustomizeRequestActionProps }}'
120
+ }
121
+ }
101
122
  }]
102
123
  }]
103
124
  };
@@ -195,6 +216,27 @@ var CreateFormActionInitializers = {
195
216
  useProps: '{{ useCreateActionProps }}'
196
217
  }
197
218
  }
219
+ }, {
220
+ type: 'item',
221
+ title: '{{t("Custom request")}}',
222
+ component: 'CustomizeActionInitializer',
223
+ schema: {
224
+ title: '{{ t("Custom request") }}',
225
+ 'x-component': 'Action',
226
+ 'x-action': 'customize:form:request',
227
+ 'x-designer': 'Action.Designer',
228
+ 'x-action-settings': {
229
+ requestSettings: {},
230
+ onSuccess: {
231
+ manualClose: false,
232
+ redirecting: false,
233
+ successMessage: '{{t("Request success")}}'
234
+ }
235
+ },
236
+ 'x-component-props': {
237
+ useProps: '{{ useCustomizeRequestActionProps }}'
238
+ }
239
+ }
198
240
  }]
199
241
  }]
200
242
  };
@@ -292,6 +334,27 @@ var UpdateFormActionInitializers = {
292
334
  useProps: '{{ useUpdateActionProps }}'
293
335
  }
294
336
  }
337
+ }, {
338
+ type: 'item',
339
+ title: '{{t("Custom request")}}',
340
+ component: 'CustomizeActionInitializer',
341
+ schema: {
342
+ title: '{{ t("Custom request") }}',
343
+ 'x-component': 'Action',
344
+ 'x-action': 'customize:form:request',
345
+ 'x-designer': 'Action.Designer',
346
+ 'x-action-settings': {
347
+ requestSettings: {},
348
+ onSuccess: {
349
+ manualClose: false,
350
+ redirecting: false,
351
+ successMessage: '{{t("Request success")}}'
352
+ }
353
+ },
354
+ 'x-component-props': {
355
+ useProps: '{{ useCustomizeRequestActionProps }}'
356
+ }
357
+ }
295
358
  }]
296
359
  }]
297
360
  };
@@ -102,6 +102,32 @@ export declare const ReadPrettyFormActionInitializers: {
102
102
  redirecting: boolean;
103
103
  successMessage: string;
104
104
  };
105
+ requestSettings?: undefined;
106
+ };
107
+ 'x-component-props': {
108
+ useProps: string;
109
+ openMode?: undefined;
110
+ };
111
+ type?: undefined;
112
+ properties?: undefined;
113
+ };
114
+ } | {
115
+ type: string;
116
+ title: string;
117
+ component: string;
118
+ schema: {
119
+ title: string;
120
+ 'x-component': string;
121
+ 'x-action': string;
122
+ 'x-designer': string;
123
+ 'x-action-settings': {
124
+ requestSettings: {};
125
+ onSuccess: {
126
+ manualClose: boolean;
127
+ redirecting: boolean;
128
+ successMessage: string;
129
+ };
130
+ assignedValues?: undefined;
105
131
  };
106
132
  'x-component-props': {
107
133
  useProps: string;
@@ -109,6 +109,27 @@ var ReadPrettyFormActionInitializers = {
109
109
  useProps: '{{ useCustomizeUpdateActionProps }}'
110
110
  }
111
111
  }
112
+ }, {
113
+ type: 'item',
114
+ title: '{{t("Custom request")}}',
115
+ component: 'CustomizeActionInitializer',
116
+ schema: {
117
+ title: '{{ t("Custom request") }}',
118
+ 'x-component': 'Action',
119
+ 'x-action': 'customize:form:request',
120
+ 'x-designer': 'Action.Designer',
121
+ 'x-action-settings': {
122
+ requestSettings: {},
123
+ onSuccess: {
124
+ manualClose: false,
125
+ redirecting: false,
126
+ successMessage: '{{t("Request success")}}'
127
+ }
128
+ },
129
+ 'x-component-props': {
130
+ useProps: '{{ useCustomizeRequestActionProps }}'
131
+ }
132
+ }
112
133
  }]
113
134
  }]
114
135
  };
@@ -161,6 +161,27 @@ var TableActionColumnInitializers = function TableActionColumnInitializers(props
161
161
  useProps: '{{ useCustomizeUpdateActionProps }}'
162
162
  }
163
163
  }
164
+ }, {
165
+ type: 'item',
166
+ title: '{{t("Custom request")}}',
167
+ component: 'CustomizeActionInitializer',
168
+ schema: {
169
+ title: '{{ t("Custom request") }}',
170
+ 'x-component': 'Action.Link',
171
+ 'x-action': 'customize:table:request',
172
+ 'x-designer': 'Action.Designer',
173
+ 'x-action-settings': {
174
+ requestSettings: {},
175
+ onSuccess: {
176
+ manualClose: false,
177
+ redirecting: false,
178
+ successMessage: '{{t("Request success")}}'
179
+ }
180
+ },
181
+ 'x-component-props': {
182
+ useProps: '{{ useCustomizeRequestActionProps }}'
183
+ }
184
+ }
164
185
  }]
165
186
  }],
166
187
  component: /*#__PURE__*/_react2.default.createElement(_icons.MenuOutlined, {
@@ -25,6 +25,8 @@ var _lodash = require("lodash");
25
25
 
26
26
  var _react2 = _interopRequireWildcard(require("react"));
27
27
 
28
+ var _reactDom = require("react-dom");
29
+
28
30
  var _reactI18next = require("react-i18next");
29
31
 
30
32
  var _ = require("..");
@@ -40,7 +42,7 @@ var _excluded = ["children", "fieldSchema"],
40
42
  _excluded3 = ["title", "options", "value", "onChange"],
41
43
  _excluded4 = ["title", "onChange"],
42
44
  _excluded5 = ["schema"],
43
- _excluded6 = ["title", "onSubmit", "initialValues", "initialSchema", "modalTip"],
45
+ _excluded6 = ["title", "onSubmit", "initialValues", "initialSchema", "schema", "modalTip", "components"],
44
46
  _excluded7 = ["hidden", "title", "components", "scope", "effects", "schema", "onSubmit", "initialValues"];
45
47
 
46
48
  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); }
@@ -686,7 +688,9 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
686
688
  onSubmit = props.onSubmit,
687
689
  initialValues = props.initialValues,
688
690
  initialSchema = props.initialSchema,
691
+ schema = props.schema,
689
692
  modalTip = props.modalTip,
693
+ components = props.components,
690
694
  others = _objectWithoutProperties(props, _excluded6);
691
695
 
692
696
  var _useState7 = (0, _react2.useState)(false),
@@ -720,19 +724,40 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
720
724
  setVisible(false);
721
725
  };
722
726
 
723
- var submitHandler = function submitHandler() {
724
- onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit((0, _lodash.cloneDeep)(form.values));
725
- setVisible(false);
726
- };
727
-
728
- var openAssignedFieldValueHandler = /*#__PURE__*/function () {
727
+ var submitHandler = /*#__PURE__*/function () {
729
728
  var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
730
729
  return regeneratorRuntime.wrap(function _callee7$(_context7) {
731
730
  while (1) {
732
731
  switch (_context7.prev = _context7.next) {
733
732
  case 0:
734
- if (!(!schemaUid && initialSchema['x-uid'])) {
735
- _context7.next = 6;
733
+ _context7.next = 2;
734
+ return form.submit();
735
+
736
+ case 2:
737
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit((0, _lodash.cloneDeep)(form.values));
738
+ setVisible(false);
739
+
740
+ case 4:
741
+ case "end":
742
+ return _context7.stop();
743
+ }
744
+ }
745
+ }, _callee7);
746
+ }));
747
+
748
+ return function submitHandler() {
749
+ return _ref.apply(this, arguments);
750
+ };
751
+ }();
752
+
753
+ var openAssignedFieldValueHandler = /*#__PURE__*/function () {
754
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
755
+ return regeneratorRuntime.wrap(function _callee8$(_context8) {
756
+ while (1) {
757
+ switch (_context8.prev = _context8.next) {
758
+ case 0:
759
+ if (!(!schemaUid && (initialSchema === null || initialSchema === void 0 ? void 0 : initialSchema['x-uid']))) {
760
+ _context8.next = 6;
736
761
  break;
737
762
  }
738
763
 
@@ -740,7 +765,7 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
740
765
  dn.emit('patch', {
741
766
  schema: fieldSchema
742
767
  });
743
- _context7.next = 5;
768
+ _context8.next = 5;
744
769
  return api.resource('uiSchemas').insert({
745
770
  values: initialSchema
746
771
  });
@@ -754,20 +779,24 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
754
779
 
755
780
  case 8:
756
781
  case "end":
757
- return _context7.stop();
782
+ return _context8.stop();
758
783
  }
759
784
  }
760
- }, _callee7);
785
+ }, _callee8);
761
786
  }));
762
787
 
763
788
  return function openAssignedFieldValueHandler() {
764
- return _ref.apply(this, arguments);
789
+ return _ref2.apply(this, arguments);
765
790
  };
766
791
  }();
767
792
 
768
793
  return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, _objectSpread(_objectSpread({}, others), {}, {
769
794
  onClick: openAssignedFieldValueHandler
770
- }), props.children || props.title), /*#__PURE__*/_react2.default.createElement(_antd2.Modal, _objectSpread(_objectSpread({
795
+ }), props.children || props.title), /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react2.default.createElement("div", {
796
+ onClick: function onClick(e) {
797
+ e.stopPropagation();
798
+ }
799
+ }, /*#__PURE__*/_react2.default.createElement(_antd2.Modal, _objectSpread(_objectSpread({
771
800
  width: '50%',
772
801
  title: compile(title)
773
802
  }, others), {}, {
@@ -786,10 +815,14 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
786
815
  layout: 'vertical'
787
816
  }, modalTip && /*#__PURE__*/_react2.default.createElement(_antd2.Alert, {
788
817
  message: modalTip
789
- }), modalTip && /*#__PURE__*/_react2.default.createElement("br", null), visible && /*#__PURE__*/_react2.default.createElement(_.RemoteSchemaComponent, {
818
+ }), modalTip && /*#__PURE__*/_react2.default.createElement("br", null), visible && schemaUid && /*#__PURE__*/_react2.default.createElement(_.RemoteSchemaComponent, {
790
819
  noForm: true,
820
+ components: components,
791
821
  uid: schemaUid
792
- })))));
822
+ }), visible && schema && /*#__PURE__*/_react2.default.createElement(_.SchemaComponent, {
823
+ components: components,
824
+ schema: schema
825
+ }))))), document.body));
793
826
  });
794
827
 
795
828
  SchemaSettings.ModalItem = function (props) {
@@ -93,7 +93,7 @@ var CurrentUser = function CurrentUser() {
93
93
  return api.resource('users').signout();
94
94
 
95
95
  case 2:
96
- api.setBearerToken(null);
96
+ api.auth.setToken(null);
97
97
  history.push('/signin');
98
98
 
99
99
  case 4:
@@ -83,13 +83,14 @@ var LanguageSettings = function LanguageSettings() {
83
83
  });
84
84
 
85
85
  case 2:
86
- _context.next = 4;
86
+ api.auth.setLocale(lang);
87
+ _context.next = 5;
87
88
  return i18n.changeLanguage(lang);
88
89
 
89
- case 4:
90
+ case 5:
90
91
  window.location.reload();
91
92
 
92
- case 5:
93
+ case 6:
93
94
  case "end":
94
95
  return _context.stop();
95
96
  }
@@ -97,10 +97,6 @@ var useSignin = function useSignin() {
97
97
  return {
98
98
  run: function run() {
99
99
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
100
- var _response$data, _response$data$data;
101
-
102
- var response, _response$data2, _response$data2$data;
103
-
104
100
  return regeneratorRuntime.wrap(function _callee$(_context) {
105
101
  while (1) {
106
102
  switch (_context.prev = _context.next) {
@@ -110,19 +106,12 @@ var useSignin = function useSignin() {
110
106
 
111
107
  case 2:
112
108
  _context.next = 4;
113
- return api.resource('users').signin({
114
- values: form.values
115
- });
109
+ return api.auth.signIn(form.values);
116
110
 
117
111
  case 4:
118
- response = _context.sent;
119
-
120
- if (response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$data = _response$data.data) === null || _response$data$data === void 0 ? void 0 : _response$data$data.token) {
121
- api.setBearerToken(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$data = _response$data2.data) === null || _response$data2$data === void 0 ? void 0 : _response$data2$data.token);
122
- history.push(redirect || '/admin');
123
- }
112
+ history.push(redirect || '/admin');
124
113
 
125
- case 6:
114
+ case 5:
126
115
  case "end":
127
116
  return _context.stop();
128
117
  }
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SwitchRole = void 0;
7
7
 
8
- var _ahooks = require("ahooks");
9
-
10
8
  var _antd = require("antd");
11
9
 
12
10
  var _react = _interopRequireDefault(require("react"));
@@ -27,18 +25,6 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
27
25
 
28
26
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
29
27
 
30
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
31
-
32
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
33
-
34
- 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); }
35
-
36
- 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; }
37
-
38
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
39
-
40
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
41
-
42
28
  var useCurrentRoles = function useCurrentRoles() {
43
29
  var _data$data;
44
30
 
@@ -67,23 +53,12 @@ var useCurrentRoles = function useCurrentRoles() {
67
53
  };
68
54
 
69
55
  var SwitchRole = function SwitchRole() {
70
- var _roles$find;
71
-
72
56
  var api = (0, _apiClient.useAPIClient)();
73
57
  var roles = useCurrentRoles();
74
58
 
75
59
  var _useTranslation = (0, _reactI18next.useTranslation)(),
76
60
  t = _useTranslation.t;
77
61
 
78
- var _useCookieState = (0, _ahooks.useCookieState)('currentRoleName', {
79
- defaultValue: roles === null || roles === void 0 ? void 0 : (_roles$find = roles.find(function (role) {
80
- return role.default;
81
- })) === null || _roles$find === void 0 ? void 0 : _roles$find.name
82
- }),
83
- _useCookieState2 = _slicedToArray(_useCookieState, 2),
84
- roleName = _useCookieState2[0],
85
- setRoleName = _useCookieState2[1];
86
-
87
62
  if (roles.length <= 1) {
88
63
  return null;
89
64
  }
@@ -100,14 +75,14 @@ var SwitchRole = function SwitchRole() {
100
75
  value: 'name'
101
76
  },
102
77
  options: roles,
103
- value: roleName,
78
+ value: api.auth.role,
104
79
  onChange: function () {
105
80
  var _onChange = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(roleName) {
106
81
  return regeneratorRuntime.wrap(function _callee$(_context) {
107
82
  while (1) {
108
83
  switch (_context.prev = _context.next) {
109
84
  case 0:
110
- setRoleName(roleName);
85
+ api.auth.setRole(roleName);
111
86
  _context.next = 3;
112
87
  return api.resource('users').setDefaultRole({
113
88
  values: {
@@ -49,6 +49,7 @@ var FieldsSelect = (0, _react2.observer)(function (props) {
49
49
  var _field$uiSchema;
50
50
 
51
51
  return /*#__PURE__*/_react.default.createElement(_antd.Select.Option, {
52
+ key: field.name,
52
53
  value: field.name
53
54
  }, compile((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title));
54
55
  }));
@@ -23,6 +23,8 @@ var _collection = _interopRequireDefault(require("./collection"));
23
23
 
24
24
  var _style = require("../style");
25
25
 
26
+ var _schedule = _interopRequireDefault(require("./schedule"));
27
+
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
29
 
28
30
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
@@ -88,6 +90,7 @@ function useUpdateConfigAction() {
88
90
  var triggers = new _utils.Registry();
89
91
  exports.triggers = triggers;
90
92
  triggers.register(_collection.default.type, _collection.default);
93
+ triggers.register(_schedule.default.type, _schedule.default);
91
94
 
92
95
  var TriggerConfig = function TriggerConfig() {
93
96
  var _useTranslation2 = (0, _reactI18next.useTranslation)(),
@@ -0,0 +1,25 @@
1
+ import { useCollectionDataSource } from '../../collection-manager';
2
+ declare const _default: {
3
+ title: string;
4
+ type: string;
5
+ fieldset: {
6
+ config: {
7
+ type: string;
8
+ name: string;
9
+ 'x-component': string;
10
+ 'x-component-props': {};
11
+ };
12
+ };
13
+ scope: {
14
+ useCollectionDataSource: typeof useCollectionDataSource;
15
+ };
16
+ components: {
17
+ ScheduleConfig: () => JSX.Element;
18
+ };
19
+ getter({ type, options, onChange }: {
20
+ type: any;
21
+ options: any;
22
+ onChange: any;
23
+ }): JSX.Element;
24
+ };
25
+ export default _default;