@byteluck-fe/model-driven-driven 2.21.0-beta.8 → 2.22.0-beta.2
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 +48 -34
- package/dist/esm/Designer.js +7 -7
- package/dist/esm/Driven.js +24 -24
- package/dist/esm/EventLogic.js +1 -1
- package/dist/esm/Store.js +4 -4
- 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 +21 -21
- package/dist/index.umd.js +1 -1
- package/package.json +6 -6
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
|
|
@@ -97,39 +97,53 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
97
97
|
listview.children.push(simpleSearch);
|
|
98
98
|
// @ts-ignore
|
|
99
99
|
listview.children.push(gridTable);
|
|
100
|
-
listview.props.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
listview.props.rowStyle = {
|
|
101
|
+
type: "rules",
|
|
102
|
+
"interval": {
|
|
103
|
+
"color": ""
|
|
104
|
+
},
|
|
105
|
+
rules: [
|
|
105
106
|
{
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
107
|
+
id: "default",
|
|
108
|
+
name: "审批通过单据",
|
|
109
|
+
color: "theme",
|
|
110
|
+
filters: [
|
|
111
|
+
{
|
|
112
|
+
ruleId: 1,
|
|
113
|
+
symbol: "op_equal",
|
|
114
|
+
leftVariableBo: {
|
|
115
|
+
type: "varchar",
|
|
116
|
+
value: "process_status",
|
|
117
|
+
name: "流程状态"
|
|
118
|
+
},
|
|
119
|
+
checked: false,
|
|
120
|
+
describe: "ruleLine",
|
|
121
|
+
type: "condition",
|
|
122
|
+
rightVariableBo: {
|
|
123
|
+
type: "custom",
|
|
124
|
+
value: [
|
|
125
|
+
"COMPLETE"
|
|
126
|
+
],
|
|
127
|
+
displayBos: []
|
|
128
|
+
},
|
|
129
|
+
isLowPerformance: false,
|
|
130
|
+
isMoreRelation: false
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
"settings": [
|
|
134
|
+
{
|
|
135
|
+
"color": "theme",
|
|
136
|
+
"type": "background",
|
|
137
|
+
"scope": "row",
|
|
138
|
+
"fieldCodes": [
|
|
139
|
+
"_row_"
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
script: "(SpecialMatch(data,sys,'process_status','varchar','op_equal','COMPLETE'))"
|
|
125
144
|
}
|
|
126
145
|
]
|
|
127
|
-
}
|
|
128
|
-
listview.props.rowStyleRulesScript.push({
|
|
129
|
-
id: 'default',
|
|
130
|
-
script: "(params.data['process_status']==='COMPLETE')",
|
|
131
|
-
color: 'theme'
|
|
132
|
-
});
|
|
146
|
+
};
|
|
133
147
|
return listview;
|
|
134
148
|
}
|
|
135
149
|
},
|
|
@@ -161,7 +175,7 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
161
175
|
// @ts-ignore
|
|
162
176
|
vueFormItem.props.isHideCaption = true;
|
|
163
177
|
// @ts-ignore
|
|
164
|
-
vueFormItem.props.controlExportName =
|
|
178
|
+
vueFormItem.props.controlExportName = "VuePage";
|
|
165
179
|
// @ts-ignore
|
|
166
180
|
grid.children.push(vueFormItem);
|
|
167
181
|
return grid;
|
package/dist/esm/Designer.js
CHANGED
|
@@ -252,10 +252,10 @@ function _ts_generator(thisArg, body) {
|
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
import { RegisterControls, controlHooksEmitter } from
|
|
256
|
-
import EventLogic from
|
|
257
|
-
import { FieldTypes } from
|
|
258
|
-
import { toSchema, getModelBindInfoList, checkSchema } from
|
|
255
|
+
import { RegisterControls, controlHooksEmitter } from "@byteluck-fe/model-driven-core";
|
|
256
|
+
import EventLogic from "./EventLogic";
|
|
257
|
+
import { FieldTypes } from "@byteluck-fe/model-driven-shared";
|
|
258
|
+
import { toSchema, getModelBindInfoList, checkSchema } from "./utils";
|
|
259
259
|
var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
260
260
|
"use strict";
|
|
261
261
|
_inherits(Designer, RegisterControls);
|
|
@@ -263,7 +263,7 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
|
263
263
|
function Designer() {
|
|
264
264
|
_class_call_check(this, Designer);
|
|
265
265
|
var _this;
|
|
266
|
-
_this = _super.call(this,
|
|
266
|
+
_this = _super.call(this, "Designer");
|
|
267
267
|
_define_property(_assert_this_initialized(_this), "toolbox", []);
|
|
268
268
|
_define_property(_assert_this_initialized(_this), "services", {});
|
|
269
269
|
_define_property(_assert_this_initialized(_this), "eventLogic", new EventLogic());
|
|
@@ -279,7 +279,7 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
|
279
279
|
{
|
|
280
280
|
key: "registerControl",
|
|
281
281
|
value: function registerControl(control) {
|
|
282
|
-
this.constructor.register(control,
|
|
282
|
+
this.constructor.register(control, "Designer");
|
|
283
283
|
var DesignerClass = control.Designer, Setting = control.Setting;
|
|
284
284
|
this.register(DesignerClass);
|
|
285
285
|
this.registeredControlTypes.add(DesignerClass.controlType);
|
|
@@ -322,7 +322,7 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
|
322
322
|
function getInitControl() {
|
|
323
323
|
// @ts-ignore
|
|
324
324
|
return [
|
|
325
|
-
this.createControlInstance(
|
|
325
|
+
this.createControlInstance("grid")
|
|
326
326
|
];
|
|
327
327
|
}
|
|
328
328
|
},
|
package/dist/esm/Driven.js
CHANGED
|
@@ -192,14 +192,14 @@ function _create_super(Derived) {
|
|
|
192
192
|
return _possible_constructor_return(this, result);
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
import { CONTROL_BASE_TYPE, error, genNonDuplicateId, isArray, isBuiltInControls, isObject, isString, updateValueFromKeys, warn, Watcher } from
|
|
196
|
-
import { findInstanceDataScopeParent, Store } from
|
|
197
|
-
import { Designer } from
|
|
198
|
-
import EventLogic from
|
|
199
|
-
import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from
|
|
200
|
-
import { Group, initSettings, Tab } from
|
|
195
|
+
import { CONTROL_BASE_TYPE, error, genNonDuplicateId, isArray, isBuiltInControls, isObject, isString, updateValueFromKeys, warn, Watcher } from "@byteluck-fe/model-driven-shared";
|
|
196
|
+
import { findInstanceDataScopeParent, Store } from "./Store";
|
|
197
|
+
import { Designer } from "./Designer";
|
|
198
|
+
import EventLogic from "./EventLogic";
|
|
199
|
+
import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from "./utils";
|
|
200
|
+
import { Group, initSettings, Tab } from "@byteluck-fe/model-driven-settings";
|
|
201
201
|
// 当前正在注册的插件名称
|
|
202
|
-
var applyingPluginName =
|
|
202
|
+
var applyingPluginName = "";
|
|
203
203
|
/**
|
|
204
204
|
* 设计器驱动
|
|
205
205
|
* */ var Driven = /*#__PURE__*/ function(Watcher) {
|
|
@@ -237,7 +237,7 @@ var applyingPluginName = '';
|
|
|
237
237
|
// TODO 拿到permission_controls
|
|
238
238
|
_define_property(_assert_this_initialized(_this), "generatePermissions", generatePermissions);
|
|
239
239
|
_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 ?
|
|
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
243
|
_this.store = new Store(_object_spread({
|
|
@@ -279,7 +279,7 @@ var applyingPluginName = '';
|
|
|
279
279
|
var _plugin_pluginName;
|
|
280
280
|
applyingPluginName = (_plugin_pluginName = plugin.pluginName) !== null && _plugin_pluginName !== void 0 ? _plugin_pluginName : plugin.constructor.name;
|
|
281
281
|
plugin.apply(_this);
|
|
282
|
-
applyingPluginName =
|
|
282
|
+
applyingPluginName = "";
|
|
283
283
|
} catch (e) {
|
|
284
284
|
error("".concat(applyingPluginName || plugin.constructor.name, " Plugin apply Error \n ").concat(e));
|
|
285
285
|
}
|
|
@@ -326,7 +326,7 @@ var applyingPluginName = '';
|
|
|
326
326
|
return;
|
|
327
327
|
}
|
|
328
328
|
this.setSelectedInstanceSetting();
|
|
329
|
-
this.emit(
|
|
329
|
+
this.emit("select", {
|
|
330
330
|
instance: instance
|
|
331
331
|
});
|
|
332
332
|
}
|
|
@@ -349,7 +349,7 @@ var applyingPluginName = '';
|
|
|
349
349
|
setting = this.concatSetting(setting, wrapSetting, instance.parent.id);
|
|
350
350
|
}
|
|
351
351
|
this.store.setSelectInstanceSettings(setting);
|
|
352
|
-
this.callSelectedEffect(
|
|
352
|
+
this.callSelectedEffect("");
|
|
353
353
|
// 选中触发scopeEffect
|
|
354
354
|
var payload = {
|
|
355
355
|
from: null,
|
|
@@ -367,7 +367,7 @@ var applyingPluginName = '';
|
|
|
367
367
|
var _settings_, _otherSettings_, _settings_1, _otherSettings_1, _settings_2, _otherSettings_2, _settings_3, _otherSettings_3;
|
|
368
368
|
var result = settings;
|
|
369
369
|
// tab
|
|
370
|
-
if (((_settings_ = settings[0]) === null || _settings_ === void 0 ? void 0 : _settings_.type) ===
|
|
370
|
+
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
371
|
var tabSettings = settings;
|
|
372
372
|
var otherTabSettings = otherSettings.slice(0);
|
|
373
373
|
result = tabSettings.map(function(tab, index) {
|
|
@@ -390,12 +390,12 @@ var applyingPluginName = '';
|
|
|
390
390
|
})));
|
|
391
391
|
}
|
|
392
392
|
// group
|
|
393
|
-
} else if (((_settings_1 = settings[0]) === null || _settings_1 === void 0 ? void 0 : _settings_1.type) ===
|
|
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
396
|
result = _to_consumable_array(this.formatGroupSetting(otherGroupSettings, settingFromId)).concat(_to_consumable_array(groupSettings));
|
|
397
397
|
// 当前控件setting是tab,合并控件setting是group
|
|
398
|
-
} else if (((_settings_2 = settings[0]) === null || _settings_2 === void 0 ? void 0 : _settings_2.type) ===
|
|
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;
|
|
400
400
|
var otherGroupSettings1 = otherSettings;
|
|
401
401
|
result = tabSettings1.map(function(tab, index) {
|
|
@@ -405,7 +405,7 @@ var applyingPluginName = '';
|
|
|
405
405
|
}
|
|
406
406
|
return result;
|
|
407
407
|
});
|
|
408
|
-
} else if (((_settings_3 = settings[0]) === null || _settings_3 === void 0 ? void 0 : _settings_3.type) ===
|
|
408
|
+
} 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
409
|
var groupSettings1 = settings;
|
|
410
410
|
var otherTabSettings1 = otherSettings;
|
|
411
411
|
result = otherTabSettings1.map(function(tab, index) {
|
|
@@ -476,7 +476,7 @@ var applyingPluginName = '';
|
|
|
476
476
|
key: "setSelectedFieldItem",
|
|
477
477
|
value: function setSelectedFieldItem(fieldItem) {
|
|
478
478
|
this.store.setSelectedFieldItem(fieldItem);
|
|
479
|
-
this.callSelectedEffect(
|
|
479
|
+
this.callSelectedEffect("dataBind", {
|
|
480
480
|
fieldItem: fieldItem
|
|
481
481
|
});
|
|
482
482
|
}
|
|
@@ -524,9 +524,9 @@ var applyingPluginName = '';
|
|
|
524
524
|
};
|
|
525
525
|
this.callSelectedScopeEffect(payload);
|
|
526
526
|
if (oldParent) {
|
|
527
|
-
this.emit(
|
|
527
|
+
this.emit("moved", _object_spread({}, payload));
|
|
528
528
|
} else {
|
|
529
|
-
this.emit(
|
|
529
|
+
this.emit("joined", _object_spread({}, payload));
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
532
|
},
|
|
@@ -543,7 +543,7 @@ var applyingPluginName = '';
|
|
|
543
543
|
// return instanceId
|
|
544
544
|
// }
|
|
545
545
|
// return this.store.instanceIdMap.get(instanceId)
|
|
546
|
-
if (typeof instanceId ===
|
|
546
|
+
if (typeof instanceId === "string") {
|
|
547
547
|
return this.store.instanceIdMap.get(instanceId);
|
|
548
548
|
}
|
|
549
549
|
return instanceId;
|
|
@@ -586,13 +586,13 @@ var applyingPluginName = '';
|
|
|
586
586
|
return;
|
|
587
587
|
}
|
|
588
588
|
// 修改dataBind的时候要更新 fieldCodeMap
|
|
589
|
-
if (propName.startsWith(
|
|
589
|
+
if (propName.startsWith("dataBind")) {
|
|
590
590
|
this.store.updateDataFieldCodeMap(instance);
|
|
591
591
|
}
|
|
592
592
|
if (instance.id === ((_this_store_selected = this.store.selected) === null || _this_store_selected === void 0 ? void 0 : _this_store_selected.id)) {
|
|
593
593
|
this.callSelectedEffect(propName, payload);
|
|
594
594
|
}
|
|
595
|
-
this.emit(
|
|
595
|
+
this.emit("updated", {
|
|
596
596
|
instance: instance,
|
|
597
597
|
propName: propName,
|
|
598
598
|
value: value
|
|
@@ -603,10 +603,10 @@ var applyingPluginName = '';
|
|
|
603
603
|
key: "updateInstanceProps",
|
|
604
604
|
value: function updateInstanceProps(instance, props, payload) {
|
|
605
605
|
var _this = this;
|
|
606
|
-
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] :
|
|
606
|
+
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "";
|
|
607
607
|
Object.entries(props).forEach(function(param) {
|
|
608
608
|
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
609
|
-
var propName = "".concat(prevKey ? prevKey +
|
|
609
|
+
var propName = "".concat(prevKey ? prevKey + "." : "").concat(key);
|
|
610
610
|
if (isObject(value)) {
|
|
611
611
|
_this.updateInstanceProps(instance, value, payload, propName);
|
|
612
612
|
} else {
|
|
@@ -642,7 +642,7 @@ var applyingPluginName = '';
|
|
|
642
642
|
});
|
|
643
643
|
index > -1 && parentList.splice(index, 1);
|
|
644
644
|
this.store.getFlatInstances();
|
|
645
|
-
this.emit(
|
|
645
|
+
this.emit("removed", {
|
|
646
646
|
instance: instance,
|
|
647
647
|
index: index,
|
|
648
648
|
parent: parent
|
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,9 +88,9 @@ 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";
|
|
@@ -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;
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONTROL_TYPE, FieldTypes } from
|
|
1
|
+
import { CONTROL_TYPE, FieldTypes } from "@byteluck-fe/model-driven-shared";
|
|
2
2
|
// 使用ObjectDataBind 的控件
|
|
3
3
|
export var objectDataBindControlTypes = [
|
|
4
4
|
CONTROL_TYPE.AMOUNT,
|
|
@@ -7,27 +7,27 @@ export var objectDataBindControlTypes = [
|
|
|
7
7
|
];
|
|
8
8
|
export var objectDataBindKeyToFieldType = {
|
|
9
9
|
amount: {
|
|
10
|
-
caption:
|
|
10
|
+
caption: "金额",
|
|
11
11
|
fieldType: FieldTypes.DECIMAL
|
|
12
12
|
},
|
|
13
13
|
currency: {
|
|
14
|
-
caption:
|
|
14
|
+
caption: "币种",
|
|
15
15
|
fieldType: FieldTypes.VARCHAR
|
|
16
16
|
},
|
|
17
17
|
result: {
|
|
18
|
-
caption:
|
|
18
|
+
caption: "结果",
|
|
19
19
|
fieldType: FieldTypes.DECIMAL
|
|
20
20
|
},
|
|
21
21
|
unit: {
|
|
22
|
-
caption:
|
|
22
|
+
caption: "单位",
|
|
23
23
|
fieldType: FieldTypes.VARCHAR
|
|
24
24
|
},
|
|
25
25
|
min: {
|
|
26
|
-
caption:
|
|
26
|
+
caption: "开始时间",
|
|
27
27
|
fieldType: FieldTypes.TIMESTAMP
|
|
28
28
|
},
|
|
29
29
|
max: {
|
|
30
|
-
caption:
|
|
30
|
+
caption: "结束时间",
|
|
31
31
|
fieldType: FieldTypes.TIMESTAMP
|
|
32
32
|
}
|
|
33
33
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE, isArray } from
|
|
1
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, isArray } from "@byteluck-fe/model-driven-shared";
|
|
2
2
|
export function hasChildrenControl(instance) {
|
|
3
|
-
return
|
|
3
|
+
return "children" in instance && isArray(instance.children);
|
|
4
4
|
}
|
|
5
5
|
export function hasHeaderControl(instance) {
|
|
6
|
-
return
|
|
6
|
+
return "headers" in instance.props && isArray(instance.props.headers);
|
|
7
7
|
}
|
|
8
8
|
export function hasFooterControl(instance) {
|
|
9
|
-
return
|
|
9
|
+
return "footers" in instance.props && isArray(instance.props.footers);
|
|
10
10
|
}
|
|
11
11
|
export function loopFormControl(control, callback) {
|
|
12
12
|
if (Array.isArray(control)) {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import Designer from
|
|
1
|
+
import Designer from "./Designer";
|
|
2
2
|
export { Designer };
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
3
|
+
export * from "./utils";
|
|
4
|
+
export * from "./Builder";
|
|
5
|
+
export * from "./designerUtils";
|
|
6
|
+
export * from "./Driven";
|
|
7
|
+
export * from "./Store";
|
package/dist/esm/utils.js
CHANGED
|
@@ -180,11 +180,11 @@ function _ts_generator(thisArg, body) {
|
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
import { loopFormControl } from
|
|
183
|
+
import { loopFormControl } from "./designerUtils";
|
|
184
184
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE, // FieldTypes,
|
|
185
185
|
// FieldTypeToColumnType,
|
|
186
|
-
isArray } from
|
|
187
|
-
import { objectDataBindControlTypes } from
|
|
186
|
+
isArray } from "@byteluck-fe/model-driven-shared";
|
|
187
|
+
import { objectDataBindControlTypes } from "./constants";
|
|
188
188
|
export function getMasterFormControls(controls) {
|
|
189
189
|
var formctls = [];
|
|
190
190
|
// @ts-ignore
|
|
@@ -200,7 +200,7 @@ export function getMasterFormControls(controls) {
|
|
|
200
200
|
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
201
201
|
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
202
202
|
* */ export function fillModelBindInfoListFieldCode(modelBindInfoList) {
|
|
203
|
-
var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] :
|
|
203
|
+
var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
204
204
|
if (!modelBindInfoList || !Array.isArray(modelBindInfoList)) return [];
|
|
205
205
|
return modelBindInfoList.map(function(item) {
|
|
206
206
|
if (!item.dataBind) return item;
|
|
@@ -211,7 +211,7 @@ export function getMasterFormControls(controls) {
|
|
|
211
211
|
Object.keys(objectDataBind).forEach(function(key) {
|
|
212
212
|
var dataBind = objectDataBind[key];
|
|
213
213
|
// 如果是ObjectDataBind的话,需要将id拼接当前的key作为元素的fieldCode
|
|
214
|
-
var fieldCode = item.controlId +
|
|
214
|
+
var fieldCode = item.controlId + "_" + key;
|
|
215
215
|
dataBind.fieldCode = fieldCodeBeforeAddPrefix(fieldCode);
|
|
216
216
|
dataBind.dataCode = dataCode;
|
|
217
217
|
});
|
|
@@ -223,7 +223,7 @@ export function getMasterFormControls(controls) {
|
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
function fieldCodeBeforeAddPrefix(fieldCode) {
|
|
226
|
-
var prefix =
|
|
226
|
+
var prefix = "field_";
|
|
227
227
|
if (fieldCode.startsWith(prefix)) {
|
|
228
228
|
return fieldCode;
|
|
229
229
|
}
|
|
@@ -321,16 +321,16 @@ var cannotEditControlTypes = [
|
|
|
321
321
|
// 列表操作列单独处理三个按钮的权限
|
|
322
322
|
var LIST_OPERATION_BUTTON_PERMISSIONS_MAPS = {
|
|
323
323
|
check: {
|
|
324
|
-
id:
|
|
325
|
-
caption:
|
|
324
|
+
id: "listPageCheckBtnId",
|
|
325
|
+
caption: "查看"
|
|
326
326
|
},
|
|
327
327
|
edit: {
|
|
328
|
-
id:
|
|
329
|
-
caption:
|
|
328
|
+
id: "listPageEditBtnId",
|
|
329
|
+
caption: "编辑"
|
|
330
330
|
},
|
|
331
331
|
delete: {
|
|
332
|
-
id:
|
|
333
|
-
caption:
|
|
332
|
+
id: "listPageDeleteBtnId",
|
|
333
|
+
caption: "删除"
|
|
334
334
|
}
|
|
335
335
|
};
|
|
336
336
|
// 生成权限字段
|
|
@@ -356,11 +356,11 @@ function generatePermissions(controls, parent) {
|
|
|
356
356
|
canEdit: !cannotEditControlTypes.includes(type),
|
|
357
357
|
canRead: true,
|
|
358
358
|
canHide: true,
|
|
359
|
-
group:
|
|
359
|
+
group: "element"
|
|
360
360
|
};
|
|
361
361
|
if (parent && parent.type === CONTROL_TYPE.SUBTABLE) {
|
|
362
362
|
// 如果有parent,则利用下划线拼接caption
|
|
363
|
-
permissionItem.caption = parent.caption +
|
|
363
|
+
permissionItem.caption = parent.caption + "_" + permissionItem.caption;
|
|
364
364
|
}
|
|
365
365
|
if (type === CONTROL_TYPE.VUE_FORM_ITEM) {
|
|
366
366
|
permissionItem.caption = controls.props.controlExportName || controls.name;
|
|
@@ -373,19 +373,19 @@ function generatePermissions(controls, parent) {
|
|
|
373
373
|
var //@ts-ignore
|
|
374
374
|
_controls_props_dataBind, _controls_props1, //@ts-ignore
|
|
375
375
|
_controls_props_dataBind1, _controls_props2;
|
|
376
|
-
if (((_controls_props1 = controls.props) === null || _controls_props1 === void 0 ? void 0 : (_controls_props_dataBind = _controls_props1.dataBind) === null || _controls_props_dataBind === void 0 ? void 0 : _controls_props_dataBind.fieldCode) !== undefined && ((_controls_props2 = controls.props) === null || _controls_props2 === void 0 ? void 0 : (_controls_props_dataBind1 = _controls_props2.dataBind) === null || _controls_props_dataBind1 === void 0 ? void 0 : _controls_props_dataBind1.fieldCode) !==
|
|
377
|
-
permissionItem.group =
|
|
376
|
+
if (((_controls_props1 = controls.props) === null || _controls_props1 === void 0 ? void 0 : (_controls_props_dataBind = _controls_props1.dataBind) === null || _controls_props_dataBind === void 0 ? void 0 : _controls_props_dataBind.fieldCode) !== undefined && ((_controls_props2 = controls.props) === null || _controls_props2 === void 0 ? void 0 : (_controls_props_dataBind1 = _controls_props2.dataBind) === null || _controls_props_dataBind1 === void 0 ? void 0 : _controls_props_dataBind1.fieldCode) !== "") {
|
|
377
|
+
permissionItem.group = "field";
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
result.push(permissionItem);
|
|
381
381
|
//追加vue容器权限
|
|
382
382
|
if (type === CONTROL_TYPE.VUE_FORM_ITEM) {
|
|
383
383
|
var _controls_props_dataBind2, _controls_props3, _controls_props_dataBind3, _controls_props4;
|
|
384
|
-
var vueFormItemGroup =
|
|
385
|
-
if (((_controls_props3 = controls.props) === null || _controls_props3 === void 0 ? void 0 : (_controls_props_dataBind2 = _controls_props3.dataBind) === null || _controls_props_dataBind2 === void 0 ? void 0 : _controls_props_dataBind2.fieldCode) !== undefined && ((_controls_props4 = controls.props) === null || _controls_props4 === void 0 ? void 0 : (_controls_props_dataBind3 = _controls_props4.dataBind) === null || _controls_props_dataBind3 === void 0 ? void 0 : _controls_props_dataBind3.fieldCode) !==
|
|
386
|
-
vueFormItemGroup =
|
|
384
|
+
var vueFormItemGroup = "element";
|
|
385
|
+
if (((_controls_props3 = controls.props) === null || _controls_props3 === void 0 ? void 0 : (_controls_props_dataBind2 = _controls_props3.dataBind) === null || _controls_props_dataBind2 === void 0 ? void 0 : _controls_props_dataBind2.fieldCode) !== undefined && ((_controls_props4 = controls.props) === null || _controls_props4 === void 0 ? void 0 : (_controls_props_dataBind3 = _controls_props4.dataBind) === null || _controls_props_dataBind3 === void 0 ? void 0 : _controls_props_dataBind3.fieldCode) !== "") {
|
|
386
|
+
vueFormItemGroup = "field";
|
|
387
387
|
}
|
|
388
|
-
var permissions = controls.props[
|
|
388
|
+
var permissions = controls.props["permissions"];
|
|
389
389
|
permissions === null || permissions === void 0 ? void 0 : permissions.map(function(item) {
|
|
390
390
|
var _controls_id;
|
|
391
391
|
permissionItem = {
|
|
@@ -419,7 +419,7 @@ function generatePermissions(controls, parent) {
|
|
|
419
419
|
canEdit: false,
|
|
420
420
|
canRead: false,
|
|
421
421
|
canHide: true,
|
|
422
|
-
group:
|
|
422
|
+
group: "element"
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
425
|
return result;
|