@otwb/ui 2.0.6 → 2.0.8

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.
Files changed (2) hide show
  1. package/dist/index.js +108 -39
  2. 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, 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, 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";
@@ -20,7 +20,7 @@ const AppAccount = /* @__PURE__ */ defineComponent({
20
20
  head: String,
21
21
  showLogoutButton: {
22
22
  type: Boolean,
23
- default: !0
23
+ default: !1
24
24
  },
25
25
  showChangePwd: {
26
26
  type: Boolean,
@@ -51,18 +51,33 @@ const AppAccount = /* @__PURE__ */ defineComponent({
51
51
  trigger: () => createVNode(NButton, {
52
52
  quaternary: !0,
53
53
  style: "--n-padding: 0 12px"
54
- }, { default: () => [createVNode("div", { style: "display: flex; align-items: center; gap: 8px" }, [createVNode(NAvatar, {
55
- key: z.head ? "head" : "no-head",
56
- src: z.head,
57
- round: !0,
58
- size: "small",
59
- radix: .78,
60
- color: "var(--color-primary-hover)"
61
- }, {
62
- fallback: () => G,
63
- placeholder: () => G,
64
- default: z.head ? void 0 : () => U.value
65
- }), createVNode("span", { style: "font-size: 14px" }, [z.username ?? ""])])] }),
54
+ }, { default: () => [createVNode("div", { style: "display: flex; align-items: center; gap: 8px" }, [
55
+ createVNode(NAvatar, {
56
+ key: z.head ? "head" : "no-head",
57
+ src: z.head,
58
+ round: !0,
59
+ size: "small",
60
+ radix: .78,
61
+ color: "var(--color-primary-hover)"
62
+ }, {
63
+ fallback: () => G,
64
+ placeholder: () => G,
65
+ default: z.head ? void 0 : () => U.value
66
+ }),
67
+ createVNode("span", { style: "font-size: 14px" }, [z.username ?? ""]),
68
+ createVNode(NIcon, null, { default: () => [createVNode("svg", {
69
+ xmlns: "http://www.w3.org/2000/svg",
70
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
71
+ viewBox: "0 0 512 512"
72
+ }, [createVNode("path", {
73
+ fill: "none",
74
+ stroke: "currentColor",
75
+ "stroke-linecap": "round",
76
+ "stroke-linejoin": "round",
77
+ "stroke-width": "48",
78
+ d: "M112 184l144 144l144-144"
79
+ }, null)])] })
80
+ ])] }),
66
81
  default: () => {
67
82
  let d = () => z.showChangePwd ? createVNode(NButton, {
68
83
  quaternary: !0,
@@ -854,7 +869,20 @@ var AppTab = /* @__PURE__ */ defineComponent({
854
869
  }, [createVNode("span", {
855
870
  class: "whitespace-nowrap",
856
871
  style: q.value
857
- }, [B.default?.()]), createVNode("span", { style: "line-height: 0; display: inline-block; text-align: right; padding-top: 2px" }, null)])])]);
872
+ }, [B.default?.()]), createVNode("span", { style: "line-height: 0; display: inline-block; text-align: right; padding-top: 2px" }, [createVNode(NButton, {
873
+ text: !0,
874
+ onClick: (d) => {
875
+ d.stopPropagation(), z("close");
876
+ }
877
+ }, { default: () => [createVNode(NIcon, { size: 18 }, { default: () => [createVNode("svg", {
878
+ xmlns: "http://www.w3.org/2000/svg",
879
+ width: "1em",
880
+ height: "1em",
881
+ viewBox: "0 0 24 24"
882
+ }, [createVNode("path", {
883
+ fill: "currentColor",
884
+ d: "m6.4 18.308l-.708-.708l5.6-5.6l-5.6-5.6l.708-.708l5.6 5.6l5.6-5.6l.708.708l-5.6 5.6l5.6 5.6l-.708.708l-5.6-5.6z"
885
+ }, null)])] })] })])])])]);
858
886
  }
859
887
  });
