@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
@@ -107,17 +107,33 @@ var useCreateCollectionField = function useCreateCollectionField() {
107
107
  return {
108
108
  run: function run() {
109
109
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
110
- var _form$values, _form$values$uiSchema, _form$values$uiSchema2, _form$values2;
110
+ var _form$values, _form$values$uiSchema, _form$values$uiSchema2, _form$values2, _form$values3;
111
111
 
112
- var options;
112
+ var options, recursiveChildren;
113
113
  return regeneratorRuntime.wrap(function _callee$(_context) {
114
114
  while (1) {
115
115
  switch (_context.prev = _context.next) {
116
116
  case 0:
117
- _context.next = 2;
117
+ recursiveChildren = function _recursiveChildren() {
118
+ var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
119
+ var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
120
+ children.forEach(function (item, index) {
121
+ var _item$uiSchema, _item$uiSchema$enum;
122
+
123
+ 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()) || [];
124
+ form.setValuesIn("".concat(prefix, "[").concat(index, "].uiSchema.enum"), itemOptions.map(function (option) {
125
+ return _objectSpread({
126
+ value: uid()
127
+ }, option);
128
+ }));
129
+ recursiveChildren(item.children, "".concat(prefix, "[").concat(index, "].children"));
130
+ });
131
+ };
132
+
133
+ _context.next = 3;
118
134
  return form.submit();
119
135
 
120
- case 2:
136
+ case 3:
121
137
  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()) || [];
122
138
 
123
139
  if (options === null || options === void 0 ? void 0 : options.length) {
@@ -128,18 +144,20 @@ var useCreateCollectionField = function useCreateCollectionField() {
128
144
  }));
129
145
  }
130
146
 
131
- if ((form === null || form === void 0 ? void 0 : (_form$values2 = form.values) === null || _form$values2 === void 0 ? void 0 : _form$values2.interface) === 'linkTo' && title) {
147
+ recursiveChildren(form === null || form === void 0 ? void 0 : (_form$values2 = form.values) === null || _form$values2 === void 0 ? void 0 : _form$values2.children);
148
+
149
+ if ((form === null || form === void 0 ? void 0 : (_form$values3 = form.values) === null || _form$values3 === void 0 ? void 0 : _form$values3.interface) === 'linkTo' && title) {
132
150
  form.setValuesIn('reverseField.uiSchema.title', title);
133
151
  }
134
152
 
135
- _context.next = 7;
153
+ _context.next = 9;
136
154
  return _run();
137
155
 
138
- case 7:
139
- _context.next = 9;
156
+ case 9:
157
+ _context.next = 11;
140
158
  return refreshCM();
141
159
 
142
- case 9:
160
+ case 11:
143
161
  case "end":
144
162
  return _context.stop();
145
163
  }
@@ -94,31 +94,48 @@ var useUpdateCollectionField = function useUpdateCollectionField() {
94
94
  return {
95
95
  run: function run() {
96
96
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
97
- var _form$values, _form$values$uiSchema, _form$values$uiSchema2;
97
+ var _form$values, _form$values$uiSchema, _form$values$uiSchema2, _form$values2;
98
98
 
99
- var options;
99
+ var options, recursiveChildren;
100
100
  return regeneratorRuntime.wrap(function _callee$(_context) {
101
101
  while (1) {
102
102
  switch (_context.prev = _context.next) {
103
103
  case 0:
104
- _context.next = 2;
104
+ recursiveChildren = function _recursiveChildren() {
105
+ var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
106
+ var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
107
+ children.forEach(function (item, index) {
108
+ var _item$uiSchema, _item$uiSchema$enum;
109
+
110
+ 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()) || [];
111
+ form.setValuesIn("".concat(prefix, "[").concat(index, "].uiSchema.enum"), itemOptions.map(function (option) {
112
+ return _objectSpread({
113
+ value: uid()
114
+ }, option);
115
+ }));
116
+ recursiveChildren(item.children, "".concat(prefix, "[").concat(index, "].children"));
117
+ });
118
+ };
119
+
120
+ _context.next = 3;
105
121
  return form.submit();
106
122
 
107
- case 2:
123
+ case 3:
108
124
  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()) || [];
109
125
  form.setValuesIn('uiSchema.enum', options.map(function (option) {
110
126
  return _objectSpread({
111
127
  value: uid()
112
128
  }, option);
113
129
  }));
114
- _context.next = 6;
130
+ recursiveChildren(form === null || form === void 0 ? void 0 : (_form$values2 = form.values) === null || _form$values2 === void 0 ? void 0 : _form$values2.children);
131
+ _context.next = 8;
115
132
  return _run();
116
133
 
117
- case 6:
118
- _context.next = 8;
134
+ case 8:
135
+ _context.next = 10;
119
136
  return refreshCM();
120
137
 
121
- case 8:
138
+ case 10:
122
139
  case "end":
123
140
  return _context.stop();
124
141
  }
@@ -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/es/i18n/i18n.js CHANGED
@@ -7,7 +7,7 @@ var log = require('debug')('i18next');
7
7
 
8
8
  export var i18n = i18next.createInstance();
9
9
  i18n.use(initReactI18next).init({
10
- lng: localStorage.getItem('NOCOBASE_LANG') || 'en-US',
10
+ lng: localStorage.getItem('NOCOBASE_LOCALE') || 'en-US',
11
11
  // debug: true,
12
12
  defaultNS: 'client',
13
13
  // parseMissingKeyHandler: (key) => {
@@ -28,8 +28,8 @@ function setMomentLng(language) {
28
28
  moment.locale(lng);
29
29
  }
30
30
 
31
- setMomentLng(localStorage.getItem('NOCOBASE_LANG'));
31
+ setMomentLng(localStorage.getItem('NOCOBASE_LOCALE'));
32
32
  i18n.on('languageChanged', function (lng) {
33
- localStorage.setItem('NOCOBASE_LANG', lng);
33
+ localStorage.setItem('NOCOBASE_LOCALE', lng);
34
34
  setMomentLng(lng);
35
35
  });
@@ -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;
@@ -278,5 +278,15 @@ export default {
278
278
  'After successful save': 'After successful save',
279
279
  'Button background color': 'Button background color',
280
280
  'Highlight': 'Highlight',
281
- 'Danger red': 'Danger red'
281
+ 'Danger red': 'Danger red',
282
+ 'Custom request': 'Custom request',
283
+ 'Request settings': 'Request settings',
284
+ 'Request URL': 'Request URL',
285
+ 'Request method': 'Request method',
286
+ 'Request query parameters': 'Request query parameters(JSON)',
287
+ 'Request headers': 'Request headers(JSON)',
288
+ 'Request body': 'Request body(JSON)',
289
+ 'Request success': 'Request success',
290
+ 'Invalid JSON format': 'Invalid JSON format',
291
+ 'After successful request': 'After successful request'
282
292
  };
@@ -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;
@@ -399,6 +399,30 @@ export default {
399
399
  'Changed fields': '发生变动的字段',
400
400
  '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.': '只有被选中的某个字段发生变动时才会触发。如果不选择,则表示任何字段变动时都会触发。新增或删除数据时,任意字段都被认为发生变动。',
401
401
  'Only triggers when match conditions': '满足以下条件才触发',
402
+ 'Schedule event': '定时任务',
403
+ 'Trigger mode': '触发模式',
404
+ 'Based on certain date': '自定义时间',
405
+ 'Based on date field of collection': '根据数据表时间字段',
406
+ 'Starts on': '开始于',
407
+ 'Ends on': '结束于',
408
+ 'Exactly at': '当时',
409
+ 'Repeat mode': '重复模式',
410
+ 'Repeat limit': '重复次数',
411
+ 'No limit': '不限',
412
+ 'Seconds': '秒',
413
+ 'Minutes': '分钟',
414
+ 'Hours': '小时',
415
+ 'Days': '天',
416
+ 'Months': '月',
417
+ 'No repeat': '不重复',
418
+ 'Every': '每',
419
+ 'By minute': '按分钟',
420
+ 'By hour': '按小时',
421
+ 'By date': '按日(月)',
422
+ 'By month': '按月',
423
+ 'By day of week': '按天(周)',
424
+ 'By field': '数据表字段',
425
+ 'By custom date': '自定义时间',
402
426
  'End': '结束',
403
427
  'Trigger context': '触发数据',
404
428
  'Node result': '节点数据',
@@ -462,5 +486,15 @@ export default {
462
486
  'After clicking the custom button, the following fields of the current record will be saved according to the following form.': '点击当前自定义按钮时,当前数据以下字段将按照以下表单保存。',
463
487
  'Button background color': '按钮颜色',
464
488
  'Highlight': '高亮',
465
- 'Danger red': '红色'
489
+ 'Danger red': '红色',
490
+ 'Custom request': '自定义请求',
491
+ 'Request settings': '请求设置',
492
+ 'Request URL': '请求地址',
493
+ 'Request method': '请求方法',
494
+ 'Request query parameters': '请求查询参数(JSON格式)',
495
+ 'Request headers': '请求头参数(JSON格式)',
496
+ 'Request body': '请求体(JSON格式)',
497
+ 'Request success': '请求成功',
498
+ 'Invalid JSON format': '非法JSON格式',
499
+ 'After successful request': '请求成功之后'
466
500
  };
@@ -30,6 +30,7 @@ import React, { useEffect, useState } from 'react';
30
30
  import { useTranslation } from 'react-i18next';
31
31
  import { useActionContext, useCompile, useDesignable } from '../..';
32
32
  import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings';
33
+ import { requestSettingsSchema } from './utils';
33
34
 
34
35
  var MenuGroup = function MenuGroup(props) {
35
36
  var fieldSchema = useFieldSchema();
@@ -41,10 +42,12 @@ var MenuGroup = function MenuGroup(props) {
41
42
  var actionTitles = {
42
43
  'customize:popup': t('Popup'),
43
44
  'customize:update': t('Update record'),
44
- 'customize:save': t('Save record')
45
+ 'customize:save': t('Save record'),
46
+ 'customize:table:request': t('Custom request'),
47
+ 'customize:form:request': t('Custom request')
45
48
  };
46
49
 
47
- if (!['customize:popup', 'customize:update', 'customize:save'].includes(actionType)) {
50
+ if (!['customize:popup', 'customize:update', 'customize:save', 'customize:table:request', 'customize:form:request'].includes(actionType)) {
48
51
  return /*#__PURE__*/React.createElement(React.Fragment, null, props.children);
49
52
  }
50
53
 
@@ -54,7 +57,7 @@ var MenuGroup = function MenuGroup(props) {
54
57
  };
55
58
 
56
59
  export var ActionDesigner = function ActionDesigner(props) {
57
- var _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xAction, _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5, _fieldSchema$xAction6, _fieldSchema$xAction7;
60
+ 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;
58
61
 
59
62
  var modalTip = props.modalTip,
60
63
  restProps = _objectWithoutProperties(props, _excluded);
@@ -193,28 +196,45 @@ export var ActionDesigner = function ActionDesigner(props) {
193
196
  });
194
197
  dn.refresh();
195
198
  }
196
- }), 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__*/React.createElement(SchemaSettings.SwitchItem, {
199
+ }), 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__*/React.createElement(SchemaSettings.ActionModalItem, {
200
+ title: t('Request settings'),
201
+ schema: requestSettingsSchema,
202
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction5 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction5 === void 0 ? void 0 : _fieldSchema$xAction5.requestSettings,
203
+ onSubmit: function onSubmit(requestSettings) {
204
+ var _schema3;
205
+
206
+ fieldSchema['x-action-settings']['requestSettings'] = requestSettings;
207
+ dn.emit('patch', {
208
+ schema: (_schema3 = {}, _defineProperty(_schema3, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema3, 'x-action-settings', fieldSchema['x-action-settings']), _schema3)
209
+ });
210
+ dn.refresh();
211
+ }
212
+ }), 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__*/React.createElement(SchemaSettings.SwitchItem, {
197
213
  title: t('Skip required validation'),
198
- checked: !!(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction5 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction5 === void 0 ? void 0 : _fieldSchema$xAction5.skipValidator),
214
+ checked: !!(fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction7 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction7 === void 0 ? void 0 : _fieldSchema$xAction7.skipValidator),
199
215
  onChange: function onChange(value) {
200
- var _schema3;
216
+ var _schema4;
201
217
 
202
218
  fieldSchema['x-action-settings'].skipValidator = value;
203
219
  dn.emit('patch', {
204
- schema: (_schema3 = {}, _defineProperty(_schema3, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema3, 'x-action-settings', _objectSpread({}, fieldSchema['x-action-settings'])), _schema3)
220
+ schema: (_schema4 = {}, _defineProperty(_schema4, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema4, 'x-action-settings', _objectSpread({}, fieldSchema['x-action-settings'])), _schema4)
205
221
  });
206
222
  }
207
- }), 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__*/React.createElement(SchemaSettings.ModalItem, {
223
+ }), 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__*/React.createElement(SchemaSettings.ModalItem, {
208
224
  title: {
209
225
  'customize:save': t('After successful save'),
210
- 'customize:update': t('After successful update')
226
+ 'customize:update': t('After successful update'),
227
+ 'customize:table:request': t('After successful request'),
228
+ 'customize:form:request': t('After successful request')
211
229
  }[actionType],
212
- initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction7 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction7 === void 0 ? void 0 : _fieldSchema$xAction7['onSuccess'],
230
+ initialValues: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xAction9 = fieldSchema['x-action-settings']) === null || _fieldSchema$xAction9 === void 0 ? void 0 : _fieldSchema$xAction9['onSuccess'],
213
231
  schema: {
214
232
  type: 'object',
215
233
  title: {
216
234
  'customize:save': t('After successful save'),
217
- 'customize:update': t('After successful update')
235
+ 'customize:update': t('After successful update'),
236
+ 'customize:table:request': t('After successful request'),
237
+ 'customize:form:request': t('After successful request')
218
238
  }[actionType],
219
239
  properties: {
220
240
  successMessage: {
@@ -268,11 +288,11 @@ export var ActionDesigner = function ActionDesigner(props) {
268
288
  }
269
289
  },
270
290
  onSubmit: function onSubmit(onSuccess) {
271
- var _schema4;
291
+ var _schema5;
272
292
 
273
293
  fieldSchema['x-action-settings']['onSuccess'] = onSuccess;
274
294
  dn.emit('patch', {
275
- schema: (_schema4 = {}, _defineProperty(_schema4, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema4, 'x-action-settings', fieldSchema['x-action-settings']), _schema4)
295
+ schema: (_schema5 = {}, _defineProperty(_schema5, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema5, 'x-action-settings', fieldSchema['x-action-settings']), _schema5)
276
296
  });
277
297
  }
278
298
  }), /*#__PURE__*/React.createElement(SchemaSettings.Divider, null), /*#__PURE__*/React.createElement(SchemaSettings.Remove, {
@@ -0,0 +1,2 @@
1
+ import type { ISchema } from '@formily/react';
2
+ export declare const requestSettingsSchema: ISchema;
@@ -0,0 +1,60 @@
1
+ var validateJSON = {
2
+ 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 }}}",
3
+ message: '{{t("Invalid JSON format")}}'
4
+ };
5
+ export var requestSettingsSchema = {
6
+ type: 'object',
7
+ properties: {
8
+ url: {
9
+ type: 'string',
10
+ title: '{{t("Request URL")}}',
11
+ required: true,
12
+ 'x-decorator': 'FormItem',
13
+ 'x-component': 'Input'
14
+ },
15
+ method: {
16
+ type: 'string',
17
+ title: '{{t("Request method")}}',
18
+ 'x-decorator': 'FormItem',
19
+ 'x-component': 'Select',
20
+ default: 'POST',
21
+ enum: [{
22
+ label: 'POST',
23
+ value: 'POST'
24
+ }, {
25
+ label: 'GET',
26
+ value: 'GET'
27
+ }, {
28
+ label: 'PUT',
29
+ value: 'PUT'
30
+ }, {
31
+ label: 'PATCH',
32
+ value: 'PATCH'
33
+ }, {
34
+ label: 'DELETE',
35
+ value: 'DELETE'
36
+ }]
37
+ },
38
+ headers: {
39
+ type: 'string',
40
+ title: '{{t("Request headers")}}',
41
+ 'x-decorator': 'FormItem',
42
+ 'x-component': 'Input.TextArea',
43
+ 'x-validator': validateJSON
44
+ },
45
+ params: {
46
+ type: 'string',
47
+ title: '{{t("Request query parameters")}}',
48
+ 'x-decorator': 'FormItem',
49
+ 'x-component': 'Input.TextArea',
50
+ 'x-validator': validateJSON
51
+ },
52
+ data: {
53
+ type: 'string',
54
+ title: '{{t("Request body")}}',
55
+ 'x-decorator': 'FormItem',
56
+ 'x-component': 'Input.TextArea',
57
+ 'x-validator': validateJSON
58
+ }
59
+ }
60
+ };
@@ -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;
@@ -4,7 +4,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
- import { formatMomentValue, momentable } from '@formily/antd/lib/__builtins__';
7
+ import { formatMomentValue } from '@formily/antd/lib/__builtins__';
8
+ import moment from 'moment';
8
9
  export var getDefaultFormat = function getDefaultFormat(props) {
9
10
  if (props.format) {
10
11
  return props.format;
@@ -36,7 +37,8 @@ export var mapDateFormat = function mapDateFormat() {
36
37
  var _onChange = props.onChange;
37
38
  return _objectSpread(_objectSpread({}, props), {}, {
38
39
  format: format,
39
- value: momentable(props.value, format === 'YYYY-wo' ? 'YYYY-w' : format),
40
+ value: props.value && moment(props.value).isValid() ? moment(props.value) : undefined,
41
+ // value: momentable(props.value, format === 'YYYY-wo' ? 'YYYY-w' : format),
40
42
  onChange: function onChange(value) {
41
43
  if (_onChange) {
42
44
  _onChange(formatMomentValue(value, format));