@byteluck-fe/model-driven-driven 2.7.0-alpha.9 → 2.7.0-beta
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 +22 -9
- package/dist/esm/Designer.js +176 -72
- package/dist/esm/Driven.js +131 -135
- package/dist/esm/EventLogic.js +1 -1
- package/dist/esm/Plugin.js +2 -2
- package/dist/esm/Store.js +75 -41
- package/dist/esm/constants.js +8 -8
- package/dist/esm/designerUtils.js +5 -5
- package/dist/esm/index.js +6 -6
- package/dist/esm/utils.js +196 -94
- 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 +6 -6
package/dist/esm/Driven.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function _assert_this_initialized(self) {
|
|
13
13
|
if (self === void 0) {
|
|
14
14
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
15
15
|
}
|
|
16
16
|
return self;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function _class_call_check(instance, Constructor) {
|
|
19
19
|
if (!(instance instanceof Constructor)) {
|
|
20
20
|
throw new TypeError("Cannot call a class as a function");
|
|
21
21
|
}
|
|
@@ -29,12 +29,12 @@ function _defineProperties(target, props) {
|
|
|
29
29
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
33
33
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
34
34
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
35
35
|
return Constructor;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function _define_property(obj, key, value) {
|
|
38
38
|
if (key in obj) {
|
|
39
39
|
Object.defineProperty(obj, key, {
|
|
40
40
|
value: value,
|
|
@@ -51,23 +51,23 @@ function _get(target, property, receiver) {
|
|
|
51
51
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
52
52
|
_get = Reflect.get;
|
|
53
53
|
} else {
|
|
54
|
-
_get = function
|
|
55
|
-
var base =
|
|
54
|
+
_get = function get(target, property, receiver) {
|
|
55
|
+
var base = _super_prop_base(target, property);
|
|
56
56
|
if (!base) return;
|
|
57
57
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
58
58
|
if (desc.get) {
|
|
59
|
-
return desc.get.call(receiver);
|
|
59
|
+
return desc.get.call(receiver || target);
|
|
60
60
|
}
|
|
61
61
|
return desc.value;
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
return _get(target, property, receiver || target);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
66
|
+
function _get_prototype_of(o) {
|
|
67
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
68
68
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
69
69
|
};
|
|
70
|
-
return
|
|
70
|
+
return _get_prototype_of(o);
|
|
71
71
|
}
|
|
72
72
|
function _inherits(subClass, superClass) {
|
|
73
73
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -80,12 +80,12 @@ function _inherits(subClass, superClass) {
|
|
|
80
80
|
configurable: true
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
|
-
if (superClass)
|
|
83
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function _iterable_to_array(iter) {
|
|
86
86
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function _iterable_to_array_limit(arr, i) {
|
|
89
89
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
90
90
|
if (_i == null) return;
|
|
91
91
|
var _arr = [];
|
|
@@ -109,13 +109,13 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
109
109
|
}
|
|
110
110
|
return _arr;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function _non_iterable_rest() {
|
|
113
113
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function _non_iterable_spread() {
|
|
116
116
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function _object_spread(target) {
|
|
119
119
|
for(var i = 1; i < arguments.length; i++){
|
|
120
120
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
121
121
|
var ownKeys = Object.keys(source);
|
|
@@ -125,50 +125,50 @@ function _objectSpread(target) {
|
|
|
125
125
|
}));
|
|
126
126
|
}
|
|
127
127
|
ownKeys.forEach(function(key) {
|
|
128
|
-
|
|
128
|
+
_define_property(target, key, source[key]);
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
return target;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
if (call && (
|
|
133
|
+
function _possible_constructor_return(self, call) {
|
|
134
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
135
135
|
return call;
|
|
136
136
|
}
|
|
137
|
-
return
|
|
137
|
+
return _assert_this_initialized(self);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
|
|
139
|
+
function _set_prototype_of(o, p) {
|
|
140
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
141
141
|
o.__proto__ = p;
|
|
142
142
|
return o;
|
|
143
143
|
};
|
|
144
|
-
return
|
|
144
|
+
return _set_prototype_of(o, p);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
return
|
|
146
|
+
function _sliced_to_array(arr, i) {
|
|
147
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function _super_prop_base(object, property) {
|
|
150
150
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
151
|
-
object =
|
|
151
|
+
object = _get_prototype_of(object);
|
|
152
152
|
if (object === null) break;
|
|
153
153
|
}
|
|
154
154
|
return object;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
return
|
|
156
|
+
function _to_consumable_array(arr) {
|
|
157
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
function _type_of(obj) {
|
|
160
160
|
"@swc/helpers - typeof";
|
|
161
161
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
162
|
-
}
|
|
163
|
-
function
|
|
162
|
+
}
|
|
163
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
164
164
|
if (!o) return;
|
|
165
|
-
if (typeof o === "string") return
|
|
165
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
166
166
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
167
167
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
168
168
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
169
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
169
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function _is_native_reflect_construct() {
|
|
172
172
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
173
173
|
if (Reflect.construct.sham) return false;
|
|
174
174
|
if (typeof Proxy === "function") return true;
|
|
@@ -179,51 +179,68 @@ function _isNativeReflectConstruct() {
|
|
|
179
179
|
return false;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
var hasNativeReflectConstruct =
|
|
182
|
+
function _create_super(Derived) {
|
|
183
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
184
184
|
return function _createSuperInternal() {
|
|
185
|
-
var Super =
|
|
185
|
+
var Super = _get_prototype_of(Derived), result;
|
|
186
186
|
if (hasNativeReflectConstruct) {
|
|
187
|
-
var NewTarget =
|
|
187
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
188
188
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
189
189
|
} else {
|
|
190
190
|
result = Super.apply(this, arguments);
|
|
191
191
|
}
|
|
192
|
-
return
|
|
192
|
+
return _possible_constructor_return(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,
|
|
208
|
-
var _super =
|
|
207
|
+
_inherits(Driven, Watcher);
|
|
208
|
+
var _super = _create_super(Driven);
|
|
209
209
|
function Driven(options) {
|
|
210
|
-
|
|
210
|
+
_class_call_check(this, Driven);
|
|
211
211
|
var _this;
|
|
212
212
|
_this = _super.call(this);
|
|
213
|
-
_this
|
|
214
|
-
_this
|
|
215
|
-
_this
|
|
213
|
+
_define_property(_assert_this_initialized(_this), "mode", void 0);
|
|
214
|
+
_define_property(_assert_this_initialized(_this), "isMounted", false);
|
|
215
|
+
_define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
|
|
216
|
+
/**
|
|
217
|
+
* 控件可选的事件
|
|
218
|
+
* */ _define_property(_assert_this_initialized(_this), "eventLogic", void 0);
|
|
219
|
+
/**
|
|
220
|
+
* 处理数据存储,存放模型等
|
|
221
|
+
* */ _define_property(_assert_this_initialized(_this), "store", void 0);
|
|
222
|
+
/**
|
|
223
|
+
* 额外参数存储
|
|
224
|
+
*/ _define_property(_assert_this_initialized(_this), "externalParams", void 0);
|
|
225
|
+
/**
|
|
226
|
+
* 处理instance,和schema存储
|
|
227
|
+
* */ _define_property(_assert_this_initialized(_this), "designer", void 0);
|
|
228
|
+
/**
|
|
229
|
+
* 插件数组
|
|
230
|
+
* */ _define_property(_assert_this_initialized(_this), "__plugins", void 0);
|
|
231
|
+
_define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
|
|
232
|
+
_define_property(_assert_this_initialized(_this), "$options", void 0);
|
|
216
233
|
// TODO 拿到schema
|
|
217
|
-
_this
|
|
234
|
+
_define_property(_assert_this_initialized(_this), "getSchema", toSchema);
|
|
218
235
|
// TODO 拿到model_bind_info_list
|
|
219
|
-
_this
|
|
236
|
+
_define_property(_assert_this_initialized(_this), "getModelBindInfoList", getModelBindInfoList);
|
|
220
237
|
// TODO 拿到permission_controls
|
|
221
|
-
_this
|
|
238
|
+
_define_property(_assert_this_initialized(_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
|
-
_this.store = new Store(
|
|
243
|
+
_this.store = new Store(_object_spread({
|
|
227
244
|
instance: _this.designer.createControl(Array.isArray(schema) ? schema : [
|
|
228
245
|
schema
|
|
229
246
|
])
|
|
@@ -232,12 +249,12 @@ var Driven = /**
|
|
|
232
249
|
autoMount && _this.mount();
|
|
233
250
|
return _this;
|
|
234
251
|
}
|
|
235
|
-
|
|
252
|
+
_create_class(Driven, [
|
|
236
253
|
{
|
|
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
|
}
|
|
@@ -276,13 +293,13 @@ var Driven = /**
|
|
|
276
293
|
for(var _len = arguments.length, payload = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
277
294
|
payload[_key - 1] = arguments[_key];
|
|
278
295
|
}
|
|
279
|
-
return _get(
|
|
296
|
+
return _get(_get_prototype_of(Driven.prototype), "emit", this).call(this, key, payload);
|
|
280
297
|
}
|
|
281
298
|
},
|
|
282
299
|
{
|
|
283
300
|
key: "on",
|
|
284
301
|
value: function on(key, callback) {
|
|
285
|
-
return _get(
|
|
302
|
+
return _get(_get_prototype_of(Driven.prototype), "on", this).call(this, key, callback);
|
|
286
303
|
}
|
|
287
304
|
},
|
|
288
305
|
{
|
|
@@ -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;
|
|
@@ -325,14 +342,13 @@ var Driven = /**
|
|
|
325
342
|
var setting = this.getControlSetting(instance.type);
|
|
326
343
|
// console.log('iswrap:', instance.parent?.controlType, instance.parent)
|
|
327
344
|
// if (instance.parent instanceof DesignerWrapControl) {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
var
|
|
331
|
-
var wrapSetting = this.getControlSetting((ref1 = instance.parent) === null || ref1 === void 0 ? void 0 : ref1.type);
|
|
345
|
+
if (((_instance_parent = instance.parent) === null || _instance_parent === void 0 ? void 0 : _instance_parent.controlType) === CONTROL_BASE_TYPE.WRAP) {
|
|
346
|
+
var _instance_parent1;
|
|
347
|
+
var wrapSetting = this.getControlSetting((_instance_parent1 = instance.parent) === null || _instance_parent1 === void 0 ? void 0 : _instance_parent1.type);
|
|
332
348
|
setting = this.concatSetting(setting, wrapSetting, instance.parent.id);
|
|
333
349
|
}
|
|
334
350
|
this.store.setSelectInstanceSettings(setting);
|
|
335
|
-
this.callSelectedEffect(
|
|
351
|
+
this.callSelectedEffect("");
|
|
336
352
|
// 选中触发scopeEffect
|
|
337
353
|
var payload = {
|
|
338
354
|
from: null,
|
|
@@ -346,14 +362,14 @@ var Driven = /**
|
|
|
346
362
|
{
|
|
347
363
|
key: "concatSetting",
|
|
348
364
|
value: function concatSetting(settings, otherSettings, settingFromId) {
|
|
349
|
-
var
|
|
350
|
-
var
|
|
365
|
+
var _this = this;
|
|
366
|
+
var _settings_, _otherSettings_, _settings_1, _otherSettings_1;
|
|
367
|
+
var result = settings;
|
|
351
368
|
// tab
|
|
352
|
-
if (((
|
|
353
|
-
var _this = this;
|
|
369
|
+
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") {
|
|
354
370
|
var tabSettings = settings;
|
|
355
371
|
var otherTabSettings = otherSettings.slice(0);
|
|
356
|
-
|
|
372
|
+
result = tabSettings.map(function(tab, index) {
|
|
357
373
|
var result = new Tab(tab);
|
|
358
374
|
var otherTabIndex = otherTabSettings.findIndex(function(item) {
|
|
359
375
|
return item.title === tab.title;
|
|
@@ -363,46 +379,24 @@ var Driven = /**
|
|
|
363
379
|
}
|
|
364
380
|
var otherTab = otherTabSettings.splice(otherTabIndex, 1)[0];
|
|
365
381
|
if (otherTab) {
|
|
366
|
-
result.items =
|
|
382
|
+
result.items = _to_consumable_array(_this.formatGroupSetting(otherTab.items, settingFromId)).concat(_to_consumable_array(result.items));
|
|
367
383
|
}
|
|
368
384
|
return result;
|
|
369
385
|
});
|
|
370
386
|
if (otherTabSettings.length) {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
return _this1.formatGroupSetting(item, settingFromId);
|
|
387
|
+
result = _to_consumable_array(result).concat(_to_consumable_array(otherTabSettings.map(function(item) {
|
|
388
|
+
return _this.formatGroupSetting(item, settingFromId);
|
|
374
389
|
})));
|
|
375
390
|
}
|
|
376
391
|
// group
|
|
377
|
-
} else if (((
|
|
392
|
+
} 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") {
|
|
378
393
|
var groupSettings = settings;
|
|
379
394
|
var otherGroupSettings = otherSettings;
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
var _this2 = this;
|
|
384
|
-
var tabSettings1 = settings;
|
|
385
|
-
var otherGroupSettings1 = otherSettings;
|
|
386
|
-
result1 = tabSettings1.map(function(tab, index) {
|
|
387
|
-
var result = new Tab(tab);
|
|
388
|
-
if (index === 0) {
|
|
389
|
-
result.items = _toConsumableArray(_this2.formatGroupSetting(otherGroupSettings1, settingFromId)).concat(_toConsumableArray(result.items));
|
|
390
|
-
}
|
|
391
|
-
return result;
|
|
392
|
-
});
|
|
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;
|
|
395
|
-
var groupSettings1 = settings;
|
|
396
|
-
var otherTabSettings1 = otherSettings;
|
|
397
|
-
result1 = otherTabSettings1.map(function(tab, index) {
|
|
398
|
-
var result = new Tab(tab);
|
|
399
|
-
if (index === 0) {
|
|
400
|
-
result.items = _toConsumableArray(result.items).concat(_toConsumableArray(_this3.formatGroupSetting(groupSettings1, settingFromId)));
|
|
401
|
-
}
|
|
402
|
-
return result;
|
|
403
|
-
});
|
|
395
|
+
result = _to_consumable_array(this.formatGroupSetting(otherGroupSettings, settingFromId)).concat(_to_consumable_array(groupSettings));
|
|
396
|
+
} else {
|
|
397
|
+
// 一个是tab,一个是group,暂时不支持
|
|
404
398
|
}
|
|
405
|
-
return
|
|
399
|
+
return result;
|
|
406
400
|
}
|
|
407
401
|
},
|
|
408
402
|
{
|
|
@@ -427,8 +421,8 @@ var Driven = /**
|
|
|
427
421
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
428
422
|
args[_key] = arguments[_key];
|
|
429
423
|
}
|
|
430
|
-
var
|
|
431
|
-
return (
|
|
424
|
+
var _this_designer;
|
|
425
|
+
return (_this_designer = this.designer).registerControlConfig.apply(_this_designer, _to_consumable_array(args));
|
|
432
426
|
}
|
|
433
427
|
},
|
|
434
428
|
{
|
|
@@ -462,7 +456,7 @@ var Driven = /**
|
|
|
462
456
|
key: "setSelectedFieldItem",
|
|
463
457
|
value: function setSelectedFieldItem(fieldItem) {
|
|
464
458
|
this.store.setSelectedFieldItem(fieldItem);
|
|
465
|
-
this.callSelectedEffect(
|
|
459
|
+
this.callSelectedEffect("dataBind", {
|
|
466
460
|
fieldItem: fieldItem
|
|
467
461
|
});
|
|
468
462
|
}
|
|
@@ -481,7 +475,7 @@ var Driven = /**
|
|
|
481
475
|
key: "moveEnd",
|
|
482
476
|
value: function moveEnd() {
|
|
483
477
|
var instance = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.store.movingInstance;
|
|
484
|
-
var
|
|
478
|
+
var _this_store_selected;
|
|
485
479
|
if (instance === null) return;
|
|
486
480
|
var _instance = this.getInstance(instance);
|
|
487
481
|
if (!_instance) return;
|
|
@@ -495,7 +489,7 @@ var Driven = /**
|
|
|
495
489
|
var newParent = _instance.parent;
|
|
496
490
|
// 移动之后清空movingInstance
|
|
497
491
|
this.store.setMovingInstance(null);
|
|
498
|
-
if (_instance.id !== ((
|
|
492
|
+
if (_instance.id !== ((_this_store_selected = this.store.selected) === null || _this_store_selected === void 0 ? void 0 : _this_store_selected.id)) {
|
|
499
493
|
this.selectInstance(_instance);
|
|
500
494
|
} else {
|
|
501
495
|
this.store.setSelectInstance(_instance);
|
|
@@ -510,9 +504,9 @@ var Driven = /**
|
|
|
510
504
|
};
|
|
511
505
|
this.callSelectedScopeEffect(payload);
|
|
512
506
|
if (oldParent) {
|
|
513
|
-
this.emit(
|
|
507
|
+
this.emit("moved", _object_spread({}, payload));
|
|
514
508
|
} else {
|
|
515
|
-
this.emit(
|
|
509
|
+
this.emit("joined", _object_spread({}, payload));
|
|
516
510
|
}
|
|
517
511
|
}
|
|
518
512
|
},
|
|
@@ -529,7 +523,7 @@ var Driven = /**
|
|
|
529
523
|
// return instanceId
|
|
530
524
|
// }
|
|
531
525
|
// return this.store.instanceIdMap.get(instanceId)
|
|
532
|
-
if (typeof instanceId ===
|
|
526
|
+
if (typeof instanceId === "string") {
|
|
533
527
|
return this.store.instanceIdMap.get(instanceId);
|
|
534
528
|
}
|
|
535
529
|
return instanceId;
|
|
@@ -566,19 +560,19 @@ var Driven = /**
|
|
|
566
560
|
{
|
|
567
561
|
key: "updateInstancePropValue",
|
|
568
562
|
value: function updateInstancePropValue(instance, propName, value, payload) {
|
|
569
|
-
var
|
|
563
|
+
var _this_store_selected;
|
|
570
564
|
var result = updateValueFromKeys(instance.props, propName, value);
|
|
571
565
|
if (!result) {
|
|
572
566
|
return;
|
|
573
567
|
}
|
|
574
568
|
// 修改dataBind的时候要更新 fieldCodeMap
|
|
575
|
-
if (propName.startsWith(
|
|
569
|
+
if (propName.startsWith("dataBind")) {
|
|
576
570
|
this.store.updateDataFieldCodeMap(instance);
|
|
577
571
|
}
|
|
578
|
-
if (instance.id === ((
|
|
572
|
+
if (instance.id === ((_this_store_selected = this.store.selected) === null || _this_store_selected === void 0 ? void 0 : _this_store_selected.id)) {
|
|
579
573
|
this.callSelectedEffect(propName, payload);
|
|
580
574
|
}
|
|
581
|
-
this.emit(
|
|
575
|
+
this.emit("updated", {
|
|
582
576
|
instance: instance,
|
|
583
577
|
propName: propName,
|
|
584
578
|
value: value
|
|
@@ -588,11 +582,11 @@ var Driven = /**
|
|
|
588
582
|
{
|
|
589
583
|
key: "updateInstanceProps",
|
|
590
584
|
value: function updateInstanceProps(instance, props, payload) {
|
|
591
|
-
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] :
|
|
585
|
+
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "";
|
|
592
586
|
var _this = this;
|
|
593
587
|
Object.entries(props).forEach(function(param) {
|
|
594
|
-
var _param =
|
|
595
|
-
var propName = "".concat(prevKey ? prevKey +
|
|
588
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
589
|
+
var propName = "".concat(prevKey ? prevKey + "." : "").concat(key);
|
|
596
590
|
if (isObject(value)) {
|
|
597
591
|
_this.updateInstanceProps(instance, value, payload, propName);
|
|
598
592
|
} else {
|
|
@@ -628,7 +622,7 @@ var Driven = /**
|
|
|
628
622
|
});
|
|
629
623
|
index > -1 && parentList.splice(index, 1);
|
|
630
624
|
this.store.getFlatInstances();
|
|
631
|
-
this.emit(
|
|
625
|
+
this.emit("removed", {
|
|
632
626
|
instance: instance,
|
|
633
627
|
index: index,
|
|
634
628
|
parent: parent
|
|
@@ -706,8 +700,8 @@ var Driven = /**
|
|
|
706
700
|
for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
|
|
707
701
|
arg[_key] = arguments[_key];
|
|
708
702
|
}
|
|
709
|
-
var
|
|
710
|
-
(
|
|
703
|
+
var _this_designer;
|
|
704
|
+
(_this_designer = this.designer).registerControl.apply(_this_designer, _to_consumable_array(arg));
|
|
711
705
|
return this;
|
|
712
706
|
}
|
|
713
707
|
},
|
|
@@ -753,7 +747,7 @@ var Driven = /**
|
|
|
753
747
|
var payload = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
754
748
|
var _this = this;
|
|
755
749
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
756
|
-
setting.callEffect(effectKey, _this,
|
|
750
|
+
setting.callEffect(effectKey, _this, _object_spread({
|
|
757
751
|
control: _this.store.selected
|
|
758
752
|
}, payload));
|
|
759
753
|
});
|
|
@@ -765,7 +759,7 @@ var Driven = /**
|
|
|
765
759
|
var payload = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
766
760
|
var _this = this;
|
|
767
761
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
768
|
-
setting.callScopeEffect(_this,
|
|
762
|
+
setting.callScopeEffect(_this, _object_spread({
|
|
769
763
|
control: _this.store.selected
|
|
770
764
|
}, payload));
|
|
771
765
|
});
|
|
@@ -780,7 +774,7 @@ var Driven = /**
|
|
|
780
774
|
arg[_key] = arguments[_key];
|
|
781
775
|
}
|
|
782
776
|
var _Designer;
|
|
783
|
-
(_Designer = Designer).register.apply(_Designer,
|
|
777
|
+
(_Designer = Designer).register.apply(_Designer, _to_consumable_array(arg));
|
|
784
778
|
return this;
|
|
785
779
|
}
|
|
786
780
|
},
|
|
@@ -793,5 +787,7 @@ var Driven = /**
|
|
|
793
787
|
]);
|
|
794
788
|
return Driven;
|
|
795
789
|
}(Watcher);
|
|
796
|
-
|
|
790
|
+
/**
|
|
791
|
+
* 控件事件定义
|
|
792
|
+
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
797
793
|
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;
|
package/dist/esm/Plugin.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _class_call_check(instance, Constructor) {
|
|
2
2
|
if (!(instance instanceof Constructor)) {
|
|
3
3
|
throw new TypeError("Cannot call a class as a function");
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
var Plugin = function Plugin() {
|
|
7
7
|
"use strict";
|
|
8
|
-
|
|
8
|
+
_class_call_check(this, Plugin);
|
|
9
9
|
};
|
|
10
10
|
export { Plugin };
|