@cst-ui/nano-buttons 0.1.2 → 0.2.1
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 +38 -2
- package/dist/NanoButton.vue_vue_type_script_setup_true_lang-D1yLWi2K.cjs +1 -0
- package/dist/NanoButton.vue_vue_type_script_setup_true_lang-DgnSKBXL.js +57 -0
- package/dist/buttons/index.cjs +1 -0
- package/dist/buttons/index.d.ts +19 -0
- package/dist/buttons/index.mjs +241 -0
- package/dist/dialog-tabs/NanoDialogTabPage.vue.d.ts +60 -0
- package/dist/dialog-tabs/context.d.ts +3 -0
- package/dist/dialog-tabs/index.cjs +1 -0
- package/dist/dialog-tabs/index.d.ts +8 -0
- package/dist/dialog-tabs/index.mjs +230 -0
- package/dist/dialog-tabs/plugin.d.ts +4 -0
- package/dist/dialog-tabs/result.d.ts +7 -0
- package/dist/dialog-tabs/types.d.ts +62 -0
- package/dist/dialog-tabs/useDialogOpen.d.ts +4 -0
- package/dist/dialog-tabs/useDialogPage.d.ts +9 -0
- package/dist/dialog-tabs/useDialogTabClose.d.ts +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -19
- package/dist/index.mjs +16 -289
- package/package.json +66 -40
- /package/dist/{components → buttons/components}/NanoAddButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/NanoBackTopButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/NanoButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/NanoCancelButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/NanoDeleteButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/NanoEditButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/NanoExportButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/NanoImportButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/NanoManageButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/NanoMoveButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/NanoSubmitButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/NanoTextAddButton.vue.d.ts +0 -0
- /package/dist/{components → buttons/components}/props.d.ts +0 -0
package/README.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Nano 项目主题按钮组件库,基于 Vue 3 和 Element Plus 封装。
|
|
4
4
|
|
|
5
|
-
这个包用于统一提供 Nano
|
|
5
|
+
这个包用于统一提供 Nano 系列按钮组件,并通过子入口提供弹窗标签页化的公共能力。模板中统一使用横线法组件名,例如 `<nano-button>`,不再保留旧命名。
|
|
6
|
+
|
|
7
|
+
## 在线文档
|
|
8
|
+
|
|
9
|
+
组件效果、安装方式、使用示例和 API 说明见在线文档:
|
|
10
|
+
|
|
11
|
+
https://nano-buttons-docs.netlify.app/
|
|
6
12
|
|
|
7
13
|
## 安装
|
|
8
14
|
|
|
@@ -26,6 +32,12 @@ app.use(NanoButtons)
|
|
|
26
32
|
app.mount('#app')
|
|
27
33
|
```
|
|
28
34
|
|
|
35
|
+
按钮插件也提供明确的平级子入口,旧入口继续兼容:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import NanoButtons from '@cst-ui/nano-buttons/buttons'
|
|
39
|
+
```
|
|
40
|
+
|
|
29
41
|
## 组件列表
|
|
30
42
|
|
|
31
43
|
模板中统一使用横线法:
|
|
@@ -68,8 +80,32 @@ app.mount('#app')
|
|
|
68
80
|
|
|
69
81
|
## 依赖说明
|
|
70
82
|
|
|
71
|
-
`vue` 和 `
|
|
83
|
+
`vue`、`element-plus` 和 `vue-router` 是 peer dependencies,需要由使用方项目提供。
|
|
84
|
+
|
|
85
|
+
## 弹窗标签页
|
|
86
|
+
|
|
87
|
+
弹窗标签页能力从子入口导入:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { createNanoDialogTabs, useDialogOpen } from '@cst-ui/nano-buttons/dialog-tabs'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
公共包只负责打开模式、上下文缓存、保存结果通知、关闭回来源页和 `NanoDialogTabPage` 页面壳。业务项目需要传入 `router`、`registry`、`tabAdapter` 和打开模式。
|
|
72
94
|
|
|
73
95
|
## 维护与发布
|
|
74
96
|
|
|
75
97
|
包维护、版本发布和权限交接说明见 [MAINTAINING.md](./MAINTAINING.md)。
|
|
98
|
+
|
|
99
|
+
文档站本地开发:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pnpm docs:dev
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
文档站构建:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pnpm docs:build
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
更新线上文档时,重新构建后将 `docs-dist/` 上传到 Netlify。若 Netlify 站点或域名发生变化,请同步修改本文档中的在线文档链接。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const o=require("vue"),u=require("element-plus"),m={...u.buttonProps,secondary:Boolean},f=o.defineComponent({name:"NanoButton",inheritAttrs:!1,__name:"NanoButton",props:m,emits:u.buttonEmits,setup(i,{emit:d}){const t=i,p=d,n=o.useAttrs(),s=o.computed(()=>{const{secondary:e,...l}=t;return l}),r=o.computed(()=>["nano-button",t.secondary?"app-button-secondary":""]),a=e=>{p("click",e)};return(e,l)=>{const c=o.resolveComponent("el-button");return e.$slots.default?(o.openBlock(),o.createBlock(c,o.mergeProps({key:0},{...s.value,...o.unref(n)},{class:r.value,onClick:a}),o.createSlots({default:o.withCtx(()=>[o.renderSlot(e.$slots,"default")]),_:2},[e.$slots.loading?{name:"loading",fn:o.withCtx(()=>[o.renderSlot(e.$slots,"loading")]),key:"0"}:void 0]),1040,["class"])):(o.openBlock(),o.createBlock(c,o.mergeProps({key:1},{...s.value,...o.unref(n)},{class:r.value,onClick:a}),o.createSlots({_:2},[e.$slots.loading?{name:"loading",fn:o.withCtx(()=>[o.renderSlot(e.$slots,"loading")]),key:"0"}:void 0]),1040,["class"]))}}});exports._sfc_main=f;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { defineComponent as v, useAttrs as B, computed as i, resolveComponent as _, openBlock as d, createBlock as p, mergeProps as m, unref as f, createSlots as k, withCtx as t, renderSlot as n } from "vue";
|
|
2
|
+
import { buttonProps as $, buttonEmits as C } from "element-plus";
|
|
3
|
+
const P = {
|
|
4
|
+
...$,
|
|
5
|
+
secondary: Boolean
|
|
6
|
+
}, A = /* @__PURE__ */ v({
|
|
7
|
+
name: "NanoButton",
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "NanoButton",
|
|
10
|
+
props: P,
|
|
11
|
+
emits: C,
|
|
12
|
+
setup(y, { emit: b }) {
|
|
13
|
+
const s = y, g = b, e = B(), a = i(() => {
|
|
14
|
+
const { secondary: o, ...c } = s;
|
|
15
|
+
return c;
|
|
16
|
+
}), r = i(() => [
|
|
17
|
+
"nano-button",
|
|
18
|
+
s.secondary ? "app-button-secondary" : ""
|
|
19
|
+
]), l = (o) => {
|
|
20
|
+
g("click", o);
|
|
21
|
+
};
|
|
22
|
+
return (o, c) => {
|
|
23
|
+
const u = _("el-button");
|
|
24
|
+
return o.$slots.default ? (d(), p(u, m({ key: 0 }, { ...a.value, ...f(e) }, {
|
|
25
|
+
class: r.value,
|
|
26
|
+
onClick: l
|
|
27
|
+
}), k({
|
|
28
|
+
default: t(() => [
|
|
29
|
+
n(o.$slots, "default")
|
|
30
|
+
]),
|
|
31
|
+
_: 2
|
|
32
|
+
}, [
|
|
33
|
+
o.$slots.loading ? {
|
|
34
|
+
name: "loading",
|
|
35
|
+
fn: t(() => [
|
|
36
|
+
n(o.$slots, "loading")
|
|
37
|
+
]),
|
|
38
|
+
key: "0"
|
|
39
|
+
} : void 0
|
|
40
|
+
]), 1040, ["class"])) : (d(), p(u, m({ key: 1 }, { ...a.value, ...f(e) }, {
|
|
41
|
+
class: r.value,
|
|
42
|
+
onClick: l
|
|
43
|
+
}), k({ _: 2 }, [
|
|
44
|
+
o.$slots.loading ? {
|
|
45
|
+
name: "loading",
|
|
46
|
+
fn: t(() => [
|
|
47
|
+
n(o.$slots, "loading")
|
|
48
|
+
]),
|
|
49
|
+
key: "0"
|
|
50
|
+
} : void 0
|
|
51
|
+
]), 1040, ["class"]));
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
A as _
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),s=require("element-plus"),n=require("../NanoButton.vue_vue_type_script_setup_true_lang-D1yLWi2K.cjs"),a=e.defineComponent({name:"NanoAddButton",inheritAttrs:!1,__name:"NanoAddButton",props:s.buttonProps,setup(r){return(t,o)=>(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({...t.$props,...t.$attrs},{type:"primary",icon:"Plus"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[o[0]||(o[0]=e.createTextVNode("新增",-1))])]),_:3},16))}}),p=e.defineComponent({name:"NanoBackTopButton",inheritAttrs:!1,__name:"NanoBackTopButton",props:s.buttonProps,setup(r){return(t,o)=>t.$slots.default?(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({key:0},{...t.$props,...t.$attrs},{secondary:"",class:"app-backtop-button"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},16)):(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({key:1},{...t.$props,...t.$attrs},{secondary:"",class:"app-backtop-button"}),{default:e.withCtx(()=>[...o[0]||(o[0]=[e.createElementVNode("svg",{class:"app-backtop-icon",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false"},[e.createElementVNode("path",{d:"M6 5h12"}),e.createElementVNode("path",{d:"M12 19V9"}),e.createElementVNode("path",{d:"m8 13 4-4 4 4"})],-1)])]),_:1},16))}}),l=e.defineComponent({name:"NanoCancelButton",inheritAttrs:!1,__name:"NanoCancelButton",props:s.buttonProps,setup(r){return(t,o)=>(e.openBlock(),e.createBlock(n._sfc_main,e.normalizeProps(e.guardReactiveProps({...t.$props,...t.$attrs})),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[o[0]||(o[0]=e.createTextVNode("取消",-1))])]),_:3},16))}}),u=e.defineComponent({name:"NanoDeleteButton",inheritAttrs:!1,__name:"NanoDeleteButton",props:s.buttonProps,setup(r){return(t,o)=>t.$slots.default?(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({key:0},{...t.$props,...t.$attrs},{type:"danger",icon:"Delete"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},16)):(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({key:1},{...t.$props,...t.$attrs},{type:"danger",icon:"Delete"}),null,16))}}),i=e.defineComponent({name:"NanoEditButton",inheritAttrs:!1,__name:"NanoEditButton",props:s.buttonProps,setup(r){return(t,o)=>t.$slots.default?(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({key:0},{...t.$props,...t.$attrs},{icon:"Edit"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},16)):(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({key:1},{...t.$props,...t.$attrs},{icon:"Edit"}),null,16))}}),m=e.defineComponent({name:"NanoExportButton",inheritAttrs:!1,__name:"NanoExportButton",props:s.buttonProps,setup(r){return(t,o)=>(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({...t.$props,...t.$attrs},{class:"app-button-export",icon:"Download"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[o[0]||(o[0]=e.createTextVNode("导出",-1))])]),_:3},16))}}),c=e.defineComponent({name:"NanoImportButton",inheritAttrs:!1,__name:"NanoImportButton",props:s.buttonProps,setup(r){return(t,o)=>(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({...t.$props,...t.$attrs},{class:"app-button-import",icon:"Upload"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[o[0]||(o[0]=e.createTextVNode("导入",-1))])]),_:3},16))}}),d=e.defineComponent({name:"NanoManageButton",inheritAttrs:!1,__name:"NanoManageButton",props:s.buttonProps,setup(r){return(t,o)=>t.$slots.default?(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({key:0},{...t.$props,...t.$attrs},{type:"primary",icon:"Setting"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},16)):(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({key:1},{...t.$props,...t.$attrs},{type:"primary",icon:"Setting"}),null,16))}}),f=e.defineComponent({name:"NanoMoveButton",inheritAttrs:!1,__name:"NanoMoveButton",props:s.buttonProps,setup(r){return(t,o)=>(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({...t.$props,...t.$attrs},{icon:"Rank"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[o[0]||(o[0]=e.createTextVNode("移动",-1))])]),_:3},16))}}),_=e.defineComponent({name:"NanoSubmitButton",inheritAttrs:!1,__name:"NanoSubmitButton",props:s.buttonProps,setup(r){return(t,o)=>(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({...t.$props,...t.$attrs},{type:"primary"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[o[0]||(o[0]=e.createTextVNode("保存",-1))])]),_:3},16))}}),B=e.defineComponent({name:"NanoTextAddButton",inheritAttrs:!1,__name:"NanoTextAddButton",props:s.buttonProps,setup(r){return(t,o)=>t.$slots.default?(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({key:0},{...t.$props,...t.$attrs},{text:"",icon:"Plus"}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},16)):(e.openBlock(),e.createBlock(n._sfc_main,e.mergeProps({key:1},{...t.$props,...t.$attrs},{text:"",icon:"Plus"}),null,16))}}),k=[n._sfc_main,a,B,f,c,m,i,d,u,_,l,p],$=r=>{k.forEach(t=>{r.component(t.name||"AnonymousComponent",t)})},N={install:$};exports.NanoButton=n._sfc_main;exports.NanoAddButton=a;exports.NanoBackTopButton=p;exports.NanoCancelButton=l;exports.NanoDeleteButton=u;exports.NanoEditButton=i;exports.NanoExportButton=m;exports.NanoImportButton=c;exports.NanoManageButton=d;exports.NanoMoveButton=f;exports.NanoSubmitButton=_;exports.NanoTextAddButton=B;exports.default=N;exports.install=$;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { App, Plugin } from 'vue';
|
|
2
|
+
import './styles/index.css';
|
|
3
|
+
import NanoAddButton from './components/NanoAddButton.vue';
|
|
4
|
+
import NanoBackTopButton from './components/NanoBackTopButton.vue';
|
|
5
|
+
import NanoButton from './components/NanoButton.vue';
|
|
6
|
+
import NanoCancelButton from './components/NanoCancelButton.vue';
|
|
7
|
+
import NanoDeleteButton from './components/NanoDeleteButton.vue';
|
|
8
|
+
import NanoEditButton from './components/NanoEditButton.vue';
|
|
9
|
+
import NanoExportButton from './components/NanoExportButton.vue';
|
|
10
|
+
import NanoImportButton from './components/NanoImportButton.vue';
|
|
11
|
+
import NanoManageButton from './components/NanoManageButton.vue';
|
|
12
|
+
import NanoMoveButton from './components/NanoMoveButton.vue';
|
|
13
|
+
import NanoSubmitButton from './components/NanoSubmitButton.vue';
|
|
14
|
+
import NanoTextAddButton from './components/NanoTextAddButton.vue';
|
|
15
|
+
declare const install: (app: App) => void;
|
|
16
|
+
declare const NanoButtons: Plugin;
|
|
17
|
+
export { NanoButton, NanoAddButton, NanoTextAddButton, NanoMoveButton, NanoImportButton, NanoExportButton, NanoEditButton, NanoManageButton, NanoDeleteButton, NanoSubmitButton, NanoCancelButton, NanoBackTopButton, install, };
|
|
18
|
+
export type { NanoButtonProps } from './components/props';
|
|
19
|
+
export default NanoButtons;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { defineComponent as u, openBlock as a, createBlock as e, mergeProps as s, withCtx as p, renderSlot as l, createTextVNode as d, createElementVNode as m, normalizeProps as f, guardReactiveProps as $ } from "vue";
|
|
2
|
+
import { buttonProps as i } from "element-plus";
|
|
3
|
+
import { _ as n } from "../NanoButton.vue_vue_type_script_setup_true_lang-DgnSKBXL.js";
|
|
4
|
+
const B = /* @__PURE__ */ u({
|
|
5
|
+
name: "NanoAddButton",
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
__name: "NanoAddButton",
|
|
8
|
+
props: i,
|
|
9
|
+
setup(r) {
|
|
10
|
+
return (t, o) => (a(), e(n, s({ ...t.$props, ...t.$attrs }, {
|
|
11
|
+
type: "primary",
|
|
12
|
+
icon: "Plus"
|
|
13
|
+
}), {
|
|
14
|
+
default: p(() => [
|
|
15
|
+
l(t.$slots, "default", {}, () => [
|
|
16
|
+
o[0] || (o[0] = d("新增", -1))
|
|
17
|
+
])
|
|
18
|
+
]),
|
|
19
|
+
_: 3
|
|
20
|
+
}, 16));
|
|
21
|
+
}
|
|
22
|
+
}), _ = /* @__PURE__ */ u({
|
|
23
|
+
name: "NanoBackTopButton",
|
|
24
|
+
inheritAttrs: !1,
|
|
25
|
+
__name: "NanoBackTopButton",
|
|
26
|
+
props: i,
|
|
27
|
+
setup(r) {
|
|
28
|
+
return (t, o) => t.$slots.default ? (a(), e(n, s({ key: 0 }, { ...t.$props, ...t.$attrs }, {
|
|
29
|
+
secondary: "",
|
|
30
|
+
class: "app-backtop-button"
|
|
31
|
+
}), {
|
|
32
|
+
default: p(() => [
|
|
33
|
+
l(t.$slots, "default")
|
|
34
|
+
]),
|
|
35
|
+
_: 3
|
|
36
|
+
}, 16)) : (a(), e(n, s({ key: 1 }, { ...t.$props, ...t.$attrs }, {
|
|
37
|
+
secondary: "",
|
|
38
|
+
class: "app-backtop-button"
|
|
39
|
+
}), {
|
|
40
|
+
default: p(() => [...o[0] || (o[0] = [
|
|
41
|
+
m("svg", {
|
|
42
|
+
class: "app-backtop-icon",
|
|
43
|
+
viewBox: "0 0 24 24",
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
focusable: "false"
|
|
46
|
+
}, [
|
|
47
|
+
m("path", { d: "M6 5h12" }),
|
|
48
|
+
m("path", { d: "M12 19V9" }),
|
|
49
|
+
m("path", { d: "m8 13 4-4 4 4" })
|
|
50
|
+
], -1)
|
|
51
|
+
])]),
|
|
52
|
+
_: 1
|
|
53
|
+
}, 16));
|
|
54
|
+
}
|
|
55
|
+
}), N = /* @__PURE__ */ u({
|
|
56
|
+
name: "NanoCancelButton",
|
|
57
|
+
inheritAttrs: !1,
|
|
58
|
+
__name: "NanoCancelButton",
|
|
59
|
+
props: i,
|
|
60
|
+
setup(r) {
|
|
61
|
+
return (t, o) => (a(), e(n, f($({ ...t.$props, ...t.$attrs })), {
|
|
62
|
+
default: p(() => [
|
|
63
|
+
l(t.$slots, "default", {}, () => [
|
|
64
|
+
o[0] || (o[0] = d("取消", -1))
|
|
65
|
+
])
|
|
66
|
+
]),
|
|
67
|
+
_: 3
|
|
68
|
+
}, 16));
|
|
69
|
+
}
|
|
70
|
+
}), y = /* @__PURE__ */ u({
|
|
71
|
+
name: "NanoDeleteButton",
|
|
72
|
+
inheritAttrs: !1,
|
|
73
|
+
__name: "NanoDeleteButton",
|
|
74
|
+
props: i,
|
|
75
|
+
setup(r) {
|
|
76
|
+
return (t, o) => t.$slots.default ? (a(), e(n, s({ key: 0 }, { ...t.$props, ...t.$attrs }, {
|
|
77
|
+
type: "danger",
|
|
78
|
+
icon: "Delete"
|
|
79
|
+
}), {
|
|
80
|
+
default: p(() => [
|
|
81
|
+
l(t.$slots, "default")
|
|
82
|
+
]),
|
|
83
|
+
_: 3
|
|
84
|
+
}, 16)) : (a(), e(n, s({ key: 1 }, { ...t.$props, ...t.$attrs }, {
|
|
85
|
+
type: "danger",
|
|
86
|
+
icon: "Delete"
|
|
87
|
+
}), null, 16));
|
|
88
|
+
}
|
|
89
|
+
}), c = /* @__PURE__ */ u({
|
|
90
|
+
name: "NanoEditButton",
|
|
91
|
+
inheritAttrs: !1,
|
|
92
|
+
__name: "NanoEditButton",
|
|
93
|
+
props: i,
|
|
94
|
+
setup(r) {
|
|
95
|
+
return (t, o) => t.$slots.default ? (a(), e(n, s({ key: 0 }, { ...t.$props, ...t.$attrs }, { icon: "Edit" }), {
|
|
96
|
+
default: p(() => [
|
|
97
|
+
l(t.$slots, "default")
|
|
98
|
+
]),
|
|
99
|
+
_: 3
|
|
100
|
+
}, 16)) : (a(), e(n, s({ key: 1 }, { ...t.$props, ...t.$attrs }, { icon: "Edit" }), null, 16));
|
|
101
|
+
}
|
|
102
|
+
}), k = /* @__PURE__ */ u({
|
|
103
|
+
name: "NanoExportButton",
|
|
104
|
+
inheritAttrs: !1,
|
|
105
|
+
__name: "NanoExportButton",
|
|
106
|
+
props: i,
|
|
107
|
+
setup(r) {
|
|
108
|
+
return (t, o) => (a(), e(n, s({ ...t.$props, ...t.$attrs }, {
|
|
109
|
+
class: "app-button-export",
|
|
110
|
+
icon: "Download"
|
|
111
|
+
}), {
|
|
112
|
+
default: p(() => [
|
|
113
|
+
l(t.$slots, "default", {}, () => [
|
|
114
|
+
o[0] || (o[0] = d("导出", -1))
|
|
115
|
+
])
|
|
116
|
+
]),
|
|
117
|
+
_: 3
|
|
118
|
+
}, 16));
|
|
119
|
+
}
|
|
120
|
+
}), A = /* @__PURE__ */ u({
|
|
121
|
+
name: "NanoImportButton",
|
|
122
|
+
inheritAttrs: !1,
|
|
123
|
+
__name: "NanoImportButton",
|
|
124
|
+
props: i,
|
|
125
|
+
setup(r) {
|
|
126
|
+
return (t, o) => (a(), e(n, s({ ...t.$props, ...t.$attrs }, {
|
|
127
|
+
class: "app-button-import",
|
|
128
|
+
icon: "Upload"
|
|
129
|
+
}), {
|
|
130
|
+
default: p(() => [
|
|
131
|
+
l(t.$slots, "default", {}, () => [
|
|
132
|
+
o[0] || (o[0] = d("导入", -1))
|
|
133
|
+
])
|
|
134
|
+
]),
|
|
135
|
+
_: 3
|
|
136
|
+
}, 16));
|
|
137
|
+
}
|
|
138
|
+
}), h = /* @__PURE__ */ u({
|
|
139
|
+
name: "NanoManageButton",
|
|
140
|
+
inheritAttrs: !1,
|
|
141
|
+
__name: "NanoManageButton",
|
|
142
|
+
props: i,
|
|
143
|
+
setup(r) {
|
|
144
|
+
return (t, o) => t.$slots.default ? (a(), e(n, s({ key: 0 }, { ...t.$props, ...t.$attrs }, {
|
|
145
|
+
type: "primary",
|
|
146
|
+
icon: "Setting"
|
|
147
|
+
}), {
|
|
148
|
+
default: p(() => [
|
|
149
|
+
l(t.$slots, "default")
|
|
150
|
+
]),
|
|
151
|
+
_: 3
|
|
152
|
+
}, 16)) : (a(), e(n, s({ key: 1 }, { ...t.$props, ...t.$attrs }, {
|
|
153
|
+
type: "primary",
|
|
154
|
+
icon: "Setting"
|
|
155
|
+
}), null, 16));
|
|
156
|
+
}
|
|
157
|
+
}), b = /* @__PURE__ */ u({
|
|
158
|
+
name: "NanoMoveButton",
|
|
159
|
+
inheritAttrs: !1,
|
|
160
|
+
__name: "NanoMoveButton",
|
|
161
|
+
props: i,
|
|
162
|
+
setup(r) {
|
|
163
|
+
return (t, o) => (a(), e(n, s({ ...t.$props, ...t.$attrs }, { icon: "Rank" }), {
|
|
164
|
+
default: p(() => [
|
|
165
|
+
l(t.$slots, "default", {}, () => [
|
|
166
|
+
o[0] || (o[0] = d("移动", -1))
|
|
167
|
+
])
|
|
168
|
+
]),
|
|
169
|
+
_: 3
|
|
170
|
+
}, 16));
|
|
171
|
+
}
|
|
172
|
+
}), g = /* @__PURE__ */ u({
|
|
173
|
+
name: "NanoSubmitButton",
|
|
174
|
+
inheritAttrs: !1,
|
|
175
|
+
__name: "NanoSubmitButton",
|
|
176
|
+
props: i,
|
|
177
|
+
setup(r) {
|
|
178
|
+
return (t, o) => (a(), e(n, s({ ...t.$props, ...t.$attrs }, { type: "primary" }), {
|
|
179
|
+
default: p(() => [
|
|
180
|
+
l(t.$slots, "default", {}, () => [
|
|
181
|
+
o[0] || (o[0] = d("保存", -1))
|
|
182
|
+
])
|
|
183
|
+
]),
|
|
184
|
+
_: 3
|
|
185
|
+
}, 16));
|
|
186
|
+
}
|
|
187
|
+
}), E = /* @__PURE__ */ u({
|
|
188
|
+
name: "NanoTextAddButton",
|
|
189
|
+
inheritAttrs: !1,
|
|
190
|
+
__name: "NanoTextAddButton",
|
|
191
|
+
props: i,
|
|
192
|
+
setup(r) {
|
|
193
|
+
return (t, o) => t.$slots.default ? (a(), e(n, s({ key: 0 }, { ...t.$props, ...t.$attrs }, {
|
|
194
|
+
text: "",
|
|
195
|
+
icon: "Plus"
|
|
196
|
+
}), {
|
|
197
|
+
default: p(() => [
|
|
198
|
+
l(t.$slots, "default")
|
|
199
|
+
]),
|
|
200
|
+
_: 3
|
|
201
|
+
}, 16)) : (a(), e(n, s({ key: 1 }, { ...t.$props, ...t.$attrs }, {
|
|
202
|
+
text: "",
|
|
203
|
+
icon: "Plus"
|
|
204
|
+
}), null, 16));
|
|
205
|
+
}
|
|
206
|
+
}), M = [
|
|
207
|
+
n,
|
|
208
|
+
B,
|
|
209
|
+
E,
|
|
210
|
+
b,
|
|
211
|
+
A,
|
|
212
|
+
k,
|
|
213
|
+
c,
|
|
214
|
+
h,
|
|
215
|
+
y,
|
|
216
|
+
g,
|
|
217
|
+
N,
|
|
218
|
+
_
|
|
219
|
+
], P = (r) => {
|
|
220
|
+
M.forEach((t) => {
|
|
221
|
+
r.component(t.name || "AnonymousComponent", t);
|
|
222
|
+
});
|
|
223
|
+
}, D = {
|
|
224
|
+
install: P
|
|
225
|
+
};
|
|
226
|
+
export {
|
|
227
|
+
B as NanoAddButton,
|
|
228
|
+
_ as NanoBackTopButton,
|
|
229
|
+
n as NanoButton,
|
|
230
|
+
N as NanoCancelButton,
|
|
231
|
+
y as NanoDeleteButton,
|
|
232
|
+
c as NanoEditButton,
|
|
233
|
+
k as NanoExportButton,
|
|
234
|
+
A as NanoImportButton,
|
|
235
|
+
h as NanoManageButton,
|
|
236
|
+
b as NanoMoveButton,
|
|
237
|
+
g as NanoSubmitButton,
|
|
238
|
+
E as NanoTextAddButton,
|
|
239
|
+
D as default,
|
|
240
|
+
P as install
|
|
241
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
declare function __VLS_template(): {
|
|
2
|
+
slots: {
|
|
3
|
+
actions?(_: {}): any;
|
|
4
|
+
default?(_: {}): any;
|
|
5
|
+
};
|
|
6
|
+
refs: {};
|
|
7
|
+
attrs: Partial<{}>;
|
|
8
|
+
};
|
|
9
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
10
|
+
declare const __VLS_component: import("vue").DefineComponent<{
|
|
11
|
+
titleKey?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
expired?: boolean;
|
|
15
|
+
fit?: boolean;
|
|
16
|
+
bodyClass?: string;
|
|
17
|
+
outerClass?: string;
|
|
18
|
+
surfaceClass?: string;
|
|
19
|
+
expiredTextKey?: string;
|
|
20
|
+
expiredText?: string;
|
|
21
|
+
closeTextKey?: string;
|
|
22
|
+
closeText?: string;
|
|
23
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
|
+
close: () => any;
|
|
25
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
26
|
+
titleKey?: string;
|
|
27
|
+
title?: string;
|
|
28
|
+
loading?: boolean;
|
|
29
|
+
expired?: boolean;
|
|
30
|
+
fit?: boolean;
|
|
31
|
+
bodyClass?: string;
|
|
32
|
+
outerClass?: string;
|
|
33
|
+
surfaceClass?: string;
|
|
34
|
+
expiredTextKey?: string;
|
|
35
|
+
expiredText?: string;
|
|
36
|
+
closeTextKey?: string;
|
|
37
|
+
closeText?: string;
|
|
38
|
+
}> & Readonly<{
|
|
39
|
+
onClose?: (() => any) | undefined;
|
|
40
|
+
}>, {
|
|
41
|
+
loading: boolean;
|
|
42
|
+
title: string;
|
|
43
|
+
titleKey: string;
|
|
44
|
+
expired: boolean;
|
|
45
|
+
fit: boolean;
|
|
46
|
+
bodyClass: string;
|
|
47
|
+
outerClass: string;
|
|
48
|
+
surfaceClass: string;
|
|
49
|
+
expiredTextKey: string;
|
|
50
|
+
expiredText: string;
|
|
51
|
+
closeTextKey: string;
|
|
52
|
+
closeText: string;
|
|
53
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
54
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
55
|
+
export default _default;
|
|
56
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
57
|
+
new (): {
|
|
58
|
+
$slots: S;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),_=require("../NanoButton.vue_vue_type_script_setup_true_lang-D1yLWi2K.cjs"),D=require("vue-router"),h=Symbol("NanoDialogTabs");let v;const w=t=>{const e=()=>typeof t.mode=="function"?t.mode():t.mode,a=t.translate??(n=>n);return{...t,getMode:e,t:a}},S=t=>{const e=w(t);return v=e,e},k=t=>{const e=w(t);return{context:e,install(a){v=e,a.provide(h,e)}}},c=()=>{const t=o.hasInjectionContext()?o.inject(h,v):v;if(t==null)throw new Error("Nano dialog tabs is not configured. Call app.use(createNanoDialogTabs(...)) first.");return t},M={class:"flex shrink-0 items-center justify-between gap-app-md border-b border-app-border-light p-app-lg"},E={class:"app-section-title"},B=o.defineComponent({name:"NanoDialogTabPage",__name:"NanoDialogTabPage",props:{titleKey:{default:""},title:{default:void 0},loading:{type:Boolean,default:!1},expired:{type:Boolean,default:!1},fit:{type:Boolean,default:!1},bodyClass:{default:"overflow-x-auto"},outerClass:{default:""},surfaceClass:{default:""},expiredTextKey:{default:"dialog.contextExpired"},expiredText:{default:void 0},closeTextKey:{default:"button.close"},closeText:{default:void 0}},emits:["close"],setup(t,{emit:e}){const a=t,n=e,{t:l}=c(),r=o.computed(()=>a.title??l(a.titleKey)),u=o.computed(()=>a.expiredText??l(a.expiredTextKey)),d=o.computed(()=>a.closeText??l(a.closeTextKey)),s=o.computed(()=>[a.fit?"h-full min-h-0 overflow-hidden p-app-md":"h-full min-h-0 overflow-y-auto p-app-md",a.outerClass]),i=o.computed(()=>[a.fit?"app-surface flex h-full min-h-0 flex-col":"app-surface",a.surfaceClass]),m=o.computed(()=>[a.fit?"min-h-0 flex-1 overflow-hidden":a.bodyClass]);return(f,g)=>{const x=o.resolveComponent("el-empty"),p=o.resolveDirective("loading");return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(s.value)},[o.createElementVNode("div",{class:o.normalizeClass(i.value)},[o.createElementVNode("div",M,[o.createElementVNode("span",E,o.toDisplayString(r.value),1),o.renderSlot(f.$slots,"actions")]),o.withDirectives((o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(m.value)},[t.expired?(o.openBlock(),o.createBlock(x,{key:1,description:u.value},{default:o.withCtx(()=>[o.createVNode(_._sfc_main,{icon:"Close",onClick:g[0]||(g[0]=U=>n("close"))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(d.value),1)]),_:1})]),_:1},8,["description"])):o.renderSlot(f.$slots,"default",{key:0})],2)),[[p,t.loading]])],2)],2)}}}),T=new Map,I=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`,N=(t,e)=>{const a=e??I();return T.set(a,t),a},y=t=>{if(typeof t=="string")return T.get(t)},$=t=>{typeof t=="string"&&T.delete(t)},b="nano-dialog-result",P=t=>{window.dispatchEvent(new CustomEvent(b,{detail:t}))},q=t=>{const e=a=>{t(a.detail)};return window.addEventListener(b,e),()=>{window.removeEventListener(b,e)}},C=(t,e)=>`${t.replace(/\/$/,"")}${e}`,A=(t,e)=>`dialog-${t}-${e.replace(/[^a-zA-Z0-9]+/g,"-")}`,K=t=>typeof t=="string"?t:t==null?void 0:t.path,V=(t,e,a,n)=>{const l=c(),r=typeof l.defaultRouteMeta=="function"?l.defaultRouteMeta({key:e,path:a,titleKey:n,config:t}):l.defaultRouteMeta??{};return{title:n??t.title,icon:"Setting",dialogTab:!0,...r}},z=(t,e,a)=>{const n=c(),l=n.registry[t];if(l==null)return;const r=A(t,e);n.router.hasRoute(r)||n.router.addRoute(n.parentRouteName,{path:e,name:r,component:l.component,meta:V(l,t,e,a),props:l.props})},F=(t,e)=>{const a=c();if(e.route!==void 0)return typeof e.route=="string"?e.route:{...e.route,query:e.query??e.route.query};if(e.key===void 0)return;const n=a.registry[e.key];if(n==null)return;const l=C(t,e.routeSuffix??n.suffix),r=C(t,e.routePatternSuffix??e.routeSuffix??n.suffix);return z(e.key,r,e.titleKey),{path:l,query:e.query}},j=()=>{const t=D.useRoute(),e=c();return{openDialog:async n=>{if(e.getMode()!=="tab"){n.openModal();return}const l=F(t.path,n);if(l===void 0){n.openModal();return}const r=K(l);n.context!==void 0&&r!==void 0&&r!==""&&N(n.context,r),await e.router.push(l)}}},R=()=>{const t=D.useRoute(),e=c();return{closeCurrentDialogTab:()=>{var f,g,x;const n=e.tabAdapter.getTabs(),l=n.findIndex(p=>p.fullPath===t.fullPath);if(l<=0){e.router.back();return}const r=n[l],u=typeof((f=r==null?void 0:r.meta)==null?void 0:f.dialogSourceFullPath)=="string"?r.meta.dialogSourceFullPath:void 0,d=l<n.length-1?(g=n[l+1])==null?void 0:g.fullPath:(x=n[l-1])==null?void 0:x.fullPath,s=u!==void 0&&u!==""?u:d;if(s==null||s===""){e.router.back();return}const i=l===e.tabAdapter.getCurrentIndex();e.tabAdapter.deleteTab(l);const m=e.tabAdapter.getTabs().findIndex(p=>p.fullPath===s);i&&m>=0&&e.tabAdapter.setCurrentIndex(m),e.router.replace(s)}}},O=t=>{const e=D.useRoute(),a=c(),{closeCurrentDialogTab:n}=R(),l=o.computed(()=>y(e.path)??y(e.query.dialogId)),r=o.computed(()=>typeof t=="function"&&t.length>0?t({route:e,dialogContext:l}):o.toValue(t)),u=()=>{const s=a.tabAdapter.getTabs().find(i=>i.fullPath===e.fullPath);s!=null&&(s.title=r.value)},d=(s,i)=>{P({key:s,type:"saved",payload:i}),n()};return o.watch(()=>[e.fullPath,r.value],u,{immediate:!0}),{route:e,dialogContext:l,pageTitleKey:r,closeCurrentDialogTab:n,emitSavedAndClose:d,syncTabTitle:u}};exports.NanoDialogTabPage=B;exports.configureNanoDialogTabs=S;exports.createNanoDialogTabs=k;exports.emitDialogResult=P;exports.getDialogContext=y;exports.nanoDialogTabsKey=h;exports.onDialogResult=q;exports.removeDialogContext=$;exports.setDialogContext=N;exports.useDialogOpen=j;exports.useDialogPage=O;exports.useDialogTabClose=R;exports.useNanoDialogTabs=c;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as NanoDialogTabPage } from './NanoDialogTabPage.vue';
|
|
2
|
+
export * from './context';
|
|
3
|
+
export * from './plugin';
|
|
4
|
+
export * from './result';
|
|
5
|
+
export * from './types';
|
|
6
|
+
export * from './useDialogOpen';
|
|
7
|
+
export * from './useDialogPage';
|
|
8
|
+
export * from './useDialogTabClose';
|