@nocobase/client 0.7.0-alpha.78 → 0.7.0-alpha.81

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 (35) hide show
  1. package/LICENSE +201 -0
  2. package/es/collection-manager/Configuration/schemas/collections.js +2 -2
  3. package/es/collection-manager/interfaces/linkTo.js +4 -1
  4. package/es/collection-manager/interfaces/properties/index.js +4 -4
  5. package/es/locale/en_US.d.ts +3 -0
  6. package/es/locale/en_US.js +4 -1
  7. package/es/locale/index.d.ts +7 -0
  8. package/es/locale/zh_CN.d.ts +4 -0
  9. package/es/locale/zh_CN.js +5 -1
  10. package/es/route-switch/antd/admin-layout/index.js +4 -0
  11. package/es/schema-component/antd/action/Action.Designer.js +24 -3
  12. package/es/schema-component/hooks/useDesignable.js +9 -0
  13. package/es/schema-settings/SchemaSettings.js +1 -6
  14. package/lib/collection-manager/Configuration/schemas/collections.js +2 -2
  15. package/lib/collection-manager/interfaces/linkTo.js +4 -1
  16. package/lib/collection-manager/interfaces/properties/index.js +4 -4
  17. package/lib/locale/en_US.d.ts +3 -0
  18. package/lib/locale/en_US.js +4 -1
  19. package/lib/locale/index.d.ts +7 -0
  20. package/lib/locale/zh_CN.d.ts +4 -0
  21. package/lib/locale/zh_CN.js +5 -1
  22. package/lib/route-switch/antd/admin-layout/index.js +4 -0
  23. package/lib/schema-component/antd/action/Action.Designer.js +24 -3
  24. package/lib/schema-component/hooks/useDesignable.js +10 -0
  25. package/lib/schema-settings/SchemaSettings.js +1 -6
  26. package/package.json +3 -3
  27. package/src/collection-manager/Configuration/schemas/collections.ts +1 -1
  28. package/src/collection-manager/interfaces/linkTo.ts +3 -0
  29. package/src/collection-manager/interfaces/properties/index.ts +4 -4
  30. package/src/locale/en_US.ts +3 -0
  31. package/src/locale/zh_CN.ts +4 -0
  32. package/src/route-switch/antd/admin-layout/index.tsx +3 -0
  33. package/src/schema-component/antd/action/Action.Designer.tsx +20 -1
  34. package/src/schema-component/hooks/useDesignable.tsx +9 -0
  35. package/src/schema-settings/SchemaSettings.tsx +3 -7
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -20,8 +20,8 @@ var collection = {
20
20
  uiSchema: {
21
21
  title: '{{ t("Collection name") }}',
22
22
  type: 'string',
23
- 'x-component': 'Input' // description: '使用英文',
24
-
23
+ 'x-component': 'Input',
24
+ description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'
25
25
  }
26
26
  }, {
27
27
  type: 'hasMany',
@@ -99,7 +99,10 @@ export var linkTo = {
99
99
  'x-disabled': '{{ !createOnly }}',
100
100
  'x-reactions': ['{{useAsyncDataSource(loadCollections)}}'],
101
101
  'x-decorator': 'FormItem',
102
- 'x-component': 'Select'
102
+ 'x-component': 'Select',
103
+ 'x-component-props': {
104
+ placeholder: '{{t("Leave it blank, unless you need a custom intermediate table")}}'
105
+ }
103
106
  },
104
107
  // 'reverseField.uiSchema.title': {
105
108
  // type: 'string',
@@ -44,16 +44,16 @@ export var type = {
44
44
  label: 'Password',
45
45
  value: 'password'
46
46
  }, {
47
- label: 'HasOne',
47
+ label: 'One to one',
48
48
  value: 'hasOne'
49
49
  }, {
50
- label: 'HasMany',
50
+ label: 'One to many',
51
51
  value: 'hasMany'
52
52
  }, {
53
- label: 'BelongsTo',
53
+ label: 'Many to one',
54
54
  value: 'belongsTo'
55
55
  }, {
56
- label: 'BelongsToMany',
56
+ label: 'Many to many',
57
57
  value: 'belongsToMany'
58
58
  }]
59
59
  };
@@ -275,5 +275,8 @@ declare const _default: {
275
275
  'After successful update': string;
276
276
  'Save record': string;
277
277
  'After successful save': string;
278
+ 'Button background color': string;
279
+ Highlight: string;
280
+ 'Danger red': string;
278
281
  };
