-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce autoResponsive mode (#8689)
This PR introduces an autoResponsive mode to FormLayout. In this mode, the component automatically creates and then dynamically adjusts columns based on the provided columnWidth, maxColumns, and the available space in the container.
- Loading branch information
Showing
21 changed files
with
718 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
packages/form-layout/test/dom/__snapshots__/form-layout.test.snap.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* @web/test-runner snapshot v1 */ | ||
export const snapshots = {}; | ||
|
||
snapshots["vaadin-form-layout auto-responsive host default"] = | ||
`<vaadin-form-layout | ||
auto-responsive="" | ||
style="--_column-width: 13em; --_max-columns: 10;" | ||
> | ||
<input placeholder="First name"> | ||
<input placeholder="Last name"> | ||
<input placeholder="Email"> | ||
<input placeholder="Phone"> | ||
</vaadin-form-layout> | ||
`; | ||
/* end snapshot vaadin-form-layout auto-responsive host default */ | ||
|
||
snapshots["vaadin-form-layout auto-responsive host autoRows"] = | ||
`<vaadin-form-layout | ||
auto-responsive="" | ||
auto-rows="" | ||
style="--_column-width: 13em; --_max-columns: 10;" | ||
> | ||
<input placeholder="First name"> | ||
<input placeholder="Last name"> | ||
<input placeholder="Email"> | ||
<input placeholder="Phone"> | ||
</vaadin-form-layout> | ||
`; | ||
/* end snapshot vaadin-form-layout auto-responsive host autoRows */ | ||
|
||
snapshots["vaadin-form-layout auto-responsive host maxColumns"] = | ||
`<vaadin-form-layout | ||
auto-responsive="" | ||
style="--_column-width: 13em; --_max-columns: 3;" | ||
> | ||
<input placeholder="First name"> | ||
<input placeholder="Last name"> | ||
<input placeholder="Email"> | ||
<input placeholder="Phone"> | ||
</vaadin-form-layout> | ||
`; | ||
/* end snapshot vaadin-form-layout auto-responsive host maxColumns */ | ||
|
||
snapshots["vaadin-form-layout auto-responsive host columnWidth"] = | ||
`<vaadin-form-layout | ||
auto-responsive="" | ||
style="--_column-width: 15em; --_max-columns: 10;" | ||
> | ||
<input placeholder="First name"> | ||
<input placeholder="Last name"> | ||
<input placeholder="Email"> | ||
<input placeholder="Phone"> | ||
</vaadin-form-layout> | ||
`; | ||
/* end snapshot vaadin-form-layout auto-responsive host columnWidth */ | ||
|
||
snapshots["vaadin-form-layout auto-responsive shadow default"] = | ||
`<div id="layout"> | ||
<slot id="slot"> | ||
</slot> | ||
</div> | ||
`; | ||
/* end snapshot vaadin-form-layout auto-responsive shadow default */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { expect } from '@vaadin/chai-plugins'; | ||
import { fixtureSync } from '@vaadin/testing-helpers'; | ||
import '../../src/vaadin-form-layout.js'; | ||
|
||
describe('vaadin-form-layout', () => { | ||
let layout; | ||
|
||
describe('auto-responsive', () => { | ||
beforeEach(() => { | ||
layout = fixtureSync(` | ||
<vaadin-form-layout auto-responsive> | ||
<input placeholder="First name" /> | ||
<input placeholder="Last name" /> | ||
<input placeholder="Email" /> | ||
<input placeholder="Phone" /> | ||
</vaadin-form-layout> | ||
`); | ||
}); | ||
|
||
describe('host', () => { | ||
it('default', async () => { | ||
await expect(layout).dom.to.equalSnapshot(); | ||
}); | ||
|
||
it('autoRows', async () => { | ||
layout.autoRows = true; | ||
await expect(layout).dom.to.equalSnapshot(); | ||
}); | ||
|
||
it('maxColumns', async () => { | ||
layout.maxColumns = 3; | ||
await expect(layout).dom.to.equalSnapshot(); | ||
}); | ||
|
||
it('columnWidth', async () => { | ||
layout.columnWidth = '15em'; | ||
await expect(layout).dom.to.equalSnapshot(); | ||
}); | ||
}); | ||
|
||
describe('shadow', () => { | ||
it('default', async () => { | ||
await expect(layout).shadowDom.to.equalSnapshot(); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.