@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
@@ -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) {
@@ -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;