@nocobase/client 0.7.2-alpha.7 → 0.7.4-alpha.4

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 (175) 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 +15 -3
  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 +42 -14
  7. package/es/block-provider/hooks/index.d.ts +6 -0
  8. package/es/block-provider/hooks/index.js +159 -65
  9. package/es/collection-manager/CollectionField.js +11 -4
  10. package/es/collection-manager/Configuration/AddFieldAction.js +6 -0
  11. package/es/collection-manager/Configuration/EditFieldAction.js +7 -0
  12. package/es/collection-manager/Configuration/index.js +5 -1
  13. package/es/collection-manager/Configuration/schemas/collections.js +2 -1
  14. package/es/collection-manager/interfaces/checkbox.js +1 -0
  15. package/es/collection-manager/interfaces/checkboxGroup.js +1 -0
  16. package/es/collection-manager/interfaces/datetime.js +1 -0
  17. package/es/collection-manager/interfaces/email.js +1 -0
  18. package/es/collection-manager/interfaces/icon.js +1 -0
  19. package/es/collection-manager/interfaces/input.js +104 -0
  20. package/es/collection-manager/interfaces/integer.js +64 -0
  21. package/es/collection-manager/interfaces/m2m.js +2 -0
  22. package/es/collection-manager/interfaces/m2o.js +1 -0
  23. package/es/collection-manager/interfaces/markdown.js +35 -0
  24. package/es/collection-manager/interfaces/multipleSelect.js +1 -0
  25. package/es/collection-manager/interfaces/number.js +56 -0
  26. package/es/collection-manager/interfaces/o2m.js +1 -0
  27. package/es/collection-manager/interfaces/o2o.js +3 -0
  28. package/es/collection-manager/interfaces/password.js +37 -1
  29. package/es/collection-manager/interfaces/percent.js +98 -0
  30. package/es/collection-manager/interfaces/phone.js +1 -0
  31. package/es/collection-manager/interfaces/properties/index.d.ts +1 -0
  32. package/es/collection-manager/interfaces/properties/index.js +1 -0
  33. package/es/collection-manager/interfaces/properties/operators.js +4 -4
  34. package/es/collection-manager/interfaces/radioGroup.js +1 -0
  35. package/es/collection-manager/interfaces/richText.js +35 -0
  36. package/es/collection-manager/interfaces/select.js +1 -0
  37. package/es/collection-manager/interfaces/textarea.js +35 -0
  38. package/es/collection-manager/interfaces/time.js +1 -0
  39. package/es/file-manager/FileStorageShortcut.js +2 -2
  40. package/es/locale/en_US.d.ts +8 -2
  41. package/es/locale/en_US.js +9 -3
  42. package/es/locale/zh_CN.d.ts +28 -2
  43. package/es/locale/zh_CN.js +29 -3
  44. package/es/plugin-manager/PluginManager.d.ts +1 -0
  45. package/es/plugin-manager/PluginManager.js +20 -6
  46. package/es/schema-component/antd/action/Action.Modal.js +1 -1
  47. package/es/schema-component/antd/calendar/Calendar.Designer.js +16 -10
  48. package/es/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
  49. package/es/schema-component/antd/date-picker/DatePicker.js +1 -1
  50. package/es/schema-component/antd/date-picker/ReadPretty.js +1 -1
  51. package/es/schema-component/antd/date-picker/util.d.ts +0 -10
  52. package/es/schema-component/antd/date-picker/util.js +1 -79
  53. package/es/schema-component/antd/form-item/FormItem.js +193 -10
  54. package/es/schema-component/antd/grid/Grid.js +72 -6
  55. package/es/schema-component/antd/input-number/InputNumber.d.ts +1 -5
  56. package/es/schema-component/antd/input-number/InputNumber.js +25 -1
  57. package/es/schema-component/antd/input-number/ReadPretty.js +2 -4
  58. package/es/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
  59. package/es/schema-component/antd/menu/Menu.js +6 -3
  60. package/es/schema-component/antd/percent/Percent.js +2 -2
  61. package/es/schema-component/antd/record-picker/InputRecordPicker.js +27 -13
  62. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +5 -3
  63. package/es/schema-component/antd/table/Table.Array.js +2 -2
  64. package/es/schema-component/antd/table/Table.Void.js +11 -1
  65. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
  66. package/es/schema-component/antd/table-v2/Table.d.ts +0 -11
  67. package/es/schema-component/antd/table-v2/Table.js +163 -92
  68. package/es/schema-component/antd/table-v2/TableField.js +3 -0
  69. package/es/schema-component/antd/tabs/Tabs.Designer.js +23 -12
  70. package/es/schema-component/antd/tabs/Tabs.js +7 -1
  71. package/es/schema-component/antd/time-picker/ReadPretty.js +11 -5
  72. package/es/schema-component/core/DesignableSwitch.js +7 -1
  73. package/es/schema-component/hooks/useDesignable.js +21 -21
  74. package/es/schema-component/hooks/useProps.js +1 -1
  75. package/es/schema-initializer/buttons/FormItemInitializers.js +14 -3
  76. package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
  77. package/es/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -3
  78. package/es/schema-initializer/buttons/RecordBlockInitializers.js +32 -3
  79. package/es/schema-initializer/buttons/TabPaneInitializers.js +11 -3
  80. package/es/schema-initializer/buttons/TableActionInitializers.js +11 -0
  81. package/es/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
  82. package/es/schema-initializer/components/assigned-field/AssignedField.js +255 -69
  83. package/es/schema-initializer/items/index.d.ts +2 -0
  84. package/es/schema-initializer/items/index.js +48 -2
  85. package/es/schema-initializer/utils.js +22 -2
  86. package/es/schema-settings/SchemaSettings.js +7 -0
  87. package/es/system-settings/SystemSettingsShortcut.js +35 -12
  88. package/lib/application/Application.d.ts +1 -0
  89. package/lib/application/Application.js +11 -2
  90. package/lib/block-provider/FormBlockProvider.js +15 -2
  91. package/lib/block-provider/TableFieldProvider.d.ts +1 -0
  92. package/lib/block-provider/TableFieldProvider.js +4 -1
  93. package/lib/block-provider/TableSelectorProvider.js +42 -14
  94. package/lib/block-provider/hooks/index.d.ts +6 -0
  95. package/lib/block-provider/hooks/index.js +168 -67
  96. package/lib/collection-manager/CollectionField.js +12 -4
  97. package/lib/collection-manager/Configuration/AddFieldAction.js +6 -0
  98. package/lib/collection-manager/Configuration/EditFieldAction.js +7 -0
  99. package/lib/collection-manager/Configuration/index.js +5 -0
  100. package/lib/collection-manager/Configuration/schemas/collections.js +2 -1
  101. package/lib/collection-manager/interfaces/checkbox.js +1 -0
  102. package/lib/collection-manager/interfaces/checkboxGroup.js +1 -0
  103. package/lib/collection-manager/interfaces/datetime.js +1 -0
  104. package/lib/collection-manager/interfaces/email.js +1 -0
  105. package/lib/collection-manager/interfaces/icon.js +1 -0
  106. package/lib/collection-manager/interfaces/input.js +105 -0
  107. package/lib/collection-manager/interfaces/integer.js +66 -0
  108. package/lib/collection-manager/interfaces/m2m.js +2 -0
  109. package/lib/collection-manager/interfaces/m2o.js +1 -0
  110. package/lib/collection-manager/interfaces/markdown.js +36 -0
  111. package/lib/collection-manager/interfaces/multipleSelect.js +1 -0
  112. package/lib/collection-manager/interfaces/number.js +57 -0
  113. package/lib/collection-manager/interfaces/o2m.js +1 -0
  114. package/lib/collection-manager/interfaces/o2o.js +3 -0
  115. package/lib/collection-manager/interfaces/password.js +38 -1
  116. package/lib/collection-manager/interfaces/percent.js +100 -0
  117. package/lib/collection-manager/interfaces/phone.js +1 -0
  118. package/lib/collection-manager/interfaces/properties/index.d.ts +1 -0
  119. package/lib/collection-manager/interfaces/properties/index.js +1 -0
  120. package/lib/collection-manager/interfaces/properties/operators.js +4 -4
  121. package/lib/collection-manager/interfaces/radioGroup.js +1 -0
  122. package/lib/collection-manager/interfaces/richText.js +36 -0
  123. package/lib/collection-manager/interfaces/select.js +1 -0
  124. package/lib/collection-manager/interfaces/textarea.js +36 -0
  125. package/lib/collection-manager/interfaces/time.js +1 -0
  126. package/lib/file-manager/FileStorageShortcut.js +1 -1
  127. package/lib/locale/en_US.d.ts +8 -2
  128. package/lib/locale/en_US.js +9 -3
  129. package/lib/locale/zh_CN.d.ts +28 -2
  130. package/lib/locale/zh_CN.js +29 -3
  131. package/lib/plugin-manager/PluginManager.d.ts +1 -0
  132. package/lib/plugin-manager/PluginManager.js +23 -5
  133. package/lib/schema-component/antd/action/Action.Modal.js +1 -1
  134. package/lib/schema-component/antd/calendar/Calendar.Designer.js +16 -10
  135. package/lib/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
  136. package/lib/schema-component/antd/date-picker/DatePicker.js +2 -2
  137. package/lib/schema-component/antd/date-picker/ReadPretty.js +6 -6
  138. package/lib/schema-component/antd/date-picker/util.d.ts +0 -10
  139. package/lib/schema-component/antd/date-picker/util.js +6 -89
  140. package/lib/schema-component/antd/form-item/FormItem.js +196 -12
  141. package/lib/schema-component/antd/grid/Grid.js +69 -3
  142. package/lib/schema-component/antd/input-number/InputNumber.d.ts +1 -5
  143. package/lib/schema-component/antd/input-number/InputNumber.js +28 -1
  144. package/lib/schema-component/antd/input-number/ReadPretty.js +2 -5
  145. package/lib/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
  146. package/lib/schema-component/antd/menu/Menu.js +6 -3
  147. package/lib/schema-component/antd/percent/Percent.js +2 -2
  148. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +27 -12
  149. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +4 -2
  150. package/lib/schema-component/antd/table/Table.Array.js +2 -2
  151. package/lib/schema-component/antd/table/Table.Void.js +11 -1
  152. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
  153. package/lib/schema-component/antd/table-v2/Table.d.ts +0 -11
  154. package/lib/schema-component/antd/table-v2/Table.js +172 -94
  155. package/lib/schema-component/antd/table-v2/TableField.js +3 -0
  156. package/lib/schema-component/antd/tabs/Tabs.Designer.js +23 -12
  157. package/lib/schema-component/antd/tabs/Tabs.js +8 -1
  158. package/lib/schema-component/antd/time-picker/ReadPretty.js +10 -3
  159. package/lib/schema-component/core/DesignableSwitch.js +8 -1
  160. package/lib/schema-component/hooks/useDesignable.js +21 -21
  161. package/lib/schema-component/hooks/useProps.js +1 -1
  162. package/lib/schema-initializer/buttons/FormItemInitializers.js +14 -2
  163. package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
  164. package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -2
  165. package/lib/schema-initializer/buttons/RecordBlockInitializers.js +34 -4
  166. package/lib/schema-initializer/buttons/TabPaneInitializers.js +11 -3
  167. package/lib/schema-initializer/buttons/TableActionInitializers.js +11 -0
  168. package/lib/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
  169. package/lib/schema-initializer/components/assigned-field/AssignedField.js +257 -66
  170. package/lib/schema-initializer/items/index.d.ts +2 -0
  171. package/lib/schema-initializer/items/index.js +54 -2
  172. package/lib/schema-initializer/utils.js +22 -2
  173. package/lib/schema-settings/SchemaSettings.js +7 -0
  174. package/lib/system-settings/SystemSettingsShortcut.js +37 -13
  175. package/package.json +7 -4
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.ViewActionInitializer = exports.UpdateSubmitActionInitializer = exports.UpdateActionInitializer = exports.TableSelectorInitializer = exports.TableCollectionFieldInitializer = exports.TableBlockInitializer = exports.TableActionColumnInitializer = exports.SubmitActionInitializer = exports.RecordReadPrettyFormBlockInitializer = exports.RecordReadPrettyAssociationFormBlockInitializer = exports.RecordFormBlockInitializer = exports.RecordAssociationFormBlockInitializer = exports.RecordAssociationDetailsBlockInitializer = exports.RecordAssociationCalendarBlockInitializer = exports.RecordAssociationBlockInitializer = exports.MarkdownBlockInitializer = exports.KanbanBlockInitializer = exports.InitializerWithSwitch = exports.G2PlotInitializer = exports.FormBlockInitializer = exports.FilterActionInitializer = exports.DetailsBlockInitializer = exports.DestroyActionInitializer = exports.DataBlockInitializer = exports.CustomizeActionInitializer = exports.CreateSubmitActionInitializer = exports.CreateFormBlockInitializer = exports.CreateActionInitializer = exports.CollectionFieldInitializer = exports.CalendarBlockInitializer = exports.BulkDestroyActionInitializer = exports.BlockInitializer = exports.ActionInitializer = void 0;
8
+ exports.ViewActionInitializer = exports.UpdateSubmitActionInitializer = exports.UpdateActionInitializer = exports.TableSelectorInitializer = exports.TableCollectionFieldInitializer = exports.TableBlockInitializer = exports.TableActionColumnInitializer = exports.SubmitActionInitializer = exports.RefreshActionInitializer = exports.RecordReadPrettyFormBlockInitializer = exports.RecordReadPrettyAssociationFormBlockInitializer = exports.RecordFormBlockInitializer = exports.RecordAssociationFormBlockInitializer = exports.RecordAssociationDetailsBlockInitializer = exports.RecordAssociationCalendarBlockInitializer = exports.RecordAssociationBlockInitializer = exports.PrintActionInitializer = exports.MarkdownBlockInitializer = exports.KanbanBlockInitializer = exports.InitializerWithSwitch = exports.G2PlotInitializer = exports.FormBlockInitializer = exports.FilterActionInitializer = exports.DetailsBlockInitializer = exports.DestroyActionInitializer = exports.DataBlockInitializer = exports.CustomizeActionInitializer = exports.CreateSubmitActionInitializer = exports.CreateFormBlockInitializer = exports.CreateActionInitializer = exports.CollectionFieldInitializer = exports.CalendarBlockInitializer = exports.BulkDestroyActionInitializer = exports.BlockInitializer = exports.ActionInitializer = void 0;
9
9
 
