@nubisco/ui 5.36.1 → 5.38.0
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/dist/{AiProvider-CFTfot9P.js → AiProvider-BUU8NJPa.js} +1 -1
- package/dist/{AiProvider-DdMne4pp.cjs → AiProvider-CzcMQh78.cjs} +1 -1
- package/dist/DataTable-CijHryn5.js +477 -0
- package/dist/DataTable-DeRtqCsP.cjs +1 -0
- package/dist/{Pagination-CEASb9u_.cjs → Pagination-DxpwnXrE.cjs} +1 -1
- package/dist/{Pagination-DevdWGZK.js → Pagination-ZYbBPdqi.js} +1 -1
- package/dist/Select-CNetl2JU.js +548 -0
- package/dist/Select-Dz5XXNrc.cjs +1 -0
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +4 -4
- package/dist/components/AiProvider.cjs +1 -1
- package/dist/components/AiProvider.mjs +1 -1
- package/dist/components/DataTable.cjs +1 -1
- package/dist/components/DataTable.d.ts +11 -3
- package/dist/components/DataTable.mjs +1 -1
- package/dist/components/DataTable.vue.d.ts.map +1 -1
- package/dist/components/Pagination.cjs +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Select.cjs +1 -1
- package/dist/components/Select.d.ts +11 -0
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Select.vue.d.ts +3 -0
- package/dist/components/Select.vue.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +4 -4
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/styles/DataTable.css +1 -1
- package/dist/styles/Select.css +1 -1
- package/dist/ui.css +2 -2
- package/package.json +2 -1
- package/dist/DataTable-BsaDeCtq.js +0 -500
- package/dist/DataTable-CVCVybbZ.cjs +0 -1
- package/dist/Select-Djtr68yO.js +0 -489
- package/dist/Select-tqEDoa5r.cjs +0 -1
|
@@ -2,7 +2,7 @@ import { t as e } from "./Button-D81Efqjg.js";
|
|
|
2
2
|
import { t } from "./AiLabel-CPINOrQd.js";
|
|
3
3
|
import { t as n } from "./Field-6haRtm1-.js";
|
|
4
4
|
import { t as r } from "./Panel-B3kJkm_w.js";
|
|
5
|
-
import { t as i } from "./Select-
|
|
5
|
+
import { t as i } from "./Select-CNetl2JU.js";
|
|
6
6
|
import { t as a } from "./TextInput-D5vlfecS.js";
|
|
7
7
|
import { createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, openBlock as p, renderSlot as m, toDisplayString as h, withCtx as g } from "vue";
|
|
8
8
|
//#region src/components/AiProvider.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Button-B-8ikYRN.cjs`),t=require(`./AiLabel-BK3oecvT.cjs`),n=require(`./Field-C7JxGz6g.cjs`),r=require(`./Panel-DKp-aPUn.cjs`),i=require(`./Select-
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Button-B-8ikYRN.cjs`),t=require(`./AiLabel-BK3oecvT.cjs`),n=require(`./Field-C7JxGz6g.cjs`),r=require(`./Panel-DKp-aPUn.cjs`),i=require(`./Select-Dz5XXNrc.cjs`),a=require(`./TextInput-IAk1KYb5.cjs`);let o=require(`vue`);var s={class:`nb-ai-provider__header`},c={class:`nb-ai-provider__title`},l={key:0,class:`nb-ai-provider__description`},u={class:`nb-ai-provider__row`},d={class:`nb-ai-provider__actions`},f=(0,o.defineComponent)({__name:`AiProvider`,props:{title:{default:`AI briefings`},providers:{default:()=>[{label:`Anthropic (Claude)`,value:`anthropic`},{label:`OpenAI`,value:`openai`},{label:`Google Gemini`,value:`gemini`}]},provider:{default:`anthropic`},model:{default:``},apiKey:{default:``},defaultModels:{default:()=>({})},hasKey:{type:Boolean,default:!1},busy:{type:Boolean,default:!1}},emits:[`update:provider`,`update:model`,`update:apiKey`,`save`,`remove`],setup(f,{emit:p}){let m=p;return(p,h)=>((0,o.openBlock)(),(0,o.createBlock)(r.t,{class:`nb-ai-provider`},{default:(0,o.withCtx)(()=>[(0,o.createElementVNode)(`header`,s,[(0,o.createElementVNode)(`h2`,c,[(0,o.createTextVNode)((0,o.toDisplayString)(f.title)+` `,1),(0,o.createVNode)(t.t,{static:``,size:`sm`})]),p.$slots.default?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,l,[(0,o.renderSlot)(p.$slots,`default`)])):(0,o.createCommentVNode)(``,!0)]),(0,o.createElementVNode)(`div`,u,[(0,o.createVNode)(n.t,{label:`Provider`,orientation:`stack`},{default:(0,o.withCtx)(({id:e})=>[(0,o.createVNode)(i.t,{id:e,"model-value":f.provider,options:f.providers,disabled:f.busy,"onUpdate:modelValue":h[0]||=e=>m(`update:provider`,String(e))},null,8,[`id`,`model-value`,`options`,`disabled`])]),_:1}),(0,o.createVNode)(n.t,{label:`Model`,hint:`Empty uses the provider's default.`,orientation:`stack`},{default:(0,o.withCtx)(({id:e})=>[(0,o.createVNode)(a.t,{id:e,"model-value":f.model,placeholder:f.defaultModels[f.provider]??``,disabled:f.busy,"onUpdate:modelValue":h[1]||=e=>m(`update:model`,String(e??``))},null,8,[`id`,`model-value`,`placeholder`,`disabled`])]),_:1})]),(0,o.createVNode)(n.t,{label:`API key`,hint:`Encrypted at rest and never sent back to the browser, so this field is always empty when the page loads.`,orientation:`stack`},{default:(0,o.withCtx)(({id:e})=>[(0,o.createVNode)(a.t,{id:e,"model-value":f.apiKey,type:`password`,autocomplete:`off`,placeholder:f.hasKey?`Stored. Type a new key to replace it.`:`sk-...`,disabled:f.busy,"onUpdate:modelValue":h[2]||=e=>m(`update:apiKey`,String(e??``))},null,8,[`id`,`model-value`,`placeholder`,`disabled`])]),_:1}),(0,o.createElementVNode)(`div`,d,[(0,o.createVNode)(e.t,{variant:`primary`,loading:f.busy,onClick:h[3]||=e=>m(`save`)},{default:(0,o.withCtx)(()=>[...h[5]||=[(0,o.createTextVNode)(` Save AI settings `,-1)]]),_:1},8,[`loading`]),f.hasKey?((0,o.openBlock)(),(0,o.createBlock)(e.t,{key:0,variant:`ghost`,disabled:f.busy,onClick:h[4]||=e=>m(`remove`)},{default:(0,o.withCtx)(()=>[...h[6]||=[(0,o.createTextVNode)(` Remove key `,-1)]]),_:1},8,[`disabled`])):(0,o.createCommentVNode)(``,!0)])]),_:3}))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
2
|
+
import { t } from "./Icon-rREAqsu0.js";
|
|
3
|
+
import { useSurfaceLayer as n } from "./composables/useSurfaceLayer.composable.mjs";
|
|
4
|
+
import { usePhoneLayout as r } from "./composables/usePhoneLayout.composable.mjs";
|
|
5
|
+
import { t as i } from "./Button-D81Efqjg.js";
|
|
6
|
+
import { t as a } from "./Grid-CJFQvcko.js";
|
|
7
|
+
import { t as o } from "./Checkbox-ColjurT5.js";
|
|
8
|
+
import { Fragment as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, getCurrentInstance as ee, mergeProps as te, normalizeClass as g, normalizeStyle as ne, openBlock as _, ref as re, renderList as v, renderSlot as y, toDisplayString as b, unref as ie, useId as x, useSlots as ae, watch as oe, withCtx as S, withModifiers as C } from "vue";
|
|
9
|
+
import * as se from "@nubisco/ui/icons/arrow-up";
|
|
10
|
+
import * as ce from "@nubisco/ui/icons/caret-right";
|
|
11
|
+
import * as le from "@nubisco/ui/icons/arrows-down-up";
|
|
12
|
+
import * as ue from "@nubisco/ui/icons/arrow-down";
|
|
13
|
+
//#region src/components/DataTable.vue?vue&type=script&setup=true&lang.ts
|
|
14
|
+
var de = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "nb-data-table__toolbar"
|
|
17
|
+
}, fe = {
|
|
18
|
+
key: 0,
|
|
19
|
+
class: "nb-data-table__toolbar-heading"
|
|
20
|
+
}, pe = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "nb-data-table__title"
|
|
23
|
+
}, me = {
|
|
24
|
+
key: 1,
|
|
25
|
+
class: "nb-data-table__description"
|
|
26
|
+
}, he = {
|
|
27
|
+
key: 1,
|
|
28
|
+
class: "nb-data-table__toolbar-row"
|
|
29
|
+
}, ge = ["inert", "aria-hidden"], _e = {
|
|
30
|
+
key: 0,
|
|
31
|
+
class: "nb-data-table__toolbar-search"
|
|
32
|
+
}, ve = {
|
|
33
|
+
key: 1,
|
|
34
|
+
class: "nb-data-table__batch",
|
|
35
|
+
role: "region",
|
|
36
|
+
"aria-label": "Table batch actions"
|
|
37
|
+
}, ye = { class: "nb-data-table__batch-count" }, be = { class: "nb-data-table__batch-actions" }, xe = { class: "nb-data-table__scroll" }, Se = [
|
|
38
|
+
"role",
|
|
39
|
+
"aria-label",
|
|
40
|
+
"aria-busy"
|
|
41
|
+
], Ce = {
|
|
42
|
+
key: 0,
|
|
43
|
+
class: "nb-data-table__col-expand"
|
|
44
|
+
}, we = {
|
|
45
|
+
key: 1,
|
|
46
|
+
class: "nb-data-table__col-select"
|
|
47
|
+
}, Te = {
|
|
48
|
+
key: 2,
|
|
49
|
+
class: "nb-data-table__col-actions"
|
|
50
|
+
}, Ee = ["role"], De = ["role"], Oe = {
|
|
51
|
+
key: 0,
|
|
52
|
+
scope: "col",
|
|
53
|
+
class: "nb-data-table__th nb-data-table__expand-cell"
|
|
54
|
+
}, ke = {
|
|
55
|
+
key: 1,
|
|
56
|
+
scope: "col",
|
|
57
|
+
class: "nb-data-table__th nb-data-table__select-cell"
|
|
58
|
+
}, Ae = ["aria-sort"], je = ["onClick"], Me = { class: "nb-data-table__th-label" }, Ne = {
|
|
59
|
+
key: 1,
|
|
60
|
+
class: "nb-data-table__th-label"
|
|
61
|
+
}, Pe = {
|
|
62
|
+
key: 2,
|
|
63
|
+
scope: "col",
|
|
64
|
+
class: "nb-data-table__th nb-data-table__actions-cell"
|
|
65
|
+
}, Fe = ["role"], Ie = {
|
|
66
|
+
key: 0,
|
|
67
|
+
class: "nb-data-table__td"
|
|
68
|
+
}, Le = {
|
|
69
|
+
key: 1,
|
|
70
|
+
class: "nb-data-table__td"
|
|
71
|
+
}, Re = {
|
|
72
|
+
key: 2,
|
|
73
|
+
class: "nb-data-table__td"
|
|
74
|
+
}, ze = {
|
|
75
|
+
key: 1,
|
|
76
|
+
class: "nb-data-table__state-row"
|
|
77
|
+
}, Be = ["colspan"], Ve = {
|
|
78
|
+
key: 2,
|
|
79
|
+
class: "nb-data-table__state-row"
|
|
80
|
+
}, He = ["colspan"], Ue = [
|
|
81
|
+
"role",
|
|
82
|
+
"aria-selected",
|
|
83
|
+
"tabindex",
|
|
84
|
+
"onClick",
|
|
85
|
+
"onKeydown",
|
|
86
|
+
"onKeyup"
|
|
87
|
+
], We = ["role"], Ge = [
|
|
88
|
+
"aria-expanded",
|
|
89
|
+
"aria-controls",
|
|
90
|
+
"aria-label",
|
|
91
|
+
"onClick"
|
|
92
|
+
], Ke = [
|
|
93
|
+
"checked",
|
|
94
|
+
"aria-label",
|
|
95
|
+
"onChange"
|
|
96
|
+
], qe = ["role", "data-label"], Je = ["role"], Ye = ["colspan", "role"], Xe = ["id", "aria-label"], Ze = {
|
|
97
|
+
key: 1,
|
|
98
|
+
class: "nb-data-table__footer"
|
|
99
|
+
}, w = /* @__PURE__ */ e(/* @__PURE__ */ h({
|
|
100
|
+
__name: "DataTable",
|
|
101
|
+
props: {
|
|
102
|
+
columns: {},
|
|
103
|
+
rows: {},
|
|
104
|
+
rowKey: {},
|
|
105
|
+
size: { default: "lg" },
|
|
106
|
+
sortState: { default: null },
|
|
107
|
+
selectable: { default: "none" },
|
|
108
|
+
selected: { default: () => [] },
|
|
109
|
+
loading: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
default: !1
|
|
112
|
+
},
|
|
113
|
+
skeletonRows: { default: 5 },
|
|
114
|
+
error: { default: void 0 },
|
|
115
|
+
emptyMessage: { default: void 0 },
|
|
116
|
+
stickyHeader: {
|
|
117
|
+
type: Boolean,
|
|
118
|
+
default: !0
|
|
119
|
+
},
|
|
120
|
+
zebra: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: !1
|
|
123
|
+
},
|
|
124
|
+
fill: {
|
|
125
|
+
type: Boolean,
|
|
126
|
+
default: !1
|
|
127
|
+
},
|
|
128
|
+
title: { default: void 0 },
|
|
129
|
+
description: { default: void 0 },
|
|
130
|
+
ariaLabel: { default: void 0 },
|
|
131
|
+
stackOnPhone: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: !1
|
|
134
|
+
},
|
|
135
|
+
expanded: { default: () => [] }
|
|
136
|
+
},
|
|
137
|
+
emits: [
|
|
138
|
+
"sort",
|
|
139
|
+
"update:selected",
|
|
140
|
+
"row-click",
|
|
141
|
+
"update:expanded"
|
|
142
|
+
],
|
|
143
|
+
setup(e, { emit: h }) {
|
|
144
|
+
let w = e, { layerProps: Qe } = n(), T = h, E = ae(), $e = `nb-data-table-select-${x()}`, et = c(() => w.size === "xl" ? "lg" : w.size), D = c(() => w.columns.filter((e) => !e.hidden)), O = c(() => w.selectable !== "none"), k = c(() => !!E["row-actions"]), A = c(() => !!E["row-detail"]), j = c(() => D.value.length + (A.value ? 1 : 0) + (O.value ? 1 : 0) + (k.value ? 1 : 0)), { phone: tt } = r(), M = c(() => w.stackOnPhone && tt.value), N = c(() => (D.value.find((e) => e.primary) ?? D.value.find((e) => !e.phoneHidden && !e.phoneMeta))?.key);
|
|
145
|
+
function nt(e) {
|
|
146
|
+
return e.phoneHidden ? "nb-data-table__td--phone-hidden" : e.key === N.value ? "nb-data-table__td--primary" : e.phoneMeta ? "nb-data-table__td--meta" : "nb-data-table__td--field";
|
|
147
|
+
}
|
|
148
|
+
let rt = c(() => !w.loading && !w.error && w.rows.length > 0 && (w.selectable === "multiple" || D.value.some((e) => e.sortable && !e.phoneHidden)));
|
|
149
|
+
function it(e) {
|
|
150
|
+
if (e.width != null) return { width: typeof e.width == "number" ? `${e.width}px` : e.width };
|
|
151
|
+
}
|
|
152
|
+
function P(e, t) {
|
|
153
|
+
return t[e.key];
|
|
154
|
+
}
|
|
155
|
+
function F(e) {
|
|
156
|
+
return e == null ? "" : String(e);
|
|
157
|
+
}
|
|
158
|
+
let I = (e) => e.column.render?.(e.row, P(e.column, e.row), e.rowIndex) ?? null;
|
|
159
|
+
I.props = [
|
|
160
|
+
"column",
|
|
161
|
+
"row",
|
|
162
|
+
"rowIndex"
|
|
163
|
+
];
|
|
164
|
+
function L(e) {
|
|
165
|
+
let t = w.rowKey;
|
|
166
|
+
return typeof t == "function" ? t(e) : e[t];
|
|
167
|
+
}
|
|
168
|
+
let R = c(() => new Set(w.selected)), at = c(() => w.selected), z = c(() => w.selected.length);
|
|
169
|
+
function B(e) {
|
|
170
|
+
return R.value.has(L(e));
|
|
171
|
+
}
|
|
172
|
+
let V = c(() => w.rows.map((e) => L(e))), H = c(() => V.value.length > 0 && V.value.every((e) => R.value.has(e))), ot = c(() => !H.value && V.value.some((e) => R.value.has(e))), U = re(null), W = !1;
|
|
173
|
+
function G(e) {
|
|
174
|
+
W = e.shiftKey;
|
|
175
|
+
}
|
|
176
|
+
oe(V, () => {
|
|
177
|
+
U.value = null;
|
|
178
|
+
});
|
|
179
|
+
function st(e, t) {
|
|
180
|
+
let n = L(e), r = new Set(w.selected), i = !r.has(n), a = U.value, o = (e) => {
|
|
181
|
+
i ? r.add(e) : r.delete(e);
|
|
182
|
+
};
|
|
183
|
+
if (W && a !== null && a !== t) {
|
|
184
|
+
let e = Math.min(a, t), n = Math.max(a, t);
|
|
185
|
+
for (let t = e; t <= n; t++) {
|
|
186
|
+
let e = w.rows[t];
|
|
187
|
+
e && o(L(e));
|
|
188
|
+
}
|
|
189
|
+
} else o(n), U.value = t;
|
|
190
|
+
W = !1, T("update:selected", [...r]);
|
|
191
|
+
}
|
|
192
|
+
function ct(e) {
|
|
193
|
+
T("update:selected", [L(e)]);
|
|
194
|
+
}
|
|
195
|
+
function lt() {
|
|
196
|
+
let e = new Set(w.selected);
|
|
197
|
+
H.value ? V.value.forEach((t) => e.delete(t)) : V.value.forEach((t) => e.add(t)), T("update:selected", [...e]);
|
|
198
|
+
}
|
|
199
|
+
function K() {
|
|
200
|
+
T("update:selected", []);
|
|
201
|
+
}
|
|
202
|
+
let ut = c(() => w.selectable !== "none" && !!E["batch-actions"]), q = c(() => ut.value && z.value > 0), dt = `nb-data-table-detail-${x()}`, ft = c(() => new Set(w.expanded));
|
|
203
|
+
function J(e) {
|
|
204
|
+
return A.value && ft.value.has(L(e));
|
|
205
|
+
}
|
|
206
|
+
function pt(e) {
|
|
207
|
+
let t = L(e), n = w.expanded.filter((e) => e !== t);
|
|
208
|
+
n.length === w.expanded.length && n.push(t), T("update:expanded", n);
|
|
209
|
+
}
|
|
210
|
+
function mt(e) {
|
|
211
|
+
return `${dt}-${e}`;
|
|
212
|
+
}
|
|
213
|
+
function ht(e, t) {
|
|
214
|
+
let n = D.value.find((e) => e.key === N.value);
|
|
215
|
+
return `Details for ${(n ? F(P(n, e)).trim() : "") || `row ${t + 1}`}`;
|
|
216
|
+
}
|
|
217
|
+
let gt = c(() => !!w.title || !!w.description || !!E.toolbar), Y = c(() => !!E.search || !!E["toolbar-actions"] || ut.value), _t = c(() => gt.value || Y.value);
|
|
218
|
+
function X(e) {
|
|
219
|
+
return !!w.sortState && w.sortState.key === e.key && w.sortState.direction !== "none";
|
|
220
|
+
}
|
|
221
|
+
function vt(e) {
|
|
222
|
+
return X(e) ? w.sortState.direction === "asc" ? "ascending" : "descending" : "none";
|
|
223
|
+
}
|
|
224
|
+
function yt(e) {
|
|
225
|
+
return X(e) ? w.sortState.direction === "asc" ? se : ue : le;
|
|
226
|
+
}
|
|
227
|
+
function bt(e) {
|
|
228
|
+
return e === "asc" ? "desc" : e === "desc" ? "none" : "asc";
|
|
229
|
+
}
|
|
230
|
+
function xt(e) {
|
|
231
|
+
let t = w.sortState && w.sortState.key === e.key ? w.sortState.direction : "none";
|
|
232
|
+
T("sort", {
|
|
233
|
+
key: e.key,
|
|
234
|
+
direction: bt(t)
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
let St = ee(), Z = c(() => !!St?.vnode.props?.onRowClick);
|
|
238
|
+
function Q(e, t) {
|
|
239
|
+
T("row-click", e, t);
|
|
240
|
+
}
|
|
241
|
+
function $(e) {
|
|
242
|
+
return Z.value && e.target === e.currentTarget && !e.altKey && !e.ctrlKey && !e.metaKey;
|
|
243
|
+
}
|
|
244
|
+
function Ct(e, t, n) {
|
|
245
|
+
$(e) && (e.key === "Enter" ? (e.preventDefault(), e.repeat || Q(t, n)) : e.key === " " && e.preventDefault());
|
|
246
|
+
}
|
|
247
|
+
function wt(e, t, n) {
|
|
248
|
+
!$(e) || e.key !== " " || (e.preventDefault(), Q(t, n));
|
|
249
|
+
}
|
|
250
|
+
return (n, r) => (_(), d("div", te({ class: [
|
|
251
|
+
"nb-data-table",
|
|
252
|
+
`nb-data-table--${e.size}`,
|
|
253
|
+
{ "nb-data-table--zebra": e.zebra },
|
|
254
|
+
{ "nb-data-table--sticky": e.stickyHeader },
|
|
255
|
+
{ "nb-data-table--fill": e.fill },
|
|
256
|
+
{ "nb-data-table--stacked": M.value },
|
|
257
|
+
{ "nb-data-table--stacked-headless": M.value && !rt.value },
|
|
258
|
+
{ "nb-data-table--expandable": A.value }
|
|
259
|
+
] }, ie(Qe)), [
|
|
260
|
+
_t.value ? (_(), d("div", de, [gt.value ? (_(), d("div", fe, [y(n.$slots, "toolbar", { selectedCount: z.value }, () => [e.title ? (_(), d("h2", pe, b(e.title), 1)) : u("", !0), e.description ? (_(), d("p", me, b(e.description), 1)) : u("", !0)], !0)])) : u("", !0), Y.value ? (_(), d("div", he, [n.$slots.search || n.$slots["toolbar-actions"] ? (_(), d("div", {
|
|
261
|
+
key: 0,
|
|
262
|
+
class: g(["nb-data-table__toolbar-tools", { "nb-data-table__toolbar-tools--search": !!n.$slots.search }]),
|
|
263
|
+
inert: q.value || void 0,
|
|
264
|
+
"aria-hidden": q.value || void 0
|
|
265
|
+
}, [n.$slots.search ? (_(), d("div", _e, [y(n.$slots, "search", {}, void 0, !0)])) : u("", !0), y(n.$slots, "toolbar-actions", {}, void 0, !0)], 10, ge)) : u("", !0), q.value ? (_(), d("div", ve, [
|
|
266
|
+
f("span", ye, b(z.value) + " selected ", 1),
|
|
267
|
+
f("div", be, [y(n.$slots, "batch-actions", {
|
|
268
|
+
selectedKeys: at.value,
|
|
269
|
+
clear: K
|
|
270
|
+
}, void 0, !0)]),
|
|
271
|
+
m(i, {
|
|
272
|
+
class: "nb-data-table__batch-cancel",
|
|
273
|
+
variant: "ghost",
|
|
274
|
+
size: et.value,
|
|
275
|
+
onClick: K
|
|
276
|
+
}, {
|
|
277
|
+
default: S(() => [...r[3] ||= [p(" Cancel ", -1)]]),
|
|
278
|
+
_: 1
|
|
279
|
+
}, 8, ["size"])
|
|
280
|
+
])) : u("", !0)])) : u("", !0)])) : u("", !0),
|
|
281
|
+
f("div", xe, [f("table", {
|
|
282
|
+
class: "nb-data-table__table",
|
|
283
|
+
role: M.value ? "table" : void 0,
|
|
284
|
+
"aria-label": e.ariaLabel || e.title || void 0,
|
|
285
|
+
"aria-busy": e.loading || void 0
|
|
286
|
+
}, [
|
|
287
|
+
f("colgroup", null, [
|
|
288
|
+
A.value ? (_(), d("col", Ce)) : u("", !0),
|
|
289
|
+
O.value ? (_(), d("col", we)) : u("", !0),
|
|
290
|
+
(_(!0), d(s, null, v(D.value, (e) => (_(), d("col", {
|
|
291
|
+
key: `col-${e.key}`,
|
|
292
|
+
style: ne(it(e))
|
|
293
|
+
}, null, 4))), 128)),
|
|
294
|
+
k.value ? (_(), d("col", Te)) : u("", !0)
|
|
295
|
+
]),
|
|
296
|
+
f("thead", {
|
|
297
|
+
class: "nb-data-table__head",
|
|
298
|
+
role: M.value ? "rowgroup" : void 0
|
|
299
|
+
}, [f("tr", { role: M.value ? "row" : void 0 }, [
|
|
300
|
+
A.value ? (_(), d("th", Oe, [...r[4] ||= [f("span", { class: "nb-sr-only" }, "Row details", -1)]])) : u("", !0),
|
|
301
|
+
O.value ? (_(), d("th", ke, [e.selectable === "multiple" ? (_(), l(o, {
|
|
302
|
+
key: 0,
|
|
303
|
+
"model-value": H.value,
|
|
304
|
+
indeterminate: ot.value,
|
|
305
|
+
"aria-label": "Select all rows",
|
|
306
|
+
"onUpdate:modelValue": lt
|
|
307
|
+
}, null, 8, ["model-value", "indeterminate"])) : u("", !0)])) : u("", !0),
|
|
308
|
+
(_(!0), d(s, null, v(D.value, (e) => (_(), d("th", {
|
|
309
|
+
key: `th-${e.key}`,
|
|
310
|
+
scope: "col",
|
|
311
|
+
class: g([
|
|
312
|
+
"nb-data-table__th",
|
|
313
|
+
`nb-data-table__th--${e.align || "left"}`,
|
|
314
|
+
{ "nb-data-table__th--sortable": e.sortable },
|
|
315
|
+
{ "nb-data-table__th--sorted": X(e) },
|
|
316
|
+
M.value && e.phoneHidden && "nb-data-table__th--phone-hidden"
|
|
317
|
+
]),
|
|
318
|
+
"aria-sort": e.sortable ? vt(e) : void 0
|
|
319
|
+
}, [e.sortable ? (_(), d("button", {
|
|
320
|
+
key: 0,
|
|
321
|
+
type: "button",
|
|
322
|
+
class: "nb-data-table__sort",
|
|
323
|
+
onClick: (t) => xt(e)
|
|
324
|
+
}, [f("span", Me, [y(n.$slots, `header-${e.key}`, { column: e }, () => [p(b(e.header), 1)], !0)]), m(t, {
|
|
325
|
+
name: yt(e),
|
|
326
|
+
class: "nb-data-table__sort-icon",
|
|
327
|
+
"aria-hidden": "true"
|
|
328
|
+
}, null, 8, ["name"])], 8, je)) : (_(), d("span", Ne, [y(n.$slots, `header-${e.key}`, { column: e }, () => [p(b(e.header), 1)], !0)]))], 10, Ae))), 128)),
|
|
329
|
+
k.value ? (_(), d("th", Pe, [...r[5] ||= [f("span", { class: "nb-sr-only" }, "Row actions", -1)]])) : u("", !0)
|
|
330
|
+
], 8, De)], 8, Ee),
|
|
331
|
+
f("tbody", {
|
|
332
|
+
class: "nb-data-table__body",
|
|
333
|
+
role: M.value ? "rowgroup" : void 0
|
|
334
|
+
}, [e.loading ? (_(!0), d(s, { key: 0 }, v(e.skeletonRows, (e) => (_(), d("tr", {
|
|
335
|
+
key: `skeleton-${e}`,
|
|
336
|
+
class: "nb-data-table__row nb-data-table__row--skeleton"
|
|
337
|
+
}, [
|
|
338
|
+
A.value ? (_(), d("td", Ie)) : u("", !0),
|
|
339
|
+
O.value ? (_(), d("td", Le, [...r[6] ||= [f("span", { class: "nb-data-table__skeleton nb-data-table__skeleton--box" }, null, -1)]])) : u("", !0),
|
|
340
|
+
(_(!0), d(s, null, v(D.value, (t) => (_(), d("td", {
|
|
341
|
+
key: `sk-${e}-${t.key}`,
|
|
342
|
+
class: "nb-data-table__td"
|
|
343
|
+
}, [...r[7] ||= [f("span", { class: "nb-data-table__skeleton" }, null, -1)]]))), 128)),
|
|
344
|
+
k.value ? (_(), d("td", Re, [...r[8] ||= [f("span", { class: "nb-data-table__skeleton nb-data-table__skeleton--box" }, null, -1)]])) : u("", !0)
|
|
345
|
+
]))), 128)) : e.error ? (_(), d("tr", ze, [f("td", {
|
|
346
|
+
colspan: j.value,
|
|
347
|
+
class: "nb-data-table__state nb-data-table__state--error"
|
|
348
|
+
}, [y(n.$slots, "error", { error: e.error }, () => [m(a, {
|
|
349
|
+
is: "span",
|
|
350
|
+
align: "center",
|
|
351
|
+
justify: "center",
|
|
352
|
+
gap: "xs",
|
|
353
|
+
class: "nb-data-table__state-inner"
|
|
354
|
+
}, {
|
|
355
|
+
default: S(() => [m(t, {
|
|
356
|
+
name: "warning-circle-fill",
|
|
357
|
+
"aria-hidden": "true"
|
|
358
|
+
}), f("span", null, b(e.error), 1)]),
|
|
359
|
+
_: 1
|
|
360
|
+
})], !0)], 8, Be)])) : e.rows.length ? (_(!0), d(s, { key: 3 }, v(e.rows, (i, a) => (_(), d(s, { key: L(i) }, [f("tr", {
|
|
361
|
+
class: g([
|
|
362
|
+
"nb-data-table__row",
|
|
363
|
+
{ "nb-data-table__row--selected": B(i) },
|
|
364
|
+
{ "nb-data-table__row--clickable": Z.value },
|
|
365
|
+
A.value && {
|
|
366
|
+
"nb-data-table__row--expanded": J(i),
|
|
367
|
+
"nb-data-table__row--even": a % 2 == 1
|
|
368
|
+
}
|
|
369
|
+
]),
|
|
370
|
+
role: M.value ? "row" : void 0,
|
|
371
|
+
"aria-selected": e.selectable === "none" ? void 0 : B(i),
|
|
372
|
+
tabindex: Z.value ? 0 : void 0,
|
|
373
|
+
onClick: (e) => Q(i, a),
|
|
374
|
+
onKeydown: (e) => Ct(e, i, a),
|
|
375
|
+
onKeyup: (e) => wt(e, i, a)
|
|
376
|
+
}, [
|
|
377
|
+
A.value ? (_(), d("td", {
|
|
378
|
+
key: 0,
|
|
379
|
+
class: "nb-data-table__td nb-data-table__expand-cell",
|
|
380
|
+
role: M.value ? "cell" : void 0,
|
|
381
|
+
onClick: r[0] ||= C(() => {}, ["stop"])
|
|
382
|
+
}, [f("button", {
|
|
383
|
+
type: "button",
|
|
384
|
+
class: "nb-data-table__expand",
|
|
385
|
+
"aria-expanded": J(i),
|
|
386
|
+
"aria-controls": J(i) ? mt(a) : void 0,
|
|
387
|
+
"aria-label": ht(i, a),
|
|
388
|
+
onClick: (e) => pt(i)
|
|
389
|
+
}, [m(t, {
|
|
390
|
+
name: ce,
|
|
391
|
+
class: "nb-data-table__expand-icon",
|
|
392
|
+
"aria-hidden": "true"
|
|
393
|
+
})], 8, Ge)], 8, We)) : u("", !0),
|
|
394
|
+
O.value ? (_(), d("td", {
|
|
395
|
+
key: 1,
|
|
396
|
+
class: "nb-data-table__td nb-data-table__select-cell",
|
|
397
|
+
onClick: r[1] ||= C(() => {}, ["stop"]),
|
|
398
|
+
onMousedown: G,
|
|
399
|
+
onKeydown: G
|
|
400
|
+
}, [e.selectable === "multiple" ? (_(), l(o, {
|
|
401
|
+
key: 0,
|
|
402
|
+
"model-value": B(i),
|
|
403
|
+
"aria-label": `Select row ${a + 1}`,
|
|
404
|
+
"onUpdate:modelValue": (e) => st(i, a)
|
|
405
|
+
}, null, 8, [
|
|
406
|
+
"model-value",
|
|
407
|
+
"aria-label",
|
|
408
|
+
"onUpdate:modelValue"
|
|
409
|
+
])) : (_(), d("input", {
|
|
410
|
+
key: 1,
|
|
411
|
+
type: "radio",
|
|
412
|
+
class: "nb-data-table__radio",
|
|
413
|
+
name: $e,
|
|
414
|
+
checked: B(i),
|
|
415
|
+
"aria-label": `Select row ${a + 1}`,
|
|
416
|
+
onChange: (e) => ct(i)
|
|
417
|
+
}, null, 40, Ke))], 32)) : u("", !0),
|
|
418
|
+
(_(!0), d(s, null, v(D.value, (t) => (_(), d("td", {
|
|
419
|
+
key: `td-${L(i)}-${t.key}`,
|
|
420
|
+
class: g([
|
|
421
|
+
"nb-data-table__td",
|
|
422
|
+
`nb-data-table__td--${t.align || "left"}`,
|
|
423
|
+
t.cellClass,
|
|
424
|
+
M.value && nt(t)
|
|
425
|
+
]),
|
|
426
|
+
role: M.value ? "cell" : void 0,
|
|
427
|
+
"data-label": e.stackOnPhone ? t.header : void 0
|
|
428
|
+
}, [y(n.$slots, `cell-${t.key}`, {
|
|
429
|
+
row: i,
|
|
430
|
+
value: P(t, i),
|
|
431
|
+
column: t,
|
|
432
|
+
rowIndex: a
|
|
433
|
+
}, () => [t.render ? (_(), l(I, {
|
|
434
|
+
key: 0,
|
|
435
|
+
column: t,
|
|
436
|
+
row: i,
|
|
437
|
+
"row-index": a
|
|
438
|
+
}, null, 8, [
|
|
439
|
+
"column",
|
|
440
|
+
"row",
|
|
441
|
+
"row-index"
|
|
442
|
+
])) : (_(), d(s, { key: 1 }, [p(b(F(P(t, i))), 1)], 64))], !0)], 10, qe))), 128)),
|
|
443
|
+
k.value ? (_(), d("td", {
|
|
444
|
+
key: 2,
|
|
445
|
+
class: "nb-data-table__td nb-data-table__actions-cell",
|
|
446
|
+
onClick: r[2] ||= C(() => {}, ["stop"])
|
|
447
|
+
}, [y(n.$slots, "row-actions", {
|
|
448
|
+
row: i,
|
|
449
|
+
rowIndex: a
|
|
450
|
+
}, void 0, !0)])) : u("", !0)
|
|
451
|
+
], 42, Ue), J(i) ? (_(), d("tr", {
|
|
452
|
+
key: 0,
|
|
453
|
+
class: "nb-data-table__detail-row",
|
|
454
|
+
role: M.value ? "row" : void 0
|
|
455
|
+
}, [f("td", {
|
|
456
|
+
colspan: j.value,
|
|
457
|
+
class: "nb-data-table__detail-cell",
|
|
458
|
+
role: M.value ? "cell" : void 0
|
|
459
|
+
}, [f("div", {
|
|
460
|
+
id: mt(a),
|
|
461
|
+
class: "nb-data-table__detail",
|
|
462
|
+
role: "region",
|
|
463
|
+
"aria-label": ht(i, a)
|
|
464
|
+
}, [y(n.$slots, "row-detail", {
|
|
465
|
+
row: i,
|
|
466
|
+
rowIndex: a
|
|
467
|
+
}, void 0, !0)], 8, Xe)], 8, Ye)], 8, Je)) : u("", !0)], 64))), 128)) : (_(), d("tr", Ve, [f("td", {
|
|
468
|
+
colspan: j.value,
|
|
469
|
+
class: "nb-data-table__state nb-data-table__state--empty"
|
|
470
|
+
}, [y(n.$slots, "empty", {}, () => [f("span", null, b(e.emptyMessage || "No data to display"), 1)], !0)], 8, He)]))], 8, Fe)
|
|
471
|
+
], 8, Se)]),
|
|
472
|
+
n.$slots.footer ? (_(), d("div", Ze, [y(n.$slots, "footer", {}, void 0, !0)])) : u("", !0)
|
|
473
|
+
], 16));
|
|
474
|
+
}
|
|
475
|
+
}), [["__scopeId", "data-v-e1388797"]]);
|
|
476
|
+
//#endregion
|
|
477
|
+
export { w as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Icon-C8R_r_In.cjs`),r=require(`./composables/useSurfaceLayer.composable.cjs`),i=require(`./composables/usePhoneLayout.composable.cjs`),a=require(`./Button-B-8ikYRN.cjs`),o=require(`./Grid-CXE0B85G.cjs`),s=require(`./Checkbox-hoojePrb.cjs`);let c=require(`vue`),l=require(`@nubisco/ui/icons/arrow-up`);l=e.n(l);let u=require(`@nubisco/ui/icons/caret-right`);u=e.n(u);let d=require(`@nubisco/ui/icons/arrows-down-up`);d=e.n(d);let f=require(`@nubisco/ui/icons/arrow-down`);f=e.n(f);var ee={key:0,class:`nb-data-table__toolbar`},te={key:0,class:`nb-data-table__toolbar-heading`},ne={key:0,class:`nb-data-table__title`},re={key:1,class:`nb-data-table__description`},ie={key:1,class:`nb-data-table__toolbar-row`},ae=[`inert`,`aria-hidden`],oe={key:0,class:`nb-data-table__toolbar-search`},se={key:1,class:`nb-data-table__batch`,role:`region`,"aria-label":`Table batch actions`},ce={class:`nb-data-table__batch-count`},le={class:`nb-data-table__batch-actions`},ue={class:`nb-data-table__scroll`},de=[`role`,`aria-label`,`aria-busy`],fe={key:0,class:`nb-data-table__col-expand`},p={key:1,class:`nb-data-table__col-select`},pe={key:2,class:`nb-data-table__col-actions`},me=[`role`],he=[`role`],ge={key:0,scope:`col`,class:`nb-data-table__th nb-data-table__expand-cell`},_e={key:1,scope:`col`,class:`nb-data-table__th nb-data-table__select-cell`},ve=[`aria-sort`],ye=[`onClick`],be={class:`nb-data-table__th-label`},xe={key:1,class:`nb-data-table__th-label`},Se={key:2,scope:`col`,class:`nb-data-table__th nb-data-table__actions-cell`},Ce=[`role`],m={key:0,class:`nb-data-table__td`},we={key:1,class:`nb-data-table__td`},Te={key:2,class:`nb-data-table__td`},Ee={key:1,class:`nb-data-table__state-row`},De=[`colspan`],Oe={key:2,class:`nb-data-table__state-row`},ke=[`colspan`],Ae=[`role`,`aria-selected`,`tabindex`,`onClick`,`onKeydown`,`onKeyup`],je=[`role`],Me=[`aria-expanded`,`aria-controls`,`aria-label`,`onClick`],Ne=[`checked`,`aria-label`,`onChange`],Pe=[`role`,`data-label`],h=[`role`],g=[`colspan`,`role`],_=[`id`,`aria-label`],v={key:1,class:`nb-data-table__footer`},y=(0,c.defineComponent)({__name:`DataTable`,props:{columns:{},rows:{},rowKey:{},size:{default:`lg`},sortState:{default:null},selectable:{default:`none`},selected:{default:()=>[]},loading:{type:Boolean,default:!1},skeletonRows:{default:5},error:{default:void 0},emptyMessage:{default:void 0},stickyHeader:{type:Boolean,default:!0},zebra:{type:Boolean,default:!1},fill:{type:Boolean,default:!1},title:{default:void 0},description:{default:void 0},ariaLabel:{default:void 0},stackOnPhone:{type:Boolean,default:!1},expanded:{default:()=>[]}},emits:[`sort`,`update:selected`,`row-click`,`update:expanded`],setup(e,{emit:t}){let y=e,{layerProps:b}=r.useSurfaceLayer(),x=t,S=(0,c.useSlots)(),Fe=`nb-data-table-select-${(0,c.useId)()}`,Ie=(0,c.computed)(()=>y.size===`xl`?`lg`:y.size),C=(0,c.computed)(()=>y.columns.filter(e=>!e.hidden)),w=(0,c.computed)(()=>y.selectable!==`none`),T=(0,c.computed)(()=>!!S[`row-actions`]),E=(0,c.computed)(()=>!!S[`row-detail`]),D=(0,c.computed)(()=>C.value.length+(E.value?1:0)+(w.value?1:0)+(T.value?1:0)),{phone:Le}=i.usePhoneLayout(),O=(0,c.computed)(()=>y.stackOnPhone&&Le.value),k=(0,c.computed)(()=>(C.value.find(e=>e.primary)??C.value.find(e=>!e.phoneHidden&&!e.phoneMeta))?.key);function Re(e){return e.phoneHidden?`nb-data-table__td--phone-hidden`:e.key===k.value?`nb-data-table__td--primary`:e.phoneMeta?`nb-data-table__td--meta`:`nb-data-table__td--field`}let ze=(0,c.computed)(()=>!y.loading&&!y.error&&y.rows.length>0&&(y.selectable===`multiple`||C.value.some(e=>e.sortable&&!e.phoneHidden)));function Be(e){if(e.width!=null)return{width:typeof e.width==`number`?`${e.width}px`:e.width}}function A(e,t){return t[e.key]}function j(e){return e==null?``:String(e)}let M=e=>e.column.render?.(e.row,A(e.column,e.row),e.rowIndex)??null;M.props=[`column`,`row`,`rowIndex`];function N(e){let t=y.rowKey;return typeof t==`function`?t(e):e[t]}let P=(0,c.computed)(()=>new Set(y.selected)),Ve=(0,c.computed)(()=>y.selected),F=(0,c.computed)(()=>y.selected.length);function I(e){return P.value.has(N(e))}let L=(0,c.computed)(()=>y.rows.map(e=>N(e))),R=(0,c.computed)(()=>L.value.length>0&&L.value.every(e=>P.value.has(e))),He=(0,c.computed)(()=>!R.value&&L.value.some(e=>P.value.has(e))),z=(0,c.ref)(null),B=!1;function V(e){B=e.shiftKey}(0,c.watch)(L,()=>{z.value=null});function Ue(e,t){let n=N(e),r=new Set(y.selected),i=!r.has(n),a=z.value,o=e=>{i?r.add(e):r.delete(e)};if(B&&a!==null&&a!==t){let e=Math.min(a,t),n=Math.max(a,t);for(let t=e;t<=n;t++){let e=y.rows[t];e&&o(N(e))}}else o(n),z.value=t;B=!1,x(`update:selected`,[...r])}function We(e){x(`update:selected`,[N(e)])}function Ge(){let e=new Set(y.selected);R.value?L.value.forEach(t=>e.delete(t)):L.value.forEach(t=>e.add(t)),x(`update:selected`,[...e])}function H(){x(`update:selected`,[])}let U=(0,c.computed)(()=>y.selectable!==`none`&&!!S[`batch-actions`]),W=(0,c.computed)(()=>U.value&&F.value>0),Ke=`nb-data-table-detail-${(0,c.useId)()}`,qe=(0,c.computed)(()=>new Set(y.expanded));function G(e){return E.value&&qe.value.has(N(e))}function Je(e){let t=N(e),n=y.expanded.filter(e=>e!==t);n.length===y.expanded.length&&n.push(t),x(`update:expanded`,n)}function K(e){return`${Ke}-${e}`}function q(e,t){let n=C.value.find(e=>e.key===k.value);return`Details for ${(n?j(A(n,e)).trim():``)||`row ${t+1}`}`}let J=(0,c.computed)(()=>!!y.title||!!y.description||!!S.toolbar),Y=(0,c.computed)(()=>!!S.search||!!S[`toolbar-actions`]||U.value),Ye=(0,c.computed)(()=>J.value||Y.value);function X(e){return!!y.sortState&&y.sortState.key===e.key&&y.sortState.direction!==`none`}function Xe(e){return X(e)?y.sortState.direction===`asc`?`ascending`:`descending`:`none`}function Ze(e){return X(e)?y.sortState.direction===`asc`?l:f:d}function Qe(e){return e===`asc`?`desc`:e===`desc`?`none`:`asc`}function $e(e){let t=y.sortState&&y.sortState.key===e.key?y.sortState.direction:`none`;x(`sort`,{key:e.key,direction:Qe(t)})}let et=(0,c.getCurrentInstance)(),Z=(0,c.computed)(()=>!!et?.vnode.props?.onRowClick);function Q(e,t){x(`row-click`,e,t)}function $(e){return Z.value&&e.target===e.currentTarget&&!e.altKey&&!e.ctrlKey&&!e.metaKey}function tt(e,t,n){$(e)&&(e.key===`Enter`?(e.preventDefault(),e.repeat||Q(t,n)):e.key===` `&&e.preventDefault())}function nt(e,t,n){!$(e)||e.key!==` `||(e.preventDefault(),Q(t,n))}return(t,r)=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,(0,c.mergeProps)({class:[`nb-data-table`,`nb-data-table--${e.size}`,{"nb-data-table--zebra":e.zebra},{"nb-data-table--sticky":e.stickyHeader},{"nb-data-table--fill":e.fill},{"nb-data-table--stacked":O.value},{"nb-data-table--stacked-headless":O.value&&!ze.value},{"nb-data-table--expandable":E.value}]},(0,c.unref)(b)),[Ye.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,ee,[J.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,te,[(0,c.renderSlot)(t.$slots,`toolbar`,{selectedCount:F.value},()=>[e.title?((0,c.openBlock)(),(0,c.createElementBlock)(`h2`,ne,(0,c.toDisplayString)(e.title),1)):(0,c.createCommentVNode)(``,!0),e.description?((0,c.openBlock)(),(0,c.createElementBlock)(`p`,re,(0,c.toDisplayString)(e.description),1)):(0,c.createCommentVNode)(``,!0)],!0)])):(0,c.createCommentVNode)(``,!0),Y.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,ie,[t.$slots.search||t.$slots[`toolbar-actions`]?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,class:(0,c.normalizeClass)([`nb-data-table__toolbar-tools`,{"nb-data-table__toolbar-tools--search":!!t.$slots.search}]),inert:W.value||void 0,"aria-hidden":W.value||void 0},[t.$slots.search?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,oe,[(0,c.renderSlot)(t.$slots,`search`,{},void 0,!0)])):(0,c.createCommentVNode)(``,!0),(0,c.renderSlot)(t.$slots,`toolbar-actions`,{},void 0,!0)],10,ae)):(0,c.createCommentVNode)(``,!0),W.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,se,[(0,c.createElementVNode)(`span`,ce,(0,c.toDisplayString)(F.value)+` selected `,1),(0,c.createElementVNode)(`div`,le,[(0,c.renderSlot)(t.$slots,`batch-actions`,{selectedKeys:Ve.value,clear:H},void 0,!0)]),(0,c.createVNode)(a.t,{class:`nb-data-table__batch-cancel`,variant:`ghost`,size:Ie.value,onClick:H},{default:(0,c.withCtx)(()=>[...r[3]||=[(0,c.createTextVNode)(` Cancel `,-1)]]),_:1},8,[`size`])])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,ue,[(0,c.createElementVNode)(`table`,{class:`nb-data-table__table`,role:O.value?`table`:void 0,"aria-label":e.ariaLabel||e.title||void 0,"aria-busy":e.loading||void 0},[(0,c.createElementVNode)(`colgroup`,null,[E.value?((0,c.openBlock)(),(0,c.createElementBlock)(`col`,fe)):(0,c.createCommentVNode)(``,!0),w.value?((0,c.openBlock)(),(0,c.createElementBlock)(`col`,p)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(C.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`col`,{key:`col-${e.key}`,style:(0,c.normalizeStyle)(Be(e))},null,4))),128)),T.value?((0,c.openBlock)(),(0,c.createElementBlock)(`col`,pe)):(0,c.createCommentVNode)(``,!0)]),(0,c.createElementVNode)(`thead`,{class:`nb-data-table__head`,role:O.value?`rowgroup`:void 0},[(0,c.createElementVNode)(`tr`,{role:O.value?`row`:void 0},[E.value?((0,c.openBlock)(),(0,c.createElementBlock)(`th`,ge,[...r[4]||=[(0,c.createElementVNode)(`span`,{class:`nb-sr-only`},`Row details`,-1)]])):(0,c.createCommentVNode)(``,!0),w.value?((0,c.openBlock)(),(0,c.createElementBlock)(`th`,_e,[e.selectable===`multiple`?((0,c.openBlock)(),(0,c.createBlock)(s.t,{key:0,"model-value":R.value,indeterminate:He.value,"aria-label":`Select all rows`,"onUpdate:modelValue":Ge},null,8,[`model-value`,`indeterminate`])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(C.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`th`,{key:`th-${e.key}`,scope:`col`,class:(0,c.normalizeClass)([`nb-data-table__th`,`nb-data-table__th--${e.align||`left`}`,{"nb-data-table__th--sortable":e.sortable},{"nb-data-table__th--sorted":X(e)},O.value&&e.phoneHidden&&`nb-data-table__th--phone-hidden`]),"aria-sort":e.sortable?Xe(e):void 0},[e.sortable?((0,c.openBlock)(),(0,c.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-data-table__sort`,onClick:t=>$e(e)},[(0,c.createElementVNode)(`span`,be,[(0,c.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.header),1)],!0)]),(0,c.createVNode)(n.t,{name:Ze(e),class:`nb-data-table__sort-icon`,"aria-hidden":`true`},null,8,[`name`])],8,ye)):((0,c.openBlock)(),(0,c.createElementBlock)(`span`,xe,[(0,c.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.header),1)],!0)]))],10,ve))),128)),T.value?((0,c.openBlock)(),(0,c.createElementBlock)(`th`,Se,[...r[5]||=[(0,c.createElementVNode)(`span`,{class:`nb-sr-only`},`Row actions`,-1)]])):(0,c.createCommentVNode)(``,!0)],8,he)],8,me),(0,c.createElementVNode)(`tbody`,{class:`nb-data-table__body`,role:O.value?`rowgroup`:void 0},[e.loading?((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,{key:0},(0,c.renderList)(e.skeletonRows,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,{key:`skeleton-${e}`,class:`nb-data-table__row nb-data-table__row--skeleton`},[E.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,m)):(0,c.createCommentVNode)(``,!0),w.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,we,[...r[6]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(C.value,t=>((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:`sk-${e}-${t.key}`,class:`nb-data-table__td`},[...r[7]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton`},null,-1)]]))),128)),T.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,Te,[...r[8]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,c.createCommentVNode)(``,!0)]))),128)):e.error?((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,Ee,[(0,c.createElementVNode)(`td`,{colspan:D.value,class:`nb-data-table__state nb-data-table__state--error`},[(0,c.renderSlot)(t.$slots,`error`,{error:e.error},()=>[(0,c.createVNode)(o.t,{is:`span`,align:`center`,justify:`center`,gap:`xs`,class:`nb-data-table__state-inner`},{default:(0,c.withCtx)(()=>[(0,c.createVNode)(n.t,{name:`warning-circle-fill`,"aria-hidden":`true`}),(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(e.error),1)]),_:1})],!0)],8,De)])):e.rows.length?((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,{key:3},(0,c.renderList)(e.rows,(i,a)=>((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:N(i)},[(0,c.createElementVNode)(`tr`,{class:(0,c.normalizeClass)([`nb-data-table__row`,{"nb-data-table__row--selected":I(i)},{"nb-data-table__row--clickable":Z.value},E.value&&{"nb-data-table__row--expanded":G(i),"nb-data-table__row--even":a%2==1}]),role:O.value?`row`:void 0,"aria-selected":e.selectable===`none`?void 0:I(i),tabindex:Z.value?0:void 0,onClick:e=>Q(i,a),onKeydown:e=>tt(e,i,a),onKeyup:e=>nt(e,i,a)},[E.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:0,class:`nb-data-table__td nb-data-table__expand-cell`,role:O.value?`cell`:void 0,onClick:r[0]||=(0,c.withModifiers)(()=>{},[`stop`])},[(0,c.createElementVNode)(`button`,{type:`button`,class:`nb-data-table__expand`,"aria-expanded":G(i),"aria-controls":G(i)?K(a):void 0,"aria-label":q(i,a),onClick:e=>Je(i)},[(0,c.createVNode)(n.t,{name:u,class:`nb-data-table__expand-icon`,"aria-hidden":`true`})],8,Me)],8,je)):(0,c.createCommentVNode)(``,!0),w.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:1,class:`nb-data-table__td nb-data-table__select-cell`,onClick:r[1]||=(0,c.withModifiers)(()=>{},[`stop`]),onMousedown:V,onKeydown:V},[e.selectable===`multiple`?((0,c.openBlock)(),(0,c.createBlock)(s.t,{key:0,"model-value":I(i),"aria-label":`Select row ${a+1}`,"onUpdate:modelValue":e=>Ue(i,a)},null,8,[`model-value`,`aria-label`,`onUpdate:modelValue`])):((0,c.openBlock)(),(0,c.createElementBlock)(`input`,{key:1,type:`radio`,class:`nb-data-table__radio`,name:Fe,checked:I(i),"aria-label":`Select row ${a+1}`,onChange:e=>We(i)},null,40,Ne))],32)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(C.value,n=>((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:`td-${N(i)}-${n.key}`,class:(0,c.normalizeClass)([`nb-data-table__td`,`nb-data-table__td--${n.align||`left`}`,n.cellClass,O.value&&Re(n)]),role:O.value?`cell`:void 0,"data-label":e.stackOnPhone?n.header:void 0},[(0,c.renderSlot)(t.$slots,`cell-${n.key}`,{row:i,value:A(n,i),column:n,rowIndex:a},()=>[n.render?((0,c.openBlock)(),(0,c.createBlock)(M,{key:0,column:n,row:i,"row-index":a},null,8,[`column`,`row`,`row-index`])):((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:1},[(0,c.createTextVNode)((0,c.toDisplayString)(j(A(n,i))),1)],64))],!0)],10,Pe))),128)),T.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:2,class:`nb-data-table__td nb-data-table__actions-cell`,onClick:r[2]||=(0,c.withModifiers)(()=>{},[`stop`])},[(0,c.renderSlot)(t.$slots,`row-actions`,{row:i,rowIndex:a},void 0,!0)])):(0,c.createCommentVNode)(``,!0)],42,Ae),G(i)?((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,{key:0,class:`nb-data-table__detail-row`,role:O.value?`row`:void 0},[(0,c.createElementVNode)(`td`,{colspan:D.value,class:`nb-data-table__detail-cell`,role:O.value?`cell`:void 0},[(0,c.createElementVNode)(`div`,{id:K(a),class:`nb-data-table__detail`,role:`region`,"aria-label":q(i,a)},[(0,c.renderSlot)(t.$slots,`row-detail`,{row:i,rowIndex:a},void 0,!0)],8,_)],8,g)],8,h)):(0,c.createCommentVNode)(``,!0)],64))),128)):((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,Oe,[(0,c.createElementVNode)(`td`,{colspan:D.value,class:`nb-data-table__state nb-data-table__state--empty`},[(0,c.renderSlot)(t.$slots,`empty`,{},()=>[(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(e.emptyMessage||`No data to display`),1)],!0)],8,ke)]))],8,Ce)],8,de)]),t.$slots.footer?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,v,[(0,c.renderSlot)(t.$slots,`footer`,{},void 0,!0)])):(0,c.createCommentVNode)(``,!0)],16))}}),b=t.t(y,[[`__scopeId`,`data-v-e1388797`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return b}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Size.d-GBIblj2D.cjs`),r=require(`./Button-B-8ikYRN.cjs`),i=require(`./Select-
|
|
1
|
+
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Size.d-GBIblj2D.cjs`),r=require(`./Button-B-8ikYRN.cjs`),i=require(`./Select-Dz5XXNrc.cjs`);let a=require(`vue`),o=require(`@nubisco/ui/icons/caret-right`);o=e.n(o);let s=require(`@nubisco/ui/icons/caret-left`);s=e.n(s);var c={class:`nb-pagination__left`},l={class:`nb-pagination__page-size`},u={class:`nb-pagination__label`},d={class:`nb-pagination__range`,"aria-live":`polite`},f={class:`nb-pagination__right`},p={class:`nb-pagination__page-of`},m=(0,a.defineComponent)({__name:`Pagination`,props:{page:{},pageSize:{},total:{},pageSizeOptions:{default:()=>[10,20,30,40,50]},size:{default:n.r.Medium},disabled:{type:Boolean,default:!1},pageSizeLabel:{default:`Items per page:`},itemLabel:{default:`items`}},emits:[`update:page`,`update:pageSize`],setup(e,{emit:t}){let n=e,m=t,h=(0,a.computed)(()=>n.size),g=(0,a.computed)(()=>n.pageSizeOptions.includes(n.pageSize)?n.pageSizeOptions:[...n.pageSizeOptions,n.pageSize].sort((e,t)=>e-t)),_=(0,a.computed)(()=>g.value.map(e=>({label:String(e),value:e}))),v=(0,a.computed)(()=>Math.max(1,Math.ceil(n.total/Math.max(1,n.pageSize)))),y=(0,a.computed)(()=>Math.min(Math.max(1,n.page),v.value)),b=(0,a.computed)(()=>n.total===0?0:(y.value-1)*n.pageSize+1),x=(0,a.computed)(()=>Math.min(y.value*n.pageSize,n.total));function S(e){let t=Math.min(Math.max(1,e),v.value);t!==n.page&&m(`update:page`,t)}function C(e){let t=Number(e);!Number.isFinite(t)||t===n.pageSize||(m(`update:pageSize`,t),n.page!==1&&m(`update:page`,1))}return(t,n)=>((0,a.openBlock)(),(0,a.createElementBlock)(`nav`,{class:(0,a.normalizeClass)([`nb-pagination`,`nb-pagination--${e.size}`]),"aria-label":`Pagination`},[(0,a.createElementVNode)(`div`,c,[(0,a.createElementVNode)(`label`,l,[(0,a.createElementVNode)(`span`,u,(0,a.toDisplayString)(e.pageSizeLabel),1),(0,a.createVNode)(i.t,{size:`xs`,"model-value":e.pageSize,options:_.value,disabled:e.disabled,"onUpdate:modelValue":C},null,8,[`model-value`,`options`,`disabled`])]),(0,a.createElementVNode)(`span`,d,(0,a.toDisplayString)(b.value)+`–`+(0,a.toDisplayString)(x.value)+` of `+(0,a.toDisplayString)(e.total)+` `+(0,a.toDisplayString)(e.itemLabel),1)]),(0,a.createElementVNode)(`div`,f,[(0,a.createElementVNode)(`span`,p,` Page `+(0,a.toDisplayString)(y.value)+` of `+(0,a.toDisplayString)(v.value),1),(0,a.createVNode)(r.t,{class:`nb-pagination__nav`,variant:`ghost`,size:h.value,icon:s,disabled:e.disabled||y.value<=1,"aria-label":`Previous page`,onClick:n[0]||=e=>S(y.value-1)},null,8,[`size`,`disabled`]),(0,a.createVNode)(r.t,{class:`nb-pagination__nav`,variant:`ghost`,size:h.value,icon:o,disabled:e.disabled||y.value>=v.value,"aria-label":`Next page`,onClick:n[1]||=e=>S(y.value+1)},null,8,[`size`,`disabled`])])],2))}}),h=t.t(m,[[`__scopeId`,`data-v-884e19f9`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
2
2
|
import { r as t } from "./Size.d-Bah6vMl3.js";
|
|
3
3
|
import { t as n } from "./Button-D81Efqjg.js";
|
|
4
|
-
import { t as r } from "./Select-
|
|
4
|
+
import { t as r } from "./Select-CNetl2JU.js";
|
|
5
5
|
import { computed as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, normalizeClass as l, openBlock as u, toDisplayString as d } from "vue";
|
|
6
6
|
import * as f from "@nubisco/ui/icons/caret-right";
|
|
7
7
|
import * as p from "@nubisco/ui/icons/caret-left";
|