@byteluck-fe/model-driven-driven 2.23.0-beta.1 → 2.23.0-beta.3

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.
@@ -15,6 +15,8 @@ interface DrivenOptions {
15
15
  mode?: string;
16
16
  schema: SchemaBaseType | SchemaBaseType[];
17
17
  store?: Omit<StoreOptions, 'instance'>;
18
+ messagesI18n?: Object;
19
+ language?: string;
18
20
  }
19
21
  /**
20
22
  * 设计器驱动
@@ -71,9 +73,9 @@ declare class Driven extends Watcher<EventKeys> {
71
73
  createInstance<T extends ControlsKeys>(type: T, initSchema?: DeepPartial<Schema<T>>): ControlDesignerInstance<T> | undefined;
72
74
  getInstance(instanceId: DesignerControl | string): DesignerControl | undefined;
73
75
  getInstances(): DesignerControl[];
74
- getInstancesFromType<T extends ControlsKeys>(type: T): InstanceType<import("@byteluck-fe/model-driven-core").ControlDesigner<T>>[];
76
+ getInstancesFromType<T extends ControlsKeys>(type: T): InstanceType<import("@byteluck-fe/model-driven-core/dist/types").ControlDesigner<T>>[];
75
77
  getDataScopeInstances(): DesignerControl[];
76
- getDataScopeInstancesFromType<T extends ControlsKeys>(type: T): InstanceType<import("@byteluck-fe/model-driven-core").ControlDesigner<T>>[];
78
+ getDataScopeInstancesFromType<T extends ControlsKeys>(type: T): InstanceType<import("@byteluck-fe/model-driven-core/dist/types").ControlDesigner<T>>[];
77
79
  private updateInstancePropValue;
78
80
  private updateInstanceProps;
79
81
  setInstance<T extends DesignerControl>(instance: T, props: DeepPartial<T['props']>, payload?: any): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byteluck-fe/model-driven-driven",
3
- "version": "2.23.0-beta.1",
3
+ "version": "2.23.0-beta.3",
4
4
  "description": "> TODO: description",
5
5
  "author": "郝晨光 <2293885211@qq.com>",
6
6
  "homepage": "",
@@ -26,10 +26,10 @@
26
26
  "postpublish": "node ../../scripts/postpublish.js"
27
27
  },
28
28
  "dependencies": {
29
- "@byteluck-fe/model-driven-controls": "2.23.0-beta.1",
29
+ "@byteluck-fe/model-driven-controls": "2.23.0-beta.3",
30
30
  "@byteluck-fe/model-driven-core": "2.22.1-beta.2",
31
31
  "@byteluck-fe/model-driven-settings": "2.22.1-beta.2",
32
32
  "@byteluck-fe/model-driven-shared": "2.22.1-beta.2"
33
33
  },
34
- "gitHead": "73168cf7a11e0aa2b6b060545ff23e194a041fe1"
34
+ "gitHead": "4233299d1ab2a863ee7b44db8e2fa3cdf83af820"
35
35
  }
@@ -1,186 +0,0 @@
1
- function _class_call_check(instance, Constructor) {
2
- if (!(instance instanceof Constructor)) {
3
- throw new TypeError("Cannot call a class as a function");
4
- }
5
- }
6
- function _defineProperties(target, props) {
7
- for(var i = 0; i < props.length; i++){
8
- var descriptor = props[i];
9
- descriptor.enumerable = descriptor.enumerable || false;
10
- descriptor.configurable = true;
11
- if ("value" in descriptor) descriptor.writable = true;
12
- Object.defineProperty(target, descriptor.key, descriptor);
13
- }
14
- }
15
- function _create_class(Constructor, protoProps, staticProps) {
16
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
17
- if (staticProps) _defineProperties(Constructor, staticProps);
18
- return Constructor;
19
- }
20
- function _define_property(obj, key, value) {
21
- if (key in obj) {
22
- Object.defineProperty(obj, key, {
23
- value: value,
24
- enumerable: true,
25
- configurable: true,
26
- writable: true
27
- });
28
- } else {
29
- obj[key] = value;
30
- }
31
- return obj;
32
- }
33
- import Designer from './Designer';
34
- import { CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
35
- export var Builder = /*#__PURE__*/ function() {
36
- "use strict";
37
- function Builder() {
38
- _class_call_check(this, Builder);
39
- _define_property(this, "designer", new Designer());
40
- }
41
- _create_class(Builder, [
42
- {
43
- key: "ListPageBuilder",
44
- value: // @ts-ignore
45
- function ListPageBuilder() {
46
- var listview = this.designer.createControlInstance(// @ts-ignore
47
- CONTROL_TYPE.LIST_VIEW);
48
- var simpleSearch = this.designer.createControlInstance(// @ts-ignore
49
- CONTROL_TYPE.SIMPLE_SEARCH);
50
- var gridTable = this.designer.createControlInstance(// @ts-ignore
51
- CONTROL_TYPE.GRID_TABLE);
52
- var createBtn = this.designer.createControlInstance(// @ts-ignore
53
- CONTROL_TYPE.CREATE_FORM_LIST_BUTTON);
54
- var importBtn = this.designer.createControlInstance(// @ts-ignore
55
- CONTROL_TYPE.IMPORT_RECORD_LIST_BUTTON);
56
- var exportBtn = this.designer.createControlInstance(// @ts-ignore
57
- CONTROL_TYPE.EXPORT_LIST_BUTTON);
58
- var exportRecordBtn = this.designer.createControlInstance(// @ts-ignore
59
- CONTROL_TYPE.EXPORT_RECORD_LIST_BUTTON);
60
- // @ts-ignore
61
- gridTable.children.push(createBtn);
62
- // @ts-ignore
63
- gridTable.children.push(importBtn);
64
- // @ts-ignore
65
- gridTable.children.push(exportBtn);
66
- // @ts-ignore
67
- gridTable.children.push(exportRecordBtn);
68
- // @ts-ignore
69
- listview.children.push(simpleSearch);
70
- // @ts-ignore
71
- listview.children.push(gridTable);
72
- return listview;
73
- }
74
- },
75
- {
76
- key: "ProListPageBuilder",
77
- value: // @ts-ignore
78
- function ProListPageBuilder() {
79
- // @ts-ignore
80
- var listview = this.designer.createControlInstance(// @ts-ignore
81
- CONTROL_TYPE.LIST_VIEW);
82
- listview.props.countType = 'async';
83
- var simpleSearch = this.designer.createControlInstance(// @ts-ignore
84
- CONTROL_TYPE.SIMPLE_SEARCH);
85
- var gridTable = this.designer.createControlInstance(// @ts-ignore
86
- CONTROL_TYPE.GRID_TABLE);
87
- // @ts-ignore
88
- var exportBtn = this.designer.createControlInstance(// @ts-ignore
89
- CONTROL_TYPE.EXPORT_LIST_BUTTON);
90
- var exportRecordBtn = this.designer.createControlInstance(// @ts-ignore
91
- CONTROL_TYPE.EXPORT_RECORD_LIST_BUTTON);
92
- // @ts-ignore
93
- gridTable.children.push(exportBtn);
94
- // @ts-ignore
95
- gridTable.children.push(exportRecordBtn);
96
- // @ts-ignore
97
- listview.children.push(simpleSearch);
98
- // @ts-ignore
99
- listview.children.push(gridTable);
100
- listview.props.rowStyle = {
101
- type: 'rules',
102
- "interval": {
103
- "color": ""
104
- },
105
- rules: [
106
- {
107
- id: 'default',
108
- name: '审批通过单据',
109
- color: 'theme',
110
- filters: [
111
- {
112
- ruleId: 1,
113
- symbol: 'op_equal',
114
- leftVariableBo: {
115
- type: 'varchar',
116
- value: 'process_status',
117
- name: '流程状态'
118
- },
119
- checked: false,
120
- describe: 'ruleLine',
121
- type: 'condition',
122
- rightVariableBo: {
123
- type: 'custom',
124
- value: [
125
- 'COMPLETE'
126
- ],
127
- displayBos: []
128
- },
129
- isLowPerformance: false,
130
- isMoreRelation: false
131
- }
132
- ],
133
- "settings": [
134
- {
135
- "color": "theme",
136
- "field_codes": [
137
- "process_status"
138
- ],
139
- "type": "fontColor",
140
- "scope": "col"
141
- }
142
- ],
143
- script: "(SpecialMatch(data,sys,'process_status','varchar','op_equal','COMPLETE'))"
144
- }
145
- ]
146
- };
147
- return listview;
148
- }
149
- },
150
- {
151
- key: "FormPageBuilder",
152
- value: // @ts-ignore
153
- function FormPageBuilder() {
154
- var dataView = this.designer.createControlInstance(// @ts-ignore
155
- CONTROL_TYPE.DATA_VIEW);
156
- // @ts-ignore
157
- var title = this.designer.createControlInstance(CONTROL_TYPE.TITLE);
158
- // @ts-ignore
159
- var grid = this.designer.createControlInstance(CONTROL_TYPE.GRID);
160
- // @ts-ignore
161
- dataView.children.push(title);
162
- // @ts-ignore
163
- dataView.children.push(grid);
164
- return dataView;
165
- }
166
- },
167
- {
168
- key: "VuePageBuilder",
169
- value: // @ts-ignore
170
- function VuePageBuilder() {
171
- var grid = this.designer.createControlInstance(// @ts-ignore
172
- CONTROL_TYPE.GRID);
173
- var vueFormItem = this.designer.createControlInstance(// @ts-ignore
174
- CONTROL_TYPE.VUE_PAGE);
175
- // @ts-ignore
176
- vueFormItem.props.isHideCaption = true;
177
- // @ts-ignore
178
- vueFormItem.props.controlExportName = 'VuePage';
179
- // @ts-ignore
180
- grid.children.push(vueFormItem);
181
- return grid;
182
- }
183
- }
184
- ]);
185
- return Builder;
186
- }();
@@ -1,378 +0,0 @@
1
- function _array_like_to_array(arr, len) {
2
- if (len == null || len > arr.length) len = arr.length;
3
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
- return arr2;
5
- }
6
- function _array_without_holes(arr) {
7
- if (Array.isArray(arr)) return _array_like_to_array(arr);
8
- }
9
- function _assert_this_initialized(self) {
10
- if (self === void 0) {
11
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12
- }
13
- return self;
14
- }
15
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
16
- try {
17
- var info = gen[key](arg);
18
- var value = info.value;
19
- } catch (error) {
20
- reject(error);
21
- return;
22
- }
23
- if (info.done) {
24
- resolve(value);
25
- } else {
26
- Promise.resolve(value).then(_next, _throw);
27
- }
28
- }
29
- function _async_to_generator(fn) {
30
- return function() {
31
- var self = this, args = arguments;
32
- return new Promise(function(resolve, reject) {
33
- var gen = fn.apply(self, args);
34
- function _next(value) {
35
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
36
- }
37
- function _throw(err) {
38
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
39
- }
40
- _next(undefined);
41
- });
42
- };
43
- }
44
- function _class_call_check(instance, Constructor) {
45
- if (!(instance instanceof Constructor)) {
46
- throw new TypeError("Cannot call a class as a function");
47
- }
48
- }
49
- function _defineProperties(target, props) {
50
- for(var i = 0; i < props.length; i++){
51
- var descriptor = props[i];
52
- descriptor.enumerable = descriptor.enumerable || false;
53
- descriptor.configurable = true;
54
- if ("value" in descriptor) descriptor.writable = true;
55
- Object.defineProperty(target, descriptor.key, descriptor);
56
- }
57
- }
58
- function _create_class(Constructor, protoProps, staticProps) {
59
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
60
- if (staticProps) _defineProperties(Constructor, staticProps);
61
- return Constructor;
62
- }
63
- function _define_property(obj, key, value) {
64
- if (key in obj) {
65
- Object.defineProperty(obj, key, {
66
- value: value,
67
- enumerable: true,
68
- configurable: true,
69
- writable: true
70
- });
71
- } else {
72
- obj[key] = value;
73
- }
74
- return obj;
75
- }
76
- function _get_prototype_of(o) {
77
- _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
78
- return o.__proto__ || Object.getPrototypeOf(o);
79
- };
80
- return _get_prototype_of(o);
81
- }
82
- function _inherits(subClass, superClass) {
83
- if (typeof superClass !== "function" && superClass !== null) {
84
- throw new TypeError("Super expression must either be null or a function");
85
- }
86
- subClass.prototype = Object.create(superClass && superClass.prototype, {
87
- constructor: {
88
- value: subClass,
89
- writable: true,
90
- configurable: true
91
- }
92
- });
93
- if (superClass) _set_prototype_of(subClass, superClass);
94
- }
95
- function _instanceof(left, right) {
96
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
97
- return !!right[Symbol.hasInstance](left);
98
- } else {
99
- return left instanceof right;
100
- }
101
- }
102
- function _iterable_to_array(iter) {
103
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
104
- }
105
- function _non_iterable_spread() {
106
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
107
- }
108
- function _possible_constructor_return(self, call) {
109
- if (call && (_type_of(call) === "object" || typeof call === "function")) {
110
- return call;
111
- }
112
- return _assert_this_initialized(self);
113
- }
114
- function _set_prototype_of(o, p) {
115
- _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
116
- o.__proto__ = p;
117
- return o;
118
- };
119
- return _set_prototype_of(o, p);
120
- }
121
- function _to_consumable_array(arr) {
122
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
123
- }
124
- function _type_of(obj) {
125
- "@swc/helpers - typeof";
126
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
127
- }
128
- function _unsupported_iterable_to_array(o, minLen) {
129
- if (!o) return;
130
- if (typeof o === "string") return _array_like_to_array(o, minLen);
131
- var n = Object.prototype.toString.call(o).slice(8, -1);
132
- if (n === "Object" && o.constructor) n = o.constructor.name;
133
- if (n === "Map" || n === "Set") return Array.from(n);
134
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
135
- }
136
- 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
- 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
- };
159
- }
160
- function _ts_generator(thisArg, body) {
161
- var f, y, t, g, _ = {
162
- label: 0,
163
- sent: function() {
164
- if (t[0] & 1) throw t[1];
165
- return t[1];
166
- },
167
- trys: [],
168
- ops: []
169
- };
170
- return g = {
171
- next: verb(0),
172
- "throw": verb(1),
173
- "return": verb(2)
174
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
175
- return this;
176
- }), g;
177
- function verb(n) {
178
- return function(v) {
179
- return step([
180
- n,
181
- v
182
- ]);
183
- };
184
- }
185
- function step(op) {
186
- if (f) throw new TypeError("Generator is already executing.");
187
- while(_)try {
188
- 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;
189
- if (y = 0, t) op = [
190
- op[0] & 2,
191
- t.value
192
- ];
193
- switch(op[0]){
194
- case 0:
195
- case 1:
196
- t = op;
197
- break;
198
- case 4:
199
- _.label++;
200
- return {
201
- value: op[1],
202
- done: false
203
- };
204
- case 5:
205
- _.label++;
206
- y = op[1];
207
- op = [
208
- 0
209
- ];
210
- continue;
211
- case 7:
212
- op = _.ops.pop();
213
- _.trys.pop();
214
- continue;
215
- default:
216
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
217
- _ = 0;
218
- continue;
219
- }
220
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
221
- _.label = op[1];
222
- break;
223
- }
224
- if (op[0] === 6 && _.label < t[1]) {
225
- _.label = t[1];
226
- t = op;
227
- break;
228
- }
229
- if (t && _.label < t[2]) {
230
- _.label = t[2];
231
- _.ops.push(op);
232
- break;
233
- }
234
- if (t[2]) _.ops.pop();
235
- _.trys.pop();
236
- continue;
237
- }
238
- op = body.call(thisArg, _);
239
- } catch (e) {
240
- op = [
241
- 6,
242
- e
243
- ];
244
- y = 0;
245
- } finally{
246
- f = t = 0;
247
- }
248
- if (op[0] & 5) throw op[1];
249
- return {
250
- value: op[0] ? op[1] : void 0,
251
- done: true
252
- };
253
- }
254
- }
255
- import { RegisterControls, controlHooksEmitter } from '@byteluck-fe/model-driven-core';
256
- import EventLogic from './EventLogic';
257
- import { FieldTypes } from '@byteluck-fe/model-driven-shared';
258
- import { toSchema, getModelBindInfoList, checkSchema } from './utils';
259
- var Designer = /*#__PURE__*/ function _target(RegisterControls) {
260
- "use strict";
261
- _inherits(Designer, RegisterControls);
262
- var _super = _create_super(Designer);
263
- function Designer() {
264
- _class_call_check(this, Designer);
265
- 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());
272
- (_instanceof(this, Designer) ? this.constructor : void 0).staticControls.forEach(function(control) {
273
- var _$Designer = control.Designer, Setting = control.Setting;
274
- _this.controlSettingMap.set(_$Designer.controlType, Setting);
275
- });
276
- return _this;
277
- }
278
- _create_class(Designer, [
279
- {
280
- key: "registerControl",
281
- value: function registerControl(control) {
282
- this.constructor.register(control, 'Designer');
283
- var DesignerClass = control.Designer, Setting = control.Setting;
284
- this.register(DesignerClass);
285
- this.registeredControlTypes.add(DesignerClass.controlType);
286
- this.controlSettingMap.set(DesignerClass.controlType, Setting);
287
- }
288
- },
289
- {
290
- key: "getControlSetting",
291
- value: function getControlSetting(type) {
292
- var setting = this.controlSettingMap.get(type);
293
- if (!setting) {
294
- return null;
295
- }
296
- return setting;
297
- }
298
- },
299
- {
300
- key: "setInstance",
301
- value: function setInstance(instance, props, value) {
302
- try {
303
- if (!instance) {
304
- return;
305
- }
306
- // @ts-ignore
307
- instance.updateProps(props, value);
308
- } catch (e) {
309
- throw e;
310
- }
311
- }
312
- },
313
- {
314
- key: "eachControls",
315
- value: function eachControls(callback) {
316
- this.getControls().forEach(callback);
317
- }
318
- },
319
- {
320
- key: "getInitControl",
321
- value: // 获取初始化的数据模型
322
- function getInitControl() {
323
- // @ts-ignore
324
- return [
325
- this.createControlInstance('grid')
326
- ];
327
- }
328
- },
329
- {
330
- key: "checkSchema",
331
- value: function checkSchema1() {
332
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
333
- args[_key] = arguments[_key];
334
- }
335
- return _async_to_generator(function() {
336
- return _ts_generator(this, function(_state) {
337
- return [
338
- 2,
339
- checkSchema.apply(void 0, _to_consumable_array(args))
340
- ];
341
- });
342
- })();
343
- }
344
- },
345
- {
346
- key: "getModelBindInfoList",
347
- value: function getModelBindInfoList1() {
348
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
349
- args[_key] = arguments[_key];
350
- }
351
- return getModelBindInfoList.apply(void 0, _to_consumable_array(args));
352
- }
353
- },
354
- {
355
- key: "getSchema",
356
- value: function getSchema() {
357
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
358
- args[_key] = arguments[_key];
359
- }
360
- return toSchema.apply(void 0, _to_consumable_array(args));
361
- }
362
- },
363
- {
364
- key: "listenControlHook",
365
- value: function listenControlHook() {
366
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
367
- args[_key] = arguments[_key];
368
- }
369
- var _controlHooksEmitter;
370
- return (_controlHooksEmitter = controlHooksEmitter).on.apply(_controlHooksEmitter, _to_consumable_array(args));
371
- }
372
- }
373
- ]);
374
- return Designer;
375
- }(RegisterControls);
376
- _define_property(Designer, "EventLogic", EventLogic);
377
- export { Designer as default };
378
- export { Designer };