|
5 | 5 | */ |
6 | 6 | import { addValueToAttribute, removeValueFromAttribute } from '@vaadin/component-base/src/dom-utils.js'; |
7 | 7 | import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js'; |
8 | | - |
9 | | -let spacingDeprecationNotified = false; |
10 | | -let labelWidthDeprecationNotified = false; |
11 | | -let labelSpacingDeprecationNotified = false; |
| 8 | +import { issueWarning } from '@vaadin/component-base/src/warnings.js'; |
12 | 9 |
|
13 | 10 | /** |
14 | 11 | * @polymerMixin |
@@ -58,25 +55,22 @@ export const FormItemMixin = (superClass) => |
58 | 55 | const labelWidth = computedStyle.getPropertyValue('--vaadin-form-item-label-width'); |
59 | 56 | const labelSpacing = computedStyle.getPropertyValue('--vaadin-form-item-label-spacing'); |
60 | 57 |
|
61 | | - if (!spacingDeprecationNotified && spacing !== '' && parseInt(spacing) !== 0) { |
62 | | - console.warn( |
| 58 | + if (spacing !== '' && parseInt(spacing) !== 0) { |
| 59 | + issueWarning( |
63 | 60 | '`--vaadin-form-item-row-spacing` is deprecated since 24.7. Use `--vaadin-form-layout-row-spacing` on <vaadin-form-layout> instead.', |
64 | 61 | ); |
65 | | - spacingDeprecationNotified = true; |
66 | 62 | } |
67 | 63 |
|
68 | | - if (!labelWidthDeprecationNotified && labelWidth !== '' && parseInt(labelWidth) !== 0) { |
69 | | - console.warn( |
| 64 | + if (labelWidth !== '' && parseInt(labelWidth) !== 0) { |
| 65 | + issueWarning( |
70 | 66 | '`--vaadin-form-item-label-width` is deprecated since 24.7. Use `--vaadin-form-layout-label-width` on <vaadin-form-layout> instead.', |
71 | 67 | ); |
72 | | - labelWidthDeprecationNotified = true; |
73 | 68 | } |
74 | 69 |
|
75 | | - if (!labelSpacingDeprecationNotified && labelSpacing !== '' && parseInt(labelSpacing) !== 0) { |
76 | | - console.warn( |
| 70 | + if (labelSpacing !== '' && parseInt(labelSpacing) !== 0) { |
| 71 | + issueWarning( |
77 | 72 | '`--vaadin-form-item-label-spacing` is deprecated since 24.7. Use `--vaadin-form-layout-label-spacing` on <vaadin-form-layout> instead.', |
78 | 73 | ); |
79 | | - labelSpacingDeprecationNotified = true; |
80 | 74 | } |
81 | 75 | } |
82 | 76 |
|
@@ -185,7 +179,7 @@ export const FormItemMixin = (superClass) => |
185 | 179 |
|
186 | 180 | const fieldNodes = this.$.contentSlot.assignedElements(); |
187 | 181 | if (fieldNodes.length > 1) { |
188 | | - console.warn( |
| 182 | + issueWarning( |
189 | 183 | `WARNING: Since Vaadin 23, placing multiple fields directly to a <vaadin-form-item> is deprecated. |
190 | 184 | Please wrap fields with a <vaadin-custom-field> instead.`, |
191 | 185 | ); |
|
0 commit comments