docs: update icon api

This commit is contained in:
fangsmile 2024-05-21 12:22:59 +08:00
parent 57a51a922a
commit d3229941a4
10 changed files with 151 additions and 17 deletions

View File

@ -12,6 +12,33 @@ The height of the icon.
${prefix} positionType (IconPosition)
IconPosition enumeration type.
```
/**
* Icon location
* inlineFront: the front of the text content,
* inlineEnd: after the text content
*
*/
export enum IconPosition {
/**The icon in front of the text line content follows the text positioning and wraps with the text */
inlineFront = 'inlineFront',
/**The icon after the text line content, positioned with the text, and wrapped with the text. For example, the sort chart is placed in the first line of the text content */
inlineEnd = 'inlineEnd',
/**Button on the left side of the cell and affected by padding */
left = 'left',
/**The button on the right side of the cell is affected by padding, such as the pin chart */
right = 'right',
/**The icon fixed on the right side does not occupy space, is not affected by padding, and may cover the content, such as dropDown */
absoluteRight = 'absoluteRight',
/**The icon on the left side of the cell content block follows the text positioning and does not wrap with the text */
contentLeft = 'contentLeft',
/**The icon on the right side of the cell content block follows the text positioning and does not wrap with the text */
contentRight = 'contentRight',
/**Free positioning in the cell */
absolute = 'absolute'
}
```
${prefix} marginRight (number)
The distance between the icon and the element on the right, or the distance between the icon and the cell boundary.
@ -28,6 +55,7 @@ When resetting the icon inside VTable, you need to specify the functional type o
Especially for functional icons with switchable states, please be sure to configure funcType, such as sorting function with funcType configured as sort, and name configured as sort_normal, sort_downward, or sort_upward. In this way, the corresponding icon inside can be accurately replaced.
IconFuncTypeEnum enumeration type definition:
```
enum IconFuncTypeEnum {
pin = 'pin',
@ -74,6 +102,7 @@ The title of the tooltip.
#${prefix} placement (Placement)
The position of the tooltip, optional values are top, left, right, or bottom.
Placement enumeration type definition:
```
enum Placement {
top = 'top',
@ -102,4 +131,4 @@ The background color of the tooltip.
Whether to show the arrow in the tooltip.
${prefix} interactive (boolean)
Whether it is interactive, default is true. Currently, the known non-interactive buttons are dropdown state menus.
Whether it is interactive, default is true. Currently, the known non-interactive buttons are dropdown state menus.

View File

@ -12,6 +12,33 @@ icon 的高度。
${prefix} positionType (IconPosition)
IconPosition 枚举类型。
```
/**
* icon 的位置
* inlineFront:文本内容的前面,
* inlineEnd文本内容后面
*
*/
export enum IconPosition {
/**文本行内容前面的图标,跟随文本定位,随文本折行 */
inlineFront = 'inlineFront',
/**文本行内容后面的图标跟随文本定位随文本折行。如sort图表 放在文本内容的第一行 */
inlineEnd = 'inlineEnd',
/**单元格左侧按钮 且受padding影响 */
left = 'left',
/**单元格右侧按钮 受padding影响 如pin图表 */
right = 'right',
/**固定在右侧的图标不占位不受padding影响可能压盖内容 如 dropDown */
absoluteRight = 'absoluteRight',
/**在单元格内容块的左侧的图标,跟随文本定位,不随文本折行 */
contentLeft = 'contentLeft',
/**在单元格内容块的右侧的图标,跟随文本定位,不随文本折行 */
contentRight = 'contentRight',
/**在单元格中自由定位 */
absolute = 'absolute'
}
```
${prefix} marginRight (number)
和右侧元素间隔距离,或者与单元格边界的间隔距离。

View File

@ -84,7 +84,7 @@ const tableInstance = new VTable.ListTable({
In this example, we configure a cell named `Avatar` Icon. The role of this icon is to display the avatar picture, and the value of the picture src is obtained from the field of the avator of records.
Effect picture: TODO
online demohttps://visactor.io/vtable/demo/custom-render/custom-icon
## How to register the icon and use it after registration

View File

@ -84,7 +84,7 @@ const tableInstance = new VTable.ListTable({
这个示例中,我们为单元格配置了一个名为 `Avatar` 的图标。该图标的作用是用来显示头像图片,图片 src 的值是从 records 的 avator 的字段中获取到的。
效果图片TODO
在线 demohttps://visactor.io/vtable/demo/custom-render/custom-icon
## 如何注册 icon 及注册后的使用

View File

@ -85,16 +85,18 @@ icon?:
| ((args: CellInfo) => string | ColumnIconOption | (string | ColumnIconOption)[]);
```
#${prefix} ColumnIconOption definition:
#${prefix} ColumnIconOption
```
type ColumnIconOption = ImageIcon | SvgIcon;
```
#${prefix} ImageIcon(Object)
type is set to 'image'. The image address needs to be set in src
{{ use: image-icon( prefix = '##' + ${prefix}) }}
#${prefix} SvgIcon(Object)
type is set to 'svg'. You need to configure the svg address or the complete svg file string in svg
{{ use: svg-icon( prefix = '##' + ${prefix}) }}
${prefix} sort(boolean|Function)

View File

@ -12,6 +12,33 @@ The height of the icon.
${prefix} positionType (IconPosition)
IconPosition enumeration type.
```
/**
* Icon location
* inlineFront: the front of the text content,
* inlineEnd: after the text content
*
*/
export enum IconPosition {
/**The icon in front of the text line content follows the text positioning and wraps with the text */
inlineFront = 'inlineFront',
/**The icon after the text line content, positioned with the text, and wrapped with the text. For example, the sort chart is placed in the first line of the text content */
inlineEnd = 'inlineEnd',
/**Button on the left side of the cell and affected by padding */
left = 'left',
/**The button on the right side of the cell is affected by padding, such as the pin chart */
right = 'right',
/**The icon fixed on the right side does not occupy space, is not affected by padding, and may cover the content, such as dropDown */
absoluteRight = 'absoluteRight',
/**The icon on the left side of the cell content block follows the text positioning and does not wrap with the text */
contentLeft = 'contentLeft',
/**The icon on the right side of the cell content block follows the text positioning and does not wrap with the text */
contentRight = 'contentRight',
/**Free positioning in the cell */
absolute = 'absolute'
}
```
${prefix} marginRight (number)
The spacing distance from the right element, or the spacing distance from the cell boundary.
@ -28,6 +55,7 @@ When resetting the icon inside VTable, you need to specify the functional type o
Especially for functional icons with toggleable states, please be sure to configure funcType, such as sorting function with funcType set to sort, and name set to sort_normal, sort_downward, or sort_upward. This way, the corresponding icon can be replaced accurately.
IconFuncTypeEnum enumeration definition:
```
enum IconFuncTypeEnum {
frozen = 'frozen',
@ -74,6 +102,7 @@ Title of the tooltip.
#${prefix} placement (Placement)
Tooltip position, optional values are top, left, right, or bottom.
Placement enumeration definition:
```
enum Placement {
top = 'top',
@ -102,4 +131,4 @@ Tooltip background color.
Whether the tooltip displays an arrow.
${prefix} interactive (boolean)
Whether it is interactive, default is true. Currently known non-interactive buttons are dropdown menu states.
Whether it is interactive, default is true. Currently known non-interactive buttons are dropdown menu states.

View File

@ -1,4 +1,3 @@
{{ target: base-indicator-type }}
${prefix} indicatorKey(string)
@ -12,16 +11,18 @@ Indicator name
${prefix} format(FieldFormat)
Indicator value formatting
```
type FieldFormat = (value: number|string, col:number, row:number, table:PivotTable) => any;
```
```
${prefix} headerFormat(FieldFormat)
indicator title format
```
type FieldFormat = (title: number|string, col:number, row:number, table:PivotTable) => any;
```
```
${prefix} width(number|string)
@ -54,9 +55,11 @@ Header cell style. Configuration items vary slightly depending on the headerType
${prefix} style
Body cell style, type declaration:
```
style?: IStyleOption | ((styleArg: StylePropertyFunctionArg) => IStyleOption);
```
{{ use: common-StylePropertyFunctionArg() }}
IStyleOption type structure is as follows:
@ -92,14 +95,19 @@ icon?:
| (string | ColumnIconOption)[]
| ((args: CellInfo) => string | ColumnIconOption | (string | ColumnIconOption)[]);
```
#${prefix}ColumnIconOption_definition
#${prefix}ColumnIconOption
```
type ColumnIconOption = ImageIcon | SvgIcon;
```
#${prefix}ImageIcon(Object)
type is set to 'image'. The image address needs to be set in src
{{ use: image-icon( prefix = '##' + ${prefix}) }}
#${prefix}SvgIcon(Object)
type is set to 'svg'. You need to configure the svg address or the complete svg file string in svg
{{ use: svg-icon( prefix = '##' + ${prefix}) }}
${prefix} headerCustomRender(Function|Object)
@ -107,11 +115,12 @@ Custom rendering content definition for the indicator name header. For details,
${prefix} headerCustomLayout(Function)
Custom layout elements for the indicator name header cell.
Custom layout elements for the indicator name header cell.
```
(args: CustomRenderFunctionArg) => ICustomLayoutObj;
```
{{ use: common-CustomRenderFunctionArg() }}
{{ use: custom-layout(
@ -123,9 +132,11 @@ ${prefix} customRender(Function|Object)
Custom rendering content definition for the indicator value body cell, either in function or object form. The type is `ICustomRenderFuc | ICustomRenderObj`.
The ICustomRenderFuc is defined as follows:
```
type ICustomRenderFuc = (args: CustomRenderFunctionArg) => ICustomRenderObj;
```
{{ use: common-CustomRenderFunctionArg() }}
{{ use: common-custom-render-object(
@ -139,6 +150,7 @@ Custom layout elements for the indicator value body cell.
```
(args: CustomRenderFunctionArg) => ICustomLayoutObj;
```
{{ use: common-CustomRenderFunctionArg() }}
{{ use: custom-layout(
@ -157,7 +169,9 @@ Whether to disable column width adjustment. If it is a transposed table or the i
${prefix} editor (string|Object|Function)
Configure the indicator cell editor
```
editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor);
```
Among them, IEditor is the editor interface defined in @visactor/vtable-editors. For details, please refer to the source code: https://github.com/VisActor/VTable/blob/main/packages/vtable-editors/src/types.ts .

View File

@ -85,16 +85,18 @@ icon?:
| ((args: CellInfo) => string | ColumnIconOption | (string | ColumnIconOption)[]);
```
#${prefix}ColumnIconOption 定义:
#${prefix}ColumnIconOption
```
type ColumnIconOption = ImageIcon | SvgIcon;
```
#${prefix}ImageIcon(Object)
type 配置成 'image'。需要配置图片地址在 src 中
{{ use: image-icon( prefix = '##' + ${prefix}) }}
#${prefix}SvgIcon(Object)
type 配置成 'svg'。需要配置 svg 地址或者 svg 完整文件字符串在 svg 中
{{ use: svg-icon( prefix = '##' + ${prefix}) }}
${prefix} sort(boolean|Function)

View File

@ -12,6 +12,33 @@ icon 的高度。
${prefix} positionType (IconPosition)
IconPosition 枚举类型。
```
/**
* icon 的位置
* inlineFront:文本内容的前面,
* inlineEnd文本内容后面
*
*/
export enum IconPosition {
/**文本行内容前面的图标,跟随文本定位,随文本折行 */
inlineFront = 'inlineFront',
/**文本行内容后面的图标跟随文本定位随文本折行。如sort图表 放在文本内容的第一行 */
inlineEnd = 'inlineEnd',
/**单元格左侧按钮 且受padding影响 */
left = 'left',
/**单元格右侧按钮 受padding影响 如pin图表 */
right = 'right',
/**固定在右侧的图标不占位不受padding影响可能压盖内容 如 dropDown */
absoluteRight = 'absoluteRight',
/**在单元格内容块的左侧的图标,跟随文本定位,不随文本折行 */
contentLeft = 'contentLeft',
/**在单元格内容块的右侧的图标,跟随文本定位,不随文本折行 */
contentRight = 'contentRight',
/**在单元格中自由定位 */
absolute = 'absolute'
}
```
${prefix} marginRight (number)
和右侧元素间隔距离,或者与单元格边界的间隔距离。
@ -23,11 +50,12 @@ icon 的名称,会作为内部缓存的 key。
${prefix} funcType (IconFuncTypeEnum)
重置VTable内部的icon时需要指定 icon 的功能类型。
重置 VTable 内部的 icon 时需要指定 icon 的功能类型。
特别是具有切换状态的功能性的图标请务必配置上funcType例如排序功能 funcType 配置 sortname 配置 sort_normal 或 sort_downward或 sort_upward。这样才能准确替换到内部相应的icon图标。
特别是具有切换状态的功能性的图标请务必配置上 funcType例如排序功能 funcType 配置 sortname 配置 sort_normal 或 sort_downward或 sort_upward。这样才能准确替换到内部相应的 icon 图标。
IconFuncTypeEnum 枚举类型定义:
IconFuncTypeEnum枚举类型定义
```
enum IconFuncTypeEnum {
frozen = 'frozen',
@ -73,7 +101,8 @@ ${prefix} tooltip (Object)
#${prefix} placement (Placement)
气泡框位置,可选值为 top、left、right 或 bottom。
Placement枚举类型定义
Placement 枚举类型定义:
```
enum Placement {
top = 'top',
@ -102,4 +131,4 @@ Placement枚举类型定义
气泡框是否显示箭头。
${prefix} interactive (boolean)
是否可交互,默认为 true。目前已知不可交互按钮为下拉菜单状态。
是否可交互,默认为 true。目前已知不可交互按钮为下拉菜单状态。

View File

@ -96,16 +96,18 @@ icon?:
| ((args: CellInfo) => string | ColumnIconOption | (string | ColumnIconOption)[]);
```
#${prefix}ColumnIconOption 定义:
#${prefix}ColumnIconOption
```
type ColumnIconOption = ImageIcon | SvgIcon;
```
#${prefix}ImageIcon(Object)
type 配置成 'image'。需要配置图片地址在 src 中
{{ use: image-icon( prefix = '##' + ${prefix}) }}
#${prefix}SvgIcon(Object)
type 配置成 'svg'。需要配置 svg 地址或者 svg 完整文件字符串在 svg 中
{{ use: svg-icon( prefix = '##' + ${prefix}) }}
${prefix} headerCustomRender(Function|Object)