@byteluck-fe/model-driven-driven 2.7.0-alpha.30 → 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/dist/esm/Store.js CHANGED
@@ -1,15 +1,15 @@
1
- function _array_like_to_array(arr, len) {
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 _array_with_holes(arr) {
6
+ function _arrayWithHoles(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
- function _array_without_holes(arr) {
10
- if (Array.isArray(arr)) return _array_like_to_array(arr);
9
+ function _arrayWithoutHoles(arr) {
10
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
11
11
  }
12
- function _class_call_check(instance, Constructor) {
12
+ function _classCallCheck(instance, Constructor) {
13
13
  if (!(instance instanceof Constructor)) {
14
14
  throw new TypeError("Cannot call a class as a function");
15
15
  }
@@ -23,28 +23,15 @@ function _defineProperties(target, props) {
23
23
  Object.defineProperty(target, descriptor.key, descriptor);
24
24
  }
25
25
  }
26
- function _create_class(Constructor, protoProps, staticProps) {
26
+ function _createClass(Constructor, protoProps, staticProps) {
27
27
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
28
28
  if (staticProps) _defineProperties(Constructor, staticProps);
29
29
  return Constructor;
30
30
  }
31
- function _define_property(obj, key, value) {
32
- if (key in obj) {
33
- Object.defineProperty(obj, key, {
34
- value: value,
35
- enumerable: true,
36
- configurable: true,
37
- writable: true
38
- });
39
- } else {
40
- obj[key] = value;
41
- }
42
- return obj;
43
- }
44
- function _iterable_to_array(iter) {
31
+ function _iterableToArray(iter) {
45
32
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
46
33
  }
47
- function _iterable_to_array_limit(arr, i) {
34
+ function _iterableToArrayLimit(arr, i) {
48
35
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
49
36
  if (_i == null) return;
50
37
  var _arr = [];
@@ -68,87 +55,66 @@ function _iterable_to_array_limit(arr, i) {
68
55
  }
69
56
  return _arr;
70
57
  }
71
- function _non_iterable_rest() {
58
+ function _nonIterableRest() {
72
59
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
73
60
  }
74
- function _non_iterable_spread() {
61
+ function _nonIterableSpread() {
75
62
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
76
63
  }
77
- function _sliced_to_array(arr, i) {
78
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
64
+ function _slicedToArray(arr, i) {
65
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
79
66
  }
80
- function _to_consumable_array(arr) {
81
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
67
+ function _toConsumableArray(arr) {
68
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
82
69
  }
83
- function _unsupported_iterable_to_array(o, minLen) {
70
+ function _unsupportedIterableToArray(o, minLen) {
84
71
  if (!o) return;
85
- if (typeof o === "string") return _array_like_to_array(o, minLen);
72
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
86
73
  var n = Object.prototype.toString.call(o).slice(8, -1);
87
74
  if (n === "Object" && o.constructor) n = o.constructor.name;
88
75
  if (n === "Map" || n === "Set") return Array.from(n);
89
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
76
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
90
77
  }
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";
78
+ import { isDataBind } from '@byteluck-fe/model-driven-core';
79
+ import { hasChildrenControl, hasFooterControl, hasHeaderControl } from './designerUtils';
80
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
94
81
  // 维护当前selected,。。 selectedControlSetting
95
82
  export var Store = /*#__PURE__*/ function() {
96
83
  "use strict";
97
84
  function Store(options) {
98
- _class_call_check(this, Store);
99
- /**
100
- * 页面控件实例树
101
- * */ _define_property(this, "instance", void 0);
102
- /**
103
- * 拍平的控件数组
104
- * */ _define_property(this, "flatInstances", void 0);
105
- /**
106
- * 控件id组成的map
107
- * */ _define_property(this, "instanceIdMap", void 0);
108
- /**
109
- * dataCode和fieldCode组成的map
110
- * {
111
- * [主表dataCode]: {
112
- * [fieldCode]: 控件
113
- * },
114
- * [子表dataCode]: {
115
- * [fieldCode]: 控件
116
- * }
117
- * }
118
- * */ _define_property(this, "dataFieldCodeMap", void 0);
119
- /**
120
- * 当前选中的控件
121
- * */ _define_property(this, "selected", null);
122
- /**
123
- * 当前选中的数据作用域控件
124
- * */ _define_property(this, "selectedInstanceDataScopeParent", null);
125
- _define_property(this, "selectedDataScopeFlatInstances", []);
126
- /**
127
- * 当前选中控件的setting
128
- * */ _define_property(this, "selectedInstanceSetting", []);
129
- _define_property(this, "selectedInstanceSettingItems", []);
130
- /**
131
- * 当前选中控件的数据模型
132
- * */ _define_property(this, "selectedFieldItem", null);
133
- /**
134
- * 扩展字段,比如appId,dataCode等
135
- * */ _define_property(this, "external", {});
136
- _define_property(this, "movingInstance", null);
137
- _define_property(this, "movingInstanceOldParent", null);
138
- _define_property(this, "movingInstanceOldDataScopeParent", null);
139
- _define_property(this, "getParentBeforeInstanceMove", void 0);
140
- var _options_getParentBeforeInstanceMove;
141
- this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
85
+ _classCallCheck(this, Store);
86
+ /**
87
+ * 当前选中的控件
88
+ * */ this.selected = null;
89
+ /**
90
+ * 当前选中的数据作用域控件
91
+ * */ this.selectedInstanceDataScopeParent = null;
92
+ this.selectedDataScopeFlatInstances = [];
93
+ /**
94
+ * 当前选中控件的setting
95
+ * */ this.selectedInstanceSetting = [];
96
+ this.selectedInstanceSettingItems = [];
97
+ /**
98
+ * 当前选中控件的数据模型
99
+ * */ this.selectedFieldItem = null;
100
+ /**
101
+ * 扩展字段,比如appId,dataCode
102
+ * */ this.external = {};
103
+ this.movingInstance = null;
104
+ this.movingInstanceOldParent = null;
105
+ this.movingInstanceOldDataScopeParent = null;
106
+ var _getParentBeforeInstanceMove;
107
+ this.getParentBeforeInstanceMove = (_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _getParentBeforeInstanceMove !== void 0 ? _getParentBeforeInstanceMove : function(instance) {
142
108
  return instance.parent;
143
109
  };
144
110
  this.instance = options.instance;
145
111
  this.getFlatInstances();
146
112
  }
147
- _create_class(Store, [
113
+ _createClass(Store, [
148
114
  {
149
115
  key: "selectedRules",
150
- get: /**
151
- * 当前选中控件的rules
116
+ get: /**
117
+ * 当前选中控件的rules
152
118
  * */ function get() {
153
119
  if (!this.selected) {
154
120
  return null;
@@ -158,8 +124,8 @@ export var Store = /*#__PURE__*/ function() {
158
124
  },
159
125
  {
160
126
  key: "selectedAntdRules",
161
- get: /**
162
- * 当前选中控件的antd rules
127
+ get: /**
128
+ * 当前选中控件的antd rules
163
129
  * */ function get() {
164
130
  var rules = this.selectedRules;
165
131
  if (!rules) {
@@ -191,8 +157,8 @@ export var Store = /*#__PURE__*/ function() {
191
157
  this.selectedInstanceSetting = settings;
192
158
  this.selectedInstanceSettingItems = [];
193
159
  this.selectedInstanceSetting.forEach(function(group) {
194
- var _this_selectedInstanceSettingItems;
195
- (_this_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_this_selectedInstanceSettingItems, _to_consumable_array(_this.getSettingItems(group)));
160
+ var _selectedInstanceSettingItems;
161
+ (_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_selectedInstanceSettingItems, _toConsumableArray(_this.getSettingItems(group)));
196
162
  });
197
163
  }
198
164
  },
@@ -200,9 +166,9 @@ export var Store = /*#__PURE__*/ function() {
200
166
  key: "getSettingItems",
201
167
  value: function getSettingItems(group) {
202
168
  // return group instanceof Group
203
- return group.type === "group" ? group.items : group.items.reduce(function(result, curr) {
169
+ return group.type === 'group' ? group.items : group.items.reduce(function(result, curr) {
204
170
  var _result;
205
- (_result = result).push.apply(_result, _to_consumable_array(curr.items));
171
+ (_result = result).push.apply(_result, _toConsumableArray(curr.items));
206
172
  return result;
207
173
  }, []);
208
174
  }
@@ -235,7 +201,7 @@ export var Store = /*#__PURE__*/ function() {
235
201
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
236
202
  try {
237
203
  for(var _iterator = map.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
238
- var _step_value = _sliced_to_array(_step.value, 2), key = _step_value[0], value = _step_value[1];
204
+ var _value = _slicedToArray(_step.value, 2), key = _value[0], value = _value[1];
239
205
  if (value.id === instance.id) {
240
206
  map.delete(key);
241
207
  break;
@@ -313,9 +279,9 @@ export function loop(instances, callback) {
313
279
  loop(item.props.headers, callback);
314
280
  }
315
281
  if (hasFooterControl(item)) {
316
- var _item_props;
317
- var _item_props_footers;
318
- loop((_item_props_footers = (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.footers) !== null && _item_props_footers !== void 0 ? _item_props_footers : [], callback);
282
+ var ref;
283
+ var ref1;
284
+ loop((ref1 = (ref = item.props) === null || ref === void 0 ? void 0 : ref.footers) !== null && ref1 !== void 0 ? ref1 : [], callback);
319
285
  }
320
286
  });
321
287
  }
@@ -323,7 +289,7 @@ export function isDataScopeInstance(instance) {
323
289
  return [
324
290
  CONTROL_TYPE.SUBTABLE,
325
291
  CONTROL_TYPE.DATA_VIEW,
326
- CONTROL_TYPE.LIST_VIEW
292
+ CONTROL_TYPE.LIST_VIEW,
327
293
  ].includes(instance.type);
328
294
  }
329
295
  export function findInstanceDataScopeParent(instance) {
@@ -1,33 +1,33 @@
1
- import { CONTROL_TYPE, FieldTypes } from "@byteluck-fe/model-driven-shared";
1
+ import { CONTROL_TYPE, FieldTypes } from '@byteluck-fe/model-driven-shared';
2
2
  // 使用ObjectDataBind 的控件
3
3
  export var objectDataBindControlTypes = [
4
4
  CONTROL_TYPE.AMOUNT,
5
5
  CONTROL_TYPE.CALC,
6
- CONTROL_TYPE.DATE_RANGE
6
+ CONTROL_TYPE.DATE_RANGE,
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 "@byteluck-fe/model-driven-shared";
1
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, isArray } from '@byteluck-fe/model-driven-shared';
2
2
  export function hasChildrenControl(instance) {
3
- return "children" in instance && isArray(instance.children);
3
+ return 'children' in instance && isArray(instance.children);
4
4
  }
5
5
  export function hasHeaderControl(instance) {
6
- return "headers" in instance.props && isArray(instance.props.headers);
6
+ return 'headers' in instance.props && isArray(instance.props.headers);
7
7
  }
8
8
  export function hasFooterControl(instance) {
9
- return "footers" in instance.props && isArray(instance.props.footers);
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)) {
@@ -17,8 +17,9 @@ export function loopFormControl(control, callback) {
17
17
  // @ts-ignore
18
18
  loopFormControl(item.props.headers, callback);
19
19
  } else if (hasChildrenControl(item)) {
20
- loopFormControl(// @ts-ignore
21
- item === null || item === void 0 ? void 0 : item.children, callback);
20
+ var // @ts-ignore
21
+ ref;
22
+ loopFormControl((ref = (item)) === null || ref === void 0 ? void 0 : ref.children, callback);
22
23
  // @ts-ignore
23
24
  // } else if (item instanceof DesignerFormControl) {
24
25
  } else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import Designer from "./Designer";
1
+ import Designer from './Designer';
2
2
  export { Designer };
3
- export * from "./utils";
4
- export * from "./Builder";
5
- export * from "./designerUtils";
6
- export * from "./Driven";
7
- export * from "./Store";
3
+ export * from './utils';
4
+ export * from './Builder';
5
+ export * from './designerUtils';
6
+ export * from './Driven';
7
+ export * from './Store';