279
282
  export default _default;
@@ -275,5 +275,8 @@ export default {
275
275
  'Manually close': 'Manually close',
276
276
  'After successful update': 'After successful update',
277
277
  'Save record': 'Save record',
278
- 'After successful save': 'After successful save'
278
+ 'After successful save': 'After successful save',
279
+ 'Button background color': 'Button background color',
280
+ 'Highlight': 'Highlight',
281
+ 'Danger red': 'Danger red'
279
282
  };
@@ -277,6 +277,9 @@ export declare const resources: {
277
277
  'After successful update': string;
278
278
  'Save record': string;
279
279
  'After successful save': string;
280
+ 'Button background color': string;
281
+ Highlight: string;
282
+ 'Danger red': string;
280
283
  };
281
284
  };
282
285
  'zh-CN': {
@@ -606,6 +609,7 @@ export declare const resources: {
606
609
  Accept: string;
607
610
  'Rich Text': string;
608
611
  'Junction collection': string;
612
+ 'Leave it blank, unless you need a custom intermediate table': string;
609
613
  Fields: string;
610
614
  'Edit field title': string;
611
615
  'Field title': string;
@@ -740,6 +744,9 @@ export declare const resources: {
740
744
  'After successful save': string;
741
745
  'After clicking the custom button, the following field values will be assigned according to the following form.': string;
742
746
  'After clicking the custom button, the following fields of the current record will be saved according to the following form.': string;
747
+ 'Button background color': string;
748
+ Highlight: string;
749
+ 'Danger red': string;
743
750
  };
744
751
  };
745
752
  };
@@ -324,6 +324,7 @@ declare const _default: {
324
324
  Accept: string;
325
325
  'Rich Text': string;
326
326
  'Junction collection': string;
327
+ 'Leave it blank, unless you need a custom intermediate table': string;
327
328
  Fields: string;
328
329
  'Edit field title': string;
329
330
  'Field title': string;
@@ -458,5 +459,8 @@ declare const _default: {
458
459
  'After successful save': string;
459
460
  'After clicking the custom button, the following field values will be assigned according to the following form.': string;
460
461
  'After clicking the custom button, the following fields of the current record will be saved according to the following form.': string;
462
+ 'Button background color': string;
463
+ Highlight: string;
464
+ 'Danger red': string;
461
465
  };
462
466
  export default _default;
@@ -324,6 +324,7 @@ export default {
324
324
  'Accept': '文件格式',
325
325
  'Rich Text': '富文本',
326
326
  'Junction collection': '中间表',
327
+ 'Leave it blank, unless you need a custom intermediate table': '默认留空,除非你需要一个自定义的中间表',
327
328
  'Fields': '字段',
328
329
  'Edit field title': '编辑字段标题',
329
330
  'Field title': '字段标题',
@@ -458,5 +459,8 @@ export default {
458
459
  'Updated successfully': '更新成功',
459
460
  'After successful save': '保存成功后',
460
461
  'After clicking the custom button, the following field values will be assigned according to the following form.': '点击当前自定义按钮时,以下字段值将按照以下表单赋值。',
461
- 'After clicking the custom button, the following fields of the current record will be saved according to the following form.': '点击当前自定义按钮时,当前数据以下字段将按照以下表单保存。'
462
+ 'After clicking the custom button, the following fields of the current record will be saved according to the following form.': '点击当前自定义按钮时,当前数据以下字段将按照以下表单保存。',
463
+ 'Button background color': '按钮颜色',
464
+ 'Highlight': '高亮',
465
+ 'Danger red': '红色'
462
466
  };
@@ -38,6 +38,10 @@ var filterByACL = function filterByACL(schema, options) {
38
38
  if (element['x-uid'] && !allowMenuItemIds.includes(element['x-uid'])) {
39
39
  delete s.properties[key];
40
40
  }
41
+
42
+ if (element['x-uid']) {
43
+ filterSchema(element);
44
+ }
41
45
  }
42
46
  }
43
47
  };
@@ -54,7 +54,7 @@ var MenuGroup = function MenuGroup(props) {
54
54
  };
55
55
 
