@nocobase/client 0.7.3-alpha.1 → 0.7.4-alpha.7

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 (137) hide show
  1. package/es/application/Application.d.ts +1 -0
  2. package/es/application/Application.js +7 -1
  3. package/es/block-provider/FormBlockProvider.js +7 -0
  4. package/es/block-provider/TableFieldProvider.d.ts +1 -0
  5. package/es/block-provider/TableFieldProvider.js +5 -2
  6. package/es/block-provider/TableSelectorProvider.js +1 -1
  7. package/es/block-provider/hooks/index.js +14 -2
  8. package/es/collection-manager/CollectionField.js +9 -4
  9. package/es/collection-manager/Configuration/AddFieldAction.js +6 -0
  10. package/es/collection-manager/Configuration/EditFieldAction.js +7 -0
  11. package/es/collection-manager/Configuration/index.js +5 -1
  12. package/es/collection-manager/Configuration/schemas/collections.js +3 -2
  13. package/es/collection-manager/action-hooks.d.ts +3 -0
  14. package/es/collection-manager/action-hooks.js +91 -36
  15. package/es/collection-manager/interfaces/checkbox.js +1 -0
  16. package/es/collection-manager/interfaces/checkboxGroup.js +1 -0
  17. package/es/collection-manager/interfaces/datetime.js +1 -0
  18. package/es/collection-manager/interfaces/email.js +1 -0
  19. package/es/collection-manager/interfaces/icon.js +1 -0
  20. package/es/collection-manager/interfaces/input.js +1 -0
  21. package/es/collection-manager/interfaces/integer.js +1 -0
  22. package/es/collection-manager/interfaces/m2m.js +2 -0
  23. package/es/collection-manager/interfaces/m2o.js +1 -0
  24. package/es/collection-manager/interfaces/markdown.js +1 -0
  25. package/es/collection-manager/interfaces/multipleSelect.js +1 -0
  26. package/es/collection-manager/interfaces/number.js +1 -0
  27. package/es/collection-manager/interfaces/o2m.js +1 -0
  28. package/es/collection-manager/interfaces/o2o.js +3 -0
  29. package/es/collection-manager/interfaces/password.js +3 -1
  30. package/es/collection-manager/interfaces/percent.js +1 -0
  31. package/es/collection-manager/interfaces/phone.js +1 -0
  32. package/es/collection-manager/interfaces/properties/index.d.ts +1 -0
  33. package/es/collection-manager/interfaces/properties/index.js +1 -0
  34. package/es/collection-manager/interfaces/properties/operators.js +4 -4
  35. package/es/collection-manager/interfaces/radioGroup.js +1 -0
  36. package/es/collection-manager/interfaces/richText.js +1 -0
  37. package/es/collection-manager/interfaces/select.js +1 -0
  38. package/es/collection-manager/interfaces/textarea.js +1 -0
  39. package/es/collection-manager/interfaces/time.js +1 -0
  40. package/es/locale/en_US.d.ts +3 -2
  41. package/es/locale/en_US.js +4 -3
  42. package/es/locale/zh_CN.d.ts +5 -2
  43. package/es/locale/zh_CN.js +5 -2
  44. package/es/plugin-manager/PluginManager.d.ts +1 -0
  45. package/es/plugin-manager/PluginManager.js +12 -2
  46. package/es/schema-component/antd/calendar/Calendar.Designer.js +16 -10
  47. package/es/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
  48. package/es/schema-component/antd/date-picker/DatePicker.js +1 -1
  49. package/es/schema-component/antd/date-picker/ReadPretty.js +1 -1
  50. package/es/schema-component/antd/date-picker/util.d.ts +0 -10
  51. package/es/schema-component/antd/date-picker/util.js +1 -79
  52. package/es/schema-component/antd/form-item/FormItem.js +39 -9
  53. package/es/schema-component/antd/input-number/InputNumber.js +1 -1
  54. package/es/schema-component/antd/input-number/ReadPretty.js +2 -4
  55. package/es/schema-component/antd/record-picker/InputRecordPicker.js +1 -1
  56. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +1 -1
  57. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
  58. package/es/schema-component/antd/table-v2/Table.d.ts +0 -11
  59. package/es/schema-component/antd/table-v2/Table.js +162 -88
  60. package/es/schema-component/antd/table-v2/TableField.js +3 -0
  61. package/es/schema-component/antd/tabs/Tabs.Designer.js +23 -12
  62. package/es/schema-component/antd/tabs/Tabs.js +7 -1
  63. package/es/schema-component/core/DesignableSwitch.js +7 -1
  64. package/es/schema-initializer/buttons/TabPaneInitializers.js +11 -3
  65. package/es/schema-initializer/components/assigned-field/AssignedField.js +6 -4
  66. package/es/schema-initializer/items/index.js +2 -1
  67. package/es/schema-initializer/utils.js +16 -0
  68. package/es/schema-settings/SchemaSettings.js +7 -0
  69. package/lib/application/Application.d.ts +1 -0
  70. package/lib/application/Application.js +11 -2
  71. package/lib/block-provider/FormBlockProvider.js +8 -0
  72. package/lib/block-provider/TableFieldProvider.d.ts +1 -0
  73. package/lib/block-provider/TableFieldProvider.js +4 -1
  74. package/lib/block-provider/TableSelectorProvider.js +1 -1
  75. package/lib/block-provider/hooks/index.js +14 -2
  76. package/lib/collection-manager/CollectionField.js +9 -4
  77. package/lib/collection-manager/Configuration/AddFieldAction.js +6 -0
  78. package/lib/collection-manager/Configuration/EditFieldAction.js +7 -0
  79. package/lib/collection-manager/Configuration/index.js +5 -0
  80. package/lib/collection-manager/Configuration/schemas/collections.js +3 -2
  81. package/lib/collection-manager/action-hooks.d.ts +3 -0
  82. package/lib/collection-manager/action-hooks.js +98 -37
  83. package/lib/collection-manager/interfaces/checkbox.js +1 -0
  84. package/lib/collection-manager/interfaces/checkboxGroup.js +1 -0
  85. package/lib/collection-manager/interfaces/datetime.js +1 -0
  86. package/lib/collection-manager/interfaces/email.js +1 -0
  87. package/lib/collection-manager/interfaces/icon.js +1 -0
  88. package/lib/collection-manager/interfaces/input.js +1 -0
  89. package/lib/collection-manager/interfaces/integer.js +1 -0
  90. package/lib/collection-manager/interfaces/m2m.js +2 -0
  91. package/lib/collection-manager/interfaces/m2o.js +1 -0
  92. package/lib/collection-manager/interfaces/markdown.js +1 -0
  93. package/lib/collection-manager/interfaces/multipleSelect.js +1 -0
  94. package/lib/collection-manager/interfaces/number.js +1 -0
  95. package/lib/collection-manager/interfaces/o2m.js +1 -0
  96. package/lib/collection-manager/interfaces/o2o.js +3 -0
  97. package/lib/collection-manager/interfaces/password.js +4 -2
  98. package/lib/collection-manager/interfaces/percent.js +1 -0
  99. package/lib/collection-manager/interfaces/phone.js +1 -0
  100. package/lib/collection-manager/interfaces/properties/index.d.ts +1 -0
  101. package/lib/collection-manager/interfaces/properties/index.js +1 -0
  102. package/lib/collection-manager/interfaces/properties/operators.js +4 -4
  103. package/lib/collection-manager/interfaces/radioGroup.js +1 -0
  104. package/lib/collection-manager/interfaces/richText.js +1 -0
  105. package/lib/collection-manager/interfaces/select.js +1 -0
  106. package/lib/collection-manager/interfaces/textarea.js +1 -0
  107. package/lib/collection-manager/interfaces/time.js +1 -0
  108. package/lib/locale/en_US.d.ts +3 -2
  109. package/lib/locale/en_US.js +4 -3
  110. package/lib/locale/zh_CN.d.ts +5 -2
  111. package/lib/locale/zh_CN.js +5 -2
  112. package/lib/plugin-manager/PluginManager.d.ts +1 -0
  113. package/lib/plugin-manager/PluginManager.js +15 -2
  114. package/lib/schema-component/antd/calendar/Calendar.Designer.js +16 -10
  115. package/lib/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
  116. package/lib/schema-component/antd/date-picker/DatePicker.js +2 -2
  117. package/lib/schema-component/antd/date-picker/ReadPretty.js +6 -6
  118. package/lib/schema-component/antd/date-picker/util.d.ts +0 -10
  119. package/lib/schema-component/antd/date-picker/util.js +6 -89
  120. package/lib/schema-component/antd/form-item/FormItem.js +42 -18
  121. package/lib/schema-component/antd/input-number/InputNumber.js +6 -6
  122. package/lib/schema-component/antd/input-number/ReadPretty.js +2 -5
  123. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +2 -2
  124. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +1 -1
  125. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
  126. package/lib/schema-component/antd/table-v2/Table.d.ts +0 -11
  127. package/lib/schema-component/antd/table-v2/Table.js +171 -90
  128. package/lib/schema-component/antd/table-v2/TableField.js +3 -0
  129. package/lib/schema-component/antd/tabs/Tabs.Designer.js +23 -12
  130. package/lib/schema-component/antd/tabs/Tabs.js +8 -1
  131. package/lib/schema-component/core/DesignableSwitch.js +8 -1
  132. package/lib/schema-initializer/buttons/TabPaneInitializers.js +11 -3
  133. package/lib/schema-initializer/components/assigned-field/AssignedField.js +7 -4
  134. package/lib/schema-initializer/items/index.js +2 -1
  135. package/lib/schema-initializer/utils.js +16 -0
  136. package/lib/schema-settings/SchemaSettings.js +7 -0
  137. package/package.json +5 -4
