From 668d91b422fb164b3f6dc778f358d0931aa12764 Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Wed, 18 Mar 2020 16:54:08 +0800 Subject: [PATCH] chore: some docs refine & radio select prop change --- .../components/collapse/enUS/index.md | 1 + .../components/collapse/zhCN/index.md | 1 + .../components/datePicker/enUS/index.md | 8 ++++---- .../components/datePicker/zhCN/index.md | 8 ++++---- demo/documentation/components/radio/enUS/index.md | 2 ++ demo/documentation/components/radio/zhCN/index.md | 2 ++ demo/documentation/components/select/enUS/index.md | 2 +- demo/documentation/components/select/zhCN/index.md | 3 ++- src/Radio/src/Radio.vue | 14 ++++++++++++++ src/Select/src/Select.vue | 4 ++-- 10 files changed, 33 insertions(+), 12 deletions(-) diff --git a/demo/documentation/components/collapse/enUS/index.md b/demo/documentation/components/collapse/enUS/index.md index d92fe9fdb..33a93d44b 100644 --- a/demo/documentation/components/collapse/enUS/index.md +++ b/demo/documentation/components/collapse/enUS/index.md @@ -39,6 +39,7 @@ item-header-click |header|`()`|| ## Event +### Collapse Event |Name|Parameters|Description| |-|-|-| |expanded-names-change|`(expandedNames: Array)`|| diff --git a/demo/documentation/components/collapse/zhCN/index.md b/demo/documentation/components/collapse/zhCN/index.md index 6cd2d689c..deb22c86f 100644 --- a/demo/documentation/components/collapse/zhCN/index.md +++ b/demo/documentation/components/collapse/zhCN/index.md @@ -39,6 +39,7 @@ item-header-click |header|`()`|| ## Event +### Collapse Event |名称|参数|说明| |-|-|-| |expanded-names-change|`(expandedNames: Array)`|| diff --git a/demo/documentation/components/datePicker/enUS/index.md b/demo/documentation/components/datePicker/enUS/index.md index d99894664..20f940eb0 100644 --- a/demo/documentation/components/datePicker/enUS/index.md +++ b/demo/documentation/components/datePicker/enUS/index.md @@ -71,11 +71,11 @@ format ### Date, DateTime Type Events |Name|Parameters|Description| |-|-|-| -|change|`(currentValue: number \| null)`|| -|blur|`(currentValue: number \| null)`|| +|change|`(value: number \| null)`|| +|blur|`()`|| ### DateRange, DateTimeRange Type Events |Name|Parameters|Description| |-|-|-| -|change|`(currentValue: [number, number] \| null)`|| -|blur|`(currentValue: [number, number] \| null)`|| +|change|`(value: [number, number] \| null)`|| +|blur|`()`|| diff --git a/demo/documentation/components/datePicker/zhCN/index.md b/demo/documentation/components/datePicker/zhCN/index.md index d4bf2eb4e..b8568b81a 100644 --- a/demo/documentation/components/datePicker/zhCN/index.md +++ b/demo/documentation/components/datePicker/zhCN/index.md @@ -72,11 +72,11 @@ format ### Date, DateTime 类型的 Events |名称|参数|说明| |-|-|-| -|change|`(currentValue: number \| null)`|| -|blur|`(currentValue: number \| null)`|| +|change|`(value: number \| null)`|| +|blur|`()`|| ### DateRange, DateTimeRange 类型的 Events |名称|参数|说明| |-|-|-| -|change|`(currentValue: [number, number] \| null)`|| -|blur|`(currentValue: [number, number] \| null)`|| +|change|`(value: [number, number] \| null)`|| +|blur|`()`|| diff --git a/demo/documentation/components/radio/enUS/index.md b/demo/documentation/components/radio/enUS/index.md index 6e0e676ad..d358bf2f0 100644 --- a/demo/documentation/components/radio/enUS/index.md +++ b/demo/documentation/components/radio/enUS/index.md @@ -23,6 +23,7 @@ size ### Radio Props |Name|Type|Default|Description| |-|-|-|-| +|theme|`'light' \| 'dark'`|`null`|| |name|`string`|`undefined`|The name attribute of the radio element. If not set, name of `radio-group` will be used.| |checked-value|`string \| number \| boolean`|`null`|| |value|`string \| number \| boolean`|`null`|| @@ -39,6 +40,7 @@ size ### Radio Group Props |Name|Type|Default|Description| |-|-|-|-| +|theme|`'light' \| 'dark'`|`null`|| |name|`string`|`null`|The name attribute of the radio elements inside the group.| |size|`'small' \| 'medium' \| 'large'`|`small`|| |value|`string \| number \| boolean`|`null`|| diff --git a/demo/documentation/components/radio/zhCN/index.md b/demo/documentation/components/radio/zhCN/index.md index 24a1c8b23..f8357769f 100644 --- a/demo/documentation/components/radio/zhCN/index.md +++ b/demo/documentation/components/radio/zhCN/index.md @@ -23,6 +23,7 @@ size ### Radio Props |名称|类型|默认值|说明| |-|-|-|-| +|theme|`'light' \| 'dark'`|`null`|| |name|`string`|`undefined`|单选 radio 元素的 name 属性。如果没有设定会使用 `radio-group` 的 `name`| |checked-value|`string \| number \| boolean`|`null`|| |value|`string \| number \| boolean`|`null`|| @@ -40,6 +41,7 @@ size ### Radio Group Props |名称|类型|默认值|说明| |-|-|-|-| +|theme|`'light' \| 'dark'`|`null`|| |name|`string`|`null`|选项组内部 radio 元素的 name 属性| |size|`'small' \| 'medium' \| 'large'`|`small`|| |value|`string \| number \| boolean`|`null`|| diff --git a/demo/documentation/components/select/enUS/index.md b/demo/documentation/components/select/enUS/index.md index bce5ff502..8f785c595 100644 --- a/demo/documentation/components/select/enUS/index.md +++ b/demo/documentation/components/select/enUS/index.md @@ -38,7 +38,7 @@ action |filterable|`boolean`|`false`|Whether it can filter options.| |filter|`(pattern: string, option: Object) => boolean`|A basic string based search method.|| |tag|`boolean`|`false`|Whether it can create new option, should be used with `filterable`.| -|create-option|`(label: string) => SelectOption`|`label => ({ label, value: label })`|How to create a option when you input a string to create a option. Note that `filter` will be applied to the option too. And make sure the value of the created option is not the same as any other option.| +|on-create|`(label: string) => SelectOption`|`label => ({ label, value: label })`|How to create a option when you input a string to create a option. Note that `filter` will be applied to the created option too. And make sure the value of the created option is not the same as any other option.| ## API ### SelectOption Type diff --git a/demo/documentation/components/select/zhCN/index.md b/demo/documentation/components/select/zhCN/index.md index e634cfdca..6dc8a7eb7 100644 --- a/demo/documentation/components/select/zhCN/index.md +++ b/demo/documentation/components/select/zhCN/index.md @@ -25,6 +25,7 @@ action ## Props |名称|类型|默认值|说明| |-|-|-|-| +|theme|`'light' \| 'dark'`|`null`|| |loading|`boolean`|`false`|| |clearable|`boolean`|`false`|| |value|`Array \| string \| number`|`false`|| @@ -37,7 +38,7 @@ action |filterable|`boolean`|`false`|是否可以过滤| |filter|`(pattern: string, option: Object) => boolean`|一个简单的字符串搜索算法|| |tag|`boolean`|`false`|是否可以创建新的选项,需要和 `filterable` 一起使用| -|create-option|`(label: string) => SelectOption`|`label => ({ label, value: label })`|在输入内容时如何创建一个选项。注意 `filter` 对这个选项同样会生效。同时确保这个选项和其他选项的 `value` 不要有重复| +|on-create|`(label: string) => SelectOption`|`label => ({ label, value: label })`|在输入内容时如何创建一个选项。注意 `filter` 对这个生成的选项同样会生效。同时确保这个选项和其他选项的 `value` 不要有重复| ## API diff --git a/src/Radio/src/Radio.vue b/src/Radio/src/Radio.vue index 8946e51fb..5d9fddb66 100644 --- a/src/Radio/src/Radio.vue +++ b/src/Radio/src/Radio.vue @@ -71,6 +71,20 @@ export default { }, default: null } + }, + computed: { + syntheticTheme () { + const theme = this.theme + const NRadioGroup = this.NRadioGroup + if (theme !== null) { + return theme + } else if (NRadioGroup && NRadioGroup.syntheticTheme) { + return NRadioGroup.syntheticTheme + } else { + const NConfigProvider = this.NConfigProvider + return (NConfigProvider && NConfigProvider.syntheticTheme) || null + } + } } } diff --git a/src/Select/src/Select.vue b/src/Select/src/Select.vue index 34b78104d..335f171d1 100644 --- a/src/Select/src/Select.vue +++ b/src/Select/src/Select.vue @@ -202,7 +202,7 @@ export default { type: Boolean, default: false }, - createOption: { + onCreate: { type: Function, default: label => ({ label: label, @@ -494,7 +494,7 @@ export default { this.beingCreatedOptions = [] return } - const optionBeingCreated = this.createOption(value) + const optionBeingCreated = this.onCreate(value) if ( this.adpatedOptions.some( option => option.value === optionBeingCreated.value