@bimdata/design-system 2.1.0-rc.24 → 2.1.0-rc.25

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@bimdata/design-system",
3
- "version": "2.1.0-rc.24",
3
+ "version": "2.1.0-rc.25",
4
4
  "main": "./src/BIMDataComponents/index.js",
5
5
  "module": "./src/BIMDataComponents/index.js",
6
6
  "files": [
@@ -53,7 +53,7 @@
53
53
  class="m-l-6"
54
54
  :class="{
55
55
  active: filters.some(
56
- filter => filter.columnKey === column.id,
56
+ filter => filter.columnKey === column.id
57
57
  ),
58
58
  }"
59
59
  @click="toggleFiltersMenu(column)"
@@ -65,7 +65,7 @@
65
65
  :column="column"
66
66
  :columnData="
67
67
  computedRows.map(
68
- computedRow => computedRow.data[column.id],
68
+ computedRow => computedRow.data[column.id]
69
69
  )
70
70
  "
71
71
  :filters="
@@ -249,7 +249,7 @@ export default {
249
249
  setup(props, { emit }) {
250
250
  // Compute rows keys based on props values.
251
251
  const computedRows = computed(() =>
252
- props.rows.map((row, i) => ({ key: row[props.rowKey] ?? i, data: row })),
252
+ props.rows.map((row, i) => ({ key: row[props.rowKey] ?? i, data: row }))
253
253
  );
254
254
 
255
255
  const { rowSelection, toggleRowSelection, toggleFullSelection } =
@@ -275,7 +275,7 @@ export default {
275
275
  emit("all-deselected");
276
276
  }
277
277
  },
278
- },
278
+ }
279
279
  );
280
280
 
281
281
  const toggleRow = row => {
@@ -381,7 +381,7 @@ export default {
381
381
  return sortedRows.value.filter(row => {
382
382
  return filters.value.every(filter => {
383
383
  const column = props.columns.find(
384
- column => column.id === filter.columnKey,
384
+ column => column.id === filter.columnKey
385
385
  );
386
386
  const columnRowData = row.data[filter.columnKey];
387
387
 
@@ -390,16 +390,20 @@ export default {
390
390
  if (Array.isArray(columnRowData)) {
391
391
  return columnRowData.some(columnRowDataElement =>
392
392
  filter.columnFilters.includes(
393
- column.filterKey
393
+ typeof column.filterFunction === "function"
394
+ ? column.filterFunction(columnRowDataElement)
395
+ : column.filterKey
394
396
  ? columnRowDataElement[column.filterKey]
395
- : columnRowDataElement,
396
- ),
397
+ : columnRowDataElement
398
+ )
397
399
  );
398
400
  } else {
399
401
  return filter.columnFilters.includes(
400
- column.filterKey
402
+ typeof column.filterFunction === "function"
403
+ ? column.filterFunction(columnRowData)
404
+ : column.filterKey
401
405
  ? columnRowData[column.filterKey]
402
- : columnRowData,
406
+ : columnRowData
403
407
  );
404
408
  }
405
409
  });
@@ -411,7 +415,7 @@ export default {
411
415
  */
412
416
  const updateFilters = (column, columnFilters) => {
413
417
  filters.value = filters.value.filter(
414
- filter => filter.columnKey !== column.id,
418
+ filter => filter.columnKey !== column.id
415
419
  );
416
420
  if (columnFilters.length > 0) {
417
421
  filters.value.push({
@@ -432,7 +436,7 @@ export default {
432
436
  () => {
433
437
  pageIndex.value = 0;
434
438
  },
435
- { immediate: true },
439
+ { immediate: true }
436
440
  );
437
441
  // Compute `paginatedRows` according to rows array and pagination settings.
438
442
  watch(
@@ -450,7 +454,7 @@ export default {
450
454
  paginatedRows.value = rowKeys;
451
455
  }
452
456
  },
453
- { immediate: true },
457
+ { immediate: true }
454
458
  );
455
459
 
456
460
  return {
@@ -50,13 +50,17 @@ export default {
50
50
  return [
51
51
  ...new Set(
52
52
  newColumnData.flatMap(data => {
53
+ if (typeof column.filterFunction === "function") {
54
+ return column.filterFunction(data);
55
+ }
56
+
53
57
  if (!Array.isArray(data)) {
54
58
  data = [data];
55
59
  }
56
60
  return column?.filterKey
57
61
  ? data.map(d => d[column?.filterKey])
58
62
  : data;
59
- }),
63
+ })
60
64
  ),
61
65
  ];
62
66
  });
@@ -65,7 +69,7 @@ export default {
65
69
  elements.value.map(element => ({
66
70
  data: element,
67
71
  checked: props.filters.includes(element),
68
- })),
72
+ }))
69
73
  );
70
74
 
71
75
  const toggle = (element, checked) => {