Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add showLayerDataTable method #31

Merged
merged 5 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/little-apples-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@feltmaps/js-sdk": minor
---

Add showLayerDataTable and hideLayerDataTable methods
59 changes: 59 additions & 0 deletions docs/Main/FeltController.md
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,65 @@ will still be selected when clicked.

***

## showLayerDataTable()

> **showLayerDataTable**(`params`?: \{ `layerId`: `string`; `sorting`: [`SortConfig`](../Shared/SortConfig.md); }): `Promise`\<`void`>

Shows a data table view for the specified layer, optionally sorted by a given attribute.

### Parameters

| Parameter | Type |
| ----------------- | ----------------------------------------------------------------------------- |
| `params`? | \{ `layerId`: `string`; `sorting`: [`SortConfig`](../Shared/SortConfig.md); } |
| `params.layerId`? | `string` |
| `params.sorting`? | [`SortConfig`](../Shared/SortConfig.md) |

### Returns

`Promise`\<`void`>

### Example

```typescript
// Show data table with default sorting
await felt.showLayerDataTable({
layerId: "layer-1",
});

// Show data table sorted by height in descending order
await felt.showLayerDataTable({
layerId: "layer-1",
sorting: {
attribute: "height",
direction: "desc",
},
});

// Show the data table pane with no table visible
await felt.showLayerDataTable();
```

***

## hideLayerDataTable()

> **hideLayerDataTable**(): `Promise`\<`void`>

Hides the data table.

### Returns

`Promise`\<`void`>

### Example

```typescript
await felt.hideLayerDataTable();
```

***

## getViewport()

> **getViewport**(): `Promise`\<[`ViewportState`](../Viewport/ViewportState.md)>
Expand Down
2 changes: 2 additions & 0 deletions docs/Shared/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ These are generic types that are used across multiple modules.
* [MultiPolygonGeometry](MultiPolygonGeometry.md)
* [LineStringGeometry](LineStringGeometry.md)
* [MultiLineStringGeometry](MultiLineStringGeometry.md)
* [SortConfig](SortConfig.md)
* [LngLatTuple](LngLatTuple.md)
* [Geometry](Geometry.md)
* [FeltZoom](FeltZoom.md)
* [FeltBoundary](FeltBoundary.md)
* [SortDirection](SortDirection.md)

# Visibility

Expand Down
21 changes: 21 additions & 0 deletions docs/Shared/SortConfig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
***

Configuration for sorting data by a specific attribute

# Properties

## attribute

> **attribute**: `string`

The attribute to sort by. What this represents depends on the context.
For instance, when sorting features in a data table, the attribute is
the column to sort by.

***

## direction

> **direction**: `"asc"` | `"desc"` = `SortDirectionSchema`

The direction to sort in
5 changes: 5 additions & 0 deletions docs/Shared/SortDirection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
***

> **SortDirection**: `"asc"` | `"desc"`

Specifies the direction to sort data in
65 changes: 63 additions & 2 deletions docs/UI/UiController.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
***

The UI controller allows you to enable and disable UI controls on the
embedded map.
The UI controller allows you to control various aspects of the Felt UI in your embedded map.

This includes enabling/disabling UI controls, managing on-map interactions, and controlling
the visibility of UI components like the data table.

# Extended by

Expand Down Expand Up @@ -50,3 +52,62 @@ will still be selected when clicked.
### Returns

`void`

***

## showLayerDataTable()

> **showLayerDataTable**(`params`?: \{ `layerId`: `string`; `sorting`: [`SortConfig`](../Shared/SortConfig.md); }): `Promise`\<`void`>

Shows a data table view for the specified layer, optionally sorted by a given attribute.

### Parameters

| Parameter | Type |
| ----------------- | ----------------------------------------------------------------------------- |
| `params`? | \{ `layerId`: `string`; `sorting`: [`SortConfig`](../Shared/SortConfig.md); } |
| `params.layerId`? | `string` |
| `params.sorting`? | [`SortConfig`](../Shared/SortConfig.md) |

### Returns

`Promise`\<`void`>

### Example

```typescript
// Show data table with default sorting
await felt.showLayerDataTable({
layerId: "layer-1",
});

// Show data table sorted by height in descending order
await felt.showLayerDataTable({
layerId: "layer-1",
sorting: {
attribute: "height",
direction: "desc",
},
});

// Show the data table pane with no table visible
await felt.showLayerDataTable();
```

***

## hideLayerDataTable()

> **hideLayerDataTable**(): `Promise`\<`void`>

Hides the data table.

### Returns

`Promise`\<`void`>

### Example

```typescript
await felt.hideLayerDataTable();
```
Loading