@ironsource/shared-ui 2.1.11-rc.24 → 2.1.11-rc.25

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,121 +1,121 @@
1
- import { useSlots as G, ref as c, provide as N, computed as s, onMounted as V, nextTick as j } from "vue";
1
+ import { useSlots as G, ref as a, provide as N, computed as l, onMounted as V, nextTick as j } from "vue";
2
2
  import { useVirtualList as q, useInfiniteScroll as F } from "@vueuse/core";
3
3
  import { TableContext as J } from "./TableContext.js";
4
- const Q = 46, U = 46, tt = (e, u) => {
5
- const S = G(), a = c([]);
4
+ const Q = 46, U = 46, tt = (e, d) => {
5
+ const y = G(), u = a([]);
6
6
  N(J, {
7
- onClose({ rowIndex: t, cellIndex: o, value: l } = {}) {
8
- a.value = [...a.value, t], u("saveRow", {
7
+ onClose({ rowIndex: t, cellIndex: o, value: s } = {}) {
8
+ u.value = [...u.value, t], d("saveRow", {
9
9
  rowIndex: t,
10
10
  cellIndex: o,
11
- value: l,
11
+ value: s,
12
12
  confirm: () => {
13
- a.value = a.value.filter((n) => n !== t);
13
+ u.value = u.value.filter((n) => n !== t);
14
14
  }
15
15
  });
16
16
  },
17
17
  setActiveMenuRow(t) {
18
- x.value = t;
18
+ R.value = t;
19
19
  }
20
20
  });
21
- const y = s(() => !!e.selection), C = s(() => {
22
- const t = (y.value ? `${U}px ` : "") + (g.value ? `${Q}px ` : "");
23
- return e.columns.reduce((o, l) => {
24
- const n = l.width ? `${l.width}px` : `${l.colSpan || 1}fr`;
25
- return `${o} ${n}`;
21
+ const x = l(() => !!e.selection), b = l(() => {
22
+ const t = (x.value ? `${U}px ` : "") + (g.value ? `${Q}px ` : "");
23
+ return e.columns.reduce((o, { width: s, colSpan: n }) => {
24
+ const i = typeof s == "number" ? `${s}px` : s, m = i || `${n || 1}fr`;
25
+ return `${o} ${m}`;
26
26
  }, t);
27
- }), g = s(() => !!S.expanded), A = c(null), x = c(null), R = s(() => Array(e.loadingRowCount).fill(
27
+ }), g = l(() => !!y.expanded), A = a(null), R = a(null), T = l(() => Array(e.loadingRowCount).fill(
28
28
  Array(e.columns.length).fill("")
29
- )), H = s(() => e.rows.length && Array.isArray(e.rows[0]) ? e.isLoading ? [...e.rows, ...R.value] : e.rows : e.isLoading ? [
29
+ )), H = l(() => e.rows.length && Array.isArray(e.rows[0]) ? e.isLoading ? [...e.rows, ...T.value] : e.rows : e.isLoading ? [
30
30
  ...e.rows.map((o) => o[e.rowDataKey]),
31
- ...R.value
32
- ] : e.rows.map((o) => o[e.rowDataKey])), { list: T, containerProps: i, wrapperProps: $, scrollTo: b } = q(
31
+ ...T.value
32
+ ] : e.rows.map((o) => o[e.rowDataKey])), { list: C, containerProps: r, wrapperProps: $, scrollTo: k } = q(
33
33
  H,
34
34
  {
35
35
  itemHeight: g.value ? (t) => w[t] ?? e.rowHeight : e.rowHeight
36
36
  }
37
- ), k = c(null), h = c(0), B = s(() => !!S.search), I = (t) => {
38
- i.onScroll(), h.value = t.target.scrollLeft + t.target.getBoundingClientRect().width, u("onScroll", t.target.scrollTop);
37
+ ), B = a(null), h = a(0), I = l(() => !!y.search), O = (t) => {
38
+ r.onScroll(), h.value = t.target.scrollLeft + t.target.getBoundingClientRect().width, d("onScroll", t.target.scrollTop);
39
39
  };
40
40
  V(() => {
41
- h.value = i.ref.value?.getBoundingClientRect().width, e.defaultScrollPosition && setTimeout(() => {
42
- i.ref.value?.scrollTo({
41
+ h.value = r.ref.value?.getBoundingClientRect().width, e.defaultScrollPosition && setTimeout(() => {
42
+ r.ref.value?.scrollTo({
43
43
  top: e.defaultScrollPosition,
44
44
  behavior: "smooth"
45
45
  });
46
46
  }, 300);
47
47
  });
48
- const O = s(() => {
49
- const [t] = T.value;
48
+ const P = l(() => {
49
+ const [t] = C.value;
50
50
  return t && t.index > 0;
51
- }), P = s(() => i.style), L = s(() => e.columns.reduce((t, o) => (o.isSticky && (t[o.id] = M(o)), t), {}));
51
+ }), L = l(() => r.style), E = l(() => e.columns.reduce((t, o) => (o.isSticky && (t[o.id] = _(o)), t), {}));
52
52
  F(
53
- i.ref,
53
+ r.ref,
54
54
  () => {
55
- e.isInfiniteScroll && u("loadMore");
55
+ e.isInfiniteScroll && d("loadMore");
56
56
  },
57
57
  { distance: e.infiniteScrollThreshold }
58
58
  );
59
- function E() {
60
- i.ref.value?.scrollTo({
59
+ function D() {
60
+ r.ref.value?.scrollTo({
61
61
  top: 0,
62
62
  behavior: "smooth"
63
63
  });
64
64
  }
65
- function D(t) {
65
+ function M(t) {
66
66
  if (!e.sort)
67
67
  return;
68
68
  const o = e.sort.sortBy === t.id;
69
69
  if (!(t.isSortable || t.isSortable === void 0))
70
70
  return;
71
- let n = e.sort.sortOrder, f = e.sort.sortBy;
72
- o ? n = e.sort.sortOrder === "asc" ? "desc" : "asc" : f = t.id, u("update:sort", { sortBy: f, sortOrder: n });
71
+ let n = e.sort.sortOrder, i = e.sort.sortBy;
72
+ o ? n = e.sort.sortOrder === "asc" ? "desc" : "asc" : i = t.id, d("update:sort", { sortBy: i, sortOrder: n });
73
73
  }
74
- function M(t) {
75
- const { isSticky: o, width: l } = t;
76
- if (!o || !l)
74
+ function _(t) {
75
+ const { isSticky: o, width: s } = t;
76
+ if (!o || !s)
77
77
  return null;
78
- const n = e.columns.findIndex((r) => r.id === t.id), f = e.columns.reduce((r, v, m) => m < n ? r + v.width : r, 0), z = e.columns.reduce((r, v, m) => m > n ? r + v.width : r, 0);
78
+ const n = e.columns.findIndex((c) => c.id === t.id), i = e.columns.reduce((c, v, S) => S < n ? c + v.width : c, 0), m = e.columns.reduce((c, v, S) => S > n ? c + v.width : c, 0);
79
79
  return {
80
- ...t.isStickyRight ? { right: `${z}px` } : { left: `${f}px` },
80
+ ...t.isStickyRight ? { right: `${m}px` } : { left: `${i}px` },
81
81
  zIndex: 1
82
82
  };
83
83
  }
84
- const d = c([]), w = {}, _ = (t) => d.value.includes(t), K = async (t, o) => {
85
- const l = d.value.indexOf(t);
86
- if (l === -1) {
87
- d.value.push(t);
84
+ const f = a([]), w = {}, K = (t) => f.value.includes(t), W = async (t, o) => {
85
+ const s = f.value.indexOf(t);
86
+ if (s === -1) {
87
+ f.value.push(t);
88
88
  const n = o.target.closest("tr");
89
89
  await j(), n && (w[t] = n.offsetHeight);
90
90
  } else
91
- d.value.splice(l, 1), delete w[t];
92
- }, W = s(() => `${e.rowHeight}px`), X = s(
91
+ f.value.splice(s, 1), delete w[t];
92
+ }, X = l(() => `${e.rowHeight}px`), z = l(
93
93
  () => `1 / span ${e.columns.length + 1}`
94
94
  );
95
95
  return {
96
- list: T,
97
- containerProps: i,
96
+ list: C,
97
+ containerProps: r,
98
98
  wrapperProps: $,
99
99
  activeRow: A,
100
- gridColumnTemplate: C,
101
- floatingActionRef: k,
102
- scrollToTop: E,
103
- toggleSortOrder: D,
104
- columnsStickyPositions: L,
105
- hasSearchSlot: B,
106
- showBackToTopButton: O,
107
- containerStyle: P,
108
- onScroll: I,
109
- scrollTo: b,
110
- savingRows: a,
100
+ gridColumnTemplate: b,
101
+ floatingActionRef: B,
102
+ scrollToTop: D,
103
+ toggleSortOrder: M,
104
+ columnsStickyPositions: E,
105
+ hasSearchSlot: I,
106
+ showBackToTopButton: P,
107
+ containerStyle: L,
108
+ onScroll: O,
109
+ scrollTo: k,
110
+ savingRows: u,
111
111
  floatingActionPosition: h,
112
112
  hasExpandSlot: g,
113
- hasCheckboxes: y,
114
- toggleExpandRow: K,
115
- isRowExpanded: _,
116
- cssRowHeight: W,
117
- cssExpandGridCol: X,
118
- activeMenuRow: x
113
+ hasCheckboxes: x,
114
+ toggleExpandRow: W,
115
+ isRowExpanded: K,
116
+ cssRowHeight: X,
117
+ cssExpandGridCol: z,
118
+ activeMenuRow: R
119
119
  };
120
120
  };
121
121
  export {
@@ -7,7 +7,7 @@ export type Column = {
7
7
  isBordered?: boolean;
8
8
  isSortable?: boolean;
9
9
  colSpan?: number;
10
- width?: number;
10
+ width?: number | string;
11
11
  isTextRight?: boolean;
12
12
  isStickyRight?: boolean;
13
13
  helpText?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ironsource/shared-ui",
3
- "version": "2.1.11-rc.24",
3
+ "version": "2.1.11-rc.25",
4
4
  "engines": {
5
5
  "npm": ">=7.0.0",
6
6
  "node": ">=16.0.0"