cnhis-design-vue 3.1.14-beta.14 → 3.1.14-beta.15

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 (25) hide show
  1. package/es/node_modules/@formily/path/esm/contexts.js +22 -0
  2. package/es/node_modules/@formily/path/esm/destructor.js +124 -0
  3. package/es/node_modules/@formily/path/esm/index.js +579 -0
  4. package/es/node_modules/@formily/path/esm/matcher.js +199 -0
  5. package/es/node_modules/@formily/path/esm/parser.js +402 -0
  6. package/es/node_modules/@formily/path/esm/shared.js +73 -0
  7. package/es/node_modules/@formily/path/esm/tokenizer.js +287 -0
  8. package/es/node_modules/@formily/path/esm/tokens.js +240 -0
  9. package/es/node_modules/@formily/path/esm/types.js +17 -0
  10. package/es/packages/form-render/src/components/renderer/combination.d.ts +6 -0
  11. package/es/packages/form-render/src/components/renderer/combination.js +53 -16
  12. package/es/packages/form-render/src/components/renderer/select.js +1 -2
  13. package/es/packages/form-render/src/components/renderer/simpleComponent.d.ts +1 -0
  14. package/es/packages/form-render/src/components/renderer/simpleComponent.js +4 -3
  15. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +1 -0
  16. package/es/packages/form-render/src/types/fieldItem.d.ts +1 -0
  17. package/es/packages/shortcut-provider/src/types/index.d.ts +11 -9
  18. package/es/packages/shortcut-provider/src/utils/index.js +5 -5
  19. package/es/packages/shortcut-setter/index.d.ts +3248 -1486
  20. package/es/packages/shortcut-setter/src/ShortcutSetter.js +9 -5
  21. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +3248 -1486
  22. package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +24 -11
  23. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +1700 -1661
  24. package/global.d.ts +8 -8
  25. package/package.json +1 -1
