Skip to content

Commit

Permalink
Merge branch 'docs'
Browse files Browse the repository at this point in the history
  • Loading branch information
07akioni committed Sep 25, 2024
2 parents 305055f + 42097e7 commit 122f47c
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions demo/pages/docs/customize-theme/enUS/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ If `theme` is `undefined` it won't affect the theme of components inside.
</script>
```

## Get theme vars

Whether it's the default light theme (`lightTheme`), the modified dark theme (`darkTheme`), or the custom theme we adjusted, you can get theme variables within the scope of the theme using [useThemeVars](./theme#use-theme-vars).

## Customizing theme vars (design tokens)

No CSS (Scss, Less) needed.
Expand Down
4 changes: 4 additions & 0 deletions demo/pages/docs/customize-theme/zhCN/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ Naive UI 通过使用 `n-config-provider` 调整主题。
</script>
```

## 获取主题变量

无论是默认的亮色主题(`lightTheme`),还是修改后的暗色主题(`darkTheme`),亦或我们通过调整得到的自定义主题,在该主题生效范围内的组件中都可以通过 [useThemeVars](./theme#use-theme-vars) 来获取主题变量。

## 调整主题变量

你不需要写任何 CSS(Scss、Less...)。
Expand Down
2 changes: 2 additions & 0 deletions src/checkbox/demos/enUS/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ focus.vue
| Name | Type | Default | Description |
| --- | --- | --- | --- |
| checked | `boolean` | `false` | Whether the checkbox is being checked manually. |
| checked-value | `string \| boolean \| number` | `true` | Value of checked state. |
| default-checked | `boolean` | `false` | Whether the checkbox is checked by default. |
| disabled | `boolean` | `false` | Whether the checkbox is disabled. |
| focusable | `boolean` | `true` | Whether the checkbox gains focus after being checked. |
| indeterminate | `boolean` | `false` | Whether the checkbox can have a third indeterminate state. |
| label | `string` | `undefined` | Checkbox label. |
| size | `'small' \| 'medium' \| 'large'` | `'medium'` | The size of the checkbox. |
| unchecked-value | `string \| boolean \| number` | `false` | Value of unchecked state. |
| value | `string \| number` | `undefined` | The value of the checkbox to be used in a checkbox group. |
| on-update:checked | `(checked: boolean) => void` | `undefined` | Callback function triggered on a checked status change. |

Expand Down
2 changes: 2 additions & 0 deletions src/checkbox/demos/zhCN/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ rtl-debug.vue
| 名称 | 类型 | 默认值 | 说明 |
| --- | --- | --- | --- |
| checked | `boolean` | `false` | 受控状态下是否选中 |
| checked-value | `string \| boolean \| number` | `true` | 选中时对应的值 |
| default-checked | `boolean` | `false` | 非受控模式下默认是否选中 |
| disabled | `boolean` | `false` | 是否禁用 |
| focusable | `boolean` | `true` | 是否可被 focus |
| indeterminate | `boolean` | `false` | 是否部分选中 |
| label | `string` | `undefined` | Checkbox 的标签 |
| size | `'small' \| 'medium' \| 'large'` | `'medium'` | 组件尺寸 |
| unchecked-value | `string \| boolean \| number` | `false` | 未选中时对应的值 |
| value | `string \| number` | `undefined` | Checkbox 在 checkbox group 中使用的值 |
| on-update:checked | `(checked: boolean) => void` | `undefined` | 当 checked 改变时触发的回调函数 |

Expand Down
1 change: 0 additions & 1 deletion src/popover/demos/enUS/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ slots.vue
| scrollable | `boolean` | `false` | Whether the popover's content is scrollable. | 2.28.3 |
| show-arrow | `boolean` | `true` | Whether to show arrow if set. | |
| show | `boolean` | `undefined` | Whether to show popover. | |
| title | `string` | `undefined` | Popover title. | |
| to | `string \| HTMLElement \| false` | `'body'` | Container node of the popover content. `false` will keep it at trigger container. | |
| trigger | `'hover' \| 'click' \| 'focus' \| 'manual'` | `'hover'` | The popover trigger type. | |
| width | `number \| 'trigger'` | `undefined` | `'trigger'` means popover's width will follow its trigger's width. | |
Expand Down
1 change: 0 additions & 1 deletion src/popover/demos/zhCN/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ center-arrow-debug.vue
| scrollable | `boolean` | `false` | popover 内容是否可滚动 | 2.28.3 |
| show-arrow | `boolean` | `true` | 是否显示箭头 | |
| show | `boolean` | `undefined` | 是否展示 popover | |
| title | `string` | `undefined` | popover 的 title 信息 | |
| to | `string \| HTMLElement \| false` | `'body'` | 弹出内容的目标容器位置,`false` 会待在原地 | |
| trigger | `'hover' \| 'click' \| 'focus' \| 'manual'` | `'hover'` | popover 的触发方式 | |
| width | `number \| 'trigger'` | `undefined` | `'trigger'` 表示 popover 的宽度会和它的触发元素一致 | |
Expand Down
2 changes: 1 addition & 1 deletion src/switch/demos/enUS/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ icon.vue
| round | `boolean` | `true` | Whether the switch has rounded corners. | |
| rubber-band | `boolean` | `true` | Whether the switch button has rubber band effect. | 2.28.3 |
| size | `'small' \| 'medium' \| 'large'` | `'medium'` | The size of the switch. | |
| unchecked-value | `string \| boolean \| number` | `false` | Value of checked state. | |
| unchecked-value | `string \| boolean \| number` | `false` | Value of unchecked state. | |
| value | `string \| number \| boolean \| undefined` | `undefined` | Value when being set manually. | |
| on-update:value | `(value: boolean) => void` | `undefined` | Callback when the component's value changes. | |

Expand Down
4 changes: 2 additions & 2 deletions src/upload/demos/enUS/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ download.vue
| trigger-class | `string` | `undefined` | Class of trigger area. | 2.36.0 |
| trigger-style | `Object \| string` | `undefined` | Style of trigger area. | 2.29.1 |
| with-credentials | `boolean` | `false` | Any credentials to be sent with the request (e.g. cookie). | |
| on-change | `(options: { file: UploadFileInfo, fileList: Array<UploadFileInfo>, event?: Event }) => void` | `() => {}` | Uploaded file(s) status change callback. | |
| on-change | `(options: { file: UploadFileInfo, fileList: Array<UploadFileInfo>, event?: Event }) => void` | `undefined` | Uploaded file(s) status change callback. | |
| on-error | `(options: { file: UploadFileInfo, event?: ProgressEvent }) => UploadFileInfo \| void` | `undefined` | Upload failed callback. | 2.24.0 |
| on-finish | `(options: { file: UploadFileInfo, event?: Event }) => UploadFileInfo \| undefined` | `({ file }) => file` | Upload finished callback. You can intercept and even modify the uploaded `UploadFileInfo`. Note: file will be null in next event-loop | |
| on-before-upload | `(options: { file: UploadFileInfo, fileList: Array<UploadFileInfo> }) => (Promise<boolean \| void> \| boolean \| void)` | `true` | Upload ready to start callback. Returning `false`, a promise resolved with `false`, or a rejected promise will cancel the upload. | |
| on-download | `(file: FileInfo) => void` | `undefined` | Callback for clicking download buttons. Returning `false`, `Promise resolve false`, `Promise rejected` will cancel the download. | |
| on-download | `(file: FileInfo) => Promise<boolean> \| boolean \| any` | `undefined` | Callback for clicking download buttons. Returning `false`, `Promise resolve false`, `Promise rejected` will cancel the download. | |
| on-preview | `(file: FileInfo, detail: { event: MouseEvent }) => void` | `undefined` | Callback for clicking file links or preview buttons. You can use `preventDefault` to prevent default anchor link open behavior. | `detail.event` 2.39.0 |
| on-remove | `(options: { file: UploadFileInfo, fileList: Array<UploadFileInfo>, index: number }) => Promise<boolean> \| boolean \| any` | `() => true` | File removed callback. Returning `false`, a promise resolved with `false`, or a rejected promise will cancel this removal. | `index` 2.38.2 |
| on-retry | `(options: { file: UploadFileInfo }) => (Promise<boolean \| void> \| boolean \| void)` | `undefined` | Click retry callback function. Returning `false`, a promise resolved with `false`, or a rejected promise will cancel the retry. | NEXT_VERSION |
Expand Down
4 changes: 2 additions & 2 deletions src/upload/demos/zhCN/index.demo-entry.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ debug.vue
| trigger-class | `string` | `undefined` | 触发器区域的类名 | 2.36.0 |
| trigger-style | `Object \| string` | `undefined` | 触发器区域的样式 | 2.29.1 |
| with-credentials | `boolean` | `false` | 是否携带 Cookie | |
| on-change | `(options: { file: UploadFileInfo, fileList: Array<UploadFileInfo>, event?: Event }) => void` | `() => {}` | 组件状态变化的回调,组件的任何文件状态变化都会触发回调 | |
| on-change | `(options: { file: UploadFileInfo, fileList: Array<UploadFileInfo>, event?: Event }) => void` | `undefined` | 组件状态变化的回调,组件的任何文件状态变化都会触发回调 | |
| on-error | `(options: { file: UploadFileInfo, event?: ProgressEvent }) => UploadFileInfo \| void` | `undefined` | 文件上传失败的回调 | 2.24.0 |
| on-finish | `(options: { file: UploadFileInfo, event?: ProgressEvent }) => UploadFileInfo \| undefined` | `({ file }) => file` | 文件上传结束的回调,可以修改传入的 UploadFileInfo 或者返回一个新的 UploadFileInfo。注意:file 将会下一次事件循环中被置为 null | |
| on-before-upload | `(options: { file: UploadFileInfo, fileList: UploadFileInfo[] }) => (Promise<boolean \| void> \| boolean \| void)` | `undefined` | 文件上传之前的回调,返回 `false``Promise resolve false``Promise rejected` 时会取消本次上传 | |
| on-download | `(file: FileInfo) => void` | `undefined` | 点击文件下载按钮的回调函数,返回 `false``Promise resolve false``Promise rejected` 时会取消本次下载 | |
| on-download | `(file: FileInfo) => Promise<boolean> \| boolean \| any` | `undefined` | 点击文件下载按钮的回调函数,返回 `false``Promise resolve false``Promise rejected` 时会取消本次下载 | |
| on-preview | `(file: FileInfo, detail: { event: MouseEvent }) => void` | `undefined` | 点击文件链接或预览按钮的回调函数,你可以通过 `preventDefault` 来取消默认的链接打开行为 | `detail.event` 2.39.0 |
| on-remove | `(options: { file: UploadFileInfo, fileList: Array<UploadFileInfo>, index: number }) => Promise<boolean> \| boolean \| any` | `() => true` | 文件删除回调,返回 `false``Promise resolve false``Promise rejected` 时会取消本次删除 | `index` 2.38.2 |
| on-retry | `(options: { file: UploadFileInfo }) => (Promise<boolean \| void> \| boolean \| void)` | `undefined` | 点击重试的回调函数,返回 `false``Promise resolve false``Promise rejected` 时会取消本次重试 | NEXT_VERSION |
Expand Down

0 comments on commit 122f47c

Please sign in to comment.