@fewangsit/wangsvue-fats 1.0.1-alpha.43 → 1.0.1-alpha.45

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.
@@ -20,6 +20,10 @@ export interface ApproverInfoProps {
20
20
  * @default true
21
21
  */
22
22
  showShortInfo?: boolean;
23
+ /**
24
+ * To customize the level 0 label, for example 'Senior'
25
+ */
26
+ customLevelZeroLabel?: string;
23
27
  /**
24
28
  * To set label text when showShortInfo is false
25
29
  */
@@ -1,39 +1,40 @@
1
- import { defineComponent as C, shallowRef as B, computed as F, createElementBlock as o, openBlock as a, Fragment as i, createElementVNode as l, createVNode as m, toDisplayString as r, withCtx as I, renderList as g, createBlock as h, createCommentVNode as k } from "vue";
2
- import { f as N } from "../utils/date.util.es.js";
3
- import { _ as w } from "../badge/index.es.js";
1
+ import { defineComponent as N, shallowRef as B, computed as F, createElementBlock as o, openBlock as t, Fragment as i, createElementVNode as l, createVNode as m, toDisplayString as r, withCtx as I, renderList as k, createBlock as g, createCommentVNode as h, createTextVNode as w } from "vue";
2
+ import { f as V } from "../utils/date.util.es.js";
3
+ import { _ as L } from "../badge/index.es.js";
4
4
  import { _ as $ } from "../dialog/index.es.js";
5
5
  import { _ as A } from "../icon/index.es.js";
6
- const V = {
6
+ const E = {
7
7
  class: "flex justify-end gap-1 items-center pb-1 flex-wrap whitespace-nowrap",
8
8
  "data-wv-name": "approver-info"
9
- }, E = { class: "text-primary-500" }, H = { class: "text-general-800" }, M = { key: 1 }, S = { class: "flex flex-col gap-3 justify-between" }, U = { class: "flex justify-between" }, P = { class: "text-general-800 text-xs font-medium" }, R = { class: "flex justify-between items-center" }, T = { class: "text-primary-500 font-medium text-xs" }, q = {
9
+ }, Z = { class: "text-primary-500" }, H = { class: "text-general-800" }, M = { key: 1 }, S = { class: "flex flex-col gap-3 justify-between" }, T = { class: "flex justify-between" }, U = { class: "text-general-800 text-xs font-medium" }, P = { class: "flex justify-between items-center" }, R = { class: "text-primary-500 font-medium text-xs" }, q = {
10
10
  key: 0,
11
11
  class: "text-general-800 font-normal text-xs"
12
12
  }, z = {
13
13
  key: 1,
14
14
  class: "flex gap-1 justify-end items-center"
15
- }, G = { class: "text-general-800 font-normal text-xs" }, X = /* @__PURE__ */ C({
15
+ }, G = { class: "text-general-800 font-normal text-xs" }, X = /* @__PURE__ */ N({
16
16
  __name: "ApproverInfo",
17
17
  props: {
18
18
  approvals: {},
19
19
  showShortInfo: { type: Boolean, default: !0 },
20
+ customLevelZeroLabel: {},
20
21
  label: {},
21
22
  btnLabel: {},
22
23
  useFormatDate: { type: Boolean, default: !0 }
23
24
  },
24
25
  setup(D) {
25
- const u = D, c = B(!1), d = F(() => {
26
- var p, s, n, v, y, _, x;
27
- let t, e;
28
- return (p = u.approvals) == null || p.forEach((b) => {
29
- e = b.approvers.findIndex((L) => !!L.actionAt), t = e === -1 ? 0 : b.level - 1, e = e === -1 ? 0 : e;
26
+ const u = D, p = B(!1), d = F(() => {
27
+ var c, a, n, v, y, x, _;
28
+ let s, e;
29
+ return (c = u.approvals) == null || c.forEach((b) => {
30
+ e = b.approvers.findIndex((C) => !!C.actionAt), s = e === -1 ? 0 : b.level - 1, e = e === -1 ? 0 : e;
30
31
  }), {
31
- name: (v = (n = (s = u.approvals) == null ? void 0 : s[t]) == null ? void 0 : n.approvers[e]) == null ? void 0 : v.fullName,
32
- date: (x = (_ = (y = u.approvals) == null ? void 0 : y[t]) == null ? void 0 : _.approvers[e]) == null ? void 0 : x.actionAt
32
+ name: (v = (n = (a = u.approvals) == null ? void 0 : a[s]) == null ? void 0 : n.approvers[e]) == null ? void 0 : v.fullName,
33
+ date: (_ = (x = (y = u.approvals) == null ? void 0 : y[s]) == null ? void 0 : x.approvers[e]) == null ? void 0 : _.actionAt
33
34
  };
34
- }), j = (t) => {
35
+ }), j = (s) => {
35
36
  let e;
36
- switch (t) {
37
+ switch (s) {
37
38
  case "menyetujui":
38
39
  e = "success";
39
40
  break;
@@ -44,73 +45,79 @@ const V = {
44
45
  e = "warning";
45
46
  }
46
47
  return e;
47
- }, f = (t) => u.useFormatDate ? t ? N(new Date(t), {
48
+ }, f = (s) => u.useFormatDate ? s ? V(new Date(s), {
48
49
  locale: "id-ID",
49
50
  dateFormat: "dd M yyyy",
50
51
  timeFormat: "HH:mm:ss"
51
- }) : "-" : t;
52
- return (t, e) => {
53
- var p;
54
- return a(), o(i, null, [
55
- l("div", V, [
56
- t.showShortInfo ? (a(), o(i, { key: 0 }, [
52
+ }) : "-" : s;
53
+ return (s, e) => {
54
+ var c;
55
+ return t(), o(i, null, [
56
+ l("div", E, [
57
+ s.showShortInfo ? (t(), o(i, { key: 0 }, [
57
58
  e[3] || (e[3] = l("span", null, "Approver:", -1)),
58
- (p = t.approvals) != null && p.length ? (a(), o(i, { key: 0 }, [
59
+ (c = s.approvals) != null && c.length ? (t(), o(i, { key: 0 }, [
59
60
  m(A, {
60
61
  class: "!text-general-200 !text-base",
61
62
  icon: "user"
62
63
  }),
63
- l("span", E, r(d.value.name), 1),
64
+ l("span", Z, r(d.value.name), 1),
64
65
  l("span", H, r(f(d.value.date)), 1),
65
66
  l("span", {
66
- onClick: e[0] || (e[0] = (s) => c.value = !0),
67
+ onClick: e[0] || (e[0] = (a) => p.value = !0),
67
68
  class: "text-primary-500 hover:cursor-pointer"
68
69
  }, r(u.btnLabel ?? "more"), 1)
69
- ], 64)) : (a(), o("span", M, "-"))
70
- ], 64)) : (a(), o("span", {
70
+ ], 64)) : (t(), o("span", M, "-"))
71
+ ], 64)) : (t(), o("span", {
71
72
  key: 1,
72
- onClick: e[1] || (e[1] = (s) => c.value = !0),
73
+ onClick: e[1] || (e[1] = (a) => p.value = !0),
73
74
  class: "text-primary-500 hover:cursor-pointer"
74
- }, r(t.label ?? "Lihat Approval"), 1))
75
+ }, r(s.label ?? "Lihat Approval"), 1))
75
76
  ]),
76
77
  m($, {
77
- visible: c.value,
78
- "onUpdate:visible": e[2] || (e[2] = (s) => c.value = s),
78
+ visible: p.value,
79
+ "onUpdate:visible": e[2] || (e[2] = (a) => p.value = a),
79
80
  class: "min-w-[400px]",
80
81
  header: "List Approver",
81
82
  modal: ""
82
83
  }, {
83
84
  default: I(() => [
84
85
  l("div", S, [
85
- (a(!0), o(i, null, g(t.approvals, (s) => (a(), o(i, {
86
- key: s._id
86
+ (t(!0), o(i, null, k(s.approvals, (a) => (t(), o(i, {
87
+ key: a._id
87
88
  }, [
88
- l("div", U, [
89
- l("span", P, " Level " + r(s.level) + " (" + r(s.type.toLowerCase()) + ") ", 1),
90
- s.status !== "menunggu approval" ? (a(), h(w, {
89
+ l("div", T, [
90
+ l("span", U, [
91
+ a.level === 0 && u.customLevelZeroLabel ? (t(), o(i, { key: 0 }, [
92
+ w(r(u.customLevelZeroLabel), 1)
93
+ ], 64)) : (t(), o(i, { key: 1 }, [
94
+ w(" Level " + r(a.level) + " (" + r(a.type.toLowerCase()) + ") ", 1)
95
+ ], 64))
96
+ ]),
97
+ a.status !== "menunggu approval" ? (t(), g(L, {
91
98
  key: 0,
92
99
  label: "selesai",
93
100
  severity: "success"
94
- })) : k("", !0)
101
+ })) : h("", !0)
95
102
  ]),
96
- (a(!0), o(i, null, g(s.approvers, (n) => (a(), o("div", {
103
+ (t(!0), o(i, null, k(a.approvers, (n) => (t(), o("div", {
97
104
  key: n._id,
98
105
  class: "flex justify-between"
99
106
  }, [
100
- l("div", R, [
107
+ l("div", P, [
101
108
  m(A, {
102
109
  class: "!text-general-200 !text-base",
103
110
  icon: "user"
104
111
  }),
105
- l("span", T, r(n.fullName), 1)
112
+ l("span", R, r(n.fullName), 1)
106
113
  ]),
107
- s.status !== "menunggu approval" && !n.action ? (a(), o("span", q, " Tidak terlibat ")) : (a(), o("div", z, [
114
+ a.status !== "menunggu approval" && !n.action ? (t(), o("span", q, " Tidak terlibat ")) : (t(), o("div", z, [
108
115
  l("span", G, r(n.actionAt ? f(n.actionAt) : "Menunggu approval..."), 1),
109
- n.action ? (a(), h(w, {
116
+ n.action ? (t(), g(L, {
110
117
  key: 0,
111
118
  label: n.action,
112
119
  severity: j(n.action)
113
- }, null, 8, ["label", "severity"])) : k("", !0)
120
+ }, null, 8, ["label", "severity"])) : h("", !0)
114
121
  ]))
115
122
  ]))), 128))
116
123
  ], 64))), 128))
@@ -1,5 +1,6 @@
1
1
  import { shallowRef as J, ref as X, defineComponent as Y, onMounted as Z, computed as f, watch as ee, createElementBlock as c, openBlock as p, createVNode as m, createElementVNode as l, createCommentVNode as v, toDisplayString as k, Fragment as se, unref as W, normalizeClass as b } from "vue";
2
2
  import { AssetServices as ae } from "@tagsamurai/fats-api-services";
3
+ import "../utils/role.util.es.js";
3
4
  import { g as te } from "../utils/getStatusSeverity.util.es.js";
4
5
  import { u as le } from "../utils/toast.util.es.js";
5
6
  import { _ as h } from "../badge/index.es.js";
@@ -11,7 +12,7 @@ const q = J(!1), z = X(), ie = () => ({
11
12
  setLoading: (y, t) => {
12
13
  q.value = y, z.value = t, document.body.classList[y ? "add" : "remove"]("loading");
13
14
  }
14
- }), ue = { class: "flex justify-between gap-[18px] dark:text-general-100" }, re = { class: "w-full flex flex-col gap-[6px]" }, de = { class: "flex justify-between" }, ce = { class: "" }, pe = { class: "text-[16px] font-bold leading-[19.12px]" }, fe = { class: "flex items-center gap-[6px]" }, me = { class: "text-general-400 leading-[16.39px]" }, ve = ["href"], ge = { class: "flex flex-col gap-1" }, _e = {
15
+ }), re = { class: "flex justify-between gap-[18px] dark:text-general-100" }, ue = { class: "w-full flex flex-col gap-[6px]" }, de = { class: "flex justify-between" }, ce = { class: "" }, pe = { class: "text-[16px] font-bold leading-[19.12px]" }, fe = { class: "flex items-center gap-[6px]" }, me = { class: "text-general-400 leading-[16.39px]" }, ve = ["href"], ge = { class: "flex flex-col gap-1" }, _e = {
15
16
  key: 0,
16
17
  class: "flex gap-3"
17
18
  }, ye = {
@@ -23,7 +24,7 @@ const q = J(!1), z = X(), ie = () => ({
23
24
  }, be = {
24
25
  key: 3,
25
26
  class: "flex gap-3"
26
- }, Ne = /* @__PURE__ */ Y({
27
+ }, Se = /* @__PURE__ */ Y({
27
28
  __name: "AssetInfo",
28
29
  props: {
29
30
  id: {},
@@ -47,13 +48,13 @@ const q = J(!1), z = X(), ie = () => ({
47
48
  secondImageBig: n,
48
49
  assetImageBig: o,
49
50
  assetImage: i,
50
- firstImage: u,
51
- secondImage: r
51
+ firstImage: r,
52
+ secondImage: u
52
53
  } = e.value ?? {}, d = s === "firstImage";
53
- return t.transactionDetail ? i ?? o : d ? u ?? a : r ?? n;
54
+ return t.transactionDetail ? i ?? o : d ? r ?? a : u ?? n;
54
55
  }), K = f(() => {
55
- var s, a, n, o, i, u, r, d, g, _;
56
- return t.transactionDetail ? (n = (a = (s = e.value) == null ? void 0 : s.assetName) == null ? void 0 : a.aliasCode) != null && n.length ? `(${(i = (o = e.value) == null ? void 0 : o.assetName) == null ? void 0 : i.aliasCode})` : "" : (d = (r = (u = e.value) == null ? void 0 : u.name) == null ? void 0 : r.aliasCode) != null && d.length ? `(${(_ = (g = e.value) == null ? void 0 : g.name) == null ? void 0 : _.aliasCode})` : "";
56
+ var s, a, n, o, i, r, u, d, g, _;
57
+ return t.transactionDetail ? (n = (a = (s = e.value) == null ? void 0 : s.assetName) == null ? void 0 : a.aliasCode) != null && n.length ? `(${(i = (o = e.value) == null ? void 0 : o.assetName) == null ? void 0 : i.aliasCode})` : "" : (d = (u = (r = e.value) == null ? void 0 : r.name) == null ? void 0 : u.aliasCode) != null && d.length ? `(${(_ = (g = e.value) == null ? void 0 : g.name) == null ? void 0 : _.aliasCode})` : "";
57
58
  }), P = f(() => {
58
59
  var s, a;
59
60
  return ((s = e.value) == null ? void 0 : s.assetTagType) ?? ((a = e.value) == null ? void 0 : a.tagType);
@@ -83,10 +84,10 @@ const q = J(!1), z = X(), ie = () => ({
83
84
  },
84
85
  { deep: !0 }
85
86
  ), y({ asset: e }), (s, a) => {
86
- var n, o, i, u, r, d, g, _, D, B, N, S, C, A, $, L, E, F, M, V, j, G;
87
- return p(), c("div", ue, [
87
+ var n, o, i, r, u, d, g, _, D, B, N, S, C, A, $, L, E, F, M, V, j, G;
88
+ return p(), c("div", re, [
88
89
  m(ne, { src: H.value }, null, 8, ["src"]),
89
- l("div", re, [
90
+ l("div", ue, [
90
91
  l("div", de, [
91
92
  l("div", ce, [
92
93
  l("div", pe, k(((n = Q.value) == null ? void 0 : n.nameWithSequence) ?? "-"), 1),
@@ -103,13 +104,13 @@ const q = J(!1), z = X(), ie = () => ({
103
104
  ]),
104
105
  W(R).userType !== "Basic" ? (p(), c("a", {
105
106
  key: 0,
106
- href: `/assets/detail/${((i = e.value) == null ? void 0 : i.asset) ?? ((u = e.value) == null ? void 0 : u._id)}`,
107
+ href: `/assets/detail/${((i = e.value) == null ? void 0 : i.asset) ?? ((r = e.value) == null ? void 0 : r._id)}`,
107
108
  class: "text-primary-500",
108
109
  target: "_blank"
109
110
  }, " Asset Detail > ", 8, ve)) : v("", !0)
110
111
  ]),
111
112
  l("div", ge, [
112
- !t.fields || (r = t.fields) != null && r.includes("brand") ? (p(), c("div", _e, [
113
+ !t.fields || (u = t.fields) != null && u.includes("brand") ? (p(), c("div", _e, [
113
114
  l("span", {
114
115
  class: b(x.value)
115
116
  }, " Brand ", 2),
@@ -156,6 +157,6 @@ const q = J(!1), z = X(), ie = () => ({
156
157
  }
157
158
  });
158
159
  export {
159
- Ne as _,
160
+ Se as _,
160
161
  ie as u
161
162
  };
@@ -1,52 +1,52 @@
1
- import { reactive as P, defineComponent as _, mergeModels as q, useModel as U, ref as F, shallowRef as J, computed as M, watch as K, createElementBlock as x, openBlock as y, Fragment as B, renderList as T, createCommentVNode as z, mergeProps as I, withModifiers as g, createVNode as E } from "vue";
2
- import { _ as G } from "../checkbox/index.es.js";
3
- import { _ as H } from "../icon/index.es.js";
4
- import { c as Q } from "../vendor/lodash-es/cloneDeep.es.js";
5
- const W = (o, u, l) => {
6
- if (u && l > u) {
1
+ import { reactive as $, defineComponent as _, mergeModels as q, useModel as U, ref as J, shallowRef as K, computed as B, watch as T, createElementBlock as w, openBlock as k, Fragment as E, renderList as z, createCommentVNode as G, mergeProps as I, withModifiers as C, createVNode as A } from "vue";
2
+ import { _ as Q } from "../checkbox/index.es.js";
3
+ import { _ as W } from "../icon/index.es.js";
4
+ import { c as X } from "../vendor/lodash-es/cloneDeep.es.js";
5
+ const Y = (o, d, l) => {
6
+ if (d && l > d) {
7
7
  let r = 0;
8
8
  return o.map((n) => {
9
- const c = u !== void 0 && r < u, d = n.checkedByDefault !== !1 && u === void 0 || n.checkedByDefault !== !1 && c;
10
- return d && r++, {
9
+ const m = d !== void 0 && r < d, c = n.checkedByDefault !== !1 && d === void 0 || n.checkedByDefault !== !1 && m;
10
+ return c && r++, {
11
11
  ...n,
12
- visible: d
12
+ visible: c
13
13
  };
14
14
  });
15
15
  }
16
16
  return o;
17
- }, b = "tableConfigs", X = () => "user-" + (JSON.parse(localStorage.getItem("user") ?? "{}")._id ?? "unknown"), A = async () => {
17
+ }, x = "tableConfigs", Z = () => "user-" + (JSON.parse(localStorage.getItem("user") ?? "{}")._id ?? "unknown"), N = async () => {
18
18
  let o = null;
19
- return new Promise((u) => {
20
- const l = indexedDB.open(X(), 1);
19
+ return new Promise((d) => {
20
+ const l = indexedDB.open(Z(), 1);
21
21
  l.onupgradeneeded = (r) => {
22
- o = r.target.result, o.createObjectStore(b);
22
+ o = r.target.result, o.createObjectStore(x);
23
23
  }, l.onsuccess = (r) => {
24
- o = r.target.result, u(o);
24
+ o = r.target.result, d(o);
25
25
  };
26
26
  });
27
- }, Y = async () => {
28
- const l = (await A()).transaction(b, "readonly").objectStore(b);
27
+ }, ee = async () => {
28
+ const l = (await N()).transaction(x, "readonly").objectStore(x);
29
29
  return new Promise((r) => {
30
- let n, c;
31
- l.getAllKeys().onsuccess = (d) => {
32
- n = d.target.result;
33
- }, l.getAll().onsuccess = (d) => {
34
- c = d.target.result;
35
- const v = {};
36
- n.forEach((m, p) => {
37
- v[m] = c[p];
38
- }), r(v);
30
+ let n, m;
31
+ l.getAllKeys().onsuccess = (c) => {
32
+ n = c.target.result;
33
+ }, l.getAll().onsuccess = (c) => {
34
+ m = c.target.result;
35
+ const b = {};
36
+ n.forEach((g, y) => {
37
+ b[g] = m[y];
38
+ }), r(b);
39
39
  };
40
40
  });
41
- }, h = P({}), Z = async () => {
42
- const o = async (u, l) => {
43
- h[u] = l, (await A()).transaction(b, "readwrite").objectStore(b).put(l, u);
41
+ }, S = $({}), te = async () => {
42
+ const o = async (d, l) => {
43
+ S[d] = l, (await N()).transaction(x, "readwrite").objectStore(x).put(l, d);
44
44
  };
45
- return Object.assign(h, await Y()), {
46
- config: h,
45
+ return Object.assign(S, await ee()), {
46
+ config: S,
47
47
  setConfig: o
48
48
  };
49
- }, ee = ["id", "data-item-dragable", "draggable", "onDragenter", "onDragstart"], se = /* @__PURE__ */ _({
49
+ }, ae = ["id", "data-item-dragable", "draggable", "onDragenter", "onDragstart"], re = /* @__PURE__ */ _({
50
50
  __name: "ColumnList",
51
51
  props: /* @__PURE__ */ q({
52
52
  tableId: {},
@@ -60,88 +60,110 @@ const W = (o, u, l) => {
60
60
  modelModifiers: {}
61
61
  }),
62
62
  emits: ["update:modelValue"],
63
- setup(o, { expose: u }) {
64
- const l = o, r = U(o, "modelValue"), n = F([]), c = J(), d = M(() => [...n.value].filter((a) => a.visible !== !1)), v = M(() => l.maxColumn ? d.value.length >= l.maxColumn : !1), m = (a) => a.dragable !== !1 && p(a), p = (a) => {
65
- if (!v.value) return !0;
63
+ setup(o, { expose: d }) {
64
+ const l = o, r = U(o, "modelValue"), n = J([]), m = K(), c = B(() => [...n.value].filter((a) => a.visible !== !1)), b = B(() => l.maxColumn ? c.value.length >= l.maxColumn : !1), g = (a) => a.dragable !== !1 && y(a), y = (a) => {
65
+ if (!b.value) return !0;
66
66
  const t = r.value.findIndex((e) => e.field === a.field) > 0;
67
- return v.value && t;
68
- }, S = () => {
69
- n.value = W(
67
+ return b.value && t;
68
+ }, H = (a) => {
69
+ const t = [];
70
+ for (const e of a)
71
+ if (e.parentHeader) {
72
+ const s = t.find(
73
+ (f) => f.parentHeaderField === e.parentHeader.field
74
+ );
75
+ s ? s.siblingHeaders.push(e) : t.push({
76
+ ...e,
77
+ parentHeaderField: e.parentHeader.field,
78
+ siblingHeaders: []
79
+ });
80
+ } else
81
+ t.push(e);
82
+ return t;
83
+ }, D = (a) => {
84
+ const t = [];
85
+ for (const e of a)
86
+ e.parentHeaderField ? t.push(e, ...e.siblingHeaders) : t.push(e);
87
+ return t;
88
+ }, V = () => {
89
+ n.value = Y(
70
90
  n.value,
71
91
  l.maxColumn,
72
- d.value.length
73
- ), r.value = [...d.value];
74
- }, C = async () => {
75
- const a = n.value.map(
76
- (e) => ({
77
- field: e.field,
78
- width: e.width ?? "max-content",
79
- visible: e.visible !== !1,
80
- fixed: !!e.fixed
81
- })
82
- ), { setConfig: t } = await Z();
92
+ c.value.length
93
+ ), r.value = D([...c.value]);
94
+ }, h = async () => {
95
+ const a = D(
96
+ n.value
97
+ ).map((e) => ({
98
+ field: e.field,
99
+ width: e.width ?? "max-content",
100
+ visible: e.visible !== !1,
101
+ fixed: !!e.fixed
102
+ })), { setConfig: t } = await te();
83
103
  await t(l.tableId, a);
84
- }, N = () => {
85
- r.value = [...n.value];
86
- }, R = (a, t, e) => {
87
- const { dataTransfer: i } = a;
88
- c.value = t, i && (i.dropEffect = "move", i.effectAllowed = "move", i.setData("field", t.field), i.setData("index", e.toString()));
89
- }, L = async () => {
90
- c.value = void 0, N(), await C();
91
- }, j = (a, t) => {
92
- var e, i;
93
- if (a.preventDefault(), m(t)) {
94
- const f = a.target, s = f.tagName === "LI" ? f : f.closest("li");
95
- if (s == null || s.classList.add("bg-primary-50"), (e = s == null ? void 0 : s.nextElementSibling) == null || e.classList.remove("bg-primary-50"), (i = s == null ? void 0 : s.previousElementSibling) == null || i.classList.remove("bg-primary-50"), !s || !c.value) return;
96
- const D = n.value.findIndex(
97
- (k) => {
98
- var V;
99
- return k.field === ((V = c.value) == null ? void 0 : V.field);
104
+ }, R = () => {
105
+ r.value = D([...n.value]);
106
+ }, L = (a, t, e) => {
107
+ const { dataTransfer: s } = a;
108
+ m.value = t, s && (s.dropEffect = "move", s.effectAllowed = "move", s.setData("field", t.field), s.setData("index", e.toString()));
109
+ }, j = async () => {
110
+ m.value = void 0, R(), await h();
111
+ }, F = (a, t) => {
112
+ var e, s;
113
+ if (a.preventDefault(), g(t)) {
114
+ const f = a.target, u = f.tagName === "LI" ? f : f.closest("li");
115
+ if (u == null || u.classList.add("bg-primary-50"), (e = u == null ? void 0 : u.nextElementSibling) == null || e.classList.remove("bg-primary-50"), (s = u == null ? void 0 : u.previousElementSibling) == null || s.classList.remove("bg-primary-50"), !u || !m.value) return;
116
+ const i = n.value.findIndex(
117
+ (p) => {
118
+ var M;
119
+ return p.field === ((M = m.value) == null ? void 0 : M.field);
100
120
  }
101
- ), w = n.value.findIndex(
102
- (k) => k.field === s.id
121
+ ), v = n.value.findIndex(
122
+ (p) => p.field === u.id
103
123
  );
104
- D !== -1 && w !== -1 && ([
105
- n.value[D],
106
- n.value[w]
124
+ i !== -1 && v !== -1 && ([
125
+ n.value[i],
126
+ n.value[v]
107
127
  ] = [
108
- n.value[w],
109
- n.value[D]
128
+ n.value[v],
129
+ n.value[i]
110
130
  ]);
111
131
  }
112
132
  }, O = (a) => {
113
133
  const t = a.target.querySelector("label");
114
134
  t && t.click();
115
- }, $ = () => {
116
- const a = Q(l.defaultColumns);
135
+ }, P = () => {
136
+ const a = X(l.defaultColumns);
117
137
  if (l.maxColumn && a.length > l.maxColumn) {
118
138
  let t = 0;
119
- n.value = a.map((e) => {
120
- const i = l.maxColumn !== void 0 && t < l.maxColumn, f = e.checkedByDefault !== !1 && l.maxColumn === void 0 || e.checkedByDefault !== !1 && i;
121
- return f && t++, {
122
- ...e,
123
- visible: f
124
- };
125
- });
139
+ n.value = H(
140
+ a.map((e) => {
141
+ const s = l.maxColumn !== void 0 && t < l.maxColumn, f = e.checkedByDefault !== !1 && l.maxColumn === void 0 || e.checkedByDefault !== !1 && s;
142
+ return f && t++, {
143
+ ...e,
144
+ visible: f
145
+ };
146
+ })
147
+ );
126
148
  } else
127
- n.value = a;
128
- r.value = [...d.value], C();
149
+ n.value = H(a);
150
+ r.value = D([...c.value]), h();
129
151
  };
130
- return K(
152
+ return T(
131
153
  () => l.savedColumns,
132
154
  (a) => {
133
- n.value = a ?? [];
155
+ n.value = H(a) ?? [];
134
156
  },
135
157
  { immediate: !0 }
136
- ), u({
137
- setColumnVisibilityConfig: C,
138
- resetToDefault: $,
139
- updateVisibleColumnsModel: S
140
- }), (a, t) => (y(), x("ul", null, [
141
- (y(!0), x(B, null, T(n.value, (e, i) => {
142
- var f;
143
- return y(), x(B, null, [
144
- e.reorderable !== !1 ? (y(), x("li", I(
158
+ ), d({
159
+ setColumnVisibilityConfig: h,
160
+ resetToDefault: P,
161
+ updateVisibleColumnsModel: V
162
+ }), (a, t) => (k(), w("ul", null, [
163
+ (k(!0), w(E, null, z(n.value, (e, s) => {
164
+ var f, u;
165
+ return k(), w(E, null, [
166
+ e.reorderable !== !1 ? (k(), w("li", I(
145
167
  {
146
168
  id: e.field,
147
169
  key: e.field,
@@ -149,56 +171,59 @@ const W = (o, u, l) => {
149
171
  },
150
172
  a.$preset.customcolumn.menuitem({
151
173
  props: l,
152
- context: { dragable: m(e) }
174
+ context: { dragable: g(e) }
153
175
  }),
154
176
  {
155
- "data-item-dragable": m(e),
156
- draggable: m(e),
177
+ "data-item-dragable": g(e),
178
+ draggable: g(e),
157
179
  onClick: O,
158
- onDragend: L,
159
- onDragenter: g((s) => j(s, e), ["prevent"]),
160
- onDragleave: t[2] || (t[2] = g(() => {
180
+ onDragend: j,
181
+ onDragenter: C((i) => F(i, e), ["prevent"]),
182
+ onDragleave: t[2] || (t[2] = C(() => {
161
183
  }, ["prevent"])),
162
- onDragover: t[3] || (t[3] = g(() => {
184
+ onDragover: t[3] || (t[3] = C(() => {
163
185
  }, ["prevent"])),
164
- onDragstart: (s) => R(s, e, i),
165
- onMouseenter: t[4] || (t[4] = (s) => s.target.classList.add("bg-primary-50")),
166
- onMouseleave: t[5] || (t[5] = (s) => s.target.classList.remove("bg-primary-50")),
186
+ onDragstart: (i) => L(i, e, s),
187
+ onMouseenter: t[4] || (t[4] = (i) => i.target.classList.add("bg-primary-50")),
188
+ onMouseleave: t[5] || (t[5] = (i) => i.target.classList.remove("bg-primary-50")),
167
189
  "data-wv-section": "custom-column-menu-item"
168
190
  }
169
191
  ), [
170
- E(H, I(
192
+ A(W, I(
171
193
  {
172
- onClick: t[0] || (t[0] = g(() => {
194
+ onClick: t[0] || (t[0] = C(() => {
173
195
  }, ["stop"])),
174
196
  ref_for: !0
175
197
  },
176
198
  (f = a.$preset.customcolumn) == null ? void 0 : f.dragicon({
177
- context: { dragable: m(e) }
199
+ context: { dragable: g(e) }
178
200
  }),
179
201
  { icon: "dragable-menu" }
180
202
  ), null, 16),
181
- E(G, {
203
+ A(Q, {
182
204
  "aria-label": e.header,
183
205
  disabled: e.fixed,
184
- label: e.header,
206
+ label: ((u = e.parentHeader) == null ? void 0 : u.header) ?? e.header,
185
207
  "model-value": e.visible !== !1,
186
- selectable: p(e),
187
- onClick: t[1] || (t[1] = g(() => {
208
+ selectable: y(e),
209
+ onClick: t[1] || (t[1] = C(() => {
188
210
  }, ["stop"])),
189
- "onUpdate:modelValue": (s) => {
190
- e.visible = !!s, S(), C();
211
+ "onUpdate:modelValue": (i) => {
212
+ var v;
213
+ e.visible = !!i, (v = e.siblingHeaders) == null || v.forEach((p) => {
214
+ p.visible = !!i;
215
+ }), V(), h();
191
216
  },
192
217
  class: "!w-full"
193
218
  }, null, 8, ["aria-label", "disabled", "label", "model-value", "selectable", "onUpdate:modelValue"])
194
- ], 16, ee)) : z("", !0)
219
+ ], 16, ae)) : G("", !0)
195
220
  ], 64);
196
221
  }), 256))
197
222
  ]));
198
223
  }
199
224
  });
200
225
  export {
201
- se as _,
202
- W as s,
203
- Z as u
226
+ re as _,
227
+ Y as s,
228
+ te as u
204
229
  };
@@ -5,7 +5,11 @@ export interface CustomColumnLocaleConfig {
5
5
  resetDefaultText: string;
6
6
  }
7
7
 
8
- export type DragableColumn = TableColumn & { order?: number };
8
+ export type DragableColumn = TableColumn & {
9
+ order?: number;
10
+ parentHeaderField?: string;
11
+ siblingHeaders?: TableColumn[];
12
+ };
9
13
 
10
14
  export interface CustomColumnProps {
11
15
  tableId: string;
@@ -1,5 +1,6 @@
1
1
  import { defineComponent as W, computed as b, ref as k, watch as T, createBlock as L, openBlock as n, mergeProps as j, createSlots as G, withCtx as C, createElementVNode as m, createVNode as S, createElementBlock as i, createCommentVNode as $, Fragment as u, renderList as w, toDisplayString as p } from "vue";
2
2
  import { AssetServices as J } from "@tagsamurai/fats-api-services";
3
+ import "../utils/role.util.es.js";
3
4
  import { u as O } from "../utils/toast.util.es.js";
4
5
  import { _ as P } from "../button/index.es.js";
5
6
  import { _ as R } from "../dialogconfirm/index.es.js";
@@ -15,7 +16,7 @@ const D = { class: "flex flex-col gap-3 justify-between" }, H = { class: "flex f
15
16
  key: 3,
16
17
  class: "text-general-800 font-medium",
17
18
  "data-ts-section": "confirmbody"
18
- }, ne = /* @__PURE__ */ W({
19
+ }, ae = /* @__PURE__ */ W({
19
20
  __name: "DialogLinkedAsset",
20
21
  props: {
21
22
  header: {},
@@ -153,5 +154,5 @@ const D = { class: "flex flex-col gap-3 justify-between" }, H = { class: "flex f
153
154
  }
154
155
  });
155
156
  export {
156
- ne as _
157
+ ae as _
157
158
  };
@@ -11,7 +11,7 @@ const R = () => u([
11
11
  {
12
12
  field: "profilePictureSmall",
13
13
  header: "Photo",
14
- sortable: !0,
14
+ sortable: !1,
15
15
  bodyComponent(e) {
16
16
  return {
17
17
  component: I,