{props.enableAlpha ?
: null}
diff --git a/packages/components/color-picker/props.ts b/packages/components/color-picker/props.ts
index f0757763bc..770065bf04 100644
--- a/packages/components/color-picker/props.ts
+++ b/packages/components/color-picker/props.ts
@@ -30,6 +30,10 @@ export default {
default: true,
},
/** 格式化色值。`enableAlpha` 为真时,`HEX8/RGBA/HSLA/HSVA` 有效 */
+ eyeDropper: {
+ type: [Boolean, Object] as unknown as PropType
,
+ default: false as TdColorPickerProps['eyeDropper'],
+ },
format: {
type: String as PropType,
default: 'RGB' as TdColorPickerProps['format'],
diff --git a/packages/components/color-picker/type.ts b/packages/components/color-picker/type.ts
index dae9992b4b..3898e485b9 100644
--- a/packages/components/color-picker/type.ts
+++ b/packages/components/color-picker/type.ts
@@ -9,6 +9,13 @@ import { PopupProps } from '../popup';
import { SelectInputProps } from '../select-input';
import { SizeEnum } from '../common';
+export type EyeDropperConfig =
+ | boolean
+ | {
+ mode?: 'native' | 'fallback';
+ showPreview?: boolean;
+ };
+
export interface TdColorPickerProps {
/**
* 无边框模式
@@ -39,6 +46,11 @@ export interface TdColorPickerProps {
* @default true
*/
enableMultipleGradient?: boolean;
+ /**
+ * 是否开启吸色(屏幕取色)功能。开启后颜色条前显示吸色按钮
+ * @default false
+ */
+ eyeDropper?: EyeDropperConfig;
/**
* 格式化色值。`enableAlpha` 为真时,`HEX8/RGBA/HSLA/HSVA` 有效
* @default RGB
@@ -133,6 +145,11 @@ export interface TdColorPickerPanelProps {
* @default true
*/
enableMultipleGradient?: boolean;
+ /**
+ * 是否开启吸色(屏幕取色)功能。开启后颜色条前显示吸色按钮
+ * @default false
+ */
+ eyeDropper?: EyeDropperConfig;
/**
* 格式化色值。`enableAlpha` 为真时,`HEX8/RGBA/HSLA/HSVA` 有效
* @default RGB
@@ -198,7 +215,8 @@ export type ColorPickerChangeTrigger =
| 'palette-alpha-bar'
| 'input'
| 'preset'
- | 'recent';
+ | 'recent'
+ | 'eyedropper';
export interface ColorObject {
alpha: number;
diff --git a/packages/components/switch/_example/theme.vue b/packages/components/switch/_example/theme.vue
new file mode 100644
index 0000000000..62450a1d3b
--- /dev/null
+++ b/packages/components/switch/_example/theme.vue
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
diff --git a/packages/components/switch/_usage/props.json b/packages/components/switch/_usage/props.json
index 881604decd..14f2441ebc 100644
--- a/packages/components/switch/_usage/props.json
+++ b/packages/components/switch/_usage/props.json
@@ -29,5 +29,24 @@
"value": "large"
}
]
+ },
+ {
+ "name": "theme",
+ "type": "enum",
+ "defaultValue": "default",
+ "options": [
+ {
+ "label": "default",
+ "value": "default"
+ },
+ {
+ "label": "rectangle",
+ "value": "rectangle"
+ },
+ {
+ "label": "line",
+ "value": "line"
+ }
+ ]
}
-]
\ No newline at end of file
+]
diff --git a/packages/components/switch/props.ts b/packages/components/switch/props.ts
index 233173bd12..2a5202d4e9 100644
--- a/packages/components/switch/props.ts
+++ b/packages/components/switch/props.ts
@@ -37,6 +37,15 @@ export default {
return ['small', 'medium', 'large'].includes(val);
},
},
+ /** 开关外观风格 */
+ theme: {
+ type: String as PropType,
+ default: 'default' as TdSwitchProps['theme'],
+ validator(val: TdSwitchProps['theme']): boolean {
+ if (!val) return true;
+ return ['default', 'rectangle', 'line'].includes(val);
+ },
+ },
/** 开关值 */
value: {
type: [String, Number, Boolean] as PropType,
diff --git a/packages/components/switch/switch.tsx b/packages/components/switch/switch.tsx
index 65d9f84d89..80eed62596 100755
--- a/packages/components/switch/switch.tsx
+++ b/packages/components/switch/switch.tsx
@@ -63,6 +63,7 @@ export default defineComponent({
`${COMPONENT_NAME.value}`,
SIZE.value[props.size],
{
+ [`${COMPONENT_NAME.value}--${props.theme}`]: props.theme !== 'default',
[STATUS.value.disabled]: disabled.value,
[STATUS.value.loading]: props.loading,
[STATUS.value.checked]: innerValue.value === activeValue.value || props.modelValue === activeValue.value,
diff --git a/packages/components/switch/type.ts b/packages/components/switch/type.ts
index 3308048a92..21696bc704 100644
--- a/packages/components/switch/type.ts
+++ b/packages/components/switch/type.ts
@@ -34,6 +34,11 @@ export interface TdSwitchProps {
* @default medium
*/
size?: 'small' | 'medium' | 'large';
+ /**
+ * 开关外观风格
+ * @default default
+ */
+ theme?: 'default' | 'rectangle' | 'line';
/**
* 开关值
*/
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 4fcb93ef1b..ae86078d0b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -338,6 +338,9 @@ importers:
'@tdesign/shared-utils':
specifier: workspace:^
version: link:packages/shared/utils
+ html2canvas-pro:
+ specifier: 2.2.4
+ version: 2.2.4
tdesign-vue-next:
specifier: workspace:^
version: link:packages/tdesign-vue-next
@@ -5177,6 +5180,10 @@ packages:
bare-url@2.4.3:
resolution: {integrity: sha512-Kccpc7ACfXaxfeInfqKcZtW4pT5YBn1mesc4sCsun6sRwtbJ4h+sNOaksUpYEJUKfN65YWC6Bw2OJEFiKxq8nQ==}
+ base64-arraybuffer@1.0.2:
+ resolution: {integrity: sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==}
+ engines: {node: '>= 0.6.0'}
+
base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
@@ -5658,6 +5665,9 @@ packages:
peerDependencies:
postcss: ^8.0.9
+ css-line-break@2.1.0:
+ resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==}
+
css-select@4.3.0:
resolution: {integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==}
@@ -7223,6 +7233,10 @@ packages:
resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==}
engines: {node: '>=12'}
+ html2canvas-pro@2.2.4:
+ resolution: {integrity: sha512-fo/VOiQZ3oWykAPvnMNHymUHzLWJE7c7C7VWPh+ydb+NquFTwqY5rHQRoxkgsaXo/iciVryPNffTvLzYg98xhg==}
+ engines: {node: '>=16.0.0'}
+
htmlparser2@10.1.0:
resolution: {integrity: sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==}
@@ -10259,6 +10273,9 @@ packages:
resolution: {integrity: sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==}
engines: {node: '>=0.10'}
+ text-segmentation@1.0.3:
+ resolution: {integrity: sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==}
+
text-table@0.2.0:
resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==}
@@ -10767,6 +10784,9 @@ packages:
util@0.12.5:
resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==}
+ utrie@1.0.2:
+ resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==}
+
uuid@14.0.1:
resolution: {integrity: sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew==}
hasBin: true
@@ -16575,6 +16595,8 @@ snapshots:
dependencies:
bare-path: 3.0.0
+ base64-arraybuffer@1.0.2: {}
+
base64-js@1.5.1: {}
baseline-browser-mapping@2.10.30: {}
@@ -17101,6 +17123,10 @@ snapshots:
dependencies:
postcss: 8.5.14
+ css-line-break@2.1.0:
+ dependencies:
+ utrie: 1.0.2
+
css-select@4.3.0:
dependencies:
boolbase: 1.0.0
@@ -19039,6 +19065,11 @@ snapshots:
dependencies:
whatwg-encoding: 2.0.0
+ html2canvas-pro@2.2.4:
+ dependencies:
+ css-line-break: 2.1.0
+ text-segmentation: 1.0.3
+
htmlparser2@10.1.0:
dependencies:
domelementtype: 2.3.0
@@ -22765,6 +22796,10 @@ snapshots:
text-extensions@1.9.0: {}
+ text-segmentation@1.0.3:
+ dependencies:
+ utrie: 1.0.2
+
text-table@0.2.0: {}
through2@2.0.5:
@@ -23304,6 +23339,10 @@ snapshots:
is-typed-array: 1.1.15
which-typed-array: 1.1.19
+ utrie@1.0.2:
+ dependencies:
+ base64-arraybuffer: 1.0.2
+
uuid@14.0.1:
optional: true