diff --git a/one/docs/en-US/components/accordion.md b/one/docs/en-US/components/accordion.md new file mode 100644 index 0000000..267e9a2 --- /dev/null +++ b/one/docs/en-US/components/accordion.md @@ -0,0 +1,104 @@ +# Accordion + +:::tip +The `Accordion` component needs to be used by the inline [`Collapse`](./collapse) component. +::: + +## Demos + +### Size variants + +Available size variants for the [`ui`](#props-ui) prop: `s` / `m`. + +[[ demo src="/demo/accordion/size.vue" ]] + +### Style + +Use the [`ui`](#props-ui) property to apply style variants. + +[[ demo src="/demo/accordion/variant.vue" ]] + +### Multiple + +Use the [`multiple`](#props-multiple) property to allow multiple panels to be expanded at the same time. + +[[ demo src="/demo/accordion/multiple.vue" ]] + +### Icon position + +Use the [`toggle-position`](#props-toggle-position) property to set the position of the toggle icon. + +[[ demo src="/demo/accordion/position.vue" ]] + +## API + +### Props + +| Name | Type | Default | Description | +| -- | -- | -- | -- | +| ``ui`` | `string=` | - | [^ui] | +| ``multiple`` | `boolean=` | `false` | Whether to allow multiple panels to be expanded at the same time. | +| ``disabled`` | `boolean=` | `false` | Whether accordion is disabled. | +| ``expanded`` | `string | Array` | - | [^expanded] | +| ``toggle-position`` | `string` | `'start'` | [^toggle-position] | + +^^^ui +Style variants. A space-separated enum list. Only one of `simple` / `basic` / `strong` can be used. The default style will be used if not set. Only one of `bordered` / `borderless` can be used. + ++++Enum +| Value | Description | +| -- | -- | +| `simple` | Simple style. | +| `basic` | Basic style. | +| `strong` | Strong style. | +| `bordered` | Bordered style. | +| `borderless` | Borderless style. | +| `dull` | The title area does not change style in response to mouse interaction. | +| `s` | Small size style. | +| `m` | Medium size style. | ++++ +^^^ + +^^^expanded +:::badges +`.sync` +::: + +The identifier of the expanded accordion panels, corresponding to the [`name`](./collapse#props-name) properties of the inline `Collapse` components. When `multiple` is `true`, it is an array of accordion panel identifiers. +^^^ + +^^^toggle-position +The position of the toggle icon. + ++++Enum +| Value | Description | +| -- | -- | +| `start` | The toggle icon is at the start position. Default value. | +| `end` | The toggle icon is at the end position. | +| `none` | Do not show the toggle icon. | ++++ +^^^ + +### Slots + +| Name | Description | +| -- | -- | +| ``default`` | The content area, which is used to place inline `Collapse` components. | + +### Events + +| Name | Description | +| -- | -- | +| ``toggle`` | [^toggle] | + +^^^toggle +Triggered when clicking on the internal panel title to trigger expand/collapse. The callback parameters are `(expand: boolean, name: string, expanded)`. + ++++Props +| Name | Type | Description | +| -- | -- | -- | +| `expand` | `boolean` | Whether to expand the collapsible panel. | +| `name` | `string` | The name of the collapsible panel. | +| `expanded` | `string | Array` | Identifiers of all currently expanded accordion panel. | ++++ +^^^ diff --git a/one/docs/en-US/components/anchor.md b/one/docs/en-US/components/anchor.md new file mode 100644 index 0000000..31c5b07 --- /dev/null +++ b/one/docs/en-US/components/anchor.md @@ -0,0 +1,70 @@ +# Anchor + +## Demos + +### Basic anchor + +Use the [`container`](#props-container) prop to set the container where scrolling occurs. When the `Anchor` component is not in the container (i.e. it does not scroll with the container), there's no need to set the [`sticky`](#props-sticky ) prop. + +[[ demo src="/demo/anchor/normal.vue" ]] + +### Sticky anchor + +When the `Anchor` component is in the container (rolling with the container), the [`sticky`](#props-sticky) prop can be set to control the attachment of the component when it scrolls out of the container. + +[[ demo src="/demo/anchor/sticky.vue" ]] + +### Specify offset + +Use the [`target-offset`](#props-target-offset) prop to control where the anchor scrolls into the container and becomes active. + +Use the [`sticky-offset`](#props-sticky-offset) prop to control where in the container the `Anchor` starts to attach. + +[[ demo src="/demo/anchor/offset.vue" ]] + +## API + +### Props + +| Name | Types | Default | Description | +| -- | -- | -- | -- | +| ``items`` | `Array<{value, label, children}>` | `[]` | [^items] | +| ``sticky`` | `boolean=` | `false` | Whether to apply sticky effect. | +| ``container`` | `string | HTMLElement | Window=` | - | The container which the `Anchor` component attaches to and checks active state against. | +| ``target-offset`` | `string | number=` | `0` | When an anchor is at the `target-offset` position of the container, then the corresponding anchor link is active. The numeric type value is a `px` value, or a percentage string such as `'10%'` can also be used, which will be calculated based on the height of the `container`. | +| ``sticky-offset`` | `string | number=` | `0` | For a sticky `Anchor`, when the container scrolls to the `sticky-offset` position, then the `Anchor` starts to attach. Different value types have the same meaning as the [`target-offset`](#props-target-offset) prop. | + +^^^items +The datasource array. The type of each item is `{label, value, children, ...}`. + ++++Properties +| Name | Type | Description | +| -- | -- | -- | +| `label` | `string` | The descriptive labe of the item. | +| `value` | `string` | The value of the item, usually an in-page hash, such as `#button`. | +| `children` | `Array=` | The children array of the item, with the same type as the [`items`](#props-items) array item. | ++++ +^^^ + +### Slots + +| Name | Description | +| -- | -- | +| ``item`` | [^slot-item] | +| ``item-label`` | [^slot-item-label] | + +^^^slot-item +Renders each anchor link. + +Default content: anchor link. + +See the [`items`](#props-items) prop for scope properties details. +^^^ + +^^^slot-item-label +Renders the label of each anchor link. + +Default content: the `label` of the anchor link. + +See the [`items`](#props-items) prop for scope properties details. +^^^ diff --git a/one/docs/en-US/components/autocomplete.md b/one/docs/en-US/components/autocomplete.md new file mode 100644 index 0000000..2aca6a9 --- /dev/null +++ b/one/docs/en-US/components/autocomplete.md @@ -0,0 +1,138 @@ +# Autocomplete + +## Demos + +### Basic Trigger + +Set [`suggest-trigger`](#props-suggest-trigger) specify trigger suggestions. + +[[ demo src="/demo/autocomplete/normal.vue" ]] + +### Strict + +Set [`strict`](#props-strict) property to strict mode. If the input value does not exactly match the recommended value, the input value will be cleared when the focus is out of focus. + +[[ demo src="/demo/autocomplete/strict.vue" ]] + +### Custom Search + +Set [`match`](#props-match) property to customize the highlighting logic; Set [`filter`](#props-filter) property to customize the search hit logic. + +:::tip +`match` is used to highlight the logic of matching text; while `filter` is to control whether it is hit or not. By default, `filter` will filter out nodes are not matched by `match`, and will include non-leaf nodes. If you want all leaf nodes in the search results, you can filter out non-leaf nodes by rewriting `filter`. +::: + +[[ demo src="/demo/autocomplete/custom.vue" ]] + +## API + +### Props + +| Name | Type | Default | Description | +| -- | -- | -- | -- | +| ``datasource`` | `Array=` | `[]` | [^datasource] | +| ``value`` | `*` | - | [^prop-value] | +| ``disabled`` | `boolean=` | `false` | Whether disabled state. | +| ``readonly`` | `boolean=` | `false` | Whether read only status. | +| ``match`` | `(item, keyword, { ancestors }) => boolean | [number, number] | Array<[number, number]>` | - | Supports custom highlighting logic, and matches case-insensitive substrings by default. | +| ``filter`` | `(item, keyword, { ancestors, offsets }) => boolean` | - | Support custom search hit logic. | +| ``suggest-trigger`` | `string | Array=` | `'input'` | Trigger the suggestion drop-down panel, the available values are: `'input'`, `'focus'`. | +| ``expanded`` | `boolean=` | `false` | [^expanded] | +| ``placeholder`` | `string=` | - | Placeholder. | +| ``clearable`` | `boolean=` | `false` | Whether clear button is displayed. | +| ``composition`` | `boolean=` | `false` | Whether perceive value of input method input process. | +| ``select-on-focus`` | `boolean=` | `false` | Whether to automatically select the input box text when focused. | +| ``maxlength`` | `number=` | - | The length of the input string is limited. | +| ``strict`` | `boolean=` | `false` | Maximum input length. | +| ``get-length`` | `function(string): number=` | Customize character length calculation function. | +| ``trim`` | `boolean | string=` | `false` | [^trim] | +| ``autofocus`` | `boolean=` | `false` | Focus automatically. | + +^^^datasource +Data source array, item is `Object`, field is `{label, value, children, ...}`. + ++++Field +| Name | Type | Description | +| -- | -- | -- | +| `label` | `string` | Text description of the node. | +| `value` | `string` | Value corresponding to the node is generally an in-page hash, such as `#button`. | +| `children` | `Array=` | Child node array of the node, Array item type is the same as the [`items`](#props-items) array item. | ++++ +^^^ + +^^^prop-value +:::badges +`v-model` +::: + +Selected value. +^^^ + +^^^expanded +:::badges +`.sync` +::: + +Whether the panel should be expanded (if there is no option in `suggestions`, panel will be closed even if it is `true`). +^^^ + +^^^trim +Remove before and after spaces. When it is `true`, the before and after spaces will be removed; when it is `false`, the before and after spaces will not be removed. When it is set to a string, it will be removed in the specified way. + ++++Enum +| Value | Description | +| -- | -- | +| `both` | Remove spaces at both ends. Equivalent to the behavior when `true`. | +| `start` | Remove front space. | +| `end` | Remove end spaces. | ++++ +^^^ + +### Slots + +| Name | Description | +| -- | -- | +| ``suggestions`` | [^slot-suggestions] | +| ``option-label`` | [^slot-option-label] | + +^^^slot-suggestions + +Pull down to suggest the panel slot. + ++++Scopes +| Name | Type | Description | +| -- | -- | -- | +| `datasource` | `Array` | data source, type is the same as the [`datasource`](#props-datasource) property. | +| `keyword` | `string` | Search keyword. | ++++ +^^^ + +^^^slot-option-label + +Option slot in the drop down panel. + ++++Scopes +| Name | Type | Description | +| -- | -- | -- | +| `label` | `string` | Node copy used to display, if doesn't exist, it will take `value`. | +| `value` | `string` | Actually select the value. | +| `matches` | `Array<{text: string, matched: boolean}>` | Case of matching, a node may be divided into multiple texts, `text` indicates the text, and `matched` indicates whether the text matches. | ++++ +^^^ + +### Events + +| Name | Description | +| -- | -- | +| ``input`` | [^event-input] | +| ``select`` | Triggered when suggestion is adopted, the parameter is current value. | +| ``toggle`` | Triggered when expanded state of prompt panel is switched, callback parameter is `(expanded: boolean)`. `expanded` indicates whether operation will trigger prompt panel to expand or collapse. | +| ``clear`` | Triggers when current value is cleared. | + +^^^event-input +:::badges +`v-model` +::: + +Event will be triggered when inputting in `input` or selecting a value in drop down panel. Parameter is current input value or the `value` of selected item when selected. +^^^ diff --git a/one/docs/en-US/components/badge.md b/one/docs/en-US/components/badge.md new file mode 100644 index 0000000..0f9a5ee --- /dev/null +++ b/one/docs/en-US/components/badge.md @@ -0,0 +1,58 @@ +# Badge + +## Demos + +### Text badge + +Badge content can be text. + +[[ demo src="/demo/badge/text.vue" ]] + +### Numeric badge + +The content can also be a number and can be can be displayed as “max+” when exceeding the maximum value. + +[[ demo src="/demo/badge/number.vue" ]] + +### Corner badge + +When no badge content is provided, the badge will be displayed in the upper right corner in a dot style. + +[[ demo src="/demo/badge/corner-dot.vue" ]] + +### Dot badge + +When no slot content is provided, the badge will be displayed in a dot style. + +[[ demo src="/demo/badge/dot.vue" ]] + +## API + +### Props + +| Name | Type | Default | Description | +| -- | -- | -- | -- | +| ``type`` | `string=` | `'error'` | [^type] | +| ``value`` | `string | number` | - | The badge content value. When it is of type `number`, it is limited by the [`max`](#props-max) prop. `max` is ignored when it is of type `string`. | +| ``max`` | `number=` | `badge.max` | The maximum value of the badge, when `value` exceeds this value, the badge content will be displayed as “max+”. Ignored when `value` is `string`. | +| ``hidden`` | `boolean=` | `false` | Whether the badge is hidden. | + +^^^type +The status type of the badge. The optional values for built-in styles are as follows. When using other values, you need to define the styles for `.veui-badge-{type}`. + ++++Enum +| Value | Description | +| -- | -- | +| `info` | Info style. | +| `success` | Success style. | +| `warning` | Warning style. | +| `error` | Error style. | +| `aux` | Aux style. | ++++ +^^^ + +### Slots + +| Name | Description | +| -- | -- | +| ``default`` | The target content that the badge needs to display upon. | diff --git a/one/docs/en-US/components/cascader.md b/one/docs/en-US/components/cascader.md new file mode 100644 index 0000000..1a2d5d6 --- /dev/null +++ b/one/docs/en-US/components/cascader.md @@ -0,0 +1,299 @@ +# Cascader + +## Demos + +### Size variants + +Available size variants for the ui prop:`xs` / `s` / `m` / `l`. + +[[ demo src="/demo/cascader/size.vue" ]] + +### Inline cascader + +Use the [`inline`](#props-inline) prop to enable inline mode. + +[[ demo src="/demo/cascader/inline.vue" ]] + +### Searchable options + +Use the [`searchable`](#props-searchable) prop to enable option searching. + +[[ demo src="/demo/cascader/searchable.vue" ]] + +### Multiple selections + +Use the [`multiple`](#props-multiple) prop to enable multiple selections. + +[[ demo src="/demo/cascader/multiple.vue" ]] + +### Select mode + +Use the [`column-trigger`](#props-column-trigger) prop to control when the option groups are expanded. + +[[ demo src="/demo/cascader/select-mode.vue" ]] + +### Column trigger + +Use the [`column-trigger`](#props-column-trigger) prop to control when the subordinates in the dropdown panel are expanded. + +[[ demo src="/demo/cascader/column-trigger.vue" ]] + +### Displaying values + +Use the [`value-display`](#props-value-display) prop to control how the selected value is displayed. + +[[ demo src="/demo/cascader/value-display.vue" ]] + +## API + +### Props + +| Name | Type | Default | Description | +| -- | -- | -- | -- | +| ``ui`` | `string=` | - | [^ui] | +| ``options`` | `Array` | - | [^options] | +| ``value`` | `Array<*>|*` | - | [^value] | +| ``multiple`` | `boolean` | `false` | Whether to allow multiple selections. | +| ``inline`` | `boolean` | `false` | Whether the dropdown panel is displayed in inline mode (expanding options will split the panel instead of expanding it outwards). | +| ``max`` | `number` | - | The maximum number of selectable options when performing multiple selections. | +| ``placeholder`` | `string` | `cascader.placeholder` | `cascader.placeholder` | Placeholder text when no option is selected. | +| ``clearable`` | `boolean` | `false` | Whether the cascader is clearable. | +| ``searchable`` | `boolean` | `false` | Whether the cascader is searchable. | +| ``expanded`` | `boolean=` | `false` | [^expanded] | +| ``column-trigger`` | `'hover' | 'click'` | `'click'` | [^column-trigger] | +| ``select-mode`` | `'leaf-only' | 'any'` | `'any'` | [^select-mode] | +| ``column-width`` | `number | string` | - | [^column-width] | +| ``show-select-all`` | `boolean` | `false` | In multiple selection mode is there a select all button. | +| ``value-display`` | `'complete' | 'simple'` | `'simple'` | [^value-display] | +| ``disabled`` | `boolean=` | `false` | Whether the cascader is disabled. | +| ``readonly`` | `boolean=` | `false` | Whether the cascader is read-only. | +| ``overlay-class`` | `string | Array | Object=` | - | See the [`overlay-class`](./overlay#props-overlay-class) prop of the [`Overlay`](./overlay) component. | +| ``overlay-style`` | `string | Array | Object=` | - | See the [`overlay-style`](./overlay#props-overlay-style) prop of the [`Overlay`](./overlay) component. | +| ``match`` | `(item, keyword, { ancestors }) => boolean | Array<[number, number]>` | - | To customize highlighting logic. Case insensitive by default, see [`Autocomplete`](./Autocomplete#custom-search). | +| ``filter`` | `(item, keyword, { ancestors, offsets }) => boolean` | - | To customize search hit logic, see [`Autocomplete`](./Autocomplete#custom-search). | + +^^^ui +Style variants. + ++++Enum +| Value | Description | +| -- | -- | +| `xs` | Extra small size. | +| `s` | Small size. | +| `m` | Medium size. | +| `l` | Large size. | ++++ +^^^ + +^^^options +The list of options with items of type `{label, value, options, disabled, position, ...}`. + ++++Properties +| Name | Type | Description | +| -- | -- | -- | +| `label` | `string` | The descriptive label of the option. | +| `value` | `*` | The value of the option. | +| `position` | `string` | How to display subordinate nodes, pop up by default, set `inline` to display inline. | +| `options` | `Array=` | An array of options' sub-options, the array item type is the same as the [`options`](#props-options) prop array item. | +| `disabled` | `boolean=` | Whether the option is disabled. | ++++ +^^^ + +^^^value +:::badges +`v-model` +::: + +The selected value / values. +^^^ + +^^^expanded +:::badges +`.sync` +::: + +Whether the dropdown menu is expanded. +^^^ + +^^^column-trigger +The timing of expanding sub-options in the dropdown panel. + ++++Enum +| Value | Description | +| -- | -- | +| `hover` | Expand on hover. | +| `click` | Expand on click.| ++++ +^^^ + +^^^select-mode +Controls which items can be selected in single-select mode. + ++++Enum +| Value | Description | +| -- | -- | +| `leaf-only` | Only leaf options can be selected. | +| `any` | Any option can be selected. | ++++ +^^^ + +^^^column-width +When there are multiple columns in the dropdown panel, uniformly control the width of the columns except the last one. + +When the value is a numeric value or can be converted to a numeric value, it is treated as a pixel value. +^^^ + +^^^value-display +Controls how the selected value is displayed. + ++++Enum +| Value | Description | +| -- | -- | +| `complete` | Displays a path that fully displays the selected value, such as “China > Shanghai”. | +| `simple` | Only displays the label of the selected value. | ++++ +^^^ + +### Slots + +| Name | Description | +| -- | -- | +| ``trigger`` | [^slot-trigger] | +| ``pane`` | The content of the dropdown panel. Shares the same slot props with the [`trigger`](#slots-trigger) slot. | +| ``before`` | The content before the list of options. No default content. Shares the same slot props with the [`trigger`](#slots-trigger) slot. | +| ``after`` | The content after the option list. No default content. Shares the same slot props with the [`trigger`](#slots-trigger) slot. | +| ``column-before`` | [^slot-column-before] | +| ``column-after`` | The area after each column in the dropdown panel. No default content. Shares the same slot props with the [`before`](#slots-before) slot. | +| ``label`` | [^slot-label] | +| ``option-label`` | [^slot-option-label] | +| ``option`` | [^slot-option] | +| ``selected`` | [^slot-selected] | + +^^^slot-trigger +The entire dropdown trigger area. + +Default content: the dropdown button. + ++++Slot props +| Name | Type | Description | +| -- | -- | -- | +| `value` | `*` | The selected value. | +| `selected` | `Object` | The selected option object. | +| `expanded` | `boolean` | Whether the dropdown panel is expanded. | +| `keyword` | `string` | The search keyword. | +| `select` | `function(option: Object): void` | Selects the specified option. | +| `toggle` | `function(force: boolean): void` | Toggles the expanded state of the dropddown menu. | +| `clear` | `function(): void` | Clears selected options. | +| `remove` | `function(option: Object): void` | Removes the specified option from seletions. | +| `updateKeyword` | `function(keyword: string): void` | Use to modify selected value. | ++++ +^^^ + +^^^slot-column-before +The area in front of each column in the drop-down panel. No default content. + ++++Slot props +| Name | Type | Description | +| -- | -- | -- | +| `option` | `Object` | The parent option of the column, where the `options` property gets the data of the current column. | ++++ +^^^ + +^^^slot-label +The label of the dropdown button. + +Displays the label of selected option or the text content of the selected embedded option by default. + ++++Slot props +| Name | Type | Description | +| -- | -- | -- | +| `label` | `string` | The descriptive label of the selected option. | +| `value` | `*` | The value of the selected option. | +| `checked` | `boolean` | Whether the cascader has a selected value. | +| `disabled` | `boolean=` | Whether the option is disabled. | ++++ + +Additionally, custom properties apart from the listed ones will also be passed into the slot props object via `v-bind`. +^^^ + + +^^^slot-option-label + +The label text of each option (option without `options` property). Displays the label of the option by default. + +Default content: The value of the option `label` prop. + ++++Slot props +| Name | Type | Description | +| -- | -- | -- | +| `option` | `Object` | The descriptive label of the option. | +| `select` | `function(option: Object): void` | Selects the current option. | +| `expand` | `function(option: Object): void` | Expands the current option. | +| `click` | `function(option: Object): void` | Clicks the content of the current option, will select/expand the current option as appropriate. | ++++ +^^^ + +^^^slot-option +The entire area of the option. + +Default content: default content of the internal `Option` component. + +Shares the same slot props with the [`option-label`](#slots-option-label) slot. +^^^ + +^^^slot-selected +The area that displays the selected value. + +Default content: the label of selected option for single selection, the tags of each selected option for multiple selection. + ++++Slot props (single selection) +| Name | Type | Description | +| -- | -- | -- | +| `label` | `string` | Option label. | +| `value` | `*` | Option value. | +| `checked` | `boolean` | Whether the option is selected. | +| `disabled` | `boolean=` | Whether the option is disabled. | ++++ + ++++Slot props (multiple selections) +| Name | Type | Description | +| -- | -- | -- | +| `selected` | `Array` | Array of the selected options. | ++++ +^^^ + +### Events + +| Name | Description | +| -- | -- | +| ``input`` | Triggered when a search keyword is entered. The callback parameter is `(value: string)`, and `value` is the value of the input box. | +| ``select`` | [^event-select] | +| ``afteropen`` | Triggered after the dropdown panel is expanded. | +| ``afterclose`` | Triggered after the dropdown panel is collapsed. | + +^^^event-select +:::badges +`v-model` +::: + +Triggered after the selected state changes, the callback parameter is `(value: *)`. `value` is the value of the currently selected option value. +^^^ + +### Global configs + +| Key | Type | Default | Description | +| -- | -- | -- | -- | +| ``cascader.placeholder`` | `string` | `@@cascader.placeholder` | Placeholder content when not selected. | + +:::tip +`@@` prefixed values denote corresponding properties in the locale settings. +::: + +### Icons + +| Name | Description | +| -- | -- | +| ``expand`` | Expand the dropdown. | +| ``collapse`` | Collapse the dropdown. | +| ``clear`` | Clear selected. | +| ``separator`` | Toggle icon. | diff --git a/one/docs/nav.json b/one/docs/nav.json index 7c5c75f..2ca80f2 100644 --- a/one/docs/nav.json +++ b/one/docs/nav.json @@ -520,7 +520,7 @@ { "title": "Badge", "slug": "badge", - "disabled": true + "disabled": false }, { "title": "Tag", @@ -693,12 +693,12 @@ { "title": "Autocomplete", "slug": "autocomplete", - "disabled": true + "disabled": false }, { "title": "Anchor", "slug": "anchor", - "disabled": true + "disabled": false }, { "title": "Drawer", @@ -717,8 +717,7 @@ }, { "title": "Accordion", - "slug": "accordion", - "disabled": true + "slug": "accordion" }, { "title": "Lightbox", @@ -728,7 +727,7 @@ { "title": "Cascader", "slug": "cascader", - "disabled": true + "disabled": false }, { "title": "ConfigProvider",