Skip to content

Commit

Permalink
feat(ColorPicker): update
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Jan 16, 2024
1 parent 96be85b commit a6313c8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 16 deletions.
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
:: BASE_DOC ::

## API

### ColorPicker Props

name | type | default | description | required
-- | -- | -- | -- | --
enable-alpha | Boolean | false | \- | N
format | String | RGB | options: RGB/RGBA/HSL/HSLA/HSB/HSV/HSVA/HEX/CMYK/CSS | N
show-primary-color-preview | Boolean | true | \- | N
swatch-colors | Array | - | swatch colors。Typescript:`Array<string> \| null` | N
type | String | base | options: base/multiple。Typescript:`TypeEnum ` `type TypeEnum = 'base' \| 'multiple'`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts) | N
value | String | - | color value | N
Expand All @@ -18,5 +16,5 @@ default-value | String | undefined | color value。uncontrolled property | N

name | params | description
-- | -- | --
change | `(value: string, context: { color: ColorObject; trigger: ColorPickerChangeTrigger })` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。<br/>`type ColorPickerChangeTrigger = 'palette-saturation-brightness' \| 'palette-saturation' \| 'palette-brightness' \| 'palette-hue-bar' \| 'palette-alpha-bar' \| 'preset' `<br/>
palette-bar-change | `(detail: { color: ColorObject })` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。<br/>`interface ColorObject { alpha: number; css: string; hex: string; hex8: string; hsl: string; hsla: string; hsv: string; hsva: string; rgb: string; rgba: string; saturation: number; value: number; isGradient: boolean; linearGradient?: string; }`<br/>
change | `(value: string, context: { color: ColorObject; trigger: ColorPickerChangeTrigger })` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。<br/>`type ColorPickerChangeTrigger = 'palette-hue-bar' \| 'palette-alpha-bar' \| 'preset' `<br/>
palette-bar-change | `(detail: { color: ColorObject })` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。<br/>`interface ColorObject { alpha: number; css: string; hex: string; hex8: string; hsl: string; hsla: string; hsv: string; hsva: string; rgb: string; rgba: string; value: number;}`<br/>
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
:: BASE_DOC ::

## API

### ColorPicker Props

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
enable-alpha | Boolean | false | 是否开启透明通道 | N
format | String | RGB | 格式化色值。`enableAlpha` 为真时,`RGBA/HSLA/HSVA` 等值有效。可选项:RGB/RGBA/HSL/HSLA/HSB/HSV/HSVA/HEX/CMYK/CSS | N
show-primary-color-preview | Boolean | true | 是否展示颜色选择条右侧的颜色预览区域 | N
swatch-colors | Array | - | 系统预设的颜色样例,值为 `null``[]` 则不显示系统色,值为 `undefined` 会显示组件内置的系统默认色。TS 类型:`Array<string> \| null` | N
type | String | base | 颜色选择器类型。(base 表示仅展示系统预设内容; multiple 表示展示色板和系统预设内容。。可选项:base/multiple。TS 类型:`TypeEnum ` `type TypeEnum = 'base' \| 'multiple'`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts) | N
value | String | - | 色值 | N
Expand All @@ -18,5 +16,5 @@ default-value | String | undefined | 色值。非受控属性 | N

