@vtx/components 3.1.17 → 3.1.18
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/CHANGELOG.md +1177 -0
- package/README.md +19 -19
- package/lib/_util/filterSpecialCharacters.js +49 -60
- package/lib/_util/filterSpecialCharacters.js.map +1 -1
- package/lib/_util/getComponentProps.js +3 -0
- package/lib/_util/getComponentProps.js.map +1 -1
- package/lib/_util/getUrlParam.js +6 -0
- package/lib/_util/getUrlParam.js.map +1 -1
- package/lib/_util/isFunction.js +1 -0
- package/lib/_util/isFunction.js.map +1 -1
- package/lib/_util/isObject.js +1 -0
- package/lib/_util/isObject.js.map +1 -1
- package/lib/_util/useColSize.js +10 -1
- package/lib/_util/useColSize.js.map +1 -1
- package/lib/_util/useInterval.js +3 -0
- package/lib/_util/useInterval.js.map +1 -1
- package/lib/_util/useSet.js +32 -14
- package/lib/_util/useSet.js.map +1 -1
- package/lib/config.js.map +1 -1
- package/lib/index.js +33 -0
- package/lib/index.js.map +1 -1
- package/lib/style/index.less +2 -2
- package/lib/style/themes/compact.less +1 -1
- package/lib/style/themes/dark.less +9 -9
- package/lib/style/themes/default.less +7 -7
- package/lib/style/themes/index.less +1 -1
- package/lib/style/themes/variable.less +5 -5
- package/lib/vtx-color-picker/index.js +21 -5
- package/lib/vtx-color-picker/index.js.map +1 -1
- package/lib/vtx-color-picker/style/css.js +2 -0
- package/lib/vtx-color-picker/style/css.js.map +1 -1
- package/lib/vtx-color-picker/style/index.js +2 -0
- package/lib/vtx-color-picker/style/index.js.map +1 -1
- package/lib/vtx-color-picker/style/index.less +12 -12
- package/lib/vtx-combogrid/Combogrid.js +74 -34
- package/lib/vtx-combogrid/Combogrid.js.map +1 -1
- package/lib/vtx-combogrid/index.js +45 -20
- package/lib/vtx-combogrid/index.js.map +1 -1
- package/lib/vtx-combogrid/style/css.js +7 -0
- package/lib/vtx-combogrid/style/css.js.map +1 -1
- package/lib/vtx-combogrid/style/index.js +7 -0
- package/lib/vtx-combogrid/style/index.js.map +1 -1
- package/lib/vtx-combogrid/style/index.less +29 -29
- package/lib/vtx-datagrid/Alert.js +11 -3
- package/lib/vtx-datagrid/Alert.js.map +1 -1
- package/lib/vtx-datagrid/ColumnSetting.js +44 -19
- package/lib/vtx-datagrid/ColumnSetting.js.map +1 -1
- package/lib/vtx-datagrid/ResizeableTitle.js +13 -2
- package/lib/vtx-datagrid/ResizeableTitle.js.map +1 -1
- package/lib/vtx-datagrid/index.js +140 -77
- package/lib/vtx-datagrid/index.js.map +1 -1
- package/lib/vtx-datagrid/renderColumnButtons.js +35 -5
- package/lib/vtx-datagrid/renderColumnButtons.js.map +1 -1
- package/lib/vtx-datagrid/style/css.js +10 -0
- package/lib/vtx-datagrid/style/css.js.map +1 -1
- package/lib/vtx-datagrid/style/index.js +10 -0
- package/lib/vtx-datagrid/style/index.js.map +1 -1
- package/lib/vtx-datagrid/style/index.less +215 -215
- package/lib/vtx-date-picker/QdatePicker.js +46 -16
- package/lib/vtx-date-picker/QdatePicker.js.map +1 -1
- package/lib/vtx-date-picker/generatePicker.js +47 -6
- package/lib/vtx-date-picker/generatePicker.js.map +1 -1
- package/lib/vtx-date-picker/index.js +5 -0
- package/lib/vtx-date-picker/index.js.map +1 -1
- package/lib/vtx-date-picker/style/css.js +1 -0
- package/lib/vtx-date-picker/style/css.js.map +1 -1
- package/lib/vtx-date-picker/style/index.js +1 -0
- package/lib/vtx-date-picker/style/index.js.map +1 -1
- package/lib/vtx-date-picker/style/index.less +39 -39
- package/lib/vtx-editor/index.js +23 -5
- package/lib/vtx-editor/index.js.map +1 -1
- package/lib/vtx-editor/style/css.js +1 -0
- package/lib/vtx-editor/style/css.js.map +1 -1
- package/lib/vtx-editor/style/index.js +1 -0
- package/lib/vtx-editor/style/index.js.map +1 -1
- package/lib/vtx-editor/style/index.less +8 -8
- package/lib/vtx-ellipsis-text/index.js +20 -6
- package/lib/vtx-ellipsis-text/index.js.map +1 -1
- package/lib/vtx-ellipsis-text/style/css.js +1 -0
- package/lib/vtx-ellipsis-text/style/css.js.map +1 -1
- package/lib/vtx-ellipsis-text/style/index.js +1 -0
- package/lib/vtx-ellipsis-text/style/index.js.map +1 -1
- package/lib/vtx-ellipsis-text/style/index.less +13 -13
- package/lib/vtx-export/index.js +66 -33
- package/lib/vtx-export/index.js.map +1 -1
- package/lib/vtx-export/style/css.js +5 -0
- package/lib/vtx-export/style/css.js.map +1 -1
- package/lib/vtx-export/style/index.js +5 -0
- package/lib/vtx-export/style/index.js.map +1 -1
- package/lib/vtx-export/style/index.less +6 -6
- package/lib/vtx-form-layout/Card.js +26 -5
- package/lib/vtx-form-layout/Card.js.map +1 -1
- package/lib/vtx-form-layout/Divider.js +8 -0
- package/lib/vtx-form-layout/Divider.js.map +1 -1
- package/lib/vtx-form-layout/FormItem.js +30 -8
- package/lib/vtx-form-layout/FormItem.js.map +1 -1
- package/lib/vtx-form-layout/Pane.js +7 -2
- package/lib/vtx-form-layout/Pane.js.map +1 -1
- package/lib/vtx-form-layout/Row.js +6 -0
- package/lib/vtx-form-layout/Row.js.map +1 -1
- package/lib/vtx-form-layout/context.js +2 -0
- package/lib/vtx-form-layout/context.js.map +1 -1
- package/lib/vtx-form-layout/demo/Modal.less +43 -43
- package/lib/vtx-form-layout/index.js +22 -8
- package/lib/vtx-form-layout/index.js.map +1 -1
- package/lib/vtx-form-layout/style/css.js +7 -0
- package/lib/vtx-form-layout/style/css.js.map +1 -1
- package/lib/vtx-form-layout/style/index.js +7 -0
- package/lib/vtx-form-layout/style/index.js.map +1 -1
- package/lib/vtx-image/Image.js +92 -56
- package/lib/vtx-image/Image.js.map +1 -1
- package/lib/vtx-image/Preview.js +51 -20
- package/lib/vtx-image/Preview.js.map +1 -1
- package/lib/vtx-image/PreviewGroup.js +40 -11
- package/lib/vtx-image/PreviewGroup.js.map +1 -1
- package/lib/vtx-image/index.js +6 -0
- package/lib/vtx-image/index.js.map +1 -1
- package/lib/vtx-image/style/css.js +1 -0
- package/lib/vtx-image/style/css.js.map +1 -1
- package/lib/vtx-image/style/index.js +1 -0
- package/lib/vtx-image/style/index.js.map +1 -1
- package/lib/vtx-image/style/index.less +63 -63
- package/lib/vtx-import/index.js +72 -37
- package/lib/vtx-import/index.js.map +1 -1
- package/lib/vtx-import/result.js +24 -7
- package/lib/vtx-import/result.js.map +1 -1
- package/lib/vtx-import/style/css.js +3 -0
- package/lib/vtx-import/style/css.js.map +1 -1
- package/lib/vtx-import/style/index.js +3 -0
- package/lib/vtx-import/style/index.js.map +1 -1
- package/lib/vtx-import/style/index.less +8 -8
- package/lib/vtx-import2/CheckResult.js +6 -0
- package/lib/vtx-import2/CheckResult.js.map +1 -1
- package/lib/vtx-import2/Content.js +25 -4
- package/lib/vtx-import2/Content.js.map +1 -1
- package/lib/vtx-import2/DownloadSvg.js +4 -0
- package/lib/vtx-import2/DownloadSvg.js.map +1 -1
- package/lib/vtx-import2/ImportResult.js +9 -3
- package/lib/vtx-import2/ImportResult.js.map +1 -1
- package/lib/vtx-import2/UploadSvg.js +4 -0
- package/lib/vtx-import2/UploadSvg.js.map +1 -1
- package/lib/vtx-import2/index.js +74 -34
- package/lib/vtx-import2/index.js.map +1 -1
- package/lib/vtx-import2/style/css.js +3 -0
- package/lib/vtx-import2/style/css.js.map +1 -1
- package/lib/vtx-import2/style/index.js +3 -0
- package/lib/vtx-import2/style/index.js.map +1 -1
- package/lib/vtx-import2/style/index.less +102 -102
- package/lib/vtx-input/TextArea.js +22 -6
- package/lib/vtx-input/TextArea.js.map +1 -1
- package/lib/vtx-input/index.js +37 -11
- package/lib/vtx-input/index.js.map +1 -1
- package/lib/vtx-input/style/css.js +1 -0
- package/lib/vtx-input/style/css.js.map +1 -1
- package/lib/vtx-input/style/index.js +1 -0
- package/lib/vtx-input/style/index.js.map +1 -1
- package/lib/vtx-input/style/index.less +24 -24
- package/lib/vtx-input/useLength.js +16 -4
- package/lib/vtx-input/useLength.js.map +1 -1
- package/lib/vtx-modal/Title.js +6 -1
- package/lib/vtx-modal/Title.js.map +1 -1
- package/lib/vtx-modal/index.js +72 -32
- package/lib/vtx-modal/index.js.map +1 -1
- package/lib/vtx-modal/style/css.js +1 -0
- package/lib/vtx-modal/style/css.js.map +1 -1
- package/lib/vtx-modal/style/index.js +1 -0
- package/lib/vtx-modal/style/index.js.map +1 -1
- package/lib/vtx-modal/style/index.less +95 -95
- package/lib/vtx-page-layout/Basic.js +8 -4
- package/lib/vtx-page-layout/Basic.js.map +1 -1
- package/lib/vtx-page-layout/Content.js +19 -7
- package/lib/vtx-page-layout/Content.js.map +1 -1
- package/lib/vtx-page-layout/Pane.js +10 -2
- package/lib/vtx-page-layout/Pane.js.map +1 -1
- package/lib/vtx-page-layout/TableLayout.js +55 -25
- package/lib/vtx-page-layout/TableLayout.js.map +1 -1
- package/lib/vtx-page-layout/TableWrap.js +15 -3
- package/lib/vtx-page-layout/TableWrap.js.map +1 -1
- package/lib/vtx-page-layout/container.js +34 -4
- package/lib/vtx-page-layout/container.js.map +1 -1
- package/lib/vtx-page-layout/index.js +8 -0
- package/lib/vtx-page-layout/index.js.map +1 -1
- package/lib/vtx-page-layout/style/css.js.map +1 -1
- package/lib/vtx-page-layout/style/index.js.map +1 -1
- package/lib/vtx-page-layout/style/index.less +138 -138
- package/lib/vtx-rps-frame/index.js +44 -21
- package/lib/vtx-rps-frame/index.js.map +1 -1
- package/lib/vtx-rps-frame/style/css.js.map +1 -1
- package/lib/vtx-rps-frame/style/index.js.map +1 -1
- package/lib/vtx-rps-frame/style/index.less +8 -8
- package/lib/vtx-scrollable-row/index.js +57 -19
- package/lib/vtx-scrollable-row/index.js.map +1 -1
- package/lib/vtx-scrollable-row/style/css.js.map +1 -1
- package/lib/vtx-scrollable-row/style/index.js.map +1 -1
- package/lib/vtx-scrollable-row/style/index.less +113 -113
- package/lib/vtx-search/VtxCol.js +21 -0
- package/lib/vtx-search/VtxCol.js.map +1 -1
- package/lib/vtx-search/VtxRow.js +12 -6
- package/lib/vtx-search/VtxRow.js.map +1 -1
- package/lib/vtx-search/index.js +93 -40
- package/lib/vtx-search/index.js.map +1 -1
- package/lib/vtx-search/style/css.js +4 -0
- package/lib/vtx-search/style/css.js.map +1 -1
- package/lib/vtx-search/style/index.js +4 -0
- package/lib/vtx-search/style/index.js.map +1 -1
- package/lib/vtx-search/style/index.less +83 -83
- package/lib/vtx-search-map-input/index.js +72 -42
- package/lib/vtx-search-map-input/index.js.map +1 -1
- package/lib/vtx-search-map-input/style/css.js +2 -0
- package/lib/vtx-search-map-input/style/css.js.map +1 -1
- package/lib/vtx-search-map-input/style/index.js +2 -0
- package/lib/vtx-search-map-input/style/index.js.map +1 -1
- package/lib/vtx-select/index.js +65 -20
- package/lib/vtx-select/index.js.map +1 -1
- package/lib/vtx-select/style/css.js +8 -0
- package/lib/vtx-select/style/css.js.map +1 -1
- package/lib/vtx-select/style/index.js +8 -0
- package/lib/vtx-select/style/index.js.map +1 -1
- package/lib/vtx-select/style/index.less +68 -68
- package/lib/vtx-signature/index.js +28 -14
- package/lib/vtx-signature/index.js.map +1 -1
- package/lib/vtx-signature/style/css.js +2 -0
- package/lib/vtx-signature/style/css.js.map +1 -1
- package/lib/vtx-signature/style/index.js +2 -0
- package/lib/vtx-signature/style/index.js.map +1 -1
- package/lib/vtx-signature/style/index.less +33 -33
- package/lib/vtx-split-pane/Pane.js +14 -2
- package/lib/vtx-split-pane/Pane.js.map +1 -1
- package/lib/vtx-split-pane/Resizer.js +29 -9
- package/lib/vtx-split-pane/Resizer.js.map +1 -1
- package/lib/vtx-split-pane/SplitPane.js +98 -43
- package/lib/vtx-split-pane/SplitPane.js.map +1 -1
- package/lib/vtx-split-pane/index.js +4 -0
- package/lib/vtx-split-pane/index.js.map +1 -1
- package/lib/vtx-split-pane/style/css.js +3 -0
- package/lib/vtx-split-pane/style/css.js.map +1 -1
- package/lib/vtx-split-pane/style/index.js +3 -0
- package/lib/vtx-split-pane/style/index.js.map +1 -1
- package/lib/vtx-split-pane/style/index.less +76 -76
- package/lib/vtx-statistics-column/Back.js +7 -1
- package/lib/vtx-statistics-column/Back.js.map +1 -1
- package/lib/vtx-statistics-column/Item.js +22 -5
- package/lib/vtx-statistics-column/Item.js.map +1 -1
- package/lib/vtx-statistics-column/Total.js +22 -5
- package/lib/vtx-statistics-column/Total.js.map +1 -1
- package/lib/vtx-statistics-column/context.js +2 -0
- package/lib/vtx-statistics-column/context.js.map +1 -1
- package/lib/vtx-statistics-column/index.js +16 -0
- package/lib/vtx-statistics-column/index.js.map +1 -1
- package/lib/vtx-statistics-column/style/css.js.map +1 -1
- package/lib/vtx-statistics-column/style/index.js.map +1 -1
- package/lib/vtx-statistics-column/style/index.less +59 -59
- package/lib/vtx-time-picker/index.js +16 -3
- package/lib/vtx-time-picker/index.js.map +1 -1
- package/lib/vtx-time-picker/style/css.js.map +1 -1
- package/lib/vtx-time-picker/style/index.js.map +1 -1
- package/lib/vtx-upload/FilePreview.js +28 -9
- package/lib/vtx-upload/FilePreview.js.map +1 -1
- package/lib/vtx-upload/index.js +137 -67
- package/lib/vtx-upload/index.js.map +1 -1
- package/lib/vtx-upload/style/css.js +5 -0
- package/lib/vtx-upload/style/css.js.map +1 -1
- package/lib/vtx-upload/style/index.js +5 -0
- package/lib/vtx-upload/style/index.js.map +1 -1
- package/lib/vtx-upload/style/index.less +61 -61
- package/lib/vtx-wang-editor/index.js +246 -0
- package/lib/vtx-wang-editor/index.js.map +1 -0
- package/lib/vtx-wang-editor/style/css.js +6 -0
- package/lib/vtx-wang-editor/style/css.js.map +1 -0
- package/lib/vtx-wang-editor/style/index.css +20 -0
- package/lib/vtx-wang-editor/style/index.js +6 -0
- package/lib/vtx-wang-editor/style/index.js.map +1 -0
- package/lib/vtx-wang-editor/style/index.less +24 -0
- package/lib/vtx-wang-editor/wangEditorUtil.js +229 -0
- package/lib/vtx-wang-editor/wangEditorUtil.js.map +1 -0
- package/lib/vtx-ztree/index.js +103 -51
- package/lib/vtx-ztree/index.js.map +1 -1
- package/lib/vtx-ztree/style/css.js +1 -0
- package/lib/vtx-ztree/style/css.js.map +1 -1
- package/lib/vtx-ztree/style/index.js +1 -0
- package/lib/vtx-ztree/style/index.js.map +1 -1
- package/lib/vtx-ztree/style/index.less +45 -45
- package/lib/vtx-ztree-select/index.js +99 -43
- package/lib/vtx-ztree-select/index.js.map +1 -1
- package/lib/vtx-ztree-select/style/css.js +3 -0
- package/lib/vtx-ztree-select/style/css.js.map +1 -1
- package/lib/vtx-ztree-select/style/index.js +3 -0
- package/lib/vtx-ztree-select/style/index.js.map +1 -1
- package/lib/vtx-ztree-select/style/index.less +74 -74
- package/package.json +126 -123
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["VtxTimePicker","props","ref","value","format","rest","newValue","moment","isMoment","React","forwardRef","propTypes","PropTypes","oneOfType","string","instanceOf"],"sources":["vtx-time-picker/index.jsx"],"sourcesContent":["import React from 'react';\nimport TimePicker from 'antd/lib/time-picker';\nimport moment from 'moment';\nimport PropTypes from 'prop-types';\n\nfunction VtxTimePicker(props, ref) {\n const { value, format = 'HH:mm:ss', ...rest } = props;\n const newValue = value ? (moment.isMoment(value) ? value : moment(value, format)) : null;\n return <TimePicker value={newValue} format={format} {...rest} ref={ref} />;\n}\n\nexport default React.forwardRef(VtxTimePicker);\n\nVtxTimePicker.propTypes = {\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(moment)]),\n format: PropTypes.string,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["VtxTimePicker","props","ref","value","format","rest","newValue","moment","isMoment","React","forwardRef","propTypes","PropTypes","oneOfType","string","instanceOf"],"sources":["vtx-time-picker/index.jsx"],"sourcesContent":["import React from 'react';\r\nimport TimePicker from 'antd/lib/time-picker';\r\nimport moment from 'moment';\r\nimport PropTypes from 'prop-types';\r\n\r\nfunction VtxTimePicker(props, ref) {\r\n const { value, format = 'HH:mm:ss', ...rest } = props;\r\n const newValue = value ? (moment.isMoment(value) ? value : moment(value, format)) : null;\r\n return <TimePicker value={newValue} format={format} {...rest} ref={ref} />;\r\n}\r\n\r\nexport default React.forwardRef(VtxTimePicker);\r\n\r\nVtxTimePicker.propTypes = {\r\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(moment)]),\r\n format: PropTypes.string,\r\n};\r\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,SAASA,aAAT,CAAuBC,KAAvB,EAA8BC,GAA9B,EAAmC;EAC/B,IAAQC,KAAR,GAAgDF,KAAhD,CAAQE,KAAR;EAAA,oBAAgDF,KAAhD,CAAeG,MAAf;EAAA,IAAeA,MAAf,8BAAwB,UAAxB;EAAA,IAAuCC,IAAvC,4BAAgDJ,KAAhD;;EACA,IAAMK,QAAQ,GAAGH,KAAK,GAAII,kBAAA,CAAOC,QAAP,CAAgBL,KAAhB,IAAyBA,KAAzB,GAAiC,IAAAI,kBAAA,EAAOJ,KAAP,EAAcC,MAAd,CAArC,GAA8D,IAApF;EACA,oBAAO,gCAAC,sBAAD;IAAY,KAAK,EAAEE,QAAnB;IAA6B,MAAM,EAAEF;EAArC,GAAiDC,IAAjD;IAAuD,GAAG,EAAEH;EAA5D,GAAP;AACH;;4BAEcO,iBAAA,CAAMC,UAAN,CAAiBV,aAAjB,C;;;AAEfA,aAAa,CAACW,SAAd,GAA0B;EACtBR,KAAK,EAAES,qBAAA,CAAUC,SAAV,CAAoB,CAACD,qBAAA,CAAUE,MAAX,EAAmBF,qBAAA,CAAUG,UAAV,CAAqBR,kBAArB,CAAnB,CAApB,CADe;EAEtBH,MAAM,EAAEQ,qBAAA,CAAUE;AAFI,CAA1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.js","names":[],"sources":["vtx-time-picker/style/index.js"],"sourcesContent":["import 'antd/lib/time-picker/style/index';\n"],"mappings":";;AAAA"}
|
|
1
|
+
{"version":3,"file":"css.js","names":[],"sources":["vtx-time-picker/style/index.js"],"sourcesContent":["import 'antd/lib/time-picker/style/index';\r\n"],"mappings":";;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["vtx-time-picker/style/index.js"],"sourcesContent":["import 'antd/lib/time-picker/style/index';\n"],"mappings":";;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["vtx-time-picker/style/index.js"],"sourcesContent":["import 'antd/lib/time-picker/style/index';\r\n"],"mappings":";;AAAA"}
|
|
@@ -4,25 +4,36 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
+
|
|
7
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
8
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
9
12
|
var _simple_player = _interopRequireDefault(require("xgplayer/dist/simple_player"));
|
|
13
|
+
|
|
10
14
|
var _controls = require("xgplayer/dist/controls");
|
|
15
|
+
|
|
11
16
|
var _modal = _interopRequireDefault(require("antd/lib/modal"));
|
|
17
|
+
|
|
12
18
|
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
19
|
+
|
|
13
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
|
|
14
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
+
|
|
15
24
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
|
+
|
|
16
26
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
27
|
+
|
|
17
28
|
function Preview(props) {
|
|
18
29
|
var type = props.type,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
name = props.name,
|
|
31
|
+
url = props.url,
|
|
32
|
+
downloadUrl = props.downloadUrl,
|
|
33
|
+
visible = props.visible,
|
|
34
|
+
onCancel = props.onCancel;
|
|
24
35
|
var player = null,
|
|
25
|
-
|
|
36
|
+
timer = null;
|
|
26
37
|
timer = setTimeout(function () {
|
|
27
38
|
if (type == 'video' && document.getElementById('vs')) {
|
|
28
39
|
player = new _simple_player["default"]({
|
|
@@ -30,12 +41,11 @@ function Preview(props) {
|
|
|
30
41
|
url: url,
|
|
31
42
|
width: 600,
|
|
32
43
|
height: 337.5,
|
|
33
|
-
controlPlugins: [_controls.volume,
|
|
34
|
-
//音量
|
|
44
|
+
controlPlugins: [_controls.volume, //音量
|
|
35
45
|
_controls.playbackRate //播放倍速
|
|
36
46
|
],
|
|
37
|
-
|
|
38
47
|
playbackRate: [0.5, 0.75, 1, 1.5, 2] //传入倍速可选数组
|
|
48
|
+
|
|
39
49
|
});
|
|
40
50
|
}
|
|
41
51
|
}, 500);
|
|
@@ -58,22 +68,26 @@ function Preview(props) {
|
|
|
58
68
|
}
|
|
59
69
|
}, "\u4E0B\u8F7D")]
|
|
60
70
|
};
|
|
71
|
+
|
|
61
72
|
if (type == 'file') {
|
|
62
73
|
modalProps = _objectSpread(_objectSpread({}, modalProps), {}, {
|
|
63
74
|
wrapClassName: 'vtx-modal-maxClass'
|
|
64
75
|
});
|
|
65
76
|
}
|
|
77
|
+
|
|
66
78
|
if (type == 'video') {
|
|
67
79
|
modalProps = _objectSpread(_objectSpread({}, modalProps), {}, {
|
|
68
80
|
width: 648
|
|
69
81
|
});
|
|
70
82
|
}
|
|
83
|
+
|
|
71
84
|
var cancel = function cancel() {
|
|
72
85
|
//销毁播放器
|
|
73
86
|
player && player.destroy();
|
|
74
87
|
timer && clearTimeout(timer);
|
|
75
88
|
onCancel();
|
|
76
89
|
};
|
|
90
|
+
|
|
77
91
|
return /*#__PURE__*/_react["default"].createElement(_modal["default"], modalProps, type == 'file' ? /*#__PURE__*/_react["default"].createElement("iframe", {
|
|
78
92
|
src: url,
|
|
79
93
|
style: {
|
|
@@ -85,6 +99,7 @@ function Preview(props) {
|
|
|
85
99
|
id: "vs"
|
|
86
100
|
}) : null);
|
|
87
101
|
}
|
|
102
|
+
|
|
88
103
|
Preview.propTypes = {
|
|
89
104
|
type: _propTypes["default"].string,
|
|
90
105
|
name: _propTypes["default"].string,
|
|
@@ -95,13 +110,17 @@ Preview.propTypes = {
|
|
|
95
110
|
};
|
|
96
111
|
var _default = Preview;
|
|
97
112
|
exports["default"] = _default;
|
|
113
|
+
|
|
98
114
|
var createForm = function createForm(reqURL) {
|
|
99
115
|
var formDom = document.createElement('form'); // 定义一个form表单
|
|
116
|
+
|
|
100
117
|
formDom.method = 'post';
|
|
101
118
|
formDom.action = reqURL;
|
|
102
119
|
formDom.style = 'display:none';
|
|
103
120
|
document.body.appendChild(formDom); // 将表单放置在web中
|
|
121
|
+
|
|
104
122
|
formDom.submit(); // 表单提交
|
|
123
|
+
|
|
105
124
|
formDom.remove();
|
|
106
125
|
};
|
|
107
126
|
//# sourceMappingURL=FilePreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilePreview.js","names":["Preview","props","type","name","url","downloadUrl","visible","onCancel","player","timer","setTimeout","document","getElementById","Player","id","width","height","controlPlugins","volume","playbackRate","modalProps","title","cancel","footer","createForm","wrapClassName","destroy","clearTimeout","border","propTypes","PropTypes","string","bool","func","reqURL","formDom","createElement","method","action","style","body","appendChild","submit","remove"],"sources":["vtx-upload/FilePreview.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Player from 'xgplayer/dist/simple_player';\nimport { volume, playbackRate } from 'xgplayer/dist/controls';\nimport Modal from 'antd/lib/modal';\nimport Button from 'antd/lib/button';\n\nfunction Preview(props) {\n const { type, name, url, downloadUrl, visible, onCancel } = props;\n\n let player = null,\n timer = null;\n timer = setTimeout(() => {\n if (type == 'video' && document.getElementById('vs')) {\n player = new Player({\n id: 'vs',\n url: url,\n width: 600,\n height: 337.5,\n controlPlugins: [\n volume, //音量\n playbackRate, //播放倍速\n ],\n playbackRate: [0.5, 0.75, 1, 1.5, 2], //传入倍速可选数组\n });\n }\n }, 500);\n\n let modalProps = {\n title: name,\n visible,\n onCancel: () => cancel(),\n footer: [\n <Button key=\"close\" onClick={() => cancel()}>\n 关闭\n </Button>,\n <Button key=\"download\" type=\"primary\" onClick={() => createForm(downloadUrl)}>\n 下载\n </Button>,\n ],\n };\n if (type == 'file') {\n modalProps = {\n ...modalProps,\n wrapClassName: 'vtx-modal-maxClass',\n };\n }\n if (type == 'video') {\n modalProps = {\n ...modalProps,\n width: 648,\n };\n }\n\n const cancel = () => {\n //销毁播放器\n player && player.destroy();\n timer && clearTimeout(timer);\n onCancel();\n };\n\n return (\n <Modal {...modalProps}>\n {type == 'file' ? (\n <iframe\n src={url}\n style={{ height: '100%', width: '100%', border: 'none' }}\n ></iframe>\n ) : null}\n {type == 'video' ? <div id=\"vs\"></div> : null}\n </Modal>\n );\n}\n\nPreview.propTypes = {\n type: PropTypes.string,\n name: PropTypes.string,\n url: PropTypes.string,\n visible: PropTypes.bool,\n onCancel: PropTypes.func,\n downloadUrl: PropTypes.string,\n};\n\nexport default Preview;\n\nconst createForm = function(reqURL) {\n const formDom = document.createElement('form'); // 定义一个form表单\n formDom.method = 'post';\n formDom.action = reqURL;\n formDom.style = 'display:none';\n document.body.appendChild(formDom); // 将表单放置在web中\n formDom.submit(); // 表单提交\n formDom.remove();\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilePreview.js","names":["Preview","props","type","name","url","downloadUrl","visible","onCancel","player","timer","setTimeout","document","getElementById","Player","id","width","height","controlPlugins","volume","playbackRate","modalProps","title","cancel","footer","createForm","wrapClassName","destroy","clearTimeout","border","propTypes","PropTypes","string","bool","func","reqURL","formDom","createElement","method","action","style","body","appendChild","submit","remove"],"sources":["vtx-upload/FilePreview.jsx"],"sourcesContent":["import React from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport Player from 'xgplayer/dist/simple_player';\r\nimport { volume, playbackRate } from 'xgplayer/dist/controls';\r\nimport Modal from 'antd/lib/modal';\r\nimport Button from 'antd/lib/button';\r\n\r\nfunction Preview(props) {\r\n const { type, name, url, downloadUrl, visible, onCancel } = props;\r\n\r\n let player = null,\r\n timer = null;\r\n timer = setTimeout(() => {\r\n if (type == 'video' && document.getElementById('vs')) {\r\n player = new Player({\r\n id: 'vs',\r\n url: url,\r\n width: 600,\r\n height: 337.5,\r\n controlPlugins: [\r\n volume, //音量\r\n playbackRate, //播放倍速\r\n ],\r\n playbackRate: [0.5, 0.75, 1, 1.5, 2], //传入倍速可选数组\r\n });\r\n }\r\n }, 500);\r\n\r\n let modalProps = {\r\n title: name,\r\n visible,\r\n onCancel: () => cancel(),\r\n footer: [\r\n <Button key=\"close\" onClick={() => cancel()}>\r\n 关闭\r\n </Button>,\r\n <Button key=\"download\" type=\"primary\" onClick={() => createForm(downloadUrl)}>\r\n 下载\r\n </Button>,\r\n ],\r\n };\r\n if (type == 'file') {\r\n modalProps = {\r\n ...modalProps,\r\n wrapClassName: 'vtx-modal-maxClass',\r\n };\r\n }\r\n if (type == 'video') {\r\n modalProps = {\r\n ...modalProps,\r\n width: 648,\r\n };\r\n }\r\n\r\n const cancel = () => {\r\n //销毁播放器\r\n player && player.destroy();\r\n timer && clearTimeout(timer);\r\n onCancel();\r\n };\r\n\r\n return (\r\n <Modal {...modalProps}>\r\n {type == 'file' ? (\r\n <iframe\r\n src={url}\r\n style={{ height: '100%', width: '100%', border: 'none' }}\r\n ></iframe>\r\n ) : null}\r\n {type == 'video' ? <div id=\"vs\"></div> : null}\r\n </Modal>\r\n );\r\n}\r\n\r\nPreview.propTypes = {\r\n type: PropTypes.string,\r\n name: PropTypes.string,\r\n url: PropTypes.string,\r\n visible: PropTypes.bool,\r\n onCancel: PropTypes.func,\r\n downloadUrl: PropTypes.string,\r\n};\r\n\r\nexport default Preview;\r\n\r\nconst createForm = function(reqURL) {\r\n const formDom = document.createElement('form'); // 定义一个form表单\r\n formDom.method = 'post';\r\n formDom.action = reqURL;\r\n formDom.style = 'display:none';\r\n document.body.appendChild(formDom); // 将表单放置在web中\r\n formDom.submit(); // 表单提交\r\n formDom.remove();\r\n};\r\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,SAASA,OAAT,CAAiBC,KAAjB,EAAwB;EACpB,IAAQC,IAAR,GAA4DD,KAA5D,CAAQC,IAAR;EAAA,IAAcC,IAAd,GAA4DF,KAA5D,CAAcE,IAAd;EAAA,IAAoBC,GAApB,GAA4DH,KAA5D,CAAoBG,GAApB;EAAA,IAAyBC,WAAzB,GAA4DJ,KAA5D,CAAyBI,WAAzB;EAAA,IAAsCC,OAAtC,GAA4DL,KAA5D,CAAsCK,OAAtC;EAAA,IAA+CC,QAA/C,GAA4DN,KAA5D,CAA+CM,QAA/C;EAEA,IAAIC,MAAM,GAAG,IAAb;EAAA,IACIC,KAAK,GAAG,IADZ;EAEAA,KAAK,GAAGC,UAAU,CAAC,YAAM;IACrB,IAAIR,IAAI,IAAI,OAAR,IAAmBS,QAAQ,CAACC,cAAT,CAAwB,IAAxB,CAAvB,EAAsD;MAClDJ,MAAM,GAAG,IAAIK,yBAAJ,CAAW;QAChBC,EAAE,EAAE,IADY;QAEhBV,GAAG,EAAEA,GAFW;QAGhBW,KAAK,EAAE,GAHS;QAIhBC,MAAM,EAAE,KAJQ;QAKhBC,cAAc,EAAE,CACZC,gBADY,EACJ;QACRC,sBAFY,CAEE;QAFF,CALA;QAShBA,YAAY,EAAE,CAAC,GAAD,EAAM,IAAN,EAAY,CAAZ,EAAe,GAAf,EAAoB,CAApB,CATE,CASsB;;MATtB,CAAX,CAAT;IAWH;EACJ,CAdiB,EAcf,GAde,CAAlB;EAgBA,IAAIC,UAAU,GAAG;IACbC,KAAK,EAAElB,IADM;IAEbG,OAAO,EAAPA,OAFa;IAGbC,QAAQ,EAAE;MAAA,OAAMe,MAAM,EAAZ;IAAA,CAHG;IAIbC,MAAM,EAAE,cACJ,gCAAC,kBAAD;MAAQ,GAAG,EAAC,OAAZ;MAAoB,OAAO,EAAE;QAAA,OAAMD,MAAM,EAAZ;MAAA;IAA7B,kBADI,eAIJ,gCAAC,kBAAD;MAAQ,GAAG,EAAC,UAAZ;MAAuB,IAAI,EAAC,SAA5B;MAAsC,OAAO,EAAE;QAAA,OAAME,UAAU,CAACnB,WAAD,CAAhB;MAAA;IAA/C,kBAJI;EAJK,CAAjB;;EAaA,IAAIH,IAAI,IAAI,MAAZ,EAAoB;IAChBkB,UAAU,mCACHA,UADG;MAENK,aAAa,EAAE;IAFT,EAAV;EAIH;;EACD,IAAIvB,IAAI,IAAI,OAAZ,EAAqB;IACjBkB,UAAU,mCACHA,UADG;MAENL,KAAK,EAAE;IAFD,EAAV;EAIH;;EAED,IAAMO,MAAM,GAAG,SAATA,MAAS,GAAM;IACjB;IACAd,MAAM,IAAIA,MAAM,CAACkB,OAAP,EAAV;IACAjB,KAAK,IAAIkB,YAAY,CAAClB,KAAD,CAArB;IACAF,QAAQ;EACX,CALD;;EAOA,oBACI,gCAAC,iBAAD,EAAWa,UAAX,EACKlB,IAAI,IAAI,MAAR,gBACG;IACI,GAAG,EAAEE,GADT;IAEI,KAAK,EAAE;MAAEY,MAAM,EAAE,MAAV;MAAkBD,KAAK,EAAE,MAAzB;MAAiCa,MAAM,EAAE;IAAzC;EAFX,EADH,GAKG,IANR,EAOK1B,IAAI,IAAI,OAAR,gBAAkB;IAAK,EAAE,EAAC;EAAR,EAAlB,GAAwC,IAP7C,CADJ;AAWH;;AAEDF,OAAO,CAAC6B,SAAR,GAAoB;EAChB3B,IAAI,EAAE4B,qBAAA,CAAUC,MADA;EAEhB5B,IAAI,EAAE2B,qBAAA,CAAUC,MAFA;EAGhB3B,GAAG,EAAE0B,qBAAA,CAAUC,MAHC;EAIhBzB,OAAO,EAAEwB,qBAAA,CAAUE,IAJH;EAKhBzB,QAAQ,EAAEuB,qBAAA,CAAUG,IALJ;EAMhB5B,WAAW,EAAEyB,qBAAA,CAAUC;AANP,CAApB;eASe/B,O;;;AAEf,IAAMwB,UAAU,GAAG,SAAbA,UAAa,CAASU,MAAT,EAAiB;EAChC,IAAMC,OAAO,GAAGxB,QAAQ,CAACyB,aAAT,CAAuB,MAAvB,CAAhB,CADgC,CACgB;;EAChDD,OAAO,CAACE,MAAR,GAAiB,MAAjB;EACAF,OAAO,CAACG,MAAR,GAAiBJ,MAAjB;EACAC,OAAO,CAACI,KAAR,GAAgB,cAAhB;EACA5B,QAAQ,CAAC6B,IAAT,CAAcC,WAAd,CAA0BN,OAA1B,EALgC,CAKI;;EACpCA,OAAO,CAACO,MAAR,GANgC,CAMd;;EAClBP,OAAO,CAACQ,MAAR;AACH,CARD"}
|
package/lib/vtx-upload/index.js
CHANGED
|
@@ -1,49 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports["default"] = void 0;
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
9
12
|
var _useSetState3 = _interopRequireDefault(require("ahooks/es/useSetState"));
|
|
13
|
+
|
|
10
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
11
16
|
var _viewerjs = _interopRequireDefault(require("viewerjs"));
|
|
17
|
+
|
|
12
18
|
var _upload = _interopRequireDefault(require("antd/lib/upload"));
|
|
19
|
+
|
|
13
20
|
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
21
|
+
|
|
14
22
|
var _InboxOutlined = _interopRequireDefault(require("@ant-design/icons/InboxOutlined"));
|
|
23
|
+
|
|
15
24
|
var _PlusOutlined = _interopRequireDefault(require("@ant-design/icons/PlusOutlined"));
|
|
25
|
+
|
|
16
26
|
var _UploadOutlined = _interopRequireDefault(require("@ant-design/icons/UploadOutlined"));
|
|
27
|
+
|
|
17
28
|
var _message = _interopRequireDefault(require("antd/lib/message"));
|
|
29
|
+
|
|
18
30
|
var _downloadFile = _interopRequireDefault(require("@vtx/utils/lib/downloadFile"));
|
|
31
|
+
|
|
19
32
|
var _lodash = _interopRequireDefault(require("lodash.debounce"));
|
|
33
|
+
|
|
20
34
|
var _FilePreview = _interopRequireDefault(require("./FilePreview"));
|
|
35
|
+
|
|
21
36
|
var _getUrlParam = _interopRequireDefault(require("../_util/getUrlParam"));
|
|
37
|
+
|
|
22
38
|
var _excluded = ["isDragger", "draggerConfig", "accept", "mode", "viewMode", "showUploadList", "customizedButton", "listType", "onSuccess", "onError", "onRemove", "maxFileSize", "beforeUpload", "maxNum", "flag"];
|
|
39
|
+
|
|
23
40
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
41
|
+
|
|
24
42
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
43
|
+
|
|
25
44
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
45
|
+
|
|
26
46
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
47
|
+
|
|
27
48
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
49
|
+
|
|
28
50
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
51
|
+
|
|
29
52
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
53
|
+
|
|
30
54
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
55
|
+
|
|
31
56
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
57
|
+
|
|
32
58
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
59
|
+
|
|
33
60
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
61
|
+
|
|
34
62
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
63
|
+
|
|
35
64
|
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."); }
|
|
65
|
+
|
|
36
66
|
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); }
|
|
67
|
+
|
|
37
68
|
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; }
|
|
69
|
+
|
|
38
70
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
71
|
+
|
|
39
72
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
73
|
+
|
|
40
74
|
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; }
|
|
75
|
+
|
|
41
76
|
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; }
|
|
77
|
+
|
|
42
78
|
var debouncedMessage = (0, _lodash["default"])(function (msg) {
|
|
43
79
|
_message["default"].error(msg);
|
|
44
|
-
}, 500);
|
|
80
|
+
}, 500); //文件预览
|
|
45
81
|
|
|
46
|
-
//文件预览
|
|
47
82
|
var initVPrev = {
|
|
48
83
|
type: '',
|
|
49
84
|
//video or file
|
|
@@ -55,86 +90,97 @@ var initVPrev = {
|
|
|
55
90
|
var initUrl = {
|
|
56
91
|
action: '/cloudFile/common/uploadFile',
|
|
57
92
|
downloadUrl: '/cloudFile/common/downloadFile?id=',
|
|
58
|
-
thumbnailUrl: '/vortex/rest/cloud/np/file/downloadFileThumbnail?outputQuality=0.5&scale=0.2&id='
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
|
|
93
|
+
thumbnailUrl: '/vortex/rest/cloud/np/file/downloadFileThumbnail?outputQuality=0.5&scale=0.2&id=' //previewUrl: '/onlinePreview',
|
|
94
|
+
|
|
95
|
+
}; //禁止上传的文件类型
|
|
96
|
+
|
|
62
97
|
var rejectTypes = ['.asp', '.aspx', '.jsp', '.exe', '.cgi', '.asa', '.cer', '.cdx', '.hta'];
|
|
63
98
|
var Dragger = _upload["default"].Dragger;
|
|
64
99
|
var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
65
100
|
var _props$isDragger = props.isDragger,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
101
|
+
isDragger = _props$isDragger === void 0 ? false : _props$isDragger,
|
|
102
|
+
_props$draggerConfig = props.draggerConfig,
|
|
103
|
+
draggerConfig = _props$draggerConfig === void 0 ? {} : _props$draggerConfig,
|
|
104
|
+
accept = props.accept,
|
|
105
|
+
_props$mode = props.mode,
|
|
106
|
+
mode = _props$mode === void 0 ? 'multiple' : _props$mode,
|
|
107
|
+
viewMode = props.viewMode,
|
|
108
|
+
showUploadList = props.showUploadList,
|
|
109
|
+
customizedButton = props.customizedButton,
|
|
110
|
+
_props$listType = props.listType,
|
|
111
|
+
listType = _props$listType === void 0 ? 'text' : _props$listType,
|
|
112
|
+
onSuccess = props.onSuccess,
|
|
113
|
+
onError = props.onError,
|
|
114
|
+
_onRemove = props.onRemove,
|
|
115
|
+
_props$maxFileSize = props.maxFileSize,
|
|
116
|
+
maxFileSize = _props$maxFileSize === void 0 ? 5 * 1024 * 1024 : _props$maxFileSize,
|
|
117
|
+
_beforeUpload = props.beforeUpload,
|
|
118
|
+
maxNum = props.maxNum,
|
|
119
|
+
flag = props.flag,
|
|
120
|
+
rest = _objectWithoutProperties(props, _excluded); // 是否使用缩略图
|
|
121
|
+
|
|
122
|
+
|
|
87
123
|
var useThumbnail = (props.useThumbnail === undefined ? true : props.useThumbnail) && (listType == 'picture' || listType == 'picture-card');
|
|
124
|
+
|
|
88
125
|
var _useState = (0, _react.useState)([]),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
126
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
127
|
+
fileList = _useState2[0],
|
|
128
|
+
setFileList = _useState2[1]; //初始化文件列表
|
|
129
|
+
|
|
130
|
+
|
|
92
131
|
var _useState3 = (0, _react.useState)(null),
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
132
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
133
|
+
imageViewer = _useState4[0],
|
|
134
|
+
setImageViewer = _useState4[1]; //图片预览
|
|
135
|
+
|
|
136
|
+
|
|
96
137
|
var _useState5 = (0, _react.useState)([]),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
138
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
139
|
+
imageList = _useState6[0],
|
|
140
|
+
setImageList = _useState6[1];
|
|
141
|
+
|
|
100
142
|
var _useState7 = (0, _react.useState)(null),
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
var _useSetState = (0, _useSetState3["default"])(initVPrev),
|
|
105
|
-
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
106
|
-
vPrev = _useSetState2[0],
|
|
107
|
-
setVPrev = _useSetState2[1]; //文件预览相关
|
|
143
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
144
|
+
imageCt = _useState8[0],
|
|
145
|
+
setImageCt = _useState8[1];
|
|
108
146
|
|
|
147
|
+
var _useSetState = (0, _useSetState3["default"])(initVPrev),
|
|
148
|
+
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
149
|
+
vPrev = _useSetState2[0],
|
|
150
|
+
setVPrev = _useSetState2[1]; //文件预览相关
|
|
109
151
|
// 参数中拼接token
|
|
152
|
+
|
|
153
|
+
|
|
110
154
|
function joinToken(str) {
|
|
111
155
|
if (str.indexOf('token=') === -1 && str.indexOf('?') > -1) {
|
|
112
156
|
return str.replace('?', "?token=".concat((0, _getUrlParam["default"])('token') || '', "&"));
|
|
113
157
|
} else if (str.indexOf('?') === -1) {
|
|
114
158
|
return str + "?token=".concat((0, _getUrlParam["default"])('token') || '');
|
|
115
159
|
}
|
|
160
|
+
|
|
116
161
|
return str;
|
|
117
162
|
}
|
|
163
|
+
|
|
118
164
|
var url = {
|
|
119
165
|
action: props.action || initUrl.action,
|
|
120
166
|
downloadUrl: joinToken(props.downloadUrl || initUrl.downloadUrl),
|
|
121
|
-
thumbnailUrl: joinToken(props.thumbnailUrl || initUrl.thumbnailUrl)
|
|
122
|
-
//previewUrl: props.previewUrl || initUrl.previewUrl,
|
|
123
|
-
};
|
|
167
|
+
thumbnailUrl: joinToken(props.thumbnailUrl || initUrl.thumbnailUrl) //previewUrl: props.previewUrl || initUrl.previewUrl,
|
|
124
168
|
|
|
169
|
+
};
|
|
125
170
|
var action = url.action,
|
|
126
|
-
|
|
127
|
-
|
|
171
|
+
downloadUrl = url.downloadUrl,
|
|
172
|
+
thumbnailUrl = url.thumbnailUrl;
|
|
128
173
|
(0, _react.useEffect)(function () {
|
|
129
174
|
setFileList(getSynFileList(props) || []);
|
|
130
175
|
}, [flag]);
|
|
131
176
|
(0, _react.useEffect)(function () {
|
|
132
177
|
if (Array.isArray(fileList)) {
|
|
133
178
|
// 只有图片的才可以预览,这边需要判断是否是图片
|
|
134
|
-
var imagelist = [];
|
|
135
|
-
|
|
179
|
+
var imagelist = []; // 只能通过后缀来判断
|
|
180
|
+
|
|
136
181
|
fileList.map(function (file) {
|
|
137
182
|
var _file$type;
|
|
183
|
+
|
|
138
184
|
if (((_file$type = file.type) === null || _file$type === void 0 ? void 0 : _file$type.indexOf('image')) > -1) {
|
|
139
185
|
imagelist.push(file);
|
|
140
186
|
}
|
|
@@ -147,8 +193,10 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
147
193
|
setImageViewer(new _viewerjs["default"](imageCt, {}));
|
|
148
194
|
}
|
|
149
195
|
}, [imageCt]);
|
|
196
|
+
|
|
150
197
|
var getConfig = function getConfig() {
|
|
151
198
|
var token = (0, _getUrlParam["default"])('token') || '';
|
|
199
|
+
|
|
152
200
|
var config = _objectSpread(_objectSpread({}, rest), {}, {
|
|
153
201
|
accept: accept,
|
|
154
202
|
action: action,
|
|
@@ -160,14 +208,18 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
160
208
|
}, rest.headers),
|
|
161
209
|
onChange: function onChange(info) {
|
|
162
210
|
setFileList(info.fileList);
|
|
211
|
+
|
|
163
212
|
if (info.file.response && info.file.response.result === 1) {
|
|
164
213
|
_message["default"].error(info.file.response.errMsg || '上传失败!');
|
|
214
|
+
|
|
165
215
|
var flt = _toConsumableArray(fileList);
|
|
216
|
+
|
|
166
217
|
flt.pop();
|
|
167
218
|
setFileList(flt);
|
|
168
219
|
return;
|
|
169
|
-
}
|
|
170
|
-
|
|
220
|
+
} // 此处根据后台返回的数据结构取得文件ID
|
|
221
|
+
|
|
222
|
+
|
|
171
223
|
if (info.file.status !== 'uploading' && info.file.status !== 'removed') {
|
|
172
224
|
var vtxId = info.file.response && Array.isArray(info.file.response.data) && info.file.response.data.length > 0 ? info.file.response.data[0].id : undefined;
|
|
173
225
|
var newFileList = info.fileList;
|
|
@@ -188,21 +240,23 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
188
240
|
thumbUrl: useThumbnail ? thumbnailUrl + vtxId : undefined
|
|
189
241
|
});
|
|
190
242
|
}
|
|
243
|
+
|
|
191
244
|
return item;
|
|
192
245
|
});
|
|
246
|
+
|
|
193
247
|
if (mode == 'single') {
|
|
194
248
|
setFileList([newFile]);
|
|
195
249
|
} else {
|
|
196
250
|
setFileList(newFileList);
|
|
197
|
-
}
|
|
198
|
-
// 更新组件状态
|
|
251
|
+
} // 更新组件状态
|
|
199
252
|
// if (mode == 'single' && info.file.status === 'done') {
|
|
200
253
|
// setFileList([newFile]);
|
|
201
254
|
// } else {
|
|
202
255
|
// setFileList(newFileList);
|
|
203
256
|
// }
|
|
204
|
-
|
|
205
257
|
// 触发外部方法
|
|
258
|
+
|
|
259
|
+
|
|
206
260
|
if (info.file.status === 'done') {
|
|
207
261
|
if (typeof onSuccess == 'function') {
|
|
208
262
|
onSuccess(newFile);
|
|
@@ -223,37 +277,48 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
223
277
|
//限制文件大小
|
|
224
278
|
if (maxFileSize && typeof maxFileSize === 'number') {
|
|
225
279
|
var limit = file.size < maxFileSize;
|
|
280
|
+
|
|
226
281
|
if (!limit) {
|
|
227
282
|
_message["default"].error("\u8BF7\u4E0A\u4F20".concat(maxFileSize / 1024 / 1024, "M\u4EE5\u5185\u7684\u6587\u4EF6"));
|
|
283
|
+
|
|
228
284
|
return false;
|
|
229
285
|
}
|
|
230
|
-
}
|
|
231
|
-
|
|
286
|
+
} //限制不允许上传的文件类型(通过文件名后缀)
|
|
287
|
+
|
|
288
|
+
|
|
232
289
|
var pointIndex = file.name ? file.name.lastIndexOf('.') : -1;
|
|
290
|
+
|
|
233
291
|
if (pointIndex > -1) {
|
|
234
292
|
var fileType = file.name.substring(pointIndex);
|
|
293
|
+
|
|
235
294
|
if (rejectTypes.includes(fileType)) {
|
|
236
295
|
_message["default"].error('不支持该文件类型');
|
|
296
|
+
|
|
237
297
|
return false;
|
|
238
298
|
}
|
|
239
|
-
}
|
|
240
|
-
|
|
299
|
+
} // 多选限制文件数量
|
|
300
|
+
|
|
301
|
+
|
|
241
302
|
if (typeof maxNum === 'number' && afterFileList.length + fileList.length > maxNum) {
|
|
242
303
|
// 减少提示错误次数, 思路,防抖 这边有个问题 就是防抖的这个方法 return fasle 不上传
|
|
243
304
|
debouncedMessage("\u6700\u591A\u4E0A\u4F20".concat(maxNum, "\u4E2A"));
|
|
244
305
|
return false;
|
|
245
306
|
}
|
|
307
|
+
|
|
246
308
|
if (typeof _beforeUpload === 'function') {
|
|
247
309
|
return _beforeUpload(file, afterFileList);
|
|
248
310
|
}
|
|
311
|
+
|
|
249
312
|
return true;
|
|
250
313
|
}
|
|
251
314
|
});
|
|
315
|
+
|
|
252
316
|
if (props.onPreview && typeof props.onPreview === 'function') {
|
|
253
317
|
config.onPreview = props.onPreview;
|
|
254
318
|
} else {
|
|
255
319
|
config.onPreview = function (file) {
|
|
256
320
|
var _file$type2, _file$type3;
|
|
321
|
+
|
|
257
322
|
if (!file.type) {
|
|
258
323
|
(0, _downloadFile["default"])(downloadUrl + file.id, {
|
|
259
324
|
fileName: file.name
|
|
@@ -273,9 +338,7 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
273
338
|
(0, _downloadFile["default"])(downloadUrl + file.id, {
|
|
274
339
|
fileName: file.name
|
|
275
340
|
}, 'blob');
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// TODO 暂无好的文件预览服务,等后续完善,只提供下载
|
|
341
|
+
} // TODO 暂无好的文件预览服务,等后续完善,只提供下载
|
|
279
342
|
// else if (
|
|
280
343
|
// file.type == 'application/PDF' ||
|
|
281
344
|
// file.type == 'application/vnd.ms-excel' ||
|
|
@@ -293,7 +356,6 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
293
356
|
// '?id=' + file.id + '&fullfilename=' + file.name.replace(/\s*/g, ''),
|
|
294
357
|
// )}`;
|
|
295
358
|
// }
|
|
296
|
-
|
|
297
359
|
// setVPrev({
|
|
298
360
|
// type: 'file',
|
|
299
361
|
// name: file.name || '文件预览',
|
|
@@ -302,17 +364,20 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
302
364
|
// visible: true,
|
|
303
365
|
// });
|
|
304
366
|
// }
|
|
367
|
+
|
|
305
368
|
};
|
|
306
|
-
}
|
|
369
|
+
} // viewMode
|
|
370
|
+
|
|
307
371
|
|
|
308
|
-
// viewMode
|
|
309
372
|
if (viewMode) {
|
|
310
373
|
config.showUploadList = {
|
|
311
374
|
showRemoveIcon: false
|
|
312
375
|
};
|
|
313
376
|
}
|
|
377
|
+
|
|
314
378
|
return config;
|
|
315
379
|
};
|
|
380
|
+
|
|
316
381
|
var handlePreview = function handlePreview(file) {
|
|
317
382
|
var imageIndex = imageList.map(function (item) {
|
|
318
383
|
return item.id;
|
|
@@ -321,18 +386,21 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
321
386
|
imageViewer.update();
|
|
322
387
|
imageViewer.view(imageIndex);
|
|
323
388
|
};
|
|
389
|
+
|
|
324
390
|
var getSynFileList = function getSynFileList(props) {
|
|
325
|
-
var processedFileList = props.fileList || [];
|
|
326
|
-
|
|
391
|
+
var processedFileList = props.fileList || []; // 单文件模式只取第一个
|
|
392
|
+
|
|
327
393
|
if (props.mode == 'single' && processedFileList.length > 1) {
|
|
328
394
|
processedFileList = [processedFileList[0]];
|
|
329
395
|
}
|
|
396
|
+
|
|
330
397
|
processedFileList = processedFileList.map(function (item, index) {
|
|
331
398
|
// 将外部传入的简易文件数组处理成为组件需要的数组结构
|
|
332
399
|
if (item.name === undefined || item.id === undefined) {
|
|
333
400
|
// eslint-disable-next-line no-console
|
|
334
401
|
console.error('文件列表的name和id属性不能为空');
|
|
335
402
|
}
|
|
403
|
+
|
|
336
404
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
337
405
|
uid: -1 - index,
|
|
338
406
|
status: 'done',
|
|
@@ -342,6 +410,7 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
342
410
|
});
|
|
343
411
|
return processedFileList;
|
|
344
412
|
};
|
|
413
|
+
|
|
345
414
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isDragger ? /*#__PURE__*/_react["default"].createElement(Dragger, _extends({}, getConfig(), {
|
|
346
415
|
ref: ref
|
|
347
416
|
}), draggerConfig !== null && draggerConfig !== void 0 && draggerConfig.img ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
@@ -378,6 +447,7 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
378
447
|
}
|
|
379
448
|
}, imageList.filter(function (item) {
|
|
380
449
|
var _item$type;
|
|
450
|
+
|
|
381
451
|
return item.type && ((_item$type = item.type) === null || _item$type === void 0 ? void 0 : _item$type.indexOf('image')) > -1;
|
|
382
452
|
}).map(function (item, index) {
|
|
383
453
|
return /*#__PURE__*/_react["default"].createElement("li", {
|