@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
  })[];
@@ -92,6 +92,27 @@ export var FormActionInitializers = {
92
92
  useProps: '{{ useCreateActionProps }}'
93
93
  }
94
94
  }
95
+ }, {
96
+ type: 'item',
97
+ title: '{{t("Custom request")}}',
98
+ component: 'CustomizeActionInitializer',
99
+ schema: {
100
+ title: '{{ t("Custom request") }}',
101
+ 'x-component': 'Action',
102
+ 'x-action': 'customize:form:request',
103
+ 'x-designer': 'Action.Designer',
104
+ 'x-action-settings': {
105
+ requestSettings: {},
106
+ onSuccess: {
107
+ manualClose: false,
108
+ redirecting: false,
109
+ successMessage: '{{t("Request success")}}'
110
+ }
111
+ },
112
+ 'x-component-props': {
113
+ useProps: '{{ useCustomizeRequestActionProps }}'
114
+ }
115
+ }
95
116
  }]
96
117
  }]
97
118
  };
@@ -188,6 +209,27 @@ export var CreateFormActionInitializers = {
188
209
  useProps: '{{ useCreateActionProps }}'
189
210
  }
190
211
  }
212
+ }, {
213
+ type: 'item',
214
+ title: '{{t("Custom request")}}',
215
+ component: 'CustomizeActionInitializer',
216
+ schema: {
217
+ title: '{{ t("Custom request") }}',
218
+ 'x-component': 'Action',
219
+ 'x-action': 'customize:form:request',
220
+ 'x-designer': 'Action.Designer',
221
+ 'x-action-settings': {
222
+ requestSettings: {},
223
+ onSuccess: {
224
+ manualClose: false,
225
+ redirecting: false,
226
+ successMessage: '{{t("Request success")}}'
227
+ }
228
+ },
229
+ 'x-component-props': {
230
+ useProps: '{{ useCustomizeRequestActionProps }}'
231
+ }
232
+ }
191
233
  }]
192
234
  }]
193
235
  };
@@ -284,6 +326,27 @@ export var UpdateFormActionInitializers = {
284
326
  useProps: '{{ useUpdateActionProps }}'
285
327
  }
286
328
  }
329
+ }, {
330
+ type: 'item',
331
+ title: '{{t("Custom request")}}',
332
+ component: 'CustomizeActionInitializer',
333
+ schema: {
334
+ title: '{{ t("Custom request") }}',
335
+ 'x-component': 'Action',
336
+ 'x-action': 'customize:form:request',
337
+ 'x-designer': 'Action.Designer',
338
+ 'x-action-settings': {
339
+ requestSettings: {},
340
+ onSuccess: {
341
+ manualClose: false,
342
+ redirecting: false,
343
+ successMessage: '{{t("Request success")}}'
344
+ }
345
+ },
346
+ 'x-component-props': {
347
+ useProps: '{{ useCustomizeRequestActionProps }}'
348
+ }
349
+ }
287
350
  }]
288
351
  }]
289
352
  };
@@ -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;
@@ -103,6 +103,27 @@ export var ReadPrettyFormActionInitializers = {
103
103
  useProps: '{{ useCustomizeUpdateActionProps }}'
104
104
  }
105
105
  }
106
+ }, {
107
+ type: 'item',
108
+ title: '{{t("Custom request")}}',
109
+ component: 'CustomizeActionInitializer',
110
+ schema: {
111
+ title: '{{ t("Custom request") }}',
112
+ 'x-component': 'Action',
113
+ 'x-action': 'customize:form:request',
114
+ 'x-designer': 'Action.Designer',
115
+ 'x-action-settings': {
116
+ requestSettings: {},
117
+ onSuccess: {
118
+ manualClose: false,
119
+ redirecting: false,
120
+ successMessage: '{{t("Request success")}}'
121
+ }
122
+ },
123
+ 'x-component-props': {
124
+ useProps: '{{ useCustomizeRequestActionProps }}'
125
+ }
126
+ }
106
127
  }]
107
128
  }]
108
129
  };
