@byteluck-fe/model-driven-shared 2.3.13 → 2.3.20
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/dist/esm/EventLogic.js +89 -76
- package/dist/esm/RulesMessage.js +22 -9
- package/dist/esm/calc.js +45 -14
- package/dist/esm/constant.js +1 -1
- package/dist/esm/entity/Department.js +26 -6
- package/dist/esm/entity/User.js +80 -6
- package/dist/esm/entity/index.js +2 -2
- package/dist/esm/enum.js +128 -128
- package/dist/esm/genNonDuplicateId.js +4 -4
- package/dist/esm/index.js +13 -13
- package/dist/esm/locales/index.js +3 -3
- package/dist/esm/log.js +64 -75
- package/dist/esm/loopControls.js +3 -3
- package/dist/esm/updateValueFromKeys.js +3 -3
- package/dist/esm/utils.js +14 -14
- package/dist/esm/watcher.js +233 -116
- package/dist/index.umd.js +1 -1
- package/dist/types/EventLogic.d.ts +1 -1
- package/dist/types/RulesMessage.d.ts +3 -3
- package/package.json +2 -2
package/dist/esm/log.js
CHANGED
|
@@ -1,55 +1,44 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
if (Array.isArray(arr)) return
|
|
6
|
+
function _array_without_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function _assert_this_initialized(self) {
|
|
10
10
|
if (self === void 0) {
|
|
11
11
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
12
12
|
}
|
|
13
13
|
return self;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function _class_call_check(instance, Constructor) {
|
|
16
16
|
if (!(instance instanceof Constructor)) {
|
|
17
17
|
throw new TypeError("Cannot call a class as a function");
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
function isNativeReflectConstruct() {
|
|
21
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
22
|
-
if (Reflect.construct.sham) return false;
|
|
23
|
-
if (typeof Proxy === "function") return true;
|
|
24
|
-
try {
|
|
25
|
-
Date.prototype.toString.call(Reflect.construct(Date, [], function() {}));
|
|
26
|
-
return true;
|
|
27
|
-
} catch (e) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
20
|
function _construct(Parent, args, Class) {
|
|
32
|
-
if (
|
|
21
|
+
if (_is_native_reflect_construct()) {
|
|
33
22
|
_construct = Reflect.construct;
|
|
34
23
|
} else {
|
|
35
|
-
_construct = function
|
|
24
|
+
_construct = function construct(Parent, args, Class) {
|
|
36
25
|
var a = [
|
|
37
26
|
null
|
|
38
27
|
];
|
|
39
28
|
a.push.apply(a, args);
|
|
40
29
|
var Constructor = Function.bind.apply(Parent, a);
|
|
41
30
|
var instance = new Constructor();
|
|
42
|
-
if (Class)
|
|
31
|
+
if (Class) _set_prototype_of(instance, Class.prototype);
|
|
43
32
|
return instance;
|
|
44
33
|
};
|
|
45
34
|
}
|
|
46
35
|
return _construct.apply(null, arguments);
|
|
47
36
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
37
|
+
function _get_prototype_of(o) {
|
|
38
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
50
39
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
51
40
|
};
|
|
52
|
-
return
|
|
41
|
+
return _get_prototype_of(o);
|
|
53
42
|
}
|
|
54
43
|
function _inherits(subClass, superClass) {
|
|
55
44
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
@@ -62,49 +51,49 @@ function _inherits(subClass, superClass) {
|
|
|
62
51
|
configurable: true
|
|
63
52
|
}
|
|
64
53
|
});
|
|
65
|
-
if (superClass)
|
|
54
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
66
55
|
}
|
|
67
|
-
function
|
|
56
|
+
function _is_native_function(fn) {
|
|
68
57
|
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
69
58
|
}
|
|
70
|
-
function
|
|
59
|
+
function _iterable_to_array(iter) {
|
|
71
60
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
72
61
|
}
|
|
73
|
-
function
|
|
62
|
+
function _non_iterable_spread() {
|
|
74
63
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
75
64
|
}
|
|
76
|
-
function
|
|
77
|
-
if (call && (
|
|
65
|
+
function _possible_constructor_return(self, call) {
|
|
66
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
78
67
|
return call;
|
|
79
68
|
}
|
|
80
|
-
return
|
|
69
|
+
return _assert_this_initialized(self);
|
|
81
70
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
71
|
+
function _set_prototype_of(o, p) {
|
|
72
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
84
73
|
o.__proto__ = p;
|
|
85
74
|
return o;
|
|
86
75
|
};
|
|
87
|
-
return
|
|
76
|
+
return _set_prototype_of(o, p);
|
|
88
77
|
}
|
|
89
|
-
function
|
|
90
|
-
return
|
|
78
|
+
function _to_consumable_array(arr) {
|
|
79
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
91
80
|
}
|
|
92
|
-
|
|
81
|
+
function _type_of(obj) {
|
|
93
82
|
"@swc/helpers - typeof";
|
|
94
83
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
95
|
-
}
|
|
96
|
-
function
|
|
84
|
+
}
|
|
85
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
97
86
|
if (!o) return;
|
|
98
|
-
if (typeof o === "string") return
|
|
87
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
99
88
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
100
89
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
101
90
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
102
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
91
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
103
92
|
}
|
|
104
|
-
function
|
|
93
|
+
function _wrap_native_super(Class) {
|
|
105
94
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
106
|
-
|
|
107
|
-
if (Class === null || !
|
|
95
|
+
_wrap_native_super = function wrapNativeSuper(Class) {
|
|
96
|
+
if (Class === null || !_is_native_function(Class)) return Class;
|
|
108
97
|
if (typeof Class !== "function") {
|
|
109
98
|
throw new TypeError("Super expression must either be null or a function");
|
|
110
99
|
}
|
|
@@ -113,7 +102,7 @@ function _wrapNativeSuper(Class) {
|
|
|
113
102
|
_cache.set(Class, Wrapper);
|
|
114
103
|
}
|
|
115
104
|
function Wrapper() {
|
|
116
|
-
return _construct(Class, arguments,
|
|
105
|
+
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
117
106
|
}
|
|
118
107
|
Wrapper.prototype = Object.create(Class.prototype, {
|
|
119
108
|
constructor: {
|
|
@@ -123,11 +112,11 @@ function _wrapNativeSuper(Class) {
|
|
|
123
112
|
configurable: true
|
|
124
113
|
}
|
|
125
114
|
});
|
|
126
|
-
return
|
|
115
|
+
return _set_prototype_of(Wrapper, Class);
|
|
127
116
|
};
|
|
128
|
-
return
|
|
117
|
+
return _wrap_native_super(Class);
|
|
129
118
|
}
|
|
130
|
-
function
|
|
119
|
+
function _is_native_reflect_construct() {
|
|
131
120
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
132
121
|
if (Reflect.construct.sham) return false;
|
|
133
122
|
if (typeof Proxy === "function") return true;
|
|
@@ -138,17 +127,17 @@ function _isNativeReflectConstruct() {
|
|
|
138
127
|
return false;
|
|
139
128
|
}
|
|
140
129
|
}
|
|
141
|
-
function
|
|
142
|
-
var hasNativeReflectConstruct =
|
|
130
|
+
function _create_super(Derived) {
|
|
131
|
+
var hasNativeReflectConstruct = _is_native_reflect_construct();
|
|
143
132
|
return function _createSuperInternal() {
|
|
144
|
-
var Super =
|
|
133
|
+
var Super = _get_prototype_of(Derived), result;
|
|
145
134
|
if (hasNativeReflectConstruct) {
|
|
146
|
-
var NewTarget =
|
|
135
|
+
var NewTarget = _get_prototype_of(this).constructor;
|
|
147
136
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
148
137
|
} else {
|
|
149
138
|
result = Super.apply(this, arguments);
|
|
150
139
|
}
|
|
151
|
-
return
|
|
140
|
+
return _possible_constructor_return(this, result);
|
|
152
141
|
};
|
|
153
142
|
}
|
|
154
143
|
var logger = console;
|
|
@@ -159,8 +148,8 @@ export function warn() {
|
|
|
159
148
|
var _logger;
|
|
160
149
|
var other = data.slice(1);
|
|
161
150
|
(_logger = logger).warn.apply(_logger, [
|
|
162
|
-
|
|
163
|
-
].concat(
|
|
151
|
+
"\uD83E\uDDD0 Driven Warning:" + data[0]
|
|
152
|
+
].concat(_to_consumable_array(other)));
|
|
164
153
|
}
|
|
165
154
|
export function log() {
|
|
166
155
|
for(var _len = arguments.length, data = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -169,47 +158,47 @@ export function log() {
|
|
|
169
158
|
var _logger;
|
|
170
159
|
var other = data.slice(1);
|
|
171
160
|
(_logger = logger).log.apply(_logger, [
|
|
172
|
-
|
|
173
|
-
].concat(
|
|
161
|
+
"\uD83D\uDE80 Driven Log:" + data[0]
|
|
162
|
+
].concat(_to_consumable_array(other)));
|
|
174
163
|
}
|
|
175
164
|
function joinMessage(message) {
|
|
176
|
-
return message +
|
|
165
|
+
return message + " \uD83D\uDC1B\uD83D\uDC1B\uD83D\uDC1B";
|
|
177
166
|
}
|
|
178
|
-
|
|
179
|
-
/*#__PURE__*/ function(
|
|
167
|
+
// 驱动错误
|
|
168
|
+
var DrivenError = /*#__PURE__*/ function(Error1) {
|
|
180
169
|
"use strict";
|
|
181
|
-
_inherits(DrivenError,
|
|
182
|
-
var _super =
|
|
170
|
+
_inherits(DrivenError, Error1);
|
|
171
|
+
var _super = _create_super(DrivenError);
|
|
183
172
|
function DrivenError(message) {
|
|
184
|
-
|
|
173
|
+
_class_call_check(this, DrivenError);
|
|
185
174
|
var _this;
|
|
186
175
|
_this = _super.call(this, message);
|
|
187
|
-
_this.name =
|
|
188
|
-
_this.message = message ? joinMessage(message) :
|
|
176
|
+
_this.name = "\uD83D\uDCA5 Driven Error";
|
|
177
|
+
_this.message = message ? joinMessage(message) : "An unknown error occurred in the Driven, please contact the person in charge \uD83D\uDE91\uD83D\uDE91\uD83D\uDE91";
|
|
189
178
|
return _this;
|
|
190
179
|
}
|
|
191
180
|
return DrivenError;
|
|
192
|
-
}(
|
|
193
|
-
|
|
194
|
-
/*#__PURE__*/ function(DrivenError) {
|
|
181
|
+
}(_wrap_native_super(Error));
|
|
182
|
+
// 驱动语法错误
|
|
183
|
+
var DrivenReferenceError = /*#__PURE__*/ function(DrivenError) {
|
|
195
184
|
"use strict";
|
|
196
185
|
_inherits(DrivenReferenceError, DrivenError);
|
|
197
|
-
var _super =
|
|
186
|
+
var _super = _create_super(DrivenReferenceError);
|
|
198
187
|
function DrivenReferenceError(message) {
|
|
199
|
-
|
|
188
|
+
_class_call_check(this, DrivenReferenceError);
|
|
200
189
|
var _this;
|
|
201
190
|
_this = _super.call(this, message);
|
|
202
|
-
_this.name =
|
|
191
|
+
_this.name = "\uD83D\uDEA8 Driven Reference Error";
|
|
203
192
|
return _this;
|
|
204
193
|
}
|
|
205
194
|
return DrivenReferenceError;
|
|
206
195
|
}(DrivenError);
|
|
207
|
-
export function error(
|
|
208
|
-
throw new DrivenError(
|
|
196
|
+
export function error(error) {
|
|
197
|
+
throw new DrivenError(error);
|
|
209
198
|
}
|
|
210
|
-
export function referenceError(
|
|
211
|
-
throw new DrivenReferenceError(
|
|
199
|
+
export function referenceError(error) {
|
|
200
|
+
throw new DrivenReferenceError(error);
|
|
212
201
|
}
|
|
213
|
-
export function logerror(
|
|
214
|
-
logger.error(new DrivenError(
|
|
202
|
+
export function logerror(error) {
|
|
203
|
+
logger.error(new DrivenError(error));
|
|
215
204
|
}
|
package/dist/esm/loopControls.js
CHANGED
|
@@ -2,13 +2,13 @@ export function loopFormSchema(schema, callback) {
|
|
|
2
2
|
if (Array.isArray(schema)) {
|
|
3
3
|
schema.map(function(item) {
|
|
4
4
|
switch(item.controlType){
|
|
5
|
-
case
|
|
5
|
+
case "layout":
|
|
6
6
|
loopFormSchema(item === null || item === void 0 ? void 0 : item.children, callback);
|
|
7
7
|
break;
|
|
8
|
-
case
|
|
8
|
+
case "search":
|
|
9
9
|
loopFormSchema(item === null || item === void 0 ? void 0 : item.children, callback);
|
|
10
10
|
break;
|
|
11
|
-
case
|
|
11
|
+
case "form":
|
|
12
12
|
callback(item);
|
|
13
13
|
default:
|
|
14
14
|
break;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { warn } from
|
|
1
|
+
import { warn } from "./log";
|
|
2
2
|
/**
|
|
3
3
|
* 通过key字符串类修改对象上边的属性
|
|
4
4
|
* @param obj 执行修改的对象
|
|
@@ -8,8 +8,8 @@ import { warn } from './log';
|
|
|
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) {
|
|
11
|
-
return
|
|
12
|
-
}).split(
|
|
11
|
+
return "." + $1;
|
|
12
|
+
}).split(".");
|
|
13
13
|
var result = false;
|
|
14
14
|
keyList.reduce(function(props, current, index, arr) {
|
|
15
15
|
var nowProps = props;
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { camelizeKeys as camelizeKeys_1, decamelizeKeys as decamelizeKeys_1 } from
|
|
2
|
-
import { CONTROL_TYPE } from
|
|
3
|
-
import cloneJSON from
|
|
1
|
+
import { camelizeKeys as camelizeKeys_1, decamelizeKeys as decamelizeKeys_1 } from "humps";
|
|
2
|
+
import { CONTROL_TYPE } from "./enum";
|
|
3
|
+
import cloneJSON from "fast-json-clone";
|
|
4
4
|
export function JSONCopy(value) {
|
|
5
5
|
if (value !== undefined) {
|
|
6
|
-
if (typeof value ===
|
|
6
|
+
if (typeof value === "object") {
|
|
7
7
|
// result = JSON.parse(JSON.stringify(value))
|
|
8
8
|
return cloneJSON(value);
|
|
9
9
|
} else {
|
|
@@ -14,25 +14,25 @@ export function JSONCopy(value) {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
export function isLanguageObject(arg) {
|
|
17
|
-
return isPlainObject(arg) &&
|
|
17
|
+
return isPlainObject(arg) && "zh" in arg;
|
|
18
18
|
}
|
|
19
19
|
export function isPlainObject(arg) {
|
|
20
|
-
return Object.prototype.toString.call(arg) ===
|
|
20
|
+
return Object.prototype.toString.call(arg) === "[object Object]";
|
|
21
21
|
}
|
|
22
22
|
export function isObject(val) {
|
|
23
|
-
return val != null && typeof val ===
|
|
23
|
+
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
24
24
|
}
|
|
25
25
|
export function isArray(val) {
|
|
26
26
|
return Array.isArray(val);
|
|
27
27
|
}
|
|
28
28
|
export function isString(val) {
|
|
29
|
-
return typeof val ===
|
|
29
|
+
return typeof val === "string";
|
|
30
30
|
}
|
|
31
31
|
export function isNumber(val) {
|
|
32
|
-
return typeof val ===
|
|
32
|
+
return typeof val === "number";
|
|
33
33
|
}
|
|
34
34
|
export function isFunction(val) {
|
|
35
|
-
return typeof val ===
|
|
35
|
+
return typeof val === "function";
|
|
36
36
|
}
|
|
37
37
|
export function isStringArray(value) {
|
|
38
38
|
return isArray(value) && value.every(function(item) {
|
|
@@ -46,7 +46,7 @@ export function isNumberArray(value) {
|
|
|
46
46
|
}
|
|
47
47
|
export function isNumberAndEmptyStringArray(value) {
|
|
48
48
|
return isArray(value) && value.every(function(item) {
|
|
49
|
-
return isNumber(item) || item ===
|
|
49
|
+
return isNumber(item) || item === "";
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
export function isJSONArray(value) {
|
|
@@ -56,7 +56,7 @@ export function isJSONObject(value) {
|
|
|
56
56
|
return /^{.*?}$/.test(value);
|
|
57
57
|
}
|
|
58
58
|
export function toNumberOrEmpty(value) {
|
|
59
|
-
return isNaN(parseFloat(value)) ?
|
|
59
|
+
return isNaN(parseFloat(value)) ? "" : Number(value);
|
|
60
60
|
}
|
|
61
61
|
export function getNotRepeatItems(arr) {
|
|
62
62
|
return arr.reduce(function(result, current) {
|
|
@@ -67,7 +67,7 @@ export function getNotRepeatItems(arr) {
|
|
|
67
67
|
}, []);
|
|
68
68
|
}
|
|
69
69
|
export function debounce(func) {
|
|
70
|
-
var
|
|
70
|
+
var wait = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 500;
|
|
71
71
|
var timer;
|
|
72
72
|
return function() {
|
|
73
73
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
@@ -82,7 +82,7 @@ export function debounce(func) {
|
|
|
82
82
|
func.apply(_this, args);
|
|
83
83
|
clearTimeout(timer);
|
|
84
84
|
timer = null;
|
|
85
|
-
},
|
|
85
|
+
}, wait);
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
export function wait() {
|