vuetable-next 1.0.0 → 1.0.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vuetable-next",
3
3
  "description": "Simple table for displaying data.",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "author": "Artem Alesenko",
6
6
  "type": "module",
7
7
  "private": false,
@@ -330,7 +330,7 @@ const instanceFetch = ref<Promise<AxiosResponse>>();
330
330
 
331
331
  const $_css = reactive({ ...CssSemanticUI.table, ...css });
332
332
 
333
- const dataIsAvailable = computed(() => tableData.value?.length! > 0 ?? false);
333
+ const dataIsAvailable = computed(() => !tableData.value?.length ? false : tableData.value?.length > 0);
334
334
  const useDetailRow = computed(() => dataIsAvailable.value && detailRowComponent !== "");
335
335
  const hasRowIdentifier = computed(() => tableData.value && typeof tableData.value[0][trackBy] !== "undefined");
336
336
  const countVisibleFields = computed(() => tableFields.value.filter(field => field.visible).length);
@@ -439,6 +439,7 @@ provide("vuetable", {
439
439
  scrollBarWidth: unref(scrollBarWidth),
440
440
  sortOrder,
441
441
  trackBy,
442
+ perPage,
442
443
  showSortIcons,
443
444
  css: toRefs($_css),
444
445
  isFieldSlot,
@@ -466,21 +467,6 @@ provide("vuetable", {
466
467
  getObjectValue,
467
468
  isSelectedRow
468
469
  });
469
- // provide("tableData", tableData);
470
- // provide("tableFields", tableFields);
471
- // provide("scrollBarWidth", scrollBarWidth);
472
- // provide("sortOrder", sortOrder);
473
- // provide("$_css", $_css);
474
- // provide("fieldPrefix", fieldPrefix);
475
- // provide("showSortIcons", showSortIcons);
476
- // provide("trackBy", trackBy);
477
- // provide("isSortable", isSortable);
478
- // provide("onHeaderEvent", onHeaderEvent);
479
- // provide("orderBy", orderBy);
480
- // provide("onCheckboxToggled", onCheckboxToggled);
481
- // provide("onCheckboxToggledAll", onCheckboxToggledAll);
482
- // provide("isSelectedRow", isSelectedRow);
483
- // provide("perPage", isSelectedRow);
484
470
 
485
471
  function getScrollBarWidth () {
486
472
  const outer = document.createElement("div");
@@ -0,0 +1,27 @@
1
+ import { mount } from "@vue/test-utils";
2
+ import VuetableFieldCheckbox from "../src/components/VuetableFieldCheckbox.vue";
3
+ import Vuetable from "../src/components/Vuetable.vue";
4
+
5
+ describe("Vuetable - Components", () => {
6
+ it("render VuetableFieldCheckbox", () => {
7
+ const root = mount(Vuetable, {
8
+ propsData: {
9
+ apiMode: false,
10
+ fields: [
11
+ { name: "code", titleClass: "foo-bar" }
12
+ ]
13
+ }
14
+ });
15
+ const wrapper = mount(VuetableFieldCheckbox, {
16
+ propsData: {
17
+ rowData: ["code"]
18
+ },
19
+ global: {
20
+ provide: {
21
+ vuetable: root.vm
22
+ }
23
+ }
24
+ });
25
+ expect(wrapper.element).toMatchSnapshot();
26
+ });
27
+ });
@@ -0,0 +1,11 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`Vuetable - Components > render VuetableFieldCheckbox 1`] = `
4
+ <td
5
+ class="vuetable-td-component-checkbox"
6
+ >
7
+ <input
8
+ type="checkbox"
9
+ />
10
+ </td>
11
+ `;