jmapcloud-ng-types 1.0.47 → 1.0.49

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/index.ts CHANGED
@@ -8,7 +8,6 @@ export interface JAppState {
8
8
  layer: JAppLayerState
9
9
  ui: JAppUiState
10
10
  map: JAppMapState
11
- query: JAppQueryState
12
11
  print: JAppPrintState
13
12
  project: JAppProjectState
14
13
  annotation: JAppAnnotationState
@@ -49,12 +48,6 @@ export interface JAppProjectState {
49
48
  showProjectList: boolean
50
49
  }
51
50
 
52
- export interface JAppQueryState {
53
- activeQuery: JQuery | undefined
54
- defaultValueById: { [id: string]: any } | undefined
55
- displayInDialog: boolean
56
- }
57
-
58
51
  export interface JAppPanelState {
59
52
  active: JAppPanel
60
53
  all: JAppPanel[]
@@ -81,7 +74,7 @@ export interface JAppMapState {
81
74
  }
82
75
 
83
76
  export interface JAppFormState {
84
- expandedSections: { [id: string]: boolean }
77
+ dialogParams: JFormDialogParams | null
85
78
  }
86
79
 
87
80
  export interface JAppMeasureState {
@@ -161,7 +154,6 @@ export interface JApplicationService extends JApplicationMainService {
161
154
  Layer: JAppLayerService
162
155
  Print: JAppPrintService
163
156
  UI: JApplicationUIService
164
- Query: JAppQueryService
165
157
  Event: JAppEventService
166
158
  Annotation: JAppAnnotationService
167
159
  Extension: JAppExtensionService
@@ -232,16 +224,6 @@ export interface JAppAnnotationService {
232
224
  deletePresetColor(presetColor: string): void
233
225
  }
234
226
 
235
- export interface JAppQueryService {
236
- activateQuery(groupId: JId, queryId: string): void
237
- deactivateQuery(): void
238
- setDefaultData(values: any): void
239
- getDefaultData(): { [id: string]: any }
240
- clearDefaultData(): void
241
- displayInDialog(isVisibleInDialog: boolean): void
242
- processQuery(values: any): Promise<GeoJSON.Feature[]>
243
- }
244
-
245
227
  export interface JApplicationUserService {
246
228
  addPopupMenuAction(action: JAppUserAction, index?: number): void
247
229
  existsPopupMenuActionById(actionId: string): boolean
@@ -435,8 +417,7 @@ export interface JAppLayerTreeFilterService {
435
417
  }
436
418
 
437
419
  export interface JAppFormService {
438
- render(containerId: string, formParams: JFormParams): JFormMetaData
439
- destroyByContainerId(containerId: string): void
420
+ openForm(params: JFormDialogParams): void
440
421
  }
441
422
 
442
423
  export interface JAppAppEventModule extends JEventModule {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-types",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "description": "JMap Cloud specific version of JMap Cloud NG types and interfaces",
5
5
  "main": "src/app.ts",
6
6
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "homepage": "https://github.com/k2geospatial/jmapcloud-ng-types#readme",
24
24
  "devDependencies": {
25
25
  "@types/react": "^18.3.2",
26
- "jmapcloud-ng-core-types": "1.0.49",
26
+ "jmapcloud-ng-core-types": "1.0.52",
27
27
  "maplibre-gl": "^4.3.1",
28
28
  "react": "^18.3.1",
29
29
  "typedoc": "^0.25.13"
package/public/app.d.ts CHANGED
@@ -2509,146 +2509,6 @@ declare namespace JMap {
2509
2509
  ): Promise<void | JAppPrintCaptureResult>
2510
2510
  }
2511
2511
 
2512
- /**
2513
- * **JMap.Application.Query**
2514
- *
2515
- * You can manage everything related to query here.
2516
- */
2517
- namespace Query {
2518
- /**
2519
- * **JMap.Application.Query.activateQuery**
2520
- *
2521
- * Activates a query by id and group id.
2522
- *
2523
- * It displays the query form (replacing the list of queries) in the query panel.
2524
- *
2525
- * @param groupId the query group id
2526
- * @param queryId the query id
2527
- * @example
2528
- * ```ts
2529
- * // activate query id=43 on group id=23
2530
- * JMap.Application.Print.activateQuery(23, 43)
2531
- * ```
2532
- */
2533
- function activateQuery(groupId: JId, queryId: string): void
2534
-
2535
- /**
2536
- * **JMap.Application.Query.deactivateQuery**
2537
- *
2538
- * Deactivatea the current query. If no query is active, does nothing.
2539
- *
2540
- * If a query form is active (= its form is displayed), hidea it and returns to the query list.
2541
- *
2542
- * @example
2543
- * ```ts
2544
- * // if a query form is displayed, hide it and return to the query list.
2545
- * JMap.Application.Print.deactivateQuery()
2546
- * ```
2547
- */
2548
- function deactivateQuery(): void
2549
-
2550
- /**
2551
- * **JMap.Application.Query.getDefaultData**
2552
- *
2553
- * Returns the current query form data.
2554
- *
2555
- * If there is no active form, warns in the console and returns an empty object {}.
2556
- *
2557
- * @example
2558
- * ```ts
2559
- * // returns the current query form data
2560
- * JMap.Application.Print.getDefaultData()
2561
- * ```
2562
- */
2563
- function getDefaultData(): { [id: string]: any }
2564
-
2565
- /**
2566
- * **JMap.Application.Query.setDefaultData**
2567
- *
2568
- * Sets active query form data. If there is no active form, this function throws.
2569
- *
2570
- * @throws if no query is active
2571
- * @param values the form data, depends on the form
2572
- * @example
2573
- * ```ts
2574
- * // set the current query form data
2575
- * JMap.Application.Print.setDefaultData({
2576
- * $param1: "black",
2577
- * $param2: "white"
2578
- * })
2579
- * ```
2580
- */
2581
- function setDefaultData(values: any): void
2582
-
2583
- /**
2584
- * **JMap.Application.Query.clearDefaultData**
2585
- *
2586
- * Resets the current query form data.
2587
- *
2588
- * If there is no active form, does nothing.
2589
- *
2590
- * @example
2591
- * ```ts
2592
- * // clear the current query form data
2593
- * JMap.Application.Print.clearDefaultData()
2594
- * ```
2595
- */
2596
- function clearDefaultData(): void
2597
-
2598
- /**
2599
- * **JMap.Application.Query.displayInDialog**
2600
- *
2601
- * By default, the query form is displayed in the left panel with a simple layout, one field per line.
2602
- *
2603
- * But it is possible to display it in a modal window, with the layout defined in the project.
2604
- *
2605
- * @throws if isVisibleInDialog is not a boolean
2606
- * @param isVisibleInDialog true in modal window, false in left panel
2607
- * @example
2608
- * ```ts
2609
- * // display the current form in a modal window
2610
- * JMap.Application.Print.displayInDialog(true)
2611
- *
2612
- * // display the current form in the left panel
2613
- * JMap.Application.Print.displayInDialog(false)
2614
- * ```
2615
- */
2616
- function displayInDialog(isVisibleInDialog: boolean): void
2617
-
2618
- /**
2619
- * **JMap.Application.Query.processQuery**
2620
- *
2621
- * Processes the active query form with the given values.
2622
- *
2623
- * Throws if no query is active.
2624
- *
2625
- * Resolves only if some features are found.
2626
- *
2627
- * If features are found, makes the layer selectable and visible if needed, then selects and zooms on found features.
2628
- *
2629
- * If no feature is found, the Promise rejects with a human readable error in the current user's locale.
2630
- *
2631
- * @throws if no query is active
2632
- * @param values the form data, depends on the form
2633
- * @example
2634
- * ```ts
2635
- * // display the current form in a modal window
2636
- * JMap.Application.Print
2637
- * .processQuery({
2638
- * $param1: "black",
2639
- * $param2: "white"
2640
- * })
2641
- * .then(features => console.info(`Found ${features.length} feature(s)`, features))
2642
- * .catch(error => {
2643
- * // pass here if no features are found, or other error
2644
- * // thrown error is a readable error using the user locale
2645
- * console.error(error)
2646
- * })
2647
- * ```
2648
- */
2649
- function processQuery(values: any): Promise<GeoJSON.Feature[]>
2650
- }
2651
-
2652
2512
  /**
2653
2513
  * **JMap.Application.Event**
2654
2514
  *
@@ -3490,101 +3350,49 @@ declare namespace JMap {
3490
3350
  */
3491
3351
  namespace Form {
3492
3352
  /**
3493
- * ***JMap.Application.Form.render***
3494
- *
3495
- * Renders a form with given params in a container.
3496
- *
3497
- * @param containerId id of the container where the form will be rendered
3498
- * @param formParams a JFormParams object
3499
- * @example
3500
- * ```ts
3501
- * // this example will show you how to create a custom form in an extension
3502
- * // it will render the form in the extension panel
3503
- * window.JMAP_OPTIONS = {
3504
- * ...
3505
- * application: {
3506
- * extensions: [{
3507
- * id: "test-form",
3508
- * panelTitle: "Test of form component API",
3509
- * initFn: () => {},
3510
- * onPanelCreation: panelContainerId => {
3511
- * document.getElementById(panelContainerId).style.padding = "1rem"
3512
- * // create a custom form in the extension panel container
3513
- * JMap.Application.Form.render(panelContainerId, {
3514
- * id: "search-form",
3515
- * schema: {
3516
- * properties: {
3517
- * name: {
3518
- * title: "Office Name",
3519
- * type: "string",
3520
- * isRequired: true,
3521
- * maxLength: 255
3522
- * },
3523
- * type: {
3524
- * title: "Office type",
3525
- * type: "number",
3526
- * // default: 2,
3527
- * enum: [1, 2, 3],
3528
- * enumNames: ["Local", "External", "Mixte"]
3529
- * }
3530
- * }
3531
- * },
3532
- * uiSchema: [
3533
- * {
3534
- * type: "Tab",
3535
- * controls: [
3536
- * {
3537
- * id: "name",
3538
- * label: "Office name",
3539
- * widget: "input",
3540
- * scope: "#/properties/name"
3541
- * },
3542
- * {
3543
- * id: "type",
3544
- * label: "Office type",
3545
- * widget: "select",
3546
- * scope: "#/properties/type"
3547
- * }
3548
- * ]
3549
- * }
3550
- * ],
3551
- * defaultValueById: { // defaultValueById is optional
3552
- * name: "default value",
3553
- * type: 2
3554
- * },
3555
- * validate: (values, formMetaData) => JMap.Form.validateData(formMetaData, JMap.Form.getPreparedData(formMetaData, values)),
3556
- * onSubmit: values => {
3557
- * // saving your data
3558
- * // return a string if an error occurred
3559
- * // return a promise, and the form will display a loading button until the promise resolved
3560
- * JMap.Application.Message.info(`Submitted values: ${JSON.stringify(values)}`)
3561
- * }
3562
- * })
3563
- * },
3564
- * onPanelDestroy: panelContainerId => {
3565
- * JMap.Application.Form.destroyByContainerId(panelContainerId)
3566
- * }
3567
- * }]
3353
+ * **JMap.Application.Form.openForm**
3354
+ *
3355
+ * Opens a form dialog in the application. Depending on the shape of `params`, this will open either:
3356
+ * - a layer-based form (when `layerId` is provided), or
3357
+ * - a table-based form (when `tableId` is provided).
3358
+ *
3359
+ * When opening a layer form:
3360
+ * - `layerId` is required.
3361
+ * - You can optionally pass `featureId` or a full `feature` (GeoJSON.Feature) to edit an existing feature.
3362
+ * - `isReadOnly` controls whether the form is editable.
3363
+ * - `onSubmit` (if provided) is called after the user submits the form.
3364
+ *
3365
+ * When opening a table form:
3366
+ * - `tableId` is required.
3367
+ * - You can optionally pass `row` (an object of key/value pairs) to edit an existing row.
3368
+ * - `isReadOnly` controls whether the form is editable.
3369
+ * - `onSubmit` (if provided) is called after the user submits the form.
3370
+ *
3371
+ * @param params The parameters that configure which form to open:
3372
+ * - For a **layer form**:
3373
+ * - `layerId` (string): The ID of the layer to open the form for.
3374
+ * - `featureId?` (string): (Optional) The ID of the feature in that layer to load.
3375
+ * - `feature?` (GeoJSON.Feature): (Optional) A full GeoJSON feature to load instead of just an ID.
3376
+ * - For a **table form**:
3377
+ * - `tableId` (string): The ID of the table to open the form for.
3378
+ * - `row?` ({ [key: string]: any }): (Optional) The row data to load into the form.
3379
+ * - Common to both shapes:
3380
+ * - `isReadOnly` (boolean): If `true`, the form will be displayed in read‐only mode.
3381
+ * - `onSubmit?` (() => void): (Optional) Callback invoked after the form is successfully submitted.
3382
+ * @example
3383
+ * ```ts
3384
+ * // Example: Open a layer form for editing an existing feature
3385
+ * formSVC.openForm({
3386
+ * layerId: "db4bc79b-03fe-4cf7-a4bc-fb76d69cabdf",
3387
+ * featureId: "3022",
3388
+ * isReadOnly: false,
3389
+ * onSubmit: () => {
3390
+ * console.log("Layer form submitted successfully");
3568
3391
  * }
3569
- * }
3570
- * ```
3571
- *
3572
- */
3573
- function render(containerId: string, formParams: JFormParams): JFormMetaData
3574
-
3575
- /**
3576
- *
3577
- * ***JMap.Application.Form.destroyByContainerId***
3578
- *
3579
- * Unmounts form by using container Id where it was rendered
3580
- *
3581
- * @param containerId id of the container to unmount
3582
- * @example
3583
- * ```ts
3584
- * JMap.Application.Form.destroy("new-form")
3392
+ * });
3585
3393
  * ```
3586
3394
  */
3587
- function destroyByContainerId(containerId: string): void
3395
+ function openForm(params: JFormDialogParams): void
3588
3396
  }
3589
3397
  }
3590
3398
  }
package/public/form.d.ts CHANGED
@@ -1,24 +1,16 @@
1
- declare interface JFormParams {
2
- id: JId
3
- label: string
4
- schema: JFormSchema
5
- uiSchema: JFormUISchema
6
- validationRules?: JFormValidationRules,
7
- readOnly?: boolean
8
- defaultValueById?: { [id: string]: any }
9
- viewId?: number
10
- hideClearButton?: boolean
11
- buttonLabelSubmit?: string
12
- buttonLabelCancel?: string
13
- buttonLabelClear?: string
14
- formIsDestroyedAfterSubmit?: boolean
15
- isSearch?: boolean
16
- smallScreenDisplay?: boolean
17
- disableSubmit?: boolean
18
- submitErrors?: string[]
19
- messageToDisplay?: string
20
- validate: (values: any, formMetada: JFormMetaData) => { [key: string]: string }
21
- onSubmit: (values: any, formMetada: JFormMetaData) => void | string | Promise<any>
22
- onCancel?: () => void
23
- onReset?: () => void
1
+ declare type JFormDialogParams = JFormDialogLayerParams | JFormDialogTableParams
2
+
3
+ declare type JFormDialogLayerParams = {
4
+ layerId: JId
5
+ featureId?: JId
6
+ feature?: GeoJSON.Feature
7
+ isReadOnly: boolean
8
+ onSubmit?: () => void
24
9
  }
10
+
11
+ declare type JFormDialogTableParams = {
12
+ tableId: JId
13
+ row?: { [key: string]: any }
14
+ isReadOnly: boolean
15
+ onSubmit?: () => void
16
+ }