vap1 0.4.7 → 0.5.0
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/base.json +30 -0
- package/basetype.d.ts +0 -1
- package/cems/admin/AsyncSelect.d.ts +45 -0
- package/cems/admin/AsyncSelect.js +2 -0
- package/cems/admin/CardTable.d.ts +207 -0
- package/cems/admin/CardTable.js +2 -0
- package/cems/admin/EasyuiTree.d.ts +131 -0
- package/cems/admin/EasyuiTree.js +2 -0
- package/cems/admin/utils.d.ts +5 -0
- package/cems/admin/utils.js +3 -0
- package/cems/admin/validator.d.ts +137 -0
- package/cems/admin/validator.js +2 -0
- package/cems/assets/CUpload.d.ts +23 -0
- package/cems/assets/CUpload.js +2 -0
- package/cems/assets/Charts.d.ts +37 -0
- package/cems/assets/Charts.js +2 -0
- package/cems/assets/DInfo.d.ts +38 -0
- package/cems/assets/DInfo.js +2 -0
- package/cems/assets/DModal.d.ts +84 -0
- package/cems/assets/DModal.js +2 -0
- package/cems/assets/DTable.d.ts +128 -0
- package/cems/assets/DTable.js +2 -0
- package/cems/assets/DivWidth.d.ts +14 -0
- package/cems/assets/DivWidth.js +2 -0
- package/cems/assets/Patch.d.ts +9 -0
- package/cems/assets/Patch.js +2 -0
- package/cems/assets/Sensitive.d.ts +33 -0
- package/cems/assets/Sensitive.js +2 -0
- package/cems/assets/types.d.ts +200 -0
- package/cems/assets/types.js +2 -0
- package/cems/assets/utils.d.ts +61 -0
- package/cems/assets/utils.js +2 -0
- package/cems/define.d.ts +9 -0
- package/cems/define.js +18 -0
- package/cems/index.d.ts +228 -0
- package/cems/index.js +81 -0
- package/cems/policy/CForm.d.ts +133 -0
- package/cems/policy/CForm.js +2 -0
- package/cems/policy/DApiTable.d.ts +78 -0
- package/cems/policy/DApiTable.js +2 -0
- package/cems/policy/DButton.d.ts +17 -0
- package/cems/policy/DButton.js +2 -0
- package/cems/policy/DCheckbox.d.ts +50 -0
- package/cems/policy/DCheckbox.js +2 -0
- package/cems/policy/DCheckboxGroup.d.ts +34 -0
- package/cems/policy/DCheckboxGroup.js +2 -0
- package/cems/policy/DCol.d.ts +33 -0
- package/cems/policy/DCol.js +2 -0
- package/cems/policy/DColorPicker.d.ts +9 -0
- package/cems/policy/DColorPicker.js +2 -0
- package/cems/policy/DDatePicker.d.ts +41 -0
- package/cems/policy/DDatePicker.js +2 -0
- package/cems/policy/DDiv.d.ts +65 -0
- package/cems/policy/DDiv.js +2 -0
- package/cems/policy/DDrawer.d.ts +6 -0
- package/cems/policy/DDrawer.js +2 -0
- package/cems/policy/DDynamicSelect.d.ts +50 -0
- package/cems/policy/DDynamicSelect.js +2 -0
- package/cems/policy/DDynamicTreeSelect.d.ts +45 -0
- package/cems/policy/DDynamicTreeSelect.js +2 -0
- package/cems/policy/DForm.d.ts +248 -0
- package/cems/policy/DForm.js +2 -0
- package/cems/policy/DIcon.d.ts +33 -0
- package/cems/policy/DIcon.js +2 -0
- package/cems/policy/DInput.d.ts +41 -0
- package/cems/policy/DInput.js +2 -0
- package/cems/policy/DLabel.d.ts +17 -0
- package/cems/policy/DLabel.js +2 -0
- package/cems/policy/DPTable.d.ts +86 -0
- package/cems/policy/DPTable.js +2 -0
- package/cems/policy/DRadio.d.ts +34 -0
- package/cems/policy/DRadio.js +2 -0
- package/cems/policy/DSCTable.d.ts +33 -0
- package/cems/policy/DSCTable.js +2 -0
- package/cems/policy/DSelect.d.ts +42 -0
- package/cems/policy/DSelect.js +2 -0
- package/cems/policy/DSlider.d.ts +21 -0
- package/cems/policy/DSlider.js +2 -0
- package/cems/policy/DSwitch.d.ts +21 -0
- package/cems/policy/DSwitch.js +2 -0
- package/cems/policy/DTab.d.ts +30 -0
- package/cems/policy/DTab.js +2 -0
- package/cems/policy/DTimePicker.d.ts +37 -0
- package/cems/policy/DTimePicker.js +2 -0
- package/cems/policy/DTree.d.ts +98 -0
- package/cems/policy/DTree.js +2 -0
- package/cems/policy/DUpload.d.ts +33 -0
- package/cems/policy/DUpload.js +2 -0
- package/cems/policy/types.d.ts +200 -0
- package/cems/policy/types.js +2 -0
- package/cems/policy/utils.d.ts +13 -0
- package/cems/policy/utils.js +2 -0
- package/components/Box/Box.d.ts +42 -6
- package/components/Box/Box.js +66 -16
- package/components/Box/SelectBar.d.ts +1 -1
- package/components/Box/SelectBar.js +19 -9
- package/components/Lists/BaseList.d.ts +5 -0
- package/components/Lists/BaseList.js +111 -0
- package/components/Lists/Fields/IconRender.d.ts +53 -0
- package/components/Lists/Fields/IconRender.js +174 -0
- package/components/Lists/Fields/ItemRender.d.ts +2 -0
- package/components/Lists/Fields/ItemRender.js +127 -0
- package/components/Lists/Fields/_utils.d.ts +3 -0
- package/components/Lists/Fields/_utils.js +80 -0
- package/components/Lists/Fields/index.d.ts +3 -0
- package/components/Lists/Fields/index.js +47 -0
- package/components/Lists/Grid/grid.d.ts +7 -0
- package/components/Lists/Grid/grid.js +18 -0
- package/components/Lists/Grid/index.d.ts +3 -0
- package/components/Lists/Grid/index.js +50 -0
- package/components/Lists/Row/index.d.ts +3 -0
- package/components/Lists/Row/index.js +14 -0
- package/components/Lists/SList.js +17 -7
- package/components/Lists/Timeline/index.d.ts +3 -0
- package/components/Lists/Timeline/index.js +117 -0
- package/components/Lists/VList.d.ts +3 -0
- package/components/Lists/VList.js +92 -0
- package/components/Lists/components/LayoutSwitcher.d.ts +13 -0
- package/components/Lists/components/LayoutSwitcher.js +121 -0
- package/components/Lists/components/SearchTool.d.ts +13 -0
- package/components/Lists/components/SearchTool.js +34 -0
- package/components/Lists/index.d.ts +129 -0
- package/components/Lists/index.js +2 -0
- package/components/SearchTool/SearchBand/BandInput.d.ts +3 -0
- package/components/SearchTool/SearchBand/BandInput.js +54 -0
- package/components/SearchTool/SearchBand/BandTag.d.ts +7 -0
- package/components/SearchTool/SearchBand/BandTag.js +82 -0
- package/components/SearchTool/SearchBand/_SearchBandAction.d.ts +3 -0
- package/components/SearchTool/SearchBand/_SearchBandAction.js +23 -0
- package/components/SearchTool/SearchBand/_SearchBandFix.d.ts +3 -0
- package/components/SearchTool/SearchBand/_SearchBandFix.js +72 -0
- package/components/SearchTool/SearchBand/_SearchBandTag.d.ts +3 -0
- package/components/SearchTool/SearchBand/_SearchBandTag.js +75 -0
- package/components/SearchTool/SearchBand/_register.d.ts +47 -0
- package/components/SearchTool/SearchBand/_register.js +15 -0
- package/components/SearchTool/SearchBand/hooks.d.ts +12 -0
- package/components/SearchTool/SearchBand/hooks.js +181 -0
- package/components/SearchTool/SearchBand/index.d.ts +3 -0
- package/components/SearchTool/SearchBand/index.js +66 -0
- package/components/SearchTool/SearchBand/type.d.ts +71 -0
- package/components/SearchTool/SearchBand/type.js +3 -0
- package/components/SearchTool/SearchBar/ActionButtons.js +17 -7
- package/components/SearchTool/SearchBar/ByField.d.ts +1 -1
- package/components/SearchTool/SearchBar/ByField.js +17 -7
- package/components/SearchTool/SearchBar/ByKeyword.d.ts +1 -1
- package/components/SearchTool/SearchBar/ByKeyword.js +17 -7
- package/components/SearchTool/SearchBar/SearchField.d.ts +1 -1
- package/components/SearchTool/SearchBar/_register.d.ts +1 -1
- package/components/SearchTool/SearchBar/index.d.ts +1 -65
- package/components/SearchTool/SearchBar/type.d.ts +133 -0
- package/components/SearchTool/SearchBar/type.js +35 -0
- package/components/SearchTool/index.d.ts +5 -63
- package/components/SearchTool/index.js +5 -0
- package/components/Tables/ApiTable.d.ts +5 -7
- package/components/Tables/ApiTable.js +17 -7
- package/components/Tables/ApiTableModal.d.ts +5 -7
- package/components/Tables/ApiTableModal.js +17 -7
- package/components/Tables/Components/ActionBar.d.ts +7 -10
- package/components/Tables/Components/ActionBar.js +73 -40
- package/components/Tables/Components/Actions.d.ts +3 -1
- package/components/Tables/Components/Actions.js +40 -3
- package/components/Tables/Components/index.d.ts +3 -1
- package/components/Tables/Components/useTableContext.d.ts +16 -0
- package/components/Tables/Components/useTableContext.js +116 -0
- package/components/Tables/STable.js +17 -7
- package/components/Tables/TopTable.js +17 -7
- package/components/Tables/Util.d.ts +2 -2
- package/components/Tables/Util.js +0 -1
- package/components/Tables/VTable.d.ts +9 -11
- package/components/Tables/VTable.js +119 -172
- package/components/Tables/VTableBack.d.ts +0 -0
- package/components/Tables/VTableBack.js +269 -0
- package/components/Tables/index.d.ts +11 -22
- package/components/TreeSelect/BaseTreeSelect.js +17 -7
- package/components/TreeSelect/DTreeSelect.js +19 -9
- package/components/TreeSelect/FTreeSelect.js +2 -2
- package/components/Trees/ActionTree.d.ts +3 -5
- package/components/Trees/ActionTree.js +19 -9
- package/components/Trees/BaseTree.js +17 -7
- package/components/Trees/COTree/COButton.js +17 -7
- package/components/Trees/COTree/COSelect.js +17 -7
- package/components/Trees/COTree/COTree.js +19 -9
- package/components/Trees/DTree.d.ts +0 -7
- package/components/Trees/DTree.js +19 -9
- package/components/Trees/FTree.js +19 -9
- package/components/Trees/STree.js +17 -7
- package/components/UForm/FormWrapper.js +17 -7
- package/components/UForm/UDescriptions.d.ts +2 -3
- package/components/UForm/UDescriptions.js +17 -7
- package/components/UForm/UForm.d.ts +1 -1
- package/components/UForm/UForm.js +24 -11
- package/components/UForm/UFormModal.js +19 -9
- package/components/UForm/_input.d.ts +5 -1
- package/components/UForm/_input.js +25 -8
- package/components/Upload/UploadImage.js +17 -7
- package/components/Upload/UploadModal.js +19 -9
- package/components/Upload/useUpload.js +2 -2
- package/components/_adapt/Alert.js +17 -7
- package/components/_adapt/ColorPicker.js +17 -7
- package/components/_adapt/Drawer.js +17 -7
- package/components/_adapt/Dropdown.js +17 -7
- package/components/_adapt/FloatButton.js +17 -7
- package/components/_adapt/Input.js +17 -7
- package/components/_adapt/InputNumber.js +17 -7
- package/components/_adapt/Layout.js +17 -7
- package/components/_adapt/Menu.js +17 -7
- package/components/_adapt/Modal.js +17 -7
- package/components/_adapt/Popconfirm.js +17 -7
- package/components/_adapt/Popover.js +17 -7
- package/components/_adapt/Progress.js +17 -7
- package/components/_adapt/Select.js +17 -7
- package/components/_adapt/Table.js +17 -7
- package/components/_adapt/Tabs.js +17 -7
- package/components/_adapt/Tag.js +17 -7
- package/components/_adapt/TreeSelect.js +17 -7
- package/components/_adapt/todo/Image.d.ts +0 -1
- package/components/_adapt/todo/Segmented.d.ts +0 -1
- package/components/_common/AutoComplete.js +35 -12
- package/components/_common/CountUp.js +17 -7
- package/components/_common/DateRange.d.ts +5 -2
- package/components/_common/DateRange.js +43 -40
- package/components/_common/HighLight.d.ts +1 -1
- package/components/_common/HighLight.js +26 -24
- package/components/_common/Loading.js +17 -7
- package/components/_common/MonthRange.js +17 -7
- package/components/_common/PromiseLabel.js +2 -2
- package/components/_common/UTitle.js +17 -7
- package/components/_common/Upagination.d.ts +1 -0
- package/components/_common/Upagination.js +5 -1
- package/components/_i18n.d.ts +1 -102
- package/components/index.js +4 -0
- package/deps/JsonView.js +17 -7
- package/deps/app-audit/LookUp.js +19 -9
- package/deps/app-data/useSource.js +19 -9
- package/deps/echarts.d.ts +3 -0
- package/deps/echarts.js +20 -10
- package/deps/editor/Article.js +17 -7
- package/deps/editor/Editor.js +17 -7
- package/deps/editor/EditorModal.js +17 -7
- package/deps/editor/support/buttons/ImageButton.js +17 -7
- package/deps/editor/tools/Button.js +0 -2
- package/deps/editor/tools/_TxtButton.js +17 -7
- package/deps/vapc/_basic.d.ts +1 -0
- package/deps/vapc/_basic.js +15 -0
- package/deps/vapc/index.d.ts +10 -0
- package/deps/vapc/index.js +70 -0
- package/hooks/useAjaxAction.js +2 -2
- package/hooks/useAjaxQuery.js +2 -2
- package/hooks/useApiBase.js +2 -2
- package/hooks/useApiGlobal.js +1 -1
- package/hooks/useArray.js +2 -2
- package/hooks/useDefault.d.ts +0 -1
- package/hooks/useDoLoad.d.ts +1 -1
- package/hooks/useError.d.ts +1 -1
- package/hooks/useMemoPromise.js +2 -2
- package/index.d.ts +2 -1
- package/login/Base65.d.ts +7 -1
- package/login/Base65.js +49 -22
- package/login/Password.d.ts +8 -5
- package/login/Password.js +68 -102
- package/package.json +1 -1
- package/screen/Page.js +17 -7
- package/screen/vapc-schema/dark.d.ts +1 -0
- package/screen/vapc-schema/dark.js +50 -0
- package/screen/vapc-schema/insight.d.ts +1 -0
- package/screen/vapc-schema/insight.js +49 -0
- package/uform/FormEditor.js +17 -7
- package/uform/FormViewer.js +17 -7
- package/uform/hooks/useEditor.d.ts +0 -1
- package/uform/hooks/useForm.d.ts +0 -1
- package/uform/inputs/index.d.ts +0 -1
- package/uform/panel/Editor/_GroupDefault.js +17 -7
- package/uform/panel/Editor/_GroupStep.js +17 -7
- package/uform/panel/Editor/_GroupTab.js +17 -7
- package/uform/panel/Editor/index.js +17 -7
- package/uform/panel/Items/Fields.js +17 -7
- package/uform/panel/Items/InputSelector.js +17 -7
- package/uform/panel/Items/Inputs.js +17 -7
- package/uform/panel/Items/index.d.ts +1 -1
- package/uform/panel/Propreties/CanvasProperties.js +17 -7
- package/uform/panel/Propreties/Component/FieldPlugin.js +17 -7
- package/uform/panel/Propreties/Component/LinkAsyncFunction.js +17 -7
- package/uform/panel/Propreties/Component/LinkSyncFunction.js +17 -7
- package/uform/panel/Propreties/Component/Links.js +17 -7
- package/uform/panel/Propreties/Component/OptionTable.js +17 -7
- package/uform/panel/Propreties/Component/RegexpModal.js +17 -7
- package/uform/panel/Propreties/Component/Validate.js +17 -7
- package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +17 -7
- package/uform/panel/Propreties/Component/ValidateSyncFunction.js +17 -7
- package/uform/panel/Propreties/FieldOptions.js +17 -7
- package/uform/panel/Propreties/FieldProperties.js +17 -7
- package/uform/panel/Propreties/_ItemAdvance.js +17 -7
- package/uform/panel/Propreties/_ItemBase.js +17 -7
- package/uform/panel/Propreties/_ItemLink.js +17 -7
- package/uform/panel/Propreties/_ItemValidate.js +17 -7
- package/uform/schema.d.ts +1 -1
- package/uform/utils/Convert.js +2 -2
- package/utils/Ajax.d.ts +3 -0
- package/utils/Ajax.js +10 -7
- package/utils/CacheUtil.d.ts +1 -1
- package/utils/Const.js +17 -7
- package/utils/Format.d.ts +138 -14
- package/utils/Format.js +127 -13
- package/utils/Global.d.ts +12 -0
- package/utils/Global.js +7 -1
- package/utils/PageUtil.d.ts +111 -23
- package/utils/PageUtil.js +163 -28
- package/utils/Renders/ApiGetRender.js +20 -10
- package/utils/Renders/ApiPostRender.js +3 -3
- package/utils/Renders/CondictionRender.js +17 -7
- package/utils/Renders/DateRender.js +20 -2
- package/utils/Renders/ListRender.js +1 -1
- package/utils/Renders/NumberRender.js +24 -5
- package/utils/Renders/StringRender.js +81 -11
- package/utils/Renders/_define.d.ts +8 -7
- package/utils/Renders/_define.js +76 -17
- package/utils/StringUtil.d.ts +292 -62
- package/utils/StringUtil.js +310 -63
- package/utils/TreeUtil.js +14 -10
- package/utils/VAP.d.ts +26 -1
- package/utils/VAP.js +57 -0
- package/utils/_AjaxUtil.d.ts +1 -0
- package/utils/_AjaxUtil.js +70 -3
- package/utils/_Support.d.ts +2 -2
- package/utils/_Support.js +4 -2
- package/utils/crontab/crontabRender.js +0 -1
- package/utils/i18n.d.ts +13 -2
- package/utils/i18n.js +13 -2
- package/utils/index.d.ts +4 -0
- package/utils/index.js +19 -9
- package/components/SearchTool/_FieldType.d.ts +0 -8
- package/components/SearchTool/_FieldType.js +0 -51
package/utils/CacheUtil.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare const set: (key: string, value: any) => void;
|
|
|
2
2
|
/**
|
|
3
3
|
* 获取 Session 缓存, 并以 Object 返回 (JSON)
|
|
4
4
|
*/
|
|
5
|
-
export declare const getData: <T extends object = any>(key: string, defaultValue?: T) => any;
|
|
5
|
+
export declare const getData: <T extends object = any>(key: string, defaultValue?: T) => T | any;
|
|
6
6
|
/**
|
|
7
7
|
* 获取 Session 缓存, 并以 String 返回
|
|
8
8
|
*/
|
package/utils/Const.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.DO_NOT_SHOW_PROCESS = exports.DATE_FORMAT = exports.NONE = void 0;
|
|
27
37
|
var react_1 = __importStar(require("react"));
|
package/utils/Format.d.ts
CHANGED
|
@@ -1,35 +1,159 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* 小数位数参数的类型定义,用于数字格式化函数
|
|
3
|
+
* 定义了小数点后有效位数,或者布尔标志
|
|
4
4
|
*/
|
|
5
5
|
export type FractionDigits = boolean | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19;
|
|
6
|
+
/**
|
|
7
|
+
* getFormater函数使用的数字格式选项类型定义
|
|
8
|
+
*/
|
|
6
9
|
export type NumberFormat = 'int' | 'int-fixed' | 'number' | 'size' | 'usd' | 'chinese' | 'percent';
|
|
7
10
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
+
* 使用美元格式(逗号分隔符)格式化数字
|
|
12
|
+
*
|
|
13
|
+
* @param num - 要格式化的数字
|
|
14
|
+
* @param digital - 显示的小数位数(如果为false或0,则显示整数)
|
|
15
|
+
* @returns 带千位分隔符的格式化字符串
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* formatUSD(123456) => '123,456'
|
|
19
|
+
* formatUSD(1234567, 2) => '1,234,567.00'
|
|
20
|
+
*/
|
|
11
21
|
export declare const formatUSD: (num: number, digital?: FractionDigits) => string;
|
|
12
22
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* fractionDigits
|
|
18
|
-
|
|
23
|
+
* 将数字格式化为百分比
|
|
24
|
+
*
|
|
25
|
+
* @param num - 分子(要格式化的数字)
|
|
26
|
+
* @param basic - 分母(默认为1)
|
|
27
|
+
* @param fractionDigits - 显示的小数位数(默认为2)
|
|
28
|
+
* @returns 带%符号的格式化百分比字符串
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* formatPercent(0.2, 1) => '20%'
|
|
32
|
+
* formatPercent(20, 100) => '20%'
|
|
33
|
+
* formatPercent(0.255, 1, 1) => '25.5%'
|
|
34
|
+
*/
|
|
19
35
|
export declare const formatPercent: (num: number, basic?: number, fractionDigits?: FractionDigits) => string;
|
|
36
|
+
/**
|
|
37
|
+
* 将字节大小格式化为人类可读的格式并附带适当的单位
|
|
38
|
+
*
|
|
39
|
+
* @param byteSize - 字节大小
|
|
40
|
+
* @returns 带有适当单位的格式化字符串(b, KB, MB, GB, TB, PB)
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* formatSize(1500) => '1.46KB'
|
|
44
|
+
* formatSize(1500000) => '1.43MB'
|
|
45
|
+
*/
|
|
20
46
|
export declare const formatSize: (byteSize: number) => string;
|
|
21
47
|
/**
|
|
22
|
-
*
|
|
23
|
-
|
|
48
|
+
* 将数字格式化为指定小数位数
|
|
49
|
+
*
|
|
50
|
+
* @param num - 要格式化的数字
|
|
51
|
+
* @param fractionDigits - 小数位数(默认为2)
|
|
52
|
+
* @returns 格式化后的数字字符串
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* formatNumber(123.456, 2) => '123.46'
|
|
56
|
+
* formatNumber(123.456, 0) => '123'
|
|
57
|
+
*/
|
|
24
58
|
export declare const formatNumber: (num: number, fractionDigits?: FractionDigits) => string;
|
|
59
|
+
/**
|
|
60
|
+
* 将数字格式化为整数(四舍五入)
|
|
61
|
+
*
|
|
62
|
+
* @param num - 要格式化的数字
|
|
63
|
+
* @param returnString - 是否将结果作为字符串返回(默认为false)
|
|
64
|
+
* @returns 根据returnString参数返回四舍五入的整数或字符串
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* formatInt(123.6) => 124
|
|
68
|
+
* formatInt(123.6, true) => '124'
|
|
69
|
+
*/
|
|
25
70
|
export declare function formatInt(num: number): number;
|
|
26
71
|
export declare function formatInt(num: number, returnString: false): number;
|
|
27
72
|
export declare function formatInt(num: number, returnString: true): string;
|
|
73
|
+
/**
|
|
74
|
+
* 将数字格式化为固定长度的整数,前面补零
|
|
75
|
+
*
|
|
76
|
+
* @param num - 要格式化的数字
|
|
77
|
+
* @param fractionDigits - 期望的字符串长度(默认为5)
|
|
78
|
+
* @returns 带前导零的固定长度字符串
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* formatIntFixed(123, 5) => '00123'
|
|
82
|
+
* formatIntFixed(1234, 3) => '1234' (超出限制,返回完整数字)
|
|
83
|
+
*/
|
|
28
84
|
export declare const formatIntFixed: (num: number, fractionDigits?: FractionDigits) => string;
|
|
85
|
+
/**
|
|
86
|
+
* 使用中文数字单位(万、亿)格式化数字
|
|
87
|
+
*
|
|
88
|
+
* @param num - 要格式化的数字
|
|
89
|
+
* @param digital - 小数位数(默认为2)
|
|
90
|
+
* @returns 带中文单位的格式化字符串
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* formatChinese(12345) => '1.23万'
|
|
94
|
+
* formatChinese(123456789) => '1.23亿'
|
|
95
|
+
*/
|
|
29
96
|
export declare const formatChinese: (num: number, digital?: boolean | FractionDigits) => string;
|
|
30
|
-
|
|
97
|
+
/**
|
|
98
|
+
* 根据指定的数字格式类型返回格式化函数
|
|
99
|
+
*
|
|
100
|
+
* @param type - 数字格式类型
|
|
101
|
+
* @param fix - 小数位数(可选)
|
|
102
|
+
* @returns 按照指定类型格式化数字的函数
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* const formatter = getFormater('usd');
|
|
106
|
+
* formatter(12345) => '12,345'
|
|
107
|
+
*/
|
|
108
|
+
export declare const getFormater: (type: NumberFormat, fix?: FractionDigits) => ((num: number) => string);
|
|
109
|
+
/**
|
|
110
|
+
* 将日期字符串或时间戳格式化为YYYY-MM-DD
|
|
111
|
+
*
|
|
112
|
+
* @param str - 日期字符串或时间戳
|
|
113
|
+
* @returns 格式化的日期字符串,无效则返回空字符串
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* formatDate('2023-01-15T12:30:45') => '2023-01-15'
|
|
117
|
+
*/
|
|
31
118
|
export declare const formatDate: (str: string | number) => string;
|
|
119
|
+
/**
|
|
120
|
+
* 将日期字符串或时间戳格式化为YYYY-MM-DD HH:mm:ss
|
|
121
|
+
*
|
|
122
|
+
* @param str - 日期字符串或时间戳
|
|
123
|
+
* @returns 格式化的日期时间字符串,无效则返回空字符串
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* formatDateTime('2023-01-15T12:30:45') => '2023-01-15 12:30:45'
|
|
127
|
+
*/
|
|
32
128
|
export declare const formatDateTime: (str: string | number) => string;
|
|
129
|
+
/**
|
|
130
|
+
* 对身份证号码进行隐私保护处理
|
|
131
|
+
*
|
|
132
|
+
* @param str - 身份证号码字符串
|
|
133
|
+
* @returns 中间部分被隐藏的身份证号码
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* maskIdCard('123456789012345678') => '12345*******678'
|
|
137
|
+
*/
|
|
33
138
|
export declare const maskIdCard: (str: string) => string;
|
|
139
|
+
/**
|
|
140
|
+
* 对电话号码进行隐私保护处理
|
|
141
|
+
*
|
|
142
|
+
* @param str - 电话号码字符串
|
|
143
|
+
* @returns 中间部分被隐藏的电话号码
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* maskPhone('1234567890') => '123****7890'
|
|
147
|
+
* maskPhone('123-4567890') => '123***890'
|
|
148
|
+
*/
|
|
34
149
|
export declare const maskPhone: (str: string) => string;
|
|
150
|
+
/**
|
|
151
|
+
* 对电子邮件地址进行隐私保护处理
|
|
152
|
+
*
|
|
153
|
+
* @param str - 电子邮件地址字符串
|
|
154
|
+
* @returns 账户部分和域名部分被部分隐藏的电子邮件
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* maskEmail('user@example.com') => 'us*********@***********.com'
|
|
158
|
+
*/
|
|
35
159
|
export declare const maskEmail: (str: string) => string;
|
package/utils/Format.js
CHANGED
|
@@ -19,11 +19,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.maskEmail = exports.maskPhone = exports.maskIdCard = exports.formatDateTime = exports.formatDate = exports.getFormater = exports.formatChinese = exports.formatIntFixed = exports.
|
|
22
|
+
exports.maskEmail = exports.maskPhone = exports.maskIdCard = exports.formatDateTime = exports.formatDate = exports.getFormater = exports.formatChinese = exports.formatIntFixed = exports.formatNumber = exports.formatSize = exports.formatPercent = exports.formatUSD = void 0;
|
|
23
|
+
exports.formatInt = formatInt;
|
|
23
24
|
var lodash_1 = __importDefault(require("lodash"));
|
|
24
25
|
var Const_1 = require("./Const");
|
|
25
26
|
var StringUtil_1 = require("./StringUtil");
|
|
26
27
|
var dayjs_1 = __importDefault(require("dayjs"));
|
|
28
|
+
/**
|
|
29
|
+
* 定点数格式化的最大值数组
|
|
30
|
+
* 用于限制formatIntFixed函数中数字的上限
|
|
31
|
+
*/
|
|
27
32
|
var MAX_FIX = [
|
|
28
33
|
0,
|
|
29
34
|
9,
|
|
@@ -43,9 +48,16 @@ var MAX_FIX = [
|
|
|
43
48
|
999999999999999
|
|
44
49
|
];
|
|
45
50
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
|
|
51
|
+
* 使用美元格式(逗号分隔符)格式化数字
|
|
52
|
+
*
|
|
53
|
+
* @param num - 要格式化的数字
|
|
54
|
+
* @param digital - 显示的小数位数(如果为false或0,则显示整数)
|
|
55
|
+
* @returns 带千位分隔符的格式化字符串
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* formatUSD(123456) => '123,456'
|
|
59
|
+
* formatUSD(1234567, 2) => '1,234,567.00'
|
|
60
|
+
*/
|
|
49
61
|
var formatUSD = function (num, digital) {
|
|
50
62
|
if (digital === void 0) { digital = false; }
|
|
51
63
|
if (digital == false || digital == 0)
|
|
@@ -55,18 +67,34 @@ var formatUSD = function (num, digital) {
|
|
|
55
67
|
};
|
|
56
68
|
exports.formatUSD = formatUSD;
|
|
57
69
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* fractionDigits
|
|
63
|
-
|
|
70
|
+
* 将数字格式化为百分比
|
|
71
|
+
*
|
|
72
|
+
* @param num - 分子(要格式化的数字)
|
|
73
|
+
* @param basic - 分母(默认为1)
|
|
74
|
+
* @param fractionDigits - 显示的小数位数(默认为2)
|
|
75
|
+
* @returns 带%符号的格式化百分比字符串
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* formatPercent(0.2, 1) => '20%'
|
|
79
|
+
* formatPercent(20, 100) => '20%'
|
|
80
|
+
* formatPercent(0.255, 1, 1) => '25.5%'
|
|
81
|
+
*/
|
|
64
82
|
var formatPercent = function (num, basic, fractionDigits) {
|
|
65
83
|
if (basic === void 0) { basic = 1; }
|
|
66
84
|
if (fractionDigits === void 0) { fractionDigits = 2; }
|
|
67
85
|
return (0, exports.formatNumber)(num * 100 / basic, fractionDigits) + '%';
|
|
68
86
|
};
|
|
69
87
|
exports.formatPercent = formatPercent;
|
|
88
|
+
/**
|
|
89
|
+
* 将字节大小格式化为人类可读的格式并附带适当的单位
|
|
90
|
+
*
|
|
91
|
+
* @param byteSize - 字节大小
|
|
92
|
+
* @returns 带有适当单位的格式化字符串(b, KB, MB, GB, TB, PB)
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* formatSize(1500) => '1.46KB'
|
|
96
|
+
* formatSize(1500000) => '1.43MB'
|
|
97
|
+
*/
|
|
70
98
|
var formatSize = function (byteSize) {
|
|
71
99
|
if (byteSize < 1024)
|
|
72
100
|
return (0, exports.formatNumber)(byteSize) + 'b';
|
|
@@ -87,8 +115,16 @@ var formatSize = function (byteSize) {
|
|
|
87
115
|
};
|
|
88
116
|
exports.formatSize = formatSize;
|
|
89
117
|
/**
|
|
90
|
-
*
|
|
91
|
-
|
|
118
|
+
* 将数字格式化为指定小数位数
|
|
119
|
+
*
|
|
120
|
+
* @param num - 要格式化的数字
|
|
121
|
+
* @param fractionDigits - 小数位数(默认为2)
|
|
122
|
+
* @returns 格式化后的数字字符串
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* formatNumber(123.456, 2) => '123.46'
|
|
126
|
+
* formatNumber(123.456, 0) => '123'
|
|
127
|
+
*/
|
|
92
128
|
var formatNumber = function (num, fractionDigits) {
|
|
93
129
|
if (fractionDigits === void 0) { fractionDigits = 2; }
|
|
94
130
|
if (fractionDigits == false || fractionDigits == 0)
|
|
@@ -104,7 +140,17 @@ function formatInt(num, returnString) {
|
|
|
104
140
|
}
|
|
105
141
|
return result;
|
|
106
142
|
}
|
|
107
|
-
|
|
143
|
+
/**
|
|
144
|
+
* 将数字格式化为固定长度的整数,前面补零
|
|
145
|
+
*
|
|
146
|
+
* @param num - 要格式化的数字
|
|
147
|
+
* @param fractionDigits - 期望的字符串长度(默认为5)
|
|
148
|
+
* @returns 带前导零的固定长度字符串
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* formatIntFixed(123, 5) => '00123'
|
|
152
|
+
* formatIntFixed(1234, 3) => '1234' (超出限制,返回完整数字)
|
|
153
|
+
*/
|
|
108
154
|
var formatIntFixed = function (num, fractionDigits) {
|
|
109
155
|
if (fractionDigits === void 0) { fractionDigits = 5; }
|
|
110
156
|
var pos = lodash_1.default.isNumber(fractionDigits) ? fractionDigits : 5;
|
|
@@ -120,6 +166,17 @@ var formatIntFixed = function (num, fractionDigits) {
|
|
|
120
166
|
return prefix + val;
|
|
121
167
|
};
|
|
122
168
|
exports.formatIntFixed = formatIntFixed;
|
|
169
|
+
/**
|
|
170
|
+
* 使用中文数字单位(万、亿)格式化数字
|
|
171
|
+
*
|
|
172
|
+
* @param num - 要格式化的数字
|
|
173
|
+
* @param digital - 小数位数(默认为2)
|
|
174
|
+
* @returns 带中文单位的格式化字符串
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* formatChinese(12345) => '1.23万'
|
|
178
|
+
* formatChinese(123456789) => '1.23亿'
|
|
179
|
+
*/
|
|
123
180
|
var formatChinese = function (num, digital) {
|
|
124
181
|
if (digital === void 0) { digital = 2; }
|
|
125
182
|
var result;
|
|
@@ -147,6 +204,17 @@ var formatChinese = function (num, digital) {
|
|
|
147
204
|
return result + unit;
|
|
148
205
|
};
|
|
149
206
|
exports.formatChinese = formatChinese;
|
|
207
|
+
/**
|
|
208
|
+
* 根据指定的数字格式类型返回格式化函数
|
|
209
|
+
*
|
|
210
|
+
* @param type - 数字格式类型
|
|
211
|
+
* @param fix - 小数位数(可选)
|
|
212
|
+
* @returns 按照指定类型格式化数字的函数
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* const formatter = getFormater('usd');
|
|
216
|
+
* formatter(12345) => '12,345'
|
|
217
|
+
*/
|
|
150
218
|
var getFormater = function (type, fix) {
|
|
151
219
|
switch (type) {
|
|
152
220
|
case 'number':
|
|
@@ -173,6 +241,15 @@ var getFormater = function (type, fix) {
|
|
|
173
241
|
}
|
|
174
242
|
};
|
|
175
243
|
exports.getFormater = getFormater;
|
|
244
|
+
/**
|
|
245
|
+
* 将日期字符串或时间戳格式化为YYYY-MM-DD
|
|
246
|
+
*
|
|
247
|
+
* @param str - 日期字符串或时间戳
|
|
248
|
+
* @returns 格式化的日期字符串,无效则返回空字符串
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* formatDate('2023-01-15T12:30:45') => '2023-01-15'
|
|
252
|
+
*/
|
|
176
253
|
var formatDate = function (str) {
|
|
177
254
|
var date = (0, dayjs_1.default)(str);
|
|
178
255
|
if (date.isValid())
|
|
@@ -180,6 +257,15 @@ var formatDate = function (str) {
|
|
|
180
257
|
return '';
|
|
181
258
|
};
|
|
182
259
|
exports.formatDate = formatDate;
|
|
260
|
+
/**
|
|
261
|
+
* 将日期字符串或时间戳格式化为YYYY-MM-DD HH:mm:ss
|
|
262
|
+
*
|
|
263
|
+
* @param str - 日期字符串或时间戳
|
|
264
|
+
* @returns 格式化的日期时间字符串,无效则返回空字符串
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* formatDateTime('2023-01-15T12:30:45') => '2023-01-15 12:30:45'
|
|
268
|
+
*/
|
|
183
269
|
var formatDateTime = function (str) {
|
|
184
270
|
var date = (0, dayjs_1.default)(str);
|
|
185
271
|
if (date.isValid())
|
|
@@ -187,6 +273,15 @@ var formatDateTime = function (str) {
|
|
|
187
273
|
return '';
|
|
188
274
|
};
|
|
189
275
|
exports.formatDateTime = formatDateTime;
|
|
276
|
+
/**
|
|
277
|
+
* 对身份证号码进行隐私保护处理
|
|
278
|
+
*
|
|
279
|
+
* @param str - 身份证号码字符串
|
|
280
|
+
* @returns 中间部分被隐藏的身份证号码
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* maskIdCard('123456789012345678') => '12345*******678'
|
|
284
|
+
*/
|
|
190
285
|
var maskIdCard = function (str) {
|
|
191
286
|
if (!lodash_1.default.isString(str) || str == null)
|
|
192
287
|
return '';
|
|
@@ -195,6 +290,16 @@ var maskIdCard = function (str) {
|
|
|
195
290
|
return str.substring(0, 5) + '*******' + str.substring(str.length - 3);
|
|
196
291
|
};
|
|
197
292
|
exports.maskIdCard = maskIdCard;
|
|
293
|
+
/**
|
|
294
|
+
* 对电话号码进行隐私保护处理
|
|
295
|
+
*
|
|
296
|
+
* @param str - 电话号码字符串
|
|
297
|
+
* @returns 中间部分被隐藏的电话号码
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* maskPhone('1234567890') => '123****7890'
|
|
301
|
+
* maskPhone('123-4567890') => '123***890'
|
|
302
|
+
*/
|
|
198
303
|
var maskPhone = function (str) {
|
|
199
304
|
if (!lodash_1.default.isString(str) || str == null)
|
|
200
305
|
return '';
|
|
@@ -206,6 +311,15 @@ var maskPhone = function (str) {
|
|
|
206
311
|
return str.substring(0, 3) + '****' + str.substring(str.length - 4);
|
|
207
312
|
};
|
|
208
313
|
exports.maskPhone = maskPhone;
|
|
314
|
+
/**
|
|
315
|
+
* 对电子邮件地址进行隐私保护处理
|
|
316
|
+
*
|
|
317
|
+
* @param str - 电子邮件地址字符串
|
|
318
|
+
* @returns 账户部分和域名部分被部分隐藏的电子邮件
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* maskEmail('user@example.com') => 'us*********@***********.com'
|
|
322
|
+
*/
|
|
209
323
|
var maskEmail = function (str) {
|
|
210
324
|
if (!lodash_1.default.isString(str) || str == null)
|
|
211
325
|
return '';
|
package/utils/Global.d.ts
CHANGED
|
@@ -88,7 +88,19 @@ export type GlobalSetting = {
|
|
|
88
88
|
data: string;
|
|
89
89
|
};
|
|
90
90
|
AJAX: {
|
|
91
|
+
/**
|
|
92
|
+
* 是否禁用缓存,默认false
|
|
93
|
+
* 设置为 true 后,Ajax.GET 将不进行缓存判断
|
|
94
|
+
* 说明: VAP 内置此功能,使用 /XX/?__DISABLE_CACHE=1 可禁用
|
|
95
|
+
*/
|
|
96
|
+
disableCache: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Ajax 超时时间,单位:ms ,默认为 15000 = 15秒
|
|
99
|
+
*/
|
|
91
100
|
timeout: number;
|
|
101
|
+
/**
|
|
102
|
+
* 发送前拦截处理
|
|
103
|
+
*/
|
|
92
104
|
beforeSend: (url: string, method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', headers: HeadersInit, query: PlainObject) => [string, 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH', HeadersInit, PlainObject];
|
|
93
105
|
/**
|
|
94
106
|
* beforeReceive :
|
package/utils/Global.js
CHANGED
|
@@ -60,7 +60,13 @@ var DEFAULT = {
|
|
|
60
60
|
VLIST: { list: 'list', total: 'total', totalAcc: 'totalAcc', start: 'start_', count: 'count_', order: 'order_', by: 'by_' },
|
|
61
61
|
VDATA: { data: 'data' },
|
|
62
62
|
BOX: { SELECT_CLOSE: 2 },
|
|
63
|
-
AJAX: {
|
|
63
|
+
AJAX: {
|
|
64
|
+
timeout: 30000,
|
|
65
|
+
beforeSend: null,
|
|
66
|
+
beforeReceive: null,
|
|
67
|
+
headers: { 'Content-Type': 'application/json' },
|
|
68
|
+
disableCache: false,
|
|
69
|
+
},
|
|
64
70
|
UPLOAD: {
|
|
65
71
|
API: '/api-common/file/upload',
|
|
66
72
|
PREVIEW: '/api-common/file/show/',
|
package/utils/PageUtil.d.ts
CHANGED
|
@@ -1,73 +1,161 @@
|
|
|
1
1
|
import type { BaseOption, PlainObject } from '../basetype';
|
|
2
2
|
/**
|
|
3
3
|
* 阻止事件简单封装
|
|
4
|
-
|
|
4
|
+
* @param evt - 事件对象
|
|
5
|
+
* @param callback - 可选的回调函数
|
|
6
|
+
* @example
|
|
7
|
+
* // 阻止点击事件的默认行为和冒泡
|
|
8
|
+
* button.addEventListener('click', (e) => {
|
|
9
|
+
* stopEvent(e, () => console.log('Event stopped'));
|
|
10
|
+
* });
|
|
11
|
+
*/
|
|
5
12
|
export declare const stopEvent: (evt: any, callback?: () => void) => void;
|
|
6
13
|
/**
|
|
7
14
|
* 将一个参数对象转换为 url Pattern 形式
|
|
8
|
-
|
|
15
|
+
* @param param - 参数对象
|
|
16
|
+
* @param baseUrl - 可选的基础URL
|
|
17
|
+
* @returns 格式化后的URL字符串
|
|
18
|
+
* @example
|
|
19
|
+
* // 返回 "name=John&age=30"
|
|
20
|
+
* paramToUri({name: 'John', age: 30});
|
|
21
|
+
*
|
|
22
|
+
* // 返回 "https://example.com?name=John&age=30"
|
|
23
|
+
* paramToUri({name: 'John', age: 30}, 'https://example.com');
|
|
24
|
+
*/
|
|
9
25
|
export declare const paramToUri: (param: PlainObject, baseUrl?: string) => string;
|
|
10
26
|
/**
|
|
11
|
-
* 将一个
|
|
12
|
-
|
|
27
|
+
* 将一个IPv4地址转换成数字
|
|
28
|
+
* @param ip - IPv4地址字符串
|
|
29
|
+
* @returns 转换后的数字,无效IP返回0
|
|
30
|
+
* @example
|
|
31
|
+
* // 返回 3232235521
|
|
32
|
+
* IpToInt('192.168.0.1');
|
|
33
|
+
*
|
|
34
|
+
* // 返回 0 (无效IP)
|
|
35
|
+
* IpToInt('invalid');
|
|
36
|
+
*/
|
|
13
37
|
export declare const IpToInt: (ip: string) => number;
|
|
14
38
|
/**
|
|
15
39
|
* 判断是否有权限
|
|
16
|
-
|
|
40
|
+
* @param roleCode - 支持角色代码/菜单路径
|
|
41
|
+
* @returns 是否拥有该角色权限
|
|
42
|
+
* @example
|
|
43
|
+
* // 检查是否有管理员权限
|
|
44
|
+
* if (hasRole('admin')) {
|
|
45
|
+
* // 执行管理员操作
|
|
46
|
+
* }
|
|
47
|
+
*/
|
|
17
48
|
export declare const hasRole: (roleCode: string) => boolean;
|
|
18
49
|
type ResolveURL = (url: string) => string;
|
|
19
50
|
/**
|
|
20
51
|
* 兼容二级目录-转化URL
|
|
21
|
-
|
|
52
|
+
* @param url - 原始URL
|
|
53
|
+
* @returns 转换后的URL,添加应用根路径
|
|
54
|
+
* @example
|
|
55
|
+
* // 假设 APP_ROOT 为 '/app'
|
|
56
|
+
* // 返回 '/app/users'
|
|
57
|
+
* resolveURL('/users');
|
|
58
|
+
*/
|
|
22
59
|
export declare const resolveURL: ResolveURL;
|
|
23
60
|
/**
|
|
24
61
|
* 兼容二级目录-恢复URL
|
|
25
|
-
|
|
62
|
+
* @param url - 带有应用根路径的URL
|
|
63
|
+
* @returns 去除应用根路径的URL
|
|
64
|
+
* @example
|
|
65
|
+
* // 假设 APP_ROOT 为 '/app'
|
|
66
|
+
* // 返回 '/users'
|
|
67
|
+
* clearURL('/app/users');
|
|
68
|
+
*/
|
|
26
69
|
export declare const clearURL: ResolveURL;
|
|
27
70
|
/**
|
|
28
|
-
* 获取 URL
|
|
29
|
-
|
|
71
|
+
* 获取 URL 路径,去除查询参数和哈希
|
|
72
|
+
* @param url - 输入URL
|
|
73
|
+
* @returns 纯路径部分
|
|
74
|
+
* @example
|
|
75
|
+
* // 返回 '/users'
|
|
76
|
+
* urlPath('/users?id=123#profile');
|
|
77
|
+
*/
|
|
30
78
|
export declare const urlPath: ResolveURL;
|
|
31
79
|
/**
|
|
32
|
-
*
|
|
33
|
-
|
|
80
|
+
* 获取当前 APP 名称
|
|
81
|
+
* @param root - 可选的根路径,默认使用location.pathname
|
|
82
|
+
* @returns 当前应用名称
|
|
83
|
+
* @example
|
|
84
|
+
* // 假设当前路径为 '/dashboard/users'
|
|
85
|
+
* // 返回 'app-dashboard-users'
|
|
86
|
+
* currentApp();
|
|
87
|
+
*/
|
|
34
88
|
export declare const currentApp: (root?: string) => string;
|
|
35
89
|
/**
|
|
36
90
|
* 通过一组 option 获取到一组 option 用于 select/checkbox/radio/treeselect 等选项
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
|
|
91
|
+
* @param items - 选项数组
|
|
92
|
+
* @returns 处理后的选项数组,过滤掉无权限的选项,并处理国际化
|
|
93
|
+
* @example
|
|
94
|
+
* const options = getOptions([
|
|
95
|
+
* { label: 'Admin', value: 'admin', roleCode: 'admin' },
|
|
96
|
+
* { label: 'User', value: 'user' }
|
|
97
|
+
* ]);
|
|
98
|
+
*/
|
|
41
99
|
export declare const getOptions: (items: BaseOption[]) => BaseOption[];
|
|
42
100
|
/**
|
|
43
101
|
* 等待一个方法返回 true
|
|
44
|
-
|
|
102
|
+
* @param assert - 断言函数,返回布尔值
|
|
103
|
+
* @param delay - 检查间隔时间,默认33毫秒
|
|
104
|
+
* @example
|
|
105
|
+
* // 等待元素出现
|
|
106
|
+
* await waitFor(() => document.getElementById('myElement') !== null);
|
|
107
|
+
*/
|
|
45
108
|
export declare const waitFor: (assert: () => boolean, delay?: number) => Promise<void>;
|
|
46
109
|
/**
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
110
|
+
* 提交一个表单的选项
|
|
111
|
+
*/
|
|
49
112
|
type SubmitFormOptions = {
|
|
50
113
|
/**
|
|
51
114
|
* 地址
|
|
52
|
-
|
|
115
|
+
*/
|
|
53
116
|
url: string;
|
|
54
117
|
/**
|
|
55
118
|
* 表单提交方法,默认为 POST
|
|
56
|
-
|
|
119
|
+
*/
|
|
57
120
|
method?: 'GET' | 'POST';
|
|
58
121
|
/**
|
|
59
122
|
* 提交 target 方式,如果是iframe 传iframename,默认为 _blank
|
|
60
|
-
|
|
123
|
+
*/
|
|
61
124
|
target?: string;
|
|
62
125
|
/**
|
|
63
126
|
* 表单数据
|
|
64
|
-
|
|
127
|
+
*/
|
|
65
128
|
formData: Record<string, string | number | boolean>;
|
|
66
129
|
/**
|
|
67
130
|
* 拼接在url上的数据
|
|
68
|
-
|
|
131
|
+
*/
|
|
69
132
|
urlParam?: Record<string, string | number | boolean>;
|
|
70
133
|
};
|
|
134
|
+
/**
|
|
135
|
+
* 使用 FormData 方式提交一个表单
|
|
136
|
+
* @param options - 表单提交选项
|
|
137
|
+
* @example
|
|
138
|
+
* submitForm({
|
|
139
|
+
* url: '/api/submit',
|
|
140
|
+
* method: 'POST',
|
|
141
|
+
* formData: { name: 'John', age: 30 }
|
|
142
|
+
* });
|
|
143
|
+
*/
|
|
71
144
|
export declare const submitForm: (options: SubmitFormOptions) => void;
|
|
145
|
+
/**
|
|
146
|
+
* 获取具有指定类名的父元素
|
|
147
|
+
* @param el - 起始HTML元素
|
|
148
|
+
* @param clazz - 要查找的类名
|
|
149
|
+
* @param defaultNode - 未找到时返回的默认元素
|
|
150
|
+
* @returns 找到的父元素或默认元素
|
|
151
|
+
* @example
|
|
152
|
+
* // 查找具有'container'类的父元素
|
|
153
|
+
* const container = getParentByClassName(element, 'container');
|
|
154
|
+
*/
|
|
72
155
|
export declare const getParentByClassName: (el: HTMLElement, clazz: string, defaultNode?: HTMLElement) => HTMLElement;
|
|
156
|
+
/**
|
|
157
|
+
* 是否嵌在CEMS中
|
|
158
|
+
* @returns
|
|
159
|
+
*/
|
|
160
|
+
export declare const isInCEMS: () => boolean;
|
|
73
161
|
export {};
|