@vaadin/split-layout 24.2.0-alpha5 → 24.2.0-alpha6
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/package.json +9 -6
- package/src/vaadin-split-layout-mixin.d.ts +17 -0
- package/src/vaadin-split-layout-mixin.js +141 -0
- package/src/vaadin-split-layout-styles.d.ts +8 -0
- package/src/vaadin-split-layout-styles.js +65 -0
- package/src/vaadin-split-layout.d.ts +2 -6
- package/src/vaadin-split-layout.js +7 -182
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/split-layout",
|
|
3
|
-
"version": "24.2.0-
|
|
3
|
+
"version": "24.2.0-alpha6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
+
"!src/vaadin-lit-split-layout.d.ts",
|
|
25
|
+
"!src/vaadin-lit-split-layout.js",
|
|
24
26
|
"theme",
|
|
25
27
|
"vaadin-*.d.ts",
|
|
26
28
|
"vaadin-*.js",
|
|
@@ -35,11 +37,12 @@
|
|
|
35
37
|
"polymer"
|
|
36
38
|
],
|
|
37
39
|
"dependencies": {
|
|
40
|
+
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
41
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/component-base": "24.2.0-
|
|
40
|
-
"@vaadin/vaadin-lumo-styles": "24.2.0-
|
|
41
|
-
"@vaadin/vaadin-material-styles": "24.2.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "24.2.0-
|
|
42
|
+
"@vaadin/component-base": "24.2.0-alpha6",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "24.2.0-alpha6",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "24.2.0-alpha6",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "24.2.0-alpha6"
|
|
43
46
|
},
|
|
44
47
|
"devDependencies": {
|
|
45
48
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -50,5 +53,5 @@
|
|
|
50
53
|
"web-types.json",
|
|
51
54
|
"web-types.lit.json"
|
|
52
55
|
],
|
|
53
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "3ef6e6cd66919b3ef7637e42916e4c54656beb51"
|
|
54
57
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
|
|
8
|
+
export declare function SplitLayoutMixin<T extends Constructor<HTMLElement>>(
|
|
9
|
+
base: T,
|
|
10
|
+
): Constructor<SplitLayoutMixinClass> & T;
|
|
11
|
+
|
|
12
|
+
export declare class SplitLayoutMixinClass {
|
|
13
|
+
/**
|
|
14
|
+
* The split layout's orientation. Possible values are: `horizontal|vertical`.
|
|
15
|
+
*/
|
|
16
|
+
orientation: 'horizontal' | 'vertical';
|
|
17
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { addListener } from '@vaadin/component-base/src/gestures.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @polymerMixin
|
|
10
|
+
*/
|
|
11
|
+
export const SplitLayoutMixin = (superClass) =>
|
|
12
|
+
class SplitLayoutMixin extends superClass {
|
|
13
|
+
static get properties() {
|
|
14
|
+
return {
|
|
15
|
+
/**
|
|
16
|
+
* The split layout's orientation. Possible values are: `horizontal|vertical`.
|
|
17
|
+
* @type {string}
|
|
18
|
+
*/
|
|
19
|
+
orientation: {
|
|
20
|
+
type: String,
|
|
21
|
+
reflectToAttribute: true,
|
|
22
|
+
value: 'horizontal',
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
/** @private */
|
|
26
|
+
_previousPrimaryPointerEvents: String,
|
|
27
|
+
|
|
28
|
+
/** @private */
|
|
29
|
+
_previousSecondaryPointerEvents: String,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** @protected */
|
|
34
|
+
ready() {
|
|
35
|
+
super.ready();
|
|
36
|
+
|
|
37
|
+
this._processChildren();
|
|
38
|
+
|
|
39
|
+
this.__observer = new MutationObserver((mutations) => {
|
|
40
|
+
mutations.forEach((mutation) => {
|
|
41
|
+
this._cleanupNodes(mutation.removedNodes);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
this._processChildren();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
this.__observer.observe(this, { childList: true });
|
|
48
|
+
|
|
49
|
+
const splitter = this.$.splitter;
|
|
50
|
+
addListener(splitter, 'track', this._onHandleTrack.bind(this));
|
|
51
|
+
addListener(splitter, 'down', this._setPointerEventsNone.bind(this));
|
|
52
|
+
addListener(splitter, 'up', this._restorePointerEvents.bind(this));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** @private */
|
|
56
|
+
_cleanupNodes(nodes) {
|
|
57
|
+
nodes.forEach((node) => {
|
|
58
|
+
if (!(node.parentElement instanceof this.constructor)) {
|
|
59
|
+
node.removeAttribute('slot');
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** @private */
|
|
65
|
+
_processChildren() {
|
|
66
|
+
[...this.children].forEach((child, i) => {
|
|
67
|
+
if (i === 0) {
|
|
68
|
+
this._primaryChild = child;
|
|
69
|
+
child.setAttribute('slot', 'primary');
|
|
70
|
+
} else if (i === 1) {
|
|
71
|
+
this._secondaryChild = child;
|
|
72
|
+
child.setAttribute('slot', 'secondary');
|
|
73
|
+
} else {
|
|
74
|
+
child.removeAttribute('slot');
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** @private */
|
|
80
|
+
_setFlexBasis(element, flexBasis, containerSize) {
|
|
81
|
+
flexBasis = Math.max(0, Math.min(flexBasis, containerSize));
|
|
82
|
+
if (flexBasis === 0) {
|
|
83
|
+
// Pure zero does not play well in Safari
|
|
84
|
+
flexBasis = 0.000001;
|
|
85
|
+
}
|
|
86
|
+
element.style.flex = `1 1 ${flexBasis}px`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** @private */
|
|
90
|
+
_setPointerEventsNone(event) {
|
|
91
|
+
if (!this._primaryChild || !this._secondaryChild) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this._previousPrimaryPointerEvents = this._primaryChild.style.pointerEvents;
|
|
95
|
+
this._previousSecondaryPointerEvents = this._secondaryChild.style.pointerEvents;
|
|
96
|
+
this._primaryChild.style.pointerEvents = 'none';
|
|
97
|
+
this._secondaryChild.style.pointerEvents = 'none';
|
|
98
|
+
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** @private */
|
|
103
|
+
_restorePointerEvents() {
|
|
104
|
+
if (!this._primaryChild || !this._secondaryChild) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
this._primaryChild.style.pointerEvents = this._previousPrimaryPointerEvents;
|
|
108
|
+
this._secondaryChild.style.pointerEvents = this._previousSecondaryPointerEvents;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** @private */
|
|
112
|
+
_onHandleTrack(event) {
|
|
113
|
+
if (!this._primaryChild || !this._secondaryChild) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const size = this.orientation === 'vertical' ? 'height' : 'width';
|
|
118
|
+
if (event.detail.state === 'start') {
|
|
119
|
+
this._startSize = {
|
|
120
|
+
container: this.getBoundingClientRect()[size] - this.$.splitter.getBoundingClientRect()[size],
|
|
121
|
+
primary: this._primaryChild.getBoundingClientRect()[size],
|
|
122
|
+
secondary: this._secondaryChild.getBoundingClientRect()[size],
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const distance = this.orientation === 'vertical' ? event.detail.dy : event.detail.dx;
|
|
129
|
+
const isRtl = this.orientation !== 'vertical' && this.__isRTL;
|
|
130
|
+
const dirDistance = isRtl ? -distance : distance;
|
|
131
|
+
|
|
132
|
+
this._setFlexBasis(this._primaryChild, this._startSize.primary + dirDistance, this._startSize.container);
|
|
133
|
+
this._setFlexBasis(this._secondaryChild, this._startSize.secondary - dirDistance, this._startSize.container);
|
|
134
|
+
|
|
135
|
+
if (event.detail.state === 'end') {
|
|
136
|
+
this.dispatchEvent(new CustomEvent('splitter-dragend'));
|
|
137
|
+
|
|
138
|
+
delete this._startSize;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const splitLayoutStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
display: flex;
|
|
11
|
+
overflow: hidden !important;
|
|
12
|
+
transform: translateZ(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host([hidden]) {
|
|
16
|
+
display: none !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host([orientation='vertical']) {
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host ::slotted(*) {
|
|
24
|
+
flex: 1 1 auto;
|
|
25
|
+
overflow: auto;
|
|
26
|
+
-webkit-overflow-scrolling: touch;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[part='splitter'] {
|
|
30
|
+
flex: none;
|
|
31
|
+
position: relative;
|
|
32
|
+
z-index: 1;
|
|
33
|
+
overflow: visible;
|
|
34
|
+
min-width: 8px;
|
|
35
|
+
min-height: 8px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host(:not([orientation='vertical'])) > [part='splitter'] {
|
|
39
|
+
cursor: ew-resize;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host([orientation='vertical']) > [part='splitter'] {
|
|
43
|
+
cursor: ns-resize;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[part='handle'] {
|
|
47
|
+
width: 40px;
|
|
48
|
+
height: 40px;
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 50%;
|
|
51
|
+
left: 50%;
|
|
52
|
+
transform: translate3d(-50%, -50%, 0);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@media (forced-colors: active) {
|
|
56
|
+
[part~='splitter'] {
|
|
57
|
+
outline: 1px solid;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
[part~='handle']::after {
|
|
61
|
+
background-color: AccentColor !important;
|
|
62
|
+
forced-color-adjust: none;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
7
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
+
import { SplitLayoutMixin } from './vaadin-split-layout-mixin.js';
|
|
8
9
|
|
|
9
10
|
export interface SplitLayoutCustomEventMap {
|
|
10
11
|
'splitter-dragend': Event;
|
|
@@ -150,12 +151,7 @@ export interface SplitLayoutEventMap extends HTMLElementEventMap, SplitLayoutCus
|
|
|
150
151
|
*
|
|
151
152
|
* @fires {Event} splitter-dragend - Fired after dragging the splitter have ended.
|
|
152
153
|
*/
|
|
153
|
-
declare class SplitLayout extends ElementMixin(ThemableMixin(HTMLElement)) {
|
|
154
|
-
/**
|
|
155
|
-
* The split layout's orientation. Possible values are: `horizontal|vertical`.
|
|
156
|
-
*/
|
|
157
|
-
orientation: 'horizontal' | 'vertical';
|
|
158
|
-
|
|
154
|
+
declare class SplitLayout extends SplitLayoutMixin(ElementMixin(ThemableMixin(HTMLElement))) {
|
|
159
155
|
addEventListener<K extends keyof SplitLayoutEventMap>(
|
|
160
156
|
type: K,
|
|
161
157
|
listener: (this: SplitLayout, ev: SplitLayoutEventMap[K]) => void,
|
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
* Copyright (c) 2016 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
7
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
8
7
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
+
import { SplitLayoutMixin } from './vaadin-split-layout-mixin.js';
|
|
10
|
+
import { splitLayoutStyles } from './vaadin-split-layout-styles.js';
|
|
11
|
+
|
|
12
|
+
registerStyles('vaadin-split-layout', splitLayoutStyles, { moduleId: 'vaadin-split-layout-styles' });
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* `<vaadin-split-layout>` is a Web Component implementing a split layout for two
|
|
@@ -149,68 +151,12 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
149
151
|
*
|
|
150
152
|
* @extends HTMLElement
|
|
151
153
|
* @mixes ElementMixin
|
|
154
|
+
* @mixes SplitLayoutMixin
|
|
152
155
|
* @mixes ThemableMixin
|
|
153
156
|
*/
|
|
154
|
-
class SplitLayout extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
157
|
+
class SplitLayout extends SplitLayoutMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
155
158
|
static get template() {
|
|
156
159
|
return html`
|
|
157
|
-
<style>
|
|
158
|
-
:host {
|
|
159
|
-
display: flex;
|
|
160
|
-
overflow: hidden !important;
|
|
161
|
-
transform: translateZ(0);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
:host([hidden]) {
|
|
165
|
-
display: none !important;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
:host([orientation='vertical']) {
|
|
169
|
-
flex-direction: column;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
:host ::slotted(*) {
|
|
173
|
-
flex: 1 1 auto;
|
|
174
|
-
overflow: auto;
|
|
175
|
-
-webkit-overflow-scrolling: touch;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
[part='splitter'] {
|
|
179
|
-
flex: none;
|
|
180
|
-
position: relative;
|
|
181
|
-
z-index: 1;
|
|
182
|
-
overflow: visible;
|
|
183
|
-
min-width: 8px;
|
|
184
|
-
min-height: 8px;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
:host(:not([orientation='vertical'])) > [part='splitter'] {
|
|
188
|
-
cursor: ew-resize;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
:host([orientation='vertical']) > [part='splitter'] {
|
|
192
|
-
cursor: ns-resize;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
[part='handle'] {
|
|
196
|
-
width: 40px;
|
|
197
|
-
height: 40px;
|
|
198
|
-
position: absolute;
|
|
199
|
-
top: 50%;
|
|
200
|
-
left: 50%;
|
|
201
|
-
transform: translate3d(-50%, -50%, 0);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
@media (forced-colors: active) {
|
|
205
|
-
[part~='splitter'] {
|
|
206
|
-
outline: 1px solid;
|
|
207
|
-
}
|
|
208
|
-
[part~='handle']::after {
|
|
209
|
-
background-color: AccentColor !important;
|
|
210
|
-
forced-color-adjust: none;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
</style>
|
|
214
160
|
<slot id="primary" name="primary"></slot>
|
|
215
161
|
<div part="splitter" id="splitter">
|
|
216
162
|
<div part="handle"></div>
|
|
@@ -223,127 +169,6 @@ class SplitLayout extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
223
169
|
return 'vaadin-split-layout';
|
|
224
170
|
}
|
|
225
171
|
|
|
226
|
-
static get properties() {
|
|
227
|
-
return {
|
|
228
|
-
/**
|
|
229
|
-
* The split layout's orientation. Possible values are: `horizontal|vertical`.
|
|
230
|
-
* @type {string}
|
|
231
|
-
*/
|
|
232
|
-
orientation: {
|
|
233
|
-
type: String,
|
|
234
|
-
reflectToAttribute: true,
|
|
235
|
-
value: 'horizontal',
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
-
/** @private */
|
|
239
|
-
_previousPrimaryPointerEvents: String,
|
|
240
|
-
|
|
241
|
-
/** @private */
|
|
242
|
-
_previousSecondaryPointerEvents: String,
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
/** @protected */
|
|
247
|
-
ready() {
|
|
248
|
-
super.ready();
|
|
249
|
-
this.__observer = new FlattenedNodesObserver(this, (info) => {
|
|
250
|
-
this._cleanupNodes(info.removedNodes);
|
|
251
|
-
this._processChildren();
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
const splitter = this.$.splitter;
|
|
255
|
-
addListener(splitter, 'track', this._onHandleTrack.bind(this));
|
|
256
|
-
addListener(splitter, 'down', this._setPointerEventsNone.bind(this));
|
|
257
|
-
addListener(splitter, 'up', this._restorePointerEvents.bind(this));
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/** @private */
|
|
261
|
-
_cleanupNodes(nodes) {
|
|
262
|
-
nodes.forEach((node) => {
|
|
263
|
-
if (!(node.parentElement instanceof SplitLayout)) {
|
|
264
|
-
node.removeAttribute('slot');
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/** @private */
|
|
270
|
-
_processChildren() {
|
|
271
|
-
[...this.children].forEach((child, i) => {
|
|
272
|
-
if (i === 0) {
|
|
273
|
-
this._primaryChild = child;
|
|
274
|
-
child.setAttribute('slot', 'primary');
|
|
275
|
-
} else if (i === 1) {
|
|
276
|
-
this._secondaryChild = child;
|
|
277
|
-
child.setAttribute('slot', 'secondary');
|
|
278
|
-
} else {
|
|
279
|
-
child.removeAttribute('slot');
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/** @private */
|
|
285
|
-
_setFlexBasis(element, flexBasis, containerSize) {
|
|
286
|
-
flexBasis = Math.max(0, Math.min(flexBasis, containerSize));
|
|
287
|
-
if (flexBasis === 0) {
|
|
288
|
-
// Pure zero does not play well in Safari
|
|
289
|
-
flexBasis = 0.000001;
|
|
290
|
-
}
|
|
291
|
-
element.style.flex = `1 1 ${flexBasis}px`;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/** @private */
|
|
295
|
-
_setPointerEventsNone(event) {
|
|
296
|
-
if (!this._primaryChild || !this._secondaryChild) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
this._previousPrimaryPointerEvents = this._primaryChild.style.pointerEvents;
|
|
300
|
-
this._previousSecondaryPointerEvents = this._secondaryChild.style.pointerEvents;
|
|
301
|
-
this._primaryChild.style.pointerEvents = 'none';
|
|
302
|
-
this._secondaryChild.style.pointerEvents = 'none';
|
|
303
|
-
|
|
304
|
-
event.preventDefault();
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
/** @private */
|
|
308
|
-
_restorePointerEvents() {
|
|
309
|
-
if (!this._primaryChild || !this._secondaryChild) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
this._primaryChild.style.pointerEvents = this._previousPrimaryPointerEvents;
|
|
313
|
-
this._secondaryChild.style.pointerEvents = this._previousSecondaryPointerEvents;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/** @private */
|
|
317
|
-
_onHandleTrack(event) {
|
|
318
|
-
if (!this._primaryChild || !this._secondaryChild) {
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
const size = this.orientation === 'vertical' ? 'height' : 'width';
|
|
323
|
-
if (event.detail.state === 'start') {
|
|
324
|
-
this._startSize = {
|
|
325
|
-
container: this.getBoundingClientRect()[size] - this.$.splitter.getBoundingClientRect()[size],
|
|
326
|
-
primary: this._primaryChild.getBoundingClientRect()[size],
|
|
327
|
-
secondary: this._secondaryChild.getBoundingClientRect()[size],
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
const distance = this.orientation === 'vertical' ? event.detail.dy : event.detail.dx;
|
|
334
|
-
const isRtl = this.orientation !== 'vertical' && this.__isRTL;
|
|
335
|
-
const dirDistance = isRtl ? -distance : distance;
|
|
336
|
-
|
|
337
|
-
this._setFlexBasis(this._primaryChild, this._startSize.primary + dirDistance, this._startSize.container);
|
|
338
|
-
this._setFlexBasis(this._secondaryChild, this._startSize.secondary - dirDistance, this._startSize.container);
|
|
339
|
-
|
|
340
|
-
if (event.detail.state === 'end') {
|
|
341
|
-
this.dispatchEvent(new CustomEvent('splitter-dragend'));
|
|
342
|
-
|
|
343
|
-
delete this._startSize;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
172
|
/**
|
|
348
173
|
* Fired after dragging the splitter have ended.
|
|
349
174
|
*
|
package/web-types.json
CHANGED
package/web-types.lit.json
CHANGED