@mouseless/baked 1.3.1 → 1.3.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/dist/module.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<DataTable
|
|
3
3
|
ref="dataTable"
|
|
4
4
|
:value
|
|
5
|
-
class="text-sm min-h-
|
|
5
|
+
class="text-sm min-h-20"
|
|
6
6
|
striped-rows
|
|
7
7
|
:data-key
|
|
8
8
|
:paginator="paginator && value.length > rows"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
class="
|
|
28
28
|
b-Header
|
|
29
29
|
flex flex-row items-center justify-end
|
|
30
|
-
gap-4 mb-2 py-4 px-2
|
|
30
|
+
gap-4 mb-2 py-4 px-2
|
|
31
31
|
"
|
|
32
32
|
>
|
|
33
33
|
<div
|
|
@@ -50,17 +50,16 @@
|
|
|
50
50
|
</div>
|
|
51
51
|
</div>
|
|
52
52
|
<Column
|
|
53
|
-
v-for="column in
|
|
53
|
+
v-for="column in visibleColumns"
|
|
54
54
|
:key="column.key"
|
|
55
55
|
:header="l(column.title)"
|
|
56
56
|
:field="column.key"
|
|
57
57
|
class="text-nowrap"
|
|
58
|
-
:class="{ 'min-w-40': column.minWidth, 'text-right': column.alignRight }"
|
|
59
58
|
:exportable="column.exportable"
|
|
60
59
|
:export-header="l(column.title)"
|
|
61
60
|
:pt="{
|
|
62
61
|
columnHeaderContent: { class: column.alignRight ? 'justify-end' : '' },
|
|
63
|
-
bodyCell: { class:
|
|
62
|
+
bodyCell: { class: bodyCellClass(column) },
|
|
64
63
|
headerCell: { class: { 'max-xs:!inset-auto': column.frozen } }
|
|
65
64
|
}"
|
|
66
65
|
:frozen="column.frozen"
|
|
@@ -198,6 +197,7 @@ const virtualScrollerOptions = schema.virtualScrollerOptions && {
|
|
|
198
197
|
};
|
|
199
198
|
const contextData = context.injectContextData();
|
|
200
199
|
const dataDescriptor = context.injectDataDescriptor();
|
|
200
|
+
const LABEL_COLUMN_BP = 5;
|
|
201
201
|
const dataTable = ref();
|
|
202
202
|
const headerActionsMenu = ref();
|
|
203
203
|
const headerActions = ref([]);
|
|
@@ -213,6 +213,7 @@ const value = computed(() => {
|
|
|
213
213
|
}
|
|
214
214
|
return result;
|
|
215
215
|
});
|
|
216
|
+
const visibleColumns = computed(() => columns.filter((c) => !c.hidden));
|
|
216
217
|
const footerColSpan = computed(() => columns.length - footerTemplate?.columns.length);
|
|
217
218
|
const exportFilename = ref(exportOptions?.fileName ? l(exportOptions.fileName) : null);
|
|
218
219
|
let formatter = null;
|
|
@@ -250,6 +251,26 @@ onMounted(async () => {
|
|
|
250
251
|
function toggleHeaderActionsMenu(event) {
|
|
251
252
|
headerActionsMenu.value.toggle(event);
|
|
252
253
|
}
|
|
254
|
+
function bodyCellClass(column) {
|
|
255
|
+
const classes = {
|
|
256
|
+
"max-xs:!inset-auto": column.frozen,
|
|
257
|
+
"min-w-40": column.minWidth,
|
|
258
|
+
"text-right": column.alignRight
|
|
259
|
+
};
|
|
260
|
+
const total = visibleColumns.value.length;
|
|
261
|
+
if (total === 1) {
|
|
262
|
+
return classes;
|
|
263
|
+
}
|
|
264
|
+
const labelColumn = visibleColumns.value?.filter((vc) => vc.frozen)?.slice(-1)[0];
|
|
265
|
+
if (!labelColumn) {
|
|
266
|
+
return classes;
|
|
267
|
+
}
|
|
268
|
+
const columnClass = total <= LABEL_COLUMN_BP ? "b-label-column--narrow" : "b-label-column--wide";
|
|
269
|
+
if (column.key == labelColumn.key) {
|
|
270
|
+
classes[columnClass] = true;
|
|
271
|
+
return classes;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
253
274
|
function exportFunction({ data: data2, field }) {
|
|
254
275
|
if (!formatter) {
|
|
255
276
|
return data2.value;
|
|
@@ -259,5 +280,10 @@ function exportFunction({ data: data2, field }) {
|
|
|
259
280
|
</script>
|
|
260
281
|
|
|
261
282
|
<style>
|
|
262
|
-
.b-component--DataTable
|
|
283
|
+
.p-panel-content:has(.b-component--DataTable) .b-component--DataTable{@apply border-none rounded-none}.p-panel-content:has(.b-component--DataTable) .b-component--DataTable .b-Header{@apply rounded-none}.p-panel-content:has(.b-component--DataTable) .b-component--DataTable .p-datatable-table-container{@apply border-none}.b-component--DataTable{@apply border border-slate-200 dark:border-zinc-700
|
|
284
|
+
justify-self-center w-full
|
|
285
|
+
rounded-[--p-border-radius-md]}.b-component--DataTable .p-datatable-table-container{@apply border-none rounded-b-[--p-border-radius-md]}.b-component--DataTable:has(.b-Header) .b-Header{@apply border-b dark:border-zinc-800
|
|
286
|
+
dark:bg-zinc-900 mb-0
|
|
287
|
+
rounded-t-[--p-border-radius-md]}.b-component--DataTable:has(.b-Header) .p-datatable-table-container{@apply rounded-b-[--p-border-radius-md]}.b-component--DataTable:has(:not(.b-Header)) .p-datatable-table-container{@apply rounded-[--p-border-radius-md]}.b-component--DataTable:has(.p-datatable-paginator-bottom) .p-datatable-paginator-bottom{@apply border-t rounded-t-none
|
|
288
|
+
rounded-b-[--p-border-radius-md] border-b-0}.b-component--DataTable:has(.p-datatable-paginator-bottom) .p-datatable-table-container{@apply rounded-b-none}.b-component--DataTable tbody>tr:last-child>td{@apply border-b-0}.b-component--DataTable tfoot>tr>td{@apply border-t}.b-component--DataTable .b-label-column--wide{@apply 3xl:w-[30%] 2xl:w-[20%] xl:w-[15%]}.b-component--DataTable .b-label-column--narrow{@apply 3xl:w-[40%] 2xl:w-[30%] xl:w-[20%]}.b-component--DataTable a{@apply text-sm}.b-component--DataTable .p-button{@apply -my-2}.b-component--DataTable td.p-datatable-frozen-column{@apply z-[1]}.b-component--DataTable .p-datatable-thead{@apply z-[2]}
|
|
263
289
|
</style>
|
|
@@ -89,5 +89,5 @@ function setSelected(value) {
|
|
|
89
89
|
</script>
|
|
90
90
|
|
|
91
91
|
<style>
|
|
92
|
-
.p-popover-content .b-component--SelectButton.p-selectbutton{@apply max-sm:flex-col}.p-popover-content .b-component--SelectButton.p-selectbutton .p-togglebutton:first-child{@apply max-sm:rounded-t-lg max-sm:rounded-es-none}.p-popover-content .b-component--SelectButton.p-selectbutton .p-togglebutton:last-child{@apply max-sm:rounded-b-lg max-sm:rounded-se-none}
|
|
92
|
+
.p-togglebutton-content{@apply whitespace-nowrap}.p-popover-content .b-component--SelectButton.p-selectbutton{@apply max-sm:flex-col}.p-popover-content .b-component--SelectButton.p-selectbutton .p-togglebutton:first-child{@apply max-sm:rounded-t-lg max-sm:rounded-es-none}.p-popover-content .b-component--SelectButton.p-selectbutton .p-togglebutton:last-child{@apply max-sm:rounded-b-lg max-sm:rounded-se-none}
|
|
93
93
|
</style>
|