@byteluck-fe/model-driven-driven 2.9.0-alpha.9 → 2.9.1-beta.1
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 +17 -17
- package/dist/esm/Designer.js +19 -34
- package/dist/esm/Driven.js +65 -91
- package/dist/esm/EventLogic.js +1 -1
- package/dist/esm/Store.js +34 -34
- package/dist/esm/constants.js +7 -7
- package/dist/esm/designerUtils.js +4 -4
- package/dist/esm/index.js +6 -6
- package/dist/esm/utils.js +33 -32
- 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/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# Driven
|
|
2
|
-
设计态引擎
|
|
3
|
-
|
|
4
|
-
Builder.ts // 兼容旧版Designer,提供页面初始化
|
|
5
|
-
constants.ts // 常量
|
|
6
|
-
Designer.ts // 旧版designer的实现
|
|
7
|
-
designerUtils.ts // 工具函数
|
|
8
|
-
Driven.ts // 引擎
|
|
9
|
-
EventLogic.ts // 事件管理
|
|
10
|
-
index.ts
|
|
11
|
-
Plugin.ts // 插件
|
|
12
|
-
Store.ts // 仓库
|
|
13
|
-
utils.ts // 工具
|
|
1
|
+
# Driven
|
|
2
|
+
设计态引擎
|
|
3
|
+
|
|
4
|
+
Builder.ts // 兼容旧版Designer,提供页面初始化
|
|
5
|
+
constants.ts // 常量
|
|
6
|
+
Designer.ts // 旧版designer的实现
|
|
7
|
+
designerUtils.ts // 工具函数
|
|
8
|
+
Driven.ts // 引擎
|
|
9
|
+
EventLogic.ts // 事件管理
|
|
10
|
+
index.ts
|
|
11
|
+
Plugin.ts // 插件
|
|
12
|
+
Store.ts // 仓库
|
|
13
|
+
utils.ts // 工具
|
package/dist/esm/Builder.js
CHANGED
|
@@ -30,8 +30,8 @@ function _define_property(obj, key, value) {
|
|
|
30
30
|
}
|
|
31
31
|
return obj;
|
|
32
32
|
}
|
|
33
|
-
import Designer from
|
|
34
|
-
import { CONTROL_TYPE } from
|
|
33
|
+
import Designer from './Designer';
|
|
34
|
+
import { CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
35
35
|
export var Builder = /*#__PURE__*/ function() {
|
|
36
36
|
"use strict";
|
|
37
37
|
function Builder() {
|
|
@@ -79,7 +79,7 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
79
79
|
// @ts-ignore
|
|
80
80
|
var listview = this.designer.createControlInstance(// @ts-ignore
|
|
81
81
|
CONTROL_TYPE.LIST_VIEW);
|
|
82
|
-
listview.props.countType =
|
|
82
|
+
listview.props.countType = 'async';
|
|
83
83
|
var simpleSearch = this.designer.createControlInstance(// @ts-ignore
|
|
84
84
|
CONTROL_TYPE.SIMPLE_SEARCH);
|
|
85
85
|
var gridTable = this.designer.createControlInstance(// @ts-ignore
|
|
@@ -98,25 +98,25 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
98
98
|
// @ts-ignore
|
|
99
99
|
listview.children.push(gridTable);
|
|
100
100
|
listview.props.rowStyleRules.push({
|
|
101
|
-
id:
|
|
102
|
-
name:
|
|
103
|
-
color:
|
|
101
|
+
id: 'default',
|
|
102
|
+
name: '审批通过单据',
|
|
103
|
+
color: 'theme',
|
|
104
104
|
filters: [
|
|
105
105
|
{
|
|
106
106
|
ruleId: 1,
|
|
107
|
-
symbol:
|
|
107
|
+
symbol: 'op_equal',
|
|
108
108
|
leftVariableBo: {
|
|
109
|
-
type:
|
|
110
|
-
value:
|
|
111
|
-
name:
|
|
109
|
+
type: 'varchar',
|
|
110
|
+
value: 'process_status',
|
|
111
|
+
name: '流程状态'
|
|
112
112
|
},
|
|
113
113
|
checked: false,
|
|
114
|
-
describe:
|
|
115
|
-
type:
|
|
114
|
+
describe: 'ruleLine',
|
|
115
|
+
type: 'condition',
|
|
116
116
|
rightVariableBo: {
|
|
117
|
-
type:
|
|
117
|
+
type: 'custom',
|
|
118
118
|
value: [
|
|
119
|
-
|
|
119
|
+
'COMPLETE'
|
|
120
120
|
],
|
|
121
121
|
displayBos: []
|
|
122
122
|
},
|
|
@@ -126,9 +126,9 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
126
126
|
]
|
|
127
127
|
});
|
|
128
128
|
listview.props.rowStyleRulesScript.push({
|
|
129
|
-
id:
|
|
129
|
+
id: 'default',
|
|
130
130
|
script: "(params.data['process_status']==='COMPLETE')",
|
|
131
|
-
color:
|
|
131
|
+
color: 'theme'
|
|
132
132
|
});
|
|
133
133
|
return listview;
|
|
134
134
|
}
|
|
@@ -161,7 +161,7 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
161
161
|
// @ts-ignore
|
|
162
162
|
vueFormItem.props.isHideCaption = true;
|
|
163
163
|
// @ts-ignore
|
|
164
|
-
vueFormItem.props.controlExportName =
|
|
164
|
+
vueFormItem.props.controlExportName = 'VuePage';
|
|
165
165
|
// @ts-ignore
|
|
166
166
|
grid.children.push(vueFormItem);
|
|
167
167
|
return grid;
|
package/dist/esm/Designer.js
CHANGED
|
@@ -41,6 +41,10 @@ function _async_to_generator(fn) {
|
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
+
function _call_super(_this, derived, args) {
|
|
45
|
+
derived = _get_prototype_of(derived);
|
|
46
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
47
|
+
}
|
|
44
48
|
function _class_call_check(instance, Constructor) {
|
|
45
49
|
if (!(instance instanceof Constructor)) {
|
|
46
50
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -134,28 +138,12 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
134
138
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
135
139
|
}
|
|
136
140
|
function _is_native_reflect_construct() {
|
|
137
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
138
|
-
if (Reflect.construct.sham) return false;
|
|
139
|
-
if (typeof Proxy === "function") return true;
|
|
140
141
|
try {
|
|
141
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
function _create_super(Derived) {
|
|
148
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
149
|
-
return function _createSuperInternal() {
|
|
150
|
-
var Super = _get_prototype_of(Derived), result;
|
|
151
|
-
if (hasNativeReflectConstruct) {
|
|
152
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
153
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
154
|
-
} else {
|
|
155
|
-
result = Super.apply(this, arguments);
|
|
156
|
-
}
|
|
157
|
-
return _possible_constructor_return(this, result);
|
|
158
|
-
};
|
|
142
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
143
|
+
} catch (_) {}
|
|
144
|
+
return (_is_native_reflect_construct = function() {
|
|
145
|
+
return !!result;
|
|
146
|
+
})();
|
|
159
147
|
}
|
|
160
148
|
function _ts_generator(thisArg, body) {
|
|
161
149
|
var f, y, t, g, _ = {
|
|
@@ -252,23 +240,19 @@ function _ts_generator(thisArg, body) {
|
|
|
252
240
|
};
|
|
253
241
|
}
|
|
254
242
|
}
|
|
255
|
-
import { RegisterControls, controlHooksEmitter } from
|
|
256
|
-
import EventLogic from
|
|
257
|
-
import { FieldTypes } from
|
|
258
|
-
import { toSchema, getModelBindInfoList, checkSchema } from
|
|
243
|
+
import { RegisterControls, controlHooksEmitter } from '@byteluck-fe/model-driven-core';
|
|
244
|
+
import EventLogic from './EventLogic';
|
|
245
|
+
import { FieldTypes } from '@byteluck-fe/model-driven-shared';
|
|
246
|
+
import { toSchema, getModelBindInfoList, checkSchema } from './utils';
|
|
259
247
|
var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
260
248
|
"use strict";
|
|
261
249
|
_inherits(Designer, RegisterControls);
|
|
262
|
-
var _super = _create_super(Designer);
|
|
263
250
|
function Designer() {
|
|
264
251
|
_class_call_check(this, Designer);
|
|
265
252
|
var _this;
|
|
266
|
-
_this =
|
|
267
|
-
|
|
268
|
-
_define_property(
|
|
269
|
-
_define_property(_assert_this_initialized(_this), "eventLogic", new EventLogic());
|
|
270
|
-
_define_property(_assert_this_initialized(_this), "fieldTypes", FieldTypes);
|
|
271
|
-
_define_property(_assert_this_initialized(_this), "controlSettingMap", new Map());
|
|
253
|
+
_this = _call_super(this, Designer, [
|
|
254
|
+
'Designer'
|
|
255
|
+
]), _define_property(_this, "toolbox", []), _define_property(_this, "services", {}), _define_property(_this, "eventLogic", new EventLogic()), _define_property(_this, "fieldTypes", FieldTypes), _define_property(_this, "controlSettingMap", new Map());
|
|
272
256
|
(_instanceof(this, Designer) ? this.constructor : void 0).staticControls.forEach(function(control) {
|
|
273
257
|
var _$Designer = control.Designer, Setting = control.Setting;
|
|
274
258
|
_this.controlSettingMap.set(_$Designer.controlType, Setting);
|
|
@@ -279,7 +263,8 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
|
279
263
|
{
|
|
280
264
|
key: "registerControl",
|
|
281
265
|
value: function registerControl(control) {
|
|
282
|
-
|
|
266
|
+
;
|
|
267
|
+
this.constructor.register(control, 'Designer');
|
|
283
268
|
var DesignerClass = control.Designer, Setting = control.Setting;
|
|
284
269
|
this.register(DesignerClass);
|
|
285
270
|
this.registeredControlTypes.add(DesignerClass.controlType);
|
|
@@ -322,7 +307,7 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
|
322
307
|
function getInitControl() {
|
|
323
308
|
// @ts-ignore
|
|
324
309
|
return [
|
|
325
|
-
this.createControlInstance(
|
|
310
|
+
this.createControlInstance('grid')
|
|
326
311
|
];
|
|
327
312
|
}
|
|
328
313
|
},
|
package/dist/esm/Driven.js
CHANGED
|
@@ -15,6 +15,10 @@ function _assert_this_initialized(self) {
|
|
|
15
15
|
}
|
|
16
16
|
return self;
|
|
17
17
|
}
|
|
18
|
+
function _call_super(_this, derived, args) {
|
|
19
|
+
derived = _get_prototype_of(derived);
|
|
20
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
21
|
+
}
|
|
18
22
|
function _class_call_check(instance, Constructor) {
|
|
19
23
|
if (!(instance instanceof Constructor)) {
|
|
20
24
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -169,75 +173,45 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
169
173
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
170
174
|
}
|
|
171
175
|
function _is_native_reflect_construct() {
|
|
172
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
173
|
-
if (Reflect.construct.sham) return false;
|
|
174
|
-
if (typeof Proxy === "function") return true;
|
|
175
176
|
try {
|
|
176
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
function _create_super(Derived) {
|
|
183
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
184
|
-
return function _createSuperInternal() {
|
|
185
|
-
var Super = _get_prototype_of(Derived), result;
|
|
186
|
-
if (hasNativeReflectConstruct) {
|
|
187
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
188
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
189
|
-
} else {
|
|
190
|
-
result = Super.apply(this, arguments);
|
|
191
|
-
}
|
|
192
|
-
return _possible_constructor_return(this, result);
|
|
193
|
-
};
|
|
177
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
178
|
+
} catch (_) {}
|
|
179
|
+
return (_is_native_reflect_construct = function() {
|
|
180
|
+
return !!result;
|
|
181
|
+
})();
|
|
194
182
|
}
|
|
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
|
|
183
|
+
import { CONTROL_BASE_TYPE, error, genNonDuplicateId, isArray, isBuiltInControls, isObject, isString, updateValueFromKeys, warn, Watcher } from '@byteluck-fe/model-driven-shared';
|
|
184
|
+
import { findInstanceDataScopeParent, Store } from './Store';
|
|
185
|
+
import { Designer } from './Designer';
|
|
186
|
+
import EventLogic from './EventLogic';
|
|
187
|
+
import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from './utils';
|
|
188
|
+
import { Group, initSettings, Tab } from '@byteluck-fe/model-driven-settings';
|
|
201
189
|
// 当前正在注册的插件名称
|
|
202
|
-
var applyingPluginName =
|
|
203
|
-
/**
|
|
204
|
-
* 设计器驱动
|
|
190
|
+
var applyingPluginName = '';
|
|
191
|
+
/**
|
|
192
|
+
* 设计器驱动
|
|
205
193
|
* */ var Driven = /*#__PURE__*/ function(Watcher) {
|
|
206
194
|
"use strict";
|
|
207
195
|
_inherits(Driven, Watcher);
|
|
208
|
-
var _super = _create_super(Driven);
|
|
209
196
|
function Driven(options) {
|
|
210
197
|
_class_call_check(this, Driven);
|
|
211
198
|
var _this;
|
|
212
|
-
_this =
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
*
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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);
|
|
233
|
-
// TODO 拿到schema
|
|
234
|
-
_define_property(_assert_this_initialized(_this), "getSchema", toSchema);
|
|
235
|
-
// TODO 拿到model_bind_info_list
|
|
236
|
-
_define_property(_assert_this_initialized(_this), "getModelBindInfoList", getModelBindInfoList);
|
|
237
|
-
// TODO 拿到permission_controls
|
|
238
|
-
_define_property(_assert_this_initialized(_this), "generatePermissions", generatePermissions);
|
|
199
|
+
_this = _call_super(this, Driven), _define_property(_this, "mode", void 0), _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), /**
|
|
200
|
+
* 控件可选的事件
|
|
201
|
+
* */ _define_property(_this, "eventLogic", void 0), /**
|
|
202
|
+
* 处理数据存储,存放模型等
|
|
203
|
+
* */ _define_property(_this, "store", void 0), /**
|
|
204
|
+
* 额外参数存储
|
|
205
|
+
*/ _define_property(_this, "externalParams", void 0), /**
|
|
206
|
+
* 处理instance,和schema存储
|
|
207
|
+
* */ _define_property(_this, "designer", void 0), /**
|
|
208
|
+
* 插件数组
|
|
209
|
+
* */ _define_property(_this, "__plugins", void 0), _define_property(_this, "__pluginsApplied", false), _define_property(_this, "$options", void 0), // TODO 拿到schema
|
|
210
|
+
_define_property(_this, "getSchema", toSchema), // TODO 拿到model_bind_info_list
|
|
211
|
+
_define_property(_this, "getModelBindInfoList", getModelBindInfoList), // TODO 拿到permission_controls
|
|
212
|
+
_define_property(_this, "generatePermissions", generatePermissions);
|
|
239
213
|
_this.$options = Object.freeze(options);
|
|
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 ?
|
|
214
|
+
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
215
|
_this.eventLogic = new EventLogic();
|
|
242
216
|
_this.designer = new DesignerClass();
|
|
243
217
|
_this.store = new Store(_object_spread({
|
|
@@ -279,7 +253,7 @@ var applyingPluginName = "";
|
|
|
279
253
|
var _plugin_pluginName;
|
|
280
254
|
applyingPluginName = (_plugin_pluginName = plugin.pluginName) !== null && _plugin_pluginName !== void 0 ? _plugin_pluginName : plugin.constructor.name;
|
|
281
255
|
plugin.apply(_this);
|
|
282
|
-
applyingPluginName =
|
|
256
|
+
applyingPluginName = '';
|
|
283
257
|
} catch (e) {
|
|
284
258
|
error("".concat(applyingPluginName || plugin.constructor.name, " Plugin apply Error \n ").concat(e));
|
|
285
259
|
}
|
|
@@ -326,7 +300,7 @@ var applyingPluginName = "";
|
|
|
326
300
|
return;
|
|
327
301
|
}
|
|
328
302
|
this.setSelectedInstanceSetting();
|
|
329
|
-
this.emit(
|
|
303
|
+
this.emit('select', {
|
|
330
304
|
instance: instance
|
|
331
305
|
});
|
|
332
306
|
}
|
|
@@ -349,7 +323,7 @@ var applyingPluginName = "";
|
|
|
349
323
|
setting = this.concatSetting(setting, wrapSetting, instance.parent.id);
|
|
350
324
|
}
|
|
351
325
|
this.store.setSelectInstanceSettings(setting);
|
|
352
|
-
this.callSelectedEffect(
|
|
326
|
+
this.callSelectedEffect('');
|
|
353
327
|
// 选中触发scopeEffect
|
|
354
328
|
var payload = {
|
|
355
329
|
from: null,
|
|
@@ -367,7 +341,7 @@ var applyingPluginName = "";
|
|
|
367
341
|
var _settings_, _otherSettings_, _settings_1, _otherSettings_1, _settings_2, _otherSettings_2, _settings_3, _otherSettings_3;
|
|
368
342
|
var result = settings;
|
|
369
343
|
// tab
|
|
370
|
-
if (((_settings_ = settings[0]) === null || _settings_ === void 0 ? void 0 : _settings_.type) ===
|
|
344
|
+
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') {
|
|
371
345
|
var tabSettings = settings;
|
|
372
346
|
var otherTabSettings = otherSettings.slice(0);
|
|
373
347
|
result = tabSettings.map(function(tab, index) {
|
|
@@ -390,12 +364,12 @@ var applyingPluginName = "";
|
|
|
390
364
|
})));
|
|
391
365
|
}
|
|
392
366
|
// group
|
|
393
|
-
} else if (((_settings_1 = settings[0]) === null || _settings_1 === void 0 ? void 0 : _settings_1.type) ===
|
|
367
|
+
} 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
368
|
var groupSettings = settings;
|
|
395
369
|
var otherGroupSettings = otherSettings;
|
|
396
370
|
result = _to_consumable_array(this.formatGroupSetting(otherGroupSettings, settingFromId)).concat(_to_consumable_array(groupSettings));
|
|
397
371
|
// 当前控件setting是tab,合并控件setting是group
|
|
398
|
-
} else if (((_settings_2 = settings[0]) === null || _settings_2 === void 0 ? void 0 : _settings_2.type) ===
|
|
372
|
+
} 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
373
|
var tabSettings1 = settings;
|
|
400
374
|
var otherGroupSettings1 = otherSettings;
|
|
401
375
|
result = tabSettings1.map(function(tab, index) {
|
|
@@ -405,7 +379,7 @@ var applyingPluginName = "";
|
|
|
405
379
|
}
|
|
406
380
|
return result;
|
|
407
381
|
});
|
|
408
|
-
} else if (((_settings_3 = settings[0]) === null || _settings_3 === void 0 ? void 0 : _settings_3.type) ===
|
|
382
|
+
} else if (((_settings_3 = settings[0]) === null || _settings_3 === void 0 ? void 0 : _settings_3.type) === 'group' && ((_otherSettings_3 = otherSettings[0]) === null || _otherSettings_3 === void 0 ? void 0 : _otherSettings_3.type) === 'tab') {
|
|
409
383
|
var groupSettings1 = settings;
|
|
410
384
|
var otherTabSettings1 = otherSettings;
|
|
411
385
|
result = otherTabSettings1.map(function(tab, index) {
|
|
@@ -476,7 +450,7 @@ var applyingPluginName = "";
|
|
|
476
450
|
key: "setSelectedFieldItem",
|
|
477
451
|
value: function setSelectedFieldItem(fieldItem) {
|
|
478
452
|
this.store.setSelectedFieldItem(fieldItem);
|
|
479
|
-
this.callSelectedEffect(
|
|
453
|
+
this.callSelectedEffect('dataBind', {
|
|
480
454
|
fieldItem: fieldItem
|
|
481
455
|
});
|
|
482
456
|
}
|
|
@@ -499,10 +473,10 @@ var applyingPluginName = "";
|
|
|
499
473
|
if (instance === null) return;
|
|
500
474
|
var _instance = this.getInstance(instance);
|
|
501
475
|
if (!_instance) return;
|
|
502
|
-
/*
|
|
503
|
-
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
504
|
-
事件是否区分move和add
|
|
505
|
-
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
476
|
+
/*
|
|
477
|
+
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
478
|
+
事件是否区分move和add
|
|
479
|
+
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
506
480
|
*/ var oldDataScopeParent = this.store.movingInstanceOldDataScopeParent;
|
|
507
481
|
var newDataScopeParent = findInstanceDataScopeParent(_instance);
|
|
508
482
|
var oldParent = this.store.movingInstanceOldParent;
|
|
@@ -524,9 +498,9 @@ var applyingPluginName = "";
|
|
|
524
498
|
};
|
|
525
499
|
this.callSelectedScopeEffect(payload);
|
|
526
500
|
if (oldParent) {
|
|
527
|
-
this.emit(
|
|
501
|
+
this.emit('moved', _object_spread({}, payload));
|
|
528
502
|
} else {
|
|
529
|
-
this.emit(
|
|
503
|
+
this.emit('joined', _object_spread({}, payload));
|
|
530
504
|
}
|
|
531
505
|
}
|
|
532
506
|
},
|
|
@@ -543,7 +517,7 @@ var applyingPluginName = "";
|
|
|
543
517
|
// return instanceId
|
|
544
518
|
// }
|
|
545
519
|
// return this.store.instanceIdMap.get(instanceId)
|
|
546
|
-
if (typeof instanceId ===
|
|
520
|
+
if (typeof instanceId === 'string') {
|
|
547
521
|
return this.store.instanceIdMap.get(instanceId);
|
|
548
522
|
}
|
|
549
523
|
return instanceId;
|
|
@@ -586,13 +560,13 @@ var applyingPluginName = "";
|
|
|
586
560
|
return;
|
|
587
561
|
}
|
|
588
562
|
// 修改dataBind的时候要更新 fieldCodeMap
|
|
589
|
-
if (propName.startsWith(
|
|
563
|
+
if (propName.startsWith('dataBind')) {
|
|
590
564
|
this.store.updateDataFieldCodeMap(instance);
|
|
591
565
|
}
|
|
592
566
|
if (instance.id === ((_this_store_selected = this.store.selected) === null || _this_store_selected === void 0 ? void 0 : _this_store_selected.id)) {
|
|
593
567
|
this.callSelectedEffect(propName, payload);
|
|
594
568
|
}
|
|
595
|
-
this.emit(
|
|
569
|
+
this.emit('updated', {
|
|
596
570
|
instance: instance,
|
|
597
571
|
propName: propName,
|
|
598
572
|
value: value
|
|
@@ -602,11 +576,11 @@ var applyingPluginName = "";
|
|
|
602
576
|
{
|
|
603
577
|
key: "updateInstanceProps",
|
|
604
578
|
value: function updateInstanceProps(instance, props, payload) {
|
|
605
|
-
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "";
|
|
606
579
|
var _this = this;
|
|
580
|
+
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : '';
|
|
607
581
|
Object.entries(props).forEach(function(param) {
|
|
608
582
|
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
609
|
-
var propName = "".concat(prevKey ? prevKey +
|
|
583
|
+
var propName = "".concat(prevKey ? prevKey + '.' : '').concat(key);
|
|
610
584
|
if (isObject(value)) {
|
|
611
585
|
_this.updateInstanceProps(instance, value, payload, propName);
|
|
612
586
|
} else {
|
|
@@ -627,8 +601,8 @@ var applyingPluginName = "";
|
|
|
627
601
|
},
|
|
628
602
|
{
|
|
629
603
|
key: "removeInstance",
|
|
630
|
-
value: /**
|
|
631
|
-
* 删除控件
|
|
604
|
+
value: /**
|
|
605
|
+
* 删除控件
|
|
632
606
|
* */ function removeInstance(instance) {
|
|
633
607
|
// 删除实例,并触发事件 removed
|
|
634
608
|
var parent = instance.parent;
|
|
@@ -642,7 +616,7 @@ var applyingPluginName = "";
|
|
|
642
616
|
});
|
|
643
617
|
index > -1 && parentList.splice(index, 1);
|
|
644
618
|
this.store.getFlatInstances();
|
|
645
|
-
this.emit(
|
|
619
|
+
this.emit('removed', {
|
|
646
620
|
instance: instance,
|
|
647
621
|
index: index,
|
|
648
622
|
parent: parent
|
|
@@ -667,8 +641,8 @@ var applyingPluginName = "";
|
|
|
667
641
|
},
|
|
668
642
|
{
|
|
669
643
|
key: "updateInstanceType",
|
|
670
|
-
value: /**
|
|
671
|
-
* 修改控件类型
|
|
644
|
+
value: /**
|
|
645
|
+
* 修改控件类型
|
|
672
646
|
* */ function updateInstanceType(instance, type) {
|
|
673
647
|
var schema = instance.toSchema();
|
|
674
648
|
var newInstance = this.createInstance(type, {
|
|
@@ -726,16 +700,16 @@ var applyingPluginName = "";
|
|
|
726
700
|
},
|
|
727
701
|
{
|
|
728
702
|
key: "assertInstance",
|
|
729
|
-
value: /**
|
|
730
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
703
|
+
value: /**
|
|
704
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
731
705
|
* */ function assertInstance(instance, types) {
|
|
732
706
|
return isString(types) ? instance.type === types : types.includes(instance.type);
|
|
733
707
|
}
|
|
734
708
|
},
|
|
735
709
|
{
|
|
736
710
|
key: "getInstanceInListControl",
|
|
737
|
-
value: /**
|
|
738
|
-
* 控件在列表控件内,如明细子表或列表控件
|
|
711
|
+
value: /**
|
|
712
|
+
* 控件在列表控件内,如明细子表或列表控件
|
|
739
713
|
* */ function getInstanceInListControl(instance) {
|
|
740
714
|
var _instance = instance;
|
|
741
715
|
while(_instance){
|
|
@@ -763,8 +737,8 @@ var applyingPluginName = "";
|
|
|
763
737
|
{
|
|
764
738
|
key: "callSelectedEffect",
|
|
765
739
|
value: function callSelectedEffect(effectKey) {
|
|
766
|
-
var payload = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
767
740
|
var _this = this;
|
|
741
|
+
var payload = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
768
742
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
769
743
|
setting.callEffect(effectKey, _this, _object_spread({
|
|
770
744
|
control: _this.store.selected
|
|
@@ -775,8 +749,8 @@ var applyingPluginName = "";
|
|
|
775
749
|
{
|
|
776
750
|
key: "callSelectedScopeEffect",
|
|
777
751
|
value: function callSelectedScopeEffect() {
|
|
778
|
-
var payload = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
779
752
|
var _this = this;
|
|
753
|
+
var payload = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
780
754
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
781
755
|
setting.callScopeEffect(_this, _object_spread({
|
|
782
756
|
control: _this.store.selected
|
|
@@ -806,7 +780,7 @@ var applyingPluginName = "";
|
|
|
806
780
|
]);
|
|
807
781
|
return Driven;
|
|
808
782
|
}(Watcher);
|
|
809
|
-
/**
|
|
810
|
-
* 控件事件定义
|
|
783
|
+
/**
|
|
784
|
+
* 控件事件定义
|
|
811
785
|
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
812
786
|
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/Store.js
CHANGED
|
@@ -88,50 +88,50 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
88
88
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
89
89
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
90
90
|
}
|
|
91
|
-
import { isDataBind } from
|
|
92
|
-
import { hasChildrenControl, hasFooterControl, hasHeaderControl } from
|
|
93
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from
|
|
91
|
+
import { isDataBind } from '@byteluck-fe/model-driven-core';
|
|
92
|
+
import { hasChildrenControl, hasFooterControl, hasHeaderControl } from './designerUtils';
|
|
93
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
94
94
|
// 维护当前selected,。。 selectedControlSetting
|
|
95
95
|
export var Store = /*#__PURE__*/ function() {
|
|
96
96
|
"use strict";
|
|
97
97
|
function Store(options) {
|
|
98
98
|
_class_call_check(this, Store);
|
|
99
|
-
/**
|
|
100
|
-
* 页面控件实例树
|
|
99
|
+
/**
|
|
100
|
+
* 页面控件实例树
|
|
101
101
|
* */ _define_property(this, "instance", void 0);
|
|
102
|
-
/**
|
|
103
|
-
* 拍平的控件数组
|
|
102
|
+
/**
|
|
103
|
+
* 拍平的控件数组
|
|
104
104
|
* */ _define_property(this, "flatInstances", void 0);
|
|
105
|
-
/**
|
|
106
|
-
* 控件id组成的map
|
|
105
|
+
/**
|
|
106
|
+
* 控件id组成的map
|
|
107
107
|
* */ _define_property(this, "instanceIdMap", void 0);
|
|
108
|
-
/**
|
|
109
|
-
* dataCode和fieldCode组成的map
|
|
110
|
-
* {
|
|
111
|
-
* [主表dataCode]: {
|
|
112
|
-
* [fieldCode]: 控件
|
|
113
|
-
* },
|
|
114
|
-
* [子表dataCode]: {
|
|
115
|
-
* [fieldCode]: 控件
|
|
116
|
-
* }
|
|
117
|
-
* }
|
|
108
|
+
/**
|
|
109
|
+
* dataCode和fieldCode组成的map
|
|
110
|
+
* {
|
|
111
|
+
* [主表dataCode]: {
|
|
112
|
+
* [fieldCode]: 控件
|
|
113
|
+
* },
|
|
114
|
+
* [子表dataCode]: {
|
|
115
|
+
* [fieldCode]: 控件
|
|
116
|
+
* }
|
|
117
|
+
* }
|
|
118
118
|
* */ _define_property(this, "dataFieldCodeMap", void 0);
|
|
119
|
-
/**
|
|
120
|
-
* 当前选中的控件
|
|
119
|
+
/**
|
|
120
|
+
* 当前选中的控件
|
|
121
121
|
* */ _define_property(this, "selected", null);
|
|
122
|
-
/**
|
|
123
|
-
* 当前选中的数据作用域控件
|
|
122
|
+
/**
|
|
123
|
+
* 当前选中的数据作用域控件
|
|
124
124
|
* */ _define_property(this, "selectedInstanceDataScopeParent", null);
|
|
125
125
|
_define_property(this, "selectedDataScopeFlatInstances", []);
|
|
126
|
-
/**
|
|
127
|
-
* 当前选中控件的setting
|
|
126
|
+
/**
|
|
127
|
+
* 当前选中控件的setting
|
|
128
128
|
* */ _define_property(this, "selectedInstanceSetting", []);
|
|
129
129
|
_define_property(this, "selectedInstanceSettingItems", []);
|
|
130
|
-
/**
|
|
131
|
-
* 当前选中控件的数据模型
|
|
130
|
+
/**
|
|
131
|
+
* 当前选中控件的数据模型
|
|
132
132
|
* */ _define_property(this, "selectedFieldItem", null);
|
|
133
|
-
/**
|
|
134
|
-
* 扩展字段,比如appId,dataCode等
|
|
133
|
+
/**
|
|
134
|
+
* 扩展字段,比如appId,dataCode等
|
|
135
135
|
* */ _define_property(this, "external", {});
|
|
136
136
|
_define_property(this, "movingInstance", null);
|
|
137
137
|
_define_property(this, "movingInstanceOldParent", null);
|
|
@@ -147,8 +147,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
147
147
|
_create_class(Store, [
|
|
148
148
|
{
|
|
149
149
|
key: "selectedRules",
|
|
150
|
-
get: /**
|
|
151
|
-
* 当前选中控件的rules
|
|
150
|
+
get: /**
|
|
151
|
+
* 当前选中控件的rules
|
|
152
152
|
* */ function get() {
|
|
153
153
|
if (!this.selected) {
|
|
154
154
|
return null;
|
|
@@ -158,8 +158,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
key: "selectedAntdRules",
|
|
161
|
-
get: /**
|
|
162
|
-
* 当前选中控件的antd rules
|
|
161
|
+
get: /**
|
|
162
|
+
* 当前选中控件的antd rules
|
|
163
163
|
* */ function get() {
|
|
164
164
|
var rules = this.selectedRules;
|
|
165
165
|
if (!rules) {
|
|
@@ -200,7 +200,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
200
200
|
key: "getSettingItems",
|
|
201
201
|
value: function getSettingItems(group) {
|
|
202
202
|
// return group instanceof Group
|
|
203
|
-
return group.type ===
|
|
203
|
+
return group.type === 'group' ? group.items : group.items.reduce(function(result, curr) {
|
|
204
204
|
var _result;
|
|
205
205
|
(_result = result).push.apply(_result, _to_consumable_array(curr.items));
|
|
206
206
|
return result;
|