@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
@@ -63,13 +63,8 @@ var AntdFormulaInput = function AntdFormulaInput(props) {
63
63
 
64
64
  var _useState3 = (0, _react2.useState)(null),
65
65
  _useState4 = _slicedToArray(_useState3, 2),
66
- formula = _useState4[0],
67
- setFormula = _useState4[1];
68
-
69
- var _useState5 = (0, _react2.useState)(null),
70
- _useState6 = _slicedToArray(_useState5, 2),
71
- html = _useState6[0],
72
- setHtml = _useState6[1];
66
+ html = _useState4[0],
67
+ setHtml = _useState4[1];
73
68
 
74
69
  var numColumns = new Map();
75
70
  var scope = {};
@@ -80,43 +75,38 @@ var AntdFormulaInput = function AntdFormulaInput(props) {
80
75
  scope[field.name] = 1;
81
76
  });
82
77
  var keys = Array.from(numColumns.keys());
83
- var initHtml;
84
-
85
- if (value) {
86
- initHtml = value;
87
- numColumns.forEach(function (value, key) {
88
- initHtml = initHtml.replaceAll(key, "<span contentEditable=\"false\" style=\"border: 1px solid #aaa; padding: 2px 5px;\">".concat(value, "</span>"));
89
- });
90
- }
91
-
92
78
  (0, _react2.useEffect)(function () {
93
- if (onChange && formula) {
94
- var v = formula || '';
79
+ if (value) {
80
+ var newHtml = value;
95
81
  numColumns.forEach(function (value, key) {
96
- v = v.replaceAll(value, key);
82
+ newHtml = newHtml.replaceAll(key, "<span contentEditable=\"false\" ><input disabled=\"disabled\" style=\"width:".concat(18 * value.length, "px;max-width: 120px\" value=\"").concat(value, "\"/><span hidden>").concat(key, "</span></span>"));
97
83
  });
84
+ newHtml = "".concat(newHtml, "<span style=\"padding-left: 5px\"></span>"); // set extra span for cursor focus on last position
98
85
 
99
- if (v != value) {
100
- onChange(v);
101
- }
86
+ setHtml(newHtml);
87
+ } else {
88
+ setHtml('');
102
89
  }
103
- }, [formula]);
90
+ }, [value]);
104
91
 
