@byteluck-fe/model-driven-core 2.22.3-beta.1 → 2.22.3-beta.11
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 +14 -19
- package/dist/esm/common/ColumnControl/property.js +6 -6
- package/dist/esm/common/FormControl/property.js +15 -14
- 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/initLinkOperationRules.js +2 -2
- package/dist/esm/common/initOptionAndDataSourceRules.js +31 -30
- package/dist/esm/framework/index.js +18 -9
- package/dist/index.umd.js +1 -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';
|
|
@@ -315,17 +312,16 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
315
312
|
{
|
|
316
313
|
key: "preValidate",
|
|
317
314
|
value: function preValidate() {
|
|
318
|
-
var _this = this;
|
|
319
315
|
return _async_to_generator(function() {
|
|
320
316
|
var rules, results, result;
|
|
321
317
|
return _ts_generator(this, function(_state) {
|
|
322
318
|
switch(_state.label){
|
|
323
319
|
case 0:
|
|
324
320
|
// 在处理validate之前,预留的钩子函数,允许在validate之前处理一些数据
|
|
325
|
-
rules = _object_spread({},
|
|
321
|
+
rules = _object_spread({}, this.rules);
|
|
326
322
|
return [
|
|
327
323
|
4,
|
|
328
|
-
|
|
324
|
+
this._callControlHooks('preValidate', rules)
|
|
329
325
|
];
|
|
330
326
|
case 1:
|
|
331
327
|
results = _state.sent();
|
|
@@ -336,14 +332,13 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
336
332
|
];
|
|
337
333
|
}
|
|
338
334
|
});
|
|
339
|
-
})();
|
|
335
|
+
}).call(this);
|
|
340
336
|
}
|
|
341
337
|
},
|
|
342
338
|
{
|
|
343
339
|
key: "validate",
|
|
344
340
|
value: // property校验
|
|
345
341
|
function validate(messages, ignore) {
|
|
346
|
-
var _this = this;
|
|
347
342
|
return _async_to_generator(function() {
|
|
348
343
|
var result, rules, validator, err;
|
|
349
344
|
return _ts_generator(this, function(_state) {
|
|
@@ -351,11 +346,11 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
351
346
|
case 0:
|
|
352
347
|
return [
|
|
353
348
|
4,
|
|
354
|
-
|
|
349
|
+
this.preValidate()
|
|
355
350
|
];
|
|
356
351
|
case 1:
|
|
357
352
|
result = _state.sent();
|
|
358
|
-
rules = result !== undefined ? result : _object_spread({},
|
|
353
|
+
rules = result !== undefined ? result : _object_spread({}, this.rules);
|
|
359
354
|
if (Array.isArray(ignore)) {
|
|
360
355
|
ignore.forEach(function(key) {
|
|
361
356
|
if (rules.hasOwnProperty(key)) {
|
|
@@ -374,7 +369,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
374
369
|
]);
|
|
375
370
|
return [
|
|
376
371
|
4,
|
|
377
|
-
validator.validate(
|
|
372
|
+
validator.validate(this.props)
|
|
378
373
|
];
|
|
379
374
|
case 3:
|
|
380
375
|
_state.sent();
|
|
@@ -385,7 +380,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
385
380
|
case 4:
|
|
386
381
|
err = _state.sent();
|
|
387
382
|
if (!err.control) {
|
|
388
|
-
err.control =
|
|
383
|
+
err.control = this;
|
|
389
384
|
}
|
|
390
385
|
throw err;
|
|
391
386
|
case 5:
|
|
@@ -394,7 +389,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
394
389
|
];
|
|
395
390
|
}
|
|
396
391
|
});
|
|
397
|
-
})();
|
|
392
|
+
}).call(this);
|
|
398
393
|
}
|
|
399
394
|
},
|
|
400
395
|
{
|
|
@@ -486,7 +481,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
486
481
|
_define_property(Control, "mode", 'Designer');
|
|
487
482
|
_define_property(Control, "slots", void 0);
|
|
488
483
|
_define_property(Control, "slotPosition", void 0);
|
|
489
|
-
_define_property(Control, "controlName", '
|
|
484
|
+
_define_property(Control, "controlName", getLocaleText('CMD.7baf1751712168384'));
|
|
490
485
|
_define_property(Control, "controlIcon", 'icon');
|
|
491
486
|
_define_property(Control, "controlType", 'control');
|
|
492
487
|
_define_property(Control, "controlFieldType", void 0);
|
|
@@ -71,9 +71,9 @@ function _is_native_reflect_construct() {
|
|
|
71
71
|
})();
|
|
72
72
|
}
|
|
73
73
|
import { Property, PropertyRules } from '../BaseControl';
|
|
74
|
-
import { RulesMessage } from '@byteluck-fe/model-driven-shared';
|
|
75
74
|
import { initOptionAndDataSourceRules } from '../initOptionAndDataSourceRules';
|
|
76
75
|
import { DataBind, AutoWidth } from '../../framework';
|
|
76
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
77
77
|
var ColumnControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
78
78
|
"use strict";
|
|
79
79
|
_inherits(ColumnControlPropertyRules, PropertyRules);
|
|
@@ -85,11 +85,11 @@ var ColumnControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
85
85
|
]), _define_property(_this, "caption", {
|
|
86
86
|
type: 'string',
|
|
87
87
|
required: true,
|
|
88
|
-
message:
|
|
88
|
+
message: getLocaleText('CMD.pleaseEnterCaption', null, '请输入标题')
|
|
89
89
|
}), _define_property(_this, "width", {
|
|
90
90
|
type: 'number',
|
|
91
91
|
required: false,
|
|
92
|
-
message:
|
|
92
|
+
message: getLocaleText('CMD.pleaseEnterColumnWidth', null, '请输入列宽')
|
|
93
93
|
});
|
|
94
94
|
_this.width.required = props.widthType === 'px';
|
|
95
95
|
return _this;
|
|
@@ -168,16 +168,16 @@ var ColumnOptionAndDataSourcePropertyRules = /*#__PURE__*/ function(ColumnContro
|
|
|
168
168
|
'datasource',
|
|
169
169
|
'none'
|
|
170
170
|
],
|
|
171
|
-
message:
|
|
171
|
+
message: getLocaleText('CMD.PleaseSelectTheCorrectOptionSettings', null, '请选择正确的选项设置')
|
|
172
172
|
}), _define_property(_this, "options", [
|
|
173
173
|
{
|
|
174
174
|
type: 'array',
|
|
175
|
-
message:
|
|
175
|
+
message: getLocaleText('CMD.isNotArray', null, '请输入一个数组')
|
|
176
176
|
}
|
|
177
177
|
]), _define_property(_this, "datasourceBind", [
|
|
178
178
|
{
|
|
179
179
|
type: 'object',
|
|
180
|
-
message:
|
|
180
|
+
message: getLocaleText('CMD.isNotObject', null, '请输入一个对象')
|
|
181
181
|
}
|
|
182
182
|
]);
|
|
183
183
|
initOptionAndDataSourceRules.call(_this, props);
|
|
@@ -70,11 +70,12 @@ function _is_native_reflect_construct() {
|
|
|
70
70
|
return !!result;
|
|
71
71
|
})();
|
|
72
72
|
}
|
|
73
|
-
import {
|
|
73
|
+
import { JSONCopy } from '@byteluck-fe/model-driven-shared';
|
|
74
74
|
import { Property, PropertyRules, PropertyRuntimeRules } from '../BaseControl';
|
|
75
75
|
import { initOptionAndDataSourceRules } from '../initOptionAndDataSourceRules';
|
|
76
76
|
import { DataBind } from '../../framework';
|
|
77
77
|
import { isDataBind } from '../../framework/isDataBind';
|
|
78
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
78
79
|
var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
79
80
|
"use strict";
|
|
80
81
|
_inherits(BaseControlPropertyRules, PropertyRules);
|
|
@@ -86,7 +87,7 @@ var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
86
87
|
]), _define_property(_this, "dataBind", {}), _define_property(_this, "caption", {
|
|
87
88
|
type: 'string',
|
|
88
89
|
required: true,
|
|
89
|
-
message:
|
|
90
|
+
message: getLocaleText('CMD.pleaseEnterCaption', null, '请输入标题')
|
|
90
91
|
}), _define_property(_this, "isHideCaption", {
|
|
91
92
|
type: 'boolean'
|
|
92
93
|
}), _define_property(_this, "labelPosition", {
|
|
@@ -99,7 +100,7 @@ var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
99
100
|
// public placeholder: RuleItem = {
|
|
100
101
|
// required: true,
|
|
101
102
|
// type: 'string',
|
|
102
|
-
// message:
|
|
103
|
+
// message: getLocaleText('CMD.pleaseEnterPlaceholder',null,'请输入提示文字'),
|
|
103
104
|
// }
|
|
104
105
|
_define_property(_this, "defaultState", {
|
|
105
106
|
type: 'enum',
|
|
@@ -112,19 +113,19 @@ var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
112
113
|
}), _define_property(_this, "captionTip", {
|
|
113
114
|
type: 'string',
|
|
114
115
|
required: false,
|
|
115
|
-
message:
|
|
116
|
+
message: getLocaleText('CMD.pleaseEnterCaptionTip', null, '请输入气泡提示语')
|
|
116
117
|
});
|
|
117
118
|
// 初始化dataBind的校验规则
|
|
118
119
|
var validateFields = {
|
|
119
120
|
fieldCode: {
|
|
120
121
|
type: 'string',
|
|
121
122
|
required: true,
|
|
122
|
-
message:
|
|
123
|
+
message: getLocaleText('CMD.pleaseEnterFieldCode', null, '请绑定数据项')
|
|
123
124
|
},
|
|
124
125
|
dataCode: {
|
|
125
126
|
type: 'string',
|
|
126
127
|
required: true,
|
|
127
|
-
message:
|
|
128
|
+
message: getLocaleText('CMD.pleaseEnterFieldCode', null, '请绑定数据项')
|
|
128
129
|
}
|
|
129
130
|
};
|
|
130
131
|
// if (props.dataBind instanceof DataBind) {
|
|
@@ -133,14 +134,14 @@ var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
133
134
|
type: 'object',
|
|
134
135
|
required: true,
|
|
135
136
|
fields: JSONCopy(validateFields),
|
|
136
|
-
message:
|
|
137
|
+
message: getLocaleText('CMD.pleaseEnterFieldCode', null, '请绑定数据项')
|
|
137
138
|
};
|
|
138
139
|
} else {
|
|
139
140
|
var dataBind = {
|
|
140
141
|
type: 'object',
|
|
141
142
|
required: true,
|
|
142
143
|
fields: {},
|
|
143
|
-
message:
|
|
144
|
+
message: getLocaleText('CMD.pleaseEnterFieldCode', null, '请绑定数据项')
|
|
144
145
|
};
|
|
145
146
|
Object.keys(props.dataBind).forEach(function(key) {
|
|
146
147
|
;
|
|
@@ -148,7 +149,7 @@ var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
148
149
|
type: 'object',
|
|
149
150
|
required: true,
|
|
150
151
|
fields: JSONCopy(validateFields),
|
|
151
|
-
message:
|
|
152
|
+
message: getLocaleText('CMD.pleaseEnterFieldCode', null, '请绑定数据项')
|
|
152
153
|
};
|
|
153
154
|
});
|
|
154
155
|
_this.dataBind = dataBind;
|
|
@@ -174,9 +175,9 @@ var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(PropertyRuntimeRule
|
|
|
174
175
|
_this.push({
|
|
175
176
|
type: 'string',
|
|
176
177
|
required: isRequired,
|
|
177
|
-
message: props.requiredMessage !== '' ? props.requiredMessage :
|
|
178
|
+
message: props.requiredMessage !== '' ? props.requiredMessage : getLocaleText('CMD.runtimeRequired', {
|
|
178
179
|
caption: props.caption
|
|
179
|
-
})
|
|
180
|
+
}, '{caption}必填')
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
183
|
return _this;
|
|
@@ -278,16 +279,16 @@ var OptionAndDataSourcePropertyRules = /*#__PURE__*/ function(BaseControlPropert
|
|
|
278
279
|
'custom',
|
|
279
280
|
'datasource'
|
|
280
281
|
],
|
|
281
|
-
message:
|
|
282
|
+
message: getLocaleText('CMD.PleaseSelectTheCorrectOptionSettings', null, '请选择正确的选项设置')
|
|
282
283
|
}), _define_property(_this, "options", [
|
|
283
284
|
{
|
|
284
285
|
type: 'array',
|
|
285
|
-
message:
|
|
286
|
+
message: getLocaleText('CMD.isNotArray', null, '请输入一个数组')
|
|
286
287
|
}
|
|
287
288
|
]), _define_property(_this, "datasourceBind", [
|
|
288
289
|
{
|
|
289
290
|
type: 'object',
|
|
290
|
-
message:
|
|
291
|
+
message: getLocaleText('CMD.isNotObject', null, '请输入一个对象')
|
|
291
292
|
}
|
|
292
293
|
]);
|
|
293
294
|
initOptionAndDataSourceRules.call(_this, props);
|
|
@@ -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) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
2
2
|
export function initLinkOperationRules(props) {
|
|
3
3
|
if (props.hasOwnProperty('linkOperationOption') && props.hasOwnProperty('showLinkOperation') && props.showLinkOperation) {
|
|
4
4
|
this.linkOperationOption = [
|
|
@@ -8,7 +8,7 @@ export function initLinkOperationRules(props) {
|
|
|
8
8
|
formKey: {
|
|
9
9
|
type: 'string',
|
|
10
10
|
required: true,
|
|
11
|
-
message:
|
|
11
|
+
message: getLocaleText('CMD.pleaseEnterForm', null, '请绑定表单')
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { getNotRepeatItems
|
|
1
|
+
import { getNotRepeatItems } from '@byteluck-fe/model-driven-shared';
|
|
2
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
2
3
|
export function initOptionAndDataSourceRules(props) {
|
|
3
4
|
if (!props.hasOwnProperty('optionConfig')) {
|
|
4
5
|
this.optionConfig = {
|
|
@@ -20,7 +21,7 @@ export function initOptionAndDataSourceRules(props) {
|
|
|
20
21
|
this.options = [
|
|
21
22
|
{
|
|
22
23
|
type: 'array',
|
|
23
|
-
message:
|
|
24
|
+
message: getLocaleText('CMD.isNotArray', null, '请输入一个数组')
|
|
24
25
|
},
|
|
25
26
|
{
|
|
26
27
|
type: 'array',
|
|
@@ -30,12 +31,12 @@ export function initOptionAndDataSourceRules(props) {
|
|
|
30
31
|
label: {
|
|
31
32
|
type: 'string',
|
|
32
33
|
required: true,
|
|
33
|
-
message:
|
|
34
|
+
message: getLocaleText('CMD.pleaseEnterLabel', null, '请输入显示值')
|
|
34
35
|
},
|
|
35
36
|
value: {
|
|
36
37
|
type: 'string',
|
|
37
38
|
required: true,
|
|
38
|
-
message:
|
|
39
|
+
message: getLocaleText('CMD.pleaseEnterValue', null, '请输入存储值')
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -44,7 +45,7 @@ export function initOptionAndDataSourceRules(props) {
|
|
|
44
45
|
type: 'array',
|
|
45
46
|
validator: function validator(rule, value, callback) {
|
|
46
47
|
if (value.length === 0) {
|
|
47
|
-
callback(
|
|
48
|
+
callback(getLocaleText('CMD.optionIsRequired', null, '请输入至少一条选项'));
|
|
48
49
|
}
|
|
49
50
|
callback();
|
|
50
51
|
}
|
|
@@ -57,19 +58,19 @@ export function initOptionAndDataSourceRules(props) {
|
|
|
57
58
|
});
|
|
58
59
|
var notRepeatIds = getNotRepeatItems(ids);
|
|
59
60
|
if (ids.length !== notRepeatIds.length) {
|
|
60
|
-
callback(
|
|
61
|
+
callback(getLocaleText('CMD.optionIdIsRepeat', null, '选项ID不能重复'));
|
|
61
62
|
} else {
|
|
62
63
|
callback();
|
|
63
64
|
}
|
|
64
65
|
},
|
|
65
|
-
message:
|
|
66
|
+
message: getLocaleText('CMD.optionIdIsRepeat', null, '选项ID不能重复')
|
|
66
67
|
}
|
|
67
68
|
];
|
|
68
69
|
} else if (props.hasOwnProperty('datasourceBind') && (!props.hasOwnProperty('optionConfig') || props.hasOwnProperty('optionConfig') && props.optionConfig === 'datasource')) {
|
|
69
70
|
this.datasourceBind = [
|
|
70
71
|
{
|
|
71
72
|
type: 'object',
|
|
72
|
-
message:
|
|
73
|
+
message: getLocaleText('CMD.isNotObject', null, '请输入一个对象')
|
|
73
74
|
},
|
|
74
75
|
{
|
|
75
76
|
type: 'object',
|
|
@@ -77,38 +78,38 @@ export function initOptionAndDataSourceRules(props) {
|
|
|
77
78
|
dataCode: {
|
|
78
79
|
type: 'string',
|
|
79
80
|
required: true,
|
|
80
|
-
message:
|
|
81
|
+
message: getLocaleText('CMD.pleaseEnterDataCode', null, '请绑定业务模型')
|
|
81
82
|
},
|
|
82
83
|
valueFieldCode: {
|
|
83
84
|
type: 'string',
|
|
84
85
|
required: true,
|
|
85
|
-
message:
|
|
86
|
+
message: getLocaleText('CMD.pleaseEnterValueFieldCode', null, '请绑定存储值')
|
|
86
87
|
},
|
|
87
88
|
svcCode: {
|
|
88
89
|
type: 'string',
|
|
89
90
|
required: true,
|
|
90
|
-
message:
|
|
91
|
+
message: getLocaleText('CMD.pleaseEnterSvcCode', null, '请绑定服务')
|
|
91
92
|
},
|
|
92
93
|
displayBoList: [
|
|
93
94
|
{
|
|
94
95
|
type: 'array',
|
|
95
|
-
message:
|
|
96
|
+
message: getLocaleText('CMD.isNotArray', null, '请输入一个数组')
|
|
96
97
|
},
|
|
97
98
|
{
|
|
98
99
|
type: 'array',
|
|
99
100
|
validator: function validator(rule, value, callback) {
|
|
100
101
|
if (value.length === 0) {
|
|
101
|
-
callback(
|
|
102
|
+
callback(getLocaleText('CMD.pleaseBindAtLeastOneDisplayValue', null, '至少绑定一个显示值'));
|
|
102
103
|
}
|
|
103
104
|
callback();
|
|
104
105
|
},
|
|
105
|
-
message:
|
|
106
|
+
message: getLocaleText('CMD.pleaseBindAtLeastOneDisplayValue', null, '至少绑定一个显示值')
|
|
106
107
|
}
|
|
107
108
|
],
|
|
108
109
|
orders: [
|
|
109
110
|
{
|
|
110
111
|
type: 'array',
|
|
111
|
-
message:
|
|
112
|
+
message: getLocaleText('CMD.isNotArray', null, '请输入一个数组')
|
|
112
113
|
},
|
|
113
114
|
{
|
|
114
115
|
type: 'array',
|
|
@@ -118,11 +119,11 @@ export function initOptionAndDataSourceRules(props) {
|
|
|
118
119
|
columnName: {
|
|
119
120
|
type: 'string',
|
|
120
121
|
required: true,
|
|
121
|
-
message:
|
|
122
|
+
message: getLocaleText('CMD.pleaseEnterFieldCode', null, '请绑定数据项')
|
|
122
123
|
},
|
|
123
124
|
desc: {
|
|
124
125
|
type: 'boolean',
|
|
125
|
-
message:
|
|
126
|
+
message: getLocaleText('CMD.isNotBoolean', null, '请输入一个布尔')
|
|
126
127
|
}
|
|
127
128
|
}
|
|
128
129
|
}
|
|
@@ -138,7 +139,7 @@ export function initSuperDataSourceRules(props, attributes) {
|
|
|
138
139
|
this.datasourceBind = [
|
|
139
140
|
{
|
|
140
141
|
type: 'object',
|
|
141
|
-
message:
|
|
142
|
+
message: getLocaleText('CMD.isNotObject', null, '请输入一个对象')
|
|
142
143
|
},
|
|
143
144
|
{
|
|
144
145
|
type: 'object',
|
|
@@ -146,22 +147,22 @@ export function initSuperDataSourceRules(props, attributes) {
|
|
|
146
147
|
dataCode: {
|
|
147
148
|
type: 'string',
|
|
148
149
|
required: true,
|
|
149
|
-
message:
|
|
150
|
+
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseEnterDataCodeInDataSetting' : 'CMD.pleaseEnterDataCode', null, messageInDataSetting ? getLocaleText('CMD.c4901751712137782') : getLocaleText('CMD.8e161751712150947'))
|
|
150
151
|
},
|
|
151
152
|
valueFieldCode: {
|
|
152
153
|
type: 'string',
|
|
153
154
|
required: true,
|
|
154
|
-
message:
|
|
155
|
+
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseEnterValueFieldCodeInDataSetting' : 'CMD.pleaseEnterValueFieldCode', null, messageInDataSetting ? getLocaleText('CMD.9af91751712139782') : getLocaleText('CMD.92701751712154242'))
|
|
155
156
|
},
|
|
156
157
|
svcCode: {
|
|
157
158
|
type: 'string',
|
|
158
159
|
required: true,
|
|
159
|
-
message:
|
|
160
|
+
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseEnterSvcCodeInDataSetting' : 'CMD.pleaseEnterSvcCode', null, messageInDataSetting ? getLocaleText('CMD.203c1751712145631') : getLocaleText('CMD.9d361751712158465'))
|
|
160
161
|
},
|
|
161
162
|
attributes: [
|
|
162
163
|
{
|
|
163
164
|
type: 'array',
|
|
164
|
-
message:
|
|
165
|
+
message: getLocaleText('CMD.isNotArray', null, '请输入一个数组')
|
|
165
166
|
},
|
|
166
167
|
{
|
|
167
168
|
type: 'array',
|
|
@@ -171,27 +172,27 @@ export function initSuperDataSourceRules(props, attributes) {
|
|
|
171
172
|
name: {
|
|
172
173
|
type: 'string',
|
|
173
174
|
required: true,
|
|
174
|
-
message:
|
|
175
|
+
message: getLocaleText('CMD.isNotString', null, '请输入一个字符串')
|
|
175
176
|
},
|
|
176
177
|
key: {
|
|
177
178
|
type: 'string',
|
|
178
179
|
required: true,
|
|
179
|
-
message:
|
|
180
|
+
message: getLocaleText('CMD.isNotString', null, '请输入一个字符串')
|
|
180
181
|
},
|
|
181
182
|
value: [
|
|
182
183
|
{
|
|
183
184
|
type: 'array',
|
|
184
|
-
message:
|
|
185
|
+
message: getLocaleText('CMD.isNotArray', null, '请输入一个数组')
|
|
185
186
|
},
|
|
186
187
|
{
|
|
187
188
|
type: 'array',
|
|
188
189
|
validator: function validator(rule, value, callback) {
|
|
189
190
|
if (value.length === 0) {
|
|
190
|
-
callback(
|
|
191
|
+
callback(getLocaleText(messageInDataSetting ? 'CMD.pleaseBindAtLeastOneDisplayValueInDataSetting' : 'CMD.pleaseBindAtLeastOneDisplayValue', null, messageInDataSetting ? getLocaleText('CMD.6a071751712131459') : getLocaleText('CMD.52351751712149286')));
|
|
191
192
|
}
|
|
192
193
|
callback();
|
|
193
194
|
},
|
|
194
|
-
message:
|
|
195
|
+
message: getLocaleText(messageInDataSetting ? 'CMD.pleaseBindAtLeastOneDisplayValueInDataSetting' : 'CMD.pleaseBindAtLeastOneDisplayValue', null, messageInDataSetting ? getLocaleText('CMD.6a071751712131459') : getLocaleText('CMD.52351751712149286'))
|
|
195
196
|
}
|
|
196
197
|
]
|
|
197
198
|
}
|
|
@@ -201,7 +202,7 @@ export function initSuperDataSourceRules(props, attributes) {
|
|
|
201
202
|
orders: [
|
|
202
203
|
{
|
|
203
204
|
type: 'array',
|
|
204
|
-
message:
|
|
205
|
+
message: getLocaleText('CMD.isNotArray', null, '请输入一个数组')
|
|
205
206
|
},
|
|
206
207
|
{
|
|
207
208
|
type: 'array',
|
|
@@ -211,11 +212,11 @@ export function initSuperDataSourceRules(props, attributes) {
|
|
|
211
212
|
columnName: {
|
|
212
213
|
type: 'string',
|
|
213
214
|
required: true,
|
|
214
|
-
message:
|
|
215
|
+
message: getLocaleText('CMD.pleaseEnterFieldCode', null, '请绑定数据项')
|
|
215
216
|
},
|
|
216
217
|
desc: {
|
|
217
218
|
type: 'boolean',
|
|
218
|
-
message:
|
|
219
|
+
message: getLocaleText('CMD.isNotBoolean', null, '请输入一个布尔')
|
|
219
220
|
}
|
|
220
221
|
}
|
|
221
222
|
}
|