@byteluck-fe/model-driven-driven 2.23.0-beta.2 → 2.23.0-beta.21

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,8 +30,9 @@ function _define_property(obj, key, value) {
30
30
  }
31
31
  return obj;
32
32
  }
33
+ import { getLocaleText } from '@byteluck-fe/locale-message';
33
34
  import Designer from './Designer';
34
- import { CONTROL_TYPE, RulesMessage } from '@byteluck-fe/model-driven-shared';
35
+ import { CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
35
36
  export var Builder = /*#__PURE__*/ function() {
36
37
  "use strict";
37
38
  function Builder() {
@@ -105,7 +106,7 @@ export var Builder = /*#__PURE__*/ function() {
105
106
  rules: [
106
107
  {
107
108
  id: 'default',
108
- name: RulesMessage.getMessage('approvedDocuments'),
109
+ name: getLocaleText('CMD.approvedDocuments', null, '审批通过单据'),
109
110
  color: 'theme',
110
111
  filters: [
111
112
  {
@@ -114,7 +115,7 @@ export var Builder = /*#__PURE__*/ function() {
114
115
  leftVariableBo: {
115
116
  type: 'varchar',
116
117
  value: 'process_status',
117
- name: RulesMessage.getMessage('processStatus')
118
+ name: getLocaleText('CMD.processStatus', null, '流程状态')
118
119
  },
119
120
  checked: false,
120
121
  describe: 'ruleLine',
@@ -41,6 +41,10 @@ function _async_to_generator(fn) {
41
41
  });
42
42
  };
43
43
  }
44
+ function _call_super(_this, derived, args) {
45
+ derived = _get_prototype_of(derived);
46
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
47
+ }
44
48
  function _class_call_check(instance, Constructor) {
45
49
  if (!(instance instanceof Constructor)) {
46
50
  throw new TypeError("Cannot call a class as a function");
@@ -134,28 +138,12 @@ function _unsupported_iterable_to_array(o, minLen) {
134
138
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
135
139
  }
136
140
  function _is_native_reflect_construct() {
137
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
138
- if (Reflect.construct.sham) return false;
139
- if (typeof Proxy === "function") return true;
140
141
  try {
141
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
142
- return true;
143
- } catch (e) {
144
- return false;
145
- }
146
- }
147
- function _create_super(Derived) {
148
- var hasNativeReflectConstruct = _is_native_reflect_construct();
149
- return function _createSuperInternal() {
150
- var Super = _get_prototype_of(Derived), result;
151
- if (hasNativeReflectConstruct) {
152
- var NewTarget = _get_prototype_of(this).constructor;
153
- result = Reflect.construct(Super, arguments, NewTarget);
154
- } else {
155
- result = Super.apply(this, arguments);
156
- }
157
- return _possible_constructor_return(this, result);
158
- };
142
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
143
+ } catch (_) {}
144
+ return (_is_native_reflect_construct = function() {
145
+ return !!result;
146
+ })();
159
147
  }
160
148
  function _ts_generator(thisArg, body) {
161
149
  var f, y, t, g, _ = {
@@ -259,16 +247,12 @@ import { toSchema, getModelBindInfoList, checkSchema } from './utils';
259
247
  var Designer = /*#__PURE__*/ function _target(RegisterControls) {
260
248
  "use strict";
261
249
  _inherits(Designer, RegisterControls);
262
- var _super = _create_super(Designer);
263
250
  function Designer() {
264
251
  _class_call_check(this, Designer);
265
252
  var _this;
266
- _this = _super.call(this, 'Designer');
267
- _define_property(_assert_this_initialized(_this), "toolbox", []);
268
- _define_property(_assert_this_initialized(_this), "services", {});
269
- _define_property(_assert_this_initialized(_this), "eventLogic", new EventLogic());
270
- _define_property(_assert_this_initialized(_this), "fieldTypes", FieldTypes);
271
- _define_property(_assert_this_initialized(_this), "controlSettingMap", new Map());
253
+ _this = _call_super(this, Designer, [
254
+ 'Designer'
255
+ ]), _define_property(_this, "toolbox", []), _define_property(_this, "services", {}), _define_property(_this, "eventLogic", new EventLogic()), _define_property(_this, "fieldTypes", FieldTypes), _define_property(_this, "controlSettingMap", new Map());
272
256
  (_instanceof(this, Designer) ? this.constructor : void 0).staticControls.forEach(function(control) {
273
257
  var _$Designer = control.Designer, Setting = control.Setting;
274
258
  _this.controlSettingMap.set(_$Designer.controlType, Setting);
@@ -279,6 +263,7 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
279
263
  {
280
264
  key: "registerControl",
281
265
  value: function registerControl(control) {
266
+ ;
282
267
  this.constructor.register(control, 'Designer');
283
268
  var DesignerClass = control.Designer, Setting = control.Setting;
284
269
  this.register(DesignerClass);
@@ -15,6 +15,10 @@ function _assert_this_initialized(self) {
15
15
  }
16
16
  return self;
17
17
  }
18
+ function _call_super(_this, derived, args) {
19
+ derived = _get_prototype_of(derived);
20
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
21
+ }
18
22
  function _class_call_check(instance, Constructor) {
19
23
  if (!(instance instanceof Constructor)) {
20
24
  throw new TypeError("Cannot call a class as a function");
@@ -169,28 +173,12 @@ function _unsupported_iterable_to_array(o, minLen) {
169
173
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
170
174
  }
171
175
  function _is_native_reflect_construct() {
172
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
173
- if (Reflect.construct.sham) return false;
174
- if (typeof Proxy === "function") return true;
175
176
  try {
176
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
177
- return true;
178
- } catch (e) {
179
- return false;
180
- }
181
- }
182
- function _create_super(Derived) {
183
- var hasNativeReflectConstruct = _is_native_reflect_construct();
184
- return function _createSuperInternal() {
185
- var Super = _get_prototype_of(Derived), result;
186
- if (hasNativeReflectConstruct) {
187
- var NewTarget = _get_prototype_of(this).constructor;
188
- result = Reflect.construct(Super, arguments, NewTarget);
189
- } else {
190
- result = Super.apply(this, arguments);
191
- }
192
- return _possible_constructor_return(this, result);
193
- };
177
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
178
+ } catch (_) {}
179
+ return (_is_native_reflect_construct = function() {
180
+ return !!result;
181
+ })();
194
182
  }
195
183
  import { CONTROL_BASE_TYPE, error, genNonDuplicateId, isArray, isBuiltInControls, isObject, isString, updateValueFromKeys, warn, Watcher } from '@byteluck-fe/model-driven-shared';
196
184
  import { findInstanceDataScopeParent, Store } from './Store';
@@ -198,7 +186,7 @@ import { Designer } from './Designer';
198
186
  import EventLogic from './EventLogic';
199
187
  import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from './utils';
200
188
  import { Group, initSettings, Tab } from '@byteluck-fe/model-driven-settings';
201
- import { RulesMessage, DEFAULT_LOCALE } from '@byteluck-fe/model-driven-shared';
189
+ import { DEFAULT_LOCALE } from '@byteluck-fe/model-driven-shared';
202
190
  // 当前正在注册的插件名称
203
191
  var applyingPluginName = '';
204
192
  /**
@@ -206,40 +194,25 @@ var applyingPluginName = '';
206
194
  * */ var Driven = /*#__PURE__*/ function(Watcher) {
207
195
  "use strict";
208
196
  _inherits(Driven, Watcher);
209
- var _super = _create_super(Driven);
210
197
  function Driven(options) {
211
198
  _class_call_check(this, Driven);
212
199
  var _this;
213
- _this = _super.call(this);
214
- _define_property(_assert_this_initialized(_this), "mode", void 0);
215
- _define_property(_assert_this_initialized(_this), "isMounted", false);
216
- _define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
217
- /**
200
+ _this = _call_super(this, Driven), _define_property(_this, "mode", void 0), _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), /**
218
201
  * 控件可选的事件
219
- * */ _define_property(_assert_this_initialized(_this), "eventLogic", void 0);
220
- /**
202
+ * */ _define_property(_this, "eventLogic", void 0), /**
221
203
  * 处理数据存储,存放模型等
222
- * */ _define_property(_assert_this_initialized(_this), "store", void 0);
223
- /**
204
+ * */ _define_property(_this, "store", void 0), /**
224
205
  * 额外参数存储
225
- */ _define_property(_assert_this_initialized(_this), "externalParams", void 0);
226
- /**
206
+ */ _define_property(_this, "externalParams", void 0), /**
227
207
  * 处理instance,和schema存储
228
- * */ _define_property(_assert_this_initialized(_this), "designer", void 0);
229
- /**
208
+ * */ _define_property(_this, "designer", void 0), /**
230
209
  * 插件数组
231
- * */ _define_property(_assert_this_initialized(_this), "__plugins", void 0);
232
- _define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
233
- _define_property(_assert_this_initialized(_this), "$options", void 0);
234
- // TODO 拿到schema
235
- _define_property(_assert_this_initialized(_this), "getSchema", toSchema);
236
- // TODO 拿到model_bind_info_list
237
- _define_property(_assert_this_initialized(_this), "getModelBindInfoList", getModelBindInfoList);
238
- // TODO 拿到permission_controls
239
- _define_property(_assert_this_initialized(_this), "generatePermissions", generatePermissions);
210
+ * */ _define_property(_this, "__plugins", void 0), _define_property(_this, "__pluginsApplied", false), _define_property(_this, "$options", void 0), // TODO 拿到schema
211
+ _define_property(_this, "getSchema", toSchema), // TODO 拿到model_bind_info_list
212
+ _define_property(_this, "getModelBindInfoList", getModelBindInfoList), // TODO 拿到permission_controls
213
+ _define_property(_this, "generatePermissions", generatePermissions);
240
214
  _this.$options = Object.freeze(options);
241
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;
242
- RulesMessage.setLocale(language, messagesI18n);
243
216
  _this.eventLogic = new EventLogic();
244
217
  _this.designer = new DesignerClass();
245
218
  _this.store = new Store(_object_spread({
package/dist/esm/Store.js CHANGED
@@ -294,9 +294,11 @@ function setInstanceInDataFieldCodeMap(instance, dataFieldCodeMap) {
294
294
  if (isDataBind(dataBind)) {
295
295
  setDataFieldCodeMap(dataFieldCodeMap, dataBind, instance);
296
296
  } else {
297
- Object.values(dataBind).forEach(function(subDataBind) {
298
- setDataFieldCodeMap(dataFieldCodeMap, subDataBind, instance);
299
- });
297
+ if (dataBind) {
298
+ Object.values(dataBind).forEach(function(subDataBind) {
299
+ setDataFieldCodeMap(dataFieldCodeMap, subDataBind, instance);
300
+ });
301
+ }
300
302
  }
301
303
  }
302
304
  }
@@ -1,4 +1,5 @@
1
- import { CONTROL_TYPE, FieldTypes, RulesMessage } from '@byteluck-fe/model-driven-shared';
1
+ import { getLocaleText } from '@byteluck-fe/locale-message';
2
+ import { CONTROL_TYPE, FieldTypes } from '@byteluck-fe/model-driven-shared';
2
3
  // 使用ObjectDataBind 的控件
3
4
  export var objectDataBindControlTypes = [
4
5
  CONTROL_TYPE.AMOUNT,
@@ -7,27 +8,27 @@ export var objectDataBindControlTypes = [
7
8
  ];
8
9
  export var objectDataBindKeyToFieldType = {
9
10
  amount: {
10
- caption: RulesMessage.getMessage('amount'),
11
+ caption: getLocaleText('CMD.amount', null, '金额'),
11
12
  fieldType: FieldTypes.DECIMAL
12
13
  },
13
14
  currency: {
14
- caption: RulesMessage.getMessage('currency'),
15
+ caption: getLocaleText('CMD.currency', null, '币种'),
15
16
  fieldType: FieldTypes.VARCHAR
16
17
  },
17
18
  result: {
18
- caption: RulesMessage.getMessage('result'),
19
+ caption: getLocaleText('CMD.result', null, '结果'),
19
20
  fieldType: FieldTypes.DECIMAL
20
21
  },
21
22
  unit: {
22
- caption: RulesMessage.getMessage('unit'),
23
+ caption: getLocaleText('CMD.unit', null, '单位'),
23
24
  fieldType: FieldTypes.VARCHAR
24
25
  },
25
26
  min: {
26
- caption: RulesMessage.getMessage('startTime'),
27
+ caption: getLocaleText('CMD.startTime', null, '开始时间'),
27
28
  fieldType: FieldTypes.TIMESTAMP
28
29
  },
29
30
  max: {
30
- caption: RulesMessage.getMessage('endTime'),
31
+ caption: getLocaleText('CMD.endTime', null, '结束时间'),
31
32
  fieldType: FieldTypes.TIMESTAMP
32
33
  }
33
34
  };
package/dist/esm/utils.js CHANGED
@@ -183,8 +183,9 @@ 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, RulesMessage } from '@byteluck-fe/model-driven-shared';
186
+ isArray } from '@byteluck-fe/model-driven-shared';
187
187
  import { objectDataBindControlTypes } from './constants';
188
+ import { getLocaleText } from '@byteluck-fe/locale-message';
188
189
  export function getMasterFormControls(controls) {
189
190
  var formctls = [];
190
191
  // @ts-ignore
@@ -216,6 +217,7 @@ export function getMasterFormControls(controls) {
216
217
  dataBind.dataCode = dataCode;
217
218
  });
218
219
  } else {
220
+ ;
219
221
  item.dataBind.fieldCode = fieldCodeBeforeAddPrefix(item.controlId);
220
222
  item.dataBind.dataCode = dataCode;
221
223
  }
@@ -322,15 +324,15 @@ var cannotEditControlTypes = [
322
324
  var LIST_OPERATION_BUTTON_PERMISSIONS_MAPS = {
323
325
  check: {
324
326
  id: 'listPageCheckBtnId',
325
- caption: RulesMessage.getMessage('view')
327
+ caption: getLocaleText('CMD.view', null, '查看')
326
328
  },
327
329
  edit: {
328
330
  id: 'listPageEditBtnId',
329
- caption: RulesMessage.getMessage('edit')
331
+ caption: getLocaleText('CMD.edit', null, '编辑')
330
332
  },
331
333
  delete: {
332
334
  id: 'listPageDeleteBtnId',
333
- caption: RulesMessage.getMessage('delete')
335
+ caption: getLocaleText('CMD.delete', null, '删除')
334
336
  }
335
337
  };
336
338
  // 生成权限字段