105
92
  var menu = /*#__PURE__*/_react2.default.createElement(_antd.Menu, {
106
93
  onClick: function () {
107
94
  var _onClick = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(args) {
108
- var replaceFormula, replaceHtml;
95
+ var replaceFormula;
109
96
  return regeneratorRuntime.wrap(function _callee$(_context) {
110
97
  while (1) {
111
98
  switch (_context.prev = _context.next) {
112
99
  case 0:
113
- replaceFormula = formula.replace('@', numColumns.get(args.key));
114
- replaceHtml = html.replace('@', "<span contentEditable=\"false\" style=\"border: 1px solid #aaa; padding: 2px 5px;\">".concat(numColumns.get(args.key), "</span>"));
115
- setFormula(replaceFormula);
116
- setHtml(replaceHtml);
100
+ replaceFormula = field.value.replace('@', args.key);
101
+
102
+ if (onChange && replaceFormula != field.value) {
103
+ onChange(replaceFormula);
104
+ }
105
+
117
106
  setDropdownVisible(false);
107
+ inputRef.current.focus();
118
108
 
119
- case 5:
109
+ case 4:
120
110
  case "end":
121
111
  return _context.stop();
122
112
  }
@@ -137,12 +127,12 @@ var AntdFormulaInput = function AntdFormulaInput(props) {
137
127
  }));
138
128
 
139
129
  var handleChange = function handleChange(e) {
140
- var current = inputRef.current;
141
- setFormula(e.currentTarget.textContent);
142
- setHtml(current.innerHTML);
143
-
144
- if (e.currentTarget.textContent == '' && onChange) {
145
- onChange(null);
130
+ if (onChange) {
131
+ if (e.currentTarget.textContent == '') {
132
+ onChange(null);
133
+ } else {
134
+ onChange(e.currentTarget.textContent);
135
+ }
146
136
  }
147
137
  };
148
138
 
@@ -170,7 +160,8 @@ var AntdFormulaInput = function AntdFormulaInput(props) {
170
160
  try {
171
161
  math.evaluate(field.value, scope);
172
162
  field.feedbacks = [];
173
- } catch (_unused) {
163
+ } catch (e) {
164
+ console.error(field.value, scope, e.message);
174
165
  field.setFeedback({
175
166
  type: 'error',
176
167
  code: 'FormulaError',
@@ -187,7 +178,7 @@ var AntdFormulaInput = function AntdFormulaInput(props) {
187
178
  className: "ant-input",
188
179
  onChange: handleChange,
189
180
  onKeyDown: handleKeyDown,
190
- html: html || initHtml || ''
181
+ html: html || ''
191
182
  }));
192
183
  };
193
184
 
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  declare type ComposedInput = React.FC<InputProps> & {
4
4
  TextArea?: React.FC<TextAreaProps>;
5
5
  URL?: React.FC<InputProps>;
6
+ JSON?: React.FC<TextAreaProps>;
6
7
  };
7
8
  export declare const Input: ComposedInput;
8
9
  export default Input;
@@ -15,6 +15,8 @@ var _react2 = _interopRequireDefault(require("react"));
15
15
 
16
16
  var _ReadPretty = require("./ReadPretty");
17
17
 
18
+ var _Json = require("./Json");
19
+
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
21
 
20
22
  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; }
@@ -38,5 +40,6 @@ Input.TextArea = (0, _react.connect)(_antd.Input.TextArea, (0, _react.mapProps)(
38
40
  }, props);
39
41
  }), (0, _react.mapReadPretty)(_ReadPretty.ReadPretty.TextArea));
40
42
  Input.URL = (0, _react.connect)(_antd.Input, (0, _react.mapReadPretty)(_ReadPretty.ReadPretty.URL));
43
+ Input.JSON = (0, _react.connect)(_Json.Json, (0, _react.mapReadPretty)(_ReadPretty.ReadPretty.JSON));
41
44
  var _default = Input;
42
45
  exports.default = _default;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { TextAreaProps } from 'antd/lib/input';
3
+ export declare function Json({ value, onChange, space, ...props }: TextAreaProps & {
4
+ value: any;
5
+ space: number;
6
+ }): JSX.Element;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Json = Json;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _react2 = require("@formily/react");
11
+
12
+ var _antd = require("antd");
13
+
14
+ var _excluded = ["value", "onChange", "space"];
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ 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; }
19
+
20
+ 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; }
21
+
22
+ 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; }
23
+
24
+ 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; }
25
+
26
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
27
+
28
+ function Json(_ref) {
29
+ var value = _ref.value,
30
+ _onChange = _ref.onChange,
31
+ _ref$space = _ref.space,
32
+ space = _ref$space === void 0 ? 2 : _ref$space,
33
+ props = _objectWithoutProperties(_ref, _excluded);
34
+
35
+ var field = (0, _react2.useField)();
36
+ return /*#__PURE__*/_react.default.createElement(_antd.Input.TextArea, _objectSpread(_objectSpread({}, props), {}, {
37
+ defaultValue: value != null ? JSON.stringify(value, null, space) : '',
38
+ onChange: function onChange(ev) {
39
+ try {
40
+ var v = ev.target.value.trim() !== '' ? JSON.parse(ev.target.value) : null;
41
+ field.setFeedback({});
42
+
43
+ _onChange(v);
44
+ } catch (err) {
45
+ field.setFeedback({
46
+ type: 'error',
47
+ code: 'JSONSyntaxError',
48
+ messages: [err.message]
49
+ });
50
+ }
51
+ }
52
+ }));
53
+ }
@@ -14,6 +14,9 @@ declare type Composed = {
14
14
  autop?: boolean;
15
15
  }>;
16
16
  Html?: any;
17
+ JSON?: React.FC<TextAreaProps & {
18
+ space: number;
19
+ }>;
17
20
  };
18
21
  export declare const ReadPretty: Composed;
19
22
  export {};
@@ -17,8 +17,14 @@ var _EllipsisWithTooltip = require("./EllipsisWithTooltip");
17
17
 
18
18
  var _shared = require("./shared");
19
19
 
20
+ var _css = require("@emotion/css");
21
+
22
+ var _templateObject;
23
+
20
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
25
 
26
+ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
27
+
22
28
  var ReadPretty = function ReadPretty() {
23
29
  return null;
24
30
  };
