@nocobase/client 0.7.0-alpha.82 → 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 (65) hide show
  1. package/es/block-provider/hooks/index.d.ts +3 -0
  2. package/es/block-provider/hooks/index.js +233 -168
  3. package/es/collection-manager/Configuration/AddFieldAction.js +27 -9
  4. package/es/collection-manager/Configuration/EditFieldAction.js +25 -8
  5. package/es/locale/en_US.d.ts +10 -0
  6. package/es/locale/en_US.js +11 -1
  7. package/es/locale/index.d.ts +44 -0
  8. package/es/locale/zh_CN.d.ts +34 -0
  9. package/es/locale/zh_CN.js +35 -1
  10. package/es/schema-component/antd/action/Action.Designer.js +33 -13
  11. package/es/schema-component/antd/action/utils.d.ts +2 -0
  12. package/es/schema-component/antd/action/utils.js +60 -0
  13. package/es/schema-component/antd/date-picker/util.d.ts +2 -1
  14. package/es/schema-component/antd/date-picker/util.js +4 -2
  15. package/es/schema-initializer/buttons/FormActionInitializers.d.ts +84 -0
  16. package/es/schema-initializer/buttons/FormActionInitializers.js +63 -0
  17. package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.d.ts +26 -0
  18. package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +21 -0
  19. package/es/schema-initializer/buttons/TableActionColumnInitializers.js +21 -0
  20. package/es/schema-settings/SchemaSettings.js +48 -16
  21. package/es/workflow/triggers/collection.js +1 -0
  22. package/es/workflow/triggers/index.js +2 -0
  23. package/es/workflow/triggers/schedule.d.ts +25 -0
  24. package/es/workflow/triggers/schedule.js +531 -0
  25. package/lib/block-provider/hooks/index.d.ts +3 -0
  26. package/lib/block-provider/hooks/index.js +238 -169
  27. package/lib/collection-manager/Configuration/AddFieldAction.js +27 -9
  28. package/lib/collection-manager/Configuration/EditFieldAction.js +25 -8
  29. package/lib/locale/en_US.d.ts +10 -0
  30. package/lib/locale/en_US.js +11 -1
  31. package/lib/locale/index.d.ts +44 -0
  32. package/lib/locale/zh_CN.d.ts +34 -0
  33. package/lib/locale/zh_CN.js +35 -1
  34. package/lib/schema-component/antd/action/Action.Designer.js +34 -13
  35. package/lib/schema-component/antd/action/utils.d.ts +2 -0
  36. package/lib/schema-component/antd/action/utils.js +67 -0
  37. package/lib/schema-component/antd/date-picker/util.d.ts +2 -1
  38. package/lib/schema-component/antd/date-picker/util.js +6 -1
  39. package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +84 -0
  40. package/lib/schema-initializer/buttons/FormActionInitializers.js +63 -0
  41. package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.d.ts +26 -0
  42. package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +21 -0
  43. package/lib/schema-initializer/buttons/TableActionColumnInitializers.js +21 -0
  44. package/lib/schema-settings/SchemaSettings.js +49 -16
  45. package/lib/workflow/triggers/collection.js +1 -0
  46. package/lib/workflow/triggers/index.js +3 -0
  47. package/lib/workflow/triggers/schedule.d.ts +25 -0
  48. package/lib/workflow/triggers/schedule.js +554 -0
  49. package/package.json +4 -4
  50. package/src/block-provider/hooks/index.ts +106 -69
  51. package/src/collection-manager/Configuration/AddFieldAction.tsx +18 -0
  52. package/src/collection-manager/Configuration/EditFieldAction.tsx +19 -0
  53. package/src/locale/en_US.ts +11 -1
  54. package/src/locale/zh_CN.ts +39 -1
  55. package/src/schema-component/antd/action/Action.Designer.tsx +33 -1
  56. package/src/schema-component/antd/action/utils.ts +68 -0
  57. package/src/schema-component/antd/date-picker/util.ts +4 -3
  58. package/src/schema-initializer/SchemaInitializer.tsx +2 -2
  59. package/src/schema-initializer/buttons/FormActionInitializers.tsx +66 -0
  60. package/src/schema-initializer/buttons/ReadPrettyFormActionInitializers.tsx +22 -0
  61. package/src/schema-initializer/buttons/TableActionColumnInitializers.tsx +22 -0
  62. package/src/schema-settings/SchemaSettings.tsx +40 -29
  63. package/src/workflow/triggers/collection.tsx +1 -1
  64. package/src/workflow/triggers/index.tsx +2 -0
  65. package/src/workflow/triggers/schedule.tsx +422 -0
@@ -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) {
@@ -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;