@byteluck-fe/model-driven-driven 2.2.0 → 2.2.1-beta.3
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/Driven.js +20 -17
- package/dist/esm/Store.js +4 -3
- package/dist/esm/designerUtils.js +2 -9
- package/dist/esm/utils.js +13 -13
- package/dist/index.umd.js +3 -3
- package/dist/types/Builder.d.ts +8 -8
- package/dist/types/Designer.d.ts +36 -36
- package/dist/types/Driven.d.ts +112 -112
- package/dist/types/EventLogic.d.ts +2 -2
- package/dist/types/Plugin.d.ts +6 -6
- package/dist/types/Store.d.ts +82 -82
- package/dist/types/constants.d.ts +6 -6
- package/dist/types/designerUtils.d.ts +4 -4
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +55 -55
- package/package.json +6 -6
package/dist/esm/Driven.js
CHANGED
|
@@ -68,13 +68,6 @@ function _inherits(subClass, superClass) {
|
|
|
68
68
|
});
|
|
69
69
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
70
70
|
}
|
|
71
|
-
function _instanceof(left, right) {
|
|
72
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
73
|
-
return !!right[Symbol.hasInstance](left);
|
|
74
|
-
} else {
|
|
75
|
-
return left instanceof right;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
71
|
function _iterableToArray(iter) {
|
|
79
72
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
80
73
|
}
|
|
@@ -185,11 +178,10 @@ function _createSuper(Derived) {
|
|
|
185
178
|
return _possibleConstructorReturn(this, result);
|
|
186
179
|
};
|
|
187
180
|
}
|
|
188
|
-
import { error, genNonDuplicateId, isArray, isBuiltInControls, isObject, isString, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
|
|
181
|
+
import { CONTROL_BASE_TYPE, error, genNonDuplicateId, isArray, isBuiltInControls, isObject, isString, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
|
|
189
182
|
import { findInstanceDataScopeParent, Store } from "./Store";
|
|
190
183
|
import { Designer } from "./Designer";
|
|
191
184
|
import EventLogic from "./EventLogic";
|
|
192
|
-
import { DesignerControl, DesignerListControl, DesignerWrapControl } from "@byteluck-fe/model-driven-core";
|
|
193
185
|
import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from "./utils";
|
|
194
186
|
import { Group, initSettings, Tab } from "@byteluck-fe/model-driven-settings";
|
|
195
187
|
// 当前正在注册的插件名称
|
|
@@ -285,13 +277,17 @@ var applyingPluginName = "";
|
|
|
285
277
|
});
|
|
286
278
|
};
|
|
287
279
|
_proto.setSelectedInstanceSetting = function setSelectedInstanceSetting() {
|
|
280
|
+
var _instance_parent;
|
|
288
281
|
var instance = this.store.selected;
|
|
289
282
|
if (!instance) {
|
|
290
283
|
return;
|
|
291
284
|
}
|
|
292
285
|
var setting = this.getControlSetting(instance.type);
|
|
293
|
-
|
|
294
|
-
|
|
286
|
+
// console.log('iswrap:', instance.parent?.controlType, instance.parent)
|
|
287
|
+
// if (instance.parent instanceof DesignerWrapControl) {
|
|
288
|
+
if (((_instance_parent = instance.parent) === null || _instance_parent === void 0 ? void 0 : _instance_parent.controlType) === CONTROL_BASE_TYPE.WRAP) {
|
|
289
|
+
var _instance_parent1;
|
|
290
|
+
var wrapSetting = this.getControlSetting((_instance_parent1 = instance.parent) === null || _instance_parent1 === void 0 ? void 0 : _instance_parent1.type);
|
|
295
291
|
setting = this.concatSetting(setting, wrapSetting, instance.parent.id);
|
|
296
292
|
}
|
|
297
293
|
this.store.setSelectInstanceSettings(setting);
|
|
@@ -433,10 +429,14 @@ var applyingPluginName = "";
|
|
|
433
429
|
return this.designer.createControlInstance(type, initSchema);
|
|
434
430
|
};
|
|
435
431
|
_proto.getInstance = function getInstance(instanceId) {
|
|
436
|
-
if (
|
|
437
|
-
|
|
432
|
+
// if (instanceId instanceof DesignerControl) {
|
|
433
|
+
// return instanceId
|
|
434
|
+
// }
|
|
435
|
+
// return this.store.instanceIdMap.get(instanceId)
|
|
436
|
+
if (typeof instanceId === "string") {
|
|
437
|
+
return this.store.instanceIdMap.get(instanceId);
|
|
438
438
|
}
|
|
439
|
-
return
|
|
439
|
+
return instanceId;
|
|
440
440
|
};
|
|
441
441
|
_proto.getInstances = function getInstances() {
|
|
442
442
|
return this.store.flatInstances;
|
|
@@ -501,7 +501,8 @@ var applyingPluginName = "";
|
|
|
501
501
|
if (!parent) {
|
|
502
502
|
return;
|
|
503
503
|
}
|
|
504
|
-
var parentList =
|
|
504
|
+
var parentList = // parent instanceof DesignerListControl &&
|
|
505
|
+
parent.controlType === CONTROL_BASE_TYPE.LIST && parent.props.headers.includes(instance) ? parent.props.headers : parent.children;
|
|
505
506
|
var index = parentList.findIndex(function(item) {
|
|
506
507
|
return item === instance;
|
|
507
508
|
});
|
|
@@ -518,7 +519,8 @@ var applyingPluginName = "";
|
|
|
518
519
|
if (!parent) {
|
|
519
520
|
return;
|
|
520
521
|
}
|
|
521
|
-
var parentList =
|
|
522
|
+
var parentList = // parent instanceof DesignerListControl &&
|
|
523
|
+
parent.controlType === CONTROL_BASE_TYPE.LIST && parent.props.headers.includes(oldInstance) ? parent.props.headers : parent.children;
|
|
522
524
|
var index = parentList.findIndex(function(item) {
|
|
523
525
|
return item === oldInstance;
|
|
524
526
|
});
|
|
@@ -577,7 +579,8 @@ var applyingPluginName = "";
|
|
|
577
579
|
* */ _proto.getInstanceInListControl = function getInstanceInListControl(instance) {
|
|
578
580
|
var _instance = instance;
|
|
579
581
|
while(_instance){
|
|
580
|
-
if (
|
|
582
|
+
// if (_instance instanceof DesignerListControl) {
|
|
583
|
+
if (_instance.controlType === CONTROL_BASE_TYPE.LIST) {
|
|
581
584
|
return true;
|
|
582
585
|
}
|
|
583
586
|
_instance = _instance.parent;
|
package/dist/esm/Store.js
CHANGED
|
@@ -82,10 +82,10 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
82
82
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
83
83
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
84
84
|
}
|
|
85
|
-
import {
|
|
85
|
+
import { DataBind } from "@byteluck-fe/model-driven-core";
|
|
86
86
|
import { hasChildrenControl, hasHeaderControl } from "./designerUtils";
|
|
87
87
|
import { Group } from "@byteluck-fe/model-driven-settings";
|
|
88
|
-
import { CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
88
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
89
89
|
// 维护当前selected,。。 selectedControlSetting
|
|
90
90
|
export var Store = /*#__PURE__*/ function() {
|
|
91
91
|
"use strict";
|
|
@@ -237,7 +237,8 @@ function setDataFieldCodeMap(dataFieldCodeMap, dataBind, instance) {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
function setInstanceInDataFieldCodeMap(instance, dataFieldCodeMap) {
|
|
240
|
-
if (
|
|
240
|
+
// if (instance instanceof DesignerFormControl) {
|
|
241
|
+
if (instance.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
241
242
|
var dataBind = instance.props.dataBind;
|
|
242
243
|
if (_instanceof(dataBind, DataBind)) {
|
|
243
244
|
setDataFieldCodeMap(dataFieldCodeMap, dataBind, instance);
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
function _instanceof(left, right) {
|
|
2
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
3
|
-
return !!right[Symbol.hasInstance](left);
|
|
4
|
-
} else {
|
|
5
|
-
return left instanceof right;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
import { DesignerFormControl } from "@byteluck-fe/model-driven-core";
|
|
9
1
|
import { CONTROL_TYPE, isArray } from "@byteluck-fe/model-driven-shared";
|
|
10
2
|
export function hasChildrenControl(instance) {
|
|
11
3
|
return "children" in instance && isArray(instance.children);
|
|
@@ -25,7 +17,8 @@ export function loopFormControl(control, callback) {
|
|
|
25
17
|
loopFormControl(// @ts-ignore
|
|
26
18
|
item === null || item === void 0 ? void 0 : item.children, callback);
|
|
27
19
|
// @ts-ignore
|
|
28
|
-
} else if (
|
|
20
|
+
// } else if (item instanceof DesignerFormControl) {
|
|
21
|
+
} else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
29
22
|
callback(item);
|
|
30
23
|
}
|
|
31
24
|
});
|
package/dist/esm/utils.js
CHANGED
|
@@ -38,13 +38,6 @@ function _asyncToGenerator(fn) {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function _instanceof(left, right) {
|
|
42
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
43
|
-
return !!right[Symbol.hasInstance](left);
|
|
44
|
-
} else {
|
|
45
|
-
return left instanceof right;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
41
|
function _iterableToArray(iter) {
|
|
49
42
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
50
43
|
}
|
|
@@ -188,15 +181,15 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
188
181
|
}
|
|
189
182
|
};
|
|
190
183
|
import { loopFormControl } from "./designerUtils";
|
|
191
|
-
import {
|
|
192
|
-
import { CONTROL_TYPE, FieldTypeToColumnType, isArray } from "@byteluck-fe/model-driven-shared";
|
|
184
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, FieldTypeToColumnType, isArray } from "@byteluck-fe/model-driven-shared";
|
|
193
185
|
import Designer from "./Designer";
|
|
194
186
|
import { objectDataBindControlTypes, objectDataBindKeyToFieldType } from "./constants";
|
|
195
187
|
export function getMasterFormControls(controls) {
|
|
196
188
|
var formctls = [];
|
|
197
189
|
// @ts-ignore
|
|
198
190
|
loopFormControl(controls, function(item) {
|
|
199
|
-
if (
|
|
191
|
+
// if (item instanceof DesignerFormControl) {
|
|
192
|
+
if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
|
200
193
|
formctls.push(item);
|
|
201
194
|
} else if (item.type === CONTROL_TYPE.SUBTABLE) {}
|
|
202
195
|
});
|
|
@@ -437,8 +430,14 @@ function generatePermissions(controls, parent) {
|
|
|
437
430
|
if (type === CONTROL_TYPE.VUE_FORM_ITEM) {
|
|
438
431
|
permissionItem.caption = controls.props.controlExportName || controls.name;
|
|
439
432
|
}
|
|
440
|
-
if (
|
|
441
|
-
|
|
433
|
+
// if (
|
|
434
|
+
// controls instanceof DesignerFormControl ||
|
|
435
|
+
// controls instanceof DesignerColumnControl
|
|
436
|
+
// ) {
|
|
437
|
+
if (controls.controlType === CONTROL_BASE_TYPE.FORM || controls.controlType === CONTROL_BASE_TYPE.COLUMN) {
|
|
438
|
+
var //@ts-ignore
|
|
439
|
+
_controls_props1, _controls_props_dataBind, //@ts-ignore
|
|
440
|
+
_controls_props2, _controls_props_dataBind1;
|
|
442
441
|
if (((_controls_props1 = controls.props) === null || _controls_props1 === void 0 ? void 0 : (_controls_props_dataBind = _controls_props1.dataBind) === null || _controls_props_dataBind === void 0 ? void 0 : _controls_props_dataBind.fieldCode) !== undefined && ((_controls_props2 = controls.props) === null || _controls_props2 === void 0 ? void 0 : (_controls_props_dataBind1 = _controls_props2.dataBind) === null || _controls_props_dataBind1 === void 0 ? void 0 : _controls_props_dataBind1.fieldCode) !== "") {
|
|
443
442
|
permissionItem.group = "field";
|
|
444
443
|
}
|
|
@@ -517,7 +516,8 @@ function generatePermissions(controls, parent) {
|
|
|
517
516
|
return generatePermissions(item, parent);
|
|
518
517
|
}).flat()));
|
|
519
518
|
}
|
|
520
|
-
if (
|
|
519
|
+
// if (controls instanceof DesignerListControl) {
|
|
520
|
+
if (controls.controlType === CONTROL_BASE_TYPE.LIST) {
|
|
521
521
|
var // 明细子表和列表的需要给parentId
|
|
522
522
|
_result2;
|
|
523
523
|
(_result2 = result).push.apply(_result2, _toConsumableArray(controls.props.headers.map(function(item) {
|