@byteluck-fe/model-driven-driven 2.7.0-alpha.25 → 2.7.0-alpha.27
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 +6 -6
- package/dist/esm/Designer.js +50 -50
- package/dist/esm/Driven.js +77 -77
- package/dist/esm/Plugin.js +2 -2
- package/dist/esm/Store.js +38 -38
- package/dist/esm/designerUtils.js +3 -2
- package/dist/esm/utils.js +32 -30
- package/dist/index.umd.js +3 -3
- package/package.json +5 -5
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,17 +179,17 @@ 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
195
|
import { CONTROL_BASE_TYPE, error, genNonDuplicateId, isArray, isBuiltInControls, isObject, isString, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
|
|
@@ -205,42 +205,42 @@ var applyingPluginName = "";
|
|
|
205
205
|
* */ var Driven = /*#__PURE__*/ function(Watcher) {
|
|
206
206
|
"use strict";
|
|
207
207
|
_inherits(Driven, Watcher);
|
|
208
|
-
var _super =
|
|
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
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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
216
|
/**
|
|
217
217
|
* 控件可选的事件
|
|
218
|
-
* */
|
|
218
|
+
* */ _define_property(_assert_this_initialized(_this), "eventLogic", void 0);
|
|
219
219
|
/**
|
|
220
220
|
* 处理数据存储,存放模型等
|
|
221
|
-
* */
|
|
221
|
+
* */ _define_property(_assert_this_initialized(_this), "store", void 0);
|
|
222
222
|
/**
|
|
223
223
|
* 额外参数存储
|
|
224
|
-
*/
|
|
224
|
+
*/ _define_property(_assert_this_initialized(_this), "externalParams", void 0);
|
|
225
225
|
/**
|
|
226
226
|
* 处理instance,和schema存储
|
|
227
|
-
* */
|
|
227
|
+
* */ _define_property(_assert_this_initialized(_this), "designer", void 0);
|
|
228
228
|
/**
|
|
229
229
|
* 插件数组
|
|
230
|
-
* */
|
|
231
|
-
|
|
232
|
-
|
|
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);
|
|
233
233
|
// TODO 拿到schema
|
|
234
|
-
|
|
234
|
+
_define_property(_assert_this_initialized(_this), "getSchema", toSchema);
|
|
235
235
|
// TODO 拿到model_bind_info_list
|
|
236
|
-
|
|
236
|
+
_define_property(_assert_this_initialized(_this), "getModelBindInfoList", getModelBindInfoList);
|
|
237
237
|
// TODO 拿到permission_controls
|
|
238
|
-
|
|
238
|
+
_define_property(_assert_this_initialized(_this), "generatePermissions", generatePermissions);
|
|
239
239
|
_this.$options = Object.freeze(options);
|
|
240
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;
|
|
241
241
|
_this.eventLogic = new EventLogic();
|
|
242
242
|
_this.designer = new DesignerClass();
|
|
243
|
-
_this.store = new Store(
|
|
243
|
+
_this.store = new Store(_object_spread({
|
|
244
244
|
instance: _this.designer.createControl(Array.isArray(schema) ? schema : [
|
|
245
245
|
schema
|
|
246
246
|
])
|
|
@@ -249,7 +249,7 @@ var applyingPluginName = "";
|
|
|
249
249
|
autoMount && _this.mount();
|
|
250
250
|
return _this;
|
|
251
251
|
}
|
|
252
|
-
|
|
252
|
+
_create_class(Driven, [
|
|
253
253
|
{
|
|
254
254
|
key: "mount",
|
|
255
255
|
value: // 挂载
|
|
@@ -293,13 +293,13 @@ var applyingPluginName = "";
|
|
|
293
293
|
for(var _len = arguments.length, payload = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
294
294
|
payload[_key - 1] = arguments[_key];
|
|
295
295
|
}
|
|
296
|
-
return _get(
|
|
296
|
+
return _get(_get_prototype_of(Driven.prototype), "emit", this).call(this, key, payload);
|
|
297
297
|
}
|
|
298
298
|
},
|
|
299
299
|
{
|
|
300
300
|
key: "on",
|
|
301
301
|
value: function on(key, callback) {
|
|
302
|
-
return _get(
|
|
302
|
+
return _get(_get_prototype_of(Driven.prototype), "on", this).call(this, key, callback);
|
|
303
303
|
}
|
|
304
304
|
},
|
|
305
305
|
{
|
|
@@ -380,12 +380,12 @@ var applyingPluginName = "";
|
|
|
380
380
|
}
|
|
381
381
|
var otherTab = otherTabSettings.splice(otherTabIndex, 1)[0];
|
|
382
382
|
if (otherTab) {
|
|
383
|
-
result.items =
|
|
383
|
+
result.items = _to_consumable_array(_this.formatGroupSetting(otherTab.items, settingFromId)).concat(_to_consumable_array(result.items));
|
|
384
384
|
}
|
|
385
385
|
return result;
|
|
386
386
|
});
|
|
387
387
|
if (otherTabSettings.length) {
|
|
388
|
-
result =
|
|
388
|
+
result = _to_consumable_array(result).concat(_to_consumable_array(otherTabSettings.map(function(item) {
|
|
389
389
|
return _this.formatGroupSetting(item, settingFromId);
|
|
390
390
|
})));
|
|
391
391
|
}
|
|
@@ -393,7 +393,7 @@ var applyingPluginName = "";
|
|
|
393
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") {
|
|
394
394
|
var groupSettings = settings;
|
|
395
395
|
var otherGroupSettings = otherSettings;
|
|
396
|
-
result =
|
|
396
|
+
result = _to_consumable_array(this.formatGroupSetting(otherGroupSettings, settingFromId)).concat(_to_consumable_array(groupSettings));
|
|
397
397
|
// 当前控件setting是tab,合并控件setting是group
|
|
398
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
399
|
var tabSettings1 = settings;
|
|
@@ -401,7 +401,7 @@ var applyingPluginName = "";
|
|
|
401
401
|
result = tabSettings1.map(function(tab, index) {
|
|
402
402
|
var result = new Tab(tab);
|
|
403
403
|
if (index === 0) {
|
|
404
|
-
result.items =
|
|
404
|
+
result.items = _to_consumable_array(_this.formatGroupSetting(otherGroupSettings1, settingFromId)).concat(_to_consumable_array(result.items));
|
|
405
405
|
}
|
|
406
406
|
return result;
|
|
407
407
|
});
|
|
@@ -411,7 +411,7 @@ var applyingPluginName = "";
|
|
|
411
411
|
result = otherTabSettings1.map(function(tab, index) {
|
|
412
412
|
var result = new Tab(tab);
|
|
413
413
|
if (index === 0) {
|
|
414
|
-
result.items =
|
|
414
|
+
result.items = _to_consumable_array(result.items).concat(_to_consumable_array(_this.formatGroupSetting(groupSettings1, settingFromId)));
|
|
415
415
|
}
|
|
416
416
|
return result;
|
|
417
417
|
});
|
|
@@ -442,7 +442,7 @@ var applyingPluginName = "";
|
|
|
442
442
|
args[_key] = arguments[_key];
|
|
443
443
|
}
|
|
444
444
|
var _this_designer;
|
|
445
|
-
return (_this_designer = this.designer).registerControlConfig.apply(_this_designer,
|
|
445
|
+
return (_this_designer = this.designer).registerControlConfig.apply(_this_designer, _to_consumable_array(args));
|
|
446
446
|
}
|
|
447
447
|
},
|
|
448
448
|
{
|
|
@@ -524,9 +524,9 @@ var applyingPluginName = "";
|
|
|
524
524
|
};
|
|
525
525
|
this.callSelectedScopeEffect(payload);
|
|
526
526
|
if (oldParent) {
|
|
527
|
-
this.emit("moved",
|
|
527
|
+
this.emit("moved", _object_spread({}, payload));
|
|
528
528
|
} else {
|
|
529
|
-
this.emit("joined",
|
|
529
|
+
this.emit("joined", _object_spread({}, payload));
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
532
|
},
|
|
@@ -605,7 +605,7 @@ var applyingPluginName = "";
|
|
|
605
605
|
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "";
|
|
606
606
|
var _this = this;
|
|
607
607
|
Object.entries(props).forEach(function(param) {
|
|
608
|
-
var _param =
|
|
608
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
609
609
|
var propName = "".concat(prevKey ? prevKey + "." : "").concat(key);
|
|
610
610
|
if (isObject(value)) {
|
|
611
611
|
_this.updateInstanceProps(instance, value, payload, propName);
|
|
@@ -721,7 +721,7 @@ var applyingPluginName = "";
|
|
|
721
721
|
arg[_key] = arguments[_key];
|
|
722
722
|
}
|
|
723
723
|
var _this_designer;
|
|
724
|
-
(_this_designer = this.designer).registerControl.apply(_this_designer,
|
|
724
|
+
(_this_designer = this.designer).registerControl.apply(_this_designer, _to_consumable_array(arg));
|
|
725
725
|
return this;
|
|
726
726
|
}
|
|
727
727
|
},
|
|
@@ -767,7 +767,7 @@ var applyingPluginName = "";
|
|
|
767
767
|
var payload = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
768
768
|
var _this = this;
|
|
769
769
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
770
|
-
setting.callEffect(effectKey, _this,
|
|
770
|
+
setting.callEffect(effectKey, _this, _object_spread({
|
|
771
771
|
control: _this.store.selected
|
|
772
772
|
}, payload));
|
|
773
773
|
});
|
|
@@ -779,7 +779,7 @@ var applyingPluginName = "";
|
|
|
779
779
|
var payload = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
780
780
|
var _this = this;
|
|
781
781
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
782
|
-
setting.callScopeEffect(_this,
|
|
782
|
+
setting.callScopeEffect(_this, _object_spread({
|
|
783
783
|
control: _this.store.selected
|
|
784
784
|
}, payload));
|
|
785
785
|
});
|
|
@@ -794,7 +794,7 @@ var applyingPluginName = "";
|
|
|
794
794
|
arg[_key] = arguments[_key];
|
|
795
795
|
}
|
|
796
796
|
var _Designer;
|
|
797
|
-
(_Designer = Designer).register.apply(_Designer,
|
|
797
|
+
(_Designer = Designer).register.apply(_Designer, _to_consumable_array(arg));
|
|
798
798
|
return this;
|
|
799
799
|
}
|
|
800
800
|
},
|
|
@@ -809,5 +809,5 @@ var applyingPluginName = "";
|
|
|
809
809
|
}(Watcher);
|
|
810
810
|
/**
|
|
811
811
|
* 控件事件定义
|
|
812
|
-
* */
|
|
812
|
+
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
813
813
|
export { Driven };
|
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 };
|
package/dist/esm/Store.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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 _class_call_check(instance, Constructor) {
|
|
13
13
|
if (!(instance instanceof Constructor)) {
|
|
14
14
|
throw new TypeError("Cannot call a class as a function");
|
|
15
15
|
}
|
|
@@ -23,12 +23,12 @@ function _defineProperties(target, props) {
|
|
|
23
23
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
27
27
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
28
28
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
29
29
|
return Constructor;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function _define_property(obj, key, value) {
|
|
32
32
|
if (key in obj) {
|
|
33
33
|
Object.defineProperty(obj, key, {
|
|
34
34
|
value: value,
|
|
@@ -41,10 +41,10 @@ function _defineProperty(obj, key, value) {
|
|
|
41
41
|
}
|
|
42
42
|
return obj;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function _iterable_to_array(iter) {
|
|
45
45
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function _iterable_to_array_limit(arr, i) {
|
|
48
48
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
49
49
|
if (_i == null) return;
|
|
50
50
|
var _arr = [];
|
|
@@ -68,25 +68,25 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
68
68
|
}
|
|
69
69
|
return _arr;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function _non_iterable_rest() {
|
|
72
72
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function _non_iterable_spread() {
|
|
75
75
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
77
|
+
function _sliced_to_array(arr, i) {
|
|
78
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
return
|
|
80
|
+
function _to_consumable_array(arr) {
|
|
81
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
84
84
|
if (!o) return;
|
|
85
|
-
if (typeof o === "string") return
|
|
85
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
86
86
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
87
87
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
88
88
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
89
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
89
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
90
90
|
}
|
|
91
91
|
import { isDataBind } from "@byteluck-fe/model-driven-core";
|
|
92
92
|
import { hasChildrenControl, hasFooterControl, hasHeaderControl } from "./designerUtils";
|
|
@@ -95,16 +95,16 @@ import { CONTROL_BASE_TYPE, CONTROL_TYPE } from "@byteluck-fe/model-driven-share
|
|
|
95
95
|
export var Store = /*#__PURE__*/ function() {
|
|
96
96
|
"use strict";
|
|
97
97
|
function Store(options) {
|
|
98
|
-
|
|
98
|
+
_class_call_check(this, Store);
|
|
99
99
|
/**
|
|
100
100
|
* 页面控件实例树
|
|
101
|
-
* */
|
|
101
|
+
* */ _define_property(this, "instance", void 0);
|
|
102
102
|
/**
|
|
103
103
|
* 拍平的控件数组
|
|
104
|
-
* */
|
|
104
|
+
* */ _define_property(this, "flatInstances", void 0);
|
|
105
105
|
/**
|
|
106
106
|
* 控件id组成的map
|
|
107
|
-
* */
|
|
107
|
+
* */ _define_property(this, "instanceIdMap", void 0);
|
|
108
108
|
/**
|
|
109
109
|
* dataCode和fieldCode组成的map
|
|
110
110
|
* {
|
|
@@ -115,28 +115,28 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
115
115
|
* [fieldCode]: 控件
|
|
116
116
|
* }
|
|
117
117
|
* }
|
|
118
|
-
* */
|
|
118
|
+
* */ _define_property(this, "dataFieldCodeMap", void 0);
|
|
119
119
|
/**
|
|
120
120
|
* 当前选中的控件
|
|
121
|
-
* */
|
|
121
|
+
* */ _define_property(this, "selected", null);
|
|
122
122
|
/**
|
|
123
123
|
* 当前选中的数据作用域控件
|
|
124
|
-
* */
|
|
125
|
-
|
|
124
|
+
* */ _define_property(this, "selectedInstanceDataScopeParent", null);
|
|
125
|
+
_define_property(this, "selectedDataScopeFlatInstances", []);
|
|
126
126
|
/**
|
|
127
127
|
* 当前选中控件的setting
|
|
128
|
-
* */
|
|
129
|
-
|
|
128
|
+
* */ _define_property(this, "selectedInstanceSetting", []);
|
|
129
|
+
_define_property(this, "selectedInstanceSettingItems", []);
|
|
130
130
|
/**
|
|
131
131
|
* 当前选中控件的数据模型
|
|
132
|
-
* */
|
|
132
|
+
* */ _define_property(this, "selectedFieldItem", null);
|
|
133
133
|
/**
|
|
134
134
|
* 扩展字段,比如appId,dataCode等
|
|
135
|
-
* */
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
* */ _define_property(this, "external", {});
|
|
136
|
+
_define_property(this, "movingInstance", null);
|
|
137
|
+
_define_property(this, "movingInstanceOldParent", null);
|
|
138
|
+
_define_property(this, "movingInstanceOldDataScopeParent", null);
|
|
139
|
+
_define_property(this, "getParentBeforeInstanceMove", void 0);
|
|
140
140
|
var _options_getParentBeforeInstanceMove;
|
|
141
141
|
this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
|
|
142
142
|
return instance.parent;
|
|
@@ -144,7 +144,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
144
144
|
this.instance = options.instance;
|
|
145
145
|
this.getFlatInstances();
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
_create_class(Store, [
|
|
148
148
|
{
|
|
149
149
|
key: "selectedRules",
|
|
150
150
|
get: /**
|
|
@@ -192,7 +192,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
192
192
|
this.selectedInstanceSettingItems = [];
|
|
193
193
|
this.selectedInstanceSetting.forEach(function(group) {
|
|
194
194
|
var _this_selectedInstanceSettingItems;
|
|
195
|
-
(_this_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_this_selectedInstanceSettingItems,
|
|
195
|
+
(_this_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_this_selectedInstanceSettingItems, _to_consumable_array(_this.getSettingItems(group)));
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
},
|
|
@@ -202,7 +202,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
202
202
|
// return group instanceof Group
|
|
203
203
|
return group.type === "group" ? group.items : group.items.reduce(function(result, curr) {
|
|
204
204
|
var _result;
|
|
205
|
-
(_result = result).push.apply(_result,
|
|
205
|
+
(_result = result).push.apply(_result, _to_consumable_array(curr.items));
|
|
206
206
|
return result;
|
|
207
207
|
}, []);
|
|
208
208
|
}
|
|
@@ -235,7 +235,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
235
235
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
236
236
|
try {
|
|
237
237
|
for(var _iterator = map.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
238
|
-
var _step_value =
|
|
238
|
+
var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
239
239
|
if (value.id === instance.id) {
|
|
240
240
|
map.delete(key);
|
|
241
241
|
break;
|
|
@@ -17,8 +17,9 @@ export function loopFormControl(control, callback) {
|
|
|
17
17
|
// @ts-ignore
|
|
18
18
|
loopFormControl(item.props.headers, callback);
|
|
19
19
|
} else if (hasChildrenControl(item)) {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
var // @ts-ignore
|
|
21
|
+
_item;
|
|
22
|
+
loopFormControl((_item = item) === null || _item === void 0 ? void 0 : _item.children, callback);
|
|
22
23
|
// @ts-ignore
|
|
23
24
|
// } else if (item instanceof DesignerFormControl) {
|
|
24
25
|
} else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|