jmapcloud-ng-core-types 2.0.12 → 2.0.13-qa.10

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.d.ts CHANGED
@@ -4,7 +4,7 @@ import { JAttribute, JDataSource, JDataSourceType, JForm as JFormJMC, JRelations
4
4
  import type * as maplibregl from "maplibre-gl"
5
5
  import { Action, Store } from "redux"
6
6
  import { JDataSourceData, JDataSourceDataParams, JDataSourcePermissions } from "./public/jmap/datasource.ts"
7
- import type { JCoreState } from "./public/state.d.ts"
7
+ import type { JCoreState, JMapLegendMode } from "./public/state.d.ts"
8
8
 
9
9
  export type { JCoreOptions } from "./public/jmap/startup-options.d.ts"
10
10
  export type {
@@ -12,9 +12,11 @@ export type {
12
12
  JFormState,
13
13
  JGeocodingState,
14
14
  JGeolocationState,
15
+ JLegendState,
15
16
  JLanguageState,
16
17
  JLayerState,
17
18
  JMapContextState,
19
+ JMapLegendMode,
18
20
  JMapState,
19
21
  JProjectState,
20
22
  JServerState,
@@ -23,7 +25,7 @@ export type {
23
25
  JUIState,
24
26
  JUserState
25
27
  } from "./public/state.d.ts"
26
- export type { JAppConfirmMessage, JAppMessage, JAppMessageOptions, JAppMessageService, JAppMessageState, JAppOverlayMessage } from "./public/jmap/message.d.ts"
28
+ export type { JAppConfirmMessage, JAppMessage, JAppMessageOptions, JAppMessageService, JAppMessageState, JAppOverlayMessage, JAppRenderableMessage } from "./public/jmap/message.d.ts"
27
29
  export type { JAppUserAction } from "./public/jmap/user.d.ts"
28
30
 
29
31
  export interface JCoreService extends JCoreMainService {
@@ -521,6 +523,7 @@ export interface JMapService {
521
523
  Selection: JMapSelectionService
522
524
  Basemap: JMapBasemapService
523
525
  Attribution: JMapAttributionService
526
+ Legend: JMapLegendService
524
527
  getMap(): maplibregl.Map
525
528
  getMapJSLib(): any
526
529
  getDomContainerId(): string
@@ -610,6 +613,14 @@ export interface JMapService {
610
613
  getPixelRatio(): number
611
614
  }
612
615
 
616
+ export interface JMapLegendService {
617
+ getVisible(): boolean
618
+ isControlVisible(): boolean
619
+ setControlVisibility(isVisible: boolean): void
620
+ setMode(mode: JMapLegendMode): void
621
+ setVisible(isVisible: boolean): void
622
+ }
623
+
613
624
  export interface JMapBasemapService {
614
625
  getAllIds(): string[]
615
626
  isActive(): boolean
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-core-types",
3
- "version": "2.0.12",
3
+ "version": "2.0.13-qa.10",
4
4
  "description": "JMap Cloud specific version of JMap Cloud NG Core types and interfaces",
5
5
  "main": "index.js",
6
6
  "types": "ambient.d.ts",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
- "update-types-bridge": "node build/codemod-export-globals.js && node build/auto-add-imports.js && node build/generate-ambient.js && npx prettier --write public/global-aliases.d.ts ambient.d.ts",
9
+ "update-types-bridge": "node build/codemod-export-globals.js && node build/auto-add-imports.js && node build/generate-ambient.js && node ../../../node_modules/prettier/bin/prettier.cjs --write public/global-aliases.d.ts ambient.d.ts",
10
10
  "pub-github": "npm run update-types-bridge && node build/buildfile.js publish-github;",
11
11
  "doc-test": "npm run update-types-bridge && node build/buildfile.js doc-test;"
12
12
  },
package/public/core.d.ts CHANGED
@@ -128,7 +128,7 @@ import type { JSimpleSearchErrorEventParams, JSimpleSearchSuccessEventParams } f
128
128
  import type { JTable, JTableData, JTableDataParams } from "./jmap/table.d.ts"
129
129
  import type { JIFramePopupParams } from "./jmap/ui.d.ts"
130
130
  import type { JJMapPasswordPolicyCompliance, JOrganization, JSessionData, JUserEventSessionChangedParams, JUserInfo } from "./jmap/user.d.ts"
131
- import type { JCoreState } from "./state.d.ts"
131
+ import type { JCoreState, JMapLegendMode } from "./state.d.ts"
132
132
  export {}
133
133
  /**
134
134
  * This is the JMap Cloud NG Core library API documentation.
@@ -4356,6 +4356,74 @@ export namespace JMap {
4356
4356
  *
4357
4357
  */
4358
4358
  function getPixelRatio(): number
4359
+ /**
4360
+ * **JMap.Map.Legend**
4361
+ *
4362
+ * This section contains map legend related methods.
4363
+ */
4364
+ namespace Legend {
4365
+ /**
4366
+ * **JMap.Map.Legend.getVisible**
4367
+ *
4368
+ * Returns whether the map legend is currently visible.
4369
+ *
4370
+ * @example
4371
+ * ```ts
4372
+ * JMap.Map.Legend.getVisible()
4373
+ * ```
4374
+ */
4375
+ function getVisible(): boolean
4376
+ /**
4377
+ * **JMap.Map.Legend.isControlVisible**
4378
+ *
4379
+ * Returns true if the legend button is visible on the map.
4380
+ *
4381
+ * @example
4382
+ * ```ts
4383
+ * JMap.Map.Legend.isControlVisible()
4384
+ * ```
4385
+ */
4386
+ function isControlVisible(): boolean
4387
+ /**
4388
+ * **JMap.Map.Legend.setControlVisibility**
4389
+ *
4390
+ * Changes the legend button visibility on the map.
4391
+ *
4392
+ * @param isVisible true to display the legend button, false to hide
4393
+ * @example
4394
+ * ```ts
4395
+ * JMap.Map.Legend.setControlVisibility(true)
4396
+ * JMap.Map.Legend.setControlVisibility(false)
4397
+ * ```
4398
+ */
4399
+ function setControlVisibility(isVisible: boolean): void
4400
+ /**
4401
+ * **JMap.Map.Legend.setMode**
4402
+ *
4403
+ * Changes the map legend mode.
4404
+ *
4405
+ * @param mode `"dynamic"` to only show what is currently visible on the map, `"static"` to always show all legend-enabled layers
4406
+ * @example
4407
+ * ```ts
4408
+ * JMap.Map.Legend.setMode("dynamic")
4409
+ * JMap.Map.Legend.setMode("static")
4410
+ * ```
4411
+ */
4412
+ function setMode(mode: JMapLegendMode): void
4413
+ /**
4414
+ * **JMap.Map.Legend.setVisible**
4415
+ *
4416
+ * Changes the map legend visibility.
4417
+ *
4418
+ * @param isVisible true to display the legend, false to hide it
4419
+ * @example
4420
+ * ```ts
4421
+ * JMap.Map.Legend.setVisible(true)
4422
+ * JMap.Map.Legend.setVisible(false)
4423
+ * ```
4424
+ */
4425
+ function setVisible(isVisible: boolean): void
4426
+ }
4359
4427
  /**
4360
4428
  * **JMap.Map.resetRasterLayerTransparency**
4361
4429
  *
@@ -364,6 +364,7 @@ declare global {
364
364
  /** @internal */ const MESSAGE_ACTION_TYPES: typeof message.MESSAGE_ACTION_TYPES
365
365
  /** @internal */ type JAppMessage = message.JAppMessage
366
366
  /** @internal */ type JAppOverlayMessage = message.JAppOverlayMessage
367
+ /** @internal */ type JAppRenderableMessage = message.JAppRenderableMessage
367
368
  /** @internal */ type JAppConfirmMessage = message.JAppConfirmMessage
368
369
  /** @internal */ type JAppMessageOptions = message.JAppMessageOptions
369
370
  /** @internal */ type JAppMessageState = message.JAppMessageState
@@ -330,6 +330,7 @@ export interface JLayer extends JLayerTreeElement {
330
330
  // TODO JMAP8-3266 : use a localized type instad of a graphQL one
331
331
  dynamicFilters: JDynamicFilterGraphQL[]
332
332
  allowClientSideEditing: boolean
333
+ includeInLegend: boolean
333
334
  baseFilter?: JAnyFilterCondition
334
335
  }
335
336
 
@@ -397,6 +397,18 @@ export interface JCoreMapOptions {
397
397
  * ```
398
398
  */
399
399
  navigationHistoryControlVisible?: boolean
400
+ /**
401
+ * By default the legend button is visible on the map.
402
+ *
403
+ * But if ***legendControlVisible*** is false, it will be hidden on the map.
404
+ */
405
+ legendControlVisible?: boolean
406
+ /**
407
+ * By default the legend panel is hidden.
408
+ *
409
+ * But if ***legendVisible*** is true, it will be displayed on startup.
410
+ */
411
+ legendVisible?: boolean
400
412
  /**
401
413
  * By default the scale control panel is visible.
402
414
  *
@@ -1,4 +1,5 @@
1
1
  import type { JLOCALES } from "./language.d.ts"
2
+ import type { ReactNode } from "react"
2
3
  export {}
3
4
 
4
5
  // ALL_APP_MESSAGE_SEVERITIES in all-enums.ts
@@ -33,8 +34,59 @@ export interface JAppOverlayMessage {
33
34
  text: string
34
35
  }
35
36
 
37
+ /**
38
+ * Explicit message content modes for NG.
39
+ *
40
+ * Three explicit content modes are supported:
41
+ *
42
+ * 1. Plain text
43
+ * `{ kind: "text", value: "Delete project foo?" }`
44
+ * Render as inert text with no HTML interpretation.
45
+ *
46
+ * 2. Sanitized HTML
47
+ * `{ kind: "html", value: "Delete <b>foo</b>?<br>Please confirm.", policy: "dialog" }`
48
+ * Use only when intentionally rendering an HTML string. The renderer must
49
+ * sanitize the string before display. This is especially useful for
50
+ * translated rich messages, for example:
51
+ * `{ kind: "html", value: JMap.Language.translate("project.delete.message", { projectName: "<b>My project</b>" }), policy: "dialog" }`
52
+ *
53
+ * 3. React node / JSX
54
+ * `{ kind: "node", value: <>Delete <strong>{project.name}</strong>?</> }`
55
+ * Preferred when formatting is needed, because React escapes interpolated
56
+ * values automatically and avoids raw HTML string construction.
57
+ */
58
+ export type JAppRenderableMessage =
59
+ | {
60
+ kind: "html"
61
+ policy?: "dialog" | "presentation"
62
+ value: string
63
+ }
64
+ | {
65
+ kind: "node"
66
+ value: ReactNode
67
+ }
68
+ | {
69
+ kind: "text"
70
+ value: string
71
+ }
72
+
36
73
  export interface JAppConfirmMessage {
37
- message: string
74
+ /**
75
+ * Bare `string` means plain text by default.
76
+ *
77
+ * Explicit rich-content forms are:
78
+ * - `{ kind: "text", value }` for plain text
79
+ * - `{ kind: "html", value, policy }` for intentionally rich HTML that must
80
+ * be sanitized by the renderer, for example a rich message produced by
81
+ * `JMap.Language.translate(...)`
82
+ * - `{ kind: "node", value }` for JSX / ReactNode content
83
+ *
84
+ * Guidance:
85
+ * - default to plain text
86
+ * - prefer `node` when formatting is needed
87
+ * - use `html` only for legacy / translated HTML-string flows
88
+ */
89
+ message: JAppRenderableMessage | string
38
90
  title: string
39
91
  isInputMessage?: boolean
40
92
  isInputOptional?: boolean
@@ -58,6 +110,20 @@ export interface JAppMessageState {
58
110
  }
59
111
 
60
112
  export interface JAppMessageService {
113
+ /**
114
+ * Confirm message content supports three intended modes:
115
+ *
116
+ * - plain text:
117
+ * `message: "Delete project foo?"`
118
+ *
119
+ * - sanitized HTML string:
120
+ * `message: { kind: "html", value: "Delete <b>foo</b>?", policy: "dialog" }`
121
+ *
122
+ * - JSX / ReactNode:
123
+ * `message: { kind: "node", value: <>Delete <strong>{project.name}</strong>?</> }`
124
+ *
125
+ * Plain text is the default.
126
+ */
61
127
  error(message: string, options?: JAppMessageOptions): void
62
128
  warning(message: string, options?: JAppMessageOptions): void
63
129
  info(message: string, options?: JAppMessageOptions): void
package/public/state.d.ts CHANGED
@@ -19,6 +19,7 @@ export interface JCoreState {
19
19
  map: JMapState
20
20
  project: JProjectState
21
21
  layer: JLayerState
22
+ legend: JLegendState
22
23
  table: JTableState
23
24
  user: JUserState
24
25
  language: JLanguageState
@@ -98,6 +99,16 @@ export interface JGeolocationState {
98
99
  currentLocation: JLocation | undefined
99
100
  }
100
101
 
102
+ export type JMapLegendMode = "dynamic" | "static"
103
+
104
+ export interface JLegendState {
105
+ height: string
106
+ mode: JMapLegendMode
107
+ position: JLocation
108
+ visible: boolean
109
+ width: string
110
+ }
111
+
101
112
  export interface JMapState {
102
113
  pitch: number
103
114
  rotation: number
@@ -122,6 +133,7 @@ export interface JMapState {
122
133
  isTerrainActive: boolean
123
134
  isScaleControlVisible: boolean
124
135
  isInitialExtentControlVisible: boolean
136
+ isLegendControlVisible: boolean
125
137
  isMapRotationControlVisible: boolean
126
138
  isTerrainControlVisible: boolean
127
139
  isMapInfoControlVisible: boolean