@oiij/naive-ui 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -15
- package/dist/components/config-providers/ConfigProviders.vue.d.ts +36 -0
- package/dist/components/config-providers/index.d.ts +1 -0
- package/dist/components/copy-button/CopyButton.vue.d.ts +31 -0
- package/dist/components/copy-button/index.d.ts +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/search-input/SearchInput.vue.d.ts +30 -0
- package/dist/components/search-input/index.d.ts +1 -0
- package/dist/components/tooltip-button/TooltipButton.vue.d.ts +29 -0
- package/dist/components/tooltip-button/index.d.ts +1 -0
- package/dist/components.cjs +1 -0
- package/dist/components.d.ts +1 -0
- package/dist/components.js +237 -0
- package/dist/components.umd.cjs +1 -0
- package/dist/index.cjs +165 -156
- package/dist/index.d.cts +45 -172
- package/dist/index.d.ts +45 -172
- package/dist/index.js +149 -143
- package/package.json +111 -93
package/README.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NaiveUI Expand
|
|
2
|
+
|
|
3
|
+
An expand component for NaiveUI.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@oiij/naive-ui)
|
|
6
|
+
[](https://github.com/oiij/naive-ui)
|
|
7
|
+
[](https://github.com/Eiog/@oiij/naive-ui/blob/main/LICENSE)
|
|
8
|
+
[](https://github.com/oiij/naive-ui)
|
|
2
9
|
|
|
3
10
|
Features:
|
|
4
11
|
|
|
@@ -11,20 +18,7 @@ Features:
|
|
|
11
18
|
pnpm add @oiij/naive-ui
|
|
12
19
|
```
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
import { useNaiveForm, useNaiveTheme } from '@oiij/naive-ui'
|
|
16
|
-
const { theme, themeOverrides, locale, dateLocale, color, setColor, } = useNaiveTheme()
|
|
17
|
-
const { formRef, formProps, formValue, rules, validate, resetValidation, resetForm, reset, clear, } = useNaiveForm({
|
|
18
|
-
value: {
|
|
19
|
-
foo: ''
|
|
20
|
-
},
|
|
21
|
-
rules: {
|
|
22
|
-
foo: {
|
|
23
|
-
required: true
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
```
|
|
21
|
+
[在线文档](https://naive-ui-mu.vercel.app/)
|
|
28
22
|
|
|
29
23
|
## License
|
|
30
24
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ConfigProviderProps, DialogProviderInst, DialogProviderProps, LoadingBarProviderInst, LoadingBarProviderProps, MessageProviderInst, MessageProviderProps, ModalProviderInst, ModalProviderProps, NotificationProviderInst, NotificationProviderProps } from 'naive-ui';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
globalStyle?: boolean;
|
|
4
|
+
configProviderProps?: ConfigProviderProps;
|
|
5
|
+
loadingBarProps?: LoadingBarProviderProps;
|
|
6
|
+
dialogProviderProps?: DialogProviderProps;
|
|
7
|
+
modalProviderProps?: ModalProviderProps;
|
|
8
|
+
notificationProviderProps?: NotificationProviderProps;
|
|
9
|
+
messageProviderProps?: MessageProviderProps;
|
|
10
|
+
};
|
|
11
|
+
declare global {
|
|
12
|
+
interface Window {
|
|
13
|
+
$dialog: DialogProviderInst;
|
|
14
|
+
$loadingBar: LoadingBarProviderInst;
|
|
15
|
+
$message: MessageProviderInst;
|
|
16
|
+
$modal: ModalProviderInst;
|
|
17
|
+
$notification: NotificationProviderInst;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
declare function __VLS_template(): {
|
|
21
|
+
attrs: Partial<{}>;
|
|
22
|
+
slots: {
|
|
23
|
+
default?(_: {}): any;
|
|
24
|
+
};
|
|
25
|
+
refs: {};
|
|
26
|
+
rootEl: any;
|
|
27
|
+
};
|
|
28
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
29
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
30
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
31
|
+
export default _default;
|
|
32
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
33
|
+
new (): {
|
|
34
|
+
$slots: S;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NConfigProviders } from './ConfigProviders.vue';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { UseClipboardOptions } from '@vueuse/core';
|
|
2
|
+
import { ButtonProps, TooltipProps } from 'naive-ui';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
value?: string;
|
|
5
|
+
config?: UseClipboardOptions<string | undefined>;
|
|
6
|
+
tooltipProps?: TooltipProps;
|
|
7
|
+
buttonProps?: ButtonProps;
|
|
8
|
+
};
|
|
9
|
+
declare function __VLS_template(): {
|
|
10
|
+
attrs: Partial<{}>;
|
|
11
|
+
slots: {
|
|
12
|
+
default?(_: {}): any;
|
|
13
|
+
icon?(_: {}): any;
|
|
14
|
+
tooltip?(_: {}): any;
|
|
15
|
+
};
|
|
16
|
+
refs: {};
|
|
17
|
+
rootEl: any;
|
|
18
|
+
};
|
|
19
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
20
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
21
|
+
copied: (v: string | undefined) => any;
|
|
22
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
+
onCopied?: ((v: string | undefined) => any) | undefined;
|
|
24
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NCopyButton } from './CopyButton.vue';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ButtonProps, InputProps } from 'naive-ui';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
value?: string;
|
|
4
|
+
autoTrigger?: boolean | number;
|
|
5
|
+
searchButton?: boolean;
|
|
6
|
+
inputProps?: InputProps;
|
|
7
|
+
buttonProps?: ButtonProps;
|
|
8
|
+
};
|
|
9
|
+
declare function __VLS_template(): {
|
|
10
|
+
attrs: Partial<{}>;
|
|
11
|
+
slots: {
|
|
12
|
+
icon?(_: {}): any;
|
|
13
|
+
button?(_: {}): any;
|
|
14
|
+
};
|
|
15
|
+
refs: {};
|
|
16
|
+
rootEl: any;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
19
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
20
|
+
"update:value": (v: string | undefined) => any;
|
|
21
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
22
|
+
"onUpdate:value"?: ((v: string | undefined) => any) | undefined;
|
|
23
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NSearchInput } from './SearchInput.vue';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ButtonProps, TooltipProps } from 'naive-ui';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
value?: string;
|
|
4
|
+
tooltipProps?: TooltipProps;
|
|
5
|
+
buttonProps?: ButtonProps;
|
|
6
|
+
};
|
|
7
|
+
declare function __VLS_template(): {
|
|
8
|
+
attrs: Partial<{}>;
|
|
9
|
+
slots: {
|
|
10
|
+
default?(_: {}): any;
|
|
11
|
+
icon?(_: {}): any;
|
|
12
|
+
tooltip?(_: {}): any;
|
|
13
|
+
};
|
|
14
|
+
refs: {};
|
|
15
|
+
rootEl: any;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
18
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
19
|
+
click: (ev: MouseEvent) => any;
|
|
20
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
21
|
+
onClick?: ((ev: MouseEvent) => any) | undefined;
|
|
22
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
24
|
+
export default _default;
|
|
25
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
26
|
+
new (): {
|
|
27
|
+
$slots: S;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NTooltipButton } from './TooltipButton.vue';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("naive-ui"),c=require("@vueuse/core"),f=e.defineComponent({__name:"ConfigProviders",props:{globalStyle:{type:Boolean,default:!1},configProviderProps:{},loadingBarProps:{},dialogProviderProps:{},modalProviderProps:{},notificationProviderProps:{},messageProviderProps:{}},setup(r){function l(){window.$dialog=t.useDialog(),window.$loadingBar=t.useLoadingBar(),window.$message=t.useMessage(),window.$modal=t.useModal(),window.$notification=t.useNotification()}const n=e.defineComponent({setup(){e.onMounted(()=>{l()})},render(){return null}});return(o,i)=>(e.openBlock(),e.createBlock(e.unref(t.NConfigProvider),e.normalizeProps(e.guardReactiveProps(o.configProviderProps)),{default:e.withCtx(()=>[e.createVNode(e.unref(t.NLoadingBarProvider),e.normalizeProps(e.guardReactiveProps(o.loadingBarProps)),{default:e.withCtx(()=>[e.createVNode(e.unref(t.NDialogProvider),e.normalizeProps(e.guardReactiveProps(o.dialogProviderProps)),{default:e.withCtx(()=>[e.createVNode(e.unref(t.NModalProvider),e.normalizeProps(e.guardReactiveProps(o.modalProviderProps)),{default:e.withCtx(()=>[e.createVNode(e.unref(t.NNotificationProvider),e.normalizeProps(e.guardReactiveProps(o.notificationProviderProps)),{default:e.withCtx(()=>[e.createVNode(e.unref(t.NMessageProvider),e.normalizeProps(e.guardReactiveProps(o.messageProviderProps)),{default:e.withCtx(()=>[e.renderSlot(o.$slots,"default"),e.createVNode(e.unref(n))]),_:3},16)]),_:3},16)]),_:3},16)]),_:3},16)]),_:3},16),o.globalStyle?(e.openBlock(),e.createBlock(e.unref(t.NGlobalStyle),{key:0})):e.createCommentVNode("",!0)]),_:3},16))}}),v=e.defineComponent({__name:"CopyButton",props:{value:{},config:{},tooltipProps:{},buttonProps:{}},emits:["copied"],setup(r,{emit:l}){const n=l,{copied:o,copy:i}=c.useClipboard({source:r.value,...r.config});e.watch(o,()=>{o.value&&n("copied",r.value)});function u(s){s.preventDefault(),i()}return(s,a)=>(e.openBlock(),e.createBlock(e.unref(t.NTooltip),e.normalizeProps(e.guardReactiveProps(s.tooltipProps)),{trigger:e.withCtx(()=>[e.createElementVNode("span",{style:{cursor:"pointer"},onClick:u},[e.renderSlot(s.$slots,"default",{},()=>[e.createVNode(e.unref(t.NButton),e.mergeProps({quaternary:"",size:"tiny"},s.buttonProps),{icon:e.withCtx(()=>[e.renderSlot(s.$slots,"icon",{},()=>[a[0]||(a[0]=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"},[e.createElementVNode("path",{fill:"#757575",d:"M18.355 6.54h-1.94V4.69a2.69 2.69 0 0 0-1.646-2.484A2.7 2.7 0 0 0 13.745 2h-8.05a2.68 2.68 0 0 0-2.67 2.69v10.09a2.68 2.68 0 0 0 2.67 2.69h1.94v1.85a2.68 2.68 0 0 0 2.67 2.68h8a2.68 2.68 0 0 0 2.67-2.68V9.23a2.69 2.69 0 0 0-2.62-2.69M7.635 9.23v6.74h-1.94a1.18 1.18 0 0 1-1.17-1.19V4.69a1.18 1.18 0 0 1 1.17-1.19h8.05a1.18 1.18 0 0 1 1.17 1.19v1.85h-4.61a2.69 2.69 0 0 0-2.67 2.69"})],-1))])]),_:3},16)])])]),default:e.withCtx(()=>[e.renderSlot(s.$slots,"tooltip",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(o)?"复制成功":"复制"),1)])]),_:3},16))}}),P=({delay:r},l)=>{let n,o=!0;const i=(...u)=>{o?(clearTimeout(n),n=setTimeout(()=>{o&&l(...u),n=void 0},r)):l(...u)};return i.isPending=()=>n!==void 0,i.cancel=()=>{o=!1},i.flush=(...u)=>l(...u),i},g=e.defineComponent({__name:"SearchInput",props:{value:{},autoTrigger:{type:[Boolean,Number],default:!0},searchButton:{type:Boolean,default:!0},inputProps:{},buttonProps:{}},emits:["update:value"],setup(r,{emit:l}){const n=l,o=e.ref(r.value);e.watch(()=>r.value,a=>{o.value=a});const i=P({delay:typeof r.autoTrigger=="number"?r.autoTrigger:500},()=>{n("update:value",o.value)});e.watch(o,()=>{r.autoTrigger&&i()});function u(){n("update:value",o.value)}function s(a){a.key==="Enter"&&u()}return(a,d)=>(e.openBlock(),e.createBlock(e.unref(t.NInputGroup),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t.NInput),e.mergeProps({value:o.value,"onUpdate:value":d[0]||(d[0]=p=>o.value=p),placeholder:"搜索"},a.inputProps,{onKeydown:s}),{prefix:e.withCtx(()=>[e.renderSlot(a.$slots,"icon",{},()=>[d[1]||(d[1]=e.createElementVNode("i",{class:"i-mage-search"},null,-1))])]),_:3},16,["value"]),e.renderSlot(a.$slots,"button",{},()=>[a.searchButton?(e.openBlock(),e.createBlock(e.unref(t.NButton),e.mergeProps({key:0},a.buttonProps,{onClick:u}),{icon:e.withCtx(()=>d[2]||(d[2]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"},[e.createElementVNode("path",{fill:"none",stroke:"#757575","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M10.783 18.828a8.05 8.05 0 0 0 7.439-4.955a8.03 8.03 0 0 0-1.737-8.765a8.045 8.045 0 0 0-13.735 5.68c0 2.131.846 4.174 2.352 5.681a8.05 8.05 0 0 0 5.68 2.359m5.706-2.337l4.762 4.759"})],-1)])),_:1},16)):e.createCommentVNode("",!0)])]),_:3}))}}),m=e.defineComponent({__name:"TooltipButton",props:{value:{},tooltipProps:{},buttonProps:{}},emits:["click"],setup(r,{emit:l}){const n=l;return(o,i)=>(e.openBlock(),e.createBlock(e.unref(t.NTooltip),e.normalizeProps(e.guardReactiveProps(o.tooltipProps)),{trigger:e.withCtx(()=>[e.createVNode(e.unref(t.NButton),e.mergeProps(o.buttonProps,{onClick:i[0]||(i[0]=u=>n("click",u))}),{icon:e.withCtx(()=>[e.renderSlot(o.$slots,"icon")]),default:e.withCtx(()=>[e.renderSlot(o.$slots,"default")]),_:3},16)]),default:e.withCtx(()=>[e.renderSlot(o.$slots,"tooltip",{},()=>[e.createTextVNode(e.toDisplayString(o.value),1)])]),_:3},16))}});exports.NConfigProviders=f;exports.NCopyButton=v;exports.NSearchInput=g;exports.NTooltipButton=m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/index';
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { defineComponent as w, onMounted as T, createBlock as m, openBlock as c, unref as e, normalizeProps as v, guardReactiveProps as f, withCtx as t, createVNode as d, createCommentVNode as B, renderSlot as p, watch as h, createTextVNode as $, toDisplayString as b, createElementVNode as P, mergeProps as N, ref as M } from "vue";
|
|
2
|
+
import { NConfigProvider as S, NLoadingBarProvider as V, NDialogProvider as D, NModalProvider as I, NNotificationProvider as E, NMessageProvider as z, NGlobalStyle as G, useDialog as K, useLoadingBar as L, useMessage as j, useModal as q, useNotification as A, NTooltip as k, NButton as y, NInputGroup as R, NInput as U } from "naive-ui";
|
|
3
|
+
import { useClipboard as F } from "@vueuse/core";
|
|
4
|
+
const W = /* @__PURE__ */ w({
|
|
5
|
+
__name: "ConfigProviders",
|
|
6
|
+
props: {
|
|
7
|
+
globalStyle: { type: Boolean, default: !1 },
|
|
8
|
+
configProviderProps: {},
|
|
9
|
+
loadingBarProps: {},
|
|
10
|
+
dialogProviderProps: {},
|
|
11
|
+
modalProviderProps: {},
|
|
12
|
+
notificationProviderProps: {},
|
|
13
|
+
messageProviderProps: {}
|
|
14
|
+
},
|
|
15
|
+
setup(r) {
|
|
16
|
+
function l() {
|
|
17
|
+
window.$dialog = K(), window.$loadingBar = L(), window.$message = j(), window.$modal = q(), window.$notification = A();
|
|
18
|
+
}
|
|
19
|
+
const i = w({
|
|
20
|
+
setup() {
|
|
21
|
+
T(() => {
|
|
22
|
+
l();
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
render() {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return (o, n) => (c(), m(e(S), v(f(o.configProviderProps)), {
|
|
30
|
+
default: t(() => [
|
|
31
|
+
d(e(V), v(f(o.loadingBarProps)), {
|
|
32
|
+
default: t(() => [
|
|
33
|
+
d(e(D), v(f(o.dialogProviderProps)), {
|
|
34
|
+
default: t(() => [
|
|
35
|
+
d(e(I), v(f(o.modalProviderProps)), {
|
|
36
|
+
default: t(() => [
|
|
37
|
+
d(e(E), v(f(o.notificationProviderProps)), {
|
|
38
|
+
default: t(() => [
|
|
39
|
+
d(e(z), v(f(o.messageProviderProps)), {
|
|
40
|
+
default: t(() => [
|
|
41
|
+
p(o.$slots, "default"),
|
|
42
|
+
d(e(i))
|
|
43
|
+
]),
|
|
44
|
+
_: 3
|
|
45
|
+
}, 16)
|
|
46
|
+
]),
|
|
47
|
+
_: 3
|
|
48
|
+
}, 16)
|
|
49
|
+
]),
|
|
50
|
+
_: 3
|
|
51
|
+
}, 16)
|
|
52
|
+
]),
|
|
53
|
+
_: 3
|
|
54
|
+
}, 16)
|
|
55
|
+
]),
|
|
56
|
+
_: 3
|
|
57
|
+
}, 16),
|
|
58
|
+
o.globalStyle ? (c(), m(e(G), { key: 0 })) : B("", !0)
|
|
59
|
+
]),
|
|
60
|
+
_: 3
|
|
61
|
+
}, 16));
|
|
62
|
+
}
|
|
63
|
+
}), X = /* @__PURE__ */ w({
|
|
64
|
+
__name: "CopyButton",
|
|
65
|
+
props: {
|
|
66
|
+
value: {},
|
|
67
|
+
config: {},
|
|
68
|
+
tooltipProps: {},
|
|
69
|
+
buttonProps: {}
|
|
70
|
+
},
|
|
71
|
+
emits: ["copied"],
|
|
72
|
+
setup(r, { emit: l }) {
|
|
73
|
+
const i = l, { copied: o, copy: n } = F({
|
|
74
|
+
source: r.value,
|
|
75
|
+
...r.config
|
|
76
|
+
});
|
|
77
|
+
h(o, () => {
|
|
78
|
+
o.value && i("copied", r.value);
|
|
79
|
+
});
|
|
80
|
+
function s(u) {
|
|
81
|
+
u.preventDefault(), n();
|
|
82
|
+
}
|
|
83
|
+
return (u, a) => (c(), m(e(k), v(f(u.tooltipProps)), {
|
|
84
|
+
trigger: t(() => [
|
|
85
|
+
P("span", {
|
|
86
|
+
style: { cursor: "pointer" },
|
|
87
|
+
onClick: s
|
|
88
|
+
}, [
|
|
89
|
+
p(u.$slots, "default", {}, () => [
|
|
90
|
+
d(e(y), N({
|
|
91
|
+
quaternary: "",
|
|
92
|
+
size: "tiny"
|
|
93
|
+
}, u.buttonProps), {
|
|
94
|
+
icon: t(() => [
|
|
95
|
+
p(u.$slots, "icon", {}, () => [
|
|
96
|
+
a[0] || (a[0] = P("svg", {
|
|
97
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
98
|
+
width: "32",
|
|
99
|
+
height: "32",
|
|
100
|
+
viewBox: "0 0 24 24"
|
|
101
|
+
}, [
|
|
102
|
+
P("path", {
|
|
103
|
+
fill: "#757575",
|
|
104
|
+
d: "M18.355 6.54h-1.94V4.69a2.69 2.69 0 0 0-1.646-2.484A2.7 2.7 0 0 0 13.745 2h-8.05a2.68 2.68 0 0 0-2.67 2.69v10.09a2.68 2.68 0 0 0 2.67 2.69h1.94v1.85a2.68 2.68 0 0 0 2.67 2.68h8a2.68 2.68 0 0 0 2.67-2.68V9.23a2.69 2.69 0 0 0-2.62-2.69M7.635 9.23v6.74h-1.94a1.18 1.18 0 0 1-1.17-1.19V4.69a1.18 1.18 0 0 1 1.17-1.19h8.05a1.18 1.18 0 0 1 1.17 1.19v1.85h-4.61a2.69 2.69 0 0 0-2.67 2.69"
|
|
105
|
+
})
|
|
106
|
+
], -1))
|
|
107
|
+
])
|
|
108
|
+
]),
|
|
109
|
+
_: 3
|
|
110
|
+
}, 16)
|
|
111
|
+
])
|
|
112
|
+
])
|
|
113
|
+
]),
|
|
114
|
+
default: t(() => [
|
|
115
|
+
p(u.$slots, "tooltip", {}, () => [
|
|
116
|
+
$(b(e(o) ? "复制成功" : "复制"), 1)
|
|
117
|
+
])
|
|
118
|
+
]),
|
|
119
|
+
_: 3
|
|
120
|
+
}, 16));
|
|
121
|
+
}
|
|
122
|
+
}), H = ({ delay: r }, l) => {
|
|
123
|
+
let i, o = !0;
|
|
124
|
+
const n = (...s) => {
|
|
125
|
+
o ? (clearTimeout(i), i = setTimeout(() => {
|
|
126
|
+
o && l(...s), i = void 0;
|
|
127
|
+
}, r)) : l(...s);
|
|
128
|
+
};
|
|
129
|
+
return n.isPending = () => i !== void 0, n.cancel = () => {
|
|
130
|
+
o = !1;
|
|
131
|
+
}, n.flush = (...s) => l(...s), n;
|
|
132
|
+
}, Y = /* @__PURE__ */ w({
|
|
133
|
+
__name: "SearchInput",
|
|
134
|
+
props: {
|
|
135
|
+
value: {},
|
|
136
|
+
autoTrigger: { type: [Boolean, Number], default: !0 },
|
|
137
|
+
searchButton: { type: Boolean, default: !0 },
|
|
138
|
+
inputProps: {},
|
|
139
|
+
buttonProps: {}
|
|
140
|
+
},
|
|
141
|
+
emits: ["update:value"],
|
|
142
|
+
setup(r, { emit: l }) {
|
|
143
|
+
const i = l, o = M(r.value);
|
|
144
|
+
h(() => r.value, (a) => {
|
|
145
|
+
o.value = a;
|
|
146
|
+
});
|
|
147
|
+
const n = H({ delay: typeof r.autoTrigger == "number" ? r.autoTrigger : 500 }, () => {
|
|
148
|
+
i("update:value", o.value);
|
|
149
|
+
});
|
|
150
|
+
h(o, () => {
|
|
151
|
+
r.autoTrigger && n();
|
|
152
|
+
});
|
|
153
|
+
function s() {
|
|
154
|
+
i("update:value", o.value);
|
|
155
|
+
}
|
|
156
|
+
function u(a) {
|
|
157
|
+
a.key === "Enter" && s();
|
|
158
|
+
}
|
|
159
|
+
return (a, g) => (c(), m(e(R), null, {
|
|
160
|
+
default: t(() => [
|
|
161
|
+
d(e(U), N({
|
|
162
|
+
value: o.value,
|
|
163
|
+
"onUpdate:value": g[0] || (g[0] = (C) => o.value = C),
|
|
164
|
+
placeholder: "搜索"
|
|
165
|
+
}, a.inputProps, { onKeydown: u }), {
|
|
166
|
+
prefix: t(() => [
|
|
167
|
+
p(a.$slots, "icon", {}, () => [
|
|
168
|
+
g[1] || (g[1] = P("i", { class: "i-mage-search" }, null, -1))
|
|
169
|
+
])
|
|
170
|
+
]),
|
|
171
|
+
_: 3
|
|
172
|
+
}, 16, ["value"]),
|
|
173
|
+
p(a.$slots, "button", {}, () => [
|
|
174
|
+
a.searchButton ? (c(), m(e(y), N({ key: 0 }, a.buttonProps, { onClick: s }), {
|
|
175
|
+
icon: t(() => g[2] || (g[2] = [
|
|
176
|
+
P("svg", {
|
|
177
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
178
|
+
width: "32",
|
|
179
|
+
height: "32",
|
|
180
|
+
viewBox: "0 0 24 24"
|
|
181
|
+
}, [
|
|
182
|
+
P("path", {
|
|
183
|
+
fill: "none",
|
|
184
|
+
stroke: "#757575",
|
|
185
|
+
"stroke-linecap": "round",
|
|
186
|
+
"stroke-linejoin": "round",
|
|
187
|
+
"stroke-width": "1.5",
|
|
188
|
+
d: "M10.783 18.828a8.05 8.05 0 0 0 7.439-4.955a8.03 8.03 0 0 0-1.737-8.765a8.045 8.045 0 0 0-13.735 5.68c0 2.131.846 4.174 2.352 5.681a8.05 8.05 0 0 0 5.68 2.359m5.706-2.337l4.762 4.759"
|
|
189
|
+
})
|
|
190
|
+
], -1)
|
|
191
|
+
])),
|
|
192
|
+
_: 1
|
|
193
|
+
}, 16)) : B("", !0)
|
|
194
|
+
])
|
|
195
|
+
]),
|
|
196
|
+
_: 3
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
}), Z = /* @__PURE__ */ w({
|
|
200
|
+
__name: "TooltipButton",
|
|
201
|
+
props: {
|
|
202
|
+
value: {},
|
|
203
|
+
tooltipProps: {},
|
|
204
|
+
buttonProps: {}
|
|
205
|
+
},
|
|
206
|
+
emits: ["click"],
|
|
207
|
+
setup(r, { emit: l }) {
|
|
208
|
+
const i = l;
|
|
209
|
+
return (o, n) => (c(), m(e(k), v(f(o.tooltipProps)), {
|
|
210
|
+
trigger: t(() => [
|
|
211
|
+
d(e(y), N(o.buttonProps, {
|
|
212
|
+
onClick: n[0] || (n[0] = (s) => i("click", s))
|
|
213
|
+
}), {
|
|
214
|
+
icon: t(() => [
|
|
215
|
+
p(o.$slots, "icon")
|
|
216
|
+
]),
|
|
217
|
+
default: t(() => [
|
|
218
|
+
p(o.$slots, "default")
|
|
219
|
+
]),
|
|
220
|
+
_: 3
|
|
221
|
+
}, 16)
|
|
222
|
+
]),
|
|
223
|
+
default: t(() => [
|
|
224
|
+
p(o.$slots, "tooltip", {}, () => [
|
|
225
|
+
$(b(o.value), 1)
|
|
226
|
+
])
|
|
227
|
+
]),
|
|
228
|
+
_: 3
|
|
229
|
+
}, 16));
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
export {
|
|
233
|
+
W as NConfigProviders,
|
|
234
|
+
X as NCopyButton,
|
|
235
|
+
Y as NSearchInput,
|
|
236
|
+
Z as NTooltipButton
|
|
237
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(i,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue"),require("naive-ui"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","naive-ui","@vueuse/core"],o):(i=typeof globalThis<"u"?globalThis:i||self,o(i["@oiij/naive-ui"]={},i.Vue,i.NaiveUI,i.VueUseCore))})(this,function(i,o,t,f){"use strict";const P=o.defineComponent({__name:"ConfigProviders",props:{globalStyle:{type:Boolean,default:!1},configProviderProps:{},loadingBarProps:{},dialogProviderProps:{},modalProviderProps:{},notificationProviderProps:{},messageProviderProps:{}},setup(r){function s(){window.$dialog=t.useDialog(),window.$loadingBar=t.useLoadingBar(),window.$message=t.useMessage(),window.$modal=t.useModal(),window.$notification=t.useNotification()}const n=o.defineComponent({setup(){o.onMounted(()=>{s()})},render(){return null}});return(e,a)=>(o.openBlock(),o.createBlock(o.unref(t.NConfigProvider),o.normalizeProps(o.guardReactiveProps(e.configProviderProps)),{default:o.withCtx(()=>[o.createVNode(o.unref(t.NLoadingBarProvider),o.normalizeProps(o.guardReactiveProps(e.loadingBarProps)),{default:o.withCtx(()=>[o.createVNode(o.unref(t.NDialogProvider),o.normalizeProps(o.guardReactiveProps(e.dialogProviderProps)),{default:o.withCtx(()=>[o.createVNode(o.unref(t.NModalProvider),o.normalizeProps(o.guardReactiveProps(e.modalProviderProps)),{default:o.withCtx(()=>[o.createVNode(o.unref(t.NNotificationProvider),o.normalizeProps(o.guardReactiveProps(e.notificationProviderProps)),{default:o.withCtx(()=>[o.createVNode(o.unref(t.NMessageProvider),o.normalizeProps(o.guardReactiveProps(e.messageProviderProps)),{default:o.withCtx(()=>[o.renderSlot(e.$slots,"default"),o.createVNode(o.unref(n))]),_:3},16)]),_:3},16)]),_:3},16)]),_:3},16)]),_:3},16),e.globalStyle?(o.openBlock(),o.createBlock(o.unref(t.NGlobalStyle),{key:0})):o.createCommentVNode("",!0)]),_:3},16))}}),m=o.defineComponent({__name:"CopyButton",props:{value:{},config:{},tooltipProps:{},buttonProps:{}},emits:["copied"],setup(r,{emit:s}){const n=s,{copied:e,copy:a}=f.useClipboard({source:r.value,...r.config});o.watch(e,()=>{e.value&&n("copied",r.value)});function d(p){p.preventDefault(),a()}return(p,l)=>(o.openBlock(),o.createBlock(o.unref(t.NTooltip),o.normalizeProps(o.guardReactiveProps(p.tooltipProps)),{trigger:o.withCtx(()=>[o.createElementVNode("span",{style:{cursor:"pointer"},onClick:d},[o.renderSlot(p.$slots,"default",{},()=>[o.createVNode(o.unref(t.NButton),o.mergeProps({quaternary:"",size:"tiny"},p.buttonProps),{icon:o.withCtx(()=>[o.renderSlot(p.$slots,"icon",{},()=>[l[0]||(l[0]=o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"},[o.createElementVNode("path",{fill:"#757575",d:"M18.355 6.54h-1.94V4.69a2.69 2.69 0 0 0-1.646-2.484A2.7 2.7 0 0 0 13.745 2h-8.05a2.68 2.68 0 0 0-2.67 2.69v10.09a2.68 2.68 0 0 0 2.67 2.69h1.94v1.85a2.68 2.68 0 0 0 2.67 2.68h8a2.68 2.68 0 0 0 2.67-2.68V9.23a2.69 2.69 0 0 0-2.62-2.69M7.635 9.23v6.74h-1.94a1.18 1.18 0 0 1-1.17-1.19V4.69a1.18 1.18 0 0 1 1.17-1.19h8.05a1.18 1.18 0 0 1 1.17 1.19v1.85h-4.61a2.69 2.69 0 0 0-2.67 2.69"})],-1))])]),_:3},16)])])]),default:o.withCtx(()=>[o.renderSlot(p.$slots,"tooltip",{},()=>[o.createTextVNode(o.toDisplayString(o.unref(e)?"复制成功":"复制"),1)])]),_:3},16))}}),g=({delay:r},s)=>{let n,e=!0;const a=(...d)=>{e?(clearTimeout(n),n=setTimeout(()=>{e&&s(...d),n=void 0},r)):s(...d)};return a.isPending=()=>n!==void 0,a.cancel=()=>{e=!1},a.flush=(...d)=>s(...d),a},u=o.defineComponent({__name:"SearchInput",props:{value:{},autoTrigger:{type:[Boolean,Number],default:!0},searchButton:{type:Boolean,default:!0},inputProps:{},buttonProps:{}},emits:["update:value"],setup(r,{emit:s}){const n=s,e=o.ref(r.value);o.watch(()=>r.value,l=>{e.value=l});const a=g({delay:typeof r.autoTrigger=="number"?r.autoTrigger:500},()=>{n("update:value",e.value)});o.watch(e,()=>{r.autoTrigger&&a()});function d(){n("update:value",e.value)}function p(l){l.key==="Enter"&&d()}return(l,c)=>(o.openBlock(),o.createBlock(o.unref(t.NInputGroup),null,{default:o.withCtx(()=>[o.createVNode(o.unref(t.NInput),o.mergeProps({value:e.value,"onUpdate:value":c[0]||(c[0]=h=>e.value=h),placeholder:"搜索"},l.inputProps,{onKeydown:p}),{prefix:o.withCtx(()=>[o.renderSlot(l.$slots,"icon",{},()=>[c[1]||(c[1]=o.createElementVNode("i",{class:"i-mage-search"},null,-1))])]),_:3},16,["value"]),o.renderSlot(l.$slots,"button",{},()=>[l.searchButton?(o.openBlock(),o.createBlock(o.unref(t.NButton),o.mergeProps({key:0},l.buttonProps,{onClick:d}),{icon:o.withCtx(()=>c[2]||(c[2]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"},[o.createElementVNode("path",{fill:"none",stroke:"#757575","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M10.783 18.828a8.05 8.05 0 0 0 7.439-4.955a8.03 8.03 0 0 0-1.737-8.765a8.045 8.045 0 0 0-13.735 5.68c0 2.131.846 4.174 2.352 5.681a8.05 8.05 0 0 0 5.68 2.359m5.706-2.337l4.762 4.759"})],-1)])),_:1},16)):o.createCommentVNode("",!0)])]),_:3}))}}),w=o.defineComponent({__name:"TooltipButton",props:{value:{},tooltipProps:{},buttonProps:{}},emits:["click"],setup(r,{emit:s}){const n=s;return(e,a)=>(o.openBlock(),o.createBlock(o.unref(t.NTooltip),o.normalizeProps(o.guardReactiveProps(e.tooltipProps)),{trigger:o.withCtx(()=>[o.createVNode(o.unref(t.NButton),o.mergeProps(e.buttonProps,{onClick:a[0]||(a[0]=d=>n("click",d))}),{icon:o.withCtx(()=>[o.renderSlot(e.$slots,"icon")]),default:o.withCtx(()=>[o.renderSlot(e.$slots,"default")]),_:3},16)]),default:o.withCtx(()=>[o.renderSlot(e.$slots,"tooltip",{},()=>[o.createTextVNode(o.toDisplayString(e.value),1)])]),_:3},16))}});i.NConfigProviders=P,i.NCopyButton=m,i.NSearchInput=u,i.NTooltipButton=w,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|