860
888
  const AppMultiTabs = /* @__PURE__ */ defineComponent({
@@ -974,26 +1002,36 @@ const AppNotification = /* @__PURE__ */ defineComponent({
974
1002
  W("common.notification.tip", { count: q.unread }),
975
1003
  void 0,
976
1004
  { bottom: !0 }
977
- ]]), X = () => {
978
- let d, z;
979
- return createVNode("div", { style: "display: flex; align-items: baseline; gap: 20px" }, [
980
- createVNode("div", { style: "padding-right: 12px" }, [W("common.notification.title")]),
981
- createVNode(NButton, {
982
- text: !0,
983
- type: K.value === "all" ? "primary" : "default",
984
- onClick: () => {
985
- K.value = "all", J();
986
- }
987
- }, _isSlot(d = W("common.notification.all")) ? d : { default: () => [d] }),
988
- createVNode(NButton, {
989
- text: !0,
990
- type: K.value === "unread" ? "primary" : "default",
991
- onClick: () => {
992
- K.value = "unread", J();
993
- }
994
- }, _isSlot(z = W("common.notification.unread", { count: q.unread > 99 ? "99+" : q.unread.toString() })) ? z : { default: () => [z] })
995
- ]);
996
- }, Z = (d) => createVNode(NListItem, {
1005
+ ]]), X = () => createVNode("div", { style: "display: flex; align-items:center; gap: 16px" }, [createVNode(NButton, {
1006
+ text: !0,
1007
+ onClick: () => {
1008
+ G.value = !1;
1009
+ }
1010
+ }, { default: () => [createVNode(NIcon, {
1011
+ size: "20",
1012
+ color: "rgba(0,0,0,.45)",
1013
+ onClick: () => {
1014
+ G.value = !1;
1015
+ }
1016
+ }, { default: () => [createVNode("svg", {
1017
+ xmlns: "http://www.w3.org/2000/svg",
1018
+ "xmlns:xlink": "http://www.w3.org/1999/xlink",
1019
+ viewBox: "0 0 512 512"
1020
+ }, [createVNode("path", {
1021
+ fill: "none",
1022
+ stroke: "currentColor",
1023
+ "stroke-linecap": "round",
1024
+ "stroke-linejoin": "round",
1025
+ "stroke-width": "32",
1026
+ d: "M368 368L144 144"
1027
+ }, null), createVNode("path", {
1028
+ fill: "none",
1029
+ stroke: "currentColor",
1030
+ "stroke-linecap": "round",
1031
+ "stroke-linejoin": "round",
1032
+ "stroke-width": "32",
1033
+ d: "M368 144L144 368"
1034
+ }, null)])] })] }), createVNode("div", { style: "padding-right: 12px" }, [W("common.notification.title")])]), Z = (d) => createVNode(NListItem, {
997
1035
  key: d.key,
998
1036
  onClick: () => {
999
1037
  d.status === "unread" && (z.markRead?.([d.key]).then(() => {
@@ -1048,12 +1086,44 @@ const AppNotification = /* @__PURE__ */ defineComponent({
1048
1086
  default: d.content,
1049
1087
  footer: () => createVNode("span", { style: "color: gray" }, [d.hover ? format(d.date, W("common.notification.time")) : W("common.timeago", { time: d.date })])
1050
1088
  })] }), Q = () => {
1051
- let d;
1052
- return withDirectives(q.records.length > 0 ? createVNode(NList, {
1089
+ let d, z;
1090
+ return withDirectives(q.records.length > 0 ? createVNode("div", null, [createVNode(NTabs, {
1091
+ "onUpdate:value": [(d) => {
1092
+ console.log(d), K.value = d, J();
1093
+ }, (d) => K.value = d],
1094
+ type: "line",
1095
+ "default-value": "all",
1096
+ animated: !0,
1097
+ value: K.value
1098
+ }, { default: () => [createVNode(NTabPane, {
1099
+ name: "all",
1100
+ tab: W("common.notification.all")
1101
+ }, { default: () => [createVNode(NList, {
1053
1102
  clickable: !0,
1054
1103
  hoverable: !0,
1055
1104
  style: "min-height: 50vh"
1056
- }, _isSlot(d = q.records.map((d) => Z(d))) ? d : { default: () => [d] }) : createVNode(NEmpty, { style: "margin-top: 30vh" }, null), [[vSpin, q.loading]]);
1105
+ }, _isSlot(d = q.records.map((d) => Z(d))) ? d : { default: () => [d] })] }), createVNode(NTabPane, {
1106
+ name: "unread",
1107
+ tab: W("common.notification.unread", { count: q.unread > 99 ? "99+" : q.unread.toString() })
1108
+ }, { default: () => [createVNode(NList, {
1109
+ clickable: !0,
1110
+ hoverable: !0,
1111
+ style: "min-height: 50vh"
1112
+ }, _isSlot(z = q.records.map((d) => Z(d))) ? z : { default: () => [z] })] })] })]) : createVNode("div", null, [createVNode(NTabs, {
1113
+ "onUpdate:value": [(d) => {
1114
+ console.log(d), K.value = d, J();
1115
+ }, (d) => K.value = d],
1116
+ type: "line",
1117
+ "default-value": "all",
1118
+ animated: !0,
1119
+ value: K.value
1120
+ }, { default: () => [createVNode(NTabPane, {
1121
+ name: "all",
1122
+ tab: W("common.notification.all")
1123
+ }, { default: () => [createVNode(NEmpty, { style: "margin-top: 30vh" }, null)] }), createVNode(NTabPane, {
1124
+ name: "unread",
1125
+ tab: W("common.notification.unread", { count: q.unread > 99 ? "99+" : q.unread.toString() })
1126
+ }, { default: () => [createVNode(NEmpty, { style: "margin-top: 30vh" }, null)] })] })]), [[vSpin, q.loading]]);
1057
1127
  }, $ = () => createVNode("div", { style: "display: flex; justify-content: space-between; width: 100%" }, [K.value === "unread" ? createVNode(NButton, {
1058
1128
  text: !0,
1059
1129
  type: "primary",
@@ -1092,7 +1162,6 @@ const AppNotification = /* @__PURE__ */ defineComponent({
1092
1162
  width: 400
1093
1163
  }, { default: () => [createVNode(NDrawerContent, {
1094
1164
  title: W("common.notification.title"),
1095
- closable: !0,
1096
1165
  nativeScrollbar: !1,
1097
1166
  bodyContentStyle: { padding: "0" }
1098
1167
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@otwb/ui",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "otwb UI",