@byteluck-fe/model-driven-core 2.0.1 → 2.1.0-beta.0
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 +174 -68
- package/dist/esm/common/BaseControl/property.js +4 -4
- package/dist/esm/common/BaseControl/runtime.js +11 -11
- package/dist/esm/common/ColumnControl/property.js +10 -10
- package/dist/esm/common/ControlArray.js +4 -4
- package/dist/esm/common/FormControl/designer.js +1 -1
- package/dist/esm/common/FormControl/property.js +22 -22
- package/dist/esm/common/LayoutControl/designer.js +118 -18
- package/dist/esm/common/ListControl/designer.js +117 -17
- package/dist/esm/common/ListControl/runtime.js +19 -0
- package/dist/esm/common/initOptionAndDataSourceRules.js +8 -8
- package/dist/esm/framework/index.js +240 -240
- package/dist/index.umd.js +1 -1
- package/dist/types/common/ListControl/runtime.d.ts +17 -0
- package/dist/types/common/Validator.d.ts +1 -1
- package/dist/types/common/controlHooksEmitter.d.ts +1 -1
- package/dist/types/type.d.ts +23 -23
- package/package.json +3 -3
|
@@ -205,7 +205,101 @@ function _createSuper(Derived) {
|
|
|
205
205
|
return _possibleConstructorReturn(this, result);
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
-
|
|
208
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
209
|
+
var f, y, t, g, _ = {
|
|
210
|
+
label: 0,
|
|
211
|
+
sent: function() {
|
|
212
|
+
if (t[0] & 1) throw t[1];
|
|
213
|
+
return t[1];
|
|
214
|
+
},
|
|
215
|
+
trys: [],
|
|
216
|
+
ops: []
|
|
217
|
+
};
|
|
218
|
+
return g = {
|
|
219
|
+
next: verb(0),
|
|
220
|
+
"throw": verb(1),
|
|
221
|
+
"return": verb(2)
|
|
222
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
223
|
+
return this;
|
|
224
|
+
}), g;
|
|
225
|
+
function verb(n) {
|
|
226
|
+
return function(v) {
|
|
227
|
+
return step([
|
|
228
|
+
n,
|
|
229
|
+
v
|
|
230
|
+
]);
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function step(op) {
|
|
234
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
235
|
+
while(_)try {
|
|
236
|
+
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;
|
|
237
|
+
if (y = 0, t) op = [
|
|
238
|
+
op[0] & 2,
|
|
239
|
+
t.value
|
|
240
|
+
];
|
|
241
|
+
switch(op[0]){
|
|
242
|
+
case 0:
|
|
243
|
+
case 1:
|
|
244
|
+
t = op;
|
|
245
|
+
break;
|
|
246
|
+
case 4:
|
|
247
|
+
_.label++;
|
|
248
|
+
return {
|
|
249
|
+
value: op[1],
|
|
250
|
+
done: false
|
|
251
|
+
};
|
|
252
|
+
case 5:
|
|
253
|
+
_.label++;
|
|
254
|
+
y = op[1];
|
|
255
|
+
op = [
|
|
256
|
+
0
|
|
257
|
+
];
|
|
258
|
+
continue;
|
|
259
|
+
case 7:
|
|
260
|
+
op = _.ops.pop();
|
|
261
|
+
_.trys.pop();
|
|
262
|
+
continue;
|
|
263
|
+
default:
|
|
264
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
265
|
+
_ = 0;
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
269
|
+
_.label = op[1];
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
273
|
+
_.label = t[1];
|
|
274
|
+
t = op;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
if (t && _.label < t[2]) {
|
|
278
|
+
_.label = t[2];
|
|
279
|
+
_.ops.push(op);
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
if (t[2]) _.ops.pop();
|
|
283
|
+
_.trys.pop();
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
op = body.call(thisArg, _);
|
|
287
|
+
} catch (e) {
|
|
288
|
+
op = [
|
|
289
|
+
6,
|
|
290
|
+
e
|
|
291
|
+
];
|
|
292
|
+
y = 0;
|
|
293
|
+
} finally{
|
|
294
|
+
f = t = 0;
|
|
295
|
+
}
|
|
296
|
+
if (op[0] & 5) throw op[1];
|
|
297
|
+
return {
|
|
298
|
+
value: op[0] ? op[1] : void 0,
|
|
299
|
+
done: true
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
};
|
|
209
303
|
import { JSONCopy } from "@byteluck-fe/model-driven-shared";
|
|
210
304
|
import { DesignerControl } from "../BaseControl";
|
|
211
305
|
import LayoutControlProperty from "./property";
|
|
@@ -221,7 +315,7 @@ var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
|
|
|
221
315
|
var _this;
|
|
222
316
|
_this = _super.call(this, props);
|
|
223
317
|
_this.controlType = "layout";
|
|
224
|
-
var
|
|
318
|
+
var _ref = _instanceof(this, LayoutControl) ? this.constructor : void 0, excludes = _ref.excludes, childrenMaxLength = _ref.childrenMaxLength;
|
|
225
319
|
_this.props = new LayoutControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
226
320
|
defineControlArrayToProperty(_assertThisInitialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
227
321
|
_this.excludes = JSONCopy(excludes);
|
|
@@ -244,25 +338,31 @@ var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
|
|
|
244
338
|
var _this1 = this, _superprop_get_validate = function() {
|
|
245
339
|
return _get(_getPrototypeOf(LayoutControl.prototype), "validate", _this);
|
|
246
340
|
};
|
|
247
|
-
return _asyncToGenerator(
|
|
248
|
-
return
|
|
249
|
-
|
|
341
|
+
return _asyncToGenerator(function() {
|
|
342
|
+
return __generator(this, function(_state) {
|
|
343
|
+
switch(_state.label){
|
|
250
344
|
case 0:
|
|
251
|
-
|
|
252
|
-
|
|
345
|
+
return [
|
|
346
|
+
4,
|
|
347
|
+
_superprop_get_validate().call(_this1, messages, ignore)
|
|
348
|
+
];
|
|
349
|
+
case 1:
|
|
350
|
+
_state.sent();
|
|
351
|
+
return [
|
|
352
|
+
4,
|
|
353
|
+
Promise.all(_this1.children.map(function(child) {
|
|
354
|
+
return child.validate(messages, ignore);
|
|
355
|
+
}))
|
|
356
|
+
];
|
|
253
357
|
case 2:
|
|
254
|
-
|
|
255
|
-
return
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
return _ctx.abrupt("return", true);
|
|
260
|
-
case 5:
|
|
261
|
-
case "end":
|
|
262
|
-
return _ctx.stop();
|
|
358
|
+
_state.sent();
|
|
359
|
+
return [
|
|
360
|
+
2,
|
|
361
|
+
true
|
|
362
|
+
];
|
|
263
363
|
}
|
|
264
|
-
}
|
|
265
|
-
})
|
|
364
|
+
});
|
|
365
|
+
})();
|
|
266
366
|
};
|
|
267
367
|
_proto.toDataBindModel = function toDataBindModel() {
|
|
268
368
|
var parentId = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
@@ -198,7 +198,101 @@ function _createSuper(Derived) {
|
|
|
198
198
|
return _possibleConstructorReturn(this, result);
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
|
-
|
|
201
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
202
|
+
var f, y, t, g, _ = {
|
|
203
|
+
label: 0,
|
|
204
|
+
sent: function() {
|
|
205
|
+
if (t[0] & 1) throw t[1];
|
|
206
|
+
return t[1];
|
|
207
|
+
},
|
|
208
|
+
trys: [],
|
|
209
|
+
ops: []
|
|
210
|
+
};
|
|
211
|
+
return g = {
|
|
212
|
+
next: verb(0),
|
|
213
|
+
"throw": verb(1),
|
|
214
|
+
"return": verb(2)
|
|
215
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
216
|
+
return this;
|
|
217
|
+
}), g;
|
|
218
|
+
function verb(n) {
|
|
219
|
+
return function(v) {
|
|
220
|
+
return step([
|
|
221
|
+
n,
|
|
222
|
+
v
|
|
223
|
+
]);
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function step(op) {
|
|
227
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
228
|
+
while(_)try {
|
|
229
|
+
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;
|
|
230
|
+
if (y = 0, t) op = [
|
|
231
|
+
op[0] & 2,
|
|
232
|
+
t.value
|
|
233
|
+
];
|
|
234
|
+
switch(op[0]){
|
|
235
|
+
case 0:
|
|
236
|
+
case 1:
|
|
237
|
+
t = op;
|
|
238
|
+
break;
|
|
239
|
+
case 4:
|
|
240
|
+
_.label++;
|
|
241
|
+
return {
|
|
242
|
+
value: op[1],
|
|
243
|
+
done: false
|
|
244
|
+
};
|
|
245
|
+
case 5:
|
|
246
|
+
_.label++;
|
|
247
|
+
y = op[1];
|
|
248
|
+
op = [
|
|
249
|
+
0
|
|
250
|
+
];
|
|
251
|
+
continue;
|
|
252
|
+
case 7:
|
|
253
|
+
op = _.ops.pop();
|
|
254
|
+
_.trys.pop();
|
|
255
|
+
continue;
|
|
256
|
+
default:
|
|
257
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
258
|
+
_ = 0;
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
262
|
+
_.label = op[1];
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
266
|
+
_.label = t[1];
|
|
267
|
+
t = op;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
if (t && _.label < t[2]) {
|
|
271
|
+
_.label = t[2];
|
|
272
|
+
_.ops.push(op);
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
if (t[2]) _.ops.pop();
|
|
276
|
+
_.trys.pop();
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
op = body.call(thisArg, _);
|
|
280
|
+
} catch (e) {
|
|
281
|
+
op = [
|
|
282
|
+
6,
|
|
283
|
+
e
|
|
284
|
+
];
|
|
285
|
+
y = 0;
|
|
286
|
+
} finally{
|
|
287
|
+
f = t = 0;
|
|
288
|
+
}
|
|
289
|
+
if (op[0] & 5) throw op[1];
|
|
290
|
+
return {
|
|
291
|
+
value: op[0] ? op[1] : void 0,
|
|
292
|
+
done: true
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
};
|
|
202
296
|
import { DesignerControl } from "../BaseControl";
|
|
203
297
|
import ListControlProperty from "./property";
|
|
204
298
|
import { FieldTypes } from "@byteluck-fe/model-driven-shared";
|
|
@@ -220,25 +314,31 @@ var ListControl = /*#__PURE__*/ function(DesignerControl) {
|
|
|
220
314
|
var _this1 = this, _superprop_get_validate = function() {
|
|
221
315
|
return _get(_getPrototypeOf(ListControl.prototype), "validate", _this);
|
|
222
316
|
};
|
|
223
|
-
return _asyncToGenerator(
|
|
224
|
-
return
|
|
225
|
-
|
|
317
|
+
return _asyncToGenerator(function() {
|
|
318
|
+
return __generator(this, function(_state) {
|
|
319
|
+
switch(_state.label){
|
|
226
320
|
case 0:
|
|
227
|
-
|
|
228
|
-
|
|
321
|
+
return [
|
|
322
|
+
4,
|
|
323
|
+
_superprop_get_validate().call(_this1, messages)
|
|
324
|
+
];
|
|
325
|
+
case 1:
|
|
326
|
+
_state.sent();
|
|
327
|
+
return [
|
|
328
|
+
4,
|
|
329
|
+
Promise.all(_this1.props.headers.map(function(child) {
|
|
330
|
+
return child.validate(messages, ignore);
|
|
331
|
+
}))
|
|
332
|
+
];
|
|
229
333
|
case 2:
|
|
230
|
-
|
|
231
|
-
return
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return _ctx.abrupt("return", true);
|
|
236
|
-
case 5:
|
|
237
|
-
case "end":
|
|
238
|
-
return _ctx.stop();
|
|
334
|
+
_state.sent();
|
|
335
|
+
return [
|
|
336
|
+
2,
|
|
337
|
+
true
|
|
338
|
+
];
|
|
239
339
|
}
|
|
240
|
-
}
|
|
241
|
-
})
|
|
340
|
+
});
|
|
341
|
+
})();
|
|
242
342
|
};
|
|
243
343
|
_proto.toDataBindModel = function toDataBindModel() {
|
|
244
344
|
var listModel = _get(_getPrototypeOf(ListControl.prototype), "toDataBindModel", this).call(this);
|
|
@@ -95,10 +95,29 @@ var ListControl = /*#__PURE__*/ function(RuntimeControl) {
|
|
|
95
95
|
var _this;
|
|
96
96
|
_this = _super.call(this, props);
|
|
97
97
|
_this.controlType = "list";
|
|
98
|
+
/** 明细子表控件的行级数据的 列控件的props 合集
|
|
99
|
+
* 无法用 instance.id 为key, 因为我们并不会对每行都创建 instance (他们都共享 headers 的instance)
|
|
100
|
+
* 但是还需要有修改props的需求,如 在一行数据中,A列要修改B列的 必填。 于是就得 把 A和B的props存下来
|
|
101
|
+
* TODO 老数据兼容,得把 老instance上的 props 给 存下来? 或许也不需要
|
|
102
|
+
*
|
|
103
|
+
* 当二开使用setInstance 修改props时候, 得动态调整 rowProps
|
|
104
|
+
* rowProps 数据结构:
|
|
105
|
+
* {
|
|
106
|
+
* [rowUid:]: {
|
|
107
|
+
* [instanceId]: PropsObj,
|
|
108
|
+
* [instanceId2]: PropsObj2,
|
|
109
|
+
* ...
|
|
110
|
+
* }
|
|
111
|
+
* }
|
|
112
|
+
*/ _this.rowProps = {};
|
|
98
113
|
_this.props = new ListControlProperty(_assertThisInitialized(_this), props === null || props === void 0 ? void 0 : props.props);
|
|
99
114
|
defineControlArrayToProperty(_assertThisInitialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
100
115
|
return _this;
|
|
101
116
|
}
|
|
117
|
+
var _proto = ListControl.prototype;
|
|
118
|
+
_proto.setRowProps = function setRowProps(rowProps) {
|
|
119
|
+
this.rowProps = rowProps;
|
|
120
|
+
};
|
|
102
121
|
_createClass(ListControl, [
|
|
103
122
|
{
|
|
104
123
|
key: "length",
|
|
@@ -63,7 +63,7 @@ export function initOptionAndDataSourceRules(props) {
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
message: RulesMessage.getMessage("optionIdIsRepeat")
|
|
66
|
-
}
|
|
66
|
+
}
|
|
67
67
|
];
|
|
68
68
|
} else if (props.hasOwnProperty("datasourceBind") && (!props.hasOwnProperty("optionConfig") || props.hasOwnProperty("optionConfig") && props.optionConfig === "datasource")) {
|
|
69
69
|
this.datasourceBind = [
|
|
@@ -103,7 +103,7 @@ export function initOptionAndDataSourceRules(props) {
|
|
|
103
103
|
callback();
|
|
104
104
|
},
|
|
105
105
|
message: RulesMessage.getMessage("pleaseBindAtLeastOneDisplayValue")
|
|
106
|
-
}
|
|
106
|
+
}
|
|
107
107
|
],
|
|
108
108
|
orders: [
|
|
109
109
|
{
|
|
@@ -126,10 +126,10 @@ export function initOptionAndDataSourceRules(props) {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
}
|
|
129
|
+
}
|
|
130
130
|
]
|
|
131
131
|
}
|
|
132
|
-
}
|
|
132
|
+
}
|
|
133
133
|
];
|
|
134
134
|
}
|
|
135
135
|
}
|
|
@@ -192,11 +192,11 @@ export function initSuperDataSourceRules(props, attributes) {
|
|
|
192
192
|
callback();
|
|
193
193
|
},
|
|
194
194
|
message: RulesMessage.getMessage(messageInDataSetting ? "pleaseBindAtLeastOneDisplayValueInDataSetting" : "pleaseBindAtLeastOneDisplayValue")
|
|
195
|
-
}
|
|
195
|
+
}
|
|
196
196
|
]
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
}
|
|
199
|
+
}
|
|
200
200
|
],
|
|
201
201
|
orders: [
|
|
202
202
|
{
|
|
@@ -219,9 +219,9 @@ export function initSuperDataSourceRules(props, attributes) {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
}
|
|
222
|
+
}
|
|
223
223
|
]
|
|
224
224
|
}
|
|
225
|
-
}
|
|
225
|
+
}
|
|
226
226
|
];
|
|
227
227
|
}
|