@byteluck-fe/model-driven-driven 2.5.0-alpha.2 → 2.5.0-alpha.20
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 +9 -22
- package/dist/esm/Designer.js +72 -176
- package/dist/esm/Driven.js +111 -129
- package/dist/esm/EventLogic.js +1 -1
- package/dist/esm/Plugin.js +2 -2
- package/dist/esm/Store.js +41 -75
- 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 +92 -193
- package/dist/index.umd.js +3 -3
- package/dist/types/Driven.d.ts +6 -6
- 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 _arrayLikeToArray(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 _arrayWithHoles(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _arrayWithoutHoles(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function _assertThisInitialized(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 _classCallCheck(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 _createClass(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 _defineProperty(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 = _superPropBase(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);
|
|
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 _getPrototypeOf(o) {
|
|
67
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
68
68
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
69
69
|
};
|
|
70
|
-
return
|
|
70
|
+
return _getPrototypeOf(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) _setPrototypeOf(subClass, superClass);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function _iterableToArray(iter) {
|
|
86
86
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function _iterableToArrayLimit(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 _iterable_to_array_limit(arr, i) {
|
|
|
109
109
|
}
|
|
110
110
|
return _arr;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function _nonIterableRest() {
|
|
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 _nonIterableSpread() {
|
|
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 _objectSpread(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 _object_spread(target) {
|
|
|
125
125
|
}));
|
|
126
126
|
}
|
|
127
127
|
ownKeys.forEach(function(key) {
|
|
128
|
-
|
|
128
|
+
_defineProperty(target, key, source[key]);
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
return target;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
if (call && (
|
|
133
|
+
function _possibleConstructorReturn(self, call) {
|
|
134
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
135
135
|
return call;
|
|
136
136
|
}
|
|
137
|
-
return
|
|
137
|
+
return _assertThisInitialized(self);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
|
|
139
|
+
function _setPrototypeOf(o, p) {
|
|
140
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
141
141
|
o.__proto__ = p;
|
|
142
142
|
return o;
|
|
143
143
|
};
|
|
144
|
-
return
|
|
144
|
+
return _setPrototypeOf(o, p);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
return
|
|
146
|
+
function _slicedToArray(arr, i) {
|
|
147
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function _superPropBase(object, property) {
|
|
150
150
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
151
|
-
object =
|
|
151
|
+
object = _getPrototypeOf(object);
|
|
152
152
|
if (object === null) break;
|
|
153
153
|
}
|
|
154
154
|
return object;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
return
|
|
156
|
+
function _toConsumableArray(arr) {
|
|
157
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
var _typeof = function(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 _unsupportedIterableToArray(o, minLen) {
|
|
164
164
|
if (!o) return;
|
|
165
|
-
if (typeof o === "string") return
|
|
165
|
+
if (typeof o === "string") return _arrayLikeToArray(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 _arrayLikeToArray(o, minLen);
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function _isNativeReflectConstruct() {
|
|
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,68 +179,51 @@ function _is_native_reflect_construct() {
|
|
|
179
179
|
return false;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
var hasNativeReflectConstruct =
|
|
182
|
+
function _createSuper(Derived) {
|
|
183
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
184
184
|
return function _createSuperInternal() {
|
|
185
|
-
var Super =
|
|
185
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
186
186
|
if (hasNativeReflectConstruct) {
|
|
187
|
-
var NewTarget =
|
|
187
|
+
var NewTarget = _getPrototypeOf(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 _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,
|
|
208
|
-
var _super =
|
|
207
|
+
_inherits(Driven, Watcher1);
|
|
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
|
-
* */ _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);
|
|
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
|
-
_this.store = new Store(
|
|
226
|
+
_this.store = new Store(_objectSpread({
|
|
244
227
|
instance: _this.designer.createControl(Array.isArray(schema) ? schema : [
|
|
245
228
|
schema
|
|
246
229
|
])
|
|
@@ -249,12 +232,12 @@ var applyingPluginName = "";
|
|
|
249
232
|
autoMount && _this.mount();
|
|
250
233
|
return _this;
|
|
251
234
|
}
|
|
252
|
-
|
|
235
|
+
_createClass(Driven, [
|
|
253
236
|
{
|
|
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
|
}
|
|
@@ -293,13 +276,13 @@ var applyingPluginName = "";
|
|
|
293
276
|
for(var _len = arguments.length, payload = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
|
|
294
277
|
payload[_key - 1] = arguments[_key];
|
|
295
278
|
}
|
|
296
|
-
return _get(
|
|
279
|
+
return _get(_getPrototypeOf(Driven.prototype), "emit", this).call(this, key, payload);
|
|
297
280
|
}
|
|
298
281
|
},
|
|
299
282
|
{
|
|
300
283
|
key: "on",
|
|
301
284
|
value: function on(key, callback) {
|
|
302
|
-
return _get(
|
|
285
|
+
return _get(_getPrototypeOf(Driven.prototype), "on", this).call(this, key, callback);
|
|
303
286
|
}
|
|
304
287
|
},
|
|
305
288
|
{
|
|
@@ -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;
|
|
@@ -342,13 +325,13 @@ var applyingPluginName = "";
|
|
|
342
325
|
var setting = this.getControlSetting(instance.type);
|
|
343
326
|
// console.log('iswrap:', instance.parent?.controlType, instance.parent)
|
|
344
327
|
// if (instance.parent instanceof DesignerWrapControl) {
|
|
345
|
-
if (((
|
|
346
|
-
var
|
|
347
|
-
var wrapSetting = this.getControlSetting((
|
|
328
|
+
if (((ref = instance.parent) === null || ref === void 0 ? void 0 : ref.controlType) === CONTROL_BASE_TYPE.WRAP) {
|
|
329
|
+
var ref1;
|
|
330
|
+
var wrapSetting = this.getControlSetting((ref1 = instance.parent) === null || ref1 === void 0 ? void 0 : ref1.type);
|
|
348
331
|
setting = this.concatSetting(setting, wrapSetting, instance.parent.id);
|
|
349
332
|
}
|
|
350
333
|
this.store.setSelectInstanceSettings(setting);
|
|
351
|
-
this.callSelectedEffect(
|
|
334
|
+
this.callSelectedEffect('');
|
|
352
335
|
// 选中触发scopeEffect
|
|
353
336
|
var payload = {
|
|
354
337
|
from: null,
|
|
@@ -362,14 +345,14 @@ var applyingPluginName = "";
|
|
|
362
345
|
{
|
|
363
346
|
key: "concatSetting",
|
|
364
347
|
value: function concatSetting(settings, otherSettings, settingFromId) {
|
|
365
|
-
var
|
|
366
|
-
var
|
|
367
|
-
var result = settings;
|
|
348
|
+
var ref, ref2, ref3, ref4;
|
|
349
|
+
var result1 = settings;
|
|
368
350
|
// tab
|
|
369
|
-
if (((
|
|
351
|
+
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') {
|
|
352
|
+
var _this = this;
|
|
370
353
|
var tabSettings = settings;
|
|
371
354
|
var otherTabSettings = otherSettings.slice(0);
|
|
372
|
-
|
|
355
|
+
result1 = tabSettings.map(function(tab, index) {
|
|
373
356
|
var result = new Tab(tab);
|
|
374
357
|
var otherTabIndex = otherTabSettings.findIndex(function(item) {
|
|
375
358
|
return item.title === tab.title;
|
|
@@ -379,24 +362,25 @@ var applyingPluginName = "";
|
|
|
379
362
|
}
|
|
380
363
|
var otherTab = otherTabSettings.splice(otherTabIndex, 1)[0];
|
|
381
364
|
if (otherTab) {
|
|
382
|
-
result.items =
|
|
365
|
+
result.items = _toConsumableArray(_this.formatGroupSetting(otherTab.items, settingFromId)).concat(_toConsumableArray(result.items));
|
|
383
366
|
}
|
|
384
367
|
return result;
|
|
385
368
|
});
|
|
386
369
|
if (otherTabSettings.length) {
|
|
387
|
-
|
|
388
|
-
|
|
370
|
+
var _this1 = this;
|
|
371
|
+
result1 = _toConsumableArray(result1).concat(_toConsumableArray(otherTabSettings.map(function(item) {
|
|
372
|
+
return _this1.formatGroupSetting(item, settingFromId);
|
|
389
373
|
})));
|
|
390
374
|
}
|
|
391
375
|
// group
|
|
392
|
-
} else if (((
|
|
376
|
+
} 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') {
|
|
393
377
|
var groupSettings = settings;
|
|
394
378
|
var otherGroupSettings = otherSettings;
|
|
395
|
-
|
|
379
|
+
result1 = _toConsumableArray(this.formatGroupSetting(otherGroupSettings, settingFromId)).concat(_toConsumableArray(groupSettings));
|
|
396
380
|
} else {
|
|
397
381
|
// 一个是tab,一个是group,暂时不支持
|
|
398
382
|
}
|
|
399
|
-
return
|
|
383
|
+
return result1;
|
|
400
384
|
}
|
|
401
385
|
},
|
|
402
386
|
{
|
|
@@ -421,8 +405,8 @@ var applyingPluginName = "";
|
|
|
421
405
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
422
406
|
args[_key] = arguments[_key];
|
|
423
407
|
}
|
|
424
|
-
var
|
|
425
|
-
return (
|
|
408
|
+
var _designer;
|
|
409
|
+
return (_designer = this.designer).registerControlConfig.apply(_designer, _toConsumableArray(args));
|
|
426
410
|
}
|
|
427
411
|
},
|
|
428
412
|
{
|
|
@@ -456,7 +440,7 @@ var applyingPluginName = "";
|
|
|
456
440
|
key: "setSelectedFieldItem",
|
|
457
441
|
value: function setSelectedFieldItem(fieldItem) {
|
|
458
442
|
this.store.setSelectedFieldItem(fieldItem);
|
|
459
|
-
this.callSelectedEffect(
|
|
443
|
+
this.callSelectedEffect('dataBind', {
|
|
460
444
|
fieldItem: fieldItem
|
|
461
445
|
});
|
|
462
446
|
}
|
|
@@ -475,7 +459,7 @@ var applyingPluginName = "";
|
|
|
475
459
|
key: "moveEnd",
|
|
476
460
|
value: function moveEnd() {
|
|
477
461
|
var instance = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.store.movingInstance;
|
|
478
|
-
var
|
|
462
|
+
var ref;
|
|
479
463
|
if (instance === null) return;
|
|
480
464
|
var _instance = this.getInstance(instance);
|
|
481
465
|
if (!_instance) return;
|
|
@@ -489,7 +473,7 @@ var applyingPluginName = "";
|
|
|
489
473
|
var newParent = _instance.parent;
|
|
490
474
|
// 移动之后清空movingInstance
|
|
491
475
|
this.store.setMovingInstance(null);
|
|
492
|
-
if (_instance.id !== ((
|
|
476
|
+
if (_instance.id !== ((ref = this.store.selected) === null || ref === void 0 ? void 0 : ref.id)) {
|
|
493
477
|
this.selectInstance(_instance);
|
|
494
478
|
} else {
|
|
495
479
|
this.store.setSelectInstance(_instance);
|
|
@@ -504,9 +488,9 @@ var applyingPluginName = "";
|
|
|
504
488
|
};
|
|
505
489
|
this.callSelectedScopeEffect(payload);
|
|
506
490
|
if (oldParent) {
|
|
507
|
-
this.emit(
|
|
491
|
+
this.emit('moved', _objectSpread({}, payload));
|
|
508
492
|
} else {
|
|
509
|
-
this.emit(
|
|
493
|
+
this.emit('joined', _objectSpread({}, payload));
|
|
510
494
|
}
|
|
511
495
|
}
|
|
512
496
|
},
|
|
@@ -523,7 +507,7 @@ var applyingPluginName = "";
|
|
|
523
507
|
// return instanceId
|
|
524
508
|
// }
|
|
525
509
|
// return this.store.instanceIdMap.get(instanceId)
|
|
526
|
-
if (typeof instanceId ===
|
|
510
|
+
if (typeof instanceId === 'string') {
|
|
527
511
|
return this.store.instanceIdMap.get(instanceId);
|
|
528
512
|
}
|
|
529
513
|
return instanceId;
|
|
@@ -560,19 +544,19 @@ var applyingPluginName = "";
|
|
|
560
544
|
{
|
|
561
545
|
key: "updateInstancePropValue",
|
|
562
546
|
value: function updateInstancePropValue(instance, propName, value, payload) {
|
|
563
|
-
var
|
|
547
|
+
var ref;
|
|
564
548
|
var result = updateValueFromKeys(instance.props, propName, value);
|
|
565
549
|
if (!result) {
|
|
566
550
|
return;
|
|
567
551
|
}
|
|
568
552
|
// 修改dataBind的时候要更新 fieldCodeMap
|
|
569
|
-
if (propName.startsWith(
|
|
553
|
+
if (propName.startsWith('dataBind')) {
|
|
570
554
|
this.store.updateDataFieldCodeMap(instance);
|
|
571
555
|
}
|
|
572
|
-
if (instance.id === ((
|
|
556
|
+
if (instance.id === ((ref = this.store.selected) === null || ref === void 0 ? void 0 : ref.id)) {
|
|
573
557
|
this.callSelectedEffect(propName, payload);
|
|
574
558
|
}
|
|
575
|
-
this.emit(
|
|
559
|
+
this.emit('updated', {
|
|
576
560
|
instance: instance,
|
|
577
561
|
propName: propName,
|
|
578
562
|
value: value
|
|
@@ -582,11 +566,11 @@ var applyingPluginName = "";
|
|
|
582
566
|
{
|
|
583
567
|
key: "updateInstanceProps",
|
|
584
568
|
value: function updateInstanceProps(instance, props, payload) {
|
|
585
|
-
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] :
|
|
569
|
+
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : '';
|
|
586
570
|
var _this = this;
|
|
587
571
|
Object.entries(props).forEach(function(param) {
|
|
588
|
-
var _param =
|
|
589
|
-
var propName = "".concat(prevKey ? prevKey +
|
|
572
|
+
var _param = _slicedToArray(param, 2), key = _param[0], value = _param[1];
|
|
573
|
+
var propName = "".concat(prevKey ? prevKey + '.' : '').concat(key);
|
|
590
574
|
if (isObject(value)) {
|
|
591
575
|
_this.updateInstanceProps(instance, value, payload, propName);
|
|
592
576
|
} else {
|
|
@@ -622,7 +606,7 @@ var applyingPluginName = "";
|
|
|
622
606
|
});
|
|
623
607
|
index > -1 && parentList.splice(index, 1);
|
|
624
608
|
this.store.getFlatInstances();
|
|
625
|
-
this.emit(
|
|
609
|
+
this.emit('removed', {
|
|
626
610
|
instance: instance,
|
|
627
611
|
index: index,
|
|
628
612
|
parent: parent
|
|
@@ -700,8 +684,8 @@ var applyingPluginName = "";
|
|
|
700
684
|
for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
|
|
701
685
|
arg[_key] = arguments[_key];
|
|
702
686
|
}
|
|
703
|
-
var
|
|
704
|
-
(
|
|
687
|
+
var _designer;
|
|
688
|
+
(_designer = this.designer).registerControl.apply(_designer, _toConsumableArray(arg));
|
|
705
689
|
return this;
|
|
706
690
|
}
|
|
707
691
|
},
|
|
@@ -747,7 +731,7 @@ var applyingPluginName = "";
|
|
|
747
731
|
var payload = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
748
732
|
var _this = this;
|
|
749
733
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
750
|
-
setting.callEffect(effectKey, _this,
|
|
734
|
+
setting.callEffect(effectKey, _this, _objectSpread({
|
|
751
735
|
control: _this.store.selected
|
|
752
736
|
}, payload));
|
|
753
737
|
});
|
|
@@ -759,7 +743,7 @@ var applyingPluginName = "";
|
|
|
759
743
|
var payload = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
760
744
|
var _this = this;
|
|
761
745
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
762
|
-
setting.callScopeEffect(_this,
|
|
746
|
+
setting.callScopeEffect(_this, _objectSpread({
|
|
763
747
|
control: _this.store.selected
|
|
764
748
|
}, payload));
|
|
765
749
|
});
|
|
@@ -774,7 +758,7 @@ var applyingPluginName = "";
|
|
|
774
758
|
arg[_key] = arguments[_key];
|
|
775
759
|
}
|
|
776
760
|
var _Designer;
|
|
777
|
-
(_Designer = Designer).register.apply(_Designer,
|
|
761
|
+
(_Designer = Designer).register.apply(_Designer, _toConsumableArray(arg));
|
|
778
762
|
return this;
|
|
779
763
|
}
|
|
780
764
|
},
|
|
@@ -787,7 +771,5 @@ var applyingPluginName = "";
|
|
|
787
771
|
]);
|
|
788
772
|
return Driven;
|
|
789
773
|
}(Watcher);
|
|
790
|
-
|
|
791
|
-
* 控件事件定义
|
|
792
|
-
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
774
|
+
Driven.EventLogic = EventLogic;
|
|
793
775
|
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 _classCallCheck(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
|
+
_classCallCheck(this, Plugin);
|
|
9
9
|
};
|
|
10
10
|
export { Plugin };
|