igniteui-webcomponents 7.3.0 → 7.3.1
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 +41 -0
- package/README.md +30 -0
- package/components/avatar/avatar.d.ts +1 -2
- package/components/avatar/avatar.js +4 -8
- package/components/avatar/avatar.js.map +1 -1
- package/components/badge/badge.d.ts +6 -1
- package/components/badge/badge.js +8 -5
- package/components/badge/badge.js.map +1 -1
- package/components/badge/themes/badge.base.css.js +1 -1
- package/components/badge/themes/badge.base.css.js.map +1 -1
- package/components/chip/chip.d.ts +30 -14
- package/components/chip/chip.js +54 -48
- package/components/chip/chip.js.map +1 -1
- package/components/chip/themes/chip.base.css.js +1 -1
- package/components/chip/themes/chip.base.css.js.map +1 -1
- package/components/chip/themes/dark/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/dark/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/dark/chip.fluent.css.js +1 -1
- package/components/chip/themes/dark/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/dark/chip.indigo.css.js +1 -1
- package/components/chip/themes/dark/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/dark/chip.material.css.js +1 -1
- package/components/chip/themes/dark/chip.material.css.js.map +1 -1
- package/components/chip/themes/light/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/light/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/light/chip.fluent.css.js +1 -1
- package/components/chip/themes/light/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/light/chip.indigo.css.js +1 -1
- package/components/chip/themes/light/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/light/chip.material.css.js +1 -1
- package/components/chip/themes/light/chip.material.css.js.map +1 -1
- package/components/chip/themes/shared/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/shared/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/shared/chip.common.css.js +1 -1
- package/components/chip/themes/shared/chip.common.css.js.map +1 -1
- package/components/chip/themes/shared/chip.fluent.css.js +1 -1
- package/components/chip/themes/shared/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js.map +1 -1
- package/components/color-picker/color-picker.d.ts +2 -2
- package/components/color-picker/color-picker.js.map +1 -1
- package/components/color-picker/picker-canvas.js +2 -1
- package/components/color-picker/picker-canvas.js.map +1 -1
- package/components/textarea/textarea.d.ts +2 -15
- package/components/textarea/textarea.js +48 -93
- package/components/textarea/textarea.js.map +1 -1
- package/components/tile-manager/position.d.ts +2 -9
- package/components/tile-manager/position.js +27 -42
- package/components/tile-manager/position.js.map +1 -1
- package/components/tile-manager/resize-state.d.ts +11 -22
- package/components/tile-manager/resize-state.js +60 -119
- package/components/tile-manager/resize-state.js.map +1 -1
- package/components/tile-manager/resize-util.d.ts +3 -7
- package/components/tile-manager/resize-util.js +65 -72
- package/components/tile-manager/resize-util.js.map +1 -1
- package/components/tile-manager/serializer.d.ts +1 -1
- package/components/tile-manager/serializer.js +9 -10
- package/components/tile-manager/serializer.js.map +1 -1
- package/components/tile-manager/themes/shared/tile/tile.common.css.js +1 -1
- package/components/tile-manager/themes/shared/tile/tile.common.css.js.map +1 -1
- package/components/tile-manager/themes/tile.base.css.js +1 -1
- package/components/tile-manager/themes/tile.base.css.js.map +1 -1
- package/components/tile-manager/tile-ghost-util.js +16 -20
- package/components/tile-manager/tile-ghost-util.js.map +1 -1
- package/components/tile-manager/tile-manager.d.ts +5 -2
- package/components/tile-manager/tile-manager.js +27 -23
- package/components/tile-manager/tile-manager.js.map +1 -1
- package/components/tile-manager/tile.d.ts +32 -18
- package/components/tile-manager/tile.js +181 -161
- package/components/tile-manager/tile.js.map +1 -1
- package/components/tile-manager/types.d.ts +1 -5
- package/components/tile-manager/types.js.map +1 -1
- package/custom-elements.json +498 -853
- package/igniteui-webcomponents.css-data.json +1 -1
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +1 -0
- package/index.js.map +1 -1
- package/internals/directives/drag.d.ts +144 -0
- package/internals/directives/drag.js +278 -0
- package/internals/directives/drag.js.map +1 -0
- package/internals/directives/resize.d.ts +109 -0
- package/internals/directives/resize.js +214 -0
- package/internals/directives/resize.js.map +1 -0
- package/internals/templates/input-shell.d.ts +12 -1
- package/internals/templates/input-shell.js +17 -10
- package/internals/templates/input-shell.js.map +1 -1
- package/internals/utils/dom.d.ts +2 -0
- package/internals/utils/dom.js +3 -0
- package/internals/utils/dom.js.map +1 -1
- package/internals/utils/events.d.ts +2 -0
- package/internals/utils/events.js +3 -0
- package/internals/utils/events.js.map +1 -1
- package/package.json +1 -1
- package/skills/README.md +1 -0
- package/web-types.json +2 -2
- package/components/resize-container/default-ghost.d.ts +0 -5
- package/components/resize-container/default-ghost.js +0 -20
- package/components/resize-container/default-ghost.js.map +0 -1
- package/components/resize-container/resize-container.d.ts +0 -60
- package/components/resize-container/resize-container.js +0 -156
- package/components/resize-container/resize-container.js.map +0 -1
- package/components/resize-container/resize-controller.d.ts +0 -46
- package/components/resize-container/resize-controller.js +0 -195
- package/components/resize-container/resize-controller.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.bootstrap.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.bootstrap.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.bootstrap.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.fluent.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.fluent.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.fluent.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.indigo.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.indigo.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.indigo.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.material.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.material.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.material.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.shared.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.shared.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.shared.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.bootstrap.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.bootstrap.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.bootstrap.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.fluent.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.fluent.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.fluent.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.indigo.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.indigo.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.indigo.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.material.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.material.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.material.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.shared.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.shared.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.shared.css.js.map +0 -1
- package/components/resize-container/themes/resize-container.base.css.d.ts +0 -1
- package/components/resize-container/themes/resize-container.base.css.js +0 -3
- package/components/resize-container/themes/resize-container.base.css.js.map +0 -1
- package/components/resize-container/themes/shared/resize-container.common.css.d.ts +0 -1
- package/components/resize-container/themes/shared/resize-container.common.css.js +0 -3
- package/components/resize-container/themes/shared/resize-container.common.css.js.map +0 -1
- package/components/resize-container/themes/themes.d.ts +0 -2
- package/components/resize-container/themes/themes.js +0 -47
- package/components/resize-container/themes/themes.js.map +0 -1
- package/components/resize-container/types.d.ts +0 -40
- package/components/resize-container/types.js +0 -2
- package/components/resize-container/types.js.map +0 -1
- package/internals/controllers/drag.d.ts +0 -166
- package/internals/controllers/drag.js +0 -283
- package/internals/controllers/drag.js.map +0 -1
|
@@ -10,21 +10,22 @@ import { createRef, ref } from 'lit/directives/ref.js';
|
|
|
10
10
|
import { setTransitionName, startViewTransition, } from '#animations/view-transition.js';
|
|
11
11
|
import { tileManagerContext, } from '#internals/context.js';
|
|
12
12
|
import { createAsyncContext } from '#internals/controllers/async-consumer.js';
|
|
13
|
-
import { addDragController, } from '#internals/controllers/drag.js';
|
|
14
13
|
import { addFullscreenController } from '#internals/controllers/fullscreen.js';
|
|
15
14
|
import { addSlotController, setSlots } from '#internals/controllers/slot.js';
|
|
16
15
|
import { coercedProperty, } from '#internals/decorators/coerced-property.js';
|
|
17
16
|
import { registerComponent } from '#internals/definitions/register.js';
|
|
17
|
+
import { draggable, } from '#internals/directives/drag.js';
|
|
18
|
+
import { resizable, } from '#internals/directives/resize.js';
|
|
18
19
|
import { EventEmitterMixin } from '#internals/mixins/event-emitter.js';
|
|
19
20
|
import { partMap } from '#internals/part-map.js';
|
|
20
21
|
import { isLTR } from '#internals/utils/dom.js';
|
|
21
22
|
import { getElementFromPath } from '#internals/utils/events.js';
|
|
23
|
+
import { bindIf } from '#internals/utils/lit.js';
|
|
22
24
|
import { asNumber } from '#internals/utils/math.js';
|
|
23
25
|
import { createIdGenerator } from '#internals/utils/strings.js';
|
|
24
26
|
import { addThemingController } from '#theming/theming-controller.js';
|
|
25
27
|
import IgcIconButtonComponent from '../button/icon-button.js';
|
|
26
28
|
import IgcDividerComponent from '../divider/divider.js';
|
|
27
|
-
import IgcResizeContainerComponent from '../resize-container/resize-container.js';
|
|
28
29
|
import { createTileDragStack, swapTiles } from './position.js';
|
|
29
30
|
import { createTileResizeState } from './resize-state.js';
|
|
30
31
|
import { styles as shared } from './themes/shared/tile/tile.common.css.js';
|
|
@@ -37,23 +38,26 @@ export default class IgcTileComponent extends EventEmitterMixin(LitElement) {
|
|
|
37
38
|
static { this.tagName = 'igc-tile'; }
|
|
38
39
|
static { this.styles = [styles, shared]; }
|
|
39
40
|
static register() {
|
|
40
|
-
registerComponent(IgcTileComponent, IgcIconButtonComponent, IgcDividerComponent
|
|
41
|
+
registerComponent(IgcTileComponent, IgcIconButtonComponent, IgcDividerComponent);
|
|
41
42
|
}
|
|
42
|
-
static
|
|
43
|
+
static _gridVariable(name, transform) {
|
|
43
44
|
return {
|
|
44
|
-
transform: ({ value }) =>
|
|
45
|
+
transform: ({ value }) => transform(value),
|
|
45
46
|
onChange: ({ value, host }) => {
|
|
46
|
-
host.style.setProperty(name, value.toString());
|
|
47
|
+
host.style.setProperty(name, value != null ? value.toString() : null);
|
|
47
48
|
},
|
|
48
49
|
};
|
|
49
50
|
}
|
|
51
|
+
static { this._adorners = {
|
|
52
|
+
side: { part: 'trigger-side', direction: 'horizontal' },
|
|
53
|
+
corner: { part: 'trigger', direction: 'both' },
|
|
54
|
+
bottom: { part: 'trigger-bottom', direction: 'vertical' },
|
|
55
|
+
}; }
|
|
56
|
+
static _spanVariable(name) {
|
|
57
|
+
return IgcTileComponent._gridVariable(name, (value) => Math.max(1, asNumber(value)));
|
|
58
|
+
}
|
|
50
59
|
static _startVariable(name) {
|
|
51
|
-
return
|
|
52
|
-
transform: ({ value }) => Math.max(0, asNumber(value)) || null,
|
|
53
|
-
onChange: ({ value, host }) => {
|
|
54
|
-
host.style.setProperty(name, value ? value.toString() : null);
|
|
55
|
-
},
|
|
56
|
-
};
|
|
60
|
+
return IgcTileComponent._gridVariable(name, (value) => Math.max(0, asNumber(value)) || null);
|
|
57
61
|
}
|
|
58
62
|
get _tileManagerCtx() {
|
|
59
63
|
return this._context.value;
|
|
@@ -67,6 +71,12 @@ export default class IgcTileComponent extends EventEmitterMixin(LitElement) {
|
|
|
67
71
|
get _resizeMode() {
|
|
68
72
|
return this._tileManager?.resizeMode ?? 'none';
|
|
69
73
|
}
|
|
74
|
+
get _dragMode() {
|
|
75
|
+
return this._tileManager?.dragMode ?? 'none';
|
|
76
|
+
}
|
|
77
|
+
get _resizeAdornersVisible() {
|
|
78
|
+
return this._isResizeActive || this._resizeMode === 'always';
|
|
79
|
+
}
|
|
70
80
|
get _resizeDisabled() {
|
|
71
81
|
return (this.disableResize ||
|
|
72
82
|
this.maximized ||
|
|
@@ -79,31 +89,18 @@ export default class IgcTileComponent extends EventEmitterMixin(LitElement) {
|
|
|
79
89
|
constructor() {
|
|
80
90
|
super();
|
|
81
91
|
this._slots = addSlotController(this, { slots: Slots });
|
|
82
|
-
this._dragController = addDragController(this, {
|
|
83
|
-
skip: this._skipDrag,
|
|
84
|
-
matchTarget: this._match,
|
|
85
|
-
ghost: this._createDragGhost,
|
|
86
|
-
start: this._handleDragStart,
|
|
87
|
-
over: this._handleDragOver,
|
|
88
|
-
end: this._handleDragEnd,
|
|
89
|
-
cancel: this._handleDragCancel,
|
|
90
|
-
});
|
|
91
92
|
this._fullscreenController = addFullscreenController(this, {
|
|
92
93
|
enter: this._emitFullScreenEvent,
|
|
93
94
|
exit: this._emitFullScreenEvent,
|
|
94
95
|
});
|
|
95
96
|
this._resizeState = createTileResizeState();
|
|
96
97
|
this._dragStack = createTileDragStack();
|
|
97
|
-
this.
|
|
98
|
-
this._dragController.set({
|
|
99
|
-
enabled: dragMode !== 'none',
|
|
100
|
-
trigger: dragMode === 'tile-header' ? () => this._headerRef.value : undefined,
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
this._context = createAsyncContext(this, tileManagerContext, this._setDragConfiguration);
|
|
98
|
+
this._context = createAsyncContext(this, tileManagerContext);
|
|
104
99
|
this._headerRef = createRef();
|
|
100
|
+
this._containerRef = createRef();
|
|
105
101
|
this._isDragging = false;
|
|
106
102
|
this._isResizing = false;
|
|
103
|
+
this._isResizeActive = false;
|
|
107
104
|
this.colSpan = 1;
|
|
108
105
|
this.rowSpan = 1;
|
|
109
106
|
this.colStart = null;
|
|
@@ -113,9 +110,79 @@ export default class IgcTileComponent extends EventEmitterMixin(LitElement) {
|
|
|
113
110
|
this.disableFullscreen = false;
|
|
114
111
|
this.disableMaximize = false;
|
|
115
112
|
this.position = -1;
|
|
113
|
+
this._handleDragStart = () => {
|
|
114
|
+
if (!this._emitStartEvent('igcTileDragStart')) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
this._setDragState();
|
|
118
|
+
this._dragStack.push(this);
|
|
119
|
+
return true;
|
|
120
|
+
};
|
|
121
|
+
this._handleDragOver = ({ event, state }) => {
|
|
122
|
+
const match = state.element;
|
|
123
|
+
if (this._dragStack.peek() === match) {
|
|
124
|
+
if (this._shouldSwap(event, state.pointerState.direction, match)) {
|
|
125
|
+
this._dragStack.pop();
|
|
126
|
+
this._dragStack.push(match);
|
|
127
|
+
this._performSwap(match);
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this._dragStack.push(match);
|
|
132
|
+
this._performSwap(match);
|
|
133
|
+
};
|
|
134
|
+
this._handleDragCancel = () => {
|
|
135
|
+
startViewTransition(() => {
|
|
136
|
+
this._dragStack.restore();
|
|
137
|
+
this._dragStack.reset();
|
|
138
|
+
});
|
|
139
|
+
this._setDragState(false);
|
|
140
|
+
this.emitEvent('igcTileDragCancel', { detail: this });
|
|
141
|
+
};
|
|
142
|
+
this._handleDragEnd = () => {
|
|
143
|
+
this._setDragState(false);
|
|
144
|
+
this._dragStack.reset();
|
|
145
|
+
this.emitEvent('igcTileDragEnd', { detail: this });
|
|
146
|
+
};
|
|
147
|
+
this._skipDrag = (event) => {
|
|
148
|
+
if (this.maximized || this.fullscreen) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
return Boolean(getElementFromPath((e) => e.matches('[part*=trigger]') || e.matches('#tile-actions'), event));
|
|
152
|
+
};
|
|
153
|
+
this._match = (element) => {
|
|
154
|
+
return element !== this && IgcTileComponent.tagName === element.localName;
|
|
155
|
+
};
|
|
156
|
+
this._createDragGhost = () => {
|
|
157
|
+
return createTileDragGhost(this);
|
|
158
|
+
};
|
|
116
159
|
this._createResizeGhost = () => {
|
|
117
160
|
return createTileGhost(this);
|
|
118
161
|
};
|
|
162
|
+
this._handleResizeStart = ({ event, state }) => {
|
|
163
|
+
if (!this._emitStartEvent('igcTileResizeStart')) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
this._resizeState.updateState(state.initial, this, this._cssContainer);
|
|
168
|
+
this._setResizeState();
|
|
169
|
+
return true;
|
|
170
|
+
};
|
|
171
|
+
this._handleResizeEnd = ({ state }) => {
|
|
172
|
+
const { colSpan, rowSpan } = this._resizeState.calculateResizedGridPosition(state.current);
|
|
173
|
+
state.commit = async () => {
|
|
174
|
+
await startViewTransition(() => {
|
|
175
|
+
this.colSpan = colSpan;
|
|
176
|
+
this.rowSpan = rowSpan;
|
|
177
|
+
}).updateCallbackDone;
|
|
178
|
+
this._setResizeState(false);
|
|
179
|
+
this.emitEvent('igcTileResizeEnd', { detail: this });
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
this._handleResizeCancel = () => {
|
|
183
|
+
this._setResizeState(false);
|
|
184
|
+
this.emitEvent('igcTileResizeCancel', { detail: this });
|
|
185
|
+
};
|
|
119
186
|
addThemingController(this, all);
|
|
120
187
|
}
|
|
121
188
|
connectedCallback() {
|
|
@@ -131,47 +198,11 @@ export default class IgcTileComponent extends EventEmitterMixin(LitElement) {
|
|
|
131
198
|
this.style.pointerEvents = state ? 'none' : '';
|
|
132
199
|
this.part.toggle('dragging', state);
|
|
133
200
|
}
|
|
134
|
-
_handleDragStart() {
|
|
135
|
-
if (!this._emitTileDragStart()) {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
this._setDragState();
|
|
139
|
-
this._dragStack.push(this);
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
_handleDragOver({ event, state }) {
|
|
143
|
-
const match = state.element;
|
|
144
|
-
if (this._dragStack.peek() === match) {
|
|
145
|
-
if (this._shouldSwap(event, state, match)) {
|
|
146
|
-
this._dragStack.pop();
|
|
147
|
-
this._dragStack.push(match);
|
|
148
|
-
this._performSwap(match);
|
|
149
|
-
}
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
this._dragStack.push(match);
|
|
153
|
-
this._performSwap(match);
|
|
154
|
-
}
|
|
155
|
-
_handleDragCancel() {
|
|
156
|
-
startViewTransition(() => {
|
|
157
|
-
this._dragStack.restore();
|
|
158
|
-
this._dragStack.reset();
|
|
159
|
-
});
|
|
160
|
-
this._dragController.dispose();
|
|
161
|
-
this._setDragState(false);
|
|
162
|
-
this.emitEvent('igcTileDragCancel', { detail: this });
|
|
163
|
-
}
|
|
164
|
-
_handleDragEnd() {
|
|
165
|
-
this._setDragState(false);
|
|
166
|
-
this._dragStack.reset();
|
|
167
|
-
this.emitEvent('igcTileDragEnd', { detail: this });
|
|
168
|
-
}
|
|
169
201
|
_performSwap(match) {
|
|
170
202
|
startViewTransition(() => swapTiles(this, match));
|
|
171
203
|
}
|
|
172
|
-
_shouldSwap({ clientX, clientY },
|
|
204
|
+
_shouldSwap({ clientX, clientY }, direction, match) {
|
|
173
205
|
const LTR = isLTR(this);
|
|
174
|
-
const direction = state.pointerState.direction;
|
|
175
206
|
const { left, top, width, height } = match.getBoundingClientRect();
|
|
176
207
|
const relativeX = (clientX - left) / width;
|
|
177
208
|
const relativeY = (clientY - top) / height;
|
|
@@ -190,57 +221,19 @@ export default class IgcTileComponent extends EventEmitterMixin(LitElement) {
|
|
|
190
221
|
return false;
|
|
191
222
|
}
|
|
192
223
|
}
|
|
193
|
-
_skipDrag(event) {
|
|
194
|
-
if (this.maximized || this.fullscreen) {
|
|
195
|
-
return true;
|
|
196
|
-
}
|
|
197
|
-
return Boolean(getElementFromPath((e) => e.matches('[part*=trigger]') || e.matches('#tile-actions'), event));
|
|
198
|
-
}
|
|
199
|
-
_match(element) {
|
|
200
|
-
return element !== this && IgcTileComponent.tagName === element.localName;
|
|
201
|
-
}
|
|
202
|
-
_createDragGhost() {
|
|
203
|
-
return createTileDragGhost(this);
|
|
204
|
-
}
|
|
205
224
|
_setResizeState(state = true) {
|
|
206
225
|
this._isResizing = state;
|
|
207
226
|
this.style.zIndex = state ? '1' : '';
|
|
208
227
|
this.part.toggle('resizing', state);
|
|
209
228
|
}
|
|
210
|
-
|
|
211
|
-
if (
|
|
212
|
-
event.preventDefault();
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
this._resizeState.updateState(event.detail.state.initial, this, this._cssContainer);
|
|
216
|
-
this._setResizeState();
|
|
217
|
-
}
|
|
218
|
-
_handleResize({ detail: { state }, }) {
|
|
219
|
-
const trigger = state.trigger;
|
|
220
|
-
const isWidthResize = trigger.matches('[part*="side"], [part="trigger"]');
|
|
221
|
-
const isHeightResize = trigger.matches('[part*="bottom"], [part="trigger"]');
|
|
222
|
-
if (isWidthResize) {
|
|
229
|
+
_handleResize({ state }, direction) {
|
|
230
|
+
if (direction !== 'vertical') {
|
|
223
231
|
state.current.width = this._resizeState.calculateSnappedWidth(state);
|
|
224
232
|
}
|
|
225
|
-
if (
|
|
233
|
+
if (direction !== 'horizontal') {
|
|
226
234
|
state.current.height = this._resizeState.calculateSnappedHeight(state);
|
|
227
235
|
}
|
|
228
236
|
}
|
|
229
|
-
_handleResizeEnd({ detail: { state }, }) {
|
|
230
|
-
const { colSpan, rowSpan } = this._resizeState.calculateResizedGridPosition(state.current);
|
|
231
|
-
state.commit = async () => {
|
|
232
|
-
await startViewTransition(() => {
|
|
233
|
-
this.colSpan = colSpan;
|
|
234
|
-
this.rowSpan = rowSpan;
|
|
235
|
-
}).updateCallbackDone;
|
|
236
|
-
this._setResizeState(false);
|
|
237
|
-
this.emitEvent('igcTileResizeEnd', { detail: this });
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
_handleResizeCancel() {
|
|
241
|
-
this._setResizeState(false);
|
|
242
|
-
this.emitEvent('igcTileResizeCancel', { detail: this });
|
|
243
|
-
}
|
|
244
237
|
_handleFullscreen() {
|
|
245
238
|
this._fullscreenController.setState(!this.fullscreen);
|
|
246
239
|
}
|
|
@@ -267,17 +260,8 @@ export default class IgcTileComponent extends EventEmitterMixin(LitElement) {
|
|
|
267
260
|
cancelable: true,
|
|
268
261
|
});
|
|
269
262
|
}
|
|
270
|
-
|
|
271
|
-
return this.emitEvent(
|
|
272
|
-
detail: this,
|
|
273
|
-
cancelable: true,
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
_emitTileResizeStart() {
|
|
277
|
-
return this.emitEvent('igcTileResizeStart', {
|
|
278
|
-
detail: this,
|
|
279
|
-
cancelable: true,
|
|
280
|
-
});
|
|
263
|
+
_emitStartEvent(name) {
|
|
264
|
+
return this.emitEvent(name, { detail: this, cancelable: true });
|
|
281
265
|
}
|
|
282
266
|
_renderDefaultAction(type) {
|
|
283
267
|
const [icon, listener] = type === 'fullscreen'
|
|
@@ -315,39 +299,46 @@ export default class IgcTileComponent extends EventEmitterMixin(LitElement) {
|
|
|
315
299
|
<slot name="title"></slot>
|
|
316
300
|
</header>
|
|
317
301
|
<section id="tile-actions" part="actions">
|
|
318
|
-
${hasMaximizeSlot
|
|
319
|
-
|
|
320
|
-
<slot name="maximize-action">
|
|
321
|
-
${this._renderDefaultAction('maximize')}
|
|
322
|
-
</slot>
|
|
323
|
-
`
|
|
324
|
-
: nothing}
|
|
325
|
-
${hasFullscreenSlot
|
|
326
|
-
? html `
|
|
327
|
-
<slot name="fullscreen-action">
|
|
328
|
-
${this._renderDefaultAction('fullscreen')}
|
|
329
|
-
</slot>
|
|
330
|
-
`
|
|
331
|
-
: nothing}
|
|
332
|
-
|
|
302
|
+
${hasMaximizeSlot ? this._renderActionSlot('maximize') : nothing}
|
|
303
|
+
${hasFullscreenSlot ? this._renderActionSlot('fullscreen') : nothing}
|
|
333
304
|
<slot name="actions"></slot>
|
|
334
305
|
</section>
|
|
335
306
|
</section>
|
|
336
307
|
<igc-divider></igc-divider>
|
|
337
308
|
`;
|
|
338
309
|
}
|
|
310
|
+
_renderActionSlot(type) {
|
|
311
|
+
return html `
|
|
312
|
+
<slot name="${type}-action">${this._renderDefaultAction(type)}</slot>
|
|
313
|
+
`;
|
|
314
|
+
}
|
|
315
|
+
_createDragOptions() {
|
|
316
|
+
const dragMode = this._dragMode;
|
|
317
|
+
return {
|
|
318
|
+
enabled: dragMode !== 'none',
|
|
319
|
+
target: () => this,
|
|
320
|
+
trigger: dragMode === 'tile-header' ? () => this._headerRef.value : undefined,
|
|
321
|
+
skip: this._skipDrag,
|
|
322
|
+
matchTarget: this._match,
|
|
323
|
+
ghostFactory: this._createDragGhost,
|
|
324
|
+
start: this._handleDragStart,
|
|
325
|
+
over: this._handleDragOver,
|
|
326
|
+
end: this._handleDragEnd,
|
|
327
|
+
cancel: this._handleDragCancel,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
339
330
|
_renderContent() {
|
|
340
331
|
const parts = {
|
|
341
332
|
base: true,
|
|
342
|
-
draggable: this.
|
|
333
|
+
draggable: this._dragMode !== 'none',
|
|
343
334
|
fullscreen: this.fullscreen,
|
|
344
335
|
dragging: this._isDragging,
|
|
345
|
-
resizable: !this.disableResize && this.
|
|
336
|
+
resizable: !this.disableResize && this._resizeMode !== 'none',
|
|
346
337
|
resizing: this._isResizing,
|
|
347
338
|
maximized: this.maximized,
|
|
348
339
|
};
|
|
349
340
|
return html `
|
|
350
|
-
<div part=${partMap(parts)}>
|
|
341
|
+
<div part=${partMap(parts)} ${draggable(this._createDragOptions())}>
|
|
351
342
|
${this._renderHeader()}
|
|
352
343
|
<div part="content-container">
|
|
353
344
|
<slot></slot>
|
|
@@ -355,42 +346,68 @@ export default class IgcTileComponent extends EventEmitterMixin(LitElement) {
|
|
|
355
346
|
</div>
|
|
356
347
|
`;
|
|
357
348
|
}
|
|
358
|
-
|
|
359
|
-
|
|
349
|
+
_handleResizePointerEnter() {
|
|
350
|
+
this._isResizeActive = true;
|
|
351
|
+
}
|
|
352
|
+
_handleResizePointerLeave() {
|
|
353
|
+
this._isResizeActive = false;
|
|
354
|
+
}
|
|
355
|
+
_createResizeOptions(direction) {
|
|
356
|
+
return {
|
|
357
|
+
mode: 'deferred',
|
|
358
|
+
direction,
|
|
359
|
+
target: () => this._containerRef.value,
|
|
360
|
+
ghostFactory: this._createResizeGhost,
|
|
361
|
+
start: this._handleResizeStart,
|
|
362
|
+
resize: (params) => this._handleResize(params, direction),
|
|
363
|
+
end: this._handleResizeEnd,
|
|
364
|
+
cancel: this._handleResizeCancel,
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
_renderAdorner(type) {
|
|
368
|
+
const { part, direction } = IgcTileComponent._adorners[type];
|
|
369
|
+
const parts = {
|
|
370
|
+
[part]: true,
|
|
371
|
+
custom: this._slots.hasAssignedElements(`${type}-adorner`),
|
|
372
|
+
};
|
|
373
|
+
return html `
|
|
374
|
+
<slot
|
|
375
|
+
name="${type}-adorner"
|
|
376
|
+
part=${partMap(parts)}
|
|
377
|
+
${resizable(this._createResizeOptions(direction))}
|
|
378
|
+
></slot>
|
|
379
|
+
`;
|
|
380
|
+
}
|
|
381
|
+
_renderAdorners() {
|
|
382
|
+
return this._resizeAdornersVisible
|
|
383
|
+
? html `
|
|
384
|
+
${this._renderAdorner('side')} ${this._renderAdorner('corner')}
|
|
385
|
+
${this._renderAdorner('bottom')}
|
|
386
|
+
`
|
|
387
|
+
: nothing;
|
|
360
388
|
}
|
|
361
389
|
render() {
|
|
362
|
-
const
|
|
390
|
+
const isHoverMode = this._resizeMode === 'hover';
|
|
391
|
+
const parts = {
|
|
392
|
+
'tile-container': true,
|
|
393
|
+
active: this._resizeAdornersVisible,
|
|
394
|
+
};
|
|
363
395
|
return this._resizeDisabled
|
|
364
396
|
? this._renderContent()
|
|
365
397
|
: html `
|
|
366
|
-
<
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
'bottom-adorner': this._slots.hasAssignedElements('bottom-adorner'),
|
|
372
|
-
})}
|
|
373
|
-
exportparts="trigger-side, trigger, trigger-bottom"
|
|
374
|
-
mode="deferred"
|
|
375
|
-
?active=${isActive}
|
|
376
|
-
.ghostFactory=${this._createResizeGhost}
|
|
377
|
-
@igcResizeStart=${this._handleResizeStart}
|
|
378
|
-
@igcResize=${this._handleResize}
|
|
379
|
-
@igcResizeEnd=${this._handleResizeEnd}
|
|
380
|
-
@igcResizeCancel=${this._handleResizeCancel}
|
|
398
|
+
<div
|
|
399
|
+
${ref(this._containerRef)}
|
|
400
|
+
part=${partMap(parts)}
|
|
401
|
+
@pointerenter=${bindIf(isHoverMode, this._handleResizePointerEnter)}
|
|
402
|
+
@pointerleave=${bindIf(isHoverMode, this._handleResizePointerLeave)}
|
|
381
403
|
>
|
|
382
|
-
${this._renderContent()} ${this.
|
|
383
|
-
|
|
384
|
-
${this._renderAdornerSlot('bottom')}
|
|
385
|
-
</igc-resize>
|
|
404
|
+
${this._renderContent()} ${this._renderAdorners()}
|
|
405
|
+
</div>
|
|
386
406
|
`;
|
|
387
407
|
}
|
|
388
408
|
}
|
|
389
409
|
__decorate([
|
|
390
|
-
query(
|
|
391
|
-
], IgcTileComponent.prototype, "_resizeContainer", void 0);
|
|
392
|
-
__decorate([
|
|
393
|
-
query('[part~="base"]', true)
|
|
410
|
+
query('[part~="base"]')
|
|
394
411
|
], IgcTileComponent.prototype, "_tileContent", void 0);
|
|
395
412
|
__decorate([
|
|
396
413
|
state()
|
|
@@ -398,6 +415,9 @@ __decorate([
|
|
|
398
415
|
__decorate([
|
|
399
416
|
state()
|
|
400
417
|
], IgcTileComponent.prototype, "_isResizing", void 0);
|
|
418
|
+
__decorate([
|
|
419
|
+
state()
|
|
420
|
+
], IgcTileComponent.prototype, "_isResizeActive", void 0);
|
|
401
421
|
__decorate([
|
|
402
422
|
property({ type: Number, attribute: 'col-span' }),
|
|
403
423
|
coercedProperty(IgcTileComponent._spanVariable('--ig-col-span'))
|