@cst-ui/nano-buttons 0.2.0 → 0.2.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 CHANGED
@@ -4,6 +4,21 @@ Nano 项目主题按钮组件库,基于 Vue 3 和 Element Plus 封装。
4
4
 
5
5
  这个包用于统一提供 Nano 系列按钮组件,并通过子入口提供弹窗标签页化的公共能力。模板中统一使用横线法组件名,例如 `<nano-button>`,不再保留旧命名。
6
6
 
7
+ ## 入口说明
8
+
9
+ 包内能力按子入口拆分,按钮和弹窗标签页可以分开引入:
10
+
11
+ ```ts
12
+ // 兼容旧按钮入口
13
+ import NanoButtons from '@cst-ui/nano-buttons'
14
+
15
+ // 明确的按钮入口
16
+ import NanoButtons from '@cst-ui/nano-buttons/buttons'
17
+
18
+ // 弹窗标签页入口
19
+ import { createNanoDialogTabs } from '@cst-ui/nano-buttons/dialog-tabs'
20
+ ```
21
+
7
22
  ## 在线文档
8
23
 
9
24
  组件效果、安装方式、使用示例和 API 说明见在线文档:
@@ -32,6 +47,12 @@ app.use(NanoButtons)
32
47
  app.mount('#app')
33
48
  ```
34
49
 
50
+ 按钮插件也提供明确的平级子入口,旧入口继续兼容:
51
+
52
+ ```ts
53
+ import NanoButtons from '@cst-ui/nano-buttons/buttons'
54
+ ```
55
+
35
56
  ## 组件列表
36
57
 
37
58
  模板中统一使用横线法:
@@ -78,13 +99,131 @@ app.mount('#app')
78
99
 
79
100
  ## 弹窗标签页
80
101
 
81
- 弹窗标签页能力从子入口导入:
102
+ 弹窗标签页能力用于把原本的弹窗按开关切换成系统 tab 页,同时保留原弹窗模式。公共包只负责打开模式、上下文缓存、保存结果通知、关闭回来源页和 `NanoDialogTabPage` 页面壳;业务项目负责注册页面、请求数据和保存业务。
103
+
104
+ ### 入口安装
105
+
106
+ 在应用入口安装插件:
107
+
108
+ ```ts
109
+ import { createNanoDialogTabs } from '@cst-ui/nano-buttons/dialog-tabs'
110
+
111
+ app.use(createNanoDialogTabs({
112
+ router,
113
+ parentRouteName: 'layout',
114
+ registry: dialogRegistry,
115
+ mode: () => DIALOG_OPEN_MODE,
116
+ translate: key => i18n.global.t(key),
117
+ tabAdapter: {
118
+ getTabs: () => tabStore.tabsOption,
119
+ getCurrentIndex: () => tabStore.currentIndex,
120
+ setCurrentIndex: index => tabStore.SET_TAB(index),
121
+ deleteTab: index => tabStore.DELETE_TAB(index),
122
+ },
123
+ }))
124
+ ```
125
+
126
+ ### 注册页面
127
+
128
+ 在业务项目维护弹窗注册表:
82
129
 
83
130
  ```ts