@@ -145,6 +145,27 @@ export var TableActionColumnInitializers = function TableActionColumnInitializer
145
145
  useProps: '{{ useCustomizeUpdateActionProps }}'
146
146
  }
147
147
  }
148
+ }, {
149
+ type: 'item',
150
+ title: '{{t("Custom request")}}',
151
+ component: 'CustomizeActionInitializer',
152
+ schema: {
153
+ title: '{{ t("Custom request") }}',
154
+ 'x-component': 'Action.Link',
155
+ 'x-action': 'customize:table:request',
156
+ 'x-designer': 'Action.Designer',
157
+ 'x-action-settings': {
158
+ requestSettings: {},
159
+ onSuccess: {
160
+ manualClose: false,
161
+ redirecting: false,
162
+ successMessage: '{{t("Request success")}}'
163
+ }
164
+ },
165
+ 'x-component-props': {
166
+ useProps: '{{ useCustomizeRequestActionProps }}'
167
+ }
168
+ }
148
169
  }]
149
170
  }],
150
171
  component: /*#__PURE__*/React.createElement(MenuOutlined, {
@@ -5,7 +5,7 @@ var _excluded = ["children", "fieldSchema"],
5
5
  _excluded3 = ["title", "options", "value", "onChange"],
6
6
  _excluded4 = ["title", "onChange"],
7
7
  _excluded5 = ["schema"],
8
- _excluded6 = ["title", "onSubmit", "initialValues", "initialSchema", "modalTip"],
8
+ _excluded6 = ["title", "onSubmit", "initialValues", "initialSchema", "schema", "modalTip", "components"],
9
9
  _excluded7 = ["hidden", "title", "components", "scope", "effects", "schema", "onSubmit", "initialValues"];
10
10
 
11
11
  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); } }
@@ -45,6 +45,7 @@ import { Alert, Button, Dropdown, Menu, Modal, Select, Space, Switch } from 'ant
45
45
  import classNames from 'classnames';
46
46
  import { cloneDeep } from 'lodash';
47
47
  import React, { createContext, useContext, useMemo, useState } from 'react';
48
+ import { createPortal } from 'react-dom';
48
49
  import { useTranslation } from 'react-i18next';
49
50
  import { ActionContext, createDesignable, FormProvider, RemoteSchemaComponent, SchemaComponent, SchemaComponentOptions, useActionContext, useAPIClient, useCollection, useCompile } from '..';
50
51
  import { useSchemaTemplateManager } from '../schema-templates';
