@otwb/ui 2.0.23 → 2.0.24
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/dist/index.js +36 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { i as vTooltip, n as vSpin, r as TooltipDirectiveProvider, t as SpinDire
|
|
|
3
3
|
import { g as useStyle, i as cM, n as cB, r as cE, t as c } from "./use-style-DcT-1dj4.js";
|
|
4
4
|
import { Fragment, computed, createVNode, defineComponent, inject, isVNode, mergeProps, provide, reactive, ref, renderSlot, shallowRef, toRef, toValue, unref, useTemplateRef, watch, withDirectives } from "vue";
|
|
5
5
|
import { computedAsync, promiseTimeout, useElementHover, useElementSize, useEventListener, useFullscreen, watchDebounced } from "@vueuse/core";
|
|
6
|
-
import { NAvatar, NBadge, NBreadcrumb, NBreadcrumbItem, NButton, NDrawer, NDrawerContent, NDropdown, NEmpty, NIcon, NList, NListItem, NMenu, NPagination, NPopover, NScrollbar, NTabPane, NTabs, NText, NThing, useThemeVars } from "ithinkdt-ui";
|
|
6
|
+
import { NAvatar, NBadge, NBreadcrumb, NBreadcrumbItem, NButton, NDrawer, NDrawerContent, NDropdown, NEmpty, NIcon, NList, NListItem, NMenu, NPagination, NPopover, NScrollbar, NTabPane, NTabs, NText, NThing, NTooltip, useThemeVars } from "ithinkdt-ui";
|
|
7
7
|
import { useAtomicBroadcast } from "@otwb/common/composables";
|
|
8
8
|
import { RouterLink, useRouter } from "vue-router";
|
|
9
9
|
import { walkTree } from "@otwb/common/tree";
|
|
@@ -550,6 +550,9 @@ const AppMenu = /* @__PURE__ */ defineComponent({
|
|
|
550
550
|
},
|
|
551
551
|
setup(d) {
|
|
552
552
|
let z = shallowRef([]);
|
|
553
|
+
function V(d, z) {
|
|
554
|
+
return d.length > 7;
|
|
555
|
+
}
|
|
553
556
|
watch([() => d.menus, () => d.single], ([B, V]) => {
|
|
554
557
|
if (z.value = [], !B?.length) return;
|
|
555
558
|
let H = (z, B = 0) => {
|
|
@@ -573,19 +576,40 @@ const AppMenu = /* @__PURE__ */ defineComponent({
|
|
|
573
576
|
}, { immediate: !0 }), watch([useTemplateRef("menu"), () => d.current], ([d, z]) => {
|
|
574
577
|
d?.showOption(z);
|
|
575
578
|
}, { immediate: !0 });
|
|
576
|
-
let
|
|
577
|
-
let
|
|
578
|
-
if (z._.type === "view") if (z.isExternal && z.externalEmbed)
|
|
579
|
+
let H = inject(COLLAPSED_INJECTION_KEY, !1), U = (z) => {
|
|
580
|
+
let U = d.collapsed ?? unref(H), W;
|
|
581
|
+
if (z._.type === "view") if (z.isExternal && z.externalEmbed) W = createVNode("a", {
|
|
579
582
|
href: z.externalLink,
|
|
580
583
|
target: "_blank",
|
|
581
584
|
onClick: (d) => d.stopPropagation()
|
|
582
585
|
}, [z.label()]);
|
|
583
586
|
else {
|
|
584
|
-
let d;
|
|
585
|
-
|
|
587
|
+
let d, B = createVNode(RouterLink, { to: z.path }, _isSlot$1(d = z.label()) ? d : { default: () => [d] }), H = createVNode("span", null, [z.label()]);
|
|
588
|
+
W = createVNode(NTooltip, {
|
|
589
|
+
placement: "top",
|
|
590
|
+
trigger: "hover",
|
|
591
|
+
showArrow: !0,
|
|
592
|
+
delay: 300,
|
|
593
|
+
disabled: !V(z.label(), z)
|
|
594
|
+
}, {
|
|
595
|
+
default: () => H,
|
|
596
|
+
trigger: () => B
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
else {
|
|
600
|
+
let d = createVNode("span", null, [z.label()]);
|
|
601
|
+
W = createVNode(NTooltip, {
|
|
602
|
+
placement: "top",
|
|
603
|
+
trigger: "hover",
|
|
604
|
+
showArrow: !0,
|
|
605
|
+
delay: 300,
|
|
606
|
+
disabled: !V(z.label(), z)
|
|
607
|
+
}, {
|
|
608
|
+
default: () => d,
|
|
609
|
+
trigger: () => d
|
|
610
|
+
});
|
|
586
611
|
}
|
|
587
|
-
|
|
588
|
-
return U.key = `${z.key}:${H ? 1 : 0}`, z.depth === 0 && !H && (U = withDirectives(U, [[
|
|
612
|
+
return W.key = `${z.key}:${U ? 1 : 0}`, z.depth === 0 && !U && (W = withDirectives(W, [[
|
|
589
613
|
vTooltip,
|
|
590
614
|
z.label(),
|
|
591
615
|
void 0,
|
|
@@ -593,7 +617,7 @@ const AppMenu = /* @__PURE__ */ defineComponent({
|
|
|
593
617
|
auto: !0,
|
|
594
618
|
right: !0
|
|
595
619
|
}
|
|
596
|
-
]])), z.isNew && (
|
|
620
|
+
]])), z.isNew && (W = createVNode("div", { style: "display: flex; width: 100%" }, [createVNode("span", { style: "flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis" }, [W]), createVNode("svg", {
|
|
597
621
|
xmlns: "http://www.w3.org/2000/svg",
|
|
598
622
|
width: "24",
|
|
599
623
|
height: "24",
|
|
@@ -602,7 +626,7 @@ const AppMenu = /* @__PURE__ */ defineComponent({
|
|
|
602
626
|
}, [createVNode("path", {
|
|
603
627
|
d: "M245.76 286.72h552.96c124.928 0 225.28 100.352 225.28 225.28s-100.352 225.28-225.28 225.28H0V532.48c0-135.168 110.592-245.76 245.76-245.76z m133.12 348.16V401.408H348.16v178.176l-112.64-178.176H204.8V634.88h30.72v-178.176L348.16 634.88h30.72z m182.272-108.544v-24.576h-96.256v-75.776h110.592v-24.576h-141.312V634.88h143.36v-24.576h-112.64v-83.968h96.256z m100.352 28.672l-34.816-151.552h-34.816l55.296 233.472H675.84l47.104-161.792 4.096-20.48 4.096 20.48 47.104 161.792h28.672l57.344-233.472h-34.816l-32.768 151.552-4.096 30.72-6.144-30.72-40.96-151.552h-30.72l-40.96 151.552-6.144 30.72-6.144-30.72z",
|
|
604
628
|
fill: "var(--color-danger)"
|
|
605
|
-
}, null)])])),
|
|
629
|
+
}, null)])])), W;
|
|
606
630
|
};
|
|
607
631
|
return () => {
|
|
608
632
|
let B = createVNode(NMenu, {
|
|
@@ -610,11 +634,11 @@ const AppMenu = /* @__PURE__ */ defineComponent({
|
|
|
610
634
|
options: z.value,
|
|
611
635
|
rootIndent: 16,
|
|
612
636
|
accordion: d.accordion,
|
|
613
|
-
collapsed: d.collapsed ?? unref(
|
|
637
|
+
collapsed: d.collapsed ?? unref(H),
|
|
614
638
|
dropdownProps: { showArrow: !0 },
|
|
615
639
|
mode: d.horizontal ? "horizontal" : "vertical",
|
|
616
640
|
value: d.current ?? null,
|
|
617
|
-
renderLabel:
|
|
641
|
+
renderLabel: U,
|
|
618
642
|
responsive: !0,
|
|
619
643
|
collapsedWidth: d.collapsedWidth,
|
|
620
644
|
width: d.width
|