@@ -0,0 +1,287 @@
1
+ import { eofTok, nameTok, ignoreTok, bracketDRTok, braceLTok, braceRTok, dbStarTok, starTok, bangTok, dotTok, bracketDLTok, bracketLTok, expandTok, bracketRTok, parenLTok, parenRTok, commaTok, colonTok } from './tokens.js';
2
+ import { bracketDContext } from './contexts.js';
3
+
4
+ var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
5
+ var fullCharCodeAtPos = function (input, pos) {
6
+ if (String.fromCharCode)
7
+ return input.codePointAt(pos);
8
+ var code = input.charCodeAt(pos);
9
+ if (code <= 0xd7ff || code >= 0xe000)
10
+ return code;
11
+ var next = input.charCodeAt(pos + 1);
12
+ return (code << 10) + next - 0x35fdc00;
13
+ };
14
+ var isRewordCode = function (code) {
15
+ return code === 42 ||
16
+ code === 46 ||
17
+ code === 33 ||
18
+ code === 91 ||
19
+ code === 93 ||
20
+ code === 40 ||
21
+ code === 41 ||
22
+ code === 44 ||
23
+ code === 58 ||
24
+ code === 126 ||
25
+ code === 123 ||
26
+ code === 125;
27
+ };
28
+ var getError = function (message, props) {
29
+ var err = new Error(message);
30
+ Object.assign(err, props);
31
+ return err;
32
+ };
33
+ var slice = function (string, start, end) {
34
+ var str = '';
35
+ for (var i = start; i < end; i++) {
36
+ var ch = string.charAt(i);
37
+ if (ch !== '\\') {
38
+ str += ch;
39
+ }
40
+ }
41
+ return str;
42
+ };
43
+ var Tokenizer = /** @class */ (function () {
44
+ function Tokenizer(input) {
45
+ this.input = input;
46
+ this.state = {
47
+ context: [],
48
+ type: null,
49
+ pos: 0,
50
+ };
51
+ this.type_ = null;
52
+ }
53
+ Tokenizer.prototype.curContext = function () {
54
+ return this.state.context[this.state.context.length - 1];
55
+ };
56
+ Tokenizer.prototype.includesContext = function (context) {
57
+ for (var len = this.state.context.length - 1; len >= 0; len--) {
58
+ if (this.state.context[len] === context) {
59
+ return true;
60
+ }
61
+ }
62
+ return false;
63
+ };
64
+ Tokenizer.prototype.unexpect = function (type) {
65
+ type = type || this.state.type;
66
+ return getError("Unexpect token \"".concat(type.flag, "\" in ").concat(this.state.pos, " char."), {
67
+ pos: this.state.pos,
68
+ });
69
+ };
70
+ Tokenizer.prototype.expectNext = function (type, next) {
71
+ if (type && type.expectNext) {
72
+ if (next && !type.expectNext.call(this, next)) {
73
+ throw getError("Unexpect token \"".concat(next.flag, "\" token should not be behind \"").concat(type.flag, "\" token.(").concat(this.state.pos, "th char)"), {
74
+ pos: this.state.pos,
75
+ });
76
+ }
77
+ }
78
+ };
79
+ Tokenizer.prototype.expectPrev = function (type, prev) {
80
+ if (type && type.expectPrev) {
81
+ if (prev && !type.expectPrev.call(this, prev)) {
82
+ throw getError("Unexpect token \"".concat(type.flag, "\" should not be behind \"").concat(prev.flag, "\"(").concat(this.state.pos, "th char)."), {
83
+ pos: this.state.pos,
84
+ });
85
+ }
86
+ }
87
+ };
88
+ Tokenizer.prototype.match = function (type) {
89
+ return this.state.type === type;
90
+ };
91
+ Tokenizer.prototype.skipSpace = function () {
92
+ if (this.curContext() === bracketDContext)
93
+ return;
94
+ loop: while (this.state.pos < this.input.length) {
95
+ var ch = this.input.charCodeAt(this.state.pos);
96
+ switch (ch) {
97
+ case 32:
98
+ case 160:
99
+ ++this.state.pos;
100
+ break;
101
+ case 13:
102
+ if (this.input.charCodeAt(this.state.pos + 1) === 10) {
103
+ ++this.state.pos;
104
+ }
105
+ case 10:
106
+ case 8232:
107
+ case 8233:
108
+ ++this.state.pos;
109
+ break;
110
+ default:
111
+ if ((ch > 8 && ch < 14) ||
112
+ (ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch)))) {
113
+ ++this.state.pos;
114
+ }
115
+ else {
116
+ break loop;
117
+ }
118
+ }
119
+ }
120
+ };
121
+ Tokenizer.prototype.next = function () {
122
+ this.type_ = this.state.type;
123
+ if (this.input.length <= this.state.pos) {
124
+ return this.finishToken(eofTok);
125
+ }
126
+ this.skipSpace();
127
+ this.readToken(this.getCode(), this.state.pos > 0 ? this.getCode(this.state.pos - 1) : -Infinity);
128
+ };
129
+ Tokenizer.prototype.getCode = function (pos) {
130
+ if (pos === void 0) { pos = this.state.pos; }
131
+ return fullCharCodeAtPos(this.input, pos);
132
+ };
133
+ Tokenizer.prototype.eat = function (type) {
134
+ if (this.match(type)) {
135
+ this.next();
136
+ return true;
137
+ }
138
+ else {
139
+ return false;
140
+ }
141
+ };
142
+ Tokenizer.prototype.readKeyWord = function () {
143
+ var startPos = this.state.pos, string = '';
144
+ while (true) {
145
+ var code = this.getCode();
146
+ var prevCode = this.getCode(this.state.pos - 1);
147
+ if (this.input.length === this.state.pos) {
148
+ string = slice(this.input, startPos, this.state.pos + 1);
149
+ break;
150
+ }
151
+ if (!isRewordCode(code) || prevCode === 92) {
152
+ if (code === 32 ||
153
+ code === 160 ||
154
+ code === 10 ||
155
+ code === 8232 ||
156
+ code === 8233) {
157
+ string = slice(this.input, startPos, this.state.pos);
158
+ break;
159
+ }
160
+ if (code === 13 && this.input.charCodeAt(this.state.pos + 1) === 10) {
161
+ string = slice(this.input, startPos, this.state.pos);
162
+ break;
163
+ }
164
+ if ((code > 8 && code < 14) ||
165
+ (code >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(code)))) {
166
+ string = slice(this.input, startPos, this.state.pos);
167
+ break;
168
+ }
169
+ this.state.pos++;
170
+ }
171
+ else {
172
+ string = slice(this.input, startPos, this.state.pos);
173
+ break;
174
+ }
175
+ }
176
+ this.finishToken(nameTok, string);
177
+ };
178
+ Tokenizer.prototype.readIngoreString = function () {
179
+ var startPos = this.state.pos, prevCode, string = '';
180
+ while (true) {
181
+ var code = this.getCode();
182
+ if (this.state.pos >= this.input.length)
183
+ break;
184
+ if ((code === 91 || code === 93) && prevCode === 92) {
185
+ this.state.pos++;
186
+ prevCode = '';
187
+ }
188
+ else if (code == 93 && prevCode === 93) {
189
+ string = this.input
190
+ .slice(startPos, this.state.pos - 1)
191
+ .replace(/\\([\[\]])/g, '$1');
192
+ this.state.pos++;
193
+ break;
194
+ }
195
+ else {
196
+ this.state.pos++;
197
+ prevCode = code;
198
+ }
199
+ }
200
+ this.finishToken(ignoreTok, string);
201
+ this.finishToken(bracketDRTok);
202
+ };
203
+ Tokenizer.prototype.finishToken = function (type, value) {
204
+ var preType = this.state.type;
205
+ this.state.type = type;
206
+ if (value !== undefined)
207
+ this.state.value = value;
208
+ this.expectNext(preType, type);
209
+ this.expectPrev(type, preType);
210
+ if (type.updateContext) {
211
+ type.updateContext.call(this, preType);
212
+ }
213
+ };
214
+ Tokenizer.prototype.readToken = function (code, prevCode) {
215
+ if (prevCode === 92) {
216
+ return this.readKeyWord();
217
+ }
218
+ if (this.input.length <= this.state.pos) {
219
+ this.finishToken(eofTok);
220
+ }
221
+ else if (this.curContext() === bracketDContext) {
222
+ this.readIngoreString();
223
+ }
224
+ else if (code === 123) {
225
+ this.state.pos++;
226
+ this.finishToken(braceLTok);
227
+ }
228
+ else if (code === 125) {
229
+ this.state.pos++;
230
+ this.finishToken(braceRTok);
231
+ }
232
+ else if (code === 42) {
233
+ this.state.pos++;
234
+ if (this.getCode() === 42) {
235
+ this.state.pos++;
236
+ return this.finishToken(dbStarTok);
237
+ }
238
+ this.finishToken(starTok);
239
+ }
240
+ else if (code === 33) {
241
+ this.state.pos++;
242
+ this.finishToken(bangTok);
243
+ }
244
+ else if (code === 46) {
245
+ this.state.pos++;
246
+ this.finishToken(dotTok);
247
+ }
248
+ else if (code === 91) {
249
+ this.state.pos++;
250
+ if (this.getCode() === 91) {
251
+ this.state.pos++;
252
+ return this.finishToken(bracketDLTok);
253
+ }
254
+ this.finishToken(bracketLTok);
255
+ }
256
+ else if (code === 126) {
257
+ this.state.pos++;
258
+ this.finishToken(expandTok);
259
+ }
260
+ else if (code === 93) {
261
+ this.state.pos++;
262
+ this.finishToken(bracketRTok);
263
+ }
264
+ else if (code === 40) {
265
+ this.state.pos++;
266
+ this.finishToken(parenLTok);
267
+ }
268
+ else if (code === 41) {
269
+ this.state.pos++;
270
+ this.finishToken(parenRTok);
271
+ }
272
+ else if (code === 44) {
273
+ this.state.pos++;
274
+ this.finishToken(commaTok);
275
+ }
276
+ else if (code === 58) {
277
+ this.state.pos++;
278
+ this.finishToken(colonTok);
279
+ }
280
+ else {
281
+ this.readKeyWord();
282
+ }
283
+ };
284
+ return Tokenizer;
285
+ }());
286
+
287
+ export { Tokenizer };
@@ -0,0 +1,240 @@
1
+ import { destructorContext, braceContext, bracketContext, bracketArrayContext, bracketDContext, parenContext } from './contexts.js';
2
+
3
+ var __assign = (undefined && undefined.__assign) || function () {
4
+ __assign = Object.assign || function(t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
+ t[p] = s[p];
9
+ }
10
+ return t;
11
+ };
12
+ return __assign.apply(this, arguments);
13
+ };
14
+ var TokenType = function (flag, props) {
15
+ return __assign({ flag: flag }, props);
16
+ };
17
+ var nameTok = TokenType('name', {
18
+ expectNext: function (next) {
19
+ if (this.includesContext(destructorContext)) {
20
+ return (next === nameTok ||
21
+ next === commaTok ||
22
+ next === bracketRTok ||
23
+ next === braceRTok ||
24
+ next === colonTok);
25
+ }
26
+ return (next === dotTok ||
27
+ next === commaTok ||
28
+ next === eofTok ||
29
+ next === bracketRTok ||
30
+ next === parenRTok ||
31
+ next === colonTok ||
32
+ next === expandTok ||
33
+ next === bracketLTok);
34
+ },
35
+ });
36
+ var starTok = TokenType('*', {
37
+ expectNext: function (next) {
38
+ return (next === dotTok ||
39
+ next === parenLTok ||
40
+ next === bracketLTok ||
41
+ next === eofTok ||
42
+ next === commaTok ||
43
+ next === parenRTok);
44
+ },
45
+ });
46
+ var dbStarTok = TokenType('**', {
47
+ expectNext: function (next) {
48
+ return (next === dotTok ||
49
+ next === parenLTok ||
50
+ next === bracketLTok ||
51
+ next === eofTok ||
52
+ next === commaTok ||
53
+ next === parenRTok);
54
+ },
55
+ });
56
+ var dotTok = TokenType('.', {
57
+ expectNext: function (next) {
58
+ return (next === dotTok ||
59
+ next === nameTok ||
60
+ next === bracketDLTok ||
61
+ next === starTok ||
62
+ next === dbStarTok ||
63
+ next === bracketLTok ||
64
+ next === braceLTok ||
65
+ next === eofTok);
66
+ },
67
+ expectPrev: function (prev) {
68
+ return (prev === dotTok ||
69
+ prev === nameTok ||
70
+ prev === bracketDRTok ||
71
+ prev === starTok ||
72
+ prev === parenRTok ||
73
+ prev === bracketRTok ||
74
+ prev === expandTok ||
75
+ prev === braceRTok);
76
+ },
77
+ });
78
+ var bangTok = TokenType('!', {
79
+ expectNext: function (next) {
80
+ return next === nameTok || next === bracketDLTok;
81
+ },
82
+ });
83
+ var colonTok = TokenType(':', {
84
+ expectNext: function (next) {
85
+ if (this.includesContext(destructorContext)) {
86
+ return next === nameTok || next === braceLTok || next === bracketLTok;
87
+ }
88
+ return next === nameTok || next === bracketDLTok || next === bracketRTok;
89
+ },
90
+ });
91
+ var braceLTok = TokenType('{', {
92
+ expectNext: function (next) {
93
+ return next === nameTok;
94
+ },
95
+ expectPrev: function (prev) {
96
+ if (this.includesContext(destructorContext)) {
97
+ return prev === colonTok || prev === commaTok || prev === bracketLTok;
98
+ }
99
+ return prev === dotTok || prev === colonTok || prev === parenLTok;
100
+ },
101
+ updateContext: function () {
102
+ this.state.context.push(braceContext);
103
+ },
104
+ });
105
+ var braceRTok = TokenType('}', {
106
+ expectNext: function (next) {
107
+ if (this.includesContext(destructorContext)) {
108
+ return (next === commaTok ||
109
+ next === braceRTok ||
110
+ next === eofTok ||
111
+ next === bracketRTok);
112
+ }
113
+ return next === dotTok || next === eofTok || next === commaTok;
114
+ },
115
+ expectPrev: function (prev) {
116
+ return prev === nameTok || prev === braceRTok || prev === bracketRTok;
117
+ },
118
+ updateContext: function () {
119
+ this.state.context.pop(braceContext);
120
+ },
121
+ });
122
+ var bracketLTok = TokenType('[', {
123
+ expectNext: function (next) {
124
+ if (this.includesContext(destructorContext)) {
125
+ return (next === nameTok ||
126
+ next === bracketLTok ||
127
+ next === braceLTok ||
128
+ next === bracketRTok);
129
+ }
130
+ return (next === nameTok ||
131
+ next === bracketDLTok ||
132
+ next === colonTok ||
133
+ next === bracketLTok ||
134
+ next === ignoreTok ||
135
+ next === bracketRTok);
136
+ },
137
+ expectPrev: function (prev) {
138
+ if (this.includesContext(destructorContext)) {
139
+ return prev === colonTok || prev === commaTok || prev === bracketLTok;
140
+ }
141
+ return (prev === starTok ||
142
+ prev === bracketLTok ||
143
+ prev === dotTok ||
144
+ prev === nameTok ||
145
+ prev === parenLTok ||
146
+ prev == commaTok);
147
+ },
148
+ updateContext: function () {
149
+ this.state.context.push(bracketContext);
150
+ },
151
+ });
152
+ var bracketRTok = TokenType(']', {
153
+ expectNext: function (next) {
154
+ if (this.includesContext(destructorContext)) {
155
+ return (next === commaTok ||
156
+ next === braceRTok ||
157
+ next === bracketRTok ||
158
+ next === eofTok);
159
+ }
160
+ return (next === dotTok ||
161
+ next === eofTok ||
162
+ next === commaTok ||
163
+ next === parenRTok ||
164
+ next === bracketRTok);
165
+ },
166
+ updateContext: function () {
167
+ if (this.includesContext(bracketArrayContext))
168
+ return;
169
+ if (!this.includesContext(bracketContext))
170
+ throw this.unexpect();
171
+ this.state.context.pop();
172
+ },
173
+ });
174
+ var bracketDLTok = TokenType('[[', {
175
+ updateContext: function () {
176
+ this.state.context.push(bracketDContext);
177
+ },
178
+ });
179
+ var bracketDRTok = TokenType(']]', {
180
+ updateContext: function () {
181
+ if (this.curContext() !== bracketDContext)
182
+ throw this.unexpect();
183
+ this.state.context.pop();
184
+ },
185
+ });
186
+ var parenLTok = TokenType('(', {
187
+ expectNext: function (next) {
188
+ return (next === nameTok ||
189
+ next === bracketDLTok ||
190
+ next === braceLTok ||
191
+ next === bangTok ||
192
+ next === bracketLTok);
193
+ },
194
+ expectPrev: function (prev) {
195
+ return prev === starTok;
196
+ },
197
+ updateContext: function () {
198
+ this.state.context.push(parenContext);
199
+ },
200
+ });
201
+ var parenRTok = TokenType(')', {
202
+ expectNext: function (next) {
203
+ return (next === dotTok ||
204
+ next === eofTok ||
205
+ next === commaTok ||
206
+ next === parenRTok);
207
+ },
208
+ updateContext: function () {
209
+ if (this.curContext() !== parenContext)
210
+ throw this.unexpect();
211
+ this.state.context.pop();
212
+ },
213
+ });
214
+ var commaTok = TokenType(',', {
215
+ expectNext: function (next) {
216
+ return (next === nameTok ||
217
+ next === bracketDLTok ||
218
+ next === bracketLTok ||
219
+ next === braceLTok);
220
+ },
221
+ });
222
+ var ignoreTok = TokenType('ignore', {
223
+ expectNext: function (next) {
224
+ return next === bracketDRTok;
225
+ },
226
+ expectPrev: function (prev) {
227
+ return prev == bracketDLTok;
228
+ },
229
+ });
230
+ var expandTok = TokenType('expandTok', {
231
+ expectNext: function (next) {
232
+ return (next === dotTok ||
233
+ next === eofTok ||
234
+ next === commaTok ||
235
+ next === parenRTok);
236
+ },
237
+ });
238
+ var eofTok = TokenType('eof');
239
+
240
+ export { bangTok, braceLTok, braceRTok, bracketDLTok, bracketDRTok, bracketLTok, bracketRTok, colonTok, commaTok, dbStarTok, dotTok, eofTok, expandTok, ignoreTok, nameTok, parenLTok, parenRTok, starTok };
@@ -0,0 +1,17 @@
1
+ var isType = function (type) {
2
+ return function (obj) {
3
+ return obj && obj.type === type;
4
+ };
5
+ };
6
+ var isIdentifier = isType('Identifier');
7
+ var isIgnoreExpression = isType('IgnoreExpression');
8
+ var isDotOperator = isType('DotOperator');
9
+ var isWildcardOperator = isType('WildcardOperator');
10
+ var isExpandOperator = isType('ExpandOperator');
11
+ var isGroupExpression = isType('GroupExpression');
12
+ var isRangeExpression = isType('RangeExpression');
13
+ var isDestructorExpression = isType('DestructorExpression');
14
+ var isObjectPattern = isType('ObjectPattern');
15
+ var isArrayPattern = isType('ArrayPattern');
16
+
17
+ export { isArrayPattern, isDestructorExpression, isDotOperator, isExpandOperator, isGroupExpression, isIdentifier, isIgnoreExpression, isObjectPattern, isRangeExpression, isType, isWildcardOperator };
@@ -8,6 +8,9 @@ export declare const COMBINATION: import("vue").DefineComponent<{
8
8
  value: {
9
9
  type: StringConstructor;
10
10
  };
11
+ maxGroupNum: {
12
+ type: NumberConstructor;
13
+ };
11
14
  getProperties: {
12
15
  type: PropType<() => FieldItem[]>;
13
16
  default: () => never[];
@@ -20,6 +23,9 @@ export declare const COMBINATION: import("vue").DefineComponent<{
20
23
  value: {
21
24
  type: StringConstructor;
22
25
  };
26
+ maxGroupNum: {
27
+ type: NumberConstructor;
28
+ };
23
29
  getProperties: {
24
30
  type: PropType<() => FieldItem[]>;
25
31
  default: () => never[];
@@ -1,4 +1,7 @@
1
- import { defineComponent, ref, createVNode, createTextVNode, toRaw } from 'vue';
1
+ import { defineComponent, ref, computed, watch, onMounted, createVNode, createTextVNode } from 'vue';
2
+ import { isField } from '@formily/core';
3
+ import { Path } from '../../../../../node_modules/@formily/path/esm/index.js';
4
+ import { isNumber } from 'lodash-es';
2
5
  import { assignUpdateValue, formRenderLog } from '../../utils/index.js';
3
6
  import { connect, mapProps } from '@formily/vue';
4
7
  import { useDebounceFn, isObject } from '@vueuse/core';
@@ -15,6 +18,9 @@ const script = defineComponent({
15
18
  value: {
16
19
  type: String
17
20
  },
21
+ maxGroupNum: {
22
+ type: Number
23
+ },
18
24
  getProperties: {
19
25
  type: Function,
20
26
  default: () => []
@@ -27,14 +33,31 @@ const script = defineComponent({
27
33
  const emitChange = useDebounceFn(function emitChange2() {
28
34
  emit("update:value", JSON.stringify(_values.value));
29
35
  }, 300);
30
- const combinationRepeat = ref(1);
36
+ const formRenderRefs = ref([]);
37
+ const groupNum = ref(1);
38
+ const maxGroupNum = computed(() => {
39
+ if (!isNumber(props.maxGroupNum))
40
+ return Infinity;
41
+ if (props.maxGroupNum < 1)
42
+ return 0;
43
+ return ~~props.maxGroupNum;
44
+ });
45
+ watch(maxGroupNum, (value) => {
46
+ if (groupNum.value <= value)
47
+ return;
48
+ groupNum.value = value;
49
+ _values.value.splice(groupNum.value);
50
+ emitChange();
51
+ }, {
52
+ immediate: true
53
+ });
31
54
  function add() {
32
- combinationRepeat.value++;
55
+ groupNum.value++;
33
56
  _values.value.push({});
34
57
  emitChange();
35
58
  }
36
59
  function remove(idx) {
37
- combinationRepeat.value--;
60
+ groupNum.value--;
38
61
  _values.value.splice(idx, 1);
39
62
  emitChange();
40
63
  }
@@ -47,19 +70,32 @@ const script = defineComponent({
47
70
  if (!Array.isArray(parsed))
48
71
  throw new Error();
49
72
  parsed.forEach((v, idx) => {
50
- if (isObject(v)) {
51
- _values.value[idx] = v;
52
- } else {
53
- _values.value[idx] = {};
54
- formRenderLog(`invalid Object value ${v} in COMBINATION => ${props.title}[${idx}]`, "warn");
55
- }
73
+ if (idx > maxGroupNum.value - 1)
74
+ return;
75
+ if (isObject(v))
76
+ return _values.value[idx] = v;
77
+ _values.value[idx] = {};
78
+ formRenderLog(`invalid Object value ${v} in COMBINATION => ${props.title}[${idx}]`, "warn");
56
79
  });
57
- combinationRepeat.value = _values.value.length;
80
+ groupNum.value = Math.min(_values.value.length, maxGroupNum.value);
58
81
  } catch (e) {
59
82
  formRenderLog(`invalid JSON value ${data} in COMBINATION => ${props.title}`, "warn");
83
+ } finally {
84
+ setFormValueByInitValue();
85
+ }
86
+ function setFormValueByInitValue() {
87
+ _values.value.forEach((item, idx) => {
88
+ var _a;
89
+ (_a = formRenderRefs.value[idx]) == null ? void 0 : _a.setFieldState("*", (state) => {
90
+ if (!isField(state))
91
+ return;
92
+ state.value = Path.getIn(item, state.path);
93
+ });
94
+ });
60
95
  }
61
96
  }
62
- initValues(props.value);
97
+ watch(() => props.value, (value) => initValues(value));
98
+ onMounted(() => initValues(props.value));
63
99
  function stop(event) {
64
100
  event.stopPropagation();
65
101
  }
@@ -68,7 +104,7 @@ const script = defineComponent({
68
104
  value
69
105
  }) {
70
106
  !_values.value[idx] && (_values.value[idx] = {});
71
- _values.value[idx][fieldKey] = value;
107
+ Path.setIn(_values.value[idx], fieldKey, value);
72
108
  emitChange();
73
109
  }
74
110
  const FormRenderComponent = FormRender;
@@ -82,16 +118,17 @@ const script = defineComponent({
82
118
  }, [props.title]), createVNode(NButton, {
83
119
  "onClick": add,
84
120
  "type": "info",
85
- "text": true
121
+ "text": true,
122
+ "disabled": groupNum.value >= maxGroupNum.value
86
123
  }, {
87
124
  default: () => [createTextVNode("\u65B0\u589E")]
88
125
  })]), Array.from({
89
- length: combinationRepeat.value
126
+ length: groupNum.value
90
127
  }).map((_, idx) => {
91
128
  return createVNode("section", {
92
129
  "class": "form-render__combinationContent"
93
130
  }, [createVNode(FormRenderComponent, {
94
- "initialData": toRaw(_values.value[idx]) || {},
131
+ "ref": (_ref) => formRenderRefs.value[idx] = _ref,
95
132
  "fieldList": props.getProperties(),
96
133
  "onUpdateValue": () => false,
97
134
  "onInput": stop,
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, watch, inject, computed, nextTick, createVNode } from 'vue';
1
+ import { defineComponent, ref, inject, computed, watch, nextTick, createVNode } from 'vue';
2
2
  import { isField } from '@formily/core';
3
3
  import { isEqual, cloneDeep } from 'lodash-es';
4
4
  import { InjectAsyncQueue, InjectionFormItemDepsCollector, InjectionChangeContextCollector } from '../../constants/index.js';
@@ -31,7 +31,6 @@ const script = defineComponent({
31
31
  emit
32
32
  }) {
33
33
  const remoteOptions = ref(null);
34
- watch(remoteOptions, (o) => console.log("remoteOption", o));
35
34
  const lastSearch = ref("");
36
35
  const asyncQueue = inject(InjectAsyncQueue);
37
36
  const {