84
- import { createNanoDialogTabs, useDialogOpen } from '@cst-ui/nano-buttons/dialog-tabs'
131
+ export const dialogRegistry = {
132
+ userEdit: {
133
+ suffix: '/edit',
134
+ title: 'dialog.user.edit',
135
+ component: async () => await import('@/views/user/components/edit-page.vue'),
136
+ props: {
137
+ mode: 'edit',
138
+ },
139
+ },
140
+ }
85
141
  ```
86
142
 
87
- 公共包只负责打开模式、上下文缓存、保存结果通知、关闭回来源页和 `NanoDialogTabPage` 页面壳。业务项目需要传入 `router`、`registry`、`tabAdapter` 和打开模式。
143
+ ### 打开弹窗或 tab
144
+
145
+ 原页面统一使用 `openDialog`。开关为 `dialog` 时走 `openModal`,开关为 `tab` 时打开注册页面:
146
+
147
+ ```ts
148
+ import { useDialogOpen } from '@cst-ui/nano-buttons/dialog-tabs'
149
+
150
+ const { openDialog } = useDialogOpen()
151
+
152
+ openDialog({
153
+ key: 'userEdit',
154
+ routeSuffix: `/edit/${row.id}`,
155
+ routePatternSuffix: '/edit/:id',
156
+ context: {
157
+ id: row.id,
158
+ },
159
+ openModal: () => {
160
+ data.showEdit = true
161
+ },
162
+ })
163
+ ```
164
+
165
+ ### tab 页面
166
+
167
+ tab 页面用 `NanoDialogTabPage` 统一标题、内容滚动、底部操作区和上下文失效兜底:
168
+
169
+ ```vue
170
+ <template>
171
+ <NanoDialogTabPage
172
+ :title-key="pageTitleKey"
173
+ :loading="loading"
174
+ :expired="expired"
175
+ @close="closeCurrentDialogTab"
176
+ >
177
+ <UserEditForm
178
+ :item="item"
179
+ variant="page"
180
+ @cancel="closeCurrentDialogTab"
181
+ @save-ok="onSaveOk"
182
+ />
183
+ </NanoDialogTabPage>
184
+ </template>
185
+
186
+ <script setup lang="ts">
187
+ import { NanoDialogTabPage, useDialogPage } from '@cst-ui/nano-buttons/dialog-tabs'
188
+
189
+ const {
190
+ route,
191
+ dialogContext,
192
+ closeCurrentDialogTab,
193
+ emitSavedAndClose,
194
+ } = useDialogPage<{ id?: string }>('dialog.user.edit')
195
+
196
+ const id = computed(() => dialogContext.value?.id ?? route.params.id)
197
+
198
+ const onSaveOk = () => {
199
+ emitSavedAndClose('userEdit', { id: id.value })
200
+ }
201
+ </script>
202
+ ```
203
+
204
+ ### 保存后刷新来源页
205
+
206
+ 来源页可以监听保存结果并刷新列表:
207
+
208
+ ```ts
209
+ import { onDialogResult } from '@cst-ui/nano-buttons/dialog-tabs'
210
+
211
+ onMounted(() => {
212
+ const remove = onDialogResult((result) => {
213
+ if (result.key === 'userEdit' && result.type === 'saved')
214
+ loadList()
215
+ })
216
+
217
+ onUnmounted(remove)
218
+ })
219
+ ```
220
+
221
+ ### 使用建议
222
+
223
+ 1. 路由上的业务主键只放可被正常访问的 ID,不放敏感数据。
224
+ 2. `context` 只作为临时上下文,页面刷新后可能失效,页面应提供兜底提示或根据路由主键重新查数据。
225
+ 3. 标题传多语言 key,不在公共模块里写死业务文案。
226
+ 4. 保存成功统一用 `emitSavedAndClose` 通知来源页刷新。
88
227
 
89
228
  ## 维护与发布
90
229
 
@@ -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
+ };
package/dist/index.cjs CHANGED
@@ -1 +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=$;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./buttons/index.cjs"),o=require("./NanoButton.vue_vue_type_script_setup_true_lang-D1yLWi2K.cjs");exports.NanoAddButton=t.NanoAddButton;exports.NanoBackTopButton=t.NanoBackTopButton;exports.NanoCancelButton=t.NanoCancelButton;exports.NanoDeleteButton=t.NanoDeleteButton;exports.NanoEditButton=t.NanoEditButton;exports.NanoExportButton=t.NanoExportButton;exports.NanoImportButton=t.NanoImportButton;exports.NanoManageButton=t.NanoManageButton;exports.NanoMoveButton=t.NanoMoveButton;exports.NanoSubmitButton=t.NanoSubmitButton;exports.NanoTextAddButton=t.NanoTextAddButton;exports.default=t.default;exports.install=t.install;exports.NanoButton=o._sfc_main;
package/dist/index.d.ts CHANGED
@@ -1,19 +1,2 @@
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;
1
+ export { default } from './buttons';
2
+ export * from './buttons';
package/dist/index.mjs CHANGED
@@ -1,241 +1,18 @@
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
- };
1
+ import { NanoAddButton as n, NanoBackTopButton as a, NanoCancelButton as u, NanoDeleteButton as B, NanoEditButton as N, NanoExportButton as e, NanoImportButton as d, NanoManageButton as r, NanoMoveButton as l, NanoSubmitButton as p, NanoTextAddButton as m, default as x, install as f } from "./buttons/index.mjs";
2
+ import { _ as c } from "./NanoButton.vue_vue_type_script_setup_true_lang-DgnSKBXL.js";
226
3
  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
4
+ n as NanoAddButton,
5
+ a as NanoBackTopButton,
6
+ c as NanoButton,
7
+ u as NanoCancelButton,
8
+ B as NanoDeleteButton,
9
+ N as NanoEditButton,
10
+ e as NanoExportButton,
11
+ d as NanoImportButton,
12
+ r as NanoManageButton,
13
+ l as NanoMoveButton,
14
+ p as NanoSubmitButton,
15
+ m as NanoTextAddButton,
16
+ x as default,
17
+ f as install
241
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cst-ui/nano-buttons",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Nano themed Vue 3 button components and dialog tab helpers based on Element Plus.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -11,6 +11,9 @@
11
11
  "*": {
12
12
  "dialog-tabs": [
13
13
  "dist/dialog-tabs/index.d.ts"
14
+ ],
15
+ "buttons": [
16
+ "dist/buttons/index.d.ts"
14
17
  ]
15
18
  }
16
19
  },
@@ -27,6 +30,11 @@
27
30
  "import": "./dist/index.mjs",
28
31
  "require": "./dist/index.cjs"
29
32
  },
33
+ "./buttons": {
34
+ "types": "./dist/buttons/index.d.ts",
35
+ "import": "./dist/buttons/index.mjs",
36
+ "require": "./dist/buttons/index.cjs"
37
+ },
30
38
  "./dialog-tabs": {
31
39
  "types": "./dist/dialog-tabs/index.d.ts",
32
40
  "import": "./dist/dialog-tabs/index.mjs",