@byteluck-fe/model-driven-shared 2.22.2-beta.7 → 2.22.3-beta.1
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 +29 -29
- package/dist/esm/EventLogic.js +112 -121
- package/dist/esm/RulesMessage.js +18 -17
- package/dist/esm/calc.js +35 -35
- package/dist/esm/entity/Department.js +7 -7
- package/dist/esm/entity/User.js +39 -39
- package/dist/esm/enum.js +75 -74
- package/dist/esm/locales/en-US.json +2 -1
- package/dist/esm/locales/ja-JP.json +2 -1
- package/dist/esm/locales/zh-CN.json +17 -2
- package/dist/esm/log.js +15 -25
- package/dist/esm/updateValueFromKeys.js +6 -6
- package/dist/esm/utils.js +10 -10
- package/dist/index.umd.js +1 -45
- package/dist/types/EventLogic.d.ts +305 -217
- package/dist/types/RulesMessage.d.ts +13 -13
- package/dist/types/calc.d.ts +74 -74
- package/dist/types/constant.d.ts +2 -2
- package/dist/types/entity/Department.d.ts +15 -15
- package/dist/types/entity/User.d.ts +85 -85
- package/dist/types/entity/index.d.ts +2 -2
- package/dist/types/enum.d.ts +269 -268
- package/dist/types/genNonDuplicateId.d.ts +1 -1
- package/dist/types/index.d.ts +13 -13
- package/dist/types/locales/index.d.ts +551 -534
- package/dist/types/log.d.ts +5 -5
- package/dist/types/loopControls.d.ts +1 -1
- package/dist/types/updateValueFromKeys.d.ts +8 -8
- package/dist/types/utils.d.ts +53 -53
- package/dist/types/watcher.d.ts +14 -14
- package/package.json +3 -2
package/dist/esm/enum.js
CHANGED
|
@@ -10,23 +10,23 @@ export var CONTROL_BASE_TYPE;
|
|
|
10
10
|
})(CONTROL_BASE_TYPE || (CONTROL_BASE_TYPE = {}));
|
|
11
11
|
export var FORM_TYPE;
|
|
12
12
|
(function(FORM_TYPE) {
|
|
13
|
-
/**
|
|
14
|
-
* 表单
|
|
13
|
+
/**
|
|
14
|
+
* 表单
|
|
15
15
|
* */ FORM_TYPE[FORM_TYPE["FORM"] = 0] = "FORM";
|
|
16
|
-
/**
|
|
17
|
-
* 列表
|
|
16
|
+
/**
|
|
17
|
+
* 列表
|
|
18
18
|
* */ FORM_TYPE[FORM_TYPE["LIST"] = 1] = "LIST";
|
|
19
|
-
/**
|
|
20
|
-
* 报表
|
|
19
|
+
/**
|
|
20
|
+
* 报表
|
|
21
21
|
* */ FORM_TYPE[FORM_TYPE["REPORT"] = 2] = "REPORT";
|
|
22
|
-
/**
|
|
23
|
-
* 仪表盘
|
|
22
|
+
/**
|
|
23
|
+
* 仪表盘
|
|
24
24
|
* */ FORM_TYPE[FORM_TYPE["DASHBOARD"] = 3] = "DASHBOARD";
|
|
25
|
-
/**
|
|
26
|
-
* Vue页面
|
|
25
|
+
/**
|
|
26
|
+
* Vue页面
|
|
27
27
|
* */ FORM_TYPE[FORM_TYPE["VUE"] = 4] = "VUE";
|
|
28
|
-
/**
|
|
29
|
-
* 自由页面
|
|
28
|
+
/**
|
|
29
|
+
* 自由页面
|
|
30
30
|
* */ FORM_TYPE[FORM_TYPE["FREE_PAGE"] = 5] = "FREE_PAGE";
|
|
31
31
|
})(FORM_TYPE || (FORM_TYPE = {}));
|
|
32
32
|
export var CONTROL_TYPE;
|
|
@@ -137,92 +137,93 @@ export var CONTROL_TYPE;
|
|
|
137
137
|
// grid_wrap 必须结合 grid-layout-container
|
|
138
138
|
CONTROL_TYPE["GRID_LAYOUT_WRAP"] = "grid-layout-wrap";
|
|
139
139
|
CONTROL_TYPE["VUE_PAGE"] = "vue-page";
|
|
140
|
+
CONTROL_TYPE["REFERENCE_LIST"] = "reference-list";
|
|
140
141
|
})(CONTROL_TYPE || (CONTROL_TYPE = {}));
|
|
141
142
|
export var OPT_TYPES;
|
|
142
143
|
(function(OPT_TYPES) {
|
|
143
|
-
/**
|
|
144
|
-
* 保存
|
|
144
|
+
/**
|
|
145
|
+
* 保存
|
|
145
146
|
* */ OPT_TYPES["SAVE"] = "save";
|
|
146
|
-
/**
|
|
147
|
-
* 草稿
|
|
147
|
+
/**
|
|
148
|
+
* 草稿
|
|
148
149
|
* */ OPT_TYPES["DRAFT"] = "draft";
|
|
149
|
-
/**
|
|
150
|
-
* 撤回
|
|
150
|
+
/**
|
|
151
|
+
* 撤回
|
|
151
152
|
* */ OPT_TYPES["UNSUBMIT"] = "unsubmit";
|
|
152
|
-
/**
|
|
153
|
-
* 审核
|
|
153
|
+
/**
|
|
154
|
+
* 审核
|
|
154
155
|
* */ OPT_TYPES["AUDIT"] = "audit";
|
|
155
|
-
/**
|
|
156
|
-
* 反审核
|
|
156
|
+
/**
|
|
157
|
+
* 反审核
|
|
157
158
|
* */ OPT_TYPES["UNAUDIT"] = "unaudit";
|
|
158
|
-
/**
|
|
159
|
-
* 取消
|
|
159
|
+
/**
|
|
160
|
+
* 取消
|
|
160
161
|
* */ OPT_TYPES["CANCEL"] = "cancel";
|
|
161
|
-
/**
|
|
162
|
-
* 提交
|
|
162
|
+
/**
|
|
163
|
+
* 提交
|
|
163
164
|
* */ OPT_TYPES["FORM_SUBMIT"] = "form_submit";
|
|
164
165
|
})(OPT_TYPES || (OPT_TYPES = {}));
|
|
165
166
|
export var FieldTypes;
|
|
166
167
|
(function(FieldTypes) {
|
|
167
|
-
/**
|
|
168
|
-
* 短文本,string
|
|
168
|
+
/**
|
|
169
|
+
* 短文本,string
|
|
169
170
|
* */ FieldTypes["VARCHAR"] = "varchar";
|
|
170
|
-
/**
|
|
171
|
-
* 长文本, string
|
|
171
|
+
/**
|
|
172
|
+
* 长文本, string
|
|
172
173
|
* */ FieldTypes["TEXT"] = "text";
|
|
173
|
-
/**
|
|
174
|
-
* 数组, Array<string>
|
|
174
|
+
/**
|
|
175
|
+
* 数组, Array<string>
|
|
175
176
|
* */ FieldTypes["ARRAY"] = "array";
|
|
176
|
-
/**
|
|
177
|
-
* 地址, AddressValue { city:string, district:string, province: string }
|
|
177
|
+
/**
|
|
178
|
+
* 地址, AddressValue { city:string, district:string, province: string }
|
|
178
179
|
* */ FieldTypes["ADDRESS"] = "location";
|
|
179
|
-
/**
|
|
180
|
-
* 数字, number
|
|
180
|
+
/**
|
|
181
|
+
* 数字, number
|
|
181
182
|
* */ FieldTypes["DECIMAL"] = "decimal";
|
|
182
183
|
// /**
|
|
183
184
|
// * 数值(decimal), number
|
|
184
185
|
// * */
|
|
185
186
|
// REAL_DECIMAL = 'real-decimal',
|
|
186
|
-
/**
|
|
187
|
-
* 数字区间, Array<number>
|
|
187
|
+
/**
|
|
188
|
+
* 数字区间, Array<number>
|
|
188
189
|
* */ FieldTypes["DECIMAL_RANGE"] = "decimal_range";
|
|
189
|
-
/**
|
|
190
|
-
* 日期, 时间戳字符串 string
|
|
190
|
+
/**
|
|
191
|
+
* 日期, 时间戳字符串 string
|
|
191
192
|
* */ FieldTypes["TIMESTAMP"] = "timestamp";
|
|
192
193
|
// /**
|
|
193
194
|
// * 日期(datetime), 时间戳字符串 string
|
|
194
195
|
// * */
|
|
195
196
|
// DATETIME = 'datetime',
|
|
196
|
-
/**
|
|
197
|
-
* 人员, Array<人员id string>
|
|
197
|
+
/**
|
|
198
|
+
* 人员, Array<人员id string>
|
|
198
199
|
* */ FieldTypes["EMPLOYEES"] = "people";
|
|
199
|
-
/**
|
|
200
|
-
* 部门, Array<部门id string>
|
|
200
|
+
/**
|
|
201
|
+
* 部门, Array<部门id string>
|
|
201
202
|
* */ FieldTypes["DEPARTMENTS"] = "department";
|
|
202
|
-
/**
|
|
203
|
-
* 金额, AmountValue { amount: number, currency: string }
|
|
203
|
+
/**
|
|
204
|
+
* 金额, AmountValue { amount: number, currency: string }
|
|
204
205
|
* */ FieldTypes["MONEY"] = "money";
|
|
205
|
-
/**
|
|
206
|
-
* 日期区间, DateRangeValue { max: string, min: string }
|
|
206
|
+
/**
|
|
207
|
+
* 日期区间, DateRangeValue { max: string, min: string }
|
|
207
208
|
* */ FieldTypes["TIMESCOPE"] = "timescope";
|
|
208
|
-
/**
|
|
209
|
-
* 附件, Array<附件id string>
|
|
209
|
+
/**
|
|
210
|
+
* 附件, Array<附件id string>
|
|
210
211
|
* */ FieldTypes["FILE"] = "file";
|
|
211
|
-
/**
|
|
212
|
-
* 图片, Array<图片id string>
|
|
212
|
+
/**
|
|
213
|
+
* 图片, Array<图片id string>
|
|
213
214
|
* */ FieldTypes["IMAGE"] = "image";
|
|
214
|
-
/**
|
|
215
|
-
* 自动编号, string
|
|
215
|
+
/**
|
|
216
|
+
* 自动编号, string
|
|
216
217
|
* */ FieldTypes["AUTO_NUMBER"] = "auto_number";
|
|
217
|
-
/**
|
|
218
|
-
* 计算公式, CalcValue { result: number, unit: string }
|
|
218
|
+
/**
|
|
219
|
+
* 计算公式, CalcValue { result: number, unit: string }
|
|
219
220
|
* */ FieldTypes["CALC"] = "calc";
|
|
220
221
|
// /**
|
|
221
222
|
// * 关联键, string
|
|
222
223
|
// * */
|
|
223
224
|
// RELATION = 'relation',
|
|
224
|
-
/**
|
|
225
|
-
* 列表 Array<any>
|
|
225
|
+
/**
|
|
226
|
+
* 列表 Array<any>
|
|
226
227
|
* */ FieldTypes["LIST"] = "list";
|
|
227
228
|
// /**
|
|
228
229
|
// * 关联字段
|
|
@@ -236,36 +237,36 @@ export var FieldTypes;
|
|
|
236
237
|
// * 计算公式字段
|
|
237
238
|
// * */
|
|
238
239
|
// CALC_FIELD = 'calc',
|
|
239
|
-
/**
|
|
240
|
-
* JSON字段
|
|
240
|
+
/**
|
|
241
|
+
* JSON字段
|
|
241
242
|
* */ FieldTypes["JSON"] = "json";
|
|
242
243
|
// /**
|
|
243
244
|
// * 整数类型
|
|
244
245
|
// * */
|
|
245
246
|
// BIGINT = 'bigint',
|
|
246
|
-
/**
|
|
247
|
-
* 任意类型
|
|
247
|
+
/**
|
|
248
|
+
* 任意类型
|
|
248
249
|
* */ FieldTypes["ANY"] = "ANY";
|
|
249
250
|
})(FieldTypes || (FieldTypes = {}));
|
|
250
251
|
export var DateType;
|
|
251
252
|
(function(DateType) {
|
|
252
|
-
/**
|
|
253
|
-
* 年
|
|
253
|
+
/**
|
|
254
|
+
* 年
|
|
254
255
|
* */ DateType["YEAR"] = "year";
|
|
255
|
-
/**
|
|
256
|
-
* 年月
|
|
256
|
+
/**
|
|
257
|
+
* 年月
|
|
257
258
|
* */ DateType["MONTH"] = "month";
|
|
258
|
-
/**
|
|
259
|
-
* 年月日
|
|
259
|
+
/**
|
|
260
|
+
* 年月日
|
|
260
261
|
* */ DateType["DATE"] = "date";
|
|
261
|
-
/**
|
|
262
|
-
* 年月日时
|
|
262
|
+
/**
|
|
263
|
+
* 年月日时
|
|
263
264
|
* */ DateType["DATEHOUR"] = "datehour";
|
|
264
|
-
/**
|
|
265
|
-
* 年月日时分
|
|
265
|
+
/**
|
|
266
|
+
* 年月日时分
|
|
266
267
|
* */ DateType["DATEMIN"] = "datemin";
|
|
267
|
-
/**
|
|
268
|
-
* 年月日时分秒
|
|
268
|
+
/**
|
|
269
|
+
* 年月日时分秒
|
|
269
270
|
* */ DateType["DATETIME"] = "datetime";
|
|
270
271
|
})(DateType || (DateType = {}));
|
|
271
272
|
export var DESIGNER_SLOT = {
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
"listDataChange": "列表数据变化时",
|
|
194
194
|
"search": "搜索时",
|
|
195
195
|
"valueChange": "值发生变化时",
|
|
196
|
-
"
|
|
196
|
+
"finished": "执行完成时",
|
|
197
197
|
"click": "点击时",
|
|
198
198
|
"pleaseEnterNameorEmail": "请输入人员姓名或邮箱",
|
|
199
199
|
"pleaseEnterDate": "请输入日期",
|
|
@@ -219,5 +219,20 @@
|
|
|
219
219
|
"view": "查看",
|
|
220
220
|
"loadCtrlErrorTip": "加载自定义控件异常,会影响到的控件:{id}",
|
|
221
221
|
"loadCtrlError": "内置组件加载错误",
|
|
222
|
-
"fullLine": "充满整行"
|
|
222
|
+
"fullLine": "充满整行",
|
|
223
|
+
"min": "最小值",
|
|
224
|
+
"max": "最大值",
|
|
225
|
+
"createWPS": "新建文档",
|
|
226
|
+
"reset": "重置",
|
|
227
|
+
"query": "查询",
|
|
228
|
+
"detailed": "明细",
|
|
229
|
+
"print": "打印",
|
|
230
|
+
"draft": "保存草稿",
|
|
231
|
+
"save": "保存",
|
|
232
|
+
"cancel": "取消",
|
|
233
|
+
"uploadImg": "上传图片",
|
|
234
|
+
"signature": "发起签署",
|
|
235
|
+
"uploadFile": "上传附件",
|
|
236
|
+
"linkContent": "我是一个链接",
|
|
237
|
+
"referenceList":"引用列表"
|
|
223
238
|
}
|
package/dist/esm/log.js
CHANGED
|
@@ -12,6 +12,10 @@ function _assert_this_initialized(self) {
|
|
|
12
12
|
}
|
|
13
13
|
return self;
|
|
14
14
|
}
|
|
15
|
+
function _call_super(_this, derived, args) {
|
|
16
|
+
derived = _get_prototype_of(derived);
|
|
17
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
18
|
+
}
|
|
15
19
|
function _class_call_check(instance, Constructor) {
|
|
16
20
|
if (!(instance instanceof Constructor)) {
|
|
17
21
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -117,28 +121,12 @@ function _wrap_native_super(Class) {
|
|
|
117
121
|
return _wrap_native_super(Class);
|
|
118
122
|
}
|
|
119
123
|
function _is_native_reflect_construct() {
|
|
120
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
121
|
-
if (Reflect.construct.sham) return false;
|
|
122
|
-
if (typeof Proxy === "function") return true;
|
|
123
124
|
try {
|
|
124
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function _create_super(Derived) {
|
|
131
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
132
|
-
return function _createSuperInternal() {
|
|
133
|
-
var Super = _get_prototype_of(Derived), result;
|
|
134
|
-
if (hasNativeReflectConstruct) {
|
|
135
|
-
var NewTarget = _get_prototype_of(this).constructor;
|
|
136
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
137
|
-
} else {
|
|
138
|
-
result = Super.apply(this, arguments);
|
|
139
|
-
}
|
|
140
|
-
return _possible_constructor_return(this, result);
|
|
141
|
-
};
|
|
125
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
126
|
+
} catch (_) {}
|
|
127
|
+
return (_is_native_reflect_construct = function() {
|
|
128
|
+
return !!result;
|
|
129
|
+
})();
|
|
142
130
|
}
|
|
143
131
|
var logger = console;
|
|
144
132
|
export function warn() {
|
|
@@ -168,11 +156,12 @@ function joinMessage(message) {
|
|
|
168
156
|
var DrivenError = /*#__PURE__*/ function(Error1) {
|
|
169
157
|
"use strict";
|
|
170
158
|
_inherits(DrivenError, Error1);
|
|
171
|
-
var _super = _create_super(DrivenError);
|
|
172
159
|
function DrivenError(message) {
|
|
173
160
|
_class_call_check(this, DrivenError);
|
|
174
161
|
var _this;
|
|
175
|
-
_this =
|
|
162
|
+
_this = _call_super(this, DrivenError, [
|
|
163
|
+
message
|
|
164
|
+
]);
|
|
176
165
|
_this.name = '💥 Driven Error';
|
|
177
166
|
_this.message = message ? joinMessage(message) : 'An unknown error occurred in the Driven, please contact the person in charge 🚑🚑🚑';
|
|
178
167
|
return _this;
|
|
@@ -183,11 +172,12 @@ var DrivenError = /*#__PURE__*/ function(Error1) {
|
|
|
183
172
|
var DrivenReferenceError = /*#__PURE__*/ function(DrivenError) {
|
|
184
173
|
"use strict";
|
|
185
174
|
_inherits(DrivenReferenceError, DrivenError);
|
|
186
|
-
var _super = _create_super(DrivenReferenceError);
|
|
187
175
|
function DrivenReferenceError(message) {
|
|
188
176
|
_class_call_check(this, DrivenReferenceError);
|
|
189
177
|
var _this;
|
|
190
|
-
_this =
|
|
178
|
+
_this = _call_super(this, DrivenReferenceError, [
|
|
179
|
+
message
|
|
180
|
+
]);
|
|
191
181
|
_this.name = '🚨 Driven Reference Error';
|
|
192
182
|
return _this;
|
|
193
183
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { warn } from './log';
|
|
2
|
-
/**
|
|
3
|
-
* 通过key字符串类修改对象上边的属性
|
|
4
|
-
* @param obj 执行修改的对象
|
|
5
|
-
* @param key 修改的key,可以是 name,可以是0,可以是深层嵌套的obj.0,obj[0].name等等
|
|
6
|
-
* @param value 修改的值
|
|
7
|
-
* @return boolean 是否修改成功
|
|
2
|
+
/**
|
|
3
|
+
* 通过key字符串类修改对象上边的属性
|
|
4
|
+
* @param obj 执行修改的对象
|
|
5
|
+
* @param key 修改的key,可以是 name,可以是0,可以是深层嵌套的obj.0,obj[0].name等等
|
|
6
|
+
* @param value 修改的值
|
|
7
|
+
* @return boolean 是否修改成功
|
|
8
8
|
* */ export function updateValueFromKeys(obj, key, value) {
|
|
9
9
|
// 'obj[0].name' 会被转换为 obj.0.name 然后变成 ['obj', 0, 'name']数组,最终匹配内容
|
|
10
10
|
var keyList = key.replace(/\[(\d)]/g, function(text, $1) {
|
package/dist/esm/utils.js
CHANGED
|
@@ -94,16 +94,16 @@ export function wait() {
|
|
|
94
94
|
setTimeout(resolve, time);
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
/**
|
|
98
|
-
* schema逐个遍历,提供转换回调
|
|
99
|
-
* @author qiyu
|
|
100
|
-
* @param schemaItems
|
|
101
|
-
* @param convertion
|
|
102
|
-
* @example
|
|
103
|
-
import { loop, camelizeKeys } from 'model-driven-front/lib/utils/dataCleaner'
|
|
104
|
-
new_model = loop(new_model, (item: any) => {
|
|
105
|
-
return camelizeKeys(item)
|
|
106
|
-
})
|
|
97
|
+
/**
|
|
98
|
+
* schema逐个遍历,提供转换回调
|
|
99
|
+
* @author qiyu
|
|
100
|
+
* @param schemaItems
|
|
101
|
+
* @param convertion
|
|
102
|
+
* @example
|
|
103
|
+
import { loop, camelizeKeys } from 'model-driven-front/lib/utils/dataCleaner'
|
|
104
|
+
new_model = loop(new_model, (item: any) => {
|
|
105
|
+
return camelizeKeys(item)
|
|
106
|
+
})
|
|
107
107
|
*/ export function loop(schemaItems, convertion) {
|
|
108
108
|
var new_items = [];
|
|
109
109
|
if (Array.isArray(schemaItems)) {
|