@kubex/zinc 1.0.113 → 1.0.115
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/.github/workflows/eleventy_build.yml +5 -5
- package/.github/workflows/js_build_and_deploy.yaml +1 -1
- package/dist/custom-elements.json +2422 -190
- package/dist/vscode.html-custom-data.json +86 -5
- package/dist/web-types.json +251 -9
- package/dist/zn.d.ts +518 -340
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +960 -882
- package/docs/eleventy.config.cjs +4 -2
- package/docs/pages/components/header.md +13 -0
- package/docs/pages/components/inline-edit.md +20 -0
- package/docs/pages/components/item.md +12 -1
- package/docs/pages/components/page.md +149 -0
- package/docs/pages/components/progress-bar.md +16 -0
- package/docs/pages/components/select.md +25 -0
- package/docs/pages/components/split-pane.md +6 -7
- package/docs/pages/components/tabs.md +59 -9
- package/package.json +8 -5
- package/scripts/build.js +40 -19
- package/scss/_global-spacing.scss +12 -1
- package/scss/_root.scss +34 -2
- package/scss/mixins/_spacing-mixins.scss +1 -1
- package/scss/shared/layout.scss +15 -2
- package/scss/themes/_light.scss +1 -1
- package/src/components/absolute-container/absolute-container.component.ts +9 -25
- package/src/components/animated-button/animated-button.test.ts +8 -8
- package/src/components/button/button.component.ts +3 -1
- package/src/components/button/button.scss +5 -0
- package/src/components/button-menu/button-menu.component.ts +36 -21
- package/src/components/button-menu/button-menu.test.ts +55 -1
- package/src/components/chart/chart.component.ts +7 -7
- package/src/components/collapsible/collapsible.component.ts +7 -14
- package/src/components/cols/cols.scss +1 -1
- package/src/components/content-block/content-block.component.ts +11 -33
- package/src/components/data-select/data-select.component.ts +7 -11
- package/src/components/data-select/data-select.scss +1 -0
- package/src/components/data-table/data-table.component.ts +10 -14
- package/src/components/dialog/dialog.scss +4 -0
- package/src/components/editor/modules/toolbar/toolbar.component.ts +5 -9
- package/src/components/expanding-action/expanding-action.component.ts +37 -43
- package/src/components/form-group/form-group.component.ts +32 -27
- package/src/components/form-group/form-group.scss +1 -0
- package/src/components/header/header.component.ts +6 -5
- package/src/components/header/header.scss +28 -26
- package/src/components/inline-edit/inline-edit.component.ts +13 -1
- package/src/components/inline-edit/inline-edit.test.ts +50 -0
- package/src/components/input/input.test.ts +77 -0
- package/src/components/input-group/input-group.test.ts +2 -10
- package/src/components/item/item.component.ts +12 -6
- package/src/components/item/item.scss +1 -1
- package/src/components/item/item.test.ts +8 -0
- package/src/components/navbar/navbar.component.ts +222 -48
- package/src/components/navbar/navbar.scss +134 -21
- package/src/components/navbar/navbar.test.ts +114 -9
- package/src/components/option/option.scss +5 -7
- package/src/components/option/option.test.ts +30 -0
- package/src/components/page/index.ts +13 -0
- package/src/components/page/page.component.ts +406 -0
- package/src/components/page/page.scss +325 -0
- package/src/components/page/page.test.ts +397 -0
- package/src/components/page-nav/page-nav.scss +7 -5
- package/src/components/pane/pane.component.ts +2 -2
- package/src/components/pane/pane.scss +0 -1
- package/src/components/pane/pane.test.ts +31 -0
- package/src/components/panel/panel.scss +5 -16
- package/src/components/progress-bar/progress-bar.component.ts +5 -2
- package/src/components/progress-bar/progress-bar.scss +17 -1
- package/src/components/progress-bar/progress-bar.test.ts +12 -0
- package/src/components/scroll-container/scroll-container.component.ts +22 -21
- package/src/components/select/select.component.ts +243 -39
- package/src/components/select/select.scss +36 -5
- package/src/components/select/select.test.ts +533 -0
- package/src/components/settings-container/settings-container.component.ts +15 -19
- package/src/components/settings-container/settings-container.scss +8 -8
- package/src/components/sidebar/sidebar.component.ts +11 -11
- package/src/components/simple-chart/simple-chart.component.ts +6 -7
- package/src/components/sp/sp.scss +46 -15
- package/src/components/sp/sp.test.ts +15 -0
- package/src/components/split-pane/split-pane.component.ts +153 -26
- package/src/components/split-pane/split-pane.scss +89 -13
- package/src/components/split-pane/split-pane.test.ts +187 -0
- package/src/components/style/style.component.ts +8 -0
- package/src/components/tab/index.ts +13 -0
- package/src/components/tab/tab.component.ts +25 -0
- package/src/components/tab/tab.scss +7 -0
- package/src/components/table/table.component.ts +7 -2
- package/src/components/table/table.scss +1 -0
- package/src/components/tabs/tabs.component.ts +75 -70
- package/src/components/tabs/tabs.scss +1 -1
- package/src/components/textarea/textarea.component.ts +5 -8
- package/src/components/tile/tile.scss +2 -2
- package/src/components/translation-group/translation-group.component.ts +15 -14
- package/src/components/translations/translations.component.ts +18 -17
- package/src/components/translations/translations.scss +1 -0
- package/src/components/translations/translations.test.ts +3 -2
- package/src/internal/form.ts +234 -0
- package/src/internal/theme.ts +26 -46
- package/src/internal/zinc-element.ts +12 -7
- package/src/utilities/form.ts +1 -0
- package/src/wc.scss +1 -1
- package/src/zinc.ts +3 -0
|
@@ -4,6 +4,7 @@ import { CanvasRenderer } from 'echarts/renderers';
|
|
|
4
4
|
import { type CSSResultGroup, html, unsafeCSS } from 'lit';
|
|
5
5
|
import { GridComponent, TooltipComponent } from 'echarts/components';
|
|
6
6
|
import { property } from 'lit/decorators.js';
|
|
7
|
+
import { ResizeController } from '@lit-labs/observers/resize-controller.js';
|
|
7
8
|
import styles from './simple-chart.scss';
|
|
8
9
|
import ZincElement from '../../internal/zinc-element';
|
|
9
10
|
import type { ECharts } from 'echarts/core';
|
|
@@ -40,7 +41,11 @@ export default class ZnSimpleChart extends ZincElement {
|
|
|
40
41
|
}) enableAnimations: boolean | number = false;
|
|
41
42
|
|
|
42
43
|
private chart?: ECharts;
|
|
43
|
-
private resizeObserver
|
|
44
|
+
private readonly resizeObserver = new ResizeController(this, {
|
|
45
|
+
target: null,
|
|
46
|
+
skipInitial: true,
|
|
47
|
+
callback: () => this.chart?.resize(),
|
|
48
|
+
});
|
|
44
49
|
|
|
45
50
|
firstUpdated() {
|
|
46
51
|
const host = this.shadowRoot?.getElementById('chart') as HTMLElement | null;
|
|
@@ -77,17 +82,11 @@ export default class ZnSimpleChart extends ZincElement {
|
|
|
77
82
|
},
|
|
78
83
|
}],
|
|
79
84
|
});
|
|
80
|
-
let firstResize = true;
|
|
81
|
-
this.resizeObserver = new ResizeObserver(() => {
|
|
82
|
-
if (firstResize) { firstResize = false; return; }
|
|
83
|
-
this.chart?.resize();
|
|
84
|
-
});
|
|
85
85
|
this.resizeObserver.observe(host);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
disconnectedCallback() {
|
|
89
89
|
super.disconnectedCallback();
|
|
90
|
-
this.resizeObserver?.disconnect();
|
|
91
90
|
this.chart?.dispose();
|
|
92
91
|
}
|
|
93
92
|
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
8
|
-
--zn-sp-padding: var(--zn-spacing-medium);
|
|
9
|
-
--zn-sp-gap: var(--zn-divide-gap, var(--zn-spacing-medium));
|
|
8
|
+
--zn-sp-padding: var(--zn-base-gap, var(--zn-divide-gap, var(--zn-spacing-medium)));
|
|
9
|
+
--zn-sp-gap: var(--zn-base-gap, var(--zn-divide-gap, var(--zn-spacing-medium)));
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
:host([grow]) {
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-grow: 1;
|
|
15
|
+
height: 100%;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
:host([max-full]) {
|
|
@@ -33,8 +34,7 @@
|
|
|
33
34
|
gap: var(--zn-sp-gap);
|
|
34
35
|
width: 100%;
|
|
35
36
|
height: 100%;
|
|
36
|
-
|
|
37
|
-
margin: 0 auto;
|
|
37
|
+
margin: var(--zn-default-margin, 0 auto);
|
|
38
38
|
|
|
39
39
|
&--divide.sp--no-gap {
|
|
40
40
|
::slotted(*:not(:last-child)) {
|
|
@@ -108,15 +108,46 @@
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
:host([align="start"]) .sp {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
:host([align="
|
|
111
|
+
:host([align="start"]) .sp {
|
|
112
|
+
align-items: flex-start;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:host([align="center"]) .sp {
|
|
116
|
+
align-items: center;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
:host([align="end"]) .sp {
|
|
120
|
+
align-items: flex-end;
|
|
121
|
+
}
|
|
116
122
|
|
|
117
|
-
:host([
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
:host([
|
|
122
|
-
|
|
123
|
+
:host([align="stretch"]) .sp {
|
|
124
|
+
align-items: stretch;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:host([align="baseline"]) .sp {
|
|
128
|
+
align-items: baseline;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
:host([justify="start"]) .sp {
|
|
132
|
+
justify-content: flex-start;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:host([justify="center"]) .sp {
|
|
136
|
+
justify-content: center;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:host([justify="end"]) .sp {
|
|
140
|
+
justify-content: flex-end;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
:host([justify="between"]) .sp {
|
|
144
|
+
justify-content: space-between;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
:host([justify="around"]) .sp {
|
|
148
|
+
justify-content: space-around;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:host([justify="evenly"]) .sp {
|
|
152
|
+
justify-content: space-evenly;
|
|
153
|
+
}
|
|
@@ -7,4 +7,19 @@ describe('<zn-sp>', () => {
|
|
|
7
7
|
|
|
8
8
|
expect(el).to.exist;
|
|
9
9
|
});
|
|
10
|
+
|
|
11
|
+
it('should fill its parent container height', async () => {
|
|
12
|
+
const parent = await fixture(html`
|
|
13
|
+
<div style="height: 300px;">
|
|
14
|
+
<zn-sp>
|
|
15
|
+
<div>Content</div>
|
|
16
|
+
</zn-sp>
|
|
17
|
+
</div>
|
|
18
|
+
`);
|
|
19
|
+
const el = parent.querySelector('zn-sp')!;
|
|
20
|
+
const base = el.shadowRoot!.querySelector('[part="base"]')!;
|
|
21
|
+
|
|
22
|
+
expect(el.getBoundingClientRect().height).to.equal(300);
|
|
23
|
+
expect(base.getBoundingClientRect().height).to.equal(300);
|
|
24
|
+
});
|
|
10
25
|
});
|
|
@@ -5,6 +5,15 @@ import {Store} from "../../internal/storage";
|
|
|
5
5
|
import ZincElement from '../../internal/zinc-element';
|
|
6
6
|
|
|
7
7
|
import styles from './split-pane.scss';
|
|
8
|
+
import { PropertyValues } from "@lit/reactive-element";
|
|
9
|
+
|
|
10
|
+
type NavigationItem = {
|
|
11
|
+
caption: string;
|
|
12
|
+
active: boolean;
|
|
13
|
+
select: () => void;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const MERGED_NAVIGATION_BREAKPOINT_PX = 768;
|
|
8
17
|
|
|
9
18
|
/**
|
|
10
19
|
* @summary Short summary of the component's intended use.
|
|
@@ -33,11 +42,15 @@ export default class ZnSplitPane extends ZincElement {
|
|
|
33
42
|
private currentPixelSize: number = 0;
|
|
34
43
|
private currentPercentSize: number = 0;
|
|
35
44
|
private currentContainerSize: number = 0;
|
|
45
|
+
private focusChangeHandler = () => this.requestUpdate();
|
|
36
46
|
private primaryFull: string;
|
|
47
|
+
private resizeObserver: ResizeObserver | null = null;
|
|
48
|
+
private parentIsNarrow = false;
|
|
37
49
|
|
|
38
50
|
@property({attribute: 'pixels', type: Boolean, reflect: true}) calculatePixels = false;
|
|
39
51
|
@property({attribute: 'secondary', type: Boolean, reflect: true}) preferSecondarySize = false;
|
|
40
52
|
@property({attribute: 'min-size', type: Number, reflect: true}) minimumPaneSize = 10;
|
|
53
|
+
@property({attribute: 'min-secondary-size', type: Number, reflect: true}) minimumSecondaryPaneSize: number;
|
|
41
54
|
@property({attribute: 'max-size', type: Number, reflect: true}) maximumPaneSize: number;
|
|
42
55
|
@property({attribute: 'initial-size', type: Number, reflect: true}) initialSize = 50;
|
|
43
56
|
@property({attribute: 'store-key', reflect: true}) storeKey: string = "";
|
|
@@ -51,6 +64,9 @@ export default class ZnSplitPane extends ZincElement {
|
|
|
51
64
|
|
|
52
65
|
@property({attribute: 'padded', type: Boolean, reflect: true}) padded = false;
|
|
53
66
|
@property({attribute: 'padded-right', type: Boolean, reflect: true}) paddedRight = false;
|
|
67
|
+
@property({type: Boolean, reflect: true}) gap = false;
|
|
68
|
+
@property({reflect: true}) hide: 'primary' | 'secondary' | '' = '';
|
|
69
|
+
@property({attribute: 'merged-navigation', type: Boolean, reflect: true}) mergedNavigation = false;
|
|
54
70
|
|
|
55
71
|
// session storage if not local
|
|
56
72
|
@property({attribute: 'local-storage', type: Boolean, reflect: true}) localStorage: boolean;
|
|
@@ -66,10 +82,30 @@ export default class ZnSplitPane extends ZincElement {
|
|
|
66
82
|
e.stopPropagation();
|
|
67
83
|
this._setFocusPane(parseInt((e.selectedTarget as HTMLElement).getAttribute('split-pane-focus')!));
|
|
68
84
|
});
|
|
85
|
+
this.addEventListener('zn-split-pane-focus-change', this.focusChangeHandler);
|
|
86
|
+
this.resizeObserver = new ResizeObserver(() => this.refreshNarrowState());
|
|
87
|
+
this.resizeObserver.observe(this);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
disconnectedCallback() {
|
|
91
|
+
this.removeEventListener('zn-split-pane-focus-change', this.focusChangeHandler);
|
|
92
|
+
this.resizeObserver?.disconnect();
|
|
93
|
+
this.resizeObserver = null;
|
|
94
|
+
super.disconnectedCallback();
|
|
69
95
|
}
|
|
70
96
|
|
|
71
|
-
|
|
97
|
+
private refreshNarrowState() {
|
|
98
|
+
const nowNarrow = this.getBoundingClientRect().width < MERGED_NAVIGATION_BREAKPOINT_PX;
|
|
99
|
+
if (nowNarrow !== this.parentIsNarrow) {
|
|
100
|
+
this.parentIsNarrow = nowNarrow;
|
|
101
|
+
this.updateNestedNavigationMerging();
|
|
102
|
+
this.requestUpdate();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
firstUpdated(changedProperties: PropertyValues) {
|
|
72
107
|
setTimeout(this.applyStoredSize.bind(this), 100);
|
|
108
|
+
this.refreshNarrowState();
|
|
73
109
|
super.firstUpdated(changedProperties);
|
|
74
110
|
}
|
|
75
111
|
|
|
@@ -80,14 +116,14 @@ export default class ZnSplitPane extends ZincElement {
|
|
|
80
116
|
|
|
81
117
|
|
|
82
118
|
const storedValue = this._store.get(this.storeKey);
|
|
83
|
-
if (storedValue
|
|
119
|
+
if (storedValue !== null) {
|
|
84
120
|
const parts = storedValue.split(",");
|
|
85
121
|
if (parts.length >= 3) {
|
|
86
122
|
applyPixels = parseInt(parts[0]);
|
|
87
123
|
applyPercent = parseInt(parts[1]);
|
|
88
124
|
const storedBasis = parseInt(parts[2]);
|
|
89
125
|
if (this.preferSecondarySize && this.calculatePixels) {
|
|
90
|
-
applyPixels
|
|
126
|
+
applyPixels *= (this.currentContainerSize / storedBasis);
|
|
91
127
|
}
|
|
92
128
|
}
|
|
93
129
|
}
|
|
@@ -96,7 +132,11 @@ export default class ZnSplitPane extends ZincElement {
|
|
|
96
132
|
|
|
97
133
|
@eventOptions({passive: true})
|
|
98
134
|
resize(e: any) {
|
|
99
|
-
if (this.
|
|
135
|
+
if (this.hide === 'primary' || this.hide === 'secondary') {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (this.mouseUpHandler !== null) {
|
|
100
140
|
this.mouseUpHandler(e);
|
|
101
141
|
}
|
|
102
142
|
|
|
@@ -131,22 +171,46 @@ export default class ZnSplitPane extends ZincElement {
|
|
|
131
171
|
}
|
|
132
172
|
|
|
133
173
|
setSize(primaryPanelPixels: number) {
|
|
134
|
-
|
|
135
|
-
|
|
174
|
+
const hasMinimumSecondaryPaneSize = Number.isFinite(this.minimumSecondaryPaneSize);
|
|
175
|
+
const maximumPrimaryPanelPixels = hasMinimumSecondaryPaneSize
|
|
176
|
+
? this.currentContainerSize - (this.calculatePixels
|
|
177
|
+
? this.minimumSecondaryPaneSize
|
|
178
|
+
: (this.currentContainerSize / 100) * this.minimumSecondaryPaneSize)
|
|
179
|
+
: undefined;
|
|
180
|
+
|
|
181
|
+
let pixelSize = maximumPrimaryPanelPixels === undefined
|
|
182
|
+
? primaryPanelPixels
|
|
183
|
+
: Math.min(primaryPanelPixels, maximumPrimaryPanelPixels);
|
|
184
|
+
let percentSize = (pixelSize / this.currentContainerSize) * 100;
|
|
136
185
|
|
|
137
186
|
if (this.calculatePixels) {
|
|
138
|
-
|
|
139
|
-
|
|
187
|
+
const minimumPrimaryPanelPixels = maximumPrimaryPanelPixels === undefined
|
|
188
|
+
? this.minimumPaneSize
|
|
189
|
+
: Math.min(this.minimumPaneSize, maximumPrimaryPanelPixels);
|
|
190
|
+
if (this.maximumPaneSize || maximumPrimaryPanelPixels !== undefined) {
|
|
191
|
+
pixelSize = Math.max(
|
|
192
|
+
minimumPrimaryPanelPixels,
|
|
193
|
+
Math.min(this.maximumPaneSize ?? Infinity, maximumPrimaryPanelPixels ?? Infinity, pixelSize)
|
|
194
|
+
);
|
|
140
195
|
} else {
|
|
141
|
-
pixelSize = Math.max(
|
|
196
|
+
pixelSize = Math.max(minimumPrimaryPanelPixels, pixelSize);
|
|
142
197
|
}
|
|
198
|
+
percentSize = (pixelSize / this.currentContainerSize) * 100;
|
|
143
199
|
this.initialSize = pixelSize;
|
|
144
200
|
} else {
|
|
145
|
-
|
|
146
|
-
|
|
201
|
+
const maximumPrimaryPanelPercent = hasMinimumSecondaryPaneSize ? 100 - this.minimumSecondaryPaneSize : undefined;
|
|
202
|
+
const minimumPrimaryPanelPercent = maximumPrimaryPanelPercent === undefined
|
|
203
|
+
? this.minimumPaneSize
|
|
204
|
+
: Math.min(this.minimumPaneSize, maximumPrimaryPanelPercent);
|
|
205
|
+
if (this.maximumPaneSize || maximumPrimaryPanelPercent !== undefined) {
|
|
206
|
+
percentSize = Math.max(
|
|
207
|
+
minimumPrimaryPanelPercent,
|
|
208
|
+
Math.min(this.maximumPaneSize ?? Infinity, maximumPrimaryPanelPercent ?? Infinity, percentSize)
|
|
209
|
+
);
|
|
147
210
|
} else {
|
|
148
|
-
percentSize = Math.max(
|
|
211
|
+
percentSize = Math.max(minimumPrimaryPanelPercent, percentSize);
|
|
149
212
|
}
|
|
213
|
+
pixelSize = (this.currentContainerSize / 100) * percentSize;
|
|
150
214
|
this.initialSize = percentSize;
|
|
151
215
|
}
|
|
152
216
|
this.currentPixelSize = pixelSize;
|
|
@@ -154,42 +218,105 @@ export default class ZnSplitPane extends ZincElement {
|
|
|
154
218
|
this.primaryFull = this.calculatePixels ? (this.currentPixelSize + 'px') : (this.currentPercentSize + '%');
|
|
155
219
|
}
|
|
156
220
|
|
|
157
|
-
_togglePane(e: any) {
|
|
158
|
-
this._setFocusPane(e.target.getAttribute('idx'));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
221
|
_setFocusPane(idx: number) {
|
|
162
222
|
this._focusPane = idx;
|
|
163
|
-
this.
|
|
164
|
-
|
|
223
|
+
this.dispatchEvent(new CustomEvent('zn-split-pane-focus-change', {bubbles: true, composed: true}));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
private getDirectNestedSplitPanes() {
|
|
227
|
+
return Array.from(this.querySelectorAll<ZnSplitPane>('zn-split-pane')).filter(child => {
|
|
228
|
+
return child.parentElement?.closest('zn-split-pane') === this && !child.vertical;
|
|
165
229
|
});
|
|
166
230
|
}
|
|
167
231
|
|
|
232
|
+
private updateNestedNavigationMerging() {
|
|
233
|
+
const shouldMerge = !this.vertical && this.parentIsNarrow;
|
|
234
|
+
this.getDirectNestedSplitPanes().forEach(child => {
|
|
235
|
+
child.mergedNavigation = shouldMerge;
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
private getPaneIndexForNestedSplitPane(child: ZnSplitPane) {
|
|
240
|
+
let node: Element | null = child;
|
|
241
|
+
while (node && node.parentElement !== this) {
|
|
242
|
+
node = node.parentElement;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return node?.getAttribute('slot') === 'secondary' ? 1 : 0;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
private getNestedNavigationItems(parentIdx: number): NavigationItem[] {
|
|
249
|
+
return this.getDirectNestedSplitPanesForPane(parentIdx)
|
|
250
|
+
.flatMap(child => child.getNavigationItems().map(item => {
|
|
251
|
+
return {
|
|
252
|
+
caption: item.caption,
|
|
253
|
+
active: this._focusPane === parentIdx && item.active,
|
|
254
|
+
select: () => {
|
|
255
|
+
this._setFocusPane(parentIdx);
|
|
256
|
+
item.select();
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
private getDirectNestedSplitPanesForPane(parentIdx: number) {
|
|
263
|
+
return this.getDirectNestedSplitPanes().filter(child => this.getPaneIndexForNestedSplitPane(child) === parentIdx);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
private getNavigationItems(): NavigationItem[] {
|
|
267
|
+
this.updateNestedNavigationMerging();
|
|
268
|
+
|
|
269
|
+
const primaryNestedItems = this.getNestedNavigationItems(0);
|
|
270
|
+
const secondaryNestedItems = this.getNestedNavigationItems(1);
|
|
271
|
+
const primaryItems = primaryNestedItems.length > 0
|
|
272
|
+
? primaryNestedItems
|
|
273
|
+
: [{
|
|
274
|
+
caption: this.primaryCaption,
|
|
275
|
+
active: this._focusPane === 0,
|
|
276
|
+
select: () => this._setFocusPane(0)
|
|
277
|
+
}];
|
|
278
|
+
const secondaryItems = secondaryNestedItems.length > 0
|
|
279
|
+
? secondaryNestedItems
|
|
280
|
+
: [{
|
|
281
|
+
caption: this.secondaryCaption,
|
|
282
|
+
active: this._focusPane === 1,
|
|
283
|
+
select: () => this._setFocusPane(1)
|
|
284
|
+
}];
|
|
285
|
+
|
|
286
|
+
return [
|
|
287
|
+
...primaryItems,
|
|
288
|
+
...secondaryItems
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
|
|
168
292
|
protected render(): unknown {
|
|
169
293
|
const resizeWidth = '2px';
|
|
170
294
|
const resizeMargin = '5px';
|
|
295
|
+
const minimumSecondaryPaneSize = Number.isFinite(this.minimumSecondaryPaneSize)
|
|
296
|
+
? this.minimumSecondaryPaneSize + (this.calculatePixels ? 'px' : '%')
|
|
297
|
+
: 'var(--min-panel-size)';
|
|
171
298
|
return html`
|
|
172
299
|
<style>:host {
|
|
173
300
|
--min-panel-size: ${this.minimumPaneSize}${this.calculatePixels ? 'px' : '%'};
|
|
301
|
+
--min-secondary-panel-size: ${minimumSecondaryPaneSize};
|
|
174
302
|
--max-panel-size: ${this.maximumPaneSize ? this.maximumPaneSize + (this.calculatePixels ? 'px' : '%') : 'none'};
|
|
175
303
|
--initial-size: ${this.primaryFull};
|
|
176
304
|
--resize-size: ${resizeWidth};
|
|
177
305
|
--resize-margin: ${resizeMargin};
|
|
178
306
|
}</style>
|
|
179
307
|
<ul id="split-nav">
|
|
180
|
-
|
|
181
|
-
${
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
</li>
|
|
308
|
+
${this.getNavigationItems().map(item => html`
|
|
309
|
+
<li class="${item.active ? 'active' : ''}" @click="${item.select}">
|
|
310
|
+
${item.caption}
|
|
311
|
+
</li>
|
|
312
|
+
`)}
|
|
186
313
|
</ul>
|
|
187
314
|
<div id="primary-pane">
|
|
188
|
-
<slot name="primary"></slot>
|
|
315
|
+
<slot name="primary" @slotchange="${() => this.requestUpdate()}"></slot>
|
|
189
316
|
</div>
|
|
190
317
|
<div @mousedown="${this.resize}" @touchstart="${this.resize}" id="resizer"></div>
|
|
191
318
|
<div id="secondary-pane">
|
|
192
|
-
<slot name="secondary"></slot>
|
|
319
|
+
<slot name="secondary" @slotchange="${() => this.requestUpdate()}"></slot>
|
|
193
320
|
</div>
|
|
194
321
|
`;
|
|
195
322
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
@use "../../wc";
|
|
3
3
|
@use "../../../scss/mixins";
|
|
4
4
|
|
|
5
|
-
:host([
|
|
6
|
-
|
|
5
|
+
:host([gap]) {
|
|
6
|
+
gap: 0 calc(var(--zn-base-gap) / 2);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
::slotted(*) {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
flex: 1;
|
|
23
23
|
min-width: 350px;
|
|
24
24
|
container-type: inline-size;
|
|
25
|
+
position: relative;
|
|
25
26
|
|
|
26
27
|
#primary-pane, #secondary-pane {
|
|
27
28
|
flex-grow: 1;
|
|
@@ -51,8 +52,6 @@
|
|
|
51
52
|
|
|
52
53
|
cursor: col-resize;
|
|
53
54
|
|
|
54
|
-
//padding: var(--zn-padding);
|
|
55
|
-
|
|
56
55
|
&:hover:before {
|
|
57
56
|
background-color: rgb(var(--zn-blue));
|
|
58
57
|
}
|
|
@@ -60,16 +59,10 @@
|
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
:host(:not([vertical])), zn-split-pane:not([vertical]) {
|
|
63
|
-
padding-top: 40px;
|
|
64
|
-
|
|
65
62
|
#split-nav {
|
|
66
63
|
display: none;
|
|
67
64
|
}
|
|
68
65
|
|
|
69
|
-
@include wc.container-query(md) {
|
|
70
|
-
padding-top: 0;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
66
|
@include wc.container-query(zero, md) {
|
|
74
67
|
|
|
75
68
|
#split-nav {
|
|
@@ -89,7 +82,8 @@
|
|
|
89
82
|
|
|
90
83
|
li {
|
|
91
84
|
line-height: 39px;
|
|
92
|
-
flex
|
|
85
|
+
flex: 1 1 0;
|
|
86
|
+
min-width: 0;
|
|
93
87
|
text-align: center;
|
|
94
88
|
position: relative;
|
|
95
89
|
cursor: pointer;
|
|
@@ -124,13 +118,18 @@
|
|
|
124
118
|
#primary-pane, #secondary-pane {
|
|
125
119
|
max-width: 100% !important;
|
|
126
120
|
width: 100%;
|
|
121
|
+
padding-top: 40px;
|
|
127
122
|
}
|
|
128
123
|
}
|
|
129
124
|
|
|
130
|
-
#primary-pane
|
|
125
|
+
#primary-pane {
|
|
131
126
|
min-width: var(--min-panel-size, 15%);
|
|
132
127
|
}
|
|
133
128
|
|
|
129
|
+
#secondary-pane {
|
|
130
|
+
min-width: var(--min-secondary-panel-size, var(--min-panel-size, 15%));
|
|
131
|
+
}
|
|
132
|
+
|
|
134
133
|
#primary-pane {
|
|
135
134
|
max-width: var(--max-panel-size, var(--initial-size, 50%));
|
|
136
135
|
}
|
|
@@ -161,6 +160,74 @@
|
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
162
|
|
|
163
|
+
:host([merged-navigation]:not([vertical])) {
|
|
164
|
+
@include wc.container-query(zero, md) {
|
|
165
|
+
padding-top: 0;
|
|
166
|
+
|
|
167
|
+
#split-nav {
|
|
168
|
+
display: none;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
#primary-pane, #secondary-pane {
|
|
172
|
+
padding-top: 0;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
:host([hide="primary"]),
|
|
178
|
+
:host([hide="secondary"]) {
|
|
179
|
+
padding-top: 0;
|
|
180
|
+
|
|
181
|
+
#split-nav,
|
|
182
|
+
#resizer {
|
|
183
|
+
display: none;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
:host([hide="primary"]) {
|
|
188
|
+
#primary-pane {
|
|
189
|
+
flex: 0 0 0;
|
|
190
|
+
height: 0;
|
|
191
|
+
max-height: 0 !important;
|
|
192
|
+
max-width: 0 !important;
|
|
193
|
+
min-height: 0 !important;
|
|
194
|
+
min-width: 0 !important;
|
|
195
|
+
overflow: hidden;
|
|
196
|
+
pointer-events: none;
|
|
197
|
+
visibility: hidden;
|
|
198
|
+
width: 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
#secondary-pane {
|
|
202
|
+
height: 100%;
|
|
203
|
+
max-height: 100% !important;
|
|
204
|
+
max-width: 100% !important;
|
|
205
|
+
width: 100%;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
:host([hide="secondary"]) {
|
|
210
|
+
#primary-pane {
|
|
211
|
+
height: 100%;
|
|
212
|
+
max-height: 100% !important;
|
|
213
|
+
max-width: 100% !important;
|
|
214
|
+
width: 100%;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
#secondary-pane {
|
|
218
|
+
flex: 0 0 0;
|
|
219
|
+
height: 0;
|
|
220
|
+
max-height: 0 !important;
|
|
221
|
+
max-width: 0 !important;
|
|
222
|
+
min-height: 0 !important;
|
|
223
|
+
min-width: 0 !important;
|
|
224
|
+
overflow: hidden;
|
|
225
|
+
pointer-events: none;
|
|
226
|
+
visibility: hidden;
|
|
227
|
+
width: 0;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
164
231
|
:host([focus-pane="0"]) {
|
|
165
232
|
#primary-pane {
|
|
166
233
|
display: block;
|
|
@@ -181,10 +248,15 @@
|
|
|
181
248
|
display: none;
|
|
182
249
|
}
|
|
183
250
|
|
|
184
|
-
#primary-pane
|
|
251
|
+
#primary-pane {
|
|
185
252
|
min-height: var(--min-panel-size, 15%);
|
|
186
253
|
}
|
|
187
254
|
|
|
255
|
+
#secondary-pane {
|
|
256
|
+
min-height: var(--min-secondary-panel-size, var(--min-panel-size, 15%));
|
|
257
|
+
z-index: 1;
|
|
258
|
+
}
|
|
259
|
+
|
|
188
260
|
#primary-pane {
|
|
189
261
|
max-height: var(--initial-size, 50%);
|
|
190
262
|
}
|
|
@@ -301,3 +373,7 @@ $padding: 8px;
|
|
|
301
373
|
background-color: rgb(var(--zn-blue)) !important;
|
|
302
374
|
}
|
|
303
375
|
}
|
|
376
|
+
|
|
377
|
+
:host([bordered]) #resizer:before {
|
|
378
|
+
background-color: rgb(var(--zn-border-color));
|
|
379
|
+
}
|