bmp-layout 0.0.14 → 0.0.16

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/bmp-layout.es.js CHANGED
@@ -1,9 +1,9 @@
1
- import { openBlock, createBlock, unref, normalizeClass, nextTick, ref, computed, watch, withCtx, createElementBlock, createElementVNode, normalizeStyle, createVNode, Fragment, defineComponent, isVNode, Teleport, Transition, withModifiers, toDisplayString, renderList, createCommentVNode, resolveComponent, provide, resolveDynamicComponent, onMounted, TransitionGroup, createTextVNode, mergeProps, isRef, onUnmounted, withDirectives, resolveDirective, renderSlot, render, useCssVars, createSlots, watchEffect, vShow, useSlots, useAttrs, inject, onBeforeUnmount, reactive, onUpdated } from "vue";
1
+ import { openBlock, createBlock, unref, normalizeClass, nextTick, ref, computed, watch, withCtx, createElementBlock, createElementVNode, normalizeStyle, createVNode, Fragment, defineComponent, isVNode, Teleport, Transition, withModifiers, toDisplayString, renderList, createCommentVNode, resolveComponent, provide, resolveDynamicComponent, onMounted, TransitionGroup, createTextVNode, mergeProps, isRef, onUnmounted, withDirectives, resolveDirective, renderSlot, watchEffect, vShow, useSlots, useAttrs, createSlots, inject, onBeforeUnmount, reactive, onUpdated, render, useCssVars } from "vue";
2
2
  import { createPinia, defineStore } from "pinia";
3
3
  import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
4
4
  import { cloneDeep, omit } from "lodash-es";
5
- import { ElBacktop, ElIcon, ElMenuItem, ElSubMenu, ElScrollbar, ElMenu, ElInput, ElBadge, ElDropdown, ElDropdownMenu, ElDropdownItem, ElAvatar, ElMessageBox, ElBreadcrumb, ElBreadcrumbItem, ElDrawer, ElMessage, ElConfigProvider, ElCard, ElImageViewer, ElNotification, ElUpload, ElLink, ElButton, ElPagination, ElDialog, ElAlert, ElAffix } from "element-plus";
6
- import { ElAffix as ElAffix2, ElAside, ElAutocomplete, ElAvatar as ElAvatar2, ElBreadcrumb as ElBreadcrumb2, ElBreadcrumbItem as ElBreadcrumbItem2, ElButton as ElButton2, ElButtonGroup, ElCalendar, ElCard as ElCard2, ElCarousel, ElCarouselItem, ElCascader, ElCascaderPanel, ElCheckTag, ElCheckbox, ElCheckboxButton, ElCheckboxGroup, ElCol, ElCollapse, ElCollapseItem, ElCollapseTransition, ElColorPicker, ElConfigProvider as ElConfigProvider2, ElContainer, ElCountdown, ElDatePicker, ElDescriptions, ElDescriptionsItem, ElDivider, ElDrawer as ElDrawer2, ElDropdown as ElDropdown2, ElDropdownItem as ElDropdownItem2, ElDropdownMenu as ElDropdownMenu2, ElEmpty, ElFooter, ElForm, ElFormItem, ElHeader, ElImage, ElImageViewer as ElImageViewer2, ElInfiniteScroll, ElInput as ElInput2, ElInputNumber, ElInputTag, ElLink as ElLink2, ElLoading, ElMain, ElMention, ElMenu as ElMenu2, ElMenuItem as ElMenuItem2, ElMenuItemGroup, ElMessage as ElMessage2, ElMessageBox as ElMessageBox2, ElNotification as ElNotification2, ElOption, ElOptionGroup, ElOverlay, ElPageHeader, ElPopconfirm, ElPopover, ElPopper, ElProgress, ElRadio, ElRadioButton, ElRadioGroup, ElRate, ElResult, ElRow, ElScrollbar as ElScrollbar2, ElSegmented, ElSelect, ElSelectV2, ElSkeleton, ElSkeletonItem, ElSlider, ElSpace, ElSplitter, ElSplitterPanel, ElStatistic, ElSubMenu as ElSubMenu2, ElSwitch, ElTabPane, ElTable, ElTableColumn, ElTabs, ElTag, ElText, ElTimePicker, ElTimeSelect, ElTimeline, ElTimelineItem, ElTooltip, ElTour, ElTourStep, ElTransfer, ElTree, ElTreeSelect, ElTreeV2, ElUpload as ElUpload2, ElWatermark } from "element-plus";
5
+ import { ElBacktop, ElIcon, ElMenuItem, ElSubMenu, ElScrollbar, ElMenu, ElInput, ElBadge, ElDropdown, ElDropdownMenu, ElDropdownItem, ElAvatar, ElMessageBox, ElBreadcrumb, ElBreadcrumbItem, ElDrawer, ElMessage, ElConfigProvider, ElCard, ElPagination, ElDialog, ElAlert, ElAffix, ElImageViewer, ElNotification, ElUpload, ElLink, ElButton, ElAutocomplete, ElButtonGroup, ElCarousel, ElCarouselItem, ElCollapse, ElCollapseItem, ElCollapseTransition, ElDivider, ElEmpty, ElOverlay, ElPageHeader, ElProgress, ElResult, ElSkeleton, ElSkeletonItem, ElSpace, ElTag, ElText, ElCascader, ElCascaderPanel, ElCheckbox, ElCheckboxButton, ElCheckboxGroup, ElColorPicker, ElDatePicker, ElForm, ElFormItem, ElInputNumber, ElInputTag, ElRadio, ElRadioButton, ElRadioGroup, ElRate, ElSelect, ElOption, ElOptionGroup, ElSelectV2, ElSlider, ElSwitch, ElTimePicker, ElTimeSelect, ElTransfer, ElTreeSelect, ElMention, ElCalendar, ElCheckTag, ElCountdown, ElDescriptions, ElDescriptionsItem, ElImage, ElStatistic, ElTable, ElTableColumn, ElTimeline, ElTimelineItem, ElTree, ElTreeV2, ElMenuItemGroup, ElTabs, ElTabPane, ElPopover, ElPopconfirm, ElTooltip, ElContainer, ElAside, ElFooter, ElHeader, ElMain, ElRow, ElCol, ElSplitter, ElSplitterPanel, ElSegmented, ElTour, ElTourStep, ElWatermark, ElPopper } from "element-plus";
6
+ import { ElAffix as ElAffix2, ElAside as ElAside2, ElAutocomplete as ElAutocomplete2, ElAvatar as ElAvatar2, ElBreadcrumb as ElBreadcrumb2, ElBreadcrumbItem as ElBreadcrumbItem2, ElButton as ElButton2, ElButtonGroup as ElButtonGroup2, ElCalendar as ElCalendar2, ElCard as ElCard2, ElCarousel as ElCarousel2, ElCarouselItem as ElCarouselItem2, ElCascader as ElCascader2, ElCascaderPanel as ElCascaderPanel2, ElCheckTag as ElCheckTag2, ElCheckbox as ElCheckbox2, ElCheckboxButton as ElCheckboxButton2, ElCheckboxGroup as ElCheckboxGroup2, ElCol as ElCol2, ElCollapse as ElCollapse2, ElCollapseItem as ElCollapseItem2, ElCollapseTransition as ElCollapseTransition2, ElColorPicker as ElColorPicker2, ElConfigProvider as ElConfigProvider2, ElContainer as ElContainer2, ElCountdown as ElCountdown2, ElDatePicker as ElDatePicker2, ElDescriptions as ElDescriptions2, ElDescriptionsItem as ElDescriptionsItem2, ElDivider as ElDivider2, ElDrawer as ElDrawer2, ElDropdown as ElDropdown2, ElDropdownItem as ElDropdownItem2, ElDropdownMenu as ElDropdownMenu2, ElEmpty as ElEmpty2, ElFooter as ElFooter2, ElForm as ElForm2, ElFormItem as ElFormItem2, ElHeader as ElHeader2, ElImage as ElImage2, ElImageViewer as ElImageViewer2, ElInfiniteScroll, ElInput as ElInput2, ElInputNumber as ElInputNumber2, ElInputTag as ElInputTag2, ElLink as ElLink2, ElLoading, ElMain as ElMain2, ElMention as ElMention2, ElMenu as ElMenu2, ElMenuItem as ElMenuItem2, ElMenuItemGroup as ElMenuItemGroup2, ElMessage as ElMessage2, ElMessageBox as ElMessageBox2, ElNotification as ElNotification2, ElOption as ElOption2, ElOptionGroup as ElOptionGroup2, ElOverlay as ElOverlay2, ElPageHeader as ElPageHeader2, ElPopconfirm as ElPopconfirm2, ElPopover as ElPopover2, ElPopper as ElPopper2, ElProgress as ElProgress2, ElRadio as ElRadio2, ElRadioButton as ElRadioButton2, ElRadioGroup as ElRadioGroup2, ElRate as ElRate2, ElResult as ElResult2, ElRow as ElRow2, ElScrollbar as ElScrollbar2, ElSegmented as ElSegmented2, ElSelect as ElSelect2, ElSelectV2 as ElSelectV22, ElSkeleton as ElSkeleton2, ElSkeletonItem as ElSkeletonItem2, ElSlider as ElSlider2, ElSpace as ElSpace2, ElSplitter as ElSplitter2, ElSplitterPanel as ElSplitterPanel2, ElStatistic as ElStatistic2, ElSubMenu as ElSubMenu2, ElSwitch as ElSwitch2, ElTabPane as ElTabPane2, ElTable as ElTable2, ElTableColumn as ElTableColumn2, ElTabs as ElTabs2, ElTag as ElTag2, ElText as ElText2, ElTimePicker as ElTimePicker2, ElTimeSelect as ElTimeSelect2, ElTimeline as ElTimeline2, ElTimelineItem as ElTimelineItem2, ElTooltip as ElTooltip2, ElTour as ElTour2, ElTourStep as ElTourStep2, ElTransfer as ElTransfer2, ElTree as ElTree2, ElTreeSelect as ElTreeSelect2, ElTreeV2 as ElTreeV22, ElUpload as ElUpload2, ElWatermark as ElWatermark2 } from "element-plus";
7
7
  import { createRouter, createWebHashHistory, useRoute, useRouter } from "vue-router";
8
8
  import "vue-i18n";
9
9
  import { useClipboard, useWindowSize } from "@vueuse/core";
@@ -9524,1763 +9524,1763 @@ const _sfc_main$b = /* @__PURE__ */ Object.assign({ name: "PageNavBar" }, {
9524
9524
  }
9525
9525
  });
9526
9526
  const PageNavBar = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-0d587176"]]);