@@ -649,7 +650,9 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/React.memo(function (props) {
649
650
  onSubmit = props.onSubmit,
650
651
  initialValues = props.initialValues,
651
652
  initialSchema = props.initialSchema,
653
+ schema = props.schema,
652
654
  modalTip = props.modalTip,
655
+ components = props.components,
653
656
  others = _objectWithoutProperties(props, _excluded6);
654
657
 
655
658
  var _useState7 = useState(false),
@@ -683,19 +686,40 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/React.memo(function (props) {
683
686
  setVisible(false);
684
687
  };
685
688
 
686
- var submitHandler = function submitHandler() {
687
- onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(cloneDeep(form.values));
688
- setVisible(false);
689
- };
690
-
691
- var openAssignedFieldValueHandler = /*#__PURE__*/function () {
689
+ var submitHandler = /*#__PURE__*/function () {
692
690
  var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
693
691
  return regeneratorRuntime.wrap(function _callee7$(_context7) {
694
692
  while (1) {
695
693
  switch (_context7.prev = _context7.next) {
696
694
  case 0:
697
- if (!(!schemaUid && initialSchema['x-uid'])) {
698
- _context7.next = 6;
695
+ _context7.next = 2;
696
+ return form.submit();
697
+
698
+ case 2:
699
+ onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(cloneDeep(form.values));
700
+ setVisible(false);
701
+
702
+ case 4:
703
+ case "end":
704
+ return _context7.stop();
705
+ }
706
+ }
707
+ }, _callee7);
708
+ }));
709
+
710
+ return function submitHandler() {
711
+ return _ref.apply(this, arguments);
712
+ };
713
+ }();
714
+
715
+ var openAssignedFieldValueHandler = /*#__PURE__*/function () {
716
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
717
+ return regeneratorRuntime.wrap(function _callee8$(_context8) {
718
+ while (1) {
719
+ switch (_context8.prev = _context8.next) {
720
+ case 0:
721
+ if (!(!schemaUid && (initialSchema === null || initialSchema === void 0 ? void 0 : initialSchema['x-uid']))) {
722
+ _context8.next = 6;
699
723
  break;
700
724
  }
701
725
 
@@ -703,7 +727,7 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/React.memo(function (props) {
703
727
  dn.emit('patch', {
704
728
  schema: fieldSchema
705
729
  });
706
- _context7.next = 5;
730
+ _context8.next = 5;
707
731
  return api.resource('uiSchemas').insert({
708
732
  values: initialSchema
709
733
  });
@@ -717,20 +741,24 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/React.memo(function (props) {
717
741
 
718
742
  case 8:
719
743
  case "end":
720
- return _context7.stop();
744
+ return _context8.stop();
721
745
  }
722
746
  }
723
- }, _callee7);
747
+ }, _callee8);
724
748
  }));
725
749
 
726
750
  return function openAssignedFieldValueHandler() {
727
- return _ref.apply(this, arguments);
751
+ return _ref2.apply(this, arguments);
728
752
  };
729
753
  }();
730
754
 
731
755
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SchemaSettings.Item, _objectSpread(_objectSpread({}, others), {}, {
732
756
  onClick: openAssignedFieldValueHandler
733
- }), props.children || props.title), /*#__PURE__*/React.createElement(Modal, _objectSpread(_objectSpread({
757
+ }), props.children || props.title), /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
758
+ onClick: function onClick(e) {
759
+ e.stopPropagation();
760
+ }
761
+ }, /*#__PURE__*/React.createElement(Modal, _objectSpread(_objectSpread({
734
762
  width: '50%',
735
763
  title: compile(title)
736
764
  }, others), {}, {
@@ -749,10 +777,14 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/React.memo(function (props) {
749
777
  layout: 'vertical'
750
778
  }, modalTip && /*#__PURE__*/React.createElement(Alert, {
751
779
  message: modalTip
752
- }), modalTip && /*#__PURE__*/React.createElement("br", null), visible && /*#__PURE__*/React.createElement(RemoteSchemaComponent, {
780
+ }), modalTip && /*#__PURE__*/React.createElement("br", null), visible && schemaUid && /*#__PURE__*/React.createElement(RemoteSchemaComponent, {
753
781
  noForm: true,
782
+ components: components,
754
783
  uid: schemaUid
755
- })))));
784
+ }), visible && schema && /*#__PURE__*/React.createElement(SchemaComponent, {
785
+ components: components,
786
+ schema: schema
787
+ }))))), document.body));
756
788
  });
757
789
 
758
790
  SchemaSettings.ModalItem = function (props) {
@@ -69,7 +69,7 @@ export var CurrentUser = function CurrentUser() {
69
69
  return api.resource('users').signout();
70
70
 
71
71
  case 2:
72
- api.setBearerToken(null);
72
+ api.auth.setToken(null);
73
73
  history.push('/signin');
74
74
 
75
75
  case 4:
@@ -66,13 +66,14 @@ export var LanguageSettings = function LanguageSettings() {
66
66
  });
67
67
 
68
68
  case 2:
69
- _context.next = 4;
69
+ api.auth.setLocale(lang);
70
+ _context.next = 5;
70
71
  return i18n.changeLanguage(lang);
71
72
 
72
- case 4:
73
+ case 5:
73
74
  window.location.reload();
74
75
 
75
- case 5:
76
+ case 6:
76
77
  case "end":
77
78
  return _context.stop();
78
79
  }
