@arcgis/core 4.30.0-next.20240605 → 4.30.0-next.20240607
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/README.md +1 -1
- package/arcade/functions/centroid.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0062b5fc83fc67d813e0.js +1 -0
- package/assets/esri/core/workers/chunks/{288fdc4a4746d6b81687.js → 4468c2c3b489782faa5c.js} +1 -1
- package/assets/esri/core/workers/chunks/6ad7b5817a9594689716.js +1 -0
- package/assets/esri/core/workers/chunks/733a117cb420316751b9.js +1 -0
- package/assets/esri/core/workers/chunks/888ad3cf5eaa472731be.js +1 -0
- package/assets/esri/core/workers/chunks/{342426c8a8c9f5f84811.js → b62e942e675d5770ea24.js} +1 -1
- package/assets/esri/core/workers/chunks/{4faf7055457c04dc9fc1.js → cd03ad7dc45fbbeb1a2f.js} +1 -1
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
- package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +8 -0
- package/assets/esri/themes/base/widgets/_CatalogLayerList.scss +8 -0
- package/assets/esri/themes/base/widgets/_LayerList.scss +8 -0
- package/assets/esri/themes/base/widgets/_Print.scss +12 -0
- package/assets/esri/themes/base/widgets/_TableList.scss +8 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/interfaces.d.ts +140 -28
- package/layers/CatalogLayer.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/arcgisLayers.js +1 -1
- package/package.json +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/support/elevationInfoUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/styleUtils.js +1 -1
- package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ScaleOrientManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/interactive/editingTools/manipulatorUtils.js +1 -1
- package/views/3d/interactive/editingTools/originGeometryVisualElementUtils.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/state/NearFarHeuristic.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/widgets/BasemapLayerList/css.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/CatalogLayerList/css.js +1 -1
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
- package/widgets/FeatureTable/RelationshipColumn.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable/support/tableUtils.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/LayerList/css.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/TableList/css.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/support/legacyIcon.js +1 -1
- package/assets/esri/core/workers/chunks/9f2d8940da48c864b2ca.js +0 -1
- package/assets/esri/core/workers/chunks/d03ada1212b13e76bff4.js +0 -1
- package/assets/esri/core/workers/chunks/de4f0da054e8a798dfbf.js +0 -1
- package/assets/esri/core/workers/chunks/e21d72debf45c5a33520.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import{MultiOriginJSONSupport as t}from"../../core/MultiOriginJSONSupport.js";import{whenOnce as o}from"../../core/reactiveUtils.js";import{hasSameCanonicalPortal as
|
|
5
|
+
import e from"../../core/Error.js";import{MultiOriginJSONSupport as t}from"../../core/MultiOriginJSONSupport.js";import{whenOnce as o}from"../../core/reactiveUtils.js";import{hasSameCanonicalPortal as r,urlToObject as a}from"../../core/urlUtils.js";import{updateOrigins as i}from"../../core/accessorSupport/originUtils.js";import n from"../../geometry/SpatialReference.js";import{equals as s}from"../../geometry/support/spatialReferenceUtils.js";import{webMercatorToGeographic as l}from"../../geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as p}from"../../layers/support/arcgisLayerUrl.js";import{isLayerWithFeatureLayerSource as c,isFeatureCollectionLayer as m}from"../../layers/support/layerUtils.js";import u from"../../portal/Portal.js";import f from"../../portal/PortalItem.js";import{createForItemWrite as d}from"../../portal/support/jsonContext.js";import{typeKeyword as w,removeTypeKeyword as y,addTypeKeyword as h,hasTypeKeyword as g}from"../../portal/support/portalItemUtils.js";import{project as _}from"../../rest/geometryService/project.js";import b from"../../rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as j,findSpatialReference as R,isDeveloperBasemapLayer as v}from"../../support/basemapUtils.js";import{saveResources as P}from"./resourceUtils.js";import{validateSaveAPIKey as W}from"./saveAPIKeyUtils.js";import{beforeSave as I,evaluateWriteErrors as S}from"./saveUtils.js";const A=["NatGeo_World_Map","Ocean_Basemap","USA_Topo_Maps","World_Imagery","World_Street_Map","World_Terrain_Base","World_Topo_Map","World_Hillshade","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Reference/World_Boundaries_and_Places","Reference/World_Reference_Overlay","Reference/World_Transportation"].map((e=>e.toLowerCase()));async function U(e,t,r){r??={},C(e,t),await o((()=>!t.updatingFromView)),await t.load(),await V(t),await I(t),await D(e,t);const a=t.portalItem,{json:i,jsonContext:n}=await O(t,a);return S(n,{errorName:`${e.name}:save`},r),await x(t,a),await we(e,t,a,i,n),await Promise.all([t.updateItemThumbnail(),P(t.resourceReferences,n)]),a}async function O(e,t){const o=d(t,"web-map",!0),r=e.write({},o);return await Promise.all(o.resources.pendingOperations),{json:r,jsonContext:o}}async function T(e,t,r,a){a??={};const i=E(e,r);await o((()=>!t.updatingFromView)),await t.load(),await V(t),await I(t),await D(e,t);const{json:n,jsonContext:s}=await O(t,i);S(s,{errorName:`${e.name}:save`},a),await Y(t,i);const l=t.getThumbnailState();return await ye(e,t,i,n,s,a)&&(t.resourceReferences.portalItem=i),t.restoreThumbnailFromState(l),await Promise.all([t.updateItemThumbnail(),P(t.resourceReferences,s)]),i}function C(t,o){if(!o.portalItem)throw new e(`${t.name}:portal-item-not-set`,"Portal item to save to has not been set on the WebMap");W(o.portalItem),M(t,o.portalItem)}function M(t,o){if(o.type!==t.itemType)throw new e(`${t.name}:portal-item-wrong-type`,`Portal item needs to have type "${t.itemType}"`)}async function D(t,r){if(!r.basemap?.baseLayers.length)throw new e(`${t.name}:save`,"Map does not have a valid basemap with a base layer.");let a=null;if(await o((()=>{const e=R(r.initialViewProperties,r.basemap);return a=e.spatialReference,!e.updating})),!s(a,r.initialViewProperties.spatialReference))throw new e(`${t.name}:save`,"The spatial reference of the basemap is not compatible with the one from the map.",{expected:r.initialViewProperties.spatialReference,actual:a})}function E(e,t){let o=f.from(t);return o.id&&(o=o.clone(),o.id=null),o.type||(o.type=e.itemType),o.portal||(o.portal=u.getDefault()),W(o),M(e,o),o}function V(e){const t=[];return e.basemap&&t.push(e.basemap.load()),e.ground&&t.push(e.ground.load()),Promise.allSettled(t).then((()=>{}))}async function x(e,t){t.extent=await ce(e.portalItem,e.initialViewProperties.viewpoint.targetGeometry),await Z(e,t)}const G=w.JSAPI,L="CollectorDisabled",k="Collector",$="Data Editing",B="OfflineDisabled",N="Offline",K="Workforce Project",F="Workforce Worker",H="Workforce Dispatcher",J="Offline Map Areas",q="FieldMapsDisabled",z=w.DEVELOPER_BASEMAP,Q="UtilityNetwork",X="IPS";async function Y(e,t){y(t,L),y(t,q),y(t,w.METADATA),y(t,B),y(t,J),y(t,H),y(t,K),y(t,F),await x(e,t)}async function Z(e,t){h(t,G),await ee(e),ae(e,t),ie(e,t),ne(e,t),se(e,t),le(e,t),pe(e,t),t.typeKeywords&&(t.typeKeywords=t.typeKeywords.filter(((e,t,o)=>o.indexOf(e)===t)))}function ee(e){const t=te(e).map((e=>e.load())).toArray();return Promise.allSettled(t).then((()=>{}))}function te(e){return e.allLayers.concat(e.allTables)}function oe(e){return te(e).some((e=>e.loaded&&c(e)&&e.capabilities.operations.supportsEditing&&e.editingEnabled&&("subtype-group"!==e.type||e.sublayers.some((e=>e.editingEnabled)))))}function re(e){return te(e).filter((e=>"group"!==e.type)).every((t=>t.loaded&&fe(e,t)))}function ae(e,t){g(t,L)||g(t,K)||g(t,F)||g(t,H)||!oe(e)?y(t,k):h(t,k)}function ie(e,t){oe(e)?h(t,$):y(t,$)}function ne(e,t){!g(t,B)&&re(e)?h(t,N):y(t,N)}function se(e,t){j(e.basemap)?h(t,z):y(t,z)}function le(e,t){e.utilityNetworks?.length?h(t,Q):y(t,Q)}function pe(e,t){e.ipsInfo?h(t,X):y(t,X)}async function ce(e,t){const o=t.clone().normalize();let r;if(o.length>1)for(const a of o)r?a.width>r.width&&(r=a):r=a;else r=o[0];return me(e,r)}async function me(e,t){const o=t.spatialReference;if(o.isWGS84)return t.clone();if(o.isWebMercator)return l(t);const{getGeometryServiceURL:r}=await import("../../portal/support/geometryServiceUtils.js"),a=await r(e),i=new b({geometries:[t],outSpatialReference:n.WGS84});return(await _(a,i))[0]}function ue(e){return m(e)||"map-notes"===e.type||"route"===e.type}function fe(e,t){return c(t)&&t.capabilities.operations.supportsSync||ue(t)&&!t.portalItem||("tile"===t.type||"vector-tile"===t.type)&&(t.capabilities.operations.supportsExportTiles||de(t)||v(t))&&t.spatialReference.equals(e.initialViewProperties.spatialReference)}function de(e){return"tile"===e.type&&(p(e.url)&&A.some((t=>e.url?.toLowerCase().includes("/"+t+"/"))))}async function we(e,t,o,r,a){await o.update({data:r}),_e(e,t,o,r,a)}async function ye(t,o,r,a,i,n){const s=o.portalItem,l={item:s,authenticated:!(!s?.id||!s.portal.user)},p=r.portal;await p.signIn();const{copyAllowed:c,itemReloaded:m}=await he(l,p);if(l.authenticated||=m,!c)throw new e(`${t.name}:save-as-copy-not-allowed`,"Owner of this map does not allow others to save a copy");const u=await ge(r,l,a,n);return o.portalItem=r,_e(t,o,r,a,i),u}async function he(e,t){const{item:o,authenticated:r}=e;return o?.id&&o.typeKeywords?.includes("useOnly")?o.portal.portalHostname!==t.portalHostname?{copyAllowed:!1,itemReloaded:!1}:(r||await o.reload(),{copyAllowed:"admin"===o.itemControl||"update"===o.itemControl,itemReloaded:!0}):{copyAllowed:!0,itemReloaded:!1}}async function ge(e,t,o,a){const i=e.portal,{item:n}=t,{folder:s,copyAllResources:l}=a;let p=!1;if(l&&n?.id&&r(n.portal.url,i.url)&&parseInt(n.portal.currentVersion,10)>=2023){const{total:e}=await n.fetchResources();p=!!e}if(p){const t=await n.copy({copyResources:"all",folder:s});e.id=t.id,e.portal=t.portal;const r=e.toJSON();await e.load(),e.read(r),await e.update({data:o})}else await(i.user?.addItem({item:e,folder:s,data:o}));return p}function _e(e,o,r,n,s){t.prototype.read.call(o,{version:n.version,authoringApp:n.authoringApp,authoringAppVersion:n.authoringAppVersion},{origin:e.origin,ignoreDefaults:!0,url:r.itemUrl?a(r.itemUrl):void 0}),i(s),o.resourceInfo=n}export{O as createJSON,U as save,T as saveAs};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const t="esri-basemap-layer-list",i=`${t}__item`,e={base:t,filterNoResults:`${t}__filter-no-results`,item:i,itemActive:`${i}--active`,itemContent:`${i}-content`,itemContentBottom:`${i}-content-bottom`,itemMessage:`${i}-message`,itemInvisible:`${i}--invisible`,itemActionIcon:`${i}-action-icon`,itemActionImage:`${i}-action-image`,itemTemporaryIcon:`${i}-temporary-icon`,itemCatalogIcon:`${i}-catalog-icon`,statusIndicator:`${t}__status-indicator`,publishing:`${t}__publishing`,updating:`${t}__updating`,editing:`${t}__editing`,connectionStatus:`${t}__connection-status`,connectionStatusConnected:`${t}__connection-status--connected`,visibleToggle:`${t}__visible-toggle`,visibleIcon:`${t}__visible-icon`,section:`${t}__section`};export{e as css};
|
|
5
|
+
const t="esri-basemap-layer-list",i=`${t}__item`,e={base:t,actionMenu:`${t}__action-menu`,actionGroup:`${t}__action-group`,filterNoResults:`${t}__filter-no-results`,item:i,itemActive:`${i}--active`,itemContent:`${i}-content`,itemContentBottom:`${i}-content-bottom`,itemMessage:`${i}-message`,itemInvisible:`${i}--invisible`,itemActionIcon:`${i}-action-icon`,itemActionImage:`${i}-action-image`,itemTemporaryIcon:`${i}-temporary-icon`,itemCatalogIcon:`${i}-catalog-icon`,statusIndicator:`${t}__status-indicator`,publishing:`${t}__publishing`,updating:`${t}__updating`,editing:`${t}__editing`,connectionStatus:`${t}__connection-status`,connectionStatusConnected:`${t}__connection-status--connected`,visibleToggle:`${t}__visible-toggle`,visibleIcon:`${t}__visible-icon`,section:`${t}__section`};export{e as css};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import{getActionIcon as a,getActionStyles as r}from"../support/actions/actionUtils.js";import c from"./Widget.js";import d from"./BasemapLayerList/BasemapLayerListViewModel.js";import m from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as p}from"./BasemapLayerList/css.js";import u from"./LayerList/ListItem.js";import{minFilterItems as h,getItem as g,getLayerType as f,getStatusIcon as b,sortLayersToIds as y,sortChildLayersToIds as _,listItemHasChildren as v,areChildrenHidden as I,canSortSublayers as L,getVisibilityIcon as w}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as E}from"./support/componentsUtils.js";import{globalCss as F}from"./support/globalCss.js";import{incrementHeadingLevel as C}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as T}from"./support/decorators/messageBundle.js";import{vmEvent as M}from"./support/decorators/vmEvent.js";import{tsx as A}from"./support/jsxFactory.js";const k=t.ofType(u),S=".*\\S+.*";let x=class extends(s(c)){constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusEditingFlowItem=!1,this._focusCatalogFlowItem=!1,this._catalogFlowItem=null,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterText="",this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.minFilterItems=h,this.selectedItems=new k,this.selectionMode="none",this.viewModel=new d,this.visibilityAppearance="default",this.visibleElements=new m,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=g(e);if(!l?.sortable)return!1;const n=g(t),a=f(t),r=g(i),c=f(i),d=!!a&&!!c&&a===c,m={selected:l,from:n,to:r},p=t.group,u=i.group,h=n?.layer?.type??"",b=r?.layer?.type??"",y=new Set(["map-image","catalog","knowledge-graph"]),_="sublayer";return p&&u&&"function"==typeof o?o.call(null,m):d&&!y.has(h)&&!y.has(b)&&l?.layer?.type!==_},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(p.item)));this._activeItem=g(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e;const n=s,a=i;if(n!==a)this._moveLayerFromChildList({toEl:a,fromEl:n,dragEl:o,newIndex:l});else{const e=Array.from(s.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(n,e)}}}normalizeCtorArgs(e){return null!=e?.editingEnabled&&null!=e.visibleElements?{...e,visibleElements:new m({...e.visibleElements,editTitleButton:e.editingEnabled})}:e}loadDependencies(){return E({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _baseFilterEnabled(){return this.viewModel.totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this.viewModel.totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get editingEnabled(){return i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled&&this.visibleElements.editTitleButton}set editingEnabled(e){i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.visibleElements.editTitleButton=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.editingEnabled?"single":"none"}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[F.hidden]:"loading"===e,[F.disabled]:"disabled"===e};return A("div",{class:this.classes(p.base,F.widget,F.panel,t)},this._renderItems())}_renderItemTooltip(e){return e?A("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:this._tooltipReferenceMap.get(e.layer.uid)},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}async _createCatalog(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:s,view:o,filterPlaceholder:l,baseListItemCreatedFunction:n,referenceListItemCreatedFunction:a,minFilterItems:r,selectionMode:c,visibilityAppearance:d}=this,m=this._catalogFlowItem?.layer;this._set("catalogLayerList",new t({headingLevel:i,view:o,filterPlaceholder:l,minFilterItems:r,selectionMode:c,listItemCreatedFunction:"base"===e?n:a,visibilityAppearance:d,...s,catalogLayer:m}))}_destroyCatalog(){this._catalogFlowItem=null,this._focusRootFlowItem=!0,this.catalogLayerList?.destroy(),this._set("catalogLayerList",null)}_renderCatalogFlowItem(){const{_catalogFlowItem:e,messages:t}=this;if(!e)return null;const i=this._getLayerTitle(e);return A("calcite-flow-item",{afterCreate:this._focusCatalogFlowItemNode,afterUpdate:this._focusCatalogFlowItemNode,bind:this,description:i,heading:t.catalogLayers,headingLevel:this.headingLevel,key:`flow-catalog-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),this._destroyCatalog()}},this.catalogLayerList?.render())}_focusCatalogFlowItemNode(e){this._focusCatalogFlowItem&&(this._focusCatalogFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return A("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),A("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderItemMessage(e){return e.error?A("div",{class:p.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},A("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},A("div",{slot:"message"},this.messages.layerError))):e.incompatible?A("div",{class:p.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},A("calcite-notice",{afterCreate:t=>this._setTooltipReference(t,e),afterRemoved:()=>this._removeTooltipReference(e),icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},A("div",{slot:"message"},this.messages.layerIncompatible))):null}_getLayerTitle(e){return e.title||this.messages.untitledLayer}_renderItem(e,t,i,s,o){const{_activeItem:l,_selectedDragItemLayerUid:n,selectionMode:a,selectedItems:r,messages:c,visibleElements:d}=this,m=this._getLayerTitle(e),u=e.visibleAtCurrentTimeExtent?e.visibleAtCurrentScale?m:`${m} (${c.layerInvisibleAtScale})`:`${m} (${c.layerInvisibleAtTime})`,h=this._filterActions(e.actionsSections),g=this._countActions(h),f="catalog"===e.parent?.layer?.type,b="catalog-footprint"===e.layer?.type,y="catalog-dynamic-group"===e.layer?.type,_=b?A("calcite-icon",{class:p.itemCatalogIcon,icon:"footprint",key:"footprint",scale:"s",slot:"content-start"}):null,v=d.catalogLayerList&&y?A("calcite-icon",{class:p.itemCatalogIcon,icon:"catalog-dataset",key:"catalog-dataset",scale:"s",slot:"content-start"}):null,I=y?A("calcite-action",{appearance:"transparent",icon:"chevron-right",iconFlipRtl:!0,onclick:()=>{this._catalogFlowItem=s,this._focusCatalogFlowItem=!0,this._createCatalog(t)},scale:"s",slot:"actions-end",text:m}):null;return A("calcite-list-item",{afterCreate:t=>this._focusSelectedDragEl(t,e),afterUpdate:t=>this._focusSelectedDragEl(t,e),class:this.classes(p.item,{[p.itemActive]:l===e}),"data-item":e,"data-layer-id":e.layer.id,dragDisabled:!e.sortable||i||f,dragSelected:e.layer.uid===n,id:e.layer.uid,key:`list-item-${e.layer.uid}`,label:m,metadata:{parentTitles:o,title:m},open:e.open,selected:"none"!==a&&r.includes(e),title:u,value:e.layer.uid,onCalciteListItemDragHandleChange:t=>this._handleCalciteListItemDragHandleChange(t,e),onCalciteListItemSelect:t=>this._handleCalciteListItemSelect(t,e,s),onCalciteListItemToggle:t=>this._handleCalciteListItemToggle(t,e)},_,v,A("div",{class:this.classes({[p.itemContent]:!0,[p.itemInvisible]:!e.visibleAtCurrentScale||!e.visibleAtCurrentTimeExtent}),slot:"content"},m),this._renderItemStatus(e,s),this._renderItemToggle(e,s),I,this._renderItemTemporaryIcon(e),this._renderChildList(e,t,o),this._renderItemMessage(e),this._renderPanel(e.panel),this._renderPanelAction(e.panel),g>1?this._renderActionsSections(e,h):1===g?this._renderAction({item:e,action:this._getSingleAction(h),textEnabled:!1}):null)}_renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:s,publishing:o,updating:l}=e,n=l&&!t,a=!!s;return A("calcite-icon",{class:this.classes({[p.statusIndicator]:!0,[p.publishing]:o,[p.updating]:n,[p.connectionStatus]:a,[p.connectionStatusConnected]:a&&"connected"===s}),icon:b({connectionStatus:s,publishing:o}),key:"layer-item-status",scale:"s",slot:"actions-end"})}_renderItemTemporaryIcon(e){return this.visibleElements.temporaryLayerIndicators&&"persistenceEnabled"in e.layer&&!e.layer.persistenceEnabled?A("calcite-icon",{class:p.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messages.temporary}):null}_renderItemToggle(e,t){const{messages:i,visibilityAppearance:s}=this,{visible:o}=e,l=t?.visibilityMode;if("inherited"===l)return null;const n=w({visible:o,exclusive:"exclusive"===l,visibilityAppearance:s}),a="checkbox"===s,r=i.layerVisibility;return A("calcite-action",{appearance:"transparent",class:p.visibleToggle,icon:a?n:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:a?"actions-start":"actions-end",text:r,title:r},a?null:A("calcite-icon",{class:this.classes({[p.visibleIcon]:"exclusive"!==l&&o}),icon:n,scale:"s"}))}_renderPanel(e){return!e?.open||e.disabled||e.flowEnabled?null:A("div",{class:p.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}_renderPanelAction(e){if(!e?.visible)return null;const{open:t,title:i,disabled:s}=e;return A("calcite-action",{active:t,appearance:"transparent",disabled:s,icon:a(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}_renderActionsSections(e,t){const i=this.messagesCommon.options;return A("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:this.messagesCommon.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:t=>e.actionsOpen=t.target.open},A("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),t.toArray().map(((t,i)=>this._renderActionSection(e,t,i))))}_renderActionSection(e,t,i){return A("calcite-action-group",{key:`action-section-${i}`},t.toArray().map((t=>this._renderAction({item:e,action:t,textEnabled:!0}))))}_renderFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const s="image"in e?e.image:void 0,o={[p.itemActionIcon]:!!t,[p.itemActionImage]:!!s};return t&&(o[t]=!0),s||t?A("span",{"aria-hidden":"true",class:this.classes(p.itemActionIcon,o),key:"icon",styles:r(s)}):null}_renderAction(e){const{item:t,action:i,textEnabled:s}=e;if(!i)return null;const{active:o,disabled:l,title:n,type:r,indicator:c}=i;return A("calcite-action",{active:"toggle"===r&&i.value,appearance:"transparent",disabled:l,icon:a(i),indicator:c,key:`action-${i.uid}`,loading:o,onclick:()=>this._triggerAction(t,i),scale:"s",slot:s?void 0:"actions-end",text:n??"",textEnabled:s,title:n??void 0},this._renderFallbackIcon(i))}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.layer.uid,e)}_removeTooltipReference(e){this._tooltipReferenceMap.delete(e.layer.uid)}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=g(i),l=g(e),n=g(t),a=j(t),r=j(e);a&&r&&this.viewModel.moveListItem({targetItem:o,fromParentItem:n,toParentItem:l,newIndex:s,from:a,to:r})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid){const i=j(e),s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;y(s,t)}else{const i=g(e);if(!i)return;_(i,t)}}_getSingleAction(e){return e.reduce((e=>e)).find((e=>e&&("button"===e.type||"toggle"===e.type)))}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.triggerAction(t,e))}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>g(e))).filter(Boolean);i.removeAll(),i.addMany(s)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_focusSelectedDragEl(e,t){this._selectedDragItemLayerUid===t.layer.uid&&requestAnimationFrame((()=>e?.setFocus()))}_handleCalciteListItemDragHandleChange(e,t){e.stopPropagation();const i=e.target.dragSelected;this._selectedDragItemLayerUid=i?t.layer.uid:null}_handleCalciteListItemSelect(e,t,i){g(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&(this._focusPanelFlowItem=!0)}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return A("div",{class:p.editing},A("calcite-label",null,e.basemapTitle,A("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:S,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return A("calcite-button",{appearance:"outline",bind:this,label:e,onclick:this._toggleEditingTitle,slot:"footer",title:e,width:"half"},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return A("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"half"},e.form.ok)}_renderEditingForm(){return this.editingTitle?A("form",{bind:this,onsubmit:this._formSubmit},A("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?A("calcite-action",{bind:this,icon:"pencil",onclick:this._toggleEditingTitle,slot:"header-actions-end",text:s,title:s}):null}_renderNoLayersInfoMessage(e){return A("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return A("div",{class:p.itemMessage},A("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_getFilteredItems(e){return e?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},messages:n,viewModel:a,referenceItems:r,baseItems:c}=this,d=this.visibleElements.referenceLayers?this._getFilteredItems(r):null,m=this.visibleElements.baseLayers?this._getFilteredItems(c):null,p=[A("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?a.basemapTitle??n.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(d),this._renderBaseSection(m,1===m?.length)),this._renderEditingForm(),this._renderPanelFlowItems(m),this._renderPanelFlowItems(d),this._renderCatalogFlowItem()];return t?[l?A("calcite-flow",{key:"root-flow"},p):p,this._renderItemTooltips(d),this._renderItemTooltips(m)]:null}_renderChildList(e,t,i=[]){const{_rootGroupUid:s,dragEnabled:o,viewModel:{listModeDisabled:l},selectionMode:n}=this,{children:a}=e,r="catalog-dynamic-group"!==e.layer?.type&&v(e),c=!(!l&&I(e.layer))&&!r&&o&&"group"===e.layer?.type;return r||c?A("calcite-list",{canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-basemap-layer-type":t,"data-item":e,"data-layer-type":s,dragEnabled:!!o&&(e.childrenSortable&&L(e)),group:`${s}-${e.layer.uid}`,key:`child-list-${e.layer.uid}`,selectionAppearance:"border",selectionMode:n},a?.filter((e=>!e.hidden)).toArray().map((s=>this._renderItem(s,t,!1,e,[...i,e.title])))):null}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:l,filterPlaceholder:n,baseFilterText:a,referenceFilterText:r,_baseFilterEnabled:c,_referenceFilterEnabled:d,_rootGroupUid:m}=this,u="reference"===t?s.noReferenceLayers:s.noBaseLayers,h="reference"===t?d:c;return A("calcite-block",{class:p.section,collapsible:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:C(this.headingLevel),key:`block-${t}`,open:!0},0===e?.length?this._renderNoLayersInfo(u,t):null,A("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-basemap-layer-type":t,"data-layer-type":m,dragEnabled:o,filterEnabled:h,filterPlaceholder:n,filterText:h?"reference"===t?r:a:"",group:m,key:`list-${t}`,label:s.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:l,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e,t,i))),e?.length&&h?A("div",{class:p.filterNoResults,slot:"filter-no-results"},A("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(u))):null))}_renderBaseSection(e,t){return this.visibleElements.baseLayers?this._renderList(e,"base",t):null}_renderReferenceSection(e){return this.visibleElements.referenceLayers?this._renderList(e,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function j(e){return e?.getAttribute("data-basemap-layer-type")}e([l()],x.prototype,"_activeItem",void 0),e([l()],x.prototype,"_tooltipReferenceMap",void 0),e([l()],x.prototype,"_focusRootFlowItem",void 0),e([l()],x.prototype,"_focusPanelFlowItem",void 0),e([l()],x.prototype,"_focusEditingFlowItem",void 0),e([l()],x.prototype,"_focusCatalogFlowItem",void 0),e([l()],x.prototype,"_catalogFlowItem",void 0),e([l()],x.prototype,"_baseFilterEnabled",null),e([l()],x.prototype,"_referenceFilterEnabled",null),e([l()],x.prototype,"basemapTitle",null),e([l({readOnly:!0})],x.prototype,"catalogLayerList",void 0),e([l()],x.prototype,"catalogOptions",void 0),e([l()],x.prototype,"collapsed",void 0),e([l()],x.prototype,"dragEnabled",void 0),e([l()],x.prototype,"editingTitle",void 0),e([l()],x.prototype,"filterPlaceholder",void 0),e([l()],x.prototype,"baseFilterText",void 0),e([l()],x.prototype,"referenceFilterText",void 0),e([l()],x.prototype,"listItemCanGiveFunction",void 0),e([l()],x.prototype,"listItemCanReceiveFunction",void 0),e([l()],x.prototype,"baseListItemCreatedFunction",null),e([l()],x.prototype,"editingEnabled",null),e([l()],x.prototype,"headingLevel",void 0),e([l()],x.prototype,"icon",null),e([l()],x.prototype,"label",null),e([l(),T("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],x.prototype,"messages",void 0),e([l(),T("esri/t9n/common")],x.prototype,"messagesCommon",void 0),e([l()],x.prototype,"minFilterItems",void 0),e([l()],x.prototype,"multipleSelectionEnabled",null),e([l()],x.prototype,"referenceListItemCreatedFunction",null),e([l({readOnly:!0})],x.prototype,"baseItems",null),e([l({readOnly:!0})],x.prototype,"referenceItems",null),e([l()],x.prototype,"selectedItems",void 0),e([l()],x.prototype,"selectionMode",void 0),e([l()],x.prototype,"view",null),e([M("trigger-action"),l({type:d})],x.prototype,"viewModel",void 0),e([l()],x.prototype,"visibilityAppearance",void 0),e([l({type:m,nonNullable:!0})],x.prototype,"visibleElements",void 0),x=e([n("esri.widgets.BasemapLayerList")],x);const B=x;export{B as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{deprecatedProperty as i}from"../core/deprecate.js";import{IdentifiableMixin as s}from"../core/Identifiable.js";import o from"../core/Logger.js";import{watch as l}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as a}from"../core/accessorSupport/decorators/subclass.js";import{getActionIcon as r,getActionStyles as c}from"../support/actions/actionUtils.js";import d from"./Widget.js";import m from"./BasemapLayerList/BasemapLayerListViewModel.js";import p from"./BasemapLayerList/BasemapLayerListVisibleElements.js";import{css as u}from"./BasemapLayerList/css.js";import h from"./LayerList/ListItem.js";import{minFilterItems as g,getItem as f,getLayerType as y,getStatusIcon as b,sortLayersToIds as _,sortChildLayersToIds as v,listItemHasChildren as I,areChildrenHidden as L,canSortSublayers as w,getVisibilityIcon as E}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as C}from"./support/componentsUtils.js";import{globalCss as F}from"./support/globalCss.js";import{incrementHeadingLevel as T}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as A}from"./support/decorators/vmEvent.js";import{tsx as k}from"./support/jsxFactory.js";const S=t.ofType(h),x=".*\\S+.*";let j=class extends(s(d)){constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new Map,this._editTitleInput=null,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusEditingFlowItem=!1,this._focusCatalogFlowItem=!1,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`basemap-${this.uid}`,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.editingTitle=!1,this.filterPlaceholder="",this.baseFilterText="",this.referenceFilterText="",this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.minFilterItems=g,this.openCatalogItem=null,this.selectedItems=new S,this.selectionMode="none",this.viewModel=new m,this.visibilityAppearance="default",this.visibleElements=new p,this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{const o="pull"===s?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=f(e);if(!l?.sortable)return!1;const n=f(t),a=y(t),r=f(i),c=y(i),d=!!a&&!!c&&a===c,m={selected:l,from:n,to:r},p=t.group,u=i.group,h=n?.layer?.type??"",g=r?.layer?.type??"",b=new Set(["map-image","catalog","knowledge-graph"]),_="sublayer";return p&&u&&"function"==typeof o?o.call(null,m):d&&!b.has(h)&&!b.has(g)&&l?.layer?.type!==_},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(u.item)));this._activeItem=f(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:s,dragEl:o,newIndex:l}=e;if(!s||!i||t?.newIndex===l&&t?.dragEl===o&&t?.toEl===i&&t?.fromEl===s)return;this._lastDragDetail=e;const n=s,a=i;if(n!==a)this._moveLayerFromChildList({toEl:a,fromEl:n,dragEl:o,newIndex:l});else{const e=Array.from(s.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(n,e)}}}initialize(){this.addHandles([l((()=>this.openCatalogItem),(e=>e?this._createCatalog():this._destroyCatalog()))])}normalizeCtorArgs(e){return null!=e?.editingEnabled&&null!=e.visibleElements?{...e,visibleElements:new p({...e.visibleElements,editTitleButton:e.editingEnabled})}:e}loadDependencies(){return C({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _totalBaseItems(){return this.viewModel.baseItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _totalReferenceItems(){return this.viewModel.referenceItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer.type)))).length}get _baseFilterEnabled(){return this._totalBaseItems>=this.minFilterItems&&this.visibleElements.filter}get _referenceFilterEnabled(){return this._totalReferenceItems>=this.minFilterItems&&this.visibleElements.filter}get basemapTitle(){return this.viewModel.basemapTitle}set basemapTitle(e){this.viewModel.basemapTitle=e}get baseListItemCreatedFunction(){return this.viewModel.baseListItemCreatedFunction}set baseListItemCreatedFunction(e){this.viewModel.baseListItemCreatedFunction=e}get editingEnabled(){return i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),"none"!==this.selectionMode&&this.dragEnabled&&this.visibleElements.editTitleButton}set editingEnabled(e){i(o.getLogger(this),"editingEnabled",{replacement:"selectionMode, dragEnabled, visibleElements.editTitleButton",version:"4.29",warnOnce:!0}),this.dragEnabled=e,this.visibleElements.editTitleButton=e,this.selectionMode=e?this.multipleSelectionEnabled?"multiple":"single":"none"}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get multipleSelectionEnabled(){return i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),"multiple"===this.selectionMode}set multipleSelectionEnabled(e){i(o.getLogger(this),"multipleSelectionEnabled",{replacement:"selectionMode",version:"4.29",warnOnce:!0}),this.selectionMode=e?"multiple":this.editingEnabled?"single":"none"}get referenceListItemCreatedFunction(){return this.viewModel.referenceListItemCreatedFunction}set referenceListItemCreatedFunction(e){this.viewModel.referenceListItemCreatedFunction=e}get baseItems(){return this.viewModel.baseItems}get referenceItems(){return this.viewModel.referenceItems}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const{state:e}=this.viewModel,t={[F.hidden]:"loading"===e,[F.disabled]:"disabled"===e};return k("div",{class:this.classes(u.base,F.widget,F.panel,t)},this._renderItems())}_renderItemTooltip(e){return e?k("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:this._tooltipReferenceMap.get(e.layer.uid)},this.messages.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}async _createCatalog(){this._destroyCatalog();const{default:e}=await import("./CatalogLayerList.js"),{headingLevel:t,catalogOptions:i,view:s,filterPlaceholder:o,baseListItemCreatedFunction:l,referenceListItemCreatedFunction:n,minFilterItems:a,selectionMode:r,visibilityAppearance:c,openCatalogItem:d,referenceItems:m}=this,p=d&&m.flatten((e=>e.children)).includes(d)?"reference":"base",u=this.openCatalogItem?.layer;this._set("catalogLayerList",new e({headingLevel:t,view:s,filterPlaceholder:o,minFilterItems:a,selectionMode:r,listItemCreatedFunction:"base"===p?l:n,visibilityAppearance:c,...i,catalogLayer:u}))}_destroyCatalog(){this.catalogLayerList?.destroy(),this._set("catalogLayerList",null)}_renderCatalogFlowItem(){const{openCatalogItem:e,messages:t}=this;if(!e)return null;const i=this._getLayerTitle(e);return k("calcite-flow-item",{afterCreate:this._focusCatalogFlowItemNode,afterUpdate:this._focusCatalogFlowItemNode,bind:this,description:i,heading:t.catalogLayers,headingLevel:this.headingLevel,key:`flow-catalog-${e.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),this.openCatalogItem=null,this._focusRootFlowItem=!0}},this.catalogLayerList?.render())}_focusCatalogFlowItemNode(e){this._focusCatalogFlowItem&&(this._focusCatalogFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return k("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),k("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusEditingFlowItemNode(e){this._focusEditingFlowItem&&(this._focusEditingFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderItemMessage(e){return e.error?k("div",{class:u.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},k("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},k("div",{slot:"message"},this.messages.layerError))):e.incompatible?k("div",{class:u.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},k("calcite-notice",{afterCreate:t=>this._setTooltipReference(t,e),afterRemoved:()=>this._removeTooltipReference(e),icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},k("div",{slot:"message"},this.messages.layerIncompatible))):null}_getLayerTitle(e){return e.title||this.messages.untitledLayer}_renderItem(e,t,i,s,o){const{_activeItem:l,_selectedDragItemLayerUid:n,selectionMode:a,selectedItems:r,messages:c,visibleElements:d}=this,m=this._getLayerTitle(e),p=e.visibleAtCurrentTimeExtent?e.visibleAtCurrentScale?m:`${m} (${c.layerInvisibleAtScale})`:`${m} (${c.layerInvisibleAtTime})`,h=this._filterActions(e.actionsSections),g=this._countActions(h),f="catalog"===e.parent?.layer?.type,y="catalog-footprint"===e.layer?.type,b="catalog-dynamic-group"===e.layer?.type,_=y?k("calcite-icon",{class:u.itemCatalogIcon,icon:"footprint",key:"footprint",scale:"s",slot:"content-start"}):null,v=d.catalogLayerList&&b?k("calcite-icon",{class:u.itemCatalogIcon,icon:"catalog-dataset",key:"catalog-dataset",scale:"s",slot:"content-start"}):null,I=b?k("calcite-action",{appearance:"transparent",icon:"chevron-right",iconFlipRtl:!0,onclick:()=>{this.openCatalogItem=s,this._focusCatalogFlowItem=!0},scale:"s",slot:"actions-end",text:m}):null;return k("calcite-list-item",{afterCreate:t=>this._focusSelectedDragEl(t,e),afterUpdate:t=>this._focusSelectedDragEl(t,e),class:this.classes(u.item,{[u.itemActive]:l===e}),"data-item":e,"data-layer-id":e.layer.id,dragDisabled:!e.sortable||i||f,dragSelected:e.layer.uid===n,id:e.layer.uid,key:`list-item-${e.layer.uid}`,label:m,metadata:{parentTitles:o,title:m},open:e.open,selected:"none"!==a&&r.includes(e),title:p,value:e.layer.uid,onCalciteListItemDragHandleChange:t=>this._handleCalciteListItemDragHandleChange(t,e),onCalciteListItemSelect:t=>this._handleCalciteListItemSelect(t,e,s),onCalciteListItemToggle:t=>this._handleCalciteListItemToggle(t,e)},_,v,k("div",{class:this.classes({[u.itemContent]:!0,[u.itemInvisible]:!e.visibleAtCurrentScale||!e.visibleAtCurrentTimeExtent}),slot:"content"},m),this._renderItemStatus(e,s),this._renderItemToggle(e,s),I,this._renderItemTemporaryIcon(e),this._renderChildList(e,t,o),this._renderItemMessage(e),this._renderPanel(e.panel),this._renderPanelAction(e.panel),g>1?this._renderActionsSections(e,h):1===g?this._renderAction({item:e,action:this._getSingleAction(h),textEnabled:!1}):null)}_renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:s,publishing:o,updating:l}=e,n=l&&!t,a=!!s;return k("calcite-icon",{class:this.classes({[u.statusIndicator]:!0,[u.publishing]:o,[u.updating]:n,[u.connectionStatus]:a,[u.connectionStatusConnected]:a&&"connected"===s}),icon:b({connectionStatus:s,publishing:o}),key:"layer-item-status",scale:"s",slot:"actions-end"})}_renderItemTemporaryIcon(e){return this.visibleElements.temporaryLayerIndicators&&"persistenceEnabled"in e.layer&&!e.layer.persistenceEnabled?k("calcite-icon",{class:u.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messages.temporary}):null}_renderItemToggle(e,t){const{messages:i,visibilityAppearance:s}=this,{visible:o}=e,l=t?.visibilityMode;if("inherited"===l)return null;const n=E({visible:o,exclusive:"exclusive"===l,visibilityAppearance:s}),a="checkbox"===s,r=i.layerVisibility;return k("calcite-action",{appearance:"transparent",class:u.visibleToggle,icon:a?n:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:a?"actions-start":"actions-end",text:r,title:r},a?null:k("calcite-icon",{class:this.classes({[u.visibleIcon]:"exclusive"!==l&&o}),icon:n,scale:"s"}))}_renderPanel(e){return!e?.open||e.disabled||e.flowEnabled?null:k("div",{class:u.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}_renderPanelAction(e){if(!e?.visible)return null;const{open:t,title:i,disabled:s}=e;return k("calcite-action",{active:t,appearance:"transparent",disabled:s,icon:r(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}_renderActionsSections(e,t){const i=this.messagesCommon.options;return k("calcite-action-menu",{appearance:"transparent",class:u.actionMenu,key:"item-action-menu",label:this.messagesCommon.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:t=>e.actionsOpen=t.target.open},k("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),t.toArray().map(((t,i)=>this._renderActionSection(e,t,i))))}_renderActionSection(e,t,i){return k("calcite-action-group",{class:u.actionGroup,key:`action-section-${i}`},t.toArray().map((t=>this._renderAction({item:e,action:t,textEnabled:!0}))))}_renderFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const s="image"in e?e.image:void 0,o={[u.itemActionIcon]:!!t,[u.itemActionImage]:!!s};return t&&(o[t]=!0),s||t?k("span",{"aria-hidden":"true",class:this.classes(u.itemActionIcon,o),key:"icon",styles:c(s)}):null}_renderAction(e){const{item:t,action:i,textEnabled:s}=e;if(!i)return null;const{active:o,disabled:l,title:n,type:a,indicator:c}=i;return k("calcite-action",{active:"toggle"===a&&i.value,appearance:"transparent",disabled:l,icon:r(i),indicator:c,key:`action-${i.uid}`,loading:o,onclick:()=>this._triggerAction(t,i),scale:"s",slot:s?void 0:"actions-end",text:n??"",textEnabled:s,title:n??void 0},this._renderFallbackIcon(i))}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.layer.uid,e)}_removeTooltipReference(e){this._tooltipReferenceMap.delete(e.layer.uid)}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:s}){const o=f(i),l=f(e),n=f(t),a=B(t),r=B(e);a&&r&&this.viewModel.moveListItem({targetItem:o,fromParentItem:n,toParentItem:l,newIndex:s,from:a,to:r})}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:s}=e;t.insertBefore(i,t.children[s])}_sortLayers(e,t){if(e)if(e.group===this._rootGroupUid){const i=B(e),s="base"===i?this.view?.map?.basemap?.baseLayers:"reference"===i?this.view?.map?.basemap?.referenceLayers:null;_(s,t)}else{const i=f(e);if(!i)return;v(i,t)}}_getSingleAction(e){return e.reduce((e=>e)).find((e=>e&&("button"===e.type||"toggle"===e.type)))}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.triggerAction(t,e))}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const s=e.target.selectedItems.map((e=>f(e))).filter(Boolean);i.removeAll(),i.addMany(s)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_focusSelectedDragEl(e,t){this._selectedDragItemLayerUid===t.layer.uid&&requestAnimationFrame((()=>e?.setFocus()))}_handleCalciteListItemDragHandleChange(e,t){e.stopPropagation();const i=e.target.dragSelected;this._selectedDragItemLayerUid=i?t.layer.uid:null}_handleCalciteListItemSelect(e,t,i){f(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&(this._focusPanelFlowItem=!0)}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}_renderEditingInput(){const{messages:e}=this,{basemapTitle:t}=this.viewModel;return k("div",{class:u.editing},k("calcite-label",null,e.basemapTitle,k("calcite-input",{afterCreate:e=>this._editTitleInput=e,label:e.basemapTitle,name:"basemaptitle",pattern:x,placeholder:e.basemapTitle,required:!0,title:e.basemapTitle,type:"text",value:t??void 0})))}_renderCancelButton(){const{messagesCommon:{cancel:e}}=this;return k("calcite-button",{appearance:"outline",bind:this,label:e,onclick:this._toggleEditingTitle,slot:"footer",title:e,width:"half"},e)}_renderSubmitButton(){const{messagesCommon:e}=this;return k("calcite-button",{label:e.form.submit,slot:"footer",title:e.form.submit,type:"submit",width:"half"},e.form.ok)}_renderEditingForm(){return this.editingTitle?k("form",{bind:this,onsubmit:this._formSubmit},k("calcite-flow-item",{afterCreate:this._focusEditingFlowItemNode,afterUpdate:this._focusEditingFlowItemNode,bind:this,heading:this.visibleElements.heading?this.messages.basemapTitle:void 0,headingLevel:this.headingLevel,onCalciteFlowItemBack:e=>{e.preventDefault(),this._toggleEditingTitle()}},this._renderEditingInput(),this._renderCancelButton(),this._renderSubmitButton())):null}_renderEditTitleButton(){const{editingTitle:e,visibleElements:t,messagesCommon:i}=this,s=i.edit;return t.editTitleButton&&!e?k("calcite-action",{bind:this,icon:"pencil",onclick:this._toggleEditingTitle,slot:"header-actions-end",text:s,title:s}):null}_renderNoLayersInfoMessage(e){return k("div",{slot:"message"},e)}_renderNoLayersInfo(e,t){return k("div",{class:u.itemMessage},k("calcite-notice",{icon:"information",key:t,kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(e)))}_getFilteredItems(e){return e?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}_renderItems(){const{collapsed:e,visible:t,visibleElements:{closeButton:i,collapseButton:s,heading:o,flow:l},messages:n,viewModel:a,referenceItems:r,baseItems:c}=this,d=this.visibleElements.referenceLayers?this._getFilteredItems(r):null,m=this.visibleElements.baseLayers?this._getFilteredItems(c):null,p=[k("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:i,closed:!t,collapsed:e,collapsible:s,heading:o?a.basemapTitle??n.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},this._renderEditTitleButton(),this._renderReferenceSection(d),this._renderBaseSection(m,1===m?.length)),this._renderEditingForm(),this._renderPanelFlowItems(m),this._renderPanelFlowItems(d),this._renderCatalogFlowItem()];return t?[l?k("calcite-flow",{key:"root-flow"},p):p,this._renderItemTooltips(d),this._renderItemTooltips(m)]:null}_renderChildList(e,t,i=[]){const{_rootGroupUid:s,dragEnabled:o,viewModel:{listModeDisabled:l},selectionMode:n}=this,{children:a}=e,r="catalog-dynamic-group"!==e.layer?.type&&I(e),c=!(!l&&L(e.layer))&&!r&&o&&"group"===e.layer?.type;return r||c?k("calcite-list",{canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-basemap-layer-type":t,"data-item":e,"data-layer-type":s,dragEnabled:!!o&&(e.childrenSortable&&w(e)),group:`${s}-${e.layer.uid}`,key:`child-list-${e.layer.uid}`,selectionAppearance:"border",selectionMode:n},a?.filter((e=>!e.hidden)).toArray().map((s=>this._renderItem(s,t,!1,e,[...i,e.title])))):null}_renderList(e,t,i){const{messages:s,dragEnabled:o,selectionMode:l,filterPlaceholder:n,baseFilterText:a,referenceFilterText:r,_baseFilterEnabled:c,_referenceFilterEnabled:d,_rootGroupUid:m}=this,p="reference"===t?s.noReferenceLayers:s.noBaseLayers,h="reference"===t?d:c;return k("calcite-block",{class:u.section,collapsible:!0,heading:"reference"===t?s.referenceHeading:s.baseHeading,headingLevel:T(this.headingLevel),key:`block-${t}`,open:!0},0===e?.length?this._renderNoLayersInfo(p,t):null,k("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-basemap-layer-type":t,"data-layer-type":m,dragEnabled:o,filterEnabled:h,filterPlaceholder:n,filterText:h?"reference"===t?r:a:"",group:m,key:`list-${t}`,label:s.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:l,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this["reference"===t?"referenceFilterText":"baseFilterText"]=e.target?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},e?.toArray().map((e=>this._renderItem(e,t,i))),e?.length&&h?k("div",{class:u.filterNoResults,slot:"filter-no-results"},k("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoLayersInfoMessage(p))):null))}_renderBaseSection(e,t){return this.visibleElements.baseLayers?this._renderList(e,"base",t):null}_renderReferenceSection(e){return this.visibleElements.referenceLayers?this._renderList(e,"reference",!1):null}_toggleEditingTitle(){const{editingTitle:e}=this,t=!e;this.editingTitle=t,t?this._focusEditingFlowItem=!0:this._focusRootFlowItem=!0}_formSubmit(e){e.preventDefault();const t=this._editTitleInput?.value;t?.trim()&&(this.basemapTitle=t),this._toggleEditingTitle()}};function B(e){return e?.getAttribute("data-basemap-layer-type")}e([n()],j.prototype,"_activeItem",void 0),e([n()],j.prototype,"_tooltipReferenceMap",void 0),e([n()],j.prototype,"_focusRootFlowItem",void 0),e([n()],j.prototype,"_focusPanelFlowItem",void 0),e([n()],j.prototype,"_focusEditingFlowItem",void 0),e([n()],j.prototype,"_focusCatalogFlowItem",void 0),e([n()],j.prototype,"_totalBaseItems",null),e([n()],j.prototype,"_totalReferenceItems",null),e([n()],j.prototype,"_baseFilterEnabled",null),e([n()],j.prototype,"_referenceFilterEnabled",null),e([n()],j.prototype,"basemapTitle",null),e([n({readOnly:!0})],j.prototype,"catalogLayerList",void 0),e([n()],j.prototype,"catalogOptions",void 0),e([n()],j.prototype,"collapsed",void 0),e([n()],j.prototype,"dragEnabled",void 0),e([n()],j.prototype,"editingTitle",void 0),e([n()],j.prototype,"filterPlaceholder",void 0),e([n()],j.prototype,"baseFilterText",void 0),e([n()],j.prototype,"referenceFilterText",void 0),e([n()],j.prototype,"listItemCanGiveFunction",void 0),e([n()],j.prototype,"listItemCanReceiveFunction",void 0),e([n()],j.prototype,"baseListItemCreatedFunction",null),e([n()],j.prototype,"editingEnabled",null),e([n()],j.prototype,"headingLevel",void 0),e([n()],j.prototype,"icon",null),e([n()],j.prototype,"label",null),e([n(),M("esri/widgets/BasemapLayerList/t9n/BasemapLayerList")],j.prototype,"messages",void 0),e([n(),M("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([n()],j.prototype,"minFilterItems",void 0),e([n()],j.prototype,"multipleSelectionEnabled",null),e([n()],j.prototype,"referenceListItemCreatedFunction",null),e([n({readOnly:!0})],j.prototype,"baseItems",null),e([n()],j.prototype,"openCatalogItem",void 0),e([n({readOnly:!0})],j.prototype,"referenceItems",null),e([n()],j.prototype,"selectedItems",void 0),e([n()],j.prototype,"selectionMode",void 0),e([n()],j.prototype,"view",null),e([A("trigger-action"),n({type:m})],j.prototype,"viewModel",void 0),e([n()],j.prototype,"visibilityAppearance",void 0),e([n({type:p,nonNullable:!0})],j.prototype,"visibleElements",void 0),j=e([a("esri.widgets.BasemapLayerList")],j);const P=j;export{P as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const t="esri-catalog-layer-list",i=`${t}__item`,e={base:t,filterNoResults:`${t}__filter-no-results`,item:i,itemActive:`${i}--active`,itemContent:`${i}-content`,itemContentBottom:`${i}-content-bottom`,itemMessage:`${i}-message`,itemInvisible:`${i}--invisible`,itemActionIcon:`${i}-action-icon`,itemActionImage:`${i}-action-image`,itemTemporaryIcon:`${i}-temporary-icon`,itemTableIcon:`${i}-table-icon`,statusIndicator:`${t}__status-indicator`,publishing:`${t}__publishing`,updating:`${t}__updating`,connectionStatus:`${t}__connection-status`,connectionStatusConnected:`${t}__connection-status--connected`,visibleToggle:`${t}__visible-toggle`,visibleIcon:`${t}__visible-icon`};export{e as css};
|
|
5
|
+
const t="esri-catalog-layer-list",i=`${t}__item`,e={base:t,actionMenu:`${t}__action-menu`,actionGroup:`${t}__action-group`,filterNoResults:`${t}__filter-no-results`,item:i,itemActive:`${i}--active`,itemContent:`${i}-content`,itemContentBottom:`${i}-content-bottom`,itemMessage:`${i}-message`,itemInvisible:`${i}--invisible`,itemActionIcon:`${i}-action-icon`,itemActionImage:`${i}-action-image`,itemTemporaryIcon:`${i}-temporary-icon`,itemTableIcon:`${i}-table-icon`,statusIndicator:`${t}__status-indicator`,publishing:`${t}__publishing`,updating:`${t}__updating`,connectionStatus:`${t}__connection-status`,connectionStatusConnected:`${t}__connection-status--connected`,visibleToggle:`${t}__visible-toggle`,visibleIcon:`${t}__visible-icon`};export{e as css};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{IdentifiableMixin as i}from"../core/Identifiable.js";import o from"../core/ReactiveMap.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{getActionIcon as n,getActionStyles as r}from"../support/actions/actionUtils.js";import a from"./Widget.js";import c from"./CatalogLayerList/CatalogLayerListViewModel.js";import d from"./CatalogLayerList/CatalogLayerListVisibleElements.js";import{css as m}from"./CatalogLayerList/css.js";import p from"./LayerList/ListItem.js";import{minFilterItems as u,getItem as h,listItemHasChildren as g,areChildrenHidden as y,getStatusIcon as v,getVisibilityIcon as f}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{globalCss as I}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{vmEvent as L}from"./support/decorators/vmEvent.js";import{tsx as w}from"./support/jsxFactory.js";const A=t.ofType(p);let C=class extends(i(a)){constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new o,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._rootGroupUid=`operational-${this.uid}`,this.collapsed=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.messages=null,this.messagesLayerList=null,this.messagesCommon=null,this.minFilterItems=u,this.selectedItems=new A,this.selectionMode="none",this.viewModel=new c,this.visibilityAppearance="default",this.visibleElements=new d,this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(m.item)));this._activeItem=h(t)}}loadDependencies(){return _({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get catalogItems(){return this.viewModel.catalogItems}set catalogItems(e){this.viewModel.catalogItems=e}get catalogLayer(){return this.viewModel.catalogLayer}set catalogLayer(e){this.viewModel.catalogLayer=e}get icon(){return"catalog-dataset"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[I.hidden]:"loading"===e,[I.disabled]:"disabled"===e},i=this.catalogItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)));return w("div",{class:this.classes(m.base,I.widget,I.panel,t)},i?.length?[this._renderItemTooltips(i),this._renderItems(i)]:this._renderNoItems())}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messagesLayerList:i}=this;return e?w("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return w("div",{slot:"message"},this.messagesLayerList.noItemsToDisplay)}_renderNoItems(){return w("div",{class:m.itemMessage,key:"esri-layer-list__no-items"},w("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return w("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),w("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderItems(e){const{visible:t,collapsed:i,_filterEnabled:o,_rootGroupUid:s,visibleElements:{closeButton:l,collapseButton:n,heading:r,flow:a},selectionMode:c,filterText:d,filterPlaceholder:p,messages:u}=this,h=[w("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!t,collapsed:i,collapsible:n,heading:r?u.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},w("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},"data-layer-type":s,filterEnabled:o,filterPlaceholder:p,filterText:o?d:"",group:s,key:"root-list",label:u.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:c,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListFilter:e=>this.filterText=e.target?.filterText??""},e?.toArray().map((e=>this._renderItem(e))),e?.length&&o?w("div",{class:m.filterNoResults,slot:"filter-no-results"},w("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(e)];return t?a?w("calcite-flow",{key:"root-flow"},h):h:null}_renderChildList(e,t=[]){const{_rootGroupUid:i,viewModel:{listModeDisabled:o},selectionMode:s}=this,{children:l}=e,n=g(e),r=!(!o&&y(e.layer))&&!n&&"group"===e.layer?.type;return n||r?w("calcite-list",{"data-item":e,"data-layer-type":i,group:`${i}-${e.layer.uid}`,key:`child-list-${e.layer.uid}`,selectionAppearance:"border",selectionMode:s},l?.filter((e=>!e.hidden)).toArray().map((i=>this._renderItem(i,e,[...t,e.title])))):null}_renderItemMessage(e){return e.error?w("div",{class:m.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},w("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},w("div",{slot:"message"},this.messagesLayerList.layerError))):e.incompatible?w("div",{class:m.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},w("calcite-notice",{afterCreate:t=>this._setTooltipReference(t,e),afterRemoved:()=>this._removeTooltipReference(e),bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},w("div",{slot:"message"},this.messagesLayerList.layerIncompatible))):null}_getLayerTitle(e){return e.title||this.messagesLayerList.untitledLayer}_renderItem(e,t,i){const{_activeItem:o,selectionMode:s,selectedItems:l,messagesLayerList:n}=this,r=this._getLayerTitle(e),a=e.visibleAtCurrentTimeExtent?e.visibleAtCurrentScale?r:`${r} (${n.layerInvisibleAtScale})`:`${r} (${n.layerInvisibleAtTime})`,c=this._filterActions(e.actionsSections),d=this._countActions(c);return w("calcite-list-item",{class:this.classes(m.item,{[m.itemActive]:o===e}),"data-item":e,"data-layer-id":e.layer.id,id:e.layer.uid,key:`list-item-${e.layer.uid}`,label:r,metadata:{parentTitles:i,title:r},open:e.open,selected:"none"!==s&&l.includes(e),title:a,value:e.layer.uid,onCalciteListItemSelect:i=>this._handleCalciteListItemSelect(i,e,t),onCalciteListItemToggle:t=>this._handleCalciteListItemToggle(t,e)},w("div",{class:this.classes({[m.itemContent]:!0,[m.itemInvisible]:!e.visibleAtCurrentScale||!e.visibleAtCurrentTimeExtent}),slot:"content"},r),this._renderItemStatus(e,t),this._renderItemToggle(e,t),this._renderItemTemporaryIcon(e),this._renderChildList(e,i),this._renderItemMessage(e),this._renderPanel(e.panel),this._renderPanelAction(e.panel),d>1?this._renderActionsSections(e,c):1===d?this._renderAction({item:e,action:this._getSingleAction(c),textEnabled:!1}):null)}_renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:o,publishing:s,updating:l}=e,n=l&&!t,r=!!o;return w("calcite-icon",{class:this.classes({[m.statusIndicator]:!0,[m.publishing]:s,[m.updating]:n,[m.connectionStatus]:r,[m.connectionStatusConnected]:r&&"connected"===o}),icon:v({connectionStatus:o,publishing:s}),key:"layer-item-status",scale:"s",slot:"actions-end"})}_renderItemTemporaryIcon(e){return this.visibleElements.temporaryLayerIndicators&&"persistenceEnabled"in e.layer&&!e.layer.persistenceEnabled?w("calcite-icon",{class:m.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messagesLayerList.temporary}):null}_renderItemToggle(e,t){const{messagesLayerList:i,visibilityAppearance:o}=this,{visible:s}=e,l=t?.visibilityMode;if("inherited"===l)return null;const n=f({visible:s,exclusive:"exclusive"===l,visibilityAppearance:o}),r="checkbox"===o,a=i.layerVisibility;return w("calcite-action",{appearance:"transparent",class:m.visibleToggle,icon:r?n:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:a,title:a},r?null:w("calcite-icon",{class:this.classes({[m.visibleIcon]:"exclusive"!==l&&s}),icon:n,scale:"s"}))}_renderPanel(e){return!e?.open||e.disabled||e.flowEnabled?null:w("div",{class:m.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}_renderPanelAction(e){if(!e?.visible)return null;const{open:t,title:i,disabled:o}=e;return w("calcite-action",{active:t,appearance:"transparent",disabled:o,icon:n(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}_renderActionsSections(e,t){const i=this.messagesCommon.options;return w("calcite-action-menu",{appearance:"transparent",key:"item-action-menu",label:this.messagesCommon.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:t=>e.actionsOpen=t.target.open},w("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),t.toArray().map(((t,i)=>this._renderActionSection(e,t,i))))}_renderActionSection(e,t,i){return w("calcite-action-group",{key:`action-section-${i}`},t.toArray().map((t=>this._renderAction({item:e,action:t,textEnabled:!0}))))}_renderFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const o="image"in e?e.image:void 0,s={[m.itemActionIcon]:!!t,[m.itemActionImage]:!!o};return t&&(s[t]=!0),o||t?w("span",{"aria-hidden":"true",class:this.classes(m.itemActionIcon,s),key:"icon",styles:r(o)}):null}_renderAction(e){const{item:t,action:i,textEnabled:o}=e;if(!i)return null;const{active:s,disabled:l,title:r,type:a,indicator:c}=i;return w("calcite-action",{active:"toggle"===a&&i.value,appearance:"transparent",disabled:l,icon:n(i),indicator:c,key:`action-${i.uid}`,loading:s,onclick:()=>this._triggerAction(t,i),scale:"s",slot:o?void 0:"actions-end",text:r??"",textEnabled:o,title:r??void 0},this._renderFallbackIcon(i))}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.layer.uid,e)}_removeTooltipReference(e){this._tooltipReferenceMap.delete(e.layer.uid)}_getSingleAction(e){return e.reduce((e=>e)).find((e=>e&&("button"===e.type||"toggle"===e.type)))}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.triggerAction(t,e))}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>h(e))).filter(Boolean);i.removeAll(),i.addMany(o)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_handleCalciteListItemSelect(e,t,i){h(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&(this._focusPanelFlowItem=!0)}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}};e([s()],C.prototype,"_activeItem",void 0),e([s()],C.prototype,"_tooltipReferenceMap",void 0),e([s()],C.prototype,"_focusRootFlowItem",void 0),e([s()],C.prototype,"_focusPanelFlowItem",void 0),e([s()],C.prototype,"_filterEnabled",null),e([s()],C.prototype,"catalogItems",null),e([s()],C.prototype,"catalogLayer",null),e([s()],C.prototype,"collapsed",void 0),e([s()],C.prototype,"filterPlaceholder",void 0),e([s()],C.prototype,"filterText",void 0),e([s()],C.prototype,"headingLevel",void 0),e([s()],C.prototype,"icon",null),e([s()],C.prototype,"label",null),e([s()],C.prototype,"listItemCreatedFunction",null),e([s(),b("esri/widgets/CatalogLayerList/t9n/CatalogLayerList")],C.prototype,"messages",void 0),e([s(),b("esri/widgets/LayerList/t9n/LayerList")],C.prototype,"messagesLayerList",void 0),e([s(),b("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([s()],C.prototype,"minFilterItems",void 0),e([s()],C.prototype,"selectedItems",void 0),e([s()],C.prototype,"selectionMode",void 0),e([s()],C.prototype,"view",null),e([L("trigger-action"),s({type:c})],C.prototype,"viewModel",void 0),e([s()],C.prototype,"visibilityAppearance",void 0),e([s({type:d,nonNullable:!0})],C.prototype,"visibleElements",void 0),C=e([l("esri.widgets.CatalogLayerList")],C);const M=C;export{M as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import{IdentifiableMixin as i}from"../core/Identifiable.js";import o from"../core/ReactiveMap.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as l}from"../core/accessorSupport/decorators/subclass.js";import{getActionIcon as n,getActionStyles as r}from"../support/actions/actionUtils.js";import a from"./Widget.js";import c from"./CatalogLayerList/CatalogLayerListViewModel.js";import d from"./CatalogLayerList/CatalogLayerListVisibleElements.js";import{css as m}from"./CatalogLayerList/css.js";import p from"./LayerList/ListItem.js";import{minFilterItems as u,getItem as h,listItemHasChildren as g,areChildrenHidden as y,getStatusIcon as v,getVisibilityIcon as f}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as _}from"./support/componentsUtils.js";import{globalCss as I}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{vmEvent as L}from"./support/decorators/vmEvent.js";import{tsx as w}from"./support/jsxFactory.js";const A=t.ofType(p);let C=class extends(i(a)){constructor(e,t){super(e,t),this._activeItem=null,this._tooltipReferenceMap=new o,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._rootGroupUid=`operational-${this.uid}`,this.collapsed=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.messages=null,this.messagesLayerList=null,this.messagesCommon=null,this.minFilterItems=u,this.selectedItems=new A,this.selectionMode="none",this.viewModel=new c,this.visibilityAppearance="default",this.visibleElements=new d,this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(m.item)));this._activeItem=h(t)}}loadDependencies(){return _({action:()=>import("@esri/calcite-components/dist/components/calcite-action.js"),"action-group":()=>import("@esri/calcite-components/dist/components/calcite-action-group.js"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow.js"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip.js")})}destroy(){this._tooltipReferenceMap.clear()}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.visibleElements.filter}get catalogItems(){return this.viewModel.catalogItems}set catalogItems(e){this.viewModel.catalogItems=e}get catalogLayer(){return this.viewModel.catalogLayer}set catalogLayer(e){this.viewModel.catalogLayer=e}get icon(){return"catalog-dataset"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[I.hidden]:"loading"===e,[I.disabled]:"disabled"===e},i=this.catalogItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)));return w("div",{class:this.classes(m.base,I.widget,I.panel,t)},i?.length?[this._renderItemTooltips(i),this._renderItems(i)]:this._renderNoItems())}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messagesLayerList:i}=this;return e?w("calcite-tooltip",{key:`tooltip-${e.layer.uid}`,referenceElement:t.get(e.layer.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(e){return e?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return w("div",{slot:"message"},this.messagesLayerList.noItemsToDisplay)}_renderNoItems(){return w("div",{class:m.itemMessage,key:"esri-layer-list__no-items"},w("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}_renderPanelFlowItems(e){return e?e.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)).toArray().map((({title:e,panel:t})=>{const i=()=>this._handlePanelFlowItemBack(t);return w("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:e,heading:t.title,headingLevel:this.headingLevel,key:`flow-panel-${t.uid}`,onCalciteFlowItemBack:e=>{e.preventDefault(),i()}},t.render(),w("calcite-button",{appearance:"transparent",onclick:i,slot:"footer-actions",width:"full"},this.messagesCommon.back))})):[]}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,requestAnimationFrame((()=>e?.setFocus())))}_renderItems(e){const{visible:t,collapsed:i,_filterEnabled:o,_rootGroupUid:s,visibleElements:{closeButton:l,collapseButton:n,heading:r,flow:a},selectionMode:c,filterText:d,filterPlaceholder:p,messages:u}=this,h=[w("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:l,closed:!t,collapsed:i,collapsible:n,heading:r?u.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",onCalciteFlowItemClose:()=>this.visible=!1},w("calcite-list",{afterCreate:e=>{e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},"data-layer-type":s,filterEnabled:o,filterPlaceholder:p,filterText:o?d:"",group:s,key:"root-list",label:u.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:c,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListFilter:e=>this.filterText=e.target?.filterText??""},e?.toArray().map((e=>this._renderItem(e))),e?.length&&o?w("div",{class:m.filterNoResults,slot:"filter-no-results"},w("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(e)];return t?a?w("calcite-flow",{key:"root-flow"},h):h:null}_renderChildList(e,t=[]){const{_rootGroupUid:i,viewModel:{listModeDisabled:o},selectionMode:s}=this,{children:l}=e,n=g(e),r=!(!o&&y(e.layer))&&!n&&"group"===e.layer?.type;return n||r?w("calcite-list",{"data-item":e,"data-layer-type":i,group:`${i}-${e.layer.uid}`,key:`child-list-${e.layer.uid}`,selectionAppearance:"border",selectionMode:s},l?.filter((e=>!e.hidden)).toArray().map((i=>this._renderItem(i,e,[...t,e.title])))):null}_renderItemMessage(e){return e.error?w("div",{class:m.itemMessage,key:"esri-layer-list__error",slot:"content-bottom"},w("calcite-notice",{icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",width:"full"},w("div",{slot:"message"},this.messagesLayerList.layerError))):e.incompatible?w("div",{class:m.itemMessage,key:"esri-layer-list__incompatible",slot:"content-bottom"},w("calcite-notice",{afterCreate:t=>this._setTooltipReference(t,e),afterRemoved:()=>this._removeTooltipReference(e),bind:this,icon:"exclamation-mark-triangle",kind:"warning",open:!0,scale:"s",tabIndex:0,width:"full"},w("div",{slot:"message"},this.messagesLayerList.layerIncompatible))):null}_getLayerTitle(e){return e.title||this.messagesLayerList.untitledLayer}_renderItem(e,t,i){const{_activeItem:o,selectionMode:s,selectedItems:l,messagesLayerList:n}=this,r=this._getLayerTitle(e),a=e.visibleAtCurrentTimeExtent?e.visibleAtCurrentScale?r:`${r} (${n.layerInvisibleAtScale})`:`${r} (${n.layerInvisibleAtTime})`,c=this._filterActions(e.actionsSections),d=this._countActions(c);return w("calcite-list-item",{class:this.classes(m.item,{[m.itemActive]:o===e}),"data-item":e,"data-layer-id":e.layer.id,id:e.layer.uid,key:`list-item-${e.layer.uid}`,label:r,metadata:{parentTitles:i,title:r},open:e.open,selected:"none"!==s&&l.includes(e),title:a,value:e.layer.uid,onCalciteListItemSelect:i=>this._handleCalciteListItemSelect(i,e,t),onCalciteListItemToggle:t=>this._handleCalciteListItemToggle(t,e)},w("div",{class:this.classes({[m.itemContent]:!0,[m.itemInvisible]:!e.visibleAtCurrentScale||!e.visibleAtCurrentTimeExtent}),slot:"content"},r),this._renderItemStatus(e,t),this._renderItemToggle(e,t),this._renderItemTemporaryIcon(e),this._renderChildList(e,i),this._renderItemMessage(e),this._renderPanel(e.panel),this._renderPanelAction(e.panel),d>1?this._renderActionsSections(e,c):1===d?this._renderAction({item:e,action:this._getSingleAction(c),textEnabled:!1}):null)}_renderItemStatus(e,t){const{visibleElements:i}=this;if(!i.statusIndicators)return null;const{connectionStatus:o,publishing:s,updating:l}=e,n=l&&!t,r=!!o;return w("calcite-icon",{class:this.classes({[m.statusIndicator]:!0,[m.publishing]:s,[m.updating]:n,[m.connectionStatus]:r,[m.connectionStatusConnected]:r&&"connected"===o}),icon:v({connectionStatus:o,publishing:s}),key:"layer-item-status",scale:"s",slot:"actions-end"})}_renderItemTemporaryIcon(e){return this.visibleElements.temporaryLayerIndicators&&"persistenceEnabled"in e.layer&&!e.layer.persistenceEnabled?w("calcite-icon",{class:m.itemTemporaryIcon,icon:"temporary",key:"temporary-icon",scale:"s",slot:"actions-start",title:this.messagesLayerList.temporary}):null}_renderItemToggle(e,t){const{messagesLayerList:i,visibilityAppearance:o}=this,{visible:s}=e,l=t?.visibilityMode;if("inherited"===l)return null;const n=f({visible:s,exclusive:"exclusive"===l,visibilityAppearance:o}),r="checkbox"===o,a=i.layerVisibility;return w("calcite-action",{appearance:"transparent",class:m.visibleToggle,icon:r?n:void 0,key:"visibility-toggle",onclick:()=>this._toggleVisibility(e,t),scale:"s",slot:r?"actions-start":"actions-end",text:a,title:a},r?null:w("calcite-icon",{class:this.classes({[m.visibleIcon]:"exclusive"!==l&&s}),icon:n,scale:"s"}))}_renderPanel(e){return!e?.open||e.disabled||e.flowEnabled?null:w("div",{class:m.itemContentBottom,key:`content-panel-${e.uid}`,slot:"content-bottom"},e.render())}_renderPanelAction(e){if(!e?.visible)return null;const{open:t,title:i,disabled:o}=e;return w("calcite-action",{active:t,appearance:"transparent",disabled:o,icon:n(e),key:`action-${e.uid}`,onclick:()=>this._togglePanel(e),scale:"s",slot:"actions-end",text:i??"",title:i??void 0},this._renderFallbackIcon(e))}_renderActionsSections(e,t){const i=this.messagesCommon.options;return w("calcite-action-menu",{appearance:"transparent",class:m.actionMenu,key:"item-action-menu",label:this.messagesCommon.menu,open:e.actionsOpen,overlayPositioning:"fixed",placement:"bottom-end",scale:"s",slot:"actions-end",onCalciteActionMenuOpen:t=>e.actionsOpen=t.target.open},w("calcite-action",{appearance:"transparent",icon:"ellipsis",scale:"s",slot:"trigger",text:i,title:i}),t.toArray().map(((t,i)=>this._renderActionSection(e,t,i))))}_renderActionSection(e,t,i){return w("calcite-action-group",{class:m.actionGroup,key:`action-section-${i}`},t.toArray().map((t=>this._renderAction({item:e,action:t,textEnabled:!0}))))}_renderFallbackIcon(e){const{className:t,icon:i}=e;if(i)return null;const o="image"in e?e.image:void 0,s={[m.itemActionIcon]:!!t,[m.itemActionImage]:!!o};return t&&(s[t]=!0),o||t?w("span",{"aria-hidden":"true",class:this.classes(m.itemActionIcon,s),key:"icon",styles:r(o)}):null}_renderAction(e){const{item:t,action:i,textEnabled:o}=e;if(!i)return null;const{active:s,disabled:l,title:r,type:a,indicator:c}=i;return w("calcite-action",{active:"toggle"===a&&i.value,appearance:"transparent",disabled:l,icon:n(i),indicator:c,key:`action-${i.uid}`,loading:s,onclick:()=>this._triggerAction(t,i),scale:"s",slot:o?void 0:"actions-end",text:r??"",textEnabled:o,title:r??void 0},this._renderFallbackIcon(i))}_setTooltipReference(e,t){this._tooltipReferenceMap.set(t.layer.uid,e)}_removeTooltipReference(e){this._tooltipReferenceMap.delete(e.layer.uid)}_getSingleAction(e){return e.reduce((e=>e)).find((e=>e&&("button"===e.type||"toggle"===e.type)))}_filterActions(e){return e.map((e=>e.filter((e=>e.visible))))}_countActions(e){return e.reduce(((e,t)=>e+t.length),0)}_triggerAction(e,t){t&&e&&("toggle"===t.type&&(t.value=!t.value),this.triggerAction(t,e))}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>h(e))).filter(Boolean);i.removeAll(),i.addMany(o)}_handleCalciteListItemToggle(e,t){e.stopPropagation(),t.open=e.target.open}_handleCalciteListItemSelect(e,t,i){h(e.target)===t&&"none"===this.selectionMode&&"inherited"!==i?.visibilityMode&&this._toggleVisibility(t,i)}_togglePanel(e){e.open=!e.open,e.open&&(this._focusPanelFlowItem=!0)}_toggleVisibility(e,t){if(!e)return;const i=t?.visibilityMode;"exclusive"===i&&e.visible||(e.visible=!e.visible)}};e([s()],C.prototype,"_activeItem",void 0),e([s()],C.prototype,"_tooltipReferenceMap",void 0),e([s()],C.prototype,"_focusRootFlowItem",void 0),e([s()],C.prototype,"_focusPanelFlowItem",void 0),e([s()],C.prototype,"_filterEnabled",null),e([s()],C.prototype,"catalogItems",null),e([s()],C.prototype,"catalogLayer",null),e([s()],C.prototype,"collapsed",void 0),e([s()],C.prototype,"filterPlaceholder",void 0),e([s()],C.prototype,"filterText",void 0),e([s()],C.prototype,"headingLevel",void 0),e([s()],C.prototype,"icon",null),e([s()],C.prototype,"label",null),e([s()],C.prototype,"listItemCreatedFunction",null),e([s(),b("esri/widgets/CatalogLayerList/t9n/CatalogLayerList")],C.prototype,"messages",void 0),e([s(),b("esri/widgets/LayerList/t9n/LayerList")],C.prototype,"messagesLayerList",void 0),e([s(),b("esri/t9n/common")],C.prototype,"messagesCommon",void 0),e([s()],C.prototype,"minFilterItems",void 0),e([s()],C.prototype,"selectedItems",void 0),e([s()],C.prototype,"selectionMode",void 0),e([s()],C.prototype,"view",null),e([L("trigger-action"),s({type:c})],C.prototype,"viewModel",void 0),e([s()],C.prototype,"visibilityAppearance",void 0),e([s({type:d,nonNullable:!0})],C.prototype,"visibleElements",void 0),C=e([l("esri.widgets.CatalogLayerList")],C);const M=C;export{M as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{convertDateFormatToIntlOptions as n,formatDate as r}from"../../../intl/date.js";import{formatNumber as i,convertNumberFormatToIntlOptions as o}from"../../../intl/number.js";import{isRasterPixelValueField as a,featureHasFields as l,isTimeOnlyField as u}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{formatAnyDate as f,isAnyDateField as c}from"../../../smartMapping/support/utils.js";import{loadArcade as d}from"../../../support/arcadeOnDemand.js";import{getTimeZoneFormattingOptions as p}from"../../../time/timeZoneUtils.js";const y="esri.widgets.Feature.support.featureUtils",m=()=>e.getLogger(y),g=/href=(""|'')/gi,h=/(\{([^{\r\n]+)\})/g,I=/'/g,b=/^\s*expression\//i,T=/(\n)/gi,w=/[\u00A0-\u9999<>&]/gim,F=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/gi,N=/^(?:mailto:|tel:)/,j="relationships/",Z=n("short-date-short-time");function E(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function v({type:e,value:t,event:n}){try{return"function"==typeof t?t(n):t}catch(r){return void m().error("error",`An error occurred when calling the "${e}" function`,{error:r,graphic:n.graphic,value:t})}}function x(e=""){if(e)return!N.test(e.trim().toLowerCase())}function A(e){return!!e&&b.test(e)}function C(e,t){if(!t||!A(t)||!e)return;const n=t.replace(b,"").toLowerCase();return e.find((({name:e})=>e.toLowerCase()===n))}function M(e,t){const n=C(t,e?.fieldName);return n?n.title||null:e?e.label||e.fieldName:null}function U(e,t){const n=t.get(e.toLowerCase());return`{${n?.fieldName||e}}`}function q(e){return e.replaceAll(g,"")}function L(e,t){const n=$(t,e);return n?n.name:e}function R(e,t){return e&&e.map((e=>L(e,t)))}function $(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function k(e){return`${e}`.trim()}function D({attributes:e,globalAttributes:t,layer:n,text:r,expressionAttributes:i,fieldInfoMap:o}){return r?z({formattedAttributes:t,template:Q(r,{...t,...i,...e},n),fieldInfoMap:o}):""}function z({formattedAttributes:e,template:n,fieldInfoMap:r}){return k(q(t(t(n,(e=>U(e,r))),e)))}function O(e,t,n=!1){const r=t[e];if("string"==typeof r){const i="%27",o=(n?encodeURIComponent(r):r).replaceAll(I,i);t[e]=o}}function G(e,t=!1){const n={...e};return Object.keys(n).forEach((e=>O(e,n,t))),n}function S(e,n,r){const i=(n=k(n))&&"{"!==n[0];return t(e,G(r,i||!1))}function P(e,t){return e.replaceAll(h,((e,n,r)=>{const i=$(t,r);return i?`{${i.name}}`:n}))}function Q(e,t,n){const r=P(e,n);return r?r.replaceAll(F,((e,n,r)=>S(e,n||r,t))):r}function _(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function H(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&("feature"===e.type||"scene"===e.type||"sublayer"===e.type)&&"when"in e}function B(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function J(e){return H(e)&&B(e)}function K(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&J(e.sourceLayer)}function V(e,t){const{fieldInfos:n,fieldName:r,preventPlacesFormatting:l,layer:u,timeZone:s}=t,c=Y(n,r),d=$(u,r);if(c&&!a(r)){const t=d?.type,n=c.format?.dateFormat;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||n)return f(e,{format:n,fieldType:t,timeZoneOptions:{layerTimeZone:u&&"preferredTimeZone"in u?u.preferredTimeZone:null,viewTimeZone:s,datesInUnknownTimezone:!(!u||!("datesInUnknownTimezone"in u))&&!!u.datesInUnknownTimezone}})}const p=c?.format;return"string"==typeof e&&a(r)&&p?W(e,p):"string"==typeof(e=_(e,p))||null==e||null==p?ae(e):i(e,l?{...o(p),minimumFractionDigits:0,maximumFractionDigits:20}:o(p))}function W(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?X(e,",",", ",t):e.includes(";")?X(e,";","; ",t):e.includes(" ")?X(e," "," ",t):i(Number(e),o(t))}function X(e,t,n,r){return e.trim().split(t).map((e=>i(Number(e),o(r)))).join(n)}function Y(e,t){if(e?.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function ee({fieldName:e,graphic:t,layer:n}){if(de(e))return null;if(!n||"function"!=typeof n.getFeatureType)return null;const{typeIdField:r}=n;if(!r||e!==r)return null;const i=n.getFeatureType(t);return i?i.name:null}function te({fieldName:e,value:t,graphic:n,layer:r}){if(de(e))return null;if(!r||"function"!=typeof r.getFieldDomain)return null;const i=n&&r.getFieldDomain(e,{feature:n});return i&&"coded-value"===i.type?i.getName(t):null}function ne(e,t,n,i){const{creatorField:o,creationDateField:a,editorField:l,editDateField:u}=e;if(!t)return;const s=p(i&&"preferredTimeZone"in i?i.preferredTimeZone:null,!(!i||!("datesInUnknownTimezone"in i))&&!!i.datesInUnknownTimezone,n,Z,"date"),f={...Z,...s},c=t[u];if("number"==typeof c){const e=t[l];return{type:"edit",date:r(c,f),user:e}}const d=t[a];if("number"==typeof d){const e=t[o];return{type:"create",date:r(d,f),user:e}}return null}function re(e,t){const n=new Map;if(!e)return n;for(const r of e){if(!r.fieldName)continue;const e=L(r.fieldName,t);r.fieldName=e,n.set(e.toLowerCase(),r)}return n}function ie(e){const t=[];if(!e)return t;const{fieldInfos:n,content:r}=e;return n&&t.push(...n),r&&Array.isArray(r)?(r.forEach((e=>{if("fields"===e.type){const n=e?.fieldInfos;n&&t.push(...n)}})),t):t}function oe(e){return e.replaceAll(w,(e=>`&#${e.charCodeAt(0)};`))}function ae(e){return"string"==typeof e?e.replaceAll(T,'<br class="esri-text-new-line" />'):e}function le(e){const{value:t,fieldName:n,fieldInfos:r,fieldInfoMap:i,layer:o,graphic:a,timeZone:l}=e;if(null==t)return"";const s=te({fieldName:n,value:t,graphic:a,layer:o});if(s)return s;const d=ee({fieldName:n,graphic:a,layer:o});if(d)return d;if(i.get(n.toLowerCase()))return V(t,{fieldInfos:r||Array.from(i.values()),fieldName:n,layer:o,timeZone:l});const p=o?.fieldsIndex?.get(n);return p&&(c(p)||u(p))?f(t,{fieldType:p.type,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:l,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}}):ae(t)}function ue({fieldInfos:e,attributes:t,layer:n,graphic:r,fieldInfoMap:i,relatedInfos:o,timeZone:a}){const l={};return o?.forEach((t=>me({attributes:l,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:n,timeZone:a}))),t&&Object.keys(t).forEach((o=>{const u=t[o];l[o]=le({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:n,value:u,graphic:r,timeZone:a})})),l}async function se(e,t){const{layer:n,graphic:r,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:n,graphic:r,objectId:u,requiredFields:i};return m().warn(e,t),null}if(!s(n)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:n,graphic:r,requiredFields:i,returnGeometry:a};return m().warn(e,t),null}const f=n.createQuery();f.objectIds=o,f.outFields=i?.length?i:[n.objectIdField],f.returnGeometry=!!a,f.returnZ=!!a,f.returnM=!!a,f.outSpatialReference=l;return(await n.queryFeatures(f,t)).features[0]}async function fe(e){if(!e.expressionInfos?.length)return!1;const t=await d(),{arcadeUtils:{hasGeometryFunctions:n}}=t;return n(e)}async function ce({graphic:e,popupTemplate:t,layer:n,spatialReference:r},i){if(!n||!t)return;if("function"==typeof n.load&&await n.load(i),!e.attributes)return;const o=n.objectIdField,a=e.attributes[o];if(null==a)return;const u=[a],s=await t.getRequiredFields(n.fieldsIndex),f=l(s,e),c=f?[]:s.includes(o)?s:[...s,o],d=t.returnGeometry||await fe(t);if(f&&!d)return;const p=await se({layer:n,graphic:e,outFields:c,objectIds:u,returnGeometry:d,spatialReference:r},i);p&&(p.geometry&&(e.geometry=p.geometry),p.attributes&&(e.attributes={...e.attributes,...p.attributes}))}function de(e=""){return!!e&&e.includes(j)}function pe(e){return e?`${j}${e.layerId}/${e.fieldName}`:""}function ye({attributes:e,graphic:t,relatedInfo:n,fieldInfos:r,fieldInfoMap:i,layer:o,timeZone:a}){e&&t&&n&&Object.keys(t.attributes).forEach((l=>{const u=pe({layerId:n.relation.id.toString(),fieldName:l}),s=t.attributes[l];e[u]=le({fieldName:u,fieldInfos:r,fieldInfoMap:i,layer:o,value:s,graphic:t,timeZone:a})}))}function me({attributes:e,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}){e&&t&&(t.relatedFeatures?.forEach((a=>ye({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))),t.relatedStatsFeatures?.forEach((a=>ye({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:n,fieldInfos:r,layer:i,timeZone:o}))))}const ge=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},he=({layer:e,method:t,query:n,definitionExpression:r})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=n.where?n.where:null,o=null!=n.geometry?n.geometry:null;ge(r)||ge(i)||"extent"===o?.type||"tile"===n.resultType||(n.cacheHint=!0)},Ie=({query:e,layer:t,method:n})=>{he({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})},be=({queryPayload:e,layer:t,method:n})=>{he({layer:t,method:n,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})};function Te(e,t,n){return e&&t&&n?"sublayer"===t.type?we({layers:t.layer?.sublayers,layer:t,relationship:n})||we({layers:t.layer?.subtables,layer:t,relationship:n}):we({layers:e.allLayers,layer:t,relationship:n})||we({layers:e.allTables,layer:t,relationship:n}):null}function we({relationship:{relatedTableId:e},layer:t,layers:n}){if(!n)return null;const r=n.filter(J);if("sublayer"===t.type)return r.find((n=>n!==t&&n.id===e));const i="scene"===t.type&&t.associatedLayer?t.associatedLayer.url:t.url;return i?r.find((n=>n!==t&&n.url===i&&n.layerId===e)):null}function Fe(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{ae as applyTextFormattingHTML,re as createFieldInfoMap,Te as findRelatedLayer,P as fixTokens,ue as formatAttributes,ne as formatEditInfo,V as formatValueToFieldInfo,ie as getAllFieldInfos,Y as getFieldInfo,M as getFieldInfoLabel,L as getFixedFieldName,R as getFixedFieldNames,Fe as getHighlightKeyForFeature,E as getSourceLayer,v as graphicCallback,oe as htmlEntities,A as isExpressionField,H as isFeatureSupportedLayer,K as isGraphicForRelatableFeatureSupportedLayer,J as isRelatableFeatureSupportedLayer,B as isRelatableLayer,de as isRelatedField,Ie as preLayerQueryCallback,be as preRequestCallback,se as querySourceLayer,ce as queryUpdatedFeature,x as shouldOpenInNewTab,z as substituteAttributes,D as substituteFieldsInLinksAndAttributes};
|
|
5
|
+
import e from"../../../core/Logger.js";import{replace as t}from"../../../core/string.js";import{convertDateFormatToIntlOptions as r,formatDate as n}from"../../../intl/date.js";import{formatNumber as i,convertNumberFormatToIntlOptions as o}from"../../../intl/number.js";import{isRasterPixelValueField as a,featureHasFields as l,isTimeOnlyField as u}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as s}from"../../../layers/support/layerUtils.js";import{formatAnyDate as f,isAnyDateField as c}from"../../../smartMapping/support/utils.js";import{loadArcade as d}from"../../../support/arcadeOnDemand.js";import{getTimeZoneFormattingOptions as p}from"../../../time/timeZoneUtils.js";const y="esri.widgets.Feature.support.featureUtils",m=()=>e.getLogger(y),g=/href=(""|'')/gi,h=/(\{([^{\r\n]+)\})/g,b=/'/g,I=/^\s*expression\//i,T=/(\n)/gi,w=/[\u00A0-\u9999<>&]/gim,F=/href\s*=\s*(?:"([^"]+)"|'([^']+)')/gi,N=/^(?:mailto:|tel:)/,j="relationships/",Z=r("short-date-short-time");function L(e){if(null!=e)return(e.sourceLayer||e.layer)??void 0}async function E({type:e,value:t,event:r}){try{return"function"==typeof t?t(r):t}catch(n){return void m().error("error",`An error occurred when calling the "${e}" function`,{error:n,graphic:r.graphic,value:t})}}function v(e=""){if(e)return!N.test(e.trim().toLowerCase())}function x(e){return!!e&&I.test(e)}function A(e,t){if(!t||!x(t)||!e)return;const r=t.replace(I,"").toLowerCase();return e.find((({name:e})=>e.toLowerCase()===r))}function C(e,t){const r=A(t,e?.fieldName);return r?r.title||null:e?e.label||e.fieldName:null}function M(e,t){const r=t.get(e.toLowerCase());return`{${r?.fieldName||e}}`}function U(e){return e.replaceAll(g,"")}function q(e,t){const r=$(t,e);return r?r.name:e}function R(e,t){return e&&e.map((e=>q(e,t)))}function $(e,t){return e&&"function"==typeof e.getField&&t?e.getField(t)??null:null}function k(e){return`${e}`.trim()}function D({attributes:e,globalAttributes:t,layer:r,text:n,expressionAttributes:i,fieldInfoMap:o}){return n?O({formattedAttributes:t,template:Q(n,{...t,...i,...e},r),fieldInfoMap:o}):""}function O({formattedAttributes:e,template:r,fieldInfoMap:n}){return k(U(t(t(r,(e=>M(e,n))),e)))}function z(e,t,r=!1){const n=t[e];if("string"==typeof n){const i="%27",o=(r?encodeURIComponent(n):n).replaceAll(b,i);t[e]=o}}function G(e,t=!1){const r={...e};return Object.keys(r).forEach((e=>z(e,r,t))),r}function S(e,r,n){const i=(r=k(r))&&"{"!==r[0];return t(e,G(n,i||!1))}function P(e,t){return e.replaceAll(h,((e,r,n)=>{const i=$(t,n);return i?`{${i.name}}`:r}))}function Q(e,t,r){const n=P(e,r);return n?n.replaceAll(F,((e,r,n)=>S(e,r||n,t))):n}function _(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function H(e){return null!=e&&"object"==typeof e&&"fieldsIndex"in e&&"geometryType"in e&&"getField"in e&&"load"in e&&"loaded"in e&&"objectIdField"in e&&"spatialReference"in e&&"type"in e&&("feature"===e.type||"scene"===e.type||"sublayer"===e.type)&&"when"in e}function J(e){return null!=e&&"object"==typeof e&&"createQuery"in e&&"queryFeatureCount"in e&&"queryObjectIds"in e&&"queryRelatedFeatures"in e&&"queryRelatedFeaturesCount"in e&&"relationships"in e}function B(e){return H(e)&&J(e)}function K(e){return!!e&&"object"==typeof e&&"sourceLayer"in e&&B(e.sourceLayer)}function V(e,t){const{fieldInfos:r,fieldName:n,preventPlacesFormatting:l,layer:u,timeZone:s}=t,c=Y(r,n),d=$(u,n);if(c&&!a(n)){const t=d?.type,r=c.format?.dateFormat;if("date"===t||"date-only"===t||"time-only"===t||"timestamp-offset"===t||r)return f(e,{format:r,fieldType:t,timeZoneOptions:{layerTimeZone:u&&"preferredTimeZone"in u?u.preferredTimeZone:null,viewTimeZone:s,datesInUnknownTimezone:!(!u||!("datesInUnknownTimezone"in u))&&!!u.datesInUnknownTimezone}})}const p=c?.format;return"string"==typeof e&&a(n)&&p?W(e,p):"string"==typeof(e=_(e,p))||null==e||null==p?ae(e):i(e,l?{...o(p),minimumFractionDigits:0,maximumFractionDigits:20}:o(p))}function W(e,t){return e=e.trim(),/\d{2}-\d{2}/.test(e)?e:e.includes(",")?X(e,",",", ",t):e.includes(";")?X(e,";","; ",t):e.includes(" ")?X(e," "," ",t):i(Number(e),o(t))}function X(e,t,r,n){return e.trim().split(t).map((e=>i(Number(e),o(n)))).join(r)}function Y(e,t){if(e?.length&&t)return e.find((e=>e.fieldName?.toLowerCase()===t.toLowerCase()))}function ee({fieldName:e,graphic:t,layer:r}){if(de(e))return null;if(!r||"function"!=typeof r.getFeatureType)return null;const{typeIdField:n}=r;if(!n||e!==n)return null;const i=r.getFeatureType(t);return i?i.name:null}function te({fieldName:e,value:t,graphic:r,layer:n}){if(de(e))return null;if(!n||"function"!=typeof n.getFieldDomain)return null;const i=r&&n.getFieldDomain(e,{feature:r});return i&&"coded-value"===i.type?i.getName(t):null}function re(e,t,r,i){const{creatorField:o,creationDateField:a,editorField:l,editDateField:u}=e;if(!t)return;const s=p(i&&"preferredTimeZone"in i?i.preferredTimeZone:null,!(!i||!("datesInUnknownTimezone"in i))&&!!i.datesInUnknownTimezone,r,Z,"date"),f={...Z,...s},c=t[u];if("number"==typeof c){const e=t[l];return{type:"edit",date:n(c,f),user:e}}const d=t[a];if("number"==typeof d){const e=t[o];return{type:"create",date:n(d,f),user:e}}return null}function ne(e,t){const r=new Map;if(!e)return r;for(const n of e){if(!n.fieldName)continue;const e=q(n.fieldName,t);n.fieldName=e,r.set(e.toLowerCase(),n)}return r}function ie(e){const t=[];if(!e)return t;const{fieldInfos:r,content:n}=e;return r&&t.push(...r),n&&Array.isArray(n)?(n.forEach((e=>{if("fields"===e.type){const r=e?.fieldInfos;r&&t.push(...r)}})),t):t}function oe(e){return e.replaceAll(w,(e=>`&#${e.charCodeAt(0)};`))}function ae(e){return"string"==typeof e?e.replaceAll(T,'<br class="esri-text-new-line" />'):e}function le(e){const{value:t,fieldName:r,fieldInfos:n,fieldInfoMap:i,layer:o,graphic:a,timeZone:l}=e;if(null==t)return"";const s=te({fieldName:r,value:t,graphic:a,layer:o});if(s)return s;const d=ee({fieldName:r,graphic:a,layer:o});if(d)return d;if(i.get(r.toLowerCase()))return V(t,{fieldInfos:n||Array.from(i.values()),fieldName:r,layer:o,timeZone:l});const p=o?.fieldsIndex?.get(r);return p&&(c(p)||u(p))?f(t,{fieldType:p.type,timeZoneOptions:{layerTimeZone:o&&"preferredTimeZone"in o?o.preferredTimeZone:null,viewTimeZone:l,datesInUnknownTimezone:!(!o||!("datesInUnknownTimezone"in o))&&!!o.datesInUnknownTimezone}}):ae(t)}function ue({fieldInfos:e,attributes:t,layer:r,graphic:n,fieldInfoMap:i,relatedInfos:o,timeZone:a}){const l={};return o?.forEach((t=>me({attributes:l,relatedInfo:t,fieldInfoMap:i,fieldInfos:e,layer:r,timeZone:a}))),t&&Object.keys(t).forEach((o=>{const u=t[o];l[o]=le({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:r,value:u,graphic:n,timeZone:a})})),l}async function se(e,t){const{layer:r,graphic:n,outFields:i,objectIds:o,returnGeometry:a,spatialReference:l}=e,u=o[0];if("number"!=typeof u&&"string"!=typeof u){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:r,graphic:n,objectId:u,requiredFields:i};return m().warn(e,t),null}if(!s(r)?.operations?.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:r,graphic:n,requiredFields:i,returnGeometry:a};return m().warn(e,t),null}const f=r.createQuery();f.objectIds=o,f.outFields=i?.length?i:[r.objectIdField],f.returnGeometry=!!a,f.returnZ=!!a,f.returnM=!!a,f.outSpatialReference=l;return(await r.queryFeatures(f,t)).features[0]}async function fe(e){if(!e.expressionInfos?.length)return!1;const t=await d(),{arcadeUtils:{hasGeometryFunctions:r}}=t;return r(e)}async function ce({graphic:e,popupTemplate:t,layer:r,spatialReference:n},i){if(!r||!t)return;if("function"==typeof r.load&&await r.load(i),!e.attributes)return;const o=r.objectIdField,a=e.attributes[o];if(null==a)return;const u=[a],s=await t.getRequiredFields(r.fieldsIndex),f=l(s,e),c=f?[]:s.includes(o)?s:[...s,o],d=t.returnGeometry||await fe(t);if(f&&!d)return;const p=await se({layer:r,graphic:e,outFields:c,objectIds:u,returnGeometry:d,spatialReference:n},i);p&&(p.geometry&&(e.geometry=p.geometry),p.attributes&&(e.attributes={...e.attributes,...p.attributes}))}function de(e=""){return!!e&&e.includes(j)}function pe(e){return e?`${j}${e.layerId}/${e.fieldName}`:""}function ye({attributes:e,graphic:t,relatedInfo:r,fieldInfos:n,fieldInfoMap:i,layer:o,timeZone:a}){e&&t&&r&&Object.keys(t.attributes).forEach((l=>{const u=pe({layerId:r.relation.id.toString(),fieldName:l}),s=t.attributes[l];e[u]=le({fieldName:u,fieldInfos:n,fieldInfoMap:i,layer:o,value:s,graphic:t,timeZone:a})}))}function me({attributes:e,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i,timeZone:o}){e&&t&&(t.relatedFeatures?.forEach((a=>ye({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i,timeZone:o}))),t.relatedStatsFeatures?.forEach((a=>ye({attributes:e,graphic:a,relatedInfo:t,fieldInfoMap:r,fieldInfos:n,layer:i,timeZone:o}))))}const ge=e=>{if(!e)return!1;const t=e.toUpperCase();return t.includes("CURRENT_TIMESTAMP")||t.includes("CURRENT_DATE")||t.includes("CURRENT_TIME")},he=({layer:e,method:t,query:r,definitionExpression:n})=>{if(!e.capabilities?.query?.supportsCacheHint||"attachments"===t)return;const i=null!=r.where?r.where:null,o=null!=r.geometry?r.geometry:null;ge(n)||ge(i)||"extent"===o?.type||"tile"===r.resultType||(r.cacheHint=!0)},be=({query:e,layer:t,method:r})=>{he({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})},Ie=({queryPayload:e,layer:t,method:r})=>{he({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression??""}`})};function Te(e,t,r){return e&&t&&r?"sublayer"===t.type?we({layers:t.layer?.sublayers,map:e,relatedLayer:t,relationship:r})||we({layers:t.layer?.subtables,map:e,relatedLayer:t,relationship:r}):we({layers:e.allLayers,map:e,relatedLayer:t,relationship:r})||we({layers:e.allTables,map:e,relatedLayer:t,relationship:r}):null}function we({map:e,relationship:t,relationship:{relatedTableId:r},relatedLayer:n,layers:i}){if(!i)return null;for(const o of i){if("map-image"===o.type){const r=we({layers:o.sublayers,map:e,relatedLayer:n,relationship:t})||we({layers:o.subtables,map:e,relatedLayer:n,relationship:t});if(r)return r;continue}if(!B(o))continue;if("sublayer"===n.type){if(o!==n&&o.id===r)return"Table"===o?.sourceJSON?.type?e?.allTables.find((e=>"feature"===e.type&&e.layerId===o.id&&e.url===o.layer?.url))??o:o;continue}const i="scene"===n.type&&n.associatedLayer?n.associatedLayer.url:n.url;if(!i)return null;if("sublayer"!==o.type){if(o!==n&&o.url===i&&o.layerId===r)return o}else if(o!==n&&o.layer?.url===i&&o.id===r)return o}return null}function Fe(e){const t=e.getObjectId();return null!=t?`oid:${t}`:`uid:${e.uid}`}export{ae as applyTextFormattingHTML,ne as createFieldInfoMap,Te as findRelatedLayer,P as fixTokens,ue as formatAttributes,re as formatEditInfo,V as formatValueToFieldInfo,ie as getAllFieldInfos,Y as getFieldInfo,C as getFieldInfoLabel,q as getFixedFieldName,R as getFixedFieldNames,Fe as getHighlightKeyForFeature,L as getSourceLayer,E as graphicCallback,oe as htmlEntities,x as isExpressionField,H as isFeatureSupportedLayer,K as isGraphicForRelatableFeatureSupportedLayer,B as isRelatableFeatureSupportedLayer,J as isRelatableLayer,de as isRelatedField,be as preLayerQueryCallback,Ie as preRequestCallback,se as querySourceLayer,ce as queryUpdatedFeature,v as shouldOpenInNewTab,O as substituteAttributes,D as substituteFieldsInLinksAndAttributes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../core/Collection.js";import{referenceSetter as i}from"../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../core/deprecate.js";import o from"../../core/Handles.js";import r from"../../core/Logger.js";import{debounce as n,ignoreAbortErrors as l}from"../../core/promiseUtils.js";import{watch as a,initial as h,on as d}from"../../core/reactiveUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{getLowerCaseDefaultHiddenFields as g}from"../../layers/support/fieldUtils.js";import{getTimeZoneFormattingOptions as p,system as u}from"../../time/timeZoneUtils.js";import{highlightsSupported as f}from"../../views/support/layerViewUtils.js";import{isSelectableLayer as y}from"../../views/support/selectionUtils.js";import b from"./ActionColumn.js";import _ from"./AttachmentsColumn.js";import C from"./FieldColumn.js";import v from"./RelationshipColumn.js";import I from"./Grid/Column.js";import w from"./Grid/Grid.js";import E from"./Grid/GridViewModel.js";import T from"./Grid/GroupColumn.js";import j from"./support/FeatureStore.js";import S from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithRelationships as R,findRelatedLayer as F,uniqueColumnNames as U}from"./support/tableUtils.js";import"../support/widgetUtils.js";import{messageBundle as O}from"../support/decorators/messageBundle.js";import{onLocaleChange as L}from"../../intl/locale.js";import{convertDateFormatToIntlOptions as x}from"../../intl/date.js";import{fetchMessageBundle as A}from"../../intl/messages.js";let z=class extends E{constructor(e){super(e),this._debounceRefresh=n((()=>this._refresh())),this._highlights=new o,this.actionColumnConfig=null,this.attachmentsEnabled=!1,this.autoRefreshEnabled=!0,this.columns=new t,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const o=this._sortOrdersToLayerOrderByFields(i,e.sortOrders);s.set({orderByFields:o});const{objectIds:r}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===r.length&&-1===r.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const n=await s.fetchItems(e);t&&t(n)},this.editingEnabled=!1,this.grid=null,this.highlightEnabled=!0,this.itemIdPath="objectId",this.layer=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.relationshipColumnConfigs=null,this.returnGeometryEnabled=!1,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,this.tableTemplate=null,this.tableTemplateOverride=null,this.timeZone=null,this.view=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._set("store",new j),this._set("grid",new w({itemIdPath:this.itemIdPath,viewModel:this}))}initialize(){const e=async()=>{this.messages=await A("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await A("esri/t9n/common"),this.messagesURIUtils=await A("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([L((()=>{e(),this._generateColumns()})),a((()=>[this.messages,this.messagesCommon,this.messagesURIUtils]),(()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.columns.forEach((t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils})),this._requestContentUpdate()}),h),d((()=>this.highlightIds),"change",(e=>this._onHighlightIdsChange(e)),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),a((()=>this.attachmentsEnabled),(e=>{const{attachmentsColumn:t,columns:i}=this;this.store.attachmentsEnabled=e,t&&i.remove(t),e&&i.length&&i.add(this._generateAttachmentsColumn(),this._getIndexOfFirstFrozenToEndColumn())})),a((()=>this._viewSelection),(()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)})),a((()=>[this._tableHighlightsReady,this._viewSelectionReady]),(()=>this._syncSelection())),a((()=>this.returnGeometryEnabled),(e=>this.store.returnGeometry=e)),a((()=>this.layer),(async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch((()=>{})))})),a((()=>this.layer?.loaded),(e=>e&&this._onLayerLoad())),a((()=>this.store.state),(e=>{"loaded"===e&&(this.grid?.scrollToTop(),this.refreshCellContent())})),a((()=>this._effectiveTableTemplate),(()=>this.layer?.loaded&&this._generateColumns())),a((()=>[this.timeZone,this.view?.timeZone]),(()=>{this.columns.forEach((e=>{if("field"in e&&e.field){const{timeZone:t,timeZoneName:i}=this._getTimeZoneInfoForFieldColumn(e.field);e.set({timeZone:t,timeZoneName:i})}})),this._requestContentUpdate()})),a((()=>this.editingEnabled),(e=>{this.editorColumns.forEach((t=>t.tableEditingEnabled=e)),this._requestContentUpdate()})),a((()=>this.layer?.definitionExpression),((e,t)=>(e||t)&&"loaded"===this.store.state&&this.reset())),a((()=>this.layer?.timeExtent),((e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset())),d((()=>this.layer),"refresh",(e=>this._onLayerRefresh(e))),d((()=>this.grid),["cell-click","cell-pointerover","cell-pointerout","cell-keydown"],(({index:e,item:t,native:i,path:s,type:o})=>{const r=t?.feature;this.emit(o,{feature:r,index:e,native:i,type:o,fieldName:s??void 0,objectId:r?.getObjectId()})})),a((()=>this.actionColumnConfig),(e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())})),a((()=>[this.relationshipColumnConfigs?.length,this.relatedRecordsEnabled]),(([e,t])=>{const{columns:i,relationshipColumns:s}=this;s.length&&i.removeMany(s),i.length&&t&&i.addMany(this._generateRelationshipColumns(),this._getIndexOfFirstFrozenToEndColumn())})),d((()=>this.objectIds),"change",(()=>this._onObjectIdsChange()),{onListenerAdd:()=>this._onObjectIdsChange()})])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return g(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _highlightableLayerView(){const e=this.layerView;return f(e)?e:null}get _layerWithRelationships(){const e=this.layer;if(!R(e))return null;const t=e.effectiveCapabilities??e.capabilities;return t?.queryRelated?.supportsCount&&t.queryRelated.supportsPagination?e:null}get _relationshipInfos(){const{_layerWithRelationships:e,relatedRecordsEnabled:t,relationships:i,view:s}=this,o=[];return t&&e?.loaded&&s?.map&&i?.length?(i.forEach((t=>{const i=F(e,s,t);i&&(i.load(),o.push({layer:e,relatedLayer:i,relationshipId:t.id}))})),o):o}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;return y(e)&&this._selectionManager?.sources.includes(e)?e:null}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get activeFilters(){const{filterGeometry:e,objectIds:i,filterBySelectionEnabled:s,highlightIds:o}=this,r=new t;return e&&r.push({type:"geometry",geometry:e}),s?r.push({type:"selection",objectIds:o.toArray()}):i.length&&r.push({type:"objectId",objectIds:i.toArray()}),r}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map((({path:e,direction:t})=>({fieldName:e,direction:t}))).filter((e=>e.fieldName&&e.direction)):[]}get filterGeometry(){return this._get("filterGeometry")}set filterGeometry(e){this.store.filterGeometry=e,this._set("filterGeometry",e)}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get hiddenFields(){return this._get("hiddenFields")??new t}set hiddenFields(e){this._set("hiddenFields",i(e,this._get("hiddenFields"),t))}get isQueryingOrSyncing(){const{store:e}=this;return e?.syncing||e?.querying}get layerView(){return this.view?.allLayerViews.find((e=>e.layer===this.layer))||null}get objectIds(){return this._get("objectIds")??new t}set objectIds(e){this._set("objectIds",i(e,this._get("objectIds"),t))}get relatedRecordsEnabled(){return!!this._get("relatedRecordsEnabled")}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e,this._set("relatedRecordsEnabled",e)}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find((({id:t})=>t===e))}get relationshipConfig(){return this._get("relationshipConfig")}set relationshipConfig(e){this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e,this._set("relationshipConfig",e)}get relationships(){const{layer:e}=this;return R(e)?e.relationships:null}set timeExtent(e){this._set("timeExtent",e),this.store.timeExtent=e}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter((e=>!e.error)).map((e=>e.objectId));i.length&&(this.highlightIds.removeMany(i),await this.refresh())}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(s(r.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store?.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}async refresh(){return l(this._debounceRefresh())}refreshCellContent(){this._requestContentUpdate()}async reset(){await(this.grid?.reset())}scrollToIndex(e){this.grid?.scrollToIndex(e)}clearSelectionFilter(){s(r.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const o=await e.queryFeatures(s);try{await t.goTo(o.features)}catch(r){"AbortError"!==r.name&&console.error(r)}}_requestContentUpdate(){this.grid?.requestContentUpdate()}async _refresh(){await this.store.refreshLayerInfo();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach(((t,i)=>{t||this.highlightIds.remove(e[i])}))}this.grid?.refreshPageCache()}_onLayerLoad(){const{layer:e}=this;if(!e)return;const t=e.capabilities.query?.maxRecordCount;t&&t<this.pageSize&&this.grid&&(this.grid.pageSize=t),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const e=this._effectiveTableTemplate?.columnTemplates,t=[],i=e?this._generateColumnsFromTemplates(e):this._generateDefaultFieldColumns();t.push(...i),t.length&&this.attachmentsEnabled&&t.push(this._generateAttachmentsColumn()),t.length&&this.relatedRecordsEnabled&&this._relationshipInfos.length&&t.push(...this._generateRelationshipColumns()),this.actionColumnConfig&&t.push(this._generateActionColumn()),t.sort(((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0)),this.columns.addMany([...t])}_generateColumnsFromTemplates(e){const{editingEnabled:t,_effectiveTableTemplate:i,grid:s,layer:o,messages:r,messagesCommon:n,messagesURIUtils:l,store:a,timeZone:h}=this,d=o?.fields??[],m=[],c=e=>d.find((t=>e.fieldName.toLowerCase()===t.name?.toLowerCase()));return e.forEach((e=>{const{autoWidth:d,direction:g,flexGrow:p,fieldName:u,formatFunction:f,frozen:y,frozenToEnd:b,icon:_,initialSortPriority:v,invalid:w,label:E,menuConfig:j,resizable:S,sortable:R,textAlign:F,textWrap:U,type:O,width:L}=e;if(!O)return void this._logWarning("Property 'type' is missing from the provided template. Skipped generating a column for this template.");if(y&&b)return void this._logWarning("Both 'frozen' and 'frozenToEnd' cannot be true for a single template. Skipped generating a column for this template.");const x=!1===e.visible;if("group"===O){if(!e.columnTemplates?.length)return void this._logWarning("Group columns must contain column templates. Skipped generating a column for this template.");if(!e.label)return void this._logWarning("Group columns require a label. Skipped generating a column for this template.");const t=this._generateColumnsFromTemplates(e.columnTemplates),i=x||this._isFieldHidden(e.label);m.push(new T({autoWidth:d,columns:t,flexGrow:p,frozen:y,frozenToEnd:b,grid:s,hidden:i,icon:_,invalid:w,label:E,menuConfig:j,messages:r,messagesCommon:n,messagesURIUtils:l,resizable:S,textAlign:F,textWrap:U,width:L}))}if(!u)return void this._logWarning("'fieldName' was missing from the provided template. Skipped generating a column for this template.");const A=x||this._isFieldHidden(u);if("column"===O&&m.push(new I({autoWidth:d,direction:g,fieldName:u,flexGrow:p,formatFunction:f,frozen:y,frozenToEnd:b,grid:s,hidden:A,icon:_,initialSortPriority:v,invalid:w,label:E,menuConfig:j,messages:r,messagesCommon:n,messagesURIUtils:l,resizable:S,sortable:R,textAlign:F,textWrap:U,timeZone:h,width:L})),"field"===O){const h=c(e);if(!h)return void this._logWarning("A valid 'field' could not be found for the provided template. Skipped generating a column for this template.");const{editable:u,required:I}=e,T=i?.expressionInfos||null,{timeZone:O,timeZoneName:x}=this._getTimeZoneInfoForFieldColumn(h);m.push(new C({autoWidth:d,direction:g,editable:u,expressionInfos:T,field:h,fieldName:h.name,flexGrow:p,formatFunction:f,frozen:y,frozenToEnd:b,grid:s,hidden:A,icon:_,initialSortPriority:v,invalid:w,label:E,layer:o,messages:r,messagesCommon:n,messagesURIUtils:l,menuConfig:j,sortable:R,store:a,required:I,resizable:S,tableEditingEnabled:t,template:e,textAlign:F,textWrap:U,timeZone:O,timeZoneName:x,width:L}))}})),m}_generateDefaultFieldColumns(){const{editingEnabled:e,grid:t,layer:i,messages:s,messagesCommon:o,messagesURIUtils:r,store:n}=this;return(i?.fields??[]).map((l=>{const{timeZone:a,timeZoneName:h}=this._getTimeZoneInfoForFieldColumn(l),d=l.name;return new C({field:l,fieldName:d,grid:t,hidden:this._isFieldHidden(d),layer:i,messages:s,messagesCommon:o,messagesURIUtils:r,store:n,tableEditingEnabled:e,timeZone:a,timeZoneName:h})}))}_getTimeZoneInfoForFieldColumn(e){const{layer:t,timeZone:i,view:s}=this;return!t||"date"!==e?.type&&"timestamp-offset"!==e?.type?{timeZone:void 0,timeZoneName:void 0}:p(t.preferredTimeZone||null,!!t.datesInUnknownTimezone,i??s?.timeZone??u,x("short-time"),e.type)}_generateAttachmentsColumn(){return new _({hidden:this._isFieldHidden(U.attachments),messages:this.messages})}_generateRelationshipColumns(){const{_layerWithRelationships:e,_relationshipInfos:t,grid:i,messages:s,messagesCommon:o,messagesURIUtils:r,relationshipColumnConfigs:n}=this,l=[];if(!e)return l;const a={grid:i,messages:s,messagesCommon:o,messagesURIUtils:r};return n?n.forEach((e=>{const{relationshipId:i}=e,s=t.find((e=>e.relationshipId===i));s&&l.push(new v({...e,...a,fieldName:`${U.relationship}-${i}`,layer:s.relatedLayer,relatedLayer:s.layer,relationshipId:i,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})):t.forEach((({layer:e,relatedLayer:t,relationshipId:i})=>{l.push(new v({...a,fieldName:`${U.relationship}-${i}`,layer:t,relatedLayer:e,relationshipId:i,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})),l}_generateActionColumn(){return new b({hidden:this._isFieldHidden(U.action),...this.actionColumnConfig})}_sortOrdersToLayerOrderByFields(e,t=[]){const i=t.map((e=>e.path)),s=t.filter(((e,t)=>{const s=i.indexOf(e.path)===t,o=null!=e.direction;return s&&o})).map((({path:e,direction:t})=>`${e} ${t?.toUpperCase()}`));return!s.length&&!e.objectIdField&&e.fields?.length&&e.fields[0]?.name&&s.push(`${e.fields[0].name} ASC`),s}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some((e=>e.toLowerCase()===t))}_addTableHighlight(e){this._highlightableLayerView&&this._highlights.add(this._highlightableLayerView.highlight(e),e)}_removeTableHighlight(e){this._highlights.remove(e)}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach((e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}_onHighlightIdsChange(e){const{added:t,removed:i}=e;this._tableHighlightsReady?(i.forEach((e=>this._removeTableHighlight(e))),t.forEach((e=>this._addTableHighlight(e)))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray())}_onShowRelatedTable(e){const{highlightIds:t}=this,{feature:i,layer:s,relatedLayer:o,relationshipId:r}=e,n=i.getObjectId()??i.attributes[o.objectIdField];if(null!=n){if(t.removeAll(),t.add(n),this.showRelatedTableCallback)return void this.showRelatedTableCallback(e);this.emit("show-related-table",{layer:s,relatedLayer:o,relationshipId:r,feature:i})}}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.grid?.refreshPageCache()}_drainColumns(){this.columns.drain((e=>!e.destroyed&&e.destroy()))}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex((e=>e.frozenToEnd));return e>-1?e:void 0}_logWarning(e){r.getLogger(this).warn(e)}};e([m()],z.prototype,"_defaultHiddenFields",null),e([m()],z.prototype,"_effectiveTableTemplate",null),e([m()],z.prototype,"_highlights",void 0),e([m()],z.prototype,"_highlightableLayerView",null),e([m({readOnly:!0})],z.prototype,"_layerWithRelationships",null),e([m()],z.prototype,"_relationshipInfos",null),e([m()],z.prototype,"_selectionManager",null),e([m()],z.prototype,"_selectableLayer",null),e([m()],z.prototype,"_tableHighlightsReady",null),e([m()],z.prototype,"_viewSelection",null),e([m()],z.prototype,"_viewSelectionReady",null),e([m()],z.prototype,"actionColumnConfig",void 0),e([m()],z.prototype,"activeFilters",null),e([m({readOnly:!0})],z.prototype,"activeSortOrders",null),e([m()],z.prototype,"attachmentsEnabled",void 0),e([m()],z.prototype,"autoRefreshEnabled",void 0),e([m({readOnly:!0})],z.prototype,"columns",void 0),e([m()],z.prototype,"dataProvider",void 0),e([m()],z.prototype,"editingEnabled",void 0),e([m()],z.prototype,"filterGeometry",null),e([m()],z.prototype,"filterBySelectionEnabled",null),e([m({readOnly:!0})],z.prototype,"grid",void 0),e([m()],z.prototype,"hiddenFields",null),e([m()],z.prototype,"highlightEnabled",void 0),e([m()],z.prototype,"isQueryingOrSyncing",null),e([m({readOnly:!0})],z.prototype,"itemIdPath",void 0),e([m()],z.prototype,"layer",void 0),e([m()],z.prototype,"layerView",null),e([m()],z.prototype,"messages",void 0),e([m(),O("esri/t9n/common")],z.prototype,"messagesCommon",void 0),e([m(),O("esri/widgets/support/t9n/uriUtils")],z.prototype,"messagesURIUtils",void 0),e([m()],z.prototype,"objectIds",null),e([m()],z.prototype,"relatedRecordsEnabled",null),e([m()],z.prototype,"relationship",null),e([m()],z.prototype,"relationshipColumnConfigs",void 0),e([m()],z.prototype,"relationshipConfig",null),e([m()],z.prototype,"relationships",null),e([m()],z.prototype,"returnGeometryEnabled",void 0),e([m()],z.prototype,"selectionSource",void 0),e([m()],z.prototype,"showRelatedTableCallback",void 0),e([m({readOnly:!0,type:j})],z.prototype,"store",void 0),e([m({type:S})],z.prototype,"tableTemplate",void 0),e([m()],z.prototype,"tableTemplateOverride",void 0),e([m()],z.prototype,"timeExtent",null),e([m()],z.prototype,"timeZone",void 0),e([m()],z.prototype,"view",void 0),z=e([c("esri.widgets.FeatureTable.FeatureTableViewModel")],z);const B=z;export{B as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import t from"../../core/Collection.js";import{referenceSetter as i}from"../../core/collectionUtils.js";import{deprecatedFunction as s}from"../../core/deprecate.js";import o from"../../core/Handles.js";import r from"../../core/Logger.js";import{debounce as n,ignoreAbortErrors as l}from"../../core/promiseUtils.js";import{watch as a,initial as h,on as d}from"../../core/reactiveUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{getLowerCaseDefaultHiddenFields as g}from"../../layers/support/fieldUtils.js";import{getTimeZoneFormattingOptions as p,system as u}from"../../time/timeZoneUtils.js";import{highlightsSupported as f}from"../../views/support/layerViewUtils.js";import{isSelectableLayer as y}from"../../views/support/selectionUtils.js";import b from"./ActionColumn.js";import _ from"./AttachmentsColumn.js";import v from"./FieldColumn.js";import C from"./RelationshipColumn.js";import I from"./Grid/Column.js";import w from"./Grid/Grid.js";import E from"./Grid/GridViewModel.js";import j from"./Grid/GroupColumn.js";import T from"./support/FeatureStore.js";import S from"./support/TableTemplate.js";import{isIFeatureTableSupportedLayerWithRelationships as R,findRelatedLayer as F,uniqueColumnNames as U}from"./support/tableUtils.js";import"../support/widgetUtils.js";import{messageBundle as O}from"../support/decorators/messageBundle.js";import{onLocaleChange as L}from"../../intl/locale.js";import{convertDateFormatToIntlOptions as x}from"../../intl/date.js";import{fetchMessageBundle as A}from"../../intl/messages.js";let Z=class extends E{constructor(e){super(e),this._debounceRefresh=n((()=>this._refresh())),this._highlights=new o,this.actionColumnConfig=null,this.attachmentsEnabled=!1,this.autoRefreshEnabled=!0,this.columns=new t,this.dataProvider=async(e,t)=>{const{layer:i,store:s}=this;if(!t)return;if(!i||!s)return void(t&&t([]));await i.load();const o=this._sortOrdersToLayerOrderByFields(i,e.sortOrders);s.set({orderByFields:o});const{objectIds:r}=this;if(this.filterBySelectionEnabled&&!this.highlightIds.length||1===r.length&&-1===r.items[0])return void t([]);"loaded"!==s.state&&"loading"!==s.state&&await s.load();const n=await s.fetchItems(e);t&&t(n)},this.editingEnabled=!1,this.grid=null,this.highlightEnabled=!0,this.itemIdPath="objectId",this.layer=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.relationshipColumnConfigs=null,this.returnGeometryEnabled=!1,this.returnMEnabled=!1,this.returnZEnabled=!1,this.selectionSource="table",this.showRelatedTableCallback=null,this.store=null,this.tableTemplate=null,this.tableTemplateOverride=null,this.timeZone=null,this.view=null,this._onLayerRefresh=this._onLayerRefresh.bind(this),this._set("store",new T),this._set("grid",new w({itemIdPath:this.itemIdPath,viewModel:this}))}initialize(){const e=async()=>{this.messages=await A("esri/widgets/FeatureTable/t9n/FeatureTable"),this.messagesCommon=await A("esri/t9n/common"),this.messagesURIUtils=await A("esri/widgets/support/t9n/uriUtils")};e(),this.addHandles([L((()=>{e(),this._generateColumns()})),a((()=>[this.messages,this.messagesCommon,this.messagesURIUtils]),(()=>{const e=this.messages;this.grid&&(this.grid.messages=e),this.columns.forEach((t=>{t.messages=e,t.messagesCommon=this.messagesCommon,t.messagesURIUtils=this.messagesURIUtils})),this._requestContentUpdate()}),h),d((()=>this.highlightIds),"change",(e=>this._onHighlightIdsChange(e)),{onListenerAdd:()=>this._syncSelection(),onListenerRemove:()=>this._highlights.removeAll()}),a((()=>this.attachmentsEnabled),(e=>{const{attachmentsColumn:t,columns:i}=this;this.store.attachmentsEnabled=e,t&&i.remove(t),e&&i.length&&i.add(this._generateAttachmentsColumn(),this._getIndexOfFirstFrozenToEndColumn())})),a((()=>this._viewSelection),(()=>{this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)})),a((()=>[this._tableHighlightsReady,this._viewSelectionReady]),(()=>this._syncSelection())),a((()=>[this.returnGeometryEnabled,this.returnMEnabled,this.returnZEnabled]),(()=>{const{store:e}=this;e.set({returnGeometry:this.returnGeometryEnabled,returnM:this.returnMEnabled,returnZ:this.returnZEnabled})})),a((()=>this.layer),(async(e,t)=>{const i=this.grid;i&&(i.clearSort(),e&&t&&await this.reset()),this._drainColumns(),this.store.layer=e,e&&(e.loaded?this._onLayerLoad():e.load().catch((()=>{})))})),a((()=>this.layer?.loaded),(e=>e&&this._onLayerLoad())),a((()=>this.store.state),(e=>{"loaded"===e&&(this.grid?.scrollToTop(),this.refreshCellContent())})),a((()=>this._effectiveTableTemplate),(()=>this.layer?.loaded&&this._generateColumns())),a((()=>[this.timeZone,this.view?.timeZone]),(()=>{this.columns.forEach((e=>{if("field"in e&&e.field){const{timeZone:t,timeZoneName:i}=this._getTimeZoneInfoForFieldColumn(e.field);e.set({timeZone:t,timeZoneName:i})}})),this._requestContentUpdate()})),a((()=>this.editingEnabled),(e=>{this.editorColumns.forEach((t=>t.tableEditingEnabled=e)),this._requestContentUpdate()})),a((()=>this.layer?.definitionExpression),((e,t)=>(e||t)&&"loaded"===this.store.state&&this.reset())),a((()=>this.layer?.timeExtent),((e,t)=>(e||t)&&!this.timeExtent&&"loaded"===this.store.state&&this.reset())),d((()=>this.layer),"refresh",(e=>this._onLayerRefresh(e))),d((()=>this.grid),["cell-click","cell-pointerover","cell-pointerout","cell-keydown"],(({index:e,item:t,native:i,path:s,type:o})=>{const r=t?.feature;this.emit(o,{feature:r,index:e,native:i,type:o,fieldName:s??void 0,objectId:r?.getObjectId()})})),a((()=>this.actionColumnConfig),(e=>{const{actionColumn:t,columns:i}=this;t?e?t.set(e):i.remove(t):e&&i.length&&i.add(this._generateActionColumn(),!1!==e.frozenToEnd?void 0:this._getIndexOfFirstFrozenToEndColumn())})),a((()=>[this.relationshipColumnConfigs?.length,this.relatedRecordsEnabled]),(([e,t])=>{const{columns:i,relationshipColumns:s}=this;s.length&&i.removeMany(s),i.length&&t&&i.addMany(this._generateRelationshipColumns(),this._getIndexOfFirstFrozenToEndColumn())})),d((()=>this.objectIds),"change",(()=>this._onObjectIdsChange()),{onListenerAdd:()=>this._onObjectIdsChange()})])}destroy(){this._drainColumns(),this._highlights.removeAll(),this._highlights.destroy(),this.grid?.destroy(),this.columns.destroyed||this.columns.destroy(),this.layer=null,this.view=null}get _defaultHiddenFields(){return g(this.layer)}get _effectiveTableTemplate(){return this.tableTemplateOverride||this.tableTemplate}get _highlightableLayerView(){const e=this.layerView;return f(e)?e:null}get _layerWithRelationships(){const e=this.layer;if(!R(e))return null;const t=e.effectiveCapabilities??e.capabilities;return t?.queryRelated?.supportsCount&&t.queryRelated.supportsPagination?e:null}get _relationshipInfos(){const{_layerWithRelationships:e,relatedRecordsEnabled:t,relationships:i,view:s}=this,o=[];return t&&e?.loaded&&s?.map&&i?.length?(i.forEach((t=>{const i=F(e,s,t);i&&(i.load(),o.push({layer:e,relatedLayer:i,relationshipId:t.id}))})),o):o}get _selectionManager(){const{view:e}=this;return!e||e.destroyed?null:e.selectionManager?.sources?.length?e.selectionManager:null}get _selectableLayer(){const{layer:e}=this;return y(e)&&this._selectionManager?.sources.includes(e)?e:null}get _tableHighlightsReady(){return!("table"!==this.selectionSource||!this.highlightEnabled||!this._highlightableLayerView)}get _viewSelection(){const{_selectableLayer:e}=this;return e?this._selectionManager?.getSelection(e)??[]:[]}get _viewSelectionReady(){return!(!this.layer||"view"!==this.selectionSource||!this._selectionManager)}get activeFilters(){const{filterGeometry:e,objectIds:i,filterBySelectionEnabled:s,highlightIds:o}=this,r=new t;return e&&r.push({type:"geometry",geometry:e}),s?r.push({type:"selection",objectIds:o.toArray()}):i.length&&r.push({type:"objectId",objectIds:i.toArray()}),r}get activeSortOrders(){return this.grid?.sortOrders?this.grid.sortOrders.map((({path:e,direction:t})=>({fieldName:e,direction:t}))).filter((e=>e.fieldName&&e.direction)):[]}get filterGeometry(){return this._get("filterGeometry")}set filterGeometry(e){this.store.filterGeometry=e,this._set("filterGeometry",e)}get filterBySelectionEnabled(){return!!this._get("filterBySelectionEnabled")}set filterBySelectionEnabled(e){const{objectIds:t}=this,i=t.length;e?(i&&(t.removeAll(),this._logWarning("Selection filter has been applied with an objectID filter. Object ID filter has been removed.")),this.filterGeometry&&this._logWarning("Selection filter has been applied with a geometry filter. Results may appear inconsistent"),this._syncObjectIdsWithStore(this.highlightIds.toArray())):i||this._syncObjectIdsWithStore(null),this._set("filterBySelectionEnabled",e)}get hiddenFields(){return this._get("hiddenFields")??new t}set hiddenFields(e){this._set("hiddenFields",i(e,this._get("hiddenFields"),t))}get isQueryingOrSyncing(){const{store:e}=this;return e?.syncing||e?.querying}get layerView(){const{layer:e,view:t}=this;if(!e||!t)return null;const i="sublayer"===e.type?e.parent:e;return t.allLayerViews.find((e=>e.layer===i))}get objectIds(){return this._get("objectIds")??new t}set objectIds(e){this._set("objectIds",i(e,this._get("objectIds"),t))}get relatedRecordsEnabled(){return!!this._get("relatedRecordsEnabled")}set relatedRecordsEnabled(e){this.store.relatedRecordsEnabled=e,this._set("relatedRecordsEnabled",e)}get relationship(){const e=this.relationshipConfig?.relationshipId;return null==e?null:this.relationships?.find((({id:t})=>t===e))}get relationshipConfig(){return this._get("relationshipConfig")}set relationshipConfig(e){this.objectIds.removeAll(),this.filterBySelectionEnabled=!1,this.store.relationshipConfig=e,this._set("relationshipConfig",e)}get relationships(){const{layer:e}=this;return R(e)?e.relationships:null}set timeExtent(e){this._set("timeExtent",e),this.store.timeExtent=e}async deleteSelection(){const e=this.highlightIds.toArray();if(!e?.length)return;const{deleteFeatureResults:t}=await this.store.deleteRowsByObjectId(e),i=t.filter((e=>!e.error)).map((e=>e.objectId));i.length&&(this.highlightIds.removeMany(i),await this.refresh())}filterBySelection(){this.filterBySelectionEnabled?this._logWarning("Property 'filterBySelectionEnabled' is already 'true'. This method has no effect."):(s(r.getLogger(this),"`FeatureTable.filterBySelection` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.addMany(this.highlightIds.toArray()))}getObjectIdIndex(e){return this.store?.getItemIndexByObjectId(e)}getValue(e,t){const i=this.store.getItemByObjectId(e);return i?.feature?.attributes[t]}async refresh(){return l(this._debounceRefresh())}refreshCellContent(){this._requestContentUpdate()}async reset(){await(this.grid?.reset())}scrollToIndex(e){this.grid?.scrollToIndex(e)}clearSelectionFilter(){s(r.getLogger(this),"`FeatureTable.clearSelectionFilter` is deprecated in favor of 'filterBySelectionEnabled' and 'objectIds'",{replacement:"FeatureTable.filterBySelectionEnabled or FeatureTable.objectIds",version:"4.30",warnOnce:!0}),this.objectIds.removeAll()}async zoomToSelection(){const{layer:e,view:t}=this,i=this.highlightIds.toArray();if(!e||!t||!i.length)return;const s=e.createQuery();s.objectIds=i,s.returnGeometry=!0;const o=await e.queryFeatures(s);try{await t.goTo(o.features)}catch(r){"AbortError"!==r.name&&console.error(r)}}_requestContentUpdate(){this.grid?.requestContentUpdate()}async _refresh(){await this.store.refreshLayerInfo();const e=this.highlightIds.toArray();if(e.length){(await this.store.verifyFeaturesByObjectId(e)).forEach(((t,i)=>{t||this.highlightIds.remove(e[i])}))}this.grid?.refreshPageCache()}_onLayerLoad(){const{layer:e}=this;if(!e)return;const t=e.capabilities.query?.maxRecordCount;t&&t<this.pageSize&&this.grid&&(this.grid.pageSize=t),this.store.load(),this._generateColumns()}_onLayerRefresh(e){this.autoRefreshEnabled&&e.dataChanged&&this.refresh()}_generateColumns(){this._drainColumns();const e=this._effectiveTableTemplate?.columnTemplates,t=e?this._generateColumnsFromTemplates(e):this._generateDefaultFieldColumns();t.length&&this.attachmentsEnabled&&t.push(this._generateAttachmentsColumn()),t.length&&this.relatedRecordsEnabled&&this._relationshipInfos.length&&t.push(...this._generateRelationshipColumns()),this.actionColumnConfig&&t.push(this._generateActionColumn()),t.sort(((e,t)=>e.frozen&&t.frozen||e.frozenToEnd&&t.frozenToEnd?0:e.frozen||t.frozenToEnd?-1:0)),this.columns.addMany(t)}_generateColumnsFromTemplates(e){const{editingEnabled:t,_effectiveTableTemplate:i,grid:s,layer:o,messages:r,messagesCommon:n,messagesURIUtils:l,store:a,timeZone:h}=this,d=o?.fields??[],m=[],c=e=>d.find((t=>e.fieldName.toLowerCase()===t.name?.toLowerCase()));return e.forEach((e=>{const{autoWidth:d,direction:g,flexGrow:p,fieldName:u,formatFunction:f,frozen:y,frozenToEnd:b,icon:_,initialSortPriority:C,invalid:w,label:E,menuConfig:T,resizable:S,sortable:R,textAlign:F,textWrap:U,type:O,width:L}=e;if(!O)return void this._logWarning("Property 'type' is missing from the provided template. Skipped generating a column for this template.");if(y&&b)return void this._logWarning("Both 'frozen' and 'frozenToEnd' cannot be true for a single template. Skipped generating a column for this template.");const x=!1===e.visible;if("group"===O){if(!e.columnTemplates?.length)return void this._logWarning("Group columns must contain column templates. Skipped generating a column for this template.");if(!e.label)return void this._logWarning("Group columns require a label. Skipped generating a column for this template.");const t=this._generateColumnsFromTemplates(e.columnTemplates),i=x||this._isFieldHidden(e.label);m.push(new j({autoWidth:d,columns:t,flexGrow:p,frozen:y,frozenToEnd:b,grid:s,hidden:i,icon:_,invalid:w,label:E,menuConfig:T,messages:r,messagesCommon:n,messagesURIUtils:l,resizable:S,textAlign:F,textWrap:U,width:L}))}if(!u)return void this._logWarning("'fieldName' was missing from the provided template. Skipped generating a column for this template.");const A=x||this._isFieldHidden(u);if("column"===O&&m.push(new I({autoWidth:d,direction:g,fieldName:u,flexGrow:p,formatFunction:f,frozen:y,frozenToEnd:b,grid:s,hidden:A,icon:_,initialSortPriority:C,invalid:w,label:E,menuConfig:T,messages:r,messagesCommon:n,messagesURIUtils:l,resizable:S,sortable:R,textAlign:F,textWrap:U,timeZone:h,width:L})),"field"===O){const h=c(e);if(!h)return void this._logWarning("A valid 'field' could not be found for the provided template. Skipped generating a column for this template.");const{editable:u,required:I}=e,j=i?.expressionInfos||null,{timeZone:O,timeZoneName:x}=this._getTimeZoneInfoForFieldColumn(h);m.push(new v({autoWidth:d,direction:g,editable:u,expressionInfos:j,field:h,fieldName:h.name,flexGrow:p,formatFunction:f,frozen:y,frozenToEnd:b,grid:s,hidden:A,icon:_,initialSortPriority:C,invalid:w,label:E,layer:o,messages:r,messagesCommon:n,messagesURIUtils:l,menuConfig:T,sortable:R,store:a,required:I,resizable:S,tableEditingEnabled:t,template:e,textAlign:F,textWrap:U,timeZone:O,timeZoneName:x,width:L}))}})),m}_generateDefaultFieldColumns(){const{editingEnabled:e,grid:t,layer:i,messages:s,messagesCommon:o,messagesURIUtils:r,store:n}=this,l=[];return i?.fields.length?(i.fields.forEach((a=>{if("geometry"===a.type)return;const{timeZone:h,timeZoneName:d}=this._getTimeZoneInfoForFieldColumn(a),m=a.name;l.push(new v({field:a,fieldName:m,grid:t,hidden:this._isFieldHidden(m),layer:i,messages:s,messagesCommon:o,messagesURIUtils:r,store:n,tableEditingEnabled:e,timeZone:h,timeZoneName:d}))})),l):l}_getTimeZoneInfoForFieldColumn(e){const{layer:t,timeZone:i,view:s}=this;return!t||"date"!==e?.type&&"timestamp-offset"!==e?.type?{timeZone:void 0,timeZoneName:void 0}:p(t.preferredTimeZone||null,!!t.datesInUnknownTimezone,i??s?.timeZone??u,x("short-time"),e.type)}_generateAttachmentsColumn(){return new _({hidden:this._isFieldHidden(U.attachments),messages:this.messages})}_generateRelationshipColumns(){const{_layerWithRelationships:e,_relationshipInfos:t,grid:i,messages:s,messagesCommon:o,messagesURIUtils:r,relationshipColumnConfigs:n}=this,l=[];if(!e)return l;const a={grid:i,messages:s,messagesCommon:o,messagesURIUtils:r};return n?n.forEach((e=>{const{relationshipId:i}=e,s=t.find((e=>e.relationshipId===i));s&&l.push(new C({...e,...a,fieldName:`${U.relationship}-${i}`,layer:s.relatedLayer,relatedLayer:s.layer,relationshipId:i,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})):t.forEach((({layer:e,relatedLayer:t,relationshipId:i})=>{l.push(new C({...a,fieldName:`${U.relationship}-${i}`,layer:t,relatedLayer:e,relationshipId:i,showRelatedTableCallback:e=>this._onShowRelatedTable(e)}))})),l}_generateActionColumn(){return new b({hidden:this._isFieldHidden(U.action),...this.actionColumnConfig})}_sortOrdersToLayerOrderByFields(e,t=[]){const i=t.map((e=>e.path)),s=t.filter(((e,t)=>{const s=i.indexOf(e.path)===t,o=null!=e.direction;return s&&o})).map((({path:e,direction:t})=>`${e} ${t?.toUpperCase()}`));return!s.length&&!e.objectIdField&&e.fields?.length&&e.fields[0]?.name&&s.push(`${e.fields[0].name} ASC`),s}_isFieldHidden(e){const t=e?.toLowerCase();return(this.hiddenFields??this._defaultHiddenFields).some((e=>e.toLowerCase()===t))}_addTableHighlight(e){const{_highlightableLayerView:t,layer:i}=this;if(t&&i){const s=this.store.getItemByObjectId(e),o="sublayer"===i.type&&s?.feature?s.feature:e;this._highlights.add(t.highlight(o),`${i.id}-${e}`)}}_removeTableHighlight(e){const{layer:t}=this;t&&this._highlights.remove(`${t.id}-${e}`)}_syncSelection(){this._highlights.removeAll(),this._tableHighlightsReady?this.highlightIds.forEach((e=>this._addTableHighlight(e))):this._viewSelectionReady&&(this.highlightIds.items=this._viewSelection)}_appendToViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.appendToSelection(t,e)}_removeFromViewSelection(e){const{_selectableLayer:t}=this;t&&this._selectionManager?.removeFromSelection(t,e)}_onHighlightIdsChange(e){const{added:t,removed:i}=e;this._tableHighlightsReady?(i.forEach((e=>this._removeTableHighlight(e))),t.forEach((e=>this._addTableHighlight(e)))):this._viewSelectionReady&&(this._removeFromViewSelection(i),this._appendToViewSelection(t)),this.filterBySelectionEnabled&&this._syncObjectIdsWithStore(this.highlightIds.toArray())}_onShowRelatedTable(e){const{highlightIds:t}=this,{feature:i,layer:s,relatedLayer:o,relationshipId:r}=e,n=i.getObjectId()??i.attributes[o.objectIdField];if(null!=n){if(t.removeAll(),t.add(n),this.showRelatedTableCallback)return void this.showRelatedTableCallback(e);this.emit("show-related-table",{layer:s,relatedLayer:o,relationshipId:r,feature:i})}}_onObjectIdsChange(){const e=this.objectIds.toArray();e.length&&this.filterBySelectionEnabled&&(this.filterBySelectionEnabled=!1,this._logWarning("Object ID filter was applied while a selection filter was applied. Selection filter has been removed.")),this._syncObjectIdsWithStore(e)}_syncObjectIdsWithStore(e){this.store.objectIds=e,this.grid?.refreshPageCache()}_drainColumns(){this.columns.drain((e=>!e.destroyed&&e.destroy()))}_getIndexOfFirstFrozenToEndColumn(){const e=this.columns.findIndex((e=>e.frozenToEnd));return e>-1?e:void 0}_logWarning(e){r.getLogger(this).warn(e)}};e([m()],Z.prototype,"_defaultHiddenFields",null),e([m()],Z.prototype,"_effectiveTableTemplate",null),e([m()],Z.prototype,"_highlights",void 0),e([m()],Z.prototype,"_highlightableLayerView",null),e([m({readOnly:!0})],Z.prototype,"_layerWithRelationships",null),e([m()],Z.prototype,"_relationshipInfos",null),e([m()],Z.prototype,"_selectionManager",null),e([m()],Z.prototype,"_selectableLayer",null),e([m()],Z.prototype,"_tableHighlightsReady",null),e([m()],Z.prototype,"_viewSelection",null),e([m()],Z.prototype,"_viewSelectionReady",null),e([m()],Z.prototype,"actionColumnConfig",void 0),e([m()],Z.prototype,"activeFilters",null),e([m({readOnly:!0})],Z.prototype,"activeSortOrders",null),e([m()],Z.prototype,"attachmentsEnabled",void 0),e([m()],Z.prototype,"autoRefreshEnabled",void 0),e([m({readOnly:!0})],Z.prototype,"columns",void 0),e([m()],Z.prototype,"dataProvider",void 0),e([m()],Z.prototype,"editingEnabled",void 0),e([m()],Z.prototype,"filterGeometry",null),e([m()],Z.prototype,"filterBySelectionEnabled",null),e([m({readOnly:!0})],Z.prototype,"grid",void 0),e([m()],Z.prototype,"hiddenFields",null),e([m()],Z.prototype,"highlightEnabled",void 0),e([m()],Z.prototype,"isQueryingOrSyncing",null),e([m({readOnly:!0})],Z.prototype,"itemIdPath",void 0),e([m()],Z.prototype,"layer",void 0),e([m()],Z.prototype,"layerView",null),e([m()],Z.prototype,"messages",void 0),e([m(),O("esri/t9n/common")],Z.prototype,"messagesCommon",void 0),e([m(),O("esri/widgets/support/t9n/uriUtils")],Z.prototype,"messagesURIUtils",void 0),e([m()],Z.prototype,"objectIds",null),e([m()],Z.prototype,"relatedRecordsEnabled",null),e([m()],Z.prototype,"relationship",null),e([m()],Z.prototype,"relationshipColumnConfigs",void 0),e([m()],Z.prototype,"relationshipConfig",null),e([m()],Z.prototype,"relationships",null),e([m()],Z.prototype,"returnGeometryEnabled",void 0),e([m()],Z.prototype,"returnMEnabled",void 0),e([m()],Z.prototype,"returnZEnabled",void 0),e([m()],Z.prototype,"selectionSource",void 0),e([m()],Z.prototype,"showRelatedTableCallback",void 0),e([m({readOnly:!0,type:T})],Z.prototype,"store",void 0),e([m({type:S})],Z.prototype,"tableTemplate",void 0),e([m()],Z.prototype,"tableTemplateOverride",void 0),e([m()],Z.prototype,"timeExtent",null),e([m()],Z.prototype,"timeZone",void 0),e([m()],Z.prototype,"view",void 0),Z=e([c("esri.widgets.FeatureTable.FeatureTableViewModel")],Z);const z=Z;export{z as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{convertDateFormatToIntlOptions as o}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as a,formatNumber as l}from"../../intl/number.js";import{CodedValue as r}from"../../layers/support/CodedValue.js";import s from"../../layers/support/CodedValueDomain.js";import{isEditableLayer as u}from"../../layers/support/editableLayers.js";import{isNumericField as p,validateFieldValue as d,isStringField as c,isTimeOnlyField as m,isDateOnlyField as f,isTimestampOffsetField as h}from"../../layers/support/fieldUtils.js";import{isAnyDateField as v}from"../../smartMapping/support/utils.js";import y from"../FeatureForm/FieldInput.js";import g from"./Grid/EditorColumn.js";import{dateFieldsWithStringFieldValue as F,getLabelForDateFieldValue as _,dateTimeIsInRange as C,getUnixFieldValueFromDateComponents as D,getISOFieldValueFromDateComponents as b,normalizeTimeOnlyString as E,prepareISOFieldValueForDateComponents as I,prepareUnixFieldValueForDateComponents as x}from"../support/dateUtils.js";import{renderingSanitizer as V}from"../support/widgetUtils.js";const w={cancelEdit:"Escape"},L="esri-column",O={input:`${L}__cell-input`,inputContainer:`${L}__cell__input-container`},j=o("short-date-short-time"),R=o("short-date"),T={useGrouping:!0,maximumFractionDigits:20};let A=class extends g{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({rowData:e,value:t})=>{const{formatFunction:i}=this;if(i&&e){const{index:n,item:{feature:o}}=e;return i({column:this,feature:o,field:this.field,index:n,value:V.sanitize(t)})}if(null===t)return" ";const{field:n}=this,o=this._getDomainForFeature(e?.item?.feature);if(o){const e=this._getComputedDomain(t,o);if("date"===n.type&&"range"===o.type)return this._formatDateValueForDisplay(n,e);if(p(n)&&"range"===o.type){const e=this.template?.format,i=e?a(e):T;return l(parseFloat(t),i)}return F.has(n.type)?"range"===o.type?V.sanitize(_(n,e)):V.sanitize(e):e}if("date"===n.type||F.has(n.type))return this._formatDateValueForDisplay(n,t);if(p(n)){const e=this.template?.format,i=e?a(e):T;return l(parseFloat(t),i)}return V.sanitize(t)},this.cellValueValidatorFunction=({oldValue:e,value:i})=>{const{field:n}=this;if(this.effectiveRequired&&(null==i||""===i))return!1;if(p(n)&&d(n,i))return t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1;if(this._isAnyDateOrTimeField){const e=n.type,t=this._effectiveRange;if(!C({type:e,range:t,value:i}))return!1}return e!==i},this.expressionInfos=null,this.field=null,this.formatFunction=null,this.inputRenderFunction=({root:e,column:i,rowData:n})=>{if(this.editInfo||!this.effectiveEditable)return;const o=this.getCellValue(i,n),{field:a}=this;if("big-integer"===a.type&&d(a,o))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const l=n?.item.feature;if(!l)return;this._activeFieldInput=this._setUpFieldInput(l,o);const r=document.createElement("div");r.classList.add(O.inputContainer);const s=[],u="coded-value"===this._effectiveDomain?.type;if(this._isAnyDateOrTimeField&&!u){const e=document.createElement("div"),t=this._setUpDateComponents(o),i=this._setUpDateActionBar();t.forEach((t=>e.appendChild(t))),r.appendChild(e),r.appendChild(i),s.push(...t)}else{const t=this.createInputElement({root:e,column:i,rowData:n,value:o});r.appendChild(t),s.push(t)}this._set("editInfo",{column:i,inputs:s,root:e,rowData:n,oldValue:o}),this.removeCellContent(e),e.appendChild(r),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();const p=s[0];p&&(p.focus(),p instanceof HTMLInputElement&&p.select())},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{const{editInfo:t,field:i,includeTime:n}=this;if(!t||!e.length)return null;const o=e[0];if(this._isAnyDateOrTimeField){const a=t.oldValue??void 0;if("coded-value"===this._effectiveDomain?.type)return null!=o.value?parseFloat(o.value):null;switch(i.type){case"date-only":{const e=o.value;return""!==e?e:null}case"time-only":{const e=E(o.value);return""!==e?e:null}case"timestamp-offset":{const t=n?e[1]:void 0,i=e.at(-1);return b({oldValue:a,dateComponent:o,timeComponent:t,timeZoneComponent:i,defaultTimeZone:this.timeZone})}case"date":{const{max:t,min:i}=this._effectiveRange;return D({oldValue:a,dateComponent:o,timeComponent:e[1],timeZone:this.timeZone??void 0,max:t,min:i})}}return null}const a=o.value,{effectiveRequired:l}=this;return l||""!==a?p(i)?parseFloat(a):c(i)?a.trim():a:null},this.sortable=!0,this.store=null,this.template=null,this.updateRowItemFunction=({rowData:e,column:t,value:i})=>{e&&t.path&&(e.item.feature.attributes[t.path]=i)},this.updateStoreItemFunction=async({rowData:e,column:t,value:i})=>{if(!e||!this.store||!t.path)return;const n=e.item.objectId,o=this.store.getItemIndexByObjectId(n),a=o>-1?o:e.index;await this.store.updateItem({index:a,name:t.path,value:i})}}get _effectiveDomain(){const e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){const{field:e}=this;return v(e)||m(e)}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get description(){return this.template?.description??this.field?.description??null}get effectiveEditable(){const{editable:e,field:t,layer:i,tableEditingEnabled:n}=this;if(null==t||null==i)return!1;const o=u(i),a=i.effectiveCapabilities??i.capabilities,l=a?.operations?.supportsUpdate;return!!(t.editable&&o&&l&&"oid"!==t.type&&n)&&e}get effectiveLabel(){return V.sanitize(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._activeFieldInput?.required||this.required}get includeTime(){const{field:e,template:t}=this;return"time-only"===e.type||"date-only"!==e.type&&(!t?.input||"includeTime"in t.input&&!1!==t.input.includeTime)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,i=e?.length??-1,n=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=n&&!isNaN(n)&&n>=-1&&(-1===i||n<=i)?n:i}get minLength(){const{template:e,maxLength:t}=this,i=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&i<=t?i:null}get name(){return this.field?.name}get nullable(){return!1!==this.field.nullable}createInputElement({value:e}){const{_effectiveDomain:t,field:i,maxLength:n,minLength:o,effectiveRequired:a}=this;let l;"coded-value"===t?.type?(l=this._createSelectElement(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),a),l.onchange=()=>{l.onblur=null,s()}):(l=document.createElement("input"),l.type=p(i)?"number":"text",n>-1&&(l.maxLength=n),o>0&&(l.minLength=o)),l.classList.add(O.input),l.value=e,l.required=a;let r=!1;l.onkeydown=e=>{r=e.key===w.cancelEdit},l.onblur=()=>{l.onblur=null,s()};const s=()=>{r?this.cancel():this.submit()};return l}getCellValue({path:e},t){return e&&t?.item?.feature?.attributes?t.item.feature.attributes?.[e]:null}onEditComplete(){const e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}_clearActiveEditValues(){this.editInfo?.inputs?.forEach((e=>e.value=""))}_setUpDateActionBar(){const{cancel:e,clear:t,save:i}=this.messagesCommon,n=document.createElement("calcite-action-bar");return n.expandDisabled=!0,n.layout="horizontal",n.appendChild(this.createCalciteAction({text:i,icon:"save",onclick:()=>this.submit()})),this.effectiveRequired||n.appendChild(this.createCalciteAction({text:t,icon:"trash",onclick:()=>{this._clearActiveEditValues(),this.submit()}})),n.appendChild(this.createCalciteAction({text:e,icon:"x",onclick:()=>this.cancel()})),n}_formatDateValueForDisplay(e,t){const{timeZone:i,timeZoneName:n}=this;return null!=t?_(e,t,{...this._getDateFormatOptions(),timeZone:i??void 0,timeZoneName:n??void 0}):null}_setUpDateComponents(e){const{_effectiveRange:{max:t,min:i,rawMax:n,rawMin:o},field:a,effectiveRequired:l}=this,r=this._getDateFieldValuesForComponents(a,e),s=[];if(v(a)){const e=this.createDateComponent(),u=f(a)||h(a)?n:t,p=f(a)||h(a)?o:i,d=this._getDateFieldValuesForComponents(a,u??null),c=this._getDateFieldValuesForComponents(a,p??null);e.value=r.date??"",e.max=d.date??"",e.min=c.date??"",e.required=l,e.addEventListener("calciteInputDatePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if(this.includeTime){const e=this.createTimeComponent();e.value=r.time??"",e.required=l,e.addEventListener("calciteInputTimePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if("timestamp-offset"===a.type){const e=this.createTimeZoneComponent();e.value=r.timeZoneOffset??"0",e.addEventListener("calciteInputTimeZoneOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}return s}_onDateComponentOpen(e){this.editInfo?.inputs.forEach((t=>{t!==e&&"open"in t&&(t.open=!1)}))}_syncRowEditingState(e,t=!1){const i=this.grid?.getRowContainingNode(e);i&&(t?i.setAttribute("editing","true"):i.removeAttribute("editing"))}_getDateFieldValuesForComponents(e,t){switch(e.type){case"date":return x(t,this.timeZone??void 0);case"date-only":return{date:t};case"time-only":return{time:t};case"timestamp-offset":return I(t);default:return{}}}_createSelectElement(e,t,i=!1){let n=!1;const o=t.map((t=>{t.value===e&&(n=!0);const i=document.createElement("option");return i.text=t.name,i.value=t.value,i}));if(null!=e&&""!==e&&!n){const t=document.createElement("option");t.text=e,t.value=e,o.unshift(t)}if(!i&&null==e){const e=document.createElement("option");e.value="",o.unshift(e)}const a=document.createElement("select");return o.forEach((e=>a.add(e))),a.value=e,a}_setUpFieldInput(e,t){const{field:i,layer:n,timeZone:o}=this,a=new y({feature:e,field:i,initialFeature:e.clone(),layer:n,timeZone:o});return a.set("value",t),a}_isDomainCompatible(e){const{field:t}=this;if(e&&"coded-value"===e.type){const i=typeof e.codedValues[0].code;if("string"===i&&c(t)||"number"===i&&p(t))return!0}return!(!e||"range"!==e.type||!p(t))}_getDomainForFeature(e){const{layer:t,name:i,template:n}=this;if(!e||!t?.getFieldDomain)return null;if("wfs"===t.type||"geojson"===t.type||"csv"===t.type||"knowledge-graph-sublayer"===t.type)return null;if(n?.domain&&this._isDomainCompatible(n.domain))return n.domain;const{typeIdField:o}=t,a=o===i,l=this.field.domain;if(a&&!l)return new s({name:"__internal-type-based-coded-value-domain__",codedValues:t.types?.map((({id:e,name:t})=>new r({code:e,name:t})))});return o&&null!=i&&t.getFieldDomain(i,{feature:e})||l}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const i=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return i&&i.length?i[0].name:e}return null}_getDateFormatOptions(){const{template:e}=this,t=e?.format?.dateFormat;return t?o(t):e?.input&&"includeTime"in e.input&&!1===e.input.includeTime?R:j}};e([i()],A.prototype,"_effectiveDomain",null),e([i()],A.prototype,"_activeFieldInput",void 0),e([i()],A.prototype,"_effectiveRange",null),e([i()],A.prototype,"_isAnyDateOrTimeField",null),e([i({readOnly:!0})],A.prototype,"alias",null),e([i()],A.prototype,"cellValueFormatFunction",void 0),e([i()],A.prototype,"cellValueValidatorFunction",void 0),e([i({readOnly:!0})],A.prototype,"defaultValue",null),e([i({readOnly:!0})],A.prototype,"description",null),e([i()],A.prototype,"effectiveEditable",null),e([i()],A.prototype,"effectiveLabel",null),e([i()],A.prototype,"effectiveRequired",null),e([i()],A.prototype,"expressionInfos",void 0),e([i()],A.prototype,"field",void 0),e([i()],A.prototype,"formatFunction",void 0),e([i()],A.prototype,"includeTime",null),e([i()],A.prototype,"inputRenderFunction",void 0),e([i()],A.prototype,"layer",void 0),e([i({readOnly:!0})],A.prototype,"loadingMessage",null),e([i()],A.prototype,"maxLength",null),e([i()],A.prototype,"minLength",null),e([i({readOnly:!0})],A.prototype,"name",null),e([i({readOnly:!0})],A.prototype,"nullable",null),e([i()],A.prototype,"parseInputValueFunction",void 0),e([i()],A.prototype,"sortable",void 0),e([i()],A.prototype,"store",void 0),e([i()],A.prototype,"template",void 0),e([i()],A.prototype,"updateRowItemFunction",void 0),e([i()],A.prototype,"updateStoreItemFunction",void 0),A=e([n("esri.widgets.FeatureTable.FieldColumn")],A);const Z=A;export{Z as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{convertDateFormatToIntlOptions as o}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as a,formatNumber as l}from"../../intl/number.js";import{CodedValue as r}from"../../layers/support/CodedValue.js";import s from"../../layers/support/CodedValueDomain.js";import{isEditableLayer as u}from"../../layers/support/editableLayers.js";import{isNumericField as p,validateFieldValue as d,isStringField as c,isTimeOnlyField as m,isDateOnlyField as f,isTimestampOffsetField as h}from"../../layers/support/fieldUtils.js";import{isAnyDateField as v}from"../../smartMapping/support/utils.js";import y from"../FeatureForm/FieldInput.js";import g from"./Grid/EditorColumn.js";import{dateFieldsWithStringFieldValue as F,getLabelForDateFieldValue as _,dateTimeIsInRange as C,getUnixFieldValueFromDateComponents as D,getISOFieldValueFromDateComponents as b,normalizeTimeOnlyString as E,prepareISOFieldValueForDateComponents as I,prepareUnixFieldValueForDateComponents as x}from"../support/dateUtils.js";import{renderingSanitizer as V}from"../support/widgetUtils.js";const w={cancelEdit:"Escape"},L="esri-column",O={input:`${L}__cell-input`,inputContainer:`${L}__cell__input-container`},j=o("short-date-short-time"),R=o("short-date"),T={useGrouping:!0,maximumFractionDigits:20};let A=class extends g{constructor(e){super(e),this._activeFieldInput=null,this.cellValueFormatFunction=({rowData:e,value:t})=>{const{formatFunction:i}=this;if(i&&e){const{index:n,item:{feature:o}}=e;return i({column:this,feature:o,field:this.field,index:n,value:V.sanitize(t)})}if(null===t)return" ";const{field:n}=this,o=this._getDomainForFeature(e?.item?.feature);if(o){const e=this._getComputedDomain(t,o);if("date"===n.type&&"range"===o.type)return this._formatDateValueForDisplay(n,e);if(p(n)&&"range"===o.type){const e=this.template?.format,i=e?a(e):T;return l(parseFloat(t),i)}return F.has(n.type)?"range"===o.type?V.sanitize(_(n,e)):V.sanitize(e):e}if("date"===n.type||F.has(n.type))return this._formatDateValueForDisplay(n,t);if(p(n)){const e=this.template?.format,i=e?a(e):T;return l(parseFloat(t),i)}return V.sanitize(t)},this.cellValueValidatorFunction=({oldValue:e,value:i})=>{const{field:n}=this;if(this.effectiveRequired&&(null==i||""===i))return!1;if(p(n)&&d(n,i))return t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1;if(this._isAnyDateOrTimeField){const e=n.type,t=this._effectiveRange;if(!C({type:e,range:t,value:i}))return!1}return e!==i},this.expressionInfos=null,this.field=null,this.formatFunction=null,this.inputRenderFunction=({root:e,column:i,rowData:n})=>{if(this.editInfo||!this.effectiveEditable)return;const o=this.getCellValue(i,n),{field:a}=this;if("big-integer"===a.type&&d(a,o))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const l=n?.item.feature;if(!l)return;this._activeFieldInput=this._setUpFieldInput(l,o);const r=document.createElement("div");r.classList.add(O.inputContainer);const s=[],u="coded-value"===this._effectiveDomain?.type;if(this._isAnyDateOrTimeField&&!u){const e=document.createElement("div"),t=this._setUpDateComponents(o),i=this._setUpDateActionBar();t.forEach((t=>e.appendChild(t))),r.appendChild(e),r.appendChild(i),s.push(...t)}else{const t=this.createInputElement({root:e,column:i,rowData:n,value:o});r.appendChild(t),s.push(t)}this._set("editInfo",{column:i,inputs:s,root:e,rowData:n,oldValue:o}),this.removeCellContent(e),e.appendChild(r),this._syncRowEditingState(e,!0),this.grid?.generateCellPartNames();const p=s[0];p&&(p.focus(),p instanceof HTMLInputElement&&p.select())},this.layer=null,this.parseInputValueFunction=({inputs:e})=>{const{editInfo:t,field:i,includeTime:n}=this;if(!t||!e.length)return null;const o=e[0];if(this._isAnyDateOrTimeField){const a=t.oldValue??void 0;if("coded-value"===this._effectiveDomain?.type)return null!=o.value?parseFloat(o.value):null;switch(i.type){case"date-only":{const e=o.value;return""!==e?e:null}case"time-only":{const e=E(o.value);return""!==e?e:null}case"timestamp-offset":{const t=n?e[1]:void 0,i=e.at(-1);return b({oldValue:a,dateComponent:o,timeComponent:t,timeZoneComponent:i,defaultTimeZone:this.timeZone})}case"date":{const{max:t,min:i}=this._effectiveRange;return D({oldValue:a,dateComponent:o,timeComponent:e[1],timeZone:this.timeZone??void 0,max:t,min:i})}}return null}const a=o.value,{effectiveRequired:l}=this;return l||""!==a?p(i)?parseFloat(a):c(i)?a.trim():a:null},this.sortable=!0,this.store=null,this.template=null,this.updateRowItemFunction=({rowData:e,column:t,value:i})=>{e&&t.path&&(e.item.feature.attributes[t.path]=i)},this.updateStoreItemFunction=async({rowData:e,column:t,value:i})=>{if(!e||!this.store||!t.path)return;const n=e.item.objectId,o=this.store.getItemIndexByObjectId(n),a=o>-1?o:e.index;await this.store.updateItem({index:a,name:t.path,value:i})}}get _effectiveDomain(){const e=this._activeFieldInput?.feature;return e?this._getDomainForFeature(e):null}get _effectiveRange(){return this._activeFieldInput?.range??{max:null,min:null}}get _isAnyDateOrTimeField(){const{field:e}=this;return v(e)||m(e)}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get description(){return this.template?.description??this.field?.description??null}get effectiveEditable(){const{editable:e,field:t,layer:i,tableEditingEnabled:n}=this;if(null==t||null==i)return!1;const o=u(i),a=i.effectiveCapabilities??i.capabilities,l=a?.operations?.supportsUpdate;return!!(t.editable&&o&&l&&"oid"!==t.type&&n)&&e}get effectiveLabel(){return V.sanitize(this.label||this.alias||this.fieldName)}get effectiveRequired(){return!this.nullable||this._activeFieldInput?.required||this.required}get includeTime(){const{field:e,template:t}=this;return"time-only"===e.type||"date-only"!==e.type&&(!t?.input||"includeTime"in t.input&&!1!==t.input.includeTime)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,i=e?.length??-1,n=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=n&&!isNaN(n)&&n>=-1&&(-1===i||n<=i)?n:i}get minLength(){const{template:e,maxLength:t}=this,i=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&i<=t?i:null}get name(){return this.field?.name}get nullable(){return!1!==this.field.nullable}createInputElement({value:e}){const{_effectiveDomain:t,field:i,maxLength:n,minLength:o,effectiveRequired:a}=this;let l;"coded-value"===t?.type?(l=this._createSelectElement(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),a),l.onchange=()=>{l.onblur=null,s()}):(l=document.createElement("input"),l.type=p(i)?"number":"text",n>-1&&(l.maxLength=n),o>0&&(l.minLength=o)),l.classList.add(O.input),l.value=e,l.required=a;let r=!1;l.onkeydown=e=>{r=e.key===w.cancelEdit},l.onblur=()=>{l.onblur=null,s()};const s=()=>{r?this.cancel():this.submit()};return l}getCellValue({path:e},t){return e&&t?.item?.feature?.attributes?t.item.feature.attributes?.[e]:null}onEditComplete(){const e=this.editInfo?.root;e&&this._syncRowEditingState(e,!1),this._activeFieldInput=null,super.onEditComplete()}_clearActiveEditValues(){this.editInfo?.inputs?.forEach((e=>e.value=""))}_setUpDateActionBar(){const{messagesCommon:e}=this,t=e?.cancel??"",i=e?.clear??"",n=e?.save??"",o=document.createElement("calcite-action-bar");return o.expandDisabled=!0,o.layout="horizontal",o.appendChild(this.createCalciteAction({text:n,icon:"save",onclick:()=>this.submit()})),this.effectiveRequired||o.appendChild(this.createCalciteAction({text:i,icon:"trash",onclick:()=>{this._clearActiveEditValues(),this.submit()}})),o.appendChild(this.createCalciteAction({text:t,icon:"x",onclick:()=>this.cancel()})),o}_formatDateValueForDisplay(e,t){const{timeZone:i,timeZoneName:n}=this;return null!=t?_(e,t,{...this._getDateFormatOptions(),timeZone:i??void 0,timeZoneName:n??void 0}):null}_setUpDateComponents(e){const{_effectiveRange:{max:t,min:i,rawMax:n,rawMin:o},field:a,effectiveRequired:l}=this,r=this._getDateFieldValuesForComponents(a,e),s=[];if(v(a)){const e=this.createDateComponent(),u=f(a)||h(a)?n:t,p=f(a)||h(a)?o:i,d=this._getDateFieldValuesForComponents(a,u??null),c=this._getDateFieldValuesForComponents(a,p??null);e.value=r.date??"",e.max=d.date??"",e.min=c.date??"",e.required=l,e.addEventListener("calciteInputDatePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if(this.includeTime){const e=this.createTimeComponent();e.value=r.time??"",e.required=l,e.addEventListener("calciteInputTimePickerOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}if("timestamp-offset"===a.type){const e=this.createTimeZoneComponent();e.value=r.timeZoneOffset??"0",e.addEventListener("calciteInputTimeZoneOpen",(()=>this._onDateComponentOpen(e))),s.push(e)}return s}_onDateComponentOpen(e){this.editInfo?.inputs.forEach((t=>{t!==e&&"open"in t&&(t.open=!1)}))}_syncRowEditingState(e,t=!1){const i=this.grid?.getRowContainingNode(e);i&&(t?i.setAttribute("editing","true"):i.removeAttribute("editing"))}_getDateFieldValuesForComponents(e,t){switch(e.type){case"date":return x(t,this.timeZone??void 0);case"date-only":return{date:t};case"time-only":return{time:t};case"timestamp-offset":return I(t);default:return{}}}_createSelectElement(e,t,i=!1){let n=!1;const o=t.map((t=>{t.value===e&&(n=!0);const i=document.createElement("option");return i.text=t.name,i.value=t.value,i}));if(null!=e&&""!==e&&!n){const t=document.createElement("option");t.text=e,t.value=e,o.unshift(t)}if(!i&&null==e){const e=document.createElement("option");e.value="",o.unshift(e)}const a=document.createElement("select");return o.forEach((e=>a.add(e))),a.value=e,a}_setUpFieldInput(e,t){const{field:i,layer:n,timeZone:o}=this,a=new y({feature:e,field:i,initialFeature:e.clone(),layer:n,timeZone:o});return a.set("value",t),a}_isDomainCompatible(e){const{field:t}=this;if(e&&"coded-value"===e.type){const i=typeof e.codedValues[0].code;if("string"===i&&c(t)||"number"===i&&p(t))return!0}return!(!e||"range"!==e.type||!p(t))}_getDomainForFeature(e){const{layer:t,name:i,template:n}=this;if(!e||!t?.getFieldDomain)return null;if("wfs"===t.type||"geojson"===t.type||"csv"===t.type||"knowledge-graph-sublayer"===t.type)return null;if(n?.domain&&this._isDomainCompatible(n.domain))return n.domain;const{typeIdField:o}=t,a=o===i,l=this.field.domain;if(a&&!l)return new s({name:"__internal-type-based-coded-value-domain__",codedValues:t.types?.map((({id:e,name:t})=>new r({code:e,name:t})))});return o&&null!=i&&t.getFieldDomain(i,{feature:e})||l}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const i=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return i&&i.length?i[0].name:e}return null}_getDateFormatOptions(){const{template:e}=this,t=e?.format?.dateFormat;return t?o(t):e?.input&&"includeTime"in e.input&&!1===e.input.includeTime?R:j}};e([i()],A.prototype,"_effectiveDomain",null),e([i()],A.prototype,"_activeFieldInput",void 0),e([i()],A.prototype,"_effectiveRange",null),e([i()],A.prototype,"_isAnyDateOrTimeField",null),e([i({readOnly:!0})],A.prototype,"alias",null),e([i()],A.prototype,"cellValueFormatFunction",void 0),e([i()],A.prototype,"cellValueValidatorFunction",void 0),e([i({readOnly:!0})],A.prototype,"defaultValue",null),e([i({readOnly:!0})],A.prototype,"description",null),e([i()],A.prototype,"effectiveEditable",null),e([i()],A.prototype,"effectiveLabel",null),e([i()],A.prototype,"effectiveRequired",null),e([i()],A.prototype,"expressionInfos",void 0),e([i()],A.prototype,"field",void 0),e([i()],A.prototype,"formatFunction",void 0),e([i()],A.prototype,"includeTime",null),e([i()],A.prototype,"inputRenderFunction",void 0),e([i()],A.prototype,"layer",void 0),e([i({readOnly:!0})],A.prototype,"loadingMessage",null),e([i()],A.prototype,"maxLength",null),e([i()],A.prototype,"minLength",null),e([i({readOnly:!0})],A.prototype,"name",null),e([i({readOnly:!0})],A.prototype,"nullable",null),e([i()],A.prototype,"parseInputValueFunction",void 0),e([i()],A.prototype,"sortable",void 0),e([i()],A.prototype,"store",void 0),e([i()],A.prototype,"template",void 0),e([i()],A.prototype,"updateRowItemFunction",void 0),e([i()],A.prototype,"updateStoreItemFunction",void 0),A=e([n("esri.widgets.FeatureTable.FieldColumn")],A);const Z=A;export{Z as default};
|