@@ -115,4 +121,14 @@ ReadPretty.URL = function (props) {
115
121
  className: (0, _classnames.default)(prefixCls, props.className),
116
122
  style: props.style
117
123
  }, props.addonBefore, props.prefix, content, props.suffix, props.addonAfter);
124
+ };
125
+
126
+ ReadPretty.JSON = function (props) {
127
+ var _props$space;
128
+
129
+ var prefixCls = (0, _builtins__.usePrefixCls)('json', props);
130
+ return /*#__PURE__*/_react.default.createElement("pre", {
131
+ className: (0, _css.cx)(prefixCls, props.className, (0, _css.css)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-bottom: 0;\n "])))),
132
+ style: props.style
133
+ }, props.value != null ? JSON.stringify(props.value, null, (_props$space = props.space) !== null && _props$space !== void 0 ? _props$space : 2) : '');
118
134
  };
@@ -1,2 +1,3 @@
1
1
  export * from './Input';
2
2
  export * from './ReadPretty';
3
+ export * from './Json';
@@ -28,4 +28,17 @@ Object.keys(_ReadPretty).forEach(function (key) {
28
28
  return _ReadPretty[key];
29
29
  }
30
30
  });
31
+ });
32
+
33
+ var _Json = require("./Json");
34
+
35
+ Object.keys(_Json).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _Json[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _Json[key];
42
+ }
43
+ });
31
44
  });
@@ -11,6 +11,8 @@ var _react = require("@formily/react");
11
11
 
12
12
  var _antd = require("antd");
13
13
 
14
+ var _classnames = _interopRequireDefault(require("classnames"));
15
+
14
16
  var _react2 = _interopRequireWildcard(require("react"));
15
17
 
16
18
  var _reactI18next = require("react-i18next");
@@ -25,6 +27,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
25
27
 
26
28
  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; }
27
29
 
30
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
+
28
32
  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); } }
29
33
 
30
34
  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); }); }; }
@@ -93,7 +97,8 @@ var MarkdownEditor = function MarkdownEditor(props) {
93
97
  };
94
98
 