56
56
  export var ActionDesigner = function ActionDesigner(props) {
57
- var _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xAction, _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5, _fieldSchema$xAction6, _fieldSchema$xAction7;
57
+ var _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xAction, _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5, _fieldSchema$xAction6, _fieldSchema$xAction7;
58
58
 
59
59
  var modalTip = props.modalTip,
60
60
  restProps = _objectWithoutProperties(props, _excluded);
@@ -115,12 +115,29 @@ export var ActionDesigner = function ActionDesigner(props) {
115
115
  default: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.icon,
116
116
  'x-component-props': {} // description: `原字段标题:${collectionField?.uiSchema?.title}`,
117
117
 
118
+ },
119
+ type: {
120
+ 'x-decorator': 'FormItem',
121
+ 'x-component': 'Radio.Group',
122
+ title: t('Button background color'),
123
+ default: (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.danger) ? 'danger' : (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : _fieldSchema$xCompon3.type) === 'primary' ? 'primary' : 'default',
124
+ enum: [{
125
+ value: 'default',
126
+ label: '{{t("Default")}}'
127
+ }, {
128
+ value: 'primary',
129
+ label: '{{t("Highlight")}}'
130
+ }, {
131
+ value: 'danger',
132
+ label: '{{t("Danger red")}}'
133
+ }]
118
134
  }
119
135
  }
120
136
  },
121
137
  onSubmit: function onSubmit(_ref) {
122
138
  var title = _ref.title,
123
- icon = _ref.icon;
139
+ icon = _ref.icon,
140
+ type = _ref.type;
124
141
 
125
142
  if (title) {
126
143
  var _schema;
@@ -128,8 +145,12 @@ export var ActionDesigner = function ActionDesigner(props) {
128
145
  fieldSchema.title = title;
129
146
  field.title = title;
130
147
  field.componentProps.icon = icon;
148
+ field.componentProps.danger = type === 'danger';
149
+ field.componentProps.type = type;
131
150
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
132
151
  fieldSchema['x-component-props'].icon = icon;
152
+ fieldSchema['x-component-props'].danger = type === 'danger';
153
+ fieldSchema['x-component-props'].type = type;
133
154
  dn.emit('patch', {
134
155
  schema: (_schema = {}, _defineProperty(_schema, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema, "title", title), _defineProperty(_schema, 'x-component-props', _objectSpread({}, fieldSchema['x-component-props'])), _schema)
135
156
  });
@@ -145,7 +166,7 @@ export var ActionDesigner = function ActionDesigner(props) {
145
166
  label: t('Dialog'),
146
167
  value: 'modal'
147
168
  }],
148
- value: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2['openMode'],
169
+ value: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4['openMode'],
149
170
  onChange: function onChange(value) {
150
171
  field.componentProps.openMode = value;
151
172
  fieldSchema['x-component-props']['openMode'] = value;
@@ -37,6 +37,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
37
37
  import { Schema, SchemaOptionsContext, useField, useFieldSchema } from '@formily/react';
38
38
  import { uid } from '@formily/shared';
39
39
  import { message } from 'antd';
40
+ import cloneDeep from 'lodash/cloneDeep';
40
41
  import get from 'lodash/get';
41
42
  import set from 'lodash/set';
42
43
  import React, { useContext } from 'react';
@@ -529,6 +530,8 @@ export var Designable = /*#__PURE__*/function () {
529
530
  breakRemoveOn: breakRemoveOn
530
531
  });
531
532
  }
533
+ } else if (schema) {
534
+ schema = cloneDeep(schema);
532
535
  }
533
536
 
534
537
  var properties = {};
@@ -609,6 +612,8 @@ export var Designable = /*#__PURE__*/function () {
609
612
  breakRemoveOn: breakRemoveOn
610
613
  });
611
614
  }
615
+ } else if (schema) {
616
+ schema = cloneDeep(schema);
612
617
  }
613
618
 
614
619
  var properties = {};
@@ -677,6 +682,8 @@ export var Designable = /*#__PURE__*/function () {
677
682
  breakRemoveOn: breakRemoveOn
678
683
  });
679
684
  }
685
+ } else if (schema) {
686
+ schema = cloneDeep(schema);
680
687
  }
681
688
 
682
689
  this.prepareProperty(schema);
@@ -736,6 +743,8 @@ export var Designable = /*#__PURE__*/function () {
736
743
  }
737
744
 
738
745
  schema.parent = null;
746
+ } else if (schema) {
747
+ schema = cloneDeep(schema);
739
748
  }
740
749
 
741
750
  var order = 0;
@@ -728,12 +728,7 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/React.memo(function (props) {
728
728
  };
729
729
  }();
