@gravitee/ui-components 3.25.3-typescript-ad6021f → 3.25.3-typescript-bfd8f67
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 +5 -8
- package/src/atoms/gv-autocomplete.js +1 -461
- package/src/atoms/gv-button.js +1 -410
- package/src/atoms/gv-checkbox.js +1 -187
- package/src/atoms/gv-date-picker-calendar.js +1 -894
- package/src/atoms/gv-date-picker-cell.js +1 -190
- package/src/atoms/gv-date-picker.js +1 -671
- package/src/atoms/gv-file-upload.js +1 -367
- package/src/atoms/gv-icon.js +1 -103
- package/src/atoms/gv-image.js +1 -144
- package/src/atoms/gv-input-message.js +1 -84
- package/src/atoms/gv-input.js +1 -561
- package/src/atoms/gv-link.js +1 -210
- package/src/atoms/gv-message.js +1 -128
- package/src/atoms/gv-metric.js +1 -117
- package/src/atoms/gv-relative-time.js +1 -156
- package/src/atoms/gv-select-native.js +1 -388
- package/src/atoms/gv-select.js +1 -437
- package/src/atoms/gv-spinner.js +1 -57
- package/src/atoms/gv-state.js +1 -130
- package/src/atoms/gv-switch.js +1 -243
- package/src/atoms/gv-tag.js +1 -168
- package/src/atoms/gv-text.js +1 -168
- package/src/charts/gv-chart-bar.js +1 -103
- package/src/charts/gv-chart-gauge.js +1 -100
- package/src/charts/gv-chart-histogram.js +1 -83
- package/src/charts/gv-chart-line.js +1 -224
- package/src/charts/gv-chart-map.js +1 -112
- package/src/charts/gv-chart-pie.js +1 -91
- package/src/index.js +1 -77
- package/src/lib/cron-expression.js +1 -205
- package/src/lib/date.js +1 -44
- package/src/lib/events.js +1 -26
- package/src/lib/http-client-schema-form.js +1 -67
- package/src/lib/http.js +1 -237
- package/src/lib/i18n.js +1 -103
- package/src/lib/item.js +1 -118
- package/src/lib/properties.js +1 -189
- package/src/lib/schema-form.js +1 -44
- package/src/lib/studio.js +1 -141
- package/src/lib/style.js +1 -41
- package/src/lib/text-format.js +1 -69
- package/src/lib/theme.js +1 -63
- package/src/lib/utils.js +1 -111
- package/src/mixins/chart-element.js +1 -165
- package/src/mixins/input-element.js +1 -144
- package/src/mixins/item-resource.js +1 -120
- package/src/mixins/keyboard-element.js +1 -69
- package/src/mixins/update-after-browser.js +1 -30
- package/src/mixins/with-resize-observer.js +1 -68
- package/src/mixins/with-skeleton-attribute.js +1 -112
- package/src/molecules/gv-card-full.js +1 -218
- package/src/molecules/gv-card-list.js +1 -113
- package/src/molecules/gv-card.js +1 -133
- package/src/molecules/gv-category-list.js +1 -60
- package/src/molecules/gv-category.js +1 -170
- package/src/molecules/gv-code.js +1 -359
- package/src/molecules/gv-confirm.js +1 -188
- package/src/molecules/gv-cron-editor.js +1 -710
- package/src/molecules/gv-dropdown-menu.js +1 -116
- package/src/molecules/gv-expandable.js +1 -122
- package/src/molecules/gv-expression-language.js +1 -270
- package/src/molecules/gv-identity-picture.js +1 -148
- package/src/molecules/gv-list.js +1 -227
- package/src/molecules/gv-metrics.js +1 -162
- package/src/molecules/gv-modal.js +1 -213
- package/src/molecules/gv-nav.js +1 -196
- package/src/molecules/gv-option.js +1 -242
- package/src/molecules/gv-plans.js +1 -429
- package/src/molecules/gv-popover.js +1 -351
- package/src/molecules/gv-promote.js +1 -209
- package/src/molecules/gv-rating-list.js +1 -365
- package/src/molecules/gv-rating.js +1 -253
- package/src/molecules/gv-row-expandable.js +1 -45
- package/src/molecules/gv-row.js +1 -210
- package/src/molecules/gv-stats.js +1 -121
- package/src/molecules/gv-stepper.js +1 -288
- package/src/molecules/gv-table.js +1 -685
- package/src/molecules/gv-tree.js +1 -250
- package/src/organisms/gv-documentation.js +1 -215
- package/src/organisms/gv-header.js +1 -288
- package/src/organisms/gv-http-client.js +1 -275
- package/src/organisms/gv-menu.js +1 -263
- package/src/organisms/gv-newsletter-subscription.js +1 -271
- package/src/organisms/gv-pagination.js +1 -198
- package/src/organisms/gv-properties.js +1 -920
- package/src/organisms/gv-resizable-views.js +1 -396
- package/src/organisms/gv-resources.js +1 -535
- package/src/organisms/gv-schema-form-array.js +1 -250
- package/src/organisms/gv-schema-form-control-object.js +1 -154
- package/src/organisms/gv-schema-form-control.js +1 -443
- package/src/organisms/gv-schema-form.js +1 -751
- package/src/organisms/gv-tabs.js +1 -210
- package/src/organisms/gv-user-menu.js +1 -314
- package/src/organisms/gv-vertical-menu.js +1 -123
- package/src/policy-studio/gv-flow-step.js +1 -464
- package/src/policy-studio/gv-flow.js +1 -621
- package/src/policy-studio/gv-policy-studio-menu.js +1 -750
- package/src/policy-studio/gv-policy-studio.js +1 -1842
- package/src/styles/empty.js +1 -36
- package/src/styles/input.js +1 -263
- package/src/styles/link.js +1 -32
- package/src/styles/shapes.js +1 -17
- package/src/styles/skeleton.js +1 -53
- package/src/styles/zoom.js +1 -40
- package/src/theme/gv-theme.js +1 -203
- package/wc/gv-autocomplete.js +1 -1
- package/wc/gv-button.js +1 -1
- package/wc/gv-card-full.js +1 -1
- package/wc/gv-card-list.js +1 -1
- package/wc/gv-card.js +1 -1
- package/wc/gv-category-list.js +1 -1
- package/wc/gv-category.js +1 -1
- package/wc/gv-chart-bar.js +1 -1
- package/wc/gv-chart-gauge.js +1 -1
- package/wc/gv-chart-histogram.js +1 -1
- package/wc/gv-chart-line.js +1 -1
- package/wc/gv-chart-map.js +1 -1
- package/wc/gv-chart-pie.js +1 -1
- package/wc/gv-checkbox.js +1 -1
- package/wc/gv-code.js +1 -1
- package/wc/gv-confirm.js +1 -1
- package/wc/gv-cron-editor.js +1 -1
- package/wc/gv-date-picker-calendar.js +1 -1
- package/wc/gv-date-picker-cell.js +1 -1
- package/wc/gv-date-picker.js +1 -1
- package/wc/gv-documentation.js +1 -1
- package/wc/gv-dropdown-menu.js +1 -1
- package/wc/gv-expandable.js +1 -1
- package/wc/gv-expression-language.js +1 -1
- package/wc/gv-file-upload.js +1 -1
- package/wc/gv-flow-step.js +1 -1
- package/wc/gv-flow.js +1 -1
- package/wc/gv-header.js +1 -1
- package/wc/gv-http-client.js +1 -1
- package/wc/gv-icon.js +1 -1
- package/wc/gv-identity-picture.js +1 -1
- package/wc/gv-image.js +1 -1
- package/wc/gv-input-message.js +1 -1
- package/wc/gv-input.js +1 -1
- package/wc/gv-link.js +1 -1
- package/wc/gv-list.js +1 -1
- package/wc/gv-menu.js +1 -1
- package/wc/gv-message.js +1 -1
- package/wc/gv-metric.js +1 -1
- package/wc/gv-metrics.js +1 -1
- package/wc/gv-modal.js +1 -1
- package/wc/gv-nav.js +1 -1
- package/wc/gv-newsletter-subscription.js +1 -1
- package/wc/gv-option.js +1 -1
- package/wc/gv-pagination.js +1 -1
- package/wc/gv-plans.js +1 -1
- package/wc/gv-policy-studio-menu.js +1 -1
- package/wc/gv-policy-studio.js +1 -1
- package/wc/gv-popover.js +1 -1
- package/wc/gv-promote.js +1 -1
- package/wc/gv-properties.js +1 -1
- package/wc/gv-rating-list.js +1 -1
- package/wc/gv-rating.js +1 -1
- package/wc/gv-relative-time.js +1 -1
- package/wc/gv-resizable-views.js +1 -1
- package/wc/gv-resources.js +1 -1
- package/wc/gv-row-expandable.js +1 -1
- package/wc/gv-row.js +1 -1
- package/wc/gv-schema-form-array.js +1 -1
- package/wc/gv-schema-form-control-object.js +1 -1
- package/wc/gv-schema-form-control.js +1 -1
- package/wc/gv-schema-form.js +1 -1
- package/wc/gv-select-native.js +1 -1
- package/wc/gv-select.js +1 -1
- package/wc/gv-spinner.js +1 -1
- package/wc/gv-state.js +1 -1
- package/wc/gv-stats.js +1 -1
- package/wc/gv-stepper.js +1 -1
- package/wc/gv-switch.js +1 -1
- package/wc/gv-table.js +1 -1
- package/wc/gv-tabs.js +1 -1
- package/wc/gv-tag.js +1 -1
- package/wc/gv-text.js +1 -1
- package/wc/gv-theme.js +1 -1
- package/wc/gv-tree.js +1 -1
- package/wc/gv-user-menu.js +1 -1
- package/wc/gv-vertical-menu.js +1 -1
- package/CHANGELOG.md +0 -1292
- package/LICENSE.txt +0 -202
- package/README.md +0 -195
- package/src/.eslintrc.js +0 -19
- package/src/theme/definition.json +0 -1762
|
@@ -1,396 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { css, LitElement, html } from 'lit';
|
|
17
|
-
import { classMap } from 'lit/directives/class-map';
|
|
18
|
-
import { dispatchCustomEvent } from '../lib/events';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Resizable views component
|
|
22
|
-
*
|
|
23
|
-
* @fires gv-resizable-views:resize - when user click to resize action
|
|
24
|
-
* @fires gv-resizable-views:move - when user move the resize cursor
|
|
25
|
-
*
|
|
26
|
-
* @slot top - The top content
|
|
27
|
-
* @slot bottom - The bottom content
|
|
28
|
-
*
|
|
29
|
-
* @attr {String} direction - the direction [vertical|horizonal]
|
|
30
|
-
* @attr {Boolean} no-overflow - true if slot containers should have `overflow: hidden`
|
|
31
|
-
*/
|
|
32
|
-
export class GvResizableViews extends LitElement {
|
|
33
|
-
static get properties() {
|
|
34
|
-
return {
|
|
35
|
-
direction: { type: String, reflect: true },
|
|
36
|
-
noOverflow: { type: Boolean, attribute: 'no-overflow' },
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
constructor() {
|
|
41
|
-
super();
|
|
42
|
-
this.direction = 'vertical';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
split() {
|
|
46
|
-
this.resize();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
maximizeTop() {
|
|
50
|
-
this.resize(85, 15);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
maximizeBottom() {
|
|
54
|
-
this.resize(20, 80);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
resize(top = 50, bottom = 50) {
|
|
58
|
-
this.shadowRoot.querySelector('.top').style.height = `${top}%`;
|
|
59
|
-
this.shadowRoot.querySelector('.bottom').style.height = `${bottom}%`;
|
|
60
|
-
// Dispatch event after transition
|
|
61
|
-
setTimeout(() => {
|
|
62
|
-
dispatchCustomEvent(this, 'resize', { top, bottom });
|
|
63
|
-
}, 350);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
resizable(resizer) {
|
|
67
|
-
const direction = resizer.getAttribute('data-direction') || 'horizontal';
|
|
68
|
-
const prevSibling = resizer.previousElementSibling;
|
|
69
|
-
const nextSibling = resizer.nextElementSibling;
|
|
70
|
-
|
|
71
|
-
// The current position of mouse
|
|
72
|
-
let x = 0;
|
|
73
|
-
let y = 0;
|
|
74
|
-
let prevSiblingHeight = 0;
|
|
75
|
-
let prevSiblingWidth = 0;
|
|
76
|
-
const shadowRoot = this.shadowRoot;
|
|
77
|
-
const me = this;
|
|
78
|
-
|
|
79
|
-
// Handle the mousedown event
|
|
80
|
-
// that's triggered when user drags the resizer
|
|
81
|
-
const mouseDownHandler = function (e) {
|
|
82
|
-
if (!e.target.classList.contains('action')) {
|
|
83
|
-
// Get the current mouse position
|
|
84
|
-
shadowRoot.querySelector('.box').classList.remove('transition');
|
|
85
|
-
x = e.clientX;
|
|
86
|
-
y = e.clientY;
|
|
87
|
-
const rect = prevSibling.getBoundingClientRect();
|
|
88
|
-
prevSiblingHeight = rect.height;
|
|
89
|
-
prevSiblingWidth = rect.width;
|
|
90
|
-
|
|
91
|
-
// Attach the listeners to `document`
|
|
92
|
-
document.addEventListener('mousemove', mouseMoveHandler);
|
|
93
|
-
document.addEventListener('mouseup', mouseUpHandler);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const mouseMoveHandler = function (e) {
|
|
98
|
-
// How far the mouse has been moved
|
|
99
|
-
const dx = e.clientX - x;
|
|
100
|
-
const dy = e.clientY - y;
|
|
101
|
-
dispatchCustomEvent(me, 'move', { direction });
|
|
102
|
-
switch (direction) {
|
|
103
|
-
case 'vertical':
|
|
104
|
-
prevSibling.style.height = `${((prevSiblingHeight + dy) * 100) / resizer.parentNode.getBoundingClientRect().height}%`;
|
|
105
|
-
nextSibling.style.height = `${100 - ((prevSiblingHeight + dy) * 100) / resizer.parentNode.getBoundingClientRect().height}%`;
|
|
106
|
-
break;
|
|
107
|
-
case 'horizontal':
|
|
108
|
-
default:
|
|
109
|
-
prevSibling.style.width = `${((prevSiblingWidth + dx) * 100) / resizer.parentNode.getBoundingClientRect().width}%`;
|
|
110
|
-
break;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const cursor = direction === 'horizontal' ? 'col-resize' : 'row-resize';
|
|
114
|
-
resizer.style.cursor = cursor;
|
|
115
|
-
resizer.classList.add('drag');
|
|
116
|
-
document.body.style.cursor = cursor;
|
|
117
|
-
|
|
118
|
-
prevSibling.style.userSelect = 'none';
|
|
119
|
-
prevSibling.style.pointerEvents = 'none';
|
|
120
|
-
|
|
121
|
-
nextSibling.style.userSelect = 'none';
|
|
122
|
-
nextSibling.style.pointerEvents = 'none';
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const mouseUpHandler = function () {
|
|
126
|
-
resizer.style.removeProperty('cursor');
|
|
127
|
-
resizer.classList.remove('drag');
|
|
128
|
-
document.body.style.removeProperty('cursor');
|
|
129
|
-
|
|
130
|
-
prevSibling.style.removeProperty('user-select');
|
|
131
|
-
prevSibling.style.removeProperty('pointer-events');
|
|
132
|
-
|
|
133
|
-
nextSibling.style.removeProperty('user-select');
|
|
134
|
-
nextSibling.style.removeProperty('pointer-events');
|
|
135
|
-
|
|
136
|
-
// Remove the handlers of `mousemove` and `mouseup`
|
|
137
|
-
document.removeEventListener('mousemove', mouseMoveHandler);
|
|
138
|
-
document.removeEventListener('mouseup', mouseUpHandler);
|
|
139
|
-
|
|
140
|
-
shadowRoot.querySelector('.box').classList.add('transition');
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
// Attach the handler
|
|
144
|
-
resizer.addEventListener('mousedown', mouseDownHandler);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
firstUpdated() {
|
|
148
|
-
this.shadowRoot.querySelectorAll('.resizer').forEach((elt) => this.resizable(elt));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
get shape() {
|
|
152
|
-
if (this.direction === 'horizontal') {
|
|
153
|
-
return 'design:vertical';
|
|
154
|
-
}
|
|
155
|
-
return 'design:horizontal';
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
render() {
|
|
159
|
-
return html`
|
|
160
|
-
<div class="${classMap({ box: true, transition: true, 'no-overflow': this.noOverflow })}">
|
|
161
|
-
<div class="top"><slot name="top"></slot></div>
|
|
162
|
-
<div class="resizer" data-direction="${this.direction}">
|
|
163
|
-
<gv-icon shape="${this.shape}"></gv-icon>
|
|
164
|
-
<div class="actions">
|
|
165
|
-
<gv-icon class="layout-icon" shape="layout:layout-right-panel-2"></gv-icon>
|
|
166
|
-
<gv-button
|
|
167
|
-
small
|
|
168
|
-
link
|
|
169
|
-
class="action"
|
|
170
|
-
icon="layout:layout-bottom-panel"
|
|
171
|
-
title="Maximize top"
|
|
172
|
-
@gv-button:click="${this.maximizeTop}"
|
|
173
|
-
></gv-button>
|
|
174
|
-
<gv-button
|
|
175
|
-
small
|
|
176
|
-
link
|
|
177
|
-
class="action"
|
|
178
|
-
icon="layout:layout-horizontal-2"
|
|
179
|
-
title="Split screen"
|
|
180
|
-
@gv-button:click="${this.split}"
|
|
181
|
-
></gv-button>
|
|
182
|
-
<gv-button
|
|
183
|
-
small
|
|
184
|
-
link
|
|
185
|
-
class="action"
|
|
186
|
-
icon="layout:layout-top-panel-6"
|
|
187
|
-
title="Maximize bottom"
|
|
188
|
-
@gv-button:click="${this.maximizeBottom}"
|
|
189
|
-
></gv-button>
|
|
190
|
-
</div>
|
|
191
|
-
</div>
|
|
192
|
-
<div class="bottom"><slot name="bottom"></slot></div>
|
|
193
|
-
</div>
|
|
194
|
-
`;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
static get styles() {
|
|
198
|
-
return [
|
|
199
|
-
// language=css
|
|
200
|
-
css`
|
|
201
|
-
.box {
|
|
202
|
-
display: flex;
|
|
203
|
-
height: 100%;
|
|
204
|
-
flex: 1 1 0;
|
|
205
|
-
flex-direction: column;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
:host([direction='horizontal']) .box {
|
|
209
|
-
flex-direction: row;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
:host([direction='horizontal']) .layout-icon {
|
|
213
|
-
display: none;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
* {
|
|
217
|
-
box-sizing: border-box;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
::slotted(*) {
|
|
221
|
-
display: inline-block;
|
|
222
|
-
width: 100%;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.no-overflow ::slotted(*) {
|
|
226
|
-
height: 100%;
|
|
227
|
-
position: relative;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.top,
|
|
231
|
-
.bottom {
|
|
232
|
-
position: relative;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.no-overflow .top,
|
|
236
|
-
.no-overflow .bottom {
|
|
237
|
-
overflow: hidden;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.bottom {
|
|
241
|
-
display: flex;
|
|
242
|
-
flex-grow: 1;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.left {
|
|
246
|
-
width: 70%;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.left,
|
|
250
|
-
.right {
|
|
251
|
-
padding: 0.2rem;
|
|
252
|
-
overflow: auto;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
.top,
|
|
256
|
-
.bottom {
|
|
257
|
-
border-left: 1px solid #bfbfbf;
|
|
258
|
-
border-right: 1px solid #bfbfbf;
|
|
259
|
-
height: 100%;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
:host([direction='horizontal']) .top {
|
|
263
|
-
border-right: 0;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
:host([direction='horizontal']) .bottom {
|
|
267
|
-
border-left: 0;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
.transition .top,
|
|
271
|
-
.transition .bottom {
|
|
272
|
-
transition: height 350ms ease-in-out;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.top {
|
|
276
|
-
overflow-y: auto;
|
|
277
|
-
overflow-x: hidden;
|
|
278
|
-
height: 50%;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
.bottom {
|
|
282
|
-
overflow-y: auto;
|
|
283
|
-
overflow-x: hidden;
|
|
284
|
-
height: 50%;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
:host([direction='horizontal']) .top,
|
|
288
|
-
:host([direction='horizontal']) .bottom {
|
|
289
|
-
height: 100%;
|
|
290
|
-
width: 50%;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
.resizer {
|
|
294
|
-
z-index: 10;
|
|
295
|
-
background-color: #d9d9d9;
|
|
296
|
-
--gv-icon--s: 20px;
|
|
297
|
-
display: flex;
|
|
298
|
-
align-items: center;
|
|
299
|
-
justify-content: flex-end;
|
|
300
|
-
--gv-icon--c: #28444f;
|
|
301
|
-
transition: all 0.2s ease-in-out;
|
|
302
|
-
position: relative;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
.resizer.drag {
|
|
306
|
-
border-width: 4px 0;
|
|
307
|
-
border-style: double;
|
|
308
|
-
border-color: #d9d9d9;
|
|
309
|
-
background-color: white;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
.resizer gv-icon,
|
|
313
|
-
.resizer .actions {
|
|
314
|
-
transition: all 0.2s ease-in-out;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
.resizer.drag gv-icon,
|
|
318
|
-
.resizer.drag .actions {
|
|
319
|
-
visibility: hidden;
|
|
320
|
-
opacity: 0;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
:host([direction='horizontal']) .resizer.drag {
|
|
324
|
-
border-width: 0 4px;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.resizer > gv-icon {
|
|
328
|
-
position: absolute;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
:host([direction='horizontal']) .resizer {
|
|
332
|
-
align-items: flex-start;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
:host([direction='vertical']) .resizer gv-icon {
|
|
336
|
-
right: 45px;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
:host([direction='horizontal']) .resizer gv-icon {
|
|
340
|
-
left: -9px;
|
|
341
|
-
top: 45px;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
.resizer[data-direction='vertical'] {
|
|
345
|
-
cursor: ns-resize;
|
|
346
|
-
height: 2px;
|
|
347
|
-
width: 100%;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
.resizer[data-direction='horizontal'] {
|
|
351
|
-
cursor: ew-resize;
|
|
352
|
-
height: 100%;
|
|
353
|
-
width: 2px;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
.actions {
|
|
357
|
-
margin-top: -22px;
|
|
358
|
-
margin-right: 15px;
|
|
359
|
-
padding: 0 0.2rem;
|
|
360
|
-
border-radius: 4px 4px 0 0;
|
|
361
|
-
background-color: #d9d9d9;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.actions gv-button {
|
|
365
|
-
margin: 0.2rem 0.1rem;
|
|
366
|
-
visibility: hidden;
|
|
367
|
-
opacity: 0;
|
|
368
|
-
display: none;
|
|
369
|
-
transition: all 250ms ease-in-out;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
.actions:focus-within,
|
|
373
|
-
.actions:hover {
|
|
374
|
-
padding: 0.2rem;
|
|
375
|
-
margin-top: -66px;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
.actions:focus-within gv-button,
|
|
379
|
-
.actions:hover gv-button {
|
|
380
|
-
display: block;
|
|
381
|
-
opacity: 1;
|
|
382
|
-
visibility: visible;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
.actions:focus-within gv-icon,
|
|
386
|
-
.actions:hover gv-icon {
|
|
387
|
-
display: none;
|
|
388
|
-
opacity: 0;
|
|
389
|
-
visibility: hidden;
|
|
390
|
-
}
|
|
391
|
-
`,
|
|
392
|
-
];
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
window.customElements.define('gv-resizable-views', GvResizableViews);
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.GvResizableViews=void 0;const t=require("lit"),e=require("lit/directives/class-map"),o=require("../lib/events");class i extends t.LitElement{static get properties(){return{direction:{type:String,reflect:!0},noOverflow:{type:Boolean,attribute:"no-overflow"}}}constructor(){super(),this.direction="vertical"}split(){this.resize()}maximizeTop(){this.resize(85,15)}maximizeBottom(){this.resize(20,80)}resize(t=50,e=50){this.shadowRoot.querySelector(".top").style.height=`${t}%`,this.shadowRoot.querySelector(".bottom").style.height=`${e}%`,setTimeout((()=>{(0,o.dispatchCustomEvent)(this,"resize",{top:t,bottom:e})}),350)}resizable(t){const e=t.getAttribute("data-direction")||"horizontal",i=t.previousElementSibling,r=t.nextElementSibling;let s=0,n=0,l=0,a=0;const c=this.shadowRoot,d=this,h=function(c){const h=c.clientX-s,v=c.clientY-n;if((0,o.dispatchCustomEvent)(d,"move",{direction:e}),"vertical"===e)i.style.height=100*(l+v)/t.parentNode.getBoundingClientRect().height+"%",r.style.height=100-100*(l+v)/t.parentNode.getBoundingClientRect().height+"%";else i.style.width=100*(a+h)/t.parentNode.getBoundingClientRect().width+"%";const u="horizontal"===e?"col-resize":"row-resize";t.style.cursor=u,t.classList.add("drag"),document.body.style.cursor=u,i.style.userSelect="none",i.style.pointerEvents="none",r.style.userSelect="none",r.style.pointerEvents="none"},v=function(){t.style.removeProperty("cursor"),t.classList.remove("drag"),document.body.style.removeProperty("cursor"),i.style.removeProperty("user-select"),i.style.removeProperty("pointer-events"),r.style.removeProperty("user-select"),r.style.removeProperty("pointer-events"),document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",v),c.querySelector(".box").classList.add("transition")};t.addEventListener("mousedown",(function(t){if(!t.target.classList.contains("action")){c.querySelector(".box").classList.remove("transition"),s=t.clientX,n=t.clientY;const e=i.getBoundingClientRect();l=e.height,a=e.width,document.addEventListener("mousemove",h),document.addEventListener("mouseup",v)}}))}firstUpdated(){this.shadowRoot.querySelectorAll(".resizer").forEach((t=>this.resizable(t)))}get shape(){return"horizontal"===this.direction?"design:vertical":"design:horizontal"}render(){return t.html`<div class="${(0,e.classMap)({box:!0,transition:!0,"no-overflow":this.noOverflow})}"><div class="top"><slot name="top"></slot></div><div class="resizer" data-direction="${this.direction}"><gv-icon shape="${this.shape}"></gv-icon><div class="actions"><gv-icon class="layout-icon" shape="layout:layout-right-panel-2"></gv-icon><gv-button small link class="action" icon="layout:layout-bottom-panel" title="Maximize top" @gv-button:click="${this.maximizeTop}"></gv-button><gv-button small link class="action" icon="layout:layout-horizontal-2" title="Split screen" @gv-button:click="${this.split}"></gv-button><gv-button small link class="action" icon="layout:layout-top-panel-6" title="Maximize bottom" @gv-button:click="${this.maximizeBottom}"></gv-button></div></div><div class="bottom"><slot name="bottom"></slot></div></div>`}static get styles(){return[t.css`.box{display:flex;height:100%;flex:1 1 0;flex-direction:column}:host([direction=horizontal]) .box{flex-direction:row}:host([direction=horizontal]) .layout-icon{display:none}*{box-sizing:border-box}::slotted(*){display:inline-block;width:100%}.no-overflow ::slotted(*){height:100%;position:relative}.bottom,.top{position:relative}.no-overflow .bottom,.no-overflow .top{overflow:hidden}.bottom{display:flex;flex-grow:1}.left{width:70%}.left,.right{padding:.2rem;overflow:auto}.bottom,.top{border-left:1px solid #bfbfbf;border-right:1px solid #bfbfbf;height:100%}:host([direction=horizontal]) .top{border-right:0}:host([direction=horizontal]) .bottom{border-left:0}.transition .bottom,.transition .top{transition:height 350ms ease-in-out}.top{overflow-y:auto;overflow-x:hidden;height:50%}.bottom{overflow-y:auto;overflow-x:hidden;height:50%}:host([direction=horizontal]) .bottom,:host([direction=horizontal]) .top{height:100%;width:50%}.resizer{z-index:10;background-color:#d9d9d9;--gv-icon--s:20px;display:flex;align-items:center;justify-content:flex-end;--gv-icon--c:#28444f;transition:all .2s ease-in-out;position:relative}.resizer.drag{border-width:4px 0;border-style:double;border-color:#d9d9d9;background-color:#fff}.resizer .actions,.resizer gv-icon{transition:all .2s ease-in-out}.resizer.drag .actions,.resizer.drag gv-icon{visibility:hidden;opacity:0}:host([direction=horizontal]) .resizer.drag{border-width:0 4px}.resizer>gv-icon{position:absolute}:host([direction=horizontal]) .resizer{align-items:flex-start}:host([direction=vertical]) .resizer gv-icon{right:45px}:host([direction=horizontal]) .resizer gv-icon{left:-9px;top:45px}.resizer[data-direction=vertical]{cursor:ns-resize;height:2px;width:100%}.resizer[data-direction=horizontal]{cursor:ew-resize;height:100%;width:2px}.actions{margin-top:-22px;margin-right:15px;padding:0 .2rem;border-radius:4px 4px 0 0;background-color:#d9d9d9}.actions gv-button{margin:.2rem .1rem;visibility:hidden;opacity:0;display:none;transition:all 250ms ease-in-out}.actions:focus-within,.actions:hover{padding:.2rem;margin-top:-66px}.actions:focus-within gv-button,.actions:hover gv-button{display:block;opacity:1;visibility:visible}.actions:focus-within gv-icon,.actions:hover gv-icon{display:none;opacity:0;visibility:hidden}`]}}exports.GvResizableViews=i,window.customElements.define("gv-resizable-views",i);
|