@opensumi/ide-editor 3.2.5-next-1724148998.0 → 3.2.5-next-1724290408.0
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/lib/browser/editor-scrollbar/index.d.ts +69 -0
- package/lib/browser/editor-scrollbar/index.d.ts.map +1 -0
- package/lib/browser/editor-scrollbar/index.js +289 -0
- package/lib/browser/editor-scrollbar/index.js.map +1 -0
- package/lib/browser/editor-scrollbar/index.module.less +106 -0
- package/lib/browser/editor.module.less +7 -7
- package/lib/browser/tab.view.d.ts.map +1 -1
- package/lib/browser/tab.view.js +7 -7
- package/lib/browser/tab.view.js.map +1 -1
- package/package.json +14 -14
- package/src/browser/editor-scrollbar/index.module.less +106 -0
- package/src/browser/editor-scrollbar/index.tsx +399 -0
- package/src/browser/editor.module.less +7 -7
- package/src/browser/tab.view.tsx +15 -8
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { MouseEvent, UIEvent } from 'react';
|
|
2
|
+
export interface ScrollAreaProps {
|
|
3
|
+
className?: string;
|
|
4
|
+
onScroll?: (position: ScrollPosition) => any;
|
|
5
|
+
atTopClassName?: string;
|
|
6
|
+
style?: any;
|
|
7
|
+
containerStyle?: any;
|
|
8
|
+
delegate?: (delegate: IScrollDelegate) => void;
|
|
9
|
+
forwardedRef: (ref: HTMLDivElement) => void;
|
|
10
|
+
children: any;
|
|
11
|
+
}
|
|
12
|
+
export interface IScrollDelegate {
|
|
13
|
+
scrollTo(position: ScrollPosition): void;
|
|
14
|
+
}
|
|
15
|
+
export interface ScrollPosition {
|
|
16
|
+
top: number;
|
|
17
|
+
left: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ScrollSizes {
|
|
20
|
+
scrollHeight: number;
|
|
21
|
+
offsetHeight: number;
|
|
22
|
+
offsetWidth: number;
|
|
23
|
+
scrollWidth: number;
|
|
24
|
+
}
|
|
25
|
+
export declare class Scroll extends React.Component<ScrollAreaProps, any> {
|
|
26
|
+
ref: HTMLDivElement;
|
|
27
|
+
container: HTMLDivElement;
|
|
28
|
+
private thumbV;
|
|
29
|
+
private trackV;
|
|
30
|
+
private thumbH;
|
|
31
|
+
private trackH;
|
|
32
|
+
private decorationL;
|
|
33
|
+
private decorationR;
|
|
34
|
+
private size;
|
|
35
|
+
private position;
|
|
36
|
+
private dragging;
|
|
37
|
+
private draggingStart;
|
|
38
|
+
private draggingStartPos;
|
|
39
|
+
private requestFrame;
|
|
40
|
+
private shouldHideThumb;
|
|
41
|
+
private isAtTop;
|
|
42
|
+
onScroll(e: UIEvent<HTMLDivElement>): void;
|
|
43
|
+
scrollTo(position: ScrollPosition): void;
|
|
44
|
+
onMouseDownHorizontal(e: MouseEvent<HTMLDivElement>): void;
|
|
45
|
+
onMouseMoveHorizontal: (e: any) => void;
|
|
46
|
+
onMouseUpHorizontal: (e: any) => void;
|
|
47
|
+
onMouseDownOnTrack(e: MouseEvent<HTMLDivElement>): void;
|
|
48
|
+
calculateXToLeft(x: any): number;
|
|
49
|
+
onMouseDownVertical(e: MouseEvent<HTMLDivElement>): void;
|
|
50
|
+
onMouseMoveVertical: (e: any) => void;
|
|
51
|
+
onMouseUpVertical: (e: any) => void;
|
|
52
|
+
onMouseDownOnTrackVertical(e: MouseEvent<HTMLDivElement>): void;
|
|
53
|
+
onMousewheel: (e: WheelEvent) => void;
|
|
54
|
+
calculateYToTop(y: any): number;
|
|
55
|
+
componentDidUpdate(): void;
|
|
56
|
+
componentDidMount(): void;
|
|
57
|
+
onMouseEnter: () => void;
|
|
58
|
+
componentWillUnmount(): void;
|
|
59
|
+
handleWindowResize: () => void;
|
|
60
|
+
sizeEqual(size1: ScrollSizes, size2: ScrollSizes): boolean;
|
|
61
|
+
update: (callback?: any) => void;
|
|
62
|
+
_update(): void;
|
|
63
|
+
updateScrollBar(): void;
|
|
64
|
+
hideThumb(): void;
|
|
65
|
+
showThumb(): void;
|
|
66
|
+
setCss(): void;
|
|
67
|
+
render(): React.JSX.Element;
|
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 = require("tslib");
|
|
5
|
+
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
6
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
const index_module_less_1 = tslib_1.__importDefault(require("./index.module.less"));
|
|
8
|
+
class Scroll extends react_1.default.Component {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.position = {
|
|
12
|
+
top: 0,
|
|
13
|
+
left: 0,
|
|
14
|
+
};
|
|
15
|
+
this.dragging = false;
|
|
16
|
+
this.draggingStart = 0;
|
|
17
|
+
this.draggingStartPos = 0;
|
|
18
|
+
this.shouldHideThumb = true;
|
|
19
|
+
this.isAtTop = true;
|
|
20
|
+
this.onMouseMoveHorizontal = (e) => {
|
|
21
|
+
if (!this.dragging) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const move = e.pageX - this.draggingStart;
|
|
25
|
+
this.ref.scrollLeft = this.draggingStartPos + this.calculateXToLeft(move);
|
|
26
|
+
};
|
|
27
|
+
this.onMouseUpHorizontal = (e) => {
|
|
28
|
+
this.dragging = false;
|
|
29
|
+
document.removeEventListener('mousemove', this.onMouseMoveHorizontal);
|
|
30
|
+
document.removeEventListener('mouseup', this.onMouseUpHorizontal);
|
|
31
|
+
if (this.shouldHideThumb) {
|
|
32
|
+
this.hideThumb();
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
this.onMouseMoveVertical = (e) => {
|
|
36
|
+
if (!this.dragging) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const move = e.pageY - this.draggingStart;
|
|
40
|
+
this.ref.scrollTop = this.draggingStartPos + this.calculateYToTop(move);
|
|
41
|
+
};
|
|
42
|
+
this.onMouseUpVertical = (e) => {
|
|
43
|
+
this.dragging = false;
|
|
44
|
+
document.removeEventListener('mousemove', this.onMouseMoveVertical);
|
|
45
|
+
document.removeEventListener('mouseup', this.onMouseUpVertical);
|
|
46
|
+
if (this.shouldHideThumb) {
|
|
47
|
+
this.hideThumb();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
this.onMousewheel = (e) => {
|
|
51
|
+
// 鼠标滚动滚轮只在有横向滚动条的情况下
|
|
52
|
+
// 页面有缩放的时候,scrollHeight 可能会小于 clientHeight / offsetHeight
|
|
53
|
+
if (this.ref.clientHeight >= this.ref.scrollHeight) {
|
|
54
|
+
if (e.deltaY !== 0) {
|
|
55
|
+
// scrollLeft 内部有边界判断
|
|
56
|
+
this.ref.scrollLeft += e.deltaY;
|
|
57
|
+
}
|
|
58
|
+
if (e.deltaX !== 0) {
|
|
59
|
+
this.ref.scrollLeft += e.deltaX;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
this.onMouseEnter = () => {
|
|
64
|
+
this.update();
|
|
65
|
+
};
|
|
66
|
+
this.handleWindowResize = () => {
|
|
67
|
+
this.update();
|
|
68
|
+
};
|
|
69
|
+
this.update = (callback) => {
|
|
70
|
+
if (this.requestFrame) {
|
|
71
|
+
window.cancelAnimationFrame(this.requestFrame);
|
|
72
|
+
}
|
|
73
|
+
this.requestFrame = window.requestAnimationFrame(() => {
|
|
74
|
+
this._update();
|
|
75
|
+
if (callback) {
|
|
76
|
+
callback();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
onScroll(e) {
|
|
82
|
+
this.position = {
|
|
83
|
+
top: this.ref.scrollTop,
|
|
84
|
+
left: this.ref.scrollLeft,
|
|
85
|
+
};
|
|
86
|
+
if (this.props.onScroll) {
|
|
87
|
+
this.props.onScroll(this.position);
|
|
88
|
+
}
|
|
89
|
+
this.update(() => {
|
|
90
|
+
const contentWidth = this.ref.scrollWidth;
|
|
91
|
+
const width = this.ref.offsetWidth;
|
|
92
|
+
const contentHeight = this.ref.scrollHeight;
|
|
93
|
+
const height = this.ref.offsetHeight;
|
|
94
|
+
this.thumbH.style.left = (this.position.left * width) / contentWidth + 'px';
|
|
95
|
+
this.thumbV.style.top = (this.position.top * height) / contentHeight + 'px';
|
|
96
|
+
});
|
|
97
|
+
if (!this.isAtTop && this.ref.scrollTop === 0) {
|
|
98
|
+
this.isAtTop = true;
|
|
99
|
+
this.setCss();
|
|
100
|
+
}
|
|
101
|
+
else if (this.isAtTop && this.ref.scrollTop !== 0) {
|
|
102
|
+
this.isAtTop = false;
|
|
103
|
+
this.setCss();
|
|
104
|
+
}
|
|
105
|
+
if (this.ref.scrollLeft > 0) {
|
|
106
|
+
this.decorationL.style.opacity = String(1);
|
|
107
|
+
this.decorationR.style.opacity = String(1);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this.decorationL.style.opacity = String(0);
|
|
111
|
+
}
|
|
112
|
+
if (this.ref.scrollWidth === this.ref.offsetWidth ||
|
|
113
|
+
this.ref.scrollLeft === this.ref.scrollWidth - this.ref.offsetWidth) {
|
|
114
|
+
this.decorationR.style.opacity = String(0);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
scrollTo(position) {
|
|
118
|
+
this.ref.scrollLeft = position.left;
|
|
119
|
+
this.ref.scrollTop = position.top;
|
|
120
|
+
}
|
|
121
|
+
onMouseDownHorizontal(e) {
|
|
122
|
+
this.dragging = true;
|
|
123
|
+
if (e.target === this.trackH) {
|
|
124
|
+
this.onMouseDownOnTrack(e);
|
|
125
|
+
}
|
|
126
|
+
this.draggingStart = e.pageX;
|
|
127
|
+
this.draggingStartPos = this.ref.scrollLeft;
|
|
128
|
+
document.addEventListener('mousemove', this.onMouseMoveHorizontal);
|
|
129
|
+
document.addEventListener('mouseup', this.onMouseUpHorizontal);
|
|
130
|
+
}
|
|
131
|
+
onMouseDownOnTrack(e) {
|
|
132
|
+
const track = e.target;
|
|
133
|
+
const x = e.clientX - track.getBoundingClientRect().left;
|
|
134
|
+
const contentWidth = this.ref.scrollWidth;
|
|
135
|
+
const width = this.ref.offsetWidth;
|
|
136
|
+
const left = (x * contentWidth) / width - 0.5 * width;
|
|
137
|
+
this.scrollTo({
|
|
138
|
+
left,
|
|
139
|
+
top: this.position.top,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
calculateXToLeft(x) {
|
|
143
|
+
const contentWidth = this.ref.scrollWidth;
|
|
144
|
+
const width = this.ref.offsetWidth;
|
|
145
|
+
return (x * contentWidth) / width;
|
|
146
|
+
}
|
|
147
|
+
onMouseDownVertical(e) {
|
|
148
|
+
this.dragging = true;
|
|
149
|
+
if (e.target === this.trackV) {
|
|
150
|
+
this.onMouseDownOnTrackVertical(e);
|
|
151
|
+
}
|
|
152
|
+
this.draggingStart = e.pageY;
|
|
153
|
+
this.draggingStartPos = this.ref.scrollTop;
|
|
154
|
+
document.addEventListener('mousemove', this.onMouseMoveVertical);
|
|
155
|
+
document.addEventListener('mouseup', this.onMouseUpVertical);
|
|
156
|
+
}
|
|
157
|
+
onMouseDownOnTrackVertical(e) {
|
|
158
|
+
const track = e.target;
|
|
159
|
+
const x = e.clientY - track.getBoundingClientRect().top;
|
|
160
|
+
const contentHeight = this.ref.scrollHeight;
|
|
161
|
+
const height = this.ref.offsetHeight;
|
|
162
|
+
const top = (x * contentHeight) / height - 0.5 * height;
|
|
163
|
+
this.scrollTo({
|
|
164
|
+
left: this.position.left,
|
|
165
|
+
top,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
calculateYToTop(y) {
|
|
169
|
+
const contentHeight = this.ref.scrollHeight;
|
|
170
|
+
const height = this.ref.offsetHeight;
|
|
171
|
+
return (y * contentHeight) / height;
|
|
172
|
+
}
|
|
173
|
+
componentDidUpdate() {
|
|
174
|
+
this.update();
|
|
175
|
+
if (this.props.delegate) {
|
|
176
|
+
this.props.delegate({
|
|
177
|
+
scrollTo: this.scrollTo.bind(this),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
componentDidMount() {
|
|
182
|
+
this.update();
|
|
183
|
+
window.addEventListener('resize', this.handleWindowResize);
|
|
184
|
+
if (this.props.delegate) {
|
|
185
|
+
this.props.delegate({
|
|
186
|
+
scrollTo: this.scrollTo.bind(this),
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
if (this.ref) {
|
|
190
|
+
this.ref.addEventListener('mouseenter', this.onMouseEnter);
|
|
191
|
+
this.ref.addEventListener('wheel', this.onMousewheel);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
componentWillUnmount() {
|
|
195
|
+
if (this.ref) {
|
|
196
|
+
this.ref.removeEventListener('mouseenter', this.onMouseEnter);
|
|
197
|
+
this.ref.removeEventListener('wheel', this.onMousewheel);
|
|
198
|
+
}
|
|
199
|
+
window.removeEventListener('resize', this.handleWindowResize);
|
|
200
|
+
if (this.requestFrame) {
|
|
201
|
+
window.cancelAnimationFrame(this.requestFrame);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
sizeEqual(size1, size2) {
|
|
205
|
+
return (size1 &&
|
|
206
|
+
size2 &&
|
|
207
|
+
size1.offsetHeight === size2.offsetHeight &&
|
|
208
|
+
size1.scrollHeight === size2.scrollHeight &&
|
|
209
|
+
size1.offsetWidth === size2.offsetWidth &&
|
|
210
|
+
size1.scrollWidth === size2.scrollWidth);
|
|
211
|
+
}
|
|
212
|
+
_update() {
|
|
213
|
+
if (this.ref) {
|
|
214
|
+
if (!this.sizeEqual(this.size, this.ref)) {
|
|
215
|
+
this.size = {
|
|
216
|
+
offsetHeight: this.ref.offsetHeight,
|
|
217
|
+
offsetWidth: this.ref.offsetWidth,
|
|
218
|
+
scrollWidth: this.ref.scrollWidth,
|
|
219
|
+
scrollHeight: this.ref.scrollHeight,
|
|
220
|
+
};
|
|
221
|
+
this.updateScrollBar();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
updateScrollBar() {
|
|
226
|
+
const contentWidth = this.ref.scrollWidth;
|
|
227
|
+
const width = this.ref.offsetWidth;
|
|
228
|
+
if (width < contentWidth) {
|
|
229
|
+
const thumbHWidth = (width * width) / contentWidth;
|
|
230
|
+
this.thumbH.style.width = thumbHWidth + 'px';
|
|
231
|
+
this.trackH.parentElement.style.display = 'block';
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
this.trackH.parentElement.style.display = 'none';
|
|
235
|
+
}
|
|
236
|
+
const contentHeight = this.ref.scrollHeight;
|
|
237
|
+
const height = this.ref.offsetHeight;
|
|
238
|
+
if (height < contentHeight) {
|
|
239
|
+
this.thumbV.style.height = (height * height) / contentHeight + 'px';
|
|
240
|
+
this.trackV.parentElement.style.display = 'block';
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
this.trackV.parentElement.style.display = 'none';
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
hideThumb() {
|
|
247
|
+
this.shouldHideThumb = true;
|
|
248
|
+
if (!this.dragging) {
|
|
249
|
+
this.setCss();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
showThumb() {
|
|
253
|
+
this.shouldHideThumb = false;
|
|
254
|
+
this.setCss();
|
|
255
|
+
}
|
|
256
|
+
setCss() {
|
|
257
|
+
this.container.className = (0, classnames_1.default)({
|
|
258
|
+
[index_module_less_1.default.scroll]: true,
|
|
259
|
+
[index_module_less_1.default['hide-thumb']]: this.shouldHideThumb && !this.dragging,
|
|
260
|
+
});
|
|
261
|
+
const clses = {};
|
|
262
|
+
if (this.props.atTopClassName) {
|
|
263
|
+
clses[this.props.atTopClassName] = this.isAtTop;
|
|
264
|
+
}
|
|
265
|
+
if (this.props.className) {
|
|
266
|
+
clses[this.props.className] = true;
|
|
267
|
+
}
|
|
268
|
+
this.ref.className = (0, classnames_1.default)(clses);
|
|
269
|
+
}
|
|
270
|
+
render() {
|
|
271
|
+
return (react_1.default.createElement("div", { className: (0, classnames_1.default)(index_module_less_1.default.scroll, index_module_less_1.default['hide-thumb']), ref: (e) => {
|
|
272
|
+
if (e) {
|
|
273
|
+
this.container = e;
|
|
274
|
+
this.props.forwardedRef(e);
|
|
275
|
+
}
|
|
276
|
+
}, onMouseMove: () => this.showThumb(), onMouseLeave: () => this.hideThumb(), style: this.props.containerStyle },
|
|
277
|
+
react_1.default.createElement("div", { style: this.props.style, className: (0, classnames_1.default)(this.props.className), onScroll: this.onScroll.bind(this), ref: (e) => e && (this.ref = e), onMouseDown: () => this.update(), onMouseUp: () => this.update() }, this.props.children),
|
|
278
|
+
react_1.default.createElement("div", { className: index_module_less_1.default['scrollbar-decoration-vertical-l'], ref: (e) => e && (this.decorationL = e) }),
|
|
279
|
+
react_1.default.createElement("div", { className: index_module_less_1.default['scrollbar-decoration-vertical-r'], ref: (e) => e && (this.decorationR = e) }),
|
|
280
|
+
react_1.default.createElement("div", { className: index_module_less_1.default['scroll-horizontal'] },
|
|
281
|
+
react_1.default.createElement("div", { className: index_module_less_1.default['track-horizontal'], ref: (e) => e && (this.trackH = e), onMouseDown: this.onMouseDownHorizontal.bind(this) }),
|
|
282
|
+
react_1.default.createElement("div", { className: 'kt-editor-scrollbar-thumb-horizontal', onMouseDown: this.onMouseDownHorizontal.bind(this), ref: (e) => e && (this.thumbH = e) })),
|
|
283
|
+
react_1.default.createElement("div", { className: index_module_less_1.default['scroll-vertical'] },
|
|
284
|
+
react_1.default.createElement("div", { className: index_module_less_1.default['track-vertical'], ref: (e) => e && (this.trackV = e), onMouseDown: this.onMouseDownVertical.bind(this) }),
|
|
285
|
+
react_1.default.createElement("div", { className: 'kt-editor-scrollbar-thumb-vertical', onMouseDown: this.onMouseDownVertical.bind(this), ref: (e) => e && (this.thumbV = e) }))));
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
exports.Scroll = Scroll;
|
|
289
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/editor-scrollbar/index.tsx"],"names":[],"mappings":";;;;AAAA,oEAA6B;AAC7B,0DAAmD;AAEnD,oFAAyC;AA+BzC,MAAa,MAAO,SAAQ,eAAK,CA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SAAS,EAAE,sCAAsC,EACjD,WAAW,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,EAClD,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAClC,CACE;YACN,uCAAK,SAAS,EAAE,2BAAM,CAAC,iBAAiB,CAAC;gBACvC,uCACE,SAAS,EAAE,2BAAM,CAAC,gBAAgB,CAAC,EACnC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAClC,WAAW,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,GAChD;gBACF,uCACE,SAAS,EAAE,oCAAoC,EAC/C,WAAW,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,EAChD,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAClC,CACE,CACF,CACP,CAAC;IACJ,CAAC;CACF;AA5WD,wBA4WC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
.track-vertical {
|
|
2
|
+
position: absolute;
|
|
3
|
+
right: 0;
|
|
4
|
+
top: 0;
|
|
5
|
+
height: 100%;
|
|
6
|
+
width: 10px;
|
|
7
|
+
}
|
|
8
|
+
.scroll-vertical {
|
|
9
|
+
position: absolute;
|
|
10
|
+
right: 0;
|
|
11
|
+
top: 0;
|
|
12
|
+
height: 100%;
|
|
13
|
+
width: 10px;
|
|
14
|
+
z-index: var(--stacking-level-editor-tabbar-overlay, 15);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.track-horizontal {
|
|
18
|
+
position: absolute;
|
|
19
|
+
bottom: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 5px;
|
|
23
|
+
}
|
|
24
|
+
.scroll-horizontal {
|
|
25
|
+
position: absolute;
|
|
26
|
+
bottom: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 5px;
|
|
30
|
+
z-index: var(--stacking-level-editor-tabbar-overlay, 15);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:global(.kt-editor-scrollbar-thumb-vertical) {
|
|
34
|
+
position: absolute;
|
|
35
|
+
width: 5px;
|
|
36
|
+
opacity: 0.8;
|
|
37
|
+
top: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
transition: opacity 200ms ease-out;
|
|
40
|
+
background: var(--scrollbarSlider-background);
|
|
41
|
+
box-shadow: 1px 0 0 var(--scrollbar-shadow);
|
|
42
|
+
|
|
43
|
+
&:hover {
|
|
44
|
+
background: var(--scrollbarSlider-hoverBackground);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:global(.kt-editor-scrollbar-thumb-horizontal) {
|
|
49
|
+
position: absolute;
|
|
50
|
+
height: 5px;
|
|
51
|
+
left: 0;
|
|
52
|
+
bottom: 0;
|
|
53
|
+
opacity: 0.8;
|
|
54
|
+
transition: opacity 200ms ease-out 200ms;
|
|
55
|
+
background: var(--scrollbarSlider-background);
|
|
56
|
+
box-shadow: 1px 0 0 var(--scrollbar-shadow);
|
|
57
|
+
|
|
58
|
+
&:hover {
|
|
59
|
+
background: var(--scrollbarSlider-hoverBackground);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.scroll {
|
|
64
|
+
position: relative;
|
|
65
|
+
height: 100%;
|
|
66
|
+
> *:first-child::-webkit-scrollbar {
|
|
67
|
+
display: none !important;
|
|
68
|
+
background: rgb(50, 50, 50);
|
|
69
|
+
}
|
|
70
|
+
> *:first-child {
|
|
71
|
+
overflow: auto;
|
|
72
|
+
height: 100%;
|
|
73
|
+
width: 100%;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.scrollbar-decoration-vertical-l,
|
|
77
|
+
.scrollbar-decoration-vertical-r {
|
|
78
|
+
position: absolute;
|
|
79
|
+
width: 6px;
|
|
80
|
+
height: 100%;
|
|
81
|
+
z-index: var(--stacking-level-overlay-top, 999);
|
|
82
|
+
top: 0px;
|
|
83
|
+
opacity: 0;
|
|
84
|
+
}
|
|
85
|
+
// rgba(106, 115, 125, 0.2) 0 6px 6px -6px inset
|
|
86
|
+
.scrollbar-decoration-vertical-l {
|
|
87
|
+
left: 0px;
|
|
88
|
+
border-left: 1px solid var(--kt-panelTab-border);
|
|
89
|
+
box-shadow: 6px 0 4px -4px rgba(106, 115, 125, 0.2) inset;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.scrollbar-decoration-vertical-r {
|
|
93
|
+
right: 0px;
|
|
94
|
+
border-right: 1px solid var(--kt-panelTab-border);
|
|
95
|
+
box-shadow: -6px 0 4px -4px rgba(106, 115, 125, 0.2) inset;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.hide-thumb {
|
|
100
|
+
:global(.kt-editor-scrollbar-thumb-horizontal) {
|
|
101
|
+
opacity: 0 !important;
|
|
102
|
+
}
|
|
103
|
+
:global(.kt-editor-scrollbar-thumb-vertical) {
|
|
104
|
+
opacity: 0 !important;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
left: 0;
|
|
74
74
|
position: absolute;
|
|
75
75
|
display: block;
|
|
76
|
-
z-index: 0;
|
|
76
|
+
z-index: var(--stacking-level-background, 0);
|
|
77
77
|
}
|
|
78
78
|
&::after {
|
|
79
79
|
content: '';
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
left: 0;
|
|
85
85
|
position: absolute;
|
|
86
86
|
display: block;
|
|
87
|
-
z-index: 0;
|
|
87
|
+
z-index: var(--stacking-level-background, 0);
|
|
88
88
|
}
|
|
89
89
|
.editor_action_wrapper {
|
|
90
90
|
margin-left: 8px;
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
left: 0;
|
|
176
176
|
position: absolute;
|
|
177
177
|
display: block;
|
|
178
|
-
z-index: 0;
|
|
178
|
+
z-index: var(--stacking-level-background, 0);
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
position: relative;
|
|
305
305
|
background: var(--tab-activeBackground);
|
|
306
306
|
color: var(--tab-activeForeground);
|
|
307
|
-
z-index: 11;
|
|
307
|
+
z-index: var(--stacking-level-editor-tabbar-current, 11);
|
|
308
308
|
&::before {
|
|
309
309
|
position: absolute;
|
|
310
310
|
content: '';
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
width: 100%;
|
|
313
313
|
top: -1px;
|
|
314
314
|
left: 0;
|
|
315
|
-
z-index:
|
|
315
|
+
z-index: var(--stacking-level-overlay, 800);
|
|
316
316
|
background-color: var(--tab-activeBorderTop);
|
|
317
317
|
}
|
|
318
318
|
.dirty {
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
.editorGroupHeader {
|
|
351
|
-
z-index: 0;
|
|
351
|
+
z-index: var(--stacking-level-background, 0);
|
|
352
352
|
position: relative;
|
|
353
353
|
}
|
|
354
354
|
|
|
@@ -489,7 +489,7 @@
|
|
|
489
489
|
.overlay-shadow();
|
|
490
490
|
border-radius: 2px;
|
|
491
491
|
padding: 5px 10px;
|
|
492
|
-
z-index:
|
|
492
|
+
z-index: var(--stacking-level-overlay-top, 1000);
|
|
493
493
|
white-space: nowrap;
|
|
494
494
|
.editor_action_tip_close {
|
|
495
495
|
cursor: pointer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.view.d.ts","sourceRoot":"","sources":["../../src/browser/tab.view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAEZ,cAAc,EAUf,MAAM,OAAO,CAAC;AAgDf,OAAO,EAAE,WAAW,EAA8B,MAAM,4BAA4B,CAAC;AAIrF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,eAAO,MAAM,IAAI,cAAe,UAAU,
|
|
1
|
+
{"version":3,"file":"tab.view.d.ts","sourceRoot":"","sources":["../../src/browser/tab.view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAEZ,cAAc,EAUf,MAAM,OAAO,CAAC;AAgDf,OAAO,EAAE,WAAW,EAA8B,MAAM,4BAA4B,CAAC;AAIrF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,WAAW,CAAC;CACpB;AAED,eAAO,MAAM,IAAI,cAAe,UAAU,sBAkdzC,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAE3F,eAAO,MAAM,aAAa,KAmEzB,CAAC"}
|
package/lib/browser/tab.view.js
CHANGED
|
@@ -4,15 +4,15 @@ exports.EditorActions = exports.Tabs = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
6
6
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
-
const ide_components_1 = require("@opensumi/ide-components");
|
|
8
7
|
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
9
|
-
const ide_core_browser_2 = require("@opensumi/ide-core-browser");
|
|
10
8
|
const actions_1 = require("@opensumi/ide-core-browser/lib/components/actions");
|
|
11
9
|
const constants_1 = require("@opensumi/ide-core-browser/lib/layout/constants");
|
|
12
10
|
const view_id_1 = require("@opensumi/ide-core-browser/lib/layout/view-id");
|
|
13
11
|
const next_1 = require("@opensumi/ide-core-browser/lib/menu/next");
|
|
14
12
|
const react_hooks_1 = require("@opensumi/ide-core-browser/lib/react-hooks");
|
|
13
|
+
const ide_core_common_1 = require("@opensumi/ide-core-common");
|
|
15
14
|
const common_1 = require("../common");
|
|
15
|
+
const editor_scrollbar_1 = require("./editor-scrollbar");
|
|
16
16
|
const editor_module_less_1 = tslib_1.__importDefault(require("./editor.module.less"));
|
|
17
17
|
const title_context_menu_1 = require("./menu/title-context.menu");
|
|
18
18
|
const types_1 = require("./types");
|
|
@@ -247,7 +247,7 @@ const Tabs = ({ group }) => {
|
|
|
247
247
|
const subname = resourceService.getResourceSubname(resource, group.resources);
|
|
248
248
|
return editorTabService.renderEditorTab(react_1.default.createElement(react_1.default.Fragment, null,
|
|
249
249
|
react_1.default.createElement("div", { className: tabsLoadingMap[resource.uri.toString()] ? 'loading_indicator' : (0, classnames_1.default)(resource.icon) }, " "),
|
|
250
|
-
react_1.default.createElement("div",
|
|
250
|
+
react_1.default.createElement("div", { tabIndex: 0, role: 'tab', "aria-selected": isCurrent ? 'true' : 'false' }, resource.name),
|
|
251
251
|
subname ? react_1.default.createElement("div", { className: editor_module_less_1.default.subname }, subname) : null,
|
|
252
252
|
decoration.readOnly ? (react_1.default.createElement("span", { className: (0, classnames_1.default)((0, ide_core_browser_1.getExternalIcon)('lock'), editor_module_less_1.default.editor_readonly_icon) })) : null,
|
|
253
253
|
react_1.default.createElement("div", { className: styles_tab_right },
|
|
@@ -258,14 +258,14 @@ const Tabs = ({ group }) => {
|
|
|
258
258
|
react_1.default.createElement("div", { className: styles_close_tab, onMouseDown: (e) => {
|
|
259
259
|
e.stopPropagation();
|
|
260
260
|
group.close(resource.uri);
|
|
261
|
-
} }, editorTabService.renderTabCloseComponent(react_1.default.createElement("div", { className: (0, classnames_1.default)((0, ide_core_browser_1.getIcon)('close'), styles_kt_editor_close_icon) }))))), isCurrent);
|
|
261
|
+
} }, editorTabService.renderTabCloseComponent(react_1.default.createElement("div", { className: (0, classnames_1.default)((0, ide_core_browser_1.getIcon)('close'), styles_kt_editor_close_icon), tabIndex: 0, role: 'button', "aria-label": (0, ide_core_common_1.formatLocalize)('editor.closeTab.title', resource.name) }))))), isCurrent);
|
|
262
262
|
}, [editorTabService]);
|
|
263
263
|
const renderTabContent = () => {
|
|
264
264
|
const curTabIndex = group.resources.findIndex((resource) => group.currentResource === resource);
|
|
265
265
|
return (react_1.default.createElement("div", { draggable: false, className: (0, classnames_1.default)({
|
|
266
266
|
[styles_kt_editor_tabs_content]: true,
|
|
267
267
|
[styles_kt_editor_tabs_current_last]: curTabIndex === group.resources.length - 1,
|
|
268
|
-
}), ref: contentRef },
|
|
268
|
+
}), ref: contentRef, role: 'tablist' },
|
|
269
269
|
group.resources.map((resource, i) => {
|
|
270
270
|
let ref;
|
|
271
271
|
const decoration = resourceService.getResourceDecoration(resource.uri);
|
|
@@ -319,9 +319,9 @@ const Tabs = ({ group }) => {
|
|
|
319
319
|
wrapMode && (react_1.default.createElement(exports.EditorActions, { className: editor_module_less_1.default.kt_editor_wrap_mode_action, ref: editorActionRef, group: group }))));
|
|
320
320
|
};
|
|
321
321
|
return (react_1.default.createElement("div", { id: view_id_1.VIEW_CONTAINERS.EDITOR_TABS, className: styles_kt_editor_tabs },
|
|
322
|
-
react_1.default.createElement("div", { className: styles_kt_editor_tabs_scroll_wrapper, ref: tabWrapperRef, onDragOver: handleWrapperDragOver, onDragLeave: handleWrapperDragLeave, onDrop: handleWrapperDrag, onDoubleClick: handleEmptyDBClick }, !wrapMode ? (react_1.default.createElement(
|
|
322
|
+
react_1.default.createElement("div", { className: styles_kt_editor_tabs_scroll_wrapper, ref: tabWrapperRef, onDragOver: handleWrapperDragOver, onDragLeave: handleWrapperDragLeave, onDrop: handleWrapperDrag, onDoubleClick: handleEmptyDBClick }, !wrapMode ? (react_1.default.createElement(editor_scrollbar_1.Scroll, { forwardedRef: (el) => (el ? (tabContainer.current = el) : null), className: editor_module_less_1.default.kt_editor_tabs_scroll }, renderTabContent())) : (react_1.default.createElement("div", { className: editor_module_less_1.default.kt_editor_wrap_container }, renderTabContent()))),
|
|
323
323
|
!wrapMode && react_1.default.createElement(exports.EditorActions, { ref: editorActionRef, group: group }),
|
|
324
|
-
(0,
|
|
324
|
+
(0, ide_core_browser_1.renderView)(RightExtraContentViewConfig)));
|
|
325
325
|
};
|
|
326
326
|
exports.Tabs = Tabs;
|
|
327
327
|
exports.EditorActions = (0, react_1.forwardRef)((props, ref) => {
|