igniteui-webcomponents 7.0.1 → 7.1.0
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/CHANGELOG.md +14 -0
- package/components/combo/themes/shared/combo.common.css.js +1 -1
- package/components/combo/themes/shared/combo.common.css.js.map +1 -1
- package/components/combo/types.js.map +1 -1
- package/components/common/definitions/defineAllComponents.js +4 -0
- package/components/common/definitions/defineAllComponents.js.map +1 -1
- package/components/common/mixins/forms/form-transformers.js.map +1 -1
- package/components/common/util.d.ts +11 -1
- package/components/common/util.js +3 -0
- package/components/common/util.js.map +1 -1
- package/components/date-picker/date-picker.js.map +1 -1
- package/components/file-input/file-input.js.map +1 -1
- package/components/highlight/highlight.d.ts +130 -0
- package/components/highlight/highlight.js +77 -0
- package/components/highlight/highlight.js.map +1 -0
- package/components/highlight/service.d.ts +58 -0
- package/components/highlight/service.js +132 -0
- package/components/highlight/service.js.map +1 -0
- package/components/highlight/themes/dark/highlight.bootstrap.css.js +3 -0
- package/components/highlight/themes/dark/highlight.bootstrap.css.js.map +1 -0
- package/components/highlight/themes/dark/highlight.fluent.css.d.ts +1 -0
- package/components/highlight/themes/dark/highlight.fluent.css.js +3 -0
- package/components/highlight/themes/dark/highlight.fluent.css.js.map +1 -0
- package/components/highlight/themes/dark/highlight.indigo.css.d.ts +1 -0
- package/components/highlight/themes/dark/highlight.indigo.css.js +3 -0
- package/components/highlight/themes/dark/highlight.indigo.css.js.map +1 -0
- package/components/highlight/themes/dark/highlight.material.css.d.ts +1 -0
- package/components/highlight/themes/dark/highlight.material.css.js +3 -0
- package/components/highlight/themes/dark/highlight.material.css.js.map +1 -0
- package/components/highlight/themes/dark/highlight.shared.css.d.ts +1 -0
- package/components/highlight/themes/dark/highlight.shared.css.js +3 -0
- package/components/highlight/themes/dark/highlight.shared.css.js.map +1 -0
- package/components/highlight/themes/light/highlight.bootstrap.css.d.ts +1 -0
- package/components/highlight/themes/light/highlight.bootstrap.css.js +3 -0
- package/components/highlight/themes/light/highlight.bootstrap.css.js.map +1 -0
- package/components/highlight/themes/light/highlight.fluent.css.d.ts +1 -0
- package/components/highlight/themes/light/highlight.fluent.css.js +3 -0
- package/components/highlight/themes/light/highlight.fluent.css.js.map +1 -0
- package/components/highlight/themes/light/highlight.indigo.css.d.ts +1 -0
- package/components/highlight/themes/light/highlight.indigo.css.js +3 -0
- package/components/highlight/themes/light/highlight.indigo.css.js.map +1 -0
- package/components/highlight/themes/light/highlight.material.css.d.ts +1 -0
- package/components/highlight/themes/light/highlight.material.css.js +3 -0
- package/components/highlight/themes/light/highlight.material.css.js.map +1 -0
- package/components/highlight/themes/light/highlight.shared.css.d.ts +1 -0
- package/components/highlight/themes/light/highlight.shared.css.js +3 -0
- package/components/highlight/themes/light/highlight.shared.css.js.map +1 -0
- package/components/highlight/themes/shared/highlight.common.css.d.ts +1 -0
- package/components/highlight/themes/shared/highlight.common.css.js +3 -0
- package/components/highlight/themes/shared/highlight.common.css.js.map +1 -0
- package/components/highlight/themes/themes.d.ts +2 -0
- package/components/highlight/themes/themes.js +47 -0
- package/components/highlight/themes/themes.js.map +1 -0
- package/components/splitter/splitter.d.ts +240 -0
- package/components/splitter/splitter.js +608 -0
- package/components/splitter/splitter.js.map +1 -0
- package/components/splitter/themes/dark/splitter.bootstrap.css.d.ts +1 -0
- package/components/splitter/themes/dark/splitter.bootstrap.css.js +3 -0
- package/components/splitter/themes/dark/splitter.bootstrap.css.js.map +1 -0
- package/components/splitter/themes/dark/splitter.fluent.css.d.ts +1 -0
- package/components/splitter/themes/dark/splitter.fluent.css.js +3 -0
- package/components/splitter/themes/dark/splitter.fluent.css.js.map +1 -0
- package/components/splitter/themes/dark/splitter.indigo.css.d.ts +1 -0
- package/components/splitter/themes/dark/splitter.indigo.css.js +3 -0
- package/components/splitter/themes/dark/splitter.indigo.css.js.map +1 -0
- package/components/splitter/themes/dark/splitter.material.css.d.ts +1 -0
- package/components/splitter/themes/dark/splitter.material.css.js +3 -0
- package/components/splitter/themes/dark/splitter.material.css.js.map +1 -0
- package/components/splitter/themes/dark/splitter.shared.css.d.ts +1 -0
- package/components/splitter/themes/dark/splitter.shared.css.js +3 -0
- package/components/splitter/themes/dark/splitter.shared.css.js.map +1 -0
- package/components/splitter/themes/light/splitter.bootstrap.css.d.ts +1 -0
- package/components/splitter/themes/light/splitter.bootstrap.css.js +3 -0
- package/components/splitter/themes/light/splitter.bootstrap.css.js.map +1 -0
- package/components/splitter/themes/light/splitter.fluent.css.d.ts +1 -0
- package/components/splitter/themes/light/splitter.fluent.css.js +3 -0
- package/components/splitter/themes/light/splitter.fluent.css.js.map +1 -0
- package/components/splitter/themes/light/splitter.indigo.css.d.ts +1 -0
- package/components/splitter/themes/light/splitter.indigo.css.js +3 -0
- package/components/splitter/themes/light/splitter.indigo.css.js.map +1 -0
- package/components/splitter/themes/light/splitter.material.css.d.ts +1 -0
- package/components/splitter/themes/light/splitter.material.css.js +3 -0
- package/components/splitter/themes/light/splitter.material.css.js.map +1 -0
- package/components/splitter/themes/light/splitter.shared.css.d.ts +1 -0
- package/components/splitter/themes/light/splitter.shared.css.js +3 -0
- package/components/splitter/themes/light/splitter.shared.css.js.map +1 -0
- package/components/splitter/themes/shared/splitter.common.css.d.ts +1 -0
- package/components/splitter/themes/shared/splitter.common.css.js +3 -0
- package/components/splitter/themes/shared/splitter.common.css.js.map +1 -0
- package/components/splitter/themes/shared/splitter.indigo.css.d.ts +1 -0
- package/components/splitter/themes/shared/splitter.indigo.css.js +3 -0
- package/components/splitter/themes/shared/splitter.indigo.css.js.map +1 -0
- package/components/splitter/themes/splitter.base.css.d.ts +1 -0
- package/components/splitter/themes/splitter.base.css.js +3 -0
- package/components/splitter/themes/splitter.base.css.js.map +1 -0
- package/components/splitter/themes/themes.d.ts +2 -0
- package/components/splitter/themes/themes.js +48 -0
- package/components/splitter/themes/themes.js.map +1 -0
- package/components/splitter/types.d.ts +39 -0
- package/components/splitter/types.js +2 -0
- package/components/splitter/types.js.map +1 -0
- package/components/stepper/{animations.d.ts → common/animations.d.ts} +2 -2
- package/components/stepper/{animations.js → common/animations.js} +2 -2
- package/components/stepper/common/animations.js.map +1 -0
- package/components/stepper/common/context.d.ts +9 -0
- package/components/stepper/common/context.js +3 -0
- package/components/stepper/common/context.js.map +1 -0
- package/components/stepper/common/state.d.ts +67 -0
- package/components/stepper/common/state.js +134 -0
- package/components/stepper/common/state.js.map +1 -0
- package/components/stepper/common/types.js +2 -0
- package/components/stepper/common/types.js.map +1 -0
- package/components/stepper/step.d.ts +101 -55
- package/components/stepper/step.js +145 -160
- package/components/stepper/step.js.map +1 -1
- package/components/stepper/stepper.d.ts +98 -53
- package/components/stepper/stepper.js +168 -308
- package/components/stepper/stepper.js.map +1 -1
- package/components/stepper/themes/step/shared/step.bootstrap.css.js +1 -1
- package/components/stepper/themes/step/shared/step.bootstrap.css.js.map +1 -1
- package/components/stepper/themes/step/shared/step.common.css.js +1 -1
- package/components/stepper/themes/step/shared/step.common.css.js.map +1 -1
- package/components/stepper/themes/step/shared/step.indigo.css.js +1 -1
- package/components/stepper/themes/step/shared/step.indigo.css.js.map +1 -1
- package/components/stepper/themes/step/themes.js +2 -3
- package/components/stepper/themes/step/themes.js.map +1 -1
- package/components/tabs/themes/tabs.base.css.js +1 -1
- package/components/tabs/themes/tabs.base.css.js.map +1 -1
- package/components/textarea/textarea.js.map +1 -1
- package/components/types.d.ts +1 -0
- package/components/types.js.map +1 -1
- package/components/visually-hidden/visually-hidden.d.ts +49 -0
- package/components/visually-hidden/visually-hidden.js +26 -0
- package/components/visually-hidden/visually-hidden.js.map +1 -0
- package/custom-elements.json +2681 -379
- package/igniteui-webcomponents.css-data.json +2 -2
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +6 -2
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +3 -1
- package/web-types.json +3 -3
- package/components/stepper/animations.js.map +0 -1
- package/components/stepper/stepper.common.js +0 -2
- package/components/stepper/stepper.common.js.map +0 -1
- package/components/stepper/themes/step/shared/step.fluent.css.js +0 -3
- package/components/stepper/themes/step/shared/step.fluent.css.js.map +0 -1
- /package/components/{stepper/themes/step/shared/step.fluent.css.d.ts → highlight/themes/dark/highlight.bootstrap.css.d.ts} +0 -0
- /package/components/stepper/{stepper.common.d.ts → common/types.d.ts} +0 -0
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement } from 'lit';
|
|
8
|
+
import { eventOptions, property, query, state } from 'lit/decorators.js';
|
|
9
|
+
import { createRef, ref } from 'lit/directives/ref.js';
|
|
10
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
11
|
+
import { addThemingController } from '../../theming/theming-controller.js';
|
|
12
|
+
import { addInternalsController } from '../common/controllers/internals.js';
|
|
13
|
+
import { addKeybindings, arrowDown, arrowLeft, arrowRight, arrowUp, ctrlKey, endKey, homeKey, } from '../common/controllers/key-bindings.js';
|
|
14
|
+
import { createResizeObserverController } from '../common/controllers/resize-observer.js';
|
|
15
|
+
import { addSlotController, setSlots } from '../common/controllers/slot.js';
|
|
16
|
+
import { registerComponent } from '../common/definitions/register.js';
|
|
17
|
+
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
|
|
18
|
+
import { partMap } from '../common/part-map.js';
|
|
19
|
+
import { asNumber, asPercent, bindIf, clamp, isLTR, roundPrecise, } from '../common/util.js';
|
|
20
|
+
import IgcVisuallyHiddenComponent from '../visually-hidden/visually-hidden.js';
|
|
21
|
+
import { styles as shared } from './themes/shared/splitter.common.css.js';
|
|
22
|
+
import { styles } from './themes/splitter.base.css.js';
|
|
23
|
+
import { all } from './themes/themes.js';
|
|
24
|
+
const KEYBOARD_RESIZE_STEP = 10;
|
|
25
|
+
const DEFAULT_RESIZE_STATE = {
|
|
26
|
+
startPane: null,
|
|
27
|
+
endPane: null,
|
|
28
|
+
isDragging: false,
|
|
29
|
+
dragStartPosition: { x: 0, y: 0 },
|
|
30
|
+
dragPointerId: -1,
|
|
31
|
+
};
|
|
32
|
+
export default class IgcSplitterComponent extends EventEmitterMixin(LitElement) {
|
|
33
|
+
static { this.tagName = 'igc-splitter'; }
|
|
34
|
+
static { this.styles = [styles, shared]; }
|
|
35
|
+
static register() {
|
|
36
|
+
registerComponent(IgcSplitterComponent, IgcVisuallyHiddenComponent);
|
|
37
|
+
}
|
|
38
|
+
get _separator() {
|
|
39
|
+
return this._separatorRef.value;
|
|
40
|
+
}
|
|
41
|
+
get _resizeDisallowed() {
|
|
42
|
+
return this.disableResize || this._collapsedPane != null;
|
|
43
|
+
}
|
|
44
|
+
get _isHorizontal() {
|
|
45
|
+
return this.orientation === 'horizontal';
|
|
46
|
+
}
|
|
47
|
+
get _separatorCursor() {
|
|
48
|
+
if (this._resizeDisallowed) {
|
|
49
|
+
return 'default';
|
|
50
|
+
}
|
|
51
|
+
return this._isHorizontal ? 'col-resize' : 'row-resize';
|
|
52
|
+
}
|
|
53
|
+
set startMinSize(value) {
|
|
54
|
+
this._startPaneState.minSize = this._normalizeValue(value);
|
|
55
|
+
}
|
|
56
|
+
get startMinSize() {
|
|
57
|
+
return this._startPaneState.minSize;
|
|
58
|
+
}
|
|
59
|
+
set endMinSize(value) {
|
|
60
|
+
this._endPaneState.minSize = this._normalizeValue(value);
|
|
61
|
+
}
|
|
62
|
+
get endMinSize() {
|
|
63
|
+
return this._endPaneState.minSize;
|
|
64
|
+
}
|
|
65
|
+
set startMaxSize(value) {
|
|
66
|
+
this._startPaneState.maxSize = this._normalizeValue(value);
|
|
67
|
+
}
|
|
68
|
+
get startMaxSize() {
|
|
69
|
+
return this._startPaneState.maxSize;
|
|
70
|
+
}
|
|
71
|
+
set endMaxSize(value) {
|
|
72
|
+
this._endPaneState.maxSize = this._normalizeValue(value);
|
|
73
|
+
}
|
|
74
|
+
get endMaxSize() {
|
|
75
|
+
return this._endPaneState.maxSize;
|
|
76
|
+
}
|
|
77
|
+
set startSize(value) {
|
|
78
|
+
this._startPaneState.size = this._normalizeValue(value, 'auto');
|
|
79
|
+
}
|
|
80
|
+
get startSize() {
|
|
81
|
+
return this._startPaneState.size;
|
|
82
|
+
}
|
|
83
|
+
set endSize(value) {
|
|
84
|
+
this._endPaneState.size = this._normalizeValue(value, 'auto');
|
|
85
|
+
}
|
|
86
|
+
get endSize() {
|
|
87
|
+
return this._endPaneState.size;
|
|
88
|
+
}
|
|
89
|
+
constructor() {
|
|
90
|
+
super();
|
|
91
|
+
this._internals = addInternalsController(this);
|
|
92
|
+
this._separatorRef = createRef();
|
|
93
|
+
this._startPaneState = { size: 'auto', styles: {} };
|
|
94
|
+
this._endPaneState = { size: 'auto', styles: {} };
|
|
95
|
+
this._collapsedPane = null;
|
|
96
|
+
this._resizeState = { ...DEFAULT_RESIZE_STATE };
|
|
97
|
+
this.orientation = 'horizontal';
|
|
98
|
+
this.disableCollapse = false;
|
|
99
|
+
this.disableResize = false;
|
|
100
|
+
this.hideCollapseButtons = false;
|
|
101
|
+
this.hideDragHandle = false;
|
|
102
|
+
addThemingController(this, all);
|
|
103
|
+
addSlotController(this, { slots: setSlots('start', 'end') });
|
|
104
|
+
createResizeObserverController(this, {
|
|
105
|
+
callback: () => this.requestUpdate(),
|
|
106
|
+
});
|
|
107
|
+
addKeybindings(this, {
|
|
108
|
+
ref: this._separatorRef,
|
|
109
|
+
})
|
|
110
|
+
.set(arrowUp, () => this._handleResizePanes(-1, 'vertical'))
|
|
111
|
+
.set(arrowDown, () => this._handleResizePanes(1, 'vertical'))
|
|
112
|
+
.set(arrowLeft, () => this._handleResizePanes(-1, 'horizontal'))
|
|
113
|
+
.set(arrowRight, () => this._handleResizePanes(1, 'horizontal'))
|
|
114
|
+
.set(homeKey, () => this._handleMinMaxResize('min'))
|
|
115
|
+
.set(endKey, () => this._handleMinMaxResize('max'))
|
|
116
|
+
.set([ctrlKey, arrowUp], () => this._handleArrowsExpandCollapse('start', 'vertical'))
|
|
117
|
+
.set([ctrlKey, arrowDown], () => this._handleArrowsExpandCollapse('end', 'vertical'))
|
|
118
|
+
.set([ctrlKey, arrowLeft], () => this._handleArrowsExpandCollapse('start', 'horizontal'))
|
|
119
|
+
.set([ctrlKey, arrowRight], () => this._handleArrowsExpandCollapse('end', 'horizontal'));
|
|
120
|
+
}
|
|
121
|
+
update(changed) {
|
|
122
|
+
if (changed.get('orientation') != null) {
|
|
123
|
+
for (const pane of ['start', 'end']) {
|
|
124
|
+
const state = this._getPaneState(pane);
|
|
125
|
+
state.size = 'auto';
|
|
126
|
+
state.minSize = undefined;
|
|
127
|
+
state.maxSize = undefined;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (this.hasUpdated) {
|
|
131
|
+
this._updatePanes();
|
|
132
|
+
}
|
|
133
|
+
super.update(changed);
|
|
134
|
+
}
|
|
135
|
+
updated() {
|
|
136
|
+
this._updateBarAria();
|
|
137
|
+
}
|
|
138
|
+
_handleBarPointerDown(e) {
|
|
139
|
+
if (e.button !== 0) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
e.preventDefault();
|
|
143
|
+
this._resizeState = {
|
|
144
|
+
...this._resizeState,
|
|
145
|
+
isDragging: true,
|
|
146
|
+
dragPointerId: e.pointerId,
|
|
147
|
+
dragStartPosition: { x: e.clientX, y: e.clientY },
|
|
148
|
+
};
|
|
149
|
+
this._resizeStart();
|
|
150
|
+
this._separator?.setPointerCapture(this._resizeState.dragPointerId);
|
|
151
|
+
}
|
|
152
|
+
_getDragDelta(e) {
|
|
153
|
+
const deltaX = e.clientX - this._resizeState.dragStartPosition.x;
|
|
154
|
+
const deltaY = e.clientY - this._resizeState.dragStartPosition.y;
|
|
155
|
+
return this._resolveDelta(deltaX, deltaY);
|
|
156
|
+
}
|
|
157
|
+
_handleBarPointerMove(e) {
|
|
158
|
+
if (e.pointerId !== this._resizeState.dragPointerId) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const delta = this._getDragDelta(e);
|
|
162
|
+
if (delta !== 0) {
|
|
163
|
+
this._resizing(delta);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
_handleEndDrag(e) {
|
|
167
|
+
if (e.pointerId !== this._resizeState.dragPointerId) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const delta = this._getDragDelta(e);
|
|
171
|
+
if (delta !== 0) {
|
|
172
|
+
this._resizeEnd(delta);
|
|
173
|
+
}
|
|
174
|
+
this._endDrag();
|
|
175
|
+
}
|
|
176
|
+
_endDrag() {
|
|
177
|
+
if (this._resizeState.dragPointerId !== -1) {
|
|
178
|
+
this._separator?.releasePointerCapture(this._resizeState.dragPointerId);
|
|
179
|
+
}
|
|
180
|
+
this._resizeState = { ...DEFAULT_RESIZE_STATE };
|
|
181
|
+
}
|
|
182
|
+
toggle(position) {
|
|
183
|
+
if (this._collapsedPane === null) {
|
|
184
|
+
this._savePaneSizes();
|
|
185
|
+
}
|
|
186
|
+
this._collapsedPane = this._collapsedPane === position ? null : position;
|
|
187
|
+
this._internals.setState('start-collapsed', this._isCollapsed('start'));
|
|
188
|
+
this._internals.setState('end-collapsed', this._isCollapsed('end'));
|
|
189
|
+
this._restoreSizesOnExpandCollapse();
|
|
190
|
+
}
|
|
191
|
+
_savePaneSizes() {
|
|
192
|
+
this._startPaneState.savedSize = `${this._paneRectAsPercent(0)}%`;
|
|
193
|
+
this._endPaneState.savedSize = `${this._paneRectAsPercent(1)}%`;
|
|
194
|
+
}
|
|
195
|
+
_restoreSizesOnExpandCollapse() {
|
|
196
|
+
if (this._collapsedPane !== null) {
|
|
197
|
+
this._startPaneState.size = 'auto';
|
|
198
|
+
this._endPaneState.size = 'auto';
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
this._startPaneState.size =
|
|
202
|
+
this._startPaneState.savedSize ?? this.startSize;
|
|
203
|
+
this._endPaneState.size = this._endPaneState.savedSize ?? this.endSize;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
_paneRectAsPercent(paneIndex) {
|
|
207
|
+
const totalSize = this._getTotalSize();
|
|
208
|
+
if (totalSize === 0) {
|
|
209
|
+
return 0;
|
|
210
|
+
}
|
|
211
|
+
return roundPrecise(asPercent(this._rectSize()[paneIndex], totalSize), 0);
|
|
212
|
+
}
|
|
213
|
+
_sizeToPercent(sizeValue) {
|
|
214
|
+
const totalSize = this._getTotalSize();
|
|
215
|
+
if (totalSize === 0) {
|
|
216
|
+
return 0;
|
|
217
|
+
}
|
|
218
|
+
if (sizeValue.includes('%')) {
|
|
219
|
+
return asNumber(sizeValue);
|
|
220
|
+
}
|
|
221
|
+
const pxValue = asNumber(sizeValue);
|
|
222
|
+
return roundPrecise(asPercent(pxValue, totalSize), 0);
|
|
223
|
+
}
|
|
224
|
+
_getStartPaneSizePercent() {
|
|
225
|
+
if (!this._startPane || this._isCollapsed('start')) {
|
|
226
|
+
return 0;
|
|
227
|
+
}
|
|
228
|
+
if (this._isCollapsed('end')) {
|
|
229
|
+
return 100;
|
|
230
|
+
}
|
|
231
|
+
return this._paneRectAsPercent(0);
|
|
232
|
+
}
|
|
233
|
+
_getMinMaxAsPercent(type) {
|
|
234
|
+
const value = type === 'min' ? this.startMinSize : this.startMaxSize;
|
|
235
|
+
const defaultValue = type === 'min' ? 0 : 100;
|
|
236
|
+
return value ? this._sizeToPercent(value) : defaultValue;
|
|
237
|
+
}
|
|
238
|
+
_isCollapsed(which) {
|
|
239
|
+
return this._collapsedPane === which;
|
|
240
|
+
}
|
|
241
|
+
_updateBarAria() {
|
|
242
|
+
if (this._separator) {
|
|
243
|
+
this._separator.ariaValueNow = this._getStartPaneSizePercent().toString();
|
|
244
|
+
this._separator.ariaValueMin = this._getMinMaxAsPercent('min').toString();
|
|
245
|
+
this._separator.ariaValueMax = this._getMinMaxAsPercent('max').toString();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
_getPaneState(which) {
|
|
249
|
+
return which === 'start' ? this._startPaneState : this._endPaneState;
|
|
250
|
+
}
|
|
251
|
+
_isPercentageSize(which) {
|
|
252
|
+
const { size } = this._getPaneState(which);
|
|
253
|
+
return !!size && size.includes('%');
|
|
254
|
+
}
|
|
255
|
+
_isAutoSize(which) {
|
|
256
|
+
return this._getPaneState(which).size === 'auto';
|
|
257
|
+
}
|
|
258
|
+
_normalizeValue(value, fallback) {
|
|
259
|
+
const trimmed = value?.trim();
|
|
260
|
+
if (!trimmed || trimmed === 'auto') {
|
|
261
|
+
return fallback;
|
|
262
|
+
}
|
|
263
|
+
const numericValue = asNumber(trimmed, -1);
|
|
264
|
+
if (numericValue < 0)
|
|
265
|
+
return fallback;
|
|
266
|
+
if (trimmed.includes('%') && numericValue > 100)
|
|
267
|
+
return fallback;
|
|
268
|
+
return trimmed;
|
|
269
|
+
}
|
|
270
|
+
_getFlex(which) {
|
|
271
|
+
const isAuto = this._isAutoSize(which);
|
|
272
|
+
const size = isAuto ? '0px' : this._getPaneState(which).size;
|
|
273
|
+
return `${isAuto ? 1 : 0} 1 ${size}`;
|
|
274
|
+
}
|
|
275
|
+
_handleResizePanes(direction, validOrientation) {
|
|
276
|
+
if (this._resizeDisallowed || this.orientation !== validOrientation) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const delta = this._resolveDelta(KEYBOARD_RESIZE_STEP, KEYBOARD_RESIZE_STEP, direction);
|
|
280
|
+
this._resizeStart();
|
|
281
|
+
this._resizing(delta);
|
|
282
|
+
this._resizeEnd(delta);
|
|
283
|
+
}
|
|
284
|
+
_preventDefaultForEvent(e) {
|
|
285
|
+
e.preventDefault();
|
|
286
|
+
}
|
|
287
|
+
_resolveDelta(deltaX, deltaY, direction) {
|
|
288
|
+
const isHorizontal = this._isHorizontal;
|
|
289
|
+
const rtlMultiplier = isHorizontal && !isLTR(this) ? -1 : 1;
|
|
290
|
+
const delta = isHorizontal ? deltaX : deltaY;
|
|
291
|
+
return delta * rtlMultiplier * (direction ?? 1);
|
|
292
|
+
}
|
|
293
|
+
_handleMinMaxResize(type) {
|
|
294
|
+
if (this._resizeDisallowed) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const totalSize = this._getTotalSize();
|
|
298
|
+
const boundaryValue = type === 'min' ? this.startMinSize : this.startMaxSize;
|
|
299
|
+
const isPercentage = boundaryValue
|
|
300
|
+
? boundaryValue.includes('%')
|
|
301
|
+
: type === 'max';
|
|
302
|
+
const targetStartSizePx = this._setMinMaxInPx('start', type) ?? (type === 'min' ? 0 : totalSize);
|
|
303
|
+
const targetEndSizePx = totalSize - targetStartSizePx;
|
|
304
|
+
if (isPercentage) {
|
|
305
|
+
this.startSize = `${roundPrecise(asPercent(targetStartSizePx, totalSize), 2)}%`;
|
|
306
|
+
this.endSize = `${roundPrecise(asPercent(targetEndSizePx, totalSize), 2)}%`;
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
this.startSize = `${targetStartSizePx}px`;
|
|
310
|
+
this.endSize = `${targetEndSizePx}px`;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
_handleExpanderAction(pane) {
|
|
314
|
+
const other = pane === 'start' ? 'end' : 'start';
|
|
315
|
+
this.toggle(this._collapsedPane === other ? other : pane);
|
|
316
|
+
}
|
|
317
|
+
_handleArrowsExpandCollapse(target, validOrientation) {
|
|
318
|
+
if (this.disableCollapse || this.orientation !== validOrientation) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const effectiveTarget = validOrientation === 'horizontal' && !isLTR(this)
|
|
322
|
+
? target === 'start'
|
|
323
|
+
? 'end'
|
|
324
|
+
: 'start'
|
|
325
|
+
: target;
|
|
326
|
+
this._handleExpanderAction(effectiveTarget);
|
|
327
|
+
}
|
|
328
|
+
_resizeStart() {
|
|
329
|
+
const [startSize, endSize] = this._rectSize();
|
|
330
|
+
const totalSize = this._getTotalSize();
|
|
331
|
+
this._resizeState.startPane = this._createPaneState('start', startSize, totalSize);
|
|
332
|
+
this._resizeState.endPane = this._createPaneState('end', endSize, totalSize);
|
|
333
|
+
this.emitEvent('igcResizeStart', {
|
|
334
|
+
detail: { startPanelSize: startSize, endPanelSize: endSize },
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
_createPaneState(pane, size, totalSize) {
|
|
338
|
+
return {
|
|
339
|
+
initialSize: size,
|
|
340
|
+
isPercentageBased: this._isPercentageSize(pane) || this._isAutoSize(pane),
|
|
341
|
+
minSizePx: this._setMinMaxInPx(pane, 'min', totalSize),
|
|
342
|
+
maxSizePx: this._setMinMaxInPx(pane, 'max', totalSize),
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
_setMinMaxInPx(pane, type, totalSize) {
|
|
346
|
+
const paneState = this._getPaneState(pane);
|
|
347
|
+
const value = type === 'max' ? paneState.maxSize : paneState.minSize;
|
|
348
|
+
const valueAsNumber = asNumber(value);
|
|
349
|
+
if (!value) {
|
|
350
|
+
return undefined;
|
|
351
|
+
}
|
|
352
|
+
return value.includes('%')
|
|
353
|
+
? (valueAsNumber / 100) * (totalSize ?? this._getTotalSize())
|
|
354
|
+
: valueAsNumber;
|
|
355
|
+
}
|
|
356
|
+
_resizing(delta) {
|
|
357
|
+
const [startPaneSize, endPaneSize] = this._calcNewSizes(delta);
|
|
358
|
+
this.startSize = `${startPaneSize}px`;
|
|
359
|
+
this.endSize = `${endPaneSize}px`;
|
|
360
|
+
this.emitEvent('igcResizing', {
|
|
361
|
+
detail: {
|
|
362
|
+
startPanelSize: startPaneSize,
|
|
363
|
+
endPanelSize: endPaneSize,
|
|
364
|
+
delta,
|
|
365
|
+
},
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
_computeSize(pane, paneSize, totalSize) {
|
|
369
|
+
return pane.isPercentageBased
|
|
370
|
+
? `${asPercent(paneSize, totalSize)}%`
|
|
371
|
+
: `${roundPrecise(paneSize, 0)}px`;
|
|
372
|
+
}
|
|
373
|
+
_resizeEnd(delta) {
|
|
374
|
+
if (!this._resizeState.startPane || !this._resizeState.endPane) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
const [startPaneSize, endPaneSize] = this._calcNewSizes(delta);
|
|
378
|
+
const totalSize = this._getTotalSize();
|
|
379
|
+
this.startSize = this._computeSize(this._resizeState.startPane, startPaneSize, totalSize);
|
|
380
|
+
this.endSize = this._computeSize(this._resizeState.endPane, endPaneSize, totalSize);
|
|
381
|
+
this.emitEvent('igcResizeEnd', {
|
|
382
|
+
detail: {
|
|
383
|
+
startPanelSize: startPaneSize,
|
|
384
|
+
endPanelSize: endPaneSize,
|
|
385
|
+
delta,
|
|
386
|
+
},
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
_rectSize() {
|
|
390
|
+
const axis = this._isHorizontal ? 'width' : 'height';
|
|
391
|
+
const startPaneRect = this._startPane.getBoundingClientRect();
|
|
392
|
+
const endPaneRect = this._endPane.getBoundingClientRect();
|
|
393
|
+
return [startPaneRect[axis], endPaneRect[axis]];
|
|
394
|
+
}
|
|
395
|
+
_calcNewSizes(delta) {
|
|
396
|
+
if (!this._resizeState.startPane || !this._resizeState.endPane)
|
|
397
|
+
return [0, 0];
|
|
398
|
+
const start = this._resizeState.startPane;
|
|
399
|
+
const end = this._resizeState.endPane;
|
|
400
|
+
const minStart = start.minSizePx || 0;
|
|
401
|
+
const minEnd = end.minSizePx || 0;
|
|
402
|
+
const maxStart = start.maxSizePx || start.initialSize + end.initialSize - minEnd;
|
|
403
|
+
const maxEnd = end.maxSizePx || start.initialSize + end.initialSize - minStart;
|
|
404
|
+
const maxPosDelta = Math.min(maxStart - start.initialSize, end.initialSize - minEnd);
|
|
405
|
+
const maxNegDelta = Math.min(start.initialSize - minStart, maxEnd - end.initialSize);
|
|
406
|
+
const finalDelta = clamp(delta, -maxNegDelta, maxPosDelta);
|
|
407
|
+
return [start.initialSize + finalDelta, end.initialSize - finalDelta];
|
|
408
|
+
}
|
|
409
|
+
_getTotalSize() {
|
|
410
|
+
if (!this._base) {
|
|
411
|
+
return 0;
|
|
412
|
+
}
|
|
413
|
+
const axis = this._isHorizontal ? 'width' : 'height';
|
|
414
|
+
const barSize = this._separator
|
|
415
|
+
? roundPrecise(this._separator.getBoundingClientRect()[axis])
|
|
416
|
+
: 0;
|
|
417
|
+
const rect = this._base.getBoundingClientRect();
|
|
418
|
+
const size = rect[axis];
|
|
419
|
+
return size - barSize;
|
|
420
|
+
}
|
|
421
|
+
_updatePanes() {
|
|
422
|
+
const totalSize = this._getTotalSize();
|
|
423
|
+
const isCollapsed = this._collapsedPane !== null;
|
|
424
|
+
for (const pane of ['start', 'end']) {
|
|
425
|
+
const state = this._getPaneState(pane);
|
|
426
|
+
if (isCollapsed) {
|
|
427
|
+
state.size = 'auto';
|
|
428
|
+
state.minSize = undefined;
|
|
429
|
+
state.maxSize = undefined;
|
|
430
|
+
}
|
|
431
|
+
this._setPaneMinMaxSizes(pane, isCollapsed ? '0' : state.minSize, isCollapsed ? '100%' : state.maxSize, totalSize);
|
|
432
|
+
this._updatePaneStyles(pane, { flex: this._getFlex(pane) });
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
_updatePaneStyles(pane, styles) {
|
|
436
|
+
Object.assign(this._getPaneState(pane).styles, styles);
|
|
437
|
+
}
|
|
438
|
+
_setPaneMinMaxSizes(pane, minSize, maxSize, totalSize) {
|
|
439
|
+
const min = this._ensureMinConstraintIsWithinBounds(pane, minSize, totalSize) ?? 0;
|
|
440
|
+
const max = maxSize ?? '100%';
|
|
441
|
+
this._updatePaneStyles(pane, this._isHorizontal
|
|
442
|
+
? { minWidth: min, maxWidth: max, minHeight: 0, maxHeight: '100%' }
|
|
443
|
+
: { minWidth: 0, maxWidth: '100%', minHeight: min, maxHeight: max });
|
|
444
|
+
}
|
|
445
|
+
_ensureMinConstraintIsWithinBounds(pane, minSize, totalSize) {
|
|
446
|
+
const total = totalSize ?? this._getTotalSize();
|
|
447
|
+
if (minSize && total > 0) {
|
|
448
|
+
const minPx = this._setMinMaxInPx(pane, 'min', total) ?? 0;
|
|
449
|
+
const other = pane === 'start' ? 'end' : 'start';
|
|
450
|
+
const otherMinPx = this._getPaneState(other).minSize
|
|
451
|
+
? (this._setMinMaxInPx(other, 'min', total) ?? 0)
|
|
452
|
+
: 0;
|
|
453
|
+
if (minPx > total || minPx + otherMinPx > total) {
|
|
454
|
+
return undefined;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return minSize;
|
|
458
|
+
}
|
|
459
|
+
_handleExpanderClick(pane, event) {
|
|
460
|
+
event.stopPropagation();
|
|
461
|
+
this._handleExpanderAction(pane);
|
|
462
|
+
}
|
|
463
|
+
_resolvePartNames(expander) {
|
|
464
|
+
const other = expander === 'start' ? 'end' : 'start';
|
|
465
|
+
const otherIsCollapsed = this._isCollapsed(other);
|
|
466
|
+
return {
|
|
467
|
+
[`${other}-expand-btn`]: otherIsCollapsed,
|
|
468
|
+
[`${expander}-collapse-btn`]: !otherIsCollapsed,
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
_renderBarControls() {
|
|
472
|
+
const dragHandleHidden = this.hideDragHandle || this.disableResize;
|
|
473
|
+
const hidden = this.disableCollapse || this.hideCollapseButtons;
|
|
474
|
+
const prevButtonHidden = hidden || this._isCollapsed('start');
|
|
475
|
+
const nextButtonHidden = hidden || this._isCollapsed('end');
|
|
476
|
+
return html `
|
|
477
|
+
<div
|
|
478
|
+
part="${partMap(this._resolvePartNames('start'))}"
|
|
479
|
+
?hidden=${prevButtonHidden}
|
|
480
|
+
@pointerdown=${(e) => this._handleExpanderClick('start', e)}
|
|
481
|
+
></div>
|
|
482
|
+
<div part="drag-handle" ?hidden=${dragHandleHidden}></div>
|
|
483
|
+
<div
|
|
484
|
+
part="${partMap(this._resolvePartNames('end'))}"
|
|
485
|
+
?hidden=${nextButtonHidden}
|
|
486
|
+
@pointerdown=${(e) => this._handleExpanderClick('end', e)}
|
|
487
|
+
></div>
|
|
488
|
+
`;
|
|
489
|
+
}
|
|
490
|
+
_renderAccessibleLabel() {
|
|
491
|
+
return html `
|
|
492
|
+
<igc-visually-hidden id="splitter-label">
|
|
493
|
+
${this._isCollapsed('start')
|
|
494
|
+
? 'Start pane collapsed'
|
|
495
|
+
: 'Start pane expanded'}
|
|
496
|
+
and
|
|
497
|
+
${this._isCollapsed('end') ? 'End pane collapsed' : 'End pane expanded'}
|
|
498
|
+
</igc-visually-hidden>
|
|
499
|
+
`;
|
|
500
|
+
}
|
|
501
|
+
_renderSeparator() {
|
|
502
|
+
const isDragging = this._resizeState.isDragging;
|
|
503
|
+
const canResize = !this._resizeDisallowed;
|
|
504
|
+
return html `
|
|
505
|
+
<div
|
|
506
|
+
${ref(this._separatorRef)}
|
|
507
|
+
part="splitter-bar"
|
|
508
|
+
role="separator"
|
|
509
|
+
tabindex=${this.disableCollapse && this.disableResize ? -1 : 0}
|
|
510
|
+
aria-controls="start-pane end-pane"
|
|
511
|
+
aria-labelledby="splitter-label"
|
|
512
|
+
aria-orientation=${this.orientation}
|
|
513
|
+
style=${styleMap({ '--cursor': this._separatorCursor })}
|
|
514
|
+
@touchstart=${bindIf(canResize, this._preventDefaultForEvent)}
|
|
515
|
+
@contextmenu=${bindIf(canResize, this._preventDefaultForEvent)}
|
|
516
|
+
@pointerdown=${bindIf(canResize, this._handleBarPointerDown)}
|
|
517
|
+
@pointermove=${bindIf(isDragging, this._handleBarPointerMove)}
|
|
518
|
+
@pointerup=${bindIf(isDragging, this._handleEndDrag)}
|
|
519
|
+
@lostpointercapture=${bindIf(isDragging, this._handleEndDrag)}
|
|
520
|
+
@pointercancel=${bindIf(isDragging, this._endDrag)}
|
|
521
|
+
>
|
|
522
|
+
${this._renderBarControls()}
|
|
523
|
+
</div>
|
|
524
|
+
`;
|
|
525
|
+
}
|
|
526
|
+
render() {
|
|
527
|
+
return html `
|
|
528
|
+
${this._renderAccessibleLabel()}
|
|
529
|
+
<div part="base">
|
|
530
|
+
<div
|
|
531
|
+
part="start-pane"
|
|
532
|
+
id="start-pane"
|
|
533
|
+
style=${styleMap(this._startPaneState.styles)}
|
|
534
|
+
>
|
|
535
|
+
<slot name="start"></slot>
|
|
536
|
+
</div>
|
|
537
|
+
${this._renderSeparator()}
|
|
538
|
+
<div
|
|
539
|
+
part="end-pane"
|
|
540
|
+
id="end-pane"
|
|
541
|
+
style=${styleMap(this._endPaneState.styles)}
|
|
542
|
+
>
|
|
543
|
+
<slot name="end"></slot>
|
|
544
|
+
</div>
|
|
545
|
+
</div>
|
|
546
|
+
`;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
__decorate([
|
|
550
|
+
state()
|
|
551
|
+
], IgcSplitterComponent.prototype, "_collapsedPane", void 0);
|
|
552
|
+
__decorate([
|
|
553
|
+
state()
|
|
554
|
+
], IgcSplitterComponent.prototype, "_resizeState", void 0);
|
|
555
|
+
__decorate([
|
|
556
|
+
query('[part~="base"]', true)
|
|
557
|
+
], IgcSplitterComponent.prototype, "_base", void 0);
|
|
558
|
+
__decorate([
|
|
559
|
+
query('[part~="start-pane"]', true)
|
|
560
|
+
], IgcSplitterComponent.prototype, "_startPane", void 0);
|
|
561
|
+
__decorate([
|
|
562
|
+
query('[part~="end-pane"]', true)
|
|
563
|
+
], IgcSplitterComponent.prototype, "_endPane", void 0);
|
|
564
|
+
__decorate([
|
|
565
|
+
property({ reflect: true })
|
|
566
|
+
], IgcSplitterComponent.prototype, "orientation", void 0);
|
|
567
|
+
__decorate([
|
|
568
|
+
property({ type: Boolean, reflect: true, attribute: 'disable-collapse' })
|
|
569
|
+
], IgcSplitterComponent.prototype, "disableCollapse", void 0);
|
|
570
|
+
__decorate([
|
|
571
|
+
property({ type: Boolean, reflect: true, attribute: 'disable-resize' })
|
|
572
|
+
], IgcSplitterComponent.prototype, "disableResize", void 0);
|
|
573
|
+
__decorate([
|
|
574
|
+
property({
|
|
575
|
+
type: Boolean,
|
|
576
|
+
reflect: true,
|
|
577
|
+
attribute: 'hide-collapse-buttons',
|
|
578
|
+
})
|
|
579
|
+
], IgcSplitterComponent.prototype, "hideCollapseButtons", void 0);
|
|
580
|
+
__decorate([
|
|
581
|
+
property({
|
|
582
|
+
type: Boolean,
|
|
583
|
+
reflect: true,
|
|
584
|
+
attribute: 'hide-drag-handle',
|
|
585
|
+
})
|
|
586
|
+
], IgcSplitterComponent.prototype, "hideDragHandle", void 0);
|
|
587
|
+
__decorate([
|
|
588
|
+
property({ attribute: 'start-min-size' })
|
|
589
|
+
], IgcSplitterComponent.prototype, "startMinSize", null);
|
|
590
|
+
__decorate([
|
|
591
|
+
property({ attribute: 'end-min-size' })
|
|
592
|
+
], IgcSplitterComponent.prototype, "endMinSize", null);
|
|
593
|
+
__decorate([
|
|
594
|
+
property({ attribute: 'start-max-size' })
|
|
595
|
+
], IgcSplitterComponent.prototype, "startMaxSize", null);
|
|
596
|
+
__decorate([
|
|
597
|
+
property({ attribute: 'end-max-size' })
|
|
598
|
+
], IgcSplitterComponent.prototype, "endMaxSize", null);
|
|
599
|
+
__decorate([
|
|
600
|
+
property({ attribute: 'start-size' })
|
|
601
|
+
], IgcSplitterComponent.prototype, "startSize", null);
|
|
602
|
+
__decorate([
|
|
603
|
+
property({ attribute: 'end-size' })
|
|
604
|
+
], IgcSplitterComponent.prototype, "endSize", null);
|
|
605
|
+
__decorate([
|
|
606
|
+
eventOptions({ passive: false })
|
|
607
|
+
], IgcSplitterComponent.prototype, "_preventDefaultForEvent", null);
|
|
608
|
+
//# sourceMappingURL=splitter.js.map
|