@vtx/components 3.1.16 → 3.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -19
- package/lib/_util/filterSpecialCharacters.js +60 -49
- package/lib/_util/filterSpecialCharacters.js.map +1 -1
- package/lib/_util/getComponentProps.js +0 -3
- package/lib/_util/getComponentProps.js.map +1 -1
- package/lib/_util/getUrlParam.js +0 -6
- package/lib/_util/getUrlParam.js.map +1 -1
- package/lib/_util/isFunction.js +0 -1
- package/lib/_util/isFunction.js.map +1 -1
- package/lib/_util/isObject.js +0 -1
- package/lib/_util/isObject.js.map +1 -1
- package/lib/_util/useColSize.js +1 -10
- package/lib/_util/useColSize.js.map +1 -1
- package/lib/_util/useInterval.js +0 -3
- package/lib/_util/useInterval.js.map +1 -1
- package/lib/_util/useSet.js +14 -32
- package/lib/_util/useSet.js.map +1 -1
- package/lib/config.js.map +1 -1
- package/lib/index.js +0 -25
- 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 +5 -21
- package/lib/vtx-color-picker/index.js.map +1 -1
- package/lib/vtx-color-picker/style/css.js +0 -2
- package/lib/vtx-color-picker/style/css.js.map +1 -1
- package/lib/vtx-color-picker/style/index.js +0 -2
- 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 +34 -74
- package/lib/vtx-combogrid/Combogrid.js.map +1 -1
- package/lib/vtx-combogrid/index.js +20 -45
- package/lib/vtx-combogrid/index.js.map +1 -1
- package/lib/vtx-combogrid/style/css.js +0 -7
- package/lib/vtx-combogrid/style/css.js.map +1 -1
- package/lib/vtx-combogrid/style/index.js +0 -7
- 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 +3 -11
- package/lib/vtx-datagrid/Alert.js.map +1 -1
- package/lib/vtx-datagrid/ColumnSetting.js +19 -44
- package/lib/vtx-datagrid/ColumnSetting.js.map +1 -1
- package/lib/vtx-datagrid/ResizeableTitle.js +2 -13
- package/lib/vtx-datagrid/ResizeableTitle.js.map +1 -1
- package/lib/vtx-datagrid/index.js +77 -140
- package/lib/vtx-datagrid/index.js.map +1 -1
- package/lib/vtx-datagrid/renderColumnButtons.js +5 -35
- package/lib/vtx-datagrid/renderColumnButtons.js.map +1 -1
- package/lib/vtx-datagrid/style/css.js +0 -10
- package/lib/vtx-datagrid/style/css.js.map +1 -1
- package/lib/vtx-datagrid/style/index.css +1 -0
- package/lib/vtx-datagrid/style/index.js +0 -10
- package/lib/vtx-datagrid/style/index.js.map +1 -1
- package/lib/vtx-datagrid/style/index.less +1 -0
- package/lib/vtx-date-picker/QdatePicker.js +16 -46
- package/lib/vtx-date-picker/QdatePicker.js.map +1 -1
- package/lib/vtx-date-picker/generatePicker.js +6 -47
- package/lib/vtx-date-picker/generatePicker.js.map +1 -1
- package/lib/vtx-date-picker/index.js +0 -5
- package/lib/vtx-date-picker/index.js.map +1 -1
- package/lib/vtx-date-picker/style/css.js +0 -1
- package/lib/vtx-date-picker/style/css.js.map +1 -1
- package/lib/vtx-date-picker/style/index.js +0 -1
- 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 +5 -23
- package/lib/vtx-editor/index.js.map +1 -1
- package/lib/vtx-editor/style/css.js +0 -1
- package/lib/vtx-editor/style/css.js.map +1 -1
- package/lib/vtx-editor/style/index.js +0 -1
- 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 +6 -20
- package/lib/vtx-ellipsis-text/index.js.map +1 -1
- package/lib/vtx-ellipsis-text/style/css.js +0 -1
- package/lib/vtx-ellipsis-text/style/css.js.map +1 -1
- package/lib/vtx-ellipsis-text/style/index.js +0 -1
- 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 +33 -66
- package/lib/vtx-export/index.js.map +1 -1
- package/lib/vtx-export/style/css.js +0 -5
- package/lib/vtx-export/style/css.js.map +1 -1
- package/lib/vtx-export/style/index.js +0 -5
- 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 +5 -26
- package/lib/vtx-form-layout/Card.js.map +1 -1
- package/lib/vtx-form-layout/Divider.js +0 -8
- package/lib/vtx-form-layout/Divider.js.map +1 -1
- package/lib/vtx-form-layout/FormItem.js +8 -30
- package/lib/vtx-form-layout/FormItem.js.map +1 -1
- package/lib/vtx-form-layout/Pane.js +2 -7
- package/lib/vtx-form-layout/Pane.js.map +1 -1
- package/lib/vtx-form-layout/Row.js +0 -6
- package/lib/vtx-form-layout/Row.js.map +1 -1
- package/lib/vtx-form-layout/context.js +0 -2
- 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 +8 -22
- package/lib/vtx-form-layout/index.js.map +1 -1
- package/lib/vtx-form-layout/style/css.js +0 -7
- package/lib/vtx-form-layout/style/css.js.map +1 -1
- package/lib/vtx-form-layout/style/index.js +0 -7
- package/lib/vtx-form-layout/style/index.js.map +1 -1
- package/lib/vtx-image/Image.js +56 -92
- package/lib/vtx-image/Image.js.map +1 -1
- package/lib/vtx-image/Preview.js +20 -51
- package/lib/vtx-image/Preview.js.map +1 -1
- package/lib/vtx-image/PreviewGroup.js +11 -40
- package/lib/vtx-image/PreviewGroup.js.map +1 -1
- package/lib/vtx-image/index.js +0 -6
- package/lib/vtx-image/index.js.map +1 -1
- package/lib/vtx-image/style/css.js +0 -1
- package/lib/vtx-image/style/css.js.map +1 -1
- package/lib/vtx-image/style/index.js +0 -1
- 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 +37 -72
- package/lib/vtx-import/index.js.map +1 -1
- package/lib/vtx-import/result.js +7 -24
- package/lib/vtx-import/result.js.map +1 -1
- package/lib/vtx-import/style/css.js +0 -3
- package/lib/vtx-import/style/css.js.map +1 -1
- package/lib/vtx-import/style/index.js +0 -3
- 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 +0 -6
- package/lib/vtx-import2/CheckResult.js.map +1 -1
- package/lib/vtx-import2/Content.js +4 -25
- package/lib/vtx-import2/Content.js.map +1 -1
- package/lib/vtx-import2/DownloadSvg.js +0 -4
- package/lib/vtx-import2/DownloadSvg.js.map +1 -1
- package/lib/vtx-import2/ImportResult.js +3 -9
- package/lib/vtx-import2/ImportResult.js.map +1 -1
- package/lib/vtx-import2/UploadSvg.js +0 -4
- package/lib/vtx-import2/UploadSvg.js.map +1 -1
- package/lib/vtx-import2/index.js +34 -74
- package/lib/vtx-import2/index.js.map +1 -1
- package/lib/vtx-import2/style/css.js +0 -3
- package/lib/vtx-import2/style/css.js.map +1 -1
- package/lib/vtx-import2/style/index.js +0 -3
- 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 +6 -22
- package/lib/vtx-input/TextArea.js.map +1 -1
- package/lib/vtx-input/index.js +11 -37
- package/lib/vtx-input/index.js.map +1 -1
- package/lib/vtx-input/style/css.js +0 -1
- package/lib/vtx-input/style/css.js.map +1 -1
- package/lib/vtx-input/style/index.js +0 -1
- 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 +4 -16
- package/lib/vtx-input/useLength.js.map +1 -1
- package/lib/vtx-modal/Title.js +1 -6
- package/lib/vtx-modal/Title.js.map +1 -1
- package/lib/vtx-modal/index.js +32 -72
- package/lib/vtx-modal/index.js.map +1 -1
- package/lib/vtx-modal/style/css.js +0 -1
- package/lib/vtx-modal/style/css.js.map +1 -1
- package/lib/vtx-modal/style/index.js +0 -1
- 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 +4 -8
- package/lib/vtx-page-layout/Basic.js.map +1 -1
- package/lib/vtx-page-layout/Content.js +7 -19
- package/lib/vtx-page-layout/Content.js.map +1 -1
- package/lib/vtx-page-layout/Pane.js +2 -10
- package/lib/vtx-page-layout/Pane.js.map +1 -1
- package/lib/vtx-page-layout/TableLayout.js +25 -55
- package/lib/vtx-page-layout/TableLayout.js.map +1 -1
- package/lib/vtx-page-layout/TableWrap.js +3 -15
- package/lib/vtx-page-layout/TableWrap.js.map +1 -1
- package/lib/vtx-page-layout/container.js +4 -34
- package/lib/vtx-page-layout/container.js.map +1 -1
- package/lib/vtx-page-layout/index.js +0 -8
- 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 +21 -44
- 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 +21 -57
- 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 +0 -21
- package/lib/vtx-search/VtxCol.js.map +1 -1
- package/lib/vtx-search/VtxRow.js +6 -12
- package/lib/vtx-search/VtxRow.js.map +1 -1
- package/lib/vtx-search/index.js +43 -94
- package/lib/vtx-search/index.js.map +1 -1
- package/lib/vtx-search/style/css.js +0 -4
- package/lib/vtx-search/style/css.js.map +1 -1
- package/lib/vtx-search/style/index.js +0 -4
- 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 +56 -72
- package/lib/vtx-search-map-input/index.js.map +1 -1
- package/lib/vtx-search-map-input/style/css.js +0 -2
- package/lib/vtx-search-map-input/style/css.js.map +1 -1
- package/lib/vtx-search-map-input/style/index.js +0 -2
- package/lib/vtx-search-map-input/style/index.js.map +1 -1
- package/lib/vtx-select/index.js +20 -65
- package/lib/vtx-select/index.js.map +1 -1
- package/lib/vtx-select/style/css.js +0 -8
- package/lib/vtx-select/style/css.js.map +1 -1
- package/lib/vtx-select/style/index.js +0 -8
- 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 +14 -28
- package/lib/vtx-signature/index.js.map +1 -1
- package/lib/vtx-signature/style/css.js +0 -2
- package/lib/vtx-signature/style/css.js.map +1 -1
- package/lib/vtx-signature/style/index.js +0 -2
- 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 +2 -14
- package/lib/vtx-split-pane/Pane.js.map +1 -1
- package/lib/vtx-split-pane/Resizer.js +9 -29
- package/lib/vtx-split-pane/Resizer.js.map +1 -1
- package/lib/vtx-split-pane/SplitPane.js +43 -98
- package/lib/vtx-split-pane/SplitPane.js.map +1 -1
- package/lib/vtx-split-pane/index.js +0 -4
- package/lib/vtx-split-pane/index.js.map +1 -1
- package/lib/vtx-split-pane/style/css.js +0 -3
- package/lib/vtx-split-pane/style/css.js.map +1 -1
- package/lib/vtx-split-pane/style/index.js +0 -3
- 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 +1 -7
- package/lib/vtx-statistics-column/Back.js.map +1 -1
- package/lib/vtx-statistics-column/Item.js +5 -22
- package/lib/vtx-statistics-column/Item.js.map +1 -1
- package/lib/vtx-statistics-column/Total.js +5 -22
- package/lib/vtx-statistics-column/Total.js.map +1 -1
- package/lib/vtx-statistics-column/context.js +0 -2
- package/lib/vtx-statistics-column/context.js.map +1 -1
- package/lib/vtx-statistics-column/index.js +0 -16
- 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 +3 -16
- 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 +9 -28
- package/lib/vtx-upload/FilePreview.js.map +1 -1
- package/lib/vtx-upload/index.js +67 -137
- package/lib/vtx-upload/index.js.map +1 -1
- package/lib/vtx-upload/style/css.js +0 -5
- package/lib/vtx-upload/style/css.js.map +1 -1
- package/lib/vtx-upload/style/index.js +0 -5
- package/lib/vtx-upload/style/index.js.map +1 -1
- package/lib/vtx-upload/style/index.less +61 -61
- package/lib/vtx-ztree/index.js +51 -103
- package/lib/vtx-ztree/index.js.map +1 -1
- package/lib/vtx-ztree/style/css.js +0 -1
- package/lib/vtx-ztree/style/css.js.map +1 -1
- package/lib/vtx-ztree/style/index.js +0 -1
- 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 +43 -99
- package/lib/vtx-ztree-select/index.js.map +1 -1
- package/lib/vtx-ztree-select/style/css.js +0 -3
- package/lib/vtx-ztree-select/style/css.js.map +1 -1
- package/lib/vtx-ztree-select/style/index.js +0 -3
- package/lib/vtx-ztree-select/style/index.js.map +1 -1
- package/lib/vtx-ztree-select/style/index.less +74 -74
- package/package.json +123 -123
- package/CHANGELOG.md +0 -1137
|
@@ -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';\
|
|
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":";;;;;;AAAA;AACA;AACA;AACA;AAAmC;AAAA;AAAA;AAAA;AAAA;AAEnC,SAASA,aAAa,CAACC,KAAK,EAAEC,GAAG,EAAE;EAC/B,IAAQC,KAAK,GAAmCF,KAAK,CAA7CE,KAAK;IAAA,gBAAmCF,KAAK,CAAtCG,MAAM;IAANA,MAAM,8BAAG,UAAU;IAAKC,IAAI,4BAAKJ,KAAK;EACrD,IAAMK,QAAQ,GAAGH,KAAK,GAAII,kBAAM,CAACC,QAAQ,CAACL,KAAK,CAAC,GAAGA,KAAK,GAAG,IAAAI,kBAAM,EAACJ,KAAK,EAAEC,MAAM,CAAC,GAAI,IAAI;EACxF,oBAAO,gCAAC,sBAAU;IAAC,KAAK,EAAEE,QAAS;IAAC,MAAM,EAAEF;EAAO,GAAKC,IAAI;IAAE,GAAG,EAAEH;EAAI,GAAG;AAC9E;AAAC,4BAEcO,iBAAK,CAACC,UAAU,CAACV,aAAa,CAAC;AAAA;AAE9CA,aAAa,CAACW,SAAS,GAAG;EACtBR,KAAK,EAAES,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,MAAM,EAAEF,qBAAS,CAACG,UAAU,CAACR,kBAAM,CAAC,CAAC,CAAC;EAC5EH,MAAM,EAAEQ,qBAAS,CAACE;AACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.js","names":[],"sources":["vtx-time-picker/style/index.js"],"sourcesContent":["import 'antd/lib/time-picker/style/index';\
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["vtx-time-picker/style/index.js"],"sourcesContent":["import 'antd/lib/time-picker/style/index';\
|
|
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"}
|
|
@@ -4,36 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _simple_player = _interopRequireDefault(require("xgplayer/dist/simple_player"));
|
|
13
|
-
|
|
14
10
|
var _controls = require("xgplayer/dist/controls");
|
|
15
|
-
|
|
16
11
|
var _modal = _interopRequireDefault(require("antd/lib/modal"));
|
|
17
|
-
|
|
18
12
|
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
14
|
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
|
-
|
|
24
15
|
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
|
-
|
|
26
16
|
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
|
-
|
|
28
17
|
function Preview(props) {
|
|
29
18
|
var type = props.type,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
name = props.name,
|
|
20
|
+
url = props.url,
|
|
21
|
+
downloadUrl = props.downloadUrl,
|
|
22
|
+
visible = props.visible,
|
|
23
|
+
onCancel = props.onCancel;
|
|
35
24
|
var player = null,
|
|
36
|
-
|
|
25
|
+
timer = null;
|
|
37
26
|
timer = setTimeout(function () {
|
|
38
27
|
if (type == 'video' && document.getElementById('vs')) {
|
|
39
28
|
player = new _simple_player["default"]({
|
|
@@ -41,11 +30,12 @@ function Preview(props) {
|
|
|
41
30
|
url: url,
|
|
42
31
|
width: 600,
|
|
43
32
|
height: 337.5,
|
|
44
|
-
controlPlugins: [_controls.volume,
|
|
33
|
+
controlPlugins: [_controls.volume,
|
|
34
|
+
//音量
|
|
45
35
|
_controls.playbackRate //播放倍速
|
|
46
36
|
],
|
|
47
|
-
playbackRate: [0.5, 0.75, 1, 1.5, 2] //传入倍速可选数组
|
|
48
37
|
|
|
38
|
+
playbackRate: [0.5, 0.75, 1, 1.5, 2] //传入倍速可选数组
|
|
49
39
|
});
|
|
50
40
|
}
|
|
51
41
|
}, 500);
|
|
@@ -68,26 +58,22 @@ function Preview(props) {
|
|
|
68
58
|
}
|
|
69
59
|
}, "\u4E0B\u8F7D")]
|
|
70
60
|
};
|
|
71
|
-
|
|
72
61
|
if (type == 'file') {
|
|
73
62
|
modalProps = _objectSpread(_objectSpread({}, modalProps), {}, {
|
|
74
63
|
wrapClassName: 'vtx-modal-maxClass'
|
|
75
64
|
});
|
|
76
65
|
}
|
|
77
|
-
|
|
78
66
|
if (type == 'video') {
|
|
79
67
|
modalProps = _objectSpread(_objectSpread({}, modalProps), {}, {
|
|
80
68
|
width: 648
|
|
81
69
|
});
|
|
82
70
|
}
|
|
83
|
-
|
|
84
71
|
var cancel = function cancel() {
|
|
85
72
|
//销毁播放器
|
|
86
73
|
player && player.destroy();
|
|
87
74
|
timer && clearTimeout(timer);
|
|
88
75
|
onCancel();
|
|
89
76
|
};
|
|
90
|
-
|
|
91
77
|
return /*#__PURE__*/_react["default"].createElement(_modal["default"], modalProps, type == 'file' ? /*#__PURE__*/_react["default"].createElement("iframe", {
|
|
92
78
|
src: url,
|
|
93
79
|
style: {
|
|
@@ -99,7 +85,6 @@ function Preview(props) {
|
|
|
99
85
|
id: "vs"
|
|
100
86
|
}) : null);
|
|
101
87
|
}
|
|
102
|
-
|
|
103
88
|
Preview.propTypes = {
|
|
104
89
|
type: _propTypes["default"].string,
|
|
105
90
|
name: _propTypes["default"].string,
|
|
@@ -110,17 +95,13 @@ Preview.propTypes = {
|
|
|
110
95
|
};
|
|
111
96
|
var _default = Preview;
|
|
112
97
|
exports["default"] = _default;
|
|
113
|
-
|
|
114
98
|
var createForm = function createForm(reqURL) {
|
|
115
99
|
var formDom = document.createElement('form'); // 定义一个form表单
|
|
116
|
-
|
|
117
100
|
formDom.method = 'post';
|
|
118
101
|
formDom.action = reqURL;
|
|
119
102
|
formDom.style = 'display:none';
|
|
120
103
|
document.body.appendChild(formDom); // 将表单放置在web中
|
|
121
|
-
|
|
122
104
|
formDom.submit(); // 表单提交
|
|
123
|
-
|
|
124
105
|
formDom.remove();
|
|
125
106
|
};
|
|
126
107
|
//# 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';\
|
|
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":"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"}
|
package/lib/vtx-upload/index.js
CHANGED
|
@@ -1,84 +1,49 @@
|
|
|
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
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _useSetState3 = _interopRequireDefault(require("ahooks/es/useSetState"));
|
|
13
|
-
|
|
14
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _viewerjs = _interopRequireDefault(require("viewerjs"));
|
|
17
|
-
|
|
18
12
|
var _upload = _interopRequireDefault(require("antd/lib/upload"));
|
|
19
|
-
|
|
20
13
|
var _button = _interopRequireDefault(require("antd/lib/button"));
|
|
21
|
-
|
|
22
14
|
var _InboxOutlined = _interopRequireDefault(require("@ant-design/icons/InboxOutlined"));
|
|
23
|
-
|
|
24
15
|
var _PlusOutlined = _interopRequireDefault(require("@ant-design/icons/PlusOutlined"));
|
|
25
|
-
|
|
26
16
|
var _UploadOutlined = _interopRequireDefault(require("@ant-design/icons/UploadOutlined"));
|
|
27
|
-
|
|
28
17
|
var _message = _interopRequireDefault(require("antd/lib/message"));
|
|
29
|
-
|
|
30
18
|
var _downloadFile = _interopRequireDefault(require("@vtx/utils/lib/downloadFile"));
|
|
31
|
-
|
|
32
19
|
var _lodash = _interopRequireDefault(require("lodash.debounce"));
|
|
33
|
-
|
|
34
20
|
var _FilePreview = _interopRequireDefault(require("./FilePreview"));
|
|
35
|
-
|
|
36
21
|
var _getUrlParam = _interopRequireDefault(require("../_util/getUrlParam"));
|
|
37
|
-
|
|
38
22
|
var _excluded = ["isDragger", "draggerConfig", "accept", "mode", "viewMode", "showUploadList", "customizedButton", "listType", "onSuccess", "onError", "onRemove", "maxFileSize", "beforeUpload", "maxNum", "flag"];
|
|
39
|
-
|
|
40
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
41
|
-
|
|
42
24
|
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
|
-
|
|
44
25
|
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
|
-
|
|
46
26
|
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
|
-
|
|
48
27
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
49
|
-
|
|
50
28
|
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
|
-
|
|
52
29
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
53
|
-
|
|
54
30
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
55
|
-
|
|
56
31
|
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
|
-
|
|
58
32
|
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
|
-
|
|
60
33
|
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
|
-
|
|
62
34
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
63
|
-
|
|
64
35
|
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
|
-
|
|
66
36
|
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
|
-
|
|
68
37
|
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
|
-
|
|
70
38
|
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
|
-
|
|
72
39
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
73
|
-
|
|
74
40
|
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
|
-
|
|
76
41
|
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
|
-
|
|
78
42
|
var debouncedMessage = (0, _lodash["default"])(function (msg) {
|
|
79
43
|
_message["default"].error(msg);
|
|
80
|
-
}, 500);
|
|
44
|
+
}, 500);
|
|
81
45
|
|
|
46
|
+
//文件预览
|
|
82
47
|
var initVPrev = {
|
|
83
48
|
type: '',
|
|
84
49
|
//video or file
|
|
@@ -90,97 +55,86 @@ var initVPrev = {
|
|
|
90
55
|
var initUrl = {
|
|
91
56
|
action: '/cloudFile/common/uploadFile',
|
|
92
57
|
downloadUrl: '/cloudFile/common/downloadFile?id=',
|
|
93
|
-
thumbnailUrl: '/vortex/rest/cloud/np/file/downloadFileThumbnail?outputQuality=0.5&scale=0.2&id='
|
|
94
|
-
|
|
95
|
-
};
|
|
96
|
-
|
|
58
|
+
thumbnailUrl: '/vortex/rest/cloud/np/file/downloadFileThumbnail?outputQuality=0.5&scale=0.2&id='
|
|
59
|
+
//previewUrl: '/onlinePreview',
|
|
60
|
+
};
|
|
61
|
+
//禁止上传的文件类型
|
|
97
62
|
var rejectTypes = ['.asp', '.aspx', '.jsp', '.exe', '.cgi', '.asa', '.cer', '.cdx', '.hta'];
|
|
98
63
|
var Dragger = _upload["default"].Dragger;
|
|
99
64
|
var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
100
65
|
var _props$isDragger = props.isDragger,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
66
|
+
isDragger = _props$isDragger === void 0 ? false : _props$isDragger,
|
|
67
|
+
_props$draggerConfig = props.draggerConfig,
|
|
68
|
+
draggerConfig = _props$draggerConfig === void 0 ? {} : _props$draggerConfig,
|
|
69
|
+
accept = props.accept,
|
|
70
|
+
_props$mode = props.mode,
|
|
71
|
+
mode = _props$mode === void 0 ? 'multiple' : _props$mode,
|
|
72
|
+
viewMode = props.viewMode,
|
|
73
|
+
showUploadList = props.showUploadList,
|
|
74
|
+
customizedButton = props.customizedButton,
|
|
75
|
+
_props$listType = props.listType,
|
|
76
|
+
listType = _props$listType === void 0 ? 'text' : _props$listType,
|
|
77
|
+
onSuccess = props.onSuccess,
|
|
78
|
+
onError = props.onError,
|
|
79
|
+
_onRemove = props.onRemove,
|
|
80
|
+
_props$maxFileSize = props.maxFileSize,
|
|
81
|
+
maxFileSize = _props$maxFileSize === void 0 ? 5 * 1024 * 1024 : _props$maxFileSize,
|
|
82
|
+
_beforeUpload = props.beforeUpload,
|
|
83
|
+
maxNum = props.maxNum,
|
|
84
|
+
flag = props.flag,
|
|
85
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
86
|
+
// 是否使用缩略图
|
|
123
87
|
var useThumbnail = (props.useThumbnail === undefined ? true : props.useThumbnail) && (listType == 'picture' || listType == 'picture-card');
|
|
124
|
-
|
|
125
88
|
var _useState = (0, _react.useState)([]),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
89
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
90
|
+
fileList = _useState2[0],
|
|
91
|
+
setFileList = _useState2[1]; //初始化文件列表
|
|
131
92
|
var _useState3 = (0, _react.useState)(null),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
93
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
94
|
+
imageViewer = _useState4[0],
|
|
95
|
+
setImageViewer = _useState4[1]; //图片预览
|
|
137
96
|
var _useState5 = (0, _react.useState)([]),
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
97
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
98
|
+
imageList = _useState6[0],
|
|
99
|
+
setImageList = _useState6[1];
|
|
142
100
|
var _useState7 = (0, _react.useState)(null),
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
101
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
102
|
+
imageCt = _useState8[0],
|
|
103
|
+
setImageCt = _useState8[1];
|
|
147
104
|
var _useSetState = (0, _useSetState3["default"])(initVPrev),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// 参数中拼接token
|
|
152
|
-
|
|
105
|
+
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
106
|
+
vPrev = _useSetState2[0],
|
|
107
|
+
setVPrev = _useSetState2[1]; //文件预览相关
|
|
153
108
|
|
|
109
|
+
// 参数中拼接token
|
|
154
110
|
function joinToken(str) {
|
|
155
111
|
if (str.indexOf('token=') === -1 && str.indexOf('?') > -1) {
|
|
156
112
|
return str.replace('?', "?token=".concat((0, _getUrlParam["default"])('token') || '', "&"));
|
|
157
113
|
} else if (str.indexOf('?') === -1) {
|
|
158
114
|
return str + "?token=".concat((0, _getUrlParam["default"])('token') || '');
|
|
159
115
|
}
|
|
160
|
-
|
|
161
116
|
return str;
|
|
162
117
|
}
|
|
163
|
-
|
|
164
118
|
var url = {
|
|
165
119
|
action: props.action || initUrl.action,
|
|
166
120
|
downloadUrl: joinToken(props.downloadUrl || initUrl.downloadUrl),
|
|
167
|
-
thumbnailUrl: joinToken(props.thumbnailUrl || initUrl.thumbnailUrl)
|
|
168
|
-
|
|
121
|
+
thumbnailUrl: joinToken(props.thumbnailUrl || initUrl.thumbnailUrl)
|
|
122
|
+
//previewUrl: props.previewUrl || initUrl.previewUrl,
|
|
169
123
|
};
|
|
124
|
+
|
|
170
125
|
var action = url.action,
|
|
171
|
-
|
|
172
|
-
|
|
126
|
+
downloadUrl = url.downloadUrl,
|
|
127
|
+
thumbnailUrl = url.thumbnailUrl;
|
|
173
128
|
(0, _react.useEffect)(function () {
|
|
174
129
|
setFileList(getSynFileList(props) || []);
|
|
175
130
|
}, [flag]);
|
|
176
131
|
(0, _react.useEffect)(function () {
|
|
177
132
|
if (Array.isArray(fileList)) {
|
|
178
133
|
// 只有图片的才可以预览,这边需要判断是否是图片
|
|
179
|
-
var imagelist = [];
|
|
180
|
-
|
|
134
|
+
var imagelist = [];
|
|
135
|
+
// 只能通过后缀来判断
|
|
181
136
|
fileList.map(function (file) {
|
|
182
137
|
var _file$type;
|
|
183
|
-
|
|
184
138
|
if (((_file$type = file.type) === null || _file$type === void 0 ? void 0 : _file$type.indexOf('image')) > -1) {
|
|
185
139
|
imagelist.push(file);
|
|
186
140
|
}
|
|
@@ -193,10 +147,8 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
193
147
|
setImageViewer(new _viewerjs["default"](imageCt, {}));
|
|
194
148
|
}
|
|
195
149
|
}, [imageCt]);
|
|
196
|
-
|
|
197
150
|
var getConfig = function getConfig() {
|
|
198
151
|
var token = (0, _getUrlParam["default"])('token') || '';
|
|
199
|
-
|
|
200
152
|
var config = _objectSpread(_objectSpread({}, rest), {}, {
|
|
201
153
|
accept: accept,
|
|
202
154
|
action: action,
|
|
@@ -208,18 +160,14 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
208
160
|
}, rest.headers),
|
|
209
161
|
onChange: function onChange(info) {
|
|
210
162
|
setFileList(info.fileList);
|
|
211
|
-
|
|
212
163
|
if (info.file.response && info.file.response.result === 1) {
|
|
213
164
|
_message["default"].error(info.file.response.errMsg || '上传失败!');
|
|
214
|
-
|
|
215
165
|
var flt = _toConsumableArray(fileList);
|
|
216
|
-
|
|
217
166
|
flt.pop();
|
|
218
167
|
setFileList(flt);
|
|
219
168
|
return;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
169
|
+
}
|
|
170
|
+
// 此处根据后台返回的数据结构取得文件ID
|
|
223
171
|
if (info.file.status !== 'uploading' && info.file.status !== 'removed') {
|
|
224
172
|
var vtxId = info.file.response && Array.isArray(info.file.response.data) && info.file.response.data.length > 0 ? info.file.response.data[0].id : undefined;
|
|
225
173
|
var newFileList = info.fileList;
|
|
@@ -240,23 +188,21 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
240
188
|
thumbUrl: useThumbnail ? thumbnailUrl + vtxId : undefined
|
|
241
189
|
});
|
|
242
190
|
}
|
|
243
|
-
|
|
244
191
|
return item;
|
|
245
192
|
});
|
|
246
|
-
|
|
247
193
|
if (mode == 'single') {
|
|
248
194
|
setFileList([newFile]);
|
|
249
195
|
} else {
|
|
250
196
|
setFileList(newFileList);
|
|
251
|
-
}
|
|
197
|
+
}
|
|
198
|
+
// 更新组件状态
|
|
252
199
|
// if (mode == 'single' && info.file.status === 'done') {
|
|
253
200
|
// setFileList([newFile]);
|
|
254
201
|
// } else {
|
|
255
202
|
// setFileList(newFileList);
|
|
256
203
|
// }
|
|
257
|
-
// 触发外部方法
|
|
258
|
-
|
|
259
204
|
|
|
205
|
+
// 触发外部方法
|
|
260
206
|
if (info.file.status === 'done') {
|
|
261
207
|
if (typeof onSuccess == 'function') {
|
|
262
208
|
onSuccess(newFile);
|
|
@@ -277,48 +223,37 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
277
223
|
//限制文件大小
|
|
278
224
|
if (maxFileSize && typeof maxFileSize === 'number') {
|
|
279
225
|
var limit = file.size < maxFileSize;
|
|
280
|
-
|
|
281
226
|
if (!limit) {
|
|
282
227
|
_message["default"].error("\u8BF7\u4E0A\u4F20".concat(maxFileSize / 1024 / 1024, "M\u4EE5\u5185\u7684\u6587\u4EF6"));
|
|
283
|
-
|
|
284
228
|
return false;
|
|
285
229
|
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
|
|
230
|
+
}
|
|
231
|
+
//限制不允许上传的文件类型(通过文件名后缀)
|
|
289
232
|
var pointIndex = file.name ? file.name.lastIndexOf('.') : -1;
|
|
290
|
-
|
|
291
233
|
if (pointIndex > -1) {
|
|
292
234
|
var fileType = file.name.substring(pointIndex);
|
|
293
|
-
|
|
294
235
|
if (rejectTypes.includes(fileType)) {
|
|
295
236
|
_message["default"].error('不支持该文件类型');
|
|
296
|
-
|
|
297
237
|
return false;
|
|
298
238
|
}
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
|
|
239
|
+
}
|
|
240
|
+
// 多选限制文件数量
|
|
302
241
|
if (typeof maxNum === 'number' && afterFileList.length + fileList.length > maxNum) {
|
|
303
242
|
// 减少提示错误次数, 思路,防抖 这边有个问题 就是防抖的这个方法 return fasle 不上传
|
|
304
243
|
debouncedMessage("\u6700\u591A\u4E0A\u4F20".concat(maxNum, "\u4E2A"));
|
|
305
244
|
return false;
|
|
306
245
|
}
|
|
307
|
-
|
|
308
246
|
if (typeof _beforeUpload === 'function') {
|
|
309
247
|
return _beforeUpload(file, afterFileList);
|
|
310
248
|
}
|
|
311
|
-
|
|
312
249
|
return true;
|
|
313
250
|
}
|
|
314
251
|
});
|
|
315
|
-
|
|
316
252
|
if (props.onPreview && typeof props.onPreview === 'function') {
|
|
317
253
|
config.onPreview = props.onPreview;
|
|
318
254
|
} else {
|
|
319
255
|
config.onPreview = function (file) {
|
|
320
256
|
var _file$type2, _file$type3;
|
|
321
|
-
|
|
322
257
|
if (!file.type) {
|
|
323
258
|
(0, _downloadFile["default"])(downloadUrl + file.id, {
|
|
324
259
|
fileName: file.name
|
|
@@ -338,7 +273,9 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
338
273
|
(0, _downloadFile["default"])(downloadUrl + file.id, {
|
|
339
274
|
fileName: file.name
|
|
340
275
|
}, 'blob');
|
|
341
|
-
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// TODO 暂无好的文件预览服务,等后续完善,只提供下载
|
|
342
279
|
// else if (
|
|
343
280
|
// file.type == 'application/PDF' ||
|
|
344
281
|
// file.type == 'application/vnd.ms-excel' ||
|
|
@@ -356,6 +293,7 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
356
293
|
// '?id=' + file.id + '&fullfilename=' + file.name.replace(/\s*/g, ''),
|
|
357
294
|
// )}`;
|
|
358
295
|
// }
|
|
296
|
+
|
|
359
297
|
// setVPrev({
|
|
360
298
|
// type: 'file',
|
|
361
299
|
// name: file.name || '文件预览',
|
|
@@ -364,20 +302,17 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
364
302
|
// visible: true,
|
|
365
303
|
// });
|
|
366
304
|
// }
|
|
367
|
-
|
|
368
305
|
};
|
|
369
|
-
}
|
|
370
|
-
|
|
306
|
+
}
|
|
371
307
|
|
|
308
|
+
// viewMode
|
|
372
309
|
if (viewMode) {
|
|
373
310
|
config.showUploadList = {
|
|
374
311
|
showRemoveIcon: false
|
|
375
312
|
};
|
|
376
313
|
}
|
|
377
|
-
|
|
378
314
|
return config;
|
|
379
315
|
};
|
|
380
|
-
|
|
381
316
|
var handlePreview = function handlePreview(file) {
|
|
382
317
|
var imageIndex = imageList.map(function (item) {
|
|
383
318
|
return item.id;
|
|
@@ -386,21 +321,18 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
386
321
|
imageViewer.update();
|
|
387
322
|
imageViewer.view(imageIndex);
|
|
388
323
|
};
|
|
389
|
-
|
|
390
324
|
var getSynFileList = function getSynFileList(props) {
|
|
391
|
-
var processedFileList = props.fileList || [];
|
|
392
|
-
|
|
325
|
+
var processedFileList = props.fileList || [];
|
|
326
|
+
// 单文件模式只取第一个
|
|
393
327
|
if (props.mode == 'single' && processedFileList.length > 1) {
|
|
394
328
|
processedFileList = [processedFileList[0]];
|
|
395
329
|
}
|
|
396
|
-
|
|
397
330
|
processedFileList = processedFileList.map(function (item, index) {
|
|
398
331
|
// 将外部传入的简易文件数组处理成为组件需要的数组结构
|
|
399
332
|
if (item.name === undefined || item.id === undefined) {
|
|
400
333
|
// eslint-disable-next-line no-console
|
|
401
334
|
console.error('文件列表的name和id属性不能为空');
|
|
402
335
|
}
|
|
403
|
-
|
|
404
336
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
405
337
|
uid: -1 - index,
|
|
406
338
|
status: 'done',
|
|
@@ -410,7 +342,6 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
410
342
|
});
|
|
411
343
|
return processedFileList;
|
|
412
344
|
};
|
|
413
|
-
|
|
414
345
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isDragger ? /*#__PURE__*/_react["default"].createElement(Dragger, _extends({}, getConfig(), {
|
|
415
346
|
ref: ref
|
|
416
347
|
}), draggerConfig !== null && draggerConfig !== void 0 && draggerConfig.img ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
@@ -447,7 +378,6 @@ var VtxUpload = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
447
378
|
}
|
|
448
379
|
}, imageList.filter(function (item) {
|
|
449
380
|
var _item$type;
|
|
450
|
-
|
|
451
381
|
return item.type && ((_item$type = item.type) === null || _item$type === void 0 ? void 0 : _item$type.indexOf('image')) > -1;
|
|
452
382
|
}).map(function (item, index) {
|
|
453
383
|
return /*#__PURE__*/_react["default"].createElement("li", {
|