@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
@@ -39,28 +39,39 @@ var TabsDesigner = function TabsDesigner() {
39
39
  properties: {
40
40
  title: {
41
41
  title: t('Tab name'),
42
+ required: true,
42
43
  'x-decorator': 'FormItem',
43
44
  'x-component': 'Input',
44
45
  'x-component-props': {}
46
+ },
47
+ icon: {
48
+ title: t('Icon'),
49
+ 'x-decorator': 'FormItem',
50
+ 'x-component': 'IconPicker',
51
+ 'x-component-props': {}
45
52
  }
46
53
  }
47
54
  },
48
55
  initialValues: {
49
- title: field.title
56
+ title: field.title,
57
+ icon: field.componentProps.icon
50
58
  },
51
59
  onSubmit: function onSubmit(_ref) {
52
- var title = _ref.title;
60
+ var _schema;
53
61
 
54
- if (title) {
55
- var _schema;
56
-
57
- fieldSchema.title = title;
58
- field.title = title;
59
- dn.emit('patch', {
60
- schema: (_schema = {}, _defineProperty(_schema, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema, "title", title), _schema)
61
- });
62
- dn.refresh();
63
- }
62
+ var title = _ref.title,
63
+ icon = _ref.icon;
64
+ var props = fieldSchema['x-component-props'] || {};
65
+ fieldSchema.title = title;
66
+ field.title = title;
67
+ props.icon = icon;
68
+ field.componentProps.icon = icon;
69
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
70
+ fieldSchema['x-component-props'].icon = icon;
71
+ dn.emit('patch', {
72
+ schema: (_schema = {}, _defineProperty(_schema, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema, "title", title), _defineProperty(_schema, 'x-component-props', props), _schema)
73
+ });
74
+ dn.refresh();
64
75
  }
65
76
  }), /*#__PURE__*/_react2.default.createElement(_2.SchemaSettings.Divider, null), /*#__PURE__*/_react2.default.createElement(_2.SchemaSettings.Remove, null));
66
77
  };
@@ -15,6 +15,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
15
15
 
16
16
  var _react2 = _interopRequireDefault(require("react"));
17
17
 
18
+ var _icon = require("../../../icon");
19
+
18
20
  var _schemaInitializer = require("../../../schema-initializer");
19
21
 
20
22
  var _common = require("../../common");
@@ -61,6 +63,11 @@ Tabs.TabPane = (0, _react.observer)(function (props) {
61
63
  var field = (0, _react.useField)();
62
64
  return /*#__PURE__*/_react2.default.createElement(_common.SortableItem, {
63
65
  className: (0, _classnames.default)('nb-action-link', designerCss, props.className)
64
- }, props.tab || field.title, /*#__PURE__*/_react2.default.createElement(Designer, null));
66
+ }, props.icon && /*#__PURE__*/_react2.default.createElement(_icon.Icon, {
67
+ style: {
68
+ marginRight: 2
69
+ },
70
+ type: props.icon
71
+ }), " ", props.tab || field.title, /*#__PURE__*/_react2.default.createElement(Designer, null));
65
72
  });
66
73
  Tabs.Designer = _Tabs.TabsDesigner;
@@ -15,6 +15,8 @@ var _ = require("..");
15
15
 
16
16
  var _pluginManager = require("../../plugin-manager");
17
17
 
18
+ var _reactHotkeysHook = require("react-hotkeys-hook");
19
+
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
21
 