730
730
 
731
- return /*#__PURE__*/React.createElement("div", {
732
- onClick: function onClick(e) {
733
- e.preventDefault();
734
- e.stopPropagation();
735
- }
736
- }, /*#__PURE__*/React.createElement(SchemaSettings.Item, _objectSpread(_objectSpread({}, others), {}, {
731
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SchemaSettings.Item, _objectSpread(_objectSpread({}, others), {}, {
737
732
  onClick: openAssignedFieldValueHandler
738
733
  }), props.children || props.title), /*#__PURE__*/React.createElement(Modal, _objectSpread(_objectSpread({
739
734
  width: '50%',
@@ -28,8 +28,8 @@ var collection = {
28
28
  uiSchema: {
29
29
  title: '{{ t("Collection name") }}',
30
30
  type: 'string',
31
- 'x-component': 'Input' // description: '使用英文',
32
-
31
+ 'x-component': 'Input',
32
+ description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'
33
33
  }
34
34
  }, {
35
35
  type: 'hasMany',
@@ -109,7 +109,10 @@ var linkTo = {
109
109
  'x-disabled': '{{ !createOnly }}',
110
110
  'x-reactions': ['{{useAsyncDataSource(loadCollections)}}'],
111
111
  'x-decorator': 'FormItem',
112
- 'x-component': 'Select'
112
+ 'x-component': 'Select',
113
+ 'x-component-props': {
114
+ placeholder: '{{t("Leave it blank, unless you need a custom intermediate table")}}'
115
+ }
113
116
  },
114
117
  // 'reverseField.uiSchema.title': {
115
118
  // type: 'string',
@@ -59,16 +59,16 @@ var type = {
59
59
  label: 'Password',
60
60
  value: 'password'
61
61
  }, {
62
- label: 'HasOne',
62
+ label: 'One to one',
63
63
  value: 'hasOne'
64
64
  }, {
65
- label: 'HasMany',
65
+ label: 'One to many',
66
66
  value: 'hasMany'
67
67
  }, {
68
- label: 'BelongsTo',
68
+ label: 'Many to one',
69
69
  value: 'belongsTo'
70
70
  }, {
71
- label: 'BelongsToMany',
71
+ label: 'Many to many',
72
72
  value: 'belongsToMany'
73
73
  }]
74
74
  };
@@ -275,5 +275,8 @@ declare const _default: {
275
275
  'After successful update': string;
276
276
  'Save record': string;
277
277
  'After successful save': string;
278
+ 'Button background color': string;
279
+ Highlight: string;
280
+ 'Danger red': string;
278
281
  };
279
282
  export default _default;
@@ -281,6 +281,9 @@ var _default = {
281
281
  'Manually close': 'Manually close',
282
282
  'After successful update': 'After successful update',
283
283
  'Save record': 'Save record',
284
- 'After successful save': 'After successful save'
284
+ 'After successful save': 'After successful save',
285
+ 'Button background color': 'Button background color',
286
+ 'Highlight': 'Highlight',
287
+ 'Danger red': 'Danger red'
285
288
  };
286
289
  exports.default = _default;
@@ -277,6 +277,9 @@ export declare const resources: {
277
277
  'After successful update': string;
278
278
  'Save record': string;
279
279
  'After successful save': string;
280
+ 'Button background color': string;
281
+ Highlight: string;
282
+ 'Danger red': string;
280
283
  };
281
284
  };
282
285
  'zh-CN': {
@@ -606,6 +609,7 @@ export declare const resources: {
606
609
  Accept: string;
607
610
  'Rich Text': string;
608
611
  'Junction collection': string;
612
+ 'Leave it blank, unless you need a custom intermediate table': string;
609
613
  Fields: string;
610
614
  'Edit field title': string;
611
615
  'Field title': string;
@@ -740,6 +744,9 @@ export declare const resources: {
740
744
  'After successful save': string;
741
745
  'After clicking the custom button, the following field values will be assigned according to the following form.': string;
742
746
  'After clicking the custom button, the following fields of the current record will be saved according to the following form.': string;
747
+ 'Button background color': string;
748
+ Highlight: string;
749
+ 'Danger red': string;
743
750
  };
744
751
  };
745
752
  };
@@ -324,6 +324,7 @@ declare const _default: {
324
324
  Accept: string;
325
325
  'Rich Text': string;
326
326
  'Junction collection': string;
327
+ 'Leave it blank, unless you need a custom intermediate table': string;
327
328
  Fields: string;
328
329
  'Edit field title': string;
329
330
  'Field title': string;
@@ -458,5 +459,8 @@ declare const _default: {
458
459
  'After successful save': string;
459
460
  'After clicking the custom button, the following field values will be assigned according to the following form.': string;
460
461
  'After clicking the custom button, the following fields of the current record will be saved according to the following form.': string;
462
+ 'Button background color': string;
463
+ Highlight: string;
464
+ 'Danger red': string;
461
465
  };
462
466
  export default _default;
@@ -330,6 +330,7 @@ var _default = {
330
330
  'Accept': '文件格式',
331
331
  'Rich Text': '富文本',
332
332
  'Junction collection': '中间表',
333
+ 'Leave it blank, unless you need a custom intermediate table': '默认留空,除非你需要一个自定义的中间表',
333
334
  'Fields': '字段',
334
335
  'Edit field title': '编辑字段标题',
335
336
  'Field title': '字段标题',
@@ -464,6 +465,9 @@ var _default = {
464
465
  'Updated successfully': '更新成功',
465
466
  'After successful save': '保存成功后',
466
467
  'After clicking the custom button, the following field values will be assigned according to the following form.': '点击当前自定义按钮时,以下字段值将按照以下表单赋值。',
467
- 'After clicking the custom button, the following fields of the current record will be saved according to the following form.': '点击当前自定义按钮时,当前数据以下字段将按照以下表单保存。'
468
+ 'After clicking the custom button, the following fields of the current record will be saved according to the following form.': '点击当前自定义按钮时,当前数据以下字段将按照以下表单保存。',
469
+ 'Button background color': '按钮颜色',
470
+ 'Highlight': '高亮',
471
+ 'Danger red': '红色'
468
472
  };
469
473
  exports.default = _default;
@@ -57,6 +57,10 @@ var filterByACL = function filterByACL(schema, options) {
57
57
  if (element['x-uid'] && !allowMenuItemIds.includes(element['x-uid'])) {
58
58
  delete s.properties[key];
59
59
  }
60
+
61
+ if (element['x-uid']) {
62
+ filterSchema(element);
63
+ }
60
64
  }
61
65
  }
62
66
  };
@@ -74,7 +74,7 @@ var MenuGroup = function MenuGroup(props) {
74
74
  };
75
75
 
76
76
  var ActionDesigner = function ActionDesigner(props) {
77
- var _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xAction, _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5, _fieldSchema$xAction6, _fieldSchema$xAction7;
77
+ var _fieldSchema$xCompon, _fieldSchema$xCompon2, _fieldSchema$xCompon3, _fieldSchema$xCompon4, _fieldSchema$xAction, _fieldSchema$xAction2, _fieldSchema$xAction3, _fieldSchema$xAction4, _fieldSchema$xAction5, _fieldSchema$xAction6, _fieldSchema$xAction7;
78
78
 
79
79
  var modalTip = props.modalTip,
80
80
  restProps = _objectWithoutProperties(props, _excluded);
@@ -135,12 +135,29 @@ var ActionDesigner = function ActionDesigner(props) {
135
135
  default: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon === void 0 ? void 0 : _fieldSchema$xCompon.icon,
136
136
  'x-component-props': {} // description: `原字段标题:${collectionField?.uiSchema?.title}`,
137
137
 
138
+ },
139
+ type: {
140
+ 'x-decorator': 'FormItem',
141
+ 'x-component': 'Radio.Group',
142
+ title: t('Button background color'),
143
+ default: (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2.danger) ? 'danger' : (fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon3 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon3 === void 0 ? void 0 : _fieldSchema$xCompon3.type) === 'primary' ? 'primary' : 'default',
144
+ enum: [{
145
+ value: 'default',
146
+ label: '{{t("Default")}}'
147
+ }, {
148
+ value: 'primary',
149
+ label: '{{t("Highlight")}}'
150
+ }, {
151
+ value: 'danger',
152
+ label: '{{t("Danger red")}}'
153
+ }]
138
154
  }
139
155
  }
140
156
  },
141
157
  onSubmit: function onSubmit(_ref) {
142
158
  var title = _ref.title,
143
- icon = _ref.icon;
159
+ icon = _ref.icon,
160
+ type = _ref.type;
144
161
 
145
162
  if (title) {
146
163
  var _schema;
@@ -148,8 +165,12 @@ var ActionDesigner = function ActionDesigner(props) {
148
165
  fieldSchema.title = title;
149
166
  field.title = title;
150
167
  field.componentProps.icon = icon;
168
+ field.componentProps.danger = type === 'danger';
169
+ field.componentProps.type = type;
151
170
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
152
171
  fieldSchema['x-component-props'].icon = icon;
172
+ fieldSchema['x-component-props'].danger = type === 'danger';
173
+ fieldSchema['x-component-props'].type = type;
153
174
  dn.emit('patch', {
154
175
  schema: (_schema = {}, _defineProperty(_schema, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema, "title", title), _defineProperty(_schema, 'x-component-props', _objectSpread({}, fieldSchema['x-component-props'])), _schema)
155
176
  });
@@ -165,7 +186,7 @@ var ActionDesigner = function ActionDesigner(props) {
165
186
  label: t('Dialog'),
166
187
  value: 'modal'
167
188
  }],
168
- value: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon2 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon2 === void 0 ? void 0 : _fieldSchema$xCompon2['openMode'],
189
+ value: fieldSchema === null || fieldSchema === void 0 ? void 0 : (_fieldSchema$xCompon4 = fieldSchema['x-component-props']) === null || _fieldSchema$xCompon4 === void 0 ? void 0 : _fieldSchema$xCompon4['openMode'],
169
190
  onChange: function onChange(value) {
170
191
  field.componentProps.openMode = value;
171
192
  fieldSchema['x-component-props']['openMode'] = value;
@@ -16,6 +16,8 @@ var _shared = require("@formily/shared");
16
16
 
17
17
  var _antd = require("antd");
18
18
 
19
+ var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
20
+
19
21
  var _get = _interopRequireDefault(require("lodash/get"));
20
22
 
21
23
  var _set = _interopRequireDefault(require("lodash/set"));
@@ -559,6 +561,8 @@ var Designable = /*#__PURE__*/function () {
559
561
  breakRemoveOn: breakRemoveOn
560
562
  });
561
563
  }
564
+ } else if (schema) {
565
+ schema = (0, _cloneDeep.default)(schema);
562
566
  }
563
567
 
564
568
  var properties = {};
@@ -639,6 +643,8 @@ var Designable = /*#__PURE__*/function () {
639
643
  breakRemoveOn: breakRemoveOn
640
644
  });
641
645
  }
646
+ } else if (schema) {
647
+ schema = (0, _cloneDeep.default)(schema);
642
648
  }
643
649
 
644
650
  var properties = {};
@@ -707,6 +713,8 @@ var Designable = /*#__PURE__*/function () {
707
713
  breakRemoveOn: breakRemoveOn
708
714
  });
