eli-video-interview 1.6.0 → 1.6.1
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/esm/modules/ai-report-v3/components/SectionTabs/SectionTabs.js +29 -13
- package/esm/modules/ai-report-v3/useAiReportVersion.js +1 -1
- package/lib/modules/ai-report-v3/components/SectionTabs/SectionTabs.js +29 -13
- package/lib/modules/ai-report-v3/useAiReportVersion.js +1 -1
- package/package.json +2 -2
|
@@ -35,6 +35,16 @@ var sections = [
|
|
|
35
35
|
{ id: 'report-evaluate', name: '综合评价' },
|
|
36
36
|
{ id: 'report-question', name: '答题解析' },
|
|
37
37
|
];
|
|
38
|
+
var findScrollParent = function (node) {
|
|
39
|
+
var el = node;
|
|
40
|
+
while (el && el !== document.body) {
|
|
41
|
+
var s = getComputedStyle(el);
|
|
42
|
+
if (/(auto|scroll)/.test(s.overflowY) && el.scrollHeight > el.clientHeight)
|
|
43
|
+
return el;
|
|
44
|
+
el = el.parentElement;
|
|
45
|
+
}
|
|
46
|
+
return window;
|
|
47
|
+
};
|
|
38
48
|
var SectionTabs = function (_a) {
|
|
39
49
|
var _b = _a.hasRisk, hasRisk = _b === void 0 ? true : _b, _c = _a.operableButtons, operableButtons = _c === void 0 ? [] : _c, onExportReportClick = _a.onExportReportClick, fetchReportUrl = _a.fetchReportUrl;
|
|
40
50
|
var _d = __read(useState('report-header'), 2), active = _d[0], setActive = _d[1];
|
|
@@ -51,20 +61,10 @@ var SectionTabs = function (_a) {
|
|
|
51
61
|
.catch(function () { return undefined; });
|
|
52
62
|
}, [fetchReportUrl]);
|
|
53
63
|
useEffect(function () {
|
|
54
|
-
var getScrollParent = function (node) {
|
|
55
|
-
var el = node;
|
|
56
|
-
while (el && el !== document.body) {
|
|
57
|
-
var s = getComputedStyle(el);
|
|
58
|
-
if (/(auto|scroll)/.test(s.overflowY) && el.scrollHeight > el.clientHeight)
|
|
59
|
-
return el;
|
|
60
|
-
el = el.parentElement;
|
|
61
|
-
}
|
|
62
|
-
return window;
|
|
63
|
-
};
|
|
64
64
|
var root = rootRef.current;
|
|
65
65
|
if (!root)
|
|
66
66
|
return;
|
|
67
|
-
var scrollParent =
|
|
67
|
+
var scrollParent = findScrollParent(root);
|
|
68
68
|
var ids = sections.map(function (s) { return s.id; });
|
|
69
69
|
var onScroll = function () {
|
|
70
70
|
var tabHeight = root.offsetHeight || 48;
|
|
@@ -83,12 +83,28 @@ var SectionTabs = function (_a) {
|
|
|
83
83
|
onScroll();
|
|
84
84
|
return function () { return scrollParent.removeEventListener('scroll', onScroll); };
|
|
85
85
|
}, []);
|
|
86
|
-
var
|
|
86
|
+
var scrollToSection = function (id) {
|
|
87
87
|
var _a;
|
|
88
|
+
var el = document.getElementById(id);
|
|
89
|
+
if (!el)
|
|
90
|
+
return;
|
|
91
|
+
var tabHeight = ((_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 48;
|
|
92
|
+
var container = findScrollParent(el);
|
|
93
|
+
if (container === window) {
|
|
94
|
+
var top_1 = el.getBoundingClientRect().top + (window.scrollY || document.documentElement.scrollTop) - tabHeight;
|
|
95
|
+
window.scrollTo({ top: top_1, behavior: 'smooth' });
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
var c = container;
|
|
99
|
+
var top_2 = el.getBoundingClientRect().top - c.getBoundingClientRect().top + c.scrollTop - tabHeight;
|
|
100
|
+
c.scrollTo({ top: top_2, behavior: 'smooth' });
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var handleClick = function (id) {
|
|
88
104
|
if (id === 'report-risk' && !hasRisk)
|
|
89
105
|
return;
|
|
90
106
|
setActive(id);
|
|
91
|
-
(
|
|
107
|
+
scrollToSection(id);
|
|
92
108
|
};
|
|
93
109
|
return (_jsx(Box, __assign({ ref: rootRef, sx: {
|
|
94
110
|
position: 'sticky',
|
|
@@ -37,6 +37,16 @@ var sections = [
|
|
|
37
37
|
{ id: 'report-evaluate', name: '综合评价' },
|
|
38
38
|
{ id: 'report-question', name: '答题解析' },
|
|
39
39
|
];
|
|
40
|
+
var findScrollParent = function (node) {
|
|
41
|
+
var el = node;
|
|
42
|
+
while (el && el !== document.body) {
|
|
43
|
+
var s = getComputedStyle(el);
|
|
44
|
+
if (/(auto|scroll)/.test(s.overflowY) && el.scrollHeight > el.clientHeight)
|
|
45
|
+
return el;
|
|
46
|
+
el = el.parentElement;
|
|
47
|
+
}
|
|
48
|
+
return window;
|
|
49
|
+
};
|
|
40
50
|
var SectionTabs = function (_a) {
|
|
41
51
|
var _b = _a.hasRisk, hasRisk = _b === void 0 ? true : _b, _c = _a.operableButtons, operableButtons = _c === void 0 ? [] : _c, onExportReportClick = _a.onExportReportClick, fetchReportUrl = _a.fetchReportUrl;
|
|
42
52
|
var _d = __read((0, react_1.useState)('report-header'), 2), active = _d[0], setActive = _d[1];
|
|
@@ -53,20 +63,10 @@ var SectionTabs = function (_a) {
|
|
|
53
63
|
.catch(function () { return undefined; });
|
|
54
64
|
}, [fetchReportUrl]);
|
|
55
65
|
(0, react_1.useEffect)(function () {
|
|
56
|
-
var getScrollParent = function (node) {
|
|
57
|
-
var el = node;
|
|
58
|
-
while (el && el !== document.body) {
|
|
59
|
-
var s = getComputedStyle(el);
|
|
60
|
-
if (/(auto|scroll)/.test(s.overflowY) && el.scrollHeight > el.clientHeight)
|
|
61
|
-
return el;
|
|
62
|
-
el = el.parentElement;
|
|
63
|
-
}
|
|
64
|
-
return window;
|
|
65
|
-
};
|
|
66
66
|
var root = rootRef.current;
|
|
67
67
|
if (!root)
|
|
68
68
|
return;
|
|
69
|
-
var scrollParent =
|
|
69
|
+
var scrollParent = findScrollParent(root);
|
|
70
70
|
var ids = sections.map(function (s) { return s.id; });
|
|
71
71
|
var onScroll = function () {
|
|
72
72
|
var tabHeight = root.offsetHeight || 48;
|
|
@@ -85,12 +85,28 @@ var SectionTabs = function (_a) {
|
|
|
85
85
|
onScroll();
|
|
86
86
|
return function () { return scrollParent.removeEventListener('scroll', onScroll); };
|
|
87
87
|
}, []);
|
|
88
|
-
var
|
|
88
|
+
var scrollToSection = function (id) {
|
|
89
89
|
var _a;
|
|
90
|
+
var el = document.getElementById(id);
|
|
91
|
+
if (!el)
|
|
92
|
+
return;
|
|
93
|
+
var tabHeight = ((_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 48;
|
|
94
|
+
var container = findScrollParent(el);
|
|
95
|
+
if (container === window) {
|
|
96
|
+
var top_1 = el.getBoundingClientRect().top + (window.scrollY || document.documentElement.scrollTop) - tabHeight;
|
|
97
|
+
window.scrollTo({ top: top_1, behavior: 'smooth' });
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
var c = container;
|
|
101
|
+
var top_2 = el.getBoundingClientRect().top - c.getBoundingClientRect().top + c.scrollTop - tabHeight;
|
|
102
|
+
c.scrollTo({ top: top_2, behavior: 'smooth' });
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var handleClick = function (id) {
|
|
90
106
|
if (id === 'report-risk' && !hasRisk)
|
|
91
107
|
return;
|
|
92
108
|
setActive(id);
|
|
93
|
-
(
|
|
109
|
+
scrollToSection(id);
|
|
94
110
|
};
|
|
95
111
|
return ((0, jsx_runtime_1.jsx)(mui_1.Box, __assign({ ref: rootRef, sx: {
|
|
96
112
|
position: 'sticky',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eli-video-interview",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "鳄梨科技 AI视频面试 React SDK",
|
|
5
5
|
"author": "鳄梨科技",
|
|
6
6
|
"license": "MIT",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"type": "git",
|
|
67
67
|
"url": "https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk.git"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "abb7c6d5688fd331fda7376b82cc9d1c93f4f3f5"
|
|
70
70
|
}
|