@jetbrains/ring-ui-built 8.0.0-beta.4 → 8.0.0-beta.5
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.
- package/components/_helpers/alert.js +3 -0
- package/components/_helpers/caption.js +1 -1
- package/components/_helpers/header.js +1 -1
- package/components/_helpers/table.js +1 -1
- package/components/alert/alert-actions.d.ts +4 -0
- package/components/alert/alert-actions.js +51 -0
- package/components/alert/alert-heading.d.ts +4 -0
- package/components/alert/alert-heading.js +62 -0
- package/components/alert/alert.d.ts +14 -1
- package/components/alert/alert.js +43 -25
- package/components/alert-service/alert-service.d.ts +2 -1
- package/components/alert-service/alert-service.js +15 -5
- package/components/auth/auth-core.d.ts +5 -9
- package/components/auth/auth-core.js +71 -17
- package/components/auth/auth.js +7 -1
- package/components/auth/down-notification.js +7 -1
- package/components/auth/storage.js +7 -1
- package/components/clipboard/clipboard.js +7 -1
- package/components/date-picker/consts.d.ts +1 -0
- package/components/date-picker/date-input.js +3 -2
- package/components/header/header.js +7 -1
- package/components/header/smart-profile.js +7 -1
- package/components/http/http.d.ts +2 -2
- package/components/http/http.js +2 -2
- package/components/i18n/i18n.d.ts +1 -0
- package/components/i18n/i18n.js +2 -0
- package/components/internal/reorder-animation-context.js +159 -0
- package/components/internal/reorder-handle.js +750 -0
- package/components/internal/reorder-layout-context.js +141 -0
- package/components/internal/table-header.js +221 -645
- package/components/internal/{virtual-items.js → virtualization.js} +29 -14
- package/components/old-browsers-message/white-list.js +2 -2
- package/components/storage/storage-local.js +7 -1
- package/components/storage/storage.js +7 -1
- package/components/style.css +1 -1
- package/components/table/default-item-renderer.d.ts +7 -1
- package/components/table/default-item-renderer.js +119 -67
- package/components/table/internal/reorder-animation-context.d.ts +21 -0
- package/components/table/internal/reorder-handle.d.ts +9 -0
- package/components/table/internal/reorder-layout-context.d.ts +16 -0
- package/components/table/internal/table-header.d.ts +1 -4
- package/components/table/internal/{virtual-items.d.ts → virtualization.d.ts} +10 -3
- package/components/table/item-virtualization.d.ts +5 -3
- package/components/table/item-virtualization.js +13 -11
- package/components/table/reorder-animation.d.ts +37 -0
- package/components/table/reorder-animation.js +18 -0
- package/components/table/reorder-item-layout.d.ts +32 -0
- package/components/table/reorder-item-layout.js +57 -0
- package/components/table/table-const.d.ts +0 -32
- package/components/table/table-const.js +1 -8
- package/components/table/table-primitives.d.ts +43 -0
- package/components/table/table-primitives.js +62 -5
- package/components/table/table-props.d.ts +29 -5
- package/components/table/table.d.ts +31 -5
- package/components/table/table.js +177 -170
- package/components/user-agreement/service.js +7 -1
- package/components/user-card/card.js +7 -1
- package/components/user-card/smart-user-card-tooltip.d.ts +1 -1
- package/components/user-card/smart-user-card-tooltip.js +7 -1
- package/components/user-card/tooltip.js +7 -1
- package/components/user-card/user-card.js +7 -1
- package/components/util-stories.d.ts +2 -2
- package/package.json +2 -2
- package/components/internal/column-animation.js +0 -133
- package/components/table/internal/column-animation.d.ts +0 -16
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { createContext, useRef } from 'react';
|
|
3
|
+
|
|
4
|
+
const ReorderLayoutContext = /*#__PURE__*/createContext({
|
|
5
|
+
registerReorderItem: () => () => {},
|
|
6
|
+
getItemBounds: () => undefined,
|
|
7
|
+
getClosestInsertionPoint: () => undefined
|
|
8
|
+
});
|
|
9
|
+
function useReorderLayoutContextValue() {
|
|
10
|
+
const $ = c(5);
|
|
11
|
+
if ($[0] !== "51d04139cf14f94fc3f354b9f5fd1983ccf84891cbc7a0b51772db425d0c409c") {
|
|
12
|
+
for (let $i = 0; $i < 5; $i += 1) {
|
|
13
|
+
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
14
|
+
}
|
|
15
|
+
$[0] = "51d04139cf14f94fc3f354b9f5fd1983ccf84891cbc7a0b51772db425d0c409c";
|
|
16
|
+
}
|
|
17
|
+
let t0;
|
|
18
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
19
|
+
t0 = [];
|
|
20
|
+
$[1] = t0;
|
|
21
|
+
} else {
|
|
22
|
+
t0 = $[1];
|
|
23
|
+
}
|
|
24
|
+
const getBoundsByItemIndex = useRef(t0);
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
27
|
+
t1 = function registerReorderItem(index, getBounds) {
|
|
28
|
+
getBoundsByItemIndex.current[index] = getBounds;
|
|
29
|
+
return () => {
|
|
30
|
+
delete getBoundsByItemIndex.current[index];
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
$[2] = t1;
|
|
34
|
+
} else {
|
|
35
|
+
t1 = $[2];
|
|
36
|
+
}
|
|
37
|
+
const registerReorderItem = t1;
|
|
38
|
+
let t2;
|
|
39
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
40
|
+
t2 = function getItemBounds(index_0) {
|
|
41
|
+
const getBounds_0 = getBoundsByItemIndex.current[index_0];
|
|
42
|
+
return getBounds_0?.();
|
|
43
|
+
};
|
|
44
|
+
$[3] = t2;
|
|
45
|
+
} else {
|
|
46
|
+
t2 = $[3];
|
|
47
|
+
}
|
|
48
|
+
const getItemBounds = t2;
|
|
49
|
+
let t3;
|
|
50
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
51
|
+
const getClosestInsertionPoint = function getClosestInsertionPoint(clientOffset, canReorder) {
|
|
52
|
+
const candidates = getBoundsByItemIndex.current.map((getBounds_1, itemIndex) => ({
|
|
53
|
+
itemIndex,
|
|
54
|
+
getBounds: getBounds_1,
|
|
55
|
+
beforeAllowed: canReorder(itemIndex),
|
|
56
|
+
afterAllowed: canReorder(itemIndex + 1)
|
|
57
|
+
})).filter(_temp);
|
|
58
|
+
if (!candidates.length) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const closest = [];
|
|
62
|
+
const computeClosest = function computeClosest(i) {
|
|
63
|
+
if (!closest[i]) {
|
|
64
|
+
const {
|
|
65
|
+
getBounds: getBounds_2,
|
|
66
|
+
beforeAllowed: beforeAllowed_0,
|
|
67
|
+
afterAllowed: afterAllowed_0
|
|
68
|
+
} = candidates[i];
|
|
69
|
+
const {
|
|
70
|
+
start,
|
|
71
|
+
end
|
|
72
|
+
} = getBounds_2();
|
|
73
|
+
const beforeDist = Math.abs(clientOffset - start);
|
|
74
|
+
const afterDist = Math.abs(clientOffset - end);
|
|
75
|
+
if (!afterAllowed_0) {
|
|
76
|
+
closest[i] = {
|
|
77
|
+
distance: beforeDist,
|
|
78
|
+
after: false
|
|
79
|
+
};
|
|
80
|
+
} else {
|
|
81
|
+
if (!beforeAllowed_0) {
|
|
82
|
+
closest[i] = {
|
|
83
|
+
distance: afterDist,
|
|
84
|
+
after: true
|
|
85
|
+
};
|
|
86
|
+
} else {
|
|
87
|
+
const after = afterDist < beforeDist;
|
|
88
|
+
closest[i] = {
|
|
89
|
+
distance: after ? afterDist : beforeDist,
|
|
90
|
+
after
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return closest[i];
|
|
96
|
+
};
|
|
97
|
+
let l = 0;
|
|
98
|
+
let r = candidates.length - 1;
|
|
99
|
+
while (l < r) {
|
|
100
|
+
const m = Math.floor((l + r) / 2);
|
|
101
|
+
const {
|
|
102
|
+
distance
|
|
103
|
+
} = computeClosest(m);
|
|
104
|
+
if (l <= m - 1 && computeClosest(m - 1).distance < distance) {
|
|
105
|
+
r = m - 1;
|
|
106
|
+
} else {
|
|
107
|
+
if (m + 1 <= r && computeClosest(m + 1).distance < distance) {
|
|
108
|
+
l = m + 1;
|
|
109
|
+
} else {
|
|
110
|
+
return {
|
|
111
|
+
itemIndex: candidates[m].itemIndex,
|
|
112
|
+
after: computeClosest(m).after
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
itemIndex: candidates[l].itemIndex,
|
|
119
|
+
after: computeClosest(l).after
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
t3 = {
|
|
123
|
+
registerReorderItem,
|
|
124
|
+
getItemBounds,
|
|
125
|
+
getClosestInsertionPoint
|
|
126
|
+
};
|
|
127
|
+
$[4] = t3;
|
|
128
|
+
} else {
|
|
129
|
+
t3 = $[4];
|
|
130
|
+
}
|
|
131
|
+
return t3;
|
|
132
|
+
}
|
|
133
|
+
function _temp(t0) {
|
|
134
|
+
const {
|
|
135
|
+
beforeAllowed,
|
|
136
|
+
afterAllowed
|
|
137
|
+
} = t0;
|
|
138
|
+
return beforeAllowed || afterAllowed;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export { ReorderLayoutContext, useReorderLayoutContextValue };
|