@vtx/components 4.0.0-beta.6 → 4.0.0-beta.7
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/es/index.js +73 -0
- package/es/utils/columnSort.js +23 -0
- package/es/utils/components/DropdownFooter/index.js +53 -0
- package/es/utils/components/DropdownFooter/style.js +25 -0
- package/es/utils/components/ErrorBoundary/index.js +53 -0
- package/es/utils/components/FieldLabel/index.js +144 -0
- package/es/utils/components/FieldLabel/style.js +93 -0
- package/es/utils/components/FilterDropdown/index.js +62 -0
- package/es/utils/components/FilterDropdown/style.js +26 -0
- package/es/utils/components/InlineErrorFormItem/index.js +156 -0
- package/es/utils/components/InlineErrorFormItem/style.js +47 -0
- package/es/utils/components/LabelIconTip/index.js +68 -0
- package/es/utils/components/LabelIconTip/style.js +47 -0
- package/es/utils/components/ProFormContext/index.js +41 -0
- package/es/utils/conversionMomentValue/index.js +163 -0
- package/es/utils/dateArrayFormatter/index.js +36 -0
- package/es/utils/filterSpecialCharacters.js +82 -0
- package/es/utils/genColumnKey.js +6 -0
- package/es/utils/genCopyable/index.js +59 -0
- package/es/utils/getComponentProps.js +7 -0
- package/es/utils/getFieldPropsOrFormItemProps/index.js +16 -0
- package/es/utils/getPlaceholder.js +5 -0
- package/es/utils/getToken.js +6 -0
- package/es/utils/hooks/useDebounceFn/index.js +71 -0
- package/es/utils/hooks/useDebounceValue/index.js +40 -0
- package/es/utils/hooks/useDeepCompareEffect/index.js +24 -0
- package/es/utils/hooks/useDeepCompareMemo/index.js +15 -0
- package/es/utils/hooks/useDocumentTitle/index.js +10 -0
- package/es/utils/hooks/useFetchData/index.js +82 -0
- package/es/utils/hooks/useForceRender/index.js +18 -0
- package/es/utils/hooks/useLatest/index.js +10 -0
- package/es/utils/hooks/usePrevious/index.js +8 -0
- package/es/utils/hooks/useReactiveRef/index.js +7 -0
- package/es/utils/hooks/useRefCallback/index.js +26 -0
- package/es/utils/hooks/useRefFunction/index.js +13 -0
- package/es/utils/index.js +73 -0
- package/es/utils/isBrowser/index.d.ts +9 -0
- package/es/utils/isBrowser/index.js +16 -0
- package/es/utils/isDeepEqualReact/index.js +95 -0
- package/es/utils/isDropdownValueType/index.js +7 -0
- package/es/utils/isFunction.js +3 -0
- package/es/utils/isImg/index.js +4 -0
- package/es/utils/isNil/index.js +3 -0
- package/es/utils/isObject/index.js +3 -0
- package/es/utils/isObject.js +3 -0
- package/es/utils/isUrl/index.js +17 -0
- package/es/utils/merge/index.js +36 -0
- package/es/utils/nanoid/index.js +29 -0
- package/es/utils/omitBoolean/index.js +11 -0
- package/es/utils/omitUndefined/index.js +12 -0
- package/es/utils/omitUndefinedAndEmptyArr/index.js +14 -0
- package/es/utils/parseValueToMoment/index.js +28 -0
- package/es/utils/pickProFormItemProps/index.js +15 -0
- package/es/utils/pickProProps/index.js +15 -0
- package/es/utils/proFieldParsingText/index.js +161 -0
- package/es/utils/runFunction/index.js +10 -0
- package/es/utils/sortByGivenOrder.js +36 -0
- package/es/utils/sortByKeyArrayExtract.js +38 -0
- package/es/utils/stringify/index.js +10 -0
- package/es/utils/transformKeySubmitValue/index.js +330 -0
- package/es/utils/useColSize.js +20 -0
- package/es/utils/useEditableArray/index.js +906 -0
- package/es/utils/useEditableMap/index.js +214 -0
- package/es/utils/useInterval.js +12 -0
- package/es/utils/useMediaQuery/index.js +106 -0
- package/es/utils/useMediaQuery/query.js +30 -0
- package/es/utils/useMountMergeState/index.js +2 -0
- package/es/utils/useSet.js +38 -0
- package/es/version.js +3 -0
- package/es/vtx-color-picker/index.js +70 -0
- package/es/vtx-color-picker/style/index.js +30 -0
- package/es/vtx-combogrid/Combogrid.js +247 -0
- package/es/vtx-combogrid/index.js +121 -0
- package/es/vtx-combogrid/style/index.js +42 -0
- package/es/vtx-datagrid/Alert/index.js +49 -0
- package/es/vtx-datagrid/Alert/style.js +44 -0
- package/es/vtx-datagrid/Store/Provide.js +441 -0
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +526 -0
- package/es/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +86 -0
- package/es/vtx-datagrid/ToolBar/components/Density/index.js +48 -0
- package/es/vtx-datagrid/ToolBar/components/Fullscreen/index.js +77 -0
- package/es/vtx-datagrid/ToolBar/components/TableStyle/index.js +71 -0
- package/es/vtx-datagrid/ToolBar/index.js +88 -0
- package/es/vtx-datagrid/ToolBar/style.js +59 -0
- package/es/vtx-datagrid/index.js +362 -0
- package/es/vtx-datagrid/renderColumnButtons.js +98 -0
- package/es/vtx-datagrid/style/index.js +80 -0
- package/es/vtx-datagrid/style/index.less +242 -0
- package/es/vtx-date-picker/QdatePicker.js +152 -0
- package/es/vtx-date-picker/generatePicker.js +104 -0
- package/es/vtx-date-picker/index.js +49 -0
- package/es/vtx-date-picker/style/index.js +39 -0
- package/es/vtx-date-picker/style/index.less +39 -0
- package/es/vtx-ellipsis-text/index.js +52 -0
- package/es/vtx-ellipsis-text/style/index.js +29 -0
- package/es/vtx-export/index.js +197 -0
- package/es/vtx-export/style/index.js +24 -0
- package/es/vtx-export-async/ColumnsSelect.js +63 -0
- package/es/vtx-export-async/History.js +256 -0
- package/es/vtx-export-async/index.js +402 -0
- package/es/vtx-export-async/style/index.js +49 -0
- package/es/vtx-export-async/util.js +51 -0
- package/es/vtx-form-layout/Card.js +74 -0
- package/es/vtx-form-layout/Divider.js +22 -0
- package/es/vtx-form-layout/FormItem.js +135 -0
- package/es/vtx-form-layout/Pane.js +41 -0
- package/es/vtx-form-layout/Row.js +19 -0
- package/es/vtx-form-layout/context.js +2 -0
- package/es/vtx-form-layout/index.js +80 -0
- package/es/vtx-form-layout/style/index.js +261 -0
- package/es/vtx-icon/index.js +78 -0
- package/es/vtx-icon/svg/alignRightOutlined.js +29 -0
- package/es/vtx-icon/svg/columnHeightOutlined.js +25 -0
- package/es/vtx-icon/svg/downOutlined.js +24 -0
- package/es/vtx-icon/svg/fullscreen.js +25 -0
- package/es/vtx-icon/svg/redoOutlined.js +29 -0
- package/es/vtx-icon/svg/rightOutlined.js +24 -0
- package/es/vtx-icon/svg/settingOutlined.js +29 -0
- package/es/vtx-image/Image.js +257 -0
- package/es/vtx-image/Preview.js +140 -0
- package/es/vtx-image/PreviewGroup.js +81 -0
- package/es/vtx-image/index.js +4 -0
- package/es/vtx-image/style/index.js +91 -0
- package/es/vtx-import/index.js +416 -0
- package/es/vtx-import/result.js +81 -0
- package/es/vtx-import/style/index.js +19 -0
- package/es/vtx-import2/CheckResult.js +45 -0
- package/es/vtx-import2/Content.js +103 -0
- package/es/vtx-import2/DownloadSvg.js +41 -0
- package/es/vtx-import2/ImportResult.js +57 -0
- package/es/vtx-import2/UploadSvg.js +41 -0
- package/es/vtx-import2/index.js +453 -0
- package/es/vtx-import2/style/index.js +99 -0
- package/es/vtx-input/TextArea/index.js +61 -0
- package/es/vtx-input/TextArea/style.js +30 -0
- package/es/vtx-input/index.js +92 -0
- package/es/vtx-input/style/index.js +24 -0
- package/es/vtx-input/useLength.js +21 -0
- package/es/vtx-modal/Title.js +34 -0
- package/es/vtx-modal/index.js +243 -0
- package/es/vtx-modal/style/index.js +109 -0
- package/es/vtx-page-layout/Basic.js +28 -0
- package/es/vtx-page-layout/Content.js +43 -0
- package/es/vtx-page-layout/Pane.js +40 -0
- package/es/vtx-page-layout/TabLayout.js +65 -0
- package/es/vtx-page-layout/TableLayout.js +163 -0
- package/es/vtx-page-layout/TableWrap.js +36 -0
- package/es/vtx-page-layout/TreeLayout.js +79 -0
- package/es/vtx-page-layout/container.js +68 -0
- package/es/vtx-page-layout/index.js +26 -0
- package/es/vtx-page-layout/style/index.js +129 -0
- package/es/vtx-provider/index.js +315 -0
- package/es/vtx-provider/intl.js +140 -0
- package/es/vtx-provider/locale/ar_EG.js +71 -0
- package/es/vtx-provider/locale/ca_ES.js +71 -0
- package/es/vtx-provider/locale/cs_CZ.js +74 -0
- package/es/vtx-provider/locale/de_DE.js +71 -0
- package/es/vtx-provider/locale/en_GB.js +73 -0
- package/es/vtx-provider/locale/en_US.js +181 -0
- package/es/vtx-provider/locale/es_ES.js +71 -0
- package/es/vtx-provider/locale/fa_IR.js +71 -0
- package/es/vtx-provider/locale/fr_FR.js +71 -0
- package/es/vtx-provider/locale/he_IL.js +74 -0
- package/es/vtx-provider/locale/hr_HR.js +71 -0
- package/es/vtx-provider/locale/id_ID.js +71 -0
- package/es/vtx-provider/locale/it_IT.js +71 -0
- package/es/vtx-provider/locale/ja_JP.js +71 -0
- package/es/vtx-provider/locale/ko_KR.js +71 -0
- package/es/vtx-provider/locale/mn_MN.js +71 -0
- package/es/vtx-provider/locale/ms_MY.js +71 -0
- package/es/vtx-provider/locale/nl_NL.js +74 -0
- package/es/vtx-provider/locale/pl_PL.js +71 -0
- package/es/vtx-provider/locale/pt_BR.js +71 -0
- package/es/vtx-provider/locale/ro_RO.js +74 -0
- package/es/vtx-provider/locale/ru_RU.js +71 -0
- package/es/vtx-provider/locale/sk_SK.js +74 -0
- package/es/vtx-provider/locale/sr_RS.js +71 -0
- package/es/vtx-provider/locale/sv_SE.js +74 -0
- package/es/vtx-provider/locale/th_TH.js +74 -0
- package/es/vtx-provider/locale/tr_TR.js +71 -0
- package/es/vtx-provider/locale/uk_UA.js +74 -0
- package/es/vtx-provider/locale/uz_UZ.js +71 -0
- package/es/vtx-provider/locale/vi_VN.js +71 -0
- package/es/vtx-provider/locale/zh_CN.js +183 -0
- package/es/vtx-provider/locale/zh_HK.js +83 -0
- package/es/vtx-provider/locale/zh_TW.js +74 -0
- package/es/vtx-provider/typing/layoutToken.js +60 -0
- package/es/vtx-provider/useStyle/index.js +106 -0
- package/es/vtx-provider/utils/merge.js +27 -0
- package/es/vtx-rps-frame/index.js +164 -0
- package/es/vtx-rps-frame/style/index.js +26 -0
- package/es/vtx-scrollable-row/index.js +183 -0
- package/es/vtx-scrollable-row/style/index.js +108 -0
- package/es/vtx-search/index.js +350 -0
- package/es/vtx-search/style/index.js +94 -0
- package/es/vtx-select/index.js +252 -0
- package/es/vtx-select/style/index.js +75 -0
- package/es/vtx-signature/index.js +119 -0
- package/es/vtx-signature/style/index.js +47 -0
- package/es/vtx-split-pane/Resizer.js +47 -0
- package/es/vtx-split-pane/SplitPane.js +60 -0
- package/es/vtx-split-pane/index.js +3 -0
- package/es/vtx-split-pane/style/index.js +133 -0
- package/es/vtx-statistics-column/Back.js +27 -0
- package/es/vtx-statistics-column/Item.js +54 -0
- package/es/vtx-statistics-column/Total.js +54 -0
- package/es/vtx-statistics-column/context.js +2 -0
- package/es/vtx-statistics-column/index.js +54 -0
- package/es/vtx-statistics-column/style/index.js +72 -0
- package/es/vtx-time-picker/index.js +37 -0
- package/es/vtx-time-picker/style/index.js +0 -0
- package/es/vtx-tree/index.js +341 -0
- package/es/vtx-tree/style/index.js +50 -0
- package/es/vtx-tree/utils.js +73 -0
- package/es/vtx-tree-select/index.js +290 -0
- package/es/vtx-tree-select/style/index.js +72 -0
- package/es/vtx-upload/FilePreview.js +111 -0
- package/es/vtx-upload/index.js +468 -0
- package/es/vtx-upload/style/index.js +83 -0
- package/es/vtx-wang-editor/index.js +245 -0
- package/es/vtx-wang-editor/style/index.js +33 -0
- package/es/vtx-wang-editor/style/index.less +12 -0
- package/es/vtx-wang-editor/wangEditorUtil.js +226 -0
- package/lib/index.js +363 -0
- package/lib/utils/columnSort.js +29 -0
- package/lib/utils/components/DropdownFooter/index.js +62 -0
- package/lib/utils/components/DropdownFooter/style.js +31 -0
- package/lib/utils/components/ErrorBoundary/index.js +59 -0
- package/lib/utils/components/FieldLabel/index.js +152 -0
- package/lib/utils/components/FieldLabel/style.js +99 -0
- package/lib/utils/components/FilterDropdown/index.js +70 -0
- package/lib/utils/components/FilterDropdown/style.js +32 -0
- package/lib/utils/components/InlineErrorFormItem/index.js +162 -0
- package/lib/utils/components/InlineErrorFormItem/style.js +53 -0
- package/lib/utils/components/LabelIconTip/index.js +73 -0
- package/lib/utils/components/LabelIconTip/style.js +53 -0
- package/lib/utils/components/ProFormContext/index.js +48 -0
- package/lib/utils/conversionMomentValue/index.js +170 -0
- package/lib/utils/dateArrayFormatter/index.js +43 -0
- package/lib/utils/filterSpecialCharacters.js +89 -0
- package/lib/utils/genColumnKey.js +12 -0
- package/lib/utils/genCopyable/index.js +66 -0
- package/lib/utils/getComponentProps.js +13 -0
- package/lib/utils/getFieldPropsOrFormItemProps/index.js +21 -0
- package/lib/utils/getPlaceholder.js +11 -0
- package/lib/utils/getToken.js +12 -0
- package/lib/utils/hooks/useDebounceFn/index.js +77 -0
- package/lib/utils/hooks/useDebounceValue/index.js +45 -0
- package/lib/utils/hooks/useDeepCompareEffect/index.js +33 -0
- package/lib/utils/hooks/useDeepCompareMemo/index.js +21 -0
- package/lib/utils/hooks/useDocumentTitle/index.js +16 -0
- package/lib/utils/hooks/useFetchData/index.js +89 -0
- package/lib/utils/hooks/useForceRender/index.js +24 -0
- package/lib/utils/hooks/useLatest/index.js +15 -0
- package/lib/utils/hooks/usePrevious/index.js +14 -0
- package/lib/utils/hooks/useReactiveRef/index.js +14 -0
- package/lib/utils/hooks/useRefCallback/index.js +31 -0
- package/lib/utils/hooks/useRefFunction/index.js +18 -0
- package/lib/utils/index.js +436 -0
- package/lib/utils/isBrowser/index.d.ts +9 -0
- package/lib/utils/isBrowser/index.js +22 -0
- package/lib/utils/isDeepEqualReact/index.js +101 -0
- package/lib/utils/isDropdownValueType/index.js +13 -0
- package/lib/utils/isFunction.js +9 -0
- package/lib/utils/isImg/index.js +10 -0
- package/lib/utils/isNil/index.js +9 -0
- package/lib/utils/isObject/index.js +9 -0
- package/lib/utils/isObject.js +9 -0
- package/lib/utils/isUrl/index.js +23 -0
- package/lib/utils/merge/index.js +41 -0
- package/lib/utils/nanoid/index.js +35 -0
- package/lib/utils/omitBoolean/index.js +17 -0
- package/lib/utils/omitUndefined/index.js +18 -0
- package/lib/utils/omitUndefinedAndEmptyArr/index.js +20 -0
- package/lib/utils/parseValueToMoment/index.js +35 -0
- package/lib/utils/pickProFormItemProps/index.js +21 -0
- package/lib/utils/pickProProps/index.js +21 -0
- package/lib/utils/proFieldParsingText/index.js +166 -0
- package/lib/utils/runFunction/index.js +16 -0
- package/lib/utils/sortByGivenOrder.js +42 -0
- package/lib/utils/sortByKeyArrayExtract.js +44 -0
- package/lib/utils/stringify/index.js +21 -0
- package/lib/utils/transformKeySubmitValue/index.js +337 -0
- package/lib/utils/useColSize.js +26 -0
- package/lib/utils/useEditableArray/index.js +918 -0
- package/lib/utils/useEditableMap/index.js +219 -0
- package/lib/utils/useInterval.js +18 -0
- package/lib/utils/useMediaQuery/index.js +112 -0
- package/lib/utils/useMediaQuery/query.js +36 -0
- package/lib/utils/useMountMergeState/index.js +12 -0
- package/lib/utils/useSet.js +43 -0
- package/lib/version.js +9 -0
- package/lib/vtx-color-picker/index.js +77 -0
- package/lib/vtx-color-picker/style/index.js +36 -0
- package/lib/vtx-combogrid/Combogrid.js +255 -0
- package/lib/vtx-combogrid/index.js +129 -0
- package/lib/vtx-combogrid/style/index.js +48 -0
- package/lib/vtx-datagrid/Alert/index.js +57 -0
- package/lib/vtx-datagrid/Alert/style.js +50 -0
- package/lib/vtx-datagrid/Store/Provide.js +446 -0
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/index.js +531 -0
- package/lib/vtx-datagrid/ToolBar/components/ColumnSetting/style.js +92 -0
- package/lib/vtx-datagrid/ToolBar/components/Density/index.js +54 -0
- package/lib/vtx-datagrid/ToolBar/components/Fullscreen/index.js +83 -0
- package/lib/vtx-datagrid/ToolBar/components/TableStyle/index.js +77 -0
- package/lib/vtx-datagrid/ToolBar/index.js +96 -0
- package/lib/vtx-datagrid/ToolBar/style.js +65 -0
- package/lib/vtx-datagrid/index.js +370 -0
- package/lib/vtx-datagrid/renderColumnButtons.js +104 -0
- package/lib/vtx-datagrid/style/index.js +86 -0
- package/lib/vtx-datagrid/style/index.less +242 -0
- package/lib/vtx-date-picker/QdatePicker.js +157 -0
- package/lib/vtx-date-picker/generatePicker.js +111 -0
- package/lib/vtx-date-picker/index.js +55 -0
- package/lib/vtx-date-picker/style/index.js +45 -0
- package/lib/vtx-date-picker/style/index.less +39 -0
- package/lib/vtx-ellipsis-text/index.js +60 -0
- package/lib/vtx-ellipsis-text/style/index.js +35 -0
- package/lib/vtx-export/index.js +203 -0
- package/lib/vtx-export/style/index.js +30 -0
- package/lib/vtx-export-async/ColumnsSelect.js +69 -0
- package/lib/vtx-export-async/History.js +264 -0
- package/lib/vtx-export-async/index.js +409 -0
- package/lib/vtx-export-async/style/index.js +55 -0
- package/lib/vtx-export-async/util.js +57 -0
- package/lib/vtx-form-layout/Card.js +83 -0
- package/lib/vtx-form-layout/Divider.js +31 -0
- package/lib/vtx-form-layout/FormItem.js +141 -0
- package/lib/vtx-form-layout/Pane.js +50 -0
- package/lib/vtx-form-layout/Row.js +26 -0
- package/lib/vtx-form-layout/context.js +8 -0
- package/lib/vtx-form-layout/index.js +89 -0
- package/lib/vtx-form-layout/style/index.js +267 -0
- package/lib/vtx-icon/index.js +90 -0
- package/lib/vtx-icon/svg/alignRightOutlined.js +34 -0
- package/lib/vtx-icon/svg/columnHeightOutlined.js +31 -0
- package/lib/vtx-icon/svg/downOutlined.js +30 -0
- package/lib/vtx-icon/svg/fullscreen.js +31 -0
- package/lib/vtx-icon/svg/redoOutlined.js +34 -0
- package/lib/vtx-icon/svg/rightOutlined.js +30 -0
- package/lib/vtx-icon/svg/settingOutlined.js +34 -0
- package/lib/vtx-image/Image.js +264 -0
- package/lib/vtx-image/Preview.js +146 -0
- package/lib/vtx-image/PreviewGroup.js +91 -0
- package/lib/vtx-image/index.js +31 -0
- package/lib/vtx-image/style/index.js +97 -0
- package/lib/vtx-import/index.js +424 -0
- package/lib/vtx-import/result.js +88 -0
- package/lib/vtx-import/style/index.js +25 -0
- package/lib/vtx-import2/CheckResult.js +50 -0
- package/lib/vtx-import2/Content.js +112 -0
- package/lib/vtx-import2/DownloadSvg.js +47 -0
- package/lib/vtx-import2/ImportResult.js +62 -0
- package/lib/vtx-import2/UploadSvg.js +47 -0
- package/lib/vtx-import2/index.js +458 -0
- package/lib/vtx-import2/style/index.js +105 -0
- package/lib/vtx-input/TextArea/index.js +70 -0
- package/lib/vtx-input/TextArea/style.js +36 -0
- package/lib/vtx-input/index.js +100 -0
- package/lib/vtx-input/style/index.js +30 -0
- package/lib/vtx-input/useLength.js +27 -0
- package/lib/vtx-modal/Title.js +42 -0
- package/lib/vtx-modal/index.js +249 -0
- package/lib/vtx-modal/style/index.js +115 -0
- package/lib/vtx-page-layout/Basic.js +36 -0
- package/lib/vtx-page-layout/Content.js +50 -0
- package/lib/vtx-page-layout/Pane.js +47 -0
- package/lib/vtx-page-layout/TabLayout.js +70 -0
- package/lib/vtx-page-layout/TableLayout.js +172 -0
- package/lib/vtx-page-layout/TableWrap.js +43 -0
- package/lib/vtx-page-layout/TreeLayout.js +84 -0
- package/lib/vtx-page-layout/container.js +74 -0
- package/lib/vtx-page-layout/index.js +32 -0
- package/lib/vtx-page-layout/style/index.js +136 -0
- package/lib/vtx-provider/index.js +351 -0
- package/lib/vtx-provider/intl.js +145 -0
- package/lib/vtx-provider/locale/ar_EG.js +77 -0
- package/lib/vtx-provider/locale/ca_ES.js +77 -0
- package/lib/vtx-provider/locale/cs_CZ.js +80 -0
- package/lib/vtx-provider/locale/de_DE.js +77 -0
- package/lib/vtx-provider/locale/en_GB.js +79 -0
- package/lib/vtx-provider/locale/en_US.js +187 -0
- package/lib/vtx-provider/locale/es_ES.js +77 -0
- package/lib/vtx-provider/locale/fa_IR.js +77 -0
- package/lib/vtx-provider/locale/fr_FR.js +77 -0
- package/lib/vtx-provider/locale/he_IL.js +80 -0
- package/lib/vtx-provider/locale/hr_HR.js +77 -0
- package/lib/vtx-provider/locale/id_ID.js +77 -0
- package/lib/vtx-provider/locale/it_IT.js +77 -0
- package/lib/vtx-provider/locale/ja_JP.js +77 -0
- package/lib/vtx-provider/locale/ko_KR.js +77 -0
- package/lib/vtx-provider/locale/mn_MN.js +77 -0
- package/lib/vtx-provider/locale/ms_MY.js +77 -0
- package/lib/vtx-provider/locale/nl_NL.js +80 -0
- package/lib/vtx-provider/locale/pl_PL.js +77 -0
- package/lib/vtx-provider/locale/pt_BR.js +77 -0
- package/lib/vtx-provider/locale/ro_RO.js +80 -0
- package/lib/vtx-provider/locale/ru_RU.js +77 -0
- package/lib/vtx-provider/locale/sk_SK.js +80 -0
- package/lib/vtx-provider/locale/sr_RS.js +77 -0
- package/lib/vtx-provider/locale/sv_SE.js +80 -0
- package/lib/vtx-provider/locale/th_TH.js +80 -0
- package/lib/vtx-provider/locale/tr_TR.js +77 -0
- package/lib/vtx-provider/locale/uk_UA.js +80 -0
- package/lib/vtx-provider/locale/uz_UZ.js +77 -0
- package/lib/vtx-provider/locale/vi_VN.js +77 -0
- package/lib/vtx-provider/locale/zh_CN.js +189 -0
- package/lib/vtx-provider/locale/zh_HK.js +89 -0
- package/lib/vtx-provider/locale/zh_TW.js +80 -0
- package/lib/vtx-provider/typing/layoutToken.js +66 -0
- package/lib/vtx-provider/useStyle/index.js +112 -0
- package/lib/vtx-provider/utils/merge.js +33 -0
- package/lib/vtx-rps-frame/index.js +173 -0
- package/lib/vtx-rps-frame/style/index.js +32 -0
- package/lib/vtx-scrollable-row/index.js +193 -0
- package/lib/vtx-scrollable-row/style/index.js +114 -0
- package/lib/vtx-search/index.js +355 -0
- package/lib/vtx-search/style/index.js +101 -0
- package/lib/vtx-select/index.js +259 -0
- package/lib/vtx-select/style/index.js +81 -0
- package/lib/vtx-signature/index.js +127 -0
- package/lib/vtx-signature/style/index.js +53 -0
- package/lib/vtx-split-pane/Resizer.js +52 -0
- package/lib/vtx-split-pane/SplitPane.js +68 -0
- package/lib/vtx-split-pane/index.js +15 -0
- package/lib/vtx-split-pane/style/index.js +139 -0
- package/lib/vtx-statistics-column/Back.js +36 -0
- package/lib/vtx-statistics-column/Item.js +62 -0
- package/lib/vtx-statistics-column/Total.js +62 -0
- package/lib/vtx-statistics-column/context.js +8 -0
- package/lib/vtx-statistics-column/index.js +63 -0
- package/lib/vtx-statistics-column/style/index.js +78 -0
- package/lib/vtx-time-picker/index.js +45 -0
- package/lib/vtx-time-picker/style/index.js +1 -0
- package/lib/vtx-tree/index.js +348 -0
- package/lib/vtx-tree/style/index.js +56 -0
- package/lib/vtx-tree/utils.js +80 -0
- package/lib/vtx-tree-select/index.js +296 -0
- package/lib/vtx-tree-select/style/index.js +78 -0
- package/lib/vtx-upload/FilePreview.js +116 -0
- package/lib/vtx-upload/index.js +474 -0
- package/lib/vtx-upload/style/index.js +89 -0
- package/lib/vtx-wang-editor/index.js +251 -0
- package/lib/vtx-wang-editor/style/index.js +39 -0
- package/lib/vtx-wang-editor/style/index.less +12 -0
- package/lib/vtx-wang-editor/wangEditorUtil.js +236 -0
- package/package.json +1 -2
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["value", "onChange", "downloadUrl", "uploadUrl", "placeholder", "maxFileSize", "maxNumberOfFiles", "height", "status"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
10
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
18
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
|
+
/*eslint-disable*/
|
|
20
|
+
import React, { forwardRef, useState, useEffect, useContext } from 'react';
|
|
21
|
+
import PropTypes from 'prop-types';
|
|
22
|
+
import { Editor, Toolbar } from '@wangeditor/editor-for-react';
|
|
23
|
+
import attachmentModule from '@wangeditor/plugin-upload-attachment';
|
|
24
|
+
import { Boot } from '@wangeditor/editor';
|
|
25
|
+
import { withEmptyHtml, findAllImgSrcsFromHtml, extractImageDataFromRtf, replaceImagesFileSourceWithInlineRepresentation, replaceAllSpanFontSize } from "./wangEditorUtil";
|
|
26
|
+
import { ConfigProvider } from 'antd';
|
|
27
|
+
import cls from 'classnames';
|
|
28
|
+
import { useStyle } from "./style/index";
|
|
29
|
+
import { FormItemInputContext } from 'antd/es/form/context';
|
|
30
|
+
import { getMergedStatus, getStatusClassNames } from 'antd/es/_util/statusUtils';
|
|
31
|
+
import { VtxProvider, useIntl } from "../vtx-provider";
|
|
32
|
+
|
|
33
|
+
// 注册插件 处理附件
|
|
34
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
35
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
36
|
+
Boot.registerModule(attachmentModule);
|
|
37
|
+
// 注册插件 处理为空的时候
|
|
38
|
+
Boot.registerPlugin(withEmptyHtml);
|
|
39
|
+
var VtxWangEditor = function VtxWangEditor(props) {
|
|
40
|
+
var intl = useIntl();
|
|
41
|
+
var _useContext = useContext(VtxProvider),
|
|
42
|
+
getPrefixCls = _useContext.getPrefixCls;
|
|
43
|
+
var prefixCls = getPrefixCls('wang-editor', props.prefixCls);
|
|
44
|
+
var _useStyle = useStyle(prefixCls),
|
|
45
|
+
wrapSSR = _useStyle.wrapSSR,
|
|
46
|
+
hashId = _useStyle.hashId;
|
|
47
|
+
var _React$useContext = React.useContext(FormItemInputContext),
|
|
48
|
+
contextStatus = _React$useContext.status,
|
|
49
|
+
hasFeedback = _React$useContext.hasFeedback,
|
|
50
|
+
isFormItemInput = _React$useContext.isFormItemInput,
|
|
51
|
+
feedbackIcon = _React$useContext.feedbackIcon;
|
|
52
|
+
var value = props.value,
|
|
53
|
+
_onChange = props.onChange,
|
|
54
|
+
_props$downloadUrl = props.downloadUrl,
|
|
55
|
+
downloadUrl = _props$downloadUrl === void 0 ? '/cloudFile/common/downloadFile?id=' : _props$downloadUrl,
|
|
56
|
+
_props$uploadUrl = props.uploadUrl,
|
|
57
|
+
uploadUrl = _props$uploadUrl === void 0 ? '/cloudFile/common/uploadFile' : _props$uploadUrl,
|
|
58
|
+
_props$placeholder = props.placeholder,
|
|
59
|
+
placeholder = _props$placeholder === void 0 ? '' : _props$placeholder,
|
|
60
|
+
_props$maxFileSize = props.maxFileSize,
|
|
61
|
+
maxFileSize = _props$maxFileSize === void 0 ? 5 * 1024 * 1024 : _props$maxFileSize,
|
|
62
|
+
_props$maxNumberOfFil = props.maxNumberOfFiles,
|
|
63
|
+
maxNumberOfFiles = _props$maxNumberOfFil === void 0 ? 5 : _props$maxNumberOfFil,
|
|
64
|
+
_props$height = props.height,
|
|
65
|
+
height = _props$height === void 0 ? 350 : _props$height,
|
|
66
|
+
customStatus = props.status,
|
|
67
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
68
|
+
var mergedStatus = getMergedStatus(contextStatus, customStatus);
|
|
69
|
+
var _useState = useState(null),
|
|
70
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
71
|
+
editor = _useState2[0],
|
|
72
|
+
setEditor = _useState2[1];
|
|
73
|
+
|
|
74
|
+
// 及时销毁 editor ,重要!
|
|
75
|
+
useEffect(function () {
|
|
76
|
+
return function () {
|
|
77
|
+
if (editor) {
|
|
78
|
+
editor.destroy();
|
|
79
|
+
setEditor(null);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}, []);
|
|
83
|
+
// 编辑器配置
|
|
84
|
+
var editorConfig = {
|
|
85
|
+
MENU_CONF: {
|
|
86
|
+
// 插入图片
|
|
87
|
+
uploadImage: {
|
|
88
|
+
server: uploadUrl,
|
|
89
|
+
maxFileSize: maxFileSize,
|
|
90
|
+
maxNumberOfFiles: maxNumberOfFiles,
|
|
91
|
+
// onSuccess(file, res) {},
|
|
92
|
+
customInsert: function customInsert(res, insertFn) {
|
|
93
|
+
console.log(res, insertFn);
|
|
94
|
+
// res 即服务端的返回结果
|
|
95
|
+
// 从 res 中找到 url alt href ,然后插入图片
|
|
96
|
+
if (res.result == 0) {
|
|
97
|
+
res.data.map(function (item) {
|
|
98
|
+
insertFn("".concat(downloadUrl).concat(item.id), item.fileName);
|
|
99
|
+
});
|
|
100
|
+
} else {
|
|
101
|
+
console.log(111);
|
|
102
|
+
throw new Error(intl.getMessage('wangEditor.imageInsertionFailed', '插入图片失败'));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
// 插入视频
|
|
107
|
+
uploadVideo: {
|
|
108
|
+
server: uploadUrl,
|
|
109
|
+
// onSuccess(file, res) {},
|
|
110
|
+
// 上传成功后,用户自定义插入文件
|
|
111
|
+
customInsert: function customInsert(res, insertFn) {
|
|
112
|
+
if (res.result == 0) {
|
|
113
|
+
res.data.map(function (item) {
|
|
114
|
+
insertFn("".concat(downloadUrl).concat(item.id), item.fileName);
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
throw new Error(intl.getMessage('wangEditor.videoInsertionFailed', '插入视频失败'));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
// 插入附件
|
|
122
|
+
uploadAttachment: {
|
|
123
|
+
server: uploadUrl,
|
|
124
|
+
// onSuccess(file, res) {},
|
|
125
|
+
// 上传成功后,用户自定义插入文件
|
|
126
|
+
customInsert: function customInsert(res, file, insertFn) {
|
|
127
|
+
if (res.result == 0) {
|
|
128
|
+
res.data.map(function (item) {
|
|
129
|
+
insertFn(item.fileName, "".concat(downloadUrl).concat(item.id));
|
|
130
|
+
});
|
|
131
|
+
} else {
|
|
132
|
+
throw new Error(intl.getMessage('wangEditor.attachmentInsertionFailed', '插入附件失败'));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
placeholder: placeholder,
|
|
138
|
+
// 在编辑器中,点击选中“附件”节点时,要弹出的菜单
|
|
139
|
+
hoverbarKeys: {
|
|
140
|
+
attachment: {
|
|
141
|
+
menuKeys: ['downloadAttachment'] // “下载附件”菜单
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
customPaste: function () {
|
|
145
|
+
var _customPaste = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(editor, event) {
|
|
146
|
+
var html, rtf, imgSrcs, rtfImageData;
|
|
147
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
148
|
+
while (1) switch (_context.prev = _context.next) {
|
|
149
|
+
case 0:
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
// 获取粘贴的html部分(??没错粘贴word时候,一部分内容就是html),该部分包含了图片img标签
|
|
152
|
+
html = event.clipboardData.getData('text/html'); // 获取rtf数据(从word、wps复制粘贴时有),复制粘贴过程中图片的数据就保存在rtf中
|
|
153
|
+
rtf = event.clipboardData.getData('text/rtf'); // 该条件分支即表示要自定义word粘贴
|
|
154
|
+
if (!(html && rtf)) {
|
|
155
|
+
_context.next = 17;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
// 列表缩进会超出边框,直接过滤掉
|
|
159
|
+
html = html.replace(/text\-indent:\-(.*?)pt/gi, '');
|
|
160
|
+
|
|
161
|
+
// 从html内容中查找粘贴内容中是否有图片元素,并返回img标签的属性src值的集合
|
|
162
|
+
imgSrcs = findAllImgSrcsFromHtml(html);
|
|
163
|
+
html = replaceAllSpanFontSize(html);
|
|
164
|
+
|
|
165
|
+
// 如果有图片
|
|
166
|
+
if (!(imgSrcs && Array.isArray(imgSrcs) && imgSrcs.length)) {
|
|
167
|
+
_context.next = 13;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
// 从rtf内容中查找图片数据
|
|
171
|
+
// 从rtf内容中查找图片数据
|
|
172
|
+
rtfImageData = extractImageDataFromRtf(rtf);
|
|
173
|
+
if (!rtfImageData.length) {
|
|
174
|
+
_context.next = 13;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
_context.next = 12;
|
|
178
|
+
return replaceImagesFileSourceWithInlineRepresentation(html, imgSrcs, rtfImageData, true, uploadUrl, downloadUrl);
|
|
179
|
+
case 12:
|
|
180
|
+
html = _context.sent;
|
|
181
|
+
case 13:
|
|
182
|
+
editor.dangerouslyInsertHtml(html);
|
|
183
|
+
return _context.abrupt("return", false);
|
|
184
|
+
case 17:
|
|
185
|
+
if (!html) {
|
|
186
|
+
_context.next = 20;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
editor.dangerouslyInsertHtml(html);
|
|
190
|
+
return _context.abrupt("return", false);
|
|
191
|
+
case 20:
|
|
192
|
+
case "end":
|
|
193
|
+
return _context.stop();
|
|
194
|
+
}
|
|
195
|
+
}, _callee);
|
|
196
|
+
}));
|
|
197
|
+
function customPaste(_x, _x2) {
|
|
198
|
+
return _customPaste.apply(this, arguments);
|
|
199
|
+
}
|
|
200
|
+
return customPaste;
|
|
201
|
+
}()
|
|
202
|
+
};
|
|
203
|
+
// 工具栏配置
|
|
204
|
+
var toolbarConfig = {
|
|
205
|
+
insertKeys: {
|
|
206
|
+
// 自定义插入的位置
|
|
207
|
+
index: 24,
|
|
208
|
+
// “上传附件”菜单
|
|
209
|
+
keys: ['uploadAttachment']
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
213
|
+
className: cls(prefixCls, getStatusClassNames(prefixCls, mergedStatus, hasFeedback), props.prefixCls),
|
|
214
|
+
children: [/*#__PURE__*/_jsx(Toolbar, {
|
|
215
|
+
editor: editor,
|
|
216
|
+
defaultConfig: toolbarConfig,
|
|
217
|
+
mode: "default"
|
|
218
|
+
}), /*#__PURE__*/_jsx(Editor, _objectSpread({
|
|
219
|
+
defaultConfig: editorConfig,
|
|
220
|
+
value: value ? value : '',
|
|
221
|
+
onCreated: function onCreated(editor) {
|
|
222
|
+
setEditor(editor);
|
|
223
|
+
},
|
|
224
|
+
onChange: function onChange(editor) {
|
|
225
|
+
var nextValue = value ? value : undefined;
|
|
226
|
+
var prevValue = editor.getHtml() ? editor.getHtml() : undefined;
|
|
227
|
+
if (nextValue !== prevValue) {
|
|
228
|
+
_onChange(editor.getHtml());
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
mode: "default",
|
|
232
|
+
className: cls("".concat(prefixCls, "-content"), hashId)
|
|
233
|
+
}, rest))]
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
export { VtxWangEditor };
|
|
237
|
+
export default VtxWangEditor;
|
|
238
|
+
VtxWangEditor.propTypes = {
|
|
239
|
+
value: PropTypes.string,
|
|
240
|
+
onChange: PropTypes.func,
|
|
241
|
+
placeholder: PropTypes.string,
|
|
242
|
+
downloadUrl: PropTypes.string,
|
|
243
|
+
uploadUrl: PropTypes.string,
|
|
244
|
+
height: PropTypes.number
|
|
245
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import '@wangeditor/editor/dist/css/style.css';
|
|
8
|
+
import { useStyle as useAntdStyle } from "../../vtx-provider";
|
|
9
|
+
var genVtxWangEditorStyle = function genVtxWangEditorStyle(token) {
|
|
10
|
+
var componentCls = token.componentCls;
|
|
11
|
+
return _defineProperty({}, componentCls, _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
12
|
+
border: "1px solid ".concat(token.colorBorderSecondary),
|
|
13
|
+
borderRadius: token.borderRadiusLG
|
|
14
|
+
}, "&".concat(componentCls, "-status-error"), {
|
|
15
|
+
borderColor: token.colorError
|
|
16
|
+
}), '&.w-e-full-screen-container', {
|
|
17
|
+
zIndex: '999999'
|
|
18
|
+
}), '&-content', {
|
|
19
|
+
height: '350px',
|
|
20
|
+
borderTop: "1px solid ".concat(token.colorBorderSecondary)
|
|
21
|
+
}), '.w-e-bar, .w-e-text-container', {
|
|
22
|
+
background: 'transparent',
|
|
23
|
+
color: token.colorText
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
export function useStyle(prefixCls) {
|
|
27
|
+
return useAntdStyle(prefixCls, function (token) {
|
|
28
|
+
var vtxWangEditorToken = _objectSpread(_objectSpread({}, token), {}, {
|
|
29
|
+
componentCls: ".".concat(prefixCls)
|
|
30
|
+
});
|
|
31
|
+
return [genVtxWangEditorStyle(vtxWangEditorToken)];
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
.vtx-wang-editor {
|
|
4
|
+
border: @border-width-base @border-style-base @border-color-base;
|
|
5
|
+
&.w-e-full-screen-container {
|
|
6
|
+
z-index: 999999;
|
|
7
|
+
}
|
|
8
|
+
&-content {
|
|
9
|
+
height: 350px;
|
|
10
|
+
border-top: @border-width-base @border-style-base @border-color-base;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
+
export function replaceAllSpanFontSize(htmlData) {
|
|
9
|
+
var spanReg = /\<span([\s\S]+?)\<\/span\>/g;
|
|
10
|
+
var fontReg = /\<font([\s\S]+?)\<\/font\>/g;
|
|
11
|
+
var fontSizeReg = /font-size:([\s\S]+?)\;/g;
|
|
12
|
+
var spanArr = htmlData.match(spanReg); // 筛选出所有的span
|
|
13
|
+
if (!spanArr || Array.isArray(spanArr) && !spanArr.length) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
var fontSizeReplaceList = {};
|
|
17
|
+
for (var i = 0; i < spanArr.length; i++) {
|
|
18
|
+
var fontArr = spanArr[i].match(fontReg);
|
|
19
|
+
if ((fontArr === null || fontArr === void 0 ? void 0 : fontArr.length) > 0) {
|
|
20
|
+
var fontSize = spanArr[i].match(fontSizeReg);
|
|
21
|
+
if ((fontSize === null || fontSize === void 0 ? void 0 : fontSize.length) > 0) {
|
|
22
|
+
var ptValue = fontSize[0].split(':')[1].replace(';', '');
|
|
23
|
+
if (ptValue.indexOf('pt') > -1) {
|
|
24
|
+
var value = toFontSize(parseInt(Number(ptValue.replace('pt', '')) / 0.75));
|
|
25
|
+
fontSizeReplaceList[fontSize[0]] = "font-size:".concat(value, "px;");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
for (var _i in fontSizeReplaceList) {
|
|
31
|
+
htmlData = htmlData.replaceAll(_i, fontSizeReplaceList[_i]);
|
|
32
|
+
}
|
|
33
|
+
return htmlData;
|
|
34
|
+
}
|
|
35
|
+
// 判断字体在这个范围之内,不在这个范围之内 则不显示字体大小
|
|
36
|
+
function toFontSize(size) {
|
|
37
|
+
var result = size;
|
|
38
|
+
var sizeArr = [12, 13, 14, 15, 16, 19, 22, 24, 29, 32, 40, 48];
|
|
39
|
+
if (sizeArr.includes(size)) {
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
if (size < sizeArr[0]) {
|
|
43
|
+
return sizeArr[0];
|
|
44
|
+
}
|
|
45
|
+
if (size > sizeArr[sizeArr.length - 1]) {
|
|
46
|
+
return sizeArr[sizeArr.length - 1];
|
|
47
|
+
}
|
|
48
|
+
for (var i = 1; i < sizeArr.length; i++) {
|
|
49
|
+
if (size >= sizeArr[i - 1] && size <= sizeArr[i]) {
|
|
50
|
+
if (size - sizeArr[i - 1] < sizeArr[i] - size) {
|
|
51
|
+
result = sizeArr[i - 1];
|
|
52
|
+
} else {
|
|
53
|
+
result = sizeArr[i];
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
export function findAllImgSrcsFromHtml(htmlData) {
|
|
61
|
+
var imgReg = /<img.*?(?:>|\/>)/gi; //匹配图片中的img标签
|
|
62
|
+
var srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i; // 匹配图片中的src
|
|
63
|
+
var widthReg = /width=[\'\"]?([^\'\"]*)[\'\"]?/i; // 匹配图片中的width
|
|
64
|
+
var heightReg = /height=[\'\"]?([^\'\"]*)[\'\"]?/i; // 匹配图片中的height
|
|
65
|
+
|
|
66
|
+
var arr = htmlData.match(imgReg); //筛选出所有的img
|
|
67
|
+
if (!arr || Array.isArray(arr) && !arr.length) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
var srcArr = [];
|
|
71
|
+
for (var i = 0; i < arr.length; i++) {
|
|
72
|
+
var src = arr[i].match(srcReg);
|
|
73
|
+
var width = arr[i].match(widthReg);
|
|
74
|
+
var height = arr[i].match(heightReg);
|
|
75
|
+
// 获取图片地址
|
|
76
|
+
srcArr.push({
|
|
77
|
+
width: width[1],
|
|
78
|
+
height: height[1],
|
|
79
|
+
url: src[1],
|
|
80
|
+
img: arr[i]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return srcArr;
|
|
84
|
+
}
|
|
85
|
+
// 处理为空的时候
|
|
86
|
+
export function withEmptyHtml(editor) {
|
|
87
|
+
var getHtml = editor.getHtml;
|
|
88
|
+
var newEditor = editor;
|
|
89
|
+
newEditor.getHtml = function () {
|
|
90
|
+
if (newEditor.isEmpty()) {
|
|
91
|
+
return '';
|
|
92
|
+
}
|
|
93
|
+
return getHtml();
|
|
94
|
+
};
|
|
95
|
+
return newEditor;
|
|
96
|
+
}
|
|
97
|
+
export function extractImageDataFromRtf(rtfData) {
|
|
98
|
+
if (!rtfData) {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
var regexPictureHeader = /{\\pict[\s\S]+?({\\\*\\blipuid\s?[\da-fA-F]+)[\s}]*/;
|
|
102
|
+
var regexPicture = new RegExp('(?:(' + regexPictureHeader.source + '))([\\da-fA-F\\s]+)\\}', 'g');
|
|
103
|
+
var images = rtfData.match(regexPicture);
|
|
104
|
+
var result = [];
|
|
105
|
+
if (images) {
|
|
106
|
+
var _iterator = _createForOfIteratorHelper(images),
|
|
107
|
+
_step;
|
|
108
|
+
try {
|
|
109
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
110
|
+
var image = _step.value;
|
|
111
|
+
var imageType = false;
|
|
112
|
+
if (image.includes('\\pngblip')) {
|
|
113
|
+
imageType = 'image/png';
|
|
114
|
+
} else if (image.includes('\\jpegblip')) {
|
|
115
|
+
imageType = 'image/jpeg';
|
|
116
|
+
}
|
|
117
|
+
if (imageType) {
|
|
118
|
+
result.push({
|
|
119
|
+
hex: image.replace(regexPictureHeader, '').replace(/[^\da-fA-F]/g, ''),
|
|
120
|
+
type: imageType
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
} catch (err) {
|
|
125
|
+
_iterator.e(err);
|
|
126
|
+
} finally {
|
|
127
|
+
_iterator.f();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
export function replaceImagesFileSourceWithInlineRepresentation(_x, _x2, _x3) {
|
|
133
|
+
return _replaceImagesFileSourceWithInlineRepresentation.apply(this, arguments);
|
|
134
|
+
}
|
|
135
|
+
function _replaceImagesFileSourceWithInlineRepresentation() {
|
|
136
|
+
_replaceImagesFileSourceWithInlineRepresentation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(htmlData, imageSrcs, imagesHexSources) {
|
|
137
|
+
var isBase64Data,
|
|
138
|
+
uploadUrl,
|
|
139
|
+
downloadUrl,
|
|
140
|
+
i,
|
|
141
|
+
_imageSrcs$i,
|
|
142
|
+
_imageSrcs$i2,
|
|
143
|
+
_imageSrcs$i3,
|
|
144
|
+
_imageSrcs$i4,
|
|
145
|
+
_url$split,
|
|
146
|
+
url,
|
|
147
|
+
width,
|
|
148
|
+
height,
|
|
149
|
+
img,
|
|
150
|
+
newSrc,
|
|
151
|
+
formData,
|
|
152
|
+
blob,
|
|
153
|
+
imgName,
|
|
154
|
+
file,
|
|
155
|
+
res,
|
|
156
|
+
_args = arguments;
|
|
157
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
158
|
+
while (1) switch (_context.prev = _context.next) {
|
|
159
|
+
case 0:
|
|
160
|
+
isBase64Data = _args.length > 3 && _args[3] !== undefined ? _args[3] : true;
|
|
161
|
+
uploadUrl = _args.length > 4 ? _args[4] : undefined;
|
|
162
|
+
downloadUrl = _args.length > 5 ? _args[5] : undefined;
|
|
163
|
+
if (!(imageSrcs.length === imagesHexSources.length)) {
|
|
164
|
+
_context.next = 23;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
i = 0;
|
|
168
|
+
case 5:
|
|
169
|
+
if (!(i < imageSrcs.length)) {
|
|
170
|
+
_context.next = 23;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
url = imageSrcs === null || imageSrcs === void 0 || (_imageSrcs$i = imageSrcs[i]) === null || _imageSrcs$i === void 0 ? void 0 : _imageSrcs$i.url;
|
|
174
|
+
width = imageSrcs === null || imageSrcs === void 0 || (_imageSrcs$i2 = imageSrcs[i]) === null || _imageSrcs$i2 === void 0 ? void 0 : _imageSrcs$i2.width;
|
|
175
|
+
height = imageSrcs === null || imageSrcs === void 0 || (_imageSrcs$i3 = imageSrcs[i]) === null || _imageSrcs$i3 === void 0 ? void 0 : _imageSrcs$i3.height;
|
|
176
|
+
img = imageSrcs === null || imageSrcs === void 0 || (_imageSrcs$i4 = imageSrcs[i]) === null || _imageSrcs$i4 === void 0 ? void 0 : _imageSrcs$i4.img;
|
|
177
|
+
newSrc = isBase64Data ? "data:".concat(imagesHexSources[i].type, ";base64,").concat(_convertHexToBase64(imagesHexSources[i].hex)) : imagesHexSources[i];
|
|
178
|
+
formData = new FormData();
|
|
179
|
+
blob = convertBase64UrlToBlob(newSrc);
|
|
180
|
+
imgName = ((_url$split = url.split('\\')) === null || _url$split === void 0 || (_url$split = _url$split.slice(-1)) === null || _url$split === void 0 ? void 0 : _url$split[0]) || 'image.jpg';
|
|
181
|
+
file = new File([blob], imgName);
|
|
182
|
+
formData.append('file', file);
|
|
183
|
+
_context.next = 18;
|
|
184
|
+
return window.fetch(uploadUrl, {
|
|
185
|
+
method: 'POST',
|
|
186
|
+
body: formData
|
|
187
|
+
}).then(function (response) {
|
|
188
|
+
return response.json();
|
|
189
|
+
});
|
|
190
|
+
case 18:
|
|
191
|
+
res = _context.sent;
|
|
192
|
+
htmlData = htmlData.replace(img, "<img src=\"".concat(downloadUrl).concat(res.data[0].id, "\" style=\"width:").concat(width, "px;height:").concat(height, "px\""));
|
|
193
|
+
case 20:
|
|
194
|
+
i++;
|
|
195
|
+
_context.next = 5;
|
|
196
|
+
break;
|
|
197
|
+
case 23:
|
|
198
|
+
return _context.abrupt("return", htmlData);
|
|
199
|
+
case 24:
|
|
200
|
+
case "end":
|
|
201
|
+
return _context.stop();
|
|
202
|
+
}
|
|
203
|
+
}, _callee);
|
|
204
|
+
}));
|
|
205
|
+
return _replaceImagesFileSourceWithInlineRepresentation.apply(this, arguments);
|
|
206
|
+
}
|
|
207
|
+
function _convertHexToBase64(hexString) {
|
|
208
|
+
return btoa(hexString.match(/\w{2}/g).map(function (char) {
|
|
209
|
+
return String.fromCharCode(parseInt(char, 16));
|
|
210
|
+
}).join(''));
|
|
211
|
+
}
|
|
212
|
+
function convertBase64UrlToBlob(dataurl) {
|
|
213
|
+
var arr = dataurl.split(',');
|
|
214
|
+
//注意base64的最后面中括号和引号是不转译的
|
|
215
|
+
var _arr = arr[1].substring(0, arr[1].length - 2);
|
|
216
|
+
var mime = arr[0].match(/:(.*?);/)[1],
|
|
217
|
+
bstr = atob(_arr);
|
|
218
|
+
var n = bstr.length;
|
|
219
|
+
var u8arr = new Uint8Array(n);
|
|
220
|
+
while (n--) {
|
|
221
|
+
u8arr[n] = bstr.charCodeAt(n);
|
|
222
|
+
}
|
|
223
|
+
return new Blob([u8arr], {
|
|
224
|
+
type: mime
|
|
225
|
+
});
|
|
226
|
+
}
|