@byteluck-fe/model-driven-driven 2.7.0-alpha.6 → 2.7.0-alpha.8
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/Builder.js +18 -5
- package/dist/esm/Designer.js +141 -37
- package/dist/esm/Driven.js +95 -66
- package/dist/esm/EventLogic.js +1 -1
- package/dist/esm/Store.js +55 -21
- package/dist/esm/constants.js +8 -8
- package/dist/esm/designerUtils.js +5 -6
- package/dist/esm/index.js +6 -6
- package/dist/esm/utils.js +176 -75
- package/dist/index.umd.js +3 -3
- package/dist/types/Driven.d.ts +2 -2
- package/dist/types/Store.d.ts +1 -1
- package/package.json +4 -4
package/dist/esm/Builder.js
CHANGED
|
@@ -17,13 +17,26 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
17
17
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
18
|
return Constructor;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
function _defineProperty(obj, key, value) {
|
|
21
|
+
if (key in obj) {
|
|
22
|
+
Object.defineProperty(obj, key, {
|
|
23
|
+
value: value,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
obj[key] = value;
|
|
30
|
+
}
|
|
31
|
+
return obj;
|
|
32
|
+
}
|
|
33
|
+
import Designer from "./Designer";
|
|
34
|
+
import { CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
|
|
22
35
|
export var Builder = /*#__PURE__*/ function() {
|
|
23
36
|
"use strict";
|
|
24
37
|
function Builder() {
|
|
25
38
|
_classCallCheck(this, Builder);
|
|
26
|
-
this
|
|
39
|
+
_defineProperty(this, "designer", new Designer());
|
|
27
40
|
}
|
|
28
41
|
_createClass(Builder, [
|
|
29
42
|
{
|
|
@@ -66,7 +79,7 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
66
79
|
// @ts-ignore
|
|
67
80
|
var listview = this.designer.createControlInstance(// @ts-ignore
|
|
68
81
|
CONTROL_TYPE.LIST_VIEW);
|
|
69
|
-
listview.props.countType =
|
|
82
|
+
listview.props.countType = "async";
|
|
70
83
|
var simpleSearch = this.designer.createControlInstance(// @ts-ignore
|
|
71
84
|
CONTROL_TYPE.SIMPLE_SEARCH);
|
|
72
85
|
var gridTable = this.designer.createControlInstance(// @ts-ignore
|
|
@@ -115,7 +128,7 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
115
128
|
// @ts-ignore
|
|
116
129
|
vueFormItem.props.isHideCaption = true;
|
|
117
130
|
// @ts-ignore
|
|
118
|
-
vueFormItem.props.controlExportName =
|
|
131
|
+
vueFormItem.props.controlExportName = "VuePage";
|
|
119
132
|
// @ts-ignore
|
|
120
133
|
grid.children.push(vueFormItem);
|
|
121
134
|
return grid;
|
package/dist/esm/Designer.js
CHANGED
|
@@ -60,6 +60,19 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
60
60
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
61
61
|
return Constructor;
|
|
62
62
|
}
|
|
63
|
+
function _defineProperty(obj, key, value) {
|
|
64
|
+
if (key in obj) {
|
|
65
|
+
Object.defineProperty(obj, key, {
|
|
66
|
+
value: value,
|
|
67
|
+
enumerable: true,
|
|
68
|
+
configurable: true,
|
|
69
|
+
writable: true
|
|
70
|
+
});
|
|
71
|
+
} else {
|
|
72
|
+
obj[key] = value;
|
|
73
|
+
}
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
63
76
|
function _getPrototypeOf(o) {
|
|
64
77
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
65
78
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -81,7 +94,7 @@ function _inherits(subClass, superClass) {
|
|
|
81
94
|
}
|
|
82
95
|
function _instanceof(left, right) {
|
|
83
96
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
84
|
-
return right[Symbol.hasInstance](left);
|
|
97
|
+
return !!right[Symbol.hasInstance](left);
|
|
85
98
|
} else {
|
|
86
99
|
return left instanceof right;
|
|
87
100
|
}
|
|
@@ -144,31 +157,125 @@ function _createSuper(Derived) {
|
|
|
144
157
|
return _possibleConstructorReturn(this, result);
|
|
145
158
|
};
|
|
146
159
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
160
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
161
|
+
var f, y, t, g, _ = {
|
|
162
|
+
label: 0,
|
|
163
|
+
sent: function() {
|
|
164
|
+
if (t[0] & 1) throw t[1];
|
|
165
|
+
return t[1];
|
|
166
|
+
},
|
|
167
|
+
trys: [],
|
|
168
|
+
ops: []
|
|
169
|
+
};
|
|
170
|
+
return g = {
|
|
171
|
+
next: verb(0),
|
|
172
|
+
"throw": verb(1),
|
|
173
|
+
"return": verb(2)
|
|
174
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
175
|
+
return this;
|
|
176
|
+
}), g;
|
|
177
|
+
function verb(n) {
|
|
178
|
+
return function(v) {
|
|
179
|
+
return step([
|
|
180
|
+
n,
|
|
181
|
+
v
|
|
182
|
+
]);
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function step(op) {
|
|
186
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
187
|
+
while(_)try {
|
|
188
|
+
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;
|
|
189
|
+
if (y = 0, t) op = [
|
|
190
|
+
op[0] & 2,
|
|
191
|
+
t.value
|
|
192
|
+
];
|
|
193
|
+
switch(op[0]){
|
|
194
|
+
case 0:
|
|
195
|
+
case 1:
|
|
196
|
+
t = op;
|
|
197
|
+
break;
|
|
198
|
+
case 4:
|
|
199
|
+
_.label++;
|
|
200
|
+
return {
|
|
201
|
+
value: op[1],
|
|
202
|
+
done: false
|
|
203
|
+
};
|
|
204
|
+
case 5:
|
|
205
|
+
_.label++;
|
|
206
|
+
y = op[1];
|
|
207
|
+
op = [
|
|
208
|
+
0
|
|
209
|
+
];
|
|
210
|
+
continue;
|
|
211
|
+
case 7:
|
|
212
|
+
op = _.ops.pop();
|
|
213
|
+
_.trys.pop();
|
|
214
|
+
continue;
|
|
215
|
+
default:
|
|
216
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
217
|
+
_ = 0;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
221
|
+
_.label = op[1];
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
225
|
+
_.label = t[1];
|
|
226
|
+
t = op;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
if (t && _.label < t[2]) {
|
|
230
|
+
_.label = t[2];
|
|
231
|
+
_.ops.push(op);
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
if (t[2]) _.ops.pop();
|
|
235
|
+
_.trys.pop();
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
op = body.call(thisArg, _);
|
|
239
|
+
} catch (e) {
|
|
240
|
+
op = [
|
|
241
|
+
6,
|
|
242
|
+
e
|
|
243
|
+
];
|
|
244
|
+
y = 0;
|
|
245
|
+
} finally{
|
|
246
|
+
f = t = 0;
|
|
247
|
+
}
|
|
248
|
+
if (op[0] & 5) throw op[1];
|
|
249
|
+
return {
|
|
250
|
+
value: op[0] ? op[1] : void 0,
|
|
251
|
+
done: true
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
import { RegisterControls, controlHooksEmitter } from "@byteluck-fe/model-driven-core";
|
|
256
|
+
import EventLogic from "./EventLogic";
|
|
257
|
+
import { FieldTypes } from "@byteluck-fe/model-driven-shared";
|
|
258
|
+
import { toSchema, getModelBindInfoList, checkSchema } from "./utils";
|
|
259
|
+
var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
153
260
|
"use strict";
|
|
154
|
-
_inherits(
|
|
155
|
-
var _super = _createSuper(
|
|
156
|
-
function
|
|
157
|
-
_classCallCheck(this,
|
|
261
|
+
_inherits(Designer, RegisterControls);
|
|
262
|
+
var _super = _createSuper(Designer);
|
|
263
|
+
function Designer() {
|
|
264
|
+
_classCallCheck(this, Designer);
|
|
158
265
|
var _this;
|
|
159
|
-
_this = _super.call(this,
|
|
160
|
-
_this
|
|
161
|
-
_this
|
|
162
|
-
_this
|
|
163
|
-
_this
|
|
164
|
-
_this
|
|
165
|
-
(_instanceof(this,
|
|
166
|
-
var
|
|
167
|
-
_this.controlSettingMap.set(
|
|
266
|
+
_this = _super.call(this, "Designer");
|
|
267
|
+
_defineProperty(_assertThisInitialized(_this), "toolbox", []);
|
|
268
|
+
_defineProperty(_assertThisInitialized(_this), "services", {});
|
|
269
|
+
_defineProperty(_assertThisInitialized(_this), "eventLogic", new EventLogic());
|
|
270
|
+
_defineProperty(_assertThisInitialized(_this), "fieldTypes", FieldTypes);
|
|
271
|
+
_defineProperty(_assertThisInitialized(_this), "controlSettingMap", new Map());
|
|
272
|
+
(_instanceof(this, Designer) ? this.constructor : void 0).staticControls.forEach(function(control) {
|
|
273
|
+
var _$Designer = control.Designer, Setting = control.Setting;
|
|
274
|
+
_this.controlSettingMap.set(_$Designer.controlType, Setting);
|
|
168
275
|
});
|
|
169
276
|
return _this;
|
|
170
277
|
}
|
|
171
|
-
_createClass(
|
|
278
|
+
_createClass(Designer, [
|
|
172
279
|
{
|
|
173
280
|
key: "registerControl",
|
|
174
281
|
value: function registerControl(control) {
|
|
@@ -215,7 +322,7 @@ var Designer1 = /*#__PURE__*/ function _target(RegisterControls1) {
|
|
|
215
322
|
function getInitControl() {
|
|
216
323
|
// @ts-ignore
|
|
217
324
|
return [
|
|
218
|
-
this.createControlInstance(
|
|
325
|
+
this.createControlInstance("grid")
|
|
219
326
|
];
|
|
220
327
|
}
|
|
221
328
|
},
|
|
@@ -225,17 +332,14 @@ var Designer1 = /*#__PURE__*/ function _target(RegisterControls1) {
|
|
|
225
332
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
226
333
|
args[_key] = arguments[_key];
|
|
227
334
|
}
|
|
228
|
-
return _asyncToGenerator(
|
|
229
|
-
return
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
}, _callee);
|
|
238
|
-
}))();
|
|
335
|
+
return _asyncToGenerator(function() {
|
|
336
|
+
return __generator(this, function(_state) {
|
|
337
|
+
return [
|
|
338
|
+
2,
|
|
339
|
+
checkSchema.apply(void 0, _toConsumableArray(args))
|
|
340
|
+
];
|
|
341
|
+
});
|
|
342
|
+
})();
|
|
239
343
|
}
|
|
240
344
|
},
|
|
241
345
|
{
|
|
@@ -267,8 +371,8 @@ var Designer1 = /*#__PURE__*/ function _target(RegisterControls1) {
|
|
|
267
371
|
}
|
|
268
372
|
}
|
|
269
373
|
]);
|
|
270
|
-
return
|
|
374
|
+
return Designer;
|
|
271
375
|
}(RegisterControls);
|
|
272
|
-
|
|
273
|
-
export {
|
|
274
|
-
export {
|
|
376
|
+
_defineProperty(Designer, "EventLogic", EventLogic);
|
|
377
|
+
export { Designer as default };
|
|
378
|
+
export { Designer };
|
package/dist/esm/Driven.js
CHANGED
|
@@ -192,35 +192,52 @@ function _createSuper(Derived) {
|
|
|
192
192
|
return _possibleConstructorReturn(this, result);
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
import { CONTROL_BASE_TYPE, error, genNonDuplicateId, isArray, isBuiltInControls, isObject, isString, updateValueFromKeys, warn, Watcher } from
|
|
196
|
-
import { findInstanceDataScopeParent, Store } from
|
|
197
|
-
import { Designer } from
|
|
198
|
-
import EventLogic from
|
|
199
|
-
import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from
|
|
200
|
-
import { Group, initSettings, Tab } from
|
|
195
|
+
import { CONTROL_BASE_TYPE, error, genNonDuplicateId, isArray, isBuiltInControls, isObject, isString, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
|
|
196
|
+
import { findInstanceDataScopeParent, Store } from "./Store";
|
|
197
|
+
import { Designer } from "./Designer";
|
|
198
|
+
import EventLogic from "./EventLogic";
|
|
199
|
+
import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from "./utils";
|
|
200
|
+
import { Group, initSettings, Tab } from "@byteluck-fe/model-driven-settings";
|
|
201
201
|
// 当前正在注册的插件名称
|
|
202
|
-
var applyingPluginName =
|
|
203
|
-
|
|
202
|
+
var applyingPluginName = "";
|
|
203
|
+
/**
|
|
204
204
|
* 设计器驱动
|
|
205
|
-
* */ /*#__PURE__*/ function(
|
|
205
|
+
* */ var Driven = /*#__PURE__*/ function(Watcher) {
|
|
206
206
|
"use strict";
|
|
207
|
-
_inherits(Driven,
|
|
207
|
+
_inherits(Driven, Watcher);
|
|
208
208
|
var _super = _createSuper(Driven);
|
|
209
209
|
function Driven(options) {
|
|
210
210
|
_classCallCheck(this, Driven);
|
|
211
211
|
var _this;
|
|
212
212
|
_this = _super.call(this);
|
|
213
|
-
_this
|
|
214
|
-
_this
|
|
215
|
-
_this
|
|
213
|
+
_defineProperty(_assertThisInitialized(_this), "mode", void 0);
|
|
214
|
+
_defineProperty(_assertThisInitialized(_this), "isMounted", false);
|
|
215
|
+
_defineProperty(_assertThisInitialized(_this), "id", genNonDuplicateId(8));
|
|
216
|
+
/**
|
|
217
|
+
* 控件可选的事件
|
|
218
|
+
* */ _defineProperty(_assertThisInitialized(_this), "eventLogic", void 0);
|
|
219
|
+
/**
|
|
220
|
+
* 处理数据存储,存放模型等
|
|
221
|
+
* */ _defineProperty(_assertThisInitialized(_this), "store", void 0);
|
|
222
|
+
/**
|
|
223
|
+
* 额外参数存储
|
|
224
|
+
*/ _defineProperty(_assertThisInitialized(_this), "externalParams", void 0);
|
|
225
|
+
/**
|
|
226
|
+
* 处理instance,和schema存储
|
|
227
|
+
* */ _defineProperty(_assertThisInitialized(_this), "designer", void 0);
|
|
228
|
+
/**
|
|
229
|
+
* 插件数组
|
|
230
|
+
* */ _defineProperty(_assertThisInitialized(_this), "__plugins", void 0);
|
|
231
|
+
_defineProperty(_assertThisInitialized(_this), "__pluginsApplied", false);
|
|
232
|
+
_defineProperty(_assertThisInitialized(_this), "$options", void 0);
|
|
216
233
|
// TODO 拿到schema
|
|
217
|
-
_this
|
|
234
|
+
_defineProperty(_assertThisInitialized(_this), "getSchema", toSchema);
|
|
218
235
|
// TODO 拿到model_bind_info_list
|
|
219
|
-
_this
|
|
236
|
+
_defineProperty(_assertThisInitialized(_this), "getModelBindInfoList", getModelBindInfoList);
|
|
220
237
|
// TODO 拿到permission_controls
|
|
221
|
-
_this
|
|
238
|
+
_defineProperty(_assertThisInitialized(_this), "generatePermissions", generatePermissions);
|
|
222
239
|
_this.$options = Object.freeze(options);
|
|
223
|
-
var
|
|
240
|
+
var _this_$options = _this.$options, _this_$options_autoMount = _this_$options.autoMount, autoMount = _this_$options_autoMount === void 0 ? false : _this_$options_autoMount, tmp = _this_$options.Designer, DesignerClass = tmp === void 0 ? Designer : tmp, schema = _this_$options.schema, _this_$options_mode = _this_$options.mode, mode = _this_$options_mode === void 0 ? "form" : _this_$options_mode, tmp1 = _this_$options.store, storeOptions = tmp1 === void 0 ? {} : tmp1;
|
|
224
241
|
_this.eventLogic = new EventLogic();
|
|
225
242
|
_this.designer = new DesignerClass();
|
|
226
243
|
_this.store = new Store(_objectSpread({
|
|
@@ -237,7 +254,7 @@ var Driven = /**
|
|
|
237
254
|
key: "mount",
|
|
238
255
|
value: // 挂载
|
|
239
256
|
function mount() {
|
|
240
|
-
var
|
|
257
|
+
var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
|
|
241
258
|
this.__plugins = plugins;
|
|
242
259
|
this.applyPlugins();
|
|
243
260
|
this.isMounted = true;
|
|
@@ -259,10 +276,10 @@ var Driven = /**
|
|
|
259
276
|
if (this.__pluginsApplied) return;
|
|
260
277
|
this.__plugins.forEach(function(plugin) {
|
|
261
278
|
try {
|
|
262
|
-
var
|
|
263
|
-
applyingPluginName = (
|
|
279
|
+
var _plugin_pluginName;
|
|
280
|
+
applyingPluginName = (_plugin_pluginName = plugin.pluginName) !== null && _plugin_pluginName !== void 0 ? _plugin_pluginName : plugin.constructor.name;
|
|
264
281
|
plugin.apply(_this);
|
|
265
|
-
applyingPluginName =
|
|
282
|
+
applyingPluginName = "";
|
|
266
283
|
} catch (e) {
|
|
267
284
|
error("".concat(applyingPluginName || plugin.constructor.name, " Plugin apply Error \n ").concat(e));
|
|
268
285
|
}
|
|
@@ -309,7 +326,7 @@ var Driven = /**
|
|
|
309
326
|
return;
|
|
310
327
|
}
|
|
311
328
|
this.setSelectedInstanceSetting();
|
|
312
|
-
this.emit(
|
|
329
|
+
this.emit("select", {
|
|
313
330
|
instance: instance
|
|
314
331
|
});
|
|
315
332
|
}
|
|
@@ -317,7 +334,7 @@ var Driven = /**
|
|
|
317
334
|
{
|
|
318
335
|
key: "setSelectedInstanceSetting",
|
|
319
336
|
value: function setSelectedInstanceSetting() {
|
|
320
|
-
var
|
|
337
|
+
var _instance_parent;
|
|
321
338
|
var instance = this.store.selected;
|
|
322
339
|
if (!instance) {
|
|
323
340
|
return;
|
|
@@ -326,21 +343,13 @@ var Driven = /**
|
|
|
326
343
|
// console.log('iswrap:', instance.parent?.controlType, instance.parent)
|
|
327
344
|
// if (instance.parent instanceof DesignerWrapControl) {
|
|
328
345
|
// 如果父控件为自定义控件wrapper
|
|
329
|
-
if (((
|
|
330
|
-
var
|
|
331
|
-
var wrapSetting = this.getControlSetting((
|
|
346
|
+
if (((_instance_parent = instance.parent) === null || _instance_parent === void 0 ? void 0 : _instance_parent.controlType) === CONTROL_BASE_TYPE.WRAP) {
|
|
347
|
+
var _instance_parent1;
|
|
348
|
+
var wrapSetting = this.getControlSetting((_instance_parent1 = instance.parent) === null || _instance_parent1 === void 0 ? void 0 : _instance_parent1.type);
|
|
332
349
|
setting = this.concatSetting(setting, wrapSetting, instance.parent.id);
|
|
333
350
|
}
|
|
334
|
-
// 如果父控件为grid-layout-wrap(可同时作为表单控件和自定义控件父级)
|
|
335
|
-
if (((ref1 = instance.parent) === null || ref1 === void 0 ? void 0 : ref1.controlType) === CONTROL_BASE_TYPE.WRAP && !Array.isArray(instance.parent.setting)) {
|
|
336
|
-
var ref3;
|
|
337
|
-
var wrapSetting1 = initSettings((ref3 = instance.parent) === null || ref3 === void 0 ? void 0 : ref3.setting);
|
|
338
|
-
if (setting[0].items) {
|
|
339
|
-
setting = this.concatSetting(setting, wrapSetting1, instance.parent.id);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
351
|
this.store.setSelectInstanceSettings(setting);
|
|
343
|
-
this.callSelectedEffect(
|
|
352
|
+
this.callSelectedEffect("");
|
|
344
353
|
// 选中触发scopeEffect
|
|
345
354
|
var payload = {
|
|
346
355
|
from: null,
|
|
@@ -354,14 +363,14 @@ var Driven = /**
|
|
|
354
363
|
{
|
|
355
364
|
key: "concatSetting",
|
|
356
365
|
value: function concatSetting(settings, otherSettings, settingFromId) {
|
|
357
|
-
var
|
|
358
|
-
var
|
|
366
|
+
var _this = this;
|
|
367
|
+
var _settings_, _otherSettings_, _settings_1, _otherSettings_1, _settings_2, _otherSettings_2, _settings_3, _otherSettings_3;
|
|
368
|
+
var result = settings;
|
|
359
369
|
// tab
|
|
360
|
-
if (((
|
|
361
|
-
var _this = this;
|
|
370
|
+
if (((_settings_ = settings[0]) === null || _settings_ === void 0 ? void 0 : _settings_.type) === "tab" && ((_otherSettings_ = otherSettings[0]) === null || _otherSettings_ === void 0 ? void 0 : _otherSettings_.type) === "tab") {
|
|
362
371
|
var tabSettings = settings;
|
|
363
372
|
var otherTabSettings = otherSettings.slice(0);
|
|
364
|
-
|
|
373
|
+
result = tabSettings.map(function(tab, index) {
|
|
365
374
|
var result = new Tab(tab);
|
|
366
375
|
var otherTabIndex = otherTabSettings.findIndex(function(item) {
|
|
367
376
|
return item.title === tab.title;
|
|
@@ -376,20 +385,38 @@ var Driven = /**
|
|
|
376
385
|
return result;
|
|
377
386
|
});
|
|
378
387
|
if (otherTabSettings.length) {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
return _this1.formatGroupSetting(item, settingFromId);
|
|
388
|
+
result = _toConsumableArray(result).concat(_toConsumableArray(otherTabSettings.map(function(item) {
|
|
389
|
+
return _this.formatGroupSetting(item, settingFromId);
|
|
382
390
|
})));
|
|
383
391
|
}
|
|
384
392
|
// group
|
|
385
|
-
} else if (((
|
|
393
|
+
} else if (((_settings_1 = settings[0]) === null || _settings_1 === void 0 ? void 0 : _settings_1.type) === "group" && ((_otherSettings_1 = otherSettings[0]) === null || _otherSettings_1 === void 0 ? void 0 : _otherSettings_1.type) === "group") {
|
|
386
394
|
var groupSettings = settings;
|
|
387
395
|
var otherGroupSettings = otherSettings;
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
396
|
+
result = _toConsumableArray(this.formatGroupSetting(otherGroupSettings, settingFromId)).concat(_toConsumableArray(groupSettings));
|
|
397
|
+
// 当前控件setting是tab,合并控件setting是group
|
|
398
|
+
} else if (((_settings_2 = settings[0]) === null || _settings_2 === void 0 ? void 0 : _settings_2.type) === "tab" && ((_otherSettings_2 = otherSettings[0]) === null || _otherSettings_2 === void 0 ? void 0 : _otherSettings_2.type) === "group") {
|
|
399
|
+
var tabSettings1 = settings;
|
|
400
|
+
var otherGroupSettings1 = otherSettings;
|
|
401
|
+
result = tabSettings1.map(function(tab, index) {
|
|
402
|
+
var result = new Tab(tab);
|
|
403
|
+
if (index === 0) {
|
|
404
|
+
result.items = _toConsumableArray(_this.formatGroupSetting(otherGroupSettings1, settingFromId)).concat(_toConsumableArray(result.items));
|
|
405
|
+
}
|
|
406
|
+
return result;
|
|
407
|
+
});
|
|
408
|
+
} else if (((_settings_3 = settings[0]) === null || _settings_3 === void 0 ? void 0 : _settings_3.type) === "group" && ((_otherSettings_3 = otherSettings[0]) === null || _otherSettings_3 === void 0 ? void 0 : _otherSettings_3.type) === "tab") {
|
|
409
|
+
var groupSettings1 = settings;
|
|
410
|
+
var otherTabSettings1 = otherSettings;
|
|
411
|
+
result = otherTabSettings1.map(function(tab, index) {
|
|
412
|
+
var result = new Tab(tab);
|
|
413
|
+
if (index === 0) {
|
|
414
|
+
result.items = _toConsumableArray(result.items).concat(_toConsumableArray(_this.formatGroupSetting(groupSettings1, settingFromId)));
|
|
415
|
+
}
|
|
416
|
+
return result;
|
|
417
|
+
});
|
|
391
418
|
}
|
|
392
|
-
return
|
|
419
|
+
return result;
|
|
393
420
|
}
|
|
394
421
|
},
|
|
395
422
|
{
|
|
@@ -414,8 +441,8 @@ var Driven = /**
|
|
|
414
441
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
415
442
|
args[_key] = arguments[_key];
|
|
416
443
|
}
|
|
417
|
-
var
|
|
418
|
-
return (
|
|
444
|
+
var _this_designer;
|
|
445
|
+
return (_this_designer = this.designer).registerControlConfig.apply(_this_designer, _toConsumableArray(args));
|
|
419
446
|
}
|
|
420
447
|
},
|
|
421
448
|
{
|
|
@@ -449,7 +476,7 @@ var Driven = /**
|
|
|
449
476
|
key: "setSelectedFieldItem",
|
|
450
477
|
value: function setSelectedFieldItem(fieldItem) {
|
|
451
478
|
this.store.setSelectedFieldItem(fieldItem);
|
|
452
|
-
this.callSelectedEffect(
|
|
479
|
+
this.callSelectedEffect("dataBind", {
|
|
453
480
|
fieldItem: fieldItem
|
|
454
481
|
});
|
|
455
482
|
}
|
|
@@ -468,7 +495,7 @@ var Driven = /**
|
|
|
468
495
|
key: "moveEnd",
|
|
469
496
|
value: function moveEnd() {
|
|
470
497
|
var instance = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.store.movingInstance;
|
|
471
|
-
var
|
|
498
|
+
var _this_store_selected;
|
|
472
499
|
if (instance === null) return;
|
|
473
500
|
var _instance = this.getInstance(instance);
|
|
474
501
|
if (!_instance) return;
|
|
@@ -482,7 +509,7 @@ var Driven = /**
|
|
|
482
509
|
var newParent = _instance.parent;
|
|
483
510
|
// 移动之后清空movingInstance
|
|
484
511
|
this.store.setMovingInstance(null);
|
|
485
|
-
if (_instance.id !== ((
|
|
512
|
+
if (_instance.id !== ((_this_store_selected = this.store.selected) === null || _this_store_selected === void 0 ? void 0 : _this_store_selected.id)) {
|
|
486
513
|
this.selectInstance(_instance);
|
|
487
514
|
} else {
|
|
488
515
|
this.store.setSelectInstance(_instance);
|
|
@@ -497,9 +524,9 @@ var Driven = /**
|
|
|
497
524
|
};
|
|
498
525
|
this.callSelectedScopeEffect(payload);
|
|
499
526
|
if (oldParent) {
|
|
500
|
-
this.emit(
|
|
527
|
+
this.emit("moved", _objectSpread({}, payload));
|
|
501
528
|
} else {
|
|
502
|
-
this.emit(
|
|
529
|
+
this.emit("joined", _objectSpread({}, payload));
|
|
503
530
|
}
|
|
504
531
|
}
|
|
505
532
|
},
|
|
@@ -516,7 +543,7 @@ var Driven = /**
|
|
|
516
543
|
// return instanceId
|
|
517
544
|
// }
|
|
518
545
|
// return this.store.instanceIdMap.get(instanceId)
|
|
519
|
-
if (typeof instanceId ===
|
|
546
|
+
if (typeof instanceId === "string") {
|
|
520
547
|
return this.store.instanceIdMap.get(instanceId);
|
|
521
548
|
}
|
|
522
549
|
return instanceId;
|
|
@@ -553,19 +580,19 @@ var Driven = /**
|
|
|
553
580
|
{
|
|
554
581
|
key: "updateInstancePropValue",
|
|
555
582
|
value: function updateInstancePropValue(instance, propName, value, payload) {
|
|
556
|
-
var
|
|
583
|
+
var _this_store_selected;
|
|
557
584
|
var result = updateValueFromKeys(instance.props, propName, value);
|
|
558
585
|
if (!result) {
|
|
559
586
|
return;
|
|
560
587
|
}
|
|
561
588
|
// 修改dataBind的时候要更新 fieldCodeMap
|
|
562
|
-
if (propName.startsWith(
|
|
589
|
+
if (propName.startsWith("dataBind")) {
|
|
563
590
|
this.store.updateDataFieldCodeMap(instance);
|
|
564
591
|
}
|
|
565
|
-
if (instance.id === ((
|
|
592
|
+
if (instance.id === ((_this_store_selected = this.store.selected) === null || _this_store_selected === void 0 ? void 0 : _this_store_selected.id)) {
|
|
566
593
|
this.callSelectedEffect(propName, payload);
|
|
567
594
|
}
|
|
568
|
-
this.emit(
|
|
595
|
+
this.emit("updated", {
|
|
569
596
|
instance: instance,
|
|
570
597
|
propName: propName,
|
|
571
598
|
value: value
|
|
@@ -575,11 +602,11 @@ var Driven = /**
|
|
|
575
602
|
{
|
|
576
603
|
key: "updateInstanceProps",
|
|
577
604
|
value: function updateInstanceProps(instance, props, payload) {
|
|
578
|
-
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] :
|
|
605
|
+
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "";
|
|
579
606
|
var _this = this;
|
|
580
607
|
Object.entries(props).forEach(function(param) {
|
|
581
608
|
var _param = _slicedToArray(param, 2), key = _param[0], value = _param[1];
|
|
582
|
-
var propName = "".concat(prevKey ? prevKey +
|
|
609
|
+
var propName = "".concat(prevKey ? prevKey + "." : "").concat(key);
|
|
583
610
|
if (isObject(value)) {
|
|
584
611
|
_this.updateInstanceProps(instance, value, payload, propName);
|
|
585
612
|
} else {
|
|
@@ -615,7 +642,7 @@ var Driven = /**
|
|
|
615
642
|
});
|
|
616
643
|
index > -1 && parentList.splice(index, 1);
|
|
617
644
|
this.store.getFlatInstances();
|
|
618
|
-
this.emit(
|
|
645
|
+
this.emit("removed", {
|
|
619
646
|
instance: instance,
|
|
620
647
|
index: index,
|
|
621
648
|
parent: parent
|
|
@@ -693,8 +720,8 @@ var Driven = /**
|
|
|
693
720
|
for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
|
|
694
721
|
arg[_key] = arguments[_key];
|
|
695
722
|
}
|
|
696
|
-
var
|
|
697
|
-
(
|
|
723
|
+
var _this_designer;
|
|
724
|
+
(_this_designer = this.designer).registerControl.apply(_this_designer, _toConsumableArray(arg));
|
|
698
725
|
return this;
|
|
699
726
|
}
|
|
700
727
|
},
|
|
@@ -780,5 +807,7 @@ var Driven = /**
|
|
|
780
807
|
]);
|
|
781
808
|
return Driven;
|
|
782
809
|
}(Watcher);
|
|
783
|
-
|
|
810
|
+
/**
|
|
811
|
+
* 控件事件定义
|
|
812
|
+
* */ _defineProperty(Driven, "EventLogic", EventLogic);
|
|
784
813
|
export { Driven };
|
package/dist/esm/EventLogic.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { EventLogic } from
|
|
1
|
+
import { EventLogic } from "@byteluck-fe/model-driven-shared";
|
|
2
2
|
export default EventLogic;
|