9527
- const _sfc_main$a = /* @__PURE__ */ Object.assign({ name: "ImageViewer" }, {
9528
- __name: "ImageViewer",
9527
+ const _sfc_main$a = /* @__PURE__ */ Object.assign({ name: "Badge" }, {
9528
+ __name: "Badge",
9529
9529
  props: {
9530
- urlList: {
9531
- type: Array,
9532
- default: () => []
9533
- },
9534
- zIndex: {
9535
- type: Number,
9536
- default: 200
9530
+ value: {
9531
+ type: [String, Number],
9532
+ default: ""
9537
9533
  },
9538
- initialIndex: {
9534
+ max: {
9539
9535
  type: Number,
9540
- default: 0
9541
- },
9542
- infinite: {
9543
- type: Boolean,
9544
- default: true
9536
+ default: 99
9545
9537
  },
9546
- hideOnClickModal: {
9538
+ isDot: {
9547
9539
  type: Boolean,
9548
9540
  default: false
9549
9541
  },
9550
- teleported: {
9542
+ hidden: {
9551
9543
  type: Boolean,
9552
9544
  default: false
9553
9545
  },
9554
- show: {
9555
- type: Boolean,
9556
- default: false
9546
+ type: {
9547
+ type: String,
9548
+ default: "danger",
9549
+ validator(value) {
9550
+ return ["primary", "success", "warning", "danger", "info"].includes(value);
9551
+ }
9557
9552
  }
9558
9553
  },
9559
9554
  setup(__props) {
9560
9555
  const props = __props;
9561
- const getBindValue = computed(() => {
9562
- const propsData = { ...props };
9563
- delete propsData.show;
9564
- return propsData;
9565
- });
9566
- const show = ref(props.show);
9567
- const close = () => {
9568
- show.value = false;
9569
- };
9556
+ const { getPrefixCls: getPrefixCls2 } = useDesign();
9557
+ const prefixCls2 = getPrefixCls2("badge");
9570
9558
  return (_ctx, _cache) => {
9571
- return unref(show) ? (openBlock(), createBlock(unref(ElImageViewer), mergeProps({ key: 0 }, unref(getBindValue), { onClose: close }), null, 16)) : createCommentVNode("", true);
9559
+ return openBlock(), createBlock(unref(ElBadge), mergeProps(props, { class: unref(prefixCls2) }), {
9560
+ default: withCtx(() => [
9561
+ renderSlot(_ctx.$slots, "default")
9562
+ ]),
9563
+ _: 3
9564
+ }, 16, ["class"]);
9572
9565
  };
9573
9566
  }
9574
9567
  });
9575
- let instance = null;
9576
- function createImageViewer(options) {
9577
- if (!isClient)
9578
- return;
9579
- const {
9580
- urlList,
9581
- initialIndex = 0,
9582
- infinite = true,
9583
- hideOnClickModal = false,
9584
- teleported = false,
9585
- zIndex = 2e3,
9586
- show = true
9587
- } = options;
9588
- const propsData = {};
9589
- const container = document.createElement("div");
9590
- propsData.urlList = urlList;
9591
- propsData.initialIndex = initialIndex;
9592
- propsData.infinite = infinite;
9593
- propsData.hideOnClickModal = hideOnClickModal;
9594
- propsData.teleported = teleported;
9595
- propsData.zIndex = zIndex;
9596
- propsData.show = show;
9597
- document.body.appendChild(container);
9598
- instance = createVNode(_sfc_main$a, propsData);
9599
- render(instance, container);
9600
- }
9601
- const useMessage = () => {
9602
- const { t: t2 } = useI18n("layout");
9603
- const scssVariables = variables$1;
9604
- return {
9605
- // 消息提示
9606
- info(content) {
9607
- ElMessage.info(content);
9608
- },
9609
- // 错误消息
9610
- error(content) {
9611
- ElMessage.error(content);
9612
- },
9613
- // 成功消息
9614
- success(content) {
9615
- ElMessage.success(content);
9616
- },
9617
- // 警告消息
9618
- warning(content) {
9619
- ElMessage.warning(content);
9568
+ const _sfc_main$9 = /* @__PURE__ */ Object.assign({ name: "Pagination" }, {
9569
+ __name: "Pagination",
9570
+ props: {
9571
+ // 总条目数
9572
+ total: {
9573
+ required: true,
9574
+ type: Number
9620
9575
  },
9621
- // 弹出提示
9622
- alert(content) {
9623
- ElMessageBox.alert(content, t2("common.confirmTitle"));
9576
+ // 当前页数:pageNo
9577
+ page: {
9578
+ type: Number,
9579
+ default: 1
9624
9580
  },
9625
- // 错误提示
9626
- alertError(content) {
9627
- ElMessageBox.alert(content, t2("common.confirmTitle"), { type: "error" });
9581
+ // 每页显示条目个数:pageSize
9582
+ limit: {
9583
+ type: Number,
9584
+ default: 20
9628
9585
  },
9629
- // 成功提示
9630
- alertSuccess(content) {
9631
- ElMessageBox.alert(content, t2("common.confirmTitle"), { type: "success" });
9586
+ // 设置最大页码按钮数。 页码按钮的数量,当总页数超过该值时会折叠
9587
+ // 移动端页码按钮的数量端默认值 5
9588
+ pagerCount: {
9589
+ type: Number,
9590
+ default: document.body.clientWidth < 992 ? 5 : 7
9591
+ }
9592
+ },
9593
+ emits: ["update:page", "update:limit", "pagination"],
9594
+ setup(__props, { emit: __emit }) {
9595
+ const appStore = useAppStore();
9596
+ const layoutCurrentSize = computed(() => appStore.currentSize);
9597
+ const isSmall = ref(layoutCurrentSize.value === "small");
9598
+ watchEffect(() => {
9599
+ isSmall.value = layoutCurrentSize.value === "small";
9600
+ });
9601
+ const props = __props;
9602
+ const emit = __emit;
9603
+ const currentPage = computed({
9604
+ get() {
9605
+ return props.page;
9606
+ },
9607
+ set(val) {
9608
+ emit("update:page", val);
9609
+ }
9610
+ });
9611
+ const pageSize = computed({
9612
+ get() {
9613
+ return props.limit;
9614
+ },
9615
+ set(val) {
9616
+ emit("update:limit", val);
9617
+ }
9618
+ });
9619
+ const handleSizeChange = (val) => {
9620
+ if (currentPage.value * val > props.total) {
9621
+ currentPage.value = 1;
9622
+ }
9623
+ emit("pagination", { page: currentPage.value, limit: val });
9624
+ };
9625
+ const handleCurrentChange = (val) => {
9626
+ emit("pagination", { page: val, limit: pageSize.value });
9627
+ };
9628
+ return (_ctx, _cache) => {
9629
+ return withDirectives((openBlock(), createBlock(unref(ElPagination), {
9630
+ "current-page": currentPage.value,
9631
+ "onUpdate:currentPage": _cache[0] || (_cache[0] = ($event) => currentPage.value = $event),
9632
+ "page-size": pageSize.value,
9633
+ "onUpdate:pageSize": _cache[1] || (_cache[1] = ($event) => pageSize.value = $event),
9634
+ "pager-count": __props.pagerCount,
9635
+ total: __props.total,
9636
+ small: unref(isSmall),
9637
+ class: "m-t-16px",
9638
+ layout: "prev, pager, next, sizes",
9639
+ onSizeChange: handleSizeChange,
9640
+ onCurrentChange: handleCurrentChange
9641
+ }, null, 8, ["current-page", "page-size", "pager-count", "total", "small"])), [
9642
+ [vShow, __props.total > 0]
9643
+ ]);
9644
+ };
9645
+ }
9646
+ });
9647
+ const _hoisted_1$4 = { class: "title" };
9648
+ const _hoisted_2$4 = { class: "absolute right-17px top-[50%] h-54px flex translate-y-[-50%] items-center justify-between" };
9649
+ const _hoisted_3$4 = { class: "p-20px" };
9650
+ const _hoisted_4$4 = {
9651
+ key: 1,
9652
+ class: "pt-16px p-l-20px p-r-20px"
9653
+ };
9654
+ const _sfc_main$8 = /* @__PURE__ */ Object.assign({ name: "Dialog" }, {
9655
+ __name: "Dialog",
9656
+ props: {
9657
+ modelValue: {
9658
+ type: Boolean,
9659
+ default: false
9632
9660
  },
9633
- // 警告提示
9634
- alertWarning(content) {
9635
- ElMessageBox.alert(content, t2("common.confirmTitle"), { type: "warning" });
9661
+ title: {
9662
+ type: String,
9663
+ default: "Dialog"
9636
9664
  },
9637
- // 通知提示
9638
- notify(content) {
9639
- ElNotification.info(content);
9665
+ fullscreen: {
9666
+ type: Boolean,
9667
+ default: false
9640
9668
  },
9641
- // 错误通知
9642
- notifyError(content) {
9643
- ElNotification.error(content);
9669
+ width: {
9670
+ type: [String, Number]
9644
9671
  },
9645
- // 成功通知
9646
- notifySuccess(content) {
9647
- ElNotification.success(content);
9672
+ // 是否开启滚动条。如果是的话,按照 maxHeight 设置最大高度
9673
+ scroll: {
9674
+ type: Boolean,
9675
+ default: false
9648
9676
  },
9649
- // 警告通知
9650
- notifyWarning(content) {
9651
- ElNotification.warning(content);
9677
+ maxHeight: {
9678
+ type: [String, Number],
9679
+ default: "60vh"
9652
9680
  },
9653
- // 确认窗体
9654
- confirm(content, tip, options = {}) {
9655
- return ElMessageBox.confirm(content, tip ? tip : t2("common.confirmTitle"), {
9656
- ...options,
9657
- customClass: `${options.customClass} ${scssVariables.namespace}-message-box`,
9658
- confirmButtonText: options.confirmButtonText ?? t2("common.ok"),
9659
- cancelButtonText: options.cancelButtonText ?? t2("common.cancel"),
9660
- buttonSize: "default",
9661
- center: true
9662
- });
9681
+ // width有值时优先使用width
9682
+ size: {
9683
+ type: String,
9684
+ default: "default",
9685
+ validate(value) {
9686
+ return ["large", "default", "small"].includes(value);
9687
+ }
9663
9688
  },
9664
- // 删除窗体
9665
- delConfirm(content, tip) {
9666
- return ElMessageBox.confirm(
9667
- content ? content : t2("common.delMessage"),
9668
- tip ? tip : t2("common.confirmTitle"),
9669
- {
9670
- customClass: `${scssVariables.namespace}-message-box`,
9671
- confirmButtonText: t2("common.ok"),
9672
- cancelButtonText: t2("common.cancel"),
9673
- buttonSize: "default",
9674
- center: true,
9675
- type: "warning"
9676
- }
9677
- );
9689
+ top: {
9690
+ type: String,
9691
+ default: "0"
9678
9692
  },
9679
- // 导出窗体
9680
- exportConfirm(content, tip) {
9681
- return ElMessageBox.confirm(
9682
- content ? content : t2("common.exportMessage"),
9683
- tip ? tip : t2("common.confirmTitle"),
9684
- {
9685
- confirmButtonText: t2("common.ok"),
9686
- cancelButtonText: t2("common.cancel"),
9687
- type: "warning"
9688
- }
9689
- );
9690
- },
9691
- // 提交内容
9692
- prompt(content, tip, options = {}) {
9693
- return ElMessageBox.prompt(content, tip, {
9694
- confirmButtonText: t2("common.ok"),
9695
- cancelButtonText: t2("common.cancel"),
9696
- ...options
9697
- });
9698
- }
9699
- };
9700
- };
9701
- const _hoisted_1$4 = { class: "upload-box" };
9702
- const _hoisted_2$4 = ["src"];
9703
- const _hoisted_3$4 = { key: 0 };
9704
- const _hoisted_4$4 = { key: 0 };
9705
- const _hoisted_5$3 = {
9706
- key: 1,
9707
- class: "upload-empty"
9708
- };
9709
- const _hoisted_6$2 = { class: "el-upload__tip" };
9710
- const _sfc_main$9 = /* @__PURE__ */ Object.assign({ name: "UploadImg", inheritAttrs: false }, {
9711
- __name: "UploadImg",
9712
- props: {
9713
- modelValue: {
9714
- type: String,
9715
- default: ""
9716
- },
9717
- // 是否支持拖拽上传 ==> 非必传(默认为 true)
9718
- drag: {
9719
- type: Boolean,
9720
- default: true
9721
- },
9722
- // 是否禁用上传组件 ==> 非必传(默认为 false)
9723
- disabled: {
9724
- type: Boolean,
9725
- default: false
9726
- },
9727
- // 图片大小限制 ==> 非必传(默认为 5M)
9728
- fileSize: {
9729
- type: Number,
9730
- default: 5
9731
- },
9732
- // 图片类型限制 ==> 非必传(默认为 ["image/jpeg", "image/png", "image/gif"])
9733
- fileType: {
9734
- type: Array,
9735
- default: () => ["image/jpeg", "image/png", "image/gif"]
9736
- },
9737
- // 组件高度 ==> 非必传(默认为 150px)
9738
- height: {
9739
- type: String,
9740
- default: "100px"
9741
- },
9742
- // 组件宽度 ==> 非必传(默认为 150px)
9743
- width: {
9744
- type: String,
9745
- default: "100px"
9746
- },
9747
- // 组件边框圆角 ==> 非必传(默认为 8px)
9748
- borderradius: {
9749
- type: String,
9750
- default: "4px"
9751
- },
9752
- // 是否显示删除按钮
9753
- showDelete: {
9693
+ scrollbarAlways: {
9754
9694
  type: Boolean,
9755
9695
  default: true
9756
- },
9757
- // 是否显示按钮文字
9758
- showBtnText: {
9759
- type: Boolean,
9760
- default: false
9761
- },
9762
- // 上传目录 ==> 非必传(默认为 undefined)
9763
- directory: {
9764
- type: String,
9765
- default: void 0
9766
- },
9767
- // 自定义上传函数(必填)==> 必传
9768
- customUpload: {
9769
- type: Function,
9770
- required: true
9771
- },
9772
- // 自定义从上传结果中提取 URL 的函数 ==> 非必传(默认为提取 res.data)
9773
- getUploadUrl: {
9774
- type: Function,
9775
- default: (res) => res.data
9776
9696
  }
9777
9697
  },
9778
- emits: ["update:modelValue"],
9698
+ emits: ["update:modelValue", "close"],
9779
9699
  setup(__props, { emit: __emit }) {
9780
- useCssVars((_ctx) => ({
9781
- "3d8ea9da": __props.width,
9782
- "2c0dbd7a": __props.height,
9783
- "00ef71d1": __props.borderradius
9784
- }));
9700
+ const slots = useSlots();
9785
9701
  const props = __props;
9786
- const { t: t2 } = useI18n("layout");
9787
- const message = useMessage();
9788
- const uuid = ref("id-" + generateUUID());
9789
- const imagePreview = (imgUrl) => {
9790
- createImageViewer({
9791
- zIndex: 9999999,
9792
- urlList: [imgUrl]
9793
- });
9794
- };
9795
9702
  const emit = __emit;
9796
- const deleteImg = () => {
9797
- emit("update:modelValue", "");
9798
- };
9799
- const httpRequest = async (options) => {
9800
- return await props.customUpload(options.file, {
9801
- directory: props.directory
9802
- });
9803
- };
9804
- const beforeUpload = (rawFile) => {
9805
- const imgSize = rawFile.size / 1024 / 1024 < props.fileSize;
9806
- const imgType = props.fileType;
9807
- if (!imgType.includes(rawFile.type))
9808
- message.notifyWarning("上传图片不符合所需的格式!");
9809
- if (!imgSize)
9810
- message.notifyWarning(`上传图片大小不能超过 ${props.fileSize}M!`);
9811
- return imgType.includes(rawFile.type) && imgSize;
9812
- };
9813
- const uploadSuccess = (res) => {
9814
- message.success("上传成功");
9815
- const fileUrl = props.getUploadUrl(res);
9816
- emit("update:modelValue", fileUrl);
9817
- };
9818
- const uploadError = () => {
9819
- message.notifyError("图片上传失败,请您重新上传!");
9703
+ const getBindValue = computed(() => {
9704
+ const delArr = ["fullscreen", "title", "maxHeight", "appendToBody"];
9705
+ const attrs = useAttrs();
9706
+ const obj = { ...attrs, ...props };
9707
+ for (const key in obj) {
9708
+ if (delArr.indexOf(key) !== -1) {
9709
+ delete obj[key];
9710
+ }
9711
+ }
9712
+ return obj;
9713
+ });
9714
+ const dialogHeight = ref(isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight);
9715
+ const dialogStyle = computed(() => {
9716
+ return {
9717
+ height: unref(dialogHeight)
9718
+ };
9719
+ });
9720
+ const dialogWidth = computed(() => {
9721
+ return props.width ?? (props.size === "default" ? "40%" : props.size === "large" ? "60%" : "30%");
9722
+ });
9723
+ const dialogClose = () => {
9724
+ emit("update:modelValue", false);
9725
+ emit("close");
9820
9726
  };
9821
9727
  return (_ctx, _cache) => {
9822
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
9823
- createVNode(unref(ElUpload), {
9824
- id: unref(uuid),
9825
- accept: __props.fileType.join(","),
9826
- "before-upload": beforeUpload,
9827
- class: normalizeClass(["upload", __props.drag ? "no-border" : ""]),
9828
- disabled: __props.disabled,
9829
- drag: __props.drag,
9830
- "http-request": httpRequest,
9831
- multiple: false,
9832
- "on-error": uploadError,
9833
- "on-success": uploadSuccess,
9834
- "show-file-list": false
9835
- }, {
9836
- default: withCtx(() => [
9837
- __props.modelValue ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
9838
- createElementVNode("img", {
9839
- src: __props.modelValue,
9840
- class: "upload-image"
9841
- }, null, 8, _hoisted_2$4),
9842
- createElementVNode("div", {
9843
- class: "upload-handle",
9844
- onClick: _cache[1] || (_cache[1] = withModifiers(() => {
9845
- }, ["stop"]))
9846
- }, [
9847
- createElementVNode("div", {
9848
- class: "handle-icon",
9849
- onClick: _cache[0] || (_cache[0] = ($event) => imagePreview(__props.modelValue))
9850
- }, [
9851
- createVNode(unref(_sfc_main$v), { icon: "ant-design:zoom-in-outlined" }),
9852
- __props.showBtnText ? (openBlock(), createElementBlock("span", _hoisted_3$4, toDisplayString(unref(t2)("action.detail")), 1)) : createCommentVNode("", true)
9853
- ]),
9854
- __props.showDelete && !__props.disabled ? (openBlock(), createElementBlock("div", {
9855
- key: 0,
9856
- class: "handle-icon",
9857
- onClick: deleteImg
9858
- }, [
9859
- createVNode(unref(_sfc_main$v), { icon: "ant-design:delete-outlined" }),
9860
- __props.showBtnText ? (openBlock(), createElementBlock("span", _hoisted_4$4, toDisplayString(unref(t2)("action.del")), 1)) : createCommentVNode("", true)
9861
- ])) : createCommentVNode("", true)
9728
+ const _component_Icon = resolveComponent("Icon");
9729
+ return openBlock(), createBlock(unref(ElDialog), mergeProps(unref(getBindValue), {
9730
+ "close-on-click-modal": true,
9731
+ fullscreen: __props.fullscreen,
9732
+ width: unref(dialogWidth),
9733
+ top: __props.top,
9734
+ "destroy-on-close": "",
9735
+ "lock-scroll": "",
9736
+ class: "com-dialog",
9737
+ "modal-class": "com-modal-dialog",
9738
+ "footer-class": __props.scroll ? "footer-shadow" : "",
9739
+ "show-close": false,
9740
+ onClose: dialogClose
9741
+ }), createSlots({
9742
+ header: withCtx(({ close }) => [
9743
+ createElementVNode("div", _hoisted_1$4, [
9744
+ renderSlot(_ctx.$slots, "title", {}, () => [
9745
+ createTextVNode(toDisplayString(__props.title), 1)
9746
+ ]),
9747
+ createElementVNode("div", _hoisted_2$4, [
9748
+ createVNode(_component_Icon, {
9749
+ class: "is-hover cursor-pointer",
9750
+ icon: "ep:close",
9751
+ "hover-color": "var(--el-color-primary)",
9752
+ color: "var(--el-color-info)",
9753
+ onClick: withModifiers(close, ["stop"])
9754
+ }, null, 8, ["onClick"])
9755
+ ])
9756
+ ])
9757
+ ]),
9758
+ default: withCtx(() => [
9759
+ __props.scroll ? (openBlock(), createBlock(unref(ElScrollbar), {
9760
+ key: 0,
9761
+ style: normalizeStyle(unref(dialogStyle)),
9762
+ always: __props.scrollbarAlways
9763
+ }, {
9764
+ default: withCtx(() => [
9765
+ createElementVNode("div", _hoisted_3$4, [
9766
+ renderSlot(_ctx.$slots, "default")
9862
9767
  ])
9863
- ], 64)) : (openBlock(), createElementBlock("div", _hoisted_5$3, [
9864
- renderSlot(_ctx.$slots, "empty", {}, () => [
9865
- createVNode(unref(_sfc_main$v), {
9866
- icon: "ep:plus",
9867
- size: 20
9868
- }),
9869
- _cache[2] || (_cache[2] = createElementVNode("span", { class: "empty-text" }, "点击上传", -1))
9870
- ], true)
9871
- ]))
9768
+ ]),
9769
+ _: 3
9770
+ }, 8, ["style", "always"])) : (openBlock(), createElementBlock("div", _hoisted_4$4, [
9771
+ renderSlot(_ctx.$slots, "default")
9772
+ ]))
9773
+ ]),
9774
+ _: 2
9775
+ }, [
9776
+ unref(slots).footer ? {
9777
+ name: "footer",
9778
+ fn: withCtx(() => [
9779
+ renderSlot(_ctx.$slots, "footer")
9872
9780
  ]),
9873
- _: 3
9874
- }, 8, ["id", "accept", "class", "disabled", "drag"]),
9875
- createElementVNode("div", _hoisted_6$2, [
9876
- renderSlot(_ctx.$slots, "tip", {}, void 0, true)
9877
- ])
9878
- ]);
9781
+ key: "0"
9782
+ } : void 0
9783
+ ]), 1040, ["fullscreen", "width", "top", "footer-class"]);
9879
9784
  };
9880
9785
  }
9881
9786
  });
9882
- const UploadImg = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-4a1df97a"]]);
9883
- const _hoisted_1$3 = { class: "upload-box" };
9884
- const _hoisted_2$3 = { class: "upload-empty" };
9885
- const _hoisted_3$3 = ["src"];
9886
- const _hoisted_4$3 = ["onClick"];
9887
- const _hoisted_5$2 = { key: 0 };
9888
- const _hoisted_6$1 = ["onClick"];
9889
- const _hoisted_7 = { key: 0 };
9890
- const _hoisted_8 = { class: "el-upload__tip" };
9891
- const _sfc_main$8 = /* @__PURE__ */ Object.assign({ name: "UploadImgs", inheritAttrs: false }, {
9892
- __name: "UploadImgs",
9787
+ const _sfc_main$7 = /* @__PURE__ */ Object.assign({ name: "Alert" }, {
9788
+ __name: "Alert",
9893
9789
  props: {
9894
- modelValue: {
9895
- type: [String, Array],
9896
- required: true
9897
- },
9898
- // 是否支持拖拽上传 ==> 非必传(默认为 true)
9899
- drag: {
9900
- type: Boolean,
9901
- default: true
9790
+ title: String,
9791
+ type: {
9792
+ type: String,
9793
+ default: "info",
9794
+ validator(value) {
9795
+ return ["success", "warning", "info", "error"].includes(value);
9796
+ }
9902
9797
  },
9903
- // 是否禁用上传组件 ==> 非必传(默认为 false)
9904
- disabled: {
9798
+ description: String,
9799
+ closable: {
9905
9800
  type: Boolean,
9906
9801
  default: false
9907
9802
  },
9908
- // 最大图片上传数 ==> 非必传(默认为 5张)
9909
- limit: {
9910
- type: Number,
9911
- default: 5
9912
- },
9913
- // 图片大小限制 ==> 非必传(默认为 5M)
9914
- fileSize: {
9915
- type: Number,
9916
- default: 5
9917
- },
9918
- // 图片类型限制 ==> 非必传(默认为 ["image/jpeg", "image/png", "image/gif"])
9919
- fileType: {
9920
- type: Array,
9921
- default: () => ["image/jpeg", "image/png", "image/gif"]
9922
- },
9923
- // 组件高度 ==> 非必传(默认为 150px)
9924
- height: {
9925
- type: String,
9926
- default: "100px"
9927
- },
9928
- // 组件宽度 ==> 非必传(默认为 150px)
9929
- width: {
9930
- type: String,
9931
- default: "100px"
9932
- },
9933
- // 组件边框圆角 ==> 非必传(默认为 8px)
9934
- borderradius: {
9935
- type: String,
9936
- default: "4px"
9937
- },
9938
- // 是否显示按钮文字
9939
- showBtnText: {
9803
+ center: {
9940
9804
  type: Boolean,
9941
9805
  default: false
9942
9806
  },
9943
- // 上传目录 ==> 非必传(默认为 undefined)
9944
- directory: {
9945
- type: String,
9946
- default: void 0
9947
- },
9948
- // 自定义上传函数(必填)==> 必传
9949
- customUpload: {
9950
- type: Function,
9951
- required: true
9952
- },
9953
- // 自定义从上传结果中提取 URL 的函数 ==> 非必传(默认为提取 res.data)
9954
- getUploadUrl: {
9955
- type: Function,
9956
- default: (res) => res.data
9807
+ closeText: String,
9808
+ showIcon: {
9809
+ type: Boolean,
9810
+ default: false
9957
9811
  }
9958
9812
  },
9959
- emits: ["update:modelValue"],
9960
- setup(__props, { emit: __emit }) {
9961
- useCssVars((_ctx) => ({
9962
- "1238a60c": __props.borderradius,
9963
- "c60c1990": __props.width,
9964
- "2f150c16": __props.height
9965
- }));
9966
- const message = useMessage();
9967
- const imagePreview = (imgUrl) => {
9968
- createImageViewer({
9969
- zIndex: 9999999,
9970
- urlList: [imgUrl]
9971
- });
9972
- };
9813
+ setup(__props) {
9814
+ const { getPrefixCls: getPrefixCls2 } = useDesign();
9815
+ const prefixCls2 = getPrefixCls2("alert");
9973
9816
  const props = __props;
9974
- const httpRequest = async (options) => {
9975
- return await props.customUpload(options.file, {
9976
- directory: props.directory
9977
- });
9978
- };
9979
- const fileList = ref([]);
9980
- const uploadNumber = ref(0);
9981
- const uploadList = ref([]);
9982
- const beforeUpload = (rawFile) => {
9983
- const imgSize = rawFile.size / 1024 / 1024 < props.fileSize;
9984
- const imgType = props.fileType;
9985
- if (!imgType.includes(rawFile.type))
9986
- ElNotification({
9987
- title: "温馨提示",
9988
- message: "上传图片不符合所需的格式!",
9989
- type: "warning"
9990
- });
9991
- if (!imgSize)
9992
- ElNotification({
9993
- title: "温馨提示",
9994
- message: `上传图片大小不能超过 ${props.fileSize}M!`,
9995
- type: "warning"
9996
- });
9997
- uploadNumber.value++;
9998
- return imgType.includes(rawFile.type) && imgSize;
9999
- };
10000
- const emit = __emit;
10001
- const uploadSuccess = (res) => {
10002
- message.success("上传成功");
10003
- const fileUrl = props.getUploadUrl(res);
10004
- const index = fileList.value.findIndex((item) => {
10005
- var _a2;
10006
- return ((_a2 = item.response) == null ? void 0 : _a2.data) === fileUrl;
10007
- });
10008
- fileList.value.splice(index, 1);
10009
- uploadList.value.push({ name: fileUrl, url: fileUrl });
10010
- if (uploadList.value.length == uploadNumber.value) {
10011
- fileList.value.push(...uploadList.value);
10012
- uploadList.value = [];
10013
- uploadNumber.value = 0;
10014
- emitUpdateModelValue();
10015
- }
10016
- };
10017
- watch(
10018
- () => props.modelValue,
10019
- (val) => {
10020
- if (!val) {
10021
- fileList.value = [];
10022
- return;
10023
- }
10024
- fileList.value = [];
10025
- fileList.value.push(
10026
- ...val.map((url) => ({ name: url.substring(url.lastIndexOf("/") + 1), url }))
10027
- );
10028
- },
10029
- { immediate: true, deep: true }
10030
- );
10031
- const emitUpdateModelValue = () => {
10032
- let result = fileList.value.map((file) => file.url);
10033
- emit("update:modelValue", result);
10034
- };
10035
- const handleRemove = (uploadFile) => {
10036
- fileList.value = fileList.value.filter(
10037
- (item) => item.url !== uploadFile.url || item.name !== uploadFile.name
10038
- );
10039
- emit(
10040
- "update:modelValue",
10041
- fileList.value.map((file) => file.url)
10042
- );
10043
- };
10044
- const uploadError = () => {
10045
- ElNotification({
10046
- title: "温馨提示",
10047
- message: "图片上传失败,请您重新上传!",
10048
- type: "error"
10049
- });
10050
- };
10051
- const handleExceed = () => {
10052
- ElNotification({
10053
- title: "温馨提示",
10054
- message: `当前最多只能上传 ${props.limit} 张图片,请移除后上传!`,
10055
- type: "warning"
10056
- });
10057
- };
10058
9817
  return (_ctx, _cache) => {
10059
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
10060
- createVNode(unref(ElUpload), {
10061
- "file-list": unref(fileList),
10062
- "onUpdate:fileList": _cache[1] || (_cache[1] = ($event) => isRef(fileList) ? fileList.value = $event : null),
10063
- accept: __props.fileType.join(","),
10064
- "before-upload": beforeUpload,
10065
- class: normalizeClass(["upload", __props.drag ? "no-border" : ""]),
10066
- disabled: __props.disabled,
10067
- drag: __props.drag,
10068
- "http-request": httpRequest,
10069
- limit: __props.limit,
10070
- multiple: true,
10071
- "on-error": uploadError,
10072
- "on-exceed": handleExceed,
10073
- "on-success": uploadSuccess,
10074
- "list-type": "picture-card"
10075
- }, {
10076
- file: withCtx(({ file }) => [
10077
- createElementVNode("img", {
10078
- src: file.url,
10079
- class: "upload-image"
10080
- }, null, 8, _hoisted_3$3),
10081
- createElementVNode("div", {
10082
- class: "upload-handle",
10083
- onClick: _cache[0] || (_cache[0] = withModifiers(() => {
10084
- }, ["stop"]))
10085
- }, [
10086
- createElementVNode("div", {
10087
- class: "handle-icon",
10088
- onClick: ($event) => imagePreview(file.url)
10089
- }, [
10090
- createVNode(unref(_sfc_main$v), { icon: "ant-design:zoom-in-outlined" }),
10091
- __props.showBtnText ? (openBlock(), createElementBlock("span", _hoisted_5$2, "查看")) : createCommentVNode("", true)
10092
- ], 8, _hoisted_4$3),
10093
- !__props.disabled ? (openBlock(), createElementBlock("div", {
10094
- key: 0,
10095
- class: "handle-icon",
10096
- onClick: ($event) => handleRemove(file)
10097
- }, [
10098
- createVNode(unref(_sfc_main$v), { icon: "ant-design:delete-outlined" }),
10099
- __props.showBtnText ? (openBlock(), createElementBlock("span", _hoisted_7, "删除")) : createCommentVNode("", true)
10100
- ], 8, _hoisted_6$1)) : createCommentVNode("", true)
10101
- ])
10102
- ]),
10103
- default: withCtx(() => [
10104
- createElementVNode("div", _hoisted_2$3, [
10105
- renderSlot(_ctx.$slots, "empty", {}, () => [
10106
- createVNode(unref(_sfc_main$v), {
10107
- icon: "ep:plus",
10108
- size: 20
10109
- }),
10110
- _cache[2] || (_cache[2] = createElementVNode("span", { class: "empty-text" }, "点击上传", -1))
10111
- ], true)
10112
- ])
10113
- ]),
10114
- _: 3
10115
- }, 8, ["file-list", "accept", "class", "disabled", "drag", "limit"]),
10116
- createElementVNode("div", _hoisted_8, [
10117
- renderSlot(_ctx.$slots, "tip", {}, void 0, true)
10118
- ])
10119
- ]);
9818
+ return openBlock(), createBlock(unref(ElAlert), mergeProps(props, { class: unref(prefixCls2) }), null, 16, ["class"]);
10120
9819
  };
10121
9820
  }
10122
9821
  });
10123
- const UploadImgs = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-92b67a34"]]);
10124
- const _hoisted_1$2 = { class: "mt-10px line-height-20px color-[var(--el-upload-tip-color)] text-12px" };
10125
- const _hoisted_2$2 = { class: "flex items-center" };
10126
- const _hoisted_3$2 = { class: "ml-10px" };
10127
- const _hoisted_4$2 = { class: "ml-10px" };
10128
- const _hoisted_5$1 = { class: "ml-10px" };
10129
- const _sfc_main$7 = /* @__PURE__ */ Object.assign({ name: "UploadFile", inheritAttrs: false }, {
10130
- __name: "UploadFile",
10131
- props: {
10132
- modelValue: {
10133
- type: [String, Array],
10134
- required: true
10135
- },
10136
- // 文件类型, 例如['png', 'jpg', 'jpeg']
10137
- fileType: {
10138
- type: Array,
10139
- default: () => ["doc", "xls", "ppt", "txt", "pdf"]
10140
- },
10141
- // 大小限制(MB)
10142
- fileSize: {
10143
- type: Number,
10144
- default: 5
10145
- },
10146
- // 数量限制
10147
- limit: {
10148
- type: Number,
10149
- default: 5
10150
- },
10151
- // 自动上传
10152
- autoUpload: {
10153
- type: Boolean,
10154
- default: true
10155
- },
10156
- // 拖拽上传
10157
- drag: {
10158
- type: Boolean,
10159
- default: false
10160
- },
10161
- // 是否显示提示
10162
- isShowTip: {
10163
- type: Boolean,
10164
- default: true
10165
- },
10166
- // 是否禁用上传组件 ==> 非必传(默认为 false)
10167
- disabled: {
10168
- type: Boolean,
10169
- default: false
10170
- },
10171
- // 上传目录 ==> 非必传(默认为 undefined)
10172
- directory: {
10173
- type: String,
10174
- default: void 0
10175
- },
10176
- // 自定义上传函数(必填)==> 必传
10177
- customUpload: {
10178
- type: Function,
10179
- required: true
10180
- },
10181
- // 自定义从上传结果中提取 URL 的函数 ==> 非必传(默认为提取 res.data)
10182
- getUploadUrl: {
10183
- type: Function,
10184
- default: (res) => res.data
9822
+ const t = (t2) => "object" == typeof t2 && null != t2 && 1 === t2.nodeType, e$1 = (t2, e2) => (!e2 || "hidden" !== t2) && ("visible" !== t2 && "clip" !== t2), n = (t2, n2) => {
9823
+ if (t2.clientHeight < t2.scrollHeight || t2.clientWidth < t2.scrollWidth) {
9824
+ const o2 = getComputedStyle(t2, null);
9825
+ return e$1(o2.overflowY, n2) || e$1(o2.overflowX, n2) || ((t3) => {
9826
+ const e2 = ((t4) => {
9827
+ if (!t4.ownerDocument || !t4.ownerDocument.defaultView)
9828
+ return null;
9829
+ try {
9830
+ return t4.ownerDocument.defaultView.frameElement;
9831
+ } catch (t5) {
9832
+ return null;
9833
+ }
9834
+ })(t3);
9835
+ return !!e2 && (e2.clientHeight < t3.scrollHeight || e2.clientWidth < t3.scrollWidth);
9836
+ })(t2);
9837
+ }
9838
+ return false;
9839
+ }, o$1 = (t2, e2, n2, o2, l2, r2, i, s) => r2 < t2 && i > e2 || r2 > t2 && i < e2 ? 0 : r2 <= t2 && s <= n2 || i >= e2 && s >= n2 ? r2 - t2 - o2 : i > e2 && s < n2 || r2 < t2 && s > n2 ? i - e2 + l2 : 0, l = (t2) => {
9840
+ const e2 = t2.parentElement;
9841
+ return null == e2 ? t2.getRootNode().host || null : e2;
9842
+ }, r = (e2, r2) => {
9843
+ var i, s, d, h;
9844
+ if ("undefined" == typeof document)
9845
+ return [];
9846
+ const { scrollMode: c, block: f, inline: u, boundary: a, skipOverflowHiddenElements: g } = r2, p = "function" == typeof a ? a : (t2) => t2 !== a;
9847
+ if (!t(e2))
9848
+ throw new TypeError("Invalid target");
9849
+ const m = document.scrollingElement || document.documentElement, w = [];
9850
+ let W = e2;
9851
+ for (; t(W) && p(W); ) {
9852
+ if (W = l(W), W === m) {
9853
+ w.push(W);
9854
+ break;
10185
9855
  }
10186
- },
10187
- emits: ["update:modelValue"],
10188
- setup(__props, { emit: __emit }) {
10189
- const message = useMessage();
10190
- const emit = __emit;
10191
- const props = __props;
10192
- const uploadRef = ref();
10193
- const uploadList = ref([]);
10194
- const fileList = ref([]);
10195
- const uploadNumber = ref(0);
10196
- const httpRequest = async (options) => {
10197
- return await props.customUpload(options.file, {
10198
- directory: props.directory
9856
+ null != W && W === document.body && n(W) && !n(document.documentElement) || null != W && n(W, g) && w.push(W);
9857
+ }
9858
+ const b = null != (s = null == (i = window.visualViewport) ? void 0 : i.width) ? s : innerWidth, H = null != (h = null == (d = window.visualViewport) ? void 0 : d.height) ? h : innerHeight, { scrollX: y, scrollY: M } = window, { height: v, width: E, top: x, right: C, bottom: I, left: R } = e2.getBoundingClientRect(), { top: T, right: B, bottom: F, left: V } = ((t2) => {
9859
+ const e3 = window.getComputedStyle(t2);
9860
+ return { top: parseFloat(e3.scrollMarginTop) || 0, right: parseFloat(e3.scrollMarginRight) || 0, bottom: parseFloat(e3.scrollMarginBottom) || 0, left: parseFloat(e3.scrollMarginLeft) || 0 };
9861
+ })(e2);
9862
+ let k = "start" === f || "nearest" === f ? x - T : "end" === f ? I + F : x + v / 2 - T + F, D = "center" === u ? R + E / 2 - V + B : "end" === u ? C + B : R - V;
9863
+ const L = [];
9864
+ for (let t2 = 0; t2 < w.length; t2++) {
9865
+ const e3 = w[t2], { height: l2, width: r3, top: i2, right: s2, bottom: d2, left: h2 } = e3.getBoundingClientRect();
9866
+ if ("if-needed" === c && x >= 0 && R >= 0 && I <= H && C <= b && (e3 === m && !n(e3) || x >= i2 && I <= d2 && R >= h2 && C <= s2))
9867
+ return L;
9868
+ const a2 = getComputedStyle(e3), g2 = parseInt(a2.borderLeftWidth, 10), p2 = parseInt(a2.borderTopWidth, 10), W2 = parseInt(a2.borderRightWidth, 10), T2 = parseInt(a2.borderBottomWidth, 10);
9869
+ let B2 = 0, F2 = 0;
9870
+ const V2 = "offsetWidth" in e3 ? e3.offsetWidth - e3.clientWidth - g2 - W2 : 0, S = "offsetHeight" in e3 ? e3.offsetHeight - e3.clientHeight - p2 - T2 : 0, X = "offsetWidth" in e3 ? 0 === e3.offsetWidth ? 0 : r3 / e3.offsetWidth : 0, Y = "offsetHeight" in e3 ? 0 === e3.offsetHeight ? 0 : l2 / e3.offsetHeight : 0;
9871
+ if (m === e3)
9872
+ B2 = "start" === f ? k : "end" === f ? k - H : "nearest" === f ? o$1(M, M + H, H, p2, T2, M + k, M + k + v, v) : k - H / 2, F2 = "start" === u ? D : "center" === u ? D - b / 2 : "end" === u ? D - b : o$1(y, y + b, b, g2, W2, y + D, y + D + E, E), B2 = Math.max(0, B2 + M), F2 = Math.max(0, F2 + y);
9873
+ else {
9874
+ B2 = "start" === f ? k - i2 - p2 : "end" === f ? k - d2 + T2 + S : "nearest" === f ? o$1(i2, d2, l2, p2, T2 + S, k, k + v, v) : k - (i2 + l2 / 2) + S / 2, F2 = "start" === u ? D - h2 - g2 : "center" === u ? D - (h2 + r3 / 2) + V2 / 2 : "end" === u ? D - s2 + W2 + V2 : o$1(h2, s2, r3, g2, W2 + V2, D, D + E, E);
9875
+ const { scrollLeft: t3, scrollTop: n2 } = e3;
9876
+ B2 = 0 === Y ? 0 : Math.max(0, Math.min(n2 + B2 / Y, e3.scrollHeight - l2 / Y + S)), F2 = 0 === X ? 0 : Math.max(0, Math.min(t3 + F2 / X, e3.scrollWidth - r3 / X + V2)), k += n2 - B2, D += t3 - F2;
9877
+ }
9878
+ L.push({ el: e3, top: B2, left: F2 });
9879
+ }
9880
+ return L;
9881
+ };
9882
+ const o = (t2) => false === t2 ? { block: "end", inline: "nearest" } : ((t3) => t3 === Object(t3) && 0 !== Object.keys(t3).length)(t2) ? t2 : { block: "start", inline: "nearest" };
9883
+ function e(e2, r$1) {
9884
+ if (!e2.isConnected || !((t2) => {
9885
+ let o2 = t2;
9886
+ for (; o2 && o2.parentNode; ) {
9887
+ if (o2.parentNode === document)
9888
+ return true;
9889
+ o2 = o2.parentNode instanceof ShadowRoot ? o2.parentNode.host : o2.parentNode;
9890
+ }
9891
+ return false;
9892
+ })(e2))
9893
+ return;
9894
+ const n2 = ((t2) => {
9895
+ const o2 = window.getComputedStyle(t2);
9896
+ return { top: parseFloat(o2.scrollMarginTop) || 0, right: parseFloat(o2.scrollMarginRight) || 0, bottom: parseFloat(o2.scrollMarginBottom) || 0, left: parseFloat(o2.scrollMarginLeft) || 0 };
9897
+ })(e2);
9898
+ if (((t2) => "object" == typeof t2 && "function" == typeof t2.behavior)(r$1))
9899
+ return r$1.behavior(r(e2, r$1));
9900
+ const l2 = "boolean" == typeof r$1 || null == r$1 ? void 0 : r$1.behavior;
9901
+ for (const { el: a, top: i, left: s } of r(e2, o(r$1))) {
9902
+ const t2 = i - n2.top + n2.bottom, o2 = s - n2.left + n2.right;
9903
+ a.scroll({ top: t2, left: o2, behavior: l2 });
9904
+ }
9905
+ }
9906
+ let raf = (callback2) => setTimeout(callback2, 16);
9907
+ let caf = (num) => clearTimeout(num);
9908
+ if (typeof window !== "undefined" && "requestAnimationFrame" in window) {
9909
+ raf = (callback2) => window.requestAnimationFrame(callback2);
9910
+ caf = (handle) => window.cancelAnimationFrame(handle);
9911
+ }
9912
+ let rafUUID = 0;
9913
+ const rafIds = /* @__PURE__ */ new Map();
9914
+ function cleanup(id) {
9915
+ rafIds.delete(id);
9916
+ }
9917
+ function wrapperRaf(callback2, times = 1) {
9918
+ rafUUID += 1;
9919
+ const id = rafUUID;
9920
+ function callRef(leftTimes) {
9921
+ if (leftTimes === 0) {
9922
+ cleanup(id);
9923
+ callback2();
9924
+ } else {
9925
+ const realId = raf(() => {
9926
+ callRef(leftTimes - 1);
10199
9927
  });
10200
- };
10201
- const beforeUpload = (file) => {
10202
- if (fileList.value.length >= props.limit) {
10203
- message.error(`上传文件数量不能超过${props.limit}个!`);
10204
- return false;
9928
+ rafIds.set(id, realId);
9929
+ }
9930
+ }
9931
+ callRef(times);
9932
+ return id;
9933
+ }
9934
+ wrapperRaf.cancel = (id) => {
9935
+ const realId = rafIds.get(id);
9936
+ cleanup(realId);
9937
+ return caf(realId);
9938
+ };
9939
+ const sharpMatcherRegx = /#([\S ]+)$/;
9940
+ const getDefaultContainer = () => {
9941
+ return window;
9942
+ };
9943
+ const getOffsetTop = (element, container) => {
9944
+ if (!element.getClientRects().length) {
9945
+ return 0;
9946
+ }
9947
+ const ele = element.getBoundingClientRect();
9948
+ if (ele.width || ele.height) {
9949
+ if (container === window) {
9950
+ container = element.ownerDocument.documentElement;
9951
+ return ele.top - container.clientTop;
9952
+ }
9953
+ return ele.top - container.getBoundingClientRect().top;
9954
+ }
9955
+ return ele.top;
9956
+ };
9957
+ const isWindow = (obj) => {
9958
+ return obj !== null && obj !== void 0 && obj === obj.window;
9959
+ };
9960
+ const getScroll = (target, top) => {
9961
+ var _a2;
9962
+ if (typeof window === "undefined") {
9963
+ return 0;
9964
+ }
9965
+ const method = "scrollTop";
9966
+ let result = 0;
9967
+ if (isWindow(target)) {
9968
+ result = target["scrollY"];
9969
+ } else if (target instanceof Document) {
9970
+ result = target.documentElement[method];
9971
+ } else if (target instanceof HTMLElement) {
9972
+ result = target[method];
9973
+ } else if (target) {
9974
+ result = target[method];
9975
+ }
9976
+ if (target && !isWindow(target) && typeof result !== "number") {
9977
+ result = (_a2 = (target.ownerDocument ?? target).documentElement) == null ? void 0 : _a2[method];
9978
+ }
9979
+ return result;
9980
+ };
9981
+ const easeInOutCubic = (t2, b, c, d) => {
9982
+ const cc = c - b;
9983
+ t2 /= d / 2;
9984
+ if (t2 < 1) {
9985
+ return cc / 2 * t2 * t2 * t2 + b;
9986
+ }
9987
+ return cc / 2 * ((t2 -= 2) * t2 * t2 + 2) + b;
9988
+ };
9989
+ const scrollTo = (y, options = {}) => {
9990
+ const { getContainer = () => window, callback: callback2, duration = 450 } = options;
9991
+ const container = getContainer();
9992
+ const scrollTop = getScroll(container);
9993
+ const startTime = Date.now();
9994
+ const frameFunc = () => {
9995
+ const timestamp = Date.now();
9996
+ const time = timestamp - startTime;
9997
+ const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
9998
+ if (isWindow(container)) {
9999
+ container.scrollTo(window.scrollX, nextScrollTop);
10000
+ } else if (container instanceof Document) {
10001
+ container.documentElement.scrollTop = nextScrollTop;
10002
+ } else {
10003
+ container.scrollTop = nextScrollTop;
10004
+ }
10005
+ if (time < duration) {
10006
+ wrapperRaf(frameFunc);
10007
+ } else if (typeof callback2 === "function") {
10008
+ callback2();
10009
+ }
10010
+ };
10011
+ wrapperRaf(frameFunc);
10012
+ };
10013
+ const addEventListener = (target, eventType, cb, option) => {
10014
+ if (target && target.addEventListener) {
10015
+ target.addEventListener(eventType, cb, option);
10016
+ }
10017
+ return {
10018
+ remove: () => {
10019
+ if (target && target.removeEventListener) {
10020
+ target.removeEventListener(eventType, cb);
10205
10021
  }
10206
- let fileExtension = "";
10207
- if (file.name.lastIndexOf(".") > -1) {
10208
- fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
10022
+ }
10023
+ };
10024
+ };
10025
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
10026
+ name: "AnchorLink",
10027
+ props: {
10028
+ prefixCls: String,
10029
+ href: String,
10030
+ title: String,
10031
+ target: String,
10032
+ customTitleProps: {
10033
+ type: Object,
10034
+ default: () => {
10209
10035
  }
10210
- const isImg = props.fileType.some((type) => {
10211
- if (file.type.indexOf(type) > -1)
10212
- return true;
10213
- return !!(fileExtension && fileExtension.indexOf(type) > -1);
10036
+ }
10037
+ },
10038
+ setup(props, {
10039
+ slots,
10040
+ attrs
10041
+ }) {
10042
+ let mergedTitle = null;
10043
+ const {
10044
+ handleClick: contextHandleClick,
10045
+ scrollTo: scrollTo2,
10046
+ unregisterLink,
10047
+ registerLink,
10048
+ activeLink
10049
+ } = inject("useAnchor");
10050
+ const handleClick = (e2) => {
10051
+ const {
10052
+ href
10053
+ } = props;
10054
+ contextHandleClick(e2, {
10055
+ title: mergedTitle,
10056
+ href
10214
10057
  });
10215
- const isLimit = file.size < props.fileSize * 1024 * 1024;
10216
- if (!isImg) {
10217
- message.error(`文件格式不正确, 请上传${props.fileType.join("、")}格式!`);
10218
- return false;
10219
- }
10220
- if (!isLimit) {
10221
- message.error(`上传文件大小不能超过${props.fileSize}MB!`);
10222
- return false;
10223
- }
10224
- message.success("正在上传文件,请稍候...");
10225
- uploadNumber.value++;
10058
+ scrollTo2(href);
10226
10059
  };
10227
- const handleFileSuccess = (res) => {
10228
- message.success("上传成功");
10229
- const fileUrl = props.getUploadUrl(res);
10230
- const index = fileList.value.findIndex((item) => {
10231
- var _a2;
10232
- return ((_a2 = item.response) == null ? void 0 : _a2.data) === fileUrl;
10060
+ watch(() => props.href, (val, oldVal) => {
10061
+ nextTick(() => {
10062
+ unregisterLink(oldVal);
10063
+ registerLink(val);
10233
10064
  });
10234
- fileList.value.splice(index, 1);
10235
- uploadList.value.push({ name: fileUrl, url: fileUrl });
10236
- if (uploadList.value.length == uploadNumber.value) {
10237
- fileList.value.push(...uploadList.value);
10238
- uploadList.value = [];
10239
- uploadNumber.value = 0;
10240
- emitUpdateModelValue();
10241
- }
10242
- };
10243
- const handleExceed = () => {
10244
- message.error(`上传文件数量不能超过${props.limit}个!`);
10245
- };
10246
- const excelUploadError = () => {
10247
- message.error("导入数据失败,请您重新上传!");
10248
- };
10249
- const handleRemove = (file) => {
10250
- const index = fileList.value.map((f) => f.name).indexOf(file.name);
10251
- if (index > -1) {
10252
- fileList.value.splice(index, 1);
10253
- emitUpdateModelValue();
10254
- }
10255
- };
10256
- const handlePreview = (uploadFile) => {
10257
- console.log(uploadFile);
10258
- };
10259
- watch(
10260
- () => props.modelValue,
10261
- (val) => {
10262
- if (!val) {
10263
- fileList.value = [];
10264
- return;
10265
- }
10266
- fileList.value = [];
10267
- if (isString(val)) {
10268
- fileList.value.push(
10269
- ...val.split(",").map((url) => ({ name: url.substring(url.lastIndexOf("/") + 1), url }))
10270
- );
10271
- return;
10272
- }
10273
- fileList.value.push(
10274
- ...val.map((url) => ({ name: url.substring(url.lastIndexOf("/") + 1), url }))
10275
- );
10276
- },
10277
- { immediate: true, deep: true }
10278
- );
10279
- const emitUpdateModelValue = () => {
10280
- let result = fileList.value.map((file) => file.url);
10281
- if (props.limit === 1 || isString(props.modelValue)) {
10282
- result = result.join(",");
10283
- }
10284
- emit("update:modelValue", result);
10285
- };
10286
- return (_ctx, _cache) => {
10287
- return openBlock(), createElementBlock("div", {
10288
- class: normalizeClass(["upload-file", _ctx.$attrs.class])
10289
- }, [
10290
- !__props.disabled ? (openBlock(), createBlock(unref(ElUpload), {
10291
- key: 0,
10292
- ref_key: "uploadRef",
10293
- ref: uploadRef,
10294
- "file-list": unref(fileList),
10295
- "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => isRef(fileList) ? fileList.value = $event : null),
10296
- "auto-upload": __props.autoUpload,
10297
- "before-upload": beforeUpload,
10298
- disabled: __props.disabled,
10299
- drag: __props.drag,
10300
- "http-request": httpRequest,
10301
- limit: props.limit,
10302
- multiple: props.limit > 1,
10303
- "on-error": excelUploadError,
10304
- "on-exceed": handleExceed,
10305
- "on-preview": handlePreview,
10306
- "on-remove": handleRemove,
10307
- "on-success": handleFileSuccess,
10308
- "show-file-list": true,
10309
- class: "upload-file-uploader",
10310
- name: "file"
10311
- }, createSlots({
10312
- file: withCtx((row) => [
10313
- createElementVNode("div", _hoisted_2$2, [
10314
- createElementVNode("span", null, toDisplayString(row.file.name), 1),
10315
- createElementVNode("div", _hoisted_3$2, [
10316
- createVNode(unref(ElLink), {
10317
- href: row.file.url,
10318
- underline: "never",
10319
- download: "",
10320
- target: "_blank",
10321
- type: "primary"
10322
- }, {
10323
- default: withCtx(() => _cache[2] || (_cache[2] = [
10324
- createTextVNode(" 下载 ", -1)
10325
- ])),
10326
- _: 2,
10327
- __: [2]
10328
- }, 1032, ["href"])
10329
- ]),
10330
- createElementVNode("div", _hoisted_4$2, [
10331
- createVNode(unref(ElLink), {
10332
- type: "danger",
10333
- onClick: ($event) => handleRemove(row.file)
10334
- }, {
10335
- default: withCtx(() => _cache[3] || (_cache[3] = [
10336
- createTextVNode(" 删除", -1)
10337
- ])),
10338
- _: 2,
10339
- __: [3]
10340
- }, 1032, ["onClick"])
10341
- ])
10342
- ])
10343
- ]),
10344
- default: withCtx(() => [
10345
- createVNode(unref(ElButton), { type: "primary" }, {
10346
- default: withCtx(() => [
10347
- createVNode(unref(_sfc_main$v), { icon: "ant-design:upload-outlined" }),
10348
- _cache[1] || (_cache[1] = createTextVNode(" 选取文件 ", -1))
10349
- ]),
10350
- _: 1,
10351
- __: [1]
10352
- })
10353
- ]),
10354
- _: 2
10355
- }, [
10356
- __props.isShowTip ? {
10357
- name: "tip",
10358
- fn: withCtx(() => [
10359
- createElementVNode("div", _hoisted_1$2, [
10360
- createElementVNode("span", null, "格式为:" + toDisplayString(__props.fileType.join("、")) + ",", 1),
10361
- createElementVNode("span", null, "大小不超过" + toDisplayString(__props.fileSize) + "MB。", 1)
10362
- ])
10363
- ]),
10364
- key: "0"
10365
- } : void 0
10366
- ]), 1032, ["file-list", "auto-upload", "disabled", "drag", "limit", "multiple"])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(fileList), (file, index) => {
10367
- return openBlock(), createElementBlock("div", {
10368
- key: index,
10369
- class: "flex items-center file-list-item"
10370
- }, [
10371
- createElementVNode("span", null, toDisplayString(file.name), 1),
10372
- createElementVNode("div", _hoisted_5$1, [
10373
- createVNode(unref(ElLink), {
10374
- href: file.url,
10375
- underline: "never",
10376
- download: "",
10377
- target: "_blank",
10378
- type: "primary"
10379
- }, {
10380
- default: withCtx(() => _cache[4] || (_cache[4] = [
10381
- createTextVNode(" 下载 ", -1)
10382
- ])),
10383
- _: 2,
10384
- __: [4]
10385
- }, 1032, ["href"])
10386
- ])
10387
- ]);
10388
- }), 128))
10389
- ], 2);
10065
+ });
10066
+ onMounted(() => {
10067
+ registerLink(props.href);
10068
+ });
10069
+ onBeforeUnmount(() => {
10070
+ unregisterLink(props.href);
10071
+ });
10072
+ return () => {
10073
+ var _a2;
10074
+ const {
10075
+ prefixCls: prefixCls2,
10076
+ href,
10077
+ target,
10078
+ title = slots.title,
10079
+ customTitleProps = {}
10080
+ } = props;
10081
+ mergedTitle = typeof title === "function" ? title(customTitleProps) : title;
10082
+ const active = activeLink.value === href;
10083
+ const wrapperClassName = [`${prefixCls2}-link`, {
10084
+ [`${prefixCls2}-link-active`]: active
10085
+ }, attrs.class];
10086
+ const titleClassName = [`${prefixCls2}-link-title`, {
10087
+ [`${prefixCls2}-link-title-active`]: active
10088
+ }];
10089
+ return createVNode("div", mergeProps(attrs, {
10090
+ "class": wrapperClassName
10091
+ }), [createVNode("a", {
10092
+ "class": titleClassName,
10093
+ "href": href,
10094
+ "title": typeof mergedTitle === "string" ? mergedTitle : "",
10095
+ "target": target,
10096
+ "onClick": handleClick
10097
+ }, [slots.customTitle ? slots.customTitle(customTitleProps) : mergedTitle]), (_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
10390
10098
  };
10391
- }
10392
- });
10393
- const UploadFile = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-f625d304"]]);
10394
- const _sfc_main$6 = /* @__PURE__ */ Object.assign({ name: "Badge" }, {
10395
- __name: "Badge",
10396
- props: {
10397
- value: {
10398
- type: [String, Number],
10399
- default: ""
10400
- },
10401
- max: {
10402
- type: Number,
10403
- default: 99
10404
- },
10405
- isDot: {
10099
+ }
10100
+ });
10101
+ function _isSlot(s) {
10102
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
10103
+ }
10104
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
10105
+ name: "Anchor",
10106
+ props: {
10107
+ offsetTop: Number,
10108
+ bounds: Number,
10109
+ affix: {
10406
10110
  type: Boolean,
10407
- default: false
10111
+ default: true
10408
10112
  },
10409
- hidden: {
10113
+ showInkInFixed: {
10410
10114
  type: Boolean,
10411
10115
  default: false
10412
10116
  },
10413
- type: {
10117
+ getContainer: Function,
10118
+ wrapperClass: String,
10119
+ wrapperStyle: {
10120
+ type: Object,
10121
+ default: void 0
10122
+ },
10123
+ // getCurrentAnchor: Function,
10124
+ targetOffset: Number,
10125
+ items: {
10126
+ type: Array,
10127
+ default: () => []
10128
+ },
10129
+ direction: {
10414
10130
  type: String,
10415
- default: "danger",
10131
+ default: "vertical",
10416
10132
  validator(value) {
10417
- return ["primary", "success", "warning", "danger", "info"].includes(value);
10133
+ return ["vertical", "horizontal"].includes(value);
10418
10134
  }
10419
10135
  }
10420
10136
  },
10421
- setup(__props) {
10422
- const props = __props;
10423
- const { getPrefixCls: getPrefixCls2 } = useDesign();
10424
- const prefixCls2 = getPrefixCls2("badge");
10425
- return (_ctx, _cache) => {
10426
- return openBlock(), createBlock(unref(ElBadge), mergeProps(props, { class: unref(prefixCls2) }), {
10427
- default: withCtx(() => [
10428
- renderSlot(_ctx.$slots, "default")
10429
- ]),
10430
- _: 3
10431
- }, 16, ["class"]);
10137
+ setup(props, {
10138
+ attrs,
10139
+ emit,
10140
+ slots,
10141
+ expose
10142
+ }) {
10143
+ const {
10144
+ getPrefixCls: getPrefixCls2
10145
+ } = useDesign();
10146
+ const prefixCls2 = getPrefixCls2("anchor");
10147
+ const anchorDirection = computed(() => props.direction ?? "vertical");
10148
+ const spanLinkNode = ref(null);
10149
+ const anchorRef = ref();
10150
+ const state = reactive({
10151
+ links: [],
10152
+ scrollContainer: null,
10153
+ scrollEvent: null,
10154
+ animating: false
10155
+ });
10156
+ const activeLink = ref(null);
10157
+ const getContainer = computed(() => {
10158
+ const {
10159
+ getContainer: getContainer2
10160
+ } = props;
10161
+ return getContainer2 || getDefaultContainer;
10162
+ });
10163
+ const getCurrentAnchor = (offsetTop = 0, bounds = 5) => {
10164
+ const linkSections = [];
10165
+ const container = getContainer.value();
10166
+ state.links.forEach((link) => {
10167
+ const sharpLinkMatch = sharpMatcherRegx.exec(link.toString());
10168
+ if (!sharpLinkMatch) {
10169
+ return;
10170
+ }
10171
+ const target = document.getElementById(sharpLinkMatch[1]);
10172
+ if (target) {
10173
+ const top = getOffsetTop(target, container);
10174
+ if (top < offsetTop + bounds) {
10175
+ linkSections.push({
10176
+ link,
10177
+ top
10178
+ });
10179
+ }
10180
+ }
10181
+ });
10182
+ if (linkSections.length) {
10183
+ const maxSection = linkSections.reduce((prev, curr) => curr.top > prev.top ? curr : prev);
10184
+ return maxSection.link;
10185
+ }
10186
+ return "";
10187
+ };
10188
+ const setCurrentActiveLink = (link) => {
10189
+ const {
10190
+ getCurrentAnchor: getCurrentAnchor2
10191
+ } = props;
10192
+ if (activeLink.value === link) {
10193
+ return;
10194
+ }
10195
+ activeLink.value = typeof getCurrentAnchor2 === "function" ? getCurrentAnchor2(link) : link;
10196
+ emit("change", link);
10197
+ };
10198
+ const handleScrollTo = (link) => {
10199
+ const {
10200
+ offsetTop,
10201
+ targetOffset
10202
+ } = props;
10203
+ setCurrentActiveLink(link);
10204
+ const sharpLinkMatch = sharpMatcherRegx.exec(link);
10205
+ if (!sharpLinkMatch) {
10206
+ return;
10207
+ }
10208
+ const targetElement = document.getElementById(sharpLinkMatch[1]);
10209
+ if (!targetElement) {
10210
+ return;
10211
+ }
10212
+ const container = getContainer.value();
10213
+ const scrollTop = getScroll(container);
10214
+ const eleOffsetTop = getOffsetTop(targetElement, container);
10215
+ let y = scrollTop + eleOffsetTop;
10216
+ y -= targetOffset !== void 0 ? targetOffset : offsetTop || 0;
10217
+ state.animating = true;
10218
+ scrollTo(y, {
10219
+ callback: () => {
10220
+ state.animating = false;
10221
+ },
10222
+ getContainer: getContainer.value
10223
+ });
10224
+ };
10225
+ expose({
10226
+ scrollTo: handleScrollTo
10227
+ });
10228
+ const handleScroll = () => {
10229
+ if (state.animating) {
10230
+ return;
10231
+ }
10232
+ const {
10233
+ offsetTop,
10234
+ bounds,
10235
+ targetOffset
10236
+ } = props;
10237
+ const currentActiveLink = getCurrentAnchor(targetOffset !== void 0 ? targetOffset : offsetTop || 0, bounds);
10238
+ setCurrentActiveLink(currentActiveLink);
10239
+ };
10240
+ const updateInk = () => {
10241
+ const linkNode = anchorRef.value.querySelector(`.${prefixCls2}-link-title-active`);
10242
+ if (linkNode && spanLinkNode.value) {
10243
+ const horizontalAnchor = anchorDirection.value === "horizontal";
10244
+ spanLinkNode.value.style.top = horizontalAnchor ? "" : `${linkNode.offsetTop + linkNode.clientHeight / 2}px`;
10245
+ spanLinkNode.value.style.height = horizontalAnchor ? "" : `${linkNode.clientHeight}px`;
10246
+ spanLinkNode.value.style.left = horizontalAnchor ? `${linkNode.offsetLeft}px` : "";
10247
+ spanLinkNode.value.style.width = horizontalAnchor ? `${linkNode.clientWidth}px` : "";
10248
+ if (horizontalAnchor) {
10249
+ e(linkNode, {
10250
+ scrollMode: "if-needed",
10251
+ block: "nearest"
10252
+ });
10253
+ }
10254
+ }
10255
+ };
10256
+ provide("useAnchor", {
10257
+ registerLink: (link) => {
10258
+ if (!state.links.includes(link)) {
10259
+ state.links.push(link);
10260
+ }
10261
+ },
10262
+ unregisterLink: (link) => {
10263
+ const index = state.links.indexOf(link);
10264
+ if (index !== -1) {
10265
+ state.links.splice(index, 1);
10266
+ }
10267
+ },
10268
+ activeLink,
10269
+ scrollTo: handleScrollTo,
10270
+ handleClick: (e2, info) => {
10271
+ emit("click", e2, info);
10272
+ },
10273
+ direction: anchorDirection
10274
+ });
10275
+ onMounted(() => {
10276
+ nextTick(() => {
10277
+ const container = getContainer.value();
10278
+ state.scrollContainer = container;
10279
+ state.scrollEvent = addEventListener(state.scrollContainer, "scroll", handleScroll);
10280
+ handleScroll();
10281
+ });
10282
+ });
10283
+ onBeforeUnmount(() => {
10284
+ if (state.scrollEvent) {
10285
+ state.scrollEvent.remove();
10286
+ }
10287
+ });
10288
+ onUpdated(() => {
10289
+ if (state.scrollEvent) {
10290
+ const currentContainer = getContainer.value();
10291
+ if (state.scrollContainer !== currentContainer) {
10292
+ state.scrollContainer = currentContainer;
10293
+ state.scrollEvent.remove();
10294
+ state.scrollEvent = addEventListener(state.scrollContainer, "scroll", handleScroll);
10295
+ handleScroll();
10296
+ }
10297
+ }
10298
+ updateInk();
10299
+ });
10300
+ const createNestedLink = (options) => Array.isArray(options) ? options.map((option) => {
10301
+ const {
10302
+ children,
10303
+ key,
10304
+ href,
10305
+ target,
10306
+ class: cls,
10307
+ style,
10308
+ title
10309
+ } = option;
10310
+ return createVNode(_sfc_main$6, {
10311
+ "key": key,
10312
+ "href": href,
10313
+ "target": target,
10314
+ "class": cls,
10315
+ "style": style,
10316
+ "title": title,
10317
+ "prefixCls": prefixCls2,
10318
+ "customTitleProps": option
10319
+ }, {
10320
+ default: () => [anchorDirection.value === "vertical" ? createNestedLink(children) : null],
10321
+ customTitle: slots.customTitle
10322
+ });
10323
+ }) : null;
10324
+ return () => {
10325
+ var _a2;
10326
+ const {
10327
+ offsetTop,
10328
+ affix,
10329
+ showInkInFixed
10330
+ } = props;
10331
+ const inkClass = [`${prefixCls2}-ink`, {
10332
+ [`${prefixCls2}-ink-visible`]: activeLink.value
10333
+ }];
10334
+ const wrapperClass = [props.wrapperClass, `${prefixCls2}-wrapper`, {
10335
+ [`${prefixCls2}-wrapper-horizontal`]: anchorDirection.value === "horizontal"
10336
+ }];
10337
+ const anchorClass = [prefixCls2, {
10338
+ [`${prefixCls2}-fixed`]: !affix && !showInkInFixed
10339
+ }];
10340
+ const wrapperStyle = {
10341
+ maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : "100vh",
10342
+ ...props.wrapperStyle
10343
+ };
10344
+ const anchorContent = createVNode("div", {
10345
+ "class": wrapperClass,
10346
+ "style": wrapperStyle,
10347
+ "ref": anchorRef
10348
+ }, [createVNode("div", {
10349
+ "class": anchorClass
10350
+ }, [createVNode("span", {
10351
+ "class": inkClass,
10352
+ "ref": spanLinkNode
10353
+ }, null), Array.isArray(props.items) ? createNestedLink(props.items) : (_a2 = slots.default) == null ? void 0 : _a2.call(slots)])]);
10354
+ return !affix ? anchorContent : createVNode(ElAffix, mergeProps(attrs, {
10355
+ "offset": offsetTop
10356
+ }), _isSlot(anchorContent) ? anchorContent : {
10357
+ default: () => [anchorContent]
10358
+ });
10432
10359
  };
10433
10360
  }
10434
10361
  });
10435
- const _sfc_main$5 = /* @__PURE__ */ Object.assign({ name: "Pagination" }, {
10436
- __name: "Pagination",
10362
+ const _hoisted_1$3 = { class: "com-steps" };
10363
+ const _hoisted_2$3 = { class: "steps-item-container" };
10364
+ const _hoisted_3$3 = { class: "steps-item-icon" };
10365
+ const _hoisted_4$3 = { class: "steps-icon" };
10366
+ const _hoisted_5$3 = { class: "steps-item-content" };
10367
+ const _hoisted_6$2 = { class: "steps-item-title" };
10368
+ const _sfc_main$4 = /* @__PURE__ */ Object.assign({ name: "Steps" }, {
10369
+ __name: "Steps",
10437
10370
  props: {
10438
- // 总条目数
10439
- total: {
10440
- required: true,
10441
- type: Number
10442
- },
10443
- // 当前页数:pageNo
10444
- page: {
10445
- type: Number,
10446
- default: 1
10447
- },
10448
- // 每页显示条目个数:pageSize
10449
- limit: {
10371
+ // 设置当前激活步骤
10372
+ active: {
10450
10373
  type: Number,
10451
- default: 20
10374
+ default: 0
10452
10375
  },
10453
- // 设置最大页码按钮数。 页码按钮的数量,当总页数超过该值时会折叠
10454
- // 移动端页码按钮的数量端默认值 5
10455
- pagerCount: {
10456
- type: Number,
10457
- default: document.body.clientWidth < 992 ? 5 : 7
10376
+ // 配置选项卡内容
10377
+ items: {
10378
+ type: Array,
10379
+ default: () => []
10458
10380
  }
10459
10381
  },
10460
- emits: ["update:page", "update:limit", "pagination"],
10461
- setup(__props, { emit: __emit }) {
10462
- const appStore = useAppStore();
10463
- const layoutCurrentSize = computed(() => appStore.currentSize);
10464
- const isSmall = ref(layoutCurrentSize.value === "small");
10465
- watchEffect(() => {
10466
- isSmall.value = layoutCurrentSize.value === "small";
10467
- });
10468
- const props = __props;
10469
- const emit = __emit;
10470
- const currentPage = computed({
10471
- get() {
10472
- return props.page;
10473
- },
10474
- set(val) {
10475
- emit("update:page", val);
10476
- }
10477
- });
10478
- const pageSize = computed({
10479
- get() {
10480
- return props.limit;
10481
- },
10482
- set(val) {
10483
- emit("update:limit", val);
10484
- }
10485
- });
10486
- const handleSizeChange = (val) => {
10487
- if (currentPage.value * val > props.total) {
10488
- currentPage.value = 1;
10489
- }
10490
- emit("pagination", { page: currentPage.value, limit: val });
10491
- };
10492
- const handleCurrentChange = (val) => {
10493
- emit("pagination", { page: val, limit: pageSize.value });
10494
- };
10382
+ setup(__props) {
10495
10383
  return (_ctx, _cache) => {
10496
- return withDirectives((openBlock(), createBlock(unref(ElPagination), {
10497
- "current-page": currentPage.value,
10498
- "onUpdate:currentPage": _cache[0] || (_cache[0] = ($event) => currentPage.value = $event),
10499
- "page-size": pageSize.value,
10500
- "onUpdate:pageSize": _cache[1] || (_cache[1] = ($event) => pageSize.value = $event),
10501
- "pager-count": __props.pagerCount,
10502
- total: __props.total,
10503
- small: unref(isSmall),
10504
- class: "m-t-16px",
10505
- layout: "prev, pager, next, sizes",
10506
- onSizeChange: handleSizeChange,
10507
- onCurrentChange: handleCurrentChange
10508
- }, null, 8, ["current-page", "page-size", "pager-count", "total", "small"])), [
10509
- [vShow, __props.total > 0]
10384
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
10385
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
10386
+ return openBlock(), createElementBlock("div", {
10387
+ key: index,
10388
+ class: normalizeClass(["steps-item", {
10389
+ "steps-item-finish": __props.active > index,
10390
+ "steps-item-process": __props.active == index,
10391
+ "steps-item-wait": __props.active < index
10392
+ }])
10393
+ }, [
10394
+ createElementVNode("div", _hoisted_2$3, [
10395
+ createElementVNode("div", _hoisted_3$3, [
10396
+ createElementVNode("div", _hoisted_4$3, [
10397
+ __props.active > index ? (openBlock(), createBlock(unref(_sfc_main$v), {
10398
+ key: 0,
10399
+ icon: "ant-design:check-outlined",
10400
+ color: "#fff"
10401
+ })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
10402
+ createTextVNode(toDisplayString(index + 1), 1)
10403
+ ], 64))
10404
+ ])
10405
+ ]),
10406
+ createElementVNode("div", _hoisted_5$3, [
10407
+ createElementVNode("div", _hoisted_6$2, toDisplayString(item.title), 1)
10408
+ ])
10409
+ ])
10410
+ ], 2);
10411
+ }), 128))
10510
10412
  ]);
10511
10413
  };
10512
10414
  }
10513
10415
  });
10514
- const _hoisted_1$1 = { class: "title" };
10515
- const _hoisted_2$1 = { class: "absolute right-17px top-[50%] h-54px flex translate-y-[-50%] items-center justify-between" };
10516
- const _hoisted_3$1 = { class: "p-20px" };
10517
- const _hoisted_4$1 = {
10518
- key: 1,
10519
- class: "pt-16px p-l-20px p-r-20px"
10520
- };
10521
- const _sfc_main$4 = /* @__PURE__ */ Object.assign({ name: "Dialog" }, {
10522
- __name: "Dialog",
10416
+ const Steps = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-eb3cf40f"]]);
10417
+ const _sfc_main$3 = /* @__PURE__ */ Object.assign({ name: "ImageViewer" }, {
10418
+ __name: "ImageViewer",
10523
10419
  props: {
10524
- modelValue: {
10525
- type: Boolean,
10526
- default: false
10527
- },
10528
- title: {
10529
- type: String,
10530
- default: "Dialog"
10531
- },
10532
- fullscreen: {
10533
- type: Boolean,
10534
- default: false
10535
- },
10536
- width: {
10537
- type: [String, Number]
10538
- },
10539
- // 是否开启滚动条。如果是的话,按照 maxHeight 设置最大高度
10540
- scroll: {
10541
- type: Boolean,
10542
- default: false
10543
- },
10544
- maxHeight: {
10545
- type: [String, Number],
10546
- default: "60vh"
10420
+ urlList: {
10421
+ type: Array,
10422
+ default: () => []
10547
10423
  },
10548
- // width有值时优先使用width
10549
- size: {
10550
- type: String,
10551
- default: "default",
10552
- validate(value) {
10553
- return ["large", "default", "small"].includes(value);
10554
- }
10424
+ zIndex: {
10425
+ type: Number,
10426
+ default: 200
10555
10427
  },
10556
- top: {
10557
- type: String,
10558
- default: "0"
10428
+ initialIndex: {
10429
+ type: Number,
10430
+ default: 0
10559
10431
  },
10560
- scrollbarAlways: {
10432
+ infinite: {
10561
10433
  type: Boolean,
10562
- default: true
10563
- }
10564
- },
10565
- emits: ["update:modelValue", "close"],
10566
- setup(__props, { emit: __emit }) {
10567
- const slots = useSlots();
10568
- const props = __props;
10569
- const emit = __emit;
10570
- const getBindValue = computed(() => {
10571
- const delArr = ["fullscreen", "title", "maxHeight", "appendToBody"];
10572
- const attrs = useAttrs();
10573
- const obj = { ...attrs, ...props };
10574
- for (const key in obj) {
10575
- if (delArr.indexOf(key) !== -1) {
10576
- delete obj[key];
10577
- }
10578
- }
10579
- return obj;
10580
- });
10581
- const dialogHeight = ref(isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight);
10582
- const dialogStyle = computed(() => {
10583
- return {
10584
- height: unref(dialogHeight)
10585
- };
10586
- });
10587
- const dialogWidth = computed(() => {
10588
- return props.width ?? (props.size === "default" ? "40%" : props.size === "large" ? "60%" : "30%");
10589
- });
10590
- const dialogClose = () => {
10591
- emit("update:modelValue", false);
10592
- emit("close");
10593
- };
10594
- return (_ctx, _cache) => {
10595
- const _component_Icon = resolveComponent("Icon");
10596
- return openBlock(), createBlock(unref(ElDialog), mergeProps(unref(getBindValue), {
10597
- "close-on-click-modal": true,
10598
- fullscreen: __props.fullscreen,
10599
- width: unref(dialogWidth),
10600
- top: __props.top,
10601
- "destroy-on-close": "",
10602
- "lock-scroll": "",
10603
- class: "com-dialog",
10604
- "modal-class": "com-modal-dialog",
10605
- "footer-class": __props.scroll ? "footer-shadow" : "",
10606
- "show-close": false,
10607
- onClose: dialogClose
10608
- }), createSlots({
10609
- header: withCtx(({ close }) => [
10610
- createElementVNode("div", _hoisted_1$1, [
10611
- renderSlot(_ctx.$slots, "title", {}, () => [
10612
- createTextVNode(toDisplayString(__props.title), 1)
10613
- ]),
10614
- createElementVNode("div", _hoisted_2$1, [
10615
- createVNode(_component_Icon, {
10616
- class: "is-hover cursor-pointer",
10617
- icon: "ep:close",
10618
- "hover-color": "var(--el-color-primary)",
10619
- color: "var(--el-color-info)",
10620
- onClick: withModifiers(close, ["stop"])
10621
- }, null, 8, ["onClick"])
10622
- ])
10623
- ])
10624
- ]),
10625
- default: withCtx(() => [
10626
- __props.scroll ? (openBlock(), createBlock(unref(ElScrollbar), {
10627
- key: 0,
10628
- style: normalizeStyle(unref(dialogStyle)),
10629
- always: __props.scrollbarAlways
10630
- }, {
10631
- default: withCtx(() => [
10632
- createElementVNode("div", _hoisted_3$1, [
10633
- renderSlot(_ctx.$slots, "default")
10634
- ])
10635
- ]),
10636
- _: 3
10637
- }, 8, ["style", "always"])) : (openBlock(), createElementBlock("div", _hoisted_4$1, [
10638
- renderSlot(_ctx.$slots, "default")
10639
- ]))
10640
- ]),
10641
- _: 2
10642
- }, [
10643
- unref(slots).footer ? {
10644
- name: "footer",
10645
- fn: withCtx(() => [
10646
- renderSlot(_ctx.$slots, "footer")
10647
- ]),
10648
- key: "0"
10649
- } : void 0
10650
- ]), 1040, ["fullscreen", "width", "top", "footer-class"]);
10651
- };
10652
- }
10653
- });
10654
- const _sfc_main$3 = /* @__PURE__ */ Object.assign({ name: "Alert" }, {
10655
- __name: "Alert",
10656
- props: {
10657
- title: String,
10658
- type: {
10659
- type: String,
10660
- default: "info",
10661
- validator(value) {
10662
- return ["success", "warning", "info", "error"].includes(value);
10663
- }
10434
+ default: true
10664
10435
  },
10665
- description: String,
10666
- closable: {
10436
+ hideOnClickModal: {
10667
10437
  type: Boolean,
10668
10438
  default: false
10669
10439
  },
10670
- center: {
10440
+ teleported: {
10671
10441
  type: Boolean,
10672
10442
  default: false
10673
10443
  },
10674
- closeText: String,
10675
- showIcon: {
10444
+ show: {
10676
10445
  type: Boolean,
10677
10446
  default: false
10678
10447
  }
10679
10448
  },
10680
10449
  setup(__props) {
10681
- const { getPrefixCls: getPrefixCls2 } = useDesign();
10682
- const prefixCls2 = getPrefixCls2("alert");
10683
10450
  const props = __props;
10451
+ const getBindValue = computed(() => {
10452
+ const propsData = { ...props };
10453
+ delete propsData.show;
10454
+ return propsData;
10455
+ });
10456
+ const show = ref(props.show);
10457
+ const close = () => {
10458
+ show.value = false;
10459
+ };
10684
10460
  return (_ctx, _cache) => {
10685
- return openBlock(), createBlock(unref(ElAlert), mergeProps(props, { class: unref(prefixCls2) }), null, 16, ["class"]);
10461
+ return unref(show) ? (openBlock(), createBlock(unref(ElImageViewer), mergeProps({ key: 0 }, unref(getBindValue), { onClose: close }), null, 16)) : createCommentVNode("", true);
10686
10462
  };
10687
10463
  }
10688
10464
  });
10689
- const t = (t2) => "object" == typeof t2 && null != t2 && 1 === t2.nodeType, e$1 = (t2, e2) => (!e2 || "hidden" !== t2) && ("visible" !== t2 && "clip" !== t2), n = (t2, n2) => {
10690
- if (t2.clientHeight < t2.scrollHeight || t2.clientWidth < t2.scrollWidth) {
10691
- const o2 = getComputedStyle(t2, null);
10692
- return e$1(o2.overflowY, n2) || e$1(o2.overflowX, n2) || ((t3) => {
10693
- const e2 = ((t4) => {
10694
- if (!t4.ownerDocument || !t4.ownerDocument.defaultView)
10695
- return null;
10696
- try {
10697
- return t4.ownerDocument.defaultView.frameElement;
10698
- } catch (t5) {
10699
- return null;
10700
- }
10701
- })(t3);
10702
- return !!e2 && (e2.clientHeight < t3.scrollHeight || e2.clientWidth < t3.scrollWidth);
10703
- })(t2);
10704
- }
10705
- return false;
10706
- }, o$1 = (t2, e2, n2, o2, l2, r2, i, s) => r2 < t2 && i > e2 || r2 > t2 && i < e2 ? 0 : r2 <= t2 && s <= n2 || i >= e2 && s >= n2 ? r2 - t2 - o2 : i > e2 && s < n2 || r2 < t2 && s > n2 ? i - e2 + l2 : 0, l = (t2) => {
10707
- const e2 = t2.parentElement;
10708
- return null == e2 ? t2.getRootNode().host || null : e2;
10709
- }, r = (e2, r2) => {
10710
- var i, s, d, h;
10711
- if ("undefined" == typeof document)
10712
- return [];
10713
- const { scrollMode: c, block: f, inline: u, boundary: a, skipOverflowHiddenElements: g } = r2, p = "function" == typeof a ? a : (t2) => t2 !== a;
10714
- if (!t(e2))
10715
- throw new TypeError("Invalid target");
10716
- const m = document.scrollingElement || document.documentElement, w = [];
10717
- let W = e2;
10718
- for (; t(W) && p(W); ) {
10719
- if (W = l(W), W === m) {
10720
- w.push(W);
10721
- break;
10722
- }
10723
- null != W && W === document.body && n(W) && !n(document.documentElement) || null != W && n(W, g) && w.push(W);
10724
- }
10725
- const b = null != (s = null == (i = window.visualViewport) ? void 0 : i.width) ? s : innerWidth, H = null != (h = null == (d = window.visualViewport) ? void 0 : d.height) ? h : innerHeight, { scrollX: y, scrollY: M } = window, { height: v, width: E, top: x, right: C, bottom: I, left: R } = e2.getBoundingClientRect(), { top: T, right: B, bottom: F, left: V } = ((t2) => {
10726
- const e3 = window.getComputedStyle(t2);
10727
- return { top: parseFloat(e3.scrollMarginTop) || 0, right: parseFloat(e3.scrollMarginRight) || 0, bottom: parseFloat(e3.scrollMarginBottom) || 0, left: parseFloat(e3.scrollMarginLeft) || 0 };
10728
- })(e2);
10729
- let k = "start" === f || "nearest" === f ? x - T : "end" === f ? I + F : x + v / 2 - T + F, D = "center" === u ? R + E / 2 - V + B : "end" === u ? C + B : R - V;
10730
- const L = [];
10731
- for (let t2 = 0; t2 < w.length; t2++) {
10732
- const e3 = w[t2], { height: l2, width: r3, top: i2, right: s2, bottom: d2, left: h2 } = e3.getBoundingClientRect();
10733
- if ("if-needed" === c && x >= 0 && R >= 0 && I <= H && C <= b && (e3 === m && !n(e3) || x >= i2 && I <= d2 && R >= h2 && C <= s2))
10734
- return L;
10735
- const a2 = getComputedStyle(e3), g2 = parseInt(a2.borderLeftWidth, 10), p2 = parseInt(a2.borderTopWidth, 10), W2 = parseInt(a2.borderRightWidth, 10), T2 = parseInt(a2.borderBottomWidth, 10);
10736
- let B2 = 0, F2 = 0;
10737
- const V2 = "offsetWidth" in e3 ? e3.offsetWidth - e3.clientWidth - g2 - W2 : 0, S = "offsetHeight" in e3 ? e3.offsetHeight - e3.clientHeight - p2 - T2 : 0, X = "offsetWidth" in e3 ? 0 === e3.offsetWidth ? 0 : r3 / e3.offsetWidth : 0, Y = "offsetHeight" in e3 ? 0 === e3.offsetHeight ? 0 : l2 / e3.offsetHeight : 0;
10738
- if (m === e3)
10739
- B2 = "start" === f ? k : "end" === f ? k - H : "nearest" === f ? o$1(M, M + H, H, p2, T2, M + k, M + k + v, v) : k - H / 2, F2 = "start" === u ? D : "center" === u ? D - b / 2 : "end" === u ? D - b : o$1(y, y + b, b, g2, W2, y + D, y + D + E, E), B2 = Math.max(0, B2 + M), F2 = Math.max(0, F2 + y);
10740
- else {
10741
- B2 = "start" === f ? k - i2 - p2 : "end" === f ? k - d2 + T2 + S : "nearest" === f ? o$1(i2, d2, l2, p2, T2 + S, k, k + v, v) : k - (i2 + l2 / 2) + S / 2, F2 = "start" === u ? D - h2 - g2 : "center" === u ? D - (h2 + r3 / 2) + V2 / 2 : "end" === u ? D - s2 + W2 + V2 : o$1(h2, s2, r3, g2, W2 + V2, D, D + E, E);
10742
- const { scrollLeft: t3, scrollTop: n2 } = e3;
10743
- B2 = 0 === Y ? 0 : Math.max(0, Math.min(n2 + B2 / Y, e3.scrollHeight - l2 / Y + S)), F2 = 0 === X ? 0 : Math.max(0, Math.min(t3 + F2 / X, e3.scrollWidth - r3 / X + V2)), k += n2 - B2, D += t3 - F2;
10744
- }
10745
- L.push({ el: e3, top: B2, left: F2 });
10746
- }
10747
- return L;
10748
- };
10749
- const o = (t2) => false === t2 ? { block: "end", inline: "nearest" } : ((t3) => t3 === Object(t3) && 0 !== Object.keys(t3).length)(t2) ? t2 : { block: "start", inline: "nearest" };
10750
- function e(e2, r$1) {
10751
- if (!e2.isConnected || !((t2) => {
10752
- let o2 = t2;
10753
- for (; o2 && o2.parentNode; ) {
10754
- if (o2.parentNode === document)
10755
- return true;
10756
- o2 = o2.parentNode instanceof ShadowRoot ? o2.parentNode.host : o2.parentNode;
10757
- }
10758
- return false;
10759
- })(e2))
10465
+ let instance = null;
10466
+ function createImageViewer(options) {
10467
+ if (!isClient)
10760
10468
  return;
10761
- const n2 = ((t2) => {
10762
- const o2 = window.getComputedStyle(t2);
10763
- return { top: parseFloat(o2.scrollMarginTop) || 0, right: parseFloat(o2.scrollMarginRight) || 0, bottom: parseFloat(o2.scrollMarginBottom) || 0, left: parseFloat(o2.scrollMarginLeft) || 0 };
10764
- })(e2);
10765
- if (((t2) => "object" == typeof t2 && "function" == typeof t2.behavior)(r$1))
10766
- return r$1.behavior(r(e2, r$1));
10767
- const l2 = "boolean" == typeof r$1 || null == r$1 ? void 0 : r$1.behavior;
10768
- for (const { el: a, top: i, left: s } of r(e2, o(r$1))) {
10769
- const t2 = i - n2.top + n2.bottom, o2 = s - n2.left + n2.right;
10770
- a.scroll({ top: t2, left: o2, behavior: l2 });
10771
- }
10772
- }
10773
- let raf = (callback2) => setTimeout(callback2, 16);
10774
- let caf = (num) => clearTimeout(num);
10775
- if (typeof window !== "undefined" && "requestAnimationFrame" in window) {
10776
- raf = (callback2) => window.requestAnimationFrame(callback2);
10777
- caf = (handle) => window.cancelAnimationFrame(handle);
10778
- }
10779
- let rafUUID = 0;
10780
- const rafIds = /* @__PURE__ */ new Map();
10781
- function cleanup(id) {
10782
- rafIds.delete(id);
10783
- }
10784
- function wrapperRaf(callback2, times = 1) {
10785
- rafUUID += 1;
10786
- const id = rafUUID;
10787
- function callRef(leftTimes) {
10788
- if (leftTimes === 0) {
10789
- cleanup(id);
10790
- callback2();
10791
- } else {
10792
- const realId = raf(() => {
10793
- callRef(leftTimes - 1);
10794
- });
10795
- rafIds.set(id, realId);
10796
- }
10797
- }
10798
- callRef(times);
10799
- return id;
10469
+ const {
10470
+ urlList,
10471
+ initialIndex = 0,
10472
+ infinite = true,
10473
+ hideOnClickModal = false,
10474
+ teleported = false,
10475
+ zIndex = 2e3,
10476
+ show = true
10477
+ } = options;
10478
+ const propsData = {};
10479
+ const container = document.createElement("div");
10480
+ propsData.urlList = urlList;
10481
+ propsData.initialIndex = initialIndex;
10482
+ propsData.infinite = infinite;
10483
+ propsData.hideOnClickModal = hideOnClickModal;
10484
+ propsData.teleported = teleported;
10485
+ propsData.zIndex = zIndex;
10486
+ propsData.show = show;
10487
+ document.body.appendChild(container);
10488
+ instance = createVNode(_sfc_main$3, propsData);
10489
+ render(instance, container);
10800
10490
  }
10801
- wrapperRaf.cancel = (id) => {
10802
- const realId = rafIds.get(id);
10803
- cleanup(realId);
10804
- return caf(realId);
10805
- };
10806
- const sharpMatcherRegx = /#([\S ]+)$/;
10807
- const getDefaultContainer = () => {
10808
- return window;
10809
- };
10810
- const getOffsetTop = (element, container) => {
10811
- if (!element.getClientRects().length) {
10812
- return 0;
10813
- }
10814
- const ele = element.getBoundingClientRect();
10815
- if (ele.width || ele.height) {
10816
- if (container === window) {
10817
- container = element.ownerDocument.documentElement;
10818
- return ele.top - container.clientTop;
10819
- }
10820
- return ele.top - container.getBoundingClientRect().top;
10821
- }
10822
- return ele.top;
10823
- };
10824
- const isWindow = (obj) => {
10825
- return obj !== null && obj !== void 0 && obj === obj.window;
10826
- };
10827
- const getScroll = (target, top) => {
10828
- var _a2;
10829
- if (typeof window === "undefined") {
10830
- return 0;
10831
- }
10832
- const method = "scrollTop";
10833
- let result = 0;
10834
- if (isWindow(target)) {
10835
- result = target["scrollY"];
10836
- } else if (target instanceof Document) {
10837
- result = target.documentElement[method];
10838
- } else if (target instanceof HTMLElement) {
10839
- result = target[method];
10840
- } else if (target) {
10841
- result = target[method];
10842
- }
10843
- if (target && !isWindow(target) && typeof result !== "number") {
10844
- result = (_a2 = (target.ownerDocument ?? target).documentElement) == null ? void 0 : _a2[method];
10845
- }
10846
- return result;
10847
- };
10848
- const easeInOutCubic = (t2, b, c, d) => {
10849
- const cc = c - b;
10850
- t2 /= d / 2;
10851
- if (t2 < 1) {
10852
- return cc / 2 * t2 * t2 * t2 + b;
10853
- }
10854
- return cc / 2 * ((t2 -= 2) * t2 * t2 + 2) + b;
10855
- };
10856
- const scrollTo = (y, options = {}) => {
10857
- const { getContainer = () => window, callback: callback2, duration = 450 } = options;
10858
- const container = getContainer();
10859
- const scrollTop = getScroll(container);
10860
- const startTime = Date.now();
10861
- const frameFunc = () => {
10862
- const timestamp = Date.now();
10863
- const time = timestamp - startTime;
10864
- const nextScrollTop = easeInOutCubic(time > duration ? duration : time, scrollTop, y, duration);
10865
- if (isWindow(container)) {
10866
- container.scrollTo(window.scrollX, nextScrollTop);
10867
- } else if (container instanceof Document) {
10868
- container.documentElement.scrollTop = nextScrollTop;
10869
- } else {
10870
- container.scrollTop = nextScrollTop;
10871
- }
10872
- if (time < duration) {
10873
- wrapperRaf(frameFunc);
10874
- } else if (typeof callback2 === "function") {
10875
- callback2();
10491
+ const useMessage = () => {
10492
+ const { t: t2 } = useI18n("layout");
10493
+ const scssVariables = variables$1;
10494
+ return {
10495
+ // 消息提示
10496
+ info(content) {
10497
+ ElMessage.info(content);
10498
+ },
10499
+ // 错误消息
10500
+ error(content) {
10501
+ ElMessage.error(content);
10502
+ },
10503
+ // 成功消息
10504
+ success(content) {
10505
+ ElMessage.success(content);
10506
+ },
10507
+ // 警告消息
10508
+ warning(content) {
10509
+ ElMessage.warning(content);
10510
+ },
10511
+ // 弹出提示
10512
+ alert(content) {
10513
+ ElMessageBox.alert(content, t2("common.confirmTitle"));
10514
+ },
10515
+ // 错误提示
10516
+ alertError(content) {
10517
+ ElMessageBox.alert(content, t2("common.confirmTitle"), { type: "error" });
10518
+ },
10519
+ // 成功提示
10520
+ alertSuccess(content) {
10521
+ ElMessageBox.alert(content, t2("common.confirmTitle"), { type: "success" });
10522
+ },
10523
+ // 警告提示
10524
+ alertWarning(content) {
10525
+ ElMessageBox.alert(content, t2("common.confirmTitle"), { type: "warning" });
10526
+ },
10527
+ // 通知提示
10528
+ notify(content) {
10529
+ ElNotification.info(content);
10530
+ },
10531
+ // 错误通知
10532
+ notifyError(content) {
10533
+ ElNotification.error(content);
10534
+ },
10535
+ // 成功通知
10536
+ notifySuccess(content) {
10537
+ ElNotification.success(content);
10538
+ },
10539
+ // 警告通知
10540
+ notifyWarning(content) {
10541
+ ElNotification.warning(content);
10542
+ },
10543
+ // 确认窗体
10544
+ confirm(content, tip, options = {}) {
10545
+ return ElMessageBox.confirm(content, tip ? tip : t2("common.confirmTitle"), {
10546
+ ...options,
10547
+ customClass: `${options.customClass} ${scssVariables.namespace}-message-box`,
10548
+ confirmButtonText: options.confirmButtonText ?? t2("common.ok"),
10549
+ cancelButtonText: options.cancelButtonText ?? t2("common.cancel"),
10550
+ buttonSize: "default",
10551
+ center: true
10552
+ });
10553
+ },
10554
+ // 删除窗体
10555
+ delConfirm(content, tip) {
10556
+ return ElMessageBox.confirm(
10557
+ content ? content : t2("common.delMessage"),
10558
+ tip ? tip : t2("common.confirmTitle"),
10559
+ {
10560
+ customClass: `${scssVariables.namespace}-message-box`,
10561
+ confirmButtonText: t2("common.ok"),
10562
+ cancelButtonText: t2("common.cancel"),
10563
+ buttonSize: "default",
10564
+ center: true,
10565
+ type: "warning"
10566
+ }
10567
+ );
10568
+ },
10569
+ // 导出窗体
10570
+ exportConfirm(content, tip) {
10571
+ return ElMessageBox.confirm(
10572
+ content ? content : t2("common.exportMessage"),
10573
+ tip ? tip : t2("common.confirmTitle"),
10574
+ {
10575
+ confirmButtonText: t2("common.ok"),
10576
+ cancelButtonText: t2("common.cancel"),
10577
+ type: "warning"
10578
+ }
10579
+ );
10580
+ },
10581
+ // 提交内容
10582
+ prompt(content, tip, options = {}) {
10583
+ return ElMessageBox.prompt(content, tip, {
10584
+ confirmButtonText: t2("common.ok"),
10585
+ cancelButtonText: t2("common.cancel"),
10586
+ ...options
10587
+ });
10876
10588
  }
10877
10589
  };
10878
- wrapperRaf(frameFunc);
10879
10590
  };
10880
- const addEventListener = (target, eventType, cb, option) => {
10881
- if (target && target.addEventListener) {
10882
- target.addEventListener(eventType, cb, option);
10883
- }
10884
- return {
10885
- remove: () => {
10886
- if (target && target.removeEventListener) {
10887
- target.removeEventListener(eventType, cb);
10888
- }
10889
- }
10890
- };
10591
+ const _hoisted_1$2 = { class: "upload-box" };
10592
+ const _hoisted_2$2 = ["src"];
10593
+ const _hoisted_3$2 = { key: 0 };
10594
+ const _hoisted_4$2 = { key: 0 };
10595
+ const _hoisted_5$2 = {
10596
+ key: 1,
10597
+ class: "upload-empty"
10891
10598
  };
10892
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10893
- name: "AnchorLink",
10599
+ const _hoisted_6$1 = { class: "el-upload__tip" };
10600
+ const _sfc_main$2 = /* @__PURE__ */ Object.assign({ name: "UploadImg", inheritAttrs: false }, {
10601
+ __name: "UploadImg",
10894
10602
  props: {
10895
- prefixCls: String,
10896
- href: String,
10897
- title: String,
10898
- target: String,
10899
- customTitleProps: {
10900
- type: Object,
10901
- default: () => {
10902
- }
10603
+ modelValue: {
10604
+ type: String,
10605
+ default: ""
10606
+ },
10607
+ // 是否支持拖拽上传 ==> 非必传(默认为 true)
10608
+ drag: {
10609
+ type: Boolean,
10610
+ default: true
10611
+ },
10612
+ // 是否禁用上传组件 ==> 非必传(默认为 false)
10613
+ disabled: {
10614
+ type: Boolean,
10615
+ default: false
10616
+ },
10617
+ // 图片大小限制 ==> 非必传(默认为 5M)
10618
+ fileSize: {
10619
+ type: Number,
10620
+ default: 5
10621
+ },
10622
+ // 图片类型限制 ==> 非必传(默认为 ["image/jpeg", "image/png", "image/gif"])
10623
+ fileType: {
10624
+ type: Array,
10625
+ default: () => ["image/jpeg", "image/png", "image/gif"]
10626
+ },
10627
+ // 组件高度 ==> 非必传(默认为 150px)
10628
+ height: {
10629
+ type: String,
10630
+ default: "100px"
10631
+ },
10632
+ // 组件宽度 ==> 非必传(默认为 150px)
10633
+ width: {
10634
+ type: String,
10635
+ default: "100px"
10636
+ },
10637
+ // 组件边框圆角 ==> 非必传(默认为 8px)
10638
+ borderradius: {
10639
+ type: String,
10640
+ default: "4px"
10641
+ },
10642
+ // 是否显示删除按钮
10643
+ showDelete: {
10644
+ type: Boolean,
10645
+ default: true
10646
+ },
10647
+ // 是否显示按钮文字
10648
+ showBtnText: {
10649
+ type: Boolean,
10650
+ default: false
10651
+ },
10652
+ // 上传目录 ==> 非必传(默认为 undefined)
10653
+ directory: {
10654
+ type: String,
10655
+ default: void 0
10656
+ },
10657
+ // 自定义上传函数(必填)==> 必传
10658
+ customUpload: {
10659
+ type: Function,
10660
+ required: true
10661
+ },
10662
+ // 自定义从上传结果中提取 URL 的函数 ==> 非必传(默认为提取 res.data)
10663
+ getUploadUrl: {
10664
+ type: Function,
10665
+ default: (res) => res.data
10666
+ }
10667
+ },
10668
+ emits: ["update:modelValue"],
10669
+ setup(__props, { emit: __emit }) {
10670
+ useCssVars((_ctx) => ({
10671
+ "3d8ea9da": __props.width,
10672
+ "2c0dbd7a": __props.height,
10673
+ "00ef71d1": __props.borderradius
10674
+ }));
10675
+ const props = __props;
10676
+ const { t: t2 } = useI18n("layout");
10677
+ const message = useMessage();
10678
+ const uuid = ref("id-" + generateUUID());
10679
+ const imagePreview = (imgUrl) => {
10680
+ createImageViewer({
10681
+ zIndex: 9999999,
10682
+ urlList: [imgUrl]
10683
+ });
10684
+ };
10685
+ const emit = __emit;
10686
+ const deleteImg = () => {
10687
+ emit("update:modelValue", "");
10688
+ };
10689
+ const httpRequest = async (options) => {
10690
+ return await props.customUpload(options.file, {
10691
+ directory: props.directory
10692
+ });
10693
+ };
10694
+ const beforeUpload = (rawFile) => {
10695
+ const imgSize = rawFile.size / 1024 / 1024 < props.fileSize;
10696
+ const imgType = props.fileType;
10697
+ if (!imgType.includes(rawFile.type))
10698
+ message.notifyWarning("上传图片不符合所需的格式!");
10699
+ if (!imgSize)
10700
+ message.notifyWarning(`上传图片大小不能超过 ${props.fileSize}M!`);
10701
+ return imgType.includes(rawFile.type) && imgSize;
10702
+ };
10703
+ const uploadSuccess = (res) => {
10704
+ message.success("上传成功");
10705
+ const fileUrl = props.getUploadUrl(res);
10706
+ emit("update:modelValue", fileUrl);
10707
+ };
10708
+ const uploadError = () => {
10709
+ message.notifyError("图片上传失败,请您重新上传!");
10710
+ };
10711
+ return (_ctx, _cache) => {
10712
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
10713
+ createVNode(unref(ElUpload), {
10714
+ id: unref(uuid),
10715
+ accept: __props.fileType.join(","),
10716
+ "before-upload": beforeUpload,
10717
+ class: normalizeClass(["upload", __props.drag ? "no-border" : ""]),
10718
+ disabled: __props.disabled,
10719
+ drag: __props.drag,
10720
+ "http-request": httpRequest,
10721
+ multiple: false,
10722
+ "on-error": uploadError,
10723
+ "on-success": uploadSuccess,
10724
+ "show-file-list": false
10725
+ }, {
10726
+ default: withCtx(() => [
10727
+ __props.modelValue ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
10728
+ createElementVNode("img", {
10729
+ src: __props.modelValue,
10730
+ class: "upload-image"
10731
+ }, null, 8, _hoisted_2$2),
10732
+ createElementVNode("div", {
10733
+ class: "upload-handle",
10734
+ onClick: _cache[1] || (_cache[1] = withModifiers(() => {
10735
+ }, ["stop"]))
10736
+ }, [
10737
+ createElementVNode("div", {
10738
+ class: "handle-icon",
10739
+ onClick: _cache[0] || (_cache[0] = ($event) => imagePreview(__props.modelValue))
10740
+ }, [
10741
+ createVNode(unref(_sfc_main$v), { icon: "ant-design:zoom-in-outlined" }),
10742
+ __props.showBtnText ? (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString(unref(t2)("action.detail")), 1)) : createCommentVNode("", true)
10743
+ ]),
10744
+ __props.showDelete && !__props.disabled ? (openBlock(), createElementBlock("div", {
10745
+ key: 0,
10746
+ class: "handle-icon",
10747
+ onClick: deleteImg
10748
+ }, [
10749
+ createVNode(unref(_sfc_main$v), { icon: "ant-design:delete-outlined" }),
10750
+ __props.showBtnText ? (openBlock(), createElementBlock("span", _hoisted_4$2, toDisplayString(unref(t2)("action.del")), 1)) : createCommentVNode("", true)
10751
+ ])) : createCommentVNode("", true)
10752
+ ])
10753
+ ], 64)) : (openBlock(), createElementBlock("div", _hoisted_5$2, [
10754
+ renderSlot(_ctx.$slots, "empty", {}, () => [
10755
+ createVNode(unref(_sfc_main$v), {
10756
+ icon: "ep:plus",
10757
+ size: 20
10758
+ }),
10759
+ _cache[2] || (_cache[2] = createElementVNode("span", { class: "empty-text" }, "点击上传", -1))
10760
+ ], true)
10761
+ ]))
10762
+ ]),
10763
+ _: 3
10764
+ }, 8, ["id", "accept", "class", "disabled", "drag"]),
10765
+ createElementVNode("div", _hoisted_6$1, [
10766
+ renderSlot(_ctx.$slots, "tip", {}, void 0, true)
10767
+ ])
10768
+ ]);
10769
+ };
10770
+ }
10771
+ });
10772
+ const UploadImg = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-4a1df97a"]]);
10773
+ const _hoisted_1$1 = { class: "upload-box" };
10774
+ const _hoisted_2$1 = { class: "upload-empty" };
10775
+ const _hoisted_3$1 = ["src"];
10776
+ const _hoisted_4$1 = ["onClick"];
10777
+ const _hoisted_5$1 = { key: 0 };
10778
+ const _hoisted_6 = ["onClick"];
10779
+ const _hoisted_7 = { key: 0 };
10780
+ const _hoisted_8 = { class: "el-upload__tip" };
10781
+ const _sfc_main$1 = /* @__PURE__ */ Object.assign({ name: "UploadImgs", inheritAttrs: false }, {
10782
+ __name: "UploadImgs",
10783
+ props: {
10784
+ modelValue: {
10785
+ type: [String, Array],
10786
+ required: true
10787
+ },
10788
+ // 是否支持拖拽上传 ==> 非必传(默认为 true)
10789
+ drag: {
10790
+ type: Boolean,
10791
+ default: true
10792
+ },
10793
+ // 是否禁用上传组件 ==> 非必传(默认为 false)
10794
+ disabled: {
10795
+ type: Boolean,
10796
+ default: false
10797
+ },
10798
+ // 最大图片上传数 ==> 非必传(默认为 5张)
10799
+ limit: {
10800
+ type: Number,
10801
+ default: 5
10802
+ },
10803
+ // 图片大小限制 ==> 非必传(默认为 5M)
10804
+ fileSize: {
10805
+ type: Number,
10806
+ default: 5
10807
+ },
10808
+ // 图片类型限制 ==> 非必传(默认为 ["image/jpeg", "image/png", "image/gif"])
10809
+ fileType: {
10810
+ type: Array,
10811
+ default: () => ["image/jpeg", "image/png", "image/gif"]
10812
+ },
10813
+ // 组件高度 ==> 非必传(默认为 150px)
10814
+ height: {
10815
+ type: String,
10816
+ default: "100px"
10817
+ },
10818
+ // 组件宽度 ==> 非必传(默认为 150px)
10819
+ width: {
10820
+ type: String,
10821
+ default: "100px"
10822
+ },
10823
+ // 组件边框圆角 ==> 非必传(默认为 8px)
10824
+ borderradius: {
10825
+ type: String,
10826
+ default: "4px"
10827
+ },
10828
+ // 是否显示按钮文字
10829
+ showBtnText: {
10830
+ type: Boolean,
10831
+ default: false
10832
+ },
10833
+ // 上传目录 ==> 非必传(默认为 undefined)
10834
+ directory: {
10835
+ type: String,
10836
+ default: void 0
10837
+ },
10838
+ // 自定义上传函数(必填)==> 必传
10839
+ customUpload: {
10840
+ type: Function,
10841
+ required: true
10842
+ },
10843
+ // 自定义从上传结果中提取 URL 的函数 ==> 非必传(默认为提取 res.data)
10844
+ getUploadUrl: {
10845
+ type: Function,
10846
+ default: (res) => res.data
10903
10847
  }
10904
10848
  },
10905
- setup(props, {
10906
- slots,
10907
- attrs
10908
- }) {
10909
- let mergedTitle = null;
10910
- const {
10911
- handleClick: contextHandleClick,
10912
- scrollTo: scrollTo2,
10913
- unregisterLink,
10914
- registerLink,
10915
- activeLink
10916
- } = inject("useAnchor");
10917
- const handleClick = (e2) => {
10918
- const {
10919
- href
10920
- } = props;
10921
- contextHandleClick(e2, {
10922
- title: mergedTitle,
10923
- href
10849
+ emits: ["update:modelValue"],
10850
+ setup(__props, { emit: __emit }) {
10851
+ useCssVars((_ctx) => ({
10852
+ "1238a60c": __props.borderradius,
10853
+ "c60c1990": __props.width,
10854
+ "2f150c16": __props.height
10855
+ }));
10856
+ const message = useMessage();
10857
+ const imagePreview = (imgUrl) => {
10858
+ createImageViewer({
10859
+ zIndex: 9999999,
10860
+ urlList: [imgUrl]
10924
10861
  });
10925
- scrollTo2(href);
10926
10862
  };
10927
- watch(() => props.href, (val, oldVal) => {
10928
- nextTick(() => {
10929
- unregisterLink(oldVal);
10930
- registerLink(val);
10863
+ const props = __props;
10864
+ const httpRequest = async (options) => {
10865
+ return await props.customUpload(options.file, {
10866
+ directory: props.directory
10931
10867
  });
10932
- });
10933
- onMounted(() => {
10934
- registerLink(props.href);
10935
- });
10936
- onBeforeUnmount(() => {
10937
- unregisterLink(props.href);
10938
- });
10939
- return () => {
10940
- var _a2;
10941
- const {
10942
- prefixCls: prefixCls2,
10943
- href,
10944
- target,
10945
- title = slots.title,
10946
- customTitleProps = {}
10947
- } = props;
10948
- mergedTitle = typeof title === "function" ? title(customTitleProps) : title;
10949
- const active = activeLink.value === href;
10950
- const wrapperClassName = [`${prefixCls2}-link`, {
10951
- [`${prefixCls2}-link-active`]: active
10952
- }, attrs.class];
10953
- const titleClassName = [`${prefixCls2}-link-title`, {
10954
- [`${prefixCls2}-link-title-active`]: active
10955
- }];
10956
- return createVNode("div", mergeProps(attrs, {
10957
- "class": wrapperClassName
10958
- }), [createVNode("a", {
10959
- "class": titleClassName,
10960
- "href": href,
10961
- "title": typeof mergedTitle === "string" ? mergedTitle : "",
10962
- "target": target,
10963
- "onClick": handleClick
10964
- }, [slots.customTitle ? slots.customTitle(customTitleProps) : mergedTitle]), (_a2 = slots.default) == null ? void 0 : _a2.call(slots)]);
10868
+ };
10869
+ const fileList = ref([]);
10870
+ const uploadNumber = ref(0);
10871
+ const uploadList = ref([]);
10872
+ const beforeUpload = (rawFile) => {
10873
+ const imgSize = rawFile.size / 1024 / 1024 < props.fileSize;
10874
+ const imgType = props.fileType;
10875
+ if (!imgType.includes(rawFile.type))
10876
+ ElNotification({
10877
+ title: "温馨提示",
10878
+ message: "上传图片不符合所需的格式!",
10879
+ type: "warning"
10880
+ });
10881
+ if (!imgSize)
10882
+ ElNotification({
10883
+ title: "温馨提示",
10884
+ message: `上传图片大小不能超过 ${props.fileSize}M!`,
10885
+ type: "warning"
10886
+ });
10887
+ uploadNumber.value++;
10888
+ return imgType.includes(rawFile.type) && imgSize;
10889
+ };
10890
+ const emit = __emit;
10891
+ const uploadSuccess = (res) => {
10892
+ message.success("上传成功");
10893
+ const fileUrl = props.getUploadUrl(res);
10894
+ const index = fileList.value.findIndex((item) => {
10895
+ var _a2;
10896
+ return ((_a2 = item.response) == null ? void 0 : _a2.data) === fileUrl;
10897
+ });
10898
+ fileList.value.splice(index, 1);
10899
+ uploadList.value.push({ name: fileUrl, url: fileUrl });
10900
+ if (uploadList.value.length == uploadNumber.value) {
10901
+ fileList.value.push(...uploadList.value);
10902
+ uploadList.value = [];
10903
+ uploadNumber.value = 0;
10904
+ emitUpdateModelValue();
10905
+ }
10906
+ };
10907
+ watch(
10908
+ () => props.modelValue,
10909
+ (val) => {
10910
+ if (!val) {
10911
+ fileList.value = [];
10912
+ return;
10913
+ }
10914
+ fileList.value = [];
10915
+ fileList.value.push(
10916
+ ...val.map((url) => ({ name: url.substring(url.lastIndexOf("/") + 1), url }))
10917
+ );
10918
+ },
10919
+ { immediate: true, deep: true }
10920
+ );
10921
+ const emitUpdateModelValue = () => {
10922
+ let result = fileList.value.map((file) => file.url);
10923
+ emit("update:modelValue", result);
10924
+ };
10925
+ const handleRemove = (uploadFile) => {
10926
+ fileList.value = fileList.value.filter(
10927
+ (item) => item.url !== uploadFile.url || item.name !== uploadFile.name
10928
+ );
10929
+ emit(
10930
+ "update:modelValue",
10931
+ fileList.value.map((file) => file.url)
10932
+ );
10933
+ };
10934
+ const uploadError = () => {
10935
+ ElNotification({
10936
+ title: "温馨提示",
10937
+ message: "图片上传失败,请您重新上传!",
10938
+ type: "error"
10939
+ });
10940
+ };
10941
+ const handleExceed = () => {
10942
+ ElNotification({
10943
+ title: "温馨提示",
10944
+ message: `当前最多只能上传 ${props.limit} 张图片,请移除后上传!`,
10945
+ type: "warning"
10946
+ });
10947
+ };
10948
+ return (_ctx, _cache) => {
10949
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
10950
+ createVNode(unref(ElUpload), {
10951
+ "file-list": unref(fileList),
10952
+ "onUpdate:fileList": _cache[1] || (_cache[1] = ($event) => isRef(fileList) ? fileList.value = $event : null),
10953
+ accept: __props.fileType.join(","),
10954
+ "before-upload": beforeUpload,
10955
+ class: normalizeClass(["upload", __props.drag ? "no-border" : ""]),
10956
+ disabled: __props.disabled,
10957
+ drag: __props.drag,
10958
+ "http-request": httpRequest,
10959
+ limit: __props.limit,
10960
+ multiple: true,
10961
+ "on-error": uploadError,
10962
+ "on-exceed": handleExceed,
10963
+ "on-success": uploadSuccess,
10964
+ "list-type": "picture-card"
10965
+ }, {
10966
+ file: withCtx(({ file }) => [
10967
+ createElementVNode("img", {
10968
+ src: file.url,
10969
+ class: "upload-image"
10970
+ }, null, 8, _hoisted_3$1),
10971
+ createElementVNode("div", {
10972
+ class: "upload-handle",
10973
+ onClick: _cache[0] || (_cache[0] = withModifiers(() => {
10974
+ }, ["stop"]))
10975
+ }, [
10976
+ createElementVNode("div", {
10977
+ class: "handle-icon",
10978
+ onClick: ($event) => imagePreview(file.url)
10979
+ }, [
10980
+ createVNode(unref(_sfc_main$v), { icon: "ant-design:zoom-in-outlined" }),
10981
+ __props.showBtnText ? (openBlock(), createElementBlock("span", _hoisted_5$1, "查看")) : createCommentVNode("", true)
10982
+ ], 8, _hoisted_4$1),
10983
+ !__props.disabled ? (openBlock(), createElementBlock("div", {
10984
+ key: 0,
10985
+ class: "handle-icon",
10986
+ onClick: ($event) => handleRemove(file)
10987
+ }, [
10988
+ createVNode(unref(_sfc_main$v), { icon: "ant-design:delete-outlined" }),
10989
+ __props.showBtnText ? (openBlock(), createElementBlock("span", _hoisted_7, "删除")) : createCommentVNode("", true)
10990
+ ], 8, _hoisted_6)) : createCommentVNode("", true)
10991
+ ])
10992
+ ]),
10993
+ default: withCtx(() => [
10994
+ createElementVNode("div", _hoisted_2$1, [
10995
+ renderSlot(_ctx.$slots, "empty", {}, () => [
10996
+ createVNode(unref(_sfc_main$v), {
10997
+ icon: "ep:plus",
10998
+ size: 20
10999
+ }),
11000
+ _cache[2] || (_cache[2] = createElementVNode("span", { class: "empty-text" }, "点击上传", -1))
11001
+ ], true)
11002
+ ])
11003
+ ]),
11004
+ _: 3
11005
+ }, 8, ["file-list", "accept", "class", "disabled", "drag", "limit"]),
11006
+ createElementVNode("div", _hoisted_8, [
11007
+ renderSlot(_ctx.$slots, "tip", {}, void 0, true)
11008
+ ])
11009
+ ]);
10965
11010
  };
10966
11011
  }
10967
11012
  });
10968
- function _isSlot(s) {
10969
- return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
10970
- }
10971
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
10972
- name: "Anchor",
11013
+ const UploadImgs = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-92b67a34"]]);
11014
+ const _hoisted_1 = { class: "mt-10px line-height-20px color-[var(--el-upload-tip-color)] text-12px" };
11015
+ const _hoisted_2 = { class: "flex items-center" };
11016
+ const _hoisted_3 = { class: "ml-10px" };
11017
+ const _hoisted_4 = { class: "ml-10px" };
11018
+ const _hoisted_5 = { class: "ml-10px" };
11019
+ const _sfc_main = /* @__PURE__ */ Object.assign({ name: "UploadFile", inheritAttrs: false }, {
11020
+ __name: "UploadFile",
10973
11021
  props: {
10974
- offsetTop: Number,
10975
- bounds: Number,
10976
- affix: {
11022
+ modelValue: {
11023
+ type: [String, Array],
11024
+ required: true
11025
+ },
11026
+ // 文件类型, 例如['png', 'jpg', 'jpeg']
11027
+ fileType: {
11028
+ type: Array,
11029
+ default: () => ["doc", "xls", "ppt", "txt", "pdf"]
11030
+ },
11031
+ // 大小限制(MB)
11032
+ fileSize: {
11033
+ type: Number,
11034
+ default: 5
11035
+ },
11036
+ // 数量限制
11037
+ limit: {
11038
+ type: Number,
11039
+ default: 5
11040
+ },
11041
+ // 自动上传
11042
+ autoUpload: {
10977
11043
  type: Boolean,
10978
11044
  default: true
10979
11045
  },
10980
- showInkInFixed: {
11046
+ // 拖拽上传
11047
+ drag: {
10981
11048
  type: Boolean,
10982
11049
  default: false
10983
11050
  },
10984
- getContainer: Function,
10985
- wrapperClass: String,
10986
- wrapperStyle: {
10987
- type: Object,
10988
- default: void 0
11051
+ // 是否显示提示
11052
+ isShowTip: {
11053
+ type: Boolean,
11054
+ default: true
10989
11055
  },
10990
- // getCurrentAnchor: Function,
10991
- targetOffset: Number,
10992
- items: {
10993
- type: Array,
10994
- default: () => []
11056
+ // 是否禁用上传组件 ==> 非必传(默认为 false)
11057
+ disabled: {
11058
+ type: Boolean,
11059
+ default: false
10995
11060
  },
10996
- direction: {
11061
+ // 上传目录 ==> 非必传(默认为 undefined)
11062
+ directory: {
10997
11063
  type: String,
10998
- default: "vertical",
10999
- validator(value) {
11000
- return ["vertical", "horizontal"].includes(value);
11001
- }
11064
+ default: void 0
11065
+ },
11066
+ // 自定义上传函数(必填)==> 必传
11067
+ customUpload: {
11068
+ type: Function,
11069
+ required: true
11070
+ },
11071
+ // 自定义从上传结果中提取 URL 的函数 ==> 非必传(默认为提取 res.data)
11072
+ getUploadUrl: {
11073
+ type: Function,
11074
+ default: (res) => res.data
11002
11075
  }
11003
11076
  },
11004
- setup(props, {
11005
- attrs,
11006
- emit,
11007
- slots,
11008
- expose
11009
- }) {
11010
- const {
11011
- getPrefixCls: getPrefixCls2
11012
- } = useDesign();
11013
- const prefixCls2 = getPrefixCls2("anchor");
11014
- const anchorDirection = computed(() => props.direction ?? "vertical");
11015
- const spanLinkNode = ref(null);
11016
- const anchorRef = ref();
11017
- const state = reactive({
11018
- links: [],
11019
- scrollContainer: null,
11020
- scrollEvent: null,
11021
- animating: false
11022
- });
11023
- const activeLink = ref(null);
11024
- const getContainer = computed(() => {
11025
- const {
11026
- getContainer: getContainer2
11027
- } = props;
11028
- return getContainer2 || getDefaultContainer;
11029
- });
11030
- const getCurrentAnchor = (offsetTop = 0, bounds = 5) => {
11031
- const linkSections = [];
11032
- const container = getContainer.value();
11033
- state.links.forEach((link) => {
11034
- const sharpLinkMatch = sharpMatcherRegx.exec(link.toString());
11035
- if (!sharpLinkMatch) {
11036
- return;
11037
- }
11038
- const target = document.getElementById(sharpLinkMatch[1]);
11039
- if (target) {
11040
- const top = getOffsetTop(target, container);
11041
- if (top < offsetTop + bounds) {
11042
- linkSections.push({
11043
- link,
11044
- top
11045
- });
11046
- }
11047
- }
11077
+ emits: ["update:modelValue"],
11078
+ setup(__props, { emit: __emit }) {
11079
+ const message = useMessage();
11080
+ const emit = __emit;
11081
+ const props = __props;
11082
+ const uploadRef = ref();
11083
+ const uploadList = ref([]);
11084
+ const fileList = ref([]);
11085
+ const uploadNumber = ref(0);
11086
+ const httpRequest = async (options) => {
11087
+ return await props.customUpload(options.file, {
11088
+ directory: props.directory
11048
11089
  });
11049
- if (linkSections.length) {
11050
- const maxSection = linkSections.reduce((prev, curr) => curr.top > prev.top ? curr : prev);
11051
- return maxSection.link;
11052
- }
11053
- return "";
11054
- };
11055
- const setCurrentActiveLink = (link) => {
11056
- const {
11057
- getCurrentAnchor: getCurrentAnchor2
11058
- } = props;
11059
- if (activeLink.value === link) {
11060
- return;
11061
- }
11062
- activeLink.value = typeof getCurrentAnchor2 === "function" ? getCurrentAnchor2(link) : link;
11063
- emit("change", link);
11064
11090
  };
11065
- const handleScrollTo = (link) => {
11066
- const {
11067
- offsetTop,
11068
- targetOffset
11069
- } = props;
11070
- setCurrentActiveLink(link);
11071
- const sharpLinkMatch = sharpMatcherRegx.exec(link);
11072
- if (!sharpLinkMatch) {
11073
- return;
11091
+ const beforeUpload = (file) => {
11092
+ if (fileList.value.length >= props.limit) {
11093
+ message.error(`上传文件数量不能超过${props.limit}个!`);
11094
+ return false;
11074
11095
  }
11075
- const targetElement = document.getElementById(sharpLinkMatch[1]);
11076
- if (!targetElement) {
11077
- return;
11096
+ let fileExtension = "";
11097
+ if (file.name.lastIndexOf(".") > -1) {
11098
+ fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
11078
11099
  }
11079
- const container = getContainer.value();
11080
- const scrollTop = getScroll(container);
11081
- const eleOffsetTop = getOffsetTop(targetElement, container);
11082
- let y = scrollTop + eleOffsetTop;
11083
- y -= targetOffset !== void 0 ? targetOffset : offsetTop || 0;
11084
- state.animating = true;
11085
- scrollTo(y, {
11086
- callback: () => {
11087
- state.animating = false;
11088
- },
11089
- getContainer: getContainer.value
11100
+ const isImg = props.fileType.some((type) => {
11101
+ if (file.type.indexOf(type) > -1)
11102
+ return true;
11103
+ return !!(fileExtension && fileExtension.indexOf(type) > -1);
11090
11104
  });
11105
+ const isLimit = file.size < props.fileSize * 1024 * 1024;
11106
+ if (!isImg) {
11107
+ message.error(`文件格式不正确, 请上传${props.fileType.join("、")}格式!`);
11108
+ return false;
11109
+ }
11110
+ if (!isLimit) {
11111
+ message.error(`上传文件大小不能超过${props.fileSize}MB!`);
11112
+ return false;
11113
+ }
11114
+ message.success("正在上传文件,请稍候...");
11115
+ uploadNumber.value++;
11091
11116
  };
11092
- expose({
11093
- scrollTo: handleScrollTo
11094
- });
11095
- const handleScroll = () => {
11096
- if (state.animating) {
11097
- return;
11117
+ const handleFileSuccess = (res) => {
11118
+ message.success("上传成功");
11119
+ const fileUrl = props.getUploadUrl(res);
11120
+ const index = fileList.value.findIndex((item) => {
11121
+ var _a2;
11122
+ return ((_a2 = item.response) == null ? void 0 : _a2.data) === fileUrl;
11123
+ });
11124
+ fileList.value.splice(index, 1);
11125
+ uploadList.value.push({ name: fileUrl, url: fileUrl });
11126
+ if (uploadList.value.length == uploadNumber.value) {
11127
+ fileList.value.push(...uploadList.value);
11128
+ uploadList.value = [];
11129
+ uploadNumber.value = 0;
11130
+ emitUpdateModelValue();
11098
11131
  }
11099
- const {
11100
- offsetTop,
11101
- bounds,
11102
- targetOffset
11103
- } = props;
11104
- const currentActiveLink = getCurrentAnchor(targetOffset !== void 0 ? targetOffset : offsetTop || 0, bounds);
11105
- setCurrentActiveLink(currentActiveLink);
11106
11132
  };
11107
- const updateInk = () => {
11108
- const linkNode = anchorRef.value.querySelector(`.${prefixCls2}-link-title-active`);
11109
- if (linkNode && spanLinkNode.value) {
11110
- const horizontalAnchor = anchorDirection.value === "horizontal";
11111
- spanLinkNode.value.style.top = horizontalAnchor ? "" : `${linkNode.offsetTop + linkNode.clientHeight / 2}px`;
11112
- spanLinkNode.value.style.height = horizontalAnchor ? "" : `${linkNode.clientHeight}px`;
11113
- spanLinkNode.value.style.left = horizontalAnchor ? `${linkNode.offsetLeft}px` : "";
11114
- spanLinkNode.value.style.width = horizontalAnchor ? `${linkNode.clientWidth}px` : "";
11115
- if (horizontalAnchor) {
11116
- e(linkNode, {
11117
- scrollMode: "if-needed",
11118
- block: "nearest"
11119
- });
11120
- }
11133
+ const handleExceed = () => {
11134
+ message.error(`上传文件数量不能超过${props.limit}个!`);
11135
+ };
11136
+ const excelUploadError = () => {
11137
+ message.error("导入数据失败,请您重新上传!");
11138
+ };
11139
+ const handleRemove = (file) => {
11140
+ const index = fileList.value.map((f) => f.name).indexOf(file.name);
11141
+ if (index > -1) {
11142
+ fileList.value.splice(index, 1);
11143
+ emitUpdateModelValue();
11121
11144
  }
11122
11145
  };
11123
- provide("useAnchor", {
11124
- registerLink: (link) => {
11125
- if (!state.links.includes(link)) {
11126
- state.links.push(link);
11146
+ const handlePreview = (uploadFile) => {
11147
+ console.log(uploadFile);
11148
+ };
11149
+ watch(
11150
+ () => props.modelValue,
11151
+ (val) => {
11152
+ if (!val) {
11153
+ fileList.value = [];
11154
+ return;
11127
11155
  }
11128
- },
11129
- unregisterLink: (link) => {
11130
- const index = state.links.indexOf(link);
11131
- if (index !== -1) {
11132
- state.links.splice(index, 1);
11156
+ fileList.value = [];
11157
+ if (isString(val)) {
11158
+ fileList.value.push(
11159
+ ...val.split(",").map((url) => ({ name: url.substring(url.lastIndexOf("/") + 1), url }))
11160
+ );
11161
+ return;
11133
11162
  }
11163
+ fileList.value.push(
11164
+ ...val.map((url) => ({ name: url.substring(url.lastIndexOf("/") + 1), url }))
11165
+ );
11134
11166
  },
11135
- activeLink,
11136
- scrollTo: handleScrollTo,
11137
- handleClick: (e2, info) => {
11138
- emit("click", e2, info);
11139
- },
11140
- direction: anchorDirection
11141
- });
11142
- onMounted(() => {
11143
- nextTick(() => {
11144
- const container = getContainer.value();
11145
- state.scrollContainer = container;
11146
- state.scrollEvent = addEventListener(state.scrollContainer, "scroll", handleScroll);
11147
- handleScroll();
11148
- });
11149
- });
11150
- onBeforeUnmount(() => {
11151
- if (state.scrollEvent) {
11152
- state.scrollEvent.remove();
11153
- }
11154
- });
11155
- onUpdated(() => {
11156
- if (state.scrollEvent) {
11157
- const currentContainer = getContainer.value();
11158
- if (state.scrollContainer !== currentContainer) {
11159
- state.scrollContainer = currentContainer;
11160
- state.scrollEvent.remove();
11161
- state.scrollEvent = addEventListener(state.scrollContainer, "scroll", handleScroll);
11162
- handleScroll();
11163
- }
11167
+ { immediate: true, deep: true }
11168
+ );
11169
+ const emitUpdateModelValue = () => {
11170
+ let result = fileList.value.map((file) => file.url);
11171
+ if (props.limit === 1 || isString(props.modelValue)) {
11172
+ result = result.join(",");
11164
11173
  }
11165
- updateInk();
11166
- });
11167
- const createNestedLink = (options) => Array.isArray(options) ? options.map((option) => {
11168
- const {
11169
- children,
11170
- key,
11171
- href,
11172
- target,
11173
- class: cls,
11174
- style,
11175
- title
11176
- } = option;
11177
- return createVNode(_sfc_main$2, {
11178
- "key": key,
11179
- "href": href,
11180
- "target": target,
11181
- "class": cls,
11182
- "style": style,
11183
- "title": title,
11184
- "prefixCls": prefixCls2,
11185
- "customTitleProps": option
11186
- }, {
11187
- default: () => [anchorDirection.value === "vertical" ? createNestedLink(children) : null],
11188
- customTitle: slots.customTitle
11189
- });
11190
- }) : null;
11191
- return () => {
11192
- var _a2;
11193
- const {
11194
- offsetTop,
11195
- affix,
11196
- showInkInFixed
11197
- } = props;
11198
- const inkClass = [`${prefixCls2}-ink`, {
11199
- [`${prefixCls2}-ink-visible`]: activeLink.value
11200
- }];
11201
- const wrapperClass = [props.wrapperClass, `${prefixCls2}-wrapper`, {
11202
- [`${prefixCls2}-wrapper-horizontal`]: anchorDirection.value === "horizontal"
11203
- }];
11204
- const anchorClass = [prefixCls2, {
11205
- [`${prefixCls2}-fixed`]: !affix && !showInkInFixed
11206
- }];
11207
- const wrapperStyle = {
11208
- maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : "100vh",
11209
- ...props.wrapperStyle
11210
- };
11211
- const anchorContent = createVNode("div", {
11212
- "class": wrapperClass,
11213
- "style": wrapperStyle,
11214
- "ref": anchorRef
11215
- }, [createVNode("div", {
11216
- "class": anchorClass
11217
- }, [createVNode("span", {
11218
- "class": inkClass,
11219
- "ref": spanLinkNode
11220
- }, null), Array.isArray(props.items) ? createNestedLink(props.items) : (_a2 = slots.default) == null ? void 0 : _a2.call(slots)])]);
11221
- return !affix ? anchorContent : createVNode(ElAffix, mergeProps(attrs, {
11222
- "offset": offsetTop
11223
- }), _isSlot(anchorContent) ? anchorContent : {
11224
- default: () => [anchorContent]
11225
- });
11174
+ emit("update:modelValue", result);
11226
11175
  };
11227
- }
11228
- });
11229
- const _hoisted_1 = { class: "com-steps" };
11230
- const _hoisted_2 = { class: "steps-item-container" };
11231
- const _hoisted_3 = { class: "steps-item-icon" };
11232
- const _hoisted_4 = { class: "steps-icon" };
11233
- const _hoisted_5 = { class: "steps-item-content" };
11234
- const _hoisted_6 = { class: "steps-item-title" };
11235
- const _sfc_main = /* @__PURE__ */ Object.assign({ name: "Steps" }, {
11236
- __name: "Steps",
11237
- props: {
11238
- // 设置当前激活步骤
11239
- active: {
11240
- type: Number,
11241
- default: 0
11242
- },
11243
- // 配置选项卡内容
11244
- items: {
11245
- type: Array,
11246
- default: () => []
11247
- }
11248
- },
11249
- setup(__props) {
11250
11176
  return (_ctx, _cache) => {
11251
- return openBlock(), createElementBlock("div", _hoisted_1, [
11252
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
11253
- return openBlock(), createElementBlock("div", {
11254
- key: index,
11255
- class: normalizeClass(["steps-item", {
11256
- "steps-item-finish": __props.active > index,
11257
- "steps-item-process": __props.active == index,
11258
- "steps-item-wait": __props.active < index
11259
- }])
11260
- }, [
11177
+ return openBlock(), createElementBlock("div", {
11178
+ class: normalizeClass(["upload-file", _ctx.$attrs.class])
11179
+ }, [
11180
+ !__props.disabled ? (openBlock(), createBlock(unref(ElUpload), {
11181
+ key: 0,
11182
+ ref_key: "uploadRef",
11183
+ ref: uploadRef,
11184
+ "file-list": unref(fileList),
11185
+ "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => isRef(fileList) ? fileList.value = $event : null),
11186
+ "auto-upload": __props.autoUpload,
11187
+ "before-upload": beforeUpload,
11188
+ disabled: __props.disabled,
11189
+ drag: __props.drag,
11190
+ "http-request": httpRequest,
11191
+ limit: props.limit,
11192
+ multiple: props.limit > 1,
11193
+ "on-error": excelUploadError,
11194
+ "on-exceed": handleExceed,
11195
+ "on-preview": handlePreview,
11196
+ "on-remove": handleRemove,
11197
+ "on-success": handleFileSuccess,
11198
+ "show-file-list": true,
11199
+ class: "upload-file-uploader",
11200
+ name: "file"
11201
+ }, createSlots({
11202
+ file: withCtx((row) => [
11261
11203
  createElementVNode("div", _hoisted_2, [
11204
+ createElementVNode("span", null, toDisplayString(row.file.name), 1),
11262
11205
  createElementVNode("div", _hoisted_3, [
11263
- createElementVNode("div", _hoisted_4, [
11264
- __props.active > index ? (openBlock(), createBlock(unref(_sfc_main$v), {
11265
- key: 0,
11266
- icon: "ant-design:check-outlined",
11267
- color: "#fff"
11268
- })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
11269
- createTextVNode(toDisplayString(index + 1), 1)
11270
- ], 64))
11271
- ])
11206
+ createVNode(unref(ElLink), {
11207
+ href: row.file.url,
11208
+ underline: "never",
11209
+ download: "",
11210
+ target: "_blank",
11211
+ type: "primary"
11212
+ }, {
11213
+ default: withCtx(() => _cache[2] || (_cache[2] = [
11214
+ createTextVNode(" 下载 ", -1)
11215
+ ])),
11216
+ _: 2,
11217
+ __: [2]
11218
+ }, 1032, ["href"])
11272
11219
  ]),
11273
- createElementVNode("div", _hoisted_5, [
11274
- createElementVNode("div", _hoisted_6, toDisplayString(item.title), 1)
11220
+ createElementVNode("div", _hoisted_4, [
11221
+ createVNode(unref(ElLink), {
11222
+ type: "danger",
11223
+ onClick: ($event) => handleRemove(row.file)
11224
+ }, {
11225
+ default: withCtx(() => _cache[3] || (_cache[3] = [
11226
+ createTextVNode(" 删除", -1)
11227
+ ])),
11228
+ _: 2,
11229
+ __: [3]
11230
+ }, 1032, ["onClick"])
11275
11231
  ])
11276
11232
  ])
11277
- ], 2);
11233
+ ]),
11234
+ default: withCtx(() => [
11235
+ createVNode(unref(ElButton), { type: "primary" }, {
11236
+ default: withCtx(() => [
11237
+ createVNode(unref(_sfc_main$v), { icon: "ant-design:upload-outlined" }),
11238
+ _cache[1] || (_cache[1] = createTextVNode(" 选取文件 ", -1))
11239
+ ]),
11240
+ _: 1,
11241
+ __: [1]
11242
+ })
11243
+ ]),
11244
+ _: 2
11245
+ }, [
11246
+ __props.isShowTip ? {
11247
+ name: "tip",
11248
+ fn: withCtx(() => [
11249
+ createElementVNode("div", _hoisted_1, [
11250
+ createElementVNode("span", null, "格式为:" + toDisplayString(__props.fileType.join("、")) + ",", 1),
11251
+ createElementVNode("span", null, "大小不超过" + toDisplayString(__props.fileSize) + "MB。", 1)
11252
+ ])
11253
+ ]),
11254
+ key: "0"
11255
+ } : void 0
11256
+ ]), 1032, ["file-list", "auto-upload", "disabled", "drag", "limit", "multiple"])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(fileList), (file, index) => {
11257
+ return openBlock(), createElementBlock("div", {
11258
+ key: index,
11259
+ class: "flex items-center file-list-item"
11260
+ }, [
11261
+ createElementVNode("span", null, toDisplayString(file.name), 1),
11262
+ createElementVNode("div", _hoisted_5, [
11263
+ createVNode(unref(ElLink), {
11264
+ href: file.url,
11265
+ underline: "never",
11266
+ download: "",
11267
+ target: "_blank",
11268
+ type: "primary"
11269
+ }, {
11270
+ default: withCtx(() => _cache[4] || (_cache[4] = [
11271
+ createTextVNode(" 下载 ", -1)
11272
+ ])),
11273
+ _: 2,
11274
+ __: [4]
11275
+ }, 1032, ["href"])
11276
+ ])
11277
+ ]);
11278
11278
  }), 128))
11279
- ]);
11279
+ ], 2);
11280
11280
  };
11281
11281
  }
11282
11282
  });
11283
- const Steps = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-eb3cf40f"]]);
11283
+ const UploadFile = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f625d304"]]);
11284
11284
  function useLayout() {
11285
11285
  const collapsed = ref(false);
11286
11286
  const toggleCollapsed = () => {
@@ -11291,121 +11291,235 @@ function useLayout() {
11291
11291
  toggleCollapsed
11292
11292
  };
11293
11293
  }
11294
+ const install = (app) => {
11295
+ app.component("BmpLayout", BmpLayout);
11296
+ app.component("BmpConfigGlobal", _sfc_main$d);
11297
+ app.component("BmpPageCard", PageCard);
11298
+ app.component("BmpPageNavBar", PageNavBar);
11299
+ app.component("BmpIcon", _sfc_main$v);
11300
+ app.component("BmpBadge", _sfc_main$a);
11301
+ app.component("BmpPagination", _sfc_main$9);
11302
+ app.component("BmpDialog", _sfc_main$8);
11303
+ app.component("BmpAlert", _sfc_main$7);
11304
+ app.component("BmpAnchor", _sfc_main$5);
11305
+ app.component("BmpSteps", Steps);
11306
+ app.component("BmpBacktop", _sfc_main$w);
11307
+ app.component("BmpUploadImg", UploadImg);
11308
+ app.component("BmpUploadImgs", UploadImgs);
11309
+ app.component("BmpUploadFile", UploadFile);
11310
+ app.component("BmpAffix", ElAffix);
11311
+ app.component("BmpAutocomplete", ElAutocomplete);
11312
+ app.component("BmpAvatar", ElAvatar);
11313
+ app.component("BmpBreadcrumb", ElBreadcrumb);
11314
+ app.component("BmpBreadcrumbItem", ElBreadcrumbItem);
11315
+ app.component("BmpButton", ElButton);
11316
+ app.component("BmpButtonGroup", ElButtonGroup);
11317
+ app.component("BmpCard", ElCard);
11318
+ app.component("BmpCarousel", ElCarousel);
11319
+ app.component("BmpCarouselItem", ElCarouselItem);
11320
+ app.component("BmpCollapse", ElCollapse);
11321
+ app.component("BmpCollapseItem", ElCollapseItem);
11322
+ app.component("BmpCollapseTransition", ElCollapseTransition);
11323
+ app.component("BmpDivider", ElDivider);
11324
+ app.component("BmpDrawer", ElDrawer);
11325
+ app.component("BmpEmpty", ElEmpty);
11326
+ app.component("BmpLink", ElLink);
11327
+ app.component("BmpOverlay", ElOverlay);
11328
+ app.component("BmpPageHeader", ElPageHeader);
11329
+ app.component("BmpProgress", ElProgress);
11330
+ app.component("BmpResult", ElResult);
11331
+ app.component("BmpScrollbar", ElScrollbar);
11332
+ app.component("BmpSkeleton", ElSkeleton);
11333
+ app.component("BmpSkeletonItem", ElSkeletonItem);
11334
+ app.component("BmpSpace", ElSpace);
11335
+ app.component("BmpTag", ElTag);
11336
+ app.component("BmpText", ElText);
11337
+ app.component("BmpCascader", ElCascader);
11338
+ app.component("BmpCascaderPanel", ElCascaderPanel);
11339
+ app.component("BmpCheckbox", ElCheckbox);
11340
+ app.component("BmpCheckboxButton", ElCheckboxButton);
11341
+ app.component("BmpCheckboxGroup", ElCheckboxGroup);
11342
+ app.component("BmpColorPicker", ElColorPicker);
11343
+ app.component("BmpDatePicker", ElDatePicker);
11344
+ app.component("BmpForm", ElForm);
11345
+ app.component("BmpFormItem", ElFormItem);
11346
+ app.component("BmpInput", ElInput);
11347
+ app.component("BmpInputNumber", ElInputNumber);
11348
+ app.component("BmpInputTag", ElInputTag);
11349
+ app.component("BmpRadio", ElRadio);
11350
+ app.component("BmpRadioButton", ElRadioButton);
11351
+ app.component("BmpRadioGroup", ElRadioGroup);
11352
+ app.component("BmpRate", ElRate);
11353
+ app.component("BmpSelect", ElSelect);
11354
+ app.component("BmpOption", ElOption);
11355
+ app.component("BmpOptionGroup", ElOptionGroup);
11356
+ app.component("BmpSelectV2", ElSelectV2);
11357
+ app.component("BmpSlider", ElSlider);
11358
+ app.component("BmpSwitch", ElSwitch);
11359
+ app.component("BmpTimePicker", ElTimePicker);
11360
+ app.component("BmpTimeSelect", ElTimeSelect);
11361
+ app.component("BmpTransfer", ElTransfer);
11362
+ app.component("BmpTreeSelect", ElTreeSelect);
11363
+ app.component("BmpMention", ElMention);
11364
+ app.component("BmpCalendar", ElCalendar);
11365
+ app.component("BmpCheckTag", ElCheckTag);
11366
+ app.component("BmpCountdown", ElCountdown);
11367
+ app.component("BmpDescriptions", ElDescriptions);
11368
+ app.component("BmpDescriptionsItem", ElDescriptionsItem);
11369
+ app.component("BmpImage", ElImage);
11370
+ app.component("BmpImageViewer", ElImageViewer);
11371
+ app.component("BmpStatistic", ElStatistic);
11372
+ app.component("BmpTable", ElTable);
11373
+ app.component("BmpTableColumn", ElTableColumn);
11374
+ app.component("BmpTimeline", ElTimeline);
11375
+ app.component("BmpTimelineItem", ElTimelineItem);
11376
+ app.component("BmpTree", ElTree);
11377
+ app.component("BmpTreeV2", ElTreeV2);
11378
+ app.component("BmpDropdown", ElDropdown);
11379
+ app.component("BmpDropdownItem", ElDropdownItem);
11380
+ app.component("BmpDropdownMenu", ElDropdownMenu);
11381
+ app.component("BmpMenu", ElMenu);
11382
+ app.component("BmpMenuItem", ElMenuItem);
11383
+ app.component("BmpMenuItemGroup", ElMenuItemGroup);
11384
+ app.component("BmpSubMenu", ElSubMenu);
11385
+ app.component("BmpTabs", ElTabs);
11386
+ app.component("BmpTabPane", ElTabPane);
11387
+ app.component("BmpPopover", ElPopover);
11388
+ app.component("BmpPopconfirm", ElPopconfirm);
11389
+ app.component("BmpTooltip", ElTooltip);
11390
+ app.component("BmpContainer", ElContainer);
11391
+ app.component("BmpAside", ElAside);
11392
+ app.component("BmpFooter", ElFooter);
11393
+ app.component("BmpHeader", ElHeader);
11394
+ app.component("BmpMain", ElMain);
11395
+ app.component("BmpRow", ElRow);
11396
+ app.component("BmpCol", ElCol);
11397
+ app.component("BmpSplitter", ElSplitter);
11398
+ app.component("BmpSplitterPanel", ElSplitterPanel);
11399
+ app.component("BmpConfigProvider", ElConfigProvider);
11400
+ app.component("BmpSegmented", ElSegmented);
11401
+ app.component("BmpTour", ElTour);
11402
+ app.component("BmpTourStep", ElTourStep);
11403
+ app.component("BmpUpload", ElUpload);
11404
+ app.component("BmpWatermark", ElWatermark);
11405
+ app.component("BmpPopper", ElPopper);
11406
+ };
11407
+ BmpLayout.install = install;
11294
11408
  export {
11295
11409
  ElAffix2 as BmpAffix,
11296
- _sfc_main$3 as BmpAlert,
11297
- _sfc_main$1 as BmpAnchor,
11298
- ElAside as BmpAside,
11299
- ElAutocomplete as BmpAutocomplete,
11410
+ _sfc_main$7 as BmpAlert,
11411
+ _sfc_main$5 as BmpAnchor,
11412
+ ElAside2 as BmpAside,
11413
+ ElAutocomplete2 as BmpAutocomplete,
11300
11414
  ElAvatar2 as BmpAvatar,
11301
11415
  _sfc_main$w as BmpBacktop,
11302
- _sfc_main$6 as BmpBadge,
11416
+ _sfc_main$a as BmpBadge,
11303
11417
  ElBreadcrumb2 as BmpBreadcrumb,
11304
11418
  ElBreadcrumbItem2 as BmpBreadcrumbItem,
11305
11419
  ElButton2 as BmpButton,
11306
- ElButtonGroup as BmpButtonGroup,
11307
- ElCalendar as BmpCalendar,
11420
+ ElButtonGroup2 as BmpButtonGroup,
11421
+ ElCalendar2 as BmpCalendar,
11308
11422
  ElCard2 as BmpCard,
11309
- ElCarousel as BmpCarousel,
11310
- ElCarouselItem as BmpCarouselItem,
11311
- ElCascader as BmpCascader,
11312
- ElCascaderPanel as BmpCascaderPanel,
11313
- ElCheckTag as BmpCheckTag,
11314
- ElCheckbox as BmpCheckbox,
11315
- ElCheckboxButton as BmpCheckboxButton,
11316
- ElCheckboxGroup as BmpCheckboxGroup,
11317
- ElCol as BmpCol,
11318
- ElCollapse as BmpCollapse,
11319
- ElCollapseItem as BmpCollapseItem,
11320
- ElCollapseTransition as BmpCollapseTransition,
11321
- ElColorPicker as BmpColorPicker,
11423
+ ElCarousel2 as BmpCarousel,
11424
+ ElCarouselItem2 as BmpCarouselItem,
11425
+ ElCascader2 as BmpCascader,
11426
+ ElCascaderPanel2 as BmpCascaderPanel,
11427
+ ElCheckTag2 as BmpCheckTag,
11428
+ ElCheckbox2 as BmpCheckbox,
11429
+ ElCheckboxButton2 as BmpCheckboxButton,
11430
+ ElCheckboxGroup2 as BmpCheckboxGroup,
11431
+ ElCol2 as BmpCol,
11432
+ ElCollapse2 as BmpCollapse,
11433
+ ElCollapseItem2 as BmpCollapseItem,
11434
+ ElCollapseTransition2 as BmpCollapseTransition,
11435
+ ElColorPicker2 as BmpColorPicker,
11322
11436
  _sfc_main$d as BmpConfigGlobal,
11323
11437
  ElConfigProvider2 as BmpConfigProvider,
11324
- ElContainer as BmpContainer,
11325
- ElCountdown as BmpCountdown,
11438
+ ElContainer2 as BmpContainer,
11439
+ ElCountdown2 as BmpCountdown,
11326
11440
  createImageViewer as BmpCreateImageViewer,
11327
- ElDatePicker as BmpDatePicker,
11328
- ElDescriptions as BmpDescriptions,
11329
- ElDescriptionsItem as BmpDescriptionsItem,
11330
- _sfc_main$4 as BmpDialog,
11331
- ElDivider as BmpDivider,
11441
+ ElDatePicker2 as BmpDatePicker,
11442
+ ElDescriptions2 as BmpDescriptions,
11443
+ ElDescriptionsItem2 as BmpDescriptionsItem,
11444
+ _sfc_main$8 as BmpDialog,
11445
+ ElDivider2 as BmpDivider,
11332
11446
  ElDrawer2 as BmpDrawer,
11333
11447
  ElDropdown2 as BmpDropdown,
11334
11448
  ElDropdownItem2 as BmpDropdownItem,
11335
11449
  ElDropdownMenu2 as BmpDropdownMenu,
11336
- ElEmpty as BmpEmpty,
11337
- ElFooter as BmpFooter,
11338
- ElForm as BmpForm,
11339
- ElFormItem as BmpFormItem,
11340
- ElHeader as BmpHeader,
11450
+ ElEmpty2 as BmpEmpty,
11451
+ ElFooter2 as BmpFooter,
11452
+ ElForm2 as BmpForm,
11453
+ ElFormItem2 as BmpFormItem,
11454
+ ElHeader2 as BmpHeader,
11341
11455
  _sfc_main$v as BmpIcon,
11342
- ElImage as BmpImage,
11456
+ ElImage2 as BmpImage,
11343
11457
  ElImageViewer2 as BmpImageViewer,
11344
11458
  ElInfiniteScroll as BmpInfiniteScroll,
11345
11459
  ElInput2 as BmpInput,
11346
- ElInputNumber as BmpInputNumber,
11347
- ElInputTag as BmpInputTag,
11460
+ ElInputNumber2 as BmpInputNumber,
11461
+ ElInputTag2 as BmpInputTag,
11348
11462
  BmpLayout,
11349
11463
  ElLink2 as BmpLink,
11350
11464
  ElLoading as BmpLoading,
11351
- ElMain as BmpMain,
11352
- ElMention as BmpMention,
11465
+ ElMain2 as BmpMain,
11466
+ ElMention2 as BmpMention,
11353
11467
  ElMenu2 as BmpMenu,
11354
11468
  ElMenuItem2 as BmpMenuItem,
11355
- ElMenuItemGroup as BmpMenuItemGroup,
11469
+ ElMenuItemGroup2 as BmpMenuItemGroup,
11356
11470
  ElMessage2 as BmpMessage,
11357
11471
  ElMessageBox2 as BmpMessageBox,
11358
11472
  ElNotification2 as BmpNotification,
11359
- ElOption as BmpOption,
11360
- ElOptionGroup as BmpOptionGroup,
11361
- ElOverlay as BmpOverlay,
11473
+ ElOption2 as BmpOption,
11474
+ ElOptionGroup2 as BmpOptionGroup,
11475
+ ElOverlay2 as BmpOverlay,
11362
11476
  PageCard as BmpPageCard,
11363
- ElPageHeader as BmpPageHeader,
11477
+ ElPageHeader2 as BmpPageHeader,
11364
11478
  PageNavBar as BmpPageNavBar,
11365
- _sfc_main$5 as BmpPagination,
11366
- ElPopconfirm as BmpPopconfirm,
11367
- ElPopover as BmpPopover,
11368
- ElPopper as BmpPopper,
11369
- ElProgress as BmpProgress,
11370
- ElRadio as BmpRadio,
11371
- ElRadioButton as BmpRadioButton,
11372
- ElRadioGroup as BmpRadioGroup,
11373
- ElRate as BmpRate,
11374
- ElResult as BmpResult,
11375
- ElRow as BmpRow,
11479
+ _sfc_main$9 as BmpPagination,
11480
+ ElPopconfirm2 as BmpPopconfirm,
11481
+ ElPopover2 as BmpPopover,
11482
+ ElPopper2 as BmpPopper,
11483
+ ElProgress2 as BmpProgress,
11484
+ ElRadio2 as BmpRadio,
11485
+ ElRadioButton2 as BmpRadioButton,
11486
+ ElRadioGroup2 as BmpRadioGroup,
11487
+ ElRate2 as BmpRate,
11488
+ ElResult2 as BmpResult,
11489
+ ElRow2 as BmpRow,
11376
11490
  ElScrollbar2 as BmpScrollbar,
11377
- ElSegmented as BmpSegmented,
11378
- ElSelect as BmpSelect,
11379
- ElSelectV2 as BmpSelectV2,
11491
+ ElSegmented2 as BmpSegmented,
11492
+ ElSelect2 as BmpSelect,
11493
+ ElSelectV22 as BmpSelectV2,
11380
11494
  setI18n as BmpSetI18n,
11381
11495
  setPinia as BmpSetPinia,
11382
- ElSkeleton as BmpSkeleton,
11383
- ElSkeletonItem as BmpSkeletonItem,
11384
- ElSlider as BmpSlider,
11385
- ElSpace as BmpSpace,
11386
- ElSplitter as BmpSplitter,
11387
- ElSplitterPanel as BmpSplitterPanel,
11388
- ElStatistic as BmpStatistic,
11496
+ ElSkeleton2 as BmpSkeleton,
11497
+ ElSkeletonItem2 as BmpSkeletonItem,
11498
+ ElSlider2 as BmpSlider,
11499
+ ElSpace2 as BmpSpace,
11500
+ ElSplitter2 as BmpSplitter,
11501
+ ElSplitterPanel2 as BmpSplitterPanel,
11502
+ ElStatistic2 as BmpStatistic,
11389
11503
  Steps as BmpSteps,
11390
11504
  ElSubMenu2 as BmpSubMenu,
11391
- ElSwitch as BmpSwitch,
11392
- ElTabPane as BmpTabPane,
11393
- ElTable as BmpTable,
11394
- ElTableColumn as BmpTableColumn,
11395
- ElTabs as BmpTabs,
11396
- ElTag as BmpTag,
11397
- ElText as BmpText,
11398
- ElTimePicker as BmpTimePicker,
11399
- ElTimeSelect as BmpTimeSelect,
11400
- ElTimeline as BmpTimeline,
11401
- ElTimelineItem as BmpTimelineItem,
11402
- ElTooltip as BmpTooltip,
11403
- ElTour as BmpTour,
11404
- ElTourStep as BmpTourStep,
11405
- ElTransfer as BmpTransfer,
11406
- ElTree as BmpTree,
11407
- ElTreeSelect as BmpTreeSelect,
11408
- ElTreeV2 as BmpTreeV2,
11505
+ ElSwitch2 as BmpSwitch,
11506
+ ElTabPane2 as BmpTabPane,
11507
+ ElTable2 as BmpTable,
11508
+ ElTableColumn2 as BmpTableColumn,
11509
+ ElTabs2 as BmpTabs,
11510
+ ElTag2 as BmpTag,
11511
+ ElText2 as BmpText,
11512
+ ElTimePicker2 as BmpTimePicker,
11513
+ ElTimeSelect2 as BmpTimeSelect,
11514
+ ElTimeline2 as BmpTimeline,
11515
+ ElTimelineItem2 as BmpTimelineItem,
11516
+ ElTooltip2 as BmpTooltip,
11517
+ ElTour2 as BmpTour,
11518
+ ElTourStep2 as BmpTourStep,
11519
+ ElTransfer2 as BmpTransfer,
11520
+ ElTree2 as BmpTree,
11521
+ ElTreeSelect2 as BmpTreeSelect,
11522
+ ElTreeV22 as BmpTreeV2,
11409
11523
  ElUpload2 as BmpUpload,
11410
11524
  UploadFile as BmpUploadFile,
11411
11525
  UploadImg as BmpUploadImg,
@@ -11417,6 +11531,7 @@ export {
11417
11531
  usePermissionStoreWithOut as BmpUsePermissionStoreWithOut,
11418
11532
  useUserStore as BmpUseUserStore,
11419
11533
  useUserStoreWithOut as BmpUseUserStoreWithOut,
11420
- ElWatermark as BmpWatermark,
11421
- BmpLayout as default
11534
+ ElWatermark2 as BmpWatermark,
11535
+ BmpLayout as default,
11536
+ install
11422
11537
  };