From 7c3c2963c8d2d5c90a97365551864f8514d67c29 Mon Sep 17 00:00:00 2001 From: dengfuping Date: Thu, 11 Apr 2024 21:10:04 +0800 Subject: [PATCH] improve(style): Multiple item background and border color for Select, TreeSelect and Cascader --- .dumirc.ts | 1 + packages/design/src/cascader/demo/basic.tsx | 53 +++++++++++++ .../design/src/cascader/demo/multiple.tsx | 65 +++++++++++++++ packages/design/src/cascader/index.md | 21 +++++ packages/design/src/select/demo/multiple.tsx | 39 +++++++++ packages/design/src/select/demo/variant.tsx | 79 +++++++++++++++++++ packages/design/src/select/index.md | 4 +- packages/design/src/select/style/index.ts | 20 +---- packages/design/src/tag/style/index.ts | 3 +- packages/design/src/theme/default.ts | 9 +++ packages/design/src/tree-select/index.tsx | 2 +- .../design/src/tree-select/style/index.ts | 30 ++----- 12 files changed, 280 insertions(+), 46 deletions(-) create mode 100644 packages/design/src/cascader/demo/basic.tsx create mode 100644 packages/design/src/cascader/demo/multiple.tsx create mode 100644 packages/design/src/cascader/index.md create mode 100644 packages/design/src/select/demo/multiple.tsx create mode 100644 packages/design/src/select/demo/variant.tsx diff --git a/.dumirc.ts b/.dumirc.ts index a19c09d21..61866c52e 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -134,6 +134,7 @@ export default defineConfig({ { title: '数据录入', children: [ + { title: 'Cascader 级联选择', link: '/components/cascader' }, { title: 'Form 表单', link: '/components/form' }, { title: 'Input 输入框', link: '/components/input' }, { title: 'InputNumber 数字输入框', link: '/components/input-number' }, diff --git a/packages/design/src/cascader/demo/basic.tsx b/packages/design/src/cascader/demo/basic.tsx new file mode 100644 index 000000000..f76fe861f --- /dev/null +++ b/packages/design/src/cascader/demo/basic.tsx @@ -0,0 +1,53 @@ +import React from 'react'; +import { Cascader } from '@oceanbase/design'; + +interface Option { + value: string | number; + label: string; + children?: Option[]; +} + +const options: Option[] = [ + { + value: 'zhejiang', + label: 'Zhejiang', + children: [ + { + value: 'hangzhou', + label: 'Hangzhou', + children: [ + { + value: 'xihu', + label: 'West Lake', + }, + ], + }, + ], + }, + { + value: 'jiangsu', + label: 'Jiangsu', + children: [ + { + value: 'nanjing', + label: 'Nanjing', + children: [ + { + value: 'zhonghuamen', + label: 'Zhong Hua Men', + }, + ], + }, + ], + }, +]; + +const onChange = (value: (string | number)[]) => { + console.log(value); +}; + +const App: React.FC = () => ( + +); + +export default App; diff --git a/packages/design/src/cascader/demo/multiple.tsx b/packages/design/src/cascader/demo/multiple.tsx new file mode 100644 index 000000000..0c1193a4b --- /dev/null +++ b/packages/design/src/cascader/demo/multiple.tsx @@ -0,0 +1,65 @@ +import React from 'react'; +import { Cascader } from '@oceanbase/design'; +import type { MultipleCascaderProps } from '@oceanbase/design/es/cascader'; + +interface Option { + value: string | number; + label: string; + children?: Option[]; + disableCheckbox?: boolean; +} + +const options: Option[] = [ + { + label: 'Light', + value: 'light', + children: new Array(20) + .fill(null) + .map((_, index) => ({ label: `Number ${index}`, value: index })), + }, + { + label: 'Bamboo', + value: 'bamboo', + children: [ + { + label: 'Little', + value: 'little', + children: [ + { + label: 'Toy Fish', + value: 'fish', + disableCheckbox: true, + }, + { + label: 'Toy Cards', + value: 'cards', + }, + { + label: 'Toy Bird', + value: 'bird', + }, + ], + }, + ], + }, +]; + +const onChange: MultipleCascaderProps