@vaadin/split-layout 23.0.0-alpha1 → 23.0.0-alpha5
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 +7 -7
- package/src/vaadin-split-layout.d.ts +4 -12
- package/src/vaadin-split-layout.js +15 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/split-layout",
|
|
3
|
-
"version": "23.0.0-
|
|
3
|
+
"version": "23.0.0-alpha5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"main": "vaadin-split-layout.js",
|
|
20
20
|
"module": "vaadin-split-layout.js",
|
|
21
|
+
"type": "module",
|
|
21
22
|
"files": [
|
|
22
23
|
"src",
|
|
23
24
|
"theme",
|
|
@@ -32,17 +33,16 @@
|
|
|
32
33
|
"polymer"
|
|
33
34
|
],
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@polymer/iron-resizable-behavior": "^3.0.0",
|
|
36
36
|
"@polymer/polymer": "^3.0.0",
|
|
37
|
-
"@vaadin/component-base": "23.0.0-
|
|
38
|
-
"@vaadin/vaadin-lumo-styles": "23.0.0-
|
|
39
|
-
"@vaadin/vaadin-material-styles": "23.0.0-
|
|
40
|
-
"@vaadin/vaadin-themable-mixin": "23.0.0-
|
|
37
|
+
"@vaadin/component-base": "23.0.0-alpha5",
|
|
38
|
+
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha5",
|
|
39
|
+
"@vaadin/vaadin-material-styles": "23.0.0-alpha5",
|
|
40
|
+
"@vaadin/vaadin-themable-mixin": "23.0.0-alpha5"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@esm-bundle/chai": "^4.3.4",
|
|
44
44
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
45
45
|
"sinon": "^9.2.1"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "74f9294964eb8552d96578c14af6ad214f5257bc"
|
|
48
48
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
|
|
7
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
8
7
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
8
|
|
|
@@ -138,13 +137,6 @@ export interface SplitLayoutEventMap extends HTMLElementEventMap, SplitLayoutCus
|
|
|
138
137
|
* </vaadin-split-layout>
|
|
139
138
|
* ```
|
|
140
139
|
*
|
|
141
|
-
* ### Resize Notification
|
|
142
|
-
*
|
|
143
|
-
* This element implements `IronResizableBehavior` to notify the nested resizables
|
|
144
|
-
* when the splitter is dragged. In order to define a resizable and receive that
|
|
145
|
-
* notification in a nested element, include `IronResizableBehavior` and listen
|
|
146
|
-
* for the `iron-resize` event.
|
|
147
|
-
*
|
|
148
140
|
* ### Styling
|
|
149
141
|
*
|
|
150
142
|
* The following shadow DOM parts are available for styling:
|
|
@@ -158,15 +150,15 @@ export interface SplitLayoutEventMap extends HTMLElementEventMap, SplitLayoutCus
|
|
|
158
150
|
*
|
|
159
151
|
* @fires {Event} splitter-dragend - Fired after dragging the splitter have ended.
|
|
160
152
|
*/
|
|
161
|
-
declare class SplitLayout extends ElementMixin(ThemableMixin(
|
|
153
|
+
declare class SplitLayout extends ElementMixin(ThemableMixin(HTMLElement)) {
|
|
162
154
|
/**
|
|
163
155
|
* The split layout's orientation. Possible values are: `horizontal|vertical`.
|
|
164
156
|
*/
|
|
165
157
|
orientation: 'horizontal' | 'vertical';
|
|
166
158
|
|
|
167
159
|
/**
|
|
168
|
-
*
|
|
169
|
-
*
|
|
160
|
+
* @deprecated Since Vaadin 23, `notifyResize()` is deprecated. The component uses a
|
|
161
|
+
* ResizeObserver internally and doesn't need to be explicitly notified of resizes.
|
|
170
162
|
*/
|
|
171
163
|
notifyResize(): void;
|
|
172
164
|
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2016 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';
|
|
7
|
-
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
|
|
8
|
-
import { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
|
|
9
6
|
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
10
7
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
11
8
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
|
+
import { addListener } from '@vaadin/component-base/src/gestures.js';
|
|
12
10
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
11
|
|
|
14
12
|
/**
|
|
@@ -152,11 +150,8 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
152
150
|
* @extends HTMLElement
|
|
153
151
|
* @mixes ElementMixin
|
|
154
152
|
* @mixes ThemableMixin
|
|
155
|
-
* @mixes GestureEventListeners
|
|
156
153
|
*/
|
|
157
|
-
class SplitLayout extends ElementMixin(
|
|
158
|
-
ThemableMixin(GestureEventListeners(mixinBehaviors([IronResizableBehavior], PolymerElement)))
|
|
159
|
-
) {
|
|
154
|
+
class SplitLayout extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
160
155
|
static get template() {
|
|
161
156
|
return html`
|
|
162
157
|
<style>
|
|
@@ -207,13 +202,7 @@ class SplitLayout extends ElementMixin(
|
|
|
207
202
|
}
|
|
208
203
|
</style>
|
|
209
204
|
<slot id="primary" name="primary"></slot>
|
|
210
|
-
<div
|
|
211
|
-
part="splitter"
|
|
212
|
-
id="splitter"
|
|
213
|
-
on-track="_onHandleTrack"
|
|
214
|
-
on-down="_setPointerEventsNone"
|
|
215
|
-
on-up="_restorePointerEvents"
|
|
216
|
-
>
|
|
205
|
+
<div part="splitter" id="splitter">
|
|
217
206
|
<div part="handle"></div>
|
|
218
207
|
</div>
|
|
219
208
|
<slot id="secondary" name="secondary"></slot>
|
|
@@ -248,11 +237,16 @@ class SplitLayout extends ElementMixin(
|
|
|
248
237
|
ready() {
|
|
249
238
|
super.ready();
|
|
250
239
|
this.__observer = new FlattenedNodesObserver(this, this._processChildren);
|
|
240
|
+
|
|
241
|
+
const splitter = this.$.splitter;
|
|
242
|
+
addListener(splitter, 'track', this._onHandleTrack.bind(this));
|
|
243
|
+
addListener(splitter, 'down', this._setPointerEventsNone.bind(this));
|
|
244
|
+
addListener(splitter, 'up', this._restorePointerEvents.bind(this));
|
|
251
245
|
}
|
|
252
246
|
|
|
253
247
|
/** @private */
|
|
254
248
|
_processChildren() {
|
|
255
|
-
this.
|
|
249
|
+
[...this.children].forEach((child, i) => {
|
|
256
250
|
if (i === 0) {
|
|
257
251
|
this._primaryChild = child;
|
|
258
252
|
child.setAttribute('slot', 'primary');
|
|
@@ -321,8 +315,6 @@ class SplitLayout extends ElementMixin(
|
|
|
321
315
|
this._setFlexBasis(this._primaryChild, this._startSize.primary + dirDistance, this._startSize.container);
|
|
322
316
|
this._setFlexBasis(this._secondaryChild, this._startSize.secondary - dirDistance, this._startSize.container);
|
|
323
317
|
|
|
324
|
-
this.notifyResize();
|
|
325
|
-
|
|
326
318
|
if (event.detail.state === 'end') {
|
|
327
319
|
this.dispatchEvent(new CustomEvent('splitter-dragend'));
|
|
328
320
|
|
|
@@ -331,23 +323,15 @@ class SplitLayout extends ElementMixin(
|
|
|
331
323
|
}
|
|
332
324
|
|
|
333
325
|
/**
|
|
334
|
-
*
|
|
335
|
-
*
|
|
326
|
+
* @deprecated Since Vaadin 23, `notifyResize()` is deprecated. The component uses a
|
|
327
|
+
* ResizeObserver internally and doesn't need to be explicitly notified of resizes.
|
|
336
328
|
*/
|
|
337
329
|
notifyResize() {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
330
|
+
console.warn(
|
|
331
|
+
`WARNING: Since Vaadin 23, notifyResize() is deprecated. The component uses a ResizeObserver internally and doesn't need to be explicitly notified of resizes.`
|
|
332
|
+
);
|
|
341
333
|
}
|
|
342
334
|
|
|
343
|
-
/**
|
|
344
|
-
* Fired when the splitter is dragged. Non-bubbling. Fired for the splitter
|
|
345
|
-
* element and any nested elements with `IronResizableBehavior`.
|
|
346
|
-
*
|
|
347
|
-
* DEPRECATED: This event will be dropped in one of the future Vaadin versions. Use a ResizeObserver instead.
|
|
348
|
-
* @event iron-resize
|
|
349
|
-
*/
|
|
350
|
-
|
|
351
335
|
/**
|
|
352
336
|
* Fired after dragging the splitter have ended.
|
|
353
337
|
*
|