@@ -83,10 +83,6 @@ var useSignin = function useSignin() {
83
83
  return {
84
84
  run: function run() {
85
85
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
86
- var _response$data, _response$data$data;
87
-
88
- var response, _response$data2, _response$data2$data;
89
-
90
86
  return regeneratorRuntime.wrap(function _callee$(_context) {
91
87
  while (1) {
92
88
  switch (_context.prev = _context.next) {
@@ -96,19 +92,12 @@ var useSignin = function useSignin() {
96
92
 
97
93
  case 2:
98
94
  _context.next = 4;
99
- return api.resource('users').signin({
100
- values: form.values
101
- });
95
+ return api.auth.signIn(form.values);
102
96
 
103
97
  case 4:
104
- response = _context.sent;
105
-
106
- 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) {
107
- 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);
108
- history.push(redirect || '/admin');
109
- }
98
+ history.push(redirect || '/admin');
110
99
 
111
- case 6:
100
+ case 5:
112
101
  case "end":
113
102
  return _context.stop();
114
103
  }
@@ -2,19 +2,6 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
2
2
 
3
3
  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); }); }; }
4
4
 
5
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
-
7
- 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."); }
8
-
9
- 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); }
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
-
13
- 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; }
14
-
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
-
17
- import { useCookieState } from 'ahooks';
18
5
  import { Menu, Select } from 'antd';
19
6
  import React from 'react';
20
7
  import { useTranslation } from 'react-i18next';
@@ -51,23 +38,12 @@ var useCurrentRoles = function useCurrentRoles() {
51
38
  };
52
39
 
53
40
  export var SwitchRole = function SwitchRole() {
54
- var _roles$find;
55
-
56
41
  var api = useAPIClient();
57
42
  var roles = useCurrentRoles();
58
43
 
59
44
  var _useTranslation = useTranslation(),
60
45
  t = _useTranslation.t;
61
46
 
62
- var _useCookieState = useCookieState('currentRoleName', {
63
- defaultValue: roles === null || roles === void 0 ? void 0 : (_roles$find = roles.find(function (role) {
64
- return role.default;
65
- })) === null || _roles$find === void 0 ? void 0 : _roles$find.name
66
- }),
67
- _useCookieState2 = _slicedToArray(_useCookieState, 2),
68
- roleName = _useCookieState2[0],
69
- setRoleName = _useCookieState2[1];
70
-
71
47
  if (roles.length <= 1) {
72
48
  return null;
73
49
  }
@@ -84,14 +60,14 @@ export var SwitchRole = function SwitchRole() {
84
60
  value: 'name'
85
61
  },
86
62
  options: roles,
87
- value: roleName,
63
+ value: api.auth.role,
88
64
  onChange: function () {
89
65
  var _onChange = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(roleName) {
90
66
  return regeneratorRuntime.wrap(function _callee$(_context) {
91
67
  while (1) {
92
68
  switch (_context.prev = _context.next) {
93
69
  case 0:
94
- setRoleName(roleName);
70
+ api.auth.setRole(roleName);
95
71
  _context.next = 3;
96
72
  return api.resource('users').setDefaultRole({
97
73
  values: {
@@ -31,6 +31,7 @@ var FieldsSelect = observer(function (props) {
31
31
  var _field$uiSchema;
32
32
 
33
33
  return /*#__PURE__*/React.createElement(Select.Option, {
34
+ key: field.name,
34
35
  value: field.name
35
36
  }, compile((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title));
36
37
  }));
@@ -11,6 +11,7 @@ import { message, Tag } from "antd";
11
11
  import { SchemaComponent, useActionContext, useAPIClient, useCompile, useRecord, useResourceActionContext } from '../../';
12
12
  import collection from './collection';
13
13
  import { nodeCardClass, nodeMetaClass } from "../style";
14
+ import schedule from "./schedule";
14
15
 
15
16
  function useUpdateConfigAction() {
16
17
  var _useTranslation = useTranslation(),
@@ -69,6 +70,7 @@ function useUpdateConfigAction() {
69
70
  ;
70
71
  export var triggers = new Registry();
71
72
  triggers.register(collection.type, collection);
73
+ triggers.register(schedule.type, schedule);
72
74
  export var TriggerConfig = function TriggerConfig() {
73
75
  var _useTranslation2 = useTranslation(),
74
76
  t = _useTranslation2.t;
@@ -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;