|
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 | 8 |
|
| 9 | +let spacingDeprecationNotified = false; |
| 10 | +let labelWidthDeprecationNotified = false; |
| 11 | +let labelSpacingDeprecationNotified = false; |
| 12 | + |
9 | 13 | /** |
10 | 14 | * @polymerMixin |
11 | 15 | */ |
@@ -46,32 +50,30 @@ export const FormItemMixin = (superClass) => |
46 | 50 | ready() { |
47 | 51 | super.ready(); |
48 | 52 |
|
49 | | - if (!this.constructor.__isDeprecationWarningShown) { |
50 | | - const computedStyle = getComputedStyle(this); |
| 53 | + const computedStyle = getComputedStyle(this); |
| 54 | + const spacing = computedStyle.getPropertyValue('--vaadin-form-item-row-spacing'); |
| 55 | + const labelWidth = computedStyle.getPropertyValue('--vaadin-form-item-label-width'); |
| 56 | + const labelSpacing = computedStyle.getPropertyValue('--vaadin-form-item-label-spacing'); |
51 | 57 |
|
52 | | - const spacing = computedStyle.getPropertyValue('--vaadin-form-item-row-spacing'); |
53 | | - if (spacing !== '' && parseInt(spacing) !== 0) { |
54 | | - console.warn( |
55 | | - '`--vaadin-form-item-row-spacing` is deprecated since 24.7. Use `--vaadin-form-layout-row-spacing` on <vaadin-form-layout> instead.', |
56 | | - ); |
57 | | - this.constructor.__isDeprecationWarningShown = true; |
58 | | - } |
| 58 | + if (!spacingDeprecationNotified && spacing !== '' && parseInt(spacing) !== 0) { |
| 59 | + console.warn( |
| 60 | + '`--vaadin-form-item-row-spacing` is deprecated since 24.7. Use `--vaadin-form-layout-row-spacing` on <vaadin-form-layout> instead.', |
| 61 | + ); |
| 62 | + spacingDeprecationNotified = true; |
| 63 | + } |
59 | 64 |
|
60 | | - const labelWidth = computedStyle.getPropertyValue('--vaadin-form-item-label-width'); |
61 | | - if (labelWidth !== '' && parseInt(labelWidth) !== 0) { |
62 | | - console.warn( |
63 | | - '`--vaadin-form-item-label-width` is deprecated since 24.7. Use `--vaadin-form-layout-label-width` on <vaadin-form-layout> instead.', |
64 | | - ); |
65 | | - this.constructor.__isDeprecationWarningShown = true; |
66 | | - } |
| 65 | + if (!labelWidthDeprecationNotified && labelWidth !== '' && parseInt(labelWidth) !== 0) { |
| 66 | + console.warn( |
| 67 | + '`--vaadin-form-item-label-width` is deprecated since 24.7. Use `--vaadin-form-layout-label-width` on <vaadin-form-layout> instead.', |
| 68 | + ); |
| 69 | + labelWidthDeprecationNotified = true; |
| 70 | + } |
67 | 71 |
|
68 | | - const labelSpacing = computedStyle.getPropertyValue('--vaadin-form-item-label-spacing'); |
69 | | - if (labelSpacing !== '' && parseInt(labelSpacing) !== 0) { |
70 | | - console.warn( |
71 | | - '`--vaadin-form-item-label-spacing` is deprecated since 24.7. Use `--vaadin-form-layout-label-spacing` on <vaadin-form-layout> instead.', |
72 | | - ); |
73 | | - this.constructor.__isDeprecationWarningShown = true; |
74 | | - } |
| 72 | + if (!labelSpacingDeprecationNotified && labelSpacing !== '' && parseInt(labelSpacing) !== 0) { |
| 73 | + console.warn( |
| 74 | + '`--vaadin-form-item-label-spacing` is deprecated since 24.7. Use `--vaadin-form-layout-label-spacing` on <vaadin-form-layout> instead.', |
| 75 | + ); |
| 76 | + labelSpacingDeprecationNotified = true; |
75 | 77 | } |
76 | 78 | } |
77 | 79 |
|
|
0 commit comments