@byteluck-fe/model-driven-driven 3.0.0-beta.4 → 4.34.0-lx1

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.
@@ -30,7 +30,6 @@ function _define_property(obj, key, value) {
30
30
  }
31
31
  return obj;
32
32
  }
33
- import { getLocaleText } from '@byteluck-fe/locale-message';
34
33
  import Designer from './Designer';
35
34
  import { CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
36
35
  export var Builder = /*#__PURE__*/ function() {
@@ -98,53 +97,39 @@ export var Builder = /*#__PURE__*/ function() {
98
97
  listview.children.push(simpleSearch);
99
98
  // @ts-ignore
100
99
  listview.children.push(gridTable);
101
- listview.props.rowStyle = {
102
- type: 'rules',
103
- "interval": {
104
- "color": ""
105
- },
106
- rules: [
100
+ listview.props.rowStyleRules.push({
101
+ id: 'default',
102
+ name: '审批通过单据',
103
+ color: 'theme',
104
+ filters: [
107
105
  {
108
- id: 'default',
109
- name: getLocaleText('CMD.approvedDocuments', null, '审批通过单据'),
110
- color: 'theme',
111
- filters: [
112
- {
113
- ruleId: 1,
114
- symbol: 'op_equal',
115
- leftVariableBo: {
116
- type: 'varchar',
117
- value: 'process_status',
118
- name: getLocaleText('CMD.processStatus', null, '流程状态')
119
- },
120
- checked: false,
121
- describe: 'ruleLine',
122
- type: 'condition',
123
- rightVariableBo: {
124
- type: 'custom',
125
- value: [
126
- 'COMPLETE'
127
- ],
128
- displayBos: []
129
- },
130
- isLowPerformance: false,
131
- isMoreRelation: false
132
- }
133
- ],
134
- "settings": [
135
- {
136
- "color": "theme",
137
- "field_codes": [
138
- "process_status"
139
- ],
140
- "type": "fontColor",
141
- "scope": "col"
142
- }
143
- ],
144
- script: "(SpecialMatch(data,sys,'process_status','varchar','op_equal','COMPLETE'))"
106
+ ruleId: 1,
107
+ symbol: 'op_equal',
108
+ leftVariableBo: {
109
+ type: 'varchar',
110
+ value: 'process_status',
111
+ name: '流程状态'
112
+ },
113
+ checked: false,
114
+ describe: 'ruleLine',
115
+ type: 'condition',
116
+ rightVariableBo: {
117
+ type: 'custom',
118
+ value: [
119
+ 'COMPLETE'
120
+ ],
121
+ displayBos: []
122
+ },
123
+ isLowPerformance: false,
124
+ isMoreRelation: false
145
125
  }
146
126
  ]
147
- };
127
+ });
128
+ listview.props.rowStyleRulesScript.push({
129
+ id: 'default',
130
+ script: "(params.data['process_status']==='COMPLETE')",
131
+ color: 'theme'
132
+ });
148
133
  return listview;
149
134
  }
150
135
  },
@@ -172,7 +157,7 @@ export var Builder = /*#__PURE__*/ function() {
172
157
  var grid = this.designer.createControlInstance(// @ts-ignore
173
158
  CONTROL_TYPE.GRID);
174
159
  var vueFormItem = this.designer.createControlInstance(// @ts-ignore
175
- CONTROL_TYPE.VUE_PAGE);
160
+ CONTROL_TYPE.VUE_FORM_ITEM);
176
161
  // @ts-ignore
177
162
  vueFormItem.props.isHideCaption = true;
178
163
  // @ts-ignore
@@ -186,7 +186,6 @@ import { Designer } from './Designer';
186
186
  import EventLogic from './EventLogic';
187
187
  import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from './utils';
188
188
  import { Group, initSettings, Tab } from '@byteluck-fe/model-driven-settings';
189
- import { DEFAULT_LOCALE } from '@byteluck-fe/model-driven-shared';
190
189
  // 当前正在注册的插件名称
191
190
  var applyingPluginName = '';
192
191
  /**
@@ -212,7 +211,7 @@ var applyingPluginName = '';
212
211
  _define_property(_this, "getModelBindInfoList", getModelBindInfoList), // TODO 拿到permission_controls
213
212
  _define_property(_this, "generatePermissions", generatePermissions);
214
213
  _this.$options = Object.freeze(options);
215
- 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, messagesI18n = _this_$options.messagesI18n, _this_$options_language = _this_$options.language, language = _this_$options_language === void 0 ? DEFAULT_LOCALE : _this_$options_language;
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;
216
215
  _this.eventLogic = new EventLogic();
217
216
  _this.designer = new DesignerClass();
218
217
  _this.store = new Store(_object_spread({
package/dist/esm/Store.js CHANGED
@@ -89,7 +89,7 @@ function _unsupported_iterable_to_array(o, minLen) {
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
91
  import { isDataBind } from '@byteluck-fe/model-driven-core';
92
- import { hasChildrenControl, hasHeaderControl } from './designerUtils';
92
+ import { hasChildrenControl, hasFooterControl, hasHeaderControl } from './designerUtils';
93
93
  import { CONTROL_BASE_TYPE, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
94
94
  // 维护当前selected,。。 selectedControlSetting
95
95
  export var Store = /*#__PURE__*/ function() {
@@ -294,11 +294,9 @@ function setInstanceInDataFieldCodeMap(instance, dataFieldCodeMap) {
294
294
  if (isDataBind(dataBind)) {
295
295
  setDataFieldCodeMap(dataFieldCodeMap, dataBind, instance);
296
296
  } else {
297
- if (dataBind) {
298
- Object.values(dataBind).forEach(function(subDataBind) {
299
- setDataFieldCodeMap(dataFieldCodeMap, subDataBind, instance);
300
- });
301
- }
297
+ Object.values(dataBind).forEach(function(subDataBind) {
298
+ setDataFieldCodeMap(dataFieldCodeMap, subDataBind, instance);
299
+ });
302
300
  }
303
301
  }
304
302
  }
@@ -314,9 +312,11 @@ export function loop(instances, callback) {
314
312
  if (hasHeaderControl(item)) {
315
313
  loop(item.props.headers, callback);
316
314
  }
317
- // if(item)) {
318
- // loop(item.props?.footers ?? [], callback)
319
- // }
315
+ 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);
319
+ }
320
320
  });
