vap1 0.2.3 → 0.2.4
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/components/Box/Box.js +75 -42
- package/components/Box/SelectBar.js +51 -24
- package/components/Box/_register.d.ts +4 -0
- package/components/Box/_register.js +10 -8
- package/components/Box/index.js +1 -1
- package/components/Lists/SList.js +76 -48
- package/components/SearchBar/ActionButtons.js +75 -42
- package/components/SearchBar/ByField.js +80 -52
- package/components/SearchBar/ByKeyword.js +44 -17
- package/components/SearchBar/SearchField.js +8 -8
- package/components/SearchBar/SearchTags.js +4 -4
- package/components/SearchBar/_register.js +9 -8
- package/components/SearchBar/index.js +22 -11
- package/components/Tables/ApiTable.d.ts +1 -1
- package/components/Tables/ApiTable.js +19 -8
- package/components/Tables/ApiTableModal.d.ts +1 -1
- package/components/Tables/ApiTableModal.js +40 -13
- package/components/Tables/Components/ActionBar.js +53 -26
- package/components/Tables/Components/Actions.js +40 -29
- package/components/Tables/Components/Summary.js +2 -2
- package/components/Tables/Components/index.js +3 -3
- package/components/Tables/STable.js +21 -10
- package/components/Tables/TopTable.d.ts +3 -2
- package/components/Tables/TopTable.js +64 -37
- package/components/Tables/TopTableModal.js +21 -10
- package/components/Tables/Util.d.ts +2 -2
- package/components/Tables/Util.js +11 -9
- package/components/Tables/VTable.d.ts +2 -2
- package/components/Tables/VTable.js +137 -65
- package/components/Tables/index.d.ts +7 -2
- package/components/Tables/index.js +5 -5
- package/components/TreeSelect/BaseTreeSelect.js +81 -45
- package/components/TreeSelect/DTreeSelect.js +191 -66
- package/components/TreeSelect/FTreeSelect.js +67 -20
- package/components/TreeSelect/STreeSelect.js +22 -11
- package/components/Trees/ActionTree.js +562 -431
- package/components/Trees/BaseTree.js +85 -38
- package/components/Trees/COTree/COButton.js +48 -21
- package/components/Trees/COTree/COSelect.js +31 -20
- package/components/Trees/COTree/COTree.js +223 -107
- package/components/Trees/COTree/COTreeUtil.js +160 -115
- package/components/Trees/DTree.js +139 -68
- package/components/Trees/FTree.js +76 -29
- package/components/Trees/STree.js +59 -23
- package/components/UForm/FormWrapper.js +70 -53
- package/components/UForm/UDescriptions.js +38 -38
- package/components/UForm/UForm.js +240 -135
- package/components/UForm/UFormModal.js +99 -44
- package/components/UForm/UInfo.js +33 -22
- package/components/UForm/UInfoModal.js +31 -20
- package/components/UForm/UModal.js +40 -13
- package/components/UForm/_FormUtils.js +29 -18
- package/components/UForm/_input.js +75 -39
- package/components/UForm/_register.js +11 -9
- package/components/Upload/UploadFile.js +38 -11
- package/components/Upload/UploadImage.js +50 -23
- package/components/Upload/UploadModal.js +149 -84
- package/components/Upload/useUpload.js +35 -19
- package/components/_RegisterUtil.js +20 -8
- package/components/_adapt/Alert.js +20 -9
- package/components/_adapt/Breadcrumb.js +18 -7
- package/components/_adapt/Button.js +24 -13
- package/components/_adapt/Col.js +34 -23
- package/components/_adapt/Collapse.js +21 -10
- package/components/_adapt/ColorPicker.js +55 -28
- package/components/_adapt/ConfigProvider.js +14 -3
- package/components/_adapt/Drawer.js +18 -7
- package/components/_adapt/Dropdown.js +23 -12
- package/components/_adapt/FloatButton.js +21 -10
- package/components/_adapt/Icon.js +18 -7
- package/components/_adapt/Input.js +17 -6
- package/components/_adapt/InputNumber.js +16 -5
- package/components/_adapt/Layout.js +84 -28
- package/components/_adapt/Menu.js +28 -17
- package/components/_adapt/Modal.js +72 -25
- package/components/_adapt/Pagination.js +14 -3
- package/components/_adapt/Popconfirm.js +17 -6
- package/components/_adapt/Popover.js +17 -6
- package/components/_adapt/Progress.js +42 -11
- package/components/_adapt/Radio.js +21 -10
- package/components/_adapt/Row.js +18 -7
- package/components/_adapt/Select.js +54 -43
- package/components/_adapt/Slider.js +1 -1
- package/components/_adapt/Space.js +2 -2
- package/components/_adapt/Table.js +16 -5
- package/components/_adapt/Tabs.js +17 -6
- package/components/_adapt/Tag.js +19 -8
- package/components/_adapt/Tooltip.js +15 -4
- package/components/_adapt/TreeSelect.js +18 -7
- package/components/_adapt/notification.js +1 -1
- package/components/_adapt/todo/Image.js +2 -2
- package/components/_adapt/todo/NotEffectOnV15.js +1 -1
- package/components/_adapt/todo/Segmented.js +2 -2
- package/components/_adapt/utils.js +28 -8
- package/components/_common/AutoComplete.js +101 -34
- package/components/_common/CountUp.js +30 -14
- package/components/_common/DateRange.js +36 -20
- package/components/_common/HighLight.js +22 -6
- package/components/_common/I18N.js +27 -2
- package/components/_common/Loading.js +25 -9
- package/components/_common/MonthRange.js +26 -26
- package/components/_common/PromiseLabel.js +68 -15
- package/components/_common/Role.js +2 -2
- package/components/_common/Upagination.js +45 -34
- package/components/_setup/Const.js +2 -2
- package/components/_setup/I18N/enUS.js +2 -2
- package/components/_setup/I18N/zhCN.js +3 -3
- package/components/_setup/I18N/zhHK.js +2 -2
- package/components/_setup/ICON/IconTypes.js +2 -2
- package/components/_setup/SearchField/SearchFieldAdvance.js +22 -11
- package/components/_setup/SearchField/SearchFieldDate.js +114 -77
- package/components/_setup/SearchField/SearchFieldInput.js +21 -10
- package/components/_setup/SearchField/SearchFieldSelect.js +55 -44
- package/components/_setup/SearchField/SearchFieldTree.js +63 -52
- package/components/_setup/SelectBar/SelectList.js +21 -10
- package/components/_setup/SelectBar/SelectTree.js +17 -6
- package/components/_setup/UForm/UFormAdvanceInput.js +105 -78
- package/components/_setup/UForm/UFormCOTree.js +21 -10
- package/components/_setup/UForm/UFormCrontab.js +51 -35
- package/components/_setup/UForm/UFormDate.js +158 -122
- package/components/_setup/UForm/UFormInput.js +110 -73
- package/components/_setup/UForm/UFormJSON.js +95 -57
- package/components/_setup/UForm/UFormJSONTable.js +79 -41
- package/components/_setup/UForm/UFormOrg.js +112 -48
- package/components/_setup/UForm/UFormRole.js +31 -20
- package/components/_setup/UForm/UFormSelect.js +106 -79
- package/components/_setup/UForm/UFormTree.js +52 -41
- package/components/_setup/UForm/UFormUpload.js +62 -34
- package/components/_setup/UForm/_utils.js +9 -9
- package/deps/JsonView.js +18 -7
- package/deps/SpringBoot.js +1 -1
- package/deps/SpringCloud.js +4 -4
- package/deps/_editor/advance/_Image.js +33 -20
- package/deps/_editor/base/Element.js +28 -17
- package/deps/_editor/base/Leaf.js +18 -7
- package/deps/_editor/base/Support.js +4 -4
- package/deps/_editor/i18n.js +1 -1
- package/deps/_editor/tools/Button.js +31 -19
- package/deps/_editor/tools/ToolBar.js +3 -3
- package/deps/_editor/tools/_BlockButton.js +49 -27
- package/deps/_editor/tools/_InsertButton.js +32 -28
- package/deps/_editor/tools/_MarkButton.js +15 -14
- package/deps/_editor/tools/_TxtButton.js +90 -58
- package/deps/api-audit.js +1 -1
- package/deps/echarts.js +58 -17
- package/deps/editor.js +52 -26
- package/deps/registerEditor.js +18 -7
- package/hooks/_list.js +1 -1
- package/hooks/useAjax.js +43 -19
- package/hooks/useAjaxAction.js +57 -20
- package/hooks/useAjaxQuery.js +121 -51
- package/hooks/useApi.js +35 -8
- package/hooks/useApiBase.js +291 -184
- package/hooks/useApiGlobal.js +40 -13
- package/hooks/useApp.js +4 -4
- package/hooks/useArray.js +114 -52
- package/hooks/useDefault.js +19 -3
- package/hooks/useDoLoad.js +25 -9
- package/hooks/useEffectFunction.js +4 -3
- package/hooks/useEffectOnce.js +5 -5
- package/hooks/useError.js +21 -5
- package/hooks/useFirstMountState.js +3 -3
- package/hooks/useGenkey.js +7 -7
- package/hooks/useGetSet.js +9 -9
- package/hooks/useGlobal.js +58 -29
- package/hooks/useHover.js +25 -9
- package/hooks/useMemoPromise.js +62 -22
- package/hooks/useModals.js +71 -36
- package/hooks/useMountedState.js +6 -6
- package/hooks/useOpenState.js +26 -10
- package/hooks/usePromise.js +15 -13
- package/hooks/useQueue.js +35 -8
- package/hooks/useSetState.js +25 -8
- package/hooks/useStateList.js +30 -18
- package/hooks/useSyncExternalStore.js +31 -15
- package/hooks/useToggle.js +6 -3
- package/hooks/useUnmountPromise.js +11 -11
- package/hooks/useUpdate.js +20 -4
- package/hooks/useUpdateEffect.js +5 -5
- package/login/Base65.js +15 -14
- package/login/Password.js +91 -38
- package/login/SM4.js +50 -49
- package/login/cems/index.js +2 -2
- package/login/jit/index.js +16 -71
- package/login/jit/pnxclient.js +6 -4
- package/login/vap/index.js +1 -1
- package/login/xrtx/index.js +2 -2
- package/package.json +1 -1
- package/screen/Comment.js +16 -5
- package/screen/Page.js +14 -14
- package/screen/render.js +2 -2
- package/uform/FormEditor.js +43 -26
- package/uform/FormViewer.js +30 -19
- package/uform/hooks/useEditor.js +83 -47
- package/uform/hooks/useForm.js +2 -2
- package/uform/index.js +10 -10
- package/uform/inputs/_advance.js +12 -12
- package/uform/inputs/_date.js +63 -52
- package/uform/inputs/_input.js +49 -38
- package/uform/inputs/_select.js +53 -42
- package/uform/inputs/_specific.js +33 -22
- package/uform/inputs/index.js +5 -5
- package/uform/inputs/register.js +14 -14
- package/uform/panel/Editor/GroupEditor.js +31 -31
- package/uform/panel/Editor/ListEditor.js +22 -22
- package/uform/panel/Editor/_FieldItems.js +16 -16
- package/uform/panel/Editor/_GroupCollapse.js +9 -9
- package/uform/panel/Editor/_GroupDefault.js +9 -9
- package/uform/panel/Editor/_GroupStep.js +18 -18
- package/uform/panel/Editor/_GroupTab.js +16 -16
- package/uform/panel/Editor/index.js +17 -17
- package/uform/panel/Items/index.js +22 -11
- package/uform/panel/Propreties/CanvasProperties.js +14 -14
- package/uform/panel/Propreties/Component/FieldPlugin.js +5 -5
- package/uform/panel/Propreties/Component/LinkAsyncFunction.js +22 -47
- package/uform/panel/Propreties/Component/LinkSyncFunction.js +20 -43
- package/uform/panel/Propreties/Component/Links.js +40 -29
- package/uform/panel/Propreties/Component/OptionTable.js +97 -52
- package/uform/panel/Propreties/Component/RegexpModal.js +11 -11
- package/uform/panel/Propreties/Component/Validate.js +35 -24
- package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +13 -24
- package/uform/panel/Propreties/Component/ValidateSyncFunction.js +15 -38
- package/uform/panel/Propreties/FieldOptions.js +78 -44
- package/uform/panel/Propreties/FieldProperties.js +47 -20
- package/uform/panel/Propreties/GroupProperties.js +9 -9
- package/uform/panel/Propreties/_ItemAdvance.js +37 -26
- package/uform/panel/Propreties/_ItemBase.js +30 -19
- package/uform/panel/Propreties/_ItemLink.js +20 -9
- package/uform/panel/Propreties/_ItemValidate.js +33 -22
- package/uform/plugins/index.js +7 -7
- package/uform/utils/Convert.js +137 -94
- package/uform/utils/SchemaConvert.js +43 -68
- package/uform/utils/arr.js +103 -75
- package/utils/Ajax.d.ts +1 -11
- package/utils/Ajax.js +154 -68
- package/utils/ArrayUtil.js +14 -12
- package/utils/CacheUtil.js +19 -13
- package/utils/Const.js +13 -13
- package/utils/CustomApp.js +15 -10
- package/utils/EventUtil.js +78 -14
- package/utils/Format.js +59 -38
- package/utils/Global.js +8 -8
- package/utils/Logger.js +56 -11
- package/utils/PageUtil.d.ts +12 -6
- package/utils/PageUtil.js +105 -35
- package/utils/Renders/ApiGetRender.js +187 -100
- package/utils/Renders/ApiPostRender.js +123 -69
- package/utils/Renders/DateRender.js +9 -9
- package/utils/Renders/DictRender.js +82 -55
- package/utils/Renders/FileRender.js +34 -12
- package/utils/Renders/ListRender.js +21 -21
- package/utils/Renders/NumberRender.js +14 -13
- package/utils/Renders/StatusRender.js +20 -20
- package/utils/Renders/StringRender.js +17 -17
- package/utils/Renders/_define.d.ts +2 -2
- package/utils/Renders/_define.js +7 -7
- package/utils/StringUtil.js +98 -67
- package/utils/TreeUtil.js +71 -20
- package/utils/VAP.js +14 -14
- package/utils/XHR.js +27 -11
- package/utils/_AjaxUtil.d.ts +10 -0
- package/utils/_AjaxUtil.js +35 -12
- package/utils/_Support.js +26 -26
- package/utils/i18n.js +78 -44
- package/utils/index.d.ts +9 -1
- package/utils/index.js +34 -5
- package/utils/screenful.js +82 -29
- package/widget/index.js +4 -4
package/hooks/useToggle.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useToggle = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var toggleReducer = function (state, nextValue) { return typeof nextValue === 'boolean' ? nextValue : !state; };
|
|
6
6
|
/**
|
|
7
7
|
* 快速控制一个 布尔状态
|
|
8
8
|
* 使用方法参考
|
|
9
9
|
* https://github.com/streamich/react-use/blob/master/docs/useToggle.md
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
var useToggle = function (initialValue) {
|
|
12
|
+
if (initialValue === void 0) { initialValue = false; }
|
|
13
|
+
return (0, react_1.useReducer)(toggleReducer, initialValue);
|
|
14
|
+
};
|
|
12
15
|
exports.useToggle = useToggle;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useUnmountPromise = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var useEffectOnce_1 = require("./useEffectOnce");
|
|
6
6
|
/**
|
|
7
7
|
* 使用方法参考
|
|
8
8
|
* https://github.com/streamich/react-use/blob/master/docs/useUnmountPromise.md
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(0, useEffectOnce_1.useEffectOnce)(()
|
|
10
|
+
var useUnmountPromise = function () {
|
|
11
|
+
var refUnmounted = (0, react_1.useRef)(false);
|
|
12
|
+
(0, useEffectOnce_1.useEffectOnce)(function () { return function () {
|
|
13
13
|
refUnmounted.current = true;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
promise.then((result)
|
|
14
|
+
}; });
|
|
15
|
+
var wrapper = (0, react_1.useMemo)(function () {
|
|
16
|
+
var race = function (promise, onError) {
|
|
17
|
+
var newPromise = new Promise(function (resolve, reject) {
|
|
18
|
+
promise.then(function (result) {
|
|
19
19
|
if (!refUnmounted.current)
|
|
20
20
|
resolve(result);
|
|
21
|
-
}, (error)
|
|
21
|
+
}, function (error) {
|
|
22
22
|
if (!refUnmounted.current)
|
|
23
23
|
reject(error);
|
|
24
24
|
else if (onError)
|
package/hooks/useUpdate.js
CHANGED
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
2
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
19
|
exports.useUpdate = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
20
|
+
var react_1 = require("react");
|
|
21
|
+
var updateReducer = function (num) { return (num + 1) % 1000000; };
|
|
6
22
|
/**
|
|
7
23
|
* 重新渲染一个组件
|
|
8
24
|
* 使用方法参考
|
|
9
25
|
* https://github.com/streamich/react-use/blob/master/docs/useUpdate.md
|
|
10
26
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
27
|
+
var useUpdate = function () {
|
|
28
|
+
var _a = __read((0, react_1.useReducer)(updateReducer, 0), 2), update = _a[1];
|
|
13
29
|
return update;
|
|
14
30
|
};
|
|
15
31
|
exports.useUpdate = useUpdate;
|
package/hooks/useUpdateEffect.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useUpdateEffect = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var useFirstMountState_1 = require("./useFirstMountState");
|
|
6
6
|
/**
|
|
7
7
|
* 使用方法参考
|
|
8
8
|
* https://github.com/streamich/react-use/blob/master/docs/useUpdateEffect.md
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(0, react_1.useEffect)(()
|
|
10
|
+
var useUpdateEffect = function (effect, deps) {
|
|
11
|
+
var isFirstMount = (0, useFirstMountState_1.useFirstMountState)();
|
|
12
|
+
(0, react_1.useEffect)(function () {
|
|
13
13
|
if (!isFirstMount) {
|
|
14
14
|
return effect();
|
|
15
15
|
}
|
package/login/Base65.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.base65 = exports.base64 = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
5
|
+
var TIME_LEN = 16;
|
|
6
|
+
var base64 = function (str) {
|
|
7
|
+
var out, i, len;
|
|
8
|
+
var c1, c2, c3;
|
|
9
9
|
len = str.length;
|
|
10
10
|
i = 0;
|
|
11
11
|
out = [];
|
|
@@ -40,14 +40,15 @@ exports.base64 = base64;
|
|
|
40
40
|
* 2. base65 加密没有太的安全性,主要用于某些扫描软件报错,如果强要求安全只能使用非对称RSA加密
|
|
41
41
|
* 3. 需要后端复制一个解决函数进行解密
|
|
42
42
|
*/
|
|
43
|
-
|
|
43
|
+
var base65 = function (str, salt) {
|
|
44
|
+
if (salt === void 0) { salt = 3; }
|
|
44
45
|
salt = salt % 5;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
for (
|
|
46
|
+
var password = (0, exports.base64)(str);
|
|
47
|
+
var timeStr = (new Date().getTime() + '').substring(1, 12) + String.fromCharCode(65 + str.length);
|
|
48
|
+
var time = (0, exports.base64)(timeStr);
|
|
49
|
+
var buf = [];
|
|
50
|
+
var mixlen = password.length < TIME_LEN ? password.length : TIME_LEN;
|
|
51
|
+
for (var i = 0; i < mixlen; i++) {
|
|
51
52
|
buf.push(String.fromCharCode(password.charCodeAt(i) - salt));
|
|
52
53
|
buf.push(time.charAt(i));
|
|
53
54
|
}
|
|
@@ -55,11 +56,11 @@ const base65 = (str, salt = 3) => {
|
|
|
55
56
|
buf.push(time.substring(mixlen));
|
|
56
57
|
}
|
|
57
58
|
else {
|
|
58
|
-
for (
|
|
59
|
+
for (var i = TIME_LEN; i < password.length; i++) {
|
|
59
60
|
buf.push(String.fromCharCode(password.charCodeAt(i) - salt));
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
+
var result = buf.join('');
|
|
63
64
|
return result;
|
|
64
65
|
};
|
|
65
66
|
exports.base65 = base65;
|
package/login/Password.js
CHANGED
|
@@ -1,80 +1,132 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
7
|
+
if (o && i >= o.length) o = void 0;
|
|
8
|
+
return { value: o && o[i++], done: !o };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.PasswordChecker = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
15
|
+
var CHARS_NUMBER = new Set('0123456789'.split(''));
|
|
16
|
+
var CHARS_LOW = new Set('abcdefghijklmnopqrstuvwxyz'.split(''));
|
|
17
|
+
var CHARS_UP = new Set('ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''));
|
|
18
|
+
var CHARS_SYMBOL = new Set('-_+.~!@#$%^&*<>'.split(''));
|
|
8
19
|
/**
|
|
9
20
|
* 密码复杂度,安全等级判断
|
|
10
21
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
22
|
+
var PasswordChecker = /** @class */ (function () {
|
|
23
|
+
function PasswordChecker(options) {
|
|
13
24
|
this.options = {};
|
|
14
25
|
this.options = options;
|
|
15
26
|
}
|
|
16
|
-
check(txt) {
|
|
17
|
-
|
|
27
|
+
PasswordChecker.prototype.check = function (txt) {
|
|
28
|
+
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
29
|
+
var options = this.options;
|
|
18
30
|
if (txt == '' || txt == null) {
|
|
19
31
|
return '密码不能为空';
|
|
20
32
|
}
|
|
21
33
|
if (options.minLength && txt.length < options.minLength) {
|
|
22
|
-
return
|
|
34
|
+
return "\u81F3\u5C11\u8F93\u5165".concat(options.minLength, "\u4E2A\u5B57\u7B26");
|
|
23
35
|
}
|
|
24
36
|
if (options.maxLength && txt.length > options.maxLength) {
|
|
25
|
-
return
|
|
37
|
+
return "\u6700\u591A\u8F93\u5165".concat(options.maxLength, "\u4E2A\u5B57\u7B26");
|
|
26
38
|
}
|
|
27
|
-
|
|
39
|
+
var chars = txt.split('');
|
|
28
40
|
if (options.requireLowerLetter) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
var checked = false;
|
|
42
|
+
try {
|
|
43
|
+
for (var chars_1 = __values(chars), chars_1_1 = chars_1.next(); !chars_1_1.done; chars_1_1 = chars_1.next()) {
|
|
44
|
+
var char = chars_1_1.value;
|
|
45
|
+
if (CHARS_LOW.has(char)) {
|
|
46
|
+
checked = true;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
52
|
+
finally {
|
|
53
|
+
try {
|
|
54
|
+
if (chars_1_1 && !chars_1_1.done && (_a = chars_1.return)) _a.call(chars_1);
|
|
34
55
|
}
|
|
56
|
+
finally { if (e_1) throw e_1.error; }
|
|
35
57
|
}
|
|
36
58
|
if (!checked) {
|
|
37
59
|
return '必须要包含小写字母';
|
|
38
60
|
}
|
|
39
61
|
}
|
|
40
62
|
if (options.requireUpperLetter) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
63
|
+
var checked = false;
|
|
64
|
+
try {
|
|
65
|
+
for (var chars_2 = __values(chars), chars_2_1 = chars_2.next(); !chars_2_1.done; chars_2_1 = chars_2.next()) {
|
|
66
|
+
var char = chars_2_1.value;
|
|
67
|
+
if (CHARS_UP.has(char)) {
|
|
68
|
+
checked = true;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
46
71
|
}
|
|
47
72
|
}
|
|
73
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
74
|
+
finally {
|
|
75
|
+
try {
|
|
76
|
+
if (chars_2_1 && !chars_2_1.done && (_b = chars_2.return)) _b.call(chars_2);
|
|
77
|
+
}
|
|
78
|
+
finally { if (e_2) throw e_2.error; }
|
|
79
|
+
}
|
|
48
80
|
if (!checked) {
|
|
49
81
|
return '必须要包含大写字母';
|
|
50
82
|
}
|
|
51
83
|
}
|
|
52
84
|
if (options.requireNumber) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
85
|
+
var checked = false;
|
|
86
|
+
try {
|
|
87
|
+
for (var chars_3 = __values(chars), chars_3_1 = chars_3.next(); !chars_3_1.done; chars_3_1 = chars_3.next()) {
|
|
88
|
+
var char = chars_3_1.value;
|
|
89
|
+
if (CHARS_NUMBER.has(char)) {
|
|
90
|
+
checked = true;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
96
|
+
finally {
|
|
97
|
+
try {
|
|
98
|
+
if (chars_3_1 && !chars_3_1.done && (_c = chars_3.return)) _c.call(chars_3);
|
|
58
99
|
}
|
|
100
|
+
finally { if (e_3) throw e_3.error; }
|
|
59
101
|
}
|
|
60
102
|
if (!checked) {
|
|
61
103
|
return '必须要包含数字';
|
|
62
104
|
}
|
|
63
105
|
}
|
|
64
106
|
if (options.rqueireSymbol) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
107
|
+
var checked = false;
|
|
108
|
+
try {
|
|
109
|
+
for (var chars_4 = __values(chars), chars_4_1 = chars_4.next(); !chars_4_1.done; chars_4_1 = chars_4.next()) {
|
|
110
|
+
var char = chars_4_1.value;
|
|
111
|
+
if (CHARS_SYMBOL.has(char)) {
|
|
112
|
+
checked = true;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
118
|
+
finally {
|
|
119
|
+
try {
|
|
120
|
+
if (chars_4_1 && !chars_4_1.done && (_d = chars_4.return)) _d.call(chars_4);
|
|
70
121
|
}
|
|
122
|
+
finally { if (e_4) throw e_4.error; }
|
|
71
123
|
}
|
|
72
124
|
if (!checked) {
|
|
73
125
|
return '必须要包含一个特殊符号';
|
|
74
126
|
}
|
|
75
127
|
}
|
|
76
128
|
return true;
|
|
77
|
-
}
|
|
129
|
+
};
|
|
78
130
|
/**
|
|
79
131
|
* 说明
|
|
80
132
|
* 一. 密码长度
|
|
@@ -88,9 +140,9 @@ class PasswordChecker {
|
|
|
88
140
|
* 2) 3 分: 字母、数字和符号
|
|
89
141
|
* 3) 5 分: 大小写字母、数字和符号
|
|
90
142
|
*/
|
|
91
|
-
strong(txt) {
|
|
143
|
+
PasswordChecker.prototype.strong = function (txt) {
|
|
92
144
|
return 1;
|
|
93
|
-
}
|
|
145
|
+
};
|
|
94
146
|
/**
|
|
95
147
|
* 0: 非常弱
|
|
96
148
|
* 25: 弱(Weak)
|
|
@@ -102,10 +154,10 @@ class PasswordChecker {
|
|
|
102
154
|
*
|
|
103
155
|
* 说明,返回 false , 说明密码没有通过验证
|
|
104
156
|
*/
|
|
105
|
-
safeCheck(txt) {
|
|
157
|
+
PasswordChecker.prototype.safeCheck = function (txt) {
|
|
106
158
|
if (!this.check(txt))
|
|
107
159
|
return false;
|
|
108
|
-
|
|
160
|
+
var score = this.strong(txt);
|
|
109
161
|
if (score < 25)
|
|
110
162
|
return '非常弱';
|
|
111
163
|
if (score < 50)
|
|
@@ -119,6 +171,7 @@ class PasswordChecker {
|
|
|
119
171
|
if (score < 90)
|
|
120
172
|
return '安全';
|
|
121
173
|
return '非常安全';
|
|
122
|
-
}
|
|
123
|
-
|
|
174
|
+
};
|
|
175
|
+
return PasswordChecker;
|
|
176
|
+
}());
|
|
124
177
|
exports.PasswordChecker = PasswordChecker;
|
package/login/SM4.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SM4 = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
var FK = [0xa3b1bac6, 0x56aa3350, 0x677d9197, 0xb27022dc];
|
|
5
|
+
var SboxTable = [
|
|
6
6
|
[0xd6, 0x90, 0xe9, 0xfe, 0xcc, 0xe1, 0x3d, 0xb7, 0x16, 0xb6, 0x14, 0xc2, 0x28, 0xfb, 0x2c, 0x05],
|
|
7
7
|
[0x2b, 0x67, 0x9a, 0x76, 0x2a, 0xbe, 0x04, 0xc3, 0xaa, 0x44, 0x13, 0x26, 0x49, 0x86, 0x06, 0x99],
|
|
8
8
|
[0x9c, 0x42, 0x50, 0xf4, 0x91, 0xef, 0x98, 0x7a, 0x33, 0x54, 0x0b, 0x43, 0xed, 0xcf, 0xac, 0x62],
|
|
@@ -20,7 +20,7 @@ const SboxTable = [
|
|
|
20
20
|
[0x89, 0x69, 0x97, 0x4a, 0x0c, 0x96, 0x77, 0x7e, 0x65, 0xb9, 0xf1, 0x09, 0xc5, 0x6e, 0xc6, 0x84],
|
|
21
21
|
[0x18, 0xf0, 0x7d, 0xec, 0x3a, 0xdc, 0x4d, 0x20, 0x79, 0xee, 0x5f, 0x3e, 0xd7, 0xcb, 0x39, 0x48]
|
|
22
22
|
];
|
|
23
|
-
|
|
23
|
+
var CK = [
|
|
24
24
|
0x00070e15, 0x1c232a31, 0x383f464d, 0x545b6269,
|
|
25
25
|
0x70777e85, 0x8c939aa1, 0xa8afb6bd, 0xc4cbd2d9,
|
|
26
26
|
0xe0e7eef5, 0xfc030a11, 0x181f262d, 0x343b4249,
|
|
@@ -30,21 +30,21 @@ const CK = [
|
|
|
30
30
|
0xa0a7aeb5, 0xbcc3cad1, 0xd8dfe6ed, 0xf4fb0209,
|
|
31
31
|
0x10171e25, 0x2c333a41, 0x484f565d, 0x646b7279
|
|
32
32
|
];
|
|
33
|
-
|
|
33
|
+
var GET_ULONG_BE = function (n, b, i) {
|
|
34
34
|
return (b[i] << 24) | (b[i + 1] << 16) | (b[i + 2]) << 8 | (b[i + 3]);
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
var PUT_ULONG_BE = function (n, b, i) {
|
|
37
37
|
b[i] = n >>> 24;
|
|
38
38
|
b[i + 1] = n >>> 16;
|
|
39
39
|
b[i + 2] = n >>> 8;
|
|
40
40
|
b[i + 3] = n;
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
var sm4Sbox = function (n) {
|
|
43
43
|
var l = n >>> 4;
|
|
44
44
|
var r = n % 16;
|
|
45
45
|
return SboxTable[l][r];
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
var sm4CalciRK = function (ka) {
|
|
48
48
|
var bb = 0;
|
|
49
49
|
var rk = 0;
|
|
50
50
|
var a = new Uint8Array(4);
|
|
@@ -58,12 +58,12 @@ const sm4CalciRK = function (ka) {
|
|
|
58
58
|
rk = bb ^ (ROTL(bb, 13)) ^ (ROTL(bb, 23));
|
|
59
59
|
return rk;
|
|
60
60
|
};
|
|
61
|
-
|
|
61
|
+
var ROTL = function (x, n) {
|
|
62
62
|
var a = (x & 0xFFFFFFFF) << n;
|
|
63
63
|
var b = x >>> (32 - n);
|
|
64
64
|
return a | b;
|
|
65
65
|
};
|
|
66
|
-
|
|
66
|
+
var sm4_one_round = function (sk, input, output) {
|
|
67
67
|
var i = 0;
|
|
68
68
|
var ulbuf = new Array(36);
|
|
69
69
|
ulbuf[0] = GET_ULONG_BE(ulbuf[0], input, 0);
|
|
@@ -79,10 +79,10 @@ const sm4_one_round = function (sk, input, output) {
|
|
|
79
79
|
PUT_ULONG_BE(ulbuf[33], output, 8);
|
|
80
80
|
PUT_ULONG_BE(ulbuf[32], output, 12);
|
|
81
81
|
};
|
|
82
|
-
|
|
82
|
+
var sm4F = function (x0, x1, x2, x3, rk) {
|
|
83
83
|
return (x0 ^ sm4Lt(x1 ^ x2 ^ x3 ^ rk));
|
|
84
84
|
};
|
|
85
|
-
|
|
85
|
+
var sm4Lt = function (ka) {
|
|
86
86
|
var bb = 0;
|
|
87
87
|
var c = 0;
|
|
88
88
|
var a = new Uint8Array(4);
|
|
@@ -96,7 +96,7 @@ const sm4Lt = function (ka) {
|
|
|
96
96
|
c = bb ^ (ROTL(bb, 2)) ^ (ROTL(bb, 10)) ^ (ROTL(bb, 18)) ^ (ROTL(bb, 24));
|
|
97
97
|
return c;
|
|
98
98
|
};
|
|
99
|
-
|
|
99
|
+
var sm4_setkey = function (SK, key) {
|
|
100
100
|
var MK = new Array(4);
|
|
101
101
|
var k = new Array(36);
|
|
102
102
|
var i = 0;
|
|
@@ -120,74 +120,75 @@ const sm4_setkey = function (SK, key) {
|
|
|
120
120
|
* const key = 'xxxxxxxxxxxxxxxx';
|
|
121
121
|
* const sm4 = new SM4(key);
|
|
122
122
|
*/
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
var SM4 = /** @class */ (function () {
|
|
124
|
+
function SM4(key) {
|
|
125
125
|
this.key = null;
|
|
126
126
|
this.key = key;
|
|
127
127
|
}
|
|
128
|
-
encrypt(content) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
SM4.prototype.encrypt = function (content) {
|
|
129
|
+
var hData = this.parseUtf8StringToHex(content);
|
|
130
|
+
var sk = [];
|
|
131
|
+
var lpbKey = this.hexToArray(this.parseUtf8StringToHex(this.key));
|
|
132
132
|
this.sm4_setkey_enc(sk, lpbKey); //加密
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
var lpbData = this.hexToArray(hData); // hex2Array(szData)
|
|
134
|
+
var pbyCryptResult = new Array();
|
|
135
|
+
var len = lpbData.length;
|
|
136
136
|
this.sm4_crypt_ecb(sk, len, lpbData, pbyCryptResult);
|
|
137
137
|
return this.arrayBufferToBase64(pbyCryptResult);
|
|
138
|
-
}
|
|
138
|
+
};
|
|
139
139
|
// arrayBuffer 转 Base64
|
|
140
|
-
arrayBufferToBase64(buffer) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
for (
|
|
140
|
+
SM4.prototype.arrayBufferToBase64 = function (buffer) {
|
|
141
|
+
var binary = '';
|
|
142
|
+
var len = buffer.length;
|
|
143
|
+
for (var i = 0; i < len; i++) {
|
|
144
144
|
binary += String.fromCharCode(buffer[i]);
|
|
145
145
|
}
|
|
146
146
|
return window.btoa(binary);
|
|
147
|
-
}
|
|
148
|
-
sm4_setkey_enc(sk, key) {
|
|
147
|
+
};
|
|
148
|
+
SM4.prototype.sm4_setkey_enc = function (sk, key) {
|
|
149
149
|
sm4_setkey(sk, key);
|
|
150
|
-
}
|
|
151
|
-
sm4_crypt_ecb(sk, length, input, output) {
|
|
152
|
-
|
|
150
|
+
};
|
|
151
|
+
SM4.prototype.sm4_crypt_ecb = function (sk, length, input, output) {
|
|
152
|
+
var index = 0;
|
|
153
153
|
while (length > 0) {
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
var oneInput = input.slice(index, index + 16);
|
|
155
|
+
var oneOutput = new Uint8Array(16);
|
|
156
156
|
sm4_one_round(sk, oneInput, oneOutput);
|
|
157
|
-
for (
|
|
157
|
+
for (var i = 0; i < 16; i++) {
|
|
158
158
|
output[index + i] = oneOutput[i];
|
|
159
159
|
}
|
|
160
160
|
index += 16;
|
|
161
161
|
length -= 16;
|
|
162
162
|
}
|
|
163
|
-
}
|
|
164
|
-
parseUtf8StringToHex(input) {
|
|
163
|
+
};
|
|
164
|
+
SM4.prototype.parseUtf8StringToHex = function (input) {
|
|
165
165
|
input = unescape(encodeURIComponent(input));
|
|
166
|
-
|
|
166
|
+
var length = input.length;
|
|
167
167
|
// 转换到字数组
|
|
168
|
-
|
|
169
|
-
for (
|
|
168
|
+
var words = [];
|
|
169
|
+
for (var i = 0; i < length; i++) {
|
|
170
170
|
words[i >>> 2] |= (input.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
|
|
171
171
|
}
|
|
172
172
|
// 转换到16进制
|
|
173
|
-
|
|
174
|
-
for (
|
|
175
|
-
|
|
173
|
+
var hexChars = [];
|
|
174
|
+
for (var i = 0; i < length; i++) {
|
|
175
|
+
var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
|
|
176
176
|
hexChars.push((bite >>> 4).toString(16));
|
|
177
177
|
hexChars.push((bite & 0x0f).toString(16));
|
|
178
178
|
}
|
|
179
179
|
return hexChars.join('');
|
|
180
|
-
}
|
|
180
|
+
};
|
|
181
181
|
/**
|
|
182
182
|
* 转成ascii码数组
|
|
183
183
|
*/
|
|
184
|
-
hexToArray(hexStr) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
for (
|
|
184
|
+
SM4.prototype.hexToArray = function (hexStr) {
|
|
185
|
+
var words = [];
|
|
186
|
+
var hexStrLength = hexStr.length;
|
|
187
|
+
for (var i = 0; i < hexStrLength; i += 2) {
|
|
188
188
|
words.push(parseInt(hexStr.substr(i, 2), 16));
|
|
189
189
|
}
|
|
190
190
|
return words;
|
|
191
|
-
}
|
|
192
|
-
|
|
191
|
+
};
|
|
192
|
+
return SM4;
|
|
193
|
+
}());
|
|
193
194
|
exports.SM4 = SM4;
|
package/login/cems/index.js
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.sso = exports.login = void 0;
|
|
8
|
-
|
|
8
|
+
var login = function () {
|
|
9
9
|
};
|
|
10
10
|
exports.login = login;
|
|
11
11
|
/**
|
|
12
12
|
* CEMS 登录
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
var sso = function (token) {
|
|
16
16
|
};
|
|
17
17
|
exports.sso = sso;
|