Skip to content

Commit

Permalink
Merge branch 'gsoc-table-develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
BabyElias authored Aug 28, 2024
2 parents 015325c + 90558b5 commit 186ea35
Show file tree
Hide file tree
Showing 14 changed files with 1,339 additions and 30 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ Changelog is rather internal in nature. See release notes for the public overvie
[#650]: https://github.com/learningequality/kolibri-design-system/pull/650


[#727]
- **Description:** Initial implementation of `KTable` component
- **Products impact:** New Component
- **Addresses:** [#328](https://github.com/learningequality/kolibri-design-system/issues/328)
- **Components:** KTable
- **Breaking:** No
- **Impacts a11y:** Yes
- **Guidance:**
[#727] https://github.com/learningequality/kolibri-design-system/pull/727


- [#723]
- **Description:** Updates $core-time value from 0.25s to 0.15s
- **Products impact:** User experience - faster transitions
Expand Down Expand Up @@ -72,6 +83,7 @@ Changelog is rather internal in nature. See release notes for the public overvie

[#728]: https://github.com/learningequality/kolibri-design-system/pull/728


- [#738]
- **Description:** Bump KDS version to 5.0.0-rc2.
- **Products impact:** -.
Expand All @@ -94,6 +106,7 @@ Changelog is rather internal in nature. See release notes for the public overvie

[705]: https://github.com/learningequality/kolibri-design-system/pull/705


- [719]
- **Description:** Removes KResponsiveWindowMixin.
- **Products impact:** removed API.
Expand All @@ -105,6 +118,7 @@ Changelog is rather internal in nature. See release notes for the public overvie

[719]: https://github.com/learningequality/kolibri-design-system/pull/719


- [#718]
- **Description:** This pull request resolves failing `KDateCalendar` component tests that occurred on the last day of the month in open pull requests by setting dates manually in the tests. Additionally, the `KDateCalendar` is updated to show the month of the `lastAllowedDate` property.
- **Products impact:** none
Expand Down
4 changes: 4 additions & 0 deletions custom-icons/sortColumn.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
156 changes: 156 additions & 0 deletions docs/pages/ktable.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<template>

<DocsPageTemplate apiDocs>
<DocsPageSection title="Overview" anchor="#overview">
<p>
The <code>KTable</code> component is an accessible and customizable table component designed to handle a variety of data presentation needs. The component is suitable for both simple and complex data tables. It offers:
<ul>
<li>Built-in sorting as well as integration with externally sorted data</li>
<li>Keyboard navigation</li>
<li>Dynamic column resizing</li>
<li>Sticky headers</li>
</ul>
</p>
</DocsPageSection>
<DocsPageSection title="Usage" anchor="#usage">
<!--Non-Sortable Table-->
<h3>Table without sorting functionality</h3>
<p>
This is an example to show how <code>KTable</code> can be used without any sorting functionality, for a simple table. Use of slots is optional.
</p>
<!-- eslint-disable -->
<DocsShowCode language="html">
<KTable
:headers="headers"
:rows="rows"
caption="Non Sortable Table"
:sortable="false"
>

<template #header="{ header, index }">
<span>{ header.label } (Backend)</span>
</template>
<template #cell="{ content, rowIndex, colIndex }">
<span v-if="colIndex === 2">{ content } (City)</span>
<span v-else>{ content }</span>
</template>
</KTable>

</DocsShowCode>

<DocsShowCode language="javascript">
data() {
return {
headers: [
{ label: 'Name', dataType: 'string' },
{ label: 'Age', dataType: 'numeric' },
{ label: 'City', dataType: 'string' },
],
rows: [
['John Doe', 28, 'New York'],
['Jane Smith', 34, 'Los Angeles'],
['Samuel Green', 22, 'Chicago'],
['Alice Johnson', 30, 'Houston'],
['Michael Brown', 45, 'Phoenix'],
['Emily Davis', 27, 'Philadelphia'],
]
};
},
</DocsShowCode>

<DocsShow block>
<KTable
:headers="headers"
:rows="rows"
caption="Non-sortable table"
:sortable="false"
>
<template #header="{ header, index }">
<span>{{ header.label }} (Backend)</span>
</template>
<template #cell="{ content, rowIndex, colIndex }">
<span v-if="colIndex === 2">{{ content }} (City)</span>
<span v-else>{{ content }}</span>
</template>
</KTable>
</DocsShow>
<!-- eslint-enable -->
<!-- Frontend Sorting Example-->
<h3>Table with Frontend Sorting</h3>
<p>
The <code>KTable</code> can be used with local sorting functionality, allowing you to sort data on the client side without the need for server requests. There are 4 permissible data types - <code>string</code>,<code>numeric</code>,<code>date</code> and <code>others</code>. Columns declared with <code>others</code> data type are not sortable. This example demonstrates a table with local sorting enabled.
</p>
<!-- eslint-disable -->
<DocsShowCode language="html">
<KTable
:headers="headers"
:rows="rows"
caption="Table with built-in sorting"
:useLocalSorting="true"
sortable
/>

</DocsShowCode>

<DocsShowCode language="javascript">
data() {
return {
headers: [
{ label: 'Name', dataType: 'string' },
{ label: 'Age', dataType: 'numeric' },
{ label: 'City', dataType: 'string' },
],
rows: [
['John Doe', 28, 'New York'],
['Jane Smith', 34, 'Los Angeles'],
['Samuel Green', 22, 'Chicago'],
['Alice Johnson', 30, 'Houston'],
['Michael Brown', 45, 'Phoenix'],
['Emily Davis', 27, 'Philadelphia'],
]
};
},
</DocsShowCode>
<DocsShow block>
<KTable
:headers="headers"
:rows="rows"
caption="Local Sorting Table"
:useLocalSorting="true"
sortable
/>
<!-- eslint-enable -->
</DocsShow>

</DocsPageSection>


</DocsPageTemplate>

</template>


<script>
export default {
name: 'DocsKTable',
data() {
return {
headers: [
{ label: 'Name', dataType: 'string' },
{ label: 'Age', dataType: 'numeric' },
{ label: 'City', dataType: 'string' },
],
rows: [
['John Doe', 28, 'New York'],
['Jane Smith', 34, 'Los Angeles'],
['Samuel Green', 22, 'Chicago'],
['Alice Johnson', 30, 'Houston'],
['Michael Brown', 45, 'Phoenix'],
['Emily Davis', 27, 'Philadelphia'],
],
};
},
};
</script>
Loading

0 comments on commit 186ea35

Please sign in to comment.