@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
@@ -133,17 +133,33 @@ var useCreateCollectionField = function useCreateCollectionField() {
133
133
  return {
134
134
  run: function run() {
135
135
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
136
- var _form$values, _form$values$uiSchema, _form$values$uiSchema2, _form$values2;
136
+ var _form$values, _form$values$uiSchema, _form$values$uiSchema2, _form$values2, _form$values3;
137
137
 
138
- var options;
138
+ var options, recursiveChildren;
139
139
  return regeneratorRuntime.wrap(function _callee$(_context) {
140
140
  while (1) {
141
141
  switch (_context.prev = _context.next) {
142
142
  case 0:
143
- _context.next = 2;
143
+ recursiveChildren = function _recursiveChildren() {
144
+ var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
145
+ var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
146
+ children.forEach(function (item, index) {
147
+ var _item$uiSchema, _item$uiSchema$enum;
148
+
149
+ var itemOptions = ((_item$uiSchema = item.uiSchema) === null || _item$uiSchema === void 0 ? void 0 : (_item$uiSchema$enum = _item$uiSchema.enum) === null || _item$uiSchema$enum === void 0 ? void 0 : _item$uiSchema$enum.slice()) || [];
150
+ form.setValuesIn("".concat(prefix, "[").concat(index, "].uiSchema.enum"), itemOptions.map(function (option) {
151
+ return _objectSpread({
152
+ value: (0, _shared.uid)()
153
+ }, option);
154
+ }));
155
+ recursiveChildren(item.children, "".concat(prefix, "[").concat(index, "].children"));
156
+ });
157
+ };
158
+
159
+ _context.next = 3;
144
160
  return form.submit();
145
161
 
146
- case 2:
162
+ case 3:
147
163
  options = (form === null || form === void 0 ? void 0 : (_form$values = form.values) === null || _form$values === void 0 ? void 0 : (_form$values$uiSchema = _form$values.uiSchema) === null || _form$values$uiSchema === void 0 ? void 0 : (_form$values$uiSchema2 = _form$values$uiSchema.enum) === null || _form$values$uiSchema2 === void 0 ? void 0 : _form$values$uiSchema2.slice()) || [];
148
164
 
149
165
  if (options === null || options === void 0 ? void 0 : options.length) {
@@ -154,18 +170,20 @@ var useCreateCollectionField = function useCreateCollectionField() {
154
170
  }));
155
171
  }
156
172
 
157
- if ((form === null || form === void 0 ? void 0 : (_form$values2 = form.values) === null || _form$values2 === void 0 ? void 0 : _form$values2.interface) === 'linkTo' && title) {
173
+ recursiveChildren(form === null || form === void 0 ? void 0 : (_form$values2 = form.values) === null || _form$values2 === void 0 ? void 0 : _form$values2.children);
174
+
175
+ if ((form === null || form === void 0 ? void 0 : (_form$values3 = form.values) === null || _form$values3 === void 0 ? void 0 : _form$values3.interface) === 'linkTo' && title) {
158
176
  form.setValuesIn('reverseField.uiSchema.title', title);
159
177
  }
160
178
 
161
- _context.next = 7;
179
+ _context.next = 9;
162
180
  return _run();
163
181
 
164
- case 7:
165
- _context.next = 9;
182
+ case 9:
183
+ _context.next = 11;
166
184
  return refreshCM();
167
185
 
168
- case 9:
186
+ case 11:
169
187
  case "end":
170
188
  return _context.stop();
171
189
  }
@@ -119,31 +119,48 @@ var useUpdateCollectionField = function useUpdateCollectionField() {
119
119
  return {
120
120
  run: function run() {
121
121
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
122
- var _form$values, _form$values$uiSchema, _form$values$uiSchema2;
122
+ var _form$values, _form$values$uiSchema, _form$values$uiSchema2, _form$values2;
123
123
 
124
- var options;
124
+ var options, recursiveChildren;
125
125
  return regeneratorRuntime.wrap(function _callee$(_context) {
126
126
  while (1) {
127
127
  switch (_context.prev = _context.next) {
128
128
  case 0:
129
- _context.next = 2;
129
+ recursiveChildren = function _recursiveChildren() {
130
+ var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
131
+ var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
132
+ children.forEach(function (item, index) {
133
+ var _item$uiSchema, _item$uiSchema$enum;
134
+
135
+ var itemOptions = ((_item$uiSchema = item.uiSchema) === null || _item$uiSchema === void 0 ? void 0 : (_item$uiSchema$enum = _item$uiSchema.enum) === null || _item$uiSchema$enum === void 0 ? void 0 : _item$uiSchema$enum.slice()) || [];
136
+ form.setValuesIn("".concat(prefix, "[").concat(index, "].uiSchema.enum"), itemOptions.map(function (option) {
137
+ return _objectSpread({
138
+ value: (0, _shared.uid)()
139
+ }, option);
140
+ }));
141
+ recursiveChildren(item.children, "".concat(prefix, "[").concat(index, "].children"));
142
+ });
143
+ };
144
+
145
+ _context.next = 3;
130
146
  return form.submit();
131
147
 
132
- case 2:
148
+ case 3:
133
149
  options = (form === null || form === void 0 ? void 0 : (_form$values = form.values) === null || _form$values === void 0 ? void 0 : (_form$values$uiSchema = _form$values.uiSchema) === null || _form$values$uiSchema === void 0 ? void 0 : (_form$values$uiSchema2 = _form$values$uiSchema.enum) === null || _form$values$uiSchema2 === void 0 ? void 0 : _form$values$uiSchema2.slice()) || [];
134
150
  form.setValuesIn('uiSchema.enum', options.map(function (option) {
135
151
  return _objectSpread({
136
152
  value: (0, _shared.uid)()
137
153
  }, option);
138
154
  }));
139
- _context.next = 6;
155
+ recursiveChildren(form === null || form === void 0 ? void 0 : (_form$values2 = form.values) === null || _form$values2 === void 0 ? void 0 : _form$values2.children);
156
+ _context.next = 8;
140
157
  return _run();
141
158
 
142
- case 6:
143
- _context.next = 8;
159
+ case 8:
160
+ _context.next = 10;
144
161
  return refreshCM();
145
162
 
146
- case 8:
163
+ case 10:
147
164
  case "end":
148
165
  return _context.stop();
149
166
  }
@@ -1,7 +1,7 @@
1
1
  import { SchemaKey } from '@formily/react';
2
2
  import { CollectionFieldOptions } from '../types';
3
3
  export declare const useCollection: () => {
4
- resource: import("../../api-client").IResource;
4
+ resource: import("@nocobase/sdk").IResource;
5
5
  getField(name: SchemaKey): CollectionFieldOptions;
6
6
  name?: string;
7
7
  title?: string;
package/lib/i18n/i18n.js CHANGED
@@ -21,7 +21,7 @@ var i18n = _i18next.default.createInstance();
21
21
 
22
22
  exports.i18n = i18n;
23
23
  i18n.use(_reactI18next.initReactI18next).init({
24
- lng: localStorage.getItem('NOCOBASE_LANG') || 'en-US',
24
+ lng: localStorage.getItem('NOCOBASE_LOCALE') || 'en-US',
25
25
  // debug: true,
26
26
  defaultNS: 'client',
27
27
  // parseMissingKeyHandler: (key) => {
@@ -43,8 +43,8 @@ function setMomentLng(language) {
43
43
  _moment.default.locale(lng);
44
44
  }
45
45
 
46
- setMomentLng(localStorage.getItem('NOCOBASE_LANG'));
46
+ setMomentLng(localStorage.getItem('NOCOBASE_LOCALE'));
47
47
  i18n.on('languageChanged', function (lng) {
48
- localStorage.setItem('NOCOBASE_LANG', lng);
48
+ localStorage.setItem('NOCOBASE_LOCALE', lng);
49
49
  setMomentLng(lng);
50
50
  });
@@ -278,5 +278,15 @@ declare const _default: {
278
278
  'Button background color': string;
279
279
  Highlight: string;
280
280
  'Danger red': string;
281
+ 'Custom request': string;
282
+ 'Request settings': string;
283
+ 'Request URL': string;
284
+ 'Request method': string;
285
+ 'Request query parameters': string;
286
+ 'Request headers': string;
287
+ 'Request body': string;
288
+ 'Request success': string;
289
+ 'Invalid JSON format': string;
290
+ 'After successful request': string;
281
291
  };
282
292
  export default _default;
@@ -284,6 +284,16 @@ var _default = {
284
284
  'After successful save': 'After successful save',
285
285
  'Button background color': 'Button background color',
286
286
  'Highlight': 'Highlight',
287
- 'Danger red': 'Danger red'
287
+ 'Danger red': 'Danger red',
288
+ 'Custom request': 'Custom request',
289
+ 'Request settings': 'Request settings',
290
+ 'Request URL': 'Request URL',
291
+ 'Request method': 'Request method',
292
+ 'Request query parameters': 'Request query parameters(JSON)',
293
+ 'Request headers': 'Request headers(JSON)',
294
+ 'Request body': 'Request body(JSON)',
295
+ 'Request success': 'Request success',
296
+ 'Invalid JSON format': 'Invalid JSON format',
297
+ 'After successful request': 'After successful request'
288
298
  };
289
299
  exports.default = _default;
@@ -280,6 +280,16 @@ export declare const resources: {
280
280
  'Button background color': string;
281
281
  Highlight: string;
282
282
  'Danger red': string;
283
+ 'Custom request': string;
284
+ 'Request settings': string;
285
+ 'Request URL': string;
286
+ 'Request method': string;
287
+ 'Request query parameters': string;
288
+ 'Request headers': string;
289
+ 'Request body': string;
290
+ 'Request success': string;
291
+ 'Invalid JSON format': string;
292
+ 'After successful request': string;
283
293
  };
284
294
  };
285
295
  'zh-CN': {
@@ -683,6 +693,30 @@ export declare const resources: {
683
693
  'Changed fields': string;
684
694
  'Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.': string;
685
695
  'Only triggers when match conditions': string;
696
+ 'Schedule event': string;
697
+ 'Trigger mode': string;
698
+ 'Based on certain date': string;
699
+ 'Based on date field of collection': string;
700
+ 'Starts on': string;
701
+ 'Ends on': string;
702
+ 'Exactly at': string;
703
+ 'Repeat mode': string;
704
+ 'Repeat limit': string;
705
+ 'No limit': string;
706
+ Seconds: string;
707
+ Minutes: string;
708
+ Hours: string;
709
+ Days: string;
710
+ Months: string;
711
+ 'No repeat': string;
712
+ Every: string;
713
+ 'By minute': string;
714
+ 'By hour': string;
715
+ 'By date': string;
716
+ 'By month': string;
717
+ 'By day of week': string;
718
+ 'By field': string;
719
+ 'By custom date': string;
686
720
  End: string;
687
721
  'Trigger context': string;
688
722
  'Node result': string;
@@ -747,6 +781,16 @@ export declare const resources: {
747
781
  'Button background color': string;
748
782
  Highlight: string;
749
783
  'Danger red': string;
784
+ 'Custom request': string;
785
+ 'Request settings': string;
786
+ 'Request URL': string;
787
+ 'Request method': string;
788
+ 'Request query parameters': string;
789
+ 'Request headers': string;
790
+ 'Request body': string;
791
+ 'Request success': string;
792
+ 'Invalid JSON format': string;
793
+ 'After successful request': string;
750
794
  };
751
795
  };
752
796
  };
@@ -398,6 +398,30 @@ declare const _default: {
398
398
  'Changed fields': string;
399
399
  'Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.': string;
400
400
  'Only triggers when match conditions': string;
401
+ 'Schedule event': string;
402
+ 'Trigger mode': string;
403
+ 'Based on certain date': string;
404
+ 'Based on date field of collection': string;
405
+ 'Starts on': string;
406
+ 'Ends on': string;
407
+ 'Exactly at': string;
408
+ 'Repeat mode': string;
409
+ 'Repeat limit': string;
410
+ 'No limit': string;
411
+ Seconds: string;
412
+ Minutes: string;
413
+ Hours: string;
414
+ Days: string;
415
+ Months: string;
416
+ 'No repeat': string;
417
+ Every: string;
418
+ 'By minute': string;
419
+ 'By hour': string;
420
+ 'By date': string;
421
+ 'By month': string;
422
+ 'By day of week': string;
423
+ 'By field': string;
424
+ 'By custom date': string;
401
425
  End: string;
402
426
  'Trigger context': string;
403
427
  'Node result': string;
@@ -462,5 +486,15 @@ declare const _default: {
462
486
  'Button background color': string;
463
487
  Highlight: string;
464
488
  'Danger red': string;
489
+ 'Custom request': string;
490
+ 'Request settings': string;
491
+ 'Request URL': string;
492
+ 'Request method': string;
493
+ 'Request query parameters': string;
494
+ 'Request headers': string;
495
+ 'Request body': string;
496
+ 'Request success': string;
497
+ 'Invalid JSON format': string;
498
+ 'After successful request': string;
465
499
  };
466
500
  export default _default;
@@ -405,6 +405,30 @@ var _default = {
405
405
  'Changed fields': '发生变动的字段',
406
406
  'Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.': '只有被选中的某个字段发生变动时才会触发。如果不选择,则表示任何字段变动时都会触发。新增或删除数据时,任意字段都被认为发生变动。',
407
407
  'Only triggers when match conditions': '满足以下条件才触发',
408
+ 'Schedule event': '定时任务',
409
+ 'Trigger mode': '触发模式',
410
+ 'Based on certain date': '自定义时间',
411
+ 'Based on date field of collection': '根据数据表时间字段',
412
+ 'Starts on': '开始于',
413
+ 'Ends on': '结束于',
414
+ 'Exactly at': '当时',
415
+ 'Repeat mode': '重复模式',
416
+ 'Repeat limit': '重复次数',
417
+ 'No limit': '不限',
418
+ 'Seconds': '秒',
419
+ 'Minutes': '分钟',
420
+ 'Hours': '小时',
421
+ 'Days': '天',
422
+ 'Months': '月',
423
+ 'No repeat': '不重复',
424
+ 'Every': '每',
425
+ 'By minute': '按分钟',
426
+ 'By hour': '按小时',
427
+ 'By date': '按日(月)',
428
+ 'By month': '按月',
429
+ 'By day of week': '按天(周)',
430
+ 'By field': '数据表字段',
431
+ 'By custom date': '自定义时间',
408
432
  'End': '结束',
409
433
  'Trigger context': '触发数据',
410
434
  'Node result': '节点数据',
@@ -468,6 +492,16 @@ var _default = {
468
492
  'After clicking the custom button, the following fields of the current record will be saved according to the following form.': '点击当前自定义按钮时,当前数据以下字段将按照以下表单保存。',
469
493
  'Button background color': '按钮颜色',
470
494
  'Highlight': '高亮',
471
- 'Danger red': '红色'
495
+ 'Danger red': '红色',
496
+ 'Custom request': '自定义请求',
497
+ 'Request settings': '请求设置',
498
+ 'Request URL': '请求地址',
499
+ 'Request method': '请求方法',
500
+ 'Request query parameters': '请求查询参数(JSON格式)',
501
+ 'Request headers': '请求头参数(JSON格式)',
502
+ 'Request body': '请求体(JSON格式)',
503
+ 'Request success': '请求成功',
504
+ 'Invalid JSON format': '非法JSON格式',
505
+ 'After successful request': '请求成功之后'
472
506
  };
473
507
  exports.default = _default;
@@ -23,6 +23,8 @@ var _ = require("../..");
23
23
 
24
24
  var _schemaSettings = require("../../../schema-settings");
25
25
 
26
+ var _utils2 = require("./utils");
27
+
26
28
  var _excluded = ["modalTip"];
27
29
 
28
30
  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); }
@@ -61,10 +63,12 @@ var MenuGroup = function MenuGroup(props) {
61
63
  var actionTitles = {
62
64
  'customize:popup': t('Popup'),
63
65
  'customize:update': t('Update record'),
64
- 'customize:save': t('Save record')
66
+ 'customize:save': t('Save record'),
67
+ 'customize:table:request': t('Custom request'),
68
+ 'customize:form:request': t('Custom request')
65
69
  };
66
70
 
67
- if (!['customize:popup', 'customize:update', 'customize:save'].includes(actionType)) {
71
+ if (!['customize:popup', 'customize:update', 'customize:save', 'customize:table:request', 'customize:form:request'].includes(actionType)) {
68
72
  return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, props.children);
69
73
  }
70
74
 
@@ -74,7 +78,7 @@ var MenuGroup = function MenuGroup(props) {
74
78
  };
75
79
 
76
80
  var ActionDesigner = function ActionDesigner(props) {
77
- var _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xAction, _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5, _fieldSchema$xAction6, _fieldSchema$xAction7;
81
+ var _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xAction, _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5, _fieldSchema$xAction6, _fieldSchema$xAction7, _fieldSchema$xAction8, _fieldSchema$xAction9;
78
82
 
79
83
  var modalTip = props.modalTip,
80
84
  restProps = _objectWithoutProperties(props, _excluded);
@@ -213,28 +217,45 @@ var ActionDesigner = function ActionDesigner(props) {
213
217
  });
214
218
  dn.refresh();
215
219
  }
216
- }), (0, _shared.isValid)(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction4 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction4 === void 0 ? void 0 : _fieldSchema$xAction4.skipValidator) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
220
+ }), (0, _shared.isValid)(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction4 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction4 === void 0 ? void 0 : _fieldSchema$xAction4.requestSettings) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ActionModalItem, {
221
+ title: t('Request settings'),
222
+ schema: _utils2.requestSettingsSchema,
223
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction5 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction5 === void 0 ? void 0 : _fieldSchema$xAction5.requestSettings,
224
+ onSubmit: function onSubmit(requestSettings) {
225
+ var _schema3;
226
+
227
+ fieldSchema['x-action-settings']['requestSettings'] = requestSettings;
228
+ dn.emit('patch', {
229
+ schema: (_schema3 = {}, _defineProperty(_schema3, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema3, 'x-action-settings', fieldSchema['x-action-settings']), _schema3)
230
+ });
231
+ dn.refresh();
232
+ }
233
+ }), (0, _shared.isValid)(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction6 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction6 === void 0 ? void 0 : _fieldSchema$xAction6.skipValidator) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SwitchItem, {
217
234
  title: t('Skip required validation'),
218
- checked: !!(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction5 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction5 === void 0 ? void 0 : _fieldSchema$xAction5.skipValidator),
235
+ checked: !!(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction7 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction7 === void 0 ? void 0 : _fieldSchema$xAction7.skipValidator),
219
236
  onChange: function onChange(value) {
220
- var _schema3;
237
+ var _schema4;
221
238
 
222
239
  fieldSchema['x-action-settings'].skipValidator = value;
223
240
  dn.emit('patch', {
224
- schema: (_schema3 = {}, _defineProperty(_schema3, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema3, 'x-action-settings', _objectSpread({}, fieldSchema['x-action-settings'])), _schema3)
241
+ schema: (_schema4 = {}, _defineProperty(_schema4, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema4, 'x-action-settings', _objectSpread({}, fieldSchema['x-action-settings'])), _schema4)
225
242
  });
226
243
  }
227
- }), (0, _shared.isValid)(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction6 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction6 === void 0 ? void 0 : _fieldSchema$xAction6['onSuccess']) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
244
+ }), (0, _shared.isValid)(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction8 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction8 === void 0 ? void 0 : _fieldSchema$xAction8['onSuccess']) && /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.ModalItem, {
228
245
  title: {
229
246
  'customize:save': t('After successful save'),
230
- 'customize:update': t('After successful update')
247
+ 'customize:update': t('After successful update'),
248
+ 'customize:table:request': t('After successful request'),
249
+ 'customize:form:request': t('After successful request')
231
250
  }[actionType],
232
- initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction7 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction7 === void 0 ? void 0 : _fieldSchema$xAction7['onSuccess'],
251
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction9 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction9 === void 0 ? void 0 : _fieldSchema$xAction9['onSuccess'],
233
252
  schema: {
234
253
  type: 'object',
235
254
  title: {
236
255
  'customize:save': t('After successful save'),
237
- 'customize:update': t('After successful update')
256
+ 'customize:update': t('After successful update'),
257
+ 'customize:table:request': t('After successful request'),
258
+ 'customize:form:request': t('After successful request')
238
259
  }[actionType],
239
260
  properties: {
240
261
  successMessage: {
@@ -288,11 +309,11 @@ var ActionDesigner = function ActionDesigner(props) {
288
309
  }
289
310
  },
290
311
  onSubmit: function onSubmit(onSuccess) {
291
- var _schema4;
312
+ var _schema5;
292
313
 
293
314
  fieldSchema['x-action-settings']['onSuccess'] = onSuccess;
294
315
  dn.emit('patch', {
295
- schema: (_schema4 = {}, _defineProperty(_schema4, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema4, 'x-action-settings', fieldSchema['x-action-settings']), _schema4)
316
+ schema: (_schema5 = {}, _defineProperty(_schema5, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema5, 'x-action-settings', fieldSchema['x-action-settings']), _schema5)
296
317
  });
297
318
  }
298
319
  }), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Divider, null), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.Remove, {
@@ -0,0 +1,2 @@
1
+ import type { ISchema } from '@formily/react';
2
+ export declare const requestSettingsSchema: ISchema;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.requestSettingsSchema = void 0;
7
+ var validateJSON = {
8
+ validator: "{{(value, rule)=> {\n if (!value) {\n return '';\n }\n try {\n const val = JSON.parse(value);\n if(!isNaN(val)) {\n return false;\n }\n return true;\n } catch(error) {\n console.error(error);\n return false;\n }\n }}}",
9
+ message: '{{t("Invalid JSON format")}}'
10
+ };
11
+ var requestSettingsSchema = {
12
+ type: 'object',
13
+ properties: {
14
+ url: {
15
+ type: 'string',
16
+ title: '{{t("Request URL")}}',
17
+ required: true,
18
+ 'x-decorator': 'FormItem',
19
+ 'x-component': 'Input'
20
+ },
21
+ method: {
22
+ type: 'string',
23
+ title: '{{t("Request method")}}',
24
+ 'x-decorator': 'FormItem',
25
+ 'x-component': 'Select',
26
+ default: 'POST',
27
+ enum: [{
28
+ label: 'POST',
29
+ value: 'POST'
30
+ }, {
31
+ label: 'GET',
32
+ value: 'GET'
33
+ }, {
34
+ label: 'PUT',
35
+ value: 'PUT'
36
+ }, {
37
+ label: 'PATCH',
38
+ value: 'PATCH'
39
+ }, {
40
+ label: 'DELETE',
41
+ value: 'DELETE'
42
+ }]
43
+ },
44
+ headers: {
45
+ type: 'string',
46
+ title: '{{t("Request headers")}}',
47
+ 'x-decorator': 'FormItem',
48
+ 'x-component': 'Input.TextArea',
49
+ 'x-validator': validateJSON
50
+ },
51
+ params: {
52
+ type: 'string',
53
+ title: '{{t("Request query parameters")}}',
54
+ 'x-decorator': 'FormItem',
55
+ 'x-component': 'Input.TextArea',
56
+ 'x-validator': validateJSON
57
+ },
58
+ data: {
59
+ type: 'string',
60
+ title: '{{t("Request body")}}',
61
+ 'x-decorator': 'FormItem',
62
+ 'x-component': 'Input.TextArea',
63
+ 'x-validator': validateJSON
64
+ }
65
+ }
66
+ };
67
+ exports.requestSettingsSchema = requestSettingsSchema;
@@ -1,6 +1,7 @@
1
1
  import type { DatePickerProps } from 'antd/lib/date-picker';
2
+ import moment from 'moment';
2
3
  export declare const getDefaultFormat: (props: DatePickerProps & {
3
4
  dateFormat: string;
4
5
  timeFormat: string;
5
- }) => string | import("rc-picker/lib/interface").CustomFormat<import("moment").Moment> | (string | import("rc-picker/lib/interface").CustomFormat<import("moment").Moment>)[];
6
+ }) => string | import("rc-picker/lib/interface").CustomFormat<moment.Moment> | (string | import("rc-picker/lib/interface").CustomFormat<moment.Moment>)[];
6
7
  export declare const mapDateFormat: () => (props: any) => any;
@@ -7,6 +7,10 @@ exports.mapDateFormat = exports.getDefaultFormat = void 0;
7
7
 
8
8
  var _builtins__ = require("@formily/antd/lib/__builtins__");
9
9
 
10
+ var _moment = _interopRequireDefault(require("moment"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
10
14
  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; }
11
15
 
12
16
  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; }
@@ -47,7 +51,8 @@ var mapDateFormat = function mapDateFormat() {
47
51
  var _onChange = props.onChange;
48
52
  return _objectSpread(_objectSpread({}, props), {}, {
49
53
  format: format,
50
- value: (0, _builtins__.momentable)(props.value, format === 'YYYY-wo' ? 'YYYY-w' : format),
54
+ value: props.value && (0, _moment.default)(props.value).isValid() ? (0, _moment.default)(props.value) : undefined,
55
+ // value: momentable(props.value, format === 'YYYY-wo' ? 'YYYY-w' : format),
51
56
  onChange: function onChange(value) {
52
57
  if (_onChange) {
53
58
  _onChange((0, _builtins__.formatMomentValue)(value, format));