Skip to content

Commit

Permalink
Merge branch 'main' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
07akioni committed Nov 25, 2024
2 parents 705e8fc + d507910 commit 05feb30
Show file tree
Hide file tree
Showing 1,521 changed files with 5,984 additions and 4,406 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# CHANGELOG

## 2.40.2

`2025-11-26`

### Fixes

- Fix `n-time-picker`'s `use-12-hours` type error warning, closes [#4308](https://github.com/tusen-ai/naive-ui/issues/4308)
- Fix `input-number` the problem that the negative sign is replaced when the negative sign is entered.
- Fix `n-data-table`'s header will show scrollbar in some old browsers, closes [#6557](https://github.com/tusen-ai/naive-ui/issues/6557).

### Features

- 🌟 Adds `n-marquee` component.
- `n-image` adds `error` slot, closes [#5649](https://github.com/tusen-ai/naive-ui/issues/5649).
- `n-date-picker` adds `date-format` prop.
- `n-date-picker` adds `calendar-day-format` prop.
- `n-date-picker` adds `calendar-header-year-format` prop.
- `n-date-picker` adds `calendar-header-month-format` prop.
- `n-date-picker` adds `calendar-header-month-before-year` prop.
- `n-date-picker` adds `calendar-header-month-year-separator` prop.
- `n-progress`'s `color` prop supports gradient config.
- `n-select` adds `font-weight` theme variable
- `n-input` adds `font-weight` theme variable
- `n-data-table` adds `get-csv-header` and `get-csv-cell` props, closes [#6542](https://github.com/tusen-ai/naive-ui/issues/6542).

## 2.40.1

`2024-09-26`
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# CHANGELOG

## 2.40.2

`2025-11-26`

### Fixes

- `n-time-picker``use-12-hours` 类型错误警告,关闭 [#4308](https://github.com/tusen-ai/naive-ui/issues/4308)
- 修复 `input-number` 存在负号时被替换的问题
- 修复 `n-data-table` 的 header 在部分浏览器中会出现滚动条,关闭 [#6557](https://github.com/tusen-ai/naive-ui/issues/6557)

### Features

- 🌟 新增 `n-marquee` 组件
- `n-image` 新增 `error` 插槽,关闭 [#5649](https://github.com/tusen-ai/naive-ui/issues/5649)
- `n-date-picker` 新增 `date-format` 属性
- `n-date-picker` 新增 `calendar-day-format` 属性
- `n-date-picker` 新增 `calendar-header-year-format` 属性
- `n-date-picker` 新增 `calendar-header-month-format` 属性
- `n-date-picker` 新增 `calendar-header-month-before-year` 属性
- `n-date-picker` 新增 `calendar-header-month-year-separator` 属性
- `n-progress``color` 属性支持渐变色配置
- `n-select` 新增 `font-weight` 主题变量
- `n-input` 新增 `font-weight` 主题变量
- `n-data-table` 新增 `get-csv-header``get-csv-cell` 属性,关闭 [#6542](https://github.com/tusen-ai/naive-ui/issues/6542)

## 2.40.1

`2024-09-26`
Expand Down
2 changes: 1 addition & 1 deletion build/loaders/convert-md-to-doc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('node:path')
const fse = require('fs-extra')
const { marked } = require('marked')
const camelCase = require('lodash/camelCase')
const { marked } = require('marked')
const createRenderer = require('./md-renderer')
const projectPath = require('./project-path')

Expand Down
2 changes: 1 addition & 1 deletion build/utils/terse-cssr.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { default: generate } = require('@babel/generator')
const parser = require('@babel/parser')
const { default: traverse } = require('@babel/traverse')
const { default: generate } = require('@babel/generator')

module.exports = function terseCssr(code) {
const patternSpace = / +/g
Expand Down
4 changes: 2 additions & 2 deletions demo/Site.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import { defineComponent, onMounted } from 'vue'
import { useLoadingBar } from 'naive-ui'
import SiteHeader from './SiteHeader.vue'
import { defineComponent, onMounted } from 'vue'
import { loadingBarApiRef } from './routes/router'
import SiteHeader from './SiteHeader.vue'
import { useIsMobile } from './utils/composables'
export default defineComponent({
Expand Down
10 changes: 5 additions & 5 deletions demo/SiteHeader.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<script lang="ts">
import { MenuOutline } from '@vicons/ionicons5'
import { useMessage, version } from 'naive-ui'
import { computed, defineComponent, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useMessage, version } from 'naive-ui'
import { MenuOutline } from '@vicons/ionicons5'
import { repoUrl } from './utils/github-url'
import { i18n, useIsMobile, useIsTablet } from './utils/composables'
import { findMenuValue } from './utils/route'
import {
useComponentOptions,
useConfigProviderName,
Expand All @@ -16,6 +13,9 @@ import {
useThemeName
} from './store'
import { renderMenuLabel } from './store/menu-options'
import { i18n, useIsMobile, useIsTablet } from './utils/composables'
import { repoUrl } from './utils/github-url'
import { findMenuValue } from './utils/route'
// match substr
function match(pattern, string) {
Expand Down
2 changes: 1 addition & 1 deletion demo/SiteRoot.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { initRouter, siteSetup } from './store'
import Site from './Site.vue'
import { initRouter, siteSetup } from './store'
export default defineComponent({
name: 'SiteProvider',
Expand Down
4 changes: 2 additions & 2 deletions demo/index.dev.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createApp } from 'vue'
import naive, { NThemeEditor } from '../src/index'
import createDemoRouter from './routes/router'
import { routes } from './routes/routes'
import { installDemoComponents } from './setup'
import SiteRoot from './SiteRoot.vue'
import { routes } from './routes/routes'
import createDemoRouter from './routes/router'

const app = createApp(SiteRoot)

Expand Down
6 changes: 3 additions & 3 deletions demo/index.prod.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createApp } from 'vue'
import naive, { NThemeEditor } from 'naive-ui'
import { createApp } from 'vue'
import createDemoRouter from './routes/router'
import { routes } from './routes/routes'
import { installDemoComponents } from './setup'
import SiteRoot from './SiteRoot.vue'
import { routes } from './routes/routes'
import createDemoRouter from './routes/router'

const app = createApp(SiteRoot)

Expand Down
6 changes: 3 additions & 3 deletions demo/pages/Layout.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script lang="ts">
import { useMemo } from 'vooks'
// Frame component for components & docs page
import { computed, defineComponent, ref, toRef, watch } from 'vue'
import { useRoute } from 'vue-router'
import { useMemo } from 'vooks'
import { findMenuValue } from '../utils/route'
import { useIsMobile, useIsTablet } from '../utils/composables'
import { useComponentOptions, useDocOptions } from '../store'
import { renderMenuLabel } from '../store/menu-options'
import { useIsMobile, useIsTablet } from '../utils/composables'
import { findMenuValue } from '../utils/route'
import SiteFooter from './home/Footer.vue'
export default defineComponent({
Expand Down
14 changes: 7 additions & 7 deletions demo/pages/docs/import-on-demand/enUS/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ You can use the `unplugin-auto-import` plugin to automatically import APIs.
If you develop using SFC, you can use the `unplugin-vue-components` plugin to automatically import components on demand.The plugin will automatically parse the components used in the template and import the components.

```ts
// vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
// vite.config.ts
import { defineConfig } from 'vite'

// https://vitejs.dev/config/
export default defineConfig({
Expand Down Expand Up @@ -91,13 +91,13 @@ export default defineConfig({
## Install on Demand Globally

```js
import { createApp } from 'vue'
import {
// component
NButton,
// create naive ui
create
create,
// component
NButton
} from 'naive-ui'
import { createApp } from 'vue'

const naive = create({
components: [NButton]
Expand Down
14 changes: 7 additions & 7 deletions demo/pages/docs/import-on-demand/zhCN/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ Naive UI 支持 tree shaking,组件、语言、主题均可 tree-shaking。
如果使用模板方式进行开发,可以使用 `unplugin-vue-components` 插件来按需自动加载组件,插件会自动解析模板中的使用到的组件,并导入组件。

```ts
// vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
// vite.config.ts
import { defineConfig } from 'vite'

// https://vitejs.dev/config/
export default defineConfig({
Expand Down Expand Up @@ -91,13 +91,13 @@ export default defineConfig({
## 按需全局安装组件(手动)

```js
import { createApp } from 'vue'
import {
// component
NButton,
// create naive ui
create
create,
// component
NButton
} from 'naive-ui'
import { createApp } from 'vue'

const naive = create({
components: [NButton]
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/jsx/enUS/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ For how to enable JSX & TSX, please look at your toolchain's docs.
We recommend importing components directly when using JSX.

```js
import { defineComponent } from 'vue'
import { NButton } from 'naive-ui'
import { defineComponent } from 'vue'

export default defineComponent({
render() {
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/jsx/zhCN/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
在 JSX 中,推荐以直接引入的形式使用组件。

```js
import { defineComponent } from 'vue'
import { NButton } from 'naive-ui'
import { defineComponent } from 'vue'

export default defineComponent({
render() {
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/nuxtjs/enUS/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ You can also use the `unplugin-auto-import` plugin to automatically import APIs

```ts
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/nuxtjs/zhCN/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ pnpm dlx nuxi module add nuxtjs-naive-ui

```ts
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/theme/enUS/element.demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Naive UI has `n-element` component. See [Element](../components/element).
```

```js
import { defineComponent, ref } from 'vue'
import { darkTheme } from 'naive-ui'
import { defineComponent, ref } from 'vue'

export default defineComponent({
setup() {
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/theme/enUS/provide-theme.demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Use `n-config-provider` to set the theme of all its descendant components.
```

```js
import { defineComponent, ref } from 'vue'
import { darkTheme } from 'naive-ui'
import { defineComponent, ref } from 'vue'

export default defineComponent({
setup() {
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/theme/enUS/use-theme-vars.demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Naive UI provides `useThemeVars`. It contains common theme variables.
```

```js
import { defineComponent } from 'vue'
import { useThemeVars } from 'naive-ui'
import { defineComponent } from 'vue'

export default defineComponent({
setup() {
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/theme/zhCN/element.demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Naive UI 提供 `n-element` 组件,参考 [Element](../components/element)。
```

```js
import { defineComponent, ref } from 'vue'
import { darkTheme } from 'naive-ui'
import { defineComponent, ref } from 'vue'

export default defineComponent({
setup() {
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/theme/zhCN/provide-theme.demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
```

```js
import { defineComponent, ref } from 'vue'
import { darkTheme } from 'naive-ui'
import { defineComponent, ref } from 'vue'

export default defineComponent({
setup() {
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/theme/zhCN/use-theme-vars.demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Naive UI 提供 `useThemeVars`,它包含了常见的主题变量。
```

```js
import { defineComponent } from 'vue'
import { useThemeVars } from 'naive-ui'
import { defineComponent } from 'vue'

export default defineComponent({
setup() {
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/usage-sfc/enUS/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ No tree-shaking. Bundle will have redundant codes.
If you want to install globally but don't want all components, please see [Import on Demand](import-on-demand).

```js
import { createApp } from 'vue'
import naive from 'naive-ui'
import { createApp } from 'vue'

const app = createApp(App)
app.use(naive)
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/docs/usage-sfc/zhCN/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
如果你想全局安装但是不想安装全部组件,请参考[按需引入](import-on-demand)

```js
import { createApp } from 'vue'
import naive from 'naive-ui'
import { createApp } from 'vue'

const app = createApp(App)
app.use(naive)
Expand Down
6 changes: 3 additions & 3 deletions demo/pages/docs/vitepress/enUS/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ pnpm install --save-dev @css-render/vue3-ssr
```js
// .vitepress/theme/index.js

import { defineComponent, h, inject } from 'vue'
import DefaultTheme from 'vitepress/theme'
import { NConfigProvider } from 'naive-ui'
import { setup } from '@css-render/vue3-ssr'
import { NConfigProvider } from 'naive-ui'
import { useRoute } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { defineComponent, h, inject } from 'vue'

const { Layout } = DefaultTheme

Expand Down
6 changes: 3 additions & 3 deletions demo/pages/docs/vitepress/zhCN/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ pnpm install --save-dev @css-render/vue3-ssr
```js
// .vitepress/theme/index.js

import { defineComponent, h, inject } from 'vue'
import DefaultTheme from 'vitepress/theme'
import { NConfigProvider } from 'naive-ui'
import { setup } from '@css-render/vue3-ssr'
import { NConfigProvider } from 'naive-ui'
import { useRoute } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { defineComponent, h, inject } from 'vue'

const { Layout } = DefaultTheme

Expand Down
4 changes: 2 additions & 2 deletions demo/pages/home/Footer.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { version } from 'naive-ui'
import { i18n } from '../../utils/composables'
import { defineComponent } from 'vue'
import { push } from '../../store'
import { i18n } from '../../utils/composables'
import { repoUrl } from '../../utils/github-url'
export default defineComponent({
Expand Down
Loading

0 comments on commit 05feb30

Please sign in to comment.