20
22
  var DesignableSwitch = function DesignableSwitch() {
@@ -29,12 +31,17 @@ var DesignableSwitch = function DesignableSwitch() {
29
31
 
30
32
  if (designable) {
31
33
  style['backgroundColor'] = '#f18b62';
32
- }
34
+ } // 快捷键切换编辑状态
35
+
33
36
 
37
+ (0, _reactHotkeysHook.useHotkeys)('Ctrl+Shift+U', function () {
38
+ return setDesignable(!designable);
39
+ }, [designable]);
34
40
  return /*#__PURE__*/_react.default.createElement(_pluginManager.PluginManager.Toolbar.Item, {
35
41
  selected: designable,
36
42
  icon: /*#__PURE__*/_react.default.createElement(_icons.HighlightOutlined, null),
37
43
  title: t('UI Editor'),
44
+ subtitle: 'Ctrl+Shift+U',
38
45
  style: style,
39
46
  onClick: function onClick() {
40
47
  setDesignable(!designable);
@@ -32,7 +32,8 @@ var TabPaneInitializers = function TabPaneInitializers() {
32
32
  return {
33
33
  run: function run() {
34
34
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
35
- var title;
35
+ var _form$values, title, icon;
36
+
36
37
  return regeneratorRuntime.wrap(function _callee$(_context) {
37
38
  while (1) {
38
39
  switch (_context.prev = _context.next) {
@@ -41,13 +42,15 @@ var TabPaneInitializers = function TabPaneInitializers() {
41
42
  return form.submit();
42
43
 
43
44
  case 2:
44
- title = form.values.title;
45
+ _form$values = form.values, title = _form$values.title, icon = _form$values.icon;
45
46
  insertBeforeEnd({
46
47
  type: 'void',
47
48
  title: title,
48
49
  'x-component': 'Tabs.TabPane',
49
50
  'x-designer': 'Tabs.Designer',
50
- 'x-component-props': {},
51
+ 'x-component-props': {
52
+ icon: icon
53
+ },
51
54
  properties: {
52
55
  grid: {
53
56
  type: 'void',
@@ -106,6 +109,11 @@ var TabPaneInitializers = function TabPaneInitializers() {
106
109
  'x-component': 'Input',
107
110
  'x-decorator': 'FormItem'
108
111
  },
112
+ icon: {
113
+ title: '{{t("Icon")}}',
114
+ 'x-component': 'IconPicker',
115
+ 'x-decorator': 'FormItem'
116
+ },
109
117
  footer: {
110
118
  'x-component': 'Action.Modal.Footer',
111
119
  type: 'void',
@@ -9,6 +9,8 @@ exports.AssignedFieldValueType = exports.AssignedField = void 0;
9
9
 
10
10
  var _react = require("@formily/react");
11
11
 
12
+ var _shared = require("@formily/shared");
13
+
12
14
  var _antd = require("antd");
13
15
 
14
16
  var _react2 = _interopRequireWildcard(require("react"));
@@ -99,10 +101,11 @@ var InternalField = function InternalField(props) {
99
101
  }
100
102
 
101
103
  setRequired(); // @ts-ignore
102
- // field.dataSource = uiSchema.enum;
103
- // const originalProps = compile(uiSchema['x-component-props']) || {};
104
- // const componentProps = merge(originalProps, field.componentProps || {});
105
- // field.component = [component, componentProps];
104
+
105
+ field.dataSource = uiSchema.enum;
106
+ var originalProps = compile(uiSchema['x-component-props']) || {};
107
+ var componentProps = (0, _shared.merge)(originalProps, field.componentProps || {});
108
+ field.componentProps = componentProps; // field.component = [component, componentProps];
106
109
  }, [JSON.stringify(uiSchema)]);
107
110
 
108
111
  if (!uiSchema) {
@@ -471,9 +471,10 @@ var KanbanBlockInitializer = function KanbanBlockInitializer(props) {
471
471
  schema: {
472
472
  properties: {
473
473
  groupField: {
474
- title: t('Group field'),
474
+ title: t('Grouping field'),
475
475
  enum: fields,
476
476
  required: true,
477
+ description: '{{t("Single select and radio fields can be used as the grouping field")}}',
477
478
  'x-component': 'Select',
478
479
  'x-component-props': {
479
480
  objectValue: true,
@@ -433,11 +433,27 @@ var removeSchema = function removeSchema(schema, cb) {
433
433
  return cb(schema);
434
434
  };
435
435
 
436
+ var recursiveParent = function recursiveParent(schema) {
437
+ if (!schema.parent) return null;
438
+ if (schema.parent['x-initializer']) return schema.parent;
439
+ return recursiveParent(schema.parent);
440
+ };
441
+
436
442
  var useCurrentSchema = function useCurrentSchema(action, key) {
443
+ var _fieldSchema;
444
+
437
445
  var find = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : findSchema;
438
446
  var rm = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : removeSchema;
439
447
  var fieldSchema = (0, _react.useFieldSchema)();
440
448
 
449
+ if (!((_fieldSchema = fieldSchema) === null || _fieldSchema === void 0 ? void 0 : _fieldSchema['x-initializer'])) {
450
+ var recursiveInitializerSchema = recursiveParent(fieldSchema);
451
+
452
+ if (recursiveInitializerSchema) {
453
+ fieldSchema = recursiveInitializerSchema;
454
+ }
455
+ }
456
+
441
457
  var _useDesignable = (0, _schemaComponent.useDesignable)(),
442
458
  _remove = _useDesignable.remove;
443
459
 
@@ -578,6 +578,8 @@ SchemaSettings.Remove = function (props) {
578
578
  var _useTranslation3 = (0, _reactI18next.useTranslation)(),
579
579
  t = _useTranslation3.t;
580
580
 
581
+ var field = (0, _react.useField)();
582
+ var fieldSchema = (0, _react.useFieldSchema)();
581
583
  var ctx = (0, _BlockTemplate.useBlockTemplateContext)();
582
584
  return /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, {
583
585
  onClick: function onClick() {
@@ -591,6 +593,11 @@ SchemaSettings.Remove = function (props) {
591
593
  breakRemoveOn: breakRemoveOn
592
594
  };
593
595
 
596
+ if (field && field.required) {
597
+ field.required = false;
598
+ fieldSchema['required'] = false;
599
+ }
600
+
594
601
  if (template && (ctx === null || ctx === void 0 ? void 0 : ctx.dn)) {
595
602
  ctx === null || ctx === void 0 ? void 0 : ctx.dn.remove(null, options);
596
603
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/client",
3
- "version": "0.7.3-alpha.1",
3
+ "version": "0.7.4-alpha.7",
4
4
  "license": "Apache-2.0",
5
5
  "licenses": [
6
6
  {
@@ -19,8 +19,8 @@
19
19
  "@formily/antd": "2.0.20",
20
20
  "@formily/core": "2.0.20",
21
21
  "@formily/react": "2.0.20",
22
- "@nocobase/sdk": "0.7.3-alpha.1",
23
- "@nocobase/utils": "0.7.3-alpha.1",
22
+ "@nocobase/sdk": "0.7.4-alpha.7",
23
+ "@nocobase/utils": "0.7.4-alpha.7",
24
24
  "ahooks": "^3.0.5",
25
25
  "antd": "~4.19.5",
26
26
  "axios": "^0.26.1",
@@ -35,6 +35,7 @@
35
35
  "react-contenteditable": "^3.3.6",
36
36
  "react-drag-listview": "^0.1.9",
37
37
  "react-helmet": "^6.1.0",
38
+ "react-hotkeys-hook": "^3.4.7",
38
39
  "react-i18next": "^11.15.1",
39
40
  "react-image-lightbox": "^5.1.4",
40
41
  "react-quill": "^1.3.5",
@@ -54,5 +55,5 @@
54
55
  "@types/marked": "^4.0.1",
55
56
  "axios-mock-adapter": "^1.20.0"
56
57
  },
57
- "gitHead": "09597f41800ec567f64000e928cd68c28bb927e3"
58
+ "gitHead": "77f22e6da464d19be111835316faf4b94cd80413"
58
59
  }