From 670169fbbb04918c1134280e1caff33296bc5520 Mon Sep 17 00:00:00 2001 From: Vitaly Date: Thu, 25 May 2023 17:19:28 +0300 Subject: [PATCH] [#3279] VaDataTable docs improvement (#3412) * fix(#3279): update block api in docs * fix(#3279): fix types and styles in VaDataTable component * fix(#3279): update VaDataTable docs examples * fix(#3279): update locales * fix(#3279): style fixing block components * fix(#3279): tweak VaValue prop type * #3279: fix block api component * #3279: tweak data-table api-options * #3279: review suggestions * #3279: review suggestions --- .../page-config/blocks/alert/index.vue | 11 +- .../blocks/api/components/api-table.vue | 38 +++- .../modules/page-config/blocks/api/index.vue | 16 +- .../modules/page-config/blocks/api/types.ts | 5 +- .../page-config/blocks/example/index.vue | 4 +- .../ui-elements/data-table/api-options.ts | 148 +++++++++++-- .../data-table/examples/Binding.vue | 40 ++-- .../ui-elements/data-table/examples/CRUD.vue | 13 +- .../data-table/examples/ColgroupSlots.vue | 9 +- .../data-table/examples/CustomSlots.vue | 10 +- .../data-table/examples/Default.vue | 4 +- .../data-table/examples/ExpandableRow.vue | 24 +-- .../data-table/examples/Filtering.vue | 29 ++- .../data-table/examples/InlineEditing.vue | 16 +- .../ui-elements/data-table/examples/Other.vue | 43 ++-- .../data-table/examples/Pagination.vue | 22 +- .../data-table/examples/Selection.vue | 62 ++---- .../data-table/examples/SelectionWithKeys.vue | 31 +-- .../data-table/examples/Sorting.vue | 38 +--- .../data-table/examples/StaticSlots.vue | 77 +++---- .../data-table/examples/Sticky.vue | 136 +++--------- .../data-table/examples/Styling.vue | 197 +++--------------- .../ui-elements/data-table/index.ts | 6 +- packages/docs/translations/en.json | 40 ++-- packages/docs/translations/ru.json | 28 +-- .../components/va-data-table/VaDataTable.vue | 9 +- .../components/VaDataTableThRow.vue | 74 +++---- .../components/va-data-table/hooks/useRows.ts | 4 +- .../ui/src/components/va-data-table/types.ts | 4 +- .../ui/src/components/va-value/VaValue.vue | 2 +- 30 files changed, 481 insertions(+), 659 deletions(-) diff --git a/packages/docs/modules/page-config/blocks/alert/index.vue b/packages/docs/modules/page-config/blocks/alert/index.vue index 6f9d731eec..5d3ade9be7 100644 --- a/packages/docs/modules/page-config/blocks/alert/index.vue +++ b/packages/docs/modules/page-config/blocks/alert/index.vue @@ -21,7 +21,7 @@ const { t } = useI18n() @@ -24,7 +24,7 @@ import { defineComponent } from "vue"; export default defineComponent({ data() { - const users = [ + const items = [ { id: 1, name: "Leanne Graham", @@ -108,7 +108,7 @@ export default defineComponent({ ]; return { - items: users, + items, columns, }; }, diff --git a/packages/docs/page-config/ui-elements/data-table/examples/Default.vue b/packages/docs/page-config/ui-elements/data-table/examples/Default.vue index d50ad852c8..f7ae283284 100644 --- a/packages/docs/page-config/ui-elements/data-table/examples/Default.vue +++ b/packages/docs/page-config/ui-elements/data-table/examples/Default.vue @@ -7,7 +7,7 @@ import { defineComponent } from "vue"; export default defineComponent({ data() { - const users = [ + const items = [ { id: 1, name: "Leanne Graham", @@ -51,7 +51,7 @@ export default defineComponent({ ]; return { - items: users, + items, }; }, }); diff --git a/packages/docs/page-config/ui-elements/data-table/examples/ExpandableRow.vue b/packages/docs/page-config/ui-elements/data-table/examples/ExpandableRow.vue index 8fd67917c8..f8864f0b75 100644 --- a/packages/docs/page-config/ui-elements/data-table/examples/ExpandableRow.vue +++ b/packages/docs/page-config/ui-elements/data-table/examples/ExpandableRow.vue @@ -40,22 +40,12 @@ - - + + diff --git a/packages/docs/page-config/ui-elements/data-table/examples/Filtering.vue b/packages/docs/page-config/ui-elements/data-table/examples/Filtering.vue index 0d323010dd..1e49a17636 100644 --- a/packages/docs/page-config/ui-elements/data-table/examples/Filtering.vue +++ b/packages/docs/page-config/ui-elements/data-table/examples/Filtering.vue @@ -1,21 +1,18 @@ @@ -47,7 +42,7 @@ import debounce from "lodash/debounce.js"; export default defineComponent({ data() { - const users = [ + const items = [ { id: 1, name: "Leanne Graham", @@ -176,19 +171,19 @@ export default defineComponent({ const input = ""; return { - items: users, + items, columns, input, filter: input, isDebounceInput: false, - useCustomFilteringFn: false, - filteredCount: users.length, + isCustomFilteringFn: false, + filteredCount: items.length, }; }, computed: { customFilteringFn() { - return this.useCustomFilteringFn ? this.filterExact : undefined; + return this.isCustomFilteringFn ? this.filterExact : undefined; }, }, diff --git a/packages/docs/page-config/ui-elements/data-table/examples/InlineEditing.vue b/packages/docs/page-config/ui-elements/data-table/examples/InlineEditing.vue index 0d42f3a3dd..bd02ce359b 100644 --- a/packages/docs/page-config/ui-elements/data-table/examples/InlineEditing.vue +++ b/packages/docs/page-config/ui-elements/data-table/examples/InlineEditing.vue @@ -1,6 +1,6 @@