@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
|
|
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,
|
|
5
|
-
const
|
|
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:
|
|
8
|
-
|
|
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:
|
|
11
|
+
value: s,
|
|
12
12
|
confirm: () => {
|
|
13
|
-
|
|
13
|
+
u.value = u.value.filter((n) => n !== t);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
},
|
|
17
17
|
setActiveMenuRow(t) {
|
|
18
|
-
|
|
18
|
+
R.value = t;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
const
|
|
22
|
-
const t = (
|
|
23
|
-
return e.columns.reduce((o,
|
|
24
|
-
const
|
|
25
|
-
return `${o} ${
|
|
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 =
|
|
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 =
|
|
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
|
-
...
|
|
32
|
-
] : e.rows.map((o) => o[e.rowDataKey])), { list:
|
|
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
|
-
),
|
|
38
|
-
|
|
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 =
|
|
42
|
-
|
|
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
|
|
49
|
-
const [t] =
|
|
48
|
+
const P = l(() => {
|
|
49
|
+
const [t] = C.value;
|
|
50
50
|
return t && t.index > 0;
|
|
51
|
-
}),
|
|
51
|
+
}), L = l(() => r.style), E = l(() => e.columns.reduce((t, o) => (o.isSticky && (t[o.id] = _(o)), t), {}));
|
|
52
52
|
F(
|
|
53
|
-
|
|
53
|
+
r.ref,
|
|
54
54
|
() => {
|
|
55
|
-
e.isInfiniteScroll &&
|
|
55
|
+
e.isInfiniteScroll && d("loadMore");
|
|
56
56
|
},
|
|
57
57
|
{ distance: e.infiniteScrollThreshold }
|
|
58
58
|
);
|
|
59
|
-
function
|
|
60
|
-
|
|
59
|
+
function D() {
|
|
60
|
+
r.ref.value?.scrollTo({
|
|
61
61
|
top: 0,
|
|
62
62
|
behavior: "smooth"
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function
|
|
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,
|
|
72
|
-
o ? n = e.sort.sortOrder === "asc" ? "desc" : "asc" :
|
|
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
|
|
75
|
-
const { isSticky: o, width:
|
|
76
|
-
if (!o || !
|
|
74
|
+
function _(t) {
|
|
75
|
+
const { isSticky: o, width: s } = t;
|
|
76
|
+
if (!o || !s)
|
|
77
77
|
return null;
|
|
78
|
-
const n = e.columns.findIndex((
|
|
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: `${
|
|
80
|
+
...t.isStickyRight ? { right: `${m}px` } : { left: `${i}px` },
|
|
81
81
|
zIndex: 1
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
|
|
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
|
-
|
|
92
|
-
},
|
|
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:
|
|
97
|
-
containerProps:
|
|
96
|
+
list: C,
|
|
97
|
+
containerProps: r,
|
|
98
98
|
wrapperProps: $,
|
|
99
99
|
activeRow: A,
|
|
100
|
-
gridColumnTemplate:
|
|
101
|
-
floatingActionRef:
|
|
102
|
-
scrollToTop:
|
|
103
|
-
toggleSortOrder:
|
|
104
|
-
columnsStickyPositions:
|
|
105
|
-
hasSearchSlot:
|
|
106
|
-
showBackToTopButton:
|
|
107
|
-
containerStyle:
|
|
108
|
-
onScroll:
|
|
109
|
-
scrollTo:
|
|
110
|
-
savingRows:
|
|
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:
|
|
114
|
-
toggleExpandRow:
|
|
115
|
-
isRowExpanded:
|
|
116
|
-
cssRowHeight:
|
|
117
|
-
cssExpandGridCol:
|
|
118
|
-
activeMenuRow:
|
|
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 {
|