diff --git a/src/BIMDataComponents/BIMDataIcon/BIMDataIconStandalone/BIMDataIconCaret.vue b/src/BIMDataComponents/BIMDataIcon/BIMDataIconStandalone/BIMDataIconCaret.vue new file mode 100644 index 00000000..35171173 --- /dev/null +++ b/src/BIMDataComponents/BIMDataIcon/BIMDataIconStandalone/BIMDataIconCaret.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/src/BIMDataComponents/BIMDataIcon/BIMDataIconStandalone/index.js b/src/BIMDataComponents/BIMDataIcon/BIMDataIconStandalone/index.js index 8f07436d..08a66b29 100644 --- a/src/BIMDataComponents/BIMDataIcon/BIMDataIconStandalone/index.js +++ b/src/BIMDataComponents/BIMDataIcon/BIMDataIconStandalone/index.js @@ -20,6 +20,7 @@ export { default as BIMDataIconCalendar } from "./BIMDataIconCalendar.vue"; export { default as BIMDataIconCaliper } from "./BIMDataIconCaliper.vue"; export { default as BIMDataIconCamera } from "./BIMDataIconCamera.vue"; export { default as BIMDataIconCancelCamera } from "./BIMDataIconCancelCamera.vue"; +export { default as BIMDataIconCaret } from "./BIMDataIconCaret.vue"; export { default as BIMDataIconCheck } from "./BIMDataIconCheck.vue"; export { default as BIMDataIconChevron } from "./BIMDataIconChevron.vue"; export { default as BIMDataIconClassificationCategory } from "./BIMDataIconClassificationCategory.vue"; diff --git a/src/BIMDataComponents/BIMDataIcon/BIMDataLibraryIcons/Caret.vue b/src/BIMDataComponents/BIMDataIcon/BIMDataLibraryIcons/Caret.vue new file mode 100644 index 00000000..bc1a5662 --- /dev/null +++ b/src/BIMDataComponents/BIMDataIcon/BIMDataLibraryIcons/Caret.vue @@ -0,0 +1,3 @@ + diff --git a/src/BIMDataComponents/BIMDataIcon/BIMDataLibraryIcons/index.js b/src/BIMDataComponents/BIMDataIcon/BIMDataLibraryIcons/index.js index 3525c48e..4a60b081 100644 --- a/src/BIMDataComponents/BIMDataIcon/BIMDataLibraryIcons/index.js +++ b/src/BIMDataComponents/BIMDataIcon/BIMDataLibraryIcons/index.js @@ -20,6 +20,7 @@ import calendar from "./Calendar.vue"; import caliper from "./Caliper.vue"; import camera from "./Camera.vue"; import cancelCamera from "./CancelCamera.vue"; +import caret from "./Caret.vue"; import check from "./Check.vue"; import chevron from "./Chevron.vue"; import classificationCategory from "./ClassificationCategory.vue"; @@ -189,6 +190,7 @@ export default { caliper, camera, cancelCamera, + caret, check, chevron, classificationCategory, diff --git a/src/BIMDataComponents/BIMDataTable/BIMDataTable.vue b/src/BIMDataComponents/BIMDataTable/BIMDataTable.vue index dcccfd66..8828bf6d 100644 --- a/src/BIMDataComponents/BIMDataTable/BIMDataTable.vue +++ b/src/BIMDataComponents/BIMDataTable/BIMDataTable.vue @@ -26,7 +26,60 @@ textAlign: column.align || 'left', }" > - {{ column.id ? column.label || column.id : column }} +
+ {{ column.id ? column.label || column.id : column }} + + +
+ + + + + + +
+
@@ -37,9 +90,9 @@ - {{ `${pageIndexStart} - ${pageIndexEnd} / ${rows.length}` }} + {{ `${pageIndexStart} - ${pageIndexEnd} / ${displayedRows.length}` }} @@ -111,19 +166,28 @@ + + diff --git a/src/BIMDataComponents/BIMDataTable/column-filters/_ColumnFilters.scss b/src/BIMDataComponents/BIMDataTable/column-filters/_ColumnFilters.scss new file mode 100644 index 00000000..aa6ea222 --- /dev/null +++ b/src/BIMDataComponents/BIMDataTable/column-filters/_ColumnFilters.scss @@ -0,0 +1,14 @@ +.column-filters { + width: 100%; + display: grid; + position: absolute; + left: 0; + background-color: var(--color-white); + box-shadow: var(--box-shadow); + gap: calc(var(--spacing-unit) / 2); + border-radius: calc(var(--spacing-unit) / 2); + z-index: 1; + .bimdata-checkbox { + font-weight: 400; + } +} diff --git a/src/BIMDataComponents/BIMDataTable/column-sorting/ColumnSorting.vue b/src/BIMDataComponents/BIMDataTable/column-sorting/ColumnSorting.vue new file mode 100644 index 00000000..a8b2d90b --- /dev/null +++ b/src/BIMDataComponents/BIMDataTable/column-sorting/ColumnSorting.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/src/web/views/Components/Table/Table.vue b/src/web/views/Components/Table/Table.vue index c173e722..ecfeb0bb 100644 --- a/src/web/views/Components/Table/Table.vue +++ b/src/web/views/Components/Table/Table.vue @@ -14,7 +14,8 @@ :paginated="simpleExample.paginated" :perPage="+simpleExample.perPage" @selection-changed="simpleExample.selection = $event" - /> + > +
Selection :
+
+ + Slots: + + +
@@ -160,9 +167,18 @@
             let columns = [
-              { id: "fullName", label: "Name" },
-              { id: "age", label: "Age", width: "64px" },
-              { id: "country", label: "Country", width: "200px", align: "center" }
+            { 
+              id: "fullName",
+              label: "Name",
+              sortable: true, defaultSortOrder: "asc",
+              sortFunction: (a, b) => {
+                const fullNameA = `${a.firstName} ${a.lastName}`;
+                const fullNameB = `${b.firstName} ${b.lastName}`;
+                return fullNameA < fullNameB ? 1 : -1;
+              },
+              { id: "age", label: "Age", width: "64px", sortable: true, defaultSortOrder: "asc" },
+              { id: "tags", label: "Tags", width: "200px", align: "center", filter: true },
+              { id: "country", label: "Country", width: "200px", align: "center", sortable: true, defaultSortOrder: "asc" }
             ];
           
@@ -210,6 +226,9 @@ + @@ -262,11 +281,14 @@ import columnsData from "./columns-data.js"; import eventsData from "./events-data.js"; import propsData from "./props-data.js"; +import slotsData from "./slots-data.js"; + // Components import Code from "../../Elements/Code/Code.vue"; import ComponentCode from "../../Elements/ComponentCode/ComponentCode.vue"; import AgeCustomCell from "./example/AgeCustomCell.vue"; import CountryCustomCell from "./example/CountryCustomCell.vue"; +import TagsCustomCell from "./example/TagsCustomCell.vue"; export default { components: { @@ -274,6 +296,7 @@ export default { ComponentCode, AgeCustomCell, CountryCustomCell, + TagsCustomCell, }, data() { return { @@ -298,17 +321,44 @@ export default { { id: "fullName", label: "Name", + sortable: true, + defaultSortOrder: "asc", + sortFunction: (a, b) => { + const fullNameA = `${a.firstName} ${a.lastName}`; + const fullNameB = `${b.firstName} ${b.lastName}`; + + return fullNameA < fullNameB ? 1 : -1; + }, }, { id: "age", label: "Age", width: "64px", + sortable: true, + defaultSortOrder: "asc", + }, + { + id: "priority", + label: "Priority", + width: "200px", + align: "center", + filter: true, + }, + { + id: "tags", + label: "Tags", + width: "200px", + align: "center", + filter: true, + filterKey: "name", }, { id: "country", label: "Country", width: "200px", align: "center", + sortable: true, + defaultSortOrder: "asc", }, ], rows: [ @@ -316,36 +366,82 @@ export default { firstName: "John", lastName: "Doe", age: 26, + priority: "High", + tags: [ + { + name: "Tag 2", + color: "#ff69b4", + }, + ], country: "Germany", }, { firstName: "Jane", lastName: "Doe", age: 21, + priority: "Low", + tags: [ + { + name: "Tag 2", + color: "#ff69b4", + }, + ], country: "Austria", }, { firstName: "Martine", lastName: "Durand", age: 35, + priority: "Medium", + tags: [ + { + name: "My tag", + color: "#2AAA8A", + }, + { + name: "Reviewed", + color: "#ff6954", + }, + ], country: "France", }, { firstName: "Giuseppe", lastName: "Bompiani", age: 64, + priority: "Low", + tags: [ + { + name: "Tag 5", + color: "#bf70a4", + }, + ], country: "Italy", }, { firstName: "Enrico", lastName: "Fermi", age: 41, + priority: "low", + tags: [ + { + name: "Missing", + color: "#fh69u6", + }, + ], country: "Italy", }, { firstName: "Lev Davidovitch", lastName: "Landau", age: 23, + priority: "Medium", + tags: [ + { + name: "Tag 2", + color: "#ff69b4", + }, + ], country: "Russia", }, ], @@ -354,6 +450,7 @@ export default { propsData, eventsData, columnsData, + slotsData, }; }, }; diff --git a/src/web/views/Components/Table/columns-data.js b/src/web/views/Components/Table/columns-data.js index 684a1e90..0519b01c 100644 --- a/src/web/views/Components/Table/columns-data.js +++ b/src/web/views/Components/Table/columns-data.js @@ -24,4 +24,29 @@ export default [ "'left' ; 'center' ; 'right'", "Set how text is aligned in the column.", ], + [ + "sortable", + "Boolean", + "If you want to sort the column, set this to true. Sortable by id value.", + ], + [ + "defaultSortOrder", + "'desc' ; 'asc'", + "Set the default sort order for the column.", + ], + [ + "sortFunction", + "Function", + "Set a custom sort function for the column. If not specified, the default sort function will be used.", + ], + [ + "filter", + "Boolean", + "If you want to filter the column, set this to true. Sortable by id value.", + ], + [ + "filterKey", + "String", + "Set the key to specify a filter by.", + ] ]; diff --git a/src/web/views/Components/Table/example/TagsCustomCell.vue b/src/web/views/Components/Table/example/TagsCustomCell.vue new file mode 100644 index 00000000..d4853c2c --- /dev/null +++ b/src/web/views/Components/Table/example/TagsCustomCell.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/web/views/Components/Table/slots-data.js b/src/web/views/Components/Table/slots-data.js new file mode 100644 index 00000000..9b9fe28e --- /dev/null +++ b/src/web/views/Components/Table/slots-data.js @@ -0,0 +1,24 @@ +/* eslint-disable */ +export default [ + [ "Slot name", "Description"], + [ + "column-header-right", + "Use this slot to add some elements on the right of the column header.", + ], + [ + "sub-header", + "Use this slot to add elements on the sub-header of the column header.", + ], + [ + "cell-${column.id}", + "Use this slot with the column id to add custom content in the cell." + ], + [ + "placeholder", + "Use this slot to add a custom placeholder when the table is empty." + ], + [ + "column-filters", + "Use this slot to add custom filters for the table." + ] +];