@byteluck-fe/model-driven-driven 2.7.0-alpha.8 → 2.7.0-alpha.9
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 +5 -18
- package/dist/esm/Designer.js +37 -141
- package/dist/esm/Driven.js +64 -80
- package/dist/esm/EventLogic.js +1 -1
- package/dist/esm/Store.js +21 -55
- package/dist/esm/constants.js +8 -8
- package/dist/esm/designerUtils.js +6 -5
- package/dist/esm/index.js +6 -6
- package/dist/esm/utils.js +75 -176
- 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 +3 -3
package/dist/esm/Builder.js
CHANGED
|
@@ -17,26 +17,13 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
17
17
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
18
|
return Constructor;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
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";
|
|
20
|
+
import Designer from './Designer';
|
|
21
|
+
import { CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
35
22
|
export var Builder = /*#__PURE__*/ function() {
|
|
36
23
|
"use strict";
|
|
37
24
|
function Builder() {
|
|
38
25
|
_classCallCheck(this, Builder);
|
|
39
|
-
|
|
26
|
+
this.designer = new Designer();
|
|
40
27
|
}
|
|
41
28
|
_createClass(Builder, [
|
|
42
29
|
{
|
|
@@ -79,7 +66,7 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
79
66
|
// @ts-ignore
|
|
80
67
|
var listview = this.designer.createControlInstance(// @ts-ignore
|
|
81
68
|
CONTROL_TYPE.LIST_VIEW);
|
|
82
|
-
listview.props.countType =
|
|
69
|
+
listview.props.countType = 'async';
|
|
83
70
|
var simpleSearch = this.designer.createControlInstance(// @ts-ignore
|
|
84
71
|
CONTROL_TYPE.SIMPLE_SEARCH);
|
|
85
72
|
var gridTable = this.designer.createControlInstance(// @ts-ignore
|
|
@@ -128,7 +115,7 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
128
115
|
// @ts-ignore
|
|
129
116
|
vueFormItem.props.isHideCaption = true;
|
|
130
117
|
// @ts-ignore
|
|
131
|
-
vueFormItem.props.controlExportName =
|
|
118
|
+
vueFormItem.props.controlExportName = 'VuePage';
|
|
132
119
|
// @ts-ignore
|
|
133
120
|
grid.children.push(vueFormItem);
|
|
134
121
|
return grid;
|
package/dist/esm/Designer.js
CHANGED
|
@@ -60,19 +60,6 @@ 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
|
-
}
|
|
76
63
|
function _getPrototypeOf(o) {
|
|
77
64
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
78
65
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -94,7 +81,7 @@ function _inherits(subClass, superClass) {
|
|
|
94
81
|
}
|
|
95
82
|
function _instanceof(left, right) {
|
|
96
83
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
97
|
-
return
|
|
84
|
+
return right[Symbol.hasInstance](left);
|
|
98
85
|
} else {
|
|
99
86
|
return left instanceof right;
|
|
100
87
|
}
|
|
@@ -157,125 +144,31 @@ function _createSuper(Derived) {
|
|
|
157
144
|
return _possibleConstructorReturn(this, result);
|
|
158
145
|
};
|
|
159
146
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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) {
|
|
147
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
148
|
+
import { RegisterControls, controlHooksEmitter } from '@byteluck-fe/model-driven-core';
|
|
149
|
+
import EventLogic from './EventLogic';
|
|
150
|
+
import { FieldTypes } from '@byteluck-fe/model-driven-shared';
|
|
151
|
+
import { toSchema, getModelBindInfoList, checkSchema } from './utils';
|
|
152
|
+
var Designer1 = /*#__PURE__*/ function _target(RegisterControls1) {
|
|
260
153
|
"use strict";
|
|
261
|
-
_inherits(
|
|
262
|
-
var _super = _createSuper(
|
|
263
|
-
function
|
|
264
|
-
_classCallCheck(this,
|
|
154
|
+
_inherits(Designer1, RegisterControls1);
|
|
155
|
+
var _super = _createSuper(Designer1);
|
|
156
|
+
function Designer1() {
|
|
157
|
+
_classCallCheck(this, Designer1);
|
|
265
158
|
var _this;
|
|
266
|
-
_this = _super.call(this,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
(_instanceof(this,
|
|
273
|
-
var
|
|
274
|
-
_this.controlSettingMap.set(
|
|
159
|
+
_this = _super.call(this, 'Designer');
|
|
160
|
+
_this.toolbox = [];
|
|
161
|
+
_this.services = {};
|
|
162
|
+
_this.eventLogic = new EventLogic();
|
|
163
|
+
_this.fieldTypes = FieldTypes;
|
|
164
|
+
_this.controlSettingMap = new Map();
|
|
165
|
+
(_instanceof(this, Designer1) ? this.constructor : void 0).staticControls.forEach(function(control) {
|
|
166
|
+
var Designer2 = control.Designer, Setting = control.Setting;
|
|
167
|
+
_this.controlSettingMap.set(Designer2.controlType, Setting);
|
|
275
168
|
});
|
|
276
169
|
return _this;
|
|
277
170
|
}
|
|
278
|
-
_createClass(
|
|
171
|
+
_createClass(Designer1, [
|
|
279
172
|
{
|
|
280
173
|
key: "registerControl",
|
|
281
174
|
value: function registerControl(control) {
|
|
@@ -322,7 +215,7 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
|
322
215
|
function getInitControl() {
|
|
323
216
|
// @ts-ignore
|
|
324
217
|
return [
|
|
325
|
-
this.createControlInstance(
|
|
218
|
+
this.createControlInstance('grid')
|
|
326
219
|
];
|
|
327
220
|
}
|
|
328
221
|
},
|
|
@@ -332,14 +225,17 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
|
332
225
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
333
226
|
args[_key] = arguments[_key];
|
|
334
227
|
}
|
|
335
|
-
return _asyncToGenerator(function() {
|
|
336
|
-
return
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
228
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
|
229
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
230
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
231
|
+
case 0:
|
|
232
|
+
return _ctx.abrupt("return", checkSchema.apply(void 0, _toConsumableArray(args)));
|
|
233
|
+
case 1:
|
|
234
|
+
case "end":
|
|
235
|
+
return _ctx.stop();
|
|
236
|
+
}
|
|
237
|
+
}, _callee);
|
|
238
|
+
}))();
|
|
343
239
|
}
|
|
344
240
|
},
|
|
345
241
|
{
|
|
@@ -371,8 +267,8 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
|
371
267
|
}
|
|
372
268
|
}
|
|
373
269
|
]);
|
|
374
|
-
return
|
|
270
|
+
return Designer1;
|
|
375
271
|
}(RegisterControls);
|
|
376
|
-
|
|
377
|
-
export {
|
|
378
|
-
export { Designer };
|
|
272
|
+
Designer1.EventLogic = EventLogic;
|
|
273
|
+
export { Designer1 as default };
|
|
274
|
+
export { Designer1 as Designer };
|
package/dist/esm/Driven.js
CHANGED
|
@@ -192,52 +192,35 @@ 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
|
+
var Driven = /**
|
|
204
204
|
* 设计器驱动
|
|
205
|
-
* */
|
|
205
|
+
* */ /*#__PURE__*/ function(Watcher1) {
|
|
206
206
|
"use strict";
|
|
207
|
-
_inherits(Driven,
|
|
207
|
+
_inherits(Driven, Watcher1);
|
|
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
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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);
|
|
213
|
+
_this.isMounted = false;
|
|
214
|
+
_this.id = genNonDuplicateId(8);
|
|
215
|
+
_this.__pluginsApplied = false;
|
|
233
216
|
// TODO 拿到schema
|
|
234
|
-
|
|
217
|
+
_this.getSchema = toSchema;
|
|
235
218
|
// TODO 拿到model_bind_info_list
|
|
236
|
-
|
|
219
|
+
_this.getModelBindInfoList = getModelBindInfoList;
|
|
237
220
|
// TODO 拿到permission_controls
|
|
238
|
-
|
|
221
|
+
_this.generatePermissions = generatePermissions;
|
|
239
222
|
_this.$options = Object.freeze(options);
|
|
240
|
-
var
|
|
223
|
+
var _$options = _this.$options, _autoMount = _$options.autoMount, autoMount = _autoMount === void 0 ? false : _autoMount, tmp = _$options.Designer, DesignerClass = tmp === void 0 ? Designer : tmp, schema = _$options.schema, _mode = _$options.mode, mode = _mode === void 0 ? 'form' : _mode, tmp1 = _$options.store, storeOptions = tmp1 === void 0 ? {} : tmp1;
|
|
241
224
|
_this.eventLogic = new EventLogic();
|
|
242
225
|
_this.designer = new DesignerClass();
|
|
243
226
|
_this.store = new Store(_objectSpread({
|
|
@@ -254,7 +237,7 @@ var applyingPluginName = "";
|
|
|
254
237
|
key: "mount",
|
|
255
238
|
value: // 挂载
|
|
256
239
|
function mount() {
|
|
257
|
-
var
|
|
240
|
+
var _$options = this.$options, _plugins = _$options.plugins, plugins = _plugins === void 0 ? [] : _plugins;
|
|
258
241
|
this.__plugins = plugins;
|
|
259
242
|
this.applyPlugins();
|
|
260
243
|
this.isMounted = true;
|
|
@@ -276,10 +259,10 @@ var applyingPluginName = "";
|
|
|
276
259
|
if (this.__pluginsApplied) return;
|
|
277
260
|
this.__plugins.forEach(function(plugin) {
|
|
278
261
|
try {
|
|
279
|
-
var
|
|
280
|
-
applyingPluginName = (
|
|
262
|
+
var _pluginName;
|
|
263
|
+
applyingPluginName = (_pluginName = plugin.pluginName) !== null && _pluginName !== void 0 ? _pluginName : plugin.constructor.name;
|
|
281
264
|
plugin.apply(_this);
|
|
282
|
-
applyingPluginName =
|
|
265
|
+
applyingPluginName = '';
|
|
283
266
|
} catch (e) {
|
|
284
267
|
error("".concat(applyingPluginName || plugin.constructor.name, " Plugin apply Error \n ").concat(e));
|
|
285
268
|
}
|
|
@@ -326,7 +309,7 @@ var applyingPluginName = "";
|
|
|
326
309
|
return;
|
|
327
310
|
}
|
|
328
311
|
this.setSelectedInstanceSetting();
|
|
329
|
-
this.emit(
|
|
312
|
+
this.emit('select', {
|
|
330
313
|
instance: instance
|
|
331
314
|
});
|
|
332
315
|
}
|
|
@@ -334,7 +317,7 @@ var applyingPluginName = "";
|
|
|
334
317
|
{
|
|
335
318
|
key: "setSelectedInstanceSetting",
|
|
336
319
|
value: function setSelectedInstanceSetting() {
|
|
337
|
-
var
|
|
320
|
+
var ref;
|
|
338
321
|
var instance = this.store.selected;
|
|
339
322
|
if (!instance) {
|
|
340
323
|
return;
|
|
@@ -343,13 +326,13 @@ var applyingPluginName = "";
|
|
|
343
326
|
// console.log('iswrap:', instance.parent?.controlType, instance.parent)
|
|
344
327
|
// if (instance.parent instanceof DesignerWrapControl) {
|
|
345
328
|
// 如果父控件为自定义控件wrapper
|
|
346
|
-
if (((
|
|
347
|
-
var
|
|
348
|
-
var wrapSetting = this.getControlSetting((
|
|
329
|
+
if (((ref = instance.parent) === null || ref === void 0 ? void 0 : ref.controlType) === CONTROL_BASE_TYPE.WRAP) {
|
|
330
|
+
var ref1;
|
|
331
|
+
var wrapSetting = this.getControlSetting((ref1 = instance.parent) === null || ref1 === void 0 ? void 0 : ref1.type);
|
|
349
332
|
setting = this.concatSetting(setting, wrapSetting, instance.parent.id);
|
|
350
333
|
}
|
|
351
334
|
this.store.setSelectInstanceSettings(setting);
|
|
352
|
-
this.callSelectedEffect(
|
|
335
|
+
this.callSelectedEffect('');
|
|
353
336
|
// 选中触发scopeEffect
|
|
354
337
|
var payload = {
|
|
355
338
|
from: null,
|
|
@@ -363,14 +346,14 @@ var applyingPluginName = "";
|
|
|
363
346
|
{
|
|
364
347
|
key: "concatSetting",
|
|
365
348
|
value: function concatSetting(settings, otherSettings, settingFromId) {
|
|
366
|
-
var
|
|
367
|
-
var
|
|
368
|
-
var result = settings;
|
|
349
|
+
var ref, ref2, ref3, ref4, ref5, ref6, ref7, ref8;
|
|
350
|
+
var result1 = settings;
|
|
369
351
|
// tab
|
|
370
|
-
if (((
|
|
352
|
+
if (((ref = settings[0]) === null || ref === void 0 ? void 0 : ref.type) === 'tab' && ((ref2 = otherSettings[0]) === null || ref2 === void 0 ? void 0 : ref2.type) === 'tab') {
|
|
353
|
+
var _this = this;
|
|
371
354
|
var tabSettings = settings;
|
|
372
355
|
var otherTabSettings = otherSettings.slice(0);
|
|
373
|
-
|
|
356
|
+
result1 = tabSettings.map(function(tab, index) {
|
|
374
357
|
var result = new Tab(tab);
|
|
375
358
|
var otherTabIndex = otherTabSettings.findIndex(function(item) {
|
|
376
359
|
return item.title === tab.title;
|
|
@@ -385,38 +368,41 @@ var applyingPluginName = "";
|
|
|
385
368
|
return result;
|
|
386
369
|
});
|
|
387
370
|
if (otherTabSettings.length) {
|
|
388
|
-
|
|
389
|
-
|
|
371
|
+
var _this1 = this;
|
|
372
|
+
result1 = _toConsumableArray(result1).concat(_toConsumableArray(otherTabSettings.map(function(item) {
|
|
373
|
+
return _this1.formatGroupSetting(item, settingFromId);
|
|
390
374
|
})));
|
|
391
375
|
}
|
|
392
376
|
// group
|
|
393
|
-
} else if (((
|
|
377
|
+
} else if (((ref3 = settings[0]) === null || ref3 === void 0 ? void 0 : ref3.type) === 'group' && ((ref4 = otherSettings[0]) === null || ref4 === void 0 ? void 0 : ref4.type) === 'group') {
|
|
394
378
|
var groupSettings = settings;
|
|
395
379
|
var otherGroupSettings = otherSettings;
|
|
396
|
-
|
|
380
|
+
result1 = _toConsumableArray(this.formatGroupSetting(otherGroupSettings, settingFromId)).concat(_toConsumableArray(groupSettings));
|
|
397
381
|
// 当前控件setting是tab,合并控件setting是group
|
|
398
|
-
} else if (((
|
|
382
|
+
} else if (((ref5 = settings[0]) === null || ref5 === void 0 ? void 0 : ref5.type) === 'tab' && ((ref6 = otherSettings[0]) === null || ref6 === void 0 ? void 0 : ref6.type) === 'group') {
|
|
383
|
+
var _this2 = this;
|
|
399
384
|
var tabSettings1 = settings;
|
|
400
385
|
var otherGroupSettings1 = otherSettings;
|
|
401
|
-
|
|
386
|
+
result1 = tabSettings1.map(function(tab, index) {
|
|
402
387
|
var result = new Tab(tab);
|
|
403
388
|
if (index === 0) {
|
|
404
|
-
result.items = _toConsumableArray(
|
|
389
|
+
result.items = _toConsumableArray(_this2.formatGroupSetting(otherGroupSettings1, settingFromId)).concat(_toConsumableArray(result.items));
|
|
405
390
|
}
|
|
406
391
|
return result;
|
|
407
392
|
});
|
|
408
|
-
} else if (((
|
|
393
|
+
} else if (((ref7 = settings[0]) === null || ref7 === void 0 ? void 0 : ref7.type) === 'group' && ((ref8 = otherSettings[0]) === null || ref8 === void 0 ? void 0 : ref8.type) === 'tab') {
|
|
394
|
+
var _this3 = this;
|
|
409
395
|
var groupSettings1 = settings;
|
|
410
396
|
var otherTabSettings1 = otherSettings;
|
|
411
|
-
|
|
397
|
+
result1 = otherTabSettings1.map(function(tab, index) {
|
|
412
398
|
var result = new Tab(tab);
|
|
413
399
|
if (index === 0) {
|
|
414
|
-
result.items = _toConsumableArray(result.items).concat(_toConsumableArray(
|
|
400
|
+
result.items = _toConsumableArray(result.items).concat(_toConsumableArray(_this3.formatGroupSetting(groupSettings1, settingFromId)));
|
|
415
401
|
}
|
|
416
402
|
return result;
|
|
417
403
|
});
|
|
418
404
|
}
|
|
419
|
-
return
|
|
405
|
+
return result1;
|
|
420
406
|
}
|
|
421
407
|
},
|
|
422
408
|
{
|
|
@@ -441,8 +427,8 @@ var applyingPluginName = "";
|
|
|
441
427
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
442
428
|
args[_key] = arguments[_key];
|
|
443
429
|
}
|
|
444
|
-
var
|
|
445
|
-
return (
|
|
430
|
+
var _designer;
|
|
431
|
+
return (_designer = this.designer).registerControlConfig.apply(_designer, _toConsumableArray(args));
|
|
446
432
|
}
|
|
447
433
|
},
|
|
448
434
|
{
|
|
@@ -476,7 +462,7 @@ var applyingPluginName = "";
|
|
|
476
462
|
key: "setSelectedFieldItem",
|
|
477
463
|
value: function setSelectedFieldItem(fieldItem) {
|
|
478
464
|
this.store.setSelectedFieldItem(fieldItem);
|
|
479
|
-
this.callSelectedEffect(
|
|
465
|
+
this.callSelectedEffect('dataBind', {
|
|
480
466
|
fieldItem: fieldItem
|
|
481
467
|
});
|
|
482
468
|
}
|
|
@@ -495,7 +481,7 @@ var applyingPluginName = "";
|
|
|
495
481
|
key: "moveEnd",
|
|
496
482
|
value: function moveEnd() {
|
|
497
483
|
var instance = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.store.movingInstance;
|
|
498
|
-
var
|
|
484
|
+
var ref;
|
|
499
485
|
if (instance === null) return;
|
|
500
486
|
var _instance = this.getInstance(instance);
|
|
501
487
|
if (!_instance) return;
|
|
@@ -509,7 +495,7 @@ var applyingPluginName = "";
|
|
|
509
495
|
var newParent = _instance.parent;
|
|
510
496
|
// 移动之后清空movingInstance
|
|
511
497
|
this.store.setMovingInstance(null);
|
|
512
|
-
if (_instance.id !== ((
|
|
498
|
+
if (_instance.id !== ((ref = this.store.selected) === null || ref === void 0 ? void 0 : ref.id)) {
|
|
513
499
|
this.selectInstance(_instance);
|
|
514
500
|
} else {
|
|
515
501
|
this.store.setSelectInstance(_instance);
|
|
@@ -524,9 +510,9 @@ var applyingPluginName = "";
|
|
|
524
510
|
};
|
|
525
511
|
this.callSelectedScopeEffect(payload);
|
|
526
512
|
if (oldParent) {
|
|
527
|
-
this.emit(
|
|
513
|
+
this.emit('moved', _objectSpread({}, payload));
|
|
528
514
|
} else {
|
|
529
|
-
this.emit(
|
|
515
|
+
this.emit('joined', _objectSpread({}, payload));
|
|
530
516
|
}
|
|
531
517
|
}
|
|
532
518
|
},
|
|
@@ -543,7 +529,7 @@ var applyingPluginName = "";
|
|
|
543
529
|
// return instanceId
|
|
544
530
|
// }
|
|
545
531
|
// return this.store.instanceIdMap.get(instanceId)
|
|
546
|
-
if (typeof instanceId ===
|
|
532
|
+
if (typeof instanceId === 'string') {
|
|
547
533
|
return this.store.instanceIdMap.get(instanceId);
|
|
548
534
|
}
|
|
549
535
|
return instanceId;
|
|
@@ -580,19 +566,19 @@ var applyingPluginName = "";
|
|
|
580
566
|
{
|
|
581
567
|
key: "updateInstancePropValue",
|
|
582
568
|
value: function updateInstancePropValue(instance, propName, value, payload) {
|
|
583
|
-
var
|
|
569
|
+
var ref;
|
|
584
570
|
var result = updateValueFromKeys(instance.props, propName, value);
|
|
585
571
|
if (!result) {
|
|
586
572
|
return;
|
|
587
573
|
}
|
|
588
574
|
// 修改dataBind的时候要更新 fieldCodeMap
|
|
589
|
-
if (propName.startsWith(
|
|
575
|
+
if (propName.startsWith('dataBind')) {
|
|
590
576
|
this.store.updateDataFieldCodeMap(instance);
|
|
591
577
|
}
|
|
592
|
-
if (instance.id === ((
|
|
578
|
+
if (instance.id === ((ref = this.store.selected) === null || ref === void 0 ? void 0 : ref.id)) {
|
|
593
579
|
this.callSelectedEffect(propName, payload);
|
|
594
580
|
}
|
|
595
|
-
this.emit(
|
|
581
|
+
this.emit('updated', {
|
|
596
582
|
instance: instance,
|
|
597
583
|
propName: propName,
|
|
598
584
|
value: value
|
|
@@ -602,11 +588,11 @@ var applyingPluginName = "";
|
|
|
602
588
|
{
|
|
603
589
|
key: "updateInstanceProps",
|
|
604
590
|
value: function updateInstanceProps(instance, props, payload) {
|
|
605
|
-
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] :
|
|
591
|
+
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : '';
|
|
606
592
|
var _this = this;
|
|
607
593
|
Object.entries(props).forEach(function(param) {
|
|
608
594
|
var _param = _slicedToArray(param, 2), key = _param[0], value = _param[1];
|
|
609
|
-
var propName = "".concat(prevKey ? prevKey +
|
|
595
|
+
var propName = "".concat(prevKey ? prevKey + '.' : '').concat(key);
|
|
610
596
|
if (isObject(value)) {
|
|
611
597
|
_this.updateInstanceProps(instance, value, payload, propName);
|
|
612
598
|
} else {
|
|
@@ -642,7 +628,7 @@ var applyingPluginName = "";
|
|
|
642
628
|
});
|
|
643
629
|
index > -1 && parentList.splice(index, 1);
|
|
644
630
|
this.store.getFlatInstances();
|
|
645
|
-
this.emit(
|
|
631
|
+
this.emit('removed', {
|
|
646
632
|
instance: instance,
|
|
647
633
|
index: index,
|
|
648
634
|
parent: parent
|
|
@@ -720,8 +706,8 @@ var applyingPluginName = "";
|
|
|
720
706
|
for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
|
|
721
707
|
arg[_key] = arguments[_key];
|
|
722
708
|
}
|
|
723
|
-
var
|
|
724
|
-
(
|
|
709
|
+
var _designer;
|
|
710
|
+
(_designer = this.designer).registerControl.apply(_designer, _toConsumableArray(arg));
|
|
725
711
|
return this;
|
|
726
712
|
}
|
|
727
713
|
},
|
|
@@ -807,7 +793,5 @@ var applyingPluginName = "";
|
|
|
807
793
|
]);
|
|
808
794
|
return Driven;
|
|
809
795
|
}(Watcher);
|
|
810
|
-
|
|
811
|
-
* 控件事件定义
|
|
812
|
-
* */ _defineProperty(Driven, "EventLogic", EventLogic);
|
|
796
|
+
Driven.EventLogic = EventLogic;
|
|
813
797
|
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;
|