@byteluck-fe/model-driven-driven 4.69.0-lx0 → 4.69.0-lx2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # Driven
2
- 设计态引擎
3
-
4
- Builder.ts // 兼容旧版Designer,提供页面初始化
5
- constants.ts // 常量
6
- Designer.ts // 旧版designer的实现
7
- designerUtils.ts // 工具函数
8
- Driven.ts // 引擎
9
- EventLogic.ts // 事件管理
10
- index.ts
11
- Plugin.ts // 插件
12
- Store.ts // 仓库
13
- utils.ts // 工具
1
+ # Driven
2
+ 设计态引擎
3
+
4
+ Builder.ts // 兼容旧版Designer,提供页面初始化
5
+ constants.ts // 常量
6
+ Designer.ts // 旧版designer的实现
7
+ designerUtils.ts // 工具函数
8
+ Driven.ts // 引擎
9
+ EventLogic.ts // 事件管理
10
+ index.ts
11
+ Plugin.ts // 插件
12
+ Store.ts // 仓库
13
+ utils.ts // 工具
@@ -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
@@ -97,6 +97,7 @@ function _inherits(subClass, superClass) {
97
97
  if (superClass) _set_prototype_of(subClass, superClass);
98
98
  }
99
99
  function _instanceof(left, right) {
100
+ "@swc/helpers - instanceof";
100
101
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
101
102
  return !!right[Symbol.hasInstance](left);
102
103
  } else {
@@ -146,7 +147,7 @@ function _is_native_reflect_construct() {
146
147
  })();
147
148
  }
