From f00e01164284c96886a025786e586ee895a9924b Mon Sep 17 00:00:00 2001 From: Justineo Date: Mon, 1 Feb 2021 14:18:57 +0800 Subject: [PATCH] docs: update feature docs --- one/docs/components/column.md | 13 +++++++- one/docs/components/dropdown.md | 24 +++++++++++++++ one/docs/components/progress.md | 2 ++ one/docs/components/select.md | 43 +++++++++++++++++++++++++-- one/docs/components/uploader.md | 19 ++++++++---- one/docs/en-US/components/column.md | 13 +++++++- one/docs/en-US/components/dropdown.md | 22 ++++++++++++++ one/docs/en-US/components/progress.md | 1 + one/docs/en-US/components/select.md | 41 +++++++++++++++++++++++-- one/docs/en-US/components/uploader.md | 28 ++++++++--------- 10 files changed, 180 insertions(+), 26 deletions(-) diff --git a/one/docs/components/column.md b/one/docs/components/column.md index 15ab802..1c88e58 100644 --- a/one/docs/components/column.md +++ b/one/docs/components/column.md @@ -21,7 +21,10 @@ | `align` | `string=` | - | 内容对齐方式,支持 `left`/`center`/`right`。 | | `span` | `function(number): Object=` | | [^span] | | `desc` | `string` | - | 表头描述。 | -| `filter-value` | `*` | - | 筛选条件取值,目前仅支持 `true` 表示已经过筛选。 | +| `filter-value` | `*` | - | [^filter-value] | +| `filter-multiple` | `boolean=` | `false` | 内置筛选是否为多选。 | +| `filter-options` | `Array` | - | 筛选选项列表,项目的类型为 `{label, value, options, disabled, ...}`,可参考 [`Select`](./select) 组件的 `options` 属性。 | +| `filter-title` | `string=` | - | 筛选下拉的标题。 | ^^^sortable 本列是否支持排序。 @@ -39,6 +42,14 @@ ::: ^^^ +^^^filter-value +:::badges +`.sync` +::: + +筛选条件取值,值为 `null` 表示未经过筛选。当 `filter-multiple` 为 `true` 时,值为已选项值的数组。 +^^^ + ### 插槽 | 名称 | 描述 | diff --git a/one/docs/components/dropdown.md b/one/docs/components/dropdown.md index eaa5ea7..4ece868 100644 --- a/one/docs/components/dropdown.md +++ b/one/docs/components/dropdown.md @@ -104,6 +104,7 @@ | `group-label` | [^slot-group-label] | | `option-label` | [^slot-option-label] | | `option` | [^slot-option] | +| `trigger` | [^slot-trigger] | ^^^slot-label 下拉按钮文本区域。 @@ -164,6 +165,29 @@ 另外,当前选项数据中除了上面描述的字段之外的其它字段也会自动通过 `v-bind` 进行绑定到作用域参数上。 ^^^ +^^^slot-trigger +整个下拉触发区域。 + +默认内容:下拉按钮。 + ++++作用域参数 +| 名称 | 类型 | 描述 | +| -- | -- | -- | +| `attrs` | `Object` | 需要输出到触发元素上的属性,包括 `aria-*`/`disabled` 等,可以使用 `v-bind="attrs"` 统一进行输出。 | +| `handlers` | `Object` | [^handlers-desc] | +| `expanded` | `boolean` | 下拉菜单是否展开。 | +| `toggle` | `function(force?: boolean): void` | 用于切换下拉菜单展开状态。 | ++++ +^^^ + +^^^handlers-desc +需要绑定到触发元素上的事件监听器,可以使用 `v-on="handlers"` 统一进行输出。 + +:::tip +用于绑定 `handlers` 的元素需要支持获取焦点,以使各种键盘交互依然可以正常触发。 +::: +^^^ + ### 事件 | 名称 | 描述 | diff --git a/one/docs/components/progress.md b/one/docs/components/progress.md index c15881b..ac7f5f3 100644 --- a/one/docs/components/progress.md +++ b/one/docs/components/progress.md @@ -19,6 +19,8 @@ | `decimal-place` | `number` | `0` | 保留的小数位数。 | | `status` | `string` | - | [^status] | | `autosucceed` | `boolean|number` | - | 是否在进度值到达最大时自动进入 `success` 状态。`true` 表示直接进入成功状态,如果是 `number` 类型则表示在到达最大值后切换为成功状态前等待的毫秒数。 | +| `indeterminate` | `boolean` | `false` | 是否不确定进度,目前仅支持在 `type` 为 `bar` 时生效。 | + ^^^ui 预设样式。 diff --git a/one/docs/components/select.md b/one/docs/components/select.md index 5e94d79..f3057f9 100644 --- a/one/docs/components/select.md +++ b/one/docs/components/select.md @@ -97,12 +97,26 @@ | 名称 | 描述 | | -- | -- | | `default` | 选项列表的内容。在没有指定 `options` 属性时,可以用来直接内联 `Option` 或 `OptionGroup`。 | -| `before` | 选项列表前的内容。无默认内容。 | -| `after` | 选项列表后的内容。无默认内容。 | +| `before` | [^slot-before] | +| `after` | 选项列表后的内容。无默认内容。作用域参数同 `before` 插槽。 | | `label` | [^slot-label] | | `group-label` | [^slot-group-label] | | `option-label` | [^slot-option-label] | | `option` | [^slot-option] | +| `trigger` | [^slot-trigger] | + +^^^slot-before +选项列表前的内容。无默认内容。 + ++++作用域参数 +| 名称 | 类型 | 描述 | +| -- | -- | -- | +| `value` | `*` | 已选项值。 | +| `select` | `function(value: *): void` | 用于切换已选项。 | +| `expanded` | `boolean` | 下拉菜单是否展开。 | +| `toggle` | `function(force?: boolean): void` | 用于切换下拉菜单展开状态。 | ++++ +^^^ ^^^slot-label 下拉按钮文本区域。 @@ -170,6 +184,31 @@ 另外,当前选项数据中除了上面描述的字段之外的其它字段也会自动通过 `v-bind` 进行绑定到作用域参数上。 ^^^ +^^^slot-trigger +整个下拉触发区域。 + +默认内容:下拉按钮。 + ++++作用域参数 +| 名称 | 类型 | 描述 | +| -- | -- | -- | +| `attrs` | `Object` | 需要输出到触发元素上的属性,包括 `aria-*`/`disabled` 等,可以使用 `v-bind="attrs"` 统一进行输出。 | +| `handlers` | `Object` | [^handlers-desc] | +| `value` | `*` | 已选项值。 | +| `select` | `function(value: *): void` | 用于切换已选项。 | +| `expanded` | `boolean` | 下拉菜单是否展开。 | +| `toggle` | `function(force?: boolean): void` | 用于切换下拉菜单展开状态。 | ++++ +^^^ + +^^^handlers-desc +需要绑定到触发元素上的事件监听器,可以使用 `v-on="handlers"` 统一进行输出。 + +:::tip +用于绑定 `handlers` 的元素需要支持获取焦点,以使各种键盘交互依然可以正常触发。 +::: +^^^ + ### 事件 | 名称 | 描述 | diff --git a/one/docs/components/uploader.md b/one/docs/components/uploader.md index 5fc92ba..c2d69d0 100644 --- a/one/docs/components/uploader.md +++ b/one/docs/components/uploader.md @@ -32,8 +32,10 @@ | 属性 | 类型 | 默认值 | 描述 | | --- | --- | --- | --- | +| `ui` | `string=` | - | [^ui] | | `type` | `string` | `'file'` | [^type] | | `value` | `Object|Array` | - | [^value] | +| `key-field` | `string` | `'key'` | 用于指定文件对象的唯一 key,作为数据变化时正确处理文件列表顺序的依据。 | | `name` | `string` | `'file'` | 原生 `` 元素的 `name`。 | | `action` | `string` | - | 上传地址。 | | `headers` | `Object` | `uploader.headers` | 需要加入 [HTTP 请求头](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Headers) 的内容。可进行全局统一配置。 | @@ -55,6 +57,17 @@ | `upload` | `function(Object, Object): function` | - | [^upload] | | `controls` | `function(Object, Array): Array` | - | [^controls] | +^^^ui +预设样式。 + ++++枚举值 +| 值 | 描述 | +| -- | -- | +| `s` | 小尺寸样式。 | +| `m` | 中尺寸样式。 | ++++ +^^^ + ^^^type 上传类型。 @@ -67,11 +80,7 @@ ^^^ ^^^value -+++字段详情 -| `max-count` | 字段类型 | -| -- | -- | -| `1` | `Object` | -| 大于 `1` 或 `null` | `Array` | +当 `multiple` 为 `true`,返回文件对象的数组。另外,当 `max-count` 被设置为大于 `1` 的值,则会视为开启了 `multiple`。 每个文件对象的类型为 `{name: string, src: string, ...}`,以及在 `convert-response` 中自定义添加的字段。 +++ diff --git a/one/docs/en-US/components/column.md b/one/docs/en-US/components/column.md index 70a6635..67718d8 100644 --- a/one/docs/en-US/components/column.md +++ b/one/docs/en-US/components/column.md @@ -21,7 +21,10 @@ See [the demos of `Table`](./table#demos). | `align` | `string=` | - | The alignment of cell content in the column. Supports `left`/`center`/`right`. | | `span` | `function(number): Object=` | | [^span] | | `desc` | `string` | - | The description of the column head. | -| `filter-value` | `*` | - | The value of filter condition. `true` is the only value supported for now which indicates the column is filtered. | +| `filter-value` | `*` | - | [^filter-value] | +| `filter-multiple` | `boolean=` | `false` | Whether the built-in filter is multi-select or not. | +| `filter-options` | `Array` | - | The list of filter options, with items of type `{label, value, options, disabled, ...}`, see the `options` prop of the [`Select`](./select) component. | +| `filter-title` | `string=` | - | The title of the filter dropdown. | ^^^sortable Whether current column is sortable. @@ -39,6 +42,14 @@ You can learn more abut how to use this in `Table` component's [Demos › Advanc ::: ^^^ +^^^filter-value +:::badges +`.sync` +::: + +The value of current filter condition. `null` means not filtered. When `filter-multiple` is `true`, the value is an array of selected values. +^^^ + ### Slots | Name | Description | diff --git a/one/docs/en-US/components/dropdown.md b/one/docs/en-US/components/dropdown.md index 167f1bb..eefb7ea 100644 --- a/one/docs/en-US/components/dropdown.md +++ b/one/docs/en-US/components/dropdown.md @@ -103,6 +103,7 @@ Whether the dropdown menu is expanded. | `group-label` | [^slot-group-label] | | `option-label` | [^slot-option-label] | | `option` | [^slot-option] | +| `trigger` | [^slot-trigger] | ^^^slot-label The content of the select button. Displays the `label` prop by default. @@ -157,6 +158,27 @@ The entire content area of each option (option without child `options`). Display Additionally, custom properties in current option, apart from the listed ones, will also be passes into the scope object via `v-bind`. ^^^ +^^^slot-trigger +The entire drop-down trigger area. Displays the dropdown button by default. + ++++Scope properties +| Name | Type | Description | +| --- | --- | --- | +| `attrs` | `Object` | Attributes that need to be output to the trigger element, including `aria-*`/`disabled`, etc., can be output using `v-bind="attrs"`. | +| `handlers` | `Object` | [^handlers-desc] | +| `expanded` | `boolean` | Whether the dropdown menu is expanded or not. | +| `toggle` | `function(force?: boolean): void` | Used to toggle the expanded state of the dropdown menu. | ++++ +^^^ + +^^^^handlers-desc +Event listeners that need to be bound to the trigger element, can be output using `v-on="handlers"`. + +:::tip +The element used to bind `handlers` needs to support focus acquisition so that various keyboard interactions can still be triggered properly. +::: +^^^ + ### Events | Name | Description | diff --git a/one/docs/en-US/components/progress.md b/one/docs/en-US/components/progress.md index 065fd1d..ef720d3 100644 --- a/one/docs/en-US/components/progress.md +++ b/one/docs/en-US/components/progress.md @@ -19,6 +19,7 @@ | `decimal-place` | `number` | `0` | Decimal place for the progress value. | | `status` | `string` | - | [^status] | | `autosucceed` | `boolean|number` | - | Whether automatically enter the `success` status when the progress reaches the maximum value. `true` denotes entering immediately, while `number` values denotes the delay in milliseconds before entering the `success` status. | +| `indeterminate` | `boolean` | `false` | Whether the progress is indeterminate. Currently only works when `type` is `bar`. | ^^^ui Style variants. diff --git a/one/docs/en-US/components/select.md b/one/docs/en-US/components/select.md index b64ac86..0304800 100644 --- a/one/docs/en-US/components/select.md +++ b/one/docs/en-US/components/select.md @@ -96,12 +96,26 @@ Whether the dropdown menu is expanded. | Name | Description | | -- | -- | | `default` | The content of the options dropdown layer. Can be used to place `Option`s or `OptionGroups`s when the `options` prop is not specified. | -| `before` | The content before the options in the dropdown layer. | -| `after` | The content after the options in the dropdown layer. | +| `before` | [^slot-before] | +| `after` | The content after the options in the dropdown layer. No default content. | | `label` | [^slot-label] | | `group-label` | [^slot-group-label] | | `option-label` | [^slot-option-label] | | `option` | [^slot-option] | +| `trigger` | [^slot-trigger] | + +^^^slot-before +The content before the options in the dropdown layer. No default content. + ++++Scope properties +| Name | Type | Description | +| -- | -- | -- | +| `value` | `*` | The value of the selected option. | +| `select` | `function(value: *): void` | To select a specified value. | +| `expanded` | `boolean` | Whether the dropdown menu is expanded or not. | +| `toggle` | `function(force?: boolean): void` | Used to toggle the expanded state of the dropdown menu. | ++++ +^^^ ^^^slot-label The content of the select button. Displays the `label` of selected option or the text content of the selected embedded option by default. @@ -161,6 +175,29 @@ The entire content area of each option (option without child `options`). Display Additionally, custom properties in current option, apart from the listed ones, will also be passes into the scope object via `v-bind`. ^^^ +^^^slot-trigger +The entire drop-down trigger area. Displays the select input by default. + ++++Scope properties +| Name | Type | Description | +| --- | --- | --- | +| `attrs` | `Object` | Attributes that need to be output to the trigger element, including `aria-*`/`disabled`, etc., can be output using `v-bind="attrs"`. | +| `value` | `*` | The value of the selected option. | +| `select` | `function(value: *): void` | To select a specified value. | +| `handlers` | `Object` | [^handlers-desc] | +| `expanded` | `boolean` | Whether the dropdown menu is expanded or not. | +| `toggle` | `function(force?: boolean): void` | Used to toggle the expanded state of the dropdown menu. | ++++ +^^^ + +^^^^handlers-desc +Event listeners that need to be bound to the trigger element, can be output using `v-on="handlers"`. + +:::tip +The element used to bind `handlers` needs to support focus acquisition so that various keyboard interactions can still be triggered properly. +::: +^^^ + ### Events | Name | Description | diff --git a/one/docs/en-US/components/uploader.md b/one/docs/en-US/components/uploader.md index 2b5b941..19ebb2a 100644 --- a/one/docs/en-US/components/uploader.md +++ b/one/docs/en-US/components/uploader.md @@ -23,6 +23,7 @@ Set the `type` prop to `image` to use the image upload mode. | `ui` | `string=` | - | [^ui] | | `type` | `string` | `'file'` | [^type] | | `value` | `Object|Array` | - | [^value] | +| `key-field` | `string` | `'key'` | Used to specify a unique key for the file object, as a basis for correctly handling the order of the file list when the data changes. | | `name` | `string` | `'file'` | The `name` of native `` elements. | | `action` | `string` | - | Upload URL. | | `headers` | `Object` | `uploader.headers` | Extra [HTTP headers](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers). Can be globally configured. | @@ -43,6 +44,17 @@ Set the `type` prop to `image` to use the image upload mode. | `upload` | `function(Object, Object): function` | - | [^upload] | | `controls` | `function(Object, Array): Array` | - | [^controls] | +^^^ui +Style variants. + ++++Enum values +| Value | Description | +| -- | -- | +| `s` | Small. | +| `m` | Medium. | ++++ +^^^ + ^^^type The type of the uploader. @@ -55,11 +67,7 @@ The type of the uploader. ^^^ ^^^value -+++Type details -| `max-count` | Type | -| -- | -- | -| `1` | `Object` | -| > `1`, or `null` | `Array` | +Returns an array of file objects when `multiple` is `true`. When `max-count` is set to a value greater than `1`, then `multiple` treated as `true`. The type of single file is `{name: string, src: string, ...}`, and fields added inside `convert-response`. +++ @@ -113,16 +121,6 @@ Additional fields can be added to the response data. These data fields will be i +++ ^^^ -^^^ui -Style variants. - -+++Enum values -| Value | Description | -| -- | -- | -| `horizontal` | Horizontal style. | -+++ -^^^ - ^^^progress To specify how to display progress when `request-mode` is `xhr`.