vue-devui 1.0.0-beta.2 → 1.0.0-beta.220801
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 +163 -172
- package/alert/index.d.ts +7 -0
- package/alert/index.es.js +79 -51
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/auto-complete/index.d.ts +7 -0
- package/auto-complete/index.es.js +9044 -0
- package/auto-complete/index.umd.js +29 -0
- package/auto-complete/package.json +7 -0
- package/auto-complete/style.css +1 -0
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +154 -147
- package/avatar/index.umd.js +1 -1
- package/avatar/style.css +1 -1
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +46 -21
- package/badge/index.umd.js +1 -1
- package/badge/style.css +1 -1
- package/button/index.d.ts +7 -0
- package/button/index.es.js +5927 -131
- package/button/index.umd.js +27 -1
- package/button/style.css +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +64 -36
- package/card/index.umd.js +1 -1
- package/card/style.css +1 -1
- package/checkbox/index.d.ts +7 -0
- package/checkbox/index.es.js +8082 -232
- package/checkbox/index.umd.js +27 -1
- package/checkbox/style.css +1 -1
- package/collapse/index.d.ts +7 -0
- package/collapse/index.es.js +213 -0
- package/collapse/index.umd.js +1 -0
- package/{cascader → collapse}/package.json +1 -1
- package/collapse/style.css +1 -0
- package/countdown/index.d.ts +7 -0
- package/countdown/index.es.js +217 -0
- package/countdown/index.umd.js +1 -0
- package/{accordion → countdown}/package.json +1 -1
- package/countdown/style.css +1 -0
- package/date-picker-pro/index.d.ts +7 -0
- package/date-picker-pro/index.es.js +12018 -0
- package/date-picker-pro/index.umd.js +27 -0
- package/date-picker-pro/package.json +7 -0
- package/date-picker-pro/style.css +1 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +203 -139
- package/drawer/index.umd.js +1 -1
- package/drawer/style.css +1 -1
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +754 -0
- package/dropdown/index.umd.js +1 -0
- package/{carousel → dropdown}/package.json +1 -1
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +912 -442
- package/editable-select/index.umd.js +1 -1
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +2415 -1985
- package/form/index.umd.js +18 -18
- package/form/style.css +1 -1
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +138 -125
- package/fullscreen/index.umd.js +1 -1
- package/fullscreen/style.css +1 -1
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +284 -0
- package/grid/index.umd.js +1 -0
- package/{toast → grid}/package.json +1 -1
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +200 -56
- package/icon/index.umd.js +1 -1
- package/icon/style.css +1 -0
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +142 -39
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +8255 -145
- package/input/index.umd.js +27 -1
- package/input/style.css +1 -1
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +270 -186
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +41 -26
- package/layout/index.umd.js +1 -1
- package/layout/style.css +1 -1
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +77 -38
- package/loading/index.umd.js +1 -1
- package/loading/style.css +1 -1
- package/mention/index.d.ts +7 -0
- package/mention/index.es.js +8310 -0
- package/mention/index.umd.js +36 -0
- package/mention/package.json +7 -0
- package/mention/style.css +1 -0
- package/menu/index.d.ts +7 -0
- package/menu/index.es.js +870 -0
- package/menu/index.umd.js +1 -0
- package/{anchor → menu}/package.json +1 -1
- package/menu/style.css +1 -0
- package/message/index.d.ts +7 -0
- package/message/index.es.js +538 -0
- package/message/index.umd.js +1 -0
- package/message/package.json +7 -0
- package/message/style.css +1 -0
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +607 -841
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/notification/index.d.ts +7 -0
- package/notification/index.es.js +545 -0
- package/notification/index.umd.js +1 -0
- package/notification/package.json +7 -0
- package/notification/style.css +1 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/AutoComplete.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/ButtonGroup.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/CheckboxButton.js +3 -0
- package/nuxt/components/CheckboxGroup.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/Collapse.js +3 -0
- package/nuxt/components/CollapseItem.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DRangeDatePickerPro.js +3 -0
- package/nuxt/components/DatePickerPro.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/DrawerService.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/DropdownMenu.js +3 -0
- package/nuxt/components/DropdownPropsKey.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FORM_ITEM_TOKEN.js +3 -0
- package/nuxt/components/FORM_TOKEN.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/IFileOptions.js +3 -0
- package/nuxt/components/IUploadOptions.js +3 -0
- package/nuxt/components/Icon.js +3 -0
- package/nuxt/components/IconGroup.js +3 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/LABEL_DATA.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingOptions.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Mention.js +3 -0
- package/nuxt/components/Menu.js +3 -0
- package/nuxt/components/MenuItem.js +3 -0
- package/nuxt/components/Message.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/Notification.js +3 -0
- package/nuxt/components/NotificationService.js +3 -0
- package/nuxt/components/Option.js +3 -0
- package/nuxt/components/OptionGroup.js +3 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/PanelBody.js +3 -0
- package/nuxt/components/PanelFooter.js +3 -0
- package/nuxt/components/PanelHeader.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioButton.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/Step.js +3 -0
- package/nuxt/components/Steps.js +3 -0
- package/nuxt/components/SubMenu.js +3 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/TABLE_TOKEN.js +3 -0
- package/nuxt/components/Tab.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/TimeSelect.js +3 -0
- package/nuxt/components/Timeline.js +3 -0
- package/nuxt/components/TimelineItem.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/UploadStatus.js +3 -0
- package/nuxt/components/alertProps.js +3 -0
- package/nuxt/components/animationInjectionKey.js +3 -0
- package/nuxt/components/autoCompleteProps.js +3 -0
- package/nuxt/components/avatarProps.js +3 -0
- package/nuxt/components/badgeProps.js +3 -0
- package/nuxt/components/buttonGroupInjectionKey.js +3 -0
- package/nuxt/components/buttonGroupProps.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/components/cardProps.js +3 -0
- package/nuxt/components/checkboxGroupInjectionKey.js +3 -0
- package/nuxt/components/checkboxGroupProps.js +3 -0
- package/nuxt/components/checkboxProps.js +3 -0
- package/nuxt/components/colProps.js +3 -0
- package/nuxt/components/colPropsBaseClass.js +3 -0
- package/nuxt/components/colPropsBaseStyle.js +3 -0
- package/nuxt/components/collapseItemProps.js +3 -0
- package/nuxt/components/collapseProps.js +3 -0
- package/nuxt/components/countdownProps.js +3 -0
- package/nuxt/components/datePickerProCommonProps.js +3 -0
- package/nuxt/components/datePickerProPanelProps.js +3 -0
- package/nuxt/components/datePickerProProps.js +3 -0
- package/nuxt/components/dropdownMenuProps.js +3 -0
- package/nuxt/components/editableSelectProps.js +3 -0
- package/nuxt/components/fixedOverlayProps.js +3 -0
- package/nuxt/components/flexibleOverlayProps.js +3 -0
- package/nuxt/components/formItemProps.js +3 -0
- package/nuxt/components/formProps.js +3 -0
- package/nuxt/components/fullscreenProps.js +3 -0
- package/nuxt/components/iconProps.js +3 -0
- package/nuxt/components/imagePreviewProps.js +3 -0
- package/nuxt/components/inputProps.js +3 -0
- package/nuxt/components/loadingProps.js +3 -0
- package/nuxt/components/mentionProps.js +3 -0
- package/nuxt/components/messageProps.js +3 -0
- package/nuxt/components/modalProps.js +3 -0
- package/nuxt/components/notificationProps.js +3 -0
- package/nuxt/components/paginationProps.js +3 -0
- package/nuxt/components/panelProps.js +3 -0
- package/nuxt/components/popoverProps.js +3 -0
- package/nuxt/components/progressProps.js +3 -0
- package/nuxt/components/rateProps.js +3 -0
- package/nuxt/components/resultProps.js +3 -0
- package/nuxt/components/roundInjectionKey.js +3 -0
- package/nuxt/components/rowProps.js +3 -0
- package/nuxt/components/screenSizes.js +3 -0
- package/nuxt/components/searchProps.js +3 -0
- package/nuxt/components/skeletonItemProps.js +3 -0
- package/nuxt/components/skeletonProps.js +3 -0
- package/nuxt/components/sliderProps.js +3 -0
- package/nuxt/components/splitterProps.js +3 -0
- package/nuxt/components/statisticProps.js +3 -0
- package/nuxt/components/stepProps.js +3 -0
- package/nuxt/components/stepsProps.js +3 -0
- package/nuxt/components/svgIconProps.js +3 -0
- package/nuxt/components/switchProps.js +3 -0
- package/nuxt/components/tableProps.js +3 -0
- package/nuxt/components/tabsProps.js +3 -0
- package/nuxt/components/tagProps.js +3 -0
- package/nuxt/components/textareaProps.js +3 -0
- package/nuxt/components/timeAxisProps.js +3 -0
- package/nuxt/components/timerPickerPanelProps.js +3 -0
- package/nuxt/components/tooltipProps.js +3 -0
- package/nuxt/components/treeNodeProps.js +3 -0
- package/nuxt/components/treeProps.js +3 -0
- package/nuxt/components/uploadProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +245 -303
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +16 -84
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +333 -155
- package/pagination/index.umd.js +1 -1
- package/pagination/style.css +1 -1
- package/panel/index.d.ts +7 -0
- package/panel/index.es.js +48 -35
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +6035 -204
- package/popover/index.umd.js +27 -1
- package/popover/style.css +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +111 -57
- package/progress/index.umd.js +3 -3
- package/progress/style.css +1 -1
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +7976 -159
- package/radio/index.umd.js +27 -1
- package/radio/style.css +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +78 -56
- package/rate/index.umd.js +1 -1
- package/rate/style.css +1 -1
- package/result/index.d.ts +7 -0
- package/result/index.es.js +248 -0
- package/result/index.umd.js +1 -0
- package/{sticky → result}/package.json +1 -1
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +51 -43
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +8411 -450
- package/search/index.umd.js +27 -1
- package/search/style.css +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +9295 -561
- package/select/index.umd.js +27 -1
- package/select/style.css +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +115 -145
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +148 -142
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +6301 -167
- package/splitter/index.umd.js +27 -1
- package/splitter/style.css +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +274 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.d.ts +7 -0
- package/status/index.es.js +29 -8
- package/status/index.umd.js +1 -1
- package/status/style.css +1 -1
- package/steps/index.d.ts +7 -0
- package/steps/index.es.js +386 -0
- package/steps/index.umd.js +1 -0
- package/steps/package.json +7 -0
- package/steps/style.css +1 -0
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +7805 -65
- package/switch/index.umd.js +27 -1
- package/switch/style.css +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +11423 -207
- package/table/index.umd.js +27 -1
- package/table/style.css +1 -1
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +356 -143
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +156 -0
- package/tag/index.umd.js +1 -0
- package/tag/package.json +7 -0
- package/tag/style.css +1 -0
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +7973 -0
- package/textarea/index.umd.js +35 -0
- package/textarea/package.json +7 -0
- package/textarea/style.css +1 -0
- package/{theme → theme/theme.scss} +0 -0
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +9101 -581
- package/time-picker/index.umd.js +27 -1
- package/time-picker/style.css +1 -1
- package/time-select/index.d.ts +7 -0
- package/time-select/index.es.js +9585 -0
- package/time-select/index.umd.js +27 -0
- package/{breadcrumb → time-select}/package.json +1 -1
- package/time-select/style.css +1 -0
- package/timeline/index.d.ts +7 -0
- package/timeline/index.es.js +427 -0
- package/timeline/index.umd.js +1 -0
- package/timeline/package.json +7 -0
- package/timeline/style.css +1 -0
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.es.js +5870 -141
- package/tooltip/index.umd.js +27 -1
- package/tooltip/style.css +1 -1
- package/tree/index.d.ts +7 -0
- package/tree/index.es.js +11438 -654
- package/tree/index.umd.js +27 -1
- package/tree/style.css +1 -1
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +981 -2719
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +22794 -16605
- package/vue-devui.umd.js +31 -20
- package/accordion/index.es.js +0 -190
- package/accordion/index.umd.js +0 -1
- package/accordion/style.css +0 -1
- package/anchor/index.es.js +0 -263
- package/anchor/index.umd.js +0 -1
- package/anchor/style.css +0 -1
- package/breadcrumb/index.es.js +0 -127
- package/breadcrumb/index.umd.js +0 -1
- package/breadcrumb/style.css +0 -1
- package/carousel/index.es.js +0 -328
- package/carousel/index.umd.js +0 -1
- package/carousel/style.css +0 -1
- package/cascader/index.es.js +0 -187
- package/cascader/index.umd.js +0 -1
- package/cascader/style.css +0 -1
- package/date-picker/index.es.js +0 -1171
- package/date-picker/index.umd.js +0 -1
- package/date-picker/package.json +0 -7
- package/date-picker/style.css +0 -1
- package/nav-sprite/index.es.js +0 -742
- package/nav-sprite/index.umd.js +0 -1
- package/nav-sprite/package.json +0 -7
- package/quadrant-diagram/index.es.js +0 -489
- package/quadrant-diagram/index.umd.js +0 -1
- package/quadrant-diagram/package.json +0 -7
- package/quadrant-diagram/style.css +0 -1
- package/steps-guide/index.es.js +0 -211
- package/steps-guide/index.umd.js +0 -1
- package/steps-guide/package.json +0 -7
- package/steps-guide/style.css +0 -1
- package/sticky/index.es.js +0 -197
- package/sticky/index.umd.js +0 -1
- package/tag-input/index.es.js +0 -341
- package/tag-input/index.umd.js +0 -1
- package/tag-input/package.json +0 -7
- package/tag-input/style.css +0 -1
- package/time-axis/index.es.js +0 -79
- package/time-axis/index.umd.js +0 -1
- package/time-axis/package.json +0 -7
- package/time-axis/style.css +0 -1
- package/toast/index.es.js +0 -2059
- package/toast/index.umd.js +0 -1
- package/toast/style.css +0 -1
- package/transfer/index.es.js +0 -1446
- package/transfer/index.umd.js +0 -1
- package/transfer/package.json +0 -7
- package/transfer/style.css +0 -1
- package/tree-select/index.es.js +0 -203
- package/tree-select/index.umd.js +0 -1
- package/tree-select/package.json +0 -7
- package/tree-select/style.css +0 -1
|
@@ -4,16 +4,25 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { defineComponent, ref, computed, onMounted, createVNode, createTextVNode, createApp } from "vue";
|
|
8
|
-
var imagePreview$1 = "";
|
|
7
|
+
import { defineComponent, ref, computed, onMounted, onUnmounted, createVNode, Fragment, createTextVNode, createApp } from "vue";
|
|
9
8
|
const imagePreviewProps = {
|
|
10
9
|
url: {
|
|
11
10
|
type: String,
|
|
12
|
-
default: ""
|
|
11
|
+
default: "",
|
|
12
|
+
required: true
|
|
13
13
|
},
|
|
14
14
|
previewUrlList: {
|
|
15
15
|
type: Array,
|
|
16
|
-
default: () => []
|
|
16
|
+
default: () => [],
|
|
17
|
+
required: true
|
|
18
|
+
},
|
|
19
|
+
zIndex: {
|
|
20
|
+
type: Number,
|
|
21
|
+
required: false
|
|
22
|
+
},
|
|
23
|
+
backDropZIndex: {
|
|
24
|
+
type: Number,
|
|
25
|
+
required: false
|
|
17
26
|
}
|
|
18
27
|
};
|
|
19
28
|
class Transform {
|
|
@@ -132,16 +141,47 @@ class Transform {
|
|
|
132
141
|
this.el.style.transform = `translate(${this.transformX}px, ${this.transformY}px) scale(${this.zoom}) rotate(${this.rotate}turn)`;
|
|
133
142
|
}
|
|
134
143
|
}
|
|
144
|
+
function createBem(namespace, element, modifier) {
|
|
145
|
+
let cls = namespace;
|
|
146
|
+
if (element) {
|
|
147
|
+
cls += `__${element}`;
|
|
148
|
+
}
|
|
149
|
+
if (modifier) {
|
|
150
|
+
cls += `--${modifier}`;
|
|
151
|
+
}
|
|
152
|
+
return cls;
|
|
153
|
+
}
|
|
154
|
+
function useNamespace(block, needDot = false) {
|
|
155
|
+
const namespace = needDot ? `.devui-${block}` : `devui-${block}`;
|
|
156
|
+
const b = () => createBem(namespace);
|
|
157
|
+
const e = (element) => element ? createBem(namespace, element) : "";
|
|
158
|
+
const m = (modifier) => modifier ? createBem(namespace, "", modifier) : "";
|
|
159
|
+
const em = (element, modifier) => element && modifier ? createBem(namespace, element, modifier) : "";
|
|
160
|
+
return {
|
|
161
|
+
b,
|
|
162
|
+
e,
|
|
163
|
+
m,
|
|
164
|
+
em
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
var imagePreview$1 = "";
|
|
135
168
|
var imagePreview = defineComponent({
|
|
136
169
|
name: "DImagePreview",
|
|
137
170
|
props: imagePreviewProps,
|
|
138
171
|
emits: [],
|
|
139
172
|
setup(props) {
|
|
173
|
+
const ns = useNamespace("image-preview");
|
|
140
174
|
let transform = null;
|
|
141
175
|
const index2 = ref(0);
|
|
142
176
|
const url = computed(() => props.previewUrlList[index2.value]);
|
|
177
|
+
const imageStyle = props.zIndex ? {
|
|
178
|
+
zIndex: props.zIndex
|
|
179
|
+
} : {};
|
|
180
|
+
const bgStyle = props.backDropZIndex ? {
|
|
181
|
+
zIndex: props.backDropZIndex
|
|
182
|
+
} : {};
|
|
143
183
|
function initTransform() {
|
|
144
|
-
const imageElement = document.querySelector("
|
|
184
|
+
const imageElement = document.querySelector(`.${ns.e("main-image")}`);
|
|
145
185
|
transform = new Transform(imageElement);
|
|
146
186
|
}
|
|
147
187
|
function initIndex() {
|
|
@@ -171,18 +211,41 @@ var imagePreview = defineComponent({
|
|
|
171
211
|
function onZoomOriginal() {
|
|
172
212
|
transform.setZoomOriginal();
|
|
173
213
|
}
|
|
214
|
+
function onKeyDown(event) {
|
|
215
|
+
if (event.defaultPrevented) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
if (event.code === "Escape") {
|
|
219
|
+
onClose();
|
|
220
|
+
} else if (event.code === "ArrowLeft") {
|
|
221
|
+
onPrev();
|
|
222
|
+
} else if (event.code === "ArrowRight") {
|
|
223
|
+
onNext();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function initKeyboard() {
|
|
227
|
+
document.addEventListener("keydown", onKeyDown, false);
|
|
228
|
+
}
|
|
229
|
+
function unKeyBoard() {
|
|
230
|
+
document.removeEventListener("keydown", onKeyDown, false);
|
|
231
|
+
}
|
|
174
232
|
onMounted(() => {
|
|
175
233
|
initIndex();
|
|
176
234
|
initTransform();
|
|
235
|
+
initKeyboard();
|
|
236
|
+
});
|
|
237
|
+
onUnmounted(() => {
|
|
238
|
+
unKeyBoard();
|
|
177
239
|
});
|
|
178
240
|
return () => {
|
|
179
|
-
return createVNode("div", {
|
|
180
|
-
"class":
|
|
241
|
+
return createVNode(Fragment, null, [createVNode("div", {
|
|
242
|
+
"class": ns.b(),
|
|
243
|
+
"style": imageStyle
|
|
181
244
|
}, [createVNode("img", {
|
|
182
|
-
"class": "
|
|
245
|
+
"class": ns.e("main-image"),
|
|
183
246
|
"src": url.value
|
|
184
247
|
}, null), createVNode("button", {
|
|
185
|
-
"class": "
|
|
248
|
+
"class": ns.e("close-btn"),
|
|
186
249
|
"onClick": onClose
|
|
187
250
|
}, [createVNode("svg", {
|
|
188
251
|
"width": "16px",
|
|
@@ -197,9 +260,9 @@ var imagePreview = defineComponent({
|
|
|
197
260
|
}, [createVNode("polygon", {
|
|
198
261
|
"fill": "#293040",
|
|
199
262
|
"fill-rule": "nonzero",
|
|
200
|
-
"points": "8 6.58578644 12.2426407 2.34314575 13.6568542 3.75735931 9.41421356 8
|
|
263
|
+
"points": "8 6.58578644 12.2426407 2.34314575 13.6568542 3.75735931 9.41421356 8 13.6568542 12.2426407 12.2426407 13.6568542 8 9.41421356 3.75735931 13.6568542 2.34314575 12.2426407 6.58578644 8 2.34314575 3.75735931 3.75735931 2.34314575"
|
|
201
264
|
}, null)])])]), createVNode("button", {
|
|
202
|
-
"class": "
|
|
265
|
+
"class": ns.e("arrow-left"),
|
|
203
266
|
"onClick": onPrev
|
|
204
267
|
}, [createVNode("svg", {
|
|
205
268
|
"width": "18px",
|
|
@@ -214,9 +277,9 @@ var imagePreview = defineComponent({
|
|
|
214
277
|
}, [createVNode("polygon", {
|
|
215
278
|
"fill": "#293040",
|
|
216
279
|
"fill-rule": "nonzero",
|
|
217
|
-
"points": "10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322
|
|
280
|
+
"points": "10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"
|
|
218
281
|
}, null)])])]), createVNode("button", {
|
|
219
|
-
"class": "
|
|
282
|
+
"class": ns.e("arrow-right"),
|
|
220
283
|
"onClick": onNext
|
|
221
284
|
}, [createVNode("svg", {
|
|
222
285
|
"width": "18px",
|
|
@@ -232,9 +295,9 @@ var imagePreview = defineComponent({
|
|
|
232
295
|
"fill": "#293040",
|
|
233
296
|
"fill-rule": "nonzero",
|
|
234
297
|
"transform": "translate(8.146447, 8.000000) scale(-1, 1) translate(-8.146447, -8.000000) ",
|
|
235
|
-
"points": "11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322
|
|
298
|
+
"points": "11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322 11.7071068 3.70710678 7.41421356 8"
|
|
236
299
|
}, null)])])]), createVNode("div", {
|
|
237
|
-
"class": "
|
|
300
|
+
"class": ns.e("toolbar")
|
|
238
301
|
}, [createVNode("button", {
|
|
239
302
|
"onClick": onZoomIn
|
|
240
303
|
}, [createVNode("svg", {
|
|
@@ -250,7 +313,7 @@ var imagePreview = defineComponent({
|
|
|
250
313
|
"fill": "#293040",
|
|
251
314
|
"fill-rule": "nonzero"
|
|
252
315
|
}, [createVNode("path", {
|
|
253
|
-
"d": "M6,6 L6,4 L8,4 L8,6 L10,6 L10,8 L8,8 L8,10 L6,10 L6,8 L4,8 L4,6 L6,6 Z
|
|
316
|
+
"d": "M6,6 L6,4 L8,4 L8,6 L10,6 L10,8 L8,8 L8,10 L6,10 L6,8 L4,8 L4,6 L6,6 Z M12.6063847,11.1921711 L15.6568542,14.2426407 L14.2426407,15.6568542 L11.1921711,12.6063847 C10.0235906,13.4815965 8.5723351,14 7,14 C3.13400675,14 0,10.8659932 0,7 C0,3.13400675 3.13400675,0 7,0 C10.8659932,0 14,3.13400675 14,7 C14,8.5723351 13.4815965,10.0235906 12.6063847,11.1921711 L12.6063847,11.1921711 Z M7,12 C9.76142375,12 12,9.76142375 12,7 C12,4.23857625 9.76142375,2 7,2 C4.23857625,2 2,4.23857625 2,7 C2,9.76142375 4.23857625,12 7,12 Z"
|
|
254
317
|
}, null)])])])]), createVNode("button", {
|
|
255
318
|
"onClick": onZoomOut
|
|
256
319
|
}, [createVNode("svg", {
|
|
@@ -266,7 +329,7 @@ var imagePreview = defineComponent({
|
|
|
266
329
|
"fill": "#293040",
|
|
267
330
|
"fill-rule": "nonzero"
|
|
268
331
|
}, [createVNode("path", {
|
|
269
|
-
"d": "M12.6063847,11.1921711 L15.6568542,14.2426407 L14.2426407,15.6568542
|
|
332
|
+
"d": "M12.6063847,11.1921711 L15.6568542,14.2426407 L14.2426407,15.6568542 L11.1921711,12.6063847 C10.0235906,13.4815965 8.5723351,14 7,14 C3.13400675,14 0,10.8659932 0,7 C0,3.13400675 3.13400675,0 7,0 C10.8659932,0 14,3.13400675 14,7 C14,8.5723351 13.4815965,10.0235906 12.6063847,11.1921711 L12.6063847,11.1921711 Z M7,12 C9.76142375,12 12,9.76142375 12,7 C12,4.23857625 9.76142375,2 7,2 C4.23857625,2 2,4.23857625 2,7 C2,9.76142375 4.23857625,12 7,12 Z M4,6 L10,6 L10,8 L4,8 L4,6 Z"
|
|
270
333
|
}, null)])])])]), createVNode("button", {
|
|
271
334
|
"onClick": onRotate
|
|
272
335
|
}, [createVNode("svg", {
|
|
@@ -280,7 +343,7 @@ var imagePreview = defineComponent({
|
|
|
280
343
|
"fill": "none",
|
|
281
344
|
"fill-rule": "evenodd"
|
|
282
345
|
}, [createVNode("path", {
|
|
283
|
-
"d": "M7.5,3.02242151 L7.5,4 L4.5,2 L7.5,0 L7.5,1.01640228 C7.66526181,1.00552468
|
|
346
|
+
"d": "M7.5,3.02242151 L7.5,4 L4.5,2 L7.5,0 L7.5,1.01640228 C7.66526181,1.00552468 7.83198572,1 8,1 C12.1421356,1 15.5,4.35786438 15.5,8.5 C15.5,12.6421356 12.1421356,16 8,16 C3.85786438,16 0.5,12.6421356 0.5,8.5 C0.5,6.9828355 0.950484514,5.5708873 1.72499011,4.39061882 L3.42173231,5.4510827 C2.83944149,6.32371289 2.5,7.37221604 2.5,8.5 C2.5,11.5375661 4.96243388,14 8,14 C11.0375661,14 13.5,11.5375661 13.5,8.5 C13.5,5.46243388 11.0375661,3 8,3 C7.83145515,3 7.66468102,3.00758131 7.5,3.02242151 Z M8,11 C6.61928813,11 5.5,9.88071187 5.5,8.5 C5.5,7.11928813 6.61928813,6 8,6 C9.38071187,6 10.5,7.11928813 10.5,8.5 C10.5,9.88071187 9.38071187,11 8,11 Z M8,10 C8.82842712,10 9.5,9.32842712 9.5,8.5 C9.5,7.67157288 8.82842712,7 8,7 C7.17157288,7 6.5,7.67157288 6.5,8.5 C6.5,9.32842712 7.17157288,10 8,10 Z",
|
|
284
347
|
"fill": "#293040"
|
|
285
348
|
}, null)])])]), createVNode("button", {
|
|
286
349
|
"onClick": onPrev
|
|
@@ -297,11 +360,10 @@ var imagePreview = defineComponent({
|
|
|
297
360
|
}, [createVNode("polygon", {
|
|
298
361
|
"fill": "#293040",
|
|
299
362
|
"fill-rule": "nonzero",
|
|
300
|
-
"points": "10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322
|
|
363
|
+
"points": "10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"
|
|
301
364
|
}, null)])])]), createVNode("span", {
|
|
302
|
-
"class": "
|
|
365
|
+
"class": ns.e("index")
|
|
303
366
|
}, [index2.value + 1, createTextVNode(":"), props.previewUrlList.length]), createVNode("button", {
|
|
304
|
-
"class": "devui-next",
|
|
305
367
|
"onClick": onNext
|
|
306
368
|
}, [createVNode("svg", {
|
|
307
369
|
"width": "16px",
|
|
@@ -317,7 +379,7 @@ var imagePreview = defineComponent({
|
|
|
317
379
|
"fill": "#293040",
|
|
318
380
|
"fill-rule": "nonzero",
|
|
319
381
|
"transform": "translate(8.146447, 8.000000) scale(-1, 1) translate(-8.146447, -8.000000) ",
|
|
320
|
-
"points": "11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322
|
|
382
|
+
"points": "11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322 11.7071068 3.70710678 7.41421356 8"
|
|
321
383
|
}, null)])])]), createVNode("button", {
|
|
322
384
|
"onClick": onZoomBest
|
|
323
385
|
}, [createVNode("svg", {
|
|
@@ -330,12 +392,15 @@ var imagePreview = defineComponent({
|
|
|
330
392
|
"fill": "none",
|
|
331
393
|
"fill-rule": "evenodd"
|
|
332
394
|
}, [createVNode("path", {
|
|
333
|
-
"d": "M16,16 L11.429,16 L11.429,15 L14.456,15 L11.006,11.226 L11.652,10.519 L15.086,14.275
|
|
395
|
+
"d": "M16,16 L11.429,16 L11.429,15 L14.456,15 L11.006,11.226 L11.652,10.519 L15.086,14.275 L15.086,11 L16,11 L16,16 Z M15.164,1.544 L12.009,4.994 L11.418,4.348 L14.558,0.914 L11.82,0.914 L11.82,0 L16,0 L16,4.571 L15.164,4.571 L15.164,1.544 Z M5,15 L5,16 L0,16 L0,11 L1,11 L1,14.275 L4.756,10.519 L5.463,11.226 L1.689,15 L5,15 Z M4.365,4.994 L0.914,1.544 L0.914,4.571 L3.41060513e-13,4.571 L3.41060513e-13,0 L4.571,0 L4.571,0.914 L1.578,0.914 L5.011,4.348 L4.365,4.994 Z",
|
|
334
396
|
"fill": "#293040",
|
|
335
397
|
"fill-rule": "nonzero"
|
|
336
398
|
}, null)])])]), createVNode("button", {
|
|
337
399
|
"onClick": onZoomOriginal
|
|
338
|
-
}, [createVNode("span", null, [createTextVNode("1:1")])])])])
|
|
400
|
+
}, [createVNode("span", null, [createTextVNode("1:1")])])])]), createVNode("div", {
|
|
401
|
+
"class": ns.e("bg"),
|
|
402
|
+
"style": bgStyle
|
|
403
|
+
}, null)]);
|
|
339
404
|
};
|
|
340
405
|
}
|
|
341
406
|
});
|
|
@@ -363,8 +428,13 @@ class ImagePreviewService {
|
|
|
363
428
|
__publicField(ImagePreviewService, "$body", null);
|
|
364
429
|
__publicField(ImagePreviewService, "$div", null);
|
|
365
430
|
__publicField(ImagePreviewService, "$overflow", "");
|
|
366
|
-
function mountedPreviewImages(
|
|
367
|
-
ImagePreviewService.open({
|
|
431
|
+
function mountedPreviewImages(props) {
|
|
432
|
+
ImagePreviewService.open({
|
|
433
|
+
url: props.url,
|
|
434
|
+
previewUrlList: props.previewUrlList,
|
|
435
|
+
zIndex: props.zIndex,
|
|
436
|
+
backDropZIndex: props.backDropZIndex
|
|
437
|
+
});
|
|
368
438
|
}
|
|
369
439
|
function unmountedPreviewImages() {
|
|
370
440
|
ImagePreviewService.close();
|
|
@@ -373,17 +443,27 @@ function getImgByEl(el) {
|
|
|
373
443
|
const urlList = [...el.querySelectorAll("img")].map((item) => item.getAttribute("src"));
|
|
374
444
|
return urlList;
|
|
375
445
|
}
|
|
446
|
+
function handleImg(e) {
|
|
447
|
+
var _a;
|
|
448
|
+
e.stopPropagation();
|
|
449
|
+
const el = e.currentTarget;
|
|
450
|
+
const target = e.target;
|
|
451
|
+
if (((_a = target == null ? void 0 : target.nodeName) == null ? void 0 : _a.toLowerCase()) === "img") {
|
|
452
|
+
const urlList = getImgByEl(el);
|
|
453
|
+
const url = target.getAttribute("src");
|
|
454
|
+
mountedPreviewImages({
|
|
455
|
+
url,
|
|
456
|
+
previewUrlList: urlList,
|
|
457
|
+
zIndex: el == null ? void 0 : el.zIndex,
|
|
458
|
+
backDropZIndex: el == null ? void 0 : el.backDropZIndex
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
}
|
|
376
462
|
function handleImgByEl(el) {
|
|
377
|
-
el.addEventListener("click",
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
if (((_a = target == null ? void 0 : target.nodeName) == null ? void 0 : _a.toLowerCase()) === "img") {
|
|
382
|
-
const urlList = getImgByEl(el);
|
|
383
|
-
const url = target.getAttribute("src");
|
|
384
|
-
mountedPreviewImages(url, urlList);
|
|
385
|
-
}
|
|
386
|
-
});
|
|
463
|
+
el.addEventListener("click", handleImg);
|
|
464
|
+
}
|
|
465
|
+
function removeHandle(el) {
|
|
466
|
+
el.removeEventListener("click", handleImg);
|
|
387
467
|
}
|
|
388
468
|
var ImagePreviewDirective = {
|
|
389
469
|
mounted(el, binding) {
|
|
@@ -394,7 +474,12 @@ var ImagePreviewDirective = {
|
|
|
394
474
|
if (custom instanceof Object) {
|
|
395
475
|
custom.open = () => {
|
|
396
476
|
const urlList = getImgByEl(el);
|
|
397
|
-
mountedPreviewImages(
|
|
477
|
+
mountedPreviewImages({
|
|
478
|
+
url: urlList == null ? void 0 : urlList[0],
|
|
479
|
+
previewUrlList: urlList,
|
|
480
|
+
zIndex: el == null ? void 0 : el.zIndex,
|
|
481
|
+
backDropZIndex: el == null ? void 0 : el.backDropZIndex
|
|
482
|
+
});
|
|
398
483
|
};
|
|
399
484
|
custom.close = () => unmountedPreviewImages();
|
|
400
485
|
}
|
|
@@ -405,15 +490,33 @@ var ImagePreviewDirective = {
|
|
|
405
490
|
},
|
|
406
491
|
unmounted() {
|
|
407
492
|
unmountedPreviewImages();
|
|
493
|
+
},
|
|
494
|
+
updated(el, binding) {
|
|
495
|
+
var _a, _b;
|
|
496
|
+
el.zIndex = (_a = binding.value) == null ? void 0 : _a.zIndex;
|
|
497
|
+
el.backDropZIndex = (_b = binding.value) == null ? void 0 : _b.backDropZIndex;
|
|
498
|
+
if (binding.value) {
|
|
499
|
+
const {
|
|
500
|
+
value: { disableDefault },
|
|
501
|
+
oldValue: { disableDefault: oldDisableDefault }
|
|
502
|
+
} = binding;
|
|
503
|
+
if (disableDefault !== oldDisableDefault) {
|
|
504
|
+
if (disableDefault) {
|
|
505
|
+
removeHandle(el);
|
|
506
|
+
} else {
|
|
507
|
+
handleImgByEl(el);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
408
511
|
}
|
|
409
512
|
};
|
|
410
513
|
var index = {
|
|
411
514
|
title: "ImagePreview \u56FE\u7247\u9884\u89C8",
|
|
412
515
|
category: "\u6570\u636E\u5C55\u793A",
|
|
413
|
-
status: "
|
|
516
|
+
status: "100%",
|
|
414
517
|
install(app) {
|
|
415
518
|
app.directive("d-image-preview", ImagePreviewDirective);
|
|
416
519
|
app.config.globalProperties.$imagePreviewService = ImagePreviewService;
|
|
417
520
|
}
|
|
418
521
|
};
|
|
419
|
-
export { ImagePreviewDirective, ImagePreviewService, index as default };
|
|
522
|
+
export { ImagePreviewDirective, ImagePreviewService, index as default, imagePreviewProps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var T=Object.defineProperty;var $=(s,e,d)=>e in s?T(s,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):s[e]=d;var n=(s,e,d)=>($(s,typeof e!="symbol"?e+"":e,d),d);(function(s,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis!="undefined"?globalThis:s||self,e(s.index={},s.Vue))})(this,function(s,e){"use strict";var d="";const v={url:{type:String,default:""},previewUrlList:{type:Array,default:()=>[]}};class C{constructor(t,o={}){n(this,"el");n(this,"oTransformX",0);n(this,"oTransformY",0);n(this,"transformX");n(this,"transformY");n(this,"zoom");n(this,"rotate");n(this,"STEP",.25);n(this,"MIN_SCALE",.2);n(this,"MAX_SCALE",2.5);n(this,"TRANSFORMX",0);n(this,"TRANSFORMY",0);n(this,"ZOOM",1);n(this,"ROTATE",0);this.el=t,this.transformX=o.transformX||this.TRANSFORMX,this.transformY=o.transformY||this.TRANSFORMY,this.zoom=o.zoom||this.ZOOM,this.rotate=o.rotate||this.ROTATE,this.handleDefaultDraggable(),this.onDraggable(),this.onMouseWheel()}handleDefaultDraggable(){document.body.ondragstart=()=>(window.event.returnValue=!1,!1)}onDraggable(){this.el.onmousedown=t=>{const o=t.clientX,r=t.clientY;document.onmousemove=l=>{const c=l.clientX-o,h=l.clientY-r;this.transformX=this.oTransformX+c,this.transformY=this.oTransformY+h,this.el.style.cursor="grabbing",this.setPosition()}},document.onmouseup=()=>{document.onmousemove=null,this.oTransformX=this.transformX,this.oTransformY=this.transformY,this.el.style.cursor="grab"}}onMouseWheel(){const t=this.throttle(this.setMouseWheel,100);this.el.onmousewheel=o=>{const r=-o.wheelDelta||o.deltaY||o.detail;t(r)}}throttle(t,o){let r=null;return(...l)=>{r||setTimeout(()=>{r=null,t.apply(this,l)},o)}}setMouseWheel(t){if(t<0){if(this.zoom>=this.MAX_SCALE){this.el.style.cursor="not-allowed";return}this.el.style.cursor="zoom-in",this.setZoomIn(this.STEP)}else{if(this.zoom<=this.MIN_SCALE){this.el.style.cursor="not-allowed";return}this.el.style.cursor="zoom-out",this.setZoomOut(this.STEP)}this.setPosition()}setZoomIn(t=this.STEP){this.zoom=Math.min(this.MAX_SCALE,this.zoom+t),this.setPosition()}setZoomOut(t=this.STEP){this.zoom=Math.max(this.MIN_SCALE,this.zoom-t),this.setPosition()}setZoomBest(){this.reset(),this.setPosition()}setZoomOriginal(){this.reset(),this.setPosition()}setRotate(){this.rotate+=.25,this.setPosition()}reset(){this.transformX=this.TRANSFORMX,this.transformY=this.TRANSFORMY,this.zoom=this.ZOOM}setPosition(){this.el.style.transform=`translate(${this.transformX}px, ${this.transformY}px) scale(${this.zoom}) rotate(${this.rotate}turn)`}}var N=e.defineComponent({name:"DImagePreview",props:v,emits:[],setup(i){let t=null;const o=e.ref(0),r=e.computed(()=>i.previewUrlList[o.value]);function l(){const u=document.querySelector(".devui-image-preview-main-image");t=new C(u)}function c(){o.value=i.previewUrlList.findIndex(u=>u===i.url)}function h(){o.value=o.value<=0?i.previewUrlList.length-1:o.value-1}function p(){o.value=o.value>=i.previewUrlList.length-1?0:o.value+1}function x(){a.close()}function M(){t.setZoomIn()}function b(){t.setZoomOut()}function Z(){t.setRotate()}function k(){t.setZoomBest()}function P(){t.setZoomOriginal()}return e.onMounted(()=>{c(),l()}),()=>e.createVNode("div",{class:"devui-image-preview"},[e.createVNode("img",{class:"devui-image-preview-main-image",src:r.value},null),e.createVNode("button",{class:"devui-image-preview-close-btn",onClick:x},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"8 6.58578644 12.2426407 2.34314575 13.6568542 3.75735931 9.41421356 8 13.6568542 12.2426407 12.2426407 13.6568542 8 9.41421356 3.75735931 13.6568542 2.34314575 12.2426407 6.58578644 8 2.34314575 3.75735931 3.75735931 2.34314575"},null)])])]),e.createVNode("button",{class:"devui-image-preview-arrow-left",onClick:h},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"},null)])])]),e.createVNode("button",{class:"devui-image-preview-arrow-right",onClick:p},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",transform:"translate(8.146447, 8.000000) scale(-1, 1) translate(-8.146447, -8.000000) ",points:"11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322 11.7071068 3.70710678 7.41421356 8"},null)])])]),e.createVNode("div",{class:"devui-image-preview-toolbar"},[e.createVNode("button",{onClick:M},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{fill:"#293040","fill-rule":"nonzero"},[e.createVNode("path",{d:"M6,6 L6,4 L8,4 L8,6 L10,6 L10,8 L8,8 L8,10 L6,10 L6,8 L4,8 L4,6 L6,6 Z M12.6063847,11.1921711 L15.6568542,14.2426407 L14.2426407,15.6568542 L11.1921711,12.6063847 C10.0235906,13.4815965 8.5723351,14 7,14 C3.13400675,14 0,10.8659932 0,7 C0,3.13400675 3.13400675,0 7,0 C10.8659932,0 14,3.13400675 14,7 C14,8.5723351 13.4815965,10.0235906 12.6063847,11.1921711 L12.6063847,11.1921711 Z M7,12 C9.76142375,12 12,9.76142375 12,7 C12,4.23857625 9.76142375,2 7,2 C4.23857625,2 2,4.23857625 2,7 C2,9.76142375 4.23857625,12 7,12 Z"},null)])])])]),e.createVNode("button",{onClick:b},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{fill:"#293040","fill-rule":"nonzero"},[e.createVNode("path",{d:"M12.6063847,11.1921711 L15.6568542,14.2426407 L14.2426407,15.6568542 L11.1921711,12.6063847 C10.0235906,13.4815965 8.5723351,14 7,14 C3.13400675,14 0,10.8659932 0,7 C0,3.13400675 3.13400675,0 7,0 C10.8659932,0 14,3.13400675 14,7 C14,8.5723351 13.4815965,10.0235906 12.6063847,11.1921711 L12.6063847,11.1921711 Z M7,12 C9.76142375,12 12,9.76142375 12,7 C12,4.23857625 9.76142375,2 7,2 C4.23857625,2 2,4.23857625 2,7 C2,9.76142375 4.23857625,12 7,12 Z M4,6 L10,6 L10,8 L4,8 L4,6 Z"},null)])])])]),e.createVNode("button",{onClick:Z},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M7.5,3.02242151 L7.5,4 L4.5,2 L7.5,0 L7.5,1.01640228 C7.66526181,1.00552468 7.83198572,1 8,1 C12.1421356,1 15.5,4.35786438 15.5,8.5 C15.5,12.6421356 12.1421356,16 8,16 C3.85786438,16 0.5,12.6421356 0.5,8.5 C0.5,6.9828355 0.950484514,5.5708873 1.72499011,4.39061882 L3.42173231,5.4510827 C2.83944149,6.32371289 2.5,7.37221604 2.5,8.5 C2.5,11.5375661 4.96243388,14 8,14 C11.0375661,14 13.5,11.5375661 13.5,8.5 C13.5,5.46243388 11.0375661,3 8,3 C7.83145515,3 7.66468102,3.00758131 7.5,3.02242151 Z M8,11 C6.61928813,11 5.5,9.88071187 5.5,8.5 C5.5,7.11928813 6.61928813,6 8,6 C9.38071187,6 10.5,7.11928813 10.5,8.5 C10.5,9.88071187 9.38071187,11 8,11 Z M8,10 C8.82842712,10 9.5,9.32842712 9.5,8.5 C9.5,7.67157288 8.82842712,7 8,7 C7.17157288,7 6.5,7.67157288 6.5,8.5 C6.5,9.32842712 7.17157288,10 8,10 Z",fill:"#293040"},null)])])]),e.createVNode("button",{onClick:h},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"},null)])])]),e.createVNode("span",{class:"devui-image-preview-index"},[o.value+1,e.createTextVNode(":"),i.previewUrlList.length]),e.createVNode("button",{class:"devui-next",onClick:p},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",transform:"translate(8.146447, 8.000000) scale(-1, 1) translate(-8.146447, -8.000000) ",points:"11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322 11.7071068 3.70710678 7.41421356 8"},null)])])]),e.createVNode("button",{onClick:k},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M16,16 L11.429,16 L11.429,15 L14.456,15 L11.006,11.226 L11.652,10.519 L15.086,14.275 L15.086,11 L16,11 L16,16 Z M15.164,1.544 L12.009,4.994 L11.418,4.348 L14.558,0.914 L11.82,0.914 L11.82,0 L16,0 L16,4.571 L15.164,4.571 L15.164,1.544 Z M5,15 L5,16 L0,16 L0,11 L1,11 L1,14.275 L4.756,10.519 L5.463,11.226 L1.689,15 L5,15 Z M4.365,4.994 L0.914,1.544 L0.914,4.571 L3.41060513e-13,4.571 L3.41060513e-13,0 L4.571,0 L4.571,0.914 L1.578,0.914 L5.011,4.348 L4.365,4.994 Z",fill:"#293040","fill-rule":"nonzero"},null)])])]),e.createVNode("button",{onClick:P},[e.createVNode("span",null,[e.createTextVNode("1:1")])])])])}});function V(i){return e.createApp(N,i)}class a{static open(t){this.$body=document.body,this.$div=document.createElement("div"),this.$overflow=this.$body.style.overflow,this.$body.appendChild(this.$div),V(t).mount(this.$div),this.$body.style.setProperty("overflow","hidden","important")}static close(){var t;(t=this.$body)==null||t.style.setProperty("overflow",this.$overflow),this.$overflow=null,this.$div&&this.$body.removeChild(this.$div),this.$body=null,this.$div=null}}n(a,"$body",null),n(a,"$div",null),n(a,"$overflow","");function m(i,t){a.open({url:i,previewUrlList:t})}function f(){a.close()}function g(i){return[...i.querySelectorAll("img")].map(o=>o.getAttribute("src"))}function L(i){i.addEventListener("click",t=>{var r;t.stopPropagation();const o=t.target;if(((r=o==null?void 0:o.nodeName)==null?void 0:r.toLowerCase())==="img"){const l=g(i),c=o.getAttribute("src");m(c,l)}})}var w={mounted(i,t){if(!t.value)return L(i);const{custom:o,disableDefault:r}=t.value;o instanceof Object&&(o.open=()=>{const l=g(i);m(l==null?void 0:l[0],l)},o.close=()=>f()),!r&&L(i)},unmounted(){f()}},y={title:"ImagePreview \u56FE\u7247\u9884\u89C8",category:"\u6570\u636E\u5C55\u793A",status:"\u5DF2\u5B8C\u6210",install(i){i.directive("d-image-preview",w),i.config.globalProperties.$imagePreviewService=a}};s.ImagePreviewDirective=w,s.ImagePreviewService=a,s.default=y,Object.defineProperty(s,"__esModule",{value:!0}),s[Symbol.toStringTag]="Module"});
|
|
1
|
+
var X=Object.defineProperty;var R=(s,e,d)=>e in s?X(s,e,{enumerable:!0,configurable:!0,writable:!0,value:d}):s[e]=d;var r=(s,e,d)=>(R(s,typeof e!="symbol"?e+"":e,d),d);(function(s,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis!="undefined"?globalThis:s||self,e(s.index={},s.Vue))})(this,function(s,e){"use strict";const d={url:{type:String,default:"",required:!0},previewUrlList:{type:Array,default:()=>[],required:!0},zIndex:{type:Number,required:!1},backDropZIndex:{type:Number,required:!1}};class k{constructor(o,n={}){r(this,"el");r(this,"oTransformX",0);r(this,"oTransformY",0);r(this,"transformX");r(this,"transformY");r(this,"zoom");r(this,"rotate");r(this,"STEP",.25);r(this,"MIN_SCALE",.2);r(this,"MAX_SCALE",2.5);r(this,"TRANSFORMX",0);r(this,"TRANSFORMY",0);r(this,"ZOOM",1);r(this,"ROTATE",0);this.el=o,this.transformX=n.transformX||this.TRANSFORMX,this.transformY=n.transformY||this.TRANSFORMY,this.zoom=n.zoom||this.ZOOM,this.rotate=n.rotate||this.ROTATE,this.handleDefaultDraggable(),this.onDraggable(),this.onMouseWheel()}handleDefaultDraggable(){document.body.ondragstart=()=>(window.event.returnValue=!1,!1)}onDraggable(){this.el.onmousedown=o=>{const n=o.clientX,i=o.clientY;document.onmousemove=l=>{const u=l.clientX-n,m=l.clientY-i;this.transformX=this.oTransformX+u,this.transformY=this.oTransformY+m,this.el.style.cursor="grabbing",this.setPosition()}},document.onmouseup=()=>{document.onmousemove=null,this.oTransformX=this.transformX,this.oTransformY=this.transformY,this.el.style.cursor="grab"}}onMouseWheel(){const o=this.throttle(this.setMouseWheel,100);this.el.onmousewheel=n=>{const i=-n.wheelDelta||n.deltaY||n.detail;o(i)}}throttle(o,n){let i=null;return(...l)=>{i||setTimeout(()=>{i=null,o.apply(this,l)},n)}}setMouseWheel(o){if(o<0){if(this.zoom>=this.MAX_SCALE){this.el.style.cursor="not-allowed";return}this.el.style.cursor="zoom-in",this.setZoomIn(this.STEP)}else{if(this.zoom<=this.MIN_SCALE){this.el.style.cursor="not-allowed";return}this.el.style.cursor="zoom-out",this.setZoomOut(this.STEP)}this.setPosition()}setZoomIn(o=this.STEP){this.zoom=Math.min(this.MAX_SCALE,this.zoom+o),this.setPosition()}setZoomOut(o=this.STEP){this.zoom=Math.max(this.MIN_SCALE,this.zoom-o),this.setPosition()}setZoomBest(){this.reset(),this.setPosition()}setZoomOriginal(){this.reset(),this.setPosition()}setRotate(){this.rotate+=.25,this.setPosition()}reset(){this.transformX=this.TRANSFORMX,this.transformY=this.TRANSFORMY,this.zoom=this.ZOOM}setPosition(){this.el.style.transform=`translate(${this.transformX}px, ${this.transformY}px) scale(${this.zoom}) rotate(${this.rotate}turn)`}}function f(t,o,n){let i=t;return o&&(i+=`__${o}`),n&&(i+=`--${n}`),i}function I(t,o=!1){const n=o?`.devui-${t}`:`devui-${t}`;return{b:()=>f(n),e:a=>a?f(n,a):"",m:a=>a?f(n,"",a):"",em:(a,L)=>a&&L?f(n,a,L):""}}var Y="",Z=e.defineComponent({name:"DImagePreview",props:d,emits:[],setup(t){const o=I("image-preview");let n=null;const i=e.ref(0),l=e.computed(()=>t.previewUrlList[i.value]),u=t.zIndex?{zIndex:t.zIndex}:{},m=t.backDropZIndex?{zIndex:t.backDropZIndex}:{};function a(){const h=document.querySelector(`.${o.e("main-image")}`);n=new k(h)}function L(){i.value=t.previewUrlList.findIndex(h=>h===t.url)}function w(){i.value=i.value<=0?t.previewUrlList.length-1:i.value-1}function p(){i.value=i.value>=t.previewUrlList.length-1?0:i.value+1}function y(){c.close()}function T(){n.setZoomIn()}function $(){n.setZoomOut()}function D(){n.setRotate()}function A(){n.setZoomBest()}function E(){n.setZoomOriginal()}function V(h){h.defaultPrevented||(h.code==="Escape"?y():h.code==="ArrowLeft"?w():h.code==="ArrowRight"&&p())}function S(){document.addEventListener("keydown",V,!1)}function O(){document.removeEventListener("keydown",V,!1)}return e.onMounted(()=>{L(),a(),S()}),e.onUnmounted(()=>{O()}),()=>e.createVNode(e.Fragment,null,[e.createVNode("div",{class:o.b(),style:u},[e.createVNode("img",{class:o.e("main-image"),src:l.value},null),e.createVNode("button",{class:o.e("close-btn"),onClick:y},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"8 6.58578644 12.2426407 2.34314575 13.6568542 3.75735931 9.41421356 8 13.6568542 12.2426407 12.2426407 13.6568542 8 9.41421356 3.75735931 13.6568542 2.34314575 12.2426407 6.58578644 8 2.34314575 3.75735931 3.75735931 2.34314575"},null)])])]),e.createVNode("button",{class:o.e("arrow-left"),onClick:w},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"},null)])])]),e.createVNode("button",{class:o.e("arrow-right"),onClick:p},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",transform:"translate(8.146447, 8.000000) scale(-1, 1) translate(-8.146447, -8.000000) ",points:"11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322 11.7071068 3.70710678 7.41421356 8"},null)])])]),e.createVNode("div",{class:o.e("toolbar")},[e.createVNode("button",{onClick:T},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{fill:"#293040","fill-rule":"nonzero"},[e.createVNode("path",{d:"M6,6 L6,4 L8,4 L8,6 L10,6 L10,8 L8,8 L8,10 L6,10 L6,8 L4,8 L4,6 L6,6 Z M12.6063847,11.1921711 L15.6568542,14.2426407 L14.2426407,15.6568542 L11.1921711,12.6063847 C10.0235906,13.4815965 8.5723351,14 7,14 C3.13400675,14 0,10.8659932 0,7 C0,3.13400675 3.13400675,0 7,0 C10.8659932,0 14,3.13400675 14,7 C14,8.5723351 13.4815965,10.0235906 12.6063847,11.1921711 L12.6063847,11.1921711 Z M7,12 C9.76142375,12 12,9.76142375 12,7 C12,4.23857625 9.76142375,2 7,2 C4.23857625,2 2,4.23857625 2,7 C2,9.76142375 4.23857625,12 7,12 Z"},null)])])])]),e.createVNode("button",{onClick:$},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("g",{fill:"#293040","fill-rule":"nonzero"},[e.createVNode("path",{d:"M12.6063847,11.1921711 L15.6568542,14.2426407 L14.2426407,15.6568542 L11.1921711,12.6063847 C10.0235906,13.4815965 8.5723351,14 7,14 C3.13400675,14 0,10.8659932 0,7 C0,3.13400675 3.13400675,0 7,0 C10.8659932,0 14,3.13400675 14,7 C14,8.5723351 13.4815965,10.0235906 12.6063847,11.1921711 L12.6063847,11.1921711 Z M7,12 C9.76142375,12 12,9.76142375 12,7 C12,4.23857625 9.76142375,2 7,2 C4.23857625,2 2,4.23857625 2,7 C2,9.76142375 4.23857625,12 7,12 Z M4,6 L10,6 L10,8 L4,8 L4,6 Z"},null)])])])]),e.createVNode("button",{onClick:D},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M7.5,3.02242151 L7.5,4 L4.5,2 L7.5,0 L7.5,1.01640228 C7.66526181,1.00552468 7.83198572,1 8,1 C12.1421356,1 15.5,4.35786438 15.5,8.5 C15.5,12.6421356 12.1421356,16 8,16 C3.85786438,16 0.5,12.6421356 0.5,8.5 C0.5,6.9828355 0.950484514,5.5708873 1.72499011,4.39061882 L3.42173231,5.4510827 C2.83944149,6.32371289 2.5,7.37221604 2.5,8.5 C2.5,11.5375661 4.96243388,14 8,14 C11.0375661,14 13.5,11.5375661 13.5,8.5 C13.5,5.46243388 11.0375661,3 8,3 C7.83145515,3 7.66468102,3.00758131 7.5,3.02242151 Z M8,11 C6.61928813,11 5.5,9.88071187 5.5,8.5 C5.5,7.11928813 6.61928813,6 8,6 C9.38071187,6 10.5,7.11928813 10.5,8.5 C10.5,9.88071187 9.38071187,11 8,11 Z M8,10 C8.82842712,10 9.5,9.32842712 9.5,8.5 C9.5,7.67157288 8.82842712,7 8,7 C7.17157288,7 6.5,7.67157288 6.5,8.5 C6.5,9.32842712 7.17157288,10 8,10 Z",fill:"#293040"},null)])])]),e.createVNode("button",{onClick:w},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",points:"10.7071068 12.2928932 9.29289322 13.7071068 3.58578644 8 9.29289322 2.29289322 10.7071068 3.70710678 6.41421356 8"},null)])])]),e.createVNode("span",{class:o.e("index")},[i.value+1,e.createTextVNode(":"),t.previewUrlList.length]),e.createVNode("button",{onClick:p},[e.createVNode("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",version:"1.1"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("polygon",{fill:"#293040","fill-rule":"nonzero",transform:"translate(8.146447, 8.000000) scale(-1, 1) translate(-8.146447, -8.000000) ",points:"11.7071068 12.2928932 10.2928932 13.7071068 4.58578644 8 10.2928932 2.29289322 11.7071068 3.70710678 7.41421356 8"},null)])])]),e.createVNode("button",{onClick:A},[e.createVNode("svg",{width:"18px",height:"18px",viewBox:"0 0 16 16"},[e.createVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createVNode("path",{d:"M16,16 L11.429,16 L11.429,15 L14.456,15 L11.006,11.226 L11.652,10.519 L15.086,14.275 L15.086,11 L16,11 L16,16 Z M15.164,1.544 L12.009,4.994 L11.418,4.348 L14.558,0.914 L11.82,0.914 L11.82,0 L16,0 L16,4.571 L15.164,4.571 L15.164,1.544 Z M5,15 L5,16 L0,16 L0,11 L1,11 L1,14.275 L4.756,10.519 L5.463,11.226 L1.689,15 L5,15 Z M4.365,4.994 L0.914,1.544 L0.914,4.571 L3.41060513e-13,4.571 L3.41060513e-13,0 L4.571,0 L4.571,0.914 L1.578,0.914 L5.011,4.348 L4.365,4.994 Z",fill:"#293040","fill-rule":"nonzero"},null)])])]),e.createVNode("button",{onClick:E},[e.createVNode("span",null,[e.createTextVNode("1:1")])])])]),e.createVNode("div",{class:o.e("bg"),style:m},null)])}});function M(t){return e.createApp(Z,t)}class c{static open(o){this.$body=document.body,this.$div=document.createElement("div"),this.$overflow=this.$body.style.overflow,this.$body.appendChild(this.$div),M(o).mount(this.$div),this.$body.style.setProperty("overflow","hidden","important")}static close(){var o;(o=this.$body)==null||o.style.setProperty("overflow",this.$overflow),this.$overflow=null,this.$div&&this.$body.removeChild(this.$div),this.$body=null,this.$div=null}}r(c,"$body",null),r(c,"$div",null),r(c,"$overflow","");function x(t){c.open({url:t.url,previewUrlList:t.previewUrlList,zIndex:t.zIndex,backDropZIndex:t.backDropZIndex})}function N(){c.close()}function C(t){return[...t.querySelectorAll("img")].map(n=>n.getAttribute("src"))}function v(t){var i;t.stopPropagation();const o=t.currentTarget,n=t.target;if(((i=n==null?void 0:n.nodeName)==null?void 0:i.toLowerCase())==="img"){const l=C(o),u=n.getAttribute("src");x({url:u,previewUrlList:l,zIndex:o==null?void 0:o.zIndex,backDropZIndex:o==null?void 0:o.backDropZIndex})}}function g(t){t.addEventListener("click",v)}function z(t){t.removeEventListener("click",v)}var b={mounted(t,o){if(!o.value)return g(t);const{custom:n,disableDefault:i}=o.value;n instanceof Object&&(n.open=()=>{const l=C(t);x({url:l==null?void 0:l[0],previewUrlList:l,zIndex:t==null?void 0:t.zIndex,backDropZIndex:t==null?void 0:t.backDropZIndex})},n.close=()=>N()),!i&&g(t)},unmounted(){N()},updated(t,o){var n,i;if(t.zIndex=(n=o.value)==null?void 0:n.zIndex,t.backDropZIndex=(i=o.value)==null?void 0:i.backDropZIndex,o.value){const{value:{disableDefault:l},oldValue:{disableDefault:u}}=o;l!==u&&(l?z(t):g(t))}}},P={title:"ImagePreview \u56FE\u7247\u9884\u89C8",category:"\u6570\u636E\u5C55\u793A",status:"100%",install(t){t.directive("d-image-preview",b),t.config.globalProperties.$imagePreviewService=c}};s.ImagePreviewDirective=b,s.ImagePreviewService=c,s.default=P,s.imagePreviewProps=d,Object.defineProperty(s,"__esModule",{value:!0}),s[Symbol.toStringTag]="Module"});
|
package/image-preview/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.devui-image-preview{position:fixed;left:0;top:0;right:0;bottom:0;z-index:calc(var(--devui-z-index-modal, 1050)
|
|
1
|
+
.devui-image-preview{position:fixed;left:0;top:0;right:0;bottom:0;z-index:calc(var(--devui-z-index-modal, 1050));display:flex;align-items:center;justify-content:center;overflow:hidden}.devui-image-preview svg,.devui-image-preview polygon,.devui-image-preview g,.devui-image-preview path{fill:var(--devui-icon-text, #71757f)}.devui-image-preview__main-image{width:auto;height:auto;max-width:90%;max-height:90%;margin-top:-20px;cursor:grab}.devui-image-preview__close-btn{position:fixed;z-index:var(--devui-z-index-modal, 1050);cursor:pointer;width:36px;height:36px;border-radius:50%;border:none;background:var(--devui-highlight-overlay, rgba(255, 255, 255, .8));box-shadow:var(--devui-shadow-length-base, 0 1px 4px 0) var(--devui-light-shadow, rgba(37, 43, 58, .1));display:inline-flex;align-items:center;justify-content:center;top:15px;right:20px}.devui-image-preview__close-btn:hover{background:var(--devui-area, #f8f8f8)}.devui-image-preview__close-btn svg{width:38px;height:18px}.devui-image-preview__arrow-left{position:fixed;z-index:var(--devui-z-index-modal, 1050);cursor:pointer;width:36px;height:36px;border-radius:50%;border:none;background:var(--devui-highlight-overlay, rgba(255, 255, 255, .8));box-shadow:var(--devui-shadow-length-base, 0 1px 4px 0) var(--devui-light-shadow, rgba(37, 43, 58, .1));display:inline-flex;align-items:center;justify-content:center;top:50%;left:20px;transform:translateY(-50%)}.devui-image-preview__arrow-left:hover{background:var(--devui-area, #f8f8f8)}.devui-image-preview__arrow-left svg{width:38px;height:18px}.devui-image-preview__arrow-right{position:fixed;z-index:var(--devui-z-index-modal, 1050);cursor:pointer;width:36px;height:36px;border-radius:50%;border:none;background:var(--devui-highlight-overlay, rgba(255, 255, 255, .8));box-shadow:var(--devui-shadow-length-base, 0 1px 4px 0) var(--devui-light-shadow, rgba(37, 43, 58, .1));display:inline-flex;align-items:center;justify-content:center;top:50%;right:20px;transform:translateY(-50%)}.devui-image-preview__arrow-right:hover{background:var(--devui-area, #f8f8f8)}.devui-image-preview__arrow-right svg{width:38px;height:18px}.devui-image-preview__toolbar{position:fixed;bottom:0;left:0;width:100%;height:50px;display:flex;align-items:center;justify-content:center;background:var(--devui-highlight-overlay, rgba(255, 255, 255, .8));box-shadow:var(--devui-shadow-length-fullscreen-overlay, 0 12px 24px 0) var(--devui-light-shadow, rgba(37, 43, 58, .1))}.devui-image-preview__toolbar button{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;color:var(--devui-text, #252b3a);border:none;background-color:transparent;cursor:pointer;outline:0;padding:0}.devui-image-preview__toolbar .devui-image-preview__index{display:inline-flex;width:100px;justify-content:center;align-items:center;cursor:pointer}.devui-image-preview__toolbar>:not(:first-child){margin-left:20px}.devui-image-preview__bg{position:fixed;left:0;top:0;right:0;bottom:0;z-index:calc(var(--devui-z-index-modal, 1050) - 1);background:var(--devui-shadow, rgba(37, 43, 58, .2))}
|
package/index.d.ts
ADDED