@byteluck-fe/model-driven-driven 2.23.0-beta.1 → 2.23.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/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 // 工具
@@ -31,7 +31,7 @@ function _define_property(obj, key, value) {
31
31
  return obj;
32
32
  }
33
33
  import Designer from './Designer';
34
- import { CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
34
+ import { CONTROL_TYPE, RulesMessage } from '@byteluck-fe/model-driven-shared';
35
35
  export var Builder = /*#__PURE__*/ function() {
36
36
  "use strict";
37
37
  function Builder() {
@@ -105,7 +105,7 @@ export var Builder = /*#__PURE__*/ function() {
105
105
  rules: [
106
106
  {
107
107
  id: 'default',
108
- name: '审批通过单据',
108
+ name: RulesMessage.getMessage('approvedDocuments'),
109
109
  color: 'theme',
110
110
  filters: [
111
111
  {
@@ -114,7 +114,7 @@ export var Builder = /*#__PURE__*/ function() {
114
114
  leftVariableBo: {
115
115
  type: 'varchar',
116
116
  value: 'process_status',
117
- name: '流程状态'
117
+ name: RulesMessage.getMessage('processStatus')
118
118
  },
119
119
  checked: false,
120
120
  describe: 'ruleLine',
@@ -198,10 +198,11 @@ import { Designer } from './Designer';
198
198
  import EventLogic from './EventLogic';
199
199
  import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from './utils';
200
200
  import { Group, initSettings, Tab } from '@byteluck-fe/model-driven-settings';
201
+ import { RulesMessage, DEFAULT_LOCALE } from '@byteluck-fe/model-driven-shared';
201
202
  // 当前正在注册的插件名称
202
203
  var applyingPluginName = '';
203
- /**
204
- * 设计器驱动
204
+ /**
205
+ * 设计器驱动
205
206
  * */ var Driven = /*#__PURE__*/ function(Watcher) {
206
207
  "use strict";
207
208
  _inherits(Driven, Watcher);
@@ -213,20 +214,20 @@ var applyingPluginName = '';
213
214
  _define_property(_assert_this_initialized(_this), "mode", void 0);
214
215
  _define_property(_assert_this_initialized(_this), "isMounted", false);
215
216
  _define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
216
- /**
217
- * 控件可选的事件
217
+ /**
218
+ * 控件可选的事件
218
219
  * */ _define_property(_assert_this_initialized(_this), "eventLogic", void 0);
219
- /**
220
- * 处理数据存储,存放模型等
220
+ /**
221
+ * 处理数据存储,存放模型等
221
222
  * */ _define_property(_assert_this_initialized(_this), "store", void 0);
222
- /**
223
- * 额外参数存储
223
+ /**
224
+ * 额外参数存储
224
225
  */ _define_property(_assert_this_initialized(_this), "externalParams", void 0);
225
- /**
226
- * 处理instance,和schema存储
226
+ /**
227
+ * 处理instance,和schema存储
227
228
  * */ _define_property(_assert_this_initialized(_this), "designer", void 0);
228
- /**
229
- * 插件数组
229
+ /**
230
+ * 插件数组
230
231
  * */ _define_property(_assert_this_initialized(_this), "__plugins", void 0);
231
232
  _define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
232
233
  _define_property(_assert_this_initialized(_this), "$options", void 0);
@@ -237,7 +238,8 @@ var applyingPluginName = '';
237
238
  // TODO 拿到permission_controls
238
239
  _define_property(_assert_this_initialized(_this), "generatePermissions", generatePermissions);
239
240
  _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 ? 'form' : _this_$options_mode, tmp1 = _this_$options.store, storeOptions = tmp1 === void 0 ? {} : tmp1;
241
+ 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;
242
+ RulesMessage.setLocale(language, messagesI18n);
241
243
  _this.eventLogic = new EventLogic();
242
244
  _this.designer = new DesignerClass();
243
245
  _this.store = new Store(_object_spread({
@@ -499,10 +501,10 @@ var applyingPluginName = '';
499
501
  if (instance === null) return;
500
502
  var _instance = this.getInstance(instance);
501
503
  if (!_instance) return;
502
- /*
503
- 移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
504
- 事件是否区分move和add
505
- move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
504
+ /*
505
+ 移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
506
+ 事件是否区分move和add
507
+ move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
506
508
  */ var oldDataScopeParent = this.store.movingInstanceOldDataScopeParent;
507
509
  var newDataScopeParent = findInstanceDataScopeParent(_instance);
508
510
  var oldParent = this.store.movingInstanceOldParent;
@@ -627,8 +629,8 @@ var applyingPluginName = '';
627
629
  },
628
630
  {
629
631
  key: "removeInstance",
630
- value: /**
631
- * 删除控件
632
+ value: /**
633
+ * 删除控件
632
634
  * */ function removeInstance(instance) {
633
635
  // 删除实例,并触发事件 removed
634
636
  var parent = instance.parent;
@@ -667,8 +669,8 @@ var applyingPluginName = '';
667
669
  },
668
670
  {
669
671
  key: "updateInstanceType",
670
- value: /**
671
- * 修改控件类型
672
+ value: /**
673
+ * 修改控件类型
672
674
  * */ function updateInstanceType(instance, type) {
673
675
  var schema = instance.toSchema();
674
676
  var newInstance = this.createInstance(type, {
@@ -726,16 +728,16 @@ var applyingPluginName = '';
726
728
  },
727
729
  {
728
730
  key: "assertInstance",
729
- value: /**
730
- * 判断控件的类型,返回当前控件的正确类型
731
+ value: /**
732
+ * 判断控件的类型,返回当前控件的正确类型
731
733
  * */ function assertInstance(instance, types) {
732
734
  return isString(types) ? instance.type === types : types.includes(instance.type);
733
735
  }
734
736
  },
735
737
  {
736
738
  key: "getInstanceInListControl",
737
- value: /**
738
- * 控件在列表控件内,如明细子表或列表控件
739
+ value: /**
740
+ * 控件在列表控件内,如明细子表或列表控件
739
741
  * */ function getInstanceInListControl(instance) {
740
742
  var _instance = instance;
741
743
  while(_instance){
@@ -806,7 +808,7 @@ var applyingPluginName = '';
806
808
  ]);
807
809
  return Driven;
808
810
  }(Watcher);
809
- /**
810
- * 控件事件定义
811
+ /**
812
+ * 控件事件定义
811
813
  * */ _define_property(Driven, "EventLogic", EventLogic);
812
814
  export { Driven };
package/dist/esm/Store.js CHANGED
@@ -96,42 +96,42 @@ export var Store = /*#__PURE__*/ function() {
96
96
  "use strict";
97
97
  function Store(options) {
98
98
  _class_call_check(this, Store);
99
- /**
100
- * 页面控件实例树
99
+ /**
100
+ * 页面控件实例树
101
101
  * */ _define_property(this, "instance", void 0);
102
- /**
103
- * 拍平的控件数组
102
+ /**
103
+ * 拍平的控件数组
104
104
  * */ _define_property(this, "flatInstances", void 0);
105
- /**
106
- * 控件id组成的map
105
+ /**
106
+ * 控件id组成的map
107
107
  * */ _define_property(this, "instanceIdMap", void 0);
108
- /**
109
- * dataCode和fieldCode组成的map
110
- * {
111
- * [主表dataCode]: {
112
- * [fieldCode]: 控件
113
- * },
114
- * [子表dataCode]: {
115
- * [fieldCode]: 控件
116
- * }
117
- * }
108
+ /**
109
+ * dataCode和fieldCode组成的map
110
+ * {
111
+ * [主表dataCode]: {
112
+ * [fieldCode]: 控件
113
+ * },
114
+ * [子表dataCode]: {
115
+ * [fieldCode]: 控件
116
+ * }
117
+ * }
118
118
  * */ _define_property(this, "dataFieldCodeMap", void 0);
119
- /**
120
- * 当前选中的控件
119
+ /**
120
+ * 当前选中的控件
121
121
  * */ _define_property(this, "selected", null);
122
- /**
123
- * 当前选中的数据作用域控件
122
+ /**
123
+ * 当前选中的数据作用域控件
124
124
  * */ _define_property(this, "selectedInstanceDataScopeParent", null);
125
125
  _define_property(this, "selectedDataScopeFlatInstances", []);
126
- /**
127
- * 当前选中控件的setting
126
+ /**
127
+ * 当前选中控件的setting
128
128
  * */ _define_property(this, "selectedInstanceSetting", []);
129
129
  _define_property(this, "selectedInstanceSettingItems", []);
130
- /**
131
- * 当前选中控件的数据模型
130
+ /**
131
+ * 当前选中控件的数据模型
132
132
  * */ _define_property(this, "selectedFieldItem", null);
133
- /**
134
- * 扩展字段,比如appId,dataCode等
133
+ /**
134
+ * 扩展字段,比如appId,dataCode等
135
135
  * */ _define_property(this, "external", {});
136
136
  _define_property(this, "movingInstance", null);
137
137
  _define_property(this, "movingInstanceOldParent", null);
@@ -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) {
@@ -1,4 +1,4 @@
1
- import { CONTROL_TYPE, FieldTypes } from '@byteluck-fe/model-driven-shared';
1
+ import { CONTROL_TYPE, FieldTypes, RulesMessage } 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: RulesMessage.getMessage('amount'),
11
11
  fieldType: FieldTypes.DECIMAL
12
12
  },
13
13
  currency: {
14
- caption: '币种',
14
+ caption: RulesMessage.getMessage('currency'),
15
15
  fieldType: FieldTypes.VARCHAR
16
16
  },
17
17
  result: {
18
- caption: '结果',
18
+ caption: RulesMessage.getMessage('result'),
19
19
  fieldType: FieldTypes.DECIMAL
20
20
  },
21
21
  unit: {
22
- caption: '单位',
22
+ caption: RulesMessage.getMessage('unit'),
23
23
  fieldType: FieldTypes.VARCHAR
24
24
  },
25
25
  min: {
26
- caption: '开始时间',
26
+ caption: RulesMessage.getMessage('startTime'),
27
27
  fieldType: FieldTypes.TIMESTAMP
28
28
  },
29
29
  max: {
30
- caption: '结束时间',
30
+ caption: RulesMessage.getMessage('endTime'),
31
31
  fieldType: FieldTypes.TIMESTAMP
32
32
  }
33
33
  };
package/dist/esm/utils.js CHANGED
@@ -183,7 +183,7 @@ function _ts_generator(thisArg, body) {
183
183
  import { loopFormControl } from './designerUtils';
184
184
  import { CONTROL_BASE_TYPE, CONTROL_TYPE, // FieldTypes,
185
185
  // FieldTypeToColumnType,
186
- isArray } from '@byteluck-fe/model-driven-shared';
186
+ isArray, RulesMessage } from '@byteluck-fe/model-driven-shared';
187
187
  import { objectDataBindControlTypes } from './constants';
188
188
  export function getMasterFormControls(controls) {
189
189
  var formctls = [];
@@ -196,9 +196,9 @@ export function getMasterFormControls(controls) {
196
196
  });
197
197
  return formctls;
198
198
  }
199
- /**
200
- * @description 给modelBindInfoList中填充fieldCode和dataCode
201
- * @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
199
+ /**
200
+ * @description 给modelBindInfoList中填充fieldCode和dataCode
201
+ * @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
202
202
  * */ export function fillModelBindInfoListFieldCode(modelBindInfoList) {
203
203
  var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
204
204
  if (!modelBindInfoList || !Array.isArray(modelBindInfoList)) return [];
@@ -322,15 +322,15 @@ var cannotEditControlTypes = [
322
322
  var LIST_OPERATION_BUTTON_PERMISSIONS_MAPS = {
323
323
  check: {
324
324
  id: 'listPageCheckBtnId',
325
- caption: '查看'
325
+ caption: RulesMessage.getMessage('view')
326
326
  },
327
327
  edit: {
328
328
  id: 'listPageEditBtnId',
329
- caption: '编辑'
329
+ caption: RulesMessage.getMessage('edit')
330
330
  },
331
331
  delete: {
332
332
  id: 'listPageDeleteBtnId',
333
- caption: '删除'
333
+ caption: RulesMessage.getMessage('delete')
334
334
  }
335
335
  };
336
336
  // 生成权限字段