@vaadin/field-base 23.3.3 → 24.0.0-alpha10
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/index.d.ts +0 -3
- package/index.js +0 -3
- package/package.json +3 -3
- package/src/checked-mixin.d.ts +2 -2
- package/src/checked-mixin.js +2 -2
- package/src/error-controller.d.ts +3 -8
- package/src/error-controller.js +53 -65
- package/src/field-aria-controller.d.ts +1 -1
- package/src/field-aria-controller.js +11 -11
- package/src/field-mixin.d.ts +1 -1
- package/src/field-mixin.js +24 -28
- package/src/helper-controller.d.ts +3 -5
- package/src/helper-controller.js +47 -147
- package/src/input-constraints-mixin.d.ts +2 -2
- package/src/input-constraints-mixin.js +2 -2
- package/src/input-control-mixin.d.ts +3 -3
- package/src/input-control-mixin.js +4 -4
- package/src/input-controller.d.ts +1 -1
- package/src/input-controller.js +5 -8
- package/src/input-field-mixin.d.ts +3 -3
- package/src/input-field-mixin.js +10 -10
- package/src/input-mixin.d.ts +1 -1
- package/src/input-mixin.js +17 -11
- package/src/label-controller.d.ts +3 -8
- package/src/label-controller.js +45 -149
- package/src/label-mixin.d.ts +1 -1
- package/src/label-mixin.js +13 -8
- package/src/labelled-input-controller.d.ts +1 -1
- package/src/labelled-input-controller.js +2 -2
- package/src/pattern-mixin.d.ts +3 -11
- package/src/pattern-mixin.js +2 -50
- package/src/slot-styles-mixin.d.ts +1 -1
- package/src/slot-styles-mixin.js +1 -1
- package/src/styles/clear-button-styles.d.ts +1 -1
- package/src/styles/clear-button-styles.js +1 -1
- package/src/styles/field-shared-styles.d.ts +1 -1
- package/src/styles/field-shared-styles.js +1 -1
- package/src/styles/input-field-container-styles.d.ts +1 -1
- package/src/styles/input-field-container-styles.js +1 -1
- package/src/styles/input-field-shared-styles.d.ts +1 -1
- package/src/styles/input-field-shared-styles.js +1 -1
- package/src/text-area-controller.d.ts +1 -1
- package/src/text-area-controller.js +5 -8
- package/src/validate-mixin.d.ts +1 -1
- package/src/validate-mixin.js +1 -1
- package/src/virtual-keyboard-controller.d.ts +1 -1
- package/src/virtual-keyboard-controller.js +1 -1
- package/src/delegate-focus-mixin.d.ts +0 -48
- package/src/delegate-focus-mixin.js +0 -228
- package/src/delegate-state-mixin.d.ts +0 -20
- package/src/delegate-state-mixin.js +0 -125
- package/src/shadow-focus-mixin.d.ts +0 -23
- package/src/shadow-focus-mixin.js +0 -97
- package/src/slot-target-controller.d.ts +0 -31
- package/src/slot-target-controller.js +0 -123
package/src/label-controller.js
CHANGED
|
@@ -1,77 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { SlotChildObserveController } from '@vaadin/component-base/src/slot-child-observe-controller.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A controller to manage the label element.
|
|
10
10
|
*/
|
|
11
|
-
export class LabelController extends
|
|
11
|
+
export class LabelController extends SlotChildObserveController {
|
|
12
12
|
constructor(host) {
|
|
13
|
-
super(
|
|
14
|
-
host,
|
|
15
|
-
'label',
|
|
16
|
-
() => document.createElement('label'),
|
|
17
|
-
(_host, node) => {
|
|
18
|
-
// Set ID attribute or use the existing one.
|
|
19
|
-
this.__updateLabelId(node);
|
|
20
|
-
|
|
21
|
-
// Set text content for the default label.
|
|
22
|
-
this.__updateDefaultLabel(this.label);
|
|
23
|
-
|
|
24
|
-
this.__observeLabel(node);
|
|
25
|
-
},
|
|
26
|
-
true,
|
|
27
|
-
);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @return {string}
|
|
32
|
-
*/
|
|
33
|
-
get labelId() {
|
|
34
|
-
return this.node.id;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Override to initialize the newly added custom label.
|
|
39
|
-
*
|
|
40
|
-
* @param {Node} labelNode
|
|
41
|
-
* @protected
|
|
42
|
-
* @override
|
|
43
|
-
*/
|
|
44
|
-
initCustomNode(labelNode) {
|
|
45
|
-
this.__updateLabelId(labelNode);
|
|
46
|
-
|
|
47
|
-
const hasLabel = this.__hasLabel(labelNode);
|
|
48
|
-
this.__toggleHasLabel(hasLabel);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Override to cleanup label node when it's removed.
|
|
53
|
-
*
|
|
54
|
-
* @param {Node} node
|
|
55
|
-
* @protected
|
|
56
|
-
* @override
|
|
57
|
-
*/
|
|
58
|
-
teardownNode(node) {
|
|
59
|
-
if (this.__labelObserver) {
|
|
60
|
-
this.__labelObserver.disconnect();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
let labelNode = this.getSlotChild();
|
|
64
|
-
|
|
65
|
-
// If custom label was removed, restore the default one.
|
|
66
|
-
if (!labelNode && node !== this.defaultNode) {
|
|
67
|
-
labelNode = this.attachDefaultNode();
|
|
68
|
-
|
|
69
|
-
// Run initializer to update default label and ID.
|
|
70
|
-
this.initNode(labelNode);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const hasLabel = this.__hasLabel(labelNode);
|
|
74
|
-
this.__toggleHasLabel(hasLabel);
|
|
13
|
+
super(host, 'label', 'label');
|
|
75
14
|
}
|
|
76
15
|
|
|
77
16
|
/**
|
|
@@ -82,108 +21,65 @@ export class LabelController extends SlotController {
|
|
|
82
21
|
setLabel(label) {
|
|
83
22
|
this.label = label;
|
|
84
23
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @param {HTMLElement} labelNode
|
|
90
|
-
* @return {boolean}
|
|
91
|
-
* @private
|
|
92
|
-
*/
|
|
93
|
-
__hasLabel(labelNode) {
|
|
24
|
+
// Restore the default label, if needed.
|
|
25
|
+
const labelNode = this.getSlotChild();
|
|
94
26
|
if (!labelNode) {
|
|
95
|
-
|
|
27
|
+
this.restoreDefaultNode();
|
|
96
28
|
}
|
|
97
29
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
* @param {string} label
|
|
103
|
-
* @private
|
|
104
|
-
*/
|
|
105
|
-
__isNotEmpty(label) {
|
|
106
|
-
return Boolean(label && label.trim() !== '');
|
|
30
|
+
// When default label is used, update it.
|
|
31
|
+
if (this.node === this.defaultNode) {
|
|
32
|
+
this.updateDefaultNode(this.node);
|
|
33
|
+
}
|
|
107
34
|
}
|
|
108
35
|
|
|
109
36
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
37
|
+
* Override method inherited from `SlotChildObserveController`
|
|
38
|
+
* to restore and observe the default label element.
|
|
39
|
+
*
|
|
40
|
+
* @protected
|
|
41
|
+
* @override
|
|
112
42
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
mutations.forEach((mutation) => {
|
|
116
|
-
const target = mutation.target;
|
|
43
|
+
restoreDefaultNode() {
|
|
44
|
+
const { label } = this;
|
|
117
45
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
46
|
+
// Restore the default label.
|
|
47
|
+
if (label && label.trim() !== '') {
|
|
48
|
+
const labelNode = this.attachDefaultNode();
|
|
121
49
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (isLabelMutation && target.id !== this.defaultId) {
|
|
126
|
-
this.__updateLabelId(target);
|
|
127
|
-
}
|
|
128
|
-
} else if (isLabelMutation || target.parentElement === this.node) {
|
|
129
|
-
// Update has-label when textContent changes
|
|
130
|
-
const hasLabel = this.__hasLabel(this.node);
|
|
131
|
-
this.__toggleHasLabel(hasLabel);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// Observe changes to label ID attribute, text content and children.
|
|
137
|
-
this.__labelObserver.observe(labelNode, {
|
|
138
|
-
attributes: true,
|
|
139
|
-
attributeFilter: ['id'],
|
|
140
|
-
childList: true,
|
|
141
|
-
subtree: true,
|
|
142
|
-
characterData: true,
|
|
143
|
-
});
|
|
50
|
+
// Observe the default label.
|
|
51
|
+
this.observeNode(labelNode);
|
|
52
|
+
}
|
|
144
53
|
}
|
|
145
54
|
|
|
146
55
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
56
|
+
* Override method inherited from `SlotChildObserveController`
|
|
57
|
+
* to update the default label element text content.
|
|
58
|
+
*
|
|
59
|
+
* @param {Node | undefined} node
|
|
60
|
+
* @protected
|
|
61
|
+
* @override
|
|
149
62
|
*/
|
|
150
|
-
|
|
151
|
-
|
|
63
|
+
updateDefaultNode(node) {
|
|
64
|
+
if (node) {
|
|
65
|
+
node.textContent = this.label;
|
|
66
|
+
}
|
|
152
67
|
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
new CustomEvent('label-changed', {
|
|
156
|
-
detail: {
|
|
157
|
-
hasLabel,
|
|
158
|
-
node: this.node,
|
|
159
|
-
},
|
|
160
|
-
}),
|
|
161
|
-
);
|
|
68
|
+
// Notify the host after update.
|
|
69
|
+
super.updateDefaultNode(node);
|
|
162
70
|
}
|
|
163
71
|
|
|
164
72
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
73
|
+
* Override to observe the newly added custom node.
|
|
74
|
+
*
|
|
75
|
+
* @param {Node} node
|
|
76
|
+
* @protected
|
|
77
|
+
* @override
|
|
167
78
|
*/
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
// Update has-label if default label is used
|
|
173
|
-
if (this.defaultNode === this.node) {
|
|
174
|
-
const hasLabel = this.__isNotEmpty(label);
|
|
175
|
-
this.__toggleHasLabel(hasLabel);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
79
|
+
initCustomNode(node) {
|
|
80
|
+
// Notify the host about adding a custom node.
|
|
81
|
+
super.initCustomNode(node);
|
|
179
82
|
|
|
180
|
-
|
|
181
|
-
* @param {HTMLElement} labelNode
|
|
182
|
-
* @private
|
|
183
|
-
*/
|
|
184
|
-
__updateLabelId(labelNode) {
|
|
185
|
-
if (!labelNode.id) {
|
|
186
|
-
labelNode.id = this.defaultId;
|
|
187
|
-
}
|
|
83
|
+
this.observeNode(node);
|
|
188
84
|
}
|
|
189
85
|
}
|
package/src/label-mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/label-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
|
@@ -29,9 +29,20 @@ export const LabelMixin = dedupingMixin(
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
|
|
35
|
+
this._labelController = new LabelController(this);
|
|
36
|
+
|
|
37
|
+
this._labelController.addEventListener('slot-content-changed', (event) => {
|
|
38
|
+
this.toggleAttribute('has-label', event.detail.hasContent);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
32
42
|
/** @protected */
|
|
33
43
|
get _labelId() {
|
|
34
|
-
|
|
44
|
+
const node = this._labelNode;
|
|
45
|
+
return node && node.id;
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
/** @protected */
|
|
@@ -39,12 +50,6 @@ export const LabelMixin = dedupingMixin(
|
|
|
39
50
|
return this._labelController.node;
|
|
40
51
|
}
|
|
41
52
|
|
|
42
|
-
constructor() {
|
|
43
|
-
super();
|
|
44
|
-
|
|
45
|
-
this._labelController = new LabelController(this);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
53
|
/** @protected */
|
|
49
54
|
ready() {
|
|
50
55
|
super.ready();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ export class LabelledInputController {
|
|
|
12
12
|
this.input = input;
|
|
13
13
|
this.__preventDuplicateLabelClick = this.__preventDuplicateLabelClick.bind(this);
|
|
14
14
|
|
|
15
|
-
labelController.addEventListener('
|
|
15
|
+
labelController.addEventListener('slot-content-changed', (event) => {
|
|
16
16
|
this.__initLabel(event.detail.node);
|
|
17
17
|
});
|
|
18
18
|
|
package/src/pattern-mixin.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import type { DelegateStateMixinClass } from '
|
|
7
|
+
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
8
8
|
import type { InputConstraintsMixinClass } from './input-constraints-mixin.js';
|
|
9
9
|
import type { InputMixinClass } from './input-mixin.js';
|
|
10
10
|
import type { ValidateMixinClass } from './validate-mixin.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* A mixin to provide `pattern`
|
|
13
|
+
* A mixin to provide `pattern` property.
|
|
14
14
|
*/
|
|
15
15
|
export declare function PatternMixin<T extends Constructor<HTMLElement>>(
|
|
16
16
|
base: T,
|
|
@@ -27,12 +27,4 @@ export declare class PatternMixinClass {
|
|
|
27
27
|
* The pattern must match the entire value, not just some subset.
|
|
28
28
|
*/
|
|
29
29
|
pattern: string;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* When set to true, user is prevented from typing a value that
|
|
33
|
-
* conflicts with the given `pattern`.
|
|
34
|
-
* @attr {boolean} prevent-invalid-input
|
|
35
|
-
* @deprecated Please use `allowedCharPattern` instead.
|
|
36
|
-
*/
|
|
37
|
-
preventInvalidInput: boolean | null | undefined;
|
|
38
30
|
}
|
package/src/pattern-mixin.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { timeOut } from '@vaadin/component-base/src/async.js';
|
|
7
|
-
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
|
|
8
6
|
import { InputConstraintsMixin } from './input-constraints-mixin.js';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
|
-
* A mixin to provide `pattern`
|
|
9
|
+
* A mixin to provide `pattern` property.
|
|
12
10
|
*
|
|
13
11
|
* @polymerMixin
|
|
14
12
|
* @mixes InputConstraintsMixin
|
|
@@ -24,17 +22,6 @@ export const PatternMixin = (superclass) =>
|
|
|
24
22
|
pattern: {
|
|
25
23
|
type: String,
|
|
26
24
|
},
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* When set to true, user is prevented from typing a value that
|
|
30
|
-
* conflicts with the given `pattern`.
|
|
31
|
-
* @attr {boolean} prevent-invalid-input
|
|
32
|
-
* @deprecated Please use `allowedCharPattern` instead.
|
|
33
|
-
*/
|
|
34
|
-
preventInvalidInput: {
|
|
35
|
-
type: Boolean,
|
|
36
|
-
observer: '_preventInvalidInputChanged',
|
|
37
|
-
},
|
|
38
25
|
};
|
|
39
26
|
}
|
|
40
27
|
|
|
@@ -45,39 +32,4 @@ export const PatternMixin = (superclass) =>
|
|
|
45
32
|
static get constraints() {
|
|
46
33
|
return [...super.constraints, 'pattern'];
|
|
47
34
|
}
|
|
48
|
-
|
|
49
|
-
/** @private */
|
|
50
|
-
_checkInputValue() {
|
|
51
|
-
if (this.preventInvalidInput) {
|
|
52
|
-
const input = this.inputElement;
|
|
53
|
-
if (input && input.value.length > 0 && !this.checkValidity()) {
|
|
54
|
-
input.value = this.value || '';
|
|
55
|
-
// Add input-prevented attribute for 200ms
|
|
56
|
-
this.setAttribute('input-prevented', '');
|
|
57
|
-
this._inputDebouncer = Debouncer.debounce(this._inputDebouncer, timeOut.after(200), () => {
|
|
58
|
-
this.removeAttribute('input-prevented');
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @param {Event} event
|
|
66
|
-
* @protected
|
|
67
|
-
* @override
|
|
68
|
-
*/
|
|
69
|
-
_onInput(event) {
|
|
70
|
-
this._checkInputValue();
|
|
71
|
-
|
|
72
|
-
super._onInput(event);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** @private */
|
|
76
|
-
_preventInvalidInputChanged(preventInvalidInput) {
|
|
77
|
-
if (preventInvalidInput) {
|
|
78
|
-
console.warn(
|
|
79
|
-
`WARNING: Since Vaadin 23.2, "preventInvalidInput" is deprecated. Please use "allowedCharPattern" instead.`,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
35
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/slot-styles-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd..
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { clearButton } from './clear-button-styles.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
@@ -10,11 +10,8 @@ import { SlotController } from '@vaadin/component-base/src/slot-controller.js';
|
|
|
10
10
|
*/
|
|
11
11
|
export class TextAreaController extends SlotController {
|
|
12
12
|
constructor(host, callback) {
|
|
13
|
-
super(
|
|
14
|
-
host
|
|
15
|
-
'textarea',
|
|
16
|
-
() => document.createElement('textarea'),
|
|
17
|
-
(host, node) => {
|
|
13
|
+
super(host, 'textarea', 'textarea', {
|
|
14
|
+
initializer: (node, host) => {
|
|
18
15
|
const value = host.getAttribute('value');
|
|
19
16
|
if (value) {
|
|
20
17
|
node.value = value;
|
|
@@ -31,7 +28,7 @@ export class TextAreaController extends SlotController {
|
|
|
31
28
|
callback(node);
|
|
32
29
|
}
|
|
33
30
|
},
|
|
34
|
-
true,
|
|
35
|
-
);
|
|
31
|
+
useUniqueId: true,
|
|
32
|
+
});
|
|
36
33
|
}
|
|
37
34
|
}
|
package/src/validate-mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/validate-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
|
-
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
-
*/
|
|
6
|
-
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import type { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
8
|
-
import type { FocusMixinClass } from '@vaadin/component-base/src/focus-mixin.js';
|
|
9
|
-
import type { TabindexMixinClass } from '@vaadin/component-base/src/tabindex-mixin.js';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* A mixin to forward focus to an element in the light DOM.
|
|
13
|
-
*/
|
|
14
|
-
export declare function DelegateFocusMixin<T extends Constructor<HTMLElement>>(
|
|
15
|
-
base: T,
|
|
16
|
-
): Constructor<DelegateFocusMixinClass> &
|
|
17
|
-
Constructor<DisabledMixinClass> &
|
|
18
|
-
Constructor<FocusMixinClass> &
|
|
19
|
-
Constructor<TabindexMixinClass> &
|
|
20
|
-
T;
|
|
21
|
-
|
|
22
|
-
export declare class DelegateFocusMixinClass {
|
|
23
|
-
/**
|
|
24
|
-
* Specify that this control should have input focus when the page loads.
|
|
25
|
-
*/
|
|
26
|
-
autofocus: boolean;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* A reference to the focusable element controlled by the mixin.
|
|
30
|
-
* It can be an input, textarea, button or any element with tabindex > -1.
|
|
31
|
-
*
|
|
32
|
-
* Any component implementing this mixin is expected to provide it
|
|
33
|
-
* by using `this._setFocusElement(input)` Polymer API.
|
|
34
|
-
*/
|
|
35
|
-
readonly focusElement: HTMLElement | null | undefined;
|
|
36
|
-
|
|
37
|
-
protected _addFocusListeners(element: HTMLElement): void;
|
|
38
|
-
|
|
39
|
-
protected _removeFocusListeners(element: HTMLElement): void;
|
|
40
|
-
|
|
41
|
-
protected _focusElementChanged(element: HTMLElement, oldElement: HTMLElement): void;
|
|
42
|
-
|
|
43
|
-
protected _onBlur(event: FocusEvent): void;
|
|
44
|
-
|
|
45
|
-
protected _onFocus(event: FocusEvent): void;
|
|
46
|
-
|
|
47
|
-
protected _setFocusElement(element: HTMLElement): void;
|
|
48
|
-
}
|