@mouseless/baked 1.3.0 → 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
3
  "configKey": "baked",
4
- "version": "1.3.0",
4
+ "version": "1.3.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -130,3 +130,7 @@ function onChanged(event) {
130
130
  values.value = event.values;
131
131
  }
132
132
  </script>
133
+
134
+ <style>
135
+ .p-panel-content{@apply [&:has(.p-datatable)]:p-0}
136
+ </style>
@@ -2,7 +2,7 @@
2
2
  <DataTable
3
3
  ref="dataTable"
4
4
  :value
5
- class="text-sm min-h-24"
5
+ class="text-sm min-h-20"
6
6
  striped-rows
7
7
  :data-key
8
8
  :paginator="paginator && value.length > rows"
@@ -25,8 +25,9 @@
25
25
  <div
26
26
  v-if="sort || (!paginator && serverPaginatorOptions)"
27
27
  class="
28
+ b-Header
28
29
  flex flex-row items-center justify-end
29
- gap-4 mb-2 py-4 px-2 rounded-sm
30
+ gap-4 mb-2 py-4 px-2
30
31
  "
31
32
  >
32
33
  <div
@@ -49,17 +50,16 @@
49
50
  </div>
50
51
  </div>
51
52
  <Column
52
- v-for="column in columns.filter(c => !c.hidden)"
53
+ v-for="column in visibleColumns"
53
54
  :key="column.key"
54
55
  :header="l(column.title)"
55
56
  :field="column.key"
56
57
  class="text-nowrap"
57
- :class="{ 'min-w-40': column.minWidth, 'text-right': column.alignRight }"
58
58
  :exportable="column.exportable"
59
59
  :export-header="l(column.title)"
60
60
  :pt="{
61
61
  columnHeaderContent: { class: column.alignRight ? 'justify-end' : '' },
62
- bodyCell: { class: { 'max-xs:!inset-auto': column.frozen } },
62
+ bodyCell: { class: bodyCellClass(column) },
63
63
  headerCell: { class: { 'max-xs:!inset-auto': column.frozen } }
64
64
  }"
65
65
  :frozen="column.frozen"
@@ -197,6 +197,7 @@ const virtualScrollerOptions = schema.virtualScrollerOptions && {
197
197
  };
198
198
  const contextData = context.injectContextData();
199
199
  const dataDescriptor = context.injectDataDescriptor();
200
+ const LABEL_COLUMN_BP = 5;
200
201
  const dataTable = ref();
201
202
  const headerActionsMenu = ref();
202
203
  const headerActions = ref([]);
@@ -212,6 +213,7 @@ const value = computed(() => {
212
213
  }
213
214
  return result;
214
215
  });
216
+ const visibleColumns = computed(() => columns.filter((c) => !c.hidden));
215
217
  const footerColSpan = computed(() => columns.length - footerTemplate?.columns.length);
216
218
  const exportFilename = ref(exportOptions?.fileName ? l(exportOptions.fileName) : null);
217
219
  let formatter = null;
@@ -249,6 +251,26 @@ onMounted(async () => {
249
251
  function toggleHeaderActionsMenu(event) {
250
252
  headerActionsMenu.value.toggle(event);
251
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
+ }
252
274
  function exportFunction({ data: data2, field }) {
253
275
  if (!formatter) {
254
276
  return data2.value;
@@ -258,5 +280,10 @@ function exportFunction({ data: data2, field }) {
258
280
  </script>
259
281
 
260
282
  <style>
261
- .b-component--DataTable a{@apply text-sm}.b-component--DataTable .p-button{@apply -my-2}.b-component--DataTable .p-datatable-tbody td.p-datatable-frozen-column{z-index:1}
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]}
262
289
  </style>
@@ -17,6 +17,9 @@
17
17
  :placeholder="l(label)"
18
18
  :show-clear
19
19
  :filter
20
+ :auto-filter-focus="filter"
21
+ :filter-fields="[optionLabel]"
22
+ reset-filter-on-hide
20
23
  class="w-full"
21
24
  >
22
25
  <template #value="slotProps">
@@ -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>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Baked is an opinionated framework for .NET and Vue. This is the UI package of Baked project.",
5
5
  "keywords": [
6
6
  "baked",