tusen-ai / naive-ui Goto Github PK
View Code? Open in Web Editor NEWA Vue 3 Component Library. Fairly Complete. Theme Customizable. Uses TypeScript. Fast.
Home Page: https://www.naiveui.com
License: MIT License
A Vue 3 Component Library. Fairly Complete. Theme Customizable. Uses TypeScript. Fast.
Home Page: https://www.naiveui.com
License: MIT License
I think the card component can add a prop to control the shadow effect of the card, like:
This prop can replace the current hoverable
prop.
<n-card shadow="never">
...
</n-card>
Name | Type | Default |
---|---|---|
shadow | 'always' | 'hover' | 'never' |
'never' |
GoGo
GoGo
Refer to react-ellipsis.
I think these features are necessary for an Ellipsis component:
I can make a pr with pleasure if in need.
This makes customizing the datable more intuitive by allowing use of automatically imported components (vite-plugin-components) using slots rather than the render function
https://codesandbox.io/embed/restless-waterfall-20ggg
just add : :modes="['hex']"
to color picker component.
Ref : https://www.naiveui.com/en-US/dark/components/color-picker
i wanna lock the color picker to hexa only
when i force hex mode only, RGBA still in the selection. For my case, RGBA is the default mode.
Thanks :D
<n-input
v-model:value="form.functionalExpectations"
type="textarea"
placeholder="请输入"
:autosize="{ minRows: 2, maxRows: 5 }"
></n-input>
When I set the minRows
and maxRows
properties at the same time, entering a lot of text will stretch the textarea horizontally
发现TreeSelect
组件没有提供,但我觉得是不是抽象出来一个下拉容器组件更加容易实现select的各种需求
https://xuliangzhan_admin.gitee.io/vxe-table/v4/table/module/pulldown
https://codesandbox.io/s/silly-smoke-h733h?file=/src/Demo.vue
Add x or y, not working. Add both, default slot disappear.
virtual-scroll
1.关于Data Table的虚拟化是否支持树形?
2.关于Tree的虚拟化是否支持不开启虚拟话的正常功能?例如复选和单选!
Hi, it's a little question. I feel confused with this statement in the docs.
All the staff in Naive UI is wrote in TypeScript. It can work with your typescript project seamlessly.
do you mean All of the stuffs?
There are designs that are infeasible to implement without the support of a generic horizontal toolbar component. For example, I want to implement a toolbar that displays some summary information on the left, a lightweight pagination component in the middle, and some action buttons on the right. It isn't possible to implement this kind of design with the menu component because it expects all items to be traditional text-based menu items with a label.
An <n-toolbar>
component is required that carries with it some default styling for what you'd expect a toolbar to look like.
GoGo
GoGo
daterange类型的选择器在actions缺失confirm时实际上无法选择时间
daterange类型的选择器在actions缺失confirm时是否可以支持默认选中结束时间来结束选择
2.11.8
3.1.1
Chrome
MacOS
GOGOG
Cool
Cool
Cool
https://www.naiveui.com/zh-CN/light/components/button
点开上面的code文档,下面的演示button样式变形
SFC Code:
<template>
<NInput v-model:value="value" type="input"></NInput>
<input v-model="value" />
<button @click="onClick">Button</button>
</template>
<script>
import { NInput } from "naive-ui";
import { ref } from "vue";
export default {
components: {
NInput: NInput,
},
setup() {
const value = ref("");
const onClick = () => {
value.value = undefined;
};
return {
value,
onClick,
};
},
};
</script>
After the button is clicked, the result of native input and n-input to be the same
value display in n-input is not cleared
https://codesandbox.io/s/ts-error-in-nmenu-and-ncalendar-77xxs?file=/src/App.vue
I use vite
and vue-ts
as my startup project, every thing is ok in dev server, but when I try to run yarn vue-tsc --noEmit && vite build
got some ts error. And I found both of error come from @update:value
method.
# Create a vue-ts project and install naive-ui
$ yarn create @vitejs/app naive-test --template vue-ts && cd naive-test && yarn
$ yarn add naive-ui
// App.vue
<template>
<NCalendar @update:value="handleUpdateCalendarValue">
<template #="{ year, month, date }"> </template>
</NCalendar>
<NMenu @update:value="handleUpdateMenuValue" :options="menuOptions" />
</template>
<script lang="ts">
import { defineComponent } from "vue";
import { MenuOption, NCalendar, NMenu } from "naive-ui";
export default defineComponent({
name: "App",
components: {
NCalendar,
NMenu,
},
setup() {
const menuOptions = [
{
label: "Item1",
key: "item1",
},
{
label: "Item2",
key: "item2",
},
];
const handleUpdateCalendarValue = (
timestamp: number,
{ year, month, date }: { year: number; month: number; date: number }
) => {
console.log({ timestamp, year, month, date });
};
const handleUpdateMenuValue = (key: string, item: MenuOption) => {
console.log("key =>", key);
console.log("item =>", item);
};
return {
handleUpdateCalendarValue,
menuOptions,
handleUpdateMenuValue,
};
},
});
</script>
$ yarn vue-tsc --noEmit
No error in typescript check.
https://codesandbox.io/s/naive-ui-test-vi95j?file=/src/App.vue:1326-1347
click reset botton
the form can be reset
The form does not have a method called clearValidationEffect ,and with an error,but i found a method called restoreValidation,it is useful for clear validation ,but not for form's value
Should make it cursor pointer
It would be great if you could add dates to the changelog for new entries going forward. This would allow people to more easily see when the most recent releases occurred. It's okay to leave old entries as-is, but it would be really appreciated if new entries could be dated 🙏
You might also want to consider creating a git tag for each release too.
When you set the header-style
prop on an <n-card>
element, the styles are applied to the .n-card-header__main
element, not the .n-card-header
. The padding is applied to the .n-card-header
element, which means there is no nice way to reduce this padding if desired.
The documentation suggests that rowKey
can be either a String
or a Function
, but the type of the prop is defined only as a Function
. Attempting to pass a String
results in a warning from the Vue core.
In the doc, options are optional.
error | (content: string, option?: MessageOption) => MessageReactive
info | (content: string, option?: MessageOption) => MessageReactive
loading | (content: string, option?: MessageOption) => MessageReactive
success | (content: string, option?: MessageOption) => MessageReactive
warning | (content: string, option?: MessageOption) => MessageReactive
But in the node_modules\naive-ui\lib\message\src\MessageProvider.d.ts
export interface MessageApiInjection {
info: (content: string, options: MessageOptions) => MessageReactive;
success: (content: string, options: MessageOptions) => MessageReactive;
warning: (content: string, options: MessageOptions) => MessageReactive;
error: (content: string, options: MessageOptions) => MessageReactive;
loading: (content: string, options: MessageOptions) => MessageReactive;
}
I think this is a mistake.
Tu-Simple, sometimes naive ;-)
If a button only has an icon and no label, the icon should be larger by default. This is necessary because it's the only thing to click on.
Right now even if you've set the size of the button to large
, the icon will only be a maximum of 20px in size. You can set size="40"
(for example) on the n-icon
element, but then the presentation goes all whacky because the icon slot container element is still set to have a size of 20px.
A new prop named something like icon
would be a good idea.
Here you can see the icon buttons overlapping each other:
如题
如代码,在dropdown中,透传给popover组件的trigger slot 为什么是 default
,然后下面又重新传了 default
函数,我在写dropdown 单测时,传入 trigger
发现始终未生效
如文档所示,trigger
应该是 触发弹出的元素
we can custom column in template with slot
// template:
<n-data-table :columns="columns" :data="data" >
<template #slotName="{value,row,columnProp}" >
<span >{{row.title}} {{value}} Custom things</span>
</template>
</n-data-table>
........
// script:
setup() {
return {
data:[],
columns:[{
key:'name',
title: 'name',
slot:'slotName'
}]
}
}
It would be nice to have a slot exposed for custom actions in the Date Picker to augment the three that are available. This way you can add buttons on the component itself for your own predefined date range's such as This Month, Last Week, etc.
If an error occurs while loading the data used to fill the data table, I would like to show an error message rather than just saying "No data".
Other frameworks tend to handle this with a slot.
see https://vuejs.org/v2/style-guide/index.html#Component-name-casing-in-templates-strongly-recommended
In most projects, component names should always be PascalCase in single-file components
...
using kebab-case everywhere is also acceptable
It seems that it will be great if we change demo codes from from kebab-case to PascalCase
Although it's ok to use the onchange event, it would be more convenient with file-list two way boninded. Since it's not two way binded, it cannot be validated together with other form items. The app I'm building requires an upload that accepts one zip file or multiple pdf files
v-model:file-list:"fileList"
I have some interest in naive-ui and am browsing the documentation. This error occurs when I tried the demo in the documentation.
https://www.naiveui.com/zh-CN/light/components/dropdown
Right click in the green square more than three times.
For the first two click, the dropdown
component opens where I clicked. But from the third click, it will never change position.
Maybe change the position?
See above.
I also tried the demo in the sandbox. I noticed that the xRef.value
and yRef.value
changed as I clicked, but the position of the component did not change. But I am new to vue3, so I can't locate where is the problem.
Multiple progress on one bar, or a progress bar with steps and customisation for each steps
<template>
<n-group-progress merged>
<!-- All progress bars will be merged in one progress bar -->
<n-progress type="line" status="info" :percentage="10" :show-indicator="false" />
<n-progress type="line" status="success" :percentage="20" :show-indicator="false" />
<n-progress type="line" status="warning" :percentage="30" :show-indicator="false" />
</n-group-progress>
</template>
<template>
<n-group-progress merged :steps="[30, 60]">
<!-- The progress bar will be split in 3 parts the second will start a 30% and the third at 60% of total width, like with the slider component mark attribute -->
<n-progress type="line" status="info" :percentage="10" :show-indicator="false" />
<n-progress type="line" status="success" :percentage="20" :show-indicator="false" />
<n-progress type="line" status="warning" :percentage="30" :show-indicator="false" />
</n-group-progress>
</template>
2.11.11
3.1.1
Chrome 最新版
Windows 最新版
请看这个文档,https://www.naiveui.com/zh-CN/os-theme/components/slider
on-update:value="onChange"
@update:value="onChange"
文档中,对于 update 事件的描述是 on-update:value,而实际在 vue3 里的写法是 @update:value ,这样的文档写法是否可以改进一下?或者建议加上关于 on-update 的例子
Hello,
Really nice library. Thanks for sharing.
Playing around with table component and not able handle onClick event on table row. Documentation says there is only one event onSelect in selection mode but this is other usecase.
Just propagate event on table props ( onRowSelect:(record:T(any)) => void; )
Btw really nice styles - so clean! Gj
https://www.naiveui.com/zh-CN/os-theme/components/badge#processing
现在处理中的动画,感觉上有点闪烁速度有点快
在设置 value
后没有动画,设计上就是这样么
Menu items should have the option of creating router-link
components to support native routing functionality provided by Vue Router. This should also ensure actual <a>
tags are generated, so as to be more friendly to accessibility.
I find there're two issues on the doc website:
[role="button"]
, like dropdown menuitems, radio buttons and breadcrumbsdisabled
components still has click listeners but no [aria-disabled]
is added, like cascader menuitems and checkboxes<input>
is wrapped by <div>
s, and the div.n-input
has a click listener but without [aria-hidden=true]
I have an extension "Vimium C" to help users use keyboard to click page elements, and when it find links, it will pick those with [role=button], [role=link]
and filter out those [aria-hidden], [aria-disabled], [aria-hidden=true], [aria-disabled=true]
. It also hooks the global addEventListener
function to learn what "plain" elements are clickable.
When I tested Vimium C's LinkHints.activate
(triggered by f
) on pages like https://www.naiveui.com/zh-CN/os-theme/components/input , I found many clickable were not recognized, while many others were mistakenly hinted.
So I want this framework to add more clues to let such keyboard helper extensions work better.
https://www.naiveui.com/zh-CN/light/components/spin
官网例子
流畅动画
闪烁
增强友好,右击出现dropdown后不一定选择某项之后才能关闭,点击dropdown外部它也应该关闭
https://ant.design/components/dropdown-cn/
他应该像antd一样出现之后,再次点击任何位置就关闭了
When I use time-picker
to quickly select a time, I wish to just leave the value not disabled on the panel.
Such as I disable every 10 minutes(enable 0, 10, 20...), to choose 08:00, 08:10, 08:20...
But the panel show 9 disabled value and 1 enable value.
It not make me choose value faster but slow down.
So i think if you can add a prop to control the show/hide of disabled hours(minutes, seconds), because these values
have been disabled
by user, means user don't want to use them, so these disabled value should not be shown by default.
The disabled value should not show by default.
<template>
<n-time-picker
v-model:value="time0"
:show-disabled="true"
:is-hour-disabled="isHourDisabled"
:is-minute-disabled="isMinuteDisabled"
:is-second-disabled="isSecondDisabled"
/>
</template>
name | type | default value |
---|---|---|
show-disabled | boolean | false |
Thank your!
RTL(Right to Left) support is a very import feature for the component library. However it'll take great efforts to fulfill the feature since all of the components need to implement extra styles, thus we need your help to achieve the goal.
We've add experimental RTL feature for n-button
, n-tag
, n-page-header
and n-card
. If you are interested in contributing to the RTL feature, please reference those components.
Here are some discussion about tech detail about implementation.
In general, Naive UI has an internal useRtl
composable to mount & update rtl style on demand. It accepts RTL styles passed from n-config-provider
and takes adventage of the style.
The component that supports RTL has a style file in component-name/styles/rtl.ts
, which exports { name: 'ComponentName', style: CssRenderStyle }
.
Here are some components in need RTL support.If you intresting in it,feel free to commont.We will convert it to issue for you,then you can work on it.
affix
alert
anchor
auto-complete
back-top
breadcrumb
calendar
card
caroulsel
cascader
checkbox
code
collapse
collapse-transition
color-piker
data-table
date-piker
description
dailog
divider
drawer
dropdown
dynamic-input
dynamic-tags
element
ellipsis
empty
form
gradient-text
input
input-number
layout
list
loading-bar
log
menu
mention
message
modal
notification
page-header
pagination
popconfirm
popover
popselect
progress
radio
rate
result
scrollbar
select
skeleton
slider
space
spin
statistic
steps
switch
table
tabs
tag
thing
time
time-picker
timeline
tooltip
transfer
tree
tree-select
typography
upload
watermark
In the select component remote feature (single and multiple) documents, there is an unused variable noDataContent
in the sample code, is it the var for placeholder?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.