From 16dfd098cd34c2b1c5b6e1886c1ca44d3ba3bdec Mon Sep 17 00:00:00 2001 From: mm <25961416+mlmoravek@users.noreply.github.com> Date: Wed, 23 Oct 2024 09:43:13 +0200 Subject: [PATCH] feat(1008): unify component options/items definiton (#1065) --- .scripts/utils.mjs | 1 - packages/docs/components/Autocomplete.md | 90 +- packages/docs/components/Dropdown.md | 1 + packages/docs/components/Sidebar.md | 4 +- packages/docs/components/Steps.md | 47 +- packages/docs/components/Tabs.md | 35 +- packages/docs/components/Taginput.md | 76 +- packages/docs/docgen.config.js | 1 - .../components/autocomplete/Autocomplete.vue | 604 +++++-------- .../components/autocomplete/examples/base.vue | 3 +- .../autocomplete/examples/groups.vue | 36 +- .../autocomplete/examples/infinite-scroll.vue | 1 - .../autocomplete/examples/inspector.vue | 9 +- .../autocomplete/examples/objects-array.vue | 321 ++++--- .../src/components/autocomplete/props.ts | 131 +++ .../__snapshots__/autocomplete.test.ts.snap | 1 + .../autocomplete/tests/autocomplete.test.ts | 135 +++ .../src/components/datepicker/Datepicker.vue | 10 +- .../oruga/src/components/datepicker/props.ts | 2 +- .../__snapshots__/datepicker.test.ts.snap | 4 +- .../__snapshots__/datetimepicker.test.ts.snap | 10 +- .../src/components/dropdown/Dropdown.vue | 41 +- .../src/components/dropdown/DropdownItem.vue | 2 + .../components/dropdown/examples/index.vue | 6 + .../components/dropdown/examples/options.vue | 29 + .../oruga/src/components/dropdown/props.ts | 9 +- .../dropdown.integration.test.ts.snap | 8 +- .../tests/__snapshots__/dropdown.test.ts.snap | 1 + .../tests/dropdown.integration.test.ts | 138 ++- .../oruga/src/components/select/Select.vue | 63 +- .../src/components/select/examples/base.vue | 4 +- packages/oruga/src/components/select/index.ts | 2 +- packages/oruga/src/components/select/props.ts | 12 +- .../components/select/tests/select.test.ts | 162 +++- packages/oruga/src/components/select/types.ts | 13 - .../oruga/src/components/steps/StepItem.vue | 3 +- packages/oruga/src/components/steps/Steps.vue | 279 ++---- .../src/components/steps/examples/base.vue | 4 +- packages/oruga/src/components/steps/props.ts | 108 +++ packages/oruga/src/components/steps/types.ts | 4 +- packages/oruga/src/components/table/Table.vue | 2 +- .../oruga/src/components/tabs/TabItem.vue | 2 +- packages/oruga/src/components/tabs/Tabs.vue | 231 ++--- .../src/components/tabs/examples/sizes.vue | 70 +- packages/oruga/src/components/tabs/props.ts | 79 ++ packages/oruga/src/components/tabs/types.ts | 36 +- .../src/components/taginput/Taginput.vue | 402 +++------ .../taginput/examples/autocomplete.vue | 327 ++++--- .../taginput/examples/custom-selected.vue | 15 +- .../components/taginput/examples/disabled.vue | 2 +- .../taginput/examples/inspector.vue | 490 ++++------- .../components/taginput/examples/limits.vue | 6 +- .../components/taginput/examples/variants.vue | 12 +- .../oruga/src/components/taginput/props.ts | 125 +++ .../tests/__snapshots__/taginput.test.ts.snap | 2 + .../taginput/tests/taginput.test.ts | 135 +++ .../src/components/timepicker/Timepicker.vue | 2 +- .../__snapshots__/timepicker.test.ts.snap | 4 +- packages/oruga/src/components/types.ts | 68 +- packages/oruga/src/composables/index.ts | 1 + .../src/composables/tests/useOptions.test.ts | 805 ++++++++++++++++++ packages/oruga/src/composables/useOptions.ts | 329 +++++++ packages/oruga/src/types/config.ts | 11 + 63 files changed, 3563 insertions(+), 2003 deletions(-) create mode 100644 packages/oruga/src/components/autocomplete/props.ts create mode 100644 packages/oruga/src/components/dropdown/examples/options.vue create mode 100644 packages/oruga/src/components/steps/props.ts create mode 100644 packages/oruga/src/components/tabs/props.ts create mode 100644 packages/oruga/src/components/taginput/props.ts create mode 100644 packages/oruga/src/composables/tests/useOptions.test.ts create mode 100644 packages/oruga/src/composables/useOptions.ts diff --git a/.scripts/utils.mjs b/.scripts/utils.mjs index 1bb80c260..5e330540b 100644 --- a/.scripts/utils.mjs +++ b/.scripts/utils.mjs @@ -4,7 +4,6 @@ import path from 'path'; // Components to be ignored const IGNORE = [ - "FieldBody", "SliderThumb", "TableMobileSort", "TablePagination", diff --git a/packages/docs/components/Autocomplete.md b/packages/docs/components/Autocomplete.md index add933255..ed85e1eaa 100644 --- a/packages/docs/components/Autocomplete.md +++ b/packages/docs/components/Autocomplete.md @@ -33,53 +33,49 @@ ### Props -| Prop name | Description | Type | Values | Default | -| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| animation | Transition name to apply on dropdown list | string | - |
autocomplete: {
animation: "fade"
}
|
-| autocomplete | Native options to use in HTML5 validation | string | - | autocomplete: {
autocomplete: "off"
}
|
-| checkScroll | Makes the component check if list reached scroll start or end and emit scroll events. | boolean | - | autocomplete: {
checkScroll: false
}
|
-| clearIcon | Icon name to be added on the clear button | string | - | autocomplete: {
clearIcon: "close-circle"
}
|
-| clearOnSelect | Clear input text on select | boolean | - | autocomplete: {
clearOnSelect: false
}
|
-| clearable | Add a button/icon to clear the inputed text | boolean | - | autocomplete: {
clearable: false
}
|
-| confirmKeys | Array of keys (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) which will add a tag when typing (default tab and enter) | string[] | - | autocomplete: {
confirmKeys: ["Tab","Enter"]
}
|
-| customValidity | Custom HTML 5 validation error to set on the form control | \| string""
|
-| debounce | Number of milliseconds to delay before to emit input event | number | - | autocomplete: {
debounce: 400
}
|
-| disabled | Same as native input disabled | boolean | - | false
|
-| expanded | Makes input full width when inside a grouped or addon field | boolean | - | false
|
-| field | Property of the object (if `options` are an array of objects) to use as display text, and to keep track of selected option | string | - | |
-| filter | Function to filter the options based on the input value - default is display text comparison | (options: T[], value: string) => T[] | - | |
-| formatter | Function to format an option to a string for display it in the input (as alternative to field prop) | (value: unknown, option: T) => string | - | |
-| groupField | Property of the object (if `options` are an array of objects) to use as display text of group | string | - | |
-| groupOptions | Property of the object (if `options` are an array of objects) to use as key to get items array of each group | string | - | |
-| icon | Icon to be shown | string | - | autocomplete: {
icon: undefined
}
|
-| iconClickable | Makes the icon clickable | boolean | - | false
|
-| iconPack | Icon pack to use | string | `mdi`, `fa`, `fas and any other custom icon pack` | autocomplete: {
iconPack: undefined
}
|
-| iconRight | Icon to be added on the right side | string | - | autocomplete: {
iconRight: undefined
}
|
-| iconRightClickable | Make the icon right clickable | boolean | - | false
|
-| iconRightVariant | Variant of right icon | string | - | |
-| input | The value of the inner input, use v-model:input to make it two-way binding | string | - | ""
|
-| itemTag | Menu item tag name | DynamicComponent | - | autocomplete: {
itemTag: "div"
}
|
-| keepFirst | The first option will always be pre-selected (easier to just hit enter or tab) | boolean | - | autocomplete: {
keepFirst: false
}
|
-| keepOpen | Keep open dropdown list after select | boolean | - | autocomplete: {
keepOpen: false
}
|
-| maxHeight | Max height of dropdown content | string\|number | - | autocomplete: {
maxHeight: undefined
}
|
-| maxlength | Same as native maxlength, plus character counter | string\|number | - | |
-| menuTag | Menu tag name | DynamicComponent | - | autocomplete: {
menuTag: "div"
}
|
-| mobileModal | Dropdown content (items) are shown into a modal on mobile | boolean | - | autocomplete: {
mobileModal: false
}
|
-| v-model | The selected option, use v-model to make it two-way binding | T | - | |
-| openOnFocus | Open dropdown list on focus | boolean | - | autocomplete: {
openOnFocus: false
}
|
-| options | Options / suggestions | string[]\|object[] | - | Default function (see source code) |
-| override | Override existing theme classes completely | boolean | - | |
-| placeholder | Input placeholder | string | - | |
-| position | Position of the dropdown | string | `auto`, `top`, `bottom` | autocomplete: {
position: "auto"
}
|
-| rounded | Makes the element rounded | boolean | - | false
|
-| selectOnClickOutside | Trigger the select event for the first pre-selected option when clicking outside and `keep-first` is enabled | boolean | - | false
|
-| selectableFooter | Allows the footer in the autocomplete to be selectable | boolean | - | false
|
-| selectableHeader | Allows the header in the autocomplete to be selectable | boolean | - | false
|
-| size | Size of the control | string | `small`, `medium`, `large` | autocomplete: {
size: undefined
}
|
-| statusIcon | Show status icon using field and variant prop | boolean | - | {
statusIcon: true
}
|
-| teleport | Append the component to another part of the DOM.autocomplete: {
teleport: false
}
|
-| type | Input type | string | - | "text"
|
-| useHtml5Validation | Enable HTML 5 native validation | boolean | - | {
useHtml5Validation: true
}
|
+| Prop name | Description | Type | Values | Default |
+| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| animation | Transition name to apply on dropdown list | string | - | autocomplete: {
animation: "fade"
}
|
+| autocomplete | Native options to use in HTML5 validation | string | - | autocomplete: {
autocomplete: "off"
}
|
+| checkScroll | Makes the component check if list reached scroll start or end and emit scroll events. | boolean | - | autocomplete: {
checkScroll: false
}
|
+| clearIcon | Icon name to be added on the clear button | string | - | autocomplete: {
clearIcon: "close-circle"
}
|
+| clearOnSelect | Clear input text on select | boolean | - | autocomplete: {
clearOnSelect: false
}
|
+| clearable | Add a button/icon to clear the inputed text | boolean | - | autocomplete: {
clearable: false
}
|
+| confirmKeys | Array of keys (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) which will add a tag when typing (default tab and enter) | string[] | - | autocomplete: {
confirmKeys: ["Tab","Enter"]
}
|
+| customValidity | Custom HTML 5 validation error to set on the form control | string \| ((currentValue: string \| number \| object, state: ValidityState) => string) | - | |
+| debounce | Number of milliseconds to delay before to emit input event | number | - | autocomplete: {
debounce: 400
}
|
+| disabled | Same as native input disabled | boolean | - | false
|
+| expanded | Makes input full width when inside a grouped or addon field | boolean | - | false
|
+| filter | Function to filter the options based on the input value - default is label string comparison | (options: string \| number \| object, value: string) => boolean | - | |
+| icon | Icon to be shown | string | - | autocomplete: {
icon: undefined
}
|
+| iconClickable | Makes the icon clickable | boolean | - | false
|
+| iconPack | Icon pack to use | string | `mdi`, `fa`, `fas and any other custom icon pack` | autocomplete: {
iconPack: undefined
}
|
+| iconRight | Icon to be added on the right side | string | - | autocomplete: {
iconRight: undefined
}
|
+| iconRightClickable | Make the icon right clickable | boolean | - | false
|
+| iconRightVariant | Variant of right icon | string | - | |
+| input | The value of the inner input, use v-model:input to make it two-way binding | string | - | ""
|
+| itemTag | Menu item tag name | DynamicComponent | - | autocomplete: {
itemTag: "div"
}
|
+| keepFirst | The first option will always be pre-selected (easier to just hit enter or tab) | boolean | - | autocomplete: {
keepFirst: false
}
|
+| keepOpen | Keep open dropdown list after select | boolean | - | autocomplete: {
keepOpen: false
}
|
+| maxHeight | Max height of dropdown content | string \| number | - | autocomplete: {
maxHeight: undefined
}
|
+| maxlength | Same as native maxlength, plus character counter | string \| number | - | |
+| menuTag | Menu tag name | DynamicComponent | - | autocomplete: {
menuTag: "div"
}
|
+| mobileModal | Dropdown content (items) are shown into a modal on mobile | boolean | - | autocomplete: {
mobileModal: false
}
|
+| v-model | The selected option value, use v-model to make it two-way binding | string \| number \| object | - | |
+| openOnFocus | Open dropdown list on focus | boolean | - | autocomplete: {
openOnFocus: false
}
|
+| options | Autocomplete options | string[]\|object[] | - | |
+| override | Override existing theme classes completely | boolean | - | |
+| placeholder | Input placeholder | string | - | |
+| position | Position of the dropdown | "auto" \| "top" \| "bottom" | `auto`, `top`, `bottom` | autocomplete: {
position: "auto"
}
|
+| rounded | Makes the element rounded | boolean | - | false
|
+| selectOnClickOutside | Trigger the select event for the first pre-selected option when clicking outside and `keep-first` is enabled | boolean | - | false
|
+| selectableFooter | Allows the footer in the autocomplete to be selectable | boolean | - | false
|
+| selectableHeader | Allows the header in the autocomplete to be selectable | boolean | - | false
|
+| size | Size of the control | string | `small`, `medium`, `large` | autocomplete: {
size: undefined
}
|
+| statusIcon | Show status icon using field and variant prop | boolean | - | {
statusIcon: true
}
|
+| teleport | Append the component to another part of the DOM.autocomplete: {
teleport: false
}
|
+| type | Input type | string | - | "text"
|
+| useHtml5Validation | Enable HTML 5 native validation | boolean | - | {
useHtml5Validation: true
}
|
### Events
diff --git a/packages/docs/components/Dropdown.md b/packages/docs/components/Dropdown.md
index 265feb387..bc23057ff 100644
--- a/packages/docs/components/Dropdown.md
+++ b/packages/docs/components/Dropdown.md
@@ -57,6 +57,7 @@ sidebarDepth: 2
| mobileBreakpoint | | | - | dropdown: {
mobileBreakpoint: undefined
}
|
| mobileModal | | | - | dropdown: {
mobileModal: true
}
|
| v-model | | | - | |
+| options | | | - | |
| override | | | - | |
| position | | | - | dropdown: {
position: "bottom-left"
}
|
| scrollable | | | - | false
|
diff --git a/packages/docs/components/Sidebar.md b/packages/docs/components/Sidebar.md
index c1e9b9087..e5fa314bd 100644
--- a/packages/docs/components/Sidebar.md
+++ b/packages/docs/components/Sidebar.md
@@ -45,11 +45,11 @@
| fullheight | Show sidebar in fullheight | boolean | - | sidebar: {
fullheight: false
}
|
| fullwidth | Show sidebar in fullwidth | boolean | - | sidebar: {
fullwidth: false
}
|
| inline | Display the Sidebear inline | boolean | - | false
|
-| mobile | Custom layout on mobile | "fullwidth" \| "reduced" \| "hidden" | `fullwidth`, `reduced`, `hidden` | sidebar: {
mobile: undefined
}
|
+| mobile | Custom layout on mobile | "hidden" \| "fullwidth" \| "reduced" | `fullwidth`, `reduced`, `hidden` | sidebar: {
mobile: undefined
}
|
| mobileBreakpoint | Mobile breakpoint as `max-width` value | string | - | sidebar: {
mobileBreakpoint: undefined
}
|
| overlay | Show an overlay like modal | boolean | - | sidebar: {
overlay: false
}
|
| override | Override existing theme classes completely | boolean | - | |
-| position | Sidebar position | "bottom" \| "top" \| "left" \| "right" | `top`, `right`, `bottom`, `left` | sidebar: {
position: "left"
}
|
+| position | Sidebar position | "top" \| "bottom" \| "left" \| "right" | `top`, `right`, `bottom`, `left` | sidebar: {
position: "left"
}
|
| props | Props to be binded to the injected component. | Record<string, any> | - | |
| reduce | Show a small sidebar | boolean | - | sidebar: {
reduce: false
}
|
| scroll | Use `clip` to remove the body scrollbar, `keep` to have a non scrollable scrollbar to avoid shifting background,sidebar: {
scroll: "clip"
}
|
diff --git a/packages/docs/components/Steps.md b/packages/docs/components/Steps.md
index 48c2a3cd1..7fecc7d79 100644
--- a/packages/docs/components/Steps.md
+++ b/packages/docs/components/Steps.md
@@ -37,27 +37,28 @@ sidebarDepth: 2
### Props
-| Prop name | Description | Type | Values | Default |
-| ----------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| animateInitially | Apply animation on the initial render | boolean | - | steps: {
animateInitially: false
}
|
-| animated | Step navigation is animated | boolean | - | steps: {
animated: true
}
|
-| animation | Transition animation name | string[] | `[next`, `prev]`, `[right`, `left`, `down`, `up]` | steps: {
animation: [ "slide-next", "slide-prev", "slide-down", "slide-up",]
}
|
-| ariaNextLabel | Accessibility next button aria label | string | - | steps: {
ariaNextLabel: undefined
}
|
-| ariaPreviousLabel | Accessibility previous button aria label | string | - | steps: {
ariaPreviousLabel: undefined
}
|
-| destroyOnHide | Destroy stepItem on hide | boolean | - | false
|
-| hasNavigation | Next and previous buttons below the component. You can use this property if you want to use your own custom navigation items. | boolean | - | true
|
-| iconNext | Icon to use for navigation button | string | - | steps: {
iconNext: "chevron-right"
}
|
-| iconPack | Icon pack to use for the navigation | string | `mdi`, `fa`, `fas and any other custom icon pack` | steps: {
iconPack: undefined
}
|
-| iconPrev | Icon to use for navigation button | string | - | steps: {
iconPrev: "chevron-left"
}
|
-| labelPosition | Position of the marker label | string | `bottom`, `right`, `left` | steps: {
labelPosition: "bottom"
}
|
-| mobileBreakpoint | Mobile breakpoint as `max-width` value | string | - | steps: {
mobileBreakpoint: undefined
}
|
-| v-model | The selected item value | string\|number\|object | - | |
-| override | Override existing theme classes completely | boolean | - | |
-| position | Position of the step | string | `left`, `centered`, `right` | |
-| rounded | Rounded step markers | boolean | - | true
|
-| size | Step size | string | `small`, `medium`, `large` | steps: {
size: undefined
}
|
-| variant | Color of the control | string | `primary`, `info`, `success`, `warning`, `danger`, `and any other custom color` | steps: {
variant: undefined
}
|
-| vertical | Show step in vertical layout | boolean | - | false
|
+| Prop name | Description | Type | Values | Default |
+| ----------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| animateInitially | Apply animation on the initial render | boolean | - | steps: {
animateInitially: false
}
|
+| animated | Step navigation is animated | boolean | - | steps: {
animated: true
}
|
+| animation | Transition animation name | [string, string] \| [string, string, string, string] | `[next`, `prev]`, `[right`, `left`, `down`, `up]` | steps: {
animation: [ "slide-next", "slide-prev", "slide-down", "slide-up",]
}
|
+| ariaNextLabel | Accessibility next button aria label | string | - | steps: {
ariaNextLabel: undefined
}
|
+| ariaPreviousLabel | Accessibility previous button aria label | string | - | steps: {
ariaPreviousLabel: undefined
}
|
+| destroyOnHide | Destroy stepItem on hide | boolean | - | false
|
+| hasNavigation | Next and previous buttons below the component. You can use this property if you want to use your own custom navigation items. | boolean | - | true
|
+| iconNext | Icon to use for navigation button | string | - | steps: {
iconNext: "chevron-right"
}
|
+| iconPack | Icon pack to use for the navigation | string | `mdi`, `fa`, `fas and any other custom icon pack` | steps: {
iconPack: undefined
}
|
+| iconPrev | Icon to use for navigation button | string | - | steps: {
iconPrev: "chevron-left"
}
|
+| labelPosition | Position of the marker label | "bottom" \| "left" \| "right" | `bottom`, `right`, `left` | steps: {
labelPosition: "bottom"
}
|
+| mobileBreakpoint | Mobile breakpoint as `max-width` value | string | - | steps: {
mobileBreakpoint: undefined
}
|
+| v-model | The selected item value | string\|number\|object | - | |
+| options | Steps options, unnecessary when default slot is used | OptionsProp<string \| number \| object> | - | |
+| override | Override existing theme classes completely | boolean | - | |
+| position | Position of the step | "left" \| "right" \| "centered" | `left`, `centered`, `right` | |
+| rounded | Rounded step markers | boolean | - | true
|
+| size | Step size | string | `small`, `medium`, `large` | steps: {
size: undefined
}
|
+| variant | Color of the control | string | `primary`, `info`, `success`, `warning`, `danger`, `and any other custom color` | steps: {
variant: undefined
}
|
+| vertical | Show step in vertical layout | boolean | - | false
|
### Events
@@ -89,10 +90,14 @@ sidebarDepth: 2
| --------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| ariaRole | Role attribute to be passed to the div wrapper for better accessibility | string | - | steps: {
ariaRole: "tab"
}
|
| clickable | Item can be used directly to navigate.{}
|
| icon | Icon on the left | string | - | steps: {
icon: undefined
}
|
| iconPack | Icon pack | string | - | steps: {
iconPack: undefined
}
|
| label | Item label | string | - | |
| override | Override existing theme classes completely | boolean | - | |
+| props | Props to be binded to the injected component | object | - | {}
|
| step | Step marker content (when there is no icon) | string\|number | - | |
| tag | Step item tag name | DynamicComponent | - | steps: {
itemTag: "button"
}
|
| value | Item value (it will be used as v-model of wrapper component) - default is an uuid | string\|number\|object | - | Default function (see source code) |
diff --git a/packages/docs/components/Tabs.md b/packages/docs/components/Tabs.md
index 737fdba1c..5bc9f95dc 100644
--- a/packages/docs/components/Tabs.md
+++ b/packages/docs/components/Tabs.md
@@ -37,21 +37,22 @@ sidebarDepth: 2
### Props
-| Prop name | Description | Type | Values | Default |
-| ---------------- | ----------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| animateInitially | Apply animation on the initial render | boolean | - | tabs: {
animateInitially: false
}
|
-| animated | Tab will have an animation | boolean | - | tabs: {
animated: true
}
|
-| animation | Transition animation name | string[] | `[next`, `prev]`, `[right`, `left`, `down`, `up]` | tabs: {
animation: [ "slide-next", "slide-prev", "slide-down", "slide-up",]
}
|
-| destroyOnHide | Destroy tabItem on hide | boolean | - | false
|
-| expanded | Tabs will be expanded (full-width) | boolean | - | false
|
-| v-model | The selected item value | string\|number\|object | - | 0
|
-| multiline | Show tab items multiline when there is no space | boolean | - | false
|
-| override | Override existing theme classes completely | boolean | - | |
-| position | Position of the tabs | string | `left`, `centered`, `right` | |
-| size | Tab size | string | `small`, `medium`, `large` | tabs: {
size: undefined
}
|
-| type | Tab type | string | `default`, `boxed`, `toggle`, `pills` | tabs: {
type: "default"
}
|
-| variant | Color of the control | string | `primary`, `info`, `success`, `warning`, `danger`, `and any other custom color` | tabs: {
variant: undefined
}
|
-| vertical | Show tab in vertical layout | boolean | - | tabs: {
vertical: false
}
|
+| Prop name | Description | Type | Values | Default |
+| ---------------- | --------------------------------------------------- | ---------------------------------------------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| animateInitially | Apply animation on the initial render | boolean | - | tabs: {
animateInitially: false
}
|
+| animated | Tab will have an animation | boolean | - | tabs: {
animated: true
}
|
+| animation | Transition animation name | [string, string] \| [string, string, string, string] | `[next`, `prev]`, `[right`, `left`, `down`, `up]` | tabs: {
animation: [ "slide-next", "slide-prev", "slide-down", "slide-up",]
}
|
+| destroyOnHide | Destroy tabItem on hide | boolean | - | false
|
+| expanded | Tabs will be expanded (full-width) | boolean | - | false
|
+| v-model | The selected item value | string\|number\|object | - | |
+| multiline | Show tab items multiline when there is no space | boolean | - | false
|
+| options | Tabs options, unnecessary when default slot is used | OptionsProp<string \| number \| object> | - | |
+| override | Override existing theme classes completely | boolean | - | |
+| position | Position of the tabs | "left" \| "right" \| "centered" | `left`, `centered`, `right` | |
+| size | Tab size | string | `small`, `medium`, `large` | tabs: {
size: undefined
}
|
+| type | Tab type | string | `default`, `boxed`, `toggle`, `pills` | tabs: {
type: "default"
}
|
+| variant | Color of the control | string | `primary`, `info`, `success`, `warning`, `danger`, `and any other custom color` | tabs: {
variant: undefined
}
|
+| vertical | Show tab in vertical layout | boolean | - | tabs: {
vertical: false
}
|
### Events
@@ -82,11 +83,15 @@ sidebarDepth: 2
| Prop name | Description | Type | Values | Default |
| --------- | --------------------------------------------------------------------------------- | ---------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
+| component | Component to be injected. | Component | - | |
+| content | Text content, unnecessary when default slot is used | string | - | |
| disabled | Item will be disabled | boolean | - | false
|
+| events | Events to be binded to the injected component | object | - | {}
|
| icon | Icon on the left | string | - | tabs: {
icon: undefined
}
|
| iconPack | Icon pack | string | - | tabs: {
iconPack: undefined
}
|
| label | Item label | string | - | |
| override | Override existing theme classes completely | boolean | - | |
+| props | Props to be binded to the injected component | object | - | {}
|
| tag | Tabs item tag name | DynamicComponent | - | tabs: {
itemTag: "button"
}
|
| value | Item value (it will be used as v-model of wrapper component) - default is an uuid | string\|number\|object | - | Default function (see source code) |
| visible | Show/hide item | boolean | - | true
|
diff --git a/packages/docs/components/Taginput.md b/packages/docs/components/Taginput.md
index 323be1405..ac37aae68 100644
--- a/packages/docs/components/Taginput.md
+++ b/packages/docs/components/Taginput.md
@@ -33,44 +33,41 @@
### Props
-| Prop name | Description | Type | Values | Default |
-| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| allowDuplicates | Allows adding the same item multiple time | boolean | - | taginput: {
allowDuplicates: false
}
|
-| allowNew | Allows adding new items | boolean | - | taginput: {
allowNew: false
}
|
-| ariaCloseLabel | Accessibility label for the close button | string | - | taginput: {
ariaCloseLabel: undefined
}
|
-| autocomplete | Native options to use in HTML5 validation | string | - | taginput: {
autocomplete: "off"
}
|
-| checkScroll | Makes the component check if list reached scroll start or end and emit scroll events. | boolean | - | taginput: {
checkScroll: false
}
|
-| closable | Add close/delete button to the item | boolean | - | taginput: {
closable: true
}
|
-| closeIcon | Icon name of close icon on selected item | string | - | taginput: {
closeIcon: "close"
}
|
-| confirmKeys | Array of keystaginput: {
confirmKeys: [",","Tab","Enter"]
}
|
-| counter | Show counter when maxlength or maxtags props are passed | boolean | - | taginput: {
counter: true
}
|
-| createItem | Function to create a new item to push into v-model (items) | (value: T \| string) => T | - | Default function (see source code) |
-| customValidity | Custom HTML 5 validation error to set on the form control | \| string""
|
-| disabled | Same as native input disabled | boolean | - | false
|
-| expanded | Makes input full width when inside a grouped or addon field | boolean | - | false
|
-| field | Property of the object (if data is array of objects) to use as display text | string | - | "value"
|
-| filter | Function to filter the options based on the input value - default is display text comparison | (options: T[], value: string) => T[] | - | |
-| formatter | Function to format an option to a string for display it in the input (as alternative to field prop) | (value: unknown, option: T) => string | - | |
-| groupField | Property of the object (if `data` is array of objects) to use as display text of group | string | - | |
-| groupOptions | Property of the object (if `data` is array of objects) to use as key to get items array of each group | string | - | |
-| icon | Icon to be shown | string | - | taginput: {
icon: undefined
}
|
-| iconPack | Icon pack to use | string | `mdi`, `fa`, `fas and any other custom icon pack` | taginput: {
iconPack: undefined
}
|
-| keepFirst | The first option will always be pre-selected (easier to just hit enter or tab) | boolean | - | false
|
-| keepOpen | Keep open dropdown list after select | boolean | - | taginput: {
keepOpen: false
}
|
-| maxitems | Limits the number of items, plus item counter | string\|number | - | |
-| maxlength | Same as native maxlength, plus character counter | string\|number | - | |
-| v-model | The input value state | string[]\|object[] | - | Default function (see source code) |
-| openOnFocus | Opens a dropdown with choices when the input field is focused | boolean | - | false
|
-| options | Items data | string[]\|object[] | - | Default function (see source code) |
-| override | Override existing theme classes completely | boolean | - | |
-| placeholder | Input placeholder | string | - | |
-| removeOnKeys | Allow removing last item when pressing given keystaginput: {
removeOnKeys: ["Backspace"]
}
|
-| separators | Array of chars used to split when pasting a new string | string[] | - | taginput: {
separators: [","]
}
|
-| size | Vertical size of the input control | string | `small`, `medium`, `large` | taginput: {
size: undefined
}
|
-| teleport | Append the component to another part of the DOM.taginput: {
teleport: false
}
|
-| useHtml5Validation | Enable HTML 5 native validation | boolean | - | {
useHtml5Validation: true
}
|
-| validateItem | Function to validate the value of a new item before it got added | (value: T \| string) => boolean | - | Default function (see source code) |
-| variant | Color of the each item | string | `primary`, `info`, `success`, `warning`, `danger`, `and any other custom color` | taginput: {
variant: undefined
}
|
+| Prop name | Description | Type | Values | Default |
+| ------------------ | ----------- | ---- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| allowDuplicates | | | - | taginput: {
allowDuplicates: false
}
|
+| allowNew | | | - | taginput: {
allowNew: false
}
|
+| ariaCloseLabel | | | - | taginput: {
ariaCloseLabel: undefined
}
|
+| autocomplete | | | - | taginput: {
autocomplete: "off"
}
|
+| checkScroll | | | - | taginput: {
checkScroll: false
}
|
+| closable | | | - | taginput: {
closable: true
}
|
+| closeIcon | | | - | taginput: {
closeIcon: "close"
}
|
+| confirmKeys | | | - | taginput: {
confirmKeys: [",","Tab","Enter"]
}
|
+| counter | | | - | taginput: {
counter: true
}
|
+| createItem | | | - | Default function (see source code) |
+| customValidity | | | - | |
+| disabled | | | - | false
|
+| expanded | | | - | false
|
+| filter | | | - | |
+| icon | | | - | taginput: {
icon: undefined
}
|
+| iconPack | | | - | taginput: {
iconPack: undefined
}
|
+| input | | | - | ""
|
+| keepFirst | | | - | false
|
+| keepOpen | | | - | taginput: {
keepOpen: false
}
|
+| maxitems | | | - | |
+| maxlength | | | - | |
+| v-model | | | - | |
+| openOnFocus | | | - | false
|
+| options | | | - | |
+| override | | | - | |
+| placeholder | | | - | |
+| removeOnKeys | | | - | taginput: {
removeOnKeys: ["Backspace"]
}
|
+| separators | | | - | taginput: {
separators: [","]
}
|
+| size | | | - | taginput: {
size: undefined
}
|
+| teleport | | | - | taginput: {
teleport: false
}
|
+| useHtml5Validation | | | - | {
useHtml5Validation: true
}
|
+| validateItem | | | - | Default function (see source code) |
+| variant | | | - | taginput: {
variant: undefined
}
|
### Events
@@ -81,6 +78,7 @@
| icon-click | **event** `Event` - native event | on icon click event |
| icon-right-click | **event** `Event` - native event | on icon right click event |
| update:modelValue | **value** `string[] \| object[]` - updated modelValue prop | modelValue prop two-way binding |
+| update:input | **value** `string` - updated input prop | input prop two-way binding |
| input | **value** `string` - input value | on input change event |
| add | **value** `string \| object` - added item | new item got added |
| remove | **value** `string \| object` - removed item | item got removed |
@@ -92,7 +90,7 @@
| Name | Description | Bindings |
| -------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
-| selected | Override selected items | **items** `(string, object)[]` - selected items