Skip to content

Commit

Permalink
Merge pull request #47 from pennions/feat/flightkit/table
Browse files Browse the repository at this point in the history
feat: made searching on annotations possible
  • Loading branch information
jelmerveen authored Dec 22, 2024
2 parents 5c0d166 + bae1ec7 commit 36453c0
Show file tree
Hide file tree
Showing 16 changed files with 67 additions and 7 deletions.
1 change: 0 additions & 1 deletion dist/flightkit-v0.0.23/flightkit.min.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@
const ftEvent = returnEventWithTopLevelElement(event);
ftEvent.contents = event.detail;
const callback = ftEvent.target.getAttribute(`e-${ftEvent.type}`);
if (!callback) return;

const callbackParts = callback.split('.');

let actualCallback = undefined;
Expand Down Expand Up @@ -657,8 +659,32 @@
if (this.filter.length) {
for (const data of tableData) {
let valuesInData = Object.values(data).join(" ").toLowerCase();
let valueInAnnotation = false;
if (Object.keys(this.contentAnnotations).length) {

for (const property of this.columnOrder) {
const annotation = this.getAnnotation(property, "body");

let annotationProperties = annotation[property];

if (annotationProperties && Object.keys(annotationProperties).length) {
let dataComparison = data[property];

if (dataComparison != null) {
let annotationValue = annotationProperties[dataComparison];
if (annotationValue) {
valueInAnnotation = annotationValue.toString().toLowerCase().includes(this.filter.toLowerCase());
}
}
}

if (valueInAnnotation) {
break;
}
}
}

if (valuesInData.includes(this.filter)) {
if (valuesInData.includes(this.filter.toLowerCase()) || valueInAnnotation) {
filteredData.push(data);
}
}
Expand Down
1 change: 1 addition & 0 deletions dist/flightkit-v0.0.24/flightkit.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/cdn/ibiss-v0.0.24/avian.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/cdn/ibiss-v0.0.24/flightkit.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/cdn/ibiss-v0.0.24/htmx-ibiss-ui.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/cdn/ibiss-v0.0.24/rocket.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/js/flightkit.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions documentation/public/cdn/ibiss-v0.0.24/avian.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions documentation/public/cdn/ibiss-v0.0.24/flightkit.min.js

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions documentation/public/cdn/ibiss-v0.0.24/rocket.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion documentation/public/js/flightkit.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions flightkit/components/extensions/base_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export class BaseComponent {
const ftEvent = returnEventWithTopLevelElement(event);
ftEvent.contents = event.detail;
const callback = ftEvent.target.getAttribute(`e-${ftEvent.type}`);
if (!callback) return;

const callbackParts = callback.split('.');

let actualCallback = undefined;
Expand Down
26 changes: 25 additions & 1 deletion flightkit/components/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,32 @@ export class FlightkitTable extends HTMLElement {
if (this.filter.length) {
for (const data of tableData) {
let valuesInData = Object.values(data).join(" ").toLowerCase();
let valueInAnnotation = false;
if (Object.keys(this.contentAnnotations).length) {

for (const property of this.columnOrder) {
const annotation = this.getAnnotation(property, "body");

let annotationProperties = annotation[property];

if (annotationProperties && Object.keys(annotationProperties).length) {
let dataComparison = data[property]

if (dataComparison != null) {
let annotationValue = annotationProperties[dataComparison]
if (annotationValue) {
valueInAnnotation = annotationValue.toString().toLowerCase().includes(this.filter.toLowerCase())
}
}
}

if (valueInAnnotation) {
break;
}
}
}

if (valuesInData.includes(this.filter)) {
if (valuesInData.includes(this.filter.toLowerCase()) || valueInAnnotation) {
filteredData.push(data)
}
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "@pennions/ibiss",
"version": "0.0.23",
"version": "0.0.24",
"avian_version": "0.0.2",
"flightkit_version": "0.0.23",
"flightkit_version": "0.0.24",
"htmx_plugin_version": "0.0.1",
"rocketjs_version": "0.0.1",
"description": "Frontend library of Pennions",
Expand Down

0 comments on commit 36453c0

Please sign in to comment.