@byteluck-fe/model-driven-core 2.22.3-beta.7 → 2.22.4-beta.1
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.
- package/dist/esm/common/BaseControl/designer.js +15 -21
- package/dist/esm/common/BaseControl/runtime.js +1 -2
- package/dist/esm/common/LayoutControl/designer.js +6 -10
- package/dist/esm/common/ListControl/designer.js +6 -10
- package/dist/esm/common/Validator.js +5 -4
- package/dist/esm/common/initOptionAndDataSourceRules.js +5 -5
- package/dist/esm/framework/index.js +383 -373
- package/dist/index.umd.js +1 -1
- package/dist/types/framework/index.d.ts +2 -1
- package/package.json +3 -3
|
@@ -120,7 +120,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
120
120
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
121
121
|
}
|
|
122
122
|
function _ts_generator(thisArg, body) {
|
|
123
|
-
var f, y, t,
|
|
123
|
+
var f, y, t, _ = {
|
|
124
124
|
label: 0,
|
|
125
125
|
sent: function() {
|
|
126
126
|
if (t[0] & 1) throw t[1];
|
|
@@ -128,12 +128,8 @@ function _ts_generator(thisArg, body) {
|
|
|
128
128
|
},
|
|
129
129
|
trys: [],
|
|
130
130
|
ops: []
|
|
131
|
-
};
|
|
132
|
-
return g = {
|
|
133
|
-
next: verb(0),
|
|
134
|
-
"throw": verb(1),
|
|
135
|
-
"return": verb(2)
|
|
136
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
131
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
132
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
137
133
|
return this;
|
|
138
134
|
}), g;
|
|
139
135
|
function verb(n) {
|
|
@@ -146,7 +142,7 @@ function _ts_generator(thisArg, body) {
|
|
|
146
142
|
}
|
|
147
143
|
function step(op) {
|
|
148
144
|
if (f) throw new TypeError("Generator is already executing.");
|
|
149
|
-
while(_)try {
|
|
145
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
150
146
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
151
147
|
if (y = 0, t) op = [
|
|
152
148
|
op[0] & 2,
|
|
@@ -214,6 +210,7 @@ function _ts_generator(thisArg, body) {
|
|
|
214
210
|
};
|
|
215
211
|
}
|
|
216
212
|
}
|
|
213
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
217
214
|
import Property from './property';
|
|
218
215
|
import { genNonDuplicateId, JSONCopy, referenceError, updateValueFromKeys } from '@byteluck-fe/model-driven-shared';
|
|
219
216
|
import { createValidator } from '../Validator';
|
|
@@ -223,8 +220,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
223
220
|
function Control(props) {
|
|
224
221
|
var _this = this;
|
|
225
222
|
_class_call_check(this, Control);
|
|
226
|
-
_define_property(this, "id", void 0 // 唯一标识符
|
|
227
|
-
);
|
|
223
|
+
_define_property(this, "id", void 0); // 唯一标识符
|
|
228
224
|
_define_property(this, "name", void 0);
|
|
229
225
|
_define_property(this, "icon", void 0);
|
|
230
226
|
_define_property(this, "type", void 0);
|
|
@@ -315,17 +311,16 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
315
311
|
{
|
|
316
312
|
key: "preValidate",
|
|
317
313
|
value: function preValidate() {
|
|
318
|
-
var _this = this;
|
|
319
314
|
return _async_to_generator(function() {
|
|
320
315
|
var rules, results, result;
|
|
321
316
|
return _ts_generator(this, function(_state) {
|
|
322
317
|
switch(_state.label){
|
|
323
318
|
case 0:
|
|
324
319
|
// 在处理validate之前,预留的钩子函数,允许在validate之前处理一些数据
|
|
325
|
-
rules = _object_spread({},
|
|
320
|
+
rules = _object_spread({}, this.rules);
|
|
326
321
|
return [
|
|
327
322
|
4,
|
|
328
|
-
|
|
323
|
+
this._callControlHooks('preValidate', rules)
|
|
329
324
|
];
|
|
330
325
|
case 1:
|
|
331
326
|
results = _state.sent();
|
|
@@ -336,14 +331,13 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
336
331
|
];
|
|
337
332
|
}
|
|
338
333
|
});
|
|
339
|
-
})();
|
|
334
|
+
}).call(this);
|
|
340
335
|
}
|
|
341
336
|
},
|
|
342
337
|
{
|
|
343
338
|
key: "validate",
|
|
344
339
|
value: // property校验
|
|
345
340
|
function validate(messages, ignore) {
|
|
346
|
-
var _this = this;
|
|
347
341
|
return _async_to_generator(function() {
|
|
348
342
|
var result, rules, validator, err;
|
|
349
343
|
return _ts_generator(this, function(_state) {
|
|
@@ -351,11 +345,11 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
351
345
|
case 0:
|
|
352
346
|
return [
|
|
353
347
|
4,
|
|
354
|
-
|
|
348
|
+
this.preValidate()
|
|
355
349
|
];
|
|
356
350
|
case 1:
|
|
357
351
|
result = _state.sent();
|
|
358
|
-
rules = result !== undefined ? result : _object_spread({},
|
|
352
|
+
rules = result !== undefined ? result : _object_spread({}, this.rules);
|
|
359
353
|
if (Array.isArray(ignore)) {
|
|
360
354
|
ignore.forEach(function(key) {
|
|
361
355
|
if (rules.hasOwnProperty(key)) {
|
|
@@ -374,7 +368,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
374
368
|
]);
|
|
375
369
|
return [
|
|
376
370
|
4,
|
|
377
|
-
validator.validate(
|
|
371
|
+
validator.validate(this.props)
|
|
378
372
|
];
|
|
379
373
|
case 3:
|
|
380
374
|
_state.sent();
|
|
@@ -385,7 +379,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
385
379
|
case 4:
|
|
386
380
|
err = _state.sent();
|
|
387
381
|
if (!err.control) {
|
|
388
|
-
err.control =
|
|
382
|
+
err.control = this;
|
|
389
383
|
}
|
|
390
384
|
throw err;
|
|
391
385
|
case 5:
|
|
@@ -394,7 +388,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
394
388
|
];
|
|
395
389
|
}
|
|
396
390
|
});
|
|
397
|
-
})();
|
|
391
|
+
}).call(this);
|
|
398
392
|
}
|
|
399
393
|
},
|
|
400
394
|
{
|
|
@@ -486,7 +480,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
486
480
|
_define_property(Control, "mode", 'Designer');
|
|
487
481
|
_define_property(Control, "slots", void 0);
|
|
488
482
|
_define_property(Control, "slotPosition", void 0);
|
|
489
|
-
_define_property(Control, "controlName", '
|
|
483
|
+
_define_property(Control, "controlName", getLocaleText('CMD.7baf1751712168384'));
|
|
490
484
|
_define_property(Control, "controlIcon", 'icon');
|
|
491
485
|
_define_property(Control, "controlType", 'control');
|
|
492
486
|
_define_property(Control, "controlFieldType", void 0);
|
|
@@ -44,8 +44,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
44
44
|
"use strict";
|
|
45
45
|
function Control(props) {
|
|
46
46
|
_class_call_check(this, Control);
|
|
47
|
-
_define_property(this, "id", void 0 // 唯一标识符
|
|
48
|
-
);
|
|
47
|
+
_define_property(this, "id", void 0); // 唯一标识符
|
|
49
48
|
_define_property(this, "type", void 0);
|
|
50
49
|
_define_property(this, "controlType", void 0);
|
|
51
50
|
_define_property(this, "props", void 0);
|
|
@@ -208,7 +208,7 @@ function _is_native_reflect_construct() {
|
|
|
208
208
|
})();
|
|
209
209
|
}
|
|
210
210
|
function _ts_generator(thisArg, body) {
|
|
211
|
-
var f, y, t,
|
|
211
|
+
var f, y, t, _ = {
|
|
212
212
|
label: 0,
|
|
213
213
|
sent: function() {
|
|
214
214
|
if (t[0] & 1) throw t[1];
|
|
@@ -216,12 +216,8 @@ function _ts_generator(thisArg, body) {
|
|
|
216
216
|
},
|
|
217
217
|
trys: [],
|
|
218
218
|
ops: []
|
|
219
|
-
};
|
|
220
|
-
return g = {
|
|
221
|
-
next: verb(0),
|
|
222
|
-
"throw": verb(1),
|
|
223
|
-
"return": verb(2)
|
|
224
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
219
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
220
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
225
221
|
return this;
|
|
226
222
|
}), g;
|
|
227
223
|
function verb(n) {
|
|
@@ -234,7 +230,7 @@ function _ts_generator(thisArg, body) {
|
|
|
234
230
|
}
|
|
235
231
|
function step(op) {
|
|
236
232
|
if (f) throw new TypeError("Generator is already executing.");
|
|
237
|
-
while(_)try {
|
|
233
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
238
234
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
239
235
|
if (y = 0, t) op = [
|
|
240
236
|
op[0] & 2,
|
|
@@ -360,7 +356,7 @@ var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
|
|
|
360
356
|
_state.sent();
|
|
361
357
|
return [
|
|
362
358
|
4,
|
|
363
|
-
Promise.all(
|
|
359
|
+
Promise.all(this.children.map(function(child) {
|
|
364
360
|
return child.validate(messages, ignore);
|
|
365
361
|
}))
|
|
366
362
|
];
|
|
@@ -372,7 +368,7 @@ var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
|
|
|
372
368
|
];
|
|
373
369
|
}
|
|
374
370
|
});
|
|
375
|
-
})();
|
|
371
|
+
}).call(this);
|
|
376
372
|
}
|
|
377
373
|
},
|
|
378
374
|
{
|
|
@@ -201,7 +201,7 @@ function _is_native_reflect_construct() {
|
|
|
201
201
|
})();
|
|
202
202
|
}
|
|
203
203
|
function _ts_generator(thisArg, body) {
|
|
204
|
-
var f, y, t,
|
|
204
|
+
var f, y, t, _ = {
|
|
205
205
|
label: 0,
|
|
206
206
|
sent: function() {
|
|
207
207
|
if (t[0] & 1) throw t[1];
|
|
@@ -209,12 +209,8 @@ function _ts_generator(thisArg, body) {
|
|
|
209
209
|
},
|
|
210
210
|
trys: [],
|
|
211
211
|
ops: []
|
|
212
|
-
};
|
|
213
|
-
return g = {
|
|
214
|
-
next: verb(0),
|
|
215
|
-
"throw": verb(1),
|
|
216
|
-
"return": verb(2)
|
|
217
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
212
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
213
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
218
214
|
return this;
|
|
219
215
|
}), g;
|
|
220
216
|
function verb(n) {
|
|
@@ -227,7 +223,7 @@ function _ts_generator(thisArg, body) {
|
|
|
227
223
|
}
|
|
228
224
|
function step(op) {
|
|
229
225
|
if (f) throw new TypeError("Generator is already executing.");
|
|
230
|
-
while(_)try {
|
|
226
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
231
227
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
232
228
|
if (y = 0, t) op = [
|
|
233
229
|
op[0] & 2,
|
|
@@ -330,7 +326,7 @@ var ListControl = /*#__PURE__*/ function(DesignerControl) {
|
|
|
330
326
|
_state.sent();
|
|
331
327
|
return [
|
|
332
328
|
4,
|
|
333
|
-
Promise.all(
|
|
329
|
+
Promise.all(this.props.headers.map(function(child) {
|
|
334
330
|
return child.validate(messages, ignore);
|
|
335
331
|
}))
|
|
336
332
|
];
|
|
@@ -342,7 +338,7 @@ var ListControl = /*#__PURE__*/ function(DesignerControl) {
|
|
|
342
338
|
];
|
|
343
339
|
}
|
|
344
340
|
});
|
|
345
|
-
})();
|
|
341
|
+
}).call(this);
|
|
346
342
|
}
|
|
347
343
|
},
|
|
348
344
|
{
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
1
2
|
import Schema from 'async-validator';
|
|
2
3
|
var messages = {
|
|
3
|
-
required: '
|
|
4
|
-
maxLength: '
|
|
5
|
-
minLength: '
|
|
4
|
+
required: getLocaleText('CMD.aad41751712156995'),
|
|
5
|
+
maxLength: getLocaleText('CMD.890d1751712141808'),
|
|
6
|
+
minLength: getLocaleText('CMD.bb9b1751712143625'),
|
|
6
7
|
string: {
|
|
7
|
-
range: '
|
|
8
|
+
range: getLocaleText('CMD.f7131751712147855')
|
|
8
9
|
}
|
|
9
10
|
};
|
|
10
11
|
function createValidator(rules) {
|
|
@@ -147,17 +147,17 @@ export function initSuperDataSourceRules(props, attributes) {
|
|
|
147
147
|
dataCode: {
|
|
148
148
|
type: 'string',
|
|
149
149
|
required: true,
|
|
150
|
-
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseEnterDataCodeInDataSetting' : 'CMD.pleaseEnterDataCode', null, messageInDataSetting ? '
|
|
150
|
+
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseEnterDataCodeInDataSetting' : 'CMD.pleaseEnterDataCode', null, messageInDataSetting ? getLocaleText('CMD.c4901751712137782') : getLocaleText('CMD.8e161751712150947'))
|
|
151
151
|
},
|
|
152
152
|
valueFieldCode: {
|
|
153
153
|
type: 'string',
|
|
154
154
|
required: true,
|
|
155
|
-
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseEnterValueFieldCodeInDataSetting' : 'CMD.pleaseEnterValueFieldCode', null, messageInDataSetting ? '
|
|
155
|
+
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseEnterValueFieldCodeInDataSetting' : 'CMD.pleaseEnterValueFieldCode', null, messageInDataSetting ? getLocaleText('CMD.9af91751712139782') : getLocaleText('CMD.92701751712154242'))
|
|
156
156
|
},
|
|
157
157
|
svcCode: {
|
|
158
158
|
type: 'string',
|
|
159
159
|
required: true,
|
|
160
|
-
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseEnterSvcCodeInDataSetting' : 'CMD.pleaseEnterSvcCode', null, messageInDataSetting ? '
|
|
160
|
+
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseEnterSvcCodeInDataSetting' : 'CMD.pleaseEnterSvcCode', null, messageInDataSetting ? getLocaleText('CMD.203c1751712145631') : getLocaleText('CMD.9d361751712158465'))
|
|
161
161
|
},
|
|
162
162
|
attributes: [
|
|
163
163
|
{
|
|
@@ -188,11 +188,11 @@ export function initSuperDataSourceRules(props, attributes) {
|
|
|
188
188
|
type: 'array',
|
|
189
189
|
validator: function validator(rule, value, callback) {
|
|
190
190
|
if (value.length === 0) {
|
|
191
|
-
callback(getLocaleText(messageInDataSetting ? 'CMD.pleaseBindAtLeastOneDisplayValueInDataSetting' : 'CMD.pleaseBindAtLeastOneDisplayValue', null, messageInDataSetting ? '
|
|
191
|
+
callback(getLocaleText(messageInDataSetting ? 'CMD.pleaseBindAtLeastOneDisplayValueInDataSetting' : 'CMD.pleaseBindAtLeastOneDisplayValue', null, messageInDataSetting ? getLocaleText('CMD.6a071751712131459') : getLocaleText('CMD.52351751712149286')));
|
|
192
192
|
}
|
|
193
193
|
callback();
|
|
194
194
|
},
|
|
195
|
-
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseBindAtLeastOneDisplayValueInDataSetting' : 'CMD.pleaseBindAtLeastOneDisplayValue', null, messageInDataSetting ? '
|
|
195
|
+
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseBindAtLeastOneDisplayValueInDataSetting' : 'CMD.pleaseBindAtLeastOneDisplayValue', null, messageInDataSetting ? getLocaleText('CMD.6a071751712131459') : getLocaleText('CMD.52351751712149286'))
|
|
196
196
|
}
|
|
197
197
|
]
|
|
198
198
|
}
|