From 53aaa5a613ecb630253dd58fefd8571e6adf7149 Mon Sep 17 00:00:00 2001 From: Sukanya Aneja Date: Mon, 6 Oct 2025 14:40:12 -0400 Subject: [PATCH 1/4] Improve feature actions docs and types --- docs/Main/FeltController.md | 23 +- docs/UI/CreateFeatureActionParams.md | 2 +- docs/UI/README.md | 4 +- docs/UI/UiController.md | 23 +- docs/UI/UpdateFeatureActionParams.md | 60 ++- docs/UI/uiFeatureAction.md | 80 +++- docs/UI/uiFeatureActionCreate.md | 6 - etc/js-sdk.api.md | 428 +++++++++---------- src/modules/ui/controller.ts | 15 +- src/modules/ui/index.ts | 4 +- src/modules/ui/types.ts | 4 +- src/modules/ui/uiElements/UIFeatureAction.ts | 11 +- 12 files changed, 383 insertions(+), 277 deletions(-) diff --git a/docs/Main/FeltController.md b/docs/Main/FeltController.md index fa851a90..28f96b54 100644 --- a/docs/Main/FeltController.md +++ b/docs/Main/FeltController.md @@ -1897,7 +1897,7 @@ await felt.deleteActionTrigger("enablePolygonTool"); ## createFeatureAction() -> **createFeatureAction**(`args`: [`CreateFeatureActionParams`](../UI/CreateFeatureActionParams.md)): `Promise`\<[`uiFeatureAction`](../UI/uiFeatureAction.md)> +> **createFeatureAction**(`args`: [`CreateFeatureActionParams`](../UI/CreateFeatureActionParams.md)): `Promise`\<[`UIFeatureAction`](../UI/UIFeatureAction.md)> Creates a feature contextual action. @@ -1909,28 +1909,29 @@ Creates a feature contextual action. ### Returns -`Promise`\<[`uiFeatureAction`](../UI/uiFeatureAction.md)> +`Promise`\<[`UIFeatureAction`](../UI/UIFeatureAction.md)> ### Example ```typescript const myAction = await felt.createFeatureAction({ action: { - label: "Edit feature", - onTrigger: async ({ featureId, layerId }) => { - console.log(`Editing feature ${featureId} in layer ${layerId}`); + label: "Add to selection", + onTrigger: async ({ feature }) => { + console.log(`Adding feature ${feature.id} from layer ${feature.layerId} to selection`); }, - layerIds: ["layer-1", "layer-2"], + layerIds: ["layer-1", "layer-2"], // Display the feature action only on these layers }, placement: { at: "start" }, // optional, defaults to { at: "end" } }); + ``` *** ## updateFeatureAction() -> **updateFeatureAction**(`args`: [`UpdateFeatureActionParams`](../UI/UpdateFeatureActionParams.md)): `Promise`\<[`uiFeatureAction`](../UI/uiFeatureAction.md)> +> **updateFeatureAction**(`args`: [`UpdateFeatureActionParams`](../UI/UpdateFeatureActionParams.md)): `Promise`\<[`UIFeatureAction`](../UI/UIFeatureAction.md)> Updates a feature contextual action. @@ -1944,7 +1945,7 @@ Feature contextual action to update is identified by the `id` property. ### Returns -`Promise`\<[`uiFeatureAction`](../UI/uiFeatureAction.md)> +`Promise`\<[`UIFeatureAction`](../UI/UIFeatureAction.md)> ### Remarks @@ -1953,8 +1954,9 @@ Properties provided will override the existing properties. ### Example ```typescript +const myAction = await felt.createFeatureAction({ ... }); await felt.updateFeatureAction({ - id: "my-action", + id: myAction.id, label: "Updated action label", // only label changes }); ``` @@ -1980,7 +1982,8 @@ Deletes a feature contextual action. ### Example ```typescript -await felt.deleteFeatureAction("my-action"); +const myAction = await felt.createFeatureAction({ ... }); +await felt.deleteFeatureAction(myAction.id); ``` *** diff --git a/docs/UI/CreateFeatureActionParams.md b/docs/UI/CreateFeatureActionParams.md index 1ac7a1ce..e2fa0ffa 100644 --- a/docs/UI/CreateFeatureActionParams.md +++ b/docs/UI/CreateFeatureActionParams.md @@ -4,7 +4,7 @@ ## action -> **action**: [`uiFeatureActionCreate`](uiFeatureActionCreate.md) +> **action**: [`UIFeatureActionCreate`](UIFeatureActionCreate.md) *** diff --git a/docs/UI/README.md b/docs/UI/README.md index 7a457afd..bd157496 100644 --- a/docs/UI/README.md +++ b/docs/UI/README.md @@ -32,7 +32,8 @@ UI features such as the legend and the full screen button. * [UIDividerElement](UIDividerElement.md) * [UIDividerElementCreate](UIDividerElementCreate.md) * [UIDividerElementUpdate](UIDividerElementUpdate.md) -* [uiFeatureActionCreate](uiFeatureActionCreate.md) +* [UIFeatureActionCreate](UIFeatureActionCreate.md) +* [UIFeatureAction](UIFeatureAction.md) * [UIFlexibleSpaceElement](UIFlexibleSpaceElement.md) * [UIFlexibleSpaceElementCreate](UIFlexibleSpaceElementCreate.md) * [UIFlexibleSpaceElementUpdate](UIFlexibleSpaceElementUpdate.md) @@ -63,7 +64,6 @@ UI features such as the legend and the full screen button. # Type Aliases -* [uiFeatureAction](uiFeatureAction.md) * [PlacementForUIElement](PlacementForUIElement.md) * [UIPanelElement](UIPanelElement.md) * [UIPanelElementCreate](UIPanelElementCreate.md) diff --git a/docs/UI/UiController.md b/docs/UI/UiController.md index 6a9f3868..5e465041 100644 --- a/docs/UI/UiController.md +++ b/docs/UI/UiController.md @@ -109,7 +109,7 @@ await felt.deleteActionTrigger("enablePolygonTool"); ## createFeatureAction() -> **createFeatureAction**(`args`: [`CreateFeatureActionParams`](CreateFeatureActionParams.md)): `Promise`\<[`uiFeatureAction`](uiFeatureAction.md)> +> **createFeatureAction**(`args`: [`CreateFeatureActionParams`](CreateFeatureActionParams.md)): `Promise`\<[`UIFeatureAction`](UIFeatureAction.md)> Creates a feature contextual action. @@ -121,28 +121,29 @@ Creates a feature contextual action. ### Returns -`Promise`\<[`uiFeatureAction`](uiFeatureAction.md)> +`Promise`\<[`UIFeatureAction`](UIFeatureAction.md)> ### Example ```typescript const myAction = await felt.createFeatureAction({ action: { - label: "Edit feature", - onTrigger: async ({ featureId, layerId }) => { - console.log(`Editing feature ${featureId} in layer ${layerId}`); + label: "Add to selection", + onTrigger: async ({ feature }) => { + console.log(`Adding feature ${feature.id} from layer ${feature.layerId} to selection`); }, - layerIds: ["layer-1", "layer-2"], + layerIds: ["layer-1", "layer-2"], // Display the feature action only on these layers }, placement: { at: "start" }, // optional, defaults to { at: "end" } }); + ``` *** ## updateFeatureAction() -> **updateFeatureAction**(`args`: [`UpdateFeatureActionParams`](UpdateFeatureActionParams.md)): `Promise`\<[`uiFeatureAction`](uiFeatureAction.md)> +> **updateFeatureAction**(`args`: [`UpdateFeatureActionParams`](UpdateFeatureActionParams.md)): `Promise`\<[`UIFeatureAction`](UIFeatureAction.md)> Updates a feature contextual action. @@ -156,7 +157,7 @@ Feature contextual action to update is identified by the `id` property. ### Returns -`Promise`\<[`uiFeatureAction`](uiFeatureAction.md)> +`Promise`\<[`UIFeatureAction`](UIFeatureAction.md)> ### Remarks @@ -165,8 +166,9 @@ Properties provided will override the existing properties. ### Example ```typescript +const myAction = await felt.createFeatureAction({ ... }); await felt.updateFeatureAction({ - id: "my-action", + id: myAction.id, label: "Updated action label", // only label changes }); ``` @@ -192,7 +194,8 @@ Deletes a feature contextual action. ### Example ```typescript -await felt.deleteFeatureAction("my-action"); +const myAction = await felt.createFeatureAction({ ... }); +await felt.deleteFeatureAction(myAction.id); ``` *** diff --git a/docs/UI/UpdateFeatureActionParams.md b/docs/UI/UpdateFeatureActionParams.md index af8e1bdf..70fa41ba 100644 --- a/docs/UI/UpdateFeatureActionParams.md +++ b/docs/UI/UpdateFeatureActionParams.md @@ -12,30 +12,82 @@ > `optional` **label**: `string` +The label of the feature action. + *** ## layerIds? > `optional` **layerIds**: `string`\[] +The layers to add the action to. Optional. Defaults to all layers. + *** ## geometryTypes? > `optional` **geometryTypes**: (`"Polygon"` | `"Point"` | `"Line"` | `"Raster"`)\[] +The geometry type of the features to add the action to. Optional. Defaults to all geometry types. + +*** + +## type? + +> `optional` **type**: `undefined` + *** ## onTrigger()? > `optional` **onTrigger**: (`args`: \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); }) => `void` +The function to call when the feature action is triggered. + +### Parameters + +| Parameter | Type | Description | +| -------------- | ------------------------------------------------------------ | -------------------------------------- | +| `args` | \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); } | The arguments passed to the function. | +| `args.feature` | [`LayerFeature`](../Layers/LayerFeature.md) | The feature that triggered the action. | + +### Returns + +`void` + +*** + +## onCreate()? + +> `optional` **onCreate**: (`args`: \{ `id`: `string`; }) => `void` + +A function to call when the element is created. + +### Parameters + +| Parameter | Type | Description | +| --------- | -------------------- | ------------------------------------- | +| `args` | \{ `id`: `string`; } | The arguments passed to the function. | +| `args.id` | `string` | The id of the element. | + +### Returns + +`void` + +*** + +## onDestroy()? + +> `optional` **onDestroy**: (`args`: \{ `id`: `string`; }) => `void` + +A function to call when the element is destroyed. + ### Parameters -| Parameter | Type | -| -------------- | ------------------------------------------------------------ | -| `args` | \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); } | -| `args.feature` | [`LayerFeature`](../Layers/LayerFeature.md) | +| Parameter | Type | Description | +| --------- | -------------------- | ------------------------------------- | +| `args` | \{ `id`: `string`; } | The arguments passed to the function. | +| `args.id` | `string` | The id of the element. | ### Returns diff --git a/docs/UI/uiFeatureAction.md b/docs/UI/uiFeatureAction.md index 5d1258eb..60651f92 100644 --- a/docs/UI/uiFeatureAction.md +++ b/docs/UI/uiFeatureAction.md @@ -1,38 +1,96 @@ *** -> **uiFeatureAction**: \{ `id`: `string`; `label`: `string`; `onTrigger`: (`args`: \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); }) => `void`; `layerIds`: `string`\[]; `geometryTypes`: (`"Polygon"` | `"Point"` | `"Line"` | `"Raster"`)\[]; } - Represents a feature action after creation (with generated id). -# Type declaration - -## id - -> **id**: `string` +# Properties ## label > **label**: `string` +The label of the feature action. + +*** + ## onTrigger() > **onTrigger**: (`args`: \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); }) => `void` +The function to call when the feature action is triggered. + ### Parameters -| Parameter | Type | -| -------------- | ------------------------------------------------------------ | -| `args` | \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); } | -| `args.feature` | [`LayerFeature`](../Layers/LayerFeature.md) | +| Parameter | Type | Description | +| -------------- | ------------------------------------------------------------ | -------------------------------------- | +| `args` | \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); } | The arguments passed to the function. | +| `args.feature` | [`LayerFeature`](../Layers/LayerFeature.md) | The feature that triggered the action. | ### Returns `void` +*** + +## id + +> **id**: `string` + +*** + ## layerIds? > `optional` **layerIds**: `string`\[] +The layers to add the action to. Optional. Defaults to all layers. + +*** + ## geometryTypes? > `optional` **geometryTypes**: (`"Polygon"` | `"Point"` | `"Line"` | `"Raster"`)\[] + +The geometry type of the features to add the action to. Optional. Defaults to all geometry types. + +*** + +## type? + +> `optional` **type**: `undefined` + +*** + +## onCreate()? + +> `optional` **onCreate**: (`args`: \{ `id`: `string`; }) => `void` + +A function to call when the element is created. + +### Parameters + +| Parameter | Type | Description | +| --------- | -------------------- | ------------------------------------- | +| `args` | \{ `id`: `string`; } | The arguments passed to the function. | +| `args.id` | `string` | The id of the element. | + +### Returns + +`void` + +*** + +## onDestroy()? + +> `optional` **onDestroy**: (`args`: \{ `id`: `string`; }) => `void` + +A function to call when the element is destroyed. + +### Parameters + +| Parameter | Type | Description | +| --------- | -------------------- | ------------------------------------- | +| `args` | \{ `id`: `string`; } | The arguments passed to the function. | +| `args.id` | `string` | The id of the element. | + +### Returns + +`void` diff --git a/docs/UI/uiFeatureActionCreate.md b/docs/UI/uiFeatureActionCreate.md index 9318786f..e3484603 100644 --- a/docs/UI/uiFeatureActionCreate.md +++ b/docs/UI/uiFeatureActionCreate.md @@ -32,12 +32,6 @@ The function to call when the feature action is triggered. *** -## id? - -> `optional` **id**: `string` - -*** - ## layerIds? > `optional` **layerIds**: `string`\[] diff --git a/etc/js-sdk.api.md b/etc/js-sdk.api.md index dc7b8f46..390a9d74 100644 --- a/etc/js-sdk.api.md +++ b/etc/js-sdk.api.md @@ -4,218 +4,218 @@ ```ts -import { aC as AggregatedGridConfig } from './controller-BD8DKro2.js'; -import { aD as AggregationConfig } from './controller-BD8DKro2.js'; -import { aE as AggregationMethod } from './controller-BD8DKro2.js'; -import { a as Basemap } from './controller-BD8DKro2.js'; -import { B as BasemapsController } from './controller-BD8DKro2.js'; -import { f as CircleElementCreate } from './controller-BD8DKro2.js'; -import { g as CircleElementRead } from './controller-BD8DKro2.js'; -import { h as CircleElementUpdate } from './controller-BD8DKro2.js'; -import { bg as CircleToolSettings } from './controller-BD8DKro2.js'; -import { C as ColorBasemap } from './controller-BD8DKro2.js'; -import { b as ColorBasemapInput } from './controller-BD8DKro2.js'; -import { bh as ConfigurableToolType } from './controller-BD8DKro2.js'; -import { aF as CountGridConfig } from './controller-BD8DKro2.js'; -import { bx as CreateActionTriggerParams } from './controller-BD8DKro2.js'; -import { by as CreateFeatureActionParams } from './controller-BD8DKro2.js'; -import { Y as CreateLayersFromGeoJsonParams } from './controller-BD8DKro2.js'; -import { bz as CreateOrUpdatePanelParams } from './controller-BD8DKro2.js'; -import { bA as CreatePanelElementsParams } from './controller-BD8DKro2.js'; -import { c as CustomTileBasemap } from './controller-BD8DKro2.js'; -import { d as CustomTileBasemapInput } from './controller-BD8DKro2.js'; -import { Z as DataOnlyLayer } from './controller-BD8DKro2.js'; -import { bB as DeletePanelElementsParams } from './controller-BD8DKro2.js'; -import { E as Element_2 } from './controller-BD8DKro2.js'; -import { i as ElementChangeCallbackParams } from './controller-BD8DKro2.js'; -import { j as ElementCreate } from './controller-BD8DKro2.js'; -import { k as ElementGroup } from './controller-BD8DKro2.js'; -import { l as ElementGroupChangeCallbackParams } from './controller-BD8DKro2.js'; -import { aU as ElementGroupNode } from './controller-BD8DKro2.js'; -import { aV as ElementNode } from './controller-BD8DKro2.js'; -import { S as ElementsController } from './controller-BD8DKro2.js'; -import { m as ElementUpdate } from './controller-BD8DKro2.js'; -import { aW as EntityNode } from './controller-BD8DKro2.js'; -import { aX as FeatureNode } from './controller-BD8DKro2.js'; -import { aY as FeatureSelection } from './controller-BD8DKro2.js'; -import { e as FeltBasemap } from './controller-BD8DKro2.js'; -import { b0 as FeltBoundary } from './controller-BD8DKro2.js'; -import { F as FeltController } from './controller-BD8DKro2.js'; -import { _ as FeltTiledVectorSource } from './controller-BD8DKro2.js'; -import { b1 as FeltZoom } from './controller-BD8DKro2.js'; -import { av as FilterExpression } from './controller-BD8DKro2.js'; -import { aw as FilterLogicGate } from './controller-BD8DKro2.js'; -import { ay as Filters } from './controller-BD8DKro2.js'; -import { ax as FilterTernary } from './controller-BD8DKro2.js'; -import { $ as GeoJsonDataVectorSource } from './controller-BD8DKro2.js'; -import { b2 as GeoJsonFeature } from './controller-BD8DKro2.js'; -import { a0 as GeoJsonFileVectorSource } from './controller-BD8DKro2.js'; -import { b3 as GeoJsonGeometry } from './controller-BD8DKro2.js'; -import { b4 as GeoJsonProperties } from './controller-BD8DKro2.js'; -import { a1 as GeoJsonUrlVectorSource } from './controller-BD8DKro2.js'; -import { az as GeometryFilter } from './controller-BD8DKro2.js'; -import { G as GetElementGroupsConstraint } from './controller-BD8DKro2.js'; -import { n as GetElementsConstraint } from './controller-BD8DKro2.js'; -import { aG as GetLayerCalculationParams } from './controller-BD8DKro2.js'; -import { aH as GetLayerCategoriesGroup } from './controller-BD8DKro2.js'; -import { aI as GetLayerCategoriesParams } from './controller-BD8DKro2.js'; -import { a2 as GetLayerGroupsConstraint } from './controller-BD8DKro2.js'; -import { aJ as GetLayerHistogramBin } from './controller-BD8DKro2.js'; -import { aK as GetLayerHistogramParams } from './controller-BD8DKro2.js'; -import { aL as GetLayerPrecomputedCalculationParams } from './controller-BD8DKro2.js'; -import { a3 as GetLayersConstraint } from './controller-BD8DKro2.js'; -import { a4 as GetRenderedFeaturesConstraint } from './controller-BD8DKro2.js'; -import { aM as GridConfig } from './controller-BD8DKro2.js'; -import { aN as GridType } from './controller-BD8DKro2.js'; -import { H as HighlighterElementCreate } from './controller-BD8DKro2.js'; -import { o as HighlighterElementRead } from './controller-BD8DKro2.js'; -import { p as HighlighterElementUpdate } from './controller-BD8DKro2.js'; -import { bi as HighlighterToolSettings } from './controller-BD8DKro2.js'; -import { I as ImageElementCreate } from './controller-BD8DKro2.js'; -import { q as ImageElementRead } from './controller-BD8DKro2.js'; -import { r as ImageElementUpdate } from './controller-BD8DKro2.js'; -import { bj as InputToolSettings } from './controller-BD8DKro2.js'; -import { X as InteractionsController } from './controller-BD8DKro2.js'; -import { b5 as LatLng } from './controller-BD8DKro2.js'; -import { a5 as Layer } from './controller-BD8DKro2.js'; -import { aA as LayerBoundaries } from './controller-BD8DKro2.js'; -import { a6 as LayerChangeCallbackParams } from './controller-BD8DKro2.js'; -import { a7 as LayerCommon } from './controller-BD8DKro2.js'; -import { al as LayerFeature } from './controller-BD8DKro2.js'; -import { aB as LayerFilters } from './controller-BD8DKro2.js'; -import { a8 as LayerGroup } from './controller-BD8DKro2.js'; -import { a9 as LayerGroupChangeCallbackParams } from './controller-BD8DKro2.js'; -import { aZ as LayerGroupNode } from './controller-BD8DKro2.js'; -import { a_ as LayerNode } from './controller-BD8DKro2.js'; -import { aa as LayerProcessingStatus } from './controller-BD8DKro2.js'; -import { an as LayerSchema } from './controller-BD8DKro2.js'; -import { ao as LayerSchemaAttribute } from './controller-BD8DKro2.js'; -import { ap as LayerSchemaBooleanAttribute } from './controller-BD8DKro2.js'; -import { aq as LayerSchemaCommonAttribute } from './controller-BD8DKro2.js'; -import { ar as LayerSchemaDateAttribute } from './controller-BD8DKro2.js'; -import { as as LayerSchemaDateTimeAttribute } from './controller-BD8DKro2.js'; -import { at as LayerSchemaNumericAttribute } from './controller-BD8DKro2.js'; -import { au as LayerSchemaTextAttribute } from './controller-BD8DKro2.js'; -import { aR as LayersController } from './controller-BD8DKro2.js'; -import { ab as LegendDisplay } from './controller-BD8DKro2.js'; -import { ac as LegendItem } from './controller-BD8DKro2.js'; -import { ad as LegendItemChangeCallbackParams } from './controller-BD8DKro2.js'; -import { ae as LegendItemIdentifier } from './controller-BD8DKro2.js'; -import { af as LegendItemsConstraint } from './controller-BD8DKro2.js'; -import { b6 as LineStringGeometry } from './controller-BD8DKro2.js'; -import { bk as LineToolSettings } from './controller-BD8DKro2.js'; -import { L as LinkElementRead } from './controller-BD8DKro2.js'; -import { b7 as LngLatTuple } from './controller-BD8DKro2.js'; -import { aS as MapDetails } from './controller-BD8DKro2.js'; -import { W as MapInteractionEvent } from './controller-BD8DKro2.js'; -import { M as MarkerElementCreate } from './controller-BD8DKro2.js'; -import { s as MarkerElementRead } from './controller-BD8DKro2.js'; -import { t as MarkerElementUpdate } from './controller-BD8DKro2.js'; -import { bl as MarkerToolSettings } from './controller-BD8DKro2.js'; -import { aT as MiscController } from './controller-BD8DKro2.js'; -import { aO as MultiAggregationConfig } from './controller-BD8DKro2.js'; -import { b8 as MultiLineStringGeometry } from './controller-BD8DKro2.js'; -import { b9 as MultiPointGeometry } from './controller-BD8DKro2.js'; -import { ba as MultiPolygonGeometry } from './controller-BD8DKro2.js'; -import { N as NoteElementCreate } from './controller-BD8DKro2.js'; -import { u as NoteElementRead } from './controller-BD8DKro2.js'; -import { v as NoteElementUpdate } from './controller-BD8DKro2.js'; -import { bm as NoteToolSettings } from './controller-BD8DKro2.js'; -import { bC as OnMapInteractionsOptions } from './controller-BD8DKro2.js'; -import { P as PathElementCreate } from './controller-BD8DKro2.js'; -import { w as PathElementRead } from './controller-BD8DKro2.js'; -import { x as PathElementUpdate } from './controller-BD8DKro2.js'; -import { bn as PinToolSettings } from './controller-BD8DKro2.js'; -import { y as PlaceElementCreate } from './controller-BD8DKro2.js'; -import { A as PlaceElementRead } from './controller-BD8DKro2.js'; -import { D as PlaceElementUpdate } from './controller-BD8DKro2.js'; -import { bo as PlaceFrame } from './controller-BD8DKro2.js'; -import { bG as PlacementForUIElement } from './controller-BD8DKro2.js'; -import { bp as PlaceSymbol } from './controller-BD8DKro2.js'; -import { bb as PointGeometry } from './controller-BD8DKro2.js'; -import { J as PolygonElementCreate } from './controller-BD8DKro2.js'; -import { K as PolygonElementRead } from './controller-BD8DKro2.js'; -import { O as PolygonElementUpdate } from './controller-BD8DKro2.js'; -import { bc as PolygonGeometry } from './controller-BD8DKro2.js'; -import { bq as PolygonToolSettings } from './controller-BD8DKro2.js'; -import { aP as PrecomputedAggregationMethod } from './controller-BD8DKro2.js'; -import { ag as RasterBand } from './controller-BD8DKro2.js'; -import { ah as RasterLayer } from './controller-BD8DKro2.js'; -import { ai as RasterLayerSource } from './controller-BD8DKro2.js'; -import { am as RasterValue } from './controller-BD8DKro2.js'; -import { br as RouteToolSettings } from './controller-BD8DKro2.js'; -import { a$ as SelectionController } from './controller-BD8DKro2.js'; -import { cp as SetViewportCenterZoomParams } from './controller-BD8DKro2.js'; -import { bd as SetVisibilityRequest } from './controller-BD8DKro2.js'; -import { be as SortConfig } from './controller-BD8DKro2.js'; -import { bf as SortDirection } from './controller-BD8DKro2.js'; -import { T as TextElementCreate } from './controller-BD8DKro2.js'; -import { Q as TextElementRead } from './controller-BD8DKro2.js'; -import { R as TextElementUpdate } from './controller-BD8DKro2.js'; -import { bs as TextToolSettings } from './controller-BD8DKro2.js'; -import { bw as ToolsController } from './controller-BD8DKro2.js'; -import { bt as ToolSettingsChangeEvent } from './controller-BD8DKro2.js'; -import { bu as ToolSettingsMap } from './controller-BD8DKro2.js'; -import { bv as ToolType } from './controller-BD8DKro2.js'; -import { cl as UIActionTriggerCreate } from './controller-BD8DKro2.js'; -import { bJ as UIButtonElement } from './controller-BD8DKro2.js'; -import { bK as UIButtonElementCreate } from './controller-BD8DKro2.js'; -import { bL as UIButtonElementUpdate } from './controller-BD8DKro2.js'; -import { c5 as UIButtonRowElement } from './controller-BD8DKro2.js'; -import { c6 as UIButtonRowElementCreate } from './controller-BD8DKro2.js'; -import { c7 as UIButtonRowElementUpdate } from './controller-BD8DKro2.js'; -import { c8 as UICheckboxGroupElement } from './controller-BD8DKro2.js'; -import { c9 as UICheckboxGroupElementCreate } from './controller-BD8DKro2.js'; -import { ca as UICheckboxGroupElementUpdate } from './controller-BD8DKro2.js'; -import { ck as UIControlElementOption } from './controller-BD8DKro2.js'; -import { co as UiController } from './controller-BD8DKro2.js'; -import { U as UiControlsOptions } from './controller-BD8DKro2.js'; -import { bS as UIDividerElement } from './controller-BD8DKro2.js'; -import { bT as UIDividerElementCreate } from './controller-BD8DKro2.js'; -import { bU as UIDividerElementUpdate } from './controller-BD8DKro2.js'; -import { cm as uiFeatureAction } from './controller-BD8DKro2.js'; -import { cn as uiFeatureActionCreate } from './controller-BD8DKro2.js'; -import { bP as UIFlexibleSpaceElement } from './controller-BD8DKro2.js'; -import { bQ as UIFlexibleSpaceElementCreate } from './controller-BD8DKro2.js'; -import { bR as UIFlexibleSpaceElementUpdate } from './controller-BD8DKro2.js'; -import { c2 as UIGridContainerElement } from './controller-BD8DKro2.js'; -import { c3 as UIGridContainerElementCreate } from './controller-BD8DKro2.js'; -import { c4 as UIGridContainerElementUpdate } from './controller-BD8DKro2.js'; -import { ch as UIIframeElement } from './controller-BD8DKro2.js'; -import { ci as UIIframeElementCreate } from './controller-BD8DKro2.js'; -import { cj as UIIframeElementUpdate } from './controller-BD8DKro2.js'; -import { bH as UIPanel } from './controller-BD8DKro2.js'; -import { bI as UIPanelCreateOrUpdate } from './controller-BD8DKro2.js'; -import { b$ as UIPanelElement } from './controller-BD8DKro2.js'; -import { c0 as UIPanelElementCreate } from './controller-BD8DKro2.js'; -import { c1 as UIPanelElementUpdate } from './controller-BD8DKro2.js'; -import { cb as UIRadioGroupElement } from './controller-BD8DKro2.js'; -import { cc as UIRadioGroupElementCreate } from './controller-BD8DKro2.js'; -import { cd as UIRadioGroupElementUpdate } from './controller-BD8DKro2.js'; -import { bY as UISelectElement } from './controller-BD8DKro2.js'; -import { bZ as UISelectElementCreate } from './controller-BD8DKro2.js'; -import { b_ as UISelectElementUpdate } from './controller-BD8DKro2.js'; -import { bM as UITextElement } from './controller-BD8DKro2.js'; -import { bN as UITextElementCreate } from './controller-BD8DKro2.js'; -import { bO as UITextElementUpdate } from './controller-BD8DKro2.js'; -import { bV as UITextInputElement } from './controller-BD8DKro2.js'; -import { bW as UITextInputElementCreate } from './controller-BD8DKro2.js'; -import { bX as UITextInputElementUpdate } from './controller-BD8DKro2.js'; -import { ce as UIToggleGroupElement } from './controller-BD8DKro2.js'; -import { cf as UIToggleGroupElementCreate } from './controller-BD8DKro2.js'; -import { cg as UIToggleGroupElementUpdate } from './controller-BD8DKro2.js'; -import { bD as UpdateActionTriggerParams } from './controller-BD8DKro2.js'; -import { bE as UpdateFeatureActionParams } from './controller-BD8DKro2.js'; -import { aj as UpdateLayerParams } from './controller-BD8DKro2.js'; -import { bF as UpdatePanelElementsParams } from './controller-BD8DKro2.js'; -import { aQ as ValueConfiguration } from './controller-BD8DKro2.js'; -import { ak as VectorLayer } from './controller-BD8DKro2.js'; -import { V as ViewportCenterZoom } from './controller-BD8DKro2.js'; -import { cq as ViewportConstraints } from './controller-BD8DKro2.js'; -import { ct as ViewportController } from './controller-BD8DKro2.js'; -import { cr as ViewportFitBoundsParams } from './controller-BD8DKro2.js'; -import { cs as ViewportState } from './controller-BD8DKro2.js'; -import { z } from './controller-BD8DKro2.js'; +import { aC as AggregatedGridConfig } from './controller-C63EIoOJ.js'; +import { aD as AggregationConfig } from './controller-C63EIoOJ.js'; +import { aE as AggregationMethod } from './controller-C63EIoOJ.js'; +import { a as Basemap } from './controller-C63EIoOJ.js'; +import { B as BasemapsController } from './controller-C63EIoOJ.js'; +import { f as CircleElementCreate } from './controller-C63EIoOJ.js'; +import { g as CircleElementRead } from './controller-C63EIoOJ.js'; +import { h as CircleElementUpdate } from './controller-C63EIoOJ.js'; +import { bg as CircleToolSettings } from './controller-C63EIoOJ.js'; +import { C as ColorBasemap } from './controller-C63EIoOJ.js'; +import { b as ColorBasemapInput } from './controller-C63EIoOJ.js'; +import { bh as ConfigurableToolType } from './controller-C63EIoOJ.js'; +import { aF as CountGridConfig } from './controller-C63EIoOJ.js'; +import { bx as CreateActionTriggerParams } from './controller-C63EIoOJ.js'; +import { by as CreateFeatureActionParams } from './controller-C63EIoOJ.js'; +import { Y as CreateLayersFromGeoJsonParams } from './controller-C63EIoOJ.js'; +import { bz as CreateOrUpdatePanelParams } from './controller-C63EIoOJ.js'; +import { bA as CreatePanelElementsParams } from './controller-C63EIoOJ.js'; +import { c as CustomTileBasemap } from './controller-C63EIoOJ.js'; +import { d as CustomTileBasemapInput } from './controller-C63EIoOJ.js'; +import { Z as DataOnlyLayer } from './controller-C63EIoOJ.js'; +import { bB as DeletePanelElementsParams } from './controller-C63EIoOJ.js'; +import { E as Element_2 } from './controller-C63EIoOJ.js'; +import { i as ElementChangeCallbackParams } from './controller-C63EIoOJ.js'; +import { j as ElementCreate } from './controller-C63EIoOJ.js'; +import { k as ElementGroup } from './controller-C63EIoOJ.js'; +import { l as ElementGroupChangeCallbackParams } from './controller-C63EIoOJ.js'; +import { aU as ElementGroupNode } from './controller-C63EIoOJ.js'; +import { aV as ElementNode } from './controller-C63EIoOJ.js'; +import { S as ElementsController } from './controller-C63EIoOJ.js'; +import { m as ElementUpdate } from './controller-C63EIoOJ.js'; +import { aW as EntityNode } from './controller-C63EIoOJ.js'; +import { aX as FeatureNode } from './controller-C63EIoOJ.js'; +import { aY as FeatureSelection } from './controller-C63EIoOJ.js'; +import { e as FeltBasemap } from './controller-C63EIoOJ.js'; +import { b0 as FeltBoundary } from './controller-C63EIoOJ.js'; +import { F as FeltController } from './controller-C63EIoOJ.js'; +import { _ as FeltTiledVectorSource } from './controller-C63EIoOJ.js'; +import { b1 as FeltZoom } from './controller-C63EIoOJ.js'; +import { av as FilterExpression } from './controller-C63EIoOJ.js'; +import { aw as FilterLogicGate } from './controller-C63EIoOJ.js'; +import { ay as Filters } from './controller-C63EIoOJ.js'; +import { ax as FilterTernary } from './controller-C63EIoOJ.js'; +import { $ as GeoJsonDataVectorSource } from './controller-C63EIoOJ.js'; +import { b2 as GeoJsonFeature } from './controller-C63EIoOJ.js'; +import { a0 as GeoJsonFileVectorSource } from './controller-C63EIoOJ.js'; +import { b3 as GeoJsonGeometry } from './controller-C63EIoOJ.js'; +import { b4 as GeoJsonProperties } from './controller-C63EIoOJ.js'; +import { a1 as GeoJsonUrlVectorSource } from './controller-C63EIoOJ.js'; +import { az as GeometryFilter } from './controller-C63EIoOJ.js'; +import { G as GetElementGroupsConstraint } from './controller-C63EIoOJ.js'; +import { n as GetElementsConstraint } from './controller-C63EIoOJ.js'; +import { aG as GetLayerCalculationParams } from './controller-C63EIoOJ.js'; +import { aH as GetLayerCategoriesGroup } from './controller-C63EIoOJ.js'; +import { aI as GetLayerCategoriesParams } from './controller-C63EIoOJ.js'; +import { a2 as GetLayerGroupsConstraint } from './controller-C63EIoOJ.js'; +import { aJ as GetLayerHistogramBin } from './controller-C63EIoOJ.js'; +import { aK as GetLayerHistogramParams } from './controller-C63EIoOJ.js'; +import { aL as GetLayerPrecomputedCalculationParams } from './controller-C63EIoOJ.js'; +import { a3 as GetLayersConstraint } from './controller-C63EIoOJ.js'; +import { a4 as GetRenderedFeaturesConstraint } from './controller-C63EIoOJ.js'; +import { aM as GridConfig } from './controller-C63EIoOJ.js'; +import { aN as GridType } from './controller-C63EIoOJ.js'; +import { H as HighlighterElementCreate } from './controller-C63EIoOJ.js'; +import { o as HighlighterElementRead } from './controller-C63EIoOJ.js'; +import { p as HighlighterElementUpdate } from './controller-C63EIoOJ.js'; +import { bi as HighlighterToolSettings } from './controller-C63EIoOJ.js'; +import { I as ImageElementCreate } from './controller-C63EIoOJ.js'; +import { q as ImageElementRead } from './controller-C63EIoOJ.js'; +import { r as ImageElementUpdate } from './controller-C63EIoOJ.js'; +import { bj as InputToolSettings } from './controller-C63EIoOJ.js'; +import { X as InteractionsController } from './controller-C63EIoOJ.js'; +import { b5 as LatLng } from './controller-C63EIoOJ.js'; +import { a5 as Layer } from './controller-C63EIoOJ.js'; +import { aA as LayerBoundaries } from './controller-C63EIoOJ.js'; +import { a6 as LayerChangeCallbackParams } from './controller-C63EIoOJ.js'; +import { a7 as LayerCommon } from './controller-C63EIoOJ.js'; +import { al as LayerFeature } from './controller-C63EIoOJ.js'; +import { aB as LayerFilters } from './controller-C63EIoOJ.js'; +import { a8 as LayerGroup } from './controller-C63EIoOJ.js'; +import { a9 as LayerGroupChangeCallbackParams } from './controller-C63EIoOJ.js'; +import { aZ as LayerGroupNode } from './controller-C63EIoOJ.js'; +import { a_ as LayerNode } from './controller-C63EIoOJ.js'; +import { aa as LayerProcessingStatus } from './controller-C63EIoOJ.js'; +import { an as LayerSchema } from './controller-C63EIoOJ.js'; +import { ao as LayerSchemaAttribute } from './controller-C63EIoOJ.js'; +import { ap as LayerSchemaBooleanAttribute } from './controller-C63EIoOJ.js'; +import { aq as LayerSchemaCommonAttribute } from './controller-C63EIoOJ.js'; +import { ar as LayerSchemaDateAttribute } from './controller-C63EIoOJ.js'; +import { as as LayerSchemaDateTimeAttribute } from './controller-C63EIoOJ.js'; +import { at as LayerSchemaNumericAttribute } from './controller-C63EIoOJ.js'; +import { au as LayerSchemaTextAttribute } from './controller-C63EIoOJ.js'; +import { aR as LayersController } from './controller-C63EIoOJ.js'; +import { ab as LegendDisplay } from './controller-C63EIoOJ.js'; +import { ac as LegendItem } from './controller-C63EIoOJ.js'; +import { ad as LegendItemChangeCallbackParams } from './controller-C63EIoOJ.js'; +import { ae as LegendItemIdentifier } from './controller-C63EIoOJ.js'; +import { af as LegendItemsConstraint } from './controller-C63EIoOJ.js'; +import { b6 as LineStringGeometry } from './controller-C63EIoOJ.js'; +import { bk as LineToolSettings } from './controller-C63EIoOJ.js'; +import { L as LinkElementRead } from './controller-C63EIoOJ.js'; +import { b7 as LngLatTuple } from './controller-C63EIoOJ.js'; +import { aS as MapDetails } from './controller-C63EIoOJ.js'; +import { W as MapInteractionEvent } from './controller-C63EIoOJ.js'; +import { M as MarkerElementCreate } from './controller-C63EIoOJ.js'; +import { s as MarkerElementRead } from './controller-C63EIoOJ.js'; +import { t as MarkerElementUpdate } from './controller-C63EIoOJ.js'; +import { bl as MarkerToolSettings } from './controller-C63EIoOJ.js'; +import { aT as MiscController } from './controller-C63EIoOJ.js'; +import { aO as MultiAggregationConfig } from './controller-C63EIoOJ.js'; +import { b8 as MultiLineStringGeometry } from './controller-C63EIoOJ.js'; +import { b9 as MultiPointGeometry } from './controller-C63EIoOJ.js'; +import { ba as MultiPolygonGeometry } from './controller-C63EIoOJ.js'; +import { N as NoteElementCreate } from './controller-C63EIoOJ.js'; +import { u as NoteElementRead } from './controller-C63EIoOJ.js'; +import { v as NoteElementUpdate } from './controller-C63EIoOJ.js'; +import { bm as NoteToolSettings } from './controller-C63EIoOJ.js'; +import { bC as OnMapInteractionsOptions } from './controller-C63EIoOJ.js'; +import { P as PathElementCreate } from './controller-C63EIoOJ.js'; +import { w as PathElementRead } from './controller-C63EIoOJ.js'; +import { x as PathElementUpdate } from './controller-C63EIoOJ.js'; +import { bn as PinToolSettings } from './controller-C63EIoOJ.js'; +import { y as PlaceElementCreate } from './controller-C63EIoOJ.js'; +import { A as PlaceElementRead } from './controller-C63EIoOJ.js'; +import { D as PlaceElementUpdate } from './controller-C63EIoOJ.js'; +import { bo as PlaceFrame } from './controller-C63EIoOJ.js'; +import { bG as PlacementForUIElement } from './controller-C63EIoOJ.js'; +import { bp as PlaceSymbol } from './controller-C63EIoOJ.js'; +import { bb as PointGeometry } from './controller-C63EIoOJ.js'; +import { J as PolygonElementCreate } from './controller-C63EIoOJ.js'; +import { K as PolygonElementRead } from './controller-C63EIoOJ.js'; +import { O as PolygonElementUpdate } from './controller-C63EIoOJ.js'; +import { bc as PolygonGeometry } from './controller-C63EIoOJ.js'; +import { bq as PolygonToolSettings } from './controller-C63EIoOJ.js'; +import { aP as PrecomputedAggregationMethod } from './controller-C63EIoOJ.js'; +import { ag as RasterBand } from './controller-C63EIoOJ.js'; +import { ah as RasterLayer } from './controller-C63EIoOJ.js'; +import { ai as RasterLayerSource } from './controller-C63EIoOJ.js'; +import { am as RasterValue } from './controller-C63EIoOJ.js'; +import { br as RouteToolSettings } from './controller-C63EIoOJ.js'; +import { a$ as SelectionController } from './controller-C63EIoOJ.js'; +import { cp as SetViewportCenterZoomParams } from './controller-C63EIoOJ.js'; +import { bd as SetVisibilityRequest } from './controller-C63EIoOJ.js'; +import { be as SortConfig } from './controller-C63EIoOJ.js'; +import { bf as SortDirection } from './controller-C63EIoOJ.js'; +import { T as TextElementCreate } from './controller-C63EIoOJ.js'; +import { Q as TextElementRead } from './controller-C63EIoOJ.js'; +import { R as TextElementUpdate } from './controller-C63EIoOJ.js'; +import { bs as TextToolSettings } from './controller-C63EIoOJ.js'; +import { bw as ToolsController } from './controller-C63EIoOJ.js'; +import { bt as ToolSettingsChangeEvent } from './controller-C63EIoOJ.js'; +import { bu as ToolSettingsMap } from './controller-C63EIoOJ.js'; +import { bv as ToolType } from './controller-C63EIoOJ.js'; +import { cl as UIActionTriggerCreate } from './controller-C63EIoOJ.js'; +import { bJ as UIButtonElement } from './controller-C63EIoOJ.js'; +import { bK as UIButtonElementCreate } from './controller-C63EIoOJ.js'; +import { bL as UIButtonElementUpdate } from './controller-C63EIoOJ.js'; +import { c5 as UIButtonRowElement } from './controller-C63EIoOJ.js'; +import { c6 as UIButtonRowElementCreate } from './controller-C63EIoOJ.js'; +import { c7 as UIButtonRowElementUpdate } from './controller-C63EIoOJ.js'; +import { c8 as UICheckboxGroupElement } from './controller-C63EIoOJ.js'; +import { c9 as UICheckboxGroupElementCreate } from './controller-C63EIoOJ.js'; +import { ca as UICheckboxGroupElementUpdate } from './controller-C63EIoOJ.js'; +import { ck as UIControlElementOption } from './controller-C63EIoOJ.js'; +import { co as UiController } from './controller-C63EIoOJ.js'; +import { U as UiControlsOptions } from './controller-C63EIoOJ.js'; +import { bS as UIDividerElement } from './controller-C63EIoOJ.js'; +import { bT as UIDividerElementCreate } from './controller-C63EIoOJ.js'; +import { bU as UIDividerElementUpdate } from './controller-C63EIoOJ.js'; +import { cm as UIFeatureAction } from './controller-C63EIoOJ.js'; +import { cn as UIFeatureActionCreate } from './controller-C63EIoOJ.js'; +import { bP as UIFlexibleSpaceElement } from './controller-C63EIoOJ.js'; +import { bQ as UIFlexibleSpaceElementCreate } from './controller-C63EIoOJ.js'; +import { bR as UIFlexibleSpaceElementUpdate } from './controller-C63EIoOJ.js'; +import { c2 as UIGridContainerElement } from './controller-C63EIoOJ.js'; +import { c3 as UIGridContainerElementCreate } from './controller-C63EIoOJ.js'; +import { c4 as UIGridContainerElementUpdate } from './controller-C63EIoOJ.js'; +import { ch as UIIframeElement } from './controller-C63EIoOJ.js'; +import { ci as UIIframeElementCreate } from './controller-C63EIoOJ.js'; +import { cj as UIIframeElementUpdate } from './controller-C63EIoOJ.js'; +import { bH as UIPanel } from './controller-C63EIoOJ.js'; +import { bI as UIPanelCreateOrUpdate } from './controller-C63EIoOJ.js'; +import { b$ as UIPanelElement } from './controller-C63EIoOJ.js'; +import { c0 as UIPanelElementCreate } from './controller-C63EIoOJ.js'; +import { c1 as UIPanelElementUpdate } from './controller-C63EIoOJ.js'; +import { cb as UIRadioGroupElement } from './controller-C63EIoOJ.js'; +import { cc as UIRadioGroupElementCreate } from './controller-C63EIoOJ.js'; +import { cd as UIRadioGroupElementUpdate } from './controller-C63EIoOJ.js'; +import { bY as UISelectElement } from './controller-C63EIoOJ.js'; +import { bZ as UISelectElementCreate } from './controller-C63EIoOJ.js'; +import { b_ as UISelectElementUpdate } from './controller-C63EIoOJ.js'; +import { bM as UITextElement } from './controller-C63EIoOJ.js'; +import { bN as UITextElementCreate } from './controller-C63EIoOJ.js'; +import { bO as UITextElementUpdate } from './controller-C63EIoOJ.js'; +import { bV as UITextInputElement } from './controller-C63EIoOJ.js'; +import { bW as UITextInputElementCreate } from './controller-C63EIoOJ.js'; +import { bX as UITextInputElementUpdate } from './controller-C63EIoOJ.js'; +import { ce as UIToggleGroupElement } from './controller-C63EIoOJ.js'; +import { cf as UIToggleGroupElementCreate } from './controller-C63EIoOJ.js'; +import { cg as UIToggleGroupElementUpdate } from './controller-C63EIoOJ.js'; +import { bD as UpdateActionTriggerParams } from './controller-C63EIoOJ.js'; +import { bE as UpdateFeatureActionParams } from './controller-C63EIoOJ.js'; +import { aj as UpdateLayerParams } from './controller-C63EIoOJ.js'; +import { bF as UpdatePanelElementsParams } from './controller-C63EIoOJ.js'; +import { aQ as ValueConfiguration } from './controller-C63EIoOJ.js'; +import { ak as VectorLayer } from './controller-C63EIoOJ.js'; +import { V as ViewportCenterZoom } from './controller-C63EIoOJ.js'; +import { cq as ViewportConstraints } from './controller-C63EIoOJ.js'; +import { ct as ViewportController } from './controller-C63EIoOJ.js'; +import { cr as ViewportFitBoundsParams } from './controller-C63EIoOJ.js'; +import { cs as ViewportState } from './controller-C63EIoOJ.js'; +import { z } from './controller-C63EIoOJ.js'; import { z as z_2 } from 'zod'; export { AggregatedGridConfig } @@ -661,9 +661,9 @@ export { UIDividerElementCreate } export { UIDividerElementUpdate } -export { uiFeatureAction } +export { UIFeatureAction } -export { uiFeatureActionCreate } +export { UIFeatureActionCreate } export { UIFlexibleSpaceElement } diff --git a/src/modules/ui/controller.ts b/src/modules/ui/controller.ts index c98e4730..50a3d7e3 100644 --- a/src/modules/ui/controller.ts +++ b/src/modules/ui/controller.ts @@ -164,14 +164,15 @@ export interface UiController { * ```typescript * const myAction = await felt.createFeatureAction({ * action: { - * label: "Edit feature", - * onTrigger: async ({ featureId, layerId }) => { - * console.log(`Editing feature ${featureId} in layer ${layerId}`); + * label: "Add to selection", + * onTrigger: async ({ feature }) => { + * console.log(`Adding feature ${feature.id} from layer ${feature.layerId} to selection`); * }, - * layerIds: ["layer-1", "layer-2"], + * layerIds: ["layer-1", "layer-2"], // Display the feature action only on these layers * }, * placement: { at: "start" }, // optional, defaults to { at: "end" } * }); + * * ``` */ createFeatureAction( @@ -190,8 +191,9 @@ export interface UiController { * * @example * ```typescript + * const myAction = await felt.createFeatureAction({ ... }); * await felt.updateFeatureAction({ - * id: "my-action", + * id: myAction.id, * label: "Updated action label", // only label changes * }); * ``` @@ -207,7 +209,8 @@ export interface UiController { * * @example * ```typescript - * await felt.deleteFeatureAction("my-action"); + * const myAction = await felt.createFeatureAction({ ... }); + * await felt.deleteFeatureAction(myAction.id); * ``` */ deleteFeatureAction(id: string): void; diff --git a/src/modules/ui/index.ts b/src/modules/ui/index.ts index 02f178d2..7577ca94 100644 --- a/src/modules/ui/index.ts +++ b/src/modules/ui/index.ts @@ -104,8 +104,8 @@ export type { UIControlElementOption } from "./uiElements/base"; export type { UIActionTriggerCreate } from "./uiElements/UIActionTrigger"; export type { - UIFeatureAction as uiFeatureAction, - UIFeatureActionCreate as uiFeatureActionCreate, + UIFeatureAction, + UIFeatureActionCreate, } from "./uiElements/UIFeatureAction"; export type { UiController } from "./controller"; diff --git a/src/modules/ui/types.ts b/src/modules/ui/types.ts index f8509548..fc9ae065 100644 --- a/src/modules/ui/types.ts +++ b/src/modules/ui/types.ts @@ -74,8 +74,6 @@ export interface CreateFeatureActionParams placement?: PlacementForUIElement; } -const UpdateFeatureActionParamsSchema = uiFeatureActionSchema.update; - export const UpdateFeatureActionParamsClonableSchema = uiFeatureActionSchema.clonable.partial().required({ id: true }); @@ -84,7 +82,7 @@ export const UpdateFeatureActionParamsClonableSchema = */ export interface UpdateFeatureActionParams extends Omit, "id"> { - id: zInfer["id"]; + id: zInfer["id"]; } const CreateOrUpdatePanelParamsSchema = z.object({ diff --git a/src/modules/ui/uiElements/UIFeatureAction.ts b/src/modules/ui/uiElements/UIFeatureAction.ts index 81430cc3..d2b83f81 100644 --- a/src/modules/ui/uiElements/UIFeatureAction.ts +++ b/src/modules/ui/uiElements/UIFeatureAction.ts @@ -49,7 +49,6 @@ export const uiFeatureActionSchema = { .extend(uiFeatureActionBaseSchema.shape) .extend({ type: z.undefined() }) .extend({ onTrigger: z.string() }), - // Add the missing update schema update: makeUpdateSchema( uiElementBaseCreateSchema.params .extend(uiFeatureActionBaseSchema.shape) @@ -65,7 +64,7 @@ export interface UIFeatureActionCreate extends UIElementLifecycle, Omit< zInfer, - "onCreate" | "onDestroy" + "onCreate" | "onDestroy" | "id" > { /** * The function to call when the feature action is triggered. @@ -79,10 +78,6 @@ export interface UIFeatureActionCreate /** * Represents a feature action after creation (with generated id). */ -export type UIFeatureAction = { +export interface UIFeatureAction extends UIFeatureActionCreate { id: string; - label: string; - layerIds?: string[]; - geometryTypes?: Array<"Polygon" | "Point" | "Line" | "Raster">; - onTrigger: (args: { feature: LayerFeature }) => void; -}; +} From 19ee36985a6ac15d33e70fa45106afd26df15677 Mon Sep 17 00:00:00 2001 From: Sukanya Aneja Date: Mon, 6 Oct 2025 14:51:25 -0400 Subject: [PATCH 2/4] docs(changeset): Fix feature action types and documentation --- .changeset/cuddly-wasps-grab.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/cuddly-wasps-grab.md diff --git a/.changeset/cuddly-wasps-grab.md b/.changeset/cuddly-wasps-grab.md new file mode 100644 index 00000000..38185d5a --- /dev/null +++ b/.changeset/cuddly-wasps-grab.md @@ -0,0 +1,5 @@ +--- +"@feltmaps/js-sdk": patch +--- + +Fix feature action types and documentation From 1cc0b127aa17f8d02cdc040316e457f6b8ff5c7f Mon Sep 17 00:00:00 2001 From: Sukanya Aneja Date: Mon, 6 Oct 2025 15:05:59 -0400 Subject: [PATCH 3/4] Fix file names --- docs/UI/UIFeatureAction.md | 96 ++++++++++++++++++++++++++++++++ docs/UI/UIFeatureActionCreate.md | 91 ++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+) create mode 100644 docs/UI/UIFeatureAction.md create mode 100644 docs/UI/UIFeatureActionCreate.md diff --git a/docs/UI/UIFeatureAction.md b/docs/UI/UIFeatureAction.md new file mode 100644 index 00000000..60651f92 --- /dev/null +++ b/docs/UI/UIFeatureAction.md @@ -0,0 +1,96 @@ +*** + +Represents a feature action after creation (with generated id). + +# Properties + +## label + +> **label**: `string` + +The label of the feature action. + +*** + +## onTrigger() + +> **onTrigger**: (`args`: \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); }) => `void` + +The function to call when the feature action is triggered. + +### Parameters + +| Parameter | Type | Description | +| -------------- | ------------------------------------------------------------ | -------------------------------------- | +| `args` | \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); } | The arguments passed to the function. | +| `args.feature` | [`LayerFeature`](../Layers/LayerFeature.md) | The feature that triggered the action. | + +### Returns + +`void` + +*** + +## id + +> **id**: `string` + +*** + +## layerIds? + +> `optional` **layerIds**: `string`\[] + +The layers to add the action to. Optional. Defaults to all layers. + +*** + +## geometryTypes? + +> `optional` **geometryTypes**: (`"Polygon"` | `"Point"` | `"Line"` | `"Raster"`)\[] + +The geometry type of the features to add the action to. Optional. Defaults to all geometry types. + +*** + +## type? + +> `optional` **type**: `undefined` + +*** + +## onCreate()? + +> `optional` **onCreate**: (`args`: \{ `id`: `string`; }) => `void` + +A function to call when the element is created. + +### Parameters + +| Parameter | Type | Description | +| --------- | -------------------- | ------------------------------------- | +| `args` | \{ `id`: `string`; } | The arguments passed to the function. | +| `args.id` | `string` | The id of the element. | + +### Returns + +`void` + +*** + +## onDestroy()? + +> `optional` **onDestroy**: (`args`: \{ `id`: `string`; }) => `void` + +A function to call when the element is destroyed. + +### Parameters + +| Parameter | Type | Description | +| --------- | -------------------- | ------------------------------------- | +| `args` | \{ `id`: `string`; } | The arguments passed to the function. | +| `args.id` | `string` | The id of the element. | + +### Returns + +`void` diff --git a/docs/UI/UIFeatureActionCreate.md b/docs/UI/UIFeatureActionCreate.md new file mode 100644 index 00000000..e3484603 --- /dev/null +++ b/docs/UI/UIFeatureActionCreate.md @@ -0,0 +1,91 @@ +*** + +Represents a feature action for creation. +It can be added to the map by using the [UiController.createFeatureAction](UiController.md#createfeatureaction) method. + +# Properties + +## label + +> **label**: `string` + +The label of the feature action. + +*** + +## onTrigger() + +> **onTrigger**: (`args`: \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); }) => `void` + +The function to call when the feature action is triggered. + +### Parameters + +| Parameter | Type | Description | +| -------------- | ------------------------------------------------------------ | -------------------------------------- | +| `args` | \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); } | The arguments passed to the function. | +| `args.feature` | [`LayerFeature`](../Layers/LayerFeature.md) | The feature that triggered the action. | + +### Returns + +`void` + +*** + +## layerIds? + +> `optional` **layerIds**: `string`\[] + +The layers to add the action to. Optional. Defaults to all layers. + +*** + +## geometryTypes? + +> `optional` **geometryTypes**: (`"Polygon"` | `"Point"` | `"Line"` | `"Raster"`)\[] + +The geometry type of the features to add the action to. Optional. Defaults to all geometry types. + +*** + +## type? + +> `optional` **type**: `undefined` + +*** + +## onCreate()? + +> `optional` **onCreate**: (`args`: \{ `id`: `string`; }) => `void` + +A function to call when the element is created. + +### Parameters + +| Parameter | Type | Description | +| --------- | -------------------- | ------------------------------------- | +| `args` | \{ `id`: `string`; } | The arguments passed to the function. | +| `args.id` | `string` | The id of the element. | + +### Returns + +`void` + +*** + +## onDestroy()? + +> `optional` **onDestroy**: (`args`: \{ `id`: `string`; }) => `void` + +A function to call when the element is destroyed. + +### Parameters + +| Parameter | Type | Description | +| --------- | -------------------- | ------------------------------------- | +| `args` | \{ `id`: `string`; } | The arguments passed to the function. | +| `args.id` | `string` | The id of the element. | + +### Returns + +`void` From da4d039c2c04c024c32be312c32da751aff9c76a Mon Sep 17 00:00:00 2001 From: Sukanya Aneja Date: Mon, 6 Oct 2025 15:43:04 -0400 Subject: [PATCH 4/4] Fix files --- docs/UI/uiFeatureAction.md | 96 -------------------------------- docs/UI/uiFeatureActionCreate.md | 91 ------------------------------ 2 files changed, 187 deletions(-) delete mode 100644 docs/UI/uiFeatureAction.md delete mode 100644 docs/UI/uiFeatureActionCreate.md diff --git a/docs/UI/uiFeatureAction.md b/docs/UI/uiFeatureAction.md deleted file mode 100644 index 60651f92..00000000 --- a/docs/UI/uiFeatureAction.md +++ /dev/null @@ -1,96 +0,0 @@ -*** - -Represents a feature action after creation (with generated id). - -# Properties - -## label - -> **label**: `string` - -The label of the feature action. - -*** - -## onTrigger() - -> **onTrigger**: (`args`: \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); }) => `void` - -The function to call when the feature action is triggered. - -### Parameters - -| Parameter | Type | Description | -| -------------- | ------------------------------------------------------------ | -------------------------------------- | -| `args` | \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); } | The arguments passed to the function. | -| `args.feature` | [`LayerFeature`](../Layers/LayerFeature.md) | The feature that triggered the action. | - -### Returns - -`void` - -*** - -## id - -> **id**: `string` - -*** - -## layerIds? - -> `optional` **layerIds**: `string`\[] - -The layers to add the action to. Optional. Defaults to all layers. - -*** - -## geometryTypes? - -> `optional` **geometryTypes**: (`"Polygon"` | `"Point"` | `"Line"` | `"Raster"`)\[] - -The geometry type of the features to add the action to. Optional. Defaults to all geometry types. - -*** - -## type? - -> `optional` **type**: `undefined` - -*** - -## onCreate()? - -> `optional` **onCreate**: (`args`: \{ `id`: `string`; }) => `void` - -A function to call when the element is created. - -### Parameters - -| Parameter | Type | Description | -| --------- | -------------------- | ------------------------------------- | -| `args` | \{ `id`: `string`; } | The arguments passed to the function. | -| `args.id` | `string` | The id of the element. | - -### Returns - -`void` - -*** - -## onDestroy()? - -> `optional` **onDestroy**: (`args`: \{ `id`: `string`; }) => `void` - -A function to call when the element is destroyed. - -### Parameters - -| Parameter | Type | Description | -| --------- | -------------------- | ------------------------------------- | -| `args` | \{ `id`: `string`; } | The arguments passed to the function. | -| `args.id` | `string` | The id of the element. | - -### Returns - -`void` diff --git a/docs/UI/uiFeatureActionCreate.md b/docs/UI/uiFeatureActionCreate.md deleted file mode 100644 index e3484603..00000000 --- a/docs/UI/uiFeatureActionCreate.md +++ /dev/null @@ -1,91 +0,0 @@ -*** - -Represents a feature action for creation. -It can be added to the map by using the [UiController.createFeatureAction](UiController.md#createfeatureaction) method. - -# Properties - -## label - -> **label**: `string` - -The label of the feature action. - -*** - -## onTrigger() - -> **onTrigger**: (`args`: \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); }) => `void` - -The function to call when the feature action is triggered. - -### Parameters - -| Parameter | Type | Description | -| -------------- | ------------------------------------------------------------ | -------------------------------------- | -| `args` | \{ `feature`: [`LayerFeature`](../Layers/LayerFeature.md); } | The arguments passed to the function. | -| `args.feature` | [`LayerFeature`](../Layers/LayerFeature.md) | The feature that triggered the action. | - -### Returns - -`void` - -*** - -## layerIds? - -> `optional` **layerIds**: `string`\[] - -The layers to add the action to. Optional. Defaults to all layers. - -*** - -## geometryTypes? - -> `optional` **geometryTypes**: (`"Polygon"` | `"Point"` | `"Line"` | `"Raster"`)\[] - -The geometry type of the features to add the action to. Optional. Defaults to all geometry types. - -*** - -## type? - -> `optional` **type**: `undefined` - -*** - -## onCreate()? - -> `optional` **onCreate**: (`args`: \{ `id`: `string`; }) => `void` - -A function to call when the element is created. - -### Parameters - -| Parameter | Type | Description | -| --------- | -------------------- | ------------------------------------- | -| `args` | \{ `id`: `string`; } | The arguments passed to the function. | -| `args.id` | `string` | The id of the element. | - -### Returns - -`void` - -*** - -## onDestroy()? - -> `optional` **onDestroy**: (`args`: \{ `id`: `string`; }) => `void` - -A function to call when the element is destroyed. - -### Parameters - -| Parameter | Type | Description | -| --------- | -------------------- | ------------------------------------- | -| `args` | \{ `id`: `string`; } | The arguments passed to the function. | -| `args.id` | `string` | The id of the element. | - -### Returns - -`void`