@itwin/core-frontend 5.3.0-dev.10 → 5.3.0-dev.12

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ArcGISImageryProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/tile/map/ImageryProviders/ArcGISImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAmB,qBAAqB,EAAmB,oBAAoB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAKvM;;;;;;GAMG;AACH,8BAAsB,qBAAsB,SAAQ,uBAAuB;IAEzE,SAAS,CAAC,aAAa,EAAE,oBAAoB,GAAC,SAAS,CAAC;IACxD,SAAS,CAAC,gBAAgB,EAAE,mBAAmB,GAAC,SAAS,CAAC;IAE1D;;MAEE;IACF,SAAS,CAAC,oBAAoB,UAAS;IAEvC,SAAS,CAAC,eAAe,UAAS;IAElC,IAAoB,sBAAsB,YAAkC;gBAEhE,QAAQ,EAAE,qBAAqB,EAAE,eAAe,EAAE,OAAO;IAKrE;SACK;cACc,eAAe,CAAC,MAAM,EAAE,6BAA6B;IAaxE;;;MAGE;cACc,cAAc;IAuB9B;;;;;OAKG;cACa,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,WAAW;CAsGtD"}
1
+ {"version":3,"file":"ArcGISImageryProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/tile/map/ImageryProviders/ArcGISImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAmB,qBAAqB,EAAmB,oBAAoB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAKvM;;;;;;GAMG;AACH,8BAAsB,qBAAsB,SAAQ,uBAAuB;IAEzE,SAAS,CAAC,aAAa,EAAE,oBAAoB,GAAC,SAAS,CAAC;IACxD,SAAS,CAAC,gBAAgB,EAAE,mBAAmB,GAAC,SAAS,CAAC;IAE1D;;MAEE;IACF,SAAS,CAAC,oBAAoB,UAAS;IAEvC,SAAS,CAAC,eAAe,UAAS;IAElC,IAAoB,sBAAsB,YAAkC;gBAEhE,QAAQ,EAAE,qBAAqB,EAAE,eAAe,EAAE,OAAO;IAKrE;SACK;cACc,eAAe,CAAC,MAAM,EAAE,6BAA6B;IAaxE;;;MAGE;cACc,cAAc;IAuB9B;;;;;OAKG;cACa,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,WAAW;CAuGtD"}
@@ -88,6 +88,7 @@ class ArcGISImageryProvider extends internal_1.MapLayerImageryProvider {
88
88
  if (this._accessTokenRequired && this._accessClient) {
89
89
  this._lastAccessToken = await internal_1.ArcGisUtilities.appendSecurityToken(urlObj, this._accessClient, {
90
90
  mapLayerUrl: new URL(this._settings.url),
91
+ portal: typeof this._settings.properties?.portal === "string" ? this._settings.properties.portal : undefined,
91
92
  userName: this._settings.userName,
92
93
  password: this._settings.password
93
94
  });
@@ -1 +1 @@
1
- {"version":3,"file":"ArcGISImageryProvider.js","sourceRoot":"","sources":["../../../../../../src/internal/tile/map/ImageryProviders/ArcGISImageryProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAuM;AACvM,qDAAkD;AAClD,yEAA8F;AAC9F,qDAAqE;AAErE;;;;;;GAMG;AACH,MAAsB,qBAAsB,SAAQ,kCAAuB;IAE/D,aAAa,CAAiC;IAC9C,gBAAgB,CAAgC;IAE1D;;MAEE;IACQ,oBAAoB,GAAG,KAAK,CAAC;IAE7B,eAAe,GAAG,KAAK,CAAC;IAElC,IAAoB,sBAAsB,KAAK,OAAO,IAAI,CAAC,eAAe,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,KAAK,SAAS;YACxB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAEvC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AAzKD,sDAyKC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\r\nimport { ArcGisErrorCode, ArcGISServiceMetadata, ArcGisUtilities, MapLayerAccessClient, MapLayerAccessToken, MapLayerImageryProvider, MapLayerImageryProviderStatus } from \"../../../../tile/internal\";\r\nimport { IModelApp } from \"../../../../IModelApp\";\r\nimport { NotifyMessageDetails, OutputMessagePriority } from \"../../../../NotificationManager\";\r\nimport { headersIncludeAuthMethod } from \"../../../../request/utils\";\r\n\r\n/** Base class for ArcGIS map-layer imagery providers.\r\n *\r\n * The initial purpose of this class is to offer shared methods\r\n * to query ArcGIS services and apply the appropriate security token.\r\n * @see [[ArcGISMapLayerImageryProvider]]\r\n * @internal\r\n */\r\nexport abstract class ArcGISImageryProvider extends MapLayerImageryProvider {\r\n\r\n protected _accessClient: MapLayerAccessClient|undefined;\r\n protected _lastAccessToken: MapLayerAccessToken|undefined;\r\n\r\n /** Flag indicating if access token should be added to request.\r\n * @note We assume a service to require access token for the entire viewing session.\r\n */\r\n protected _accessTokenRequired = false;\r\n\r\n protected _querySupported = false;\r\n\r\n public override get supportsMapFeatureInfo() { return this._querySupported;}\r\n\r\n constructor(settings: ImageMapLayerSettings, usesCachedTiles: boolean) {\r\n super(settings, usesCachedTiles);\r\n this._accessClient = IModelApp.mapLayerFormatRegistry?.getAccessClient(settings.formatId);\r\n }\r\n\r\n /** Updates the accessClient token state whenever the status of the provider change.\r\n * */\r\n protected override onStatusUpdated(status: MapLayerImageryProviderStatus) {\r\n if (status === MapLayerImageryProviderStatus.RequireAuth) {\r\n\r\n // Invalidate the token, so a new one get generated\r\n if (this._accessClient?.invalidateToken !== undefined && this._lastAccessToken !== undefined) {\r\n this._accessClient.invalidateToken(this._lastAccessToken);\r\n }\r\n\r\n // Make sure we don't re-use this token again (i.e force login process)\r\n this._lastAccessToken = undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Fetch an ArcGIS service metadata, and returns its JSON representation.\r\n * This wrapper maintains token state and should be used instead of the the ArcGisUtilities version.\r\n */\r\n protected async getServiceJson() {\r\n let metadata: ArcGISServiceMetadata|undefined;\r\n try {\r\n metadata = await ArcGisUtilities.getServiceJson({url: this._settings.url, formatId: this._settings.formatId, userName: this._settings.userName, password: this._settings.password, queryParams: this._settings.collectQueryParams()});\r\n\r\n } catch {\r\n }\r\n if (metadata && metadata.accessTokenRequired) {\r\n const accessClient = IModelApp.mapLayerFormatRegistry.getAccessClient(this._settings.formatId);\r\n if (accessClient) {\r\n try {\r\n // Keep track of last used access token, so we can invalidate it later when an errors occurs\r\n const accessToken = await accessClient.getAccessToken({mapLayerUrl: new URL(this._settings.url)});\r\n this._lastAccessToken = accessToken;\r\n } catch {\r\n }\r\n }\r\n // By turning this ON, tiles requests will include security token\r\n this._accessTokenRequired = metadata.accessTokenRequired;\r\n }\r\n return metadata;\r\n }\r\n\r\n /**\r\n * Make a request to an ArcGIS service using the provided URL and init parameters.\r\n * @param url URL to query\r\n * @param options Custom settings to apply to the request.\r\n * Refer to fetch API for more details (https://developer.mozilla.org/en-US/docs/Web/API/fetch)\r\n */\r\n protected async fetch(url: URL, options?: RequestInit) {\r\n\r\n let errorCode: number | undefined;\r\n const urlObj = new URL(url);\r\n const queryParams = this._settings.collectQueryParams();\r\n Object.keys(queryParams).forEach((paramKey) => {\r\n if (!urlObj.searchParams.has(paramKey))\r\n urlObj.searchParams.append(paramKey, queryParams[paramKey]);\r\n });\r\n\r\n if (this._accessTokenRequired && this._accessClient) {\r\n this._lastAccessToken = await ArcGisUtilities.appendSecurityToken(urlObj, this._accessClient, {\r\n mapLayerUrl: new URL(this._settings.url),\r\n userName: this._settings.userName,\r\n password: this._settings.password });\r\n }\r\n\r\n // We want to complete the first request before letting other requests go;\r\n // this done to avoid flooding server with requests missing credentials\r\n if (!this._firstRequestPromise)\r\n this._firstRequestPromise = new Promise<void>((resolve: any) => this.onFirstRequestCompleted.addOnce(()=>resolve()));\r\n else\r\n await this._firstRequestPromise;\r\n\r\n let response: Response|undefined;\r\n try {\r\n response = await fetch(urlObj, {...options, credentials: this._includeUserCredentials ? \"include\" : undefined});\r\n\r\n if (response.status === 401 && !this._lastAccessToken && headersIncludeAuthMethod(response.headers, [\"ntlm\", \"negotiate\"])) {\r\n // We got a http 401 challenge, lets try again with SSO enabled (i.e. Windows Authentication)\r\n response = await fetch(urlObj, {...options, credentials: \"include\" });\r\n if (response.status === 200) {\r\n this._includeUserCredentials = true; // avoid going through 401 challenges over and over\r\n }\r\n }\r\n\r\n if ((this._lastAccessToken && response.status === 400)\r\n || response.headers.get(\"content-type\")?.toLowerCase().includes(\"htm\")) {\r\n // For some reasons when we make a request with the fetch() api and there is a token error\r\n // we receive a status 400 instead of proper json response. (i.e doing the same request in the browser gives a different response)\r\n // For some other request, we also seen error message in html.\r\n // When it occurs, we fall back to root service request so we get a proper JSON response with error code.\r\n const tmpUrl = new URL(this._settings.url);\r\n if (this._lastAccessToken && this._accessTokenRequired)\r\n tmpUrl.searchParams.append(\"token\", this._lastAccessToken.token);\r\n tmpUrl.searchParams.append(\"f\",\"json\");\r\n response = await fetch(tmpUrl.toString(), options);\r\n }\r\n\r\n errorCode = await ArcGisUtilities.checkForResponseErrorCode(response);\r\n\r\n if (errorCode !== undefined &&\r\n ( errorCode === ArcGisErrorCode.TokenRequired\r\n || errorCode === ArcGisErrorCode.InvalidToken\r\n || errorCode === ArcGisErrorCode.MissingPermissions\r\n ) ) {\r\n\r\n if (this._settings.userName && this._settings.userName.length > 0 && this._lastAccessToken ) {\r\n // **** Legacy token ONLY ***\r\n\r\n // Token might have expired, make a second attempt by forcing new token.\r\n if (this._accessClient?.invalidateToken !== undefined && this._lastAccessToken !== undefined)\r\n this._accessClient.invalidateToken(this._lastAccessToken);\r\n\r\n const urlObj2 = new URL(url);\r\n if (this._accessClient) {\r\n try {\r\n this._lastAccessToken = await ArcGisUtilities.appendSecurityToken(urlObj, this._accessClient, {mapLayerUrl: urlObj, userName: this._settings.userName, password: this._settings.password });\r\n } catch {\r\n }\r\n }\r\n\r\n // Make a second attempt with refreshed token\r\n response = await fetch(urlObj2.toString(), options);\r\n errorCode = await ArcGisUtilities.checkForResponseErrorCode(response);\r\n }\r\n\r\n if (errorCode !== undefined &&\r\n ( errorCode === ArcGisErrorCode.TokenRequired\r\n || errorCode === ArcGisErrorCode.InvalidToken\r\n || errorCode === ArcGisErrorCode.MissingPermissions\r\n ) ) {\r\n // Looks like the initially generated token has expired.\r\n\r\n if (this.status === MapLayerImageryProviderStatus.Valid ) {\r\n // Only report new status change to avoid spamming the UI\r\n this.setStatus(MapLayerImageryProviderStatus.RequireAuth);\r\n this.onStatusChanged.raiseEvent(this);\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:MapLayers.Messages.FetchTooltipTokenError\", { layerName: this._settings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, msg));\r\n }\r\n }\r\n }\r\n } finally {\r\n this.onFirstRequestCompleted.raiseEvent();\r\n }\r\n\r\n if (response === undefined)\r\n throw new Error(\"fetch call failed\");\r\n\r\n return response;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ArcGISImageryProvider.js","sourceRoot":"","sources":["../../../../../../src/internal/tile/map/ImageryProviders/ArcGISImageryProvider.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAGH,wDAAuM;AACvM,qDAAkD;AAClD,yEAA8F;AAC9F,qDAAqE;AAErE;;;;;;GAMG;AACH,MAAsB,qBAAsB,SAAQ,kCAAuB;IAE/D,a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oD,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;wBAChJ,qBAAS,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,0CAAoB,CAAC,2CAAqB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;oBACtG,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,uBAAuB,CAAC,UAAU,EAAE,CAAC;QAC5C,CAAC;QAED,IAAI,QAAQ,KAAK,SAAS;YACxB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAEvC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF;AA1KD,sDA0KC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\nimport { ImageMapLayerSettings } from \"@itwin/core-common\";\r\nimport { ArcGisErrorCode, ArcGISServiceMetadata, ArcGisUtilities, MapLayerAccessClient, MapLayerAccessToken, MapLayerImageryProvider, MapLayerImageryProviderStatus } from \"../../../../tile/internal\";\r\nimport { IModelApp } from \"../../../../IModelApp\";\r\nimport { NotifyMessageDetails, OutputMessagePriority } from \"../../../../NotificationManager\";\r\nimport { headersIncludeAuthMethod } from \"../../../../request/utils\";\r\n\r\n/** Base class for ArcGIS map-layer imagery providers.\r\n *\r\n * The initial purpose of this class is to offer shared methods\r\n * to query ArcGIS services and apply the appropriate security token.\r\n * @see [[ArcGISMapLayerImageryProvider]]\r\n * @internal\r\n */\r\nexport abstract class ArcGISImageryProvider extends MapLayerImageryProvider {\r\n\r\n protected _accessClient: MapLayerAccessClient|undefined;\r\n protected _lastAccessToken: MapLayerAccessToken|undefined;\r\n\r\n /** Flag indicating if access token should be added to request.\r\n * @note We assume a service to require access token for the entire viewing session.\r\n */\r\n protected _accessTokenRequired = false;\r\n\r\n protected _querySupported = false;\r\n\r\n public override get supportsMapFeatureInfo() { return this._querySupported;}\r\n\r\n constructor(settings: ImageMapLayerSettings, usesCachedTiles: boolean) {\r\n super(settings, usesCachedTiles);\r\n this._accessClient = IModelApp.mapLayerFormatRegistry?.getAccessClient(settings.formatId);\r\n }\r\n\r\n /** Updates the accessClient token state whenever the status of the provider change.\r\n * */\r\n protected override onStatusUpdated(status: MapLayerImageryProviderStatus) {\r\n if (status === MapLayerImageryProviderStatus.RequireAuth) {\r\n\r\n // Invalidate the token, so a new one get generated\r\n if (this._accessClient?.invalidateToken !== undefined && this._lastAccessToken !== undefined) {\r\n this._accessClient.invalidateToken(this._lastAccessToken);\r\n }\r\n\r\n // Make sure we don't re-use this token again (i.e force login process)\r\n this._lastAccessToken = undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Fetch an ArcGIS service metadata, and returns its JSON representation.\r\n * This wrapper maintains token state and should be used instead of the the ArcGisUtilities version.\r\n */\r\n protected async getServiceJson() {\r\n let metadata: ArcGISServiceMetadata|undefined;\r\n try {\r\n metadata = await ArcGisUtilities.getServiceJson({url: this._settings.url, formatId: this._settings.formatId, userName: this._settings.userName, password: this._settings.password, queryParams: this._settings.collectQueryParams()});\r\n\r\n } catch {\r\n }\r\n if (metadata && metadata.accessTokenRequired) {\r\n const accessClient = IModelApp.mapLayerFormatRegistry.getAccessClient(this._settings.formatId);\r\n if (accessClient) {\r\n try {\r\n // Keep track of last used access token, so we can invalidate it later when an errors occurs\r\n const accessToken = await accessClient.getAccessToken({mapLayerUrl: new URL(this._settings.url)});\r\n this._lastAccessToken = accessToken;\r\n } catch {\r\n }\r\n }\r\n // By turning this ON, tiles requests will include security token\r\n this._accessTokenRequired = metadata.accessTokenRequired;\r\n }\r\n return metadata;\r\n }\r\n\r\n /**\r\n * Make a request to an ArcGIS service using the provided URL and init parameters.\r\n * @param url URL to query\r\n * @param options Custom settings to apply to the request.\r\n * Refer to fetch API for more details (https://developer.mozilla.org/en-US/docs/Web/API/fetch)\r\n */\r\n protected async fetch(url: URL, options?: RequestInit) {\r\n\r\n let errorCode: number | undefined;\r\n const urlObj = new URL(url);\r\n const queryParams = this._settings.collectQueryParams();\r\n Object.keys(queryParams).forEach((paramKey) => {\r\n if (!urlObj.searchParams.has(paramKey))\r\n urlObj.searchParams.append(paramKey, queryParams[paramKey]);\r\n });\r\n\r\n if (this._accessTokenRequired && this._accessClient) {\r\n this._lastAccessToken = await ArcGisUtilities.appendSecurityToken(urlObj, this._accessClient, {\r\n mapLayerUrl: new URL(this._settings.url),\r\n portal: typeof this._settings.properties?.portal === \"string\" ? this._settings.properties.portal : undefined,\r\n userName: this._settings.userName,\r\n password: this._settings.password });\r\n }\r\n\r\n // We want to complete the first request before letting other requests go;\r\n // this done to avoid flooding server with requests missing credentials\r\n if (!this._firstRequestPromise)\r\n this._firstRequestPromise = new Promise<void>((resolve: any) => this.onFirstRequestCompleted.addOnce(()=>resolve()));\r\n else\r\n await this._firstRequestPromise;\r\n\r\n let response: Response|undefined;\r\n try {\r\n response = await fetch(urlObj, {...options, credentials: this._includeUserCredentials ? \"include\" : undefined});\r\n\r\n if (response.status === 401 && !this._lastAccessToken && headersIncludeAuthMethod(response.headers, [\"ntlm\", \"negotiate\"])) {\r\n // We got a http 401 challenge, lets try again with SSO enabled (i.e. Windows Authentication)\r\n response = await fetch(urlObj, {...options, credentials: \"include\" });\r\n if (response.status === 200) {\r\n this._includeUserCredentials = true; // avoid going through 401 challenges over and over\r\n }\r\n }\r\n\r\n if ((this._lastAccessToken && response.status === 400)\r\n || response.headers.get(\"content-type\")?.toLowerCase().includes(\"htm\")) {\r\n // For some reasons when we make a request with the fetch() api and there is a token error\r\n // we receive a status 400 instead of proper json response. (i.e doing the same request in the browser gives a different response)\r\n // For some other request, we also seen error message in html.\r\n // When it occurs, we fall back to root service request so we get a proper JSON response with error code.\r\n const tmpUrl = new URL(this._settings.url);\r\n if (this._lastAccessToken && this._accessTokenRequired)\r\n tmpUrl.searchParams.append(\"token\", this._lastAccessToken.token);\r\n tmpUrl.searchParams.append(\"f\",\"json\");\r\n response = await fetch(tmpUrl.toString(), options);\r\n }\r\n\r\n errorCode = await ArcGisUtilities.checkForResponseErrorCode(response);\r\n\r\n if (errorCode !== undefined &&\r\n ( errorCode === ArcGisErrorCode.TokenRequired\r\n || errorCode === ArcGisErrorCode.InvalidToken\r\n || errorCode === ArcGisErrorCode.MissingPermissions\r\n ) ) {\r\n\r\n if (this._settings.userName && this._settings.userName.length > 0 && this._lastAccessToken ) {\r\n // **** Legacy token ONLY ***\r\n\r\n // Token might have expired, make a second attempt by forcing new token.\r\n if (this._accessClient?.invalidateToken !== undefined && this._lastAccessToken !== undefined)\r\n this._accessClient.invalidateToken(this._lastAccessToken);\r\n\r\n const urlObj2 = new URL(url);\r\n if (this._accessClient) {\r\n try {\r\n this._lastAccessToken = await ArcGisUtilities.appendSecurityToken(urlObj, this._accessClient, {mapLayerUrl: urlObj, userName: this._settings.userName, password: this._settings.password });\r\n } catch {\r\n }\r\n }\r\n\r\n // Make a second attempt with refreshed token\r\n response = await fetch(urlObj2.toString(), options);\r\n errorCode = await ArcGisUtilities.checkForResponseErrorCode(response);\r\n }\r\n\r\n if (errorCode !== undefined &&\r\n ( errorCode === ArcGisErrorCode.TokenRequired\r\n || errorCode === ArcGisErrorCode.InvalidToken\r\n || errorCode === ArcGisErrorCode.MissingPermissions\r\n ) ) {\r\n // Looks like the initially generated token has expired.\r\n\r\n if (this.status === MapLayerImageryProviderStatus.Valid ) {\r\n // Only report new status change to avoid spamming the UI\r\n this.setStatus(MapLayerImageryProviderStatus.RequireAuth);\r\n this.onStatusChanged.raiseEvent(this);\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:MapLayers.Messages.FetchTooltipTokenError\", { layerName: this._settings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, msg));\r\n }\r\n }\r\n }\r\n } finally {\r\n this.onFirstRequestCompleted.raiseEvent();\r\n }\r\n\r\n if (response === undefined)\r\n throw new Error(\"fetch call failed\");\r\n\r\n return response;\r\n }\r\n}\r\n"]}
@@ -18,6 +18,10 @@ export interface MapLayerAccessToken {
18
18
  /** @beta */
19
19
  export interface MapLayerAccessTokenParams {
20
20
  mapLayerUrl: URL;
21
+ /**
22
+ * Optional portal URL for ArcGIS services. If set overrides the portal inferred from the mapLayerUrl
23
+ */
24
+ portal?: string;
21
25
  userName?: string;
22
26
  password?: string;
23
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerAuthentication.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerAuthentication.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAExD,YAAY;AACZ,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,SAAS,CAAC,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAAC;IACjD,MAAM,IAAI,MAAM,CAAC;CAClB;AAED,YAAY;AACZ,MAAM,WAAW,0BAA0B;IACzC,aAAa,CAAC,EAAE,qBAAqB,CAAC;CACvC;AAED,YAAY;AACZ,MAAM,WAAW,mBAAmB;IAElC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,YAAY;AACZ,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,GAAG,CAAC;IAGjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,YAAY;AACZ,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;IAC5F,uBAAuB,CAAC,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC;IAC1F,eAAe,CAAC,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAEtD,iBAAiB,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CACvC"}
1
+ {"version":3,"file":"MapLayerAuthentication.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerAuthentication.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAExD,YAAY;AACZ,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,SAAS,CAAC,EAAE,GAAG,GAAG,MAAM,GAAG,SAAS,CAAC;IACjD,MAAM,IAAI,MAAM,CAAC;CAClB;AAED,YAAY;AACZ,MAAM,WAAW,0BAA0B;IACzC,aAAa,CAAC,EAAE,qBAAqB,CAAC;CACvC;AAED,YAAY;AACZ,MAAM,WAAW,mBAAmB;IAElC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,YAAY;AACZ,MAAM,WAAW,yBAAyB;IAExC,WAAW,EAAE,GAAG,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,YAAY;AACZ,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC;IAC5F,uBAAuB,CAAC,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC;IAC1F,eAAe,CAAC,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC;IAEtD,iBAAiB,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CACvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerAuthentication.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerAuthentication.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module MapLayers\r\n */\r\n\r\nimport { BeEvent, Listener } from \"@itwin/core-bentley\";\r\n\r\n/** @beta */\r\nexport interface MapLayerTokenEndpoint {\r\n getLoginUrl(stateData?: any): string | undefined;\r\n getUrl(): string;\r\n}\r\n\r\n/** @beta */\r\nexport interface MapLayerAuthenticationInfo {\r\n tokenEndpoint?: MapLayerTokenEndpoint;\r\n}\r\n\r\n/** @beta */\r\nexport interface MapLayerAccessToken {\r\n // The generated token.\r\n token: string;\r\n}\r\n\r\n/** @beta */\r\nexport interface MapLayerAccessTokenParams {\r\n mapLayerUrl: URL;\r\n\r\n // credentials are used to generate non-oauth tokens (i.e ArcGIS legacy tokens)\r\n userName?: string;\r\n password?: string;\r\n}\r\n\r\n/** @beta */\r\nexport interface MapLayerAccessClient {\r\n getAccessToken(params: MapLayerAccessTokenParams): Promise<MapLayerAccessToken | undefined>;\r\n getTokenServiceEndPoint?(mapLayerUrl: string): Promise<MapLayerTokenEndpoint | undefined>;\r\n invalidateToken?(token: MapLayerAccessToken): boolean;\r\n\r\n onOAuthProcessEnd?: BeEvent<Listener>;\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"MapLayerAuthentication.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerAuthentication.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module MapLayers\r\n */\r\n\r\nimport { BeEvent, Listener } from \"@itwin/core-bentley\";\r\n\r\n/** @beta */\r\nexport interface MapLayerTokenEndpoint {\r\n getLoginUrl(stateData?: any): string | undefined;\r\n getUrl(): string;\r\n}\r\n\r\n/** @beta */\r\nexport interface MapLayerAuthenticationInfo {\r\n tokenEndpoint?: MapLayerTokenEndpoint;\r\n}\r\n\r\n/** @beta */\r\nexport interface MapLayerAccessToken {\r\n // The generated token.\r\n token: string;\r\n}\r\n\r\n/** @beta */\r\nexport interface MapLayerAccessTokenParams {\r\n /* @deprecated in 5.2.0. Use `portal` instead */\r\n mapLayerUrl: URL;\r\n\r\n /**\r\n * Optional portal URL for ArcGIS services. If set overrides the portal inferred from the mapLayerUrl\r\n */\r\n portal?: string;\r\n\r\n // credentials are used to generate non-oauth tokens (i.e ArcGIS legacy tokens)\r\n userName?: string;\r\n password?: string;\r\n}\r\n\r\n/** @beta */\r\nexport interface MapLayerAccessClient {\r\n getAccessToken(params: MapLayerAccessTokenParams): Promise<MapLayerAccessToken | undefined>;\r\n getTokenServiceEndPoint?(mapLayerUrl: string): Promise<MapLayerTokenEndpoint | undefined>;\r\n invalidateToken?(token: MapLayerAccessToken): boolean;\r\n\r\n onOAuthProcessEnd?: BeEvent<Listener>;\r\n}\r\n\r\n"]}
@@ -29,37 +29,93 @@ export declare class AccuDrawViewportUI extends AccuDraw {
29
29
  simplifiedInput: boolean;
30
30
  /** Enable simple math operations not supported by quantity parser. */
31
31
  mathOperations: boolean;
32
- /** Number of visible characters to show in text input fields. */
33
- fieldSize: number;
34
- /** Row spacing of text input fields for vertical arrangement. */
35
- rowSpacingFactor: number;
36
- /** Column spacing of text input fields and buttons for horizontal arrangement. */
37
- columnSpacingFactor: number;
38
- /** Corner radius of text input fields and locks buttons. */
39
- borderRadius: string;
40
- /** Background color of unfocused text input fields and unlocked buttons. */
41
- backgroundColor: string;
42
- /** Settings specific to text input fields and lock button labels. */
43
- text: {
44
- /** Font family to use for text input field values and button labels. */
45
- fontFamily: string;
46
- /** Font size to use for text input field values and button labels. */
47
- fontSize: string;
48
- /** Font color to use for text input field values and button labels. */
32
+ /** Settings that apply to both text input fields and lock buttons. */
33
+ field: {
34
+ /** Number of visible characters to show in text input fields. */
35
+ size: number;
36
+ /** Height of text input fields and lock buttons. */
37
+ height: string;
38
+ /** Border settings for text input fields and lock buttons. */
39
+ border: {
40
+ /** Border width to use for text input fields and lock buttons. */
41
+ width: string;
42
+ /** Border style to use for text input fields and lock buttons. */
43
+ style: string;
44
+ /** Corner radius of text input fields and locks buttons. */
45
+ radius: string;
46
+ };
47
+ /** Settings specific to text input fields and lock button labels. */
48
+ text: {
49
+ /** Font family to use for text input field values and button labels. */
50
+ fontFamily: string;
51
+ /** Font size to use for text input field values and button labels. */
52
+ fontSize: string;
53
+ };
54
+ };
55
+ /** Settings specific to text input fields. */
56
+ input: {
57
+ /** Font color to use for text input field values. */
49
58
  color: string;
50
- /** Background color of focused text input field. */
51
- focusColor: string;
59
+ /** Padding applied to text input fields. */
60
+ padding: string;
61
+ /** Settings applied to text input fields when they have focus. */
62
+ focused: {
63
+ /** Background color for focused text input fields. */
64
+ backgroundColor: string;
65
+ /** Inner stroke for focused text input fields. */
66
+ innerStroke: string;
67
+ /** Border settings for focused text input fields. */
68
+ border: {
69
+ /** Border color for focused text input fields. */
70
+ color: string;
71
+ };
72
+ };
73
+ /** Settings applied to text input fields when they do not have focus. */
74
+ unfocused: {
75
+ /** Background color for unfocused text input fields. */
76
+ backgroundColor: string;
77
+ /** Border settings for unfocused text input fields. */
78
+ border: {
79
+ /** Border color for unfocused text input fields. */
80
+ color: string;
81
+ };
82
+ };
52
83
  };
53
84
  /** Settings specific to lock buttons. */
54
85
  button: {
55
- /** Background color of locked buttons. */
56
- pressedColor: string;
57
- /** Margin to use on left and right to position relative to text input field. */
86
+ /** Padding applied to lock buttons. */
87
+ padding: string;
88
+ /** Settings applied to lock buttons when they are unlocked. */
89
+ unlocked: {
90
+ /** Text color for unlocked lock buttons. */
91
+ color: string;
92
+ /** Background color for unlocked lock buttons. */
93
+ backgroundColor: string;
94
+ /** Border settings for unlocked lock buttons. */
95
+ border: {
96
+ /** Border color for unlocked lock buttons. */
97
+ color: string;
98
+ };
99
+ };
100
+ /** Settings applied to lock buttons when they are locked. */
101
+ locked: {
102
+ /** Text color for locked lock buttons. */
103
+ color: string;
104
+ /** Background color for locked lock buttons. */
105
+ backgroundColor: string;
106
+ /** Border settings for locked lock buttons. */
107
+ border: {
108
+ /** Border color for locked lock buttons. */
109
+ color: string;
110
+ };
111
+ };
112
+ };
113
+ /** Spacing between fields within a control and between rows of controls. */
114
+ spacing: {
115
+ /** Spacing between input field and lock button within each field group. */
116
+ gap: string;
117
+ /** Spacing between field groups (distance/angle, x, y, z controls). */
58
118
  margin: string;
59
- /** Width of border outline. */
60
- outlineWidth: string;
61
- /** Shadow shown when unlocked to make it appear raised. */
62
- shadow: string;
63
119
  };
64
120
  };
65
121
  /** Create a new instance of this class to set as [[IModelAppOptions.accuDraw]] for this session. */
@@ -1 +1 @@
1
- {"version":3,"file":"AccuDrawViewportUI.d.ts","sourceRoot":"","sources":["../../../src/tools/AccuDrawViewportUI.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAS7C;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,SAAS,CAAC,CAAmB;IACrC,OAAO,CAAC,kBAAkB,CAAC,CAAO;IAClC,OAAO,CAAC,WAAW,CAAC,CAAwC;IAE5D;;OAEG;IACH,OAAc,YAAY;QACxB,qGAAqG;;QAErG,+GAA+G;;QAE/G,4HAA4H;;QAE5H,wJAAwJ;;;;;QAExJ,mEAAmE;;QAEnE,sEAAsE;;QAEtE,iEA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AC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAMpE;;OAEG;IACa,mBAAmB,IAAI,IAAI;IAK3C;;;;;OAKG;IACa,wBAAwB,CAAC,IAAI,EAAE,SAAS;IAMxD;;OAEG;IACa,kBAAkB,CAAC,IAAI,EAAE,SAAS;IAMlD;;OAEG;IACa,iBAAiB,CAAC,IAAI,EAAE,SAAS;IAMjD;;;;OAIG;IACa,QAAQ,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI;CAIlD"}
@@ -38,37 +38,93 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
38
38
  simplifiedInput: true,
39
39
  /** Enable simple math operations not supported by quantity parser. */
40
40
  mathOperations: true,
41
- /** Number of visible characters to show in text input fields. */
42
- fieldSize: 12,
43
- /** Row spacing of text input fields for vertical arrangement. */
44
- rowSpacingFactor: 1.2,
45
- /** Column spacing of text input fields and buttons for horizontal arrangement. */
46
- columnSpacingFactor: 1.1,
47
- /** Corner radius of text input fields and locks buttons. */
48
- borderRadius: "0.5em",
49
- /** Background color of unfocused text input fields and unlocked buttons. */
50
- backgroundColor: "rgba(150, 150, 150, 0.5)",
51
- /** Settings specific to text input fields and lock button labels. */
52
- text: {
53
- /** Font family to use for text input field values and button labels. */
54
- fontFamily: "sans-serif",
55
- /** Font size to use for text input field values and button labels. */
56
- fontSize: "9pt",
57
- /** Font color to use for text input field values and button labels. */
58
- color: "white",
59
- /** Background color of focused text input field. */
60
- focusColor: "rgba(50, 50, 200, 0.75)",
41
+ /** Settings that apply to both text input fields and lock buttons. */
42
+ field: {
43
+ /** Number of visible characters to show in text input fields. */
44
+ size: 12,
45
+ /** Height of text input fields and lock buttons. */
46
+ height: "var(--iui-component-height-small, 1.75em)",
47
+ /** Border settings for text input fields and lock buttons. */
48
+ border: {
49
+ /** Border width to use for text input fields and lock buttons. */
50
+ width: "1px",
51
+ /** Border style to use for text input fields and lock buttons. */
52
+ style: "solid",
53
+ /** Corner radius of text input fields and locks buttons. */
54
+ radius: "var(--iui-border-radius-1, 0.25rem)",
55
+ },
56
+ /** Settings specific to text input fields and lock button labels. */
57
+ text: {
58
+ /** Font family to use for text input field values and button labels. */
59
+ fontFamily: "var(--iui-font-sans, sans-serif)",
60
+ /** Font size to use for text input field values and button labels. */
61
+ fontSize: "var(--iui-font-size-1, 0.875rem)",
62
+ },
63
+ },
64
+ /** Settings specific to text input fields. */
65
+ input: {
66
+ /** Font color to use for text input field values. */
67
+ color: "var(--iui-color-white, white)",
68
+ /** Padding applied to text input fields. */
69
+ padding: "0 var(--iui-size-s, 0.5rem)",
70
+ /** Settings applied to text input fields when they have focus. */
71
+ focused: {
72
+ /** Background color for focused text input fields. */
73
+ backgroundColor: "hsl(var(--iui-color-accent-hsl, 166 96% 30.7%) / var(--iui-opacity-2, 85%))",
74
+ /** Inner stroke for focused text input fields. */
75
+ innerStroke: `inset 0px 0px 0px 1px var(--iui-color-background, #333c41)`,
76
+ /** Border settings for focused text input fields. */
77
+ border: {
78
+ /** Border color for focused text input fields. */
79
+ color: "hsl(var(--iui-color-accent-hsl, 166 96% 51%))",
80
+ },
81
+ },
82
+ /** Settings applied to text input fields when they do not have focus. */
83
+ unfocused: {
84
+ /** Background color for unfocused text input fields. */
85
+ backgroundColor: "hsl(var(--iui-color-background-hsl, 203 6% 21.25%) / var(--iui-opacity-2, 85%))",
86
+ /** Border settings for unfocused text input fields. */
87
+ border: {
88
+ /** Border color for unfocused text input fields. */
89
+ color: "var(--iui-color-border, hsla(215, 8%, 30%))",
90
+ },
91
+ },
61
92
  },
62
93
  /** Settings specific to lock buttons. */
63
94
  button: {
64
- /** Background color of locked buttons. */
65
- pressedColor: "rgba(50, 50, 50, 0.75)",
66
- /** Margin to use on left and right to position relative to text input field. */
67
- margin: "0.25em",
68
- /** Width of border outline. */
69
- outlineWidth: "thin",
70
- /** Shadow shown when unlocked to make it appear raised. */
71
- shadow: "0.25em 0.25em 0.2em rgb(75, 75, 75)",
95
+ /** Padding applied to lock buttons. */
96
+ padding: "var(--iui-size-2xs, 0.25rem)",
97
+ /** Settings applied to lock buttons when they are unlocked. */
98
+ unlocked: {
99
+ /** Text color for unlocked lock buttons. */
100
+ color: "var(--iui-color-text-muted, #cccccc)",
101
+ /** Background color for unlocked lock buttons. */
102
+ backgroundColor: "hsl(var(--iui-color-background-hsl, 203 6% 21.25%) / var(--iui-opacity-2, 85%))",
103
+ /** Border settings for unlocked lock buttons. */
104
+ border: {
105
+ /** Border color for unlocked lock buttons. */
106
+ color: "var(--iui-color-border, hsla(215, 8%, 30%))",
107
+ },
108
+ },
109
+ /** Settings applied to lock buttons when they are locked. */
110
+ locked: {
111
+ /** Text color for locked lock buttons. */
112
+ color: "hsla(0, 0%, 100%, 1)",
113
+ /** Background color for locked lock buttons. */
114
+ backgroundColor: "hsla(0, 0%, 100%, 0.16)",
115
+ /** Border settings for locked lock buttons. */
116
+ border: {
117
+ /** Border color for locked lock buttons. */
118
+ color: "hsla(0, 0%, 100%, 1)",
119
+ },
120
+ },
121
+ },
122
+ /** Spacing between fields within a control and between rows of controls. */
123
+ spacing: {
124
+ /** Spacing between input field and lock button within each field group. */
125
+ gap: "var(--iui-size-2xs, 0.25rem)",
126
+ /** Spacing between field groups (distance/angle, x, y, z controls). */
127
+ margin: "var(--iui-size-s, 0.75rem)",
72
128
  },
73
129
  };
74
130
  /** Create a new instance of this class to set as [[IModelAppOptions.accuDraw]] for this session. */
@@ -320,7 +376,9 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
320
376
  if (itemField.selectionStart !== (moveLeft ? operatorPosIns + this._expression.operator.length : operatorPosIns))
321
377
  break;
322
378
  // Treat expression operator string as a single character when moving the text insertion cursor...
323
- itemField.selectionStart = itemField.selectionEnd = (moveLeft ? operatorPosIns : operatorPosIns + this._expression.operator.length);
379
+ itemField.selectionStart = itemField.selectionEnd = moveLeft
380
+ ? operatorPosIns
381
+ : operatorPosIns + this._expression.operator.length;
324
382
  ev.preventDefault();
325
383
  return true;
326
384
  case "Backspace":
@@ -431,10 +489,18 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
431
489
  div.className = "accudraw-controls";
432
490
  const style = div.style;
433
491
  style.pointerEvents = "none";
434
- style.overflow = "visible"; // Don't clip/hide outline or shadow...
435
492
  style.position = "absolute";
436
- style.top = style.left = "0";
437
- style.height = style.width = "100%";
493
+ style.display = "flex";
494
+ const isHorizontal = AccuDrawViewportUI.controlProps.horizontalArrangement;
495
+ style.flexDirection = isHorizontal ? "row" : "column";
496
+ if (isHorizontal) {
497
+ // Make the space between each control group bigger than the space between fields within a group
498
+ style.columnGap = AccuDrawViewportUI.controlProps.spacing.margin;
499
+ }
500
+ else {
501
+ // Make the space between each control group equal than the space between fields within a group
502
+ style.rowGap = AccuDrawViewportUI.controlProps.spacing.gap;
503
+ }
438
504
  return div;
439
505
  }
440
506
  updateItemFieldKeyinStatus(itemField, item) {
@@ -450,27 +516,52 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
450
516
  }
451
517
  updateItemFieldLock(itemLock, item) {
452
518
  const locked = this.getFieldLock(item);
453
- itemLock.style.outlineStyle = locked ? "inset" : "outset";
454
- itemLock.style.boxShadow = locked ? "none" : AccuDrawViewportUI.controlProps.button.shadow;
455
- itemLock.style.backgroundColor = locked ? AccuDrawViewportUI.controlProps.button.pressedColor : AccuDrawViewportUI.controlProps.backgroundColor;
519
+ itemLock.style.backgroundColor = locked
520
+ ? AccuDrawViewportUI.controlProps.button.locked.backgroundColor
521
+ : AccuDrawViewportUI.controlProps.button.unlocked.backgroundColor;
522
+ itemLock.style.border = `${AccuDrawViewportUI.controlProps.field.border.width} ${AccuDrawViewportUI.controlProps.field.border.style} ${locked
523
+ ? AccuDrawViewportUI.controlProps.button.locked.border.color
524
+ : AccuDrawViewportUI.controlProps.button.unlocked.border.color}`;
525
+ itemLock.style.color = locked
526
+ ? AccuDrawViewportUI.controlProps.button.locked.color
527
+ : AccuDrawViewportUI.controlProps.button.unlocked.color;
456
528
  }
457
529
  initializeItemStyle(style, isButton) {
458
530
  style.pointerEvents = "none"; // Don't receive pointer events...
459
- style.position = "absolute";
460
531
  style.textWrap = "nowrap";
461
532
  style.textAnchor = "top";
462
- style.textAlign = isButton ? "center" : "left";
533
+ style.boxSizing = "border-box";
463
534
  const controlProps = AccuDrawViewportUI.controlProps;
464
- style.fontFamily = controlProps.text.fontFamily;
465
- style.fontSize = controlProps.text.fontSize;
466
- style.color = controlProps.text.color;
467
- style.backgroundColor = controlProps.backgroundColor;
468
- style.borderRadius = controlProps.borderRadius;
535
+ style.height = controlProps.field.height;
536
+ const baseBorder = `${controlProps.field.border.width} ${controlProps.field.border.style} `;
537
+ switch (isButton) {
538
+ case true:
539
+ style.display = "flex";
540
+ style.justifyContent = "center";
541
+ style.alignItems = "center";
542
+ style.backgroundColor = controlProps.button.unlocked.backgroundColor;
543
+ style.padding = controlProps.button.padding;
544
+ style.border = baseBorder + controlProps.button.unlocked.border.color;
545
+ style.color = controlProps.button.unlocked.color;
546
+ style.aspectRatio = "1";
547
+ break;
548
+ case false:
549
+ style.backgroundColor = controlProps.input.unfocused.backgroundColor;
550
+ style.outline = "none";
551
+ style.padding = controlProps.input.padding;
552
+ style.border = baseBorder + controlProps.input.unfocused.border.color;
553
+ style.color = controlProps.input.color;
554
+ style.width = "120px";
555
+ break;
556
+ }
557
+ style.fontFamily = controlProps.field.text.fontFamily;
558
+ style.fontSize = controlProps.field.text.fontSize;
559
+ style.borderRadius = controlProps.field.border.radius;
469
560
  }
470
561
  createItemField(item) {
471
562
  const itemField = document.createElement("input");
472
563
  itemField.contentEditable = "true";
473
- itemField.size = AccuDrawViewportUI.controlProps.fieldSize;
564
+ itemField.size = AccuDrawViewportUI.controlProps.field.size;
474
565
  const style = itemField.style;
475
566
  this.initializeItemStyle(style, false);
476
567
  this.updateItemFieldValue(itemField, item);
@@ -478,7 +569,6 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
478
569
  itemField.onkeyup = async (ev) => { await this.onKeyboardEvent(ev, false); };
479
570
  itemField.onfocus = (ev) => { this.onFocusChange(ev, item, true); };
480
571
  itemField.onblur = (ev) => { this.onFocusChange(ev, item, false); };
481
- ;
482
572
  return itemField;
483
573
  }
484
574
  createItemFieldLock(item) {
@@ -506,10 +596,6 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
506
596
  const style = itemLock.style;
507
597
  this.initializeItemStyle(style, true);
508
598
  this.updateItemFieldLock(itemLock, item);
509
- const button = AccuDrawViewportUI.controlProps.button;
510
- style.paddingLeft = style.paddingRight = "0";
511
- style.marginLeft = style.marginRight = button.margin;
512
- style.outlineWidth = button.outlineWidth;
513
599
  return itemLock;
514
600
  }
515
601
  /** Called after the controls have been removed from the view. */
@@ -530,18 +616,23 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
530
616
  updateControlVisibility(isPolar, is3d) {
531
617
  if (undefined === this._controls)
532
618
  return;
533
- this._controls.itemFields[AccuDraw_1.ItemField.ANGLE_Item].hidden = !isPolar;
534
- this._controls.itemLocks[AccuDraw_1.ItemField.ANGLE_Item].hidden = !isPolar;
535
- this._controls.itemFields[AccuDraw_1.ItemField.DIST_Item].hidden = !isPolar;
536
- this._controls.itemLocks[AccuDraw_1.ItemField.DIST_Item].hidden = !isPolar;
537
- this._controls.itemFields[AccuDraw_1.ItemField.X_Item].hidden = isPolar;
538
- this._controls.itemLocks[AccuDraw_1.ItemField.X_Item].hidden = isPolar;
539
- this._controls.itemFields[AccuDraw_1.ItemField.Y_Item].hidden = isPolar;
540
- this._controls.itemLocks[AccuDraw_1.ItemField.Y_Item].hidden = isPolar;
619
+ const angleWrapper = this._controls.itemFields[AccuDraw_1.ItemField.ANGLE_Item]
620
+ .parentElement;
621
+ const distWrapper = this._controls.itemFields[AccuDraw_1.ItemField.DIST_Item]
622
+ .parentElement;
623
+ const xWrapper = this._controls.itemFields[AccuDraw_1.ItemField.X_Item]
624
+ .parentElement;
625
+ const yWrapper = this._controls.itemFields[AccuDraw_1.ItemField.Y_Item]
626
+ .parentElement;
627
+ const zWrapper = this._controls.itemFields[AccuDraw_1.ItemField.Z_Item]
628
+ .parentElement;
629
+ angleWrapper.style.display = !isPolar ? "none" : "flex";
630
+ distWrapper.style.display = !isPolar ? "none" : "flex";
631
+ xWrapper.style.display = isPolar ? "none" : "flex";
632
+ yWrapper.style.display = isPolar ? "none" : "flex";
541
633
  if (undefined === is3d)
542
634
  return;
543
- this._controls.itemFields[AccuDraw_1.ItemField.Z_Item].hidden = !is3d;
544
- this._controls.itemLocks[AccuDraw_1.ItemField.Z_Item].hidden = !is3d;
635
+ zWrapper.style.display = !is3d ? "none" : "flex";
545
636
  }
546
637
  updateControls(ev) {
547
638
  const vp = ev.viewport;
@@ -553,43 +644,28 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
553
644
  if (undefined === this._controls) {
554
645
  const overlay = vp.addNewDiv("accudraw-overlay", true, 35);
555
646
  const div = this.createControlDiv();
556
- const is3dLayout = this.is3dCompass(vp);
557
- const isHorizontalLayout = props.horizontalArrangement;
558
647
  overlay.appendChild(div);
559
648
  const createFieldAndLock = (item) => {
560
- const itemField = itemFields[item] = this.createItemField(item);
561
- itemField.style.top = isHorizontalLayout ? "0" : `${rowOffset}px`;
562
- itemField.style.left = isHorizontalLayout ? `${columnOffset}px` : "0";
563
- div.appendChild(itemField);
564
- if (is3dLayout || AccuDraw_1.ItemField.Z_Item !== item)
565
- rowOffset += itemField.offsetHeight * props.rowSpacingFactor;
566
- itemWidth = itemField.offsetWidth;
567
- itemHeight = itemField.offsetHeight;
568
- const itemLock = itemLocks[item] = this.createItemFieldLock(item);
569
- itemLock.style.top = itemField.style.top;
570
- itemLock.style.left = isHorizontalLayout ? `${columnOffset + itemWidth}px` : `${itemWidth}px`;
571
- itemLock.style.width = itemLock.style.height = `${itemHeight}px`; // Make square of same height as text field...
572
- div.appendChild(itemLock);
573
- lockWidth = itemLock.offsetWidth;
574
- if (is3dLayout || AccuDraw_1.ItemField.Z_Item !== item)
575
- columnOffset += (itemWidth + lockWidth) * props.columnSpacingFactor;
649
+ const fieldWrapper = document.createElement("div");
650
+ fieldWrapper.style.display = "flex";
651
+ fieldWrapper.style.flexDirection = "row";
652
+ fieldWrapper.style.alignItems = "center";
653
+ fieldWrapper.style.justifyContent = "center";
654
+ fieldWrapper.style.columnGap = AccuDrawViewportUI.controlProps.spacing.gap;
655
+ fieldWrapper.style.rowGap = AccuDrawViewportUI.controlProps.spacing.gap;
656
+ const itemField = (itemFields[item] = this.createItemField(item));
657
+ fieldWrapper.appendChild(itemField);
658
+ const itemLock = (itemLocks[item] = this.createItemFieldLock(item));
659
+ fieldWrapper.appendChild(itemLock);
660
+ div.appendChild(fieldWrapper);
576
661
  };
577
- let rowOffset = 0;
578
- let columnOffset = 0;
579
- let itemWidth = 0;
580
- let itemHeight = 0;
581
- let lockWidth = 0;
582
662
  const itemFields = [];
583
663
  const itemLocks = [];
584
664
  createFieldAndLock(AccuDraw_1.ItemField.DIST_Item);
585
665
  createFieldAndLock(AccuDraw_1.ItemField.ANGLE_Item);
586
- rowOffset = 0;
587
- columnOffset = 0;
588
666
  createFieldAndLock(AccuDraw_1.ItemField.X_Item);
589
667
  createFieldAndLock(AccuDraw_1.ItemField.Y_Item);
590
668
  createFieldAndLock(AccuDraw_1.ItemField.Z_Item); // Both polar and rectangular modes support Z in 3d views...
591
- div.style.width = isHorizontalLayout ? `${columnOffset}px` : `${itemWidth + lockWidth + 5}px`;
592
- div.style.height = isHorizontalLayout ? `${itemHeight * props.rowSpacingFactor}px` : `${rowOffset}px`;
593
669
  this._controls = { overlay, div, itemFields, itemLocks };
594
670
  this.updateControlVisibility(AccuDraw_1.CompassMode.Polar === this.compassMode, this.is3dCompass(vp));
595
671
  this.setFocusItem(this._focusItem);
@@ -600,7 +676,7 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
600
676
  const position = vp.worldToView(ev.point);
601
677
  if (props.fixedLocation) {
602
678
  position.x = (viewRect.left + ((viewRect.width - this._controls.div.offsetWidth) * 0.5));
603
- position.y = (viewRect.bottom - this._controls.div.offsetHeight);
679
+ position.y = (viewRect.bottom - this._controls.div.offsetHeight * 1.2);
604
680
  }
605
681
  else {
606
682
  position.x += Math.floor(vp.pixelsFromInches(props.cursorOffset.x)) + 0.5;
@@ -667,7 +743,15 @@ class AccuDrawViewportUI extends AccuDraw_1.AccuDraw {
667
743
  return;
668
744
  // NOTE: Using "setSelectionRange" while value is changing in dynamics isn't pretty, use background+caret color instead...
669
745
  const itemField = this._controls.itemFields[item];
670
- itemField.style.backgroundColor = (focusIn ? AccuDrawViewportUI.controlProps.text.focusColor : AccuDrawViewportUI.controlProps.backgroundColor);
746
+ itemField.style.backgroundColor = focusIn
747
+ ? AccuDrawViewportUI.controlProps.input.focused.backgroundColor
748
+ : AccuDrawViewportUI.controlProps.input.unfocused.backgroundColor;
749
+ itemField.style.border = focusIn
750
+ ? `${AccuDrawViewportUI.controlProps.field.border.width} ${AccuDrawViewportUI.controlProps.field.border.style} ${AccuDrawViewportUI.controlProps.input.focused.border.color}`
751
+ : `${AccuDrawViewportUI.controlProps.field.border.width} ${AccuDrawViewportUI.controlProps.field.border.style} ${AccuDrawViewportUI.controlProps.input.unfocused.border.color}`;
752
+ itemField.style.boxShadow = focusIn
753
+ ? AccuDrawViewportUI.controlProps.input.focused.innerStroke
754
+ : "none";
671
755
  this.updateItemFieldKeyinStatus(itemField, item);
672
756
  if (!focusIn)
673
757
  this.setDynamicKeyinStatus(item);