@ithinkdt/ui 4.0.2 → 4.0.4

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.
@@ -0,0 +1,25 @@
1
+ import { nextTick as e, ref as t, watch as n } from "vue";
2
+ import { unrefElement as r } from "@vueuse/core";
3
+ import { Sortable as i } from "sortablejs";
4
+ function a(a, { data: o, onSort: s, ...c }) {
5
+ n([t(o), a], async ([t, n]) => {
6
+ if (t.length === 0) return;
7
+ await e();
8
+ let a = r(n)?.querySelector(".n-data-table-base-table-body .n-data-table-tbody");
9
+ if (!a) return;
10
+ let o = i.create(a, {
11
+ animation: 150,
12
+ ...c,
13
+ onSort(e) {
14
+ s({
15
+ from: e.oldIndex,
16
+ to: e.newIndex
17
+ });
18
+ }
19
+ });
20
+ return () => {
21
+ o.destroy();
22
+ };
23
+ }, { immediate: !0 });
24
+ }
25
+ export { a as useDataTableDrag };
@@ -10,7 +10,7 @@ var C = [
10
10
  2,
11
11
  3,
12
12
  5
13
- ], w = /* @__PURE__ */ t([
13
+ ], w = t([
14
14
  t(({ props: e }) => `:where(span${e.bPrefix}tooltip-host)`, { display: "inline-block" }),
15
15
  t(({ props: e }) => `:where(${e.bPrefix}tooltip-host)`, {
16
16
  maxWidth: "100%",
@@ -30,7 +30,7 @@ var C = [
30
30
  whiteSpace: "normal",
31
31
  lineHeight: "1.25"
32
32
  })
33
- ]), T = /* @__PURE__ */ Symbol("tooltip-dir"), E = /* @__PURE__ */ f();
33
+ ]), T = Symbol("tooltip-dir"), E = f();
34
34
  function D(e) {
35
35
  let t = e.firstChild;
36
36
  if (!t) return !1;
@@ -44,7 +44,7 @@ function D(e) {
44
44
  return n.width >= e.clientWidth + 1 || n.height >= e.clientHeight + 2;
45
45
  }
46
46
  var O, k, A;
47
- const j = /* @__PURE__ */ s({
47
+ const j = s({
48
48
  name: "TooltipDirectiveProvider",
49
49
  props: { delay: {
50
50
  type: Number,
@@ -136,7 +136,7 @@ const P = {
136
136
  E.value === e && (E.value = void 0), e[T] && (e.removeEventListener("mouseenter", M), e.bindClick = !1, e.removeEventListener("click", N), e.classList.remove(`${A.value}-tooltip-host`, `${A.value}-tooltip-expandable`, `${A.value}-tooltip-expanded`, ...C.map((e) => `${A.value}-tooltip-ell${e}`)), delete e[T]);
137
137
  }
138
138
  };
139
- var F, I, L = /* @__PURE__ */ t([t(({ props: e }) => `:where(${e.bPrefix}spin-host)`, { position: "relative" }), n("spin-directive", {
139
+ var F, I, L = t([t(({ props: e }) => `:where(${e.bPrefix}spin-host)`, { position: "relative" }), n("spin-directive", {
140
140
  zIndex: "999999",
141
141
  position: "absolute",
142
142
  color: "var(--color-primary)",
@@ -157,14 +157,14 @@ var F, I, L = /* @__PURE__ */ t([t(({ props: e }) => `:where(${e.bPrefix}spin-ho
157
157
  r("tip:empty", { display: "none" }),
158
158
  i("spining", { backgroundColor: "rgb(var(--host-bg, 255 255 255) / 0.5)" }, [r("tip, icon", { opacity: "1" })])
159
159
  ])]);
160
- const R = /* @__PURE__ */ s({
160
+ const R = s({
161
161
  name: "SpinDirectiveProvider",
162
162
  props: { dark: Boolean },
163
163
  setup(t) {
164
164
  return F = e("-spin-directive", L), I = p(t, "dark"), () => c(a);
165
165
  }
166
166
  });
167
- var z = /* @__PURE__ */ Symbol("spin-dir"), B = (e, { value: t, modifiers: n }) => {
167
+ var z = Symbol("spin-dir"), B = (e, { value: t, modifiers: n }) => {
168
168
  if (e[z].loading.value = !!t, !e[z].loading.value) return;
169
169
  let r = n.dark || !n.light && I.value;
170
170
  e[z].spinEl.style.setProperty("--host-bg", r ? "0 0 0" : "255 255 255");
@@ -1,2 +1,2 @@
1
- import { i as e, n as t, r as n, t as r } from "./directives-pSAvXd5F.js";
1
+ import { i as e, n as t, r as n, t as r } from "./directives-DXNnV4xc.js";
2
2
  export { r as SpinDirectiveProvider, n as TooltipDirectiveProvider, t as vSpin, e as vTooltip };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as e, t } from "./use-i18n-Cmb7Xx7d.js";
2
2
  import n, { c as r, cB as i, cE as a, cM as o } from "./use-style.js";
3
- import { i as s, n as c, r as l, t as u } from "./directives-pSAvXd5F.js";
3
+ import { i as s, n as c, r as l, t as u } from "./directives-DXNnV4xc.js";
4
4
  import { Fragment as d, computed as f, createVNode as p, defineComponent as m, inject as h, isVNode as g, mergeProps as _, provide as v, reactive as y, ref as b, renderSlot as x, shallowRef as ee, toRef as S, toValue as C, unref as w, useTemplateRef as T, watch as E, withDirectives as D } from "vue";
5
5
  import { computedAsync as te, promiseTimeout as O, useElementHover as k, useElementSize as ne, useEventListener as re, useFullscreen as ie, watchDebounced as ae } from "@vueuse/core";
6
6
  import { NAvatar as A, NBadge as oe, NBreadcrumb as se, NBreadcrumbItem as ce, NButton as j, NDrawer as le, NDrawerContent as M, NDropdown as N, NEmpty as P, NIcon as F, NList as I, NListItem as L, NMenu as R, NPagination as z, NPopover as B, NScrollbar as V, NText as H, NThing as U, useThemeVars as W } from "ithinkdt-ui";
@@ -12,7 +12,7 @@ import { format as me } from "date-fns";
12
12
  function K(e) {
13
13
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !g(e);
14
14
  }
15
- const he = /* @__PURE__ */ m({
15
+ const he = m({
16
16
  name: "AppAccount",
17
17
  props: {
18
18
  username: String,
@@ -115,7 +115,7 @@ const he = /* @__PURE__ */ m({
115
115
  ]]) : void 0
116
116
  ]);
117
117
  }
118
- }), ge = /* @__PURE__ */ m({
118
+ }), ge = m({
119
119
  name: "AppAppearance",
120
120
  props: { mode: String },
121
121
  emit: ["update:mode"],
@@ -178,7 +178,7 @@ const he = /* @__PURE__ */ m({
178
178
  function _e(e) {
179
179
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !g(e);
180
180
  }
181
- const ve = /* @__PURE__ */ m({
181
+ const ve = m({
182
182
  name: "AppBreadcrumb",
183
183
  props: {
184
184
  items: {
@@ -207,7 +207,7 @@ const ve = /* @__PURE__ */ m({
207
207
  }, { default: () => [e.icon ? p(d, null, [p(F, { component: e[r] }, null), " "]) : void 0, C(e.title)] }))) ? n : { default: () => [n] });
208
208
  };
209
209
  }
210
- }), ye = /* @__PURE__ */ m({
210
+ }), ye = m({
211
211
  name: "AppFullscreen",
212
212
  props: {},
213
213
  emit: ["change"],
@@ -250,7 +250,7 @@ const ve = /* @__PURE__ */ m({
250
250
  { bottom: !0 }
251
251
  ]]);
252
252
  }
253
- }), be = /* @__PURE__ */ m({
253
+ }), be = m({
254
254
  name: "AppLanguage",
255
255
  props: {
256
256
  lang: String,
@@ -282,7 +282,7 @@ const ve = /* @__PURE__ */ m({
282
282
  }, [p("path", { d: "M2 12c0 5.523 4.477 10 10 10s10-4.477 10-10S17.523 2 12 2S2 6.477 2 12Z" }, null), p("path", { d: "M13 2.05S16 6 16 12c0 6-3 9.95-3 9.95m-2 0S8 18 8 12c0-6 3-9.95 3-9.95M2.63 15.5h18.74m-18.74-7h18.74" }, null)])])] })] })] });
283
283
  }
284
284
  });
285
- var xe = /* @__PURE__ */ r([
285
+ var xe = r([
286
286
  i("layout", {
287
287
  display: "grid",
288
288
  gridTemplateAreas: "\n 'sider header'\n 'sider content'\n 'sider footer'\n ",
@@ -360,7 +360,7 @@ var xe = /* @__PURE__ */ r([
360
360
  d: "M12.5 18s6-4.419 6-6s-6-6-6-6m-7 12s6-4.419 6-6s-6-6-6-6",
361
361
  color: "currentColor"
362
362
  }, null)]);
363
- const we = /* @__PURE__ */ m({
363
+ const we = m({
364
364
  name: "AppLayout",
365
365
  props: {
366
366
  layout: {
@@ -393,7 +393,7 @@ const we = /* @__PURE__ */ m({
393
393
  }, [x(t, "default")]);
394
394
  };
395
395
  }
396
- }), Te = /* @__PURE__ */ m({
396
+ }), Te = m({
397
397
  name: "AppHeader",
398
398
  props: { height: {
399
399
  type: Number,
@@ -403,7 +403,7 @@ const we = /* @__PURE__ */ m({
403
403
  let n = X();
404
404
  return () => (n.headerHeight = e.height + "px", p("div", { class: "app-header" }, [x(t, "default")]));
405
405
  }
406
- }), Ee = /* @__PURE__ */ m({
406
+ }), Ee = m({
407
407
  name: "AppSidebar",
408
408
  props: {
409
409
  showCollapseBtn: {
@@ -432,12 +432,12 @@ const we = /* @__PURE__ */ m({
432
432
  }
433
433
  }, { default: () => [p(F, { size: "20" }, { default: () => [t.collapsed ? p(Ce, null, null) : p(Se, null, null)] })] }), [[s, t.collapsed ? i("common.layout.sider.expand") : i("common.layout.sider.collapse")]]) : void 0]));
434
434
  }
435
- }), De = /* @__PURE__ */ m({
435
+ }), De = m({
436
436
  name: "AppContent",
437
437
  setup(e, { slots: t }) {
438
438
  return () => p("div", { class: "app-content" }, [x(t, "default")]);
439
439
  }
440
- }), Oe = /* @__PURE__ */ m({
440
+ }), Oe = m({
441
441
  name: "AppFooter",
442
442
  props: { height: {
443
443
  type: Number,
@@ -451,7 +451,7 @@ const we = /* @__PURE__ */ m({
451
451
  function ke(e) {
452
452
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !g(e);
453
453
  }
454
- const Z = /* @__PURE__ */ m({
454
+ const Z = m({
455
455
  name: "AppLogo",
456
456
  props: {
457
457
  src: [String, Function],
@@ -511,7 +511,7 @@ const Z = /* @__PURE__ */ m({
511
511
  function Q(e) {
512
512
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !g(e);
513
513
  }
514
- const Ae = /* @__PURE__ */ m({
514
+ const Ae = m({
515
515
  name: "AppMenu",
516
516
  props: {
517
517
  menus: Array,
@@ -835,7 +835,7 @@ var Ne = (e) => p("svg", e, [
835
835
  height: "36",
836
836
  fill: "currentColor"
837
837
  }, null)])])
838
- ]), Pe = /* @__PURE__ */ m({
838
+ ]), Pe = m({
839
839
  name: "AppTab",
840
840
  props: {
841
841
  path: String,
@@ -893,7 +893,7 @@ var Ne = (e) => p("svg", e, [
893
893
  ]);
894
894
  }
895
895
  });
896
- const Fe = /* @__PURE__ */ m({
896
+ const Fe = m({
897
897
  name: "AppMultiTabs",
898
898
  props: {
899
899
  fullTab: Boolean,
@@ -951,7 +951,7 @@ const Fe = /* @__PURE__ */ m({
951
951
  function $(e) {
952
952
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !g(e);
953
953
  }
954
- const Ie = /* @__PURE__ */ m({
954
+ const Ie = m({
955
955
  name: "AppNotification",
956
956
  inheritAttrs: !1,
957
957
  props: {
@@ -1154,7 +1154,7 @@ var Le = (e) => p("svg", _({
1154
1154
  fill: "currentColor",
1155
1155
  d: "m9.55 18l-5.7-5.7l1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z"
1156
1156
  }, null)]);
1157
- const Re = /* @__PURE__ */ m({
1157
+ const Re = m({
1158
1158
  name: "AppTenant",
1159
1159
  props: {
1160
1160
  options: Array,
@@ -1201,7 +1201,7 @@ const Re = /* @__PURE__ */ m({
1201
1201
  })] });
1202
1202
  };
1203
1203
  }
1204
- }), ze = /* @__PURE__ */ m({
1204
+ }), ze = m({
1205
1205
  name: "UIProvider",
1206
1206
  props: { i18n: Function },
1207
1207
  setup(e, { slots: n }) {