1 |
|
2 |
|
3 | import { nullTranslator } from '@jupyterlab/translation';
|
4 | import { hpass } from '@lumino/virtualdom';
|
5 | import { DockPanel, TabBar, TabPanel } from '@lumino/widgets';
|
6 | import { LabIconStyle } from '../../style';
|
7 | import { classes } from '../../utils';
|
8 | import { addIcon, closeIcon } from '../iconimports';
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export class TabBarSvg extends TabBar {
|
14 | |
15 |
|
16 |
|
17 |
|
18 |
|
19 | constructor(options = {}) {
|
20 | var _a;
|
21 | super({ renderer: TabBarSvg.defaultRenderer, ...options });
|
22 | const trans = ((_a = TabBarSvg.translator) !== null && _a !== void 0 ? _a : nullTranslator).load('jupyterlab');
|
23 | addIcon.element({
|
24 | container: this.addButtonNode,
|
25 | title: trans.__('New Launcher')
|
26 | });
|
27 | }
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | TabBarSvg.translator = null;
|
33 | (function (TabBarSvg) {
|
34 | |
35 |
|
36 |
|
37 | class Renderer extends TabBar.Renderer {
|
38 | |
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | renderCloseIcon(data) {
|
46 | var _a;
|
47 | const trans = ((_a = TabBarSvg.translator) !== null && _a !== void 0 ? _a : nullTranslator).load('jupyterlab');
|
48 | const title = data.title.label
|
49 | ? trans.__('Close %1', data.title.label)
|
50 | : trans.__('Close tab');
|
51 | const className = classes('jp-icon-hover lm-TabBar-tabCloseIcon', LabIconStyle.styleClass({
|
52 | elementPosition: 'center',
|
53 | height: '16px',
|
54 | width: '16px'
|
55 | }));
|
56 | return hpass('div', { className, title }, closeIcon);
|
57 | }
|
58 | }
|
59 | TabBarSvg.Renderer = Renderer;
|
60 | TabBarSvg.defaultRenderer = new Renderer();
|
61 | })(TabBarSvg || (TabBarSvg = {}));
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | export class DockPanelSvg extends DockPanel {
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 | constructor(options = {}) {
|
73 | super({
|
74 | renderer: DockPanelSvg.defaultRenderer,
|
75 | ...options
|
76 | });
|
77 | }
|
78 | }
|
79 | (function (DockPanelSvg) {
|
80 | |
81 |
|
82 |
|
83 | class Renderer extends DockPanel.Renderer {
|
84 | |
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | createTabBar() {
|
91 | const bar = new TabBarSvg();
|
92 | bar.addClass('lm-DockPanel-tabBar');
|
93 | return bar;
|
94 | }
|
95 | }
|
96 | DockPanelSvg.Renderer = Renderer;
|
97 | DockPanelSvg.defaultRenderer = new Renderer();
|
98 | })(DockPanelSvg || (DockPanelSvg = {}));
|
99 |
|
100 |
|
101 |
|
102 |
|
103 | export class TabPanelSvg extends TabPanel {
|
104 | |
105 |
|
106 |
|
107 |
|
108 |
|
109 | constructor(options = {}) {
|
110 | options.renderer = options.renderer || TabBarSvg.defaultRenderer;
|
111 | super(options);
|
112 | }
|
113 | }
|
114 |
|
\ | No newline at end of file |