@@ -218,6 +218,7 @@ var o2o = {
218
218
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
219
219
  'x-decorator': 'FormItem',
220
220
  'x-component': 'Input',
221
+ 'x-validator': 'uid',
221
222
  'x-disabled': '{{ !createOnly }}'
222
223
  }
223
224
  }
@@ -389,6 +390,7 @@ var oho = {
389
390
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
390
391
  'x-decorator': 'FormItem',
391
392
  'x-component': 'Input',
393
+ 'x-validator': 'uid',
392
394
  'x-disabled': '{{ !createOnly }}'
393
395
  }
394
396
  }
@@ -547,6 +549,7 @@ var obo = {
547
549
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
548
550
  'x-decorator': 'FormItem',
549
551
  'x-component': 'Input',
552
+ 'x-validator': 'uid',
550
553
  'x-disabled': '{{ !createOnly }}'
551
554
  }
552
555
  }
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.password = void 0;
7
7
 
8
- var _properties = require("./properties");
9
-
10
8
  var _i18n = require("../../i18n");
11
9
 
10
+ var _properties = require("./properties");
11
+
12
12
  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; }
13
13
 
14
14
  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; }
@@ -23,6 +23,7 @@ var password = {
23
23
  title: '{{t("Password")}}',
24
24
  default: {
25
25
  type: 'password',
26
+ hidden: true,
26
27
  // name,
27
28
  uiSchema: {
28
29
  type: 'string',
@@ -30,6 +31,7 @@ var password = {
30
31
  'x-component': 'Password'
31
32
  }
32
33
  },
34
+ hasDefaultValue: true,
33
35
  properties: _objectSpread({}, _properties.defaultProps),
34
36
  validateSchema: function validateSchema(fieldSchema) {
35
37
  return {
@@ -79,6 +79,7 @@ var percent = {
79
79
  }
80
80
  }
81
81
  },
82
+ hasDefaultValue: true,
82
83
  properties: _objectSpread(_objectSpread({}, _properties.defaultProps), {}, {
83
84
  'uiSchema.x-component-props.step': {
84
85
  type: 'string',
@@ -33,6 +33,7 @@ var phone = {
33
33
 
34
34
  }
35
35
  },
36
+ hasDefaultValue: true,
36
37
  properties: _objectSpread({}, _properties.defaultProps),
37
38
  filterable: {
38
39
  operators: _properties.operators.string
@@ -21,6 +21,7 @@ export declare const defaultProps: {
21
21
  'x-disabled': string;
22
22
  'x-decorator': string;
23
23
  'x-component': string;
24
+ 'x-validator': string;
24
25
  description: string;
25
26
  };
26
27
  type: import("@formily/react").Stringify<{
@@ -267,6 +267,7 @@ var defaultProps = {
267
267
  'x-disabled': '{{ !createOnly }}',
268
268
  'x-decorator': 'FormItem',
269
269
  'x-component': 'Input',
270
+ 'x-validator': 'uid',
270
271
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
271
272
  },
272
273
  type: type
@@ -95,11 +95,11 @@ var datetime = [{
95
95
  value: '$dateNotAfter'
96
96
  }, {
97
97
  label: "{{ t('is empty') }}",
98
- value: '$null',
98
+ value: '$empty',
99
99
  noValue: true
100
100
  }, {
101
101
  label: "{{ t('is not empty') }}",
102
- value: '$notNull',
102
+ value: '$notEmpty',
103
103
  noValue: true
104
104
  }];
105
105
  exports.datetime = datetime;
@@ -213,11 +213,11 @@ var time = [{
213
213
  value: '$neq'
214
214
  }, {
215
215
  label: '{{t("is empty")}}',
216
- value: '$null',
216
+ value: '$empty',
217
217
  noValue: true
218
218
  }, {
219
219
  label: '{{t("is not empty")}}',
220
- value: '$notNull',
220
+ value: '$notEmpty',
221
221
  noValue: true
222
222
  }];
223
223
  exports.time = time;
@@ -29,6 +29,7 @@ var radioGroup = {
29
29
  'x-component': 'Radio.Group'
30
30
  }
31
31
  },
32
+ hasDefaultValue: true,
32
33
  properties: _objectSpread(_objectSpread({}, _properties.defaultProps), {}, {
33
34
  'uiSchema.enum': _properties.dataSource
34
35
  }),
@@ -30,6 +30,7 @@ var richText = {
30
30
  'x-component': 'RichText'
31
31
  }
32
32
  },
33
+ hasDefaultValue: true,
33
34
  properties: _objectSpread({}, _properties.defaultProps),
34
35
  schemaInitialize: function schemaInitialize(schema, _ref) {
35
36
  var block = _ref.block;
@@ -30,6 +30,7 @@ var select = {
30
30
  enum: []
31
31
  }
32
32
  },
33
+ hasDefaultValue: true,
33
34
  properties: _objectSpread(_objectSpread({}, _properties.defaultProps), {}, {
34
35
  'uiSchema.enum': _properties.dataSource
35
36
  }),
@@ -30,6 +30,7 @@ var textarea = {
30
30
  'x-component': 'Input.TextArea'
31
31
  }
32
32
  },
33
+ hasDefaultValue: true,
33
34
  properties: _objectSpread({}, _properties.defaultProps),
34
35
  schemaInitialize: function schemaInitialize(schema, _ref) {
35
36
  var block = _ref.block;
@@ -28,6 +28,7 @@ var time = {
28
28
  'x-component': 'TimePicker'
29
29
  }
30
30
  },
31
+ hasDefaultValue: true,
31
32
  properties: _objectSpread(_objectSpread({}, _properties.defaultProps), {}, {
32
33
  'uiSchema.x-component-props.format': {
33
34
  type: 'string',
@@ -54,7 +54,7 @@ declare const _default: {
54
54
  "Select data source": string;
55
55
  Calendar: string;
56
56
  Kanban: string;
57
- "Select group field": string;
57
+ "Select grouping field": string;
58
58
  Media: string;
59
59
  Markdown: string;
60
60
  Wysiwyg: string;
@@ -373,7 +373,7 @@ declare const _default: {
373
373
  "Reference template": string;
374
374
  "Create calendar block": string;
375
375
  "Create kanban block": string;
376
- "Group field": string;
376
+ "Grouping field": string;
377
377
  "Tab name": string;
378
378
  "Current record blocks": string;
379
379
  "Popup message": string;
@@ -554,5 +554,6 @@ declare const _default: {
554
554
  "Enabled languages": string;
555
555
  "View all plugins": string;
556
556
  Print: string;
557
+ 'Single select and radio fields can be used as the grouping field': string;
557
558
  };
558
559
  export default _default;
@@ -60,7 +60,7 @@ var _default = {
60
60
  "Select data source": "Select data source",
61
61
  "Calendar": "Calendar",
62
62
  "Kanban": "Kanban",
63
- "Select group field": "Select group field",
63
+ "Select grouping field": "Select grouping field",
64
64
  "Media": "Media",
65
65
  "Markdown": "Markdown",
66
66
  "Wysiwyg": "Wysiwyg",
@@ -379,7 +379,7 @@ var _default = {
379
379
  "Reference template": "Reference template",
380
380
  "Create calendar block": "Create calendar block",
381
381
  "Create kanban block": "Create kanban block",
382
- "Group field": "Group field",
382
+ "Grouping field": "Grouping field",
383
383
  "Tab name": "Tab name",
384
384
  "Current record blocks": "Current record blocks",
385
385
  "Popup message": "Popup message",
@@ -559,6 +559,7 @@ var _default = {
559
559
  "Regular expression": "Pattern",
560
560
  "Enabled languages": "Enabled languages",
561
561
  "View all plugins": "View all plugins",
562
- "Print": "Print"
562
+ "Print": "Print",
563
+ 'Single select and radio fields can be used as the grouping field': 'Single select and radio fields can be used as the grouping field'
563
564
  };
564
565
  exports.default = _default;
@@ -54,7 +54,7 @@ declare const _default: {
54
54
  "Select data source": string;
55
55
  Calendar: string;
56
56
  Kanban: string;
57
- "Select group field": string;
57
+ "Select grouping field": string;
58
58
  Media: string;
59
59
  Markdown: string;
60
60
  Wysiwyg: string;
@@ -251,6 +251,8 @@ declare const _default: {
251
251
  "The field value cannot be greater than ": string;
252
252
  "The field value cannot be less than ": string;
253
253
  "The field value is not an integer number": string;
254
+ "Set default value": string;
255
+ "Default value": string;
254
256
  "is before": string;
255
257
  "is after": string;
256
258
  "is on or after": string;
@@ -408,7 +410,8 @@ declare const _default: {
408
410
  'Reference template': string;
409
411
  'Create calendar block': string;
410
412
  'Create kanban block': string;
411
- 'Group field': string;
413
+ 'Grouping field': string;
414
+ 'Single select and radio fields can be used as the grouping field': string;
412
415
  'Tab name': string;
413
416
  'Current record blocks': string;
414
417
  'Popup message': string;
@@ -60,7 +60,7 @@ var _default = {
60
60
  "Select data source": "选择数据源",
61
61
  "Calendar": "日历",
62
62
  "Kanban": "看板",
63
- "Select group field": "选择分组字段",
63
+ "Select grouping field": "选择分组字段",
64
64
  "Media": "多媒体",
65
65
  "Markdown": "Markdown",
66
66
  "Wysiwyg": "富文本",
@@ -257,6 +257,8 @@ var _default = {
257
257
  "The field value cannot be greater than ": "数值不能大于",
258
258
  "The field value cannot be less than ": "数值不能小于",
259
259
  "The field value is not an integer number": "数字不是整数",
260
+ "Set default value": "设置默认值",
261
+ "Default value": "默认值",
260
262
  "is before": "早于",
261
263
  "is after": "晚于",
262
264
  "is on or after": "不早于",
@@ -414,7 +416,8 @@ var _default = {
414
416
  'Reference template': '引用模板',
415
417
  'Create calendar block': '创建日历区块',
416
418
  'Create kanban block': '创建看板区块',
417
- 'Group field': '分组字段',
419
+ 'Grouping field': '分组字段',
420
+ 'Single select and radio fields can be used as the grouping field': '数据表的单选字段可以作为分组字段',
418
421
  'Tab name': '标签名称',
419
422
  'Current record blocks': '当前数据区块',
420
423
  'Popup message': '弹窗提示消息',
@@ -7,6 +7,7 @@ declare type PluginManagerType = {
7
7
  Toolbar?: React.FC<ToolbarProps> & {
8
8
  Item?: React.FC<MenuItemProps & {
9
9
  selected?: boolean;
10
+ subtitle?: string;
10
11
  }>;
11
12
  };
12
13
  };
@@ -9,6 +9,8 @@ exports.usePrefixCls = exports.RemotePluginManagerToolbar = exports.PluginManage
9
9
 
10
10
  var _icons = require("@ant-design/icons");
11
11
 
12
+ var _css = require("@emotion/css");
13
+
12
14
  var _antd = require("antd");
13
15
 
14
16
  var _classnames = _interopRequireDefault(require("classnames"));
@@ -23,7 +25,9 @@ var _apiClient = require("../api-client");
23
25
 
24
26
  var _context = require("./context");
25
27
 
26
- var _excluded = ["selected", "icon", "title"];
28
+ var _templateObject;
29
+
30
+ var _excluded = ["selected", "icon", "title", "subtitle"];
27
31
 
28
32
  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); }
29
33
 
@@ -35,6 +39,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
35
39
 
36
40
  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; }
37
41
 
42
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
43
+
38
44
  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; }
39
45
 
40
46
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -154,14 +160,21 @@ PluginManager.Toolbar.Item = function (props) {
154
160
  var selected = props.selected,
155
161
  icon = props.icon,
156
162
  title = props.title,
163
+ subtitle = props.subtitle,
157
164
  others = _objectWithoutProperties(props, _excluded);
158
165
 
159
166
  var prefix = usePrefixCls();
160
167
  var className = (0, _classnames.default)(_defineProperty({}, "".concat(prefix, "-menu-item-selected"), selected));
161
168
 
162
169
  if (item.pin) {
170
+ var subtitleComponent = subtitle && /*#__PURE__*/_react.default.createElement("div", {
171
+ className: (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 12px;\n color: #999;\n "])))
172
+ }, subtitle);
173
+
174
+ var titleComponent = /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", null, title), subtitleComponent);
175
+
163
176
  return /*#__PURE__*/_react.default.createElement(_antd.Tooltip, {
164
- title: title
177
+ title: titleComponent
165
178
  }, /*#__PURE__*/_react.default.createElement(_antd.Menu.Item, _objectSpread(_objectSpread({}, others), {}, {
166
179
  className: className,
167
180
  eventKey: item.component
@@ -32,12 +32,17 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
32
32
  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; }
33
33
 
34
34
  var useOptions = function useOptions() {
35
+ var _fields$filter;
36
+
37
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'string';
35
38
  var compile = (0, _.useCompile)();
36
39
 
37
40
  var _useCollection = (0, _collectionManager.useCollection)(),
38
41
  fields = _useCollection.fields;
39
42
 
40
- var options = fields === null || fields === void 0 ? void 0 : fields.map(function (field) {
43
+ var options = fields === null || fields === void 0 ? void 0 : (_fields$filter = fields.filter(function (field) {
44
+ return field.type === type;
45
+ })) === null || _fields$filter === void 0 ? void 0 : _fields$filter.map(function (field) {
41
46
  var _field$uiSchema;
42
47
 
43
48
  return {
@@ -74,7 +79,6 @@ var CalendarDesigner = function CalendarDesigner() {
74
79
 
75
80
  var template = (0, _schemaTemplates.useSchemaTemplate)();
76
81
  var defaultFilter = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora === void 0 ? void 0 : (_fieldSchema$xDecora$ = _fieldSchema$xDecora.params) === null || _fieldSchema$xDecora$ === void 0 ? void 0 : _fieldSchema$xDecora$.filter) || {};
77
- var options = useOptions();
78
82
  var fieldNames = (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora2 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora2 === void 0 ? void 0 : _fieldSchema$xDecora2['fieldNames']) || {};
79
83
  var defaultResource = fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xDecora3 = fieldSchema['x-decorator-props']) === null || _fieldSchema$xDecora3 === void 0 ? void 0 : _fieldSchema$xDecora3.resource;
80
84
  return /*#__PURE__*/_react2.default.createElement(_schemaSettings.GeneralSchemaDesigner, {
@@ -83,14 +87,16 @@ var CalendarDesigner = function CalendarDesigner() {
83
87
  }, /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.BlockTitleItem, null), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
84
88
  title: t('Title field'),
85
89
  value: fieldNames.title,
86
- options: options,
90
+ options: useOptions('string'),
87
91
  onChange: function onChange(title) {
88
92
  var _schema;
89
93
 
90
94
  var fieldNames = field.decoratorProps.fieldNames || {};
91
95
  fieldNames['title'] = title;
92
96
  field.decoratorProps.params = fieldNames;
93
- fieldSchema['x-decorator-props']['params'] = fieldNames;
97
+ fieldSchema['x-decorator-props']['params'] = fieldNames; // Select切换option后value未按照预期切换,固增加以下代码
98
+
99
+ fieldSchema['x-decorator-props']['fieldNames'] = fieldNames;
94
100
  service.refresh();
95
101
  dn.emit('patch', {
96
102
  schema: (_schema = {}, _defineProperty(_schema, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema, 'x-decorator-props', field.decoratorProps), _schema)
@@ -100,14 +106,14 @@ var CalendarDesigner = function CalendarDesigner() {
100
106
  }), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
101
107
  title: t('Start date field'),
102
108
  value: fieldNames.start,
103
- options: options,
109
+ options: useOptions('date'),
104
110
  onChange: function onChange(start) {
105
111
  var _schema2;
106
112
 
107
113
  var fieldNames = field.decoratorProps.fieldNames || {};
108
114
  fieldNames['start'] = start;
109
- field.decoratorProps.params = fieldNames;
110
- fieldSchema['x-decorator-props']['params'] = fieldNames;
115
+ field.decoratorProps.fieldNames = fieldNames;
116
+ fieldSchema['x-decorator-props']['fieldNames'] = fieldNames;
111
117
  service.refresh();
112
118
  dn.emit('patch', {
113
119
  schema: (_schema2 = {}, _defineProperty(_schema2, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema2, 'x-decorator-props', field.decoratorProps), _schema2)
@@ -117,14 +123,14 @@ var CalendarDesigner = function CalendarDesigner() {
117
123
  }), /*#__PURE__*/_react2.default.createElement(_schemaSettings.SchemaSettings.SelectItem, {
118
124
  title: t('End date field'),
119
125
  value: fieldNames.end,
120
- options: options,
126
+ options: useOptions('date'),
121
127
  onChange: function onChange(end) {
122
128
  var _schema3;
123
129
 
124
130
  var fieldNames = field.decoratorProps.fieldNames || {};
125
131
  fieldNames['end'] = end;
126
- field.decoratorProps.params = fieldNames;
127
- fieldSchema['x-decorator-props']['params'] = fieldNames;
132
+ field.decoratorProps.fieldNames = fieldNames;
133
+ fieldSchema['x-decorator-props']['fieldNames'] = fieldNames;
128
134
  service.refresh();
129
135
  dn.emit('patch', {
130
136
  schema: (_schema3 = {}, _defineProperty(_schema3, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema3, 'x-decorator-props', field.decoratorProps), _schema3)
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import type { DatePickerProps as AntdDatePickerProps, RangePickerProps as AntdRangePickerProps } from 'antd/lib/date-picker';
2
+ import React from 'react';
3
3
  declare type ComposedDatePicker = React.FC<AntdDatePickerProps> & {
4
4
  RangePicker?: React.FC<AntdRangePickerProps>;
5
5
  };
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.DatePicker = void 0;
7
7
 
8
- var _antd = require("antd");
9
-
10
8
  var _react = require("@formily/react");
11
9
 
10
+ var _antd = require("antd");
11
+
12
12
  var _ReadPretty = require("./ReadPretty");
13
13
 
14
14
  var _util = require("./util");
@@ -9,14 +9,14 @@ var _builtins__ = require("@formily/antd/lib/__builtins__");
9
9
 
10
10
  var _shared = require("@formily/shared");
11
11
 
12
+ var _client = require("@nocobase/utils/client");
13
+
12
14
  var _classnames = _interopRequireDefault(require("classnames"));
13
15
 
14
16
  var _moment = _interopRequireDefault(require("moment"));
15
17
 
16
18
  var _react = _interopRequireDefault(require("react"));
17
19
 
18
- var _util = require("./util");
19
-
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
22
  var ReadPretty = function ReadPretty() {
@@ -33,8 +33,8 @@ ReadPretty.DatePicker = function (props) {
33
33
  var prefixCls = (0, _builtins__.usePrefixCls)('description-date-picker', props);
34
34
 
35
35
  var getLabels = function getLabels() {
36
- var format = (0, _util.getDefaultFormat)(props);
37
- var m = (0, _util.str2moment)(props.value, props);
36
+ var format = (0, _client.getDefaultFormat)(props);
37
+ var m = (0, _client.str2moment)(props.value, props);
38
38
  var labels = _moment.default.isMoment(m) ? m.format(format) : '';
39
39
  return (0, _shared.isArr)(labels) ? labels.join('~') : labels;
40
40
  };
@@ -46,10 +46,10 @@ ReadPretty.DatePicker = function (props) {
46
46
 
47
47
  ReadPretty.DateRangePicker = function (props) {
48
48
  var prefixCls = (0, _builtins__.usePrefixCls)('description-text', props);
49
- var format = (0, _util.getDefaultFormat)(props);
49
+ var format = (0, _client.getDefaultFormat)(props);
50
50
 
51
51
  var getLabels = function getLabels() {
52
- var m = (0, _util.str2moment)(props.value, props);
52
+ var m = (0, _client.str2moment)(props.value, props);
53
53
 
54
54
  if (!m) {
55
55
  return '';
@@ -1,18 +1,8 @@
1
- import type { DatePickerProps } from 'antd/lib/date-picker';
2
1
  import moment from 'moment';
3
- export interface Str2momentOptions {
4
- gmt?: boolean;
5
- picker?: 'year' | 'month' | 'week' | 'quarter';
6
- }
7
- export declare const str2moment: (value?: string | string[], options?: Str2momentOptions) => any;
8
2
  export interface Moment2strOptions {
9
3
  showTime?: boolean;
10
4
  gmt?: boolean;
11
5
  picker?: 'year' | 'month' | 'week' | 'quarter';
12
6
  }
13
7
  export declare const moment2str: (value?: moment.Moment | moment.Moment[], options?: Moment2strOptions) => string | string[] | moment.Moment | moment.Moment[];
14
- export declare const getDefaultFormat: (props: DatePickerProps & {
15
- dateFormat: string;
16
- timeFormat: string;
17
- }) => string | import("rc-picker/lib/interface").CustomFormat<moment.Moment> | (string | import("rc-picker/lib/interface").CustomFormat<moment.Moment>)[];
18
8
  export declare const mapDateFormat: () => (props: any) => any;
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.str2moment = exports.moment2str = exports.mapDateFormat = exports.getDefaultFormat = void 0;
6
+ exports.moment2str = exports.mapDateFormat = void 0;
7
+
8
+ var _client = require("@nocobase/utils/client");
7
9
 
8
10
  var _moment = _interopRequireDefault(require("moment"));
9
11
 
@@ -15,22 +17,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
15
17
 
16
18
  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; }
17
19
 
18
- var toGmt = function toGmt(value) {
19
- if (!value) {
20
- return value;
21
- }
22
-
23
- if (Array.isArray(value)) {
24
- return value.map(function (val) {
25
- return "".concat(val.format('YYYY-MM-DD'), "T").concat(val.format('HH:mm:ss.SSS'), "Z");
26
- });
27
- }
28
-
29
- if (_moment.default.isMoment(value)) {
30
- return "".concat(value.format('YYYY-MM-DD'), "T").concat(value.format('HH:mm:ss.SSS'), "Z");
31
- }
32
- };
33
-
34
20
  var toStringByPicker = function toStringByPicker(value, picker) {
35
21
  if (picker === 'year') {
36
22
  return value.format('YYYY') + '-01-01T00:00:00.000Z';
@@ -67,47 +53,6 @@ var toGmtByPicker = function toGmtByPicker(value, picker) {
67
53
  }
68
54
  };
69
55
 
70
- var toLocal = function toLocal(value) {
71
- if (!value) {
72
- return value;
73
- }
74
-
75
- if (Array.isArray(value)) {
76
- return value.map(function (val) {
77
- return val.toISOString();
78
- });
79
- }
80
-
81
- if (_moment.default.isMoment(value)) {
82
- return value.toISOString();
83
- }
84
- };
85
-
86
- var toMoment = function toMoment(val, options) {
87
- if (_moment.default.isMoment(val)) {
88
- return val;
89
- }
90
-
91
- var gmt = options.gmt,
92
- picker = options.picker;
93
-
94
- if (gmt || picker) {
95
- val = val.replace('T', ' ').replace('Z', '');
96
- return (0, _moment.default)(val);
97
- }
98
-
99
- return (0, _moment.default)(val);
100
- };
101
-
102
- var str2moment = function str2moment(value) {
103
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
104
- return Array.isArray(value) ? value.map(function (val) {
105
- return toMoment(val, options);
106
- }) : value ? toMoment(value, options) : value;
107
- };
108
-
109
- exports.str2moment = str2moment;
110
-
111
56
  var moment2str = function moment2str(value) {
112
57
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
113
58
  var showTime = options.showTime,
@@ -119,7 +64,7 @@ var moment2str = function moment2str(value) {
119
64
  }
120
65
 
121
66
  if (showTime) {
122
- return gmt ? toGmt(value) : toLocal(value);
67
+ return gmt ? (0, _client.toGmt)(value) : (0, _client.toLocal)(value);
123
68
  }
124
69
 
125
70
  return toGmtByPicker(value, picker);
@@ -127,41 +72,13 @@ var moment2str = function moment2str(value) {
127
72
 
128
73
  exports.moment2str = moment2str;
129
74
 
130
- var getDefaultFormat = function getDefaultFormat(props) {
131
- if (props.format) {
132
- return props.format;
133
- }
134
-
135
- if (props.dateFormat) {
136
- if (props['showTime']) {
137
- return "".concat(props.dateFormat, " ").concat(props.timeFormat || 'HH:mm:ss');
138
- }
139
-
140
- return props.dateFormat;
141
- }
142
-
143
- if (props['picker'] === 'month') {
144
- return 'YYYY-MM';
145
- } else if (props['picker'] === 'quarter') {
146
- return 'YYYY-\\QQ';
147
- } else if (props['picker'] === 'year') {
148
- return 'YYYY';
149
- } else if (props['picker'] === 'week') {
150
- return 'YYYY-wo';
151
- }
152
-
153
- return props['showTime'] ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
154
- };
155
-
156
- exports.getDefaultFormat = getDefaultFormat;
157
-
158
75
  var mapDateFormat = function mapDateFormat() {
159
76
  return function (props) {
160
- var format = getDefaultFormat(props);
77
+ var format = (0, _client.getDefaultFormat)(props);
161
78
  var _onChange = props.onChange;
162
79
  return _objectSpread(_objectSpread({}, props), {}, {
163
80
  format: format,
164
- value: str2moment(props.value, props),
81
+ value: (0, _client.str2moment)(props.value, props),
165
82
  onChange: function onChange(value) {
166
83
  if (_onChange) {
167
84
  _onChange(moment2str(value, props));