vap1 0.4.5 → 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 +4 -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 +43 -7
- package/components/Box/Box.js +67 -17
- 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/{SearchBar → SearchTool/SearchBar}/ActionButtons.d.ts +2 -2
- package/components/{SearchBar → SearchTool/SearchBar}/ActionButtons.js +22 -12
- package/components/{SearchBar → SearchTool/SearchBar}/ByField.d.ts +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/ByField.js +21 -11
- package/components/{SearchBar → SearchTool/SearchBar}/ByKeyword.d.ts +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/ByKeyword.js +20 -10
- package/components/{SearchBar → SearchTool/SearchBar}/SearchField.d.ts +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/SearchTags.js +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/_register.d.ts +1 -1
- package/components/{SearchBar → SearchTool/SearchBar}/_register.js +3 -3
- package/components/SearchTool/SearchBar/index.d.ts +7 -0
- package/components/{SearchBar → SearchTool/SearchBar}/index.js +1 -1
- package/components/{SearchBar/index.d.ts → SearchTool/SearchBar/type.d.ts} +68 -67
- package/components/SearchTool/SearchBar/type.js +35 -0
- package/components/SearchTool/index.d.ts +5 -0
- package/components/SearchTool/index.js +7 -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 +8 -11
- package/components/Tables/Components/ActionBar.js +74 -41
- 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 -9
- 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/TreeSelect/STreeSelect.js +1 -1
- 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/_FieldType.d.ts +1 -1
- package/components/UForm/_FieldType.js +4 -0
- 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/Col.d.ts +1 -1
- 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.d.ts +1 -1
- package/components/_common/UTitle.js +18 -8
- 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.d.ts +2 -2
- package/components/index.js +5 -1
- package/deps/JsonView.js +17 -7
- package/deps/app-audit/LookUp.js +19 -9
- package/deps/app-data/Const.d.ts +68 -3
- package/deps/app-data/Const.js +47 -3
- package/deps/app-data/TimeConst.d.ts +0 -0
- package/deps/app-data/TimeConst.js +58 -0
- package/deps/app-data/useSource.d.ts +22 -0
- package/deps/app-data/useSource.js +253 -162
- 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/index.js +1 -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 +22 -16
- package/utils/CacheUtil.d.ts +1 -1
- package/utils/Const.js +17 -7
- package/utils/Format.d.ts +138 -14
- package/utils/Format.js +132 -23
- package/utils/Global.d.ts +46 -2
- package/utils/Global.js +24 -2
- package/utils/PageUtil.d.ts +111 -23
- package/utils/PageUtil.js +163 -28
- package/utils/Renders/ApiGetRender.js +25 -12
- 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 -12
- package/utils/VAP.d.ts +26 -1
- package/utils/VAP.js +57 -1
- 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/_en.d.ts +2 -0
- package/utils/crontab/_en.js +178 -0
- package/utils/crontab/_global.d.ts +11 -0
- package/utils/crontab/_global.js +23 -0
- package/utils/crontab/_zh_CN.d.ts +2 -0
- package/utils/crontab/_zh_CN.js +180 -0
- package/utils/crontab/_zh_TW.d.ts +2 -0
- package/utils/crontab/_zh_TW.js +170 -0
- package/utils/crontab/crontabParser.d.ts +1 -0
- package/utils/crontab/crontabParser.js +251 -0
- package/utils/crontab/crontabRender.d.ts +23 -0
- package/utils/crontab/crontabRender.js +502 -0
- package/utils/crontab/index.d.ts +3 -0
- package/utils/crontab/index.js +9 -0
- package/utils/crontab/type.d.ts +79 -0
- package/utils/crontab/type.js +2 -0
- package/utils/crontab/utils.d.ts +20 -0
- package/utils/crontab/utils.js +122 -0
- package/utils/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/utils/py.js +2 -0
- package/components/SearchBar/_FieldType.d.ts +0 -8
- package/components/SearchBar/_FieldType.js +0 -51
- /package/components/{SearchBar → SearchTool/SearchBar}/SearchField.js +0 -0
- /package/components/{SearchBar → SearchTool/SearchBar}/SearchTags.d.ts +0 -0
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 {};
|
package/utils/PageUtil.js
CHANGED
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -46,21 +46,54 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
+
if (!m) return o;
|
|
52
|
+
var i = m.call(o), r, ar = [], e;
|
|
53
|
+
try {
|
|
54
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
+
}
|
|
56
|
+
catch (error) { e = { error: error }; }
|
|
57
|
+
finally {
|
|
58
|
+
try {
|
|
59
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
+
}
|
|
61
|
+
finally { if (e) throw e.error; }
|
|
62
|
+
}
|
|
63
|
+
return ar;
|
|
64
|
+
};
|
|
65
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
66
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
67
|
+
if (ar || !(i in from)) {
|
|
68
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
69
|
+
ar[i] = from[i];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
73
|
+
};
|
|
49
74
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
75
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
76
|
};
|
|
52
77
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.getParentByClassName = exports.submitForm = exports.waitFor = exports.getOptions = exports.currentApp = exports.urlPath = exports.clearURL = exports.resolveURL = exports.hasRole = exports.IpToInt = exports.paramToUri = exports.stopEvent = void 0;
|
|
78
|
+
exports.isInCEMS = exports.getParentByClassName = exports.submitForm = exports.waitFor = exports.getOptions = exports.currentApp = exports.urlPath = exports.clearURL = exports.resolveURL = exports.hasRole = exports.IpToInt = exports.paramToUri = exports.stopEvent = void 0;
|
|
54
79
|
var lodash_1 = __importDefault(require("lodash"));
|
|
55
80
|
var StringUtil_1 = require("./StringUtil");
|
|
56
81
|
var _Support_1 = require("./_Support");
|
|
57
82
|
var _AjaxUtil_1 = require("./_AjaxUtil");
|
|
58
83
|
var i18n_1 = require("./i18n");
|
|
59
84
|
var Global_1 = require("./Global");
|
|
60
|
-
var
|
|
85
|
+
var appLen = _Support_1.APP_ROOT ? _Support_1.APP_ROOT.length : 0;
|
|
86
|
+
var apiLen = _Support_1.API_ROOT ? _Support_1.API_ROOT.length : 0;
|
|
61
87
|
/**
|
|
62
88
|
* 阻止事件简单封装
|
|
63
|
-
|
|
89
|
+
* @param evt - 事件对象
|
|
90
|
+
* @param callback - 可选的回调函数
|
|
91
|
+
* @example
|
|
92
|
+
* // 阻止点击事件的默认行为和冒泡
|
|
93
|
+
* button.addEventListener('click', (e) => {
|
|
94
|
+
* stopEvent(e, () => console.log('Event stopped'));
|
|
95
|
+
* });
|
|
96
|
+
*/
|
|
64
97
|
var stopEvent = function (evt, callback) {
|
|
65
98
|
if (lodash_1.default.isFunction(evt === null || evt === void 0 ? void 0 : evt.preventDefault)) {
|
|
66
99
|
evt.preventDefault();
|
|
@@ -73,7 +106,16 @@ var stopEvent = function (evt, callback) {
|
|
|
73
106
|
exports.stopEvent = stopEvent;
|
|
74
107
|
/**
|
|
75
108
|
* 将一个参数对象转换为 url Pattern 形式
|
|
76
|
-
|
|
109
|
+
* @param param - 参数对象
|
|
110
|
+
* @param baseUrl - 可选的基础URL
|
|
111
|
+
* @returns 格式化后的URL字符串
|
|
112
|
+
* @example
|
|
113
|
+
* // 返回 "name=John&age=30"
|
|
114
|
+
* paramToUri({name: 'John', age: 30});
|
|
115
|
+
*
|
|
116
|
+
* // 返回 "https://example.com?name=John&age=30"
|
|
117
|
+
* paramToUri({name: 'John', age: 30}, 'https://example.com');
|
|
118
|
+
*/
|
|
77
119
|
var paramToUri = function (param, baseUrl) {
|
|
78
120
|
var patterns = [];
|
|
79
121
|
lodash_1.default.keys(param).map(function (key) { return patterns.push("".concat(key, "=").concat(encodeURIComponent(param[key]))); });
|
|
@@ -86,8 +128,16 @@ var paramToUri = function (param, baseUrl) {
|
|
|
86
128
|
};
|
|
87
129
|
exports.paramToUri = paramToUri;
|
|
88
130
|
/**
|
|
89
|
-
* 将一个
|
|
90
|
-
|
|
131
|
+
* 将一个IPv4地址转换成数字
|
|
132
|
+
* @param ip - IPv4地址字符串
|
|
133
|
+
* @returns 转换后的数字,无效IP返回0
|
|
134
|
+
* @example
|
|
135
|
+
* // 返回 3232235521
|
|
136
|
+
* IpToInt('192.168.0.1');
|
|
137
|
+
*
|
|
138
|
+
* // 返回 0 (无效IP)
|
|
139
|
+
* IpToInt('invalid');
|
|
140
|
+
*/
|
|
91
141
|
var IpToInt = function (ip) {
|
|
92
142
|
var ipNum = 0;
|
|
93
143
|
if (!(0, StringUtil_1.isIP)(ip, '4'))
|
|
@@ -99,33 +149,71 @@ var IpToInt = function (ip) {
|
|
|
99
149
|
exports.IpToInt = IpToInt;
|
|
100
150
|
/**
|
|
101
151
|
* 判断是否有权限
|
|
102
|
-
|
|
152
|
+
* @param roleCode - 支持角色代码/菜单路径
|
|
153
|
+
* @returns 是否拥有该角色权限
|
|
154
|
+
* @example
|
|
155
|
+
* // 检查是否有管理员权限
|
|
156
|
+
* if (hasRole('admin')) {
|
|
157
|
+
* // 执行管理员操作
|
|
158
|
+
* }
|
|
159
|
+
*/
|
|
103
160
|
var hasRole = function (roleCode) {
|
|
104
161
|
return Global_1.CONFIG.PROMISSION.ROLE.has(roleCode) || Global_1.CONFIG.PROMISSION.ROLE.has((0, StringUtil_1.trimLower)(roleCode));
|
|
105
162
|
};
|
|
106
163
|
exports.hasRole = hasRole;
|
|
107
164
|
var DEFAULT_RESOLVER = function (url) { return url; };
|
|
108
|
-
|
|
109
|
-
* 兼容二级目录-转化URL
|
|
110
|
-
*/
|
|
111
|
-
exports.resolveURL = len == 0 ? DEFAULT_RESOLVER : function (url) {
|
|
165
|
+
var resolveApp = appLen == 0 ? DEFAULT_RESOLVER : function (url) {
|
|
112
166
|
if (!url.startsWith('/'))
|
|
113
167
|
return url;
|
|
114
168
|
if (url.startsWith(_Support_1.APP_ROOT))
|
|
115
169
|
return url;
|
|
116
170
|
return _Support_1.APP_ROOT + url;
|
|
117
171
|
};
|
|
172
|
+
var resolveApi = apiLen == 0 ? DEFAULT_RESOLVER : function (url) {
|
|
173
|
+
if (!url.startsWith('/'))
|
|
174
|
+
return url;
|
|
175
|
+
if (url.startsWith(_Support_1.API_ROOT))
|
|
176
|
+
return url;
|
|
177
|
+
return _Support_1.API_ROOT + url;
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* 兼容二级目录-转化URL
|
|
181
|
+
* @param url - 原始URL
|
|
182
|
+
* @returns 转换后的URL,添加应用根路径
|
|
183
|
+
* @example
|
|
184
|
+
* // 假设 APP_ROOT 为 '/app'
|
|
185
|
+
* // 返回 '/app/users'
|
|
186
|
+
* resolveURL('/users');
|
|
187
|
+
*/
|
|
188
|
+
exports.resolveURL = (appLen == 0 && apiLen == 0) ? DEFAULT_RESOLVER : function (url) {
|
|
189
|
+
if (!url.startsWith('/'))
|
|
190
|
+
return url;
|
|
191
|
+
if (apiLen > 0 && url.startsWith('/api'))
|
|
192
|
+
return resolveApi(url);
|
|
193
|
+
return resolveApp(url);
|
|
194
|
+
};
|
|
118
195
|
/**
|
|
119
196
|
* 兼容二级目录-恢复URL
|
|
120
|
-
|
|
121
|
-
|
|
197
|
+
* @param url - 带有应用根路径的URL
|
|
198
|
+
* @returns 去除应用根路径的URL
|
|
199
|
+
* @example
|
|
200
|
+
* // 假设 APP_ROOT 为 '/app'
|
|
201
|
+
* // 返回 '/users'
|
|
202
|
+
* clearURL('/app/users');
|
|
203
|
+
*/
|
|
204
|
+
exports.clearURL = appLen == 0 ? DEFAULT_RESOLVER : function (url) {
|
|
122
205
|
if (!url.startsWith(_Support_1.APP_ROOT))
|
|
123
206
|
return url;
|
|
124
|
-
return url.substring(
|
|
207
|
+
return url.substring(appLen);
|
|
125
208
|
};
|
|
126
209
|
/**
|
|
127
|
-
* 获取 URL
|
|
128
|
-
|
|
210
|
+
* 获取 URL 路径,去除查询参数和哈希
|
|
211
|
+
* @param url - 输入URL
|
|
212
|
+
* @returns 纯路径部分
|
|
213
|
+
* @example
|
|
214
|
+
* // 返回 '/users'
|
|
215
|
+
* urlPath('/users?id=123#profile');
|
|
216
|
+
*/
|
|
129
217
|
var urlPath = function (url) {
|
|
130
218
|
var result = (0, exports.clearURL)(url);
|
|
131
219
|
var idx = result.indexOf('?');
|
|
@@ -139,8 +227,14 @@ var urlPath = function (url) {
|
|
|
139
227
|
exports.urlPath = urlPath;
|
|
140
228
|
var GLOBAL_APPS = new Map();
|
|
141
229
|
/**
|
|
142
|
-
*
|
|
143
|
-
|
|
230
|
+
* 获取当前 APP 名称
|
|
231
|
+
* @param root - 可选的根路径,默认使用location.pathname
|
|
232
|
+
* @returns 当前应用名称
|
|
233
|
+
* @example
|
|
234
|
+
* // 假设当前路径为 '/dashboard/users'
|
|
235
|
+
* // 返回 'app-dashboard-users'
|
|
236
|
+
* currentApp();
|
|
237
|
+
*/
|
|
144
238
|
var currentApp = function (root) {
|
|
145
239
|
var pathname = (0, exports.urlPath)(root ? root : location.pathname);
|
|
146
240
|
if (GLOBAL_APPS.has(pathname))
|
|
@@ -157,10 +251,14 @@ var currentApp = function (root) {
|
|
|
157
251
|
exports.currentApp = currentApp;
|
|
158
252
|
/**
|
|
159
253
|
* 通过一组 option 获取到一组 option 用于 select/checkbox/radio/treeselect 等选项
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
|
|
254
|
+
* @param items - 选项数组
|
|
255
|
+
* @returns 处理后的选项数组,过滤掉无权限的选项,并处理国际化
|
|
256
|
+
* @example
|
|
257
|
+
* const options = getOptions([
|
|
258
|
+
* { label: 'Admin', value: 'admin', roleCode: 'admin' },
|
|
259
|
+
* { label: 'User', value: 'user' }
|
|
260
|
+
* ]);
|
|
261
|
+
*/
|
|
164
262
|
var getOptions = function (items) {
|
|
165
263
|
var options = [];
|
|
166
264
|
items.map(function (item) {
|
|
@@ -184,10 +282,19 @@ var getOptions = function (items) {
|
|
|
184
282
|
exports.getOptions = getOptions;
|
|
185
283
|
/**
|
|
186
284
|
* 等待一个方法返回 true
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
285
|
+
* @param assert - 断言函数,返回布尔值
|
|
286
|
+
* @param delay - 检查间隔时间,默认33毫秒
|
|
287
|
+
* @example
|
|
288
|
+
* // 等待元素出现
|
|
289
|
+
* await waitFor(() => document.getElementById('myElement') !== null);
|
|
290
|
+
*/
|
|
291
|
+
var waitFor = function (assert_1) {
|
|
292
|
+
var args_1 = [];
|
|
293
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
294
|
+
args_1[_i - 1] = arguments[_i];
|
|
295
|
+
}
|
|
296
|
+
return __awaiter(void 0, __spreadArray([assert_1], __read(args_1), false), void 0, function (assert, delay) {
|
|
297
|
+
if (delay === void 0) { delay = 33; }
|
|
191
298
|
return __generator(this, function (_a) {
|
|
192
299
|
switch (_a.label) {
|
|
193
300
|
case 0:
|
|
@@ -202,6 +309,16 @@ var waitFor = function (assert, delay) {
|
|
|
202
309
|
});
|
|
203
310
|
};
|
|
204
311
|
exports.waitFor = waitFor;
|
|
312
|
+
/**
|
|
313
|
+
* 使用 FormData 方式提交一个表单
|
|
314
|
+
* @param options - 表单提交选项
|
|
315
|
+
* @example
|
|
316
|
+
* submitForm({
|
|
317
|
+
* url: '/api/submit',
|
|
318
|
+
* method: 'POST',
|
|
319
|
+
* formData: { name: 'John', age: 30 }
|
|
320
|
+
* });
|
|
321
|
+
*/
|
|
205
322
|
var submitForm = function (options) {
|
|
206
323
|
var url = (0, exports.resolveURL)(options.url);
|
|
207
324
|
if (options.urlParam) {
|
|
@@ -225,6 +342,16 @@ var submitForm = function (options) {
|
|
|
225
342
|
window.setTimeout(function () { return document.body.removeChild(form); }, 200);
|
|
226
343
|
};
|
|
227
344
|
exports.submitForm = submitForm;
|
|
345
|
+
/**
|
|
346
|
+
* 获取具有指定类名的父元素
|
|
347
|
+
* @param el - 起始HTML元素
|
|
348
|
+
* @param clazz - 要查找的类名
|
|
349
|
+
* @param defaultNode - 未找到时返回的默认元素
|
|
350
|
+
* @returns 找到的父元素或默认元素
|
|
351
|
+
* @example
|
|
352
|
+
* // 查找具有'container'类的父元素
|
|
353
|
+
* const container = getParentByClassName(element, 'container');
|
|
354
|
+
*/
|
|
228
355
|
var getParentByClassName = function (el, clazz, defaultNode) {
|
|
229
356
|
if (el.classList.contains(clazz))
|
|
230
357
|
return el;
|
|
@@ -233,3 +360,11 @@ var getParentByClassName = function (el, clazz, defaultNode) {
|
|
|
233
360
|
return (0, exports.getParentByClassName)(el.parentElement, clazz, defaultNode);
|
|
234
361
|
};
|
|
235
362
|
exports.getParentByClassName = getParentByClassName;
|
|
363
|
+
/**
|
|
364
|
+
* 是否嵌在CEMS中
|
|
365
|
+
* @returns
|
|
366
|
+
*/
|
|
367
|
+
var isInCEMS = function () {
|
|
368
|
+
return (top.window['$'] && top.window['$']["checkSession"]) && typeof (top.window['$']["checkSession"]) == "function";
|
|
369
|
+
};
|
|
370
|
+
exports.isInCEMS = isInCEMS;
|
|
@@ -26,13 +26,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
26
26
|
}) : function(o, v) {
|
|
27
27
|
o["default"] = v;
|
|
28
28
|
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
36
46
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
47
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
48
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -43,8 +53,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
53
|
});
|
|
44
54
|
};
|
|
45
55
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
-
return g =
|
|
56
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
57
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
58
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
59
|
function step(op) {
|
|
50
60
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -122,7 +132,7 @@ var loadApi = function (option) { return __awaiter(void 0, void 0, void 0, funct
|
|
|
122
132
|
result = _a.sent();
|
|
123
133
|
if (!cache.loaded) {
|
|
124
134
|
arr = (0, _define_1.getList)(result);
|
|
125
|
-
arr.map(function (item) { return cache.map.set(item[option.valueField] + '', item[option.nameField]); });
|
|
135
|
+
arr.map(function (item) { return cache.map.set(item[option.valueField] + '', item[option.nameField] || ''); });
|
|
126
136
|
cache.loaded = true;
|
|
127
137
|
}
|
|
128
138
|
return [2 /*return*/, true];
|
|
@@ -171,7 +181,7 @@ var _ApiGetRender = function (props) {
|
|
|
171
181
|
var label = cache.map.get(key);
|
|
172
182
|
if (props.render)
|
|
173
183
|
return props.render({ label: label, value: props.value });
|
|
174
|
-
return (0, _define_1.getValue)(label, props);
|
|
184
|
+
return (0, _define_1.getValue)(label, props.value, props);
|
|
175
185
|
// if (props.render) return props.render({ label: result, value: cacheKey });
|
|
176
186
|
// if (_.isNumber(props.value)) {
|
|
177
187
|
// return cache.map.has(props.value + '') ? getValue(cache.map.get(props.value + ''), props) : (props.default || NONE)
|
|
@@ -254,7 +264,10 @@ var ApiGetRender = function (options) {
|
|
|
254
264
|
if (API_CACHES.has(CACHE_KEY)) {
|
|
255
265
|
var CACHE_MAPPER = API_CACHES.get(CACHE_KEY);
|
|
256
266
|
if (CACHE_MAPPER.loaded) {
|
|
257
|
-
|
|
267
|
+
var result = CACHE_MAPPER.map.get(val);
|
|
268
|
+
if (lodash_1.default.isString(result) && result.length)
|
|
269
|
+
return result;
|
|
270
|
+
return lodash_1.default.isString(defaultValue) ? defaultValue : val;
|
|
258
271
|
}
|
|
259
272
|
}
|
|
260
273
|
var resp = (0, XHR_1.GETSYNC)(options.api);
|
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -165,7 +165,7 @@ var _ApiPostRender = function (props) {
|
|
|
165
165
|
}
|
|
166
166
|
if (result === false)
|
|
167
167
|
return props.default || props.value;
|
|
168
|
-
return (0, _define_1.getValue)(result, props);
|
|
168
|
+
return (0, _define_1.getValue)(result, props.value, props);
|
|
169
169
|
};
|
|
170
170
|
var ApiPostRender = function (options) {
|
|
171
171
|
var KEY = SESSION_KEY + options.api;
|
|
@@ -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
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -1,4 +1,20 @@
|
|
|
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
|
};
|
|
@@ -6,6 +22,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
22
|
exports.dateRender = exports.DateRender = void 0;
|
|
7
23
|
var react_1 = __importDefault(require("react"));
|
|
8
24
|
var dayjs_1 = __importDefault(require("dayjs"));
|
|
25
|
+
var _define_1 = require("./_define");
|
|
9
26
|
var Const_1 = require("../Const");
|
|
10
27
|
var DateRender = function (options) {
|
|
11
28
|
var config = options == undefined ? {} : options;
|
|
@@ -16,8 +33,9 @@ var DateRender = function (options) {
|
|
|
16
33
|
var date = (0, dayjs_1.default)(txt, config.sourceFormat || undefined);
|
|
17
34
|
if (!date.isValid())
|
|
18
35
|
return Const_1.NONE || config.default;
|
|
19
|
-
|
|
20
|
-
|
|
36
|
+
var _a = __read((0, _define_1.getStyles)(txt, options), 2), className = _a[0], style = _a[1];
|
|
37
|
+
if (className || style) {
|
|
38
|
+
return react_1.default.createElement("span", { className: className, style: style }, date.format(config.targetFormat || Const_1.DATE_FORMAT));
|
|
21
39
|
}
|
|
22
40
|
return date.format(config.targetFormat || Const_1.DATE_FORMAT);
|
|
23
41
|
};
|