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/Renders/_define.js
CHANGED
|
@@ -1,17 +1,82 @@
|
|
|
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
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
19
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
20
|
};
|
|
5
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getList = exports.convertValue = exports.getValue = void 0;
|
|
22
|
+
exports.getList = exports.convertValue = exports.getValue = exports.getStyles = void 0;
|
|
7
23
|
var react_1 = __importDefault(require("react"));
|
|
8
24
|
var lodash_1 = __importDefault(require("lodash"));
|
|
9
25
|
var Const_1 = require("../Const");
|
|
10
|
-
var
|
|
26
|
+
var getStyles = function (value, options) {
|
|
27
|
+
if (options == null || options.onlyText)
|
|
28
|
+
return [undefined, undefined];
|
|
29
|
+
var clazz = [];
|
|
30
|
+
if (options.className) {
|
|
31
|
+
if (lodash_1.default.isString(options.className)) {
|
|
32
|
+
clazz.push(options.className);
|
|
33
|
+
}
|
|
34
|
+
else if (lodash_1.default.isFunction(options.className)) {
|
|
35
|
+
clazz.push(options.className(value));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (options.bold) {
|
|
39
|
+
if (lodash_1.default.isBoolean(options.bold)) {
|
|
40
|
+
clazz.push('font-bold');
|
|
41
|
+
}
|
|
42
|
+
else if (lodash_1.default.isFunction(options.bold) && options.bold(value)) {
|
|
43
|
+
clazz.push('font-bold');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
;
|
|
47
|
+
if (options.italic) {
|
|
48
|
+
if (lodash_1.default.isBoolean(options.italic)) {
|
|
49
|
+
clazz.push('font-italic');
|
|
50
|
+
}
|
|
51
|
+
else if (lodash_1.default.isFunction(options.italic) && options.italic(value)) {
|
|
52
|
+
clazz.push('font-italic');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (options.underline) {
|
|
56
|
+
if (lodash_1.default.isBoolean(options.underline)) {
|
|
57
|
+
clazz.push('font-underline');
|
|
58
|
+
}
|
|
59
|
+
else if (lodash_1.default.isFunction(options.underline) && options.underline(value)) {
|
|
60
|
+
clazz.push('font-underline');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
var style = undefined;
|
|
64
|
+
if (options.color) {
|
|
65
|
+
if (lodash_1.default.isString(options.color)) {
|
|
66
|
+
style = { color: options.color };
|
|
67
|
+
}
|
|
68
|
+
else if (lodash_1.default.isFunction(options.color)) {
|
|
69
|
+
style = { color: options.color(value) };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return [clazz.length ? clazz.join(' ') : undefined, style];
|
|
73
|
+
};
|
|
74
|
+
exports.getStyles = getStyles;
|
|
75
|
+
var getValue = function (label, value, options) {
|
|
11
76
|
if (options == null)
|
|
12
|
-
return
|
|
77
|
+
return label || Const_1.NONE;
|
|
13
78
|
var str;
|
|
14
|
-
if (
|
|
79
|
+
if (label == null) {
|
|
15
80
|
if (options.default)
|
|
16
81
|
return options.default;
|
|
17
82
|
if (options.format) {
|
|
@@ -19,24 +84,18 @@ var getValue = function (txt, options) {
|
|
|
19
84
|
}
|
|
20
85
|
}
|
|
21
86
|
else {
|
|
22
|
-
str =
|
|
87
|
+
str = label;
|
|
23
88
|
}
|
|
24
89
|
if (options.len && str.length > options.len) {
|
|
25
90
|
str = str.substring(0, options.len) + '...';
|
|
26
91
|
}
|
|
27
|
-
|
|
28
|
-
if (options.className)
|
|
29
|
-
clazz.push(options.className);
|
|
30
|
-
if (options.bold)
|
|
31
|
-
clazz.push('font-bold');
|
|
32
|
-
if (options.italic)
|
|
33
|
-
clazz.push('font-italic');
|
|
34
|
-
if (options.underline)
|
|
35
|
-
clazz.push('font-underline');
|
|
36
|
-
var style = options.color ? { color: options.color } : undefined;
|
|
37
|
-
if (options.onlyText || (clazz.length == 0 && style == undefined))
|
|
92
|
+
if (options.onlyText)
|
|
38
93
|
return str;
|
|
39
|
-
|
|
94
|
+
var _a = __read((0, exports.getStyles)(value, options), 2), clazz = _a[0], style = _a[1];
|
|
95
|
+
if (clazz || style) {
|
|
96
|
+
return react_1.default.createElement("span", { className: clazz, style: style, title: label }, str);
|
|
97
|
+
}
|
|
98
|
+
return str;
|
|
40
99
|
};
|
|
41
100
|
exports.getValue = getValue;
|
|
42
101
|
var convertValue = function (value, config) {
|
package/utils/StringUtil.d.ts
CHANGED
|
@@ -1,132 +1,362 @@
|
|
|
1
1
|
import { spellMatch } from './py';
|
|
2
2
|
import type { MatchPatterns } from './py';
|
|
3
|
+
/**
|
|
4
|
+
* 邮箱地址正则表达式
|
|
5
|
+
*/
|
|
3
6
|
export declare const REG_EMAIL: RegExp;
|
|
7
|
+
/**
|
|
8
|
+
* 手机号码正则表达式
|
|
9
|
+
*/
|
|
4
10
|
export declare const REG_PHONE: RegExp;
|
|
11
|
+
/**
|
|
12
|
+
* 固定电话正则表达式
|
|
13
|
+
*/
|
|
5
14
|
export declare const REG_TELEPHONE: RegExp;
|
|
15
|
+
/**
|
|
16
|
+
* 英文字母集合
|
|
17
|
+
*/
|
|
6
18
|
export declare const LETTERS: Set<string>;
|
|
19
|
+
/**
|
|
20
|
+
* IPv4地址正则表达式
|
|
21
|
+
*/
|
|
7
22
|
export declare const REG_IPV4: RegExp;
|
|
23
|
+
/**
|
|
24
|
+
* IPv6地址正则表达式
|
|
25
|
+
*/
|
|
8
26
|
export declare const REG_IPV6: RegExp;
|
|
27
|
+
/**
|
|
28
|
+
* URL地址正则表达式
|
|
29
|
+
*/
|
|
9
30
|
export declare const REG_URL: RegExp;
|
|
31
|
+
/**
|
|
32
|
+
* 端口号正则表达式
|
|
33
|
+
*/
|
|
10
34
|
export declare const REG_PORT: RegExp;
|
|
11
35
|
/**
|
|
12
|
-
*
|
|
13
|
-
|
|
36
|
+
* 判断是否为手机号码
|
|
37
|
+
* @param txt - 待验证的字符串
|
|
38
|
+
* @returns 是否为有效的手机号码
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* isMobilePhone('13812345678') // => true
|
|
42
|
+
* isMobilePhone('1381234567') // => false
|
|
43
|
+
*/
|
|
14
44
|
export declare const isMobilePhone: (txt: string) => boolean;
|
|
15
45
|
/**
|
|
16
|
-
*
|
|
17
|
-
|
|
46
|
+
* 判断是否为固定电话号码
|
|
47
|
+
* @param txt - 待验证的字符串
|
|
48
|
+
* @returns 是否为有效的固定电话号码
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* isTelePhone('010-12345678') // => true
|
|
52
|
+
* isTelePhone('010123456789') // => false
|
|
53
|
+
*/
|
|
18
54
|
export declare const isTelePhone: (txt: string) => boolean;
|
|
19
55
|
/**
|
|
20
|
-
*
|
|
21
|
-
|
|
56
|
+
* 判断是否为Email地址
|
|
57
|
+
* @param txt - 待验证的字符串
|
|
58
|
+
* @returns 是否为有效的Email地址
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* isEmail('user@example.com') // => true
|
|
62
|
+
* isEmail('invalid.email') // => false
|
|
63
|
+
*/
|
|
22
64
|
export declare const isEmail: (txt: string) => boolean;
|
|
23
65
|
/**
|
|
24
|
-
*
|
|
25
|
-
|
|
66
|
+
* 判断是否为URL地址
|
|
67
|
+
* @param txt - 待验证的字符串
|
|
68
|
+
* @returns 是否为有效的URL地址
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* isURL('https://www.example.com') // => true
|
|
72
|
+
* isURL('invalid-url') // => false
|
|
73
|
+
*/
|
|
26
74
|
export declare const isURL: (txt: string) => boolean;
|
|
27
75
|
/**
|
|
28
|
-
*
|
|
29
|
-
|
|
76
|
+
* 判断是否为MAC地址
|
|
77
|
+
* @param txt - 待验证的字符串
|
|
78
|
+
* @returns 是否为有效的MAC地址
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* isMAC('00:11:22:33:44:55') // => true
|
|
82
|
+
* isMAC('00-11-22-33-44-55') // => true
|
|
83
|
+
* isMAC('001122334455') // => true
|
|
84
|
+
* isMAC('invalid-mac') // => false
|
|
85
|
+
*/
|
|
30
86
|
export declare const isMAC: (txt: string) => boolean;
|
|
31
87
|
/**
|
|
32
|
-
*
|
|
33
|
-
|
|
88
|
+
* 判断是否为电话号码(支持固定电话和手机)
|
|
89
|
+
* @param txt - 待验证的字符串
|
|
90
|
+
* @returns 是否为有效的电话号码
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* isPhone('13812345678') // => true
|
|
94
|
+
* isPhone('010-12345678') // => true
|
|
95
|
+
* isPhone('invalid-phone') // => false
|
|
96
|
+
*/
|
|
34
97
|
export declare const isPhone: (txt: string) => boolean;
|
|
35
98
|
type IP_VERSION = '' | '4' | '6';
|
|
99
|
+
/**
|
|
100
|
+
* 判断是否为IPv4地址
|
|
101
|
+
* @param str - 待验证的字符串
|
|
102
|
+
* @returns 是否为有效的IPv4地址
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* isIP4('192.168.1.1') // => true
|
|
106
|
+
* isIP4('256.1.2.3') // => false
|
|
107
|
+
*/
|
|
36
108
|
export declare const isIP4: (str: string) => boolean;
|
|
109
|
+
/**
|
|
110
|
+
* 判断是否为IPv6地址
|
|
111
|
+
* @param str - 待验证的字符串
|
|
112
|
+
* @returns 是否为有效的IPv6地址
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* isIP6('2001:0db8:85a3:0000:0000:8a2e:0370:7334') // => true
|
|
116
|
+
* isIP6('invalid-ipv6') // => false
|
|
117
|
+
*/
|
|
37
118
|
export declare const isIP6: (str: string) => boolean;
|
|
38
119
|
/**
|
|
39
|
-
*
|
|
40
|
-
* @param str
|
|
41
|
-
* @param version
|
|
42
|
-
|
|
120
|
+
* 判断是否为IP地址
|
|
121
|
+
* @param str - 待验证的字符串
|
|
122
|
+
* @param version - IP版本('4'|'6'|''),默认为'4'。空字符串表示同时支持IPv4和IPv6
|
|
123
|
+
* @returns 是否为有效的IP地址
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* isIP('192.168.1.1', '4') // => true
|
|
127
|
+
* isIP('2001:0db8:85a3:0000:0000:8a2e:0370:7334', '6') // => true
|
|
128
|
+
* isIP('192.168.1.1', '') // => true
|
|
129
|
+
*/
|
|
43
130
|
export declare const isIP: (str: string, version?: IP_VERSION) => boolean;
|
|
44
131
|
export declare const REG_ID_18: RegExp;
|
|
45
132
|
export declare const REG_ID_15: RegExp;
|
|
46
133
|
/**
|
|
47
|
-
*
|
|
48
|
-
* @param txt
|
|
49
|
-
* @param strict
|
|
50
|
-
|
|
134
|
+
* 判断是否为18位身份证号
|
|
135
|
+
* @param txt - 待验证的字符串
|
|
136
|
+
* @param strict - 是否开启严格校验,默认为true
|
|
137
|
+
* @returns 是否为有效的18位身份证号
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* isId18('110101199001011234') // => true
|
|
141
|
+
* isId18('11010119900101123X') // => true
|
|
142
|
+
* isId18('invalid-id', false) // => false
|
|
143
|
+
*/
|
|
51
144
|
export declare const isId18: (txt: string, strict?: boolean) => boolean;
|
|
52
145
|
/**
|
|
53
|
-
*
|
|
54
|
-
* @param txt
|
|
55
|
-
* @param strict
|
|
56
|
-
*
|
|
146
|
+
* 判断是否为15位身份证号
|
|
147
|
+
* @param txt - 待验证的字符串
|
|
148
|
+
* @param strict - 是否开启严格校验,默认为true
|
|
149
|
+
* @returns 是否为有效的15位身份证号
|
|
57
150
|
*
|
|
58
|
-
|
|
151
|
+
* @example
|
|
152
|
+
* isId15('110101900101123') // => true
|
|
153
|
+
* isId15('invalid-id', false) // => false
|
|
154
|
+
*/
|
|
59
155
|
export declare const isId15: (txt: string, strict?: boolean) => boolean;
|
|
60
156
|
/**
|
|
61
|
-
*
|
|
62
|
-
* @param txt
|
|
63
|
-
* @param strict
|
|
64
|
-
|
|
157
|
+
* 判断是否为身份证号(支持15位和18位)
|
|
158
|
+
* @param txt - 待验证的字符串
|
|
159
|
+
* @param strict - 是否开启严格校验,默认为true
|
|
160
|
+
* @returns 是否为有效的身份证号
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* isId('110101199001011234') // => true
|
|
164
|
+
* isId('110101900101123') // => true
|
|
165
|
+
* isId('invalid-id', false) // => false
|
|
166
|
+
*/
|
|
65
167
|
export declare const isId: (txt: string, strict?: boolean) => boolean;
|
|
66
168
|
/**
|
|
67
|
-
*
|
|
68
|
-
|
|
169
|
+
* 生成唯一ID标识
|
|
170
|
+
* @returns 生成的唯一ID字符串
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* genKey() // => "1a2b3c"
|
|
174
|
+
*/
|
|
69
175
|
export declare const genKey: () => string;
|
|
70
176
|
/**
|
|
71
|
-
* 生成
|
|
72
|
-
|
|
177
|
+
* 生成UUID
|
|
178
|
+
* @returns 生成的UUID字符串
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* uuid() // => "550e8400-e29b-41d4-a716-446655440000"
|
|
182
|
+
*/
|
|
73
183
|
export declare const uuid: () => string;
|
|
74
184
|
/**
|
|
75
|
-
*
|
|
76
|
-
|
|
185
|
+
* 判断是否为BTC地址
|
|
186
|
+
* @param str - 待验证的字符串
|
|
187
|
+
* @returns 是否为有效的BTC地址
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* isBTCAddress('1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2') // => true
|
|
191
|
+
* isBTCAddress('invalid-address') // => false
|
|
192
|
+
*/
|
|
77
193
|
export declare const isBTCAddress: (str: string) => boolean;
|
|
78
194
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
|
|
195
|
+
* 判断字符串是否可以转换为布尔值
|
|
196
|
+
* @param str - 待验证的字符串
|
|
197
|
+
* @returns 是否可以转换为布尔值
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* isBoolean('true') // => true
|
|
201
|
+
* isBoolean('yes') // => true
|
|
202
|
+
* isBoolean('0') // => true
|
|
203
|
+
* isBoolean('invalid') // => false
|
|
204
|
+
*/
|
|
83
205
|
export declare const isBoolean: (str: string) => boolean;
|
|
84
206
|
/**
|
|
85
|
-
*
|
|
86
|
-
|
|
207
|
+
* 清空字符串首尾空格并转换为小写
|
|
208
|
+
* @param str - 输入字符串
|
|
209
|
+
* @returns 处理后的字符串
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* trimLower(' Hello World ') // => "hello world"
|
|
213
|
+
*/
|
|
87
214
|
export declare const trimLower: (str: string) => string;
|
|
88
215
|
export { spellMatch };
|
|
89
216
|
/**
|
|
90
|
-
*
|
|
91
|
-
|
|
217
|
+
* 搜索文本并返回匹配结果,用于高亮显示
|
|
218
|
+
* @param sentence - 待搜索的文本
|
|
219
|
+
* @param keyword - 搜索关键词
|
|
220
|
+
* @returns 匹配结果数组
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* searchText('Hello World', 'world') // => [{hit: false, text: 'Hello '}, {hit: true, text: 'World'}]
|
|
224
|
+
*/
|
|
92
225
|
export declare const searchText: (sentence: string, keyword: string) => MatchPatterns[];
|
|
93
226
|
/**
|
|
94
|
-
*
|
|
95
|
-
|
|
227
|
+
* 合并CSS类名
|
|
228
|
+
* @param base - 基础类名数组
|
|
229
|
+
* @param classNameProps - 额外的类名
|
|
230
|
+
* @returns 合并后的类名字符串
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* className(['btn', 'primary'], 'large') // => "btn primary large"
|
|
234
|
+
*/
|
|
96
235
|
export declare const className: (base: string[], classNameProps?: string) => string;
|
|
236
|
+
/**
|
|
237
|
+
* 替换字符串中所有匹配的内容
|
|
238
|
+
* @param text - 原始字符串
|
|
239
|
+
* @param keyword - 要替换的关键词或正则表达式
|
|
240
|
+
* @param replaceText - 替换后的文本
|
|
241
|
+
* @returns 替换后的字符串
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* replaceAll('hello world', 'o', '0') // => "hell0 w0rld"
|
|
245
|
+
*/
|
|
97
246
|
export declare const replaceAll: (text: string, keyword: string | RegExp, replaceText: string) => string;
|
|
98
247
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
|
|
248
|
+
* 将字符串转换为像素值
|
|
249
|
+
* @param str - 输入的数字或字符串
|
|
250
|
+
* @returns 转换后的像素值数字
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* px('300px') // => 300
|
|
254
|
+
* px(300) // => 300
|
|
255
|
+
* px('invalid') // => 0
|
|
256
|
+
*/
|
|
102
257
|
export declare const px: (str: number | string) => number;
|
|
103
258
|
/**
|
|
104
|
-
*
|
|
105
|
-
|
|
259
|
+
* 复制文本到剪贴板
|
|
260
|
+
* @param text - 要复制的文本
|
|
261
|
+
* @param onCopied - 复制成功后的回调函数
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* copy('Hello World', (text) => console.log(`Copied: ${text}`))
|
|
265
|
+
*/
|
|
106
266
|
export declare const copy: (text: string, onCopied?: (txt: any) => void) => void;
|
|
107
267
|
/**
|
|
108
|
-
*
|
|
109
|
-
|
|
268
|
+
* 获取字符串值,空字符串返回默认值
|
|
269
|
+
* @param txt - 输入字符串
|
|
270
|
+
* @param defaultValue - 默认值
|
|
271
|
+
* @returns 处理后的字符串
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* getString(' hello ') // => "hello"
|
|
275
|
+
* getString('', 'default') // => "default"
|
|
276
|
+
*/
|
|
110
277
|
export declare const getString: (txt: string, defaultValue?: string) => string;
|
|
111
278
|
/**
|
|
112
279
|
* 获取布尔值
|
|
113
|
-
|
|
280
|
+
* @param key - 输入字符串
|
|
281
|
+
* @param defaultValue - 默认值
|
|
282
|
+
* @returns 转换后的布尔值
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* getBoolean('true') // => true
|
|
286
|
+
* getBoolean('yes') // => true
|
|
287
|
+
* getBoolean('invalid', true) // => true
|
|
288
|
+
*/
|
|
114
289
|
export declare const getBoolean: (key: string, defaultValue?: boolean) => boolean;
|
|
115
290
|
/**
|
|
116
|
-
*
|
|
117
|
-
|
|
291
|
+
* 获取整数值
|
|
292
|
+
* @param txt - 输入字符串
|
|
293
|
+
* @param defaultValue - 默认值
|
|
294
|
+
* @returns 转换后的整数
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* getInteger('123') // => 123
|
|
298
|
+
* getInteger('invalid', 0) // => 0
|
|
299
|
+
*/
|
|
118
300
|
export declare const getInteger: (txt: string, defaultValue?: number) => number;
|
|
119
301
|
/**
|
|
120
|
-
*
|
|
121
|
-
|
|
302
|
+
* 获取浮点数值
|
|
303
|
+
* @param txt - 输入字符串
|
|
304
|
+
* @param defaultValue - 默认值
|
|
305
|
+
* @returns 转换后的浮点数
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* getFloat('123.45') // => 123.45
|
|
309
|
+
* getFloat('invalid', 0) // => 0
|
|
310
|
+
*/
|
|
122
311
|
export declare const getFloat: (txt: string, defaultValue?: number) => number;
|
|
312
|
+
/**
|
|
313
|
+
* 获取文件名
|
|
314
|
+
* @param uri - 文件路径
|
|
315
|
+
* @returns 文件名
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* getFileName('/path/to/file.txt') // => "file.txt"
|
|
319
|
+
*/
|
|
123
320
|
export declare const getFileName: (uri: string) => string;
|
|
124
321
|
/**
|
|
125
|
-
*
|
|
126
|
-
|
|
322
|
+
* 获取文件后缀名
|
|
323
|
+
* @param fileName - 文件名
|
|
324
|
+
* @returns 小写的文件后缀名
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* getSuffix('image.JPG') // => "jpg"
|
|
328
|
+
*/
|
|
127
329
|
export declare const getSuffix: (fileName: string) => string;
|
|
128
|
-
type FileType = 'image' | 'pdf' | 'doc' | 'excel' | 'ppt' | 'zip' | 'video' | 'audio' | 'unknown';
|
|
330
|
+
type FileType = 'image' | 'pdf' | 'doc' | 'excel' | 'ppt' | 'zip' | 'video' | 'xml' | 'audio' | 'unknown';
|
|
129
331
|
/**
|
|
130
|
-
*
|
|
131
|
-
|
|
332
|
+
* 获取文件类型和对应的图标
|
|
333
|
+
* @param fileName - 文件名
|
|
334
|
+
* @returns [文件类型, 图标名称]
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* getFileType('document.pdf') // => ['pdf', 'file-pdf']
|
|
338
|
+
* getFileType('image.jpg') // => ['image', 'file-image']
|
|
339
|
+
*/
|
|
132
340
|
export declare const getFileType: (fileName: string) => [FileType, string];
|
|
341
|
+
/**
|
|
342
|
+
* 计算占比
|
|
343
|
+
* @param count - 分子
|
|
344
|
+
* @param total - 分母
|
|
345
|
+
* @returns 比率(0-1之间的小数)
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ratio(4, 10) // => 0.4
|
|
349
|
+
* ratio(0, 10) // => 0
|
|
350
|
+
*/
|
|
351
|
+
export declare const ratio: (count: number, total: number) => number;
|
|
352
|
+
/**
|
|
353
|
+
* 计算增长率
|
|
354
|
+
* @param current - 当前值
|
|
355
|
+
* @param prev - 上一个值
|
|
356
|
+
* @returns 增长率(-1到1之间的小数)
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* rise(120, 100) // => 0.2
|
|
360
|
+
* rise(80, 100) // => -0.2
|
|
361
|
+
*/
|
|
362
|
+
export declare const rise: (current: number, prev: number) => number;
|