95
99
  var MarkdownVoid = (0, _react.observer)(function (props) {
96
- var content = props.content;
100
+ var content = props.content,
101
+ className = props.className;
97
102
  var field = (0, _react.useField)();
98
103
  var schema = (0, _react.useFieldSchema)();
99
104
 
@@ -103,6 +108,7 @@ var MarkdownVoid = (0, _react.observer)(function (props) {
103
108
  var onSave = props.onSave,
104
109
  _onCancel = props.onCancel;
105
110
  return (field === null || field === void 0 ? void 0 : field.editable) ? /*#__PURE__*/_react2.default.createElement(MarkdownEditor, _objectSpread(_objectSpread({}, props), {}, {
111
+ className: true,
106
112
  defaultValue: content,
107
113
  onCancel: function onCancel() {
108
114
  field.editable = false;
@@ -145,7 +151,7 @@ var MarkdownVoid = (0, _react.observer)(function (props) {
145
151
  return onSubmit;
146
152
  }()
147
153
  })) : /*#__PURE__*/_react2.default.createElement("div", {
148
- className: 'nb-markdown',
154
+ className: (0, _classnames.default)(['nb-markdown', className]),
149
155
  dangerouslySetInnerHTML: {
150
156
  __html: (0, _util.markdown)(content)
151
157
  }
@@ -38,7 +38,8 @@ Radio.Group = (0, _react.connect)(_antd.Radio.Group, (0, _react.mapProps)({
38
38
  }).map(function (option, key) {
39
39
  return /*#__PURE__*/_react2.default.createElement(_antd.Tag, {
40
40
  key: key,
41
- color: option.color
41
+ color: option.color,
42
+ icon: option.icon
42
43
  }, option.label);
43
44
  }));
44
45
  }));
@@ -45,7 +45,8 @@ var ReadPretty = (0, _react.observer)(function (props) {
45
45
  return /*#__PURE__*/_react2.default.createElement("div", null, options.map(function (option, key) {
46
46
  return /*#__PURE__*/_react2.default.createElement(_antd.Tag, {
47
47
  key: key,
48
- color: option[fieldNames.color]
48
+ color: option[fieldNames.color],
49
+ icon: option.icon
49
50
  }, option[fieldNames.label]);
50
51
  }));
51
52
  });
@@ -25,6 +25,8 @@ var _schemaTemplates = require("../../../schema-templates");
25
25
 
26
26
  var _hooks = require("../../hooks");
27
27
 
28
+ var _lodash = require("lodash");
29
+
28
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
31
 
30
32
  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; }
@@ -46,7 +48,8 @@ var TableSelectorDesigner = function TableSelectorDesigner() {
46
48
  var sortFields = (0, _actionHooks.useSortFields)(name);
47
49
 
48
50
  var _useTableSelectorCont = (0, _blockProvider.useTableSelectorContext)(),
49
- service = _useTableSelectorCont.service;
51
+ service = _useTableSelectorCont.service,
52
+ extraFilter = _useTableSelectorCont.extraFilter;
50
53
 
51
54
  var _useTranslation = (0, _reactI18next.useTranslation)(),
52
55
  t = _useTranslation.t;
@@ -94,8 +97,20 @@ var TableSelectorDesigner = function TableSelectorDesigner() {
94
97
  params.filter = filter;
95
98
  field.decoratorProps.params = params;
96
99
  fieldSchema['x-decorator-props']['params'] = params;
100
+ var serviceFilter = (0, _lodash.cloneDeep)(filter);
101
+
102
+ if (extraFilter) {
103
+ if (serviceFilter) {
104
+ serviceFilter = {
105
+ $and: [extraFilter, serviceFilter]
106
+ };
107
+ } else {
108
+ serviceFilter = extraFilter;
109
+ }
110
+ }
111
+
97
112
  service.run(_objectSpread(_objectSpread({}, (_service$params = service.params) === null || _service$params === void 0 ? void 0 : _service$params[0]), {}, {
98
- filter: filter,
113
+ filter: serviceFilter,
99
114
  page: 1
100
115
  }));
101
116
  dn.emit('patch', {
@@ -262,9 +262,10 @@ Upload.Attachment = (0, _react.connect)(function (props) {
262
262
  }));
263
263
  }, (0, _react.mapReadPretty)(_ReadPretty.ReadPretty.Attachment));
264
264
  Upload.Dragger = (0, _react.connect)(function (props) {
265
+ var tipContent = props.tipContent;
265
266
  return /*#__PURE__*/_react2.default.createElement("div", {
266
267
  className: (0, _builtins__.usePrefixCls)('upload-dragger')
267
- }, /*#__PURE__*/_react2.default.createElement(_antd.Upload.Dragger, _objectSpread({}, (0, _shared.useUploadProps)(props))));
268
+ }, /*#__PURE__*/_react2.default.createElement(_antd.Upload.Dragger, _objectSpread({}, (0, _shared.useUploadProps)(props)), tipContent, props.children));
268
269
  }, (0, _react.mapProps)({
269
270
  value: 'fileList'
270
271
  }));
@@ -251,9 +251,11 @@ function useUploadProps(_ref) {
251
251
  (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, normalizeFileList(_toConsumableArray(param.fileList)));
252
252
  };
253
253
 
254
- var form = (0, _react.useForm)();
255
254
  var api = (0, _apiClient.useAPIClient)();
256
255
  return _objectSpread(_objectSpread({}, props), {}, {
256
+ // in customRequest method can't modify form's status(e.g: form.disabled=true )
257
+ // that will be trigger Upload component(actual Underlying is AjaxUploader component )'s componentWillUnmount method
258
+ // which will cause multiple files upload fail
257
259
  customRequest: function customRequest(_ref2) {
258
260
  var action = _ref2.action,
259
261
  data = _ref2.data,
@@ -273,7 +275,6 @@ function useUploadProps(_ref) {
273
275
  }
274
276
 
275
277
  formData.append(filename, file);
276
- form.disabled = true;
277
278
  api.axios.post(action, formData, {
278
279
  withCredentials: withCredentials,
279
280
  headers: headers,
@@ -287,9 +288,7 @@ function useUploadProps(_ref) {
287
288
  }).then(function (_ref4) {
288
289
  var data = _ref4.data;
289
290
  onSuccess(data, file);
290
- }).catch(onError).finally(function () {
291
- form.disabled = false;
292
- });
291
+ }).catch(onError).finally(function () {});
293
292
  return {
294
293
  abort: function abort() {
295
294
  console.log('upload progress is aborted.');
@@ -12,6 +12,8 @@ export type UploadProps = Omit<AntdUploadProps, 'onChange'> & {
12
12
  export type DraggerProps = Omit<AntdDraggerProps, 'onChange'> & {
13
13
  onChange?: (fileList: UploadFile[]) => void;
14
14
  serviceErrorMessage?: string;
15
+ tipContent?: string | React.ReactNode;
16
+ children?: React.ReactNode;
15
17
  };
16
18
 
17
19
  export type ComposedUpload = React.FC<UploadProps> & {
@@ -0,0 +1 @@
1
+ export declare const BulkEditFormItemInitializers: (props: any) => JSX.Element;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BulkEditFormItemInitializers = void 0;
7
+
8
+ var _lodash = require("lodash");
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _reactI18next = require("react-i18next");
13
+
14
+ var _SchemaInitializer = require("../SchemaInitializer");
15
+
16
+ var _utils = require("../utils");
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ var BulkEditFormItemInitializers = function BulkEditFormItemInitializers(props) {
21
+ var _useTranslation = (0, _reactI18next.useTranslation)(),
22
+ t = _useTranslation.t;
23
+
24
+ var insertPosition = props.insertPosition,
25
+ component = props.component;
26
+ var associationFields = (0, _utils.useAssociatedFormItemInitializerFields)({
27
+ readPretty: true,
28
+ block: 'Form'
29
+ });
30
+ return /*#__PURE__*/_react.default.createElement(_SchemaInitializer.SchemaInitializer.Button, {
31
+ wrap: _utils.gridRowColWrap,
32
+ icon: 'SettingOutlined',
33
+ items: (0, _lodash.union)([{
34
+ type: 'itemGroup',
35
+ title: t('Display fields'),
36
+ children: (0, _utils.useCustomBulkEditFormItemInitializerFields)()
37
+ }], associationFields.length > 0 ? [{
38
+ type: 'divider'
39
+ }, {
40
+ type: 'itemGroup',
41
+ title: t('Display association fields'),
42
+ children: associationFields
43
+ }] : [], [{
44
+ type: 'divider'
45
+ }, {
46
+ type: 'item',
47
+ title: t('Add text'),
48
+ component: 'BlockInitializer',
49
+ schema: {
50
+ type: 'void',
51
+ 'x-editable': false,
52
+ 'x-decorator': 'FormItem',
53
+ 'x-designer': 'Markdown.Void.Designer',
54
+ 'x-component': 'Markdown.Void',
55
+ 'x-component-props': {
56
+ content: t('This is a demo text, **supports Markdown syntax**.')
57
+ }
58
+ }
59
+ }]),
60
+ insertPosition: insertPosition,
61
+ component: component,
62
+ title: component ? null : t('Configure fields')
63
+ });
64
+ };
65
+
66
+ exports.BulkEditFormItemInitializers = BulkEditFormItemInitializers;
@@ -0,0 +1 @@
1
+ export declare const CreateFormBulkEditBlockInitializers: (props: any) => JSX.Element;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CreateFormBulkEditBlockInitializers = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _reactI18next = require("react-i18next");
11
+
12
+ var _ = require("../..");
13
+
14
+ var _utils = require("../utils");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ var CreateFormBulkEditBlockInitializers = function CreateFormBulkEditBlockInitializers(props) {
19
+ var _useTranslation = (0, _reactI18next.useTranslation)(),
20
+ t = _useTranslation.t;
21
+
22
+ var insertPosition = props.insertPosition,
23
+ component = props.component;
24
+ return /*#__PURE__*/_react.default.createElement(_.SchemaInitializer.Button, {
25
+ wrap: _utils.gridRowColWrap,
26
+ title: component ? null : t('Add block'),
27
+ icon: 'PlusOutlined',
28
+ insertPosition: insertPosition,
29
+ component: component,
30
+ items: [{
31
+ type: 'itemGroup',
32
+ title: '{{t("Data blocks")}}',
33
+ children: [{
34
+ type: 'item',
35
+ title: '{{t("Form")}}',
36
+ component: 'CreateFormBulkEditBlockInitializer'
37
+ }]
38
+ }, {
39
+ type: 'itemGroup',
40
+ title: '{{t("Other blocks")}}',
41
+ children: [{
42
+ type: 'item',
43
+ title: '{{t("Markdown")}}',
44
+ component: 'MarkdownBlockInitializer'
45
+ }]
46
+ }]
47
+ });
48
+ };
49
+
50
+ exports.CreateFormBulkEditBlockInitializers = CreateFormBulkEditBlockInitializers;