@lingxiteam/ebe-utils 0.0.1
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/README.md +217 -0
- package/bin/ebe.js +7 -0
- package/es/constants.d.ts +2 -0
- package/es/constants.js +183 -0
- package/es/index.d.ts +64 -0
- package/es/index.js +539 -0
- package/es/node/babel/getAllImportFiles.d.ts +1 -0
- package/es/node/babel/getAllImportFiles.js +79 -0
- package/es/node/babel/getRealPath.d.ts +5 -0
- package/es/node/babel/getRealPath.js +40 -0
- package/es/node/babel/parse.d.ts +6 -0
- package/es/node/babel/parse.js +20 -0
- package/es/node/cli.d.ts +1 -0
- package/es/node/cli.js +87 -0
- package/es/node/constants.d.ts +1 -0
- package/es/node/constants.js +3 -0
- package/es/node/copyStatic.d.ts +6 -0
- package/es/node/copyStatic.js +25 -0
- package/es/node/move.d.ts +5 -0
- package/es/node/move.js +64 -0
- package/es/node/setup.d.ts +4 -0
- package/es/node/setup.js +40 -0
- package/es/shims.d.ts +4 -0
- package/es/types.d.ts +14 -0
- package/es/types.js +1 -0
- package/lib/node/babel/getAllImportFiles.d.ts +1 -0
- package/lib/node/babel/getAllImportFiles.js +106 -0
- package/lib/node/babel/getRealPath.d.ts +5 -0
- package/lib/node/babel/getRealPath.js +59 -0
- package/lib/node/babel/parse.d.ts +6 -0
- package/lib/node/babel/parse.js +64 -0
- package/lib/node/cli.d.ts +1 -0
- package/lib/node/cli.js +37 -0
- package/lib/node/constants.d.ts +1 -0
- package/lib/node/constants.js +30 -0
- package/lib/node/copyStatic.d.ts +6 -0
- package/lib/node/copyStatic.js +57 -0
- package/lib/node/move.d.ts +5 -0
- package/lib/node/move.js +66 -0
- package/lib/node/setup.d.ts +4 -0
- package/lib/node/setup.js +43 -0
- package/lib/public/.editorconfig +17 -0
- package/lib/public/.prettierignore +15 -0
- package/lib/public/.stylelintrc.js +3 -0
- package/lib/public/deploy.sh +48 -0
- package/lib/public/docker/Dockerfile +11 -0
- package/lib/public/docker/default.conf +24 -0
- package/lib/public/src/assets/pageicon/closeIcon.png +0 -0
- package/lib/public/src/assets/pageicon/deleteIcon.png +0 -0
- package/lib/public/src/assets/pageicon/downloadIcon.png +0 -0
- package/lib/public/src/assets/pageicon/excel.png +0 -0
- package/lib/public/src/assets/pageicon/ico-container-drawer.png +0 -0
- package/lib/public/src/assets/pageicon/ico-container-modal.png +0 -0
- package/lib/public/src/assets/pageicon/ico-container-page.png +0 -0
- package/lib/public/src/assets/pageicon/index.ts +25 -0
- package/lib/public/src/assets/pageicon/leftIcon.png +0 -0
- package/lib/public/src/assets/pageicon/rightIcon.png +0 -0
- package/lib/public/src/assets/pageicon/zoomInIcon.png +0 -0
- package/lib/public/src/assets/pageicon/zoomOutIcon.png +0 -0
- package/lib/public/src/components/ExpBusiObjModal/index.less +28 -0
- package/lib/public/src/components/ExpBusiObjModal/index.tsx +315 -0
- package/lib/public/src/components/ExpSQLServiceModal/index.less +28 -0
- package/lib/public/src/components/ExpSQLServiceModal/index.tsx +295 -0
- package/lib/public/src/components/IconFont/IconFont.tsx +26 -0
- package/lib/public/src/components/IconFont/index.ts +1 -0
- package/lib/public/src/components/ImportBusiObjModal/index.less +262 -0
- package/lib/public/src/components/ImportBusiObjModal/index.tsx +1243 -0
- package/lib/public/src/components/LoaderHelper/index.tsx +29 -0
- package/lib/public/src/components/PreviewFile/index.less +200 -0
- package/lib/public/src/components/PreviewFile/index.tsx +787 -0
- package/lib/public/src/components/PreviewFile/utils.ts +90 -0
- package/lib/public/src/components/ProgressComp/ProgressComp.less +64 -0
- package/lib/public/src/components/ProgressComp/ProgressComp.tsx +34 -0
- package/lib/public/src/components/ProgressComp/index.tsx +153 -0
- package/lib/public/src/components/common/ExpBusiObjModal/index.less +28 -0
- package/lib/public/src/components/common/ExpBusiObjModal/index.tsx +315 -0
- package/lib/public/src/components/common/PreviewFile/index.less +200 -0
- package/lib/public/src/components/common/PreviewFile/index.tsx +787 -0
- package/lib/public/src/components/common/PreviewFile/utils.ts +90 -0
- package/lib/public/src/components/pcfactory/src/Alert/index.tsx +22 -0
- package/lib/public/src/components/pcfactory/src/Animation/index.tsx +186 -0
- package/lib/public/src/components/pcfactory/src/Animation/useAnimation.ts +270 -0
- package/lib/public/src/components/pcfactory/src/Animation/useBackgroundStyle.ts +74 -0
- package/lib/public/src/components/pcfactory/src/Audio/index.tsx +240 -0
- package/lib/public/src/components/pcfactory/src/BarChart/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Button/index.tsx +151 -0
- package/lib/public/src/components/pcfactory/src/Card/index.tsx +201 -0
- package/lib/public/src/components/pcfactory/src/Card/useExtendBtn.tsx +195 -0
- package/lib/public/src/components/pcfactory/src/Cascader/index.tsx +398 -0
- package/lib/public/src/components/pcfactory/src/ChartBar/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/ChartBar/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/ChartLine.tsx +48 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/PropsType.ts +88 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/ChartLine/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Checkbox/index.tsx +144 -0
- package/lib/public/src/components/pcfactory/src/CheckboxGroup/index.tsx +319 -0
- package/lib/public/src/components/pcfactory/src/Collapse/index.tsx +195 -0
- package/lib/public/src/components/pcfactory/src/CollapsePanel/index.tsx +186 -0
- package/lib/public/src/components/pcfactory/src/Condition/index.tsx +22 -0
- package/lib/public/src/components/pcfactory/src/DatePicker/index.tsx +756 -0
- package/lib/public/src/components/pcfactory/src/Description/index.tsx +447 -0
- package/lib/public/src/components/pcfactory/src/Description/utils/getLabelSizeMode.ts +40 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/CenterLineDivider/index.tsx +190 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/CenterTabDivider/index.tsx +77 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftCardDivider/index.tsx +87 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftLineDivider/index.tsx +106 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftTabDivider/index.tsx +60 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LeftTopDivider/index.tsx +55 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxDashed/index.module.less +10 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxDashed/index.tsx +143 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxSolid/index.module.less +10 -0
- package/lib/public/src/components/pcfactory/src/Divider/components/LxSolid/index.tsx +126 -0
- package/lib/public/src/components/pcfactory/src/Divider/index.tsx +210 -0
- package/lib/public/src/components/pcfactory/src/Dropdown/index.tsx +385 -0
- package/lib/public/src/components/pcfactory/src/DynamicTabs/PropsType.ts +31 -0
- package/lib/public/src/components/pcfactory/src/DynamicTabs/TabPage.tsx +63 -0
- package/lib/public/src/components/pcfactory/src/DynamicTabs/index.tsx +214 -0
- package/lib/public/src/components/pcfactory/src/Form/Form.tsx +600 -0
- package/lib/public/src/components/pcfactory/src/Form/WrapperForm.ts +14 -0
- package/lib/public/src/components/pcfactory/src/Form/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/Form/useFormStatus.ts +47 -0
- package/lib/public/src/components/pcfactory/src/Form/useMonitor.ts +40 -0
- package/lib/public/src/components/pcfactory/src/FormGroup/TitleComp.tsx +107 -0
- package/lib/public/src/components/pcfactory/src/FormGroup/index.tsx +181 -0
- package/lib/public/src/components/pcfactory/src/FreeLayout/index.tsx +151 -0
- package/lib/public/src/components/pcfactory/src/Gantt/Gantt.tsx +460 -0
- package/lib/public/src/components/pcfactory/src/Gantt/const.ts +122 -0
- package/lib/public/src/components/pcfactory/src/Gantt/index.tsx +16 -0
- package/lib/public/src/components/pcfactory/src/Gantt/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/GridView/GridView.tsx +435 -0
- package/lib/public/src/components/pcfactory/src/GridView/index.tsx +24 -0
- package/lib/public/src/components/pcfactory/src/GridView/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/HorizontalView/index.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/Icon/IconED/index.tsx +42 -0
- package/lib/public/src/components/pcfactory/src/Icon/PropsType.ts +57 -0
- package/lib/public/src/components/pcfactory/src/Icon/hooks/index.tsx +300 -0
- package/lib/public/src/components/pcfactory/src/Icon/index.tsx +69 -0
- package/lib/public/src/components/pcfactory/src/IconFont/index.tsx +24 -0
- package/lib/public/src/components/pcfactory/src/Img/BasicImage/index.tsx +90 -0
- package/lib/public/src/components/pcfactory/src/Img/assets/placeholder.png +0 -0
- package/lib/public/src/components/pcfactory/src/Img/index.tsx +91 -0
- package/lib/public/src/components/pcfactory/src/Input/index.tsx +425 -0
- package/lib/public/src/components/pcfactory/src/InputNumber/index.tsx +263 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/LXPieChart.tsx +23 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/PropsType.ts +11 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/index.less +6 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/index.tsx +15 -0
- package/lib/public/src/components/pcfactory/src/LXPieChart/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/LXRadarChat.tsx +25 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/PropsType.ts +9 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/index.less +7 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/index.tsx +17 -0
- package/lib/public/src/components/pcfactory/src/LXRadarChart/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Layout/index.tsx +130 -0
- package/lib/public/src/components/pcfactory/src/Layout/utils.ts +48 -0
- package/lib/public/src/components/pcfactory/src/LineChart/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Link/index.tsx +117 -0
- package/lib/public/src/components/pcfactory/src/LoopList/index.tsx +551 -0
- package/lib/public/src/components/pcfactory/src/Menu/index.tsx +422 -0
- package/lib/public/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +95 -0
- package/lib/public/src/components/pcfactory/src/ModalSelect/index.tsx +453 -0
- package/lib/public/src/components/pcfactory/src/MultipleSelect/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Pagination/index.tsx +104 -0
- package/lib/public/src/components/pcfactory/src/Password/index.tsx +88 -0
- package/lib/public/src/components/pcfactory/src/PictureVerifyCode/assets/placeholder.png +0 -0
- package/lib/public/src/components/pcfactory/src/PictureVerifyCode/index.tsx +76 -0
- package/lib/public/src/components/pcfactory/src/PieChart/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Progress/index.tsx +155 -0
- package/lib/public/src/components/pcfactory/src/QRCode/const.ts +5 -0
- package/lib/public/src/components/pcfactory/src/QRCode/index.tsx +146 -0
- package/lib/public/src/components/pcfactory/src/QuillEditor/QuillEditor.tsx +197 -0
- package/lib/public/src/components/pcfactory/src/QuillEditor/index.tsx +37 -0
- package/lib/public/src/components/pcfactory/src/QuillEditor/loader.ts +12 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/RadarChartHook.ts +449 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/RadarChartType.ts +39 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/RadarECharts.tsx +86 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/index.tsx +16 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/RadarChart/radarDefaultConfig.js +55 -0
- package/lib/public/src/components/pcfactory/src/Radio/index.tsx +260 -0
- package/lib/public/src/components/pcfactory/src/RangePicker/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/Rate/index.tsx +187 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/PropsType.ts +37 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/ReactECharts.tsx +672 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/index.tsx +26 -0
- package/lib/public/src/components/pcfactory/src/ReactECharts/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/components/FishRender.tsx +31 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/components/ReactRender.tsx +55 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/components/VueRender.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/constant.ts +9 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/index.tsx +82 -0
- package/lib/public/src/components/pcfactory/src/RemoteComponent/remote-component.config.ts +12 -0
- package/lib/public/src/components/pcfactory/src/Result/index.tsx +27 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +105 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +234 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +41 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/index.tsx +33 -0
- package/lib/public/src/components/pcfactory/src/RichTextEditor/loader.ts +12 -0
- package/lib/public/src/components/pcfactory/src/Row/Row.tsx +66 -0
- package/lib/public/src/components/pcfactory/src/Row/index.tsx +9 -0
- package/lib/public/src/components/pcfactory/src/Row/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Select/index.tsx +628 -0
- package/lib/public/src/components/pcfactory/src/Select/selectUtils.ts +257 -0
- package/lib/public/src/components/pcfactory/src/Slider/index.tsx +351 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/DownloadProgress/DownloadProgress.tsx +27 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/DownloadProgress/index.ts +3 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/UploadItem.tsx +257 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/default.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/js.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/pdf.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/ppt.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/txt.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/word.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/xls.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/assets/zip.png +0 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/index.tsx +1050 -0
- package/lib/public/src/components/pcfactory/src/StdUpload/uploadItem.less +64 -0
- package/lib/public/src/components/pcfactory/src/Steps/constant/checkcircle.tsx +29 -0
- package/lib/public/src/components/pcfactory/src/Steps/constant/index.ts +2 -0
- package/lib/public/src/components/pcfactory/src/Steps/constant/vector.tsx +13 -0
- package/lib/public/src/components/pcfactory/src/Steps/index.tsx +343 -0
- package/lib/public/src/components/pcfactory/src/SuperSelect/ComSelect.tsx +538 -0
- package/lib/public/src/components/pcfactory/src/SuperSelect/index.tsx +127 -0
- package/lib/public/src/components/pcfactory/src/SuperSelect/loader.tsx +12 -0
- package/lib/public/src/components/pcfactory/src/Swiper/index.tsx +184 -0
- package/lib/public/src/components/pcfactory/src/Switch/index.tsx +219 -0
- package/lib/public/src/components/pcfactory/src/TabPane/index.tsx +145 -0
- package/lib/public/src/components/pcfactory/src/Table/BodyCell/index.tsx +278 -0
- package/lib/public/src/components/pcfactory/src/Table/EditComponent/index.tsx +554 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +34 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +26 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +41 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +34 -0
- package/lib/public/src/components/pcfactory/src/Table/FormatCell/index.tsx +227 -0
- package/lib/public/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +63 -0
- package/lib/public/src/components/pcfactory/src/Table/HeaderCell/index.tsx +32 -0
- package/lib/public/src/components/pcfactory/src/Table/TableHead/index.tsx +501 -0
- package/lib/public/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +46 -0
- package/lib/public/src/components/pcfactory/src/Table/constant.ts +73 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/index.ts +32 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +325 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +176 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useColumns.tsx +1851 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useCommon.ts +39 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useDataSource.ts +201 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +324 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useFilter.tsx +274 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useFormatCell.ts +309 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/usePagination.ts +104 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +302 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +93 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useScroll.ts +120 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useSelection.ts +467 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useSort.ts +39 -0
- package/lib/public/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +191 -0
- package/lib/public/src/components/pcfactory/src/Table/index.tsx +525 -0
- package/lib/public/src/components/pcfactory/src/Table/utils/SequenceId.ts +104 -0
- package/lib/public/src/components/pcfactory/src/Table/utils/index.ts +442 -0
- package/lib/public/src/components/pcfactory/src/Tabs/index.tsx +209 -0
- package/lib/public/src/components/pcfactory/src/Tag/index.tsx +39 -0
- package/lib/public/src/components/pcfactory/src/Text/index.tsx +191 -0
- package/lib/public/src/components/pcfactory/src/TextArea/ForIETextArea.tsx +96 -0
- package/lib/public/src/components/pcfactory/src/TextArea/index.tsx +255 -0
- package/lib/public/src/components/pcfactory/src/TimePicker/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/TlrView/index.tsx +3 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/PropsType.ts +22 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/TooltipViewED/index.tsx +10 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/hooks/index.tsx +90 -0
- package/lib/public/src/components/pcfactory/src/TooltipView/index.tsx +13 -0
- package/lib/public/src/components/pcfactory/src/Transfer/index.tsx +753 -0
- package/lib/public/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +102 -0
- package/lib/public/src/components/pcfactory/src/Tree/index.tsx +1303 -0
- package/lib/public/src/components/pcfactory/src/TreeSelect/index.tsx +639 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +82 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +61 -0
- package/lib/public/src/components/pcfactory/src/TreeTable/index.tsx +273 -0
- package/lib/public/src/components/pcfactory/src/Upload/Upload.tsx +740 -0
- package/lib/public/src/components/pcfactory/src/Upload/index.tsx +29 -0
- package/lib/public/src/components/pcfactory/src/Upload/loader.tsx +13 -0
- package/lib/public/src/components/pcfactory/src/VerificationCode/assets/placeholder.png +0 -0
- package/lib/public/src/components/pcfactory/src/VerificationCode/index.tsx +297 -0
- package/lib/public/src/components/pcfactory/src/VerticalView/index.tsx +25 -0
- package/lib/public/src/components/pcfactory/src/VideoPlayer/index.tsx +159 -0
- package/lib/public/src/components/pcfactory/src/View/index.tsx +150 -0
- package/lib/public/src/components/pcfactory/src/View/useBackgroundStyle.ts +75 -0
- package/lib/public/src/components/pcfactory/src/VirtualGroup/index.tsx +16 -0
- package/lib/public/src/components/pcfactory/src/Webview/index.tsx +104 -0
- package/lib/public/src/components/pcfactory/src/index.component.ts +253 -0
- package/lib/public/src/components/pcfactory/src/styles/common.less +107 -0
- package/lib/public/src/components/pcfactory/src/styles/compatible.less +976 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Alert.less +25 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Audio.less +198 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Button.less +32 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Card.less +155 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Cascader.less +54 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Checkbox.less +7 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Collapse.less +214 -0
- package/lib/public/src/components/pcfactory/src/styles/components/DatePicker.less +22 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Description.less +64 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Divider.less +530 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Drawer.less +54 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Dropdown.less +11 -0
- package/lib/public/src/components/pcfactory/src/styles/components/DynamicDataContainer.less +16 -0
- package/lib/public/src/components/pcfactory/src/styles/components/DynamicTabs.less +254 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Form.less +265 -0
- package/lib/public/src/components/pcfactory/src/styles/components/FormGroup.less +111 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Gantt.less +139 -0
- package/lib/public/src/components/pcfactory/src/styles/components/GridView.less +62 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Icon.less +20 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Input.less +164 -0
- package/lib/public/src/components/pcfactory/src/styles/components/InputNumber.less +124 -0
- package/lib/public/src/components/pcfactory/src/styles/components/InputPassword.less +3 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Link.less +4 -0
- package/lib/public/src/components/pcfactory/src/styles/components/LoopList.less +67 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Menu.less +54 -0
- package/lib/public/src/components/pcfactory/src/styles/components/ModalSelect.less +42 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Popconfirm.less +7 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Progress.less +57 -0
- package/lib/public/src/components/pcfactory/src/styles/components/QuillEditor.less +15 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Radio.less +7 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Rate.less +16 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Result.less +26 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Select.less +146 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Slider.less +78 -0
- package/lib/public/src/components/pcfactory/src/styles/components/StdUpload.less +225 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Step.less +91 -0
- package/lib/public/src/components/pcfactory/src/styles/components/SuperSelect.less +83 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Swiper.less +106 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Switch.less +49 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Table.less +1229 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Tabs.less +291 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Tag.less +107 -0
- package/lib/public/src/components/pcfactory/src/styles/components/TextArea.less +12 -0
- package/lib/public/src/components/pcfactory/src/styles/components/TooltipView.less +43 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Transfer.less +155 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Tree.less +329 -0
- package/lib/public/src/components/pcfactory/src/styles/components/TreeSelect.less +65 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Upload.less +26 -0
- package/lib/public/src/components/pcfactory/src/styles/components/VerificationCode.less +162 -0
- package/lib/public/src/components/pcfactory/src/styles/components/Webview.less +31 -0
- package/lib/public/src/components/pcfactory/src/styles/index.less +10 -0
- package/lib/public/src/components/pcfactory/src/styles/index.ued.less +65 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/antdVariables.less +84 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/common.less +9 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/customVariables.less +35 -0
- package/lib/public/src/components/pcfactory/src/styles/theme/variables/index.less +2 -0
- package/lib/public/src/components/pcfactory/src/utils/ChannelContainer.tsx +150 -0
- package/lib/public/src/components/pcfactory/src/utils/ChildRender.ts +103 -0
- package/lib/public/src/components/pcfactory/src/utils/CustomModule.tsx +134 -0
- package/lib/public/src/components/pcfactory/src/utils/DummyFormContext.ts +136 -0
- package/lib/public/src/components/pcfactory/src/utils/Empty/customLocale.tsx +6 -0
- package/lib/public/src/components/pcfactory/src/utils/Empty/empty.tsx +37 -0
- package/lib/public/src/components/pcfactory/src/utils/LoaderHelper.tsx +29 -0
- package/lib/public/src/components/pcfactory/src/utils/PropsType.ts +21 -0
- package/lib/public/src/components/pcfactory/src/utils/WithSyncValue.ts +218 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/index.ts +22 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useCreation.ts +23 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useDeepCompareEffect.ts +27 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useMap.ts +46 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +27 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/usePrevious.ts +19 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useSetState.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useUnmountedRef.ts +14 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useUpdate.ts +9 -0
- package/lib/public/src/components/pcfactory/src/utils/ahooks/useUpdateEffect.ts +16 -0
- package/lib/public/src/components/pcfactory/src/utils/basicStatusTransfer.ts +32 -0
- package/lib/public/src/components/pcfactory/src/utils/common.ts +367 -0
- package/lib/public/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +106 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +131 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +646 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +123 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +411 -0
- package/lib/public/src/components/pcfactory/src/utils/formUtils/common.ts +28 -0
- package/lib/public/src/components/pcfactory/src/utils/getExportDefaultObj.ts +11 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +140 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useDataMask.ts +83 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +63 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +86 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +41 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +43 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +90 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useListenState.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useLocale.ts +129 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +80 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useRules.ts +89 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +26 -0
- package/lib/public/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +33 -0
- package/lib/public/src/components/pcfactory/src/utils/index.ts +19 -0
- package/lib/public/src/components/pcfactory/src/utils/polyfill.js +305 -0
- package/lib/public/src/components/pcfactory/src/utils/renderReadOnly.tsx +105 -0
- package/lib/public/src/components/pcfactory/src/variables.ts +2 -0
- package/lib/public/src/components/pcfactory/typings.d.ts +27 -0
- package/lib/public/src/hooks/useExportCustomDataFile.ts +566 -0
- package/lib/public/src/hooks/useLifeCycle.ts +110 -0
- package/lib/public/src/hooks/useListenProps.ts +14 -0
- package/lib/public/src/hooks/useSafeState.ts +26 -0
- package/lib/public/src/hooks/useSetState.ts +41 -0
- package/lib/public/src/hooks/useSyncState.ts +27 -0
- package/lib/public/src/hooks/useTransSuperObjectParams.ts +82 -0
- package/lib/public/src/hooks/useUnmountedRef.ts +14 -0
- package/lib/public/src/hooks/useUpdateEffect.ts +16 -0
- package/lib/public/src/pages/_preview/index.tsx +23 -0
- package/lib/public/src/services/README.md +32 -0
- package/lib/public/src/services/api/batchInsert.ts +21 -0
- package/lib/public/src/services/api/engine.ts +59 -0
- package/lib/public/src/services/api/file.ts +50 -0
- package/lib/public/src/services/api/findAppConfig.ts +14 -0
- package/lib/public/src/services/api/getAppFileUrlByFileCode.ts +14 -0
- package/lib/public/src/services/api/index.ts +38 -0
- package/lib/public/src/services/type.ts +51 -0
- package/lib/public/src/styles/common.less +41 -0
- package/lib/public/src/styles/index.less +4 -0
- package/lib/public/src/styles/index.ts +1 -0
- package/lib/public/src/styles/theme/variables.less +130 -0
- package/lib/public/src/types/index.ts +246 -0
- package/lib/public/src/utils/AwaitHandleData.ts +46 -0
- package/lib/public/src/utils/Context/Container.tsx +65 -0
- package/lib/public/src/utils/Context/context.tsx +95 -0
- package/lib/public/src/utils/LcdpSpin/index.less +13 -0
- package/lib/public/src/utils/LcdpSpin/index.tsx +12 -0
- package/lib/public/src/utils/ModalManager/Drawer/index.less +30 -0
- package/lib/public/src/utils/ModalManager/Drawer/index.tsx +109 -0
- package/lib/public/src/utils/ModalManager/Modal/index.less +7 -0
- package/lib/public/src/utils/ModalManager/Modal/index.tsx +96 -0
- package/lib/public/src/utils/ModalManager/index.tsx +278 -0
- package/lib/public/src/utils/Security/clientCapabilities.ts +19 -0
- package/lib/public/src/utils/Security/config.ts +89 -0
- package/lib/public/src/utils/Security/const.ts +129 -0
- package/lib/public/src/utils/Security/encipher/aes.ts +52 -0
- package/lib/public/src/utils/Security/encipher/des.ts +52 -0
- package/lib/public/src/utils/Security/encipher/rsa.ts +42 -0
- package/lib/public/src/utils/Security/encipher/sign.ts +212 -0
- package/lib/public/src/utils/Security/encipher/token.ts +52 -0
- package/lib/public/src/utils/Security/httpEncryption.ts +75 -0
- package/lib/public/src/utils/Security/index.ts +28 -0
- package/lib/public/src/utils/Security/requester/fetch.ts +119 -0
- package/lib/public/src/utils/Security/requester/wx.ts +132 -0
- package/lib/public/src/utils/Security/requester/xhr.ts +121 -0
- package/lib/public/src/utils/Security/types.ts +181 -0
- package/lib/public/src/utils/Security/utils/check.ts +62 -0
- package/lib/public/src/utils/Security/utils/cookie.ts +70 -0
- package/lib/public/src/utils/Security/utils/encrypted.ts +122 -0
- package/lib/public/src/utils/Security/utils/message.ts +17 -0
- package/lib/public/src/utils/Security/utils/url.ts +78 -0
- package/lib/public/src/utils/StateListener.ts +69 -0
- package/lib/public/src/utils/User.ts +16 -0
- package/lib/public/src/utils/array.ts +151 -0
- package/lib/public/src/utils/basicStatusTransfer.ts +32 -0
- package/lib/public/src/utils/cmd.ts +27 -0
- package/lib/public/src/utils/customFuncMapping.ts +107 -0
- package/lib/public/src/utils/dataSource/fetchQuery.ts +154 -0
- package/lib/public/src/utils/dataSource/index.ts +1 -0
- package/lib/public/src/utils/engine-utils/exportCustomUtils.ts +215 -0
- package/lib/public/src/utils/engine-utils/hooks/index.ts +3 -0
- package/lib/public/src/utils/engine-utils/hooks/useCreation.ts +23 -0
- package/lib/public/src/utils/engine-utils/index.ts +2 -0
- package/lib/public/src/utils/engine-utils/previewUtil.ts +18 -0
- package/lib/public/src/utils/formUtils.ts +458 -0
- package/lib/public/src/utils/functors/ABS.ts +23 -0
- package/lib/public/src/utils/functors/AESDECRYPT.ts +26 -0
- package/lib/public/src/utils/functors/AESENCRYPT.ts +26 -0
- package/lib/public/src/utils/functors/ARRAYINDEX.ts +23 -0
- package/lib/public/src/utils/functors/ARRAYTOSTR.ts +23 -0
- package/lib/public/src/utils/functors/AVERAGE.ts +23 -0
- package/lib/public/src/utils/functors/CONCAT.ts +20 -0
- package/lib/public/src/utils/functors/COUNTA.ts +22 -0
- package/lib/public/src/utils/functors/COUNTARRAY.ts +20 -0
- package/lib/public/src/utils/functors/COUNTBLANK.ts +22 -0
- package/lib/public/src/utils/functors/COUNTCHAR.ts +26 -0
- package/lib/public/src/utils/functors/DATAMASK.ts +150 -0
- package/lib/public/src/utils/functors/DATEADD.ts +37 -0
- package/lib/public/src/utils/functors/DATENOW.ts +27 -0
- package/lib/public/src/utils/functors/DATETIME.ts +20 -0
- package/lib/public/src/utils/functors/IF.ts +20 -0
- package/lib/public/src/utils/functors/INT.ts +23 -0
- package/lib/public/src/utils/functors/LOG.ts +24 -0
- package/lib/public/src/utils/functors/MAX.ts +24 -0
- package/lib/public/src/utils/functors/MIN.ts +24 -0
- package/lib/public/src/utils/functors/MOD.ts +24 -0
- package/lib/public/src/utils/functors/NUMBER.ts +26 -0
- package/lib/public/src/utils/functors/OBJECTVALUE.ts +20 -0
- package/lib/public/src/utils/functors/POWER.ts +24 -0
- package/lib/public/src/utils/functors/PRODUCT.ts +20 -0
- package/lib/public/src/utils/functors/RANDBETWEEN.ts +22 -0
- package/lib/public/src/utils/functors/RANDOMNUM.ts +30 -0
- package/lib/public/src/utils/functors/ROUND.ts +24 -0
- package/lib/public/src/utils/functors/ROUNDDOWN.ts +24 -0
- package/lib/public/src/utils/functors/ROUNDUP.ts +25 -0
- package/lib/public/src/utils/functors/STRTOARRAY.ts +23 -0
- package/lib/public/src/utils/functors/SUM.ts +20 -0
- package/lib/public/src/utils/functors/index.ts +32 -0
- package/lib/public/src/utils/functors/types.ts +32 -0
- package/lib/public/src/utils/functors/utils/tools.ts +15 -0
- package/lib/public/src/utils/historytool.ts +154 -0
- package/lib/public/src/utils/hooks/index.ts +22 -0
- package/lib/public/src/utils/hooks/useCreation.ts +23 -0
- package/lib/public/src/utils/hooks/useHiddenStyle.ts +19 -0
- package/lib/public/src/utils/hooks/useMovable.ts +227 -0
- package/lib/public/src/utils/hooks/usePersistFn.ts +17 -0
- package/lib/public/src/utils/hooks/useReactive.ts +73 -0
- package/lib/public/src/utils/hooks/useRefState.ts +25 -0
- package/lib/public/src/utils/hooks/useSetState.ts +25 -0
- package/lib/public/src/utils/hooks/useStyle.ts +139 -0
- package/lib/public/src/utils/hooks/useTrackedEffect.ts +39 -0
- package/lib/public/src/utils/hooks/useUpdate.ts +9 -0
- package/lib/public/src/utils/hooks/useUpdateDeepEffect.ts +22 -0
- package/lib/public/src/utils/hooks/useUpdateEffect.ts +18 -0
- package/lib/public/src/utils/hooks/useWhyDidYouUpdate.ts +32 -0
- package/lib/public/src/utils/i18n/i18n.ts +15 -0
- package/lib/public/src/utils/i18n/index.ts +7 -0
- package/lib/public/src/utils/i18n/locale/app/en_US.ts +77 -0
- package/lib/public/src/utils/i18n/locale/app/index.ts +9 -0
- package/lib/public/src/utils/i18n/locale/app/otherLocale.ts +2 -0
- package/lib/public/src/utils/i18n/locale/app/zh_CN.ts +65 -0
- package/lib/public/src/utils/i18n/locale/app/zh_HK.ts +66 -0
- package/lib/public/src/utils/i18n/locale/base/en_US.ts +449 -0
- package/lib/public/src/utils/i18n/locale/base/index.ts +5 -0
- package/lib/public/src/utils/i18n/locale/base/zh_CN.ts +413 -0
- package/lib/public/src/utils/i18n/locale/base/zh_HK.ts +411 -0
- package/lib/public/src/utils/i18n/locale/pc/en_US.ts +131 -0
- package/lib/public/src/utils/i18n/locale/pc/index.ts +9 -0
- package/lib/public/src/utils/i18n/locale/pc/otherLocale.ts +2 -0
- package/lib/public/src/utils/i18n/locale/pc/zh_CN.ts +105 -0
- package/lib/public/src/utils/i18n/locale/pc/zh_HK.ts +105 -0
- package/lib/public/src/utils/i18n/localeMonitor.ts +71 -0
- package/lib/public/src/utils/i18n/locales.ts +30 -0
- package/lib/public/src/utils/i18n/replaceMessage.ts +29 -0
- package/lib/public/src/utils/i18n/types.ts +2 -0
- package/lib/public/src/utils/i18n/useLocale.ts +129 -0
- package/lib/public/src/utils/lcdpApi.ts +215 -0
- package/lib/public/src/utils/lcdpBaseApi.ts +293 -0
- package/lib/public/src/utils/messageApi.ts +93 -0
- package/lib/public/src/utils/platform/index.ts +1 -0
- package/lib/public/src/utils/platform/type.ts +7 -0
- package/lib/public/src/utils/platform/utils/fileUtils.ts +536 -0
- package/lib/public/src/utils/preprocess.ts +88 -0
- package/lib/public/src/utils/sandBoxLoadModule.ts +216 -0
- package/lib/public/src/utils/sandbox/browserCompatible.ts +54 -0
- package/lib/public/src/utils/sandbox/compileCode.ts +81 -0
- package/lib/public/src/utils/sandbox/index.ts +5 -0
- package/lib/public/src/utils/sandbox/sandbox.ts +324 -0
- package/lib/public/src/utils/sandbox/sandboxrules.ts +206 -0
- package/lib/public/src/utils/sandbox/utils.ts +9 -0
- package/lib/public/src/utils/service/baseRequest.ts +111 -0
- package/lib/public/src/utils/service/commonFetch.ts +140 -0
- package/lib/public/src/utils/service/defaultResponseInterceptor.ts +84 -0
- package/lib/public/src/utils/service/resolveApiPath.ts +24 -0
- package/lib/public/src/utils/service/urlHelper.ts +56 -0
- package/lib/public/src/utils/styleInject.ts +17 -0
- package/lib/public/src/utils/svgImage/imageUtils.ts +3 -0
- package/lib/public/src/utils/svgImage/index.ts +10 -0
- package/lib/public/src/utils/uid.ts +33 -0
- package/lib/public/src/utils/useComponentHoc.ts +96 -0
- package/lib/public/src/utils/useSetState.ts +26 -0
- package/lib/public/src/utils/useTool.ts +428 -0
- package/lib/public/tsconfig.json +33 -0
- package/lib/public/typings.d.ts +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
|
|
3
|
+
export const COUNTCHAR = FunctorDefine({
|
|
4
|
+
label: '计字符数',
|
|
5
|
+
type: 'COUNTCHAR',
|
|
6
|
+
value: 'COUNTCHAR(标题)',
|
|
7
|
+
functor(text: string) {
|
|
8
|
+
if (typeof text !== 'string') {
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
if (text === null || text === undefined) {
|
|
12
|
+
return 0;
|
|
13
|
+
}
|
|
14
|
+
return text.length;
|
|
15
|
+
},
|
|
16
|
+
define: ['计算文本字段的字符数量'],
|
|
17
|
+
description: {
|
|
18
|
+
tips: [],
|
|
19
|
+
title: '(文本)',
|
|
20
|
+
},
|
|
21
|
+
example: {
|
|
22
|
+
tips: ['计算标题“通过函数计算赋字段默认值”的字数'],
|
|
23
|
+
title: '(标题),结果:12',
|
|
24
|
+
},
|
|
25
|
+
groupsName: '数学函数',
|
|
26
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/* eslint-disable no-extend-native,no-param-reassign,no-self-compare,eqeqeq,no-bitwise,no-fallthrough */
|
|
2
|
+
|
|
3
|
+
import { FunctorDefine } from './types';
|
|
4
|
+
|
|
5
|
+
type DataMaskType = 'mobile' | 'email' | 'ID' | 'phone' | 'default' | 'service';
|
|
6
|
+
|
|
7
|
+
if (!String.prototype.repeat) {
|
|
8
|
+
String.prototype.repeat = function (count) {
|
|
9
|
+
if (this == null) {
|
|
10
|
+
throw new TypeError(`can't convert ${this} to object`);
|
|
11
|
+
}
|
|
12
|
+
let str = `${this}`;
|
|
13
|
+
count = +count;
|
|
14
|
+
if (count != count) {
|
|
15
|
+
count = 0;
|
|
16
|
+
}
|
|
17
|
+
if (count < 0) {
|
|
18
|
+
throw new RangeError('repeat count must be non-negative');
|
|
19
|
+
}
|
|
20
|
+
if (count == Infinity) {
|
|
21
|
+
throw new RangeError('repeat count must be less than infinity');
|
|
22
|
+
}
|
|
23
|
+
count = Math.floor(count);
|
|
24
|
+
if (str.length == 0 || count == 0) {
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
// 确保 count 是一个 31 位的整数。这样我们就可以使用如下优化的算法。
|
|
28
|
+
// 当前(2014 年 8 月),绝大多数浏览器都不能支持 1 << 28 长的字符串,所以:
|
|
29
|
+
if (str.length * count >= 1 << 28) {
|
|
30
|
+
throw new RangeError(
|
|
31
|
+
'repeat count must not overflow maximum string size',
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
let rpt = '';
|
|
35
|
+
for (;;) {
|
|
36
|
+
if ((count & 1) == 1) {
|
|
37
|
+
rpt += str;
|
|
38
|
+
}
|
|
39
|
+
count >>>= 1;
|
|
40
|
+
if (count == 0) {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
str += str;
|
|
44
|
+
}
|
|
45
|
+
return rpt;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const defaultDataMaskProcess = (inputstr: String) => {
|
|
50
|
+
// 通用规则脱敏为 保留前后2位,中间脱敏,如果不足5位,最后一位为脱敏
|
|
51
|
+
if (inputstr.length < 5) {
|
|
52
|
+
return inputstr.replace(/.$/g, '*');
|
|
53
|
+
}
|
|
54
|
+
const count = inputstr.length - 4;
|
|
55
|
+
return inputstr.replace(/(^.{2})(.*)(.{2}$)/g, `$1${'*'.repeat(count)}$3`);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const processDataMaskValue = (
|
|
59
|
+
inputstr: String,
|
|
60
|
+
type: DataMaskType = 'default',
|
|
61
|
+
) => {
|
|
62
|
+
// 待脱敏数据类型检测提示
|
|
63
|
+
if (typeof inputstr !== 'string') {
|
|
64
|
+
// 数字类型自动转换
|
|
65
|
+
if (typeof inputstr === 'number') {
|
|
66
|
+
inputstr = (inputstr as number).toString();
|
|
67
|
+
} else {
|
|
68
|
+
console.error(
|
|
69
|
+
`待脱敏数据${inputstr}类型:${typeof inputstr},不是string类型`,
|
|
70
|
+
);
|
|
71
|
+
return inputstr;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 后端脱敏(service)的情况下也是原样返回
|
|
76
|
+
if (!inputstr || !type || type === 'service') {
|
|
77
|
+
return inputstr;
|
|
78
|
+
}
|
|
79
|
+
// 注意,下面这个switch的条件穿透是故意为之,不break
|
|
80
|
+
// 目的是,当具体的配置违背第一层格式表达式时,可以自动回退到保底通用规则
|
|
81
|
+
// 如果认为这样不规范,那就每一个条件就加上else return defaultDataMaskProcess(inputstr);即可
|
|
82
|
+
switch (type) {
|
|
83
|
+
case 'mobile':
|
|
84
|
+
// 手机,手机遮4-7位
|
|
85
|
+
if (inputstr.match(/^1[3-9]\d{9}$/g)) {
|
|
86
|
+
return inputstr.replace(
|
|
87
|
+
/(^\d{3})(\d*)(\d{4}$)/g,
|
|
88
|
+
`$1${'*'.repeat(4)}$3`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
case 'email':
|
|
92
|
+
// 电子邮箱,都只保留前两位
|
|
93
|
+
if (
|
|
94
|
+
inputstr.match(
|
|
95
|
+
/^[\w\+\-]+(\.[\w\+\-]+)*@[a-z\d\-]+(\.[a-z\d\-]+)*\.([a-z]{2,9})$/i,
|
|
96
|
+
)
|
|
97
|
+
) {
|
|
98
|
+
const arr = inputstr.split('@');
|
|
99
|
+
const firstp = `${arr[0].substring(0, 2)}${'*'.repeat(
|
|
100
|
+
arr[0].length - 2,
|
|
101
|
+
)}`;
|
|
102
|
+
const secondp = `${arr[1].substring(0, 2)}${'*'.repeat(
|
|
103
|
+
arr[1].length - 2,
|
|
104
|
+
)}`;
|
|
105
|
+
return `${firstp}@${secondp}`;
|
|
106
|
+
}
|
|
107
|
+
case 'ID':
|
|
108
|
+
// 居民身份证号
|
|
109
|
+
if (inputstr.match(/^\d{17}(\d|X)$/g)) {
|
|
110
|
+
return inputstr.replace(
|
|
111
|
+
/(^\d{4})(\d*)(.{2}$)/g,
|
|
112
|
+
`$1${'*'.repeat(12)}$3`,
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
case 'phone':
|
|
116
|
+
// 固话,固话逻辑是保留前3位,遮4-7位
|
|
117
|
+
if (
|
|
118
|
+
inputstr.match(
|
|
119
|
+
/^(?:(?:0\d{2,3}[\- ]?[1-9]\d{6,7})|(?:[48]00[\- ]?[1-9]\d{6}))$/g,
|
|
120
|
+
)
|
|
121
|
+
) {
|
|
122
|
+
return `${inputstr.substring(0, 3)}${'*'.repeat(4)}${inputstr.substring(
|
|
123
|
+
7,
|
|
124
|
+
)}`;
|
|
125
|
+
}
|
|
126
|
+
default:
|
|
127
|
+
// 回归保底通用规则
|
|
128
|
+
return defaultDataMaskProcess(inputstr);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const DATAMASK = FunctorDefine({
|
|
133
|
+
label: '数据脱敏',
|
|
134
|
+
type: 'DATAMASK',
|
|
135
|
+
value: "DATAMASK('88888888@test.com', 'email')",
|
|
136
|
+
functor: processDataMaskValue,
|
|
137
|
+
define: [
|
|
138
|
+
'对敏感信息进行脱敏',
|
|
139
|
+
'email: 邮件脱敏,phone: 手机脱敏,ID: 身份证脱敏,common: 通用',
|
|
140
|
+
],
|
|
141
|
+
description: {
|
|
142
|
+
tips: [],
|
|
143
|
+
title: '(文本)',
|
|
144
|
+
},
|
|
145
|
+
example: {
|
|
146
|
+
tips: ['电子邮箱,@前后两段,只保留前两位'],
|
|
147
|
+
title: "('88888888@test.com', 'email'),结果:88******@te******",
|
|
148
|
+
},
|
|
149
|
+
groupsName: '字符串函数',
|
|
150
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ManipulateType } from 'dayjs';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import { FunctorDefine } from './types';
|
|
4
|
+
|
|
5
|
+
export const DATEADD = FunctorDefine({
|
|
6
|
+
label: '为日期加减时间',
|
|
7
|
+
type: 'DATEADD',
|
|
8
|
+
value: "DATEADD('2008-11-11 12:23','+8h','YYYY-MM-DD hh:mm')",
|
|
9
|
+
functor: (
|
|
10
|
+
date: string | Date,
|
|
11
|
+
unitDis: string,
|
|
12
|
+
formatter?: string,
|
|
13
|
+
): Date | string => {
|
|
14
|
+
const day = dayjs(date);
|
|
15
|
+
const unitLen = unitDis.length;
|
|
16
|
+
const unit = unitDis.charAt(unitLen - 1) as ManipulateType;
|
|
17
|
+
const resultDate = day.add(parseFloat(unitDis), unit);
|
|
18
|
+
if (!formatter) {
|
|
19
|
+
return resultDate.toDate();
|
|
20
|
+
}
|
|
21
|
+
return resultDate.format(formatter);
|
|
22
|
+
},
|
|
23
|
+
define: ['对某个日期(时间)添加/减去一定时间段,再对计算结果设置格式'],
|
|
24
|
+
description: {
|
|
25
|
+
tips: [
|
|
26
|
+
"· 计算式:'+'或'-'代表添加或减去;时间段的单位,'y'代表年、'M'代表月、'd'代表天、'h'代表小时、'm'代表分钟、's'代表秒",
|
|
27
|
+
'· [输出格式]:YYYY-MM-DD;如果不指定这个参数,则默认是Date类型',
|
|
28
|
+
],
|
|
29
|
+
title: '(初始日期,计算式,[输出格式])',
|
|
30
|
+
},
|
|
31
|
+
example: {
|
|
32
|
+
tips: [],
|
|
33
|
+
title:
|
|
34
|
+
"('2008-11-11 12:23','+8h','YYYY-MM-DD hh:mm') ,结果:2008-11-11 20:23",
|
|
35
|
+
},
|
|
36
|
+
groupsName: ['日期函数', '常用函数'],
|
|
37
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { FunctorDefine } from './types';
|
|
3
|
+
import { getGreenText } from './utils/tools';
|
|
4
|
+
|
|
5
|
+
export const DATENOW = FunctorDefine({
|
|
6
|
+
label: '返回当前时间',
|
|
7
|
+
type: 'DATENOW',
|
|
8
|
+
value: "DATENOW('YYYY-MM-DD')",
|
|
9
|
+
functor: (formatter?: string): Date | string => {
|
|
10
|
+
if (!formatter) {
|
|
11
|
+
return new Date();
|
|
12
|
+
}
|
|
13
|
+
return dayjs().format(formatter);
|
|
14
|
+
},
|
|
15
|
+
define: ['返回当前时间'],
|
|
16
|
+
description: {
|
|
17
|
+
tips: ['返回指定格式的当前时间,如果不传参数。将返回Date类型'],
|
|
18
|
+
title: '([格式])',
|
|
19
|
+
},
|
|
20
|
+
example: {
|
|
21
|
+
tips: [],
|
|
22
|
+
title: `('YYYY-MM-DD'),结果:'2022-07-24'; ${getGreenText(
|
|
23
|
+
'DATENOW',
|
|
24
|
+
)}(),结果: Thu Jul 14 2022 17:23:31 GMT+0800 (中国标准时间)`,
|
|
25
|
+
},
|
|
26
|
+
groupsName: ['日期函数', '常用函数'],
|
|
27
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
|
|
3
|
+
export const DATETIME = FunctorDefine({
|
|
4
|
+
label: '时间戳',
|
|
5
|
+
type: 'DATETIME',
|
|
6
|
+
value: 'DATETIME()',
|
|
7
|
+
functor() {
|
|
8
|
+
return new Date().getTime();
|
|
9
|
+
},
|
|
10
|
+
define: ['获取当前时间戳'],
|
|
11
|
+
description: {
|
|
12
|
+
tips: [],
|
|
13
|
+
title: '()',
|
|
14
|
+
},
|
|
15
|
+
example: {
|
|
16
|
+
tips: ['获取当前时间戳'],
|
|
17
|
+
title: '()',
|
|
18
|
+
},
|
|
19
|
+
groupsName: ['日期函数'],
|
|
20
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
|
|
3
|
+
export const IF = FunctorDefine({
|
|
4
|
+
label: '条件语句',
|
|
5
|
+
type: 'IF',
|
|
6
|
+
value: "IF(分数>=60,'及格','不及格')",
|
|
7
|
+
functor(condition: boolean, trueValue: any, falseValue: any): any {
|
|
8
|
+
return condition ? trueValue : falseValue;
|
|
9
|
+
},
|
|
10
|
+
define: ['设置判断条件,然后根据判断结果TRUE或FALSE来返回不同的文本'],
|
|
11
|
+
description: {
|
|
12
|
+
tips: ['· 无论表达式成立或不成立时,输出结果固定为文本类型'],
|
|
13
|
+
title: '(表达式,成立时输出,不成立时输出)',
|
|
14
|
+
},
|
|
15
|
+
example: {
|
|
16
|
+
tips: ['如果分数大于等于60分,则记为及格,否则记为不及格'],
|
|
17
|
+
title: "(分数>=60,'及格','不及格'),结果:'及格'",
|
|
18
|
+
},
|
|
19
|
+
groupsName: '常用函数',
|
|
20
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
|
|
3
|
+
export const INT = FunctorDefine({
|
|
4
|
+
label: '求整',
|
|
5
|
+
type: 'INT',
|
|
6
|
+
value: 'INT(-3.14159265)',
|
|
7
|
+
functor(x: number) {
|
|
8
|
+
if ([null, undefined, ''].includes(x as any)) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return Math.floor(x);
|
|
12
|
+
},
|
|
13
|
+
define: ['返回永远小于等于原数字的最接近的整数'],
|
|
14
|
+
description: {
|
|
15
|
+
tips: [],
|
|
16
|
+
title: '(数值)',
|
|
17
|
+
},
|
|
18
|
+
example: {
|
|
19
|
+
tips: ['对 -3.14159265 进行求整'],
|
|
20
|
+
title: '(-3.14159265),结果:-4',
|
|
21
|
+
},
|
|
22
|
+
groupsName: '数学函数',
|
|
23
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
import { includes } from './utils/tools';
|
|
3
|
+
|
|
4
|
+
export const LOG = FunctorDefine({
|
|
5
|
+
label: '计算以指定数字为底的对数',
|
|
6
|
+
type: 'LOG',
|
|
7
|
+
value: 'LOG(8,2)',
|
|
8
|
+
functor(x: number, base: number): number | undefined {
|
|
9
|
+
if (includes([x, base], ['', undefined, null])) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return Math.round(Math.log(x) / Math.log(base));
|
|
13
|
+
},
|
|
14
|
+
define: ['计算填入数值的对数,返回的是整数'],
|
|
15
|
+
description: {
|
|
16
|
+
tips: [],
|
|
17
|
+
title: '(真数, 底数)',
|
|
18
|
+
},
|
|
19
|
+
example: {
|
|
20
|
+
tips: ['计算以2为底8的对数'],
|
|
21
|
+
title: '(8,2),结果:3',
|
|
22
|
+
},
|
|
23
|
+
groupsName: '数学函数',
|
|
24
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
import { includes } from './utils/tools';
|
|
3
|
+
|
|
4
|
+
export const MAX = FunctorDefine({
|
|
5
|
+
label: '最大值',
|
|
6
|
+
type: 'MAX',
|
|
7
|
+
value: 'MAX(10,20,30)',
|
|
8
|
+
functor(...numbers: number[]): number | undefined {
|
|
9
|
+
if (includes(numbers, ['', undefined, null])) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return Math.max(...numbers);
|
|
13
|
+
},
|
|
14
|
+
define: ['返回一组数字中的最大值'],
|
|
15
|
+
description: {
|
|
16
|
+
tips: [],
|
|
17
|
+
title: '(数值1,数值2...)',
|
|
18
|
+
},
|
|
19
|
+
example: {
|
|
20
|
+
tips: ['返回10,20,30中最大的数字'],
|
|
21
|
+
title: '(10,20,30) ,结果:30',
|
|
22
|
+
},
|
|
23
|
+
groupsName: '数学函数',
|
|
24
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
import { includes } from './utils/tools';
|
|
3
|
+
|
|
4
|
+
export const MIN = FunctorDefine({
|
|
5
|
+
label: '最小值',
|
|
6
|
+
type: 'MIN',
|
|
7
|
+
value: 'MIN(10,20,30)',
|
|
8
|
+
functor(...numbers: number[]): number | undefined {
|
|
9
|
+
if (includes(numbers, ['', undefined, null])) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return Math.min(...numbers);
|
|
13
|
+
},
|
|
14
|
+
define: ['返回一组数字中的最小值'],
|
|
15
|
+
description: {
|
|
16
|
+
tips: [],
|
|
17
|
+
title: '(数值1,数值2...)',
|
|
18
|
+
},
|
|
19
|
+
example: {
|
|
20
|
+
tips: ['返回10,20,30中最小的数字'],
|
|
21
|
+
title: '(10,20,30) ,结果:10',
|
|
22
|
+
},
|
|
23
|
+
groupsName: '数学函数',
|
|
24
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
import { includes } from './utils/tools';
|
|
3
|
+
|
|
4
|
+
export const MOD = FunctorDefine({
|
|
5
|
+
label: '求余',
|
|
6
|
+
type: 'MOD',
|
|
7
|
+
value: 'MOD(15,4)',
|
|
8
|
+
functor(x: number, y: number): number | undefined {
|
|
9
|
+
if (includes([x, y], [undefined, null, ''])) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return Math.round(x) % Math.round(y);
|
|
13
|
+
},
|
|
14
|
+
define: ['返回两数相除的余数'],
|
|
15
|
+
description: {
|
|
16
|
+
tips: [],
|
|
17
|
+
title: '(被除数,除数)',
|
|
18
|
+
},
|
|
19
|
+
example: {
|
|
20
|
+
tips: ['计算 15 除以 4 的余数'],
|
|
21
|
+
title: '(15,4) ,结果:3',
|
|
22
|
+
},
|
|
23
|
+
groupsName: '数学函数',
|
|
24
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
import { getGreenText, includes } from './utils/tools';
|
|
3
|
+
|
|
4
|
+
export const NUMBER = FunctorDefine({
|
|
5
|
+
label: '强制转为数值',
|
|
6
|
+
type: 'NUMBER',
|
|
7
|
+
value: `NUMBER(${getGreenText('IF')}(${getGreenText('TRUE')}(),'-1','0'))`,
|
|
8
|
+
functor(x: number): number | undefined {
|
|
9
|
+
if (includes([x], ['', null, undefined])) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return Number(x);
|
|
13
|
+
},
|
|
14
|
+
define: ['将文本等类型的值转为数值'],
|
|
15
|
+
description: {
|
|
16
|
+
tips: [],
|
|
17
|
+
title: '(文本)',
|
|
18
|
+
},
|
|
19
|
+
example: {
|
|
20
|
+
tips: ["将 '-1' 和 5 相加(if输出的结果类型固定为文本)"],
|
|
21
|
+
title: `(${getGreenText('IF')}(${getGreenText(
|
|
22
|
+
'TRUE',
|
|
23
|
+
)}(),'-1','0'))+5,结果:4`,
|
|
24
|
+
},
|
|
25
|
+
groupsName: '数学函数',
|
|
26
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
|
|
3
|
+
export const OBJECTVALUE = FunctorDefine({
|
|
4
|
+
label: '获取对象字段值',
|
|
5
|
+
type: 'OBJECTVALUE',
|
|
6
|
+
value: "OBJECTVALUE({ a: { b: 1 } }, 'a', 'b')",
|
|
7
|
+
functor(obj: any, ...keys) {
|
|
8
|
+
return keys?.reduce((target, it) => target?.[it], obj);
|
|
9
|
+
},
|
|
10
|
+
define: ['获取对象对应的对象值'],
|
|
11
|
+
description: {
|
|
12
|
+
tips: [],
|
|
13
|
+
title: '(对象, key1, key2, ...)',
|
|
14
|
+
},
|
|
15
|
+
example: {
|
|
16
|
+
tips: ['获取 { a: { b: 1 } } b的值'],
|
|
17
|
+
title: "({ a: { b: 1 } }, 'a', 'b') ,结果:1",
|
|
18
|
+
},
|
|
19
|
+
groupsName: ['常用函数'],
|
|
20
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
import { includes } from './utils/tools';
|
|
3
|
+
|
|
4
|
+
export const POWER = FunctorDefine({
|
|
5
|
+
label: '计算数字的乘幂',
|
|
6
|
+
type: 'POWER',
|
|
7
|
+
value: 'POWER(2,3)',
|
|
8
|
+
functor(x: number, y: number): number | undefined {
|
|
9
|
+
if (includes([x, y], ['', undefined, null])) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return x ** y;
|
|
13
|
+
},
|
|
14
|
+
define: [],
|
|
15
|
+
description: {
|
|
16
|
+
tips: [],
|
|
17
|
+
title: '(底数,指数)',
|
|
18
|
+
},
|
|
19
|
+
example: {
|
|
20
|
+
tips: ['计算2的3次方'],
|
|
21
|
+
title: '(2,3),结果:8',
|
|
22
|
+
},
|
|
23
|
+
groupsName: '数学函数',
|
|
24
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
|
|
3
|
+
export const PRODUCT = FunctorDefine({
|
|
4
|
+
label: '乘积',
|
|
5
|
+
type: 'PRODUCT',
|
|
6
|
+
value: 'PRODUCT(15,4)',
|
|
7
|
+
functor(...numbers: number[]): number {
|
|
8
|
+
return numbers.reduce((a, b) => Number(a ?? 0) * Number(b ?? 0), 1);
|
|
9
|
+
},
|
|
10
|
+
define: ['返回两数相乘的积'],
|
|
11
|
+
description: {
|
|
12
|
+
tips: [],
|
|
13
|
+
title: '(数值1,数值2...)',
|
|
14
|
+
},
|
|
15
|
+
example: {
|
|
16
|
+
tips: ['计算 15 乘以 4 的积'],
|
|
17
|
+
title: '(15,4) ,结果:60',
|
|
18
|
+
},
|
|
19
|
+
groupsName: '数学函数',
|
|
20
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
|
|
3
|
+
export const RANDBETWEEN = FunctorDefine({
|
|
4
|
+
label: '返回随机数',
|
|
5
|
+
type: 'RANDBETWEEN',
|
|
6
|
+
value: 'RANDBETWEEN(1,10)',
|
|
7
|
+
functor(x: number, y: number) {
|
|
8
|
+
return Math.round(Math.random() * (y - x) + x);
|
|
9
|
+
},
|
|
10
|
+
define: [
|
|
11
|
+
'随机输出指定两个数字之间的一个整数;在新建记录时生成后,值将不再改变',
|
|
12
|
+
],
|
|
13
|
+
description: {
|
|
14
|
+
tips: [],
|
|
15
|
+
title: '(最小值,最大值)',
|
|
16
|
+
},
|
|
17
|
+
example: {
|
|
18
|
+
tips: ['随机输出1-10之间的一个数字'],
|
|
19
|
+
title: '(1,10) ,结果:7',
|
|
20
|
+
},
|
|
21
|
+
groupsName: '数学函数',
|
|
22
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
|
|
3
|
+
export const RANDOMNUM = FunctorDefine({
|
|
4
|
+
label: '根据位数生成随机数',
|
|
5
|
+
type: 'RANDOMNUM',
|
|
6
|
+
value: 'RANDOMNUM(6)',
|
|
7
|
+
functor(x: number) {
|
|
8
|
+
if ([null, undefined, ''].includes(x as any)) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
let randomNumStr = '';
|
|
12
|
+
let i = 0;
|
|
13
|
+
while (i < x) {
|
|
14
|
+
randomNumStr += String(Math.floor(Math.random() * 10));
|
|
15
|
+
// eslint-disable-next-line no-plusplus
|
|
16
|
+
i++;
|
|
17
|
+
}
|
|
18
|
+
return Number(randomNumStr);
|
|
19
|
+
},
|
|
20
|
+
define: ['根据位数生成随机数'],
|
|
21
|
+
description: {
|
|
22
|
+
tips: [],
|
|
23
|
+
title: '(位数)',
|
|
24
|
+
},
|
|
25
|
+
example: {
|
|
26
|
+
tips: ['随机生成6位随机数'],
|
|
27
|
+
title: '示例:=RANDOMNUM(6)',
|
|
28
|
+
},
|
|
29
|
+
groupsName: ['数学函数'],
|
|
30
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
import { includes } from './utils/tools';
|
|
3
|
+
|
|
4
|
+
export const ROUND = FunctorDefine({
|
|
5
|
+
label: '四舍五入',
|
|
6
|
+
type: 'ROUND',
|
|
7
|
+
value: 'ROUND(3.14159265,4)',
|
|
8
|
+
functor(x: number, digits: number): number | undefined {
|
|
9
|
+
if (includes([x, digits], [null, undefined, ''])) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return Math.round(x * 10 ** digits) / 10 ** digits;
|
|
13
|
+
},
|
|
14
|
+
define: ['按指定位数对数字进行四舍五入'],
|
|
15
|
+
description: {
|
|
16
|
+
tips: [],
|
|
17
|
+
title: '(数值,位数)',
|
|
18
|
+
},
|
|
19
|
+
example: {
|
|
20
|
+
tips: ['随机输出1-10之间的一个数字'],
|
|
21
|
+
title: '(3.14159265,4) ,结果:3.1416',
|
|
22
|
+
},
|
|
23
|
+
groupsName: '数学函数',
|
|
24
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
import { includes } from './utils/tools';
|
|
3
|
+
|
|
4
|
+
export const ROUNDDOWN = FunctorDefine({
|
|
5
|
+
label: '向下舍入',
|
|
6
|
+
type: 'ROUNDDOWN',
|
|
7
|
+
value: 'ROUNDDOWN(3.14159265,4)',
|
|
8
|
+
functor(x: number, digits: number) {
|
|
9
|
+
if (includes([x, digits], [null, undefined, ''])) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return Math.floor(x * 10 ** digits) / 10 ** digits;
|
|
13
|
+
},
|
|
14
|
+
define: ['以绝对值减小的方向按指定位数舍入数字'],
|
|
15
|
+
description: {
|
|
16
|
+
tips: [],
|
|
17
|
+
title: '(数值,位数)',
|
|
18
|
+
},
|
|
19
|
+
example: {
|
|
20
|
+
tips: ['保留 3.14159265 的四位小数'],
|
|
21
|
+
title: '(3.14159265,4) ,结果:3.1415',
|
|
22
|
+
},
|
|
23
|
+
groupsName: '数学函数',
|
|
24
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
import { includes } from './utils/tools';
|
|
3
|
+
|
|
4
|
+
export const ROUNDUP = FunctorDefine({
|
|
5
|
+
label: '向上舍入',
|
|
6
|
+
type: 'ROUNDUP',
|
|
7
|
+
value: 'ROUNDUP(3.14159265,4)',
|
|
8
|
+
functor(x: number, digits: number) {
|
|
9
|
+
if (includes([x, digits], [null, undefined, ''])) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
// eslint-disable-next-line no-mixed-operators
|
|
13
|
+
return Math.ceil(x * 10 ** digits) / 10 ** digits;
|
|
14
|
+
},
|
|
15
|
+
define: ['以绝对值增大的方向按指定位数舍入数字'],
|
|
16
|
+
description: {
|
|
17
|
+
tips: [],
|
|
18
|
+
title: '(数值,位数)',
|
|
19
|
+
},
|
|
20
|
+
example: {
|
|
21
|
+
tips: ['保留 3.14159265 的四位小数'],
|
|
22
|
+
title: '(3.14159265,4) ,结果:3.1416',
|
|
23
|
+
},
|
|
24
|
+
groupsName: '数学函数',
|
|
25
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
|
|
3
|
+
export const STRTOARRAY = FunctorDefine({
|
|
4
|
+
label: '字符串转数组',
|
|
5
|
+
type: 'STRTOARRAY',
|
|
6
|
+
value: "STRTOARRAY('a,b,c', ',')",
|
|
7
|
+
functor(s: string, sk: string) {
|
|
8
|
+
if (typeof s === 'string') {
|
|
9
|
+
return s.split(sk);
|
|
10
|
+
}
|
|
11
|
+
return undefined;
|
|
12
|
+
},
|
|
13
|
+
define: ['字符串根据字符转换成数组'],
|
|
14
|
+
description: {
|
|
15
|
+
tips: [],
|
|
16
|
+
title: '(字符串,分割字符)',
|
|
17
|
+
},
|
|
18
|
+
example: {
|
|
19
|
+
tips: ['字符串"a,b,c",以","分割为数组'],
|
|
20
|
+
title: '("a,b,c", ",") ,结果:["a","b","c"]',
|
|
21
|
+
},
|
|
22
|
+
groupsName: ['常用函数'],
|
|
23
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FunctorDefine } from './types';
|
|
2
|
+
|
|
3
|
+
export const SUM = FunctorDefine({
|
|
4
|
+
label: '求和',
|
|
5
|
+
type: 'SUM',
|
|
6
|
+
value: 'SUM(10,20,30)',
|
|
7
|
+
functor(...numbers: number[]): number {
|
|
8
|
+
return numbers.reduce((a, b) => Number(a ?? 0) + Number(b ?? 0), 0);
|
|
9
|
+
},
|
|
10
|
+
define: ['计算数字之和'],
|
|
11
|
+
description: {
|
|
12
|
+
tips: [],
|
|
13
|
+
title: '(数值1,数值2...)',
|
|
14
|
+
},
|
|
15
|
+
example: {
|
|
16
|
+
tips: ['计算10,20,30的和'],
|
|
17
|
+
title: '(10,20,30) ,结果:60',
|
|
18
|
+
},
|
|
19
|
+
groupsName: ['常用函数', '数学函数'],
|
|
20
|
+
});
|