名称 | 参数 | 描述
-- | -- | --
change | `(value: string, context: { color: ColorObject; trigger: ColorPickerChangeTrigger })` | 选中的色值发生变化时触发,第一个参数 `value` 表示新色值,`context.color` 表示当前调色板控制器的色值,`context.trigger` 表示触发颜色变化的来源。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。<br/>`type ColorPickerChangeTrigger = 'palette-saturation-brightness' \| 'palette-saturation' \| 'palette-brightness' \| 'palette-hue-bar' \| 'palette-alpha-bar' \| 'preset' `<br/>
palette-bar-change | `(detail: { color: ColorObject })` | 调色板控制器的值变化时触发,`context.color` 指调色板控制器的值。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。<br/>`interface ColorObject { alpha: number; css: string; hex: string; hex8: string; hsl: string; hsla: string; hsv: string; hsva: string; rgb: string; rgba: string; saturation: number; value: number; isGradient: boolean; linearGradient?: string; }`<br/>
change | `(value: string, context: { color: ColorObject; trigger: ColorPickerChangeTrigger })` | 选中的色值发生变化时触发,第一个参数 `value` 表示新色值,`context.color` 表示当前调色板控制器的色值,`context.trigger` 表示触发颜色变化的来源。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。<br/>`type ColorPickerChangeTrigger = 'palette-hue-bar' \| 'palette-alpha-bar' \| 'preset' `<br/>
palette-bar-change | `(detail: { color: ColorObject })` | 调色板控制器的值变化时触发,`context.color` 指调色板控制器的值。[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/color-picker/type.ts)。<br/>`interface ColorObject { alpha: number; css: string; hex: string; hex8: string; hsl: string; hsla: string; hsv: string; hsva: string; rgb: string; rgba: string; value: number;}`<br/>
45 changes: 37 additions & 8 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -25744,8 +25744,7 @@
"platform_framework": [
"1",
"2",
"4",
"64"
"4"
],
"component": "ColorPicker",
"field_category": 1,
Expand Down Expand Up @@ -25775,8 +25774,7 @@
"platform_framework_text": [
"Vue(PC)",
"React(PC)",
"Angular(PC)",
"Miniprogram"
"Angular(PC)"
],
"field_type_text": [
"Boolean"
Expand Down Expand Up @@ -25991,7 +25989,7 @@
"field_desc_zh": "选中的色值发生变化时触发,第一个参数 `value` 表示新色值,`context.color` 表示当前调色板控制器的色值,`context.trigger` 表示触发颜色变化的来源",
"field_desc_en": null,
"field_required": 0,
"event_input": "(value: string, context: { color: ColorObject; trigger: ColorPickerChangeTrigger })【type ColorPickerChangeTrigger = 'palette-saturation-brightness' | 'palette-saturation' | 'palette-brightness' | 'palette-hue-bar' | 'palette-alpha-bar' | 'preset' 】",
"event_input": "(value: string, context: { color: ColorObject; trigger: ColorPickerChangeTrigger })【type ColorPickerChangeTrigger = 'palette-hue-bar' | 'palette-alpha-bar' | 'preset' 】",
"create_time": "2024-01-15 05:00:04",
"update_time": "2024-01-15 05:00:04",
"event_output": null,
Expand All @@ -26015,8 +26013,7 @@
"platform_framework": [
"1",
"2",
"4",
"64"
"4"
],
"component": "ColorPicker",
"field_category": 2,
Expand Down Expand Up @@ -26044,7 +26041,39 @@
"platform_framework_text": [
"Vue(PC)",
"React(PC)",
"Angular(PC)",
"Angular(PC)"
],
"field_type_text": []
},
{
"id": 1705394290,
"platform_framework": [
"64"
],
"component": "ColorPicker",
"field_category": 2,
"field_name": "paletteBarChange",
"field_type": [],
"field_default_value": "",
"field_enum": "",
"field_desc_zh": "调色板控制器的值变化时触发,`context.color` 指调色板控制器的值",
"field_desc_en": null,
"field_required": 0,
"event_input": "(context: { color: ColorObject })【interface ColorObject { alpha: number; css: string; hex: string; hex8: string; hsl: string; hsla: string; hsv: string; hsva: string; rgb: string; rgba: string; value: number;}】",
"create_time": "2024-01-16 08:38:10",
"update_time": "2024-01-16 08:38:10",
"event_output": null,
"custom_field_type": null,
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
"trigger_elements": "",
"deprecated": 0,
"version": "",
"test_description": null,
"support_default_value": 0,
"field_category_text": "Events",
"platform_framework_text": [
"Miniprogram"
],
"field_type_text": []
Expand Down

0 comments on commit a6313c8

Please sign in to comment.