709
715
  }
716
+ } else if (schema) {
717
+ schema = (0, _cloneDeep.default)(schema);
710
718
  }
711
719
 
712
720
  this.prepareProperty(schema);
@@ -766,6 +774,8 @@ var Designable = /*#__PURE__*/function () {
766
774
  }
767
775
 
768
776
  schema.parent = null;
777
+ } else if (schema) {
778
+ schema = (0, _cloneDeep.default)(schema);
769
779
  }
770
780
 
771
781
  var order = 0;
@@ -765,12 +765,7 @@ SchemaSettings.ActionModalItem = /*#__PURE__*/_react2.default.memo(function (pro
765
765
  };
766
766
  }();
767
767
 
768
- return /*#__PURE__*/_react2.default.createElement("div", {
769
- onClick: function onClick(e) {
770
- e.preventDefault();
771
- e.stopPropagation();
772
- }
773
- }, /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, _objectSpread(_objectSpread({}, others), {}, {
768
+ return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement(SchemaSettings.Item, _objectSpread(_objectSpread({}, others), {}, {
774
769
  onClick: openAssignedFieldValueHandler
775
770
  }), props.children || props.title), /*#__PURE__*/_react2.default.createElement(_antd2.Modal, _objectSpread(_objectSpread({
776
771
  width: '50%',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/client",
3
- "version": "0.7.0-alpha.78",
3
+ "version": "0.7.0-alpha.81",
4
4
  "license": "Apache-2.0",
5
5
  "licenses": [
6
6
  {
@@ -18,7 +18,7 @@
18
18
  "@formily/antd": "2.0.20",
19
19
  "@formily/core": "2.0.20",
20
20
  "@formily/react": "2.0.20",
21
- "@nocobase/utils": "0.7.0-alpha.78",
21
+ "@nocobase/utils": "0.7.0-alpha.81",
22
22
  "ahooks": "^3.0.5",
23
23
  "antd": "~4.19.5",
24
24
  "axios": "^0.26.1",
@@ -51,5 +51,5 @@
51
51
  "@types/marked": "^4.0.1",
52
52
  "axios-mock-adapter": "^1.20.0"
53
53
  },
54
- "gitHead": "a00b45a2686695c5f4824d074ac5e1aff210793a"
54
+ "gitHead": "c84bcc9188a9f8d086a6e29b6b00921da030a296"
55
55
  }
@@ -26,7 +26,7 @@ const collection: CollectionOptions = {
26
26
  title: '{{ t("Collection name") }}',
27
27
  type: 'string',
28
28
  'x-component': 'Input',
29
- // description: '使用英文',
29
+ description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}',
30
30
  },
31
31
  },
32
32
  {
@@ -92,6 +92,9 @@ export const linkTo: IField = {
92
92
  'x-reactions': ['{{useAsyncDataSource(loadCollections)}}'],
93
93
  'x-decorator': 'FormItem',
94
94
  'x-component': 'Select',
95
+ 'x-component-props': {
96
+ placeholder: '{{t("Leave it blank, unless you need a custom intermediate table")}}',
97
+ },
95
98
  },
96
99
  // 'reverseField.uiSchema.title': {
97
100
  // type: 'string',
@@ -22,10 +22,10 @@ export const type: ISchema = {
22
22
  { label: 'Virtual', value: 'virtual' },
23
23
  { label: 'JSON', value: 'json' },
24
24
  { label: 'Password', value: 'password' },
25
- { label: 'HasOne', value: 'hasOne' },
26
- { label: 'HasMany', value: 'hasMany' },
27
- { label: 'BelongsTo', value: 'belongsTo' },
28
- { label: 'BelongsToMany', value: 'belongsToMany' },
25
+ { label: 'One to one', value: 'hasOne' },
26
+ { label: 'One to many', value: 'hasMany' },
27
+ { label: 'Many to one', value: 'belongsTo' },
28
+ { label: 'Many to many', value: 'belongsToMany' },
29
29
  ],
30
30
  };
31
31
 
@@ -299,4 +299,7 @@ export default {
299
299
  'After successful update': 'After successful update',
300
300
  'Save record': 'Save record',
301
301
  'After successful save': 'After successful save',
302
+ 'Button background color': 'Button background color',
303
+ 'Highlight': 'Highlight',
304
+ 'Danger red': 'Danger red'
302
305
  }
@@ -346,6 +346,7 @@ export default {
346
346
  'Accept': '文件格式',
347
347
  'Rich Text': '富文本',
348
348
  'Junction collection': '中间表',
349
+ 'Leave it blank, unless you need a custom intermediate table': '默认留空,除非你需要一个自定义的中间表',
349
350
  'Fields': '字段',
350
351
  'Edit field title': '编辑字段标题',
351
352
  'Field title': '字段标题',
@@ -505,4 +506,7 @@ export default {
505
506
  'After successful save': '保存成功后',
506
507
  'After clicking the custom button, the following field values will be assigned according to the following form.': '点击当前自定义按钮时,以下字段值将按照以下表单赋值。',
507
508
  'After clicking the custom button, the following fields of the current record will be saved according to the following form.': '点击当前自定义按钮时,当前数据以下字段将按照以下表单保存。',
509
+ 'Button background color': '按钮颜色',
510
+ 'Highlight': '高亮',
511
+ 'Danger red': '红色'
508
512
  }
@@ -37,6 +37,9 @@ const filterByACL = (schema, options) => {
37
37
  if (element['x-uid'] && !allowMenuItemIds.includes(element['x-uid'])) {
38
38
  delete s.properties[key];
39
39
  }
40
+ if (element['x-uid']) {
41
+ filterSchema(element);
42
+ }
40
43
  }
41
44
  }
42
45
  };
@@ -79,16 +79,35 @@ export const ActionDesigner = (props) => {
79
79
  'x-component-props': {},
80
80
  // description: `原字段标题:${collectionField?.uiSchema?.title}`,
81
81
  },
82
+ type: {
83
+ 'x-decorator': 'FormItem',
84
+ 'x-component': 'Radio.Group',
85
+ title: t('Button background color'),
86
+ default: fieldSchema?.['x-component-props']?.danger
87
+ ? 'danger'
88
+ : fieldSchema?.['x-component-props']?.type === 'primary'
89
+ ? 'primary'
90
+ : 'default',
91
+ enum: [
92
+ { value: 'default', label: '{{t("Default")}}' },
93
+ { value: 'primary', label: '{{t("Highlight")}}' },
94
+ { value: 'danger', label: '{{t("Danger red")}}' },
95
+ ],
96
+ },
82
97
  },
83
98
  } as ISchema
84
99
  }
85
- onSubmit={({ title, icon }) => {
100
+ onSubmit={({ title, icon, type }) => {
86
101
  if (title) {
87
102
  fieldSchema.title = title;
88
103
  field.title = title;
89
104
  field.componentProps.icon = icon;
105
+ field.componentProps.danger = type === 'danger';
106
+ field.componentProps.type = type;
90
107
  fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
91
108
  fieldSchema['x-component-props'].icon = icon;
109
+ fieldSchema['x-component-props'].danger = type === 'danger';
110
+ fieldSchema['x-component-props'].type = type;
92
111
  dn.emit('patch', {
93
112
  schema: {
94
113
  ['x-uid']: fieldSchema['x-uid'],
@@ -1,6 +1,7 @@
1
1
  import { ISchema, Schema, SchemaOptionsContext, useField, useFieldSchema } from '@formily/react';
2
2
  import { uid } from '@formily/shared';
3
3
  import { message } from 'antd';
4
+ import cloneDeep from 'lodash/cloneDeep';
4
5
  import get from 'lodash/get';
5
6
  import set from 'lodash/set';
6
7
  import React, { useContext } from 'react';
@@ -325,6 +326,8 @@ export class Designable {
325
326
  if (removeParentsIfNoChildren) {
326
327
  opts['removed'] = this.recursiveRemoveIfNoChildren(schema.parent, { breakRemoveOn });
327
328
  }
329
+ } else if (schema) {
330
+ schema = cloneDeep(schema);
328
331
  }
329
332
  const properties = {};
330
333
  let start = false;
@@ -382,6 +385,8 @@ export class Designable {
382
385
  if (removeParentsIfNoChildren) {
383
386
  opts['removed'] = this.recursiveRemoveIfNoChildren(schema.parent, { breakRemoveOn });
384
387
  }
388
+ } else if (schema) {
389
+ schema = cloneDeep(schema);
385
390
  }
386
391
  const properties = {};
387
392
  let order = 1;
@@ -430,6 +435,8 @@ export class Designable {
430
435
  if (removeParentsIfNoChildren) {
431
436
  opts['removed'] = this.recursiveRemoveIfNoChildren(schema.parent, { breakRemoveOn });
432
437
  }
438
+ } else if (schema) {
439
+ schema = cloneDeep(schema);
433
440
  }
434
441
  this.prepareProperty(schema);
435
442
  const wrapped = wrap(schema);
@@ -466,6 +473,8 @@ export class Designable {
466
473
  opts['removed'] = this.recursiveRemoveIfNoChildren(schema.parent, { breakRemoveOn });
467
474
  }
468
475
  schema.parent = null;
476
+ } else if (schema) {
477
+ schema = cloneDeep(schema);
469
478
  }
470
479
 
471
480
  let order = 0;
@@ -486,6 +486,7 @@ SchemaSettings.ActionModalItem = React.memo((props: any) => {
486
486
  const cancelHandler = () => {
487
487
  setVisible(false);
488
488
  };
489
+
489
490
  const submitHandler = () => {
490
491
  onSubmit?.(cloneDeep(form.values));
491
492
  setVisible(false);
@@ -504,12 +505,7 @@ SchemaSettings.ActionModalItem = React.memo((props: any) => {
504
505
  };
505
506
 
506
507
  return (
507
- <div
508
- onClick={(e) => {
509
- e.preventDefault();
510
- e.stopPropagation();
511
- }}
512
- >
508
+ <>
513
509
  <SchemaSettings.Item {...others} onClick={openAssignedFieldValueHandler}>
514
510
  {props.children || props.title}
515
511
  </SchemaSettings.Item>
@@ -538,7 +534,7 @@ SchemaSettings.ActionModalItem = React.memo((props: any) => {
538
534
  </FormLayout>
539
535
  </FormProvider>
540
536
  </Modal>
541
- </div>
537
+ </>
542
538
  );
543
539
  });
544
540