@byteluck-fe/model-driven-driven 2.7.0-alpha.31 → 2.7.0-alpha.31b
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/README.md +13 -13
- package/dist/esm/Builder.js +9 -22
- package/dist/esm/Designer.js +73 -177
- package/dist/esm/Driven.js +131 -148
- package/dist/esm/EventLogic.js +1 -1
- package/dist/esm/Plugin.js +2 -2
- package/dist/esm/Store.js +57 -91
- package/dist/esm/constants.js +8 -8
- package/dist/esm/designerUtils.js +7 -6
- package/dist/esm/index.js +6 -6
- package/dist/esm/utils.js +98 -199
- package/dist/index.umd.js +3 -3
- package/dist/types/Builder.d.ts +8 -8
- package/dist/types/Designer.d.ts +36 -36
- package/dist/types/Driven.d.ts +112 -112
- package/dist/types/EventLogic.d.ts +2 -2
- package/dist/types/Plugin.d.ts +6 -6
- package/dist/types/Store.d.ts +82 -82
- package/dist/types/constants.d.ts +6 -6
- package/dist/types/designerUtils.d.ts +5 -5
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +55 -55
- 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
|
-
/**
|
|
204
|
-
* 设计器驱动
|
|
205
|
-
* */
|
|
202
|
+
var applyingPluginName = '';
|
|
203
|
+
var Driven = /**
|
|
204
|
+
* 设计器驱动
|
|
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;
|
|
@@ -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;
|
|
@@ -380,43 +363,46 @@ var applyingPluginName = "";
|
|
|
380
363
|
}
|
|
381
364
|
var otherTab = otherTabSettings.splice(otherTabIndex, 1)[0];
|
|
382
365
|
if (otherTab) {
|
|
383
|
-
result.items =
|
|
366
|
+
result.items = _toConsumableArray(_this.formatGroupSetting(otherTab.items, settingFromId)).concat(_toConsumableArray(result.items));
|
|
384
367
|
}
|
|
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 =
|
|
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 =
|
|
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,21 +481,21 @@ 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;
|
|
502
|
-
/*
|
|
503
|
-
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
504
|
-
事件是否区分move和add
|
|
505
|
-
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
488
|
+
/*
|
|
489
|
+
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
490
|
+
事件是否区分move和add
|
|
491
|
+
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
506
492
|
*/ var oldDataScopeParent = this.store.movingInstanceOldDataScopeParent;
|
|
507
493
|
var newDataScopeParent = findInstanceDataScopeParent(_instance);
|
|
508
494
|
var oldParent = this.store.movingInstanceOldParent;
|
|
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
|
-
var _param =
|
|
609
|
-
var propName = "".concat(prevKey ? prevKey +
|
|
594
|
+
var _param = _slicedToArray(param, 2), key = _param[0], value = _param[1];
|
|
595
|
+
var propName = "".concat(prevKey ? prevKey + '.' : '').concat(key);
|
|
610
596
|
if (isObject(value)) {
|
|
611
597
|
_this.updateInstanceProps(instance, value, payload, propName);
|
|
612
598
|
} else {
|
|
@@ -627,8 +613,8 @@ var applyingPluginName = "";
|
|
|
627
613
|
},
|
|
628
614
|
{
|
|
629
615
|
key: "removeInstance",
|
|
630
|
-
value: /**
|
|
631
|
-
* 删除控件
|
|
616
|
+
value: /**
|
|
617
|
+
* 删除控件
|
|
632
618
|
* */ function removeInstance(instance) {
|
|
633
619
|
// 删除实例,并触发事件 removed
|
|
634
620
|
var parent = instance.parent;
|
|
@@ -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
|
|
@@ -667,8 +653,8 @@ var applyingPluginName = "";
|
|
|
667
653
|
},
|
|
668
654
|
{
|
|
669
655
|
key: "updateInstanceType",
|
|
670
|
-
value: /**
|
|
671
|
-
* 修改控件类型
|
|
656
|
+
value: /**
|
|
657
|
+
* 修改控件类型
|
|
672
658
|
* */ function updateInstanceType(instance, type) {
|
|
673
659
|
var schema = instance.toSchema();
|
|
674
660
|
var newInstance = this.createInstance(type, {
|
|
@@ -720,23 +706,22 @@ 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
|
-
|
|
724
|
-
(_this_designer = this.designer).registerControl.apply(_this_designer, _to_consumable_array(arg));
|
|
709
|
+
this.designer.registerControl(arg[0]);
|
|
725
710
|
return this;
|
|
726
711
|
}
|
|
727
712
|
},
|
|
728
713
|
{
|
|
729
714
|
key: "assertInstance",
|
|
730
|
-
value: /**
|
|
731
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
715
|
+
value: /**
|
|
716
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
732
717
|
* */ function assertInstance(instance, types) {
|
|
733
718
|
return isString(types) ? instance.type === types : types.includes(instance.type);
|
|
734
719
|
}
|
|
735
720
|
},
|
|
736
721
|
{
|
|
737
722
|
key: "getInstanceInListControl",
|
|
738
|
-
value: /**
|
|
739
|
-
* 控件在列表控件内,如明细子表或列表控件
|
|
723
|
+
value: /**
|
|
724
|
+
* 控件在列表控件内,如明细子表或列表控件
|
|
740
725
|
* */ function getInstanceInListControl(instance) {
|
|
741
726
|
var _instance = instance;
|
|
742
727
|
while(_instance){
|
|
@@ -767,7 +752,7 @@ var applyingPluginName = "";
|
|
|
767
752
|
var payload = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
768
753
|
var _this = this;
|
|
769
754
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
770
|
-
setting.callEffect(effectKey, _this,
|
|
755
|
+
setting.callEffect(effectKey, _this, _objectSpread({
|
|
771
756
|
control: _this.store.selected
|
|
772
757
|
}, payload));
|
|
773
758
|
});
|
|
@@ -779,7 +764,7 @@ var applyingPluginName = "";
|
|
|
779
764
|
var payload = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
780
765
|
var _this = this;
|
|
781
766
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
782
|
-
setting.callScopeEffect(_this,
|
|
767
|
+
setting.callScopeEffect(_this, _objectSpread({
|
|
783
768
|
control: _this.store.selected
|
|
784
769
|
}, payload));
|
|
785
770
|
});
|
|
@@ -794,7 +779,7 @@ var applyingPluginName = "";
|
|
|
794
779
|
arg[_key] = arguments[_key];
|
|
795
780
|
}
|
|
796
781
|
var _Designer;
|
|
797
|
-
(_Designer = Designer).register.apply(_Designer,
|
|
782
|
+
(_Designer = Designer).register.apply(_Designer, _toConsumableArray(arg));
|
|
798
783
|
return this;
|
|
799
784
|
}
|
|
800
785
|
},
|
|
@@ -807,7 +792,5 @@ var applyingPluginName = "";
|
|
|
807
792
|
]);
|
|
808
793
|
return Driven;
|
|
809
794
|
}(Watcher);
|
|
810
|
-
|
|
811
|
-
* 控件事件定义
|
|
812
|
-
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
795
|
+
Driven.EventLogic = EventLogic;
|
|
813
796
|
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 };
|