10
10
  var _icons = require("@ant-design/icons");
11
11
 
@@ -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,
@@ -770,6 +771,24 @@ var DestroyActionInitializer = function DestroyActionInitializer(props) {
770
771
 
771
772
  exports.DestroyActionInitializer = DestroyActionInitializer;
772
773
 
774
+ var PrintActionInitializer = function PrintActionInitializer(props) {
775
+ var schema = {
776
+ title: '{{ t("Print") }}',
777
+ 'x-action': 'print',
778
+ 'x-component': 'Action',
779
+ 'x-designer': 'Action.Designer',
780
+ 'x-component-props': {
781
+ icon: 'PrinterOutlined',
782
+ useProps: '{{ useDetailPrintActionProps }}'
783
+ }
784
+ };
785
+ return /*#__PURE__*/_react2.default.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
786
+ schema: schema
787
+ }));
788
+ };
789
+
790
+ exports.PrintActionInitializer = PrintActionInitializer;
791
+
773
792
  var BulkDestroyActionInitializer = function BulkDestroyActionInitializer(props) {
774
793
  var schema = {
775
794
  title: '{{ t("Delete") }}',
@@ -792,6 +811,24 @@ var BulkDestroyActionInitializer = function BulkDestroyActionInitializer(props)
792
811
 
793
812
  exports.BulkDestroyActionInitializer = BulkDestroyActionInitializer;
794
813
 
814
+ var RefreshActionInitializer = function RefreshActionInitializer(props) {
815
+ var schema = {
816
+ title: '{{ t("Refresh") }}',
817
+ 'x-action': 'refresh',
818
+ 'x-component': 'Action',
819
+ 'x-designer': 'Action.Designer',
820
+ 'x-component-props': {
821
+ icon: 'ReloadOutlined',
822
+ useProps: '{{ useRefreshActionProps }}'
823
+ }
824
+ };
825
+ return /*#__PURE__*/_react2.default.createElement(ActionInitializer, _objectSpread(_objectSpread({}, props), {}, {
826
+ schema: schema
827
+ }));
828
+ };
829
+
830
+ exports.RefreshActionInitializer = RefreshActionInitializer;
831
+
795
832
  var SubmitActionInitializer = function SubmitActionInitializer(props) {
796
833
  var schema = {
797
834
  title: '{{ t("Submit") }}',
@@ -943,6 +980,7 @@ var RecordFormBlockInitializer = function RecordFormBlockInitializer(props) {
943
980
 
944
981
  var collection = (0, _collectionManager.useCollection)();
945
982
  var association = (0, _blockProvider.useBlockAssociationContext)();
983
+ console.log('RecordFormBlockInitializer', collection, association);
946
984
  return /*#__PURE__*/_react2.default.createElement(_SchemaInitializer.SchemaInitializer.Item, _objectSpread(_objectSpread({
947
985
  icon: /*#__PURE__*/_react2.default.createElement(_icons.FormOutlined, null)
948
986
  }, others), {}, {
@@ -1031,6 +1069,11 @@ var RecordReadPrettyFormBlockInitializer = function RecordReadPrettyFormBlockIni
1031
1069
 
1032
1070
  var collection = (0, _collectionManager.useCollection)();
1033
1071
  var association = (0, _blockProvider.useBlockAssociationContext)();
1072
+
1073
+ var _useBlockRequestConte = (0, _blockProvider.useBlockRequestContext)(),
1074
+ block = _useBlockRequestConte.block;
1075
+
1076
+ var actionInitializers = block !== 'TableField' ? 'ReadPrettyFormActionInitializers' : null;
1034
1077
  return /*#__PURE__*/_react2.default.createElement(_SchemaInitializer.SchemaInitializer.Item, _objectSpread(_objectSpread({
1035
1078
  icon: /*#__PURE__*/_react2.default.createElement(_icons.FormOutlined, null)
1036
1079
  }, others), {}, {
@@ -1057,6 +1100,7 @@ var RecordReadPrettyFormBlockInitializer = function RecordReadPrettyFormBlockIni
1057
1100
 
1058
1101
  if (item.template.componentName === 'ReadPrettyFormItem') {
1059
1102
  blockSchema = (0, _utils.createReadPrettyFormBlockSchema)({
1103
+ actionInitializers: actionInitializers,
1060
1104
  association: association,
1061
1105
  collection: collection.name,
1062
1106
  action: 'get',
@@ -1079,6 +1123,7 @@ var RecordReadPrettyFormBlockInitializer = function RecordReadPrettyFormBlockIni
1079
1123
 
1080
1124
  case 8:
1081
1125
  insert((0, _utils.createReadPrettyFormBlockSchema)({
1126
+ actionInitializers: actionInitializers,
1082
1127
  association: association,
1083
1128
  collection: collection.name,
1084
1129
  action: 'get',
@@ -1214,6 +1259,11 @@ var RecordReadPrettyAssociationFormBlockInitializer = function RecordReadPrettyA
1214
1259
  var field = item.field;
1215
1260
  var collection = field.target;
1216
1261
  var resource = "".concat(field.collectionName, ".").concat(field.name);
1262
+
1263
+ var _useBlockRequestConte2 = (0, _blockProvider.useBlockRequestContext)(),
1264
+ block = _useBlockRequestConte2.block;
1265
+
1266
+ var actionInitializers = block !== 'TableField' ? 'ReadPrettyFormActionInitializers' : null;
1217
1267
  return /*#__PURE__*/_react2.default.createElement(_SchemaInitializer.SchemaInitializer.Item, _objectSpread(_objectSpread({
1218
1268
  icon: /*#__PURE__*/_react2.default.createElement(_icons.FormOutlined, null)
1219
1269
  }, others), {}, {
@@ -1239,6 +1289,7 @@ var RecordReadPrettyAssociationFormBlockInitializer = function RecordReadPrettyA
1239
1289
 
1240
1290
  if (item.template.componentName === 'ReadPrettyFormItem') {
1241
1291
  blockSchema = (0, _utils.createReadPrettyFormBlockSchema)({
1292
+ actionInitializers: actionInitializers,
1242
1293
  collection: collection,
1243
1294
  resource: resource,
1244
1295
  association: resource,
@@ -1262,6 +1313,7 @@ var RecordReadPrettyAssociationFormBlockInitializer = function RecordReadPrettyA
1262
1313
 
1263
1314
  case 8:
1264
1315
  insert((0, _utils.createReadPrettyFormBlockSchema)({
1316
+ actionInitializers: actionInitializers,
1265
1317
  collection: collection,
1266
1318
  resource: resource,
1267
1319
  association: resource,
@@ -300,8 +300,9 @@ var useAssociatedFormItemInitializerFields = function useAssociatedFormItemIniti
300
300
  _ref2$block = _ref2.block,
301
301
  block = _ref2$block === void 0 ? 'Form' : _ref2$block;
302
302
 
303
+ var interfaces = block === 'Form' ? ['m2o'] : ['o2o', 'oho', 'obo', 'm2o'];
303
304
  var groups = fields === null || fields === void 0 ? void 0 : (_fields$filter3 = fields.filter(function (field) {
304
- return ['o2o', 'oho', 'obo', 'm2o'].includes(field.interface);
305
+ return interfaces.includes(field.interface);
305
306
  })) === null || _fields$filter3 === void 0 ? void 0 : _fields$filter3.map(function (field) {
306
307
  var _subFields$filter2, _field$uiSchema4;
307
308
 
@@ -318,7 +319,10 @@ var useAssociatedFormItemInitializerFields = function useAssociatedFormItemIniti
318
319
  // title: subField?.uiSchema?.title || subField.name,
319
320
  'x-designer': 'FormItem.Designer',
320
321
  'x-component': 'CollectionField',
321
- 'x-component-props': {},
322
+ 'x-read-pretty': readPretty,
323
+ 'x-component-props': {
324
+ 'pattern-disable': block === 'Form' && readPretty
325
+ },
322
326
  'x-decorator': 'FormItem',
323
327
  'x-collection-field': "".concat(name, ".").concat(field.name, ".").concat(subField.name)
324
328
  }; // interfaceConfig?.schemaInitialize?.(schema, { field, block: 'Form', readPretty: form.readPretty });
@@ -429,11 +433,27 @@ var removeSchema = function removeSchema(schema, cb) {
429
433
  return cb(schema);
430
434
  };
431
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
+
432
442
  var useCurrentSchema = function useCurrentSchema(action, key) {
443
+ var _fieldSchema;
444
+
433
445
  var find = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : findSchema;
434
446
  var rm = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : removeSchema;
435
447
  var fieldSchema = (0, _react.useFieldSchema)();
436
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
+
437
457
  var _useDesignable = (0, _schemaComponent.useDesignable)(),
438
458
  _remove = _useDesignable.remove;
439
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 {
@@ -13,6 +13,8 @@ var _react = require("@formily/react");
13
13
 
14
14
  var _shared = require("@formily/shared");
15
15
 
16
+ var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
17
+
16
18
  var _react2 = _interopRequireWildcard(require("react"));
17
19
 
18
20
  var _reactI18next = require("react-i18next");
@@ -25,12 +27,12 @@ var _locale = _interopRequireDefault(require("../locale"));
25
27
 
26
28
  var _schemaComponent = require("../schema-component");
27
29
 
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
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); }
31
31
 
32
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
33
 
34
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
+
34
36
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
35
37
 
36
38
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -110,6 +112,9 @@ var useSaveSystemSettingsValues = function useSaveSystemSettingsValues() {
110
112
  return {
111
113
  run: function run() {
112
114
  return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
115
+ var _values$enabledLangua;
116
+
117
+ var values, lang;
113
118
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
114
119
  while (1) {
115
120
  switch (_context2.prev = _context2.next) {
@@ -118,18 +123,28 @@ var useSaveSystemSettingsValues = function useSaveSystemSettingsValues() {
118
123
  return form.submit();
119
124
 
120
125
  case 2:
121
- setVisible(false);
126
+ values = (0, _cloneDeep.default)(form.values);
122
127
  mutate({
123
- data: _objectSpread(_objectSpread({}, data === null || data === void 0 ? void 0 : data.data), form.values)
128
+ data: _objectSpread(_objectSpread({}, data === null || data === void 0 ? void 0 : data.data), values)
124
129
  });
125
130
  _context2.next = 6;
126
131
  return api.request({
127
132
  url: 'systemSettings:update/1',
128
133
  method: 'post',
129
- data: form.values
134
+ data: values
130
135
  });
131
136
 
132
137
  case 6:
138
+ lang = ((_values$enabledLangua = values.enabledLanguages) === null || _values$enabledLangua === void 0 ? void 0 : _values$enabledLangua[0]) || 'en-US';
139
+
140
+ if (values.enabledLanguages.length < 2 && api.auth.getLocale() !== lang) {
141
+ api.auth.setLocale('');
142
+ window.location.reload();
143
+ } else {
144
+ setVisible(false);
145
+ }
146
+
147
+ case 8:
133
148
  case "end":
134
149
  return _context2.stop();
135
150
  }
@@ -177,14 +192,23 @@ var schema = {
177
192
  mode: 'multiple'
178
193
  },
179
194
  'x-decorator': 'FormItem',
180
- enum: langs
181
- },
182
- appLang: {
183
- type: 'string',
184
- title: '{{t("Default language")}}',
185
- 'x-component': 'Select',
186
- 'x-decorator': 'FormItem',
187
- enum: langs
195
+ enum: langs,
196
+ 'x-reactions': function xReactions(field) {
197
+ field.dataSource = langs.map(function (item) {
198
+ var _field$value;
199
+
200
+ var label = item.label;
201
+
202
+ if (((_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value[0]) === item.value) {
203
+ label += "(".concat(_2.i18n.t('Default'), ")");
204
+ }
205
+
206
+ return {
207
+ label: label,
208
+ value: item.value
209
+ };
210
+ });
211
+ }
188
212
  },
189
213
  allowSignUp: {
190
214
  type: 'boolean',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/client",
3
- "version": "0.7.2-alpha.7",
3
+ "version": "0.7.4-alpha.4",
4
4
  "license": "Apache-2.0",
5
5
  "licenses": [
6
6
  {
@@ -19,14 +19,15 @@
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.2-alpha.7",
23
- "@nocobase/utils": "0.7.2-alpha.7",
22
+ "@nocobase/sdk": "0.7.4-alpha.4",
23
+ "@nocobase/utils": "0.7.4-alpha.4",
24
24
  "ahooks": "^3.0.5",
25
25
  "antd": "~4.19.5",
26
26
  "axios": "^0.26.1",
27
27
  "classnames": "^2.3.1",
28
28
  "file-saver": "^2.0.5",
29
29
  "i18next": "^21.6.0",
30
+ "json-templates": "^4.2.0",
30
31
  "marked": "^4.0.12",
31
32
  "mathjs": "^10.6.0",
32
33
  "react-beautiful-dnd": "^13.1.0",
@@ -34,10 +35,12 @@
34
35
  "react-contenteditable": "^3.3.6",
35
36
  "react-drag-listview": "^0.1.9",
36
37
  "react-helmet": "^6.1.0",
38
+ "react-hotkeys-hook": "^3.4.7",
37
39
  "react-i18next": "^11.15.1",
38
40
  "react-image-lightbox": "^5.1.4",
39
41
  "react-quill": "^1.3.5",
40
42
  "react-router-dom": "^5.2.0",
43
+ "react-to-print": "^2.14.7",
41
44
  "use-deep-compare-effect": "^1.8.1"
42
45
  },
43
46
  "peerDependencies": {
@@ -52,5 +55,5 @@
52
55
  "@types/marked": "^4.0.1",
53
56
  "axios-mock-adapter": "^1.20.0"
54
57
  },
55
- "gitHead": "c34194ae51395346b7cf1d1b6b5e127597d956ab"
58
+ "gitHead": "726c06b721b217a6aa5c1421b899d1315e552b57"
56
59
  }