148
149
  function _ts_generator(thisArg, body) {
149
- var f, y, t, g, _ = {
150
+ var f, y, t, _ = {
150
151
  label: 0,
151
152
  sent: function() {
152
153
  if (t[0] & 1) throw t[1];
@@ -154,13 +155,17 @@ function _ts_generator(thisArg, body) {
154
155
  },
155
156
  trys: [],
156
157
  ops: []
157
- };
158
- return g = {
159
- next: verb(0),
160
- "throw": verb(1),
161
- "return": verb(2)
162
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
163
- return this;
158
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
159
+ return d(g, "next", {
160
+ value: verb(0)
161
+ }), d(g, "throw", {
162
+ value: verb(1)
163
+ }), d(g, "return", {
164
+ value: verb(2)
165
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
166
+ value: function() {
167
+ return this;
168
+ }
164
169
  }), g;
165
170
  function verb(n) {
166
171
  return function(v) {
@@ -172,7 +177,7 @@ function _ts_generator(thisArg, body) {
172
177
  }
173
178
  function step(op) {
174
179
  if (f) throw new TypeError("Generator is already executing.");
175
- while(_)try {
180
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
176
181
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
177
182
  if (y = 0, t) op = [
178
183
  op[0] & 2,
@@ -186,33 +186,32 @@ 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
- /**
193
- * 设计器驱动
191
+ /**
192
+ * 设计器驱动
194
193
  * */ var Driven = /*#__PURE__*/ function(Watcher) {
195
194
  "use strict";
196
195
  _inherits(Driven, Watcher);
197
196
  function Driven(options) {
198
197
  _class_call_check(this, Driven);
199
198
  var _this;
200
- _this = _call_super(this, Driven), _define_property(_this, "mode", void 0), _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), /**
201
- * 控件可选的事件
202
- * */ _define_property(_this, "eventLogic", void 0), /**
203
- * 处理数据存储,存放模型等
204
- * */ _define_property(_this, "store", void 0), /**
205
- * 额外参数存储
206
- */ _define_property(_this, "externalParams", void 0), /**
207
- * 处理instance,和schema存储
208
- * */ _define_property(_this, "designer", void 0), /**
209
- * 插件数组
199
+ _this = _call_super(this, Driven), _define_property(_this, "mode", void 0), _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), /**
200
+ * 控件可选的事件
201
+ * */ _define_property(_this, "eventLogic", void 0), /**
202
+ * 处理数据存储,存放模型等
203
+ * */ _define_property(_this, "store", void 0), /**
204
+ * 额外参数存储
205
+ */ _define_property(_this, "externalParams", void 0), /**
206
+ * 处理instance,和schema存储
207
+ * */ _define_property(_this, "designer", void 0), /**
208
+ * 插件数组
210
209
  * */ _define_property(_this, "__plugins", void 0), _define_property(_this, "__pluginsApplied", false), _define_property(_this, "$options", void 0), // TODO 拿到schema
211
210
  _define_property(_this, "getSchema", toSchema), // TODO 拿到model_bind_info_list
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({
@@ -474,10 +473,10 @@ var applyingPluginName = '';
474
473
  if (instance === null) return;
475
474
  var _instance = this.getInstance(instance);
476
475
  if (!_instance) return;
477
- /*
478
- 移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
479
- 事件是否区分move和add
480
- move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
476
+ /*
477
+ 移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
478
+ 事件是否区分move和add
479
+ move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
481
480
  */ var oldDataScopeParent = this.store.movingInstanceOldDataScopeParent;
482
481
  var newDataScopeParent = findInstanceDataScopeParent(_instance);
483
482
  var oldParent = this.store.movingInstanceOldParent;
@@ -602,8 +601,8 @@ var applyingPluginName = '';
602
601
  },
603
602
  {
604
603
  key: "removeInstance",
605
- value: /**
606
- * 删除控件
604
+ value: /**
605
+ * 删除控件
607
606
  * */ function removeInstance(instance) {
608
607
  // 删除实例,并触发事件 removed
609
608
  var parent = instance.parent;
@@ -642,8 +641,8 @@ var applyingPluginName = '';
642
641
  },
643
642
  {
644
643
  key: "updateInstanceType",
645
- value: /**
646
- * 修改控件类型
644
+ value: /**
645
+ * 修改控件类型
647
646
  * */ function updateInstanceType(instance, type) {
648
647
  var schema = instance.toSchema();
649
648
  var newInstance = this.createInstance(type, {
@@ -701,16 +700,16 @@ var applyingPluginName = '';
701
700
  },
702
701
  {
703
702
  key: "assertInstance",
704
- value: /**
705
- * 判断控件的类型,返回当前控件的正确类型
703
+ value: /**
704
+ * 判断控件的类型,返回当前控件的正确类型
706
705
  * */ function assertInstance(instance, types) {
707
706
  return isString(types) ? instance.type === types : types.includes(instance.type);
708
707
  }
709
708
  },
710
709
  {
711
710
  key: "getInstanceInListControl",
712
- value: /**
713
- * 控件在列表控件内,如明细子表或列表控件
711
+ value: /**
712
+ * 控件在列表控件内,如明细子表或列表控件
714
713
  * */ function getInstanceInListControl(instance) {
715
714
  var _instance = instance;
716
715
  while(_instance){
@@ -781,7 +780,7 @@ var applyingPluginName = '';
781
780
  ]);
782
781
  return Driven;
783
782
  }(Watcher);
784
- /**
785
- * 控件事件定义
783
+ /**
784
+ * 控件事件定义
786
785
  * */ _define_property(Driven, "EventLogic", EventLogic);
787
786
  export { Driven };
package/dist/esm/Store.js CHANGED
@@ -89,55 +89,55 @@ 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() {
96
96
  "use strict";
97
97
  function Store(options) {
98
98
  _class_call_check(this, Store);
99
- /**
100
- * 页面控件实例树
99
+ var _options_getParentBeforeInstanceMove;
100
+ /**
101
+ * 页面控件实例树
101
102
  * */ _define_property(this, "instance", void 0);
102
- /**
103
- * 拍平的控件数组
103
+ /**
104
+ * 拍平的控件数组
104
105
  * */ _define_property(this, "flatInstances", void 0);
105
- /**
106
- * 控件id组成的map
106
+ /**
107
+ * 控件id组成的map
107
108
  * */ _define_property(this, "instanceIdMap", void 0);
108
- /**
109
- * dataCode和fieldCode组成的map
110
- * {
111
- * [主表dataCode]: {
112
- * [fieldCode]: 控件
113
- * },
114
- * [子表dataCode]: {
115
- * [fieldCode]: 控件
116
- * }
117
- * }
109
+ /**
110
+ * dataCode和fieldCode组成的map
111
+ * {
112
+ * [主表dataCode]: {
113
+ * [fieldCode]: 控件
114
+ * },
115
+ * [子表dataCode]: {
116
+ * [fieldCode]: 控件
117
+ * }
118
+ * }
118
119
  * */ _define_property(this, "dataFieldCodeMap", void 0);
119
- /**
120
- * 当前选中的控件
120
+ /**
121
+ * 当前选中的控件
121
122
  * */ _define_property(this, "selected", null);
122
- /**
123
- * 当前选中的数据作用域控件
123
+ /**
124
+ * 当前选中的数据作用域控件
124
125
  * */ _define_property(this, "selectedInstanceDataScopeParent", null);
125
126
  _define_property(this, "selectedDataScopeFlatInstances", []);
126
- /**
127
- * 当前选中控件的setting
127
+ /**
128
+ * 当前选中控件的setting
128
129
  * */ _define_property(this, "selectedInstanceSetting", []);
129
130
  _define_property(this, "selectedInstanceSettingItems", []);
130
- /**
131
- * 当前选中控件的数据模型
131
+ /**
132
+ * 当前选中控件的数据模型
132
133
  * */ _define_property(this, "selectedFieldItem", null);
133
- /**
134
- * 扩展字段,比如appId,dataCode等
134
+ /**
135
+ * 扩展字段,比如appId,dataCode等
135
136
  * */ _define_property(this, "external", {});
136
137
  _define_property(this, "movingInstance", null);
137
138
  _define_property(this, "movingInstanceOldParent", null);
138
139
  _define_property(this, "movingInstanceOldDataScopeParent", null);
139
140
  _define_property(this, "getParentBeforeInstanceMove", void 0);
140
- var _options_getParentBeforeInstanceMove;
141
141
  this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
142
142
  return instance.parent;
143
143
  };
@@ -147,8 +147,8 @@ export var Store = /*#__PURE__*/ function() {
147
147
  _create_class(Store, [
148
148
  {
149
149
  key: "selectedRules",
150
- get: /**
151
- * 当前选中控件的rules
150
+ get: /**
151
+ * 当前选中控件的rules
152
152
  * */ function get() {
153
153
  if (!this.selected) {
154
154
  return null;
@@ -158,8 +158,8 @@ export var Store = /*#__PURE__*/ function() {
158
158
  },
159
159
  {
160
160
  key: "selectedAntdRules",
161
- get: /**
162
- * 当前选中控件的antd rules
161
+ get: /**
162
+ * 当前选中控件的antd rules
163
163
  * */ function get() {
164
164
  var rules = this.selectedRules;
165
165
  if (!rules) {
@@ -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 _ref;
317
+ var _item_props;
318
+ loop((_ref = (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.footers) !== null && _ref !== void 0 ? _ref : [], 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) {