@byteluck-fe/model-driven-upgrade 2.7.0-alpha.9 → 2.7.0-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.
@@ -1,18 +1,18 @@
1
- function _arrayLikeToArray(arr, len) {
1
+ function _array_like_to_array(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 _arrayWithHoles(arr) {
6
+ function _array_with_holes(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
- function _arrayWithoutHoles(arr) {
10
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
9
+ function _array_without_holes(arr) {
10
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
11
11
  }
12
- function _iterableToArray(iter) {
12
+ function _iterable_to_array(iter) {
13
13
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
14
14
  }
15
- function _iterableToArrayLimit(arr, i) {
15
+ function _iterable_to_array_limit(arr, i) {
16
16
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
17
17
  if (_i == null) return;
18
18
  var _arr = [];
@@ -36,35 +36,36 @@ function _iterableToArrayLimit(arr, i) {
36
36
  }
37
37
  return _arr;
38
38
  }
39
- function _nonIterableRest() {
39
+ function _non_iterable_rest() {
40
40
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
41
41
  }
42
- function _nonIterableSpread() {
42
+ function _non_iterable_spread() {
43
43
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44
44
  }
45
- function _slicedToArray(arr, i) {
46
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
45
+ function _sliced_to_array(arr, i) {
46
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
47
47
  }
48
- function _toConsumableArray(arr) {
49
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
48
+ function _to_consumable_array(arr) {
49
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
50
50
  }
51
- function _unsupportedIterableToArray(o, minLen) {
51
+ function _unsupported_iterable_to_array(o, minLen) {
52
52
  if (!o) return;
53
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
53
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
54
54
  var n = Object.prototype.toString.call(o).slice(8, -1);
55
55
  if (n === "Object" && o.constructor) n = o.constructor.name;
56
56
  if (n === "Map" || n === "Set") return Array.from(n);
57
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
57
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
58
58
  }
59
- import { loop, toNumberOrEmpty, isLanguageObject, camelizeKeys, decamelizeKeys, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
60
- import { DataSourceBind } from '@byteluck-fe/model-driven-core';
61
- import { Col, SubTableColumn, ListView, DataView } from '@byteluck-fe/model-driven-controls';
59
+ import { loop, toNumberOrEmpty, isLanguageObject, camelizeKeys, decamelizeKeys, CONTROL_TYPE } from "@byteluck-fe/model-driven-shared";
60
+ import { DataSourceBind } from "@byteluck-fe/model-driven-core";
61
+ import { Col, SubTableColumn, ListView, DataView } from "@byteluck-fe/model-driven-controls";
62
62
  var dataCleaner = function(schemaItems, payload) {
63
+ var _payload;
63
64
  var isArray = Array.isArray(schemaItems);
64
65
  var schemaArray = isArray ? schemaItems : [
65
66
  schemaItems
66
67
  ];
67
- conversionPageEvents(payload === null || payload === void 0 ? void 0 : payload.events);
68
+ conversionPageEvents((_payload = payload) === null || _payload === void 0 ? void 0 : _payload.events);
68
69
  conversionGroupPanel(schemaArray);
69
70
  conversionLayoutControl(schemaArray);
70
71
  var dataView = conversionDataViewPage(schemaArray);
@@ -80,122 +81,122 @@ var baseControlKeys = [
80
81
  CONTROL_TYPE.TITLE,
81
82
  CONTROL_TYPE.LINK,
82
83
  CONTROL_TYPE.BUTTON,
83
- 'list-btn-export-list',
84
- 'list-btn-export-record',
84
+ "list-btn-export-list",
85
+ "list-btn-export-record"
85
86
  ];
86
87
  var listControlKeys = [
87
- 'subtable',
88
- 'grid-table'
88
+ "subtable",
89
+ "grid-table"
89
90
  ];
90
91
  var searchViewControlKeys = [
91
- 'simple-search'
92
+ "simple-search"
92
93
  ];
93
- function conversion(item1, payload) {
94
- var ref, ref1, ref2;
95
- var new_item = item1;
94
+ function conversion(item, payload) {
95
+ var _item_props, _item, _item_props1, _item1, _item_props2, _item2, _payload;
96
+ var new_item = item;
96
97
  if (!new_item.controlType) {
97
98
  if (new_item.is_layout_control === true) {
98
- new_item.controlType = 'layout';
99
+ new_item.controlType = "layout";
99
100
  } else if (baseControlKeys.includes(new_item.type)) {
100
- new_item.controlType = 'base';
101
+ new_item.controlType = "base";
101
102
  } else {
102
- new_item.controlType = 'form';
103
+ new_item.controlType = "form";
103
104
  }
104
105
  // 放在这个位置,而不是else if是因为原来的subtable是一个form控件
105
106
  if (listControlKeys.includes(new_item.type)) {
106
- new_item.controlType = 'list';
107
+ new_item.controlType = "list";
107
108
  }
108
109
  if (searchViewControlKeys.includes(new_item.type)) {
109
- new_item.controlType = 'search-view';
110
+ new_item.controlType = "search-view";
110
111
  }
111
112
  }
112
113
  delete new_item.is_layout_control;
113
- if (item1.props.lable_position) {
114
- item1.props.labelPosition = item1.props.lable_position;
114
+ if (item.props.lable_position) {
115
+ item.props.labelPosition = item.props.lable_position;
115
116
  }
116
117
  // 排列方式
117
- if (item1.props.select_mode) {
118
- item1.props.optionsFormat = item1.props.select_mode;
118
+ if (item.props.select_mode) {
119
+ item.props.optionsFormat = item.props.select_mode;
119
120
  }
120
121
  // 默认值
121
- if (item1.props.value) {
122
- item1.props.defaultValue = item1.props.value;
122
+ if (item.props.value) {
123
+ item.props.defaultValue = item.props.value;
123
124
  }
124
125
  //caption/placeholder/placeholder_end 的 zh 属性将被保留,国际化资源都丢弃,放到外部
125
- if (isLanguageObject(item1 === null || item1 === void 0 ? void 0 : (ref = item1.props) === null || ref === void 0 ? void 0 : ref.caption)) {
126
- new_item.props.caption = item1.props.caption.zh;
126
+ if (isLanguageObject((_item = item) === null || _item === void 0 ? void 0 : (_item_props = _item.props) === null || _item_props === void 0 ? void 0 : _item_props.caption)) {
127
+ new_item.props.caption = item.props.caption.zh;
127
128
  }
128
- if (isLanguageObject(item1 === null || item1 === void 0 ? void 0 : (ref1 = item1.props) === null || ref1 === void 0 ? void 0 : ref1.placeholder)) {
129
- new_item.props.placeholder = item1.props.placeholder.zh;
129
+ if (isLanguageObject((_item1 = item) === null || _item1 === void 0 ? void 0 : (_item_props1 = _item1.props) === null || _item_props1 === void 0 ? void 0 : _item_props1.placeholder)) {
130
+ new_item.props.placeholder = item.props.placeholder.zh;
130
131
  }
131
- if (isLanguageObject(item1 === null || item1 === void 0 ? void 0 : (ref2 = item1.props) === null || ref2 === void 0 ? void 0 : ref2.placeholder_end)) {
132
- new_item.props.placeholder_end = item1.props.placeholder_end.zh;
132
+ if (isLanguageObject((_item2 = item) === null || _item2 === void 0 ? void 0 : (_item_props2 = _item2.props) === null || _item_props2 === void 0 ? void 0 : _item_props2.placeholder_end)) {
133
+ new_item.props.placeholder_end = item.props.placeholder_end.zh;
133
134
  }
134
135
  // 部门组件
135
- if (item1.type === 'department-search') {
136
- new_item.type = 'department';
137
- if (item1.props.value.length) {
138
- new_item.props.default_value = item1.props.value;
136
+ if (item.type === "department-search") {
137
+ new_item.type = "department";
138
+ if (item.props.value.length) {
139
+ new_item.props.default_value = item.props.value;
139
140
  }
140
- new_item.props.showType = item1.props.show_tree ? 'tree' : 'default';
141
- new_item.props.rangeOptions = item1.props.department_list;
141
+ new_item.props.showType = item.props.show_tree ? "tree" : "default";
142
+ new_item.props.rangeOptions = item.props.department_list;
142
143
  }
143
- if (item1.type === 'automatic-number') {
144
- new_item.type = 'auto-number';
145
- new_item.props.defaultValue = item1.props.value;
144
+ if (item.type === "automatic-number") {
145
+ new_item.type = "auto-number";
146
+ new_item.props.defaultValue = item.props.value;
146
147
  }
147
148
  // 附件类型转换
148
- if (item1.type === 'file') {
149
- var ref3;
150
- new_item.type = 'attachment';
151
- new_item.props.attachmentAccept = (ref3 = item1.attachment_format) === null || ref3 === void 0 ? void 0 : ref3.split(',');
152
- new_item.props.showType = item1.props.show_type === 'title' ? 'default' : 'table';
149
+ if (item.type === "file") {
150
+ var _item_attachment_format;
151
+ new_item.type = "attachment";
152
+ new_item.props.attachmentAccept = (_item_attachment_format = item.attachment_format) === null || _item_attachment_format === void 0 ? void 0 : _item_attachment_format.split(",");
153
+ new_item.props.showType = item.props.show_type === "title" ? "default" : "table";
153
154
  }
154
- if (item1.type === 'image') {
155
- var ref4;
156
- new_item.props.attachmentAccept = (ref4 = item1.attachment_format) === null || ref4 === void 0 ? void 0 : ref4.split(',');
155
+ if (item.type === "image") {
156
+ var _item_attachment_format1;
157
+ new_item.props.attachmentAccept = (_item_attachment_format1 = item.attachment_format) === null || _item_attachment_format1 === void 0 ? void 0 : _item_attachment_format1.split(",");
157
158
  }
158
159
  // 日期选择转换
159
- if (item1.type === 'date-pick') {
160
- new_item.type = 'date-picker';
160
+ if (item.type === "date-pick") {
161
+ new_item.type = "date-picker";
161
162
  }
162
- if (item1.type === 'rich-text') {
163
- if (isLanguageObject(item1.props.value)) {
164
- new_item.props.defaultValue = item1.props.value.zh;
163
+ if (item.type === "rich-text") {
164
+ if (isLanguageObject(item.props.value)) {
165
+ new_item.props.defaultValue = item.props.value.zh;
165
166
  } else {
166
- new_item.props.defaultValue = item1.props.value;
167
+ new_item.props.defaultValue = item.props.value;
167
168
  }
168
169
  }
169
170
  if ([
170
- 'link',
171
- 'text',
172
- 'button'
173
- ].includes(item1.type)) {
174
- if (isLanguageObject(item1.props.value)) {
175
- new_item.props.content = item1.props.value.zh;
171
+ "link",
172
+ "text",
173
+ "button"
174
+ ].includes(item.type)) {
175
+ if (isLanguageObject(item.props.value)) {
176
+ new_item.props.content = item.props.value.zh;
176
177
  } else {
177
- new_item.props.content = item1.props.value;
178
+ new_item.props.content = item.props.value;
178
179
  }
179
180
  }
180
- if (item1.type === 'text') {
181
- if (item1.props.showState === 'iconText') {
182
- new_item.props.showState = 'image';
181
+ if (item.type === "text") {
182
+ if (item.props.showState === "iconText") {
183
+ new_item.props.showState = "image";
183
184
  }
184
185
  }
185
- if (item1.type === 'user-search') {
186
- new_item.type = 'employee';
187
- new_item.props.defaultValue = item1.props.value;
186
+ if (item.type === "user-search") {
187
+ new_item.type = "employee";
188
+ new_item.props.defaultValue = item.props.value;
188
189
  }
189
- if (item1.type === 'address') {
190
- new_item.props.addressType = item1.props.address_type_value;
190
+ if (item.type === "address") {
191
+ new_item.props.addressType = item.props.address_type_value;
191
192
  }
192
193
  //明细子表去掉 subtable-row,保留 subtable-column
193
- if (new_item.type === 'subtable') {
194
- var ref5;
194
+ if (new_item.type === "subtable") {
195
+ var _new_item_children_;
195
196
  // 转换打开方式
196
197
  var entryType = new_item.props.entry_type || new_item.props.entryType;
197
- new_item.props.openType = entryType === 'subpage' ? 'modal' : 'default';
198
- if (((ref5 = new_item.children[0]) === null || ref5 === void 0 ? void 0 : ref5.type) === 'subtable-row') {
198
+ new_item.props.openType = entryType === "subpage" ? "modal" : "default";
199
+ if (((_new_item_children_ = new_item.children[0]) === null || _new_item_children_ === void 0 ? void 0 : _new_item_children_.type) === "subtable-row") {
199
200
  if (new_item.props.headers) {
200
201
  new_item.props.headers = new_item.props.headers.map(function(item, index) {
201
202
  var subtableColumn = new SubTableColumn.Designer();
@@ -203,7 +204,7 @@ function conversion(item1, payload) {
203
204
  // item.header_width_config === '1' ? 'auto' : 'px'
204
205
  // subtableColumn.props.width =
205
206
  // item.header_width === '' ? 200 : Number(item.header_width)
206
- subtableColumn.props.caption = isLanguageObject(item.field_name) ? item.field_name['zh'] : item.field_name;
207
+ subtableColumn.props.caption = isLanguageObject(item.field_name) ? item.field_name["zh"] : item.field_name;
207
208
  var schema = subtableColumn.toSchema();
208
209
  schema.id = item.header_id;
209
210
  var child = new_item.children[0].children[index].children[0];
@@ -216,25 +217,25 @@ function conversion(item1, payload) {
216
217
  }
217
218
  }
218
219
  }
219
- if (new_item.type === 'subtable-cell') {
220
- new_item.type = 'subtable-column';
220
+ if (new_item.type === "subtable-cell") {
221
+ new_item.type = "subtable-column";
221
222
  }
222
223
  var optionsControl = [
223
- 'radio',
224
- 'checkbox',
225
- 'select',
226
- 'select-multiple'
224
+ "radio",
225
+ "checkbox",
226
+ "select",
227
+ "select-multiple"
227
228
  ];
228
229
  //radio / checkbox 中 options text 的 zh 属性保留 国际化资源丢弃
229
- if (optionsControl.includes(item1.type)) {
230
- item1.props.options.map(function(option) {
230
+ if (optionsControl.includes(item.type)) {
231
+ item.props.options.map(function(option) {
231
232
  option.label = isLanguageObject(option.text) ? option.text.zh : option.text;
232
233
  option.id = option.id || option.opt_id || option.optId || option.data_id;
233
234
  });
234
- new_item = item1;
235
+ new_item = item;
235
236
  }
236
237
  // grid-row 更改type,并且添加col控件
237
- if (item1.type === 'grid-row') {
238
+ if (item.type === "grid-row") {
238
239
  var span = 24 / new_item.children.length;
239
240
  new_item.children = new_item.children.map(function(child) {
240
241
  var newCol = new Col.Designer();
@@ -245,23 +246,24 @@ function conversion(item1, payload) {
245
246
  });
246
247
  }
247
248
  // grid-layout-row 更改type
248
- if (item1.type === 'grid-layout-row') {
249
- new_item.type = 'row';
249
+ if (item.type === "grid-layout-row") {
250
+ new_item.type = "row";
250
251
  }
251
- if (item1.type === 'grid-layout-col') {
252
- new_item.type = 'col';
252
+ if (item.type === "grid-layout-col") {
253
+ new_item.type = "col";
253
254
  }
254
- if (item1.type === 'group-panel') {
255
- new_item.type = 'card-group';
256
- new_item.props.collapse = new_item.props.flod === 'no' ? 'none' : new_item.props.flod;
255
+ if (item.type === "group-panel") {
256
+ new_item.type = "card-group";
257
+ new_item.props.collapse = new_item.props.flod === "no" ? "none" : new_item.props.flod;
257
258
  }
258
259
  // tabs-pane => tab-pane
259
- if (item1.type === 'tabs-pane') {
260
- new_item.type = 'tab-pane';
260
+ if (item.type === "tabs-pane") {
261
+ new_item.type = "tab-pane";
261
262
  }
262
- if (item1.type === 'calc') {
263
- var calcValue = new_item === null || new_item === void 0 ? void 0 : new_item.children[0];
264
- var calcUnit = new_item === null || new_item === void 0 ? void 0 : new_item.children[1];
263
+ if (item.type === "calc") {
264
+ var _new_item, _new_item1;
265
+ var calcValue = (_new_item = new_item) === null || _new_item === void 0 ? void 0 : _new_item.children[0];
266
+ var calcUnit = (_new_item1 = new_item) === null || _new_item1 === void 0 ? void 0 : _new_item1.children[1];
265
267
  var newDataBind = {};
266
268
  if (calcValue) {
267
269
  conversionDisplayBoListAndBehaviors(new_item, payload);
@@ -283,11 +285,12 @@ function conversion(item1, payload) {
283
285
  new_item.props.dataBind = newDataBind;
284
286
  delete new_item.children;
285
287
  }
286
- if (item1.type === 'amount-currency') {
287
- new_item.type = 'amount';
288
- new_item.controlType = 'form';
289
- var amount = new_item === null || new_item === void 0 ? void 0 : new_item.children[0];
290
- var currency = new_item === null || new_item === void 0 ? void 0 : new_item.children[1];
288
+ if (item.type === "amount-currency") {
289
+ var _new_item2, _new_item3;
290
+ new_item.type = "amount";
291
+ new_item.controlType = "form";
292
+ var amount = (_new_item2 = new_item) === null || _new_item2 === void 0 ? void 0 : _new_item2.children[0];
293
+ var currency = (_new_item3 = new_item) === null || _new_item3 === void 0 ? void 0 : _new_item3.children[1];
291
294
  var newDataBind1 = {};
292
295
  var defaultValue = {};
293
296
  // new_item.
@@ -320,12 +323,13 @@ function conversion(item1, payload) {
320
323
  new_item.props.defaultValue = defaultValue;
321
324
  delete new_item.children;
322
325
  }
323
- if (item1.type === 'date-range') {
324
- new_item.controlType = 'form';
325
- var min = new_item === null || new_item === void 0 ? void 0 : new_item.children[0];
326
- var max = new_item === null || new_item === void 0 ? void 0 : new_item.children[1];
327
- new_item.props.placeholderStart = isLanguageObject(item1.props.placeholder) ? item1.props.placeholder.zh : item1.props.placeholder;
328
- new_item.props.caption = isLanguageObject(item1.props.caption) ? item1.props.caption.zh : item1.props.caption;
326
+ if (item.type === "date-range") {
327
+ var _new_item4, _new_item5;
328
+ new_item.controlType = "form";
329
+ var min = (_new_item4 = new_item) === null || _new_item4 === void 0 ? void 0 : _new_item4.children[0];
330
+ var max = (_new_item5 = new_item) === null || _new_item5 === void 0 ? void 0 : _new_item5.children[1];
331
+ new_item.props.placeholderStart = isLanguageObject(item.props.placeholder) ? item.props.placeholder.zh : item.props.placeholder;
332
+ new_item.props.caption = isLanguageObject(item.props.caption) ? item.props.caption.zh : item.props.caption;
329
333
  var newDataBind2 = {};
330
334
  if (min) {
331
335
  newDataBind2.min = min.props.data_bind;
@@ -336,34 +340,34 @@ function conversion(item1, payload) {
336
340
  new_item.props.dataBind = newDataBind2;
337
341
  delete new_item.children;
338
342
  }
339
- if (item1.type === 'score') {
343
+ if (item.type === "score") {
340
344
  new_item.props.defaultValue = new_item.props.value * 1;
341
345
  }
342
346
  if ([
343
- 'input',
344
- 'textarea'
345
- ].includes(item1.type)) {
346
- new_item.props.defaultValue = isLanguageObject(item1.props.value) ? item1.props.value.zh : item1.props.value;
347
+ "input",
348
+ "textarea"
349
+ ].includes(item.type)) {
350
+ new_item.props.defaultValue = isLanguageObject(item.props.value) ? item.props.value.zh : item.props.value;
347
351
  }
348
- if (item1.type === 'number') {
349
- new_item.props.range_min = toNumberOrEmpty(item1.props.range_min);
350
- new_item.props.range_max = toNumberOrEmpty(item1.props.range_max);
351
- new_item.props.defaultValue = toNumberOrEmpty(item1.props.value);
352
+ if (item.type === "number") {
353
+ new_item.props.range_min = toNumberOrEmpty(item.props.range_min);
354
+ new_item.props.range_max = toNumberOrEmpty(item.props.range_max);
355
+ new_item.props.defaultValue = toNumberOrEmpty(item.props.value);
352
356
  }
353
- if (item1.type === 'list-page-btn-custom-button') {
354
- item1.type = 'button';
357
+ if (item.type === "list-page-btn-custom-button") {
358
+ item.type = "button";
355
359
  }
356
- if (item1.type === 'button') {
357
- if (item1.props.button_type === 'dashed') {
358
- new_item.props.buttonType = 'default';
360
+ if (item.type === "button") {
361
+ if (item.props.button_type === "dashed") {
362
+ new_item.props.buttonType = "default";
359
363
  }
360
364
  }
361
- conversionControlEvents(new_item, payload === null || payload === void 0 ? void 0 : payload.control_events);
365
+ conversionControlEvents(new_item, (_payload = payload) === null || _payload === void 0 ? void 0 : _payload.control_events);
362
366
  return new_item;
363
367
  }
364
368
  function conversionDisplayBoListAndBehaviors(control, payload) {
365
369
  if (!payload) return;
366
- var _displayBoList = payload.displayBoList, displayBoList = _displayBoList === void 0 ? [] : _displayBoList, _behaviors = payload.behaviors, behaviors = _behaviors === void 0 ? [] : _behaviors;
370
+ var _payload_displayBoList = payload.displayBoList, displayBoList = _payload_displayBoList === void 0 ? [] : _payload_displayBoList, _payload_behaviors = payload.behaviors, behaviors = _payload_behaviors === void 0 ? [] : _payload_behaviors;
367
371
  var controlId = control.id;
368
372
  var newId = control.children[0].id;
369
373
  displayBoList.forEach(function(item) {
@@ -394,7 +398,7 @@ function conversionDataViewPage(controlArray) {
394
398
  return controlArray;
395
399
  }
396
400
  var grid = controlArray.find(function(item) {
397
- return item.type === 'grid';
401
+ return item.type === "grid";
398
402
  });
399
403
  if (!grid) {
400
404
  return controlArray;
@@ -419,13 +423,13 @@ function conversionLayoutControl(schemArray) {
419
423
  if (!(item && item.children)) return;
420
424
  var controlArray = item.children;
421
425
  for(var i = 0; i < controlArray.length; i++){
422
- var ref, ref6;
426
+ var _controlArray_i_children, _controlArray_i;
423
427
  var control = controlArray[i];
424
- var child = (ref = controlArray[i]) === null || ref === void 0 ? void 0 : (ref6 = ref.children) === null || ref6 === void 0 ? void 0 : ref6[0];
425
- if (control.type === 'grid-row' && child && [
426
- 'group-panel',
427
- 'subtable',
428
- 'tab'
428
+ var child = (_controlArray_i = controlArray[i]) === null || _controlArray_i === void 0 ? void 0 : (_controlArray_i_children = _controlArray_i.children) === null || _controlArray_i_children === void 0 ? void 0 : _controlArray_i_children[0];
429
+ if (control.type === "grid-row" && child && [
430
+ "group-panel",
431
+ "subtable",
432
+ "tab"
429
433
  ].includes(child.type)) {
430
434
  controlArray.splice(i, 1, child);
431
435
  }
@@ -433,31 +437,31 @@ function conversionLayoutControl(schemArray) {
433
437
  });
434
438
  }
435
439
  function conversionListPage(controlArray, payload) {
436
- var ref, ref7, ref8, ref9, ref10;
440
+ var _listPageProps_source_config, _listPageProps, _listPageProps_source_config1, _listPageProps1, _payload, _listPageProps_source_config2, _listPageProps2, _listPageProps_source_config3, _listPageProps3, _listPageProps_sublist_page, _listPageProps4;
437
441
  if (!(Array.isArray(controlArray) && controlArray.length === 1)) {
438
442
  return controlArray;
439
443
  }
440
444
  var listPage = controlArray[0];
441
- if (listPage.type !== 'list-page') {
445
+ if (listPage.type !== "list-page") {
442
446
  return controlArray;
443
447
  }
444
448
  // children = search + toolbox + table
445
449
  var listPageProps = listPage.props, children = listPage.children;
446
- var _children = _slicedToArray(children, 3), search = _children[0], toolbox = _children[1], table = _children[2];
450
+ var _children = _sliced_to_array(children, 3), search = _children[0], toolbox = _children[1], table = _children[2];
447
451
  conversionSearch(search);
448
- table.props.is_fixed_header = listPageProps === null || listPageProps === void 0 ? void 0 : (ref = listPageProps.source_config) === null || ref === void 0 ? void 0 : ref.is_fixed_header;
452
+ table.props.is_fixed_header = (_listPageProps = listPageProps) === null || _listPageProps === void 0 ? void 0 : (_listPageProps_source_config = _listPageProps.source_config) === null || _listPageProps_source_config === void 0 ? void 0 : _listPageProps_source_config.is_fixed_header;
449
453
  // table.props.datasource_bind = new DataSourceBind({
450
454
  // dataCode: listPageProps?.source_config?data_code,
451
455
  // svcCode: listPageProps?.source_config?svc_code,
452
456
  // orders: camelizeKeys(listPageProps?.source_config?orders) as any[],
453
457
  // })
454
458
  conversionGridTable(table, toolbox);
455
- var ref11;
456
- var dataCode = (ref11 = listPageProps === null || listPageProps === void 0 ? void 0 : (ref7 = listPageProps.source_config) === null || ref7 === void 0 ? void 0 : ref7.data_code) !== null && ref11 !== void 0 ? ref11 : payload === null || payload === void 0 ? void 0 : payload.dataCode;
457
- var ref12;
458
- var svcCode = ((ref12 = listPageProps === null || listPageProps === void 0 ? void 0 : (ref8 = listPageProps.source_config) === null || ref8 === void 0 ? void 0 : ref8.svc_code) !== null && ref12 !== void 0 ? ref12 : dataCode) ? "".concat(dataCode, "_selectMore") : undefined;
459
- var ref13;
460
- var orders = (ref13 = listPageProps === null || listPageProps === void 0 ? void 0 : (ref9 = listPageProps.source_config) === null || ref9 === void 0 ? void 0 : ref9.orders) !== null && ref13 !== void 0 ? ref13 : [];
459
+ var _listPageProps_source_config_data_code;
460
+ var dataCode = (_listPageProps_source_config_data_code = (_listPageProps1 = listPageProps) === null || _listPageProps1 === void 0 ? void 0 : (_listPageProps_source_config1 = _listPageProps1.source_config) === null || _listPageProps_source_config1 === void 0 ? void 0 : _listPageProps_source_config1.data_code) !== null && _listPageProps_source_config_data_code !== void 0 ? _listPageProps_source_config_data_code : (_payload = payload) === null || _payload === void 0 ? void 0 : _payload.dataCode;
461
+ var _listPageProps_source_config_svc_code;
462
+ var svcCode = ((_listPageProps_source_config_svc_code = (_listPageProps2 = listPageProps) === null || _listPageProps2 === void 0 ? void 0 : (_listPageProps_source_config2 = _listPageProps2.source_config) === null || _listPageProps_source_config2 === void 0 ? void 0 : _listPageProps_source_config2.svc_code) !== null && _listPageProps_source_config_svc_code !== void 0 ? _listPageProps_source_config_svc_code : dataCode) ? "".concat(dataCode, "_selectMore") : undefined;
463
+ var _listPageProps_source_config_orders;
464
+ var orders = (_listPageProps_source_config_orders = (_listPageProps3 = listPageProps) === null || _listPageProps3 === void 0 ? void 0 : (_listPageProps_source_config3 = _listPageProps3.source_config) === null || _listPageProps_source_config3 === void 0 ? void 0 : _listPageProps_source_config3.orders) !== null && _listPageProps_source_config_orders !== void 0 ? _listPageProps_source_config_orders : [];
461
465
  var listView = new ListView.Designer();
462
466
  listView.props.datasourceBind = new DataSourceBind({
463
467
  dataCode: dataCode,
@@ -467,7 +471,7 @@ function conversionListPage(controlArray, payload) {
467
471
  listView.props.isShowSubList = listPageProps.is_show_sublist;
468
472
  listView.props.triggerType = listPageProps.timing_type;
469
473
  listView.props.triggerFieldCode = listPageProps.ctrl_field_code;
470
- listPageProps === null || listPageProps === void 0 ? void 0 : (ref10 = listPageProps.sublist_page) === null || ref10 === void 0 ? void 0 : ref10.sublists.forEach(function(item) {
474
+ (_listPageProps4 = listPageProps) === null || _listPageProps4 === void 0 ? void 0 : (_listPageProps_sublist_page = _listPageProps4.sublist_page) === null || _listPageProps_sublist_page === void 0 ? void 0 : _listPageProps_sublist_page.sublists.forEach(function(item) {
471
475
  item.title = isLanguageObject(item.title) ? item.title.zh : item.title;
472
476
  });
473
477
  listView.props.sublistPage = listPageProps.sublist_page;
@@ -478,34 +482,34 @@ function conversionListPage(controlArray, payload) {
478
482
  ];
479
483
  }
480
484
  function conversionSearch(searchControl) {
481
- searchControl.type = 'simple-search';
482
- searchControl.control_type = 'search-view';
485
+ searchControl.type = "simple-search";
486
+ searchControl.control_type = "search-view";
483
487
  searchControl.children.forEach(function(item) {
484
- var placeholder = isLanguageObject(item.placeholder) ? item.placeholder['zh'] : item.placeholder;
485
- if (item.type === 'number-range') {
486
- item.type = 'search-number-range';
488
+ var placeholder = isLanguageObject(item.placeholder) ? item.placeholder["zh"] : item.placeholder;
489
+ if (item.type === "number-range") {
490
+ item.type = "search-number-range";
487
491
  item.placeholderStart = placeholder;
488
492
  item.placeholderEnd = placeholder;
489
493
  }
490
- if (item.type === 'date-pick') {
491
- var ref, ref14;
492
- item.type = 'search-date-range';
494
+ if (item.type === "date-pick") {
495
+ var _item_dateType_replace, _item_dateType;
496
+ item.type = "search-date-range";
493
497
  item.placeholderStart = placeholder;
494
498
  item.placeholderEnd = placeholder;
495
- item.dateType = (ref = item.dateType) === null || ref === void 0 ? void 0 : (ref14 = ref.replace) === null || ref14 === void 0 ? void 0 : ref14.call(ref, /range$/);
499
+ item.dateType = (_item_dateType = item.dateType) === null || _item_dateType === void 0 ? void 0 : (_item_dateType_replace = _item_dateType.replace) === null || _item_dateType_replace === void 0 ? void 0 : _item_dateType_replace.call(_item_dateType, /range$/);
496
500
  }
497
- if (item.type === 'automatic-number' || item.type === 'auto-number') {
498
- item.type = 'search-input';
499
- item.props.defaultValue = '';
501
+ if (item.type === "automatic-number" || item.type === "auto-number") {
502
+ item.type = "search-input";
503
+ item.props.defaultValue = "";
500
504
  }
501
505
  });
502
506
  }
503
507
  function conversionGridTable(tableControl, toolbox) {
504
508
  // 去掉了'list-page-btn-custom-head'按钮控件
505
509
  tableControl.children = toolbox.children.filter(function(item) {
506
- return item.type !== 'list-page-btn-custom-head';
510
+ return item.type !== "list-page-btn-custom-head";
507
511
  });
508
- tableControl.type = 'grid-table';
512
+ tableControl.type = "grid-table";
509
513
  if (tableControl.props.sublist_page) {
510
514
  tableControl.props.sublist_page.form_bind = {
511
515
  data_code: tableControl.props.sublist_page.data_code,
@@ -515,63 +519,63 @@ function conversionGridTable(tableControl, toolbox) {
515
519
  if (Array.isArray(tableControl.props.headers)) {
516
520
  tableControl.props.headers = tableControl.props.headers.map(function(item) {
517
521
  var obj = {
518
- type: '',
519
- control_type: 'column',
522
+ type: "",
523
+ control_type: "column",
520
524
  props: {
521
- widthType: 'px',
525
+ widthType: "px",
522
526
  width: 50,
523
- caption: '',
527
+ caption: "",
524
528
  field_code: item.field_code,
525
- field_name: isLanguageObject(item.field_name) ? item.field_name['zh'] : item.field_name
529
+ field_name: isLanguageObject(item.field_name) ? item.field_name["zh"] : item.field_name
526
530
  }
527
531
  };
528
- obj.props.caption = isLanguageObject(item.field_name) ? item.field_name['zh'] : item.field_name;
532
+ obj.props.caption = isLanguageObject(item.field_name) ? item.field_name["zh"] : item.field_name;
529
533
  obj.props.filter_tags = item.is_filter_tags;
530
534
  obj.props.fixed = item.fixed;
531
535
  obj.props.display_bo_list = item.display_bo_list;
532
536
  obj.props.date_type = item.date_type;
533
- obj.props.optionConfig = 'none';
537
+ obj.props.optionConfig = "none";
534
538
  if (item.header_width_config) {
535
- obj.props.widthType = item.header_width_config === '1' ? 'auto' : 'px';
539
+ obj.props.widthType = item.header_width_config === "1" ? "auto" : "px";
536
540
  }
537
- if (obj.props.widthType === 'px' && item.header_width) {
541
+ if (obj.props.widthType === "px" && item.header_width) {
538
542
  obj.props.width = Number(item.header_width);
539
543
  }
540
- if (item.table_header_type === 'order') {
541
- obj.type = 'order-column';
544
+ if (item.table_header_type === "order") {
545
+ obj.type = "order-column";
542
546
  obj.props.fixed = true;
543
- } else if (item.table_header_type === 'operation') {
544
- obj.type = 'operation-column';
545
- var _check;
546
- obj.props.check = (_check = item.check) !== null && _check !== void 0 ? _check : {};
547
- obj.props.check.openType = 'window';
548
- var _delete;
549
- obj.props.delete = (_delete = item.delete) !== null && _delete !== void 0 ? _delete : {};
550
- obj.props.delete.openType = 'window';
551
- var _edit;
552
- obj.props.edit = (_edit = item.edit) !== null && _edit !== void 0 ? _edit : {};
553
- obj.props.edit.openType = 'window';
547
+ } else if (item.table_header_type === "operation") {
548
+ obj.type = "operation-column";
549
+ var _item_check;
550
+ obj.props.check = (_item_check = item.check) !== null && _item_check !== void 0 ? _item_check : {};
551
+ obj.props.check.openType = "window";
552
+ var _item_delete;
553
+ obj.props.delete = (_item_delete = item.delete) !== null && _item_delete !== void 0 ? _item_delete : {};
554
+ obj.props.delete.openType = "window";
555
+ var _item_edit;
556
+ obj.props.edit = (_item_edit = item.edit) !== null && _item_edit !== void 0 ? _item_edit : {};
557
+ obj.props.edit.openType = "window";
554
558
  obj.props.fixed = true;
555
559
  } else {
556
- obj.type = item.field_type + '-column';
557
- if (item.field_type === 'auto_number') {
558
- obj.type = 'auto-number-column';
560
+ obj.type = item.field_type + "-column";
561
+ if (item.field_type === "auto_number") {
562
+ obj.type = "auto-number-column";
559
563
  }
560
- if (item.field_type === 'relation') {
561
- obj.type = 'varchar-column';
564
+ if (item.field_type === "relation") {
565
+ obj.type = "varchar-column";
562
566
  }
563
567
  }
564
568
  if (item.convert_switch) {
565
- obj.props.optionConfig = item.convert_type === 1 ? 'datasource' : 'custom';
569
+ obj.props.optionConfig = item.convert_type === 1 ? "datasource" : "custom";
566
570
  }
567
- if (obj.props.optionConfig === 'datasource') {
571
+ if (obj.props.optionConfig === "datasource") {
568
572
  obj.props.datasource_bind = new DataSourceBind({
569
573
  svcCode: item.svc_code,
570
574
  displayBoList: item.display_bo_list,
571
575
  valueFieldCode: item.field_match,
572
576
  dataCode: item.field_source
573
577
  });
574
- } else if (obj.props.optionConfig === 'custom') {
578
+ } else if (obj.props.optionConfig === "custom") {
575
579
  obj.props.options = item.custom_match_bo_list;
576
580
  }
577
581
  return obj;
@@ -581,12 +585,12 @@ function conversionGridTable(tableControl, toolbox) {
581
585
  function groupPanelHandler(controlArray) {
582
586
  var group = null;
583
587
  for(var i = 0; i < controlArray.length; i++){
584
- var ref;
588
+ var _item_children_;
585
589
  var item = controlArray[i];
586
590
  if (!item) {
587
591
  continue;
588
592
  }
589
- if (item.children && ((ref = item.children[0]) === null || ref === void 0 ? void 0 : ref.type) === 'group-panel') {
593
+ if (item.children && ((_item_children_ = item.children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.type) === "group-panel") {
590
594
  group = item.children[0];
591
595
  continue;
592
596
  }
@@ -612,7 +616,7 @@ function conversionPageEvents(events) {
612
616
  });
613
617
  }
614
618
  function conversionControlEvents(control, controlEvents) {
615
- var ref;
619
+ var _controlEvents_control_id;
616
620
  if (!controlEvents || !control.props.events) {
617
621
  return;
618
622
  }
@@ -621,7 +625,7 @@ function conversionControlEvents(control, controlEvents) {
621
625
  return;
622
626
  }
623
627
  eventKeys.forEach(function(eventKey) {
624
- var _eventKey;
628
+ var _controlEvents_control_id_eventKey;
625
629
  if (!control.props.events[eventKey].length) {
626
630
  return;
627
631
  }
@@ -631,17 +635,17 @@ function conversionControlEvents(control, controlEvents) {
631
635
  if (!controlEvents[control.id][eventKey]) {
632
636
  controlEvents[control.id][eventKey] = [];
633
637
  }
634
- (_eventKey = controlEvents[control.id][eventKey]).push.apply(_eventKey, _toConsumableArray(control.props.events[eventKey].map(function(item) {
638
+ (_controlEvents_control_id_eventKey = controlEvents[control.id][eventKey]).push.apply(_controlEvents_control_id_eventKey, _to_consumable_array(control.props.events[eventKey].map(function(item) {
635
639
  return item.name;
636
640
  })));
637
641
  });
638
642
  // 将失焦事件转换为change事件
639
- if ((ref = controlEvents[control.id]) === null || ref === void 0 ? void 0 : ref.on_blur) {
640
- var _on_change;
643
+ if ((_controlEvents_control_id = controlEvents[control.id]) === null || _controlEvents_control_id === void 0 ? void 0 : _controlEvents_control_id.on_blur) {
644
+ var _controlEvents_control_id_on_change;
641
645
  if (!controlEvents[control.id].on_change) {
642
646
  controlEvents[control.id].on_change = [];
643
647
  }
644
- (_on_change = controlEvents[control.id].on_change).push.apply(_on_change, _toConsumableArray(controlEvents[control.id].on_blur));
648
+ (_controlEvents_control_id_on_change = controlEvents[control.id].on_change).push.apply(_controlEvents_control_id_on_change, _to_consumable_array(controlEvents[control.id].on_blur));
645
649
  }
646
650
  }
647
651
  export { dataCleaner };