vap1 0.4.5 → 0.4.7
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/basetype.d.ts +4 -0
- package/components/Box/Box.d.ts +2 -2
- package/components/Box/Box.js +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/ActionButtons.d.ts +2 -2
- package/components/{SearchBar → SearchTool/SearchBar}/ActionButtons.js +5 -5
- package/components/{SearchBar → SearchTool/SearchBar}/ByField.js +4 -4
- package/components/{SearchBar → SearchTool/SearchBar}/ByKeyword.js +3 -3
- package/components/{SearchBar → SearchTool/SearchBar}/SearchField.d.ts +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/SearchTags.js +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/_register.d.ts +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/_register.js +3 -3
- package/components/SearchTool/SearchBar/index.d.ts +71 -0
- package/components/{SearchBar → SearchTool/SearchBar}/index.js +1 -1
- package/components/{SearchBar → SearchTool}/index.d.ts +1 -70
- package/components/SearchTool/index.js +2 -0
- package/components/Tables/ApiTable.d.ts +1 -1
- package/components/Tables/ApiTableModal.d.ts +1 -1
- package/components/Tables/Components/ActionBar.d.ts +1 -1
- package/components/Tables/Components/ActionBar.js +1 -1
- package/components/Tables/VTable.d.ts +4 -2
- package/components/Tables/index.d.ts +1 -1
- package/components/TreeSelect/STreeSelect.js +1 -1
- package/components/UForm/_FieldType.d.ts +1 -1
- package/components/UForm/_FieldType.js +4 -0
- package/components/UForm/_input.d.ts +1 -1
- package/components/_adapt/Col.d.ts +1 -1
- package/components/_common/UTitle.d.ts +1 -1
- package/components/_common/UTitle.js +1 -1
- package/components/index.d.ts +2 -2
- package/components/index.js +1 -1
- package/deps/app-data/Const.d.ts +68 -3
- package/deps/app-data/Const.js +47 -3
- package/deps/app-data/TimeConst.d.ts +0 -0
- package/deps/app-data/TimeConst.js +58 -0
- package/deps/app-data/useSource.d.ts +22 -0
- package/deps/app-data/useSource.js +243 -162
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/utils/Ajax.js +12 -9
- package/utils/Format.js +5 -10
- package/utils/Global.d.ts +34 -2
- package/utils/Global.js +17 -1
- package/utils/Renders/ApiGetRender.js +5 -2
- package/utils/TreeUtil.js +2 -4
- package/utils/VAP.js +0 -1
- package/utils/_Support.d.ts +1 -1
- package/utils/crontab/_en.d.ts +2 -0
- package/utils/crontab/_en.js +178 -0
- package/utils/crontab/_global.d.ts +11 -0
- package/utils/crontab/_global.js +23 -0
- package/utils/crontab/_zh_CN.d.ts +2 -0
- package/utils/crontab/_zh_CN.js +180 -0
- package/utils/crontab/_zh_TW.d.ts +2 -0
- package/utils/crontab/_zh_TW.js +170 -0
- package/utils/crontab/crontabParser.d.ts +1 -0
- package/utils/crontab/crontabParser.js +251 -0
- package/utils/crontab/crontabRender.d.ts +23 -0
- package/utils/crontab/crontabRender.js +503 -0
- package/utils/crontab/index.d.ts +3 -0
- package/utils/crontab/index.js +9 -0
- package/utils/crontab/type.d.ts +79 -0
- package/utils/crontab/type.js +2 -0
- package/utils/crontab/utils.d.ts +20 -0
- package/utils/crontab/utils.js +122 -0
- package/utils/py.js +2 -0
- /package/components/{SearchBar → SearchTool/SearchBar}/ByField.d.ts +0 -0
- /package/components/{SearchBar → SearchTool/SearchBar}/ByKeyword.d.ts +0 -0
- /package/components/{SearchBar → SearchTool/SearchBar}/SearchField.js +0 -0
- /package/components/{SearchBar → SearchTool/SearchBar}/SearchTags.d.ts +0 -0
- /package/components/{SearchBar → SearchTool}/_FieldType.d.ts +0 -0
- /package/components/{SearchBar → SearchTool}/_FieldType.js +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.containsAny = exports.format = exports.validate = void 0;
|
|
4
|
+
var _global_1 = require("./_global");
|
|
5
|
+
function assert(value, message) {
|
|
6
|
+
if (!value) {
|
|
7
|
+
throw new Error(message);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
// export default class RangeValidator {
|
|
11
|
+
var secondRange = function (parse) {
|
|
12
|
+
var parsed = parse.split(',');
|
|
13
|
+
for (var i = 0; i < parsed.length; i++) {
|
|
14
|
+
if (!isNaN(parseInt(parsed[i], 10))) {
|
|
15
|
+
var second = parseInt(parsed[i], 10);
|
|
16
|
+
assert(second >= 0 && second <= 59, '秒钟范围只是是 0 - 59');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var minuteRange = function (parse) {
|
|
21
|
+
var parsed = parse.split(',');
|
|
22
|
+
for (var i = 0; i < parsed.length; i++) {
|
|
23
|
+
if (!isNaN(parseInt(parsed[i], 10))) {
|
|
24
|
+
var minute = parseInt(parsed[i], 10);
|
|
25
|
+
assert(minute >= 0 && minute <= 59, '分钟范围只是是 0 - 59');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var hourRange = function (parse) {
|
|
30
|
+
var parsed = parse.split(',');
|
|
31
|
+
for (var i = 0; i < parsed.length; i++) {
|
|
32
|
+
if (!isNaN(parseInt(parsed[i], 10))) {
|
|
33
|
+
var hour = parseInt(parsed[i], 10);
|
|
34
|
+
assert(hour >= 0 && hour <= 23, '小时范围只是是 0 - 23');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var dayOfMonthRange = function (parse) {
|
|
39
|
+
var parsed = parse.split(',');
|
|
40
|
+
for (var i = 0; i < parsed.length; i++) {
|
|
41
|
+
if (!isNaN(parseInt(parsed[i], 10))) {
|
|
42
|
+
var dayOfMonth = parseInt(parsed[i], 10);
|
|
43
|
+
assert(dayOfMonth >= 1 && dayOfMonth <= 31, '日期范围只是是 1 - 31');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var monthRange = function (parse, monthStartIndexZero) {
|
|
48
|
+
var parsed = parse.split(',');
|
|
49
|
+
for (var i = 0; i < parsed.length; i++) {
|
|
50
|
+
if (!isNaN(parseInt(parsed[i], 10))) {
|
|
51
|
+
var month = parseInt(parsed[i], 10);
|
|
52
|
+
assert(month >= 1 && month <= 12, monthStartIndexZero ? '月份范围只是是 0 - 11' : '月份范围只是是 1 - 12');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var dayOfWeekRange = function (parse, dayOfWeekStartIndexZero) {
|
|
57
|
+
var parsed = parse.split(',');
|
|
58
|
+
for (var i = 0; i < parsed.length; i++) {
|
|
59
|
+
if (!isNaN(parseInt(parsed[i], 10))) {
|
|
60
|
+
var dayOfWeek = parseInt(parsed[i], 10);
|
|
61
|
+
assert(dayOfWeek >= 0 && dayOfWeek <= 6, dayOfWeekStartIndexZero ? '星期范围只是是 0 - 6' : '星期范围只是是 1 - 7');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var assertNoInvalidCharacters = function (partDescription, expression) {
|
|
66
|
+
// No characters other than 'L' or 'W' should remain after normalization
|
|
67
|
+
var invalidChars = expression.match(/[A-KM-VX-Z]+/gi);
|
|
68
|
+
if (invalidChars && invalidChars.length) {
|
|
69
|
+
throw new Error("".concat(partDescription, " \u90E8\u5206\u4E0D\u80FD\u5305\u62EC\u5B57\u7B26: '").concat(invalidChars.toString(), "'"));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var validateRange = function (parsed) {
|
|
73
|
+
secondRange(parsed[0]);
|
|
74
|
+
minuteRange(parsed[1]);
|
|
75
|
+
hourRange(parsed[2]);
|
|
76
|
+
dayOfMonthRange(parsed[3]);
|
|
77
|
+
monthRange(parsed[4], _global_1.monthStartIndexZero);
|
|
78
|
+
dayOfWeekRange(parsed[5], _global_1.dayOfWeekStartIndexZero);
|
|
79
|
+
};
|
|
80
|
+
var validate = function (parsed) {
|
|
81
|
+
assertNoInvalidCharacters("DOW", parsed[5]);
|
|
82
|
+
assertNoInvalidCharacters("DOM", parsed[3]);
|
|
83
|
+
validateRange(parsed);
|
|
84
|
+
};
|
|
85
|
+
exports.validate = validate;
|
|
86
|
+
/**
|
|
87
|
+
* Takes a string with '%s' placeholders and replaces them with provided values.
|
|
88
|
+
* Works like sprintf in C or string.Format in C#.
|
|
89
|
+
* @static
|
|
90
|
+
* @param {string} template - The string template with enclosed %s replacements
|
|
91
|
+
* @param {...string[]} values - The ordered replacement text
|
|
92
|
+
* @returns {string}
|
|
93
|
+
*/
|
|
94
|
+
var format = function (template) {
|
|
95
|
+
var values = [];
|
|
96
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
97
|
+
values[_i - 1] = arguments[_i];
|
|
98
|
+
}
|
|
99
|
+
return template.replace(/%s/g, function (substring) {
|
|
100
|
+
var args = [];
|
|
101
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
102
|
+
args[_i - 1] = arguments[_i];
|
|
103
|
+
}
|
|
104
|
+
return values.shift();
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
exports.format = format;
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
* Given a string and an array of search strings, determines if the string
|
|
111
|
+
* contains any value from the array.
|
|
112
|
+
* @static
|
|
113
|
+
* @param {string} text - The string to search
|
|
114
|
+
* @param {string[]} searchStrings - The array of values to search for
|
|
115
|
+
* @returns {boolean}
|
|
116
|
+
*/
|
|
117
|
+
var containsAny = function (text, searchStrings) {
|
|
118
|
+
return searchStrings.some(function (c) {
|
|
119
|
+
return text.indexOf(c) > -1;
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
exports.containsAny = containsAny;
|
package/utils/py.js
CHANGED
|
@@ -8,6 +8,8 @@ var Global_1 = require("./Global");
|
|
|
8
8
|
var lodash_1 = __importDefault(require("lodash"));
|
|
9
9
|
// 创建反向索引
|
|
10
10
|
var createIndex = function (txt) {
|
|
11
|
+
if (txt == null || txt.length == 0)
|
|
12
|
+
return [];
|
|
11
13
|
var index = [];
|
|
12
14
|
for (var i = 0, _i = txt.length; i < _i; i++) {
|
|
13
15
|
var char = txt[i];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|