@titaui/pc 1.13.2-beta.6 → 1.13.2-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/avatar/icon-avatar/index.js +1 -1
- package/lib/components/avatar/num-avatar/index.js +1 -1
- package/lib/components/book-demo/components/pc/components/content/index.js +1 -1
- package/lib/components/button/default-button/index.js +1 -1
- package/lib/components/button/icon-btn/index.js +1 -1
- package/lib/components/cascader/index.js +1 -1
- package/lib/components/cascader/time.js +1 -1
- package/lib/components/change-okr-modal/Filter.js +2 -2
- package/lib/components/change-okr-modal/Item.js +2 -2
- package/lib/components/change-okr-modal/filterTab.js +2 -2
- package/lib/components/change-okr-modal/index.js +4 -6
- package/lib/components/common-share/publishMblog.js +2 -4
- package/lib/components/communication/CommunicationAttachments.js +2 -2
- package/lib/components/communication/ConvertUserName.js +2 -2
- package/lib/components/communication/index.js +2 -2
- package/lib/components/create-okr-modal/fields/okr-type-detail.js +2 -4
- package/lib/components/create-okr-modal/fields/okr-visibility-detail.js +2 -4
- package/lib/components/create-okr-modal/index.js +3 -8
- package/lib/components/create-okr-modal/objectType.js +2 -2
- package/lib/components/create-okr-modal/request-api.js +12 -16
- package/lib/components/create-okr-modal/utils/helper.js +2 -6
- package/lib/components/date-picker/BodyItem.js +3 -3
- package/lib/components/date-picker/CalendarBody.js +3 -3
- package/lib/components/date-picker/CalendarHeader.js +3 -3
- package/lib/components/date-picker/index.js +2 -2
- package/lib/components/date-range-picker/index.js +2 -2
- package/lib/components/delete-confirm-pop/ConfirmPop.js +2 -2
- package/lib/components/dialog/index.js +1 -1
- package/lib/components/dialog-confirm/index.js +1 -1
- package/lib/components/dialog-upload/index.js +2 -4
- package/lib/components/dialog-upload/util.js +1 -19
- package/lib/components/drawer/headerDrop.js +1 -1
- package/lib/components/drawer/index.js +1 -1
- package/lib/components/drawer-manager/drawerWrapper.js +3 -5
- package/lib/components/drawer-manager/index.js +1 -1
- package/lib/components/drop-selector/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/components/okr-progress/index.js +2 -1
- package/lib/components/dynamic/dynamic-item/components/progress/components/okr-progress/index.js +2 -4
- package/lib/components/dynamic/dynamic-item/components/summary-header/index.js +4 -6
- package/lib/components/dynamic/dynamic-item/components/table-row-okr/index.css +12 -0
- package/lib/components/dynamic/dynamic-item/components/table-row-okr/index.js +13 -2
- package/lib/components/dynamic/dynamic-item/components/table-row-okr/utils.js +56 -0
- package/lib/components/dynamic/dynamic-item/dynamic-ai-dialy/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-align/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-announcement/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-assessment/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-chart/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-create-o/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-discovery/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-kr/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-learning/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-milestone/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-new-report/components/remind-user-view/index.css +16 -1
- package/lib/components/dynamic/dynamic-item/dynamic-new-report/components/remind-user-view/index.js +51 -9
- package/lib/components/dynamic/dynamic-item/dynamic-new-report/index.js +28 -11
- package/lib/components/dynamic/dynamic-item/dynamic-okrs-communication/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-plan-communication/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-progress/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-project/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-relative/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-reply/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-report/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-reward/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-share/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/dynamic-task/index.js +1 -1
- package/lib/components/dynamic/dynamic-item/index.js +24 -4
- package/lib/components/dynamic/dynamic-list/index.js +1 -1
- package/lib/components/dynamic/request-api.js +9 -2
- package/lib/components/eReport/eReportListEmpty.js +2 -2
- package/lib/components/eReport/eReportLists/reportList.js +2 -2
- package/lib/components/eReport/eReportShare/index.js +2 -2
- package/lib/components/eReport/eReportShare/toast/index.js +2 -2
- package/lib/components/edit-kr-wight/EditKrWightModal.js +2 -2
- package/lib/components/edit-kr-wight/FormItemV2.js +2 -2
- package/lib/components/emotions-selector/selector-content.js +2 -2
- package/lib/components/emotions-selector/selector-pop.js +2 -2
- package/lib/components/ereport-list/index.js +2 -2
- package/lib/components/error-boundary/index.js +2 -2
- package/lib/components/file-list/components/single-file/index.js +1 -3
- package/lib/components/file-list/index.js +1 -2
- package/lib/components/firework/index.js +2 -6
- package/lib/components/form/form-fields/date/index.js +1 -1
- package/lib/components/form/form-fields/dropdown/index.js +1 -1
- package/lib/components/form/form-fields/input/index.js +1 -1
- package/lib/components/form/form-fields/input-verification-code/index.js +2 -4
- package/lib/components/form/form-fields/user/index.js +1 -1
- package/lib/components/grid-layout/util/network.js +6 -10
- package/lib/components/guide-tip/index.js +1 -1
- package/lib/components/help-card/index.js +1 -1
- package/lib/components/import-modal/import-task-modal/index.js +1 -1
- package/lib/components/import-modal/tree/okr-tree/index.js +2 -4
- package/lib/components/import-modal/tree-node/index.js +1 -1
- package/lib/components/mblog/components/ConfirmPop.js +2 -2
- package/lib/components/mblog/components/MblogAction.js +2 -2
- package/lib/components/mblog/components/MblogContent.js +2 -2
- package/lib/components/mblog/index.js +2 -2
- package/lib/components/menus/components/menu-tree/index.js +1 -1
- package/lib/components/menus/components/menu-tree/tree-node/index.js +1 -1
- package/lib/components/nav-top/components/app-center/index.js +1 -6
- package/lib/components/nav-top/components/menu/index.js +14 -44
- package/lib/components/nav-top/index.css +0 -6
- package/lib/components/nav-top/index.js +2 -126
- package/lib/components/okr-detail/auth.js +2 -2
- package/lib/components/okr-detail/base-info/other-infos/principal/index.js +2 -4
- package/lib/components/okr-detail/components/ao-nice/index.js +4 -6
- package/lib/components/okr-detail/components/base-okr-type/confirm/buttonv2.js +2 -2
- package/lib/components/okr-detail/components/base-okr-type/confirm/confirm.js +2 -2
- package/lib/components/okr-detail/components/base-okr-type/object-type.js +2 -2
- package/lib/components/okr-detail/components/header/edit-name.js +2 -4
- package/lib/components/okr-detail/components/header/o-avatar.js +2 -4
- package/lib/components/okr-detail/components/header/o-classify.js +2 -4
- package/lib/components/okr-detail/components/header/o-score.js +1 -1
- package/lib/components/okr-detail/components/icon-text/index.js +1 -1
- package/lib/components/okr-detail/components/o-classify.js +2 -4
- package/lib/components/okr-detail/components/o-progress-update/index.js +2 -4
- package/lib/components/okr-detail/components/okr-tree/index.js +1 -1
- package/lib/components/okr-detail/components/okr-tree/tree-node/e-kr-node/index.js +2 -4
- package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-task-level2.js +2 -4
- package/lib/components/okr-detail/components/okr-tree/tree-node/e-node/e-task.js +2 -4
- package/lib/components/okr-detail/components/okr-tree/tree-node/index.js +1 -1
- package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/index.js +2 -4
- package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/edit-pop.js +2 -2
- package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/kr-score-editor/kr-push-score.js +3 -3
- package/lib/components/okr-detail/components/okr-tree/tree-node/kr-parent-node/index.js +2 -4
- package/lib/components/okr-detail/components/okr-tree/tree-node/o-child-node/edit-child-okr-weight.js +6 -8
- package/lib/components/okr-detail/components/okr-tree/tree-node/o-parent-node/index.js +2 -4
- package/lib/components/okr-detail/detail-footer/index.js +2 -4
- package/lib/components/okr-detail/detail-header/index.js +10 -12
- package/lib/components/okr-detail/okr-list/index.js +2 -4
- package/lib/components/okr-detail/request-apis.js +2 -6
- package/lib/components/okr-flow/child-node/fields/creator.js +2 -4
- package/lib/components/okr-flow/child-node/work-node.js +2 -4
- package/lib/components/okr-flow/export-modal/index.js +43 -6
- package/lib/components/okr-flow/export-modules/okr-search-panel/index.js +8 -10
- package/lib/components/okr-flow/request-apis.js +2 -6
- package/lib/components/okr-flow/root-node/index.js +2 -4
- package/lib/components/okr-progress/components/o-progress-update/index.js +2 -4
- package/lib/components/okr-progress-modal/index.js +2 -4
- package/lib/components/okr-review/ReviewPop/components/ReviewBody/index.js +4 -6
- package/lib/components/okr-review/ReviewPop/components/Toast/index.js +2 -2
- package/lib/components/okr-review/ReviewPop/index.js +2 -2
- package/lib/components/okr-review/components/ReviewItem/index.js +2 -2
- package/lib/components/okr-review/components/confirm-pop/ConfirmPop.js +2 -2
- package/lib/components/okr-review/index.js +2 -2
- package/lib/components/okr-share/common-painter/darwAvatar.js +4 -8
- package/lib/components/okr-share/common-painter/openDataPainter.js +2 -6
- package/lib/components/okr-share/common-painter/utils.js +4 -8
- package/lib/components/okr-share/pink-card/drawDepartmentName.js +2 -6
- package/lib/components/okr-share/pink-card/drawKrs.js +2 -6
- package/lib/components/okr-share/pink-card/drawQuote.js +2 -6
- package/lib/components/okr-share/pink-card/drawUserName.js +2 -6
- package/lib/components/okr-share/pink-card/index.js +2 -6
- package/lib/components/okr-share/publishMblog.js +2 -4
- package/lib/components/okr-share/shareCardSelector.js +4 -6
- package/lib/components/okrcase-library/okrcases-components/submitOkr-dialog.js +4 -4
- package/lib/components/okrcase-library/server/network.js +20 -24
- package/lib/components/open-data-painter/index.js +2 -6
- package/lib/components/operation-records/OperationRecordItem.js +2 -2
- package/lib/components/operation-records/index.js +2 -2
- package/lib/components/pagination/pagination.js +1 -1
- package/lib/components/period-selector/components/button/index.js +1 -1
- package/lib/components/period-selector/helper/index.js +2 -6
- package/lib/components/picker/components/panels/date-panel/index.js +1 -1
- package/lib/components/picker/components/panels/month-panel/index.js +1 -1
- package/lib/components/picker/components/panels/month-panel/month-head.js +1 -1
- package/lib/components/picker/components/panels/week-panel/index.js +1 -1
- package/lib/components/picker/components/panels/year-panel/index.js +1 -1
- package/lib/components/picker/components/panels/year-panel/year-head.js +1 -1
- package/lib/components/picker/picker.js +1 -1
- package/lib/components/picker/range-picker/index.js +1 -1
- package/lib/components/point-demo/drop-down-box/index.js +1 -1
- package/lib/components/point-demo/input/index.js +3 -3
- package/lib/components/point-demo/popup/index.js +1 -1
- package/lib/components/popup/index.js +1 -1
- package/lib/components/praise-record/PraiseRecordItem.js +2 -2
- package/lib/components/praise-record/index.js +2 -2
- package/lib/components/range-picker-pop/index.js +3 -3
- package/lib/components/range-selector-pop/RangeList.js +2 -2
- package/lib/components/range-selector-pop/RangeSelectorPop.js +2 -2
- package/lib/components/rate/index.js +1 -1
- package/lib/components/rich-editor/models/schema.js +2 -2
- package/lib/components/rich-editor/plugins/block/block-quote/index.js +2 -2
- package/lib/components/rich-editor/plugins/block/heading/index.js +2 -2
- package/lib/components/rich-editor/plugins/block/lists/index.js +2 -2
- package/lib/components/rich-editor/plugins/block/paragraph/index.js +2 -2
- package/lib/components/rich-editor/plugins/core/index.js +2 -2
- package/lib/components/rich-editor/plugins/extension/alignment/index.js +2 -2
- package/lib/components/rich-editor/plugins/extension/placeholder/index.js +2 -2
- package/lib/components/rich-editor/plugins/inline/color/index.js +2 -2
- package/lib/components/rich-editor/plugins/inline/delete-line/index.js +2 -2
- package/lib/components/rich-editor/plugins/inline/em/index.js +2 -2
- package/lib/components/rich-editor/plugins/inline/link/index.js +2 -2
- package/lib/components/rich-editor/plugins/inline/strong/index.js +2 -2
- package/lib/components/rich-editor/plugins/inline/under-line/index.js +2 -2
- package/lib/components/rich-editor/react/reactNodeView.js +4 -4
- package/lib/components/rich-editor/react/uiProvider.js +2 -2
- package/lib/components/rich-editor/ui/Popup/index.js +2 -2
- package/lib/components/rich-editor-at/index.js +94 -13
- package/lib/components/scroll-container/index.js +8 -29
- package/lib/components/scrollbar/index.js +1 -1
- package/lib/components/scrollbar/scroll-mask/index.js +1 -1
- package/lib/components/scrollbar/simplebar-react.js +1 -1
- package/lib/components/search-dropdown/index.js +1 -1
- package/lib/components/search-input/index.js +0 -3
- package/lib/components/select/Option.js +3 -3
- package/lib/components/select/index.js +3 -3
- package/lib/components/select-layer/index.js +1 -1
- package/lib/components/select-tags/index.js +1 -1
- package/lib/components/superset-charts/fetch-assets-and-append/get-assets-with-cache.js +2 -6
- package/lib/components/superset-charts/fetch-assets-and-append/index.js +4 -8
- package/lib/components/survey-model/request-api.js +2 -6
- package/lib/components/switch/index.js +1 -1
- package/lib/components/table/index.js +1 -1
- package/lib/components/tabs/index.js +1 -1
- package/lib/components/task-relation-modal/index.js +5 -7
- package/lib/components/task-relation-modal/okr-relation/relation-task-model/index.js +1 -1
- package/lib/components/task-relation-modal/okr-relation/relation-work-model/index.js +1 -1
- package/lib/components/task-relation-modal/tree/category-tree/index.js +2 -4
- package/lib/components/task-relation-modal/tree/okr-tree/index.js +2 -4
- package/lib/components/task-relation-modal/tree/work-tree/index.js +2 -4
- package/lib/components/task-relation-modal/tree-node/index.js +1 -1
- package/lib/components/task-relation-modal/work-relation/index.js +5 -7
- package/lib/components/task-tree/task-item-node/e-project.js +2 -4
- package/lib/components/task-tree/task-item-node/e-task.js +2 -4
- package/lib/components/task-tree/task-item-node/task-node-render.js +1 -1
- package/lib/components/task-tree/task-tree.js +1 -1
- package/lib/components/textarea/index.js +1 -1
- package/lib/components/time-picker/time-picker-selector.js +1 -1
- package/lib/components/time-picker/time-picker.js +1 -1
- package/lib/components/time-picker/timer-picker-input.js +1 -1
- package/lib/components/tita-chart/charts/liquid-ball.js +1 -1
- package/lib/components/tita-chart/charts/pie.js +1 -1
- package/lib/components/tita-chart/errorBoundary/index.js +2 -2
- package/lib/components/toast/index.js +8 -12
- package/lib/components/tooltip/error-tip.js +1 -1
- package/lib/components/tooltip/tooltip.js +1 -1
- package/lib/components/tree/index.js +1 -1
- package/lib/components/upload/components/uploadedPreview.js +2 -2
- package/lib/components/upload/index.js +455 -261
- package/lib/components/upvote/index.js +5 -7
- package/lib/components/user-selector/export-modules/multiple-user-selector--bak/index.js +1 -1
- package/lib/components/user-selector/select-tree/choose-tree/index.js +1 -1
- package/lib/components/user-selector/select-tree/selected-tree/index.js +1 -1
- package/lib/components/version-change-modal/index.js +4 -6
- package/lib/components/version-change-modal/request-api.js +2 -6
- package/lib/components/viewer/ImageListRender.js +2 -2
- package/lib/components/viewer/index.js +2 -2
- package/lib/components/weekly-report/card.js +12 -4
- package/lib/components/weekly-report/common-painter/darwAvatar.js +6 -10
- package/lib/components/weekly-report/common-painter/drawName.js +2 -6
- package/lib/components/weekly-report/common-painter/openDataPainter.js +2 -6
- package/lib/components/weekly-report/index.js +4 -6
- package/lib/components-v1/animate/AnimateChild.js +2 -2
- package/lib/components-v1/animate/animate.js +2 -2
- package/lib/components-v1/avatar/index.js +2 -2
- package/lib/components-v1/buttonv2/ButtonOutlined.js +2 -2
- package/lib/components-v1/buttonv2/ButtonRounded.js +2 -2
- package/lib/components-v1/buttonv2/DefaultButton.js +2 -2
- package/lib/components-v1/confirm/index.js +2 -2
- package/lib/components-v1/dropDownSelector/StatelessDropdown.js +2 -2
- package/lib/components-v1/dropDownSelector/dropDownSelector.js +2 -2
- package/lib/components-v1/input/Input.js +3 -3
- package/lib/components-v1/input/InputNumber.js +2 -2
- package/lib/components-v1/placement/placement.js +2 -2
- package/lib/components-v1/placement/placementInner.js +2 -2
- package/lib/components-v1/pop/Pop.js +2 -2
- package/lib/components-v1/pop/PopInner.js +2 -2
- package/lib/components-v1/portals/Portals.js +2 -2
- package/lib/components-v1/progress/CircleProgress.js +2 -2
- package/lib/components-v1/progress/LineProgress.js +2 -2
- package/lib/components-v1/progress/index.js +2 -2
- package/lib/components-v1/radio/radio.js +2 -2
- package/lib/components-v1/radio/radioGroup.js +2 -2
- package/lib/components-v1/search/index.js +2 -2
- package/lib/components-v1/select/Option.js +3 -3
- package/lib/components-v1/select/index.js +3 -3
- package/lib/components-v1/tabs/index.js +2 -2
- package/lib/components-v1/textarea/index.js +2 -2
- package/lib/components-v1/transition/index.js +2 -2
- package/lib/components-v1/userSelector/UserSelectorPop.js +2 -2
- package/lib/components-v1/userSelector/components/MultiMode/CommonList.js +2 -2
- package/lib/components-v1/userSelector/components/MultiMode/DepartmentList.js +2 -2
- package/lib/components-v1/userSelector/components/MultiMode/DepartmentTree.js +2 -2
- package/lib/components-v1/userSelector/components/MultiMode/SubsList.js +2 -2
- package/lib/components-v1/userSelector/components/MultiMode/index.js +2 -2
- package/lib/components-v1/userSelector/components/SearchBar.js +2 -2
- package/lib/components-v1/userSelector/components/SingleMode.js +2 -2
- package/lib/components-v1/userSelector/components/UserItem.js +2 -2
- package/lib/components-v1/userSelector/index.js +2 -2
- package/lib/index.js +0 -8
- package/lib/pages/appointment-demo/drop-down-box/index.js +1 -1
- package/lib/pages/appointment-demo/input/index.js +3 -3
- package/lib/pages/appointment-demo/popup/index.js +1 -1
- package/lib/pages/group-management/components/input-form/index.js +3 -3
- package/lib/pages/group-management/components/radio/index.js +1 -1
- package/lib/pages/group-management/groupInterface.js +2 -6
- package/lib/pages/group-management/page-view/importGroupStaff/index.js +1 -1
- package/lib/pages/group-management/tree/index.js +1 -1
- package/lib/pages/new-okr-list/request-api.js +14 -18
- package/lib/pages/okr-map/export-modules/okr-map/okr-map.js +3 -5
- package/lib/pages/okr-map/export-modules/share-okr-page/share-okr-map.js +1 -1
- package/lib/pages/okr-map/request-apis.js +2 -6
- package/lib/pages/okr-map/share-dialog/index.js +1 -1
- package/lib/utils/auth.js +2 -2
- package/lib/utils/open-data.js +4 -6
- package/lib/utils/request-v1.js +2 -6
- package/lib/utils/request.js +2 -6
- package/lib/utils/tools.js +1 -11
- package/package.json +1 -1
- package/lib/components/checkbox-list/index.css +0 -18
- package/lib/components/checkbox-list/index.js +0 -66
- package/lib/components/dialog-qq-docs/index.css +0 -90
- package/lib/components/dialog-qq-docs/index.js +0 -490
- package/lib/components/dialog-qq-docs/request-apis.js +0 -16
- package/lib/components/dialog-qq-docs/utils.js +0 -80
- package/lib/components/dialog-select/index.css +0 -9
- package/lib/components/dialog-select/index.js +0 -48
- package/lib/components/dialog-upload/img/folder.svg +0 -40
- package/lib/components/dialog-upload/img/form.svg +0 -38
- package/lib/components/dialog-upload/img/mind.svg +0 -39
- package/lib/components/dialog-upload-type/assets/folder.svg +0 -20
- package/lib/components/dialog-upload-type/assets/qq-docs.svg +0 -20
- package/lib/components/dialog-upload-type/components/upload-type-item/index.css +0 -14
- package/lib/components/dialog-upload-type/components/upload-type-item/index.js +0 -36
- package/lib/components/dialog-upload-type/index.css +0 -7
- package/lib/components/dialog-upload-type/index.js +0 -75
- package/lib/components/file-preview/index.css +0 -37
- package/lib/components/file-preview/index.js +0 -68
- package/lib/components/loading/assets/loading.gif +0 -0
- package/lib/components/loading/index.css +0 -28
- package/lib/components/loading/index.js +0 -64
- package/lib/components/nav/index.css +0 -23
- package/lib/components/nav/index.js +0 -31
- package/lib/components/okr-guide/constant.js +0 -23
- package/lib/components/okr-guide/img/left-img.png +0 -0
- package/lib/components/okr-guide/index.css +0 -146
- package/lib/components/okr-guide/index.js +0 -243
- package/lib/components/okr-guide/request-api.js +0 -57
- package/lib/components/upload/upload.js +0 -566
|
@@ -1,566 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
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
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _titaUi = require("tita-ui");
|
|
13
|
-
|
|
14
|
-
var _uuid = _interopRequireDefault(require("uuid"));
|
|
15
|
-
|
|
16
|
-
var _Portals = _interopRequireDefault(require("../../components-v1/portals/Portals"));
|
|
17
|
-
|
|
18
|
-
var _requestV = require("../../utils/request-v1");
|
|
19
|
-
|
|
20
|
-
var _toast = _interopRequireDefault(require("../toast"));
|
|
21
|
-
|
|
22
|
-
var _uploadedPreview = _interopRequireDefault(require("./components/uploadedPreview"));
|
|
23
|
-
|
|
24
|
-
var _type = require("./type");
|
|
25
|
-
|
|
26
|
-
var _style = require("./style");
|
|
27
|
-
|
|
28
|
-
var _imgViewer = _interopRequireDefault(require("../img-viewer"));
|
|
29
|
-
|
|
30
|
-
var _util = require("./util");
|
|
31
|
-
|
|
32
|
-
var _getLocale = require("../../utils/getLocale");
|
|
33
|
-
|
|
34
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
35
|
-
|
|
36
|
-
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); }
|
|
37
|
-
|
|
38
|
-
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; }
|
|
39
|
-
|
|
40
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
41
|
-
|
|
42
|
-
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."); }
|
|
43
|
-
|
|
44
|
-
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); }
|
|
45
|
-
|
|
46
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
47
|
-
|
|
48
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
49
|
-
|
|
50
|
-
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; }
|
|
51
|
-
|
|
52
|
-
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; }
|
|
53
|
-
|
|
54
|
-
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; }
|
|
55
|
-
|
|
56
|
-
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; }
|
|
57
|
-
|
|
58
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
59
|
-
|
|
60
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
61
|
-
|
|
62
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
63
|
-
|
|
64
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
65
|
-
|
|
66
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
67
|
-
|
|
68
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
69
|
-
|
|
70
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
71
|
-
|
|
72
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
73
|
-
|
|
74
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
75
|
-
|
|
76
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
77
|
-
|
|
78
|
-
var Upload = /*#__PURE__*/function (_PureComponent) {
|
|
79
|
-
_inherits(Upload, _PureComponent);
|
|
80
|
-
|
|
81
|
-
var _super = _createSuper(Upload);
|
|
82
|
-
|
|
83
|
-
function Upload(props) {
|
|
84
|
-
var _this;
|
|
85
|
-
|
|
86
|
-
_classCallCheck(this, Upload);
|
|
87
|
-
|
|
88
|
-
_this = _super.call(this, props);
|
|
89
|
-
|
|
90
|
-
_this.onFileInputChange = function (e) {
|
|
91
|
-
var onChange = _this.props.onChange;
|
|
92
|
-
var fileInput = _this.refs.fileInput;
|
|
93
|
-
if (onChange) onChange(e); // @ts-ignore
|
|
94
|
-
|
|
95
|
-
var selectFiles = fileInput.files; // 选择的文件
|
|
96
|
-
// @ts-ignore
|
|
97
|
-
|
|
98
|
-
if (!fileInput.value) return; // 未选择文件或选择文件超出个数限制时
|
|
99
|
-
|
|
100
|
-
_this.dealSelectFiles(Array.from(selectFiles));
|
|
101
|
-
|
|
102
|
-
if (fileInput) {
|
|
103
|
-
// @ts-ignore
|
|
104
|
-
fileInput.value = '';
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
_this.dealSelectFiles = function (uploadSelectFilesObj) {
|
|
109
|
-
var _this$state = _this.state,
|
|
110
|
-
uploadSuccessFiles = _this$state.uploadSuccessFiles,
|
|
111
|
-
selectFiles = _this$state.selectFiles;
|
|
112
|
-
var _this$props = _this.props,
|
|
113
|
-
action = _this$props.action,
|
|
114
|
-
fileNumLimit = _this$props.fileNumLimit,
|
|
115
|
-
fileSizeLimit = _this$props.fileSizeLimit,
|
|
116
|
-
filesTotal = _this$props.filesTotal;
|
|
117
|
-
var uploadSelectFilesLen = uploadSelectFilesObj.length; // 选中上传的文件数量
|
|
118
|
-
|
|
119
|
-
var uploadSuccessFilesLen = uploadSuccessFiles.length; // 已上传成功的文件数量
|
|
120
|
-
|
|
121
|
-
var allFilesTotal = uploadSuccessFilesLen + uploadSelectFilesLen; // 把文件字节流保存,用来文件重传用
|
|
122
|
-
|
|
123
|
-
uploadSelectFilesObj.forEach(function (ele) {
|
|
124
|
-
if (!selectFiles[ele.name]) {
|
|
125
|
-
selectFiles[ele.name] = ele;
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
_this.setState({
|
|
130
|
-
selectFiles: selectFiles
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
if (filesTotal && allFilesTotal > filesTotal) {
|
|
134
|
-
_toast["default"].Error("\u6700\u591A\u53EF\u4E0A\u4F20 ".concat(filesTotal, " \u4E2A\u6587\u4EF6"), {
|
|
135
|
-
canClose: false
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
uploadSelectFilesObj = uploadSelectFilesObj.slice(0, filesTotal - uploadSuccessFilesLen);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (fileNumLimit && uploadSelectFilesObj.length > fileNumLimit) {
|
|
142
|
-
_toast["default"].Error("\u5355\u6B21\u6700\u591A\u53EF\u4E0A\u4F20 ".concat(fileNumLimit, " \u4E2A\u6587\u4EF6"), {
|
|
143
|
-
canClose: false
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
uploadSelectFilesObj = uploadSelectFilesObj.slice(0, fileNumLimit);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
if (!uploadSelectFilesObj.length) return;
|
|
150
|
-
var uploadSelectFilesSize = uploadSelectFilesObj.map(function (item) {
|
|
151
|
-
return item.size;
|
|
152
|
-
}).reduce(function (total, num) {
|
|
153
|
-
return total + num;
|
|
154
|
-
}); // 上传文件的大小
|
|
155
|
-
|
|
156
|
-
if (uploadSelectFilesSize > fileNumLimit * fileSizeLimit * 1024 * 1024) return _toast["default"].Error("\u5355\u6B21\u6700\u591A\u53EF\u4E0A\u4F20 ".concat(fileNumLimit, " \u4E2A\u6587\u4EF6\uFF0C\u6BCF\u4E2A\u4E0D\u8D85\u8FC7 ").concat(fileSizeLimit, "M")); // 文件大小超出限制
|
|
157
|
-
|
|
158
|
-
var uploadStartFiles = []; // 开始上传的文件
|
|
159
|
-
|
|
160
|
-
uploadSelectFilesObj.forEach(function (element, index) {
|
|
161
|
-
var formData = new FormData(); // FormData 对象
|
|
162
|
-
|
|
163
|
-
var uploadStartFile = null;
|
|
164
|
-
var timestamp = new Date().getTime(); // 给每个文件加一个时间戳
|
|
165
|
-
|
|
166
|
-
var uploadFileType = element.name.substring(element.name.lastIndexOf('.') + 1);
|
|
167
|
-
uploadStartFile = {
|
|
168
|
-
FileName: element.name,
|
|
169
|
-
FileType: (0, _type._dealAttachmentType)(uploadFileType).FileType,
|
|
170
|
-
FileSize: element.size,
|
|
171
|
-
FileLastModified: element.lastModified,
|
|
172
|
-
IsImage: (0, _type._dealAttachmentType)(uploadFileType).IsImage,
|
|
173
|
-
percentComplete: 0,
|
|
174
|
-
uploadStatus: 1,
|
|
175
|
-
// 开始上传
|
|
176
|
-
IsSuccess: false,
|
|
177
|
-
uid: (0, _uuid["default"])(),
|
|
178
|
-
_smallImageUrl: '',
|
|
179
|
-
_bigImageUrl: '',
|
|
180
|
-
MediaType: '',
|
|
181
|
-
UserId: 0,
|
|
182
|
-
MaxDocCount: 0,
|
|
183
|
-
DfsPath: '',
|
|
184
|
-
ClientUrl: '',
|
|
185
|
-
SmallImageUrl: '',
|
|
186
|
-
BigImageUrl: '',
|
|
187
|
-
DownloadUrl: '',
|
|
188
|
-
Msg: '',
|
|
189
|
-
AllowUploadAttachmentSize: 50,
|
|
190
|
-
Deleteable: true,
|
|
191
|
-
requestXHR: new XMLHttpRequest() // 在这创建是为了取消用
|
|
192
|
-
|
|
193
|
-
};
|
|
194
|
-
var sameFile = uploadSuccessFiles.find(function (file) {
|
|
195
|
-
return _this.isSameFile(file, uploadStartFile) && file.uploadStatus !== 4;
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
if (sameFile) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
uploadStartFiles.push(uploadStartFile);
|
|
203
|
-
|
|
204
|
-
_this._dealUploadStart(uploadStartFiles); // 处理开始上传的文件
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
formData.append('file', element);
|
|
208
|
-
var url = action || (0, _requestV.getApiUrl)("Upload/PostFiles?format=json×tamp=".concat(timestamp));
|
|
209
|
-
|
|
210
|
-
_this._dealUploadXHRRequest(formData, url, uploadStartFile);
|
|
211
|
-
});
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
_this._dealUploadXHRRequest = function (formData, url, uploadStartFile) {
|
|
215
|
-
if (uploadStartFile.FileSize > _this.props.fileSizeLimit * 1024 * 1024) {
|
|
216
|
-
setTimeout(function () {
|
|
217
|
-
_this._dealUploadSuccess(_objectSpread(_objectSpread({}, uploadStartFile), {
|
|
218
|
-
Msg: '上传失败,文件过大',
|
|
219
|
-
IsImage: false,
|
|
220
|
-
uploadStatus: 5
|
|
221
|
-
}));
|
|
222
|
-
}, 300);
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
var xhr = uploadStartFile.requestXHR; // xhr.onreadystatechange = () => {
|
|
227
|
-
// if (xhr.readyState == 4 && xhr.status == 200) {
|
|
228
|
-
// const result = { ...JSON.parse(xhr.responseText).Result[0] }; // 上传成功接口返回数据
|
|
229
|
-
// result.percentComplete = 100;
|
|
230
|
-
// result.IsSuccess = !!result.IsSuccess;
|
|
231
|
-
// result.uploadStatus = result.IsSuccess ? 3 : 4; // 3上传成功;4上传失败
|
|
232
|
-
// this._dealUploadSuccess({ ...uploadStartFile, ...result });
|
|
233
|
-
// }
|
|
234
|
-
// };
|
|
235
|
-
// // 进度条部分
|
|
236
|
-
// xhr.upload.onprogress = (evt) => {
|
|
237
|
-
// const uploadSuccessFiles = [...this.state.uploadSuccessFiles];
|
|
238
|
-
// if (evt.lengthComputable) {
|
|
239
|
-
// uploadSuccessFiles.forEach((item: UploadResultObj) => {
|
|
240
|
-
// if (this.isSameFile(item, uploadStartFile)) {
|
|
241
|
-
// item.uploadStatus = 2; // 上传中
|
|
242
|
-
// item.percentComplete = Math.round((evt.loaded * 100) / evt.total);
|
|
243
|
-
// }
|
|
244
|
-
// });
|
|
245
|
-
// this.setState({ uploadSuccessFiles });
|
|
246
|
-
// }
|
|
247
|
-
// };
|
|
248
|
-
|
|
249
|
-
xhr.onreadystatechange = function () {
|
|
250
|
-
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
251
|
-
var result = Object.assign({}, _objectSpread({}, JSON.parse(xhr.responseText).Result[0])); // 上传成功接口返回数据
|
|
252
|
-
|
|
253
|
-
result.percentComplete = 100;
|
|
254
|
-
result.IsSuccess = !!result.IsSuccess;
|
|
255
|
-
result.uploadStatus = result.IsSuccess ? 3 : 4; // 3上传成功;4上传失败
|
|
256
|
-
|
|
257
|
-
_this._dealUploadSuccess(_objectSpread(_objectSpread({}, uploadStartFile), result));
|
|
258
|
-
}
|
|
259
|
-
}; //进度条部分
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
xhr.upload.onprogress = function (evt) {
|
|
263
|
-
var uploadSuccessFiles = JSON.parse(JSON.stringify(_this.state.uploadSuccessFiles));
|
|
264
|
-
|
|
265
|
-
if (evt.lengthComputable) {
|
|
266
|
-
uploadSuccessFiles.forEach(function (item) {
|
|
267
|
-
if (_this.isSameFile(item, uploadStartFile)) {
|
|
268
|
-
item.uploadStatus = 2; // 上传中
|
|
269
|
-
|
|
270
|
-
item.percentComplete = Math.round(evt.loaded * 100 / evt.total);
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
_this.setState({
|
|
275
|
-
uploadSuccessFiles: uploadSuccessFiles
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
xhr.upload.onerror = function (evt) {
|
|
281
|
-
var uploadSuccessFiles = _toConsumableArray(_this.state.uploadSuccessFiles);
|
|
282
|
-
|
|
283
|
-
uploadSuccessFiles.forEach(function (item) {
|
|
284
|
-
if (_this.isSameFile(item, uploadStartFile)) {
|
|
285
|
-
item.uploadStatus = 4; // 上传失败
|
|
286
|
-
|
|
287
|
-
item.percentComplete = Math.round(evt.loaded * 100 / evt.total);
|
|
288
|
-
item.Msg = '网络异常,请重新上传';
|
|
289
|
-
}
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
_this.setState({
|
|
293
|
-
uploadSuccessFiles: uploadSuccessFiles
|
|
294
|
-
});
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
xhr.open('POST', url, true);
|
|
298
|
-
xhr.send(formData); // 开始上传,发送form数据
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
_this._dealUploadStart = function (uploadStartFiles) {
|
|
302
|
-
var uploadSuccessFiles = [];
|
|
303
|
-
|
|
304
|
-
var uploadedFiles = _toConsumableArray(_this.state.uploadSuccessFiles); // 处理重传文件,直接展开会导致同样的文件展示两个
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
var uploadFilesConcatArr = uploadedFiles;
|
|
308
|
-
var isReloadFile = uploadFilesConcatArr.filter(function (item) {
|
|
309
|
-
return _this.isSameFile(item, uploadStartFiles[0]);
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
if (!isReloadFile || isReloadFile.length === 0) {
|
|
313
|
-
uploadFilesConcatArr = [].concat(_toConsumableArray(uploadedFiles), _toConsumableArray(uploadStartFiles));
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
uploadFilesConcatArr.forEach(function (item) {
|
|
317
|
-
var res = uploadSuccessFiles.filter(function (v) {
|
|
318
|
-
return _this.isSameFile(item, v);
|
|
319
|
-
});
|
|
320
|
-
uploadSuccessFiles.forEach(function (element) {
|
|
321
|
-
if (_this.isSameFile(item, element)) {
|
|
322
|
-
element = item;
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
if (res.length === 0) {
|
|
327
|
-
uploadSuccessFiles.push(item);
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
_this.setState({
|
|
332
|
-
uploadSuccessFiles: uploadSuccessFiles
|
|
333
|
-
});
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
_this._dealUploadSuccess = function (uploadSuccessFile) {
|
|
337
|
-
var _this$props2 = _this.props,
|
|
338
|
-
onSubmit = _this$props2.onSubmit,
|
|
339
|
-
onUploadSuccess = _this$props2.onUploadSuccess;
|
|
340
|
-
|
|
341
|
-
var uploadSuccessFiles = _toConsumableArray(_this.state.uploadSuccessFiles);
|
|
342
|
-
|
|
343
|
-
var uploadSuccessFilesFormat = uploadSuccessFiles.map(function (element) {
|
|
344
|
-
return _this.isSameFile(uploadSuccessFile, element) ? uploadSuccessFile : element;
|
|
345
|
-
});
|
|
346
|
-
var uploadSuccessFilesPath = uploadSuccessFilesFormat.map(function (item) {
|
|
347
|
-
return item.DfsPath;
|
|
348
|
-
}); // 获取文件上传后返回的路径
|
|
349
|
-
|
|
350
|
-
onSubmit(uploadSuccessFilesPath); // 将上传完成的文件路径传递给父组件
|
|
351
|
-
|
|
352
|
-
if (onUploadSuccess) onUploadSuccess(uploadSuccessFilesFormat);
|
|
353
|
-
|
|
354
|
-
_this.setState({
|
|
355
|
-
uploadSuccessFiles: uploadSuccessFilesFormat,
|
|
356
|
-
attachmentPreviewUrl: (0, _util.getPreviewImgs)(uploadSuccessFilesFormat)
|
|
357
|
-
});
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
_this.isImg = function (fileType) {
|
|
361
|
-
if (/^(jpg|png|gif|jpeg|image|JPG|PNG|GIF|JPEG)$/.test(fileType)) {
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
return false;
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
_this.getImgIndex = function (index) {
|
|
369
|
-
var newIndex = 0;
|
|
370
|
-
var uploadSuccessFiles = _this.state.uploadSuccessFiles;
|
|
371
|
-
|
|
372
|
-
for (var i = 0; i < index; i++) {
|
|
373
|
-
if (_this.isImg(uploadSuccessFiles[i].FileType)) {
|
|
374
|
-
newIndex++;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
return newIndex;
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
_this.handlerUploadPreviewOptions = function (index, options) {
|
|
382
|
-
var _this$props3 = _this.props,
|
|
383
|
-
onSubmit = _this$props3.onSubmit,
|
|
384
|
-
onDelete = _this$props3.onDelete;
|
|
385
|
-
|
|
386
|
-
if (options === 'cancel') {
|
|
387
|
-
var reUploadFileInfo = _this.state.uploadSuccessFiles[index];
|
|
388
|
-
reUploadFileInfo.requestXHR.abort();
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
if (options === 'delete' || options === 'cancel') {
|
|
392
|
-
var uploadResultFiles = _toConsumableArray(_this.state.uploadSuccessFiles);
|
|
393
|
-
|
|
394
|
-
var deleteFiles = uploadResultFiles[index];
|
|
395
|
-
onDelete && onDelete(deleteFiles.documentId ? deleteFiles.documentId : deleteFiles.DfsPath);
|
|
396
|
-
uploadResultFiles.splice(index, 1);
|
|
397
|
-
|
|
398
|
-
var _uploadSuccessFilesPath = uploadResultFiles.map(function (item) {
|
|
399
|
-
return item.DfsPath;
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
onSubmit(_uploadSuccessFilesPath, options);
|
|
403
|
-
|
|
404
|
-
_this.setState({
|
|
405
|
-
uploadSuccessFiles: uploadResultFiles
|
|
406
|
-
});
|
|
407
|
-
} else if (options === 'preview') {
|
|
408
|
-
var imgIndex = _this.getImgIndex(index);
|
|
409
|
-
|
|
410
|
-
_this.refs.imgViewerRef.show(imgIndex);
|
|
411
|
-
} else if (options === 'reupload') {
|
|
412
|
-
var _reUploadFileInfo = _this.state.uploadSuccessFiles[index];
|
|
413
|
-
var reUploadFile = _this.state.selectFiles[_reUploadFileInfo.FileName];
|
|
414
|
-
|
|
415
|
-
_this.dealSelectFiles([reUploadFile]);
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
_this.isSameFile = function (item, element) {
|
|
420
|
-
return item.FileName === element.FileName && item.FileSize === element.FileSize && item.FileLastModified === element.FileLastModified;
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
_this.renderUploadList = function (list) {
|
|
424
|
-
var _this$props4 = _this.props,
|
|
425
|
-
attachmentPreviewBox = _this$props4.attachmentPreviewBox,
|
|
426
|
-
_this$props4$showFile = _this$props4.showFileList,
|
|
427
|
-
showFileList = _this$props4$showFile === void 0 ? true : _this$props4$showFile;
|
|
428
|
-
var attachmentPreviewUrl = _this.state.attachmentPreviewUrl;
|
|
429
|
-
if (!list.length || !showFileList) return;
|
|
430
|
-
return /*#__PURE__*/_react["default"].createElement(_Portals["default"], {
|
|
431
|
-
domNode: attachmentPreviewBox,
|
|
432
|
-
className: "uploadFile__preview__list"
|
|
433
|
-
}, /*#__PURE__*/_react["default"].createElement(_imgViewer["default"], {
|
|
434
|
-
data: attachmentPreviewUrl,
|
|
435
|
-
ref: "imgViewerRef",
|
|
436
|
-
showDownload: false
|
|
437
|
-
}), list.map(function (item, index) {
|
|
438
|
-
return /*#__PURE__*/_react["default"].createElement(_uploadedPreview["default"], {
|
|
439
|
-
uploadResultItem: item,
|
|
440
|
-
index: index,
|
|
441
|
-
key: item.uid,
|
|
442
|
-
className: "uploaded__preview",
|
|
443
|
-
onSubmit: function onSubmit(index, options) {
|
|
444
|
-
_this.handlerUploadPreviewOptions(index, options);
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
}));
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
_this.handleButtonClick = function (e) {
|
|
451
|
-
e.nativeEvent.stopImmediatePropagation();
|
|
452
|
-
|
|
453
|
-
if (_this.refs.fileInput) {
|
|
454
|
-
// @ts-ignore
|
|
455
|
-
_this.refs.fileInput.click();
|
|
456
|
-
}
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
_this.state = {
|
|
460
|
-
uploadSuccessFiles: props.attachments || [],
|
|
461
|
-
attachmentPreviewUrl: props.attachments ? (0, _util.getPreviewImgs)(props.attachments) : [],
|
|
462
|
-
selectFiles: {}
|
|
463
|
-
};
|
|
464
|
-
return _this;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
_createClass(Upload, [{
|
|
468
|
-
key: "componentDidMount",
|
|
469
|
-
value: function componentDidMount() {
|
|
470
|
-
var attachments = this.props.attachments;
|
|
471
|
-
this.setState({
|
|
472
|
-
uploadSuccessFiles: attachments || [],
|
|
473
|
-
attachmentPreviewUrl: attachments ? (0, _util.getPreviewImgs)(attachments) : []
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
}, {
|
|
477
|
-
key: "componentWillReceiveProps",
|
|
478
|
-
value: function componentWillReceiveProps(nextProps) {
|
|
479
|
-
if (this.props.submitStatus === 2 && nextProps.submitStatus == 1) {
|
|
480
|
-
this.setState({
|
|
481
|
-
uploadSuccessFiles: [],
|
|
482
|
-
attachmentPreviewUrl: []
|
|
483
|
-
});
|
|
484
|
-
} else {
|
|
485
|
-
this.setState({
|
|
486
|
-
// uploadSuccessFiles: nextProps.attachments || [],
|
|
487
|
-
attachmentPreviewUrl: nextProps.attachments ? (0, _util.getPreviewImgs)(nextProps.attachments) : []
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
if (nextProps.dragFilesList && nextProps.dragFilesList.length) {
|
|
492
|
-
this.dealSelectFiles(nextProps.dragFilesList);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}, {
|
|
496
|
-
key: "onRemoveFile",
|
|
497
|
-
value: function onRemoveFile(index) {
|
|
498
|
-
var _uploadSuccessFiles = _toConsumableArray(this.state.uploadSuccessFiles);
|
|
499
|
-
|
|
500
|
-
_uploadSuccessFiles.splice(index, 1);
|
|
501
|
-
|
|
502
|
-
this.setState({
|
|
503
|
-
uploadSuccessFiles: _uploadSuccessFiles
|
|
504
|
-
});
|
|
505
|
-
}
|
|
506
|
-
}, {
|
|
507
|
-
key: "render",
|
|
508
|
-
value: function render() {
|
|
509
|
-
var _this2 = this;
|
|
510
|
-
|
|
511
|
-
var _this$props5 = this.props,
|
|
512
|
-
children = _this$props5.children,
|
|
513
|
-
className = _this$props5.className,
|
|
514
|
-
style = _this$props5.style,
|
|
515
|
-
_this$props5$attachme = _this$props5.attachmentTipText,
|
|
516
|
-
attachmentTipText = _this$props5$attachme === void 0 ? (0, _getLocale.getLocale)('OKR_MyO_KRP_Draganddropu') : _this$props5$attachme,
|
|
517
|
-
_this$props5$disableT = _this$props5.disableTooltip,
|
|
518
|
-
disableTooltip = _this$props5$disableT === void 0 ? false : _this$props5$disableT;
|
|
519
|
-
var uploadSuccessFiles = this.state.uploadSuccessFiles;
|
|
520
|
-
|
|
521
|
-
var uploadFormContainer = /*#__PURE__*/_react["default"].createElement(_style.UploadFormContainer, {
|
|
522
|
-
className: className,
|
|
523
|
-
style: style,
|
|
524
|
-
onMouseUp: function onMouseUp(e) {
|
|
525
|
-
return _this2.handleButtonClick(e);
|
|
526
|
-
}
|
|
527
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
528
|
-
ref: "uploader-trigger",
|
|
529
|
-
style: {
|
|
530
|
-
cursor: 'pointer'
|
|
531
|
-
}
|
|
532
|
-
}, children), /*#__PURE__*/_react["default"].createElement("input", {
|
|
533
|
-
type: "file",
|
|
534
|
-
ref: "fileInput",
|
|
535
|
-
className: "upload_file_input",
|
|
536
|
-
multiple: this.props.multiple,
|
|
537
|
-
style: {
|
|
538
|
-
display: 'none'
|
|
539
|
-
},
|
|
540
|
-
onChange: this.onFileInputChange
|
|
541
|
-
}));
|
|
542
|
-
|
|
543
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, disableTooltip ? uploadFormContainer : /*#__PURE__*/_react["default"].createElement(_titaUi.Tooltip, {
|
|
544
|
-
container: document.body,
|
|
545
|
-
content: /*#__PURE__*/_react["default"].createElement("p", {
|
|
546
|
-
dangerouslySetInnerHTML: {
|
|
547
|
-
__html: attachmentTipText
|
|
548
|
-
}
|
|
549
|
-
})
|
|
550
|
-
}, uploadFormContainer), this.renderUploadList(uploadSuccessFiles));
|
|
551
|
-
}
|
|
552
|
-
}]);
|
|
553
|
-
|
|
554
|
-
return Upload;
|
|
555
|
-
}(_react.PureComponent);
|
|
556
|
-
|
|
557
|
-
Upload.Preview = _uploadedPreview["default"];
|
|
558
|
-
Upload.defaultProps = {
|
|
559
|
-
fileNumLimit: 20,
|
|
560
|
-
fileSizeLimit: 50,
|
|
561
|
-
filesTotal: 50,
|
|
562
|
-
multiple: true,
|
|
563
|
-
attachmentPreviewBox: 'MBlog__attachmentViewBox'
|
|
564
|
-
};
|
|
565
|
-
var _default = Upload;
|
|
566
|
-
exports["default"] = _default;
|