From a5b3b5b68ba5f66e96147e60851cd7229c8e95af Mon Sep 17 00:00:00 2001 From: Kai Arrowood Date: Fri, 15 Jul 2022 11:07:08 -0400 Subject: [PATCH] feat(kselect): misc fixes [khcp-4146] (#692) - Fix `width` prop handling to ensure selected item, input, and dropdown are the same size - Add support for `%` for `width` props - Add `enableFilter` prop to control filter support on `KSelect` input --- docs/components/menu.md | 16 ++-- docs/components/popover.md | 2 +- docs/components/select.md | 75 ++++++++++++++++--- .../__snapshots__/KCatalog.spec.js.snap | 18 ++--- packages/KMenu/KMenu.vue | 23 +++--- .../__snapshots__/KPagination.spec.js.snap | 4 +- packages/KPop/KPop.vue | 11 ++- packages/KSelect/KSelect.spec.js | 6 +- packages/KSelect/KSelect.vue | 57 +++++++++++--- .../__snapshots__/KSelect.spec.js.snap | 6 +- .../KTable/__snapshots__/KTable.spec.js.snap | 6 +- packages/styles/forms/_inputs.scss | 54 ++++++++----- 12 files changed, 196 insertions(+), 82 deletions(-) diff --git a/docs/components/menu.md b/docs/components/menu.md index bad0011360..c7528249b1 100644 --- a/docs/components/menu.md +++ b/docs/components/menu.md @@ -72,12 +72,12 @@ function getMenuItems(count) { ### width -You can pass a `width` string for menu. By default the `width` is `284px`. +You can pass a `width` string for menu. Currently we support numbers (will be converted to `px`), `auto`, and percentages for width. By default the `width` is `284px`. ```vue - + ``` ## KMenuItem @@ -97,11 +97,11 @@ You can pass a `width` string for menu. By default the `width` is `284px`. ```vue ``` @@ -111,7 +111,7 @@ You can pass a `width` string for menu. By default the `width` is `284px`. - `itemBody` - the body content for the menu item ```vue - + @@ -177,9 +177,9 @@ This should be used instead of the `items` property. - - diff --git a/docs/components/popover.md b/docs/components/popover.md index 4e99275d27..331be7bcd3 100644 --- a/docs/components/popover.md +++ b/docs/components/popover.md @@ -285,7 +285,7 @@ Use fixed positioning of the popover to avoid content being clipped by parental ### width -The width of the popover body - by default it is 200px. +The width of the popover body - by default it is `200px`. Currently we support numbers (will be converted to `px`), `auto`, and percentages for width. button diff --git a/docs/components/select.md b/docs/components/select.md index 132923169e..11271f917d 100644 --- a/docs/components/select.md +++ b/docs/components/select.md @@ -255,7 +255,11 @@ export default { ### width You can pass a `width` string for dropdown. By default the `width` is `200px`. This is the width -of the input, dropdown, and selected item. +of the input, dropdown, and selected item. Currently we support numbers (will be converted to `px`), `auto`, and percentages for width. + +:::tip Note +Because we are controlling the widths of multiple elements, we recommend using this prop to control the width instead of explicitly adding classes or styles to the `KSelect` component. +:::
+ + +
+ +```html + + + +``` + ### filterFunc Use this prop to override the default filter function if you want to do something like filter on an attribute other than `label`. Your filter function @@ -347,7 +402,7 @@ You can pass any input attribute and it will get properly bound to the element. You can use the `item-template` slot to customize the look and feel of your items. Use slots to gain access to the `item` data.
- +