@vaadin/form-layout
Advanced tools
Comparing version 23.0.0-alpha2 to 23.0.0-alpha3
{ | ||
"name": "@vaadin/form-layout", | ||
"version": "23.0.0-alpha2", | ||
"version": "23.0.0-alpha3", | ||
"publishConfig": { | ||
@@ -35,17 +35,16 @@ "access": "public" | ||
"dependencies": { | ||
"@polymer/iron-resizable-behavior": "^3.0.0", | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/component-base": "23.0.0-alpha2", | ||
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha2", | ||
"@vaadin/vaadin-material-styles": "23.0.0-alpha2", | ||
"@vaadin/vaadin-themable-mixin": "23.0.0-alpha2" | ||
"@vaadin/component-base": "23.0.0-alpha3", | ||
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha3", | ||
"@vaadin/vaadin-material-styles": "23.0.0-alpha3", | ||
"@vaadin/vaadin-themable-mixin": "23.0.0-alpha3" | ||
}, | ||
"devDependencies": { | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@vaadin/custom-field": "23.0.0-alpha2", | ||
"@vaadin/custom-field": "23.0.0-alpha3", | ||
"@vaadin/testing-helpers": "^0.3.2", | ||
"@vaadin/text-field": "23.0.0-alpha2", | ||
"@vaadin/text-field": "23.0.0-alpha3", | ||
"sinon": "^9.2.1" | ||
}, | ||
"gitHead": "070f586dead02ca41b66717820c647f48bf1665f" | ||
"gitHead": "490037919a9e054cc002c1b3be0c94a1603e1a44" | ||
} |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2017 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -12,3 +12,3 @@ */ | ||
* | ||
* `<vaadin-form-item>` accepts any number of children as the input content, | ||
* `<vaadin-form-item>` accepts a single child as the input content, | ||
* and also has a separate named `label` slot: | ||
@@ -23,15 +23,2 @@ * | ||
* | ||
* Any content can be used. For instance, you can have multiple input elements | ||
* with surrounding text. The label can be an element of any type: | ||
* | ||
* ```html | ||
* <vaadin-form-item> | ||
* <span slot="label">Date of Birth</span> | ||
* <input placeholder="YYYY" size="4"> - | ||
* <input placeholder="MM" size="2"> - | ||
* <input placeholder="DD" size="2"><br> | ||
* <em>Example: 1900-01-01</em> | ||
* </vaadin-form-item> | ||
* ``` | ||
* | ||
* The label is optional and can be omitted: | ||
@@ -63,3 +50,3 @@ * | ||
* By default, `<vaadin-form-item>` does not manipulate the width of the slotted | ||
* input elements. Optionally you can stretch the child input element to fill | ||
* input element. Optionally you can stretch the child input element to fill | ||
* the available width for the input content by adding the `full-width` class: | ||
@@ -66,0 +53,0 @@ * |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2017 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -14,3 +14,3 @@ */ | ||
* | ||
* `<vaadin-form-item>` accepts any number of children as the input content, | ||
* `<vaadin-form-item>` accepts a single child as the input content, | ||
* and also has a separate named `label` slot: | ||
@@ -25,15 +25,2 @@ * | ||
* | ||
* Any content can be used. For instance, you can have multiple input elements | ||
* with surrounding text. The label can be an element of any type: | ||
* | ||
* ```html | ||
* <vaadin-form-item> | ||
* <span slot="label">Date of Birth</span> | ||
* <input placeholder="YYYY" size="4"> - | ||
* <input placeholder="MM" size="2"> - | ||
* <input placeholder="DD" size="2"><br> | ||
* <em>Example: 1900-01-01</em> | ||
* </vaadin-form-item> | ||
* ``` | ||
* | ||
* The label is optional and can be omitted: | ||
@@ -65,3 +52,3 @@ * | ||
* By default, `<vaadin-form-item>` does not manipulate the width of the slotted | ||
* input elements. Optionally you can stretch the child input element to fill | ||
* input element. Optionally you can stretch the child input element to fill | ||
* the available width for the input content by adding the `full-width` class: | ||
@@ -301,3 +288,11 @@ * | ||
const newFieldNode = this.$.contentSlot.assignedElements().find((field) => { | ||
const fieldNodes = this.$.contentSlot.assignedElements(); | ||
if (fieldNodes.length > 1) { | ||
console.warn( | ||
`WARNING: Since Vaadin 23, placing multiple fields directly to a <vaadin-form-item> is deprecated. | ||
Please wrap fields with a <vaadin-custom-field> instead.` | ||
); | ||
} | ||
const newFieldNode = fieldNodes.find((field) => { | ||
return !!this.__getValidateFunction(field); | ||
@@ -304,0 +299,0 @@ }); |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2017 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js'; | ||
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js'; | ||
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
@@ -107,3 +108,3 @@ | ||
*/ | ||
declare class FormLayout extends ElementMixin(ThemableMixin(HTMLElement)) { | ||
declare class FormLayout extends ResizeMixin(ElementMixin(ThemableMixin(HTMLElement))) { | ||
/** | ||
@@ -150,4 +151,12 @@ * Allows specifying a responsive behavior with the number of columns | ||
* Set custom CSS property values and update the layout. | ||
* | ||
* @deprecated Since Vaadin 23, `updateStyles()` is deprecated. | ||
* Use the native element.style.setProperty API to set custom CSS property values. | ||
*/ | ||
updateStyles(properties?: { [key: string]: string }): void; | ||
/** | ||
* Update the layout. | ||
*/ | ||
protected _updateLayout(): void; | ||
} | ||
@@ -154,0 +163,0 @@ |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2017 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js'; | ||
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js'; | ||
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js'; | ||
import { beforeNextRender } from '@polymer/polymer/lib/utils/render-status.js'; | ||
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js'; | ||
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js'; | ||
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js'; | ||
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
@@ -107,4 +105,5 @@ | ||
* @mixes ThemableMixin | ||
* @mixes ResizeMixin | ||
*/ | ||
class FormLayout extends ElementMixin(ThemableMixin(mixinBehaviors([IronResizableBehavior], PolymerElement))) { | ||
class FormLayout extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) { | ||
static get template() { | ||
@@ -247,3 +246,3 @@ return html` | ||
static get observers() { | ||
return ['_invokeUpdateStyles(_columnCount, _labelsOnTop)']; | ||
return ['_invokeUpdateLayout(_columnCount, _labelsOnTop)']; | ||
} | ||
@@ -259,3 +258,3 @@ | ||
this._styleElement = document.createElement('style'); | ||
this.root.appendChild(this._styleElement); | ||
this.appendChild(this._styleElement); | ||
// Ensure there is a child text node in the style element | ||
@@ -266,3 +265,2 @@ this._styleElement.textContent = ' '; | ||
this.addEventListener('iron-resize', this._selectResponsiveStep); | ||
this.addEventListener('animationend', this.__onAnimationEnd); | ||
@@ -275,4 +273,4 @@ } | ||
beforeNextRender(this, this._selectResponsiveStep); | ||
beforeNextRender(this, this.updateStyles); | ||
requestAnimationFrame(() => this._selectResponsiveStep()); | ||
requestAnimationFrame(() => this._updateLayout()); | ||
@@ -301,3 +299,3 @@ this._observeChildrenColspanChange(); | ||
) { | ||
this.updateStyles(); | ||
this._updateLayout(); | ||
} | ||
@@ -316,3 +314,3 @@ }); | ||
if (addedNodes.length > 0 || removedNodes.length > 0) { | ||
this.updateStyles(); | ||
this._updateLayout(); | ||
} | ||
@@ -443,4 +441,4 @@ }); | ||
/** @private */ | ||
_invokeUpdateStyles() { | ||
this.updateStyles(); | ||
_invokeUpdateLayout() { | ||
this._updateLayout(); | ||
} | ||
@@ -450,8 +448,23 @@ | ||
* Set custom CSS property values and update the layout. | ||
* @param {Object<string, string>=} properties | ||
* | ||
* @deprecated Since Vaadin 23, `updateStyles()` is deprecated. | ||
* Use the native element.style.setProperty API to set custom CSS property values. | ||
*/ | ||
updateStyles(properties = {}) { | ||
console.warn( | ||
`WARNING: Since Vaadin 23, updateStyles() is deprecated. Use the native element.style.setProperty API to set custom CSS property values.` | ||
); | ||
Object.entries(properties).forEach(([key, value]) => { | ||
this.style.setProperty(key, value); | ||
}); | ||
this._updateLayout(); | ||
} | ||
/** | ||
* Update the layout. | ||
* @protected | ||
*/ | ||
updateStyles(properties) { | ||
super.updateStyles(properties); | ||
_updateLayout() { | ||
/* | ||
@@ -537,2 +550,10 @@ The item width formula: | ||
} | ||
/** | ||
* @protected | ||
* @override | ||
*/ | ||
_onResize() { | ||
this._selectResponsiveStep(); | ||
} | ||
} | ||
@@ -539,0 +560,0 @@ |
52880
5
1135
+ Added@vaadin/component-base@23.0.0-alpha3(transitive)
+ Added@vaadin/icon@23.0.0-alpha3(transitive)
+ Added@vaadin/vaadin-lumo-styles@23.0.0-alpha3(transitive)
+ Added@vaadin/vaadin-material-styles@23.0.0-alpha3(transitive)
+ Added@vaadin/vaadin-themable-mixin@23.0.0-alpha3(transitive)
- Removed@polymer/iron-resizable-behavior@3.0.1(transitive)
- Removed@vaadin/component-base@23.0.0-alpha2(transitive)
- Removed@vaadin/icon@23.0.0-alpha2(transitive)
- Removed@vaadin/vaadin-lumo-styles@23.0.0-alpha2(transitive)
- Removed@vaadin/vaadin-material-styles@23.0.0-alpha2(transitive)
- Removed@vaadin/vaadin-themable-mixin@23.0.0-alpha2(transitive)