@soft-stech/bootsman-ui-shadcn 1.5.0 → 1.5.2

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.
@@ -1,4 +1,17 @@
1
1
  export declare function useResizeColumns(): {
2
+ cells: import('vue').Ref<{
3
+ [key: string]: {
4
+ cell: HTMLTableCellElement;
5
+ initialWidth: number;
6
+ minWidth: number;
7
+ };
8
+ } | undefined, {
9
+ [key: string]: {
10
+ cell: HTMLTableCellElement;
11
+ initialWidth: number;
12
+ minWidth: number;
13
+ };
14
+ } | undefined>;
2
15
  tableHeaderElement: import('vue').Ref<({
3
16
  $: import('vue').ComponentInternalInstance;
4
17
  $data: {};
@@ -1,89 +1,96 @@
1
- import { ref as n } from "vue";
1
+ import { ref as o } from "vue";
2
2
  import "vee-validate";
3
- import { useEventListener as R } from "@vueuse/core";
4
- function A() {
5
- const u = n(!1), o = n(""), r = n(""), i = n(void 0), d = n(90), m = n(void 0), a = n(null), v = n(void 0), w = (e) => {
6
- a.value && a.value.headRef && [...a.value.headRef.querySelectorAll("th")].forEach((l) => {
7
- const s = l.id.split("_")[0];
8
- e && e[s] && (l.style.width = e[s] + "px");
3
+ import { useEventListener as M } from "@vueuse/core";
4
+ function b() {
5
+ const r = o(!1), u = o(""), d = o(""), l = o(void 0), h = 90, x = 56, z = 10, v = o(void 0), n = o(null), f = o(void 0), y = (e) => {
6
+ n.value && n.value.headRef && [...n.value.headRef.querySelectorAll("th")].forEach((i) => {
7
+ const s = a(i);
8
+ e && e[s] && (i.style.width = e[s] + "px");
9
9
  });
10
- }, W = () => {
11
- if (a.value && a.value.headRef)
12
- return [...a.value.headRef.querySelectorAll("th")].reduce((l, s) => {
13
- const h = s.id.split("_")[0];
10
+ }, E = () => {
11
+ if (n.value && n.value.headRef)
12
+ return [...n.value.headRef.querySelectorAll("th")].reduce((i, s) => {
13
+ const c = a(s);
14
14
  return {
15
- ...l,
16
- [h]: {
15
+ ...i,
16
+ [c]: {
17
17
  cell: s,
18
- initialWidth: s.offsetWidth
18
+ initialWidth: s.offsetWidth,
19
+ minWidth: c === "actions" ? z : Math.min(s.offsetWidth, h)
19
20
  }
20
21
  };
21
22
  }, {});
22
- }, g = (e, t) => {
23
- if (t && (u.value = !0, o.value = e, i.value)) {
24
- const l = i.value[e].cell;
25
- let s = l.nextElementSibling;
26
- s || (s = l.previousElementSibling), r.value = s ? s.id.split("_")[0] : "", v.value = R(document, "mousemove", z);
23
+ }, I = (e, t) => {
24
+ if (t && (r.value = !0, u.value = e, l.value)) {
25
+ const i = l.value[e].cell;
26
+ let s = i.nextElementSibling;
27
+ s || (s = i.previousElementSibling), d.value = s ? s.id.split("_")[0] : "", f.value = M(document, "mousemove", R);
27
28
  }
28
- }, x = () => {
29
- if (u.value && (u.value = !1, o.value = "", r.value = "", v.value && v.value(), i.value)) {
29
+ }, g = () => {
30
+ if (r.value && (r.value = !1, u.value = "", d.value = "", f.value && f.value(), l.value)) {
30
31
  const e = {};
31
- for (let t in i.value) {
32
- const l = i.value[t], s = l.cell.hasAttribute("can-resize") ? Math.floor(l.cell.offsetWidth) <= d.value ? d.value : l.cell.offsetWidth : l.initialWidth;
33
- l.cell.style.width = s + "px", e[t] = s;
32
+ for (let t in l.value) {
33
+ const i = l.value[t], s = i.cell.hasAttribute("can-resize") ? Math.floor(i.cell.offsetWidth) <= i.minWidth ? i.minWidth : i.cell.offsetWidth : i.initialWidth;
34
+ i.cell.style.width = s + "px", e[t] = s;
34
35
  }
35
- m.value = e;
36
+ v.value = e;
36
37
  }
37
- }, y = (e) => {
38
- if (!e.nextElementSibling) {
39
- const t = e.querySelector(".header-cell_wrapper");
40
- if (t)
41
- return parseInt(window.getComputedStyle(t).paddingRight);
42
- }
43
- return 0;
44
- }, c = (e, t, l) => {
38
+ }, S = (e) => a(e) === "actions" ? x : 0, a = (e) => e.id.split("_")[0], m = (e, t, i) => {
45
39
  if (!e || !t) {
46
- o.value = "", r.value = "";
40
+ u.value = "", d.value = "";
47
41
  return;
48
42
  }
49
- const s = l.movementX, h = s < 0 ? "left" : "right", f = Math.floor(parseInt(e.style.width)) + s, p = Math.floor(parseInt(t.style.width)) - s;
50
- if (h === "left")
51
- if (f <= d.value || !e.hasAttribute("can-resize")) {
52
- const C = e.previousElementSibling;
53
- c(C, t, l);
43
+ const s = i.movementX, c = s < 0 ? "left" : "right", C = Math.floor(parseInt(e.style.width)) + s, W = Math.floor(parseInt(t.style.width)) - s;
44
+ if (c === "left") {
45
+ const p = l.value && l.value[a(e)] ? l.value[a(e)].minWidth : h;
46
+ if (C <= p || !e.hasAttribute("can-resize")) {
47
+ const w = e.previousElementSibling;
48
+ m(w, t, i);
49
+ } else
50
+ e.style.width = C + "px", t.style.width = W + "px";
51
+ } else {
52
+ const p = l.value && l.value[a(t)] ? l.value[a(t)].minWidth + S(t) : h;
53
+ if (W <= p || !t.hasAttribute("can-resize")) {
54
+ const w = t.nextElementSibling;
55
+ m(e, w, i);
54
56
  } else
55
- e.style.width = f + "px", t.style.width = p + "px";
56
- else if (p <= d.value + y(t) || !t.hasAttribute("can-resize")) {
57
- const C = t.nextElementSibling;
58
- c(e, C, l);
59
- } else
60
- e.style.width = f + "px", t.style.width = p + "px";
61
- }, z = (e) => {
62
- if (e.preventDefault(), i.value) {
63
- const t = i.value[o.value]?.cell, l = i.value[r.value]?.cell;
64
- c(t, l, e);
57
+ e.style.width = C + "px", t.style.width = W + "px";
58
+ }
59
+ }, R = (e) => {
60
+ if (e.preventDefault(), l.value) {
61
+ const t = l.value[u.value]?.cell, i = l.value[d.value]?.cell;
62
+ m(t, i, e);
65
63
  }
66
64
  };
67
65
  return {
68
- tableHeaderElement: a,
69
- calculatedColumnSizing: m,
70
- isResizing: u,
71
- resizingCellId: o,
72
- handleResizeControlMouseDown: g,
73
- handleResizeControlMouseUp: x,
66
+ cells: l,
67
+ tableHeaderElement: n,
68
+ calculatedColumnSizing: v,
69
+ isResizing: r,
70
+ resizingCellId: u,
71
+ handleResizeControlMouseDown: I,
72
+ handleResizeControlMouseUp: g,
74
73
  resetCells: () => {
75
- if (i.value)
76
- for (let e in i.value)
77
- i.value[e].cell.style.width = i.value[e].initialWidth + "px";
74
+ if (l.value) {
75
+ const e = {};
76
+ for (let t in l.value) {
77
+ const i = l.value[t].initialWidth;
78
+ l.value[t].cell.style.width = i + "px", e[t] = i;
79
+ }
80
+ v.value = e;
81
+ }
78
82
  },
79
83
  setInitialColumnWidths: () => {
80
- if (i.value = W(), i.value)
81
- for (let e in i.value)
82
- i.value[e].cell.style.width || (i.value[e].cell.style.width = i.value[e].initialWidth + "px");
84
+ if (l.value = E(), l.value) {
85
+ const e = {};
86
+ for (let t in l.value)
87
+ l.value[t].cell.style.width || (l.value[t].cell.style.width = l.value[t].initialWidth + "px"), e[t] = l.value[t].cell.offsetWidth;
88
+ v.value = e;
89
+ }
83
90
  },
84
- setProvidedCellWidths: w
91
+ setProvidedCellWidths: y
85
92
  };
86
93
  }
87
94
  export {
88
- A as useResizeColumns
95
+ b as useResizeColumns
89
96
  };