@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
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { hasInjectionContext as $, inject as I, defineComponent as A, computed as c, resolveComponent as E, resolveDirective as K, openBlock as y, createElementBlock as w, normalizeClass as b, createElementVNode as h, toDisplayString as P, renderSlot as R, withDirectives as q, createBlock as B, withCtx as N, createVNode as F, createTextVNode as U, toValue as V, watch as j } from "vue";
|
|
2
|
+
import { _ as z } from "../NanoButton.vue_vue_type_script_setup_true_lang-DgnSKBXL.js";
|
|
3
|
+
import { useRoute as C } from "vue-router";
|
|
4
|
+
const k = Symbol("NanoDialogTabs");
|
|
5
|
+
let v;
|
|
6
|
+
const S = (t) => {
|
|
7
|
+
const e = () => typeof t.mode == "function" ? t.mode() : t.mode, o = t.translate ?? ((n) => n);
|
|
8
|
+
return {
|
|
9
|
+
...t,
|
|
10
|
+
getMode: e,
|
|
11
|
+
t: o
|
|
12
|
+
};
|
|
13
|
+
}, re = (t) => {
|
|
14
|
+
const e = S(t);
|
|
15
|
+
return v = e, e;
|
|
16
|
+
}, le = (t) => {
|
|
17
|
+
const e = S(t);
|
|
18
|
+
return {
|
|
19
|
+
context: e,
|
|
20
|
+
install(o) {
|
|
21
|
+
v = e, o.provide(k, e);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, u = () => {
|
|
25
|
+
const t = $() ? I(k, v) : v;
|
|
26
|
+
if (t == null)
|
|
27
|
+
throw new Error("Nano dialog tabs is not configured. Call app.use(createNanoDialogTabs(...)) first.");
|
|
28
|
+
return t;
|
|
29
|
+
}, L = { class: "flex shrink-0 items-center justify-between gap-app-md border-b border-app-border-light p-app-lg" }, O = { class: "app-section-title" }, se = /* @__PURE__ */ A({
|
|
30
|
+
name: "NanoDialogTabPage",
|
|
31
|
+
__name: "NanoDialogTabPage",
|
|
32
|
+
props: {
|
|
33
|
+
titleKey: { default: "" },
|
|
34
|
+
title: { default: void 0 },
|
|
35
|
+
loading: { type: Boolean, default: !1 },
|
|
36
|
+
expired: { type: Boolean, default: !1 },
|
|
37
|
+
fit: { type: Boolean, default: !1 },
|
|
38
|
+
bodyClass: { default: "overflow-x-auto" },
|
|
39
|
+
outerClass: { default: "" },
|
|
40
|
+
surfaceClass: { default: "" },
|
|
41
|
+
expiredTextKey: { default: "dialog.contextExpired" },
|
|
42
|
+
expiredText: { default: void 0 },
|
|
43
|
+
closeTextKey: { default: "button.close" },
|
|
44
|
+
closeText: { default: void 0 }
|
|
45
|
+
},
|
|
46
|
+
emits: ["close"],
|
|
47
|
+
setup(t, { emit: e }) {
|
|
48
|
+
const o = t, n = e, { t: a } = u(), r = c(() => o.title ?? a(o.titleKey)), s = c(() => o.expiredText ?? a(o.expiredTextKey)), d = c(() => o.closeText ?? a(o.closeTextKey)), l = c(() => [
|
|
49
|
+
o.fit ? "h-full min-h-0 overflow-hidden p-app-md" : "h-full min-h-0 overflow-y-auto p-app-md",
|
|
50
|
+
o.outerClass
|
|
51
|
+
]), i = c(() => [
|
|
52
|
+
o.fit ? "app-surface flex h-full min-h-0 flex-col" : "app-surface",
|
|
53
|
+
o.surfaceClass
|
|
54
|
+
]), x = c(() => [
|
|
55
|
+
o.fit ? "min-h-0 flex-1 overflow-hidden" : o.bodyClass
|
|
56
|
+
]);
|
|
57
|
+
return (f, p) => {
|
|
58
|
+
const m = E("el-empty"), g = K("loading");
|
|
59
|
+
return y(), w("div", {
|
|
60
|
+
class: b(l.value)
|
|
61
|
+
}, [
|
|
62
|
+
h("div", {
|
|
63
|
+
class: b(i.value)
|
|
64
|
+
}, [
|
|
65
|
+
h("div", L, [
|
|
66
|
+
h("span", O, P(r.value), 1),
|
|
67
|
+
R(f.$slots, "actions")
|
|
68
|
+
]),
|
|
69
|
+
q((y(), w("div", {
|
|
70
|
+
class: b(x.value)
|
|
71
|
+
}, [
|
|
72
|
+
t.expired ? (y(), B(m, {
|
|
73
|
+
key: 1,
|
|
74
|
+
description: s.value
|
|
75
|
+
}, {
|
|
76
|
+
default: N(() => [
|
|
77
|
+
F(z, {
|
|
78
|
+
icon: "Close",
|
|
79
|
+
onClick: p[0] || (p[0] = (te) => n("close"))
|
|
80
|
+
}, {
|
|
81
|
+
default: N(() => [
|
|
82
|
+
U(P(d.value), 1)
|
|
83
|
+
]),
|
|
84
|
+
_: 1
|
|
85
|
+
})
|
|
86
|
+
]),
|
|
87
|
+
_: 1
|
|
88
|
+
}, 8, ["description"])) : R(f.$slots, "default", { key: 0 })
|
|
89
|
+
], 2)), [
|
|
90
|
+
[g, t.loading]
|
|
91
|
+
])
|
|
92
|
+
], 2)
|
|
93
|
+
], 2);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}), D = /* @__PURE__ */ new Map(), Z = () => typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`, G = (t, e) => {
|
|
97
|
+
const o = e ?? Z();
|
|
98
|
+
return D.set(o, t), o;
|
|
99
|
+
}, M = (t) => {
|
|
100
|
+
if (typeof t == "string")
|
|
101
|
+
return D.get(t);
|
|
102
|
+
}, ce = (t) => {
|
|
103
|
+
typeof t == "string" && D.delete(t);
|
|
104
|
+
}, T = "nano-dialog-result", H = (t) => {
|
|
105
|
+
window.dispatchEvent(new CustomEvent(T, {
|
|
106
|
+
detail: t
|
|
107
|
+
}));
|
|
108
|
+
}, ie = (t) => {
|
|
109
|
+
const e = (o) => {
|
|
110
|
+
t(o.detail);
|
|
111
|
+
};
|
|
112
|
+
return window.addEventListener(T, e), () => {
|
|
113
|
+
window.removeEventListener(T, e);
|
|
114
|
+
};
|
|
115
|
+
}, _ = (t, e) => `${t.replace(/\/$/, "")}${e}`, J = (t, e) => `dialog-${t}-${e.replace(/[^a-zA-Z0-9]+/g, "-")}`, Q = (t) => typeof t == "string" ? t : t == null ? void 0 : t.path, W = (t, e, o, n) => {
|
|
116
|
+
const a = u(), r = typeof a.defaultRouteMeta == "function" ? a.defaultRouteMeta({ key: e, path: o, titleKey: n, config: t }) : a.defaultRouteMeta ?? {};
|
|
117
|
+
return {
|
|
118
|
+
title: n ?? t.title,
|
|
119
|
+
icon: "Setting",
|
|
120
|
+
dialogTab: !0,
|
|
121
|
+
...r
|
|
122
|
+
};
|
|
123
|
+
}, X = (t, e, o) => {
|
|
124
|
+
const n = u(), a = n.registry[t];
|
|
125
|
+
if (a == null)
|
|
126
|
+
return;
|
|
127
|
+
const r = J(t, e);
|
|
128
|
+
n.router.hasRoute(r) || n.router.addRoute(n.parentRouteName, {
|
|
129
|
+
path: e,
|
|
130
|
+
name: r,
|
|
131
|
+
component: a.component,
|
|
132
|
+
meta: W(a, t, e, o),
|
|
133
|
+
props: a.props
|
|
134
|
+
});
|
|
135
|
+
}, Y = (t, e) => {
|
|
136
|
+
const o = u();
|
|
137
|
+
if (e.route !== void 0)
|
|
138
|
+
return typeof e.route == "string" ? e.route : {
|
|
139
|
+
...e.route,
|
|
140
|
+
query: e.query ?? e.route.query
|
|
141
|
+
};
|
|
142
|
+
if (e.key === void 0)
|
|
143
|
+
return;
|
|
144
|
+
const n = o.registry[e.key];
|
|
145
|
+
if (n == null)
|
|
146
|
+
return;
|
|
147
|
+
const a = _(t, e.routeSuffix ?? n.suffix), r = _(t, e.routePatternSuffix ?? e.routeSuffix ?? n.suffix);
|
|
148
|
+
return X(e.key, r, e.titleKey), {
|
|
149
|
+
path: a,
|
|
150
|
+
query: e.query
|
|
151
|
+
};
|
|
152
|
+
}, ue = () => {
|
|
153
|
+
const t = C(), e = u();
|
|
154
|
+
return {
|
|
155
|
+
openDialog: async (n) => {
|
|
156
|
+
if (e.getMode() !== "tab") {
|
|
157
|
+
n.openModal();
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const a = Y(t.path, n);
|
|
161
|
+
if (a === void 0) {
|
|
162
|
+
n.openModal();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const r = Q(a);
|
|
166
|
+
n.context !== void 0 && r !== void 0 && r !== "" && G(n.context, r), await e.router.push(a);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}, ee = () => {
|
|
170
|
+
const t = C(), e = u();
|
|
171
|
+
return {
|
|
172
|
+
closeCurrentDialogTab: () => {
|
|
173
|
+
var f, p, m;
|
|
174
|
+
const n = e.tabAdapter.getTabs(), a = n.findIndex((g) => g.fullPath === t.fullPath);
|
|
175
|
+
if (a <= 0) {
|
|
176
|
+
e.router.back();
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
const r = n[a], s = typeof ((f = r == null ? void 0 : r.meta) == null ? void 0 : f.dialogSourceFullPath) == "string" ? r.meta.dialogSourceFullPath : void 0, d = a < n.length - 1 ? (p = n[a + 1]) == null ? void 0 : p.fullPath : (m = n[a - 1]) == null ? void 0 : m.fullPath, l = s !== void 0 && s !== "" ? s : d;
|
|
180
|
+
if (l == null || l === "") {
|
|
181
|
+
e.router.back();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const i = a === e.tabAdapter.getCurrentIndex();
|
|
185
|
+
e.tabAdapter.deleteTab(a);
|
|
186
|
+
const x = e.tabAdapter.getTabs().findIndex((g) => g.fullPath === l);
|
|
187
|
+
i && x >= 0 && e.tabAdapter.setCurrentIndex(x), e.router.replace(l);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}, de = (t) => {
|
|
191
|
+
const e = C(), o = u(), { closeCurrentDialogTab: n } = ee(), a = c(
|
|
192
|
+
() => M(e.path) ?? M(e.query.dialogId)
|
|
193
|
+
), r = c(() => typeof t == "function" && t.length > 0 ? t({ route: e, dialogContext: a }) : V(t)), s = () => {
|
|
194
|
+
const l = o.tabAdapter.getTabs().find((i) => i.fullPath === e.fullPath);
|
|
195
|
+
l != null && (l.title = r.value);
|
|
196
|
+
}, d = (l, i) => {
|
|
197
|
+
H({
|
|
198
|
+
key: l,
|
|
199
|
+
type: "saved",
|
|
200
|
+
payload: i
|
|
201
|
+
}), n();
|
|
202
|
+
};
|
|
203
|
+
return j(
|
|
204
|
+
() => [e.fullPath, r.value],
|
|
205
|
+
s,
|
|
206
|
+
{ immediate: !0 }
|
|
207
|
+
), {
|
|
208
|
+
route: e,
|
|
209
|
+
dialogContext: a,
|
|
210
|
+
pageTitleKey: r,
|
|
211
|
+
closeCurrentDialogTab: n,
|
|
212
|
+
emitSavedAndClose: d,
|
|
213
|
+
syncTabTitle: s
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
export {
|
|
217
|
+
se as NanoDialogTabPage,
|
|
218
|
+
re as configureNanoDialogTabs,
|
|
219
|
+
le as createNanoDialogTabs,
|
|
220
|
+
H as emitDialogResult,
|
|
221
|
+
M as getDialogContext,
|
|
222
|
+
k as nanoDialogTabsKey,
|
|
223
|
+
ie as onDialogResult,
|
|
224
|
+
ce as removeDialogContext,
|
|
225
|
+
G as setDialogContext,
|
|
226
|
+
ue as useDialogOpen,
|
|
227
|
+
de as useDialogPage,
|
|
228
|
+
ee as useDialogTabClose,
|
|
229
|
+
u as useNanoDialogTabs
|
|
230
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NanoDialogTabsContext, NanoDialogTabsOptions, NanoDialogTabsPlugin } from './types';
|
|
2
|
+
export declare const configureNanoDialogTabs: <TKey extends string>(options: NanoDialogTabsOptions<TKey>) => NanoDialogTabsContext<TKey>;
|
|
3
|
+
export declare const createNanoDialogTabs: <TKey extends string>(options: NanoDialogTabsOptions<TKey>) => NanoDialogTabsPlugin<TKey>;
|
|
4
|
+
export declare const useNanoDialogTabs: () => NanoDialogTabsContext<string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface DialogResult<TPayload = unknown> {
|
|
2
|
+
key: string;
|
|
3
|
+
type: 'saved' | 'cancelled';
|
|
4
|
+
payload?: TPayload;
|
|
5
|
+
}
|
|
6
|
+
export declare const emitDialogResult: <TPayload>(result: DialogResult<TPayload>) => void;
|
|
7
|
+
export declare const onDialogResult: (listener: (result: DialogResult) => void) => () => void;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { App, ComputedRef, InjectionKey, MaybeRefOrGetter, Plugin } from 'vue';
|
|
2
|
+
import type { LocationQueryRaw, RouteLocationNormalizedLoaded, RouteLocationRaw, Router } from 'vue-router';
|
|
3
|
+
export type DialogOpenMode = 'dialog' | 'tab';
|
|
4
|
+
export interface NanoDialogRouteConfig {
|
|
5
|
+
suffix: string;
|
|
6
|
+
title: string;
|
|
7
|
+
component: unknown;
|
|
8
|
+
props?: unknown;
|
|
9
|
+
}
|
|
10
|
+
export type NanoDialogRegistry<TKey extends string = string> = Partial<Record<TKey, NanoDialogRouteConfig>>;
|
|
11
|
+
export interface NanoDialogTabData {
|
|
12
|
+
title: string;
|
|
13
|
+
name?: string | symbol | null;
|
|
14
|
+
route?: unknown;
|
|
15
|
+
fullPath: string;
|
|
16
|
+
meta?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
export interface NanoDialogTabAdapter {
|
|
19
|
+
getTabs: () => NanoDialogTabData[];
|
|
20
|
+
getCurrentIndex: () => number;
|
|
21
|
+
setCurrentIndex: (index: number) => void;
|
|
22
|
+
deleteTab: (index: number) => void;
|
|
23
|
+
}
|
|
24
|
+
export interface NanoDialogRouteMetaState<TKey extends string = string> {
|
|
25
|
+
key: TKey;
|
|
26
|
+
path: string;
|
|
27
|
+
titleKey?: string;
|
|
28
|
+
config: NanoDialogRouteConfig;
|
|
29
|
+
}
|
|
30
|
+
export interface NanoDialogTabsOptions<TKey extends string = string> {
|
|
31
|
+
router: Router;
|
|
32
|
+
parentRouteName: string;
|
|
33
|
+
registry: NanoDialogRegistry<TKey>;
|
|
34
|
+
mode: DialogOpenMode | (() => DialogOpenMode);
|
|
35
|
+
tabAdapter: NanoDialogTabAdapter;
|
|
36
|
+
translate?: (key: string) => string;
|
|
37
|
+
defaultRouteMeta?: Record<string, unknown> | ((state: NanoDialogRouteMetaState<TKey>) => Record<string, unknown>);
|
|
38
|
+
}
|
|
39
|
+
export interface NanoDialogTabsContext<TKey extends string = string> extends NanoDialogTabsOptions<TKey> {
|
|
40
|
+
getMode: () => DialogOpenMode;
|
|
41
|
+
t: (key: string) => string;
|
|
42
|
+
}
|
|
43
|
+
export type NanoDialogTabsPlugin<TKey extends string = string> = Plugin & {
|
|
44
|
+
install: (app: App) => void;
|
|
45
|
+
context: NanoDialogTabsContext<TKey>;
|
|
46
|
+
};
|
|
47
|
+
export interface OpenDialogOptions<TKey extends string = string> {
|
|
48
|
+
key?: TKey;
|
|
49
|
+
route?: RouteLocationRaw;
|
|
50
|
+
query?: LocationQueryRaw;
|
|
51
|
+
context?: unknown;
|
|
52
|
+
routeSuffix?: string;
|
|
53
|
+
routePatternSuffix?: string;
|
|
54
|
+
titleKey?: string;
|
|
55
|
+
openModal: () => void;
|
|
56
|
+
}
|
|
57
|
+
export interface DialogPageTitleState<TContext> {
|
|
58
|
+
route: RouteLocationNormalizedLoaded;
|
|
59
|
+
dialogContext: ComputedRef<TContext | undefined>;
|
|
60
|
+
}
|
|
61
|
+
export type DialogPageTitle<TContext> = MaybeRefOrGetter<string> | ((state: DialogPageTitleState<TContext>) => string);
|
|
62
|
+
export declare const nanoDialogTabsKey: InjectionKey<NanoDialogTabsContext>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DialogPageTitle } from './types';
|
|
2
|
+
export declare const useDialogPage: <TContext = unknown>(titleKey: DialogPageTitle<TContext>) => {
|
|
3
|
+
route: import("vue-router").RouteLocationNormalizedLoadedGeneric;
|
|
4
|
+
dialogContext: import("vue").ComputedRef<TContext | undefined>;
|
|
5
|
+
pageTitleKey: import("vue").ComputedRef<string>;
|
|
6
|
+
closeCurrentDialogTab: () => void;
|
|
7
|
+
emitSavedAndClose: <TPayload>(key: string, payload?: TPayload) => void;
|
|
8
|
+
syncTabTitle: () => void;
|
|
9
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("
|
|
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
|
-
|
|
2
|
-
|
|
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,291 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
const M = {
|
|
4
|
-
...i,
|
|
5
|
-
secondary: Boolean
|
|
6
|
-
}, a = /* @__PURE__ */ l({
|
|
7
|
-
name: "NanoButton",
|
|
8
|
-
inheritAttrs: !1,
|
|
9
|
-
__name: "NanoButton",
|
|
10
|
-
props: M,
|
|
11
|
-
emits: C,
|
|
12
|
-
setup(p, { emit: t }) {
|
|
13
|
-
const o = p, h = t, $ = g(), B = k(() => {
|
|
14
|
-
const { secondary: d, ...N } = o;
|
|
15
|
-
return N;
|
|
16
|
-
}), _ = k(() => [
|
|
17
|
-
"nano-button",
|
|
18
|
-
o.secondary ? "app-button-secondary" : ""
|
|
19
|
-
]), c = (d) => {
|
|
20
|
-
h("click", d);
|
|
21
|
-
};
|
|
22
|
-
return (d, N) => {
|
|
23
|
-
const y = v("el-button");
|
|
24
|
-
return d.$slots.default ? (n(), s(y, e({ key: 0 }, { ...B.value, ...A($) }, {
|
|
25
|
-
class: _.value,
|
|
26
|
-
onClick: c
|
|
27
|
-
}), b({
|
|
28
|
-
default: r(() => [
|
|
29
|
-
u(d.$slots, "default")
|
|
30
|
-
]),
|
|
31
|
-
_: 2
|
|
32
|
-
}, [
|
|
33
|
-
d.$slots.loading ? {
|
|
34
|
-
name: "loading",
|
|
35
|
-
fn: r(() => [
|
|
36
|
-
u(d.$slots, "loading")
|
|
37
|
-
]),
|
|
38
|
-
key: "0"
|
|
39
|
-
} : void 0
|
|
40
|
-
]), 1040, ["class"])) : (n(), s(y, e({ key: 1 }, { ...B.value, ...A($) }, {
|
|
41
|
-
class: _.value,
|
|
42
|
-
onClick: c
|
|
43
|
-
}), b({ _: 2 }, [
|
|
44
|
-
d.$slots.loading ? {
|
|
45
|
-
name: "loading",
|
|
46
|
-
fn: r(() => [
|
|
47
|
-
u(d.$slots, "loading")
|
|
48
|
-
]),
|
|
49
|
-
key: "0"
|
|
50
|
-
} : void 0
|
|
51
|
-
]), 1040, ["class"]));
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}), S = /* @__PURE__ */ l({
|
|
55
|
-
name: "NanoAddButton",
|
|
56
|
-
inheritAttrs: !1,
|
|
57
|
-
__name: "NanoAddButton",
|
|
58
|
-
props: i,
|
|
59
|
-
setup(p) {
|
|
60
|
-
return (t, o) => (n(), s(a, e({ ...t.$props, ...t.$attrs }, {
|
|
61
|
-
type: "primary",
|
|
62
|
-
icon: "Plus"
|
|
63
|
-
}), {
|
|
64
|
-
default: r(() => [
|
|
65
|
-
u(t.$slots, "default", {}, () => [
|
|
66
|
-
o[0] || (o[0] = m("新增", -1))
|
|
67
|
-
])
|
|
68
|
-
]),
|
|
69
|
-
_: 3
|
|
70
|
-
}, 16));
|
|
71
|
-
}
|
|
72
|
-
}), T = /* @__PURE__ */ l({
|
|
73
|
-
name: "NanoBackTopButton",
|
|
74
|
-
inheritAttrs: !1,
|
|
75
|
-
__name: "NanoBackTopButton",
|
|
76
|
-
props: i,
|
|
77
|
-
setup(p) {
|
|
78
|
-
return (t, o) => t.$slots.default ? (n(), s(a, e({ key: 0 }, { ...t.$props, ...t.$attrs }, {
|
|
79
|
-
secondary: "",
|
|
80
|
-
class: "app-backtop-button"
|
|
81
|
-
}), {
|
|
82
|
-
default: r(() => [
|
|
83
|
-
u(t.$slots, "default")
|
|
84
|
-
]),
|
|
85
|
-
_: 3
|
|
86
|
-
}, 16)) : (n(), s(a, e({ key: 1 }, { ...t.$props, ...t.$attrs }, {
|
|
87
|
-
secondary: "",
|
|
88
|
-
class: "app-backtop-button"
|
|
89
|
-
}), {
|
|
90
|
-
default: r(() => [...o[0] || (o[0] = [
|
|
91
|
-
f("svg", {
|
|
92
|
-
class: "app-backtop-icon",
|
|
93
|
-
viewBox: "0 0 24 24",
|
|
94
|
-
"aria-hidden": "true",
|
|
95
|
-
focusable: "false"
|
|
96
|
-
}, [
|
|
97
|
-
f("path", { d: "M6 5h12" }),
|
|
98
|
-
f("path", { d: "M12 19V9" }),
|
|
99
|
-
f("path", { d: "m8 13 4-4 4 4" })
|
|
100
|
-
], -1)
|
|
101
|
-
])]),
|
|
102
|
-
_: 1
|
|
103
|
-
}, 16));
|
|
104
|
-
}
|
|
105
|
-
}), D = /* @__PURE__ */ l({
|
|
106
|
-
name: "NanoCancelButton",
|
|
107
|
-
inheritAttrs: !1,
|
|
108
|
-
__name: "NanoCancelButton",
|
|
109
|
-
props: i,
|
|
110
|
-
setup(p) {
|
|
111
|
-
return (t, o) => (n(), s(a, E(P({ ...t.$props, ...t.$attrs })), {
|
|
112
|
-
default: r(() => [
|
|
113
|
-
u(t.$slots, "default", {}, () => [
|
|
114
|
-
o[0] || (o[0] = m("取消", -1))
|
|
115
|
-
])
|
|
116
|
-
]),
|
|
117
|
-
_: 3
|
|
118
|
-
}, 16));
|
|
119
|
-
}
|
|
120
|
-
}), w = /* @__PURE__ */ l({
|
|
121
|
-
name: "NanoDeleteButton",
|
|
122
|
-
inheritAttrs: !1,
|
|
123
|
-
__name: "NanoDeleteButton",
|
|
124
|
-
props: i,
|
|
125
|
-
setup(p) {
|
|
126
|
-
return (t, o) => t.$slots.default ? (n(), s(a, e({ key: 0 }, { ...t.$props, ...t.$attrs }, {
|
|
127
|
-
type: "danger",
|
|
128
|
-
icon: "Delete"
|
|
129
|
-
}), {
|
|
130
|
-
default: r(() => [
|
|
131
|
-
u(t.$slots, "default")
|
|
132
|
-
]),
|
|
133
|
-
_: 3
|
|
134
|
-
}, 16)) : (n(), s(a, e({ key: 1 }, { ...t.$props, ...t.$attrs }, {
|
|
135
|
-
type: "danger",
|
|
136
|
-
icon: "Delete"
|
|
137
|
-
}), null, 16));
|
|
138
|
-
}
|
|
139
|
-
}), I = /* @__PURE__ */ l({
|
|
140
|
-
name: "NanoEditButton",
|
|
141
|
-
inheritAttrs: !1,
|
|
142
|
-
__name: "NanoEditButton",
|
|
143
|
-
props: i,
|
|
144
|
-
setup(p) {
|
|
145
|
-
return (t, o) => t.$slots.default ? (n(), s(a, e({ key: 0 }, { ...t.$props, ...t.$attrs }, { icon: "Edit" }), {
|
|
146
|
-
default: r(() => [
|
|
147
|
-
u(t.$slots, "default")
|
|
148
|
-
]),
|
|
149
|
-
_: 3
|
|
150
|
-
}, 16)) : (n(), s(a, e({ key: 1 }, { ...t.$props, ...t.$attrs }, { icon: "Edit" }), null, 16));
|
|
151
|
-
}
|
|
152
|
-
}), V = /* @__PURE__ */ l({
|
|
153
|
-
name: "NanoExportButton",
|
|
154
|
-
inheritAttrs: !1,
|
|
155
|
-
__name: "NanoExportButton",
|
|
156
|
-
props: i,
|
|
157
|
-
setup(p) {
|
|
158
|
-
return (t, o) => (n(), s(a, e({ ...t.$props, ...t.$attrs }, {
|
|
159
|
-
class: "app-button-export",
|
|
160
|
-
icon: "Download"
|
|
161
|
-
}), {
|
|
162
|
-
default: r(() => [
|
|
163
|
-
u(t.$slots, "default", {}, () => [
|
|
164
|
-
o[0] || (o[0] = m("导出", -1))
|
|
165
|
-
])
|
|
166
|
-
]),
|
|
167
|
-
_: 3
|
|
168
|
-
}, 16));
|
|
169
|
-
}
|
|
170
|
-
}), R = /* @__PURE__ */ l({
|
|
171
|
-
name: "NanoImportButton",
|
|
172
|
-
inheritAttrs: !1,
|
|
173
|
-
__name: "NanoImportButton",
|
|
174
|
-
props: i,
|
|
175
|
-
setup(p) {
|
|
176
|
-
return (t, o) => (n(), s(a, e({ ...t.$props, ...t.$attrs }, {
|
|
177
|
-
class: "app-button-import",
|
|
178
|
-
icon: "Upload"
|
|
179
|
-
}), {
|
|
180
|
-
default: r(() => [
|
|
181
|
-
u(t.$slots, "default", {}, () => [
|
|
182
|
-
o[0] || (o[0] = m("导入", -1))
|
|
183
|
-
])
|
|
184
|
-
]),
|
|
185
|
-
_: 3
|
|
186
|
-
}, 16));
|
|
187
|
-
}
|
|
188
|
-
}), z = /* @__PURE__ */ l({
|
|
189
|
-
name: "NanoManageButton",
|
|
190
|
-
inheritAttrs: !1,
|
|
191
|
-
__name: "NanoManageButton",
|
|
192
|
-
props: i,
|
|
193
|
-
setup(p) {
|
|
194
|
-
return (t, o) => t.$slots.default ? (n(), s(a, e({ key: 0 }, { ...t.$props, ...t.$attrs }, {
|
|
195
|
-
type: "primary",
|
|
196
|
-
icon: "Setting"
|
|
197
|
-
}), {
|
|
198
|
-
default: r(() => [
|
|
199
|
-
u(t.$slots, "default")
|
|
200
|
-
]),
|
|
201
|
-
_: 3
|
|
202
|
-
}, 16)) : (n(), s(a, e({ key: 1 }, { ...t.$props, ...t.$attrs }, {
|
|
203
|
-
type: "primary",
|
|
204
|
-
icon: "Setting"
|
|
205
|
-
}), null, 16));
|
|
206
|
-
}
|
|
207
|
-
}), U = /* @__PURE__ */ l({
|
|
208
|
-
name: "NanoMoveButton",
|
|
209
|
-
inheritAttrs: !1,
|
|
210
|
-
__name: "NanoMoveButton",
|
|
211
|
-
props: i,
|
|
212
|
-
setup(p) {
|
|
213
|
-
return (t, o) => (n(), s(a, e({ ...t.$props, ...t.$attrs }, { icon: "Rank" }), {
|
|
214
|
-
default: r(() => [
|
|
215
|
-
u(t.$slots, "default", {}, () => [
|
|
216
|
-
o[0] || (o[0] = m("移动", -1))
|
|
217
|
-
])
|
|
218
|
-
]),
|
|
219
|
-
_: 3
|
|
220
|
-
}, 16));
|
|
221
|
-
}
|
|
222
|
-
}), j = /* @__PURE__ */ l({
|
|
223
|
-
name: "NanoSubmitButton",
|
|
224
|
-
inheritAttrs: !1,
|
|
225
|
-
__name: "NanoSubmitButton",
|
|
226
|
-
props: i,
|
|
227
|
-
setup(p) {
|
|
228
|
-
return (t, o) => (n(), s(a, e({ ...t.$props, ...t.$attrs }, { type: "primary" }), {
|
|
229
|
-
default: r(() => [
|
|
230
|
-
u(t.$slots, "default", {}, () => [
|
|
231
|
-
o[0] || (o[0] = m("保存", -1))
|
|
232
|
-
])
|
|
233
|
-
]),
|
|
234
|
-
_: 3
|
|
235
|
-
}, 16));
|
|
236
|
-
}
|
|
237
|
-
}), q = /* @__PURE__ */ l({
|
|
238
|
-
name: "NanoTextAddButton",
|
|
239
|
-
inheritAttrs: !1,
|
|
240
|
-
__name: "NanoTextAddButton",
|
|
241
|
-
props: i,
|
|
242
|
-
setup(p) {
|
|
243
|
-
return (t, o) => t.$slots.default ? (n(), s(a, e({ key: 0 }, { ...t.$props, ...t.$attrs }, {
|
|
244
|
-
text: "",
|
|
245
|
-
icon: "Plus"
|
|
246
|
-
}), {
|
|
247
|
-
default: r(() => [
|
|
248
|
-
u(t.$slots, "default")
|
|
249
|
-
]),
|
|
250
|
-
_: 3
|
|
251
|
-
}, 16)) : (n(), s(a, e({ key: 1 }, { ...t.$props, ...t.$attrs }, {
|
|
252
|
-
text: "",
|
|
253
|
-
icon: "Plus"
|
|
254
|
-
}), null, 16));
|
|
255
|
-
}
|
|
256
|
-
}), F = [
|
|
257
|
-
a,
|
|
258
|
-
S,
|
|
259
|
-
q,
|
|
260
|
-
U,
|
|
261
|
-
R,
|
|
262
|
-
V,
|
|
263
|
-
I,
|
|
264
|
-
z,
|
|
265
|
-
w,
|
|
266
|
-
j,
|
|
267
|
-
D,
|
|
268
|
-
T
|
|
269
|
-
], G = (p) => {
|
|
270
|
-
F.forEach((t) => {
|
|
271
|
-
p.component(t.name || "AnonymousComponent", t);
|
|
272
|
-
});
|
|
273
|
-
}, K = {
|
|
274
|
-
install: G
|
|
275
|
-
};
|
|
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";
|
|
276
3
|
export {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
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
|
|
291
18
|
};
|