321
321
  }
322
322
  export function isDataScopeInstance(instance) {
@@ -1,4 +1,3 @@
1
- import { getLocaleText } from '@byteluck-fe/locale-message';
2
1
  import { CONTROL_TYPE, FieldTypes } from '@byteluck-fe/model-driven-shared';
3
2
  // 使用ObjectDataBind 的控件
4
3
  export var objectDataBindControlTypes = [
@@ -8,27 +7,27 @@ export var objectDataBindControlTypes = [
8
7
  ];
9
8
  export var objectDataBindKeyToFieldType = {
10
9
  amount: {
11
- caption: getLocaleText('CMD.amount', null, '金额'),
10
+ caption: '金额',
12
11
  fieldType: FieldTypes.DECIMAL
13
12
  },
14
13
  currency: {
15
- caption: getLocaleText('CMD.currency', null, '币种'),
14
+ caption: '币种',
16
15
  fieldType: FieldTypes.VARCHAR
17
16
  },
18
17
  result: {
19
- caption: getLocaleText('CMD.result', null, '结果'),
18
+ caption: '结果',
20
19
  fieldType: FieldTypes.DECIMAL
21
20
  },
22
21
  unit: {
23
- caption: getLocaleText('CMD.unit', null, '单位'),
22
+ caption: '单位',
24
23
  fieldType: FieldTypes.VARCHAR
25
24
  },
26
25
  min: {
27
- caption: getLocaleText('CMD.startTime', null, '开始时间'),
26
+ caption: '开始时间',
28
27
  fieldType: FieldTypes.TIMESTAMP
29
28
  },
30
29
  max: {
31
- caption: getLocaleText('CMD.endTime', null, '结束时间'),
30
+ caption: '结束时间',
32
31
  fieldType: FieldTypes.TIMESTAMP
33
32
  }
34
33
  };
@@ -5,14 +5,9 @@ export function hasChildrenControl(instance) {
5
5
  export function hasHeaderControl(instance) {
6
6
  return 'headers' in instance.props && isArray(instance.props.headers);
7
7
  }
8
- // export function hasFooterControl(
9
- // instance: DesignerControl
10
- // ): instance is DesignerListControl {
11
- // return (
12
- // 'footers' in instance.props &&
13
- // isArray((instance as DesignerListControl).props.footers)
14
- // )
15
- // }
8
+ export function hasFooterControl(instance) {
9
+ return 'footers' in instance.props && isArray(instance.props.footers);
10
+ }
16
11
  export function loopFormControl(control, callback) {
17
12
  if (Array.isArray(control)) {
18
13
  control.map(function(item) {
package/dist/esm/utils.js CHANGED
@@ -181,11 +181,9 @@ function _ts_generator(thisArg, body) {
181
181
  }
182
182
  }
183
183
  import { loopFormControl } from './designerUtils';
184
- import { CONTROL_BASE_TYPE, CONTROL_TYPE, // FieldTypes,
185
- // FieldTypeToColumnType,
186
- isArray } from '@byteluck-fe/model-driven-shared';
187
- import { objectDataBindControlTypes } from './constants';
188
- import { getLocaleText } from '@byteluck-fe/locale-message';
184
+ import { CONTROL_BASE_TYPE, CONTROL_TYPE, FieldTypeToColumnType, isArray } from '@byteluck-fe/model-driven-shared';
185
+ import Designer from './Designer';
186
+ import { objectDataBindControlTypes, objectDataBindKeyToFieldType } from './constants';
189
187
  export function getMasterFormControls(controls) {
190
188
  var formctls = [];
191
189
  // @ts-ignore
@@ -231,6 +229,75 @@ function fieldCodeBeforeAddPrefix(fieldCode) {
231
229
  }
232
230
  return prefix + fieldCode;
233
231
  }
232
+ /**
233
+ * @description 通过fieldType获取列表表头的type
234
+ * */ export function getColumnTypeFromFiledType(fieldType) {
235
+ return FieldTypeToColumnType[fieldType];
236
+ }
237
+ /**
238
+ * @description 通过modelBindInfoList生成多个columns
239
+ * */ export function getColumnsFromModelBindInfoList(modelBindInfoList) {
240
+ var designer = new Designer();
241
+ var columns = [];
242
+ modelBindInfoList.forEach(function(item) {
243
+ // 控件在明细子表内或者没有dataBind的话 不做生成
244
+ if (item.parentId || !item.dataBind) return;
245
+ // 如果是对象形式的dataBind的话
246
+ if (objectDataBindControlTypes.includes(item.type)) {
247
+ var objectDataBind = item.dataBind;
248
+ var datasourceBind = item.datasourceBind;
249
+ // 对象的每一个key生成一个column
250
+ Object.keys(objectDataBind).forEach(function(key) {
251
+ // 对应的dataBind
252
+ var dataBind = objectDataBind[key];
253
+ // 当前key对应的fieldType
254
+ var fieldType = objectDataBindKeyToFieldType[key].fieldType;
255
+ // 拼接当前列的caption
256
+ var caption = item.caption + '_' + objectDataBindKeyToFieldType[key].caption;
257
+ // 通过fieldType获取列类型
258
+ var controlType = getColumnTypeFromFiledType(fieldType);
259
+ if (!controlType) return;
260
+ var props = {
261
+ caption: caption,
262
+ dataBind: dataBind
263
+ };
264
+ if (key === 'currency') {
265
+ props.optionConfig = 'datasource';
266
+ props.datasourceBind = datasourceBind;
267
+ }
268
+ // @ts-ignore
269
+ var column = designer.createControlInstance(controlType, {
270
+ props: props
271
+ });
272
+ column && columns.push(column);
273
+ });
274
+ } else {
275
+ var controlType = getColumnTypeFromFiledType(item.fieldType);
276
+ if (!controlType) return;
277
+ // @ts-ignore
278
+ var column = designer.createControlInstance(controlType, {
279
+ props: {
280
+ caption: item.caption,
281
+ dataBind: item.dataBind,
282
+ datasourceBind: item.datasourceBind
283
+ }
284
+ });
285
+ column && columns.push(column);
286
+ }
287
+ });
288
+ return columns;
289
+ }
290
+ export function getColumnsFromFiledType(fieldTypes) {
291
+ var designer = new Designer();
292
+ var fieldTypesMap = Array.isArray(fieldTypes) ? fieldTypes : [
293
+ fieldTypes
294
+ ];
295
+ var result = fieldTypesMap.map(function(fieldType) {
296
+ var columnType = getColumnTypeFromFiledType(fieldType);
297
+ return designer.createControlInstance(columnType);
298
+ });
299
+ return Array.isArray(fieldTypes) ? result : result[0];
300
+ }
234
301
  function toSchema(schema) {
235
302
  if (Array.isArray(schema)) {
236
303
  return schema.map(function(item) {
@@ -324,15 +391,15 @@ var cannotEditControlTypes = [
324
391
  var LIST_OPERATION_BUTTON_PERMISSIONS_MAPS = {
325
392
  check: {
326
393
  id: 'listPageCheckBtnId',
327
- caption: getLocaleText('CMD.view', null, '查看')
394
+ caption: '查看'
328
395
  },
329
396
  edit: {
330
397
  id: 'listPageEditBtnId',
331
- caption: getLocaleText('CMD.edit', null, '编辑')
398
+ caption: '编辑'
332
399
  },
333
400
  delete: {
334
401
  id: 'listPageDeleteBtnId',
335
- caption: getLocaleText('CMD.delete', null, '删除')
402
+ caption: '删除'
336
403
  }
337
404
  };
338
405
  // 生成权限字段