@nocobase/client 0.7.7-alpha.1 → 0.8.0-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 (229) hide show
  1. package/es/acl/ACLShortcut.d.ts +2 -0
  2. package/es/acl/ACLShortcut.js +31 -2
  3. package/es/application/Application.d.ts +3 -1
  4. package/es/application/Application.js +131 -39
  5. package/es/block-provider/CalendarBlockProvider.d.ts +1 -0
  6. package/es/block-provider/CalendarBlockProvider.js +6 -3
  7. package/es/block-provider/TableSelectorProvider.js +21 -6
  8. package/es/block-provider/hooks/index.d.ts +6 -0
  9. package/es/block-provider/hooks/index.js +485 -115
  10. package/es/collection-manager/CollectionManagerProvider.js +26 -45
  11. package/es/collection-manager/CollectionManagerShortcut.d.ts +2 -0
  12. package/es/collection-manager/CollectionManagerShortcut.js +38 -3
  13. package/es/collection-manager/Configuration/AddFieldAction.d.ts +5 -1
  14. package/es/collection-manager/Configuration/AddFieldAction.js +44 -13
  15. package/es/collection-manager/Configuration/EditFieldAction.d.ts +1 -0
  16. package/es/collection-manager/Configuration/EditFieldAction.js +24 -11
  17. package/es/collection-manager/Configuration/index.d.ts +2 -0
  18. package/es/collection-manager/Configuration/index.js +2 -0
  19. package/es/collection-manager/Configuration/schemas/collectionFields.js +2 -2
  20. package/es/collection-manager/index.d.ts +1 -0
  21. package/es/collection-manager/index.js +2 -1
  22. package/es/collection-manager/interfaces/index.d.ts +1 -0
  23. package/es/collection-manager/interfaces/index.js +1 -0
  24. package/es/collection-manager/interfaces/json.d.ts +2 -0
  25. package/es/collection-manager/interfaces/json.js +48 -0
  26. package/es/collection-manager/interfaces/m2o.js +3 -3
  27. package/es/collection-manager/interfaces/o2m.js +5 -6
  28. package/es/collection-manager/interfaces/o2o.js +5 -5
  29. package/es/collection-manager/interfaces/properties/index.d.ts +14 -0
  30. package/es/collection-manager/interfaces/properties/index.js +23 -0
  31. package/es/collection-manager/interfaces/sequence.js +13 -9
  32. package/es/index.d.ts +1 -0
  33. package/es/index.js +1 -0
  34. package/es/locale/en_US.d.ts +13 -1
  35. package/es/locale/en_US.js +14 -2
  36. package/es/locale/ja_JP.d.ts +1 -1
  37. package/es/locale/ja_JP.js +1 -1
  38. package/es/locale/ru_RU.d.ts +1 -1
  39. package/es/locale/ru_RU.js +1 -1
  40. package/es/locale/tr_TR.d.ts +1 -1
  41. package/es/locale/tr_TR.js +1 -1
  42. package/es/locale/zh_CN.d.ts +39 -1
  43. package/es/locale/zh_CN.js +40 -2
  44. package/es/plugin-manager/PluginManager.js +35 -23
  45. package/es/pm/PluginManagerLink.d.ts +2 -0
  46. package/es/pm/PluginManagerLink.js +111 -0
  47. package/es/pm/index.d.ts +4 -0
  48. package/es/pm/index.js +422 -0
  49. package/es/route-switch/antd/admin-layout/index.js +1 -1
  50. package/es/schema-component/antd/action/Action.Designer.js +35 -12
  51. package/es/schema-component/antd/action/Action.Modal.js +4 -2
  52. package/es/schema-component/antd/action/Action.js +3 -3
  53. package/es/schema-component/antd/action/context.d.ts +2 -0
  54. package/es/schema-component/antd/action/hooks.d.ts +1 -0
  55. package/es/schema-component/antd/calendar/Calendar.Designer.js +19 -6
  56. package/es/schema-component/antd/calendar/Calendar.js +23 -2
  57. package/es/schema-component/antd/calendar/Title.js +18 -3
  58. package/es/schema-component/antd/calendar/components/Header.d.ts +10 -0
  59. package/es/schema-component/antd/calendar/components/Header.js +43 -0
  60. package/es/schema-component/antd/calendar/style.less +53 -9
  61. package/es/schema-component/antd/calendar/types.d.ts +6 -0
  62. package/es/schema-component/antd/calendar/utils.d.ts +2 -0
  63. package/es/schema-component/antd/calendar/utils.js +7 -0
  64. package/es/schema-component/antd/checkbox/Checkbox.js +13 -4
  65. package/es/schema-component/antd/formula-input/FormulaInput.js +28 -37
  66. package/es/schema-component/antd/input/Input.d.ts +1 -0
  67. package/es/schema-component/antd/input/Input.js +2 -0
  68. package/es/schema-component/antd/input/Json.d.ts +6 -0
  69. package/es/schema-component/antd/input/Json.js +41 -0
  70. package/es/schema-component/antd/input/ReadPretty.d.ts +3 -0
  71. package/es/schema-component/antd/input/ReadPretty.js +15 -0
  72. package/es/schema-component/antd/input/index.d.ts +1 -0
  73. package/es/schema-component/antd/input/index.js +2 -1
  74. package/es/schema-component/antd/markdown/Markdown.Void.js +5 -2
  75. package/es/schema-component/antd/radio/Radio.js +2 -1
  76. package/es/schema-component/antd/select/ReadPretty.js +2 -1
  77. package/es/schema-component/antd/table-v2/TableSelectorDesigner.js +16 -2
  78. package/es/schema-component/antd/upload/Upload.js +2 -1
  79. package/es/schema-component/antd/upload/shared.js +5 -6
  80. package/es/schema-component/antd/upload/type.d.ts +2 -0
  81. package/es/schema-initializer/buttons/BulkEditFormItemInitializers.d.ts +1 -0
  82. package/es/schema-initializer/buttons/BulkEditFormItemInitializers.js +50 -0
  83. package/es/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.d.ts +1 -0
  84. package/es/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.js +35 -0
  85. package/es/schema-initializer/buttons/FormActionInitializers.d.ts +132 -0
  86. package/es/schema-initializer/buttons/FormActionInitializers.js +118 -0
  87. package/es/schema-initializer/buttons/TabPaneInitializers.d.ts +1 -0
  88. package/es/schema-initializer/buttons/TabPaneInitializers.js +13 -0
  89. package/es/schema-initializer/buttons/TableActionInitializers.d.ts +56 -2
  90. package/es/schema-initializer/buttons/TableActionInitializers.js +45 -0
  91. package/es/schema-initializer/buttons/index.d.ts +2 -0
  92. package/es/schema-initializer/buttons/index.js +2 -0
  93. package/es/schema-initializer/components/BulkEditField.d.ts +7 -0
  94. package/es/schema-initializer/components/BulkEditField.js +187 -0
  95. package/es/schema-initializer/components/index.d.ts +1 -0
  96. package/es/schema-initializer/components/index.js +2 -1
  97. package/es/schema-initializer/items/BlockInitializer.js +8 -8
  98. package/es/schema-initializer/items/BulkEditSubmitActionInitializer.d.ts +1 -0
  99. package/es/schema-initializer/items/BulkEditSubmitActionInitializer.js +24 -0
  100. package/es/schema-initializer/items/CreateFormBulkEditBlockInitializer.d.ts +1 -0
  101. package/es/schema-initializer/items/CreateFormBulkEditBlockInitializer.js +103 -0
  102. package/es/schema-initializer/items/CustomizeBulkEditActionInitializer.d.ts +1 -0
  103. package/es/schema-initializer/items/CustomizeBulkEditActionInitializer.js +61 -0
  104. package/es/schema-initializer/items/index.d.ts +3 -0
  105. package/es/schema-initializer/items/index.js +3 -0
  106. package/es/schema-initializer/utils.d.ts +1 -0
  107. package/es/schema-initializer/utils.js +67 -12
  108. package/es/schema-settings/SchemaSettings.d.ts +6 -0
  109. package/es/schema-settings/SchemaSettings.js +4 -1
  110. package/es/schema-templates/BlockTemplatePage.d.ts +1 -0
  111. package/es/schema-templates/BlockTemplatePage.js +7 -0
  112. package/es/schema-templates/SchemaTemplateShortcut.js +1 -1
  113. package/es/system-settings/SystemSettingsShortcut.d.ts +2 -0
  114. package/es/system-settings/SystemSettingsShortcut.js +134 -5
  115. package/lib/acl/ACLShortcut.d.ts +2 -0
  116. package/lib/acl/ACLShortcut.js +41 -4
  117. package/lib/application/Application.d.ts +3 -1
  118. package/lib/application/Application.js +139 -39
  119. package/lib/block-provider/CalendarBlockProvider.d.ts +1 -0
  120. package/lib/block-provider/CalendarBlockProvider.js +6 -3
  121. package/lib/block-provider/TableSelectorProvider.js +21 -6
  122. package/lib/block-provider/hooks/index.d.ts +6 -0
  123. package/lib/block-provider/hooks/index.js +496 -115
  124. package/lib/collection-manager/CollectionManagerProvider.js +28 -47
  125. package/lib/collection-manager/CollectionManagerShortcut.d.ts +2 -0
  126. package/lib/collection-manager/CollectionManagerShortcut.js +47 -4
  127. package/lib/collection-manager/Configuration/AddFieldAction.d.ts +5 -1
  128. package/lib/collection-manager/Configuration/AddFieldAction.js +48 -12
  129. package/lib/collection-manager/Configuration/EditFieldAction.d.ts +1 -0
  130. package/lib/collection-manager/Configuration/EditFieldAction.js +26 -10
  131. package/lib/collection-manager/Configuration/index.d.ts +2 -0
  132. package/lib/collection-manager/Configuration/index.js +26 -0
  133. package/lib/collection-manager/Configuration/schemas/collectionFields.js +2 -2
  134. package/lib/collection-manager/index.d.ts +1 -0
  135. package/lib/collection-manager/index.js +14 -0
  136. package/lib/collection-manager/interfaces/index.d.ts +1 -0
  137. package/lib/collection-manager/interfaces/index.js +13 -0
  138. package/lib/collection-manager/interfaces/json.d.ts +2 -0
  139. package/lib/collection-manager/interfaces/json.js +58 -0
  140. package/lib/collection-manager/interfaces/m2o.js +2 -2
  141. package/lib/collection-manager/interfaces/o2m.js +4 -5
  142. package/lib/collection-manager/interfaces/o2o.js +4 -4
  143. package/lib/collection-manager/interfaces/properties/index.d.ts +14 -0
  144. package/lib/collection-manager/interfaces/properties/index.js +25 -1
  145. package/lib/collection-manager/interfaces/sequence.js +13 -9
  146. package/lib/index.d.ts +1 -0
  147. package/lib/index.js +13 -0
  148. package/lib/locale/en_US.d.ts +13 -1
  149. package/lib/locale/en_US.js +14 -2
  150. package/lib/locale/ja_JP.d.ts +1 -1
  151. package/lib/locale/ja_JP.js +1 -1
  152. package/lib/locale/ru_RU.d.ts +1 -1
  153. package/lib/locale/ru_RU.js +1 -1
  154. package/lib/locale/tr_TR.d.ts +1 -1
  155. package/lib/locale/tr_TR.js +1 -1
  156. package/lib/locale/zh_CN.d.ts +39 -1
  157. package/lib/locale/zh_CN.js +40 -2
  158. package/lib/plugin-manager/PluginManager.js +33 -21
  159. package/lib/pm/PluginManagerLink.d.ts +2 -0
  160. package/lib/pm/PluginManagerLink.js +138 -0
  161. package/lib/pm/index.d.ts +4 -0
  162. package/lib/pm/index.js +474 -0
  163. package/lib/route-switch/antd/admin-layout/index.js +1 -1
  164. package/lib/schema-component/antd/action/Action.Designer.js +35 -12
  165. package/lib/schema-component/antd/action/Action.Modal.js +4 -2
  166. package/lib/schema-component/antd/action/Action.js +3 -3
  167. package/lib/schema-component/antd/action/context.d.ts +2 -0
  168. package/lib/schema-component/antd/action/hooks.d.ts +1 -0
  169. package/lib/schema-component/antd/calendar/Calendar.Designer.js +19 -6
  170. package/lib/schema-component/antd/calendar/Calendar.js +24 -2
  171. package/lib/schema-component/antd/calendar/Title.js +18 -2
  172. package/lib/schema-component/antd/calendar/components/Header.d.ts +10 -0
  173. package/lib/schema-component/antd/calendar/components/Header.js +57 -0
  174. package/lib/schema-component/antd/calendar/style.less +53 -9
  175. package/lib/schema-component/antd/calendar/types.d.ts +6 -0
  176. package/lib/schema-component/antd/calendar/utils.d.ts +2 -0
  177. package/lib/schema-component/antd/calendar/utils.js +18 -2
  178. package/lib/schema-component/antd/checkbox/Checkbox.js +13 -4
  179. package/lib/schema-component/antd/formula-input/FormulaInput.js +28 -37
  180. package/lib/schema-component/antd/input/Input.d.ts +1 -0
  181. package/lib/schema-component/antd/input/Input.js +3 -0
  182. package/lib/schema-component/antd/input/Json.d.ts +6 -0
  183. package/lib/schema-component/antd/input/Json.js +53 -0
  184. package/lib/schema-component/antd/input/ReadPretty.d.ts +3 -0
  185. package/lib/schema-component/antd/input/ReadPretty.js +16 -0
  186. package/lib/schema-component/antd/input/index.d.ts +1 -0
  187. package/lib/schema-component/antd/input/index.js +13 -0
  188. package/lib/schema-component/antd/markdown/Markdown.Void.js +8 -2
  189. package/lib/schema-component/antd/radio/Radio.js +2 -1
  190. package/lib/schema-component/antd/select/ReadPretty.js +2 -1
  191. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +17 -2
  192. package/lib/schema-component/antd/upload/Upload.js +2 -1
  193. package/lib/schema-component/antd/upload/shared.js +4 -5
  194. package/lib/schema-component/antd/upload/type.d.ts +2 -0
  195. package/lib/schema-initializer/buttons/BulkEditFormItemInitializers.d.ts +1 -0
  196. package/lib/schema-initializer/buttons/BulkEditFormItemInitializers.js +66 -0
  197. package/lib/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.d.ts +1 -0
  198. package/lib/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.js +50 -0
  199. package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +132 -0
  200. package/lib/schema-initializer/buttons/FormActionInitializers.js +121 -2
  201. package/lib/schema-initializer/buttons/TabPaneInitializers.d.ts +1 -0
  202. package/lib/schema-initializer/buttons/TabPaneInitializers.js +18 -2
  203. package/lib/schema-initializer/buttons/TableActionInitializers.d.ts +56 -2
  204. package/lib/schema-initializer/buttons/TableActionInitializers.js +45 -0
  205. package/lib/schema-initializer/buttons/index.d.ts +2 -0
  206. package/lib/schema-initializer/buttons/index.js +26 -0
  207. package/lib/schema-initializer/components/BulkEditField.d.ts +7 -0
  208. package/lib/schema-initializer/components/BulkEditField.js +210 -0
  209. package/lib/schema-initializer/components/index.d.ts +1 -0
  210. package/lib/schema-initializer/components/index.js +13 -0
  211. package/lib/schema-initializer/items/BlockInitializer.js +8 -7
  212. package/lib/schema-initializer/items/BulkEditSubmitActionInitializer.d.ts +1 -0
  213. package/lib/schema-initializer/items/BulkEditSubmitActionInitializer.js +37 -0
  214. package/lib/schema-initializer/items/CreateFormBulkEditBlockInitializer.d.ts +1 -0
  215. package/lib/schema-initializer/items/CreateFormBulkEditBlockInitializer.js +121 -0
  216. package/lib/schema-initializer/items/CustomizeBulkEditActionInitializer.d.ts +1 -0
  217. package/lib/schema-initializer/items/CustomizeBulkEditActionInitializer.js +74 -0
  218. package/lib/schema-initializer/items/index.d.ts +3 -0
  219. package/lib/schema-initializer/items/index.js +39 -0
  220. package/lib/schema-initializer/utils.d.ts +1 -0
  221. package/lib/schema-initializer/utils.js +71 -13
  222. package/lib/schema-settings/SchemaSettings.d.ts +6 -0
  223. package/lib/schema-settings/SchemaSettings.js +3 -0
  224. package/lib/schema-templates/BlockTemplatePage.d.ts +1 -0
  225. package/lib/schema-templates/BlockTemplatePage.js +12 -2
  226. package/lib/schema-templates/SchemaTemplateShortcut.js +1 -1
  227. package/lib/system-settings/SystemSettingsShortcut.d.ts +2 -0
  228. package/lib/system-settings/SystemSettingsShortcut.js +145 -7
  229. package/package.json +5 -4
@@ -1,3 +1,7 @@
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
+
3
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
+
1
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
6
 
3
7
  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."); }
@@ -10,10 +14,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
14
 
11
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
16
 
13
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
14
-
15
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
16
-
17
17
  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; }
18
18
 
19
19
  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; }
@@ -31,40 +31,13 @@ export var CollectionManagerProvider = function CollectionManagerProvider(props)
31
31
  interfaces = props.interfaces,
32
32
  _props$collections = props.collections,
33
33
  collections = _props$collections === void 0 ? [] : _props$collections,
34
- _refreshCM = props.refreshCM;
34
+ refreshCM = props.refreshCM;
35
35
  return /*#__PURE__*/React.createElement(CollectionManagerContext.Provider, {
36
36
  value: {
37
37
  service: service,
38
38
  interfaces: _objectSpread(_objectSpread({}, defaultInterfaces), interfaces),
39
39
  collections: collections,
40
- refreshCM: function () {
41
- var _refreshCM2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
42
- return regeneratorRuntime.wrap(function _callee$(_context) {
43
- while (1) {
44
- switch (_context.prev = _context.next) {
45
- case 0:
46
- if (!_refreshCM) {
47
- _context.next = 3;
48
- break;
49
- }
50
-
51
- _context.next = 3;
52
- return _refreshCM();
53
-
54
- case 3:
55
- case "end":
56
- return _context.stop();
57
- }
58
- }
59
- }, _callee);
60
- }));
61
-
62
- function refreshCM() {
63
- return _refreshCM2.apply(this, arguments);
64
- }
65
-
66
- return refreshCM;
67
- }()
40
+ refreshCM: refreshCM
68
41
  }
69
42
  }, /*#__PURE__*/React.createElement(CollectionManagerSchemaComponentProvider, null, props.children));
70
43
  };
@@ -102,33 +75,41 @@ export var RemoteCollectionManagerProvider = function RemoteCollectionManagerPro
102
75
  }),
103
76
  collections: service === null || service === void 0 ? void 0 : (_service$data = service.data) === null || _service$data === void 0 ? void 0 : _service$data.data,
104
77
  refreshCM: function () {
105
- var _refreshCM3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
78
+ var _refreshCM = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(opts) {
106
79
  var _yield$api$request, data;
107
80
 
108
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
81
+ return regeneratorRuntime.wrap(function _callee$(_context) {
109
82
  while (1) {
110
- switch (_context2.prev = _context2.next) {
83
+ switch (_context.prev = _context.next) {
111
84
  case 0:
112
- setContentLoading(true);
113
- _context2.next = 3;
85
+ if (opts === null || opts === void 0 ? void 0 : opts.reload) {
86
+ setContentLoading(true);
87
+ }
88
+
89
+ _context.next = 3;
114
90
  return api.request(options);
115
91
 
116
92
  case 3:
117
- _yield$api$request = _context2.sent;
93
+ _yield$api$request = _context.sent;
118
94
  data = _yield$api$request.data;
119
95
  service.mutate(data);
120
- setContentLoading(false);
121
96
 
122
- case 7:
97
+ if (opts === null || opts === void 0 ? void 0 : opts.reload) {
98
+ setContentLoading(false);
99
+ }
100
+
101
+ return _context.abrupt("return", (data === null || data === void 0 ? void 0 : data.data) || []);
102
+
103
+ case 8:
123
104
  case "end":
124
- return _context2.stop();
105
+ return _context.stop();
125
106
  }
126
107
  }
127
- }, _callee2);
108
+ }, _callee);
128
109
  }));
129
110
 
130
- function refreshCM() {
131
- return _refreshCM3.apply(this, arguments);
111
+ function refreshCM(_x) {
112
+ return _refreshCM.apply(this, arguments);
132
113
  }
133
114
 
134
115
  return refreshCM;
@@ -1 +1,3 @@
1
+ export declare const CollectionManagerPane: () => JSX.Element;
1
2
  export declare const CollectionManagerShortcut: () => JSX.Element;
3
+ export declare const CollectionManagerShortcut2: () => JSX.Element;
@@ -14,11 +14,13 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
14
14
 
15
15
  import { DatabaseOutlined } from '@ant-design/icons';
16
16
  import { uid } from '@formily/shared';
17
+ import { Card } from 'antd';
17
18
  import React, { useState } from 'react';
18
19
  import { useTranslation } from 'react-i18next';
20
+ import { useHistory } from 'react-router-dom';
19
21
  import { PluginManager } from '../plugin-manager';
20
22
  import { ActionContext, SchemaComponent } from '../schema-component';
21
- import { AddFieldAction, ConfigurationTable, EditFieldAction } from './Configuration';
23
+ import { AddCollectionField, AddFieldAction, ConfigurationTable, EditFieldAction, EditCollectionField } from './Configuration';
22
24
  var schema = {
23
25
  type: 'object',
24
26
  properties: _defineProperty({}, uid(), {
@@ -32,14 +34,47 @@ var schema = {
32
34
  }
33
35
  })
34
36
  };
37
+ var schema2 = {
38
+ type: 'object',
39
+ properties: _defineProperty({}, uid(), {
40
+ 'x-component': 'ConfigurationTable'
41
+ })
42
+ };
43
+ export var CollectionManagerPane = function CollectionManagerPane() {
44
+ return /*#__PURE__*/React.createElement(Card, {
45
+ bordered: false
46
+ }, /*#__PURE__*/React.createElement(SchemaComponent, {
47
+ schema: schema2,
48
+ components: {
49
+ ConfigurationTable: ConfigurationTable,
50
+ AddFieldAction: AddFieldAction,
51
+ AddCollectionField: AddCollectionField,
52
+ EditFieldAction: EditFieldAction,
53
+ EditCollectionField: EditCollectionField
54
+ }
55
+ }));
56
+ };
35
57
  export var CollectionManagerShortcut = function CollectionManagerShortcut() {
58
+ var _useTranslation = useTranslation(),
59
+ t = _useTranslation.t;
60
+
61
+ var history = useHistory();
62
+ return /*#__PURE__*/React.createElement(PluginManager.Toolbar.Item, {
63
+ icon: /*#__PURE__*/React.createElement(DatabaseOutlined, null),
64
+ title: t('Collections & Fields'),
65
+ onClick: function onClick() {
66
+ history.push('/admin/settings/collection-manager/collections');
67
+ }
68
+ });
69
+ };
70
+ export var CollectionManagerShortcut2 = function CollectionManagerShortcut2() {
36
71
  var _useState = useState(false),
37
72
  _useState2 = _slicedToArray(_useState, 2),
38
73
  visible = _useState2[0],
39
74
  setVisible = _useState2[1];
40
75
 
41
- var _useTranslation = useTranslation(),
42
- t = _useTranslation.t;
76
+ var _useTranslation2 = useTranslation(),
77
+ t = _useTranslation2.t;
43
78
 
44
79
  return /*#__PURE__*/React.createElement(ActionContext.Provider, {
45
80
  value: {
@@ -1 +1,5 @@
1
- export declare const AddFieldAction: () => JSX.Element;
1
+ export declare const useCollectionFieldFormValues: () => {
2
+ getValues(): any;
3
+ };
4
+ export declare const AddCollectionField: (props: any) => JSX.Element;
5
+ export declare const AddFieldAction: (props: any) => JSX.Element;
@@ -29,9 +29,9 @@ import { cloneDeep } from 'lodash';
29
29
  import React, { useState } from 'react';
30
30
  import { useTranslation } from 'react-i18next';
31
31
  import { useRequest } from '../../api-client';
32
- import { useRecord } from '../../record-provider';
32
+ import { RecordProvider, useRecord } from '../../record-provider';
33
33
  import { ActionContext, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
34
- import { useCreateAction } from '../action-hooks';
34
+ import { useCancelAction, useCreateAction } from '../action-hooks';
35
35
  import { useCollectionManager } from '../hooks';
36
36
  import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
37
37
  import * as components from './components';
@@ -66,6 +66,9 @@ var getSchema = function getSchema(schema, record, compile) {
66
66
  properties: _defineProperty({}, uid(), {
67
67
  type: 'void',
68
68
  'x-component': 'Action.Drawer',
69
+ 'x-component-props': {
70
+ getContainer: '{{ getContainer }}'
71
+ },
69
72
  'x-decorator': 'Form',
70
73
  'x-decorator-props': {
71
74
  useValues: function useValues(options) {
@@ -94,7 +97,7 @@ var getSchema = function getSchema(schema, record, compile) {
94
97
  title: '{{ t("Cancel") }}',
95
98
  'x-component': 'Action',
96
99
  'x-component-props': {
97
- useAction: '{{ cm.useCancelAction }}'
100
+ useAction: '{{ useCancelAction }}'
98
101
  }
99
102
  },
100
103
  action2: {
@@ -112,6 +115,22 @@ var getSchema = function getSchema(schema, record, compile) {
112
115
  };
113
116
  };
114
117
 
118
+ export var useCollectionFieldFormValues = function useCollectionFieldFormValues() {
119
+ var form = useForm();
120
+ return {
121
+ getValues: function getValues() {
122
+ var values = cloneDeep(form.values);
123
+
124
+ if (values.autoCreateReverseField) {} else {
125
+ delete values.reverseField;
126
+ }
127
+
128
+ delete values.autoCreateReverseField;
129
+ return values;
130
+ }
131
+ };
132
+ };
133
+
115
134
  var useCreateCollectionField = function useCreateCollectionField() {
116
135
  var form = useForm();
117
136
 
@@ -121,9 +140,6 @@ var useCreateCollectionField = function useCreateCollectionField() {
121
140
  var _useCollectionManager = useCollectionManager(),
122
141
  refreshCM = _useCollectionManager.refreshCM;
123
142
 
124
- var _useRecord = useRecord(),
125
- title = _useRecord.title;
126
-
127
143
  var ctx = useActionContext();
128
144
 
129
145
  var _useResourceActionCon = useResourceActionContext(),
@@ -177,7 +193,18 @@ var useCreateCollectionField = function useCreateCollectionField() {
177
193
  };
178
194
  };
179
195
 
180
- export var AddFieldAction = function AddFieldAction() {
196
+ export var AddCollectionField = function AddCollectionField(props) {
197
+ var record = useRecord();
198
+ return /*#__PURE__*/React.createElement(AddFieldAction, _objectSpread({
199
+ item: record
200
+ }, props));
201
+ };
202
+ export var AddFieldAction = function AddFieldAction(props) {
203
+ var scope = props.scope,
204
+ getContainer = props.getContainer,
205
+ record = props.item,
206
+ children = props.children;
207
+
181
208
  var _useCollectionManager2 = useCollectionManager(),
182
209
  getInterface = _useCollectionManager2.getInterface;
183
210
 
@@ -196,13 +223,15 @@ export var AddFieldAction = function AddFieldAction() {
196
223
  var _useTranslation = useTranslation(),
197
224
  t = _useTranslation.t;
198
225
 
199
- var record = useRecord();
200
- return /*#__PURE__*/React.createElement(ActionContext.Provider, {
226
+ return /*#__PURE__*/React.createElement(RecordProvider, {
227
+ record: record
228
+ }, /*#__PURE__*/React.createElement(ActionContext.Provider, {
201
229
  value: {
202
230
  visible: visible,
203
231
  setVisible: setVisible
204
232
  }
205
233
  }, /*#__PURE__*/React.createElement(Dropdown, {
234
+ getPopupContainer: getContainer,
206
235
  overlay: /*#__PURE__*/React.createElement(Menu, {
207
236
  style: {
208
237
  maxHeight: '60vh',
@@ -225,7 +254,7 @@ export var AddFieldAction = function AddFieldAction() {
225
254
  }, compile(child.title));
226
255
  }));
227
256
  }))
228
- }, /*#__PURE__*/React.createElement(Button, {
257
+ }, children || /*#__PURE__*/React.createElement(Button, {
229
258
  icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
230
259
  type: 'primary'
231
260
  }, t('Add field'))), /*#__PURE__*/React.createElement(SchemaComponent, {
@@ -233,11 +262,13 @@ export var AddFieldAction = function AddFieldAction() {
233
262
  components: _objectSpread(_objectSpread({}, components), {}, {
234
263
  ArrayTable: ArrayTable
235
264
  }),
236
- scope: {
265
+ scope: _objectSpread({
266
+ getContainer: getContainer,
267
+ useCancelAction: useCancelAction,
237
268
  createOnly: true,
238
269
  useCreateCollectionField: useCreateCollectionField,
239
270
  record: record,
240
271
  showReverseFieldConfig: true
241
- }
242
- }));
272
+ }, scope)
273
+ })));
243
274
  };
@@ -1 +1,2 @@
1
+ export declare const EditCollectionField: (props: any) => JSX.Element;
1
2
  export declare const EditFieldAction: (props: any) => JSX.Element;
@@ -28,14 +28,14 @@ import set from 'lodash/set';
28
28
  import React, { useState } from 'react';
29
29
  import { useTranslation } from 'react-i18next';
30
30
  import { useAPIClient, useRequest } from '../../api-client';
31
- import { useRecord } from '../../record-provider';
31
+ import { useRecord, RecordProvider } from '../../record-provider';
32
32
  import { ActionContext, SchemaComponent, useActionContext, useCompile } from '../../schema-component';
33
- import { useUpdateAction } from '../action-hooks';
33
+ import { useCancelAction, useUpdateAction } from '../action-hooks';
34
34
  import { useCollectionManager } from '../hooks';
35
35
  import { useResourceActionContext, useResourceContext } from '../ResourceActionProvider';
36
36
  import * as components from './components';
37
37
 
38
- var getSchema = function getSchema(schema, record, compile) {
38
+ var getSchema = function getSchema(schema, record, compile, getContainer) {
39
39
  var _record$__parent;
40
40
 
41
41
  if (!schema) {
@@ -84,7 +84,7 @@ var getSchema = function getSchema(schema, record, compile) {
84
84
  title: '{{ t("Cancel") }}',
85
85
  'x-component': 'Action',
86
86
  'x-component-props': {
87
- useAction: '{{ cm.useCancelAction }}'
87
+ useAction: '{{ useCancelAction }}'
88
88
  }
89
89
  },
90
90
  action2: {
@@ -169,8 +169,17 @@ var useUpdateCollectionField = function useUpdateCollectionField() {
169
169
  };
170
170
  };
171
171
 
172
- export var EditFieldAction = function EditFieldAction(props) {
172
+ export var EditCollectionField = function EditCollectionField(props) {
173
173
  var record = useRecord();
174
+ return /*#__PURE__*/React.createElement(EditFieldAction, _objectSpread({
175
+ item: record
176
+ }, props));
177
+ };
178
+ export var EditFieldAction = function EditFieldAction(props) {
179
+ var scope = props.scope,
180
+ getContainer = props.getContainer,
181
+ record = props.item,
182
+ children = props.children;
174
183
 
175
184
  var _useCollectionManager2 = useCollectionManager(),
176
185
  getInterface = _useCollectionManager2.getInterface;
@@ -197,7 +206,9 @@ export var EditFieldAction = function EditFieldAction(props) {
197
206
  data = _useState6[0],
198
207
  setData = _useState6[1];
199
208
 
200
- return /*#__PURE__*/React.createElement(ActionContext.Provider, {
209
+ return /*#__PURE__*/React.createElement(RecordProvider, {
210
+ record: record
211
+ }, /*#__PURE__*/React.createElement(ActionContext.Provider, {
201
212
  value: {
202
213
  visible: visible,
203
214
  setVisible: setVisible
@@ -233,7 +244,7 @@ export var EditFieldAction = function EditFieldAction(props) {
233
244
 
234
245
  schema = getSchema(_objectSpread(_objectSpread({}, interfaceConf), {}, {
235
246
  default: defaultValues
236
- }), record, compile);
247
+ }), record, compile, getContainer);
237
248
  setSchema(schema);
238
249
  setVisible(true);
239
250
 
@@ -251,14 +262,16 @@ export var EditFieldAction = function EditFieldAction(props) {
251
262
 
252
263
  return onClick;
253
264
  }()
254
- }, t('Edit')), /*#__PURE__*/React.createElement(SchemaComponent, {
265
+ }, children || t('Edit')), /*#__PURE__*/React.createElement(SchemaComponent, {
255
266
  schema: schema,
256
267
  components: _objectSpread(_objectSpread({}, components), {}, {
257
268
  ArrayTable: ArrayTable
258
269
  }),
259
- scope: {
270
+ scope: _objectSpread({
271
+ getContainer: getContainer,
260
272
  useUpdateCollectionField: useUpdateCollectionField,
273
+ useCancelAction: useCancelAction,
261
274
  showReverseFieldConfig: !(data === null || data === void 0 ? void 0 : data.reverseField)
262
- }
263
- }));
275
+ }, scope)
276
+ })));
264
277
  };
@@ -1,3 +1,5 @@
1
1
  export * from './AddFieldAction';
2
2
  export * from './ConfigurationTable';
3
3
  export * from './EditFieldAction';
4
+ export * from './interfaces';
5
+ export * from './components';
@@ -2,6 +2,8 @@ import { registerValidateFormats } from '@formily/core';
2
2
  export * from './AddFieldAction';
3
3
  export * from './ConfigurationTable';
4
4
  export * from './EditFieldAction';
5
+ export * from './interfaces';
6
+ export * from './components';
5
7
  registerValidateFormats({
6
8
  uid: /^[A-Za-z0-9][A-Za-z0-9_-]*$/
7
9
  });
@@ -102,7 +102,7 @@ export var collectionFieldSchema = {
102
102
  create: {
103
103
  type: 'void',
104
104
  title: '{{ t("Add new") }}',
105
- 'x-component': 'AddFieldAction',
105
+ 'x-component': 'AddCollectionField',
106
106
  'x-component-props': {
107
107
  type: 'primary'
108
108
  }
@@ -170,7 +170,7 @@ export var collectionFieldSchema = {
170
170
  update: {
171
171
  type: 'void',
172
172
  title: '{{ t("Edit") }}',
173
- 'x-component': 'EditFieldAction',
173
+ 'x-component': 'EditCollectionField',
174
174
  'x-component-props': {
175
175
  type: 'primary'
176
176
  }
@@ -9,3 +9,4 @@ export * from './context';
9
9
  export * from './hooks';
10
10
  export * from './ResourceActionProvider';
11
11
  export * from './types';
12
+ export * from './Configuration';
@@ -8,4 +8,5 @@ export * from './CollectionProvider';
8
8
  export * from './context';
9
9
  export * from './hooks';
10
10
  export * from './ResourceActionProvider';
11
- export * from './types';
11
+ export * from './types';
12
+ export * from './Configuration';
@@ -12,6 +12,7 @@ export * from './icon';
12
12
  export * from './id';
13
13
  export * from './input';
14
14
  export * from './integer';
15
+ export * from './json';
15
16
  export * from './linkTo';
16
17
  export * from './m2m';
17
18
  export * from './m2o';
@@ -12,6 +12,7 @@ export * from './icon';
12
12
  export * from './id';
13
13
  export * from './input';
14
14
  export * from './integer';
15
+ export * from './json';
15
16
  export * from './linkTo';
16
17
  export * from './m2m';
17
18
  export * from './m2o';
@@ -0,0 +1,2 @@
1
+ import { IField } from './types';
2
+ export declare const json: IField;
@@ -0,0 +1,48 @@
1
+ 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; }
2
+
3
+ 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; }
4
+
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
+
7
+ import { defaultProps } from './properties';
8
+ import { registerValidateRules } from '@formily/core';
9
+ registerValidateRules({
10
+ json: function json(value) {
11
+ try {
12
+ JSON.parse(value);
13
+ return true;
14
+ } catch (error) {
15
+ return {
16
+ type: 'error',
17
+ message: error.message
18
+ };
19
+ }
20
+ }
21
+ });
22
+ export var json = {
23
+ name: 'json',
24
+ type: 'object',
25
+ group: 'advanced',
26
+ order: 3,
27
+ title: '{{t("JSON")}}',
28
+ sortable: true,
29
+ default: {
30
+ type: 'json',
31
+ // name,
32
+ uiSchema: {
33
+ type: 'object',
34
+ // title,
35
+ 'x-component': 'Input.JSON',
36
+ 'x-component-props': {
37
+ autoSize: {
38
+ minRows: 5 // maxRows: 20,
39
+
40
+ }
41
+ },
42
+ default: null
43
+ }
44
+ },
45
+ hasDefaultValue: true,
46
+ properties: _objectSpread({}, defaultProps),
47
+ filterable: {}
48
+ };
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
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
7
  import { cloneDeep } from 'lodash';
8
- import { recordPickerSelector, recordPickerViewer, relationshipType, reverseFieldProperties } from './properties';
8
+ import { constraintsProps, recordPickerSelector, recordPickerViewer, relationshipType, reverseFieldProperties } from './properties';
9
9
  export var m2o = {
10
10
  name: 'm2o',
11
11
  type: 'object',
@@ -115,7 +115,7 @@ export var m2o = {
115
115
  schema['x-component-props']['ellipsis'] = true;
116
116
  }
117
117
  },
118
- properties: _objectSpread({
118
+ properties: _objectSpread(_objectSpread({
119
119
  'uiSchema.title': {
120
120
  type: 'string',
121
121
  title: '{{t("Field display name")}}',
@@ -209,7 +209,7 @@ export var m2o = {
209
209
  }
210
210
  }
211
211
  }
212
- }, reverseFieldProperties),
212
+ }, constraintsProps), reverseFieldProperties),
213
213
  filterable: {
214
214
  nested: true,
215
215
  children: [// {
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
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
7
  import { cloneDeep } from 'lodash';
8
- import { recordPickerSelector, recordPickerViewer, relationshipType, reverseFieldProperties } from './properties';
8
+ import { constraintsProps, recordPickerSelector, recordPickerViewer, relationshipType, reverseFieldProperties } from './properties';
9
9
  export var o2m = {
10
10
  name: 'o2m',
11
11
  type: 'object',
@@ -92,9 +92,8 @@ export var o2m = {
92
92
  }
93
93
  };
94
94
  } else {
95
- schema['x-component'] = 'CollectionField';
96
- schema.type = 'array';
97
-
95
+ // schema['x-component'] = 'CollectionField';
96
+ // schema.type = 'array';
98
97
  if (block === 'Form') {
99
98
  schema['properties'] = {
100
99
  viewer: cloneDeep(recordPickerViewer),
@@ -127,7 +126,7 @@ export var o2m = {
127
126
  schema['x-component-props']['ellipsis'] = true;
128
127
  }
129
128
  },
130
- properties: _objectSpread({
129
+ properties: _objectSpread(_objectSpread({
131
130
  'uiSchema.title': {
132
131
  type: 'string',
133
132
  title: '{{t("Field display name")}}',
@@ -248,7 +247,7 @@ export var o2m = {
248
247
  }
249
248
  }
250
249
  }
251
- }, reverseFieldProperties),
250
+ }, constraintsProps), reverseFieldProperties),
252
251
  filterable: {
253
252
  nested: true,
254
253
  children: [// {
@@ -5,7 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
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
7
  import { cloneDeep } from 'lodash';
8
- import { recordPickerSelector, recordPickerViewer, relationshipType, reverseFieldProperties } from './properties';
8
+ import { constraintsProps, recordPickerSelector, recordPickerViewer, relationshipType, reverseFieldProperties } from './properties';
9
9
 
10
10
  var internalSchameInitialize = function internalSchameInitialize(schema, _ref) {
11
11
  var field = _ref.field,
@@ -310,7 +310,7 @@ export var oho = {
310
310
  schema['x-component-props']['ellipsis'] = true;
311
311
  }
312
312
  },
313
- properties: _objectSpread({
313
+ properties: _objectSpread(_objectSpread({
314
314
  'uiSchema.title': {
315
315
  type: 'string',
316
316
  title: '{{t("Field display name")}}',
@@ -403,7 +403,7 @@ export var oho = {
403
403
  }
404
404
  }
405
405
  }
406
- }, reverseFieldProperties),
406
+ }, constraintsProps), reverseFieldProperties),
407
407
  filterable: {
408
408
  nested: true,
409
409
  children: [// {
@@ -480,7 +480,7 @@ export var obo = {
480
480
  schema['x-component-props']['ellipsis'] = true;
481
481
  }
482
482
  },
483
- properties: _objectSpread({
483
+ properties: _objectSpread(_objectSpread({
484
484
  'uiSchema.title': {
485
485
  type: 'string',
486
486
  title: '{{t("Field display name")}}',
@@ -574,7 +574,7 @@ export var obo = {
574
574
  }
575
575
  }
576
576
  }
577
- }, reverseFieldProperties),
577
+ }, constraintsProps), reverseFieldProperties),
578
578
  filterable: {
579
579
  nested: true,
580
580
  children: [// {
@@ -8,6 +8,20 @@ export declare const unique: {
8
8
  'x-component': string;
9
9
  };
10
10
  export declare const relationshipType: ISchema;
11
+ export declare const constraintsProps: {
12
+ onDelete: {
13
+ type: string;
14
+ title: string;
15
+ required: boolean;
16
+ default: string;
17
+ 'x-decorator': string;
18
+ 'x-component': string;
19
+ enum: {
20
+ label: string;
21
+ value: string;
22
+ }[];
23
+ };
24
+ };
11
25
  export declare const reverseFieldProperties: Record<string, ISchema>;
12
26
  export declare const dateTimeProps: {
13
27
  [key: string]: ISchema;