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
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { LitElement,
|
|
2
|
-
import { type InferSlotNames } from '#internals/controllers/slot.js';
|
|
1
|
+
import { LitElement, type PropertyValues } from 'lit';
|
|
3
2
|
import type { Constructor } from '#internals/mixins/constructor.js';
|
|
4
3
|
import type { RangeTextSelectMode, SelectionRangeDirection, TextareaResize } from '../types.js';
|
|
5
4
|
export interface IgcTextareaComponentEventMap {
|
|
@@ -8,7 +7,6 @@ export interface IgcTextareaComponentEventMap {
|
|
|
8
7
|
focus: FocusEvent;
|
|
9
8
|
blur: FocusEvent;
|
|
10
9
|
}
|
|
11
|
-
declare const Slots: readonly ["[default]", "prefix", "suffix", "helper-text", "value-missing", "too-long", "too-short", "custom-error", "invalid"];
|
|
12
10
|
declare const IgcTextareaComponent_base: Constructor<import("../../internals/mixins/forms/types.js").FormRequiredInterface & import("../../internals/mixins/forms/types.js").FormAssociatedElementInterface> & Constructor<import("#internals/mixins/event-emitter.js").EventEmitterInterface<IgcTextareaComponentEventMap>> & Constructor<LitElement>;
|
|
13
11
|
/**
|
|
14
12
|
* Represents a multi-line plain-text editing control,
|
|
@@ -49,7 +47,7 @@ export default class IgcTextareaComponent extends IgcTextareaComponent_base {
|
|
|
49
47
|
* native textarea. See {@link addAriaTarget}.
|
|
50
48
|
*/
|
|
51
49
|
private readonly _ariaTarget;
|
|
52
|
-
private readonly _input
|
|
50
|
+
private readonly _input?;
|
|
53
51
|
protected get __validators(): import("../../internals/validators.js").Validator<IgcTextareaComponent>[];
|
|
54
52
|
protected readonly _formValue: import("#internals/mixins/forms/form-value.js").FormValue<string>;
|
|
55
53
|
/**
|
|
@@ -157,14 +155,7 @@ export default class IgcTextareaComponent extends IgcTextareaComponent_base {
|
|
|
157
155
|
validateOnly: boolean;
|
|
158
156
|
constructor();
|
|
159
157
|
protected updated(props: PropertyValues<this>): void;
|
|
160
|
-
private _setAutoHeight;
|
|
161
158
|
protected _setAreaHeight(): void;
|
|
162
|
-
protected _resolvePartNames(): {
|
|
163
|
-
container: boolean;
|
|
164
|
-
prefixed: boolean;
|
|
165
|
-
suffixed: boolean;
|
|
166
|
-
filled: boolean;
|
|
167
|
-
};
|
|
168
159
|
private _handleSlotChange;
|
|
169
160
|
protected _handleInput(): void;
|
|
170
161
|
protected _handleChange(): void;
|
|
@@ -176,10 +167,6 @@ export default class IgcTextareaComponent extends IgcTextareaComponent_base {
|
|
|
176
167
|
setRangeText(replacement: string, start: number, end: number, selectMode?: RangeTextSelectMode): void;
|
|
177
168
|
scrollTo(options?: ScrollToOptions | undefined): void;
|
|
178
169
|
scrollTo(x: number, y: number): void;
|
|
179
|
-
protected _renderSlot(name: InferSlotNames<typeof Slots>): import("lit-html").TemplateResult<1>;
|
|
180
|
-
protected _renderLabel(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
181
|
-
protected _renderStandard(): import("lit-html").TemplateResult<1>;
|
|
182
|
-
protected _renderMaterial(): import("lit-html").TemplateResult<1>;
|
|
183
170
|
protected _renderInput(): import("lit-html").TemplateResult<1>;
|
|
184
171
|
protected render(): import("lit-html/directive.js").DirectiveResult<typeof import("lit-html/directives/cache.js").CacheDirective>;
|
|
185
172
|
}
|
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var IgcTextareaComponent_1;
|
|
8
|
-
import { html, LitElement
|
|
8
|
+
import { html, LitElement } from 'lit';
|
|
9
9
|
import { property, query } from 'lit/decorators.js';
|
|
10
10
|
import { cache } from 'lit/directives/cache.js';
|
|
11
11
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
@@ -19,7 +19,7 @@ import { registerComponent } from '#internals/definitions/register.js';
|
|
|
19
19
|
import { EventEmitterMixin } from '#internals/mixins/event-emitter.js';
|
|
20
20
|
import { FormAssociatedRequiredMixin } from '#internals/mixins/forms/associated-required.js';
|
|
21
21
|
import { createFormValueState } from '#internals/mixins/forms/form-value.js';
|
|
22
|
-
import {
|
|
22
|
+
import { renderInputShell, resolveInputPartNames, } from '#internals/templates/input-shell.js';
|
|
23
23
|
import { addSafeEventListener } from '#internals/utils/events.js';
|
|
24
24
|
import { asNumber } from '#internals/utils/math.js';
|
|
25
25
|
import { createIdGenerator } from '#internals/utils/strings.js';
|
|
@@ -81,119 +81,68 @@ let IgcTextareaComponent = class IgcTextareaComponent extends FormAssociatedRequ
|
|
|
81
81
|
this._setAreaHeight();
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
_setAutoHeight() {
|
|
85
|
-
const { borderTopWidth, borderBottomWidth } = getComputedStyle(this._input);
|
|
86
|
-
return (this._input.scrollHeight +
|
|
87
|
-
asNumber(borderTopWidth) +
|
|
88
|
-
asNumber(borderBottomWidth));
|
|
89
|
-
}
|
|
90
84
|
_setAreaHeight() {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
const input = this._input;
|
|
86
|
+
if (!input) {
|
|
87
|
+
return;
|
|
94
88
|
}
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
if (this.resize !== 'auto') {
|
|
90
|
+
input.style.removeProperty('height');
|
|
91
|
+
return;
|
|
97
92
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}),
|
|
105
|
-
suffixed: this._slots.hasAssignedElements('suffix', {
|
|
106
|
-
selector: ':not([hidden])',
|
|
107
|
-
}),
|
|
108
|
-
filled: !!this.value,
|
|
109
|
-
};
|
|
93
|
+
input.style.height = 'auto';
|
|
94
|
+
const { borderTopWidth, borderBottomWidth } = getComputedStyle(input);
|
|
95
|
+
const height = input.scrollHeight +
|
|
96
|
+
asNumber(borderTopWidth) +
|
|
97
|
+
asNumber(borderBottomWidth);
|
|
98
|
+
input.style.height = `${height}px`;
|
|
110
99
|
}
|
|
111
100
|
_handleSlotChange({ isDefault, }) {
|
|
112
|
-
if (isDefault) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
101
|
+
if (!isDefault) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const value = this._slots
|
|
105
|
+
.getAssignedNodes('[default]', true)
|
|
106
|
+
.map((node) => node.textContent?.trim())
|
|
107
|
+
.filter(Boolean)
|
|
108
|
+
.join('\r\n');
|
|
109
|
+
if (value === this.value) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (this._pristine) {
|
|
113
|
+
this.defaultValue = value;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
this.value = value;
|
|
121
117
|
}
|
|
122
118
|
}
|
|
123
119
|
_handleInput() {
|
|
124
|
-
this._commitValue(this._input
|
|
120
|
+
this._commitValue(this._input?.value ?? '', 'igcInput');
|
|
125
121
|
}
|
|
126
122
|
_handleChange() {
|
|
127
|
-
this._commitValue(this._input
|
|
123
|
+
this._commitValue(this._input?.value ?? '', 'igcChange');
|
|
128
124
|
}
|
|
129
125
|
select() {
|
|
130
|
-
this._input
|
|
126
|
+
this._input?.select();
|
|
131
127
|
}
|
|
132
128
|
setSelectionRange(start, end, direction = 'none') {
|
|
133
|
-
this._input
|
|
129
|
+
this._input?.setSelectionRange(start, end, direction);
|
|
134
130
|
}
|
|
135
131
|
setRangeText(replacement, start, end, selectMode = 'preserve') {
|
|
136
|
-
this._input
|
|
137
|
-
this.value = this._input
|
|
132
|
+
this._input?.setRangeText(replacement, start, end, selectMode);
|
|
133
|
+
this.value = this._input?.value ?? '';
|
|
138
134
|
}
|
|
139
135
|
scrollTo(x, y) {
|
|
140
136
|
x != null && y != null
|
|
141
|
-
? this._input
|
|
142
|
-
: this._input
|
|
143
|
-
}
|
|
144
|
-
_renderSlot(name) {
|
|
145
|
-
const isHidden = !this._slots.hasAssignedElements(name, {
|
|
146
|
-
selector: ':not([hidden])',
|
|
147
|
-
});
|
|
148
|
-
return html `
|
|
149
|
-
<div part=${name} ?hidden=${isHidden}>
|
|
150
|
-
<slot name=${name}></slot>
|
|
151
|
-
</div>
|
|
152
|
-
`;
|
|
153
|
-
}
|
|
154
|
-
_renderLabel() {
|
|
155
|
-
return this.label
|
|
156
|
-
? html `
|
|
157
|
-
<label part="label" for=${this.id || this._inputId}>
|
|
158
|
-
${this.label}
|
|
159
|
-
</label>
|
|
160
|
-
`
|
|
161
|
-
: nothing;
|
|
162
|
-
}
|
|
163
|
-
_renderStandard() {
|
|
164
|
-
return html `
|
|
165
|
-
${this._renderLabel()}
|
|
166
|
-
<div part=${partMap(this._resolvePartNames())}>
|
|
167
|
-
${this._renderSlot('prefix')} ${this._renderInput()}
|
|
168
|
-
${this._renderSlot('suffix')}
|
|
169
|
-
</div>
|
|
170
|
-
${this._renderValidationContainer()}
|
|
171
|
-
`;
|
|
172
|
-
}
|
|
173
|
-
_renderMaterial() {
|
|
174
|
-
return html `
|
|
175
|
-
<div
|
|
176
|
-
part=${partMap({
|
|
177
|
-
...this._resolvePartNames(),
|
|
178
|
-
labelled: !!this.label,
|
|
179
|
-
placeholder: !!this.placeholder,
|
|
180
|
-
})}
|
|
181
|
-
>
|
|
182
|
-
<div part="start">${this._renderSlot('prefix')}</div>
|
|
183
|
-
${this._renderInput()}
|
|
184
|
-
<div part="notch">${this._renderLabel()}</div>
|
|
185
|
-
<div part="filler"></div>
|
|
186
|
-
<div part="end">${this._renderSlot('suffix')}</div>
|
|
187
|
-
</div>
|
|
188
|
-
${this._renderValidationContainer()}
|
|
189
|
-
`;
|
|
137
|
+
? this._input?.scrollTo(x, y)
|
|
138
|
+
: this._input?.scrollTo(x);
|
|
190
139
|
}
|
|
191
140
|
_renderInput() {
|
|
192
141
|
return html `
|
|
193
142
|
<slot style="display: none"></slot>
|
|
194
143
|
<textarea
|
|
195
144
|
${ariaBindings(this._ariaTarget.resolveBindings())}
|
|
196
|
-
id=${this.
|
|
145
|
+
id=${this._inputId}
|
|
197
146
|
part="input"
|
|
198
147
|
style=${styleMap({
|
|
199
148
|
resize: this.resize === 'auto' ? 'none' : this.resize,
|
|
@@ -217,9 +166,15 @@ let IgcTextareaComponent = class IgcTextareaComponent extends FormAssociatedRequ
|
|
|
217
166
|
`;
|
|
218
167
|
}
|
|
219
168
|
render() {
|
|
220
|
-
return cache(this
|
|
221
|
-
|
|
222
|
-
: this.
|
|
169
|
+
return cache(renderInputShell(this, {
|
|
170
|
+
theme: this._themes.theme,
|
|
171
|
+
label: this.label,
|
|
172
|
+
labelId: this._inputId,
|
|
173
|
+
containerParts: resolveInputPartNames(this._slots, 'container', !!this.value),
|
|
174
|
+
materialParts: { placeholder: !!this.placeholder },
|
|
175
|
+
hideEmptyAffixes: true,
|
|
176
|
+
renderInput: this._renderInput,
|
|
177
|
+
}));
|
|
223
178
|
}
|
|
224
179
|
};
|
|
225
180
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../src/components/textarea/textarea.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EACL,aAAa,EACb,YAAY,GACb,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EACL,iBAAiB,EAGjB,QAAQ,GACT,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AO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;0DAC3C;AAlMT,oBAAoB;IADxC,aAAa,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;GACnB,oBAAoB,CA8ZxC;eA9ZoB,oBAAoB","sourcesContent":["import { html, LitElement, nothing, type PropertyValues } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport {\n addAriaTarget,\n ariaBindings,\n} from '#internals/controllers/aria-projection.js';\nimport { createResizeObserverController } from '#internals/controllers/resize-observer.js';\nimport {\n addSlotController,\n type InferSlotNames,\n type SlotChangeCallbackParameters,\n setSlots,\n} from '#internals/controllers/slot.js';\nimport { shadowOptions } from '#internals/decorators/shadow-options.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport type { Constructor } from '#internals/mixins/constructor.js';\nimport { EventEmitterMixin } from '#internals/mixins/event-emitter.js';\nimport { FormAssociatedRequiredMixin } from '#internals/mixins/forms/associated-required.js';\nimport { createFormValueState } from '#internals/mixins/forms/form-value.js';\nimport { partMap } from '#internals/part-map.js';\nimport { addSafeEventListener } from '#internals/utils/events.js';\nimport { asNumber } from '#internals/utils/math.js';\nimport { createIdGenerator } from '#internals/utils/strings.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport type {\n RangeTextSelectMode,\n SelectionRangeDirection,\n TextareaResize,\n} from '../types.js';\nimport IgcValidationContainerComponent from '../validation-container/validation-container.js';\nimport { styles as shared } from './themes/shared/textarea.common.css.js';\nimport { styles } from './themes/textarea.base.css.js';\nimport { all } from './themes/themes.js';\nimport { textAreaValidators } from './validators.js';\n\nexport interface IgcTextareaComponentEventMap {\n igcInput: CustomEvent<string>;\n igcChange: CustomEvent<string>;\n // For analyzer meta only:\n /* skipWCPrefix */\n focus: FocusEvent;\n /* skipWCPrefix */\n blur: FocusEvent;\n}\n\nconst nextId = createIdGenerator('textarea');\nconst Slots = setSlots(\n 'prefix',\n 'suffix',\n 'helper-text',\n 'value-missing',\n 'too-long',\n 'too-short',\n 'custom-error',\n 'invalid'\n);\n\n/**\n * Represents a multi-line plain-text editing control,\n * useful when you want to allow users to enter a sizeable amount of free-form text,\n * for example a comment on a review or feedback form.\n *\n * @element igc-textarea\n *\n * @slot - Text content from the default slot will be used as the value of the component.\n * @slot prefix - Renders content before the input.\n * @slot suffix - Renders content after input.\n * @slot helper-text - Renders content below the input.\n * @slot value-missing - Renders content when the required validation fails.\n * @slot too-long - Renders content when the maxlength validation fails.\n * @slot too-short - Renders content when the minlength validation fails.\n * @slot custom-error - Renders content when setCustomValidity(message) is set.\n * @slot invalid - Renders content when the component is in invalid state (validity.valid = false).\n *\n * @fires igcInput - Emitted when the control receives user input.\n * @fires igcChange - Emitted when the a change to the control value is committed by the user.\n *\n * @csspart container - The main wrapper that holds all main input elements of the textarea.\n * @csspart input - The native input element of the textarea.\n * @csspart label - The native label element of the textarea.\n * @csspart prefix - The prefix wrapper of the textarea.\n * @csspart suffix - The suffix wrapper of the textarea.\n * @csspart helper-text - The helper text wrapper of the textarea.\n */\n@shadowOptions({ delegatesFocus: true })\nexport default class IgcTextareaComponent extends FormAssociatedRequiredMixin(\n EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>(\n LitElement\n )\n) {\n public static readonly tagName = 'igc-textarea';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcTextareaComponent, IgcValidationContainerComponent);\n }\n\n //#region Private properties and state\n\n private readonly _inputId = nextId();\n\n private readonly _themes = addThemingController(this, all);\n\n private readonly _slots = addSlotController(this, {\n slots: Slots,\n onChange: this._handleSlotChange,\n });\n\n /**\n * Receives ARIA semantics projected by a composite host onto the inner\n * native textarea. See {@link addAriaTarget}.\n */\n private readonly _ariaTarget = addAriaTarget(this, {\n labels: () => this._internals.labels,\n description: () =>\n this._slots.hasAssignedElements('helper-text')\n ? this.renderRoot.querySelector('#helper-text')\n : null,\n });\n\n @query('textarea')\n private readonly _input!: HTMLTextAreaElement;\n\n protected override get __validators() {\n return textAreaValidators;\n }\n\n protected override readonly _formValue = createFormValueState(this, {\n initialValue: '',\n });\n\n //#endregion\n\n //#region Public properties and attributes\n\n /**\n * Specifies what permission, if any, the browser has to provide automated assistance in filling out form field values,\n * as well as guidance to the browser as to the type of information expected in the field.\n * Refer to [this page](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for additional information.\n *\n * @attr\n */\n @property()\n public autocomplete!: string;\n\n /**\n * Controls whether and how text input is automatically capitalized as it is entered/edited by the user.\n *\n * [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize).\n *\n * @attr\n */\n @property()\n public override autocapitalize!: string;\n\n /**\n * Hints at the type of data that might be entered by the user while editing the element or its contents.\n * This allows a browser to display an appropriate virtual keyboard.\n *\n * [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)\n *\n * @attr inputmode\n */\n @property({ attribute: 'inputmode' })\n public override inputMode!: string;\n\n /**\n * The label for the control.\n *\n * @attr\n */\n @property()\n public label!: string;\n\n /**\n * The maximum number of characters (UTF-16 code units) that the user can enter.\n * If this value isn't specified, the user can enter an unlimited number of characters.\n *\n * @attr maxlength\n */\n @property({ type: Number, attribute: 'maxlength' })\n public maxLength!: number;\n\n /**\n * The minimum number of characters (UTF-16 code units) required that the user should enter.\n *\n * @attr minlength\n */\n @property({ type: Number, attribute: 'minlength' })\n public minLength!: number;\n\n /**\n * Whether the control will have outlined appearance.\n * @attr\n */\n @property({ reflect: true, type: Boolean })\n public outlined = false;\n\n /**\n * The placeholder text of the control.\n *\n * @attr\n */\n @property()\n public placeholder!: string;\n\n /**\n * Makes the control a readonly field.\n *\n * @attr readonly\n */\n @property({ type: Boolean, reflect: true, attribute: 'readonly' })\n public readOnly = false;\n\n /**\n * Controls whether the control can be resized.\n * When `auto` is set, the control will try to expand and fit its content.\n *\n * @attr\n */\n @property()\n public resize: TextareaResize = 'vertical';\n\n /**\n * The number of visible text lines for the control. If it is specified, it must be a positive integer.\n * If it is not specified, the default value is 3.\n *\n * @attr\n */\n @property({ type: Number })\n public rows = 3;\n\n /* @tsTwoWayProperty(true, \"igcChange\", \"detail\", false) */\n /**\n * The value of the component\n *\n * @attr\n */\n @property()\n public set value(value: string) {\n this._formValue.setValueAndFormState(value);\n }\n\n public get value(): string {\n return this._formValue.value;\n }\n\n /**\n * Controls whether the element may be checked for spelling errors.\n *\n * @attr\n */\n @property({\n type: Boolean,\n converter: {\n fromAttribute: (value) => !(!value || value === 'false'),\n toAttribute: (value) => (value ? 'true' : 'false'),\n },\n })\n public override spellcheck = true;\n\n /**\n * Indicates how the control should wrap the value for form submission.\n * Refer to [this page on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attributes)\n * for explanation of the available values.\n *\n * @attr\n */\n @property()\n public wrap: 'hard' | 'soft' | 'off' = 'soft';\n\n /**\n * Enables validation rules to be evaluated without restricting user input. This applies to the `maxLength` property\n * when it is defined.\n *\n * @attr validate-only\n */\n @property({ type: Boolean, reflect: true, attribute: 'validate-only' })\n public validateOnly = false;\n\n //#endregion\n\n //#region Life-cycle hooks\n\n constructor() {\n super();\n\n createResizeObserverController(this, {\n callback: this._setAreaHeight,\n });\n\n addSafeEventListener(this, 'blur', this._handleBlur);\n }\n\n protected override updated(props: PropertyValues<this>): void {\n if (props.has('rows') || props.has('resize') || props.has('value')) {\n this._setAreaHeight();\n }\n }\n\n //#endregion\n\n //#region Internal methods\n\n private _setAutoHeight(): number {\n const { borderTopWidth, borderBottomWidth } = getComputedStyle(this._input);\n return (\n this._input.scrollHeight +\n asNumber(borderTopWidth) +\n asNumber(borderBottomWidth)\n );\n }\n\n protected _setAreaHeight(): void {\n if (this.resize === 'auto') {\n this._input.style.height = 'auto';\n this._input.style.height = `${this._setAutoHeight()}px`;\n } else {\n Object.assign(this._input.style, { height: undefined });\n }\n }\n\n protected _resolvePartNames() {\n return {\n container: true,\n prefixed: this._slots.hasAssignedElements('prefix', {\n selector: ':not([hidden])',\n }),\n suffixed: this._slots.hasAssignedElements('suffix', {\n selector: ':not([hidden])',\n }),\n filled: !!this.value,\n };\n }\n\n //#endregion\n\n //#region Event handlers\n\n private _handleSlotChange({\n isDefault,\n }: SlotChangeCallbackParameters<InferSlotNames<typeof Slots>>): void {\n if (isDefault) {\n const value = this._slots\n .getAssignedNodes('[default]', true)\n .map((node) => node.textContent?.trim())\n .filter((node) => Boolean(node))\n .join('\\r\\n');\n\n if (value !== this.value) {\n this.value = value;\n }\n }\n }\n\n protected _handleInput(): void {\n this._commitValue(this._input.value, 'igcInput');\n }\n\n protected _handleChange(): void {\n this._commitValue(this._input.value, 'igcChange');\n }\n\n //#endregion\n\n //#region Public methods\n\n /** Selects all text within the control. */\n public select(): void {\n this._input.select();\n }\n\n /* blazorSuppress */\n /** Sets the text selection range of the control */\n public setSelectionRange(\n start: number,\n end: number,\n direction: SelectionRangeDirection = 'none'\n ): void {\n this._input.setSelectionRange(start, end, direction);\n }\n\n /* blazorSuppress */\n /** Replaces the selected text in the control. */\n public setRangeText(\n replacement: string,\n start: number,\n end: number,\n selectMode: RangeTextSelectMode = 'preserve'\n ): void {\n this._input.setRangeText(replacement, start, end, selectMode);\n this.value = this._input.value;\n }\n\n /* blazorSuppress */\n public override scrollTo(options?: ScrollToOptions | undefined): void;\n /* blazorSuppress */\n public override scrollTo(x: number, y: number): void;\n public override scrollTo(x?: unknown, y?: unknown): void {\n x != null && y != null\n ? this._input.scrollTo(x as number, y as number)\n : this._input.scrollTo(x as ScrollToOptions);\n }\n\n //#endregion\n\n //#region Renderers\n\n protected _renderSlot(name: InferSlotNames<typeof Slots>) {\n const isHidden = !this._slots.hasAssignedElements(name, {\n selector: ':not([hidden])',\n });\n\n return html`\n <div part=${name} ?hidden=${isHidden}>\n <slot name=${name}></slot>\n </div>\n `;\n }\n\n protected _renderLabel() {\n return this.label\n ? html`\n <label part=\"label\" for=${this.id || this._inputId}>\n ${this.label}\n </label>\n `\n : nothing;\n }\n\n protected _renderStandard() {\n return html`\n ${this._renderLabel()}\n <div part=${partMap(this._resolvePartNames())}>\n ${this._renderSlot('prefix')} ${this._renderInput()}\n ${this._renderSlot('suffix')}\n </div>\n ${this._renderValidationContainer()}\n `;\n }\n\n protected _renderMaterial() {\n return html`\n <div\n part=${partMap({\n ...this._resolvePartNames(),\n labelled: !!this.label,\n placeholder: !!this.placeholder,\n })}\n >\n <div part=\"start\">${this._renderSlot('prefix')}</div>\n ${this._renderInput()}\n <div part=\"notch\">${this._renderLabel()}</div>\n <div part=\"filler\"></div>\n <div part=\"end\">${this._renderSlot('suffix')}</div>\n </div>\n ${this._renderValidationContainer()}\n `;\n }\n\n protected _renderInput() {\n return html`\n <slot style=\"display: none\"></slot>\n <textarea\n ${ariaBindings(this._ariaTarget.resolveBindings())}\n id=${this.id || this._inputId}\n part=\"input\"\n style=${styleMap({\n resize: this.resize === 'auto' ? 'none' : this.resize,\n })}\n @input=${this._handleInput}\n @change=${this._handleChange}\n placeholder=${ifDefined(this.placeholder)}\n .rows=${this.rows}\n .value=${live(this.value)}\n .wrap=${this.wrap}\n autocomplete=${ifDefined(this.autocomplete as any)}\n autocapitalize=${ifDefined(this.autocapitalize as any)}\n inputmode=${ifDefined(this.inputMode)}\n spellcheck=${ifDefined(this.spellcheck)}\n minlength=${ifDefined(this.minLength)}\n maxlength=${ifDefined(this.validateOnly ? undefined : this.maxLength)}\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?readonly=${this.readOnly}\n ></textarea>\n `;\n }\n\n protected override render() {\n return cache(\n this._themes.theme === 'material'\n ? this._renderMaterial()\n : this._renderStandard()\n );\n }\n\n //#endregion\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-textarea': IgcTextareaComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"textar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iB;AAQrB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;sDAC1C;AASjB;IADN,QAAQ,EAAE;oDACgC;AASpC;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACX;AAShB;IADC,QAAQ,EAAE;iDAGV;AAkBe;IAPf,QAAQ,CAAC;QACR,IAAI,EAAE,OAAO;QACb,SAAS,EAAE;YACT,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,KAAK,OAAO,CAAC;YACxD,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;SACnD;KACF,CAAC;wDACgC;AAU3B;IADN,QAAQ,EAAE;kDACmC;AASvC;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;0DAC3C;AAlMT,oBAAoB;IADxC,aAAa,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;GACnB,oBAAoB,CAoXxC;eApXoB,oBAAoB","sourcesContent":["import { html, LitElement, type PropertyValues } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport {\n addAriaTarget,\n ariaBindings,\n} from '#internals/controllers/aria-projection.js';\nimport { createResizeObserverController } from '#internals/controllers/resize-observer.js';\nimport {\n addSlotController,\n type InferSlotNames,\n type SlotChangeCallbackParameters,\n setSlots,\n} from '#internals/controllers/slot.js';\nimport { shadowOptions } from '#internals/decorators/shadow-options.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport type { Constructor } from '#internals/mixins/constructor.js';\nimport { EventEmitterMixin } from '#internals/mixins/event-emitter.js';\nimport { FormAssociatedRequiredMixin } from '#internals/mixins/forms/associated-required.js';\nimport { createFormValueState } from '#internals/mixins/forms/form-value.js';\nimport {\n renderInputShell,\n resolveInputPartNames,\n} from '#internals/templates/input-shell.js';\nimport { addSafeEventListener } from '#internals/utils/events.js';\nimport { asNumber } from '#internals/utils/math.js';\nimport { createIdGenerator } from '#internals/utils/strings.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport type {\n RangeTextSelectMode,\n SelectionRangeDirection,\n TextareaResize,\n} from '../types.js';\nimport IgcValidationContainerComponent from '../validation-container/validation-container.js';\nimport { styles as shared } from './themes/shared/textarea.common.css.js';\nimport { styles } from './themes/textarea.base.css.js';\nimport { all } from './themes/themes.js';\nimport { textAreaValidators } from './validators.js';\n\nexport interface IgcTextareaComponentEventMap {\n igcInput: CustomEvent<string>;\n igcChange: CustomEvent<string>;\n // For analyzer meta only:\n /* skipWCPrefix */\n focus: FocusEvent;\n /* skipWCPrefix */\n blur: FocusEvent;\n}\n\nconst nextId = createIdGenerator('textarea');\nconst Slots = setSlots(\n 'prefix',\n 'suffix',\n 'helper-text',\n 'value-missing',\n 'too-long',\n 'too-short',\n 'custom-error',\n 'invalid'\n);\n\n/**\n * Represents a multi-line plain-text editing control,\n * useful when you want to allow users to enter a sizeable amount of free-form text,\n * for example a comment on a review or feedback form.\n *\n * @element igc-textarea\n *\n * @slot - Text content from the default slot will be used as the value of the component.\n * @slot prefix - Renders content before the input.\n * @slot suffix - Renders content after input.\n * @slot helper-text - Renders content below the input.\n * @slot value-missing - Renders content when the required validation fails.\n * @slot too-long - Renders content when the maxlength validation fails.\n * @slot too-short - Renders content when the minlength validation fails.\n * @slot custom-error - Renders content when setCustomValidity(message) is set.\n * @slot invalid - Renders content when the component is in invalid state (validity.valid = false).\n *\n * @fires igcInput - Emitted when the control receives user input.\n * @fires igcChange - Emitted when the a change to the control value is committed by the user.\n *\n * @csspart container - The main wrapper that holds all main input elements of the textarea.\n * @csspart input - The native input element of the textarea.\n * @csspart label - The native label element of the textarea.\n * @csspart prefix - The prefix wrapper of the textarea.\n * @csspart suffix - The suffix wrapper of the textarea.\n * @csspart helper-text - The helper text wrapper of the textarea.\n */\n@shadowOptions({ delegatesFocus: true })\nexport default class IgcTextareaComponent extends FormAssociatedRequiredMixin(\n EventEmitterMixin<IgcTextareaComponentEventMap, Constructor<LitElement>>(\n LitElement\n )\n) {\n public static readonly tagName = 'igc-textarea';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcTextareaComponent, IgcValidationContainerComponent);\n }\n\n //#region Private properties and state\n\n private readonly _inputId = nextId();\n\n private readonly _themes = addThemingController(this, all);\n\n private readonly _slots = addSlotController(this, {\n slots: Slots,\n onChange: this._handleSlotChange,\n });\n\n /**\n * Receives ARIA semantics projected by a composite host onto the inner\n * native textarea. See {@link addAriaTarget}.\n */\n private readonly _ariaTarget = addAriaTarget(this, {\n labels: () => this._internals.labels,\n description: () =>\n this._slots.hasAssignedElements('helper-text')\n ? this.renderRoot.querySelector('#helper-text')\n : null,\n });\n\n @query('textarea')\n private readonly _input?: HTMLTextAreaElement;\n\n protected override get __validators() {\n return textAreaValidators;\n }\n\n protected override readonly _formValue = createFormValueState(this, {\n initialValue: '',\n });\n\n //#endregion\n\n //#region Public properties and attributes\n\n /**\n * Specifies what permission, if any, the browser has to provide automated assistance in filling out form field values,\n * as well as guidance to the browser as to the type of information expected in the field.\n * Refer to [this page](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for additional information.\n *\n * @attr\n */\n @property()\n public autocomplete!: string;\n\n /**\n * Controls whether and how text input is automatically capitalized as it is entered/edited by the user.\n *\n * [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize).\n *\n * @attr\n */\n @property()\n public override autocapitalize!: string;\n\n /**\n * Hints at the type of data that might be entered by the user while editing the element or its contents.\n * This allows a browser to display an appropriate virtual keyboard.\n *\n * [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode)\n *\n * @attr inputmode\n */\n @property({ attribute: 'inputmode' })\n public override inputMode!: string;\n\n /**\n * The label for the control.\n *\n * @attr\n */\n @property()\n public label!: string;\n\n /**\n * The maximum number of characters (UTF-16 code units) that the user can enter.\n * If this value isn't specified, the user can enter an unlimited number of characters.\n *\n * @attr maxlength\n */\n @property({ type: Number, attribute: 'maxlength' })\n public maxLength!: number;\n\n /**\n * The minimum number of characters (UTF-16 code units) required that the user should enter.\n *\n * @attr minlength\n */\n @property({ type: Number, attribute: 'minlength' })\n public minLength!: number;\n\n /**\n * Whether the control will have outlined appearance.\n * @attr\n */\n @property({ reflect: true, type: Boolean })\n public outlined = false;\n\n /**\n * The placeholder text of the control.\n *\n * @attr\n */\n @property()\n public placeholder!: string;\n\n /**\n * Makes the control a readonly field.\n *\n * @attr readonly\n */\n @property({ type: Boolean, reflect: true, attribute: 'readonly' })\n public readOnly = false;\n\n /**\n * Controls whether the control can be resized.\n * When `auto` is set, the control will try to expand and fit its content.\n *\n * @attr\n */\n @property()\n public resize: TextareaResize = 'vertical';\n\n /**\n * The number of visible text lines for the control. If it is specified, it must be a positive integer.\n * If it is not specified, the default value is 3.\n *\n * @attr\n */\n @property({ type: Number })\n public rows = 3;\n\n /* @tsTwoWayProperty(true, \"igcChange\", \"detail\", false) */\n /**\n * The value of the component\n *\n * @attr\n */\n @property()\n public set value(value: string) {\n this._formValue.setValueAndFormState(value);\n }\n\n public get value(): string {\n return this._formValue.value;\n }\n\n /**\n * Controls whether the element may be checked for spelling errors.\n *\n * @attr\n */\n @property({\n type: Boolean,\n converter: {\n fromAttribute: (value) => !(!value || value === 'false'),\n toAttribute: (value) => (value ? 'true' : 'false'),\n },\n })\n public override spellcheck = true;\n\n /**\n * Indicates how the control should wrap the value for form submission.\n * Refer to [this page on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attributes)\n * for explanation of the available values.\n *\n * @attr\n */\n @property()\n public wrap: 'hard' | 'soft' | 'off' = 'soft';\n\n /**\n * Enables validation rules to be evaluated without restricting user input. This applies to the `maxLength` property\n * when it is defined.\n *\n * @attr validate-only\n */\n @property({ type: Boolean, reflect: true, attribute: 'validate-only' })\n public validateOnly = false;\n\n //#endregion\n\n //#region Life-cycle hooks\n\n constructor() {\n super();\n\n createResizeObserverController(this, {\n callback: this._setAreaHeight,\n });\n\n addSafeEventListener(this, 'blur', this._handleBlur);\n }\n\n protected override updated(props: PropertyValues<this>): void {\n if (props.has('rows') || props.has('resize') || props.has('value')) {\n this._setAreaHeight();\n }\n }\n\n //#endregion\n\n //#region Internal methods\n\n protected _setAreaHeight(): void {\n const input = this._input;\n\n if (!input) {\n return;\n }\n\n if (this.resize !== 'auto') {\n input.style.removeProperty('height');\n return;\n }\n\n input.style.height = 'auto';\n\n const { borderTopWidth, borderBottomWidth } = getComputedStyle(input);\n const height =\n input.scrollHeight +\n asNumber(borderTopWidth) +\n asNumber(borderBottomWidth);\n\n input.style.height = `${height}px`;\n }\n\n //#endregion\n\n //#region Event handlers\n\n private _handleSlotChange({\n isDefault,\n }: SlotChangeCallbackParameters<InferSlotNames<typeof Slots>>): void {\n if (!isDefault) {\n return;\n }\n\n const value = this._slots\n .getAssignedNodes('[default]', true)\n .map((node) => node.textContent?.trim())\n .filter(Boolean)\n .join('\\r\\n');\n\n if (value === this.value) {\n return;\n }\n\n if (this._pristine) {\n this.defaultValue = value;\n } else {\n this.value = value;\n }\n }\n\n protected _handleInput(): void {\n this._commitValue(this._input?.value ?? '', 'igcInput');\n }\n\n protected _handleChange(): void {\n this._commitValue(this._input?.value ?? '', 'igcChange');\n }\n\n //#endregion\n\n //#region Public methods\n\n /** Selects all text within the control. */\n public select(): void {\n this._input?.select();\n }\n\n /* blazorSuppress */\n /** Sets the text selection range of the control */\n public setSelectionRange(\n start: number,\n end: number,\n direction: SelectionRangeDirection = 'none'\n ): void {\n this._input?.setSelectionRange(start, end, direction);\n }\n\n /* blazorSuppress */\n /** Replaces the selected text in the control. */\n public setRangeText(\n replacement: string,\n start: number,\n end: number,\n selectMode: RangeTextSelectMode = 'preserve'\n ): void {\n this._input?.setRangeText(replacement, start, end, selectMode);\n this.value = this._input?.value ?? '';\n }\n\n /* blazorSuppress */\n public override scrollTo(options?: ScrollToOptions | undefined): void;\n /* blazorSuppress */\n public override scrollTo(x: number, y: number): void;\n public override scrollTo(x?: unknown, y?: unknown): void {\n x != null && y != null\n ? this._input?.scrollTo(x as number, y as number)\n : this._input?.scrollTo(x as ScrollToOptions);\n }\n\n //#endregion\n\n //#region Renderers\n\n protected _renderInput() {\n return html`\n <slot style=\"display: none\"></slot>\n <textarea\n ${ariaBindings(this._ariaTarget.resolveBindings())}\n id=${this._inputId}\n part=\"input\"\n style=${styleMap({\n resize: this.resize === 'auto' ? 'none' : this.resize,\n })}\n @input=${this._handleInput}\n @change=${this._handleChange}\n placeholder=${ifDefined(this.placeholder)}\n .rows=${this.rows}\n .value=${live(this.value)}\n .wrap=${this.wrap}\n autocomplete=${ifDefined(this.autocomplete as any)}\n autocapitalize=${ifDefined(this.autocapitalize as any)}\n inputmode=${ifDefined(this.inputMode)}\n spellcheck=${ifDefined(this.spellcheck)}\n minlength=${ifDefined(this.minLength)}\n maxlength=${ifDefined(this.validateOnly ? undefined : this.maxLength)}\n ?disabled=${this.disabled}\n ?required=${this.required}\n ?readonly=${this.readOnly}\n ></textarea>\n `;\n }\n\n protected override render() {\n return cache(\n renderInputShell(this, {\n theme: this._themes.theme,\n label: this.label,\n labelId: this._inputId,\n containerParts: resolveInputPartNames(\n this._slots,\n 'container',\n !!this.value\n ),\n materialParts: { placeholder: !!this.placeholder },\n hideEmptyAffixes: true,\n renderInput: this._renderInput,\n })\n );\n }\n\n //#endregion\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-textarea': IgcTextareaComponent;\n }\n}\n"]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type IgcTileManagerComponent from './tile-manager.js';
|
|
2
2
|
import type IgcTileComponent from './tile.js';
|
|
3
3
|
declare class TilesState {
|
|
4
|
-
private
|
|
5
|
-
manager: IgcTileManagerComponent;
|
|
4
|
+
private readonly _manager;
|
|
6
5
|
private get _tiles();
|
|
7
6
|
/**
|
|
8
7
|
* Returns the current tiles of the tile manager sorted by their position.
|
|
@@ -19,16 +18,10 @@ declare class TilesState {
|
|
|
19
18
|
adjustTileGridPosition(): void;
|
|
20
19
|
remove(tile: IgcTileComponent): void;
|
|
21
20
|
}
|
|
22
|
-
type TileDragStackEntry = {
|
|
23
|
-
tile: IgcTileComponent;
|
|
24
|
-
position: number;
|
|
25
|
-
column?: number | null;
|
|
26
|
-
row?: number | null;
|
|
27
|
-
};
|
|
28
21
|
declare class TileDragStack {
|
|
29
22
|
private _stack;
|
|
30
23
|
peek(): IgcTileComponent;
|
|
31
|
-
pop():
|
|
24
|
+
pop(): void;
|
|
32
25
|
push(tile: IgcTileComponent): void;
|
|
33
26
|
restore(): void;
|
|
34
27
|
reset(): void;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { lastOf, partition } from '#internals/utils/arrays.js';
|
|
2
2
|
class TilesState {
|
|
3
3
|
get _tiles() {
|
|
4
|
-
return Array.from(this.
|
|
4
|
+
return Array.from(this._manager.querySelectorAll(':scope > igc-tile'));
|
|
5
5
|
}
|
|
6
6
|
get tiles() {
|
|
7
7
|
return this._tiles.toSorted((a, b) => a.position - b.position);
|
|
8
8
|
}
|
|
9
9
|
constructor(manager) {
|
|
10
|
-
this.
|
|
11
|
-
this.manager = manager;
|
|
10
|
+
this._manager = manager;
|
|
12
11
|
}
|
|
13
12
|
assignPositions() {
|
|
14
13
|
let nextPosition = 0;
|
|
@@ -27,41 +26,35 @@ class TilesState {
|
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
28
|
assignTiles() {
|
|
30
|
-
this.
|
|
29
|
+
this._manager.renderRoot.querySelector('slot').assign(...this._tiles);
|
|
31
30
|
}
|
|
32
31
|
add(tile) {
|
|
33
|
-
const tiles = this.tiles;
|
|
34
32
|
if (tile.position > -1) {
|
|
35
|
-
for (const each of tiles) {
|
|
33
|
+
for (const each of this.tiles) {
|
|
36
34
|
if (each !== tile && each.position >= tile.position) {
|
|
37
35
|
each.position++;
|
|
38
36
|
}
|
|
39
37
|
}
|
|
38
|
+
return;
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
tile.position
|
|
44
|
-
|
|
45
|
-
? Math.max(...positionedTiles.map((tile) => tile.position)) + 1
|
|
46
|
-
: this._nextEmptyPosition;
|
|
47
|
-
this._nextEmptyPosition += 1;
|
|
48
|
-
}
|
|
40
|
+
const positionedTiles = this._tiles.filter((tile) => tile.position > -1);
|
|
41
|
+
tile.position = positionedTiles.length
|
|
42
|
+
? Math.max(...positionedTiles.map((tile) => tile.position)) + 1
|
|
43
|
+
: 0;
|
|
49
44
|
}
|
|
50
45
|
adjustTileGridPosition() {
|
|
51
|
-
const columnCount = this.
|
|
52
|
-
if (columnCount
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
tile.colSpan = columnCount - colStart + colStartDelta;
|
|
64
|
-
}
|
|
46
|
+
const { columnCount } = this._manager;
|
|
47
|
+
if (columnCount < 1) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
for (const tile of this.tiles) {
|
|
51
|
+
let colStart = tile.colStart ?? 0;
|
|
52
|
+
if (colStart > columnCount) {
|
|
53
|
+
colStart = 0;
|
|
54
|
+
tile.colStart = null;
|
|
55
|
+
}
|
|
56
|
+
if (colStart + tile.colSpan > columnCount) {
|
|
57
|
+
tile.colSpan = columnCount - colStart + (colStart > 0 ? 1 : 0);
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
}
|
|
@@ -81,23 +74,15 @@ class TileDragStack {
|
|
|
81
74
|
return lastOf(this._stack).tile;
|
|
82
75
|
}
|
|
83
76
|
pop() {
|
|
84
|
-
|
|
77
|
+
this._stack.pop();
|
|
85
78
|
}
|
|
86
79
|
push(tile) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
position: tile.position,
|
|
90
|
-
column: tile.colStart,
|
|
91
|
-
row: tile.rowStart,
|
|
92
|
-
});
|
|
80
|
+
const { position, colStart, rowStart } = tile;
|
|
81
|
+
this._stack.push({ tile, position, colStart, rowStart });
|
|
93
82
|
}
|
|
94
83
|
restore() {
|
|
95
|
-
for (const { tile,
|
|
96
|
-
Object.assign(tile,
|
|
97
|
-
position,
|
|
98
|
-
colStart,
|
|
99
|
-
rowStart,
|
|
100
|
-
});
|
|
84
|
+
for (const { tile, ...placement } of this._stack.toReversed()) {
|
|
85
|
+
Object.assign(tile, placement);
|
|
101
86
|
}
|
|
102
87
|
}
|
|
103
88
|
reset() {
|
|
@@ -112,7 +97,7 @@ export function createTileDragStack() {
|
|
|
112
97
|
}
|
|
113
98
|
export function swapTiles(a, b) {
|
|
114
99
|
[a.colStart, b.colStart] = [b.colStart, a.colStart];
|
|
115
|
-
[a.rowStart, b.rowStart] = [b.rowStart, a.
|
|
100
|
+
[a.rowStart, b.rowStart] = [b.rowStart, a.rowStart];
|
|
116
101
|
[a.position, b.position] = [b.position, a.position];
|
|
117
102
|
}
|
|
118
103
|
//# sourceMappingURL=position.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.js","sourceRoot":"","sources":["../../../src/components/tile-manager/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAI/D,MAAM,UAAU;
|
|
1
|
+
{"version":3,"file":"position.js","sourceRoot":"","sources":["../../../src/components/tile-manager/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,E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AAG,EAAE,CAAC;IACnB,CAAC;CACF;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAgC;IAC/D,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,aAAa,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,CAAmB,EAAE,CAAmB;IAChE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { lastOf, partition } from '#internals/utils/arrays.js';\nimport type IgcTileManagerComponent from './tile-manager.js';\nimport type IgcTileComponent from './tile.js';\n\nclass TilesState {\n private readonly _manager: IgcTileManagerComponent;\n\n private get _tiles(): IgcTileComponent[] {\n return Array.from(\n this._manager.querySelectorAll<IgcTileComponent>(':scope > igc-tile')\n );\n }\n\n /**\n * Returns the current tiles of the tile manager sorted by their position.\n */\n public get tiles(): IgcTileComponent[] {\n return this._tiles.toSorted((a, b) => a.position - b.position);\n }\n\n constructor(manager: IgcTileManagerComponent) {\n this._manager = manager;\n }\n\n public assignPositions(): void {\n let nextPosition = 0;\n const [positionedTiles, nonPositionedTiles] = partition(\n this._tiles,\n (tile) => tile.position !== -1\n );\n\n positionedTiles.sort((a, b) => a.position - b.position);\n\n for (const tile of positionedTiles) {\n // Fill any unassigned slots before the next assigned tile's position\n while (nextPosition < tile.position && nonPositionedTiles.length > 0) {\n const nonPositionedTile = nonPositionedTiles.shift()!;\n nonPositionedTile.position = nextPosition++;\n }\n\n tile.position = nextPosition;\n nextPosition = tile.position + 1;\n }\n\n for (const tile of nonPositionedTiles) {\n tile.position = nextPosition++;\n }\n }\n\n /** Updates the default (manual) slot of the tile manager with the current tiles. */\n public assignTiles(): void {\n this._manager.renderRoot.querySelector('slot')!.assign(...this._tiles);\n }\n\n public add(tile: IgcTileComponent): void {\n if (tile.position > -1) {\n for (const each of this.tiles) {\n if (each !== tile && each.position >= tile.position) {\n each.position++;\n }\n }\n return;\n }\n\n const positionedTiles = this._tiles.filter((tile) => tile.position > -1);\n\n tile.position = positionedTiles.length\n ? Math.max(...positionedTiles.map((tile) => tile.position)) + 1\n : 0;\n }\n\n /**\n * Checks and adjusts tile spans based on the column count of the tile manager.\n */\n public adjustTileGridPosition(): void {\n const { columnCount } = this._manager;\n\n if (columnCount < 1) {\n return;\n }\n\n for (const tile of this.tiles) {\n let colStart = tile.colStart ?? 0;\n\n if (colStart > columnCount) {\n colStart = 0;\n tile.colStart = null;\n }\n\n if (colStart + tile.colSpan > columnCount) {\n tile.colSpan = columnCount - colStart + (colStart > 0 ? 1 : 0);\n }\n }\n }\n\n public remove(tile: IgcTileComponent): void {\n for (const each of this.tiles) {\n if (each.position >= tile.position) {\n each.position--;\n }\n }\n }\n}\n\ntype TileDragStackEntry = {\n tile: IgcTileComponent;\n position: number;\n colStart: number | null;\n rowStart: number | null;\n};\n\nclass TileDragStack {\n private _stack: TileDragStackEntry[] = [];\n\n public peek(): IgcTileComponent {\n return lastOf(this._stack).tile;\n }\n\n public pop(): void {\n this._stack.pop();\n }\n\n public push(tile: IgcTileComponent): void {\n const { position, colStart, rowStart } = tile;\n this._stack.push({ tile, position, colStart, rowStart });\n }\n\n public restore(): void {\n for (const { tile, ...placement } of this._stack.toReversed()) {\n Object.assign(tile, placement);\n }\n }\n\n public reset(): void {\n this._stack = [];\n }\n}\n\nexport function createTilesState(manager: IgcTileManagerComponent) {\n return new TilesState(manager);\n}\n\nexport function createTileDragStack(): TileDragStack {\n return new TileDragStack();\n}\n\nexport function swapTiles(a: IgcTileComponent, b: IgcTileComponent): void {\n [a.colStart, b.colStart] = [b.colStart, a.colStart];\n [a.rowStart, b.rowStart] = [b.rowStart, a.rowStart];\n [a.position, b.position] = [b.position, a.position];\n}\n"]}
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
import type { ResizeState } from '
|
|
1
|
+
import type { ResizeState } from '#internals/directives/resize.js';
|
|
2
2
|
import type IgcTileComponent from './tile.js';
|
|
3
|
-
import type { TileGridDimension, TileGridPosition, TileResizeDimensions } from './types.js';
|
|
4
3
|
declare class TileResizeState {
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
protected _prevDeltaX: number;
|
|
9
|
-
protected _prevDeltaY: number;
|
|
10
|
-
protected _prevSnappedWidth: number;
|
|
11
|
-
protected _prevSnappedHeight: number;
|
|
12
|
-
protected _position: TileGridPosition;
|
|
13
|
-
protected _columns: TileGridDimension;
|
|
14
|
-
protected _rows: TileGridDimension;
|
|
15
|
-
resizedDimensions: TileResizeDimensions;
|
|
16
|
-
get gap(): number;
|
|
17
|
-
get position(): TileGridPosition;
|
|
18
|
-
get columns(): TileGridDimension;
|
|
19
|
-
get rows(): TileGridDimension;
|
|
4
|
+
private _gap;
|
|
5
|
+
private _position;
|
|
6
|
+
private _axes;
|
|
20
7
|
calculateSnappedWidth(state: ResizeState): number;
|
|
21
8
|
calculateSnappedHeight(state: ResizeState): number;
|
|
22
9
|
updateState(tileRect: DOMRect, tile: IgcTileComponent, grid: HTMLElement): void;
|
|
@@ -28,11 +15,13 @@ declare class TileResizeState {
|
|
|
28
15
|
colSpan: number;
|
|
29
16
|
rowSpan: number;
|
|
30
17
|
};
|
|
31
|
-
private
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
private _calculateSnappedSize;
|
|
19
|
+
private _initState;
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the tile's implicit grid start lines from its offset inside the
|
|
22
|
+
* grid container when the tile has no explicit `colStart`/`rowStart`.
|
|
23
|
+
*/
|
|
24
|
+
private _calculateTileStartPosition;
|
|
36
25
|
}
|
|
37
26
|
export declare function createTileResizeState(): TileResizeState;
|
|
38
27
|
export {};
|