@arcgis/core 4.28.0-next.20231002 → 4.28.0-rc.0
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02120d192eafd7612475.js +1 -0
- package/assets/esri/core/workers/chunks/{4d967e98d229f18d61f5.js → 09e8babe75407c2e64c4.js} +1 -1
- package/assets/esri/core/workers/chunks/0beebbb0c6dad0e742d7.js +1 -0
- package/assets/esri/core/workers/chunks/0d8ca51043c7784aed96.js +1 -0
- package/assets/esri/core/workers/chunks/112e89da628bdea5355c.js +1 -0
- package/assets/esri/core/workers/chunks/{5e9edd06e624f385fa4b.js → 121a9e148509f2fe2210.js} +1 -1
- package/assets/esri/core/workers/chunks/1856d16d738f44f58084.js +1 -0
- package/assets/esri/core/workers/chunks/{0526d623d0b4c12929bd.js → 18ab9cc85a1a7988fdfd.js} +1 -1
- package/assets/esri/core/workers/chunks/{7c960a2694c4c3123acf.js → 1a36703ebe934749646e.js} +1 -1
- package/assets/esri/core/workers/chunks/24a0cf405195421c0d06.js +1 -0
- package/assets/esri/core/workers/chunks/24ff267cf253feac22de.js +1 -0
- package/assets/esri/core/workers/chunks/{3c8613596659801fd6ab.js → 29cab345819ec02ed60a.js} +1 -1
- package/assets/esri/core/workers/chunks/{169a61c6e128b8a16021.js → 2c560a075d9ef2069ed1.js} +1 -1
- package/assets/esri/core/workers/chunks/2f8e71dac98135bbc3e6.js +1 -0
- package/assets/esri/core/workers/chunks/341fb51b2165522963b3.js +1 -0
- package/assets/esri/core/workers/chunks/{ad8e0f82cb1feafa9e2f.js → 36ab90fb34b9716a9983.js} +1 -1
- package/assets/esri/core/workers/chunks/{2688213bbff536da7917.js → 3ea0b872436fce84b927.js} +1 -1
- package/assets/esri/core/workers/chunks/40633064c290dc2af9ea.js +1 -0
- package/assets/esri/core/workers/chunks/42ec4c80b0c2944cd65c.js +1 -0
- package/assets/esri/core/workers/chunks/44b870cb53ba68b17c32.js +1 -0
- package/assets/esri/core/workers/chunks/{8a7fa4e8b0d14da7c9eb.js → 4cc680fe4c9c39d2f853.js} +1 -1
- package/assets/esri/core/workers/chunks/{6730c9f0890191a95fdb.js → 4d81aa50d90f5701a343.js} +1 -1
- package/assets/esri/core/workers/chunks/4e0bf30da4281070e453.js +1 -0
- package/assets/esri/core/workers/chunks/4e6bf1efe3b0b474cbb4.js +1 -0
- package/assets/esri/core/workers/chunks/52cef7cd3aaaa4f45c94.js +1 -0
- package/assets/esri/core/workers/chunks/{4e04242e707c0eb3aa4a.js → 5a3ccc0a19ac8fa9e524.js} +1 -1
- package/assets/esri/core/workers/chunks/5e907ec0ee1565b5fbbc.js +1 -0
- package/assets/esri/core/workers/chunks/66ba749ab0a631bbfdec.js +1 -0
- package/assets/esri/core/workers/chunks/6b14d89d689a21014aec.js +1 -0
- package/assets/esri/core/workers/chunks/6b1856303d1562f05100.js +1 -0
- package/assets/esri/core/workers/chunks/{576269fd1f9049876aa1.js → 6b7b5544ed1f9a84623f.js} +1 -1
- package/assets/esri/core/workers/chunks/710a6268de62003af825.js +1 -0
- package/assets/esri/core/workers/chunks/77923afde29ae1ff10ca.js +1 -0
- package/assets/esri/core/workers/chunks/784ffd52315a4d55d683.js +1 -0
- package/assets/esri/core/workers/chunks/7cf7f2b991a7cbdad2ce.js +1 -0
- package/assets/esri/core/workers/chunks/{70dffbf49b0633b1a5f1.js → 8f3680fee85a05839489.js} +1 -1
- package/assets/esri/core/workers/chunks/97aecf210938015cc7a3.js +1 -0
- package/assets/esri/core/workers/chunks/{c7ebd5d431fb996bfcee.js → 9f8207c82a17508a87a8.js} +1 -1
- package/assets/esri/core/workers/chunks/{557305b91f77569ce664.js → a01ffe03b1465c21b9e6.js} +1 -1
- package/assets/esri/core/workers/chunks/a298c9031962951e55a9.js +1 -0
- package/assets/esri/core/workers/chunks/{329669a9beda89b028dd.js → a5a7bbdd8298016535bc.js} +1 -1
- package/assets/esri/core/workers/chunks/a877a4826cd6a46ec99b.js +1 -0
- package/assets/esri/core/workers/chunks/ad38e456a7cee940a165.js +1 -0
- package/assets/esri/core/workers/chunks/adfbc168be8c49b51e1b.js +1 -0
- package/assets/esri/core/workers/chunks/b0526633a93ef69ec47b.js +1 -0
- package/assets/esri/core/workers/chunks/b99bc08a01e9250b0a31.js +1 -0
- package/assets/esri/core/workers/chunks/{36c4b4c3eca57417da2c.js → c260ad3434bb00ba64a7.js} +1 -1
- package/assets/esri/core/workers/chunks/{39922ce232338de076ae.js → c459c8d8630eb4b955b1.js} +1 -1
- package/assets/esri/core/workers/chunks/c92e75b79aff7b505b31.js +1 -0
- package/assets/esri/core/workers/chunks/ca85e88dad30b5f2956b.js +1 -0
- package/assets/esri/core/workers/chunks/{8e56d40691b6bf75d7cc.js → ce409944221a784ddb61.js} +1 -1
- package/assets/esri/core/workers/chunks/d13f75f233cf313e5a1d.js +1 -0
- package/assets/esri/core/workers/chunks/d60d5f006375f7fcc88c.js +1 -0
- package/assets/esri/core/workers/chunks/{77958089748dc31757cf.js → d6ded127949160103f69.js} +1 -1
- package/assets/esri/core/workers/chunks/d8c696da42f8f8919b83.js +1 -0
- package/assets/esri/core/workers/chunks/{304c81f6297ecba3a324.js → d95eed98316e59f8f35d.js} +1 -1
- package/assets/esri/core/workers/chunks/df7267892b6e0493e1d7.js +1 -0
- package/assets/esri/core/workers/chunks/{52dca349e1a45555954d.js → e52d5a48e83d8df36f92.js} +1 -1
- package/assets/esri/core/workers/chunks/e8688b6cc3b3c1010b43.js +1 -0
- package/assets/esri/core/workers/chunks/e8c7cc974420c0b92d0e.js +1 -0
- package/assets/esri/core/workers/chunks/{b7ef554b1213307499fc.js → e93442c6d92229f3a4b0.js} +1 -1
- package/assets/esri/core/workers/chunks/{ef5772ca1848d6d01b88.js → eda86faa708cfe4c9f9a.js} +1 -1
- package/assets/esri/core/workers/chunks/f2718e260f594537f7fd.js +1 -0
- package/assets/esri/core/workers/chunks/f6b7036114b1d754fdd9.js +1 -0
- package/assets/esri/core/workers/chunks/{c4631241dc777ca77aaa.js → f6c0680c535c5a3c73ee.js} +1 -1
- package/assets/esri/core/workers/chunks/{a0ea1d3e22d52b8a59a8.js → fa6103e3d4e857b0035b.js} +9 -9
- package/assets/esri/core/workers/chunks/fac3e57784d7f37053af.js +1 -0
- package/assets/esri/geometry/support/pe-wasm.wasm +0 -0
- package/assets/esri/t9n/common.json +1 -1
- package/assets/esri/t9n/common_ar.json +1 -1
- package/assets/esri/t9n/common_bg.json +1 -1
- package/assets/esri/t9n/common_bs.json +1 -1
- package/assets/esri/t9n/common_ca.json +1 -1
- package/assets/esri/t9n/common_cs.json +1 -1
- package/assets/esri/t9n/common_da.json +1 -1
- package/assets/esri/t9n/common_de.json +1 -1
- package/assets/esri/t9n/common_el.json +1 -1
- package/assets/esri/t9n/common_en.json +1 -1
- package/assets/esri/t9n/common_es.json +1 -1
- package/assets/esri/t9n/common_et.json +1 -1
- package/assets/esri/t9n/common_fi.json +1 -1
- package/assets/esri/t9n/common_fr.json +1 -1
- package/assets/esri/t9n/common_he.json +1 -1
- package/assets/esri/t9n/common_hr.json +1 -1
- package/assets/esri/t9n/common_hu.json +1 -1
- package/assets/esri/t9n/common_id.json +1 -1
- package/assets/esri/t9n/common_it.json +1 -1
- package/assets/esri/t9n/common_ja.json +1 -1
- package/assets/esri/t9n/common_ko.json +1 -1
- package/assets/esri/t9n/common_lt.json +1 -1
- package/assets/esri/t9n/common_lv.json +1 -1
- package/assets/esri/t9n/common_nb.json +1 -1
- package/assets/esri/t9n/common_nl.json +1 -1
- package/assets/esri/t9n/common_pl.json +1 -1
- package/assets/esri/t9n/common_pt-BR.json +1 -1
- package/assets/esri/t9n/common_pt-PT.json +1 -1
- package/assets/esri/t9n/common_ro.json +1 -1
- package/assets/esri/t9n/common_ru.json +1 -1
- package/assets/esri/t9n/common_sk.json +1 -1
- package/assets/esri/t9n/common_sl.json +1 -1
- package/assets/esri/t9n/common_sr.json +1 -1
- package/assets/esri/t9n/common_sv.json +1 -1
- package/assets/esri/t9n/common_th.json +1 -1
- package/assets/esri/t9n/common_tr.json +1 -1
- package/assets/esri/t9n/common_uk.json +1 -1
- package/assets/esri/t9n/common_vi.json +1 -1
- package/assets/esri/t9n/common_zh-CN.json +1 -1
- package/assets/esri/t9n/common_zh-HK.json +1 -1
- package/assets/esri/t9n/common_zh-TW.json +1 -1
- package/assets/esri/themes/base/widgets/_DirectionalPad.scss +2 -1
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +0 -1
- 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/chunks/pe-wasm.js +1 -1
- package/config.js +1 -1
- package/core/pbf.js +1 -1
- package/geometry/support/WKIDUnitConversion.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/interfaces.d.ts +37 -39
- package/kernel.js +1 -1
- package/layers/GroupLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/editingSupport.js +1 -1
- package/layers/graphics/sources/WFSSourceWorker.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/support/CSVSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/mixins/OperationalLayer.js +1 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/save/groupLayerUtils.js +5 -0
- package/layers/save/utils.js +1 -1
- package/layers/support/LayerLoadContext.js +5 -0
- package/layers/support/featureLayerUtils.js +1 -1
- package/layers/support/labelFormatUtils.js +1 -1
- package/layers/support/layersCreator.js +1 -1
- package/layers/support/versionUtils.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/portal/support/jsonContext.js +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/portal/support/loadUtils.js +5 -0
- package/portal/support/portalItemUtils.js +1 -1
- package/portal/support/portalLayers.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/rest/print.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/PolygonSymbol3D.js +1 -1
- package/views/2d/engine/imagery/RasterBitmap.js +1 -1
- package/views/2d/engine/imagery/colorizer/shadedrelief.js +1 -1
- package/views/2d/engine/imagery/colorizer/stretch.js +1 -1
- package/views/2d/input/handlers/KeyPan.js +1 -1
- package/views/2d/input/handlers/KeyRotate.js +1 -1
- package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFIndirect.js +1 -1
- package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/i3s/featureEditing.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/input/VisibilityChange.js +5 -0
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/interactive/snapping/FeatureSnappingSourceInfo.js +5 -0
- package/views/interactive/snapping/SnappingContext.js +1 -1
- package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorkerHandle.js +1 -1
- package/views/interactive/snapping/snappingUtils.js +1 -1
- package/webdoc/support/saveUtils.js +1 -1
- package/webdoc/webdocSaveUtils.js +1 -1
- package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
- package/widgets/DirectionalPad/constants.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Editor/Upload.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureForm.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.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/support/DatePicker.js +1 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation2D.js +1 -1
- package/widgets/support/Selector2D.js +1 -1
- package/widgets/support/TimePicker.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/027f8b57565c65fbccda.js +0 -1
- package/assets/esri/core/workers/chunks/048265fb5953350e3e33.js +0 -1
- package/assets/esri/core/workers/chunks/0b9cf14f8aafb76c578b.js +0 -1
- package/assets/esri/core/workers/chunks/0ebf58c927bfc4c9d4fe.js +0 -1
- package/assets/esri/core/workers/chunks/10fd951bd296b2beeeba.js +0 -1
- package/assets/esri/core/workers/chunks/1224475f3eefdfd59c76.js +0 -1
- package/assets/esri/core/workers/chunks/162b0220e24e9ba72655.js +0 -1
- package/assets/esri/core/workers/chunks/1e611cad53b745ee146f.js +0 -1
- package/assets/esri/core/workers/chunks/24b1bf1a5d80f43a6c9a.js +0 -1
- package/assets/esri/core/workers/chunks/29ed31fd4f9d5cf53686.js +0 -1
- package/assets/esri/core/workers/chunks/2b6d1c8e4ed759767827.js +0 -1
- package/assets/esri/core/workers/chunks/34b44b0fab88f838885c.js +0 -1
- package/assets/esri/core/workers/chunks/364f55294a1d7bf163d7.js +0 -1
- package/assets/esri/core/workers/chunks/3714ab435dd5ccf9e694.js +0 -1
- package/assets/esri/core/workers/chunks/3788009a5ece453011f3.js +0 -1
- package/assets/esri/core/workers/chunks/3aafe8160b3bfbaa6935.js +0 -1
- package/assets/esri/core/workers/chunks/41c002e4c42c581cda8d.js +0 -1
- package/assets/esri/core/workers/chunks/47be4c75dd6372b96fe4.js +0 -1
- package/assets/esri/core/workers/chunks/4e8d1e6051f6654a5e83.js +0 -1
- package/assets/esri/core/workers/chunks/53746e9976758630159b.js +0 -1
- package/assets/esri/core/workers/chunks/5449fdd69e12e5cbd12a.js +0 -1
- package/assets/esri/core/workers/chunks/57ce4ece0147afb0d43c.js +0 -1
- package/assets/esri/core/workers/chunks/5e83d21400a5dec05c81.js +0 -1
- package/assets/esri/core/workers/chunks/6047f4487dcd37cca98e.js +0 -1
- package/assets/esri/core/workers/chunks/6967d2b3721678b38774.js +0 -1
- package/assets/esri/core/workers/chunks/6ac5ca7de651e3d672a1.js +0 -1
- package/assets/esri/core/workers/chunks/6b7ee9164149428edb9e.js +0 -1
- package/assets/esri/core/workers/chunks/6c495077cc79e1898927.js +0 -1
- package/assets/esri/core/workers/chunks/6d43648d5326e01b4474.js +0 -1
- package/assets/esri/core/workers/chunks/74fb07de0f990d45af89.js +0 -1
- package/assets/esri/core/workers/chunks/8e9a52062ce059153a89.js +0 -1
- package/assets/esri/core/workers/chunks/919a57d372419785cd5e.js +0 -1
- package/assets/esri/core/workers/chunks/939f0a1a7d605e389e45.js +0 -1
- package/assets/esri/core/workers/chunks/9932f23ba6589df14a3d.js +0 -1
- package/assets/esri/core/workers/chunks/a25a38c9f338e0beffef.js +0 -1
- package/assets/esri/core/workers/chunks/a97581e584336b46ede7.js +0 -1
- package/assets/esri/core/workers/chunks/b1cb932cfadc4dc3f1e4.js +0 -1
- package/assets/esri/core/workers/chunks/be3fb6113b0b27b94537.js +0 -1
- package/assets/esri/core/workers/chunks/c37119f5692e19aa1ce2.js +0 -1
- package/assets/esri/core/workers/chunks/c685f16435d9861bbbd0.js +0 -1
- package/assets/esri/core/workers/chunks/d5dfc03673aec8aa57e2.js +0 -1
- package/assets/esri/core/workers/chunks/e6416a2684866d677b3e.js +0 -1
- package/assets/esri/core/workers/chunks/eb01f4cdb9b918cc61e7.js +0 -1
- package/assets/esri/core/workers/chunks/eb4aed4fdb44495a4fe6.js +0 -1
- package/assets/esri/core/workers/chunks/ec8258c9dc1491e97fc8.js +0 -1
- package/assets/esri/core/workers/chunks/eeac53da496de4cd4182.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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{watch as n}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{formatDate as a,convertDateFormatToIntlOptions as o}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as l,formatNumber as s}from"../../intl/number.js";import u from"../../layers/support/CodedValueDomain.js";import{isEditableLayer as d}from"../../layers/support/editableLayers.js";import{isNumericField as p,validateFieldValue as c,isStringField as m}from"../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as h}from"../../layers/support/layerUtils.js";import f from"../FeatureForm/FieldInput.js";import g from"./Grid/EditorColumn.js";import y from"../support/DatePicker.js";import{dateFieldsWithStringFieldValue as v,getLabelForDateFieldValue as b}from"../support/dateUtils.js";import{legacyIcon as F}from"../support/legacyIcon.js";import _ from"../support/TimePicker.js";import{renderingSanitizer as C}from"../support/widgetUtils.js";const E={cancelEdit:"Escape"},D="esri-field-column",L={headerContent:`${D}__header-content`,headerLabel:`${D}__header-label`,input:`${D}__cell-input`,inputContainer:`${D}__cell__input-container`,dateInputContainer:`${D}__cell__date-input-container`,dateInputWrapper:`${D}__cell__date-input-wrapper`,button:`${D}__button`},w=o("short-date-short-time"),I=o("short-date"),j={useGrouping:!0,maximumFractionDigits:20};let x=class extends g{constructor(e){super(e),this._inputField=null,this.cellValueFormatFunction=({rowData:e,value:t})=>{if(this.formatFunction){const{template:e,field:n}=this;return this.formatFunction({template:e,field:n,value:C.sanitize(t)})}if(null===t)return" ";const{field:n}=this,i=e?.item?.feature,r=this._getDomainForFeature(i);if(r){const e=this._getComputedDomain(t,r);if("date"===n.type&&"range"===r.type)return this._formatDateValueForDisplay(e);if(p(n)&&"range"===r.type){const e=this.template?.format,n=e?l(e):j;return s(parseFloat(t),n)}if(v.has(n.type)&&e){const t=b(n,e);return C.sanitize(t)}return e}if("date"===n.type)return this._formatDateValueForDisplay(t);if(v.has(n.type)&&t){const e=b(n,t);return C.sanitize(e)}if(p(n)){const e=this.template?.format,n=e?l(e):j;return s(parseFloat(t),n)}return C.sanitize(t)},this.cellValueValidatorFunction=({oldValue:e,value:n})=>{const{_inputField:i,field:r}=this;return!(i&&!i.valid)&&((!this.required||null!=n&&""!==n)&&(p(r)&&c(r,n)?(t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1):e!==n))},this.editingEnabled=!1,this.expressionInfos=null,this.field=null,this.formatFunction=null,this.headerRenderFunction=e=>{const{root:t}=e,{editable:n,editingEnabled:i,headerMenuEnabled:r,sortable:a}=this;if(this.removeCellContent(t),t.classList.add(L.headerContent),i&&!n&&t.appendChild(this.createLockedElement()),a)this.headerSorterRenderFunction(e);else{const e=document.createElement("div");e.classList.add(L.headerLabel),e.textContent=this.label,t.appendChild(e)}r&&this.headerMenuRenderFunction(e)},this.inputRenderFunction=({root:e,column:n,rowData:i})=>{if(this.activeEditInfo?.updating||!this.editable)return;const r=this.getCellValue(n,i),{field:a}=this;if(p(a)&&c(a,r))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const o=this.createInputElement({root:e,column:n,rowData:i,value:r});if(this._set("activeEditInfo",{column:n,input:o,root:e,rowData:i,updating:!0,oldValue:r}),"date"===this.field.type)return void this._renderDateEditors(r,e,o);const l=this.createInputContainer();l.appendChild(o),this.removeCellContent(e),e.appendChild(l),o.focus(),o instanceof HTMLInputElement&&o.select(),this.grid?.notifyResize()},this.layer=null,this.parseInputValueFunction=({input:e})=>{const t=this._inputField;if(!t)return null;const n=e.value,{dataType:i,required:r}=t;return r||""!==n?"number"===i||"date"===i?parseFloat(n):"text"===i?n.trim():n:null},this.store=null,this.template=null,this.updateRowItemFunction=({rowData:e,column:t,value:n})=>{e&&(e.item.feature.attributes[t.path]=n)},this.updateStoreItemFunction=async({rowData:e,column:t,value:n})=>{if(!e||!this.store)return;const i=e.item.objectId,r=this.store.getObjectIdIndex(i)??e.index;await this.store.updateItem({index:r,name:t.path,value:n})}}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get description(){return this.template?.description??this.field?.description??null}get editable(){const{editingEnabled:e,field:t,layer:n,template:i}=this;if(null==t||null==n)return!1;const r=d(n),a=h(n),o=a?.operations.supportsUpdate;return!!(t.editable&&r&&o)&&(!v.has(t.type)&&(e?!(!1===i?.editable):!!i?.editable))}get header(){return this.template?.label||this.alias||this.path||null}get hidden(){const{template:e}=this;return!1===e?.visible||this._get("hidden")||!1}set hidden(e){this._set("hidden",e)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,n=e?.length,i=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=i&&!isNaN(i)&&i>=-1&&(-1===n||i<=n)?i:n}get minLength(){const{template:e,maxLength:t}=this,n=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&n<=t?n:null}get name(){return this.field?.name}get nullable(){return this.field?.nullable??!1}get path(){return this.field?.name}get required(){const{field:e,template:t}=this,n=e?.nullable,i=t?.required;return this.editable&&(!n||!0===i)}get sortable(){return!(!1===this.template?.sortable)}createInputElement({rowData:e,value:t}){const n=e?.item;if(!n?.feature)return null;this._inputField=this._setUpInputField(n.feature,t);const{field:i,maxLength:r,minLength:a,required:o}=this,{domain:l}=this._inputField;let s;"coded-value"===l?.type?(s=this._createSelectElement(t,l.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),this._inputField),s.onchange=()=>{s.onblur=null,d()}):(s=document.createElement("input"),s.type=p(i)?"number":"text",r>-1&&(s.maxLength=r),a>0&&(s.minLength=a)),s.classList.add(L.input),s.value=t,s.required=o;let u=!1;s.onkeydown=e=>{u=e.key===E.cancelEdit},s.onblur=()=>{s.onblur=null,d()};const d=()=>{u?this.cancel():this.submit(),this._inputField=null};return s}createInputContainer(){const e=document.createElement("div");return e.classList.add(L.inputContainer),e}createLockedElement(){const e=document.createElement("div");return e.classList.add(F.locked),e}getCellValue({path:e},t){return t?.item?.feature?.attributes?.[e]??null}_formatDateValueForDisplay(e){const t=this.layer,n=this._getDateFormatOptions(),i="feature"===t?.type&&t.datesInUnknownTimezone?{timeZone:"UTC"}:null;return null!=e?a(e,{...n,...i}):null}_renderDateEditors(e,t,i){const{messagesCommon:r,template:a}=this,o=e?new Date(e):new Date(Date.now()),l=new y({dateInputEnabled:!0,value:o}),s=new _({value:o});i.value=o.getTime().toString();let u=!e;const d=()=>{u=!0;const e=this._getCombinedDateTime(l.value,s.value);i.value=e.getTime().toString()},p=()=>{u?this.submit():this.cancel()},c=()=>{i.value=null,this.submit()};n((()=>[l.value,s.value]),(()=>d()));const m=document.createElement("div"),h=document.createElement("div");l.container=m,s.container=h;const f=document.createElement("button");f.classList.add(L.button,F.save),f.onclick=()=>p(),f.title=r?.save;const g=document.createElement("button");g.classList.add(L.button,F.trash),g.onclick=()=>c(),g.title=r?.clear;const v=document.createElement("div");v.classList.add(L.dateInputWrapper),v.appendChild(m),a?.input&&"datetime-picker"===a.input.type&&!1!==a.input.includeTime&&v.appendChild(h);const b=document.createElement("div");b.classList.add(L.dateInputContainer),b.appendChild(v),b.appendChild(f),b.appendChild(g),l.when((()=>{const e=l._inputOrButtonNode;e&&(e.onblur=e=>{const t=e.relatedTarget;t&&t.className.includes("esri-date-picker")||l.close(!1)}),this.grid?.notifyResize()})),s.when((()=>this.grid?.notifyResize())),this.removeCellContent(t),t.appendChild(b),this.grid?.notifyResize()}_createSelectElement(e,t,n){let i=!1;const r=t.map((t=>{t.value===e&&(i=!0);const n=document.createElement("option");return n.text=t.name,n.value=t.value,n}));if(null!=e&&""!==e&&!i){const t=document.createElement("option");t.text=e,t.value=e,r.unshift(t)}if(!n.required&&null==n.value){const e=document.createElement("option");e.value="",r.unshift(e)}const a=document.createElement("select");return r.forEach((e=>a.add(e))),a.value=e,a}_setUpInputField(e,t){const{field:n,layer:i}=this,r=new f({feature:e,initialFeature:e.clone(),field:n,layer:i});return r.set("value",t),r}_isDomainCompatible(e){const{field:t}=this;if(e&&"coded-value"===e.type){const n=typeof e.codedValues[0].code;if("string"===n&&m(t)||"number"===n&&p(t))return!0}return!(!e||"range"!==e.type||!p(t))}_getDomainForFeature(e){const{layer:t,name:n,template:i}=this;if(!t)return null;if("wfs"===t.type||"geojson"===t.type||"csv"===t.type)return null;if(i?.domain&&this._isDomainCompatible(i.domain))return i.domain;const{typeIdField:r}=t,a=r===n,o=this.field.domain;if(a&&!o)return new u({name:"__internal-type-based-coded-value-domain__",codedValues:t.types?.map((({id:e,name:t})=>({code:e,name:t})))});return r&&null!=n&&t.getFieldDomain(n,{feature:e})||o}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const n=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return n&&n.length?n[0].name:e}return null}_getCombinedDateTime(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds())}_getDateFormatOptions(){const{template:e}=this,t=e?.format?.dateFormat;return t?o(t):e?.input&&"includeTime"in e.input==!1?I:w}};e([i({readOnly:!0})],x.prototype,"alias",null),e([i()],x.prototype,"cellValueFormatFunction",void 0),e([i()],x.prototype,"cellValueValidatorFunction",void 0),e([i({readOnly:!0})],x.prototype,"defaultValue",null),e([i({readOnly:!0})],x.prototype,"description",null),e([i({readOnly:!0})],x.prototype,"editable",null),e([i()],x.prototype,"editingEnabled",void 0),e([i()],x.prototype,"expressionInfos",void 0),e([i()],x.prototype,"field",void 0),e([i()],x.prototype,"formatFunction",void 0),e([i({readOnly:!0})],x.prototype,"header",null),e([i()],x.prototype,"hidden",null),e([i()],x.prototype,"headerRenderFunction",void 0),e([i()],x.prototype,"inputRenderFunction",void 0),e([i()],x.prototype,"layer",void 0),e([i({readOnly:!0})],x.prototype,"loadingMessage",null),e([i()],x.prototype,"maxLength",null),e([i()],x.prototype,"minLength",null),e([i({readOnly:!0})],x.prototype,"name",null),e([i({readOnly:!0})],x.prototype,"nullable",null),e([i()],x.prototype,"parseInputValueFunction",void 0),e([i({readOnly:!0})],x.prototype,"path",null),e([i({readOnly:!0})],x.prototype,"required",null),e([i()],x.prototype,"sortable",null),e([i()],x.prototype,"store",void 0),e([i()],x.prototype,"template",void 0),e([i()],x.prototype,"updateRowItemFunction",void 0),e([i()],x.prototype,"updateStoreItemFunction",void 0),x=e([r("esri.widgets.FeatureTable.FieldColumn")],x);const V=x;export{V as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Logger.js";import{watch as n}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import{convertDateFormatToIntlOptions as a}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as o,formatNumber as l}from"../../intl/number.js";import s from"../../layers/support/CodedValueDomain.js";import{isEditableLayer as u}from"../../layers/support/editableLayers.js";import{isNumericField as d,validateFieldValue as p,isStringField as c}from"../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as m}from"../../layers/support/layerUtils.js";import h from"../FeatureForm/FieldInput.js";import f from"./Grid/EditorColumn.js";import g from"../support/DatePicker.js";import{dateFieldsWithStringFieldValue as y,getLabelForDateFieldValue as v}from"../support/dateUtils.js";import{legacyIcon as b}from"../support/legacyIcon.js";import F from"../support/TimePicker.js";import{renderingSanitizer as _}from"../support/widgetUtils.js";const C={cancelEdit:"Escape"},E="esri-field-column",D={headerContent:`${E}__header-content`,headerLabel:`${E}__header-label`,input:`${E}__cell-input`,inputContainer:`${E}__cell__input-container`,dateInputContainer:`${E}__cell__date-input-container`,dateInputWrapper:`${E}__cell__date-input-wrapper`,button:`${E}__button`},L=a("short-date-short-time"),w=a("short-date"),I={useGrouping:!0,maximumFractionDigits:20};let j=class extends f{constructor(e){super(e),this._inputField=null,this.cellValueFormatFunction=({rowData:e,value:t})=>{if(this.formatFunction){const{template:e,field:n}=this;return this.formatFunction({template:e,field:n,value:_.sanitize(t)})}if(null===t)return" ";const{field:n}=this,i=e?.item?.feature,r=this._getDomainForFeature(i);if(r){const e=this._getComputedDomain(t,r);if("date"===n.type&&"range"===r.type)return this._formatDateValueForDisplay(n,e);if(d(n)&&"range"===r.type){const e=this.template?.format,n=e?o(e):I;return l(parseFloat(t),n)}return y.has(n.type)?"range"===r.type?_.sanitize(v(n,e)):_.sanitize(e):e}if("date"===n.type||y.has(n.type))return this._formatDateValueForDisplay(n,t);if(d(n)){const e=this.template?.format,n=e?o(e):I;return l(parseFloat(t),n)}return _.sanitize(t)},this.cellValueValidatorFunction=({oldValue:e,value:n})=>{const{_inputField:i,field:r}=this;return!(i&&!i.valid)&&((!this.required||null!=n&&""!==n)&&(d(r)&&p(r,n)?(t.getLogger(this).warn("value-exceeds-valid-range","Field value exceeds valid range. Attempted edit was rejected."),!1):e!==n))},this.editingEnabled=!1,this.expressionInfos=null,this.field=null,this.formatFunction=null,this.headerRenderFunction=e=>{const{root:t}=e,{editable:n,editingEnabled:i,headerMenuEnabled:r,sortable:a}=this;if(this.removeCellContent(t),t.classList.add(D.headerContent),i&&!n&&t.appendChild(this.createLockedElement()),a)this.headerSorterRenderFunction(e);else{const e=document.createElement("div");e.classList.add(D.headerLabel),e.textContent=this.label,t.appendChild(e)}r&&this.headerMenuRenderFunction(e)},this.inputRenderFunction=({root:e,column:n,rowData:i})=>{if(this.activeEditInfo?.updating||!this.editable)return;const r=this.getCellValue(n,i),{field:a}=this;if(d(a)&&p(a,r))return void t.getLogger(this).warn("value-exceeds-valid-range","Field value is beyond supported limit. Editing is disabled for this field value.");const o=this.createInputElement({root:e,column:n,rowData:i,value:r});if(this._set("activeEditInfo",{column:n,input:o,root:e,rowData:i,updating:!0,oldValue:r}),"date"===this.field.type)return void this._renderDateEditors(r,e,o);const l=this.createInputContainer();l.appendChild(o),this.removeCellContent(e),e.appendChild(l),o.focus(),o instanceof HTMLInputElement&&o.select(),this.grid?.notifyResize()},this.layer=null,this.parseInputValueFunction=({input:e})=>{const t=this._inputField;if(!t)return null;const n=e.value,{dataType:i,required:r}=t;return r||""!==n?"number"===i||"date"===i?parseFloat(n):"text"===i?n.trim():n:null},this.store=null,this.template=null,this.updateRowItemFunction=({rowData:e,column:t,value:n})=>{e&&(e.item.feature.attributes[t.path]=n)},this.updateStoreItemFunction=async({rowData:e,column:t,value:n})=>{if(!e||!this.store)return;const i=e.item.objectId,r=this.store.getObjectIdIndex(i)??e.index;await this.store.updateItem({index:r,name:t.path,value:n})}}get alias(){return this.field?.alias}get defaultValue(){return this.field?.defaultValue}get description(){return this.template?.description??this.field?.description??null}get editable(){const{editingEnabled:e,field:t,layer:n,template:i}=this;if(null==t||null==n)return!1;const r=u(n),a=m(n),o=a?.operations.supportsUpdate;return!!(t.editable&&r&&o)&&(!y.has(t.type)&&(e?!(!1===i?.editable):!!i?.editable))}get header(){return this.template?.label||this.alias||this.path||null}get hidden(){const{template:e}=this;return!1===e?.visible||this._get("hidden")||!1}set hidden(e){this._set("hidden",e)}get loadingMessage(){return this.messages?.loading||"..."}get maxLength(){const{field:e,template:t}=this,n=e?.length,i=t?.input&&"maxLength"in t.input?t.input.maxLength:null;return null!=i&&!isNaN(i)&&i>=-1&&(-1===n||i<=n)?i:n}get minLength(){const{template:e,maxLength:t}=this,n=e?.input&&"minLength"in e.input?e.input.minLength:null;return t&&n<=t?n:null}get name(){return this.field?.name}get nullable(){return this.field?.nullable??!1}get path(){return this.field?.name}get required(){const{field:e,template:t}=this,n=e?.nullable,i=t?.required;return this.editable&&(!n||!0===i)}get sortable(){return!(!1===this.template?.sortable)}createInputElement({rowData:e,value:t}){const n=e?.item;if(!n?.feature)return null;this._inputField=this._setUpInputField(n.feature,t);const{field:i,maxLength:r,minLength:a,required:o}=this,{domain:l}=this._inputField;let s;"coded-value"===l?.type?(s=this._createSelectElement(t,l.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),this._inputField),s.onchange=()=>{s.onblur=null,p()}):(s=document.createElement("input"),s.type=d(i)?"number":"text",r>-1&&(s.maxLength=r),a>0&&(s.minLength=a)),s.classList.add(D.input),s.value=t,s.required=o;let u=!1;s.onkeydown=e=>{u=e.key===C.cancelEdit},s.onblur=()=>{s.onblur=null,p()};const p=()=>{u?this.cancel():this.submit(),this._inputField=null};return s}createInputContainer(){const e=document.createElement("div");return e.classList.add(D.inputContainer),e}createLockedElement(){const e=document.createElement("div");return e.classList.add(b.locked),e}getCellValue({path:e},t){return t?.item?.feature?.attributes?.[e]??null}_formatDateValueForDisplay(e,t){const{timeZone:n,timeZoneName:i}=this;return null!=t?v(e,t,{...this._getDateFormatOptions(),timeZone:n??void 0,timeZoneName:i??void 0}):null}_renderDateEditors(e,t,i){const{messagesCommon:r,template:a,timeZone:o}=this,l=e?new Date(e):new Date(Date.now()),s=new g({dateInputEnabled:!0,timeZone:o,value:l}),u=new F({timeZone:o,value:l});i.value=l.getTime().toString();let d=!e;const p=()=>{d=!0;const e=this._getCombinedDateTime(s.value,u.value);i.value=e.getTime().toString()},c=()=>{d?this.submit():this.cancel()},m=()=>{i.value=null,this.submit()};n((()=>[s.value,u.value]),(()=>p()));const h=document.createElement("div"),f=document.createElement("div");s.container=h,u.container=f;const y=document.createElement("button");y.classList.add(D.button,b.save),y.onclick=()=>c(),y.title=r?.save;const v=document.createElement("button");v.classList.add(D.button,b.trash),v.onclick=()=>m(),v.title=r?.clear;const _=document.createElement("div");_.classList.add(D.dateInputWrapper),_.appendChild(h),(!a||a?.input&&"datetime-picker"===a.input.type&&!1!==a.input.includeTime)&&_.appendChild(f);const C=document.createElement("div");C.classList.add(D.dateInputContainer),C.appendChild(_),C.appendChild(y),C.appendChild(v),s.when((()=>{const e=s._inputOrButtonNode;e&&(e.onblur=e=>{const t=e.relatedTarget;t&&t.className.includes("esri-date-picker")||s.close(!1)}),this.grid?.notifyResize()})),u.when((()=>this.grid?.notifyResize())),this.removeCellContent(t),t.appendChild(C),this.grid?.notifyResize()}_createSelectElement(e,t,n){let i=!1;const r=t.map((t=>{t.value===e&&(i=!0);const n=document.createElement("option");return n.text=t.name,n.value=t.value,n}));if(null!=e&&""!==e&&!i){const t=document.createElement("option");t.text=e,t.value=e,r.unshift(t)}if(!n.required&&null==n.value){const e=document.createElement("option");e.value="",r.unshift(e)}const a=document.createElement("select");return r.forEach((e=>a.add(e))),a.value=e,a}_setUpInputField(e,t){const{field:n,layer:i}=this,r=new h({feature:e,initialFeature:e.clone(),field:n,layer:i});return r.set("value",t),r}_isDomainCompatible(e){const{field:t}=this;if(e&&"coded-value"===e.type){const n=typeof e.codedValues[0].code;if("string"===n&&c(t)||"number"===n&&d(t))return!0}return!(!e||"range"!==e.type||!d(t))}_getDomainForFeature(e){const{layer:t,name:n,template:i}=this;if(!t)return null;if("wfs"===t.type||"geojson"===t.type||"csv"===t.type)return null;if(i?.domain&&this._isDomainCompatible(i.domain))return i.domain;const{typeIdField:r}=t,a=r===n,o=this.field.domain;if(a&&!o)return new s({name:"__internal-type-based-coded-value-domain__",codedValues:t.types?.map((({id:e,name:t})=>({code:e,name:t})))});return r&&null!=n&&t.getFieldDomain(n,{feature:e})||o}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const n=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return n&&n.length?n[0].name:e}return null}_getCombinedDateTime(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds())}_getDateFormatOptions(){const{template:e}=this,t=e?.format?.dateFormat;return t?a(t):e?.input&&"includeTime"in e.input&&!1===e.input.includeTime?w:L}};e([i({readOnly:!0})],j.prototype,"alias",null),e([i()],j.prototype,"cellValueFormatFunction",void 0),e([i()],j.prototype,"cellValueValidatorFunction",void 0),e([i({readOnly:!0})],j.prototype,"defaultValue",null),e([i({readOnly:!0})],j.prototype,"description",null),e([i({readOnly:!0})],j.prototype,"editable",null),e([i()],j.prototype,"editingEnabled",void 0),e([i()],j.prototype,"expressionInfos",void 0),e([i()],j.prototype,"field",void 0),e([i()],j.prototype,"formatFunction",void 0),e([i({readOnly:!0})],j.prototype,"header",null),e([i()],j.prototype,"hidden",null),e([i()],j.prototype,"headerRenderFunction",void 0),e([i()],j.prototype,"inputRenderFunction",void 0),e([i()],j.prototype,"layer",void 0),e([i({readOnly:!0})],j.prototype,"loadingMessage",null),e([i()],j.prototype,"maxLength",null),e([i()],j.prototype,"minLength",null),e([i({readOnly:!0})],j.prototype,"name",null),e([i({readOnly:!0})],j.prototype,"nullable",null),e([i()],j.prototype,"parseInputValueFunction",void 0),e([i({readOnly:!0})],j.prototype,"path",null),e([i({readOnly:!0})],j.prototype,"required",null),e([i()],j.prototype,"sortable",null),e([i()],j.prototype,"store",void 0),e([i()],j.prototype,"template",void 0),e([i()],j.prototype,"updateRowItemFunction",void 0),e([i()],j.prototype,"updateStoreItemFunction",void 0),j=e([r("esri.widgets.FeatureTable.FieldColumn")],j);const x=j;export{x 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Evented.js";import{watch as o}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import n from"./support/ButtonMenu.js";import{legacyIcon as s}from"../../support/legacyIcon.js";import{renderingSanitizer as l}from"../../support/widgetUtils.js";const a="esri-column",d={menuContainer:`${a}__menu-container`,sorter:`${a}__sorter`,headerContent:`${a}__header-content`,headerLabel:`${a}__header-label`},h={keyboardSort1:"Enter",keyboardSort2:"Spacebar"};let c=class extends e.EventedAccessor{constructor(t){super(t),this._menuContainer=document.createElement("div"),this.activeRowIndex=null,this.autoWidth=!1,this.cellValueFormatFunction=({value:t})=>l.sanitize(t),this.flexGrow=1,this.footerRenderFunction=null,this.frozen=!1,this.grid=null,this.header=null,this.headerRenderFunction=t=>{const{root:e}=t;if(this.removeCellContent(e),e.classList.add(d.headerContent),this.sortable)this.headerSorterRenderFunction(t);else{const t=document.createElement("div");t.classList.add(d.headerLabel),t.textContent=this.label,e.appendChild(t)}this.headerMenuEnabled&&this.headerMenuRenderFunction(t)},this.headerMenuRenderFunction=({root:t})=>{this.menu?.items?.length&&t.appendChild(this._menuContainer)},this.headerSorterRenderFunction=({root:t})=>{const{label:e,sortElement:o}=this;if(!o)return void(t.textContent=e);o.textContent!==e&&o.setAttribute("textContent",e),t.appendChild(o);const i=this.grid?.getSlotElementByName(t.slot),r=i?.parentElement;r&&!r.onkeydown&&(r.onkeydown=({key:t})=>{t!==h.keyboardSort1&&t!==h.keyboardSort2||o.click()})},this.hidden=!1,this.headerMenuEnabled=!0,this.initialSortPriority=null,this.menu=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.path=null,this.renderFunction=({root:t,column:e,rowData:o})=>{const i=this.getCellValue(e,o),r=this.cellValueFormatFunction({column:e,rowData:o,value:i});t.innerHTML!==r&&(t.innerHTML=r)},this.resizable=!0,this.sortable=!0,this.textAlign="start",this.width=200}initialize(){const{messages:t,path:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e??""),this._menuContainer.classList.add(d.menuContainer),this.menu=new n({label:t?.options,iconClass:s.handleHorizontal,...this.menuConfig}),this.menu.container=this._menuContainer,this.menu.set("items",this.getMenuItems()),this.addHandles([o((()=>this.hidden),(()=>this.menu?.set("open",!1))),o((()=>this.path),(t=>{this.sortElement&&this.sortElement.path!==t&&this.sortElement.setAttribute("path",t??"")}))])}destroy(){this.menu?.destroy()}set direction(t){this.sortable&&(this.sortElement&&(t?this.sortElement.direction!==t&&this.sortElement.setAttribute("direction",t):this.sortElement.removeAttribute("direction")),this._set("direction",t))}get direction(){return this._get("direction")||null}get label(){return l.sanitize(this.header??this.path??"")}getMenuItems(){const{menuConfig:t,sortable:e}=this,o=t?.items,i=this.getSortMenuItems(),r=[];return e&&r.push(...i),o?.length&&r.push(...o),r.length?r:null}getSortMenuItems(){const{messages:t}=this;return[{selected:"asc"===this.direction,iconClass:s.arrowUp,label:t?.sortAsc,autoCloseMenu:!0,clickFunction:()=>this.set("direction","asc"!==this.direction?"asc":null)},{selected:"desc"===this.direction,iconClass:s.arrowDown,label:t?.sortDesc,autoCloseMenu:!0,clickFunction:()=>this.set("direction","desc"!==this.direction?"desc":null)}]}getCellValue(t,e){return e?.item[t?.path]??""}createSortElement(){const{direction:t,label:e,path:o,initialSortPriority:i}=this,r=document.createElement("vaadin-grid-sorter");return r.classList.add(d.sorter),r.setAttribute("path",o??""),r.setAttribute("title",e),r.textContent=e,t&&r.setAttribute("direction",t),null!=i&&(r._initialOrder=i),r.addEventListener("direction-changed",(()=>{this.direction!==r.direction&&this._set("direction",r.direction)})),r}removeCellContent(t){if(t)for(;t.firstChild;)try{t.removeChild(t.firstChild)}catch(e){}}};t([i()],c.prototype,"activeRowIndex",void 0),t([i()],c.prototype,"autoWidth",void 0),t([i()],c.prototype,"cellValueFormatFunction",void 0),t([i()],c.prototype,"direction",null),t([i()],c.prototype,"flexGrow",void 0),t([i()],c.prototype,"footerRenderFunction",void 0),t([i()],c.prototype,"frozen",void 0),t([i()],c.prototype,"grid",void 0),t([i()],c.prototype,"header",void 0),t([i()],c.prototype,"headerRenderFunction",void 0),t([i()],c.prototype,"headerMenuRenderFunction",void 0),t([i()],c.prototype,"headerSorterRenderFunction",void 0),t([i()],c.prototype,"hidden",void 0),t([i()],c.prototype,"headerMenuEnabled",void 0),t([i({constructOnly:!0})],c.prototype,"initialSortPriority",void 0),t([i({readOnly:!0})],c.prototype,"label",null),t([i()],c.prototype,"menu",void 0),t([i()],c.prototype,"menuConfig",void 0),t([i()],c.prototype,"messages",void 0),t([i()],c.prototype,"messagesCommon",void 0),t([i()],c.prototype,"messagesURIUtils",void 0),t([i()],c.prototype,"path",void 0),t([i()],c.prototype,"renderFunction",void 0),t([i()],c.prototype,"resizable",void 0),t([i()],c.prototype,"sortable",void 0),t([i({readOnly:!0})],c.prototype,"sortElement",void 0),t([i()],c.prototype,"textAlign",void 0),t([i()],c.prototype,"width",void 0),c=t([r("esri.widgets.FeatureTable.Grid.Column")],c);const u=c;export{u as default};
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Evented.js";import{watch as o}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import n from"./support/ButtonMenu.js";import{legacyIcon as s}from"../../support/legacyIcon.js";import{renderingSanitizer as l}from"../../support/widgetUtils.js";const a="esri-column",d={menuContainer:`${a}__menu-container`,sorter:`${a}__sorter`,headerContent:`${a}__header-content`,headerLabel:`${a}__header-label`},h={keyboardSort1:"Enter",keyboardSort2:"Spacebar"};let c=class extends e.EventedAccessor{constructor(t){super(t),this._menuContainer=document.createElement("div"),this.activeRowIndex=null,this.autoWidth=!1,this.cellValueFormatFunction=({value:t})=>l.sanitize(t),this.flexGrow=1,this.footerRenderFunction=null,this.frozen=!1,this.grid=null,this.header=null,this.headerRenderFunction=t=>{const{root:e}=t;if(this.removeCellContent(e),e.classList.add(d.headerContent),this.sortable)this.headerSorterRenderFunction(t);else{const t=document.createElement("div");t.classList.add(d.headerLabel),t.textContent=this.label,e.appendChild(t)}this.headerMenuEnabled&&this.headerMenuRenderFunction(t)},this.headerMenuRenderFunction=({root:t})=>{this.menu?.items?.length&&t.appendChild(this._menuContainer)},this.headerSorterRenderFunction=({root:t})=>{const{label:e,sortElement:o}=this;if(!o)return void(t.textContent=e);o.textContent!==e&&o.setAttribute("textContent",e),t.appendChild(o);const i=this.grid?.getSlotElementByName(t.slot),r=i?.parentElement;r&&!r.onkeydown&&(r.onkeydown=({key:t})=>{t!==h.keyboardSort1&&t!==h.keyboardSort2||o.click()})},this.hidden=!1,this.headerMenuEnabled=!0,this.initialSortPriority=null,this.menu=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.path=null,this.renderFunction=({root:t,column:e,rowData:o})=>{const i=this.getCellValue(e,o),r=this.cellValueFormatFunction({column:e,rowData:o,value:i});t.innerHTML!==r&&(t.innerHTML=r)},this.resizable=!0,this.sortable=!0,this.textAlign="start",this.timeZone=null,this.timeZoneName=null,this.width=200}initialize(){const{messages:t,path:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e??""),this._menuContainer.classList.add(d.menuContainer),this.menu=new n({label:t?.options,iconClass:s.handleHorizontal,...this.menuConfig}),this.menu.container=this._menuContainer,this.menu.set("items",this.getMenuItems()),this.addHandles([o((()=>this.hidden),(()=>this.menu?.set("open",!1))),o((()=>this.path),(t=>{this.sortElement&&this.sortElement.path!==t&&this.sortElement.setAttribute("path",t??"")}))])}destroy(){this.menu?.destroy()}set direction(t){this.sortable&&(this.sortElement&&(t?this.sortElement.direction!==t&&this.sortElement.setAttribute("direction",t):this.sortElement.removeAttribute("direction")),this._set("direction",t))}get direction(){return this._get("direction")||null}get label(){return l.sanitize(this.header??this.path??"")}getMenuItems(){const{menuConfig:t,sortable:e}=this,o=t?.items,i=this.getSortMenuItems(),r=[];return e&&r.push(...i),o?.length&&r.push(...o),r.length?r:null}getSortMenuItems(){const{messages:t}=this;return[{selected:"asc"===this.direction,iconClass:s.arrowUp,label:t?.sortAsc,autoCloseMenu:!0,clickFunction:()=>this.set("direction","asc"!==this.direction?"asc":null)},{selected:"desc"===this.direction,iconClass:s.arrowDown,label:t?.sortDesc,autoCloseMenu:!0,clickFunction:()=>this.set("direction","desc"!==this.direction?"desc":null)}]}getCellValue(t,e){return e?.item[t?.path]??""}createSortElement(){const{direction:t,label:e,path:o,initialSortPriority:i}=this,r=document.createElement("vaadin-grid-sorter");return r.classList.add(d.sorter),r.setAttribute("path",o??""),r.setAttribute("title",e),r.textContent=e,t&&r.setAttribute("direction",t),null!=i&&(r._initialOrder=i),r.addEventListener("direction-changed",(()=>{this.direction!==r.direction&&this._set("direction",r.direction)})),r}removeCellContent(t){if(t)for(;t.firstChild;)try{t.removeChild(t.firstChild)}catch(e){}}};t([i()],c.prototype,"activeRowIndex",void 0),t([i()],c.prototype,"autoWidth",void 0),t([i()],c.prototype,"cellValueFormatFunction",void 0),t([i()],c.prototype,"direction",null),t([i()],c.prototype,"flexGrow",void 0),t([i()],c.prototype,"footerRenderFunction",void 0),t([i()],c.prototype,"frozen",void 0),t([i()],c.prototype,"grid",void 0),t([i()],c.prototype,"header",void 0),t([i()],c.prototype,"headerRenderFunction",void 0),t([i()],c.prototype,"headerMenuRenderFunction",void 0),t([i()],c.prototype,"headerSorterRenderFunction",void 0),t([i()],c.prototype,"hidden",void 0),t([i()],c.prototype,"headerMenuEnabled",void 0),t([i({constructOnly:!0})],c.prototype,"initialSortPriority",void 0),t([i({readOnly:!0})],c.prototype,"label",null),t([i()],c.prototype,"menu",void 0),t([i()],c.prototype,"menuConfig",void 0),t([i()],c.prototype,"messages",void 0),t([i()],c.prototype,"messagesCommon",void 0),t([i()],c.prototype,"messagesURIUtils",void 0),t([i()],c.prototype,"path",void 0),t([i()],c.prototype,"renderFunction",void 0),t([i()],c.prototype,"resizable",void 0),t([i()],c.prototype,"sortable",void 0),t([i({readOnly:!0})],c.prototype,"sortElement",void 0),t([i()],c.prototype,"textAlign",void 0),t([i()],c.prototype,"timeZone",void 0),t([i()],c.prototype,"timeZoneName",void 0),t([i()],c.prototype,"width",void 0),c=t([r("esri.widgets.FeatureTable.Grid.Column")],c);const u=c;export{u as default};
|
package/widgets/FeatureTable.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{deprecatedFunction as t}from"../core/deprecate.js";import i from"../core/Logger.js";import{on as l,watch as s}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{cast as n}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import d from"./FeatureTable/FeatureTableViewModel.js";import h from"./FeatureTable/Grid/support/ButtonMenu.js";import c from"./FeatureTable/Grid/support/ButtonMenuItem.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{Heading as g}from"./support/Heading.js";import{legacyIcon as p}from"./support/legacyIcon.js";import"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{tsx as v}from"./support/jsxFactory.js";import{substitute as w}from"../intl/substitute.js";const M={header:!0,menu:!0,menuItems:{clearSelection:!0,refreshData:!0,toggleColumns:!0,selectedRecordsShowAllToggle:!0,selectedRecordsShowSelectedToggle:!0,zoomToSelection:!0,deleteSelection:!0},selectionColumn:!0,columnMenus:!0},y="esri-feature-table",_=`${y}__prompt`,f={base:y,header:`${y}__header`,title:`${y}__title`,content:`${y}__content`,loader:`${y}__loader`,loaderContainer:`${y}__loader-container`,menuContainer:`${y}__menu`,promptContainer:_,promptHeader:`${_}__header`,promptHeading:`${_}__header__heading`,promptMessage:`${_}__message`,promptDivider:`${_}__divider`,promptActions:`${_}__actions`},E=i.getLogger("esri.widgets.FeatureTable");let S=class extends a{constructor(e,t){super(e,t),this._prompt=null,this.menu=null,this.menuConfig=null,this.viewModel=new d,this.visibleElements={...M},this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([l((()=>this.viewModel.columns),"change",(()=>this._syncMenuConfig())),l((()=>this.viewModel.activeFilters),"change",(()=>this._syncMenuConfig())),l((()=>this.highlightIds),"change",(e=>{this._syncMenuConfig(),this._onSelectionChange(e)})),s((()=>[this.viewModel.store.querying,this.viewModel.store.syncing,this.editingEnabled]),(()=>this.scheduleRender())),s((()=>[this.menuConfig,this.editingEnabled]),(()=>this._syncMenuConfig())),s((()=>this.messages),(()=>{this.menu&&(this.menu.label=this.messages?.options),this._syncMenuConfig()}))]),this._set("menu",new h({label:this.messages?.options,iconClass:p.handleHorizontal,...this.menuConfig}));const{attachmentsEnabled:e,relatedRecordsEnabled:t}=this;this.viewModel?.store?.set({attachmentsEnabled:e,relatedRecordsEnabled:t})}loadDependencies(){return m({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js")})}destroy(){this._prompt=null,this.menu?.destroy()}get activeFilters(){return this.viewModel.activeFilters}get activeSortOrders(){return this.viewModel.activeSortOrders}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get grid(){return this.viewModel.grid}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get highlightOnRowSelectEnabled(){return this.viewModel.highlightEnabled}set highlightOnRowSelectEnabled(e){this.viewModel.highlightEnabled=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get messages(){return this.viewModel.messages}set messages(e){this.viewModel.messages=e}get messagesCommon(){return this.viewModel.messagesCommon}set messagesCommon(e){this.viewModel.messagesCommon=e}get messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get state(){return this.viewModel.state}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){const t={...M,...e};return this.grid?.set("visibleElements",{...this.grid.visibleElements,selectionColumn:t.selectionColumn,columnMenus:t.columnMenus}),t}clearHighlights(){return t(E,"`FeatureTable.clearHighlights` is deprecated in favor of FeatureTable.highlightIds'",{replacement:"FeatureTable.highlightIds",version:"4.25",see:"https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html#highlightIds"}),this.viewModel.clearHighlights()}clearSelection(){return t(E,"`FeatureTable.clearSelection` is deprecated in favor of FeatureTable.highlightIds'",{replacement:"FeatureTable.highlightIds",version:"4.25",see:"https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html#highlightIds"}),this.viewModel.clearSelection()}clearSelectionFilter(){return this.viewModel.clearSelectionFilter()}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}deselectRows(e){return this.viewModel.deselectRows(e)}filterBySelection(){return this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}hideColumn(e){this.grid?.hideColumn(e),this._syncMenuConfig()}refresh(){return this.viewModel.refresh()}get returnGeometryEnabled(){return this.viewModel.returnGeometryEnabled}set returnGeometryEnabled(e){this.viewModel.returnGeometryEnabled=e}showAllColumns(){return this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e),this._syncMenuConfig()}sortColumn(e,t){return this.viewModel.sortColumn(e,t)}selectRows(e){return this.viewModel.selectRows(e)}scrollToIndex(e){return this.viewModel.scrollToIndex(e)}zoomToSelection(){this.viewModel.zoomToSelection()}render(){const{_prompt:e}=this,t=null!=e?v("calcite-scrim",null,this._renderPrompt(e)):null;return v("div",{bind:this,class:this.classes(f.base,u.widget)},this.visibleElements.header?this._renderHeader():null,v("div",{class:f.content},"disabled"!==this.state&&this.grid?.render()),t)}_renderPrompt({title:e,message:t,context:i,actions:l}){const s=v("calcite-button",{appearance:"solid",key:"prompt-primary-button",kind:"danger"===i?"danger":"brand",onclick:l.primary.action,width:l.secondary?"half":"full"},l.primary.label),o=l.secondary?v("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:"danger"===i?"danger":"brand",onclick:l.secondary.action,width:"half"},l.secondary.label):null;return v("div",{class:`${f.promptContainer}--${i}`},v("div",{class:f.promptHeader},v("calcite-icon",{icon:"exclamation-mark-triangle"}),v(g,{class:f.promptHeading,level:2},e)),v("div",{class:f.promptMessage},t),v("div",{class:f.promptDivider}),v("div",{class:f.promptActions},o,s))}_renderHeader(){return v("div",{class:f.header,key:"header"},this._renderLoader(),this._renderTitle(),this.visibleElements.menu?this._renderMenu():null)}_renderTitle(){return v("div",{class:f.title,key:"title"},this._getTitle())}_getTitle(){const{grid:e,highlightIds:t,layer:i,messages:l,viewModel:{size:s}}=this;return e&&i?w(l.header,{title:i.title,count:s,selected:t.length||0}):""}_renderLoader(){const{state:e,store:t}=this.viewModel,i="loading"===e||t.syncing||t.querying;return v("div",{class:f.loaderContainer},i?v("div",{class:f.loader,key:"loader"}):null)}_renderMenu(){return v("div",{class:f.menuContainer},this.menu?.render())}_onSelectionChange(e){const{added:t,removed:i}=e,l=t.map((e=>this.viewModel.store.getLocalItemByKey(e)||{objectId:e,feature:null,attachments:null,relatedRecords:null})),s=i.map((e=>this.viewModel.store.getLocalItemByKey(e)||{objectId:e,feature:null,attachments:null,relatedRecords:null}));this.emit("selection-change",{added:l,removed:s})}_syncMenuConfig(){this.menu?.set({...this.menuConfig,items:this._getMenuItems()})}_getMenuItems(){const e=this.menuConfig?.items,t=this._getDefaultMenuItems(),i=[];return t?.length&&i.push(...t),e?.length&&i.push(...e),i}_getDefaultMenuItems(){const{highlightIds:e,messages:t,viewModel:i,visibleElements:l}=this,{menuItems:s}=l,o=[];if(s?.refreshData&&o.push(new c({selectionEnabled:!1,label:t?.refreshData,clickFunction:()=>this.refresh()})),e.length){const i=this._getSelectionFilter();if(s?.clearSelection&&o.push(new c({selectionEnabled:!1,label:t?.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()})),s?.zoomToSelection&&this.view&&o.push(new c({selectionEnabled:!1,label:t?.zoomToSelection,clickFunction:()=>this.viewModel.zoomToSelection()})),s?.selectedRecordsShowSelectedToggle&&(!i||e.length!==i.objectIds.length)){const e=t.showSelected,i=new c({selectionEnabled:!1,label:e,clickFunction:()=>{this.filterBySelection(),i.set("label",e)}});o.push(i)}s?.deleteSelection&&this.editingEnabled&&this.layer?.capabilities?.operations?.supportsDelete&&o.push(new c({selectionEnabled:!1,label:t.deleteSelection,clickFunction:this._showDeletePrompt}))}if(s?.selectedRecordsShowAllToggle&&this._hasSelectionFilter()){const e=t.showAllRecords,i=new c({selectionEnabled:!1,label:e,clickFunction:()=>{this.clearSelectionFilter(),i.set("label",e)}});o.push(i)}return s?.toggleColumns&&o.push(new c({iconClass:p.right,label:t?.toggleColumns,clickFunction:this._toggleMenuItemSelectedIcon,items:i?.columns?.items.map((({header:e,hidden:t,path:i})=>new c({label:e||i,selected:!t,selectionEnabled:!0,iconClass:p.checkMark,clickFunction:()=>this._toggleColumnFromMenuItem(i)})))})),o.length?o:null}_toggleMenuItemSelectedIcon({item:e}){e?.set("iconClass",e?.selected?p.down:p.right)}_toggleColumnFromMenuItem(e){const{grid:t,viewModel:i}=this,l=i.findColumn(e);l?.hidden?t?.showColumn(e):t?.hideColumn(e)}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=this.highlightIds.length||0,l=w(e.deleteSelectionCount,{count:i});this.menu&&(this.menu.open=!1),this._prompt={title:l,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this._prompt=null}}}}async _onDeleteSelectionClick(){await this.viewModel.deleteSelection(),this._prompt=null}_getSelectionFilter(){return this.viewModel.activeFilters?.find((e=>"selection"===e.type))}_hasSelectionFilter(){return!!this._getSelectionFilter()}};e([o({readOnly:!0})],S.prototype,"activeFilters",null),e([o({readOnly:!0})],S.prototype,"activeSortOrders",null),e([o()],S.prototype,"attachmentsEnabled",null),e([o()],S.prototype,"autoRefreshEnabled",null),e([o()],S.prototype,"columnReorderingEnabled",null),e([o({readOnly:!0})],S.prototype,"columns",null),e([o()],S.prototype,"editingEnabled",null),e([o()],S.prototype,"filterGeometry",null),e([o({readOnly:!0})],S.prototype,"grid",null),e([o()],S.prototype,"hiddenFields",null),e([o()],S.prototype,"highlightEnabled",null),e([o()],S.prototype,"highlightIds",null),e([o()],S.prototype,"highlightOnRowSelectEnabled",null),e([o()],S.prototype,"label",null),e([o()],S.prototype,"layer",null),e([o(),b("esri/widgets/FeatureTable/t9n/FeatureTable")],S.prototype,"messages",null),e([o(),b("esri/t9n/common")],S.prototype,"messagesCommon",null),e([o(),b("esri/widgets/support/t9n/uriUtils")],S.prototype,"messagesURIUtils",null),e([o({readOnly:!0})],S.prototype,"menu",void 0),e([o()],S.prototype,"menuConfig",void 0),e([o()],S.prototype,"multiSortEnabled",null),e([o()],S.prototype,"pageSize",null),e([o()],S.prototype,"relatedRecordsEnabled",null),e([o({readOnly:!0})],S.prototype,"state",null),e([o()],S.prototype,"tableTemplate",null),e([o()],S.prototype,"timeExtent",null),e([o()],S.prototype,"view",null),e([o()],S.prototype,"viewModel",void 0),e([o()],S.prototype,"visibleElements",void 0),e([n("visibleElements")],S.prototype,"castVisibleElements",null),e([o()],S.prototype,"returnGeometryEnabled",null),S=e([r("esri.widgets.FeatureTable")],S);const C=S;export{C as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{deprecatedFunction as t}from"../core/deprecate.js";import i from"../core/Logger.js";import{on as l,watch as s}from"../core/reactiveUtils.js";import{property as o}from"../core/accessorSupport/decorators/property.js";import{cast as n}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import d from"./FeatureTable/FeatureTableViewModel.js";import h from"./FeatureTable/Grid/support/ButtonMenu.js";import c from"./FeatureTable/Grid/support/ButtonMenuItem.js";import{loadCalciteComponents as m}from"./support/componentsUtils.js";import{globalCss as u}from"./support/globalCss.js";import{Heading as g}from"./support/Heading.js";import{legacyIcon as p}from"./support/legacyIcon.js";import"./support/widgetUtils.js";import{messageBundle as b}from"./support/decorators/messageBundle.js";import{tsx as v}from"./support/jsxFactory.js";import{substitute as w}from"../intl/substitute.js";const M={header:!0,menu:!0,menuItems:{clearSelection:!0,refreshData:!0,toggleColumns:!0,selectedRecordsShowAllToggle:!0,selectedRecordsShowSelectedToggle:!0,zoomToSelection:!0,deleteSelection:!0},selectionColumn:!0,columnMenus:!0},y="esri-feature-table",_=`${y}__prompt`,f={base:y,header:`${y}__header`,title:`${y}__title`,content:`${y}__content`,loader:`${y}__loader`,loaderContainer:`${y}__loader-container`,menuContainer:`${y}__menu`,promptContainer:_,promptHeader:`${_}__header`,promptHeading:`${_}__header__heading`,promptMessage:`${_}__message`,promptDivider:`${_}__divider`,promptActions:`${_}__actions`},E=i.getLogger("esri.widgets.FeatureTable");let S=class extends a{constructor(e,t){super(e,t),this._prompt=null,this.menu=null,this.menuConfig=null,this.viewModel=new d,this.visibleElements={...M},this._showDeletePrompt=this._showDeletePrompt.bind(this),this._onDeleteSelectionClick=this._onDeleteSelectionClick.bind(this)}initialize(){this.addHandles([l((()=>this.viewModel.columns),"change",(()=>this._syncMenuConfig())),l((()=>this.viewModel.activeFilters),"change",(()=>this._syncMenuConfig())),l((()=>this.highlightIds),"change",(e=>{this._syncMenuConfig(),this._onSelectionChange(e)})),s((()=>[this.viewModel.store.querying,this.viewModel.store.syncing,this.editingEnabled]),(()=>this.scheduleRender())),s((()=>[this.menuConfig,this.editingEnabled]),(()=>this._syncMenuConfig())),s((()=>this.messages),(()=>{this.menu&&(this.menu.label=this.messages?.options),this._syncMenuConfig()}))]),this._set("menu",new h({label:this.messages?.options,iconClass:p.handleHorizontal,...this.menuConfig}));const{attachmentsEnabled:e,relatedRecordsEnabled:t}=this;this.viewModel?.store?.set({attachmentsEnabled:e,relatedRecordsEnabled:t})}loadDependencies(){return m({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),scrim:()=>import("@esri/calcite-components/dist/components/calcite-scrim.js")})}destroy(){this._prompt=null,this.menu?.destroy()}get activeFilters(){return this.viewModel.activeFilters}get activeSortOrders(){return this.viewModel.activeSortOrders}get attachmentsEnabled(){return this.viewModel.attachmentsEnabled}set attachmentsEnabled(e){this.viewModel.attachmentsEnabled=e}get autoRefreshEnabled(){return this.viewModel.autoRefreshEnabled}set autoRefreshEnabled(e){this.viewModel.autoRefreshEnabled=e}get columnReorderingEnabled(){return this.viewModel.columnReorderingEnabled}set columnReorderingEnabled(e){this.viewModel.columnReorderingEnabled=e}get columns(){return this.viewModel.columns}get editingEnabled(){return this.viewModel.editingEnabled}set editingEnabled(e){this.viewModel.editingEnabled=e}get filterGeometry(){return this.viewModel.filterGeometry}set filterGeometry(e){this.viewModel.filterGeometry=e}get grid(){return this.viewModel.grid}get hiddenFields(){return this.viewModel.hiddenFields}set hiddenFields(e){this.viewModel.hiddenFields=e}get highlightEnabled(){return this.viewModel.highlightEnabled}set highlightEnabled(e){this.viewModel.highlightEnabled=e}get highlightIds(){return this.viewModel.highlightIds}set highlightIds(e){this.viewModel.highlightIds=e}get highlightOnRowSelectEnabled(){return this.viewModel.highlightEnabled}set highlightOnRowSelectEnabled(e){this.viewModel.highlightEnabled=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get messages(){return this.viewModel.messages}set messages(e){this.viewModel.messages=e}get messagesCommon(){return this.viewModel.messagesCommon}set messagesCommon(e){this.viewModel.messagesCommon=e}get messagesURIUtils(){return this.viewModel.messagesURIUtils}set messagesURIUtils(e){this.viewModel.messagesURIUtils=e}get multiSortEnabled(){return this.viewModel.multiSortEnabled}set multiSortEnabled(e){this.viewModel.multiSortEnabled=e}get pageSize(){return this.viewModel.pageSize}set pageSize(e){this.viewModel.pageSize=e}get relatedRecordsEnabled(){return this.viewModel.relatedRecordsEnabled}set relatedRecordsEnabled(e){this.viewModel.relatedRecordsEnabled=e}get state(){return this.viewModel.state}get tableTemplate(){return this.viewModel.tableTemplate}set tableTemplate(e){this.viewModel.tableTemplate=e}get timeExtent(){return this.viewModel.timeExtent}set timeExtent(e){this.viewModel.timeExtent=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){const t={...M,...e};return this.grid?.set("visibleElements",{...this.grid.visibleElements,selectionColumn:t.selectionColumn,columnMenus:t.columnMenus}),t}clearHighlights(){return t(E,"`FeatureTable.clearHighlights` is deprecated in favor of FeatureTable.highlightIds'",{replacement:"FeatureTable.highlightIds",version:"4.25",see:"https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html#highlightIds"}),this.viewModel.clearHighlights()}clearSelection(){return t(E,"`FeatureTable.clearSelection` is deprecated in favor of FeatureTable.highlightIds'",{replacement:"FeatureTable.highlightIds",version:"4.25",see:"https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-FeatureTable.html#highlightIds"}),this.viewModel.clearSelection()}clearSelectionFilter(){return this.viewModel.clearSelectionFilter()}deleteSelection(e){return this.highlightIds.length?e?(this._showDeletePrompt(),this.scheduleRender(),Promise.resolve()):this.viewModel.deleteSelection():Promise.resolve()}deselectRows(e){return this.viewModel.deselectRows(e)}filterBySelection(){return this.viewModel.filterBySelection()}findColumn(e){return this.viewModel.findColumn(e)}hideColumn(e){this.grid?.hideColumn(e),this._syncMenuConfig()}refresh(){return this.viewModel.refresh()}get returnGeometryEnabled(){return this.viewModel.returnGeometryEnabled}set returnGeometryEnabled(e){this.viewModel.returnGeometryEnabled=e}showAllColumns(){return this.viewModel.showAllColumns()}showColumn(e){this.grid?.showColumn(e),this._syncMenuConfig()}sortColumn(e,t){return this.viewModel.sortColumn(e,t)}selectRows(e){return this.viewModel.selectRows(e)}scrollToIndex(e){return this.viewModel.scrollToIndex(e)}zoomToSelection(){this.viewModel.zoomToSelection()}render(){const{_prompt:e}=this,t=null!=e?v("calcite-scrim",null,this._renderPrompt(e)):null;return v("div",{bind:this,class:this.classes(f.base,u.widget)},this.visibleElements.header?this._renderHeader():null,v("div",{class:f.content},"disabled"!==this.state&&this.grid?.render()),t)}_renderPrompt({title:e,message:t,context:i,actions:l}){const s=v("calcite-button",{appearance:"solid",key:"prompt-primary-button",kind:"danger"===i?"danger":"brand",onclick:l.primary.action,width:l.secondary?"half":"full"},l.primary.label),o=l.secondary?v("calcite-button",{appearance:"outline",key:"prompt-secondary-button",kind:"danger"===i?"danger":"brand",onclick:l.secondary.action,width:"half"},l.secondary.label):null;return v("div",{class:`${f.promptContainer}--${i}`},v("div",{class:f.promptHeader},v("calcite-icon",{icon:"exclamation-mark-triangle"}),v(g,{class:f.promptHeading,level:2},e)),v("div",{class:f.promptMessage},t),v("div",{class:f.promptDivider}),v("div",{class:f.promptActions},o,s))}_renderHeader(){return v("div",{class:f.header,key:"header"},this._renderLoader(),this._renderTitle(),this.visibleElements.menu?this._renderMenu():null)}_renderTitle(){return v("div",{class:f.title,key:"title"},this._getTitle())}_getTitle(){const{grid:e,highlightIds:t,layer:i,messages:l,viewModel:{size:s}}=this;return e&&i?w(l.header,{title:i.title,count:s,selected:t.length||0}):""}_renderLoader(){const{state:e,store:t}=this.viewModel,i="loading"===e||t.syncing||t.querying;return v("div",{class:f.loaderContainer},i?v("div",{class:f.loader,key:"loader"}):null)}_renderMenu(){return v("div",{class:f.menuContainer},this.menu?.render())}_onSelectionChange(e){const{added:t,removed:i}=e,l=t.map((e=>this.viewModel.store.getLocalItemByKey(e)||{objectId:e,feature:null,attachments:null,relatedRecords:null})),s=i.map((e=>this.viewModel.store.getLocalItemByKey(e)||{objectId:e,feature:null,attachments:null,relatedRecords:null}));this.emit("selection-change",{added:l,removed:s})}_syncMenuConfig(){this.menu?.set({...this.menuConfig,items:this._getMenuItems()})}_getMenuItems(){const e=this.menuConfig?.items,t=this._getDefaultMenuItems(),i=[];return t?.length&&i.push(...t),e?.length&&i.push(...e),i}_getDefaultMenuItems(){const{highlightIds:e,messages:t,viewModel:i,visibleElements:l}=this,{menuItems:s}=l,o=[];if(s?.refreshData&&o.push(new c({selectionEnabled:!1,label:t?.refreshData,clickFunction:()=>this.refresh()})),e.length){const i=this._getSelectionFilter();if(s?.clearSelection&&o.push(new c({selectionEnabled:!1,label:t?.clearSelection,clickFunction:()=>this.highlightIds?.removeAll()})),s?.zoomToSelection&&this.view&&o.push(new c({selectionEnabled:!1,label:t?.zoomToSelection,clickFunction:()=>this.viewModel.zoomToSelection()})),s?.selectedRecordsShowSelectedToggle&&(!i||e.length!==i.objectIds.length)){const e=t.showSelected,i=new c({selectionEnabled:!1,label:e,clickFunction:()=>{this.filterBySelection(),i.set("label",e)}});o.push(i)}s?.deleteSelection&&this.editingEnabled&&this.layer?.capabilities?.operations?.supportsDelete&&o.push(new c({selectionEnabled:!1,label:t.deleteSelection,clickFunction:this._showDeletePrompt}))}if(s?.selectedRecordsShowAllToggle&&this._hasSelectionFilter()){const e=t.showAllRecords,i=new c({selectionEnabled:!1,label:e,clickFunction:()=>{this.clearSelectionFilter(),i.set("label",e)}});o.push(i)}return s?.toggleColumns&&o.push(new c({iconClass:p.right,label:t?.toggleColumns,clickFunction:this._toggleMenuItemSelectedIcon,items:i?.columns?.items.map((({header:e,hidden:t,path:i})=>new c({label:e||i,selected:!t,selectionEnabled:!0,iconClass:p.checkMark,clickFunction:()=>this._toggleColumnFromMenuItem(i)})))})),o.length?o:null}_toggleMenuItemSelectedIcon({item:e}){e?.set("iconClass",e?.selected?p.down:p.right)}_toggleColumnFromMenuItem(e){const{grid:t,viewModel:i}=this,l=i.findColumn(e);l?.hidden?t?.showColumn(e):t?.hideColumn(e)}_showDeletePrompt(){const{messages:e,messagesCommon:t}=this,i=this.highlightIds.length||0,l=w(e.deleteSelectionCount,{count:i});this.menu&&(this.menu.open=!1),this._prompt={title:l,message:e.deleteRecordsRemoved,context:"danger",actions:{primary:{label:t.delete,action:this._onDeleteSelectionClick},secondary:{label:e.keepRecords,action:()=>this._prompt=null}}}}async _onDeleteSelectionClick(){await this.viewModel.deleteSelection(),this._prompt=null}_getSelectionFilter(){return this.viewModel.activeFilters?.find((e=>"selection"===e.type))}_hasSelectionFilter(){return!!this._getSelectionFilter()}};e([o({readOnly:!0})],S.prototype,"activeFilters",null),e([o({readOnly:!0})],S.prototype,"activeSortOrders",null),e([o()],S.prototype,"attachmentsEnabled",null),e([o()],S.prototype,"autoRefreshEnabled",null),e([o()],S.prototype,"columnReorderingEnabled",null),e([o({readOnly:!0})],S.prototype,"columns",null),e([o()],S.prototype,"editingEnabled",null),e([o()],S.prototype,"filterGeometry",null),e([o({readOnly:!0})],S.prototype,"grid",null),e([o()],S.prototype,"hiddenFields",null),e([o()],S.prototype,"highlightEnabled",null),e([o()],S.prototype,"highlightIds",null),e([o()],S.prototype,"highlightOnRowSelectEnabled",null),e([o()],S.prototype,"label",null),e([o()],S.prototype,"layer",null),e([o(),b("esri/widgets/FeatureTable/t9n/FeatureTable")],S.prototype,"messages",null),e([o(),b("esri/t9n/common")],S.prototype,"messagesCommon",null),e([o(),b("esri/widgets/support/t9n/uriUtils")],S.prototype,"messagesURIUtils",null),e([o({readOnly:!0})],S.prototype,"menu",void 0),e([o()],S.prototype,"menuConfig",void 0),e([o()],S.prototype,"multiSortEnabled",null),e([o()],S.prototype,"pageSize",null),e([o()],S.prototype,"relatedRecordsEnabled",null),e([o({readOnly:!0})],S.prototype,"state",null),e([o()],S.prototype,"tableTemplate",null),e([o()],S.prototype,"timeExtent",null),e([o()],S.prototype,"timeZone",null),e([o()],S.prototype,"view",null),e([o()],S.prototype,"viewModel",void 0),e([o()],S.prototype,"visibleElements",void 0),e([n("visibleElements")],S.prototype,"castVisibleElements",null),e([o()],S.prototype,"returnGeometryEnabled",null),S=e([r("esri.widgets.FeatureTable")],S);const C=S;export{C 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{on as t}from"../core/events.js";import{destroyMaybe as i}from"../core/maybe.js";import{watch as l,initial as s,when as a}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{cast as o}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import c from"./Slider.js";import d from"./Widget.js";import{css as m}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as u,getScalePreviewSpriteBackgroundPosition as p}from"./ScaleRangeSlider/scalePreviewUtils.js";import v from"./ScaleRangeSlider/ScaleRanges.js";import h from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{loadCalciteComponents as S}from"./support/componentsUtils.js";import{globalCss as M}from"./support/globalCss.js";import{storeNode as b}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{tsx as _}from"./support/jsxFactory.js";import{formatNumber as g}from"../intl/number.js";import{substitute as w}from"../intl/substitute.js";const x={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},y={maximumFractionDigits:0},j="1:",I=16;let T=class extends d{constructor(e,i){super(e,i),this._activeMenu=null,this._activeThumb=null,this._customInput=null,this._maxThumbNode=null,this._minThumbNode=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._slider=new c({thumbCreatedFunction:(e,i,l)=>{0===e?this._minThumbNode=l:1===e&&(this._maxThumbNode=l),this.addHandles([t(l,"mouseenter",(()=>{this._activeThumb=e,this.scheduleRender()})),t(l,"mouseleave",(()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())}))])}}),this.disabled=!1,this.messages=null,this.region="US",this.viewModel=new h,this.visibleElements=x,this._afterInputNumberCreate=e=>{"value"in e&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._customInput=e},this._handleCustomScaleInputChange=(e,t)=>{const{viewModel:{scaleRanges:i}}=this,l=Number.parseFloat(t.value);Number.isNaN(l)?t.value=e:this._setScale(i.clampScale(l))}}loadDependencies(){return S({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown.js"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group.js"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover.js")})}initialize(){this.addHandles([l((()=>this.viewModel),(e=>this._slider.viewModel=e?.sliderViewModel??null),s),l((()=>this._interactive),(e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)}),s),this._slider.on("thumb-drag",(({index:e})=>{this._activeThumb=e,clearTimeout(this._previewAutoCloseTimeoutId);const t=250;this._previewAutoCloseTimeoutId=setTimeout((()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null}),t)})),a((()=>!0===this.view?.stationary),(()=>this.scheduleRender()))])}destroy(){this._slider=i(this._slider)}get _maxScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.maxScaleMenu}get _minScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.minScaleMenu}get _interactive(){return"disabled"!==this.viewModel?.state&&!this.disabled}get effectiveMaxScale(){return this.viewModel.effectiveMaxScale}get effectiveMinScale(){return this.viewModel.effectiveMinScale}get effectiveMaxScaleLimit(){return this.viewModel.effectiveMaxScaleLimit}get effectiveMinScaleLimit(){return this.viewModel.effectiveMinScaleLimit}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxScale(){return this.viewModel.maxScale}set maxScale(e){this.viewModel.maxScale=e}get maxScaleLimit(){return this.viewModel.maxScaleLimit}set maxScaleLimit(e){this.viewModel.maxScaleLimit=e}get minScale(){return this.viewModel.minScale}set minScale(e){this.viewModel.minScale=e}get minScaleLimit(){return this.viewModel.minScaleLimit}set minScaleLimit(e){this.viewModel.minScaleLimit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...x,...e,scaleMenus:"boolean"==typeof e?.scaleMenus?e.scaleMenus:{...x.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`${j}${g(e,y)}`}render(){const{_interactive:e,_slider:t,label:i,messages:l,view:s,viewModel:{scaleRanges:a,state:n}}=this,o=l.scaleRangeLabels,r=o[a.findScaleRangeByIndex(t.values[0]).id],c=o[a.findScaleRangeByIndex(t.values[1]).id];return _("div",{"aria-label":i,class:this.classes(m.base,M.widget,e?null:M.disabled)},_("div",{class:m.scaleIndicatorWrapper,dir:"ltr"},"ready"===n&&s?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),_("div",{class:m.scaleMenuContainer},this._minScaleMenuEnabled?this._renderScaleMenuToggle("min",r):null,_("div",{class:m.scaleMenuSeparator}),this._maxScaleMenuEnabled?this._renderScaleMenuToggle("max",c):null))}_renderPreviewPopover(){const{_activeThumb:e}=this,t=null!=e&&this.visibleElements.preview,i=t?0===e?this._minThumbNode:this._maxThumbNode:"";return _("calcite-popover",{afterCreate:b,afterUpdate:()=>this._previewPopover?.reposition(),bind:this,"data-node-ref":"_previewPopover",label:this.messages.preview,offsetDistance:I,open:t,overlayPositioning:"fixed",placement:"top",referenceElement:i,triggerDisabled:!0},this._renderScalePreview())}_renderScalePreview(){const{_activeThumb:e,_slider:t,region:i,viewModel:{scaleRanges:l}}=this,s=0===e?t.values[0]:t.values[1],a=Object.keys(v.RecommendedScales).indexOf(l.findScaleRangeByIndex(s).id),n={backgroundImage:u(i),backgroundPosition:p(a)};return _("div",{class:m.scalePreview},_("div",{class:m.scalePreviewThumbnail,styles:n}))}_renderScaleMenuToggle(e,t){const{_activeMenu:i,_interactive:l}=this,s=i===e;return[_("calcite-dropdown",{closeOnSelectDisabled:!0,open:s,overlayPositioning:"fixed",placement:"max"===e?"bottom-end":"bottom-start",scale:"s",onCalciteDropdownClose:({target:t})=>{this._activeMenu===e&&this._setActiveMenu(null),t.setFocus()},onCalciteDropdownOpen:()=>this._setActiveMenu(e)},_("calcite-button",{appearance:s?"outline":"transparent","aria-pressed":s.toString(),class:m.scaleMenuToggle,"data-type":e,disabled:!l,iconEnd:"chevron-down",scale:"s",slot:"trigger"},t),s&&"max"===e?this._renderMaxScaleMenu():null,s&&"min"===e?this._renderMinScaleMenu():null)]}_renderMinScaleMenu(){const{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,s=i?i.scale:void 0;return this._renderScaleMenu({type:"min",min:t,max:l.findScaleRange(e).minScale,viewScale:s})}_renderMaxScaleMenu(){const{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,s=i?i.scale:void 0;return this._renderScaleMenu({type:"max",min:l.findScaleRange(e).maxScale,max:t,viewScale:s})}_renderScaleMenu({viewScale:e,min:t,max:i,type:l}){const{effectiveMaxScale:s,effectiveMinScale:a,messages:n}=this,o="max"===l?s:a,r=v.fromScaleRange({minScale:t,maxScale:i}),c=this.messages.featuredScaleLabels,d=v.RecommendedScales,m=Object.keys(d).filter((e=>r.contains(d[e]))).map((e=>this._renderScaleMenuItem({scaleLabel:c[e],scaleValue:d[e],isSelected:o===d[e],valueVisible:"world"!==e})));return _("calcite-dropdown-group",{key:`${this.id}__scale-menu--${l}`},this._renderCustomScaleValue({currentScale:o}),null!=e?this._renderScaleMenuItem({scaleValue:e,scaleLabel:n.featuredScaleLabels.current,isSelected:o===e,valueVisible:!0}):null,m)}_renderCustomScaleValue({currentScale:e}){const{messages:t}=this,i=Math.round(e).toString();return _("calcite-dropdown-item",{afterCreate:e=>{e.setFocus()},key:"custom-scale",label:t.featuredScaleLabels.custom,onCalciteDropdownItemSelect:()=>{this._customInput?.setFocus()}},_("calcite-label",{scale:"s"},_("span",null,t.featuredScaleLabels.custom),_("calcite-input-number",{afterCreate:this._afterInputNumberCreate,groupSeparator:!0,inputMode:"numeric",max:v.RecommendedScales.world,min:0,numberButtonType:"none",placeholder:t.customScaleInputTooltip,prefixText:j,scale:"s",step:1,value:i,onCalciteInputNumberChange:({target:e})=>this._handleCustomScaleInputChange(i,e)})))}_renderScaleMenuItem(e){const{scaleValue:t,scaleLabel:i,valueVisible:l,isSelected:s}=e;return _("calcite-dropdown-item",{key:`${i}_${t}`,label:i,selected:s,onCalciteDropdownItemSelect:this._setScale.bind(this,t)},i,l?_("div",{class:m.scaleMenuSublabel},this.formatScale(t)):void 0)}_renderCurrentScaleIndicator(){const{_slider:e,messages:t,view:i,viewModel:{scaleRanges:l}}=this,s=l.clampScale(i.scale),a=this.viewModel.mapScaleToSlider(s),n=a/e.max,o=t.scaleRangeLabels[l.findScaleRangeByIndex(a).id],r=w(t.currentScaleTooltip,{scaleLabel:o});return _("div",{class:m.scaleIndicatorContainer,key:"scale-indicator"},_("div",{"aria-label":r,class:m.scaleIndicator,styles:{left:100*n+"%"},title:r},_("calcite-icon",{class:m.scaleIndicatorIcon,icon:"caret-up",scale:"s"})))}_setScale(e){"max"===this._activeMenu?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null)}_setActiveMenu(e){this._activeMenu=e}};e([n()],T.prototype,"_activeMenu",void 0),e([n()],T.prototype,"_activeThumb",void 0),e([n()],T.prototype,"_customInput",void 0),e([n()],T.prototype,"_maxScaleMenuEnabled",null),e([n()],T.prototype,"_minScaleMenuEnabled",null),e([n()],T.prototype,"_slider",void 0),e([n({readOnly:!0})],T.prototype,"_interactive",null),e([n()],T.prototype,"disabled",void 0),e([n()],T.prototype,"effectiveMaxScale",null),e([n()],T.prototype,"effectiveMinScale",null),e([n()],T.prototype,"effectiveMaxScaleLimit",null),e([n()],T.prototype,"effectiveMinScaleLimit",null),e([n()],T.prototype,"label",null),e([n()],T.prototype,"layer",null),e([n()],T.prototype,"maxScale",null),e([n()],T.prototype,"maxScaleLimit",null),e([n(),f("esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider")],T.prototype,"messages",void 0),e([n()],T.prototype,"minScale",null),e([n()],T.prototype,"minScaleLimit",null),e([n()],T.prototype,"region",void 0),e([n()],T.prototype,"view",null),e([n()],T.prototype,"viewModel",void 0),e([n()],T.prototype,"visibleElements",void 0),e([o("visibleElements")],T.prototype,"castVisibleElements",null),T=e([r("esri.widgets.ScaleRangeSlider")],T);const R=T;export{R as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{on as t}from"../core/events.js";import{destroyMaybe as i}from"../core/maybe.js";import{watch as l,initial as s,when as a}from"../core/reactiveUtils.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{cast as o}from"../core/accessorSupport/decorators/cast.js";import"../core/arrayUtils.js";import"../core/has.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import c from"./Slider.js";import d from"./Widget.js";import{css as m}from"./ScaleRangeSlider/css.js";import{getScalePreviewSource as u,getScalePreviewSpriteBackgroundPosition as p}from"./ScaleRangeSlider/scalePreviewUtils.js";import v from"./ScaleRangeSlider/ScaleRanges.js";import h from"./ScaleRangeSlider/ScaleRangeSliderViewModel.js";import{loadCalciteComponents as S}from"./support/componentsUtils.js";import{globalCss as M}from"./support/globalCss.js";import{storeNode as b}from"./support/widgetUtils.js";import{messageBundle as f}from"./support/decorators/messageBundle.js";import{tsx as g}from"./support/jsxFactory.js";import{formatNumber as _}from"../intl/number.js";import{substitute as w}from"../intl/substitute.js";const x={preview:!0,scaleMenus:{maxScaleMenu:!0,minScaleMenu:!0}},y={maximumFractionDigits:0},j="1:",I=16;let T=class extends d{constructor(e,i){super(e,i),this._activeMenu=null,this._activeThumb=null,this._customInput=null,this._maxThumbNode=null,this._minThumbNode=null,this._previewAutoCloseTimeoutId=void 0,this._previewPopover=null,this._slider=new c({thumbCreatedFunction:(e,i,l)=>{0===e?this._minThumbNode=l:1===e&&(this._maxThumbNode=l),this.addHandles([t(l,"mouseenter",(()=>{this._activeThumb=e,this.scheduleRender()})),t(l,"mouseleave",(()=>{this._previewAutoCloseTimeoutId||(this._activeThumb=null,this.scheduleRender())}))])}}),this.disabled=!1,this.messages=null,this.region="US",this.viewModel=new h,this.visibleElements=x,this._afterInputNumberCreate=e=>{"value"in e&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._customInput=e},this._handleCustomScaleInputChange=(e,t)=>{const{viewModel:{scaleRanges:i}}=this,l=Number.parseFloat(t.value);Number.isNaN(l)?t.value=e:this._setScale(i.clampScale(l))}}loadDependencies(){return S({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown.js"),"dropdown-group":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-group.js"),"dropdown-item":()=>import("@esri/calcite-components/dist/components/calcite-dropdown-item.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),popover:()=>import("@esri/calcite-components/dist/components/calcite-popover.js")})}initialize(){this.addHandles([l((()=>this.viewModel),(e=>this._slider.viewModel=e?.sliderViewModel??null),s),l((()=>this._interactive),(e=>{this._slider.disabled=!e,e||this._setActiveMenu(null)}),s),this._slider.on("thumb-drag",(({index:e})=>{this._activeThumb=e,clearTimeout(this._previewAutoCloseTimeoutId);const t=250;this._previewAutoCloseTimeoutId=setTimeout((()=>{this._previewAutoCloseTimeoutId=void 0,this._activeThumb=null}),t)})),a((()=>!0===this.view?.stationary),(()=>this.scheduleRender()))])}destroy(){this._slider=i(this._slider)}get _maxScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.maxScaleMenu}get _minScaleMenuEnabled(){const{scaleMenus:e}=this.visibleElements;return!0===e||"boolean"!=typeof e&&e.minScaleMenu}get _interactive(){return"disabled"!==this.viewModel?.state&&!this.disabled}get effectiveMaxScale(){return this.viewModel.effectiveMaxScale}get effectiveMinScale(){return this.viewModel.effectiveMinScale}get effectiveMaxScaleLimit(){return this.viewModel.effectiveMaxScaleLimit}get effectiveMinScaleLimit(){return this.viewModel.effectiveMinScaleLimit}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxScale(){return this.viewModel.maxScale}set maxScale(e){this.viewModel.maxScale=e}get maxScaleLimit(){return this.viewModel.maxScaleLimit}set maxScaleLimit(e){this.viewModel.maxScaleLimit=e}get minScale(){return this.viewModel.minScale}set minScale(e){this.viewModel.minScale=e}get minScaleLimit(){return this.viewModel.minScaleLimit}set minScaleLimit(e){this.viewModel.minScaleLimit=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...x,...e,scaleMenus:"boolean"==typeof e?.scaleMenus?e.scaleMenus:{...x.scaleMenus,...e?.scaleMenus}}}formatScale(e){return`${j}${_(e,y)}`}render(){const{_interactive:e,_slider:t,label:i,messages:l,view:s,viewModel:{scaleRanges:a,state:n}}=this,o=l.scaleRangeLabels,r=o[a.findScaleRangeByIndex(t.values[0]).id],c=o[a.findScaleRangeByIndex(t.values[1]).id];return g("div",{"aria-label":i,class:this.classes(m.base,M.widget,e?null:M.disabled)},g("div",{class:m.scaleIndicatorWrapper,dir:"ltr"},"ready"===n&&s?this._renderCurrentScaleIndicator():null,t.render(),this._renderPreviewPopover()),g("div",{class:m.scaleMenuContainer},this._minScaleMenuEnabled?this._renderScaleMenuToggle("min",r):null,g("div",{class:m.scaleMenuSeparator}),this._maxScaleMenuEnabled?this._renderScaleMenuToggle("max",c):null))}_renderPreviewPopover(){const{_activeThumb:e}=this,t=null!=e&&this.visibleElements.preview,i=t?0===e?this._minThumbNode:this._maxThumbNode:"";return g("calcite-popover",{afterCreate:b,afterUpdate:()=>this._previewPopover?.reposition(),bind:this,"data-node-ref":"_previewPopover",label:this.messages.preview,offsetDistance:I,open:t,overlayPositioning:"fixed",placement:"top",referenceElement:i,triggerDisabled:!0},this._renderScalePreview())}_renderScalePreview(){const{_activeThumb:e,_slider:t,region:i,viewModel:{scaleRanges:l}}=this,s=0===e?t.values[0]:t.values[1],a=Object.keys(v.RecommendedScales).indexOf(l.findScaleRangeByIndex(s).id),n={backgroundImage:u(i),backgroundPosition:p(a)};return g("div",{class:m.scalePreview},g("div",{class:m.scalePreviewThumbnail,styles:n}))}_renderScaleMenuToggle(e,t){const{_activeMenu:i,_interactive:l}=this,s=i===e;return[g("calcite-dropdown",{closeOnSelectDisabled:!0,open:s,overlayPositioning:"fixed",placement:"max"===e?"bottom-end":"bottom-start",scale:"s",onCalciteDropdownClose:({target:t})=>{this._activeMenu===e&&this._setActiveMenu(null),t.setFocus()},onCalciteDropdownOpen:()=>this._setActiveMenu(e)},g("calcite-button",{appearance:s?"outline":"transparent","aria-pressed":s.toString(),class:m.scaleMenuToggle,"data-type":e,disabled:!l,iconEnd:"chevron-down",scale:"s",slot:"trigger"},t),s&&"max"===e?this._renderMaxScaleMenu():null,s&&"min"===e?this._renderMinScaleMenu():null)]}_renderMinScaleMenu(){const{effectiveMaxScale:e,effectiveMinScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,s=i?i.scale:void 0;return this._renderScaleMenu({type:"min",min:t,max:l.findScaleRange(e).minScale,viewScale:s})}_renderMaxScaleMenu(){const{effectiveMinScale:e,effectiveMaxScaleLimit:t,view:i,viewModel:{scaleRanges:l}}=this,s=i?i.scale:void 0;return this._renderScaleMenu({type:"max",min:l.findScaleRange(e).maxScale,max:t,viewScale:s})}_renderScaleMenu({viewScale:e,min:t,max:i,type:l}){const{effectiveMaxScale:s,effectiveMinScale:a,messages:n}=this,o="max"===l?s:a,r=v.fromScaleRange({minScale:t,maxScale:i}),c=this.messages.featuredScaleLabels,d=v.RecommendedScales,m=Object.keys(d).filter((e=>r.contains(d[e]))).map((e=>this._renderScaleMenuItem({scaleLabel:c[e],scaleValue:d[e],isSelected:o===d[e],valueVisible:"world"!==e})));return g("calcite-dropdown-group",{key:`${this.id}__scale-menu--${l}`},this._renderCustomScaleValue({currentScale:o}),null!=e?this._renderScaleMenuItem({scaleValue:e,scaleLabel:n.featuredScaleLabels.current,isSelected:o===e,valueVisible:!0}):null,m)}_renderCustomScaleValue({currentScale:e}){const{messages:t}=this,i=Math.round(e).toString();return g("calcite-dropdown-item",{afterCreate:e=>{e.setFocus()},key:"custom-scale",label:t.featuredScaleLabels.custom,onCalciteDropdownItemSelect:()=>{this._customInput?.setFocus()}},g("calcite-label",{scale:"s"},g("span",null,t.featuredScaleLabels.custom),g("calcite-input-number",{afterCreate:this._afterInputNumberCreate,groupSeparator:!0,inputMode:"numeric",max:v.RecommendedScales.world,min:0,numberButtonType:"none",placeholder:t.customScaleInputTooltip,prefixText:j,scale:"s",step:1,value:i,onCalciteInputNumberChange:({target:e})=>this._handleCustomScaleInputChange(i,e)})))}_renderScaleMenuItem(e){const{scaleValue:t,scaleLabel:i,valueVisible:l,isSelected:s}=e;return g("calcite-dropdown-item",{key:i,label:i,selected:s,onCalciteDropdownItemSelect:this._setScale.bind(this,t)},i,l?g("div",{class:m.scaleMenuSublabel},this.formatScale(t)):void 0)}_renderCurrentScaleIndicator(){const{_slider:e,messages:t,view:i,viewModel:{scaleRanges:l}}=this,s=l.clampScale(i.scale),a=this.viewModel.mapScaleToSlider(s),n=a/e.max,o=t.scaleRangeLabels[l.findScaleRangeByIndex(a).id],r=w(t.currentScaleTooltip,{scaleLabel:o});return g("div",{class:m.scaleIndicatorContainer,key:"scale-indicator"},g("div",{"aria-label":r,class:m.scaleIndicator,styles:{left:100*n+"%"},title:r},g("calcite-icon",{class:m.scaleIndicatorIcon,icon:"caret-up",scale:"s"})))}_setScale(e){"max"===this._activeMenu?this.maxScale=Math.min(e,this.effectiveMinScale-1):this.minScale=Math.max(e,this.effectiveMaxScale+1),this._setActiveMenu(null)}_setActiveMenu(e){this._activeMenu=e}};e([n()],T.prototype,"_activeMenu",void 0),e([n()],T.prototype,"_activeThumb",void 0),e([n()],T.prototype,"_customInput",void 0),e([n()],T.prototype,"_maxScaleMenuEnabled",null),e([n()],T.prototype,"_minScaleMenuEnabled",null),e([n()],T.prototype,"_slider",void 0),e([n({readOnly:!0})],T.prototype,"_interactive",null),e([n()],T.prototype,"disabled",void 0),e([n()],T.prototype,"effectiveMaxScale",null),e([n()],T.prototype,"effectiveMinScale",null),e([n()],T.prototype,"effectiveMaxScaleLimit",null),e([n()],T.prototype,"effectiveMinScaleLimit",null),e([n()],T.prototype,"label",null),e([n()],T.prototype,"layer",null),e([n()],T.prototype,"maxScale",null),e([n()],T.prototype,"maxScaleLimit",null),e([n(),f("esri/widgets/ScaleRangeSlider/t9n/ScaleRangeSlider")],T.prototype,"messages",void 0),e([n()],T.prototype,"minScale",null),e([n()],T.prototype,"minScaleLimit",null),e([n()],T.prototype,"region",void 0),e([n()],T.prototype,"view",null),e([n()],T.prototype,"viewModel",void 0),e([n()],T.prototype,"visibleElements",void 0),e([o("visibleElements")],T.prototype,"castVisibleElements",null),T=e([r("esri.widgets.ScaleRangeSlider")],T);const R=T;export{R 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{eventKey as t}from"../../core/events.js";import a from"../../core/Logger.js";import{watch as i,sync as s}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import n from"../Widget.js";import{parseDateIntoParts as d,getFirstDayOfWeek as l,getLocaleDayOfWeek as h}from"./datePickerUtils.js";import c from"./DatePickerViewModel.js";import{globalCss as u}from"./globalCss.js";import{legacyIcon as _}from"./legacyIcon.js";import p from"./Popover.js";import{accessibleHandler as y}from"./decorators/accessibleHandler.js";import{messageBundle as v}from"./decorators/messageBundle.js";import{tsx as m}from"./jsxFactory.js";import{storeNode as g,isActivationKey as D,isRTL as k}from"./widgetUtils.js";import{DateTime as w,Info as f,Interval as b}from"luxon";import{formatDate as P}from"../../intl/date.js";import{getLocale as M}from"../../intl/locale.js";const O="esri-date-picker",x={base:O,datePicker:`${O}__calendar`,monthPicker:`${O}__month-picker`,dayPicker:`${O}__day-picker`,week:`${O}__week-item`,nearbyMonth:`${O}__day-item--nearby-month`,activeDay:`${O}__day-item--active`,today:`${O}__day-item--today`,selectedDay:`${O}__day-item--selected`,day:`${O}__day-item`,dayHeader:`${O}__day-item--header`,yearPicker:`${O}__year-picker`,selectedYear:`${O}__year-picker-item--selected`,year:`${O}__year-picker-item`,monthDropdown:`${O}__month-dropdown`,date:`${O}__date`,datePickerToggle:`${O}__calendar-toggle`,dateInput:`${O}__input`,dateTextInput:`${O}__text-input`,leadingIcon:`${O}__icon--leading`},I={year:"numeric",month:"2-digit",day:"2-digit"},$=new Set([" ","ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","Home","PageDown","PageUp"]);let C=class extends n{constructor(e,t){super(e,t),this._calendarNode=null,this._inputOrButtonNode=null,this._rootNode=null,this._requestDayPickerFocusOnCreate=!1,this._activeDate=null,this._calendarPopover=new p({owner:this,placement:"bottom-start",anchorElement:()=>this._rootNode,renderContentFunction:this._renderCalendar}),this._isOpen=!1,this.dateInputEnabled=!1,this.messages=null,this.commitOnMonthChange=!1,this.viewModel=new c,this.disabled=!1,this.toggle=this.toggle.bind(this)}initialize(){this.addHandles(i((()=>({viewModel:this.viewModel,value:this.viewModel?.value})),(({viewModel:e,value:t})=>{!this.destroyed&&e&&null!=this.onChange&&this.onChange(t)}),s))}destroy(){this._calendarPopover.destroy()}get value(){return this.viewModel.value}set value(e){this.viewModel.value=e}get isOpen(){return this._isOpen}render(){return m("div",{afterCreate:g,bind:this,class:this.classes(x.base,u.widget),"data-node-ref":"_rootNode"},this.dateInputEnabled?this._renderInputAndButtonMode():this._renderButtonOnlyMode())}toggle(){this._isOpen?this.close():this.open()}open(e=!0){this._activeDate=w.fromJSDate(this.viewModel.value),this._isOpen=!0,this._calendarPopover.open=!0,this._requestDayPickerFocusOnCreate=e}close(e=!0){this._activeDate=null,this._isOpen=!1,this._calendarPopover.open=!1,e&&this._inputOrButtonNode?.focus()}_renderButtonOnlyMode(){const e=P(this.viewModel.value,I),{disabled:t,_isOpen:a,messages:i}=this;return m("div",{afterCreate:g,"aria-controls":a?this._getCalendarId():null,"aria-expanded":a.toString(),"aria-haspopup":"true","aria-label":i.setDate,"aria-pressed":a.toString(),bind:this,class:this.classes(u.widgetButton,u.select,x.datePickerToggle),"data-node-ref":"_inputOrButtonNode",key:`date-button-${t}`,onclick:this.toggle,onkeydown:this._handleDateButtonKeyDown,role:"button",tabIndex:t?void 0:0},m("span",{class:x.date},e))}_renderInputAndButtonMode(){const e=P(this.viewModel.value,I),{_isOpen:t,messages:a}=this;return m("div",{class:this.classes(x.dateInput)},m("input",{afterCreate:g,"aria-controls":t?this._getCalendarId():null,"aria-haspopup":"true","aria-label":a.setDate,bind:this,class:this.classes(x.dateTextInput,u.input),"data-node-ref":"_inputOrButtonNode",key:"date-input",onblur:this._handleDateInputBlur,onclick:this._handleDateInputClick,onkeydown:this._handleDateInputKeyDown,type:"text",value:e}),m("span",{"aria-hidden":"true",class:this.classes(x.leadingIcon,_.calendar)}))}_handleDateInputClick(){this.open(!1)}_handleDateInputKeyDown(e){const{key:t}=e;this._isOpen?"Enter"===t?this._handleDateText(e):"Escape"===t&&this.close():"ArrowDown"===t&&(this.open(),e.preventDefault())}_handleDateButtonKeyDown(e){const{key:t,shiftKey:a}=e;this._isOpen&&"Tab"===t&&a?this.close():D(t)&&this.toggle()}_handleDateInputBlur(e){this._isOpen||this._handleDateText(e)}_handleDateText(e){const t=e.currentTarget;let i;try{i=d(t.value,I)}catch(o){return a.getLogger(this).warn(o),void(t.value=P(this.viewModel.value,I))}const s=w.fromObject(i);s.isValid?(this.viewModel.value=s.toJSDate(),this._activeDate=s):t.value=P(this.viewModel.value,I)}_handleDatePickerKeydown(e){"Escape"===t(e)&&(this.close(),e.preventDefault(),e.stopPropagation())}_renderCalendar(){const e=this._activeDate;if(!e)return null;const t=w.fromJSDate(this.viewModel.value);return m("div",{afterCreate:g,bind:this,class:this.classes(x.datePicker,u.widget),"data-node-ref":"_calendarNode",id:this._getCalendarId(),key:"esri-date-picker__calendar",onfocusout:this._onCalendarFocusOut,onkeydown:this._handleDatePickerKeydown,tabIndex:-1},this._renderMonthPicker(e),this._renderDayPicker(e,t),this._renderYearPicker(e))}_getCalendarId(){return`date-picker__calendar--${this.id}`}_onCalendarFocusOut(e){const t=e.relatedTarget;t&&t instanceof Node&&(this._calendarNode?.contains(t)||this._rootNode?.contains(t))||this.close(!1)}_renderMonthPicker(e){const t=k(this.container),a=t?_.right:_.left,i=t?_.left:_.right,s=f.months("long",{locale:M()}).map(((t,a)=>{const i=e.month-1===a;return m("option",{selected:i,value:a.toString()},t)})),{disabled:o,messages:r}=this;return m("div",{class:x.monthPicker},m("div",{"aria-label":r.goToPreviousMonth,bind:this,class:u.button,key:`previous-month-${o}`,onclick:this._setPreviousMonth,onkeydown:this._handlePreviousMonthKeyDown,role:"button",tabIndex:o?void 0:0,title:r.goToPreviousMonth},m("span",{"aria-hidden":"true",class:a})),m("select",{"aria-label":r.selectMonth,"aria-live":"assertive",bind:this,class:this.classes(x.monthDropdown,u.select),disabled:o,id:`${this.id}__month-picker`,onchange:this._setMonth,onkeydown:this._setMonth,title:r.selectMonth},s),m("div",{"aria-label":r.goToNextMonth,bind:this,class:u.button,key:`next-month-${o}`,onclick:this._setNextMonth,onkeydown:this._setNextMonth,role:"button",tabIndex:o?void 0:0,title:r.goToNextMonth},m("span",{"aria-hidden":"true",class:i})))}_renderDayPicker(e,t){const a=this._getWeekLabels(),i=this._getDayId(e),s=this._renderMonth(e,t),{id:o,disabled:r}=this;return m("div",{afterCreate:this._handleDayPickerCreate,"aria-activedescendant":i,"aria-labelledby":`${o}__month-picker ${o}__selected-year`,bind:this,class:x.dayPicker,id:`${o}__day-picker`,key:`day-picker-${r}`,onkeydown:this._handleDayPickerKeydown,role:"grid",tabIndex:r?void 0:0},m("div",{class:x.week,role:"row"},a.map((e=>m("div",{"aria-label":e.name,class:this.classes(x.day,x.dayHeader),role:"columnheader",title:e.name},e.abbr)))),s)}_getDayId(e){return`${this.id}__${P(e.valueOf(),I)}`}_handleDayPickerCreate(e){this._requestDayPickerFocusOnCreate&&(this._requestDayPickerFocusOnCreate=!1,e.focus())}_getWeekLabels(){const e=[],t={weekday:"long"},a={weekday:"narrow"};let i=w.now().set({weekday:l(M())});for(let s=0;s<7;s++)e.push({name:P(i.valueOf(),t),abbr:P(i.valueOf(),a)}),i=i.plus({day:1});return e}_handleDayPickerKeydown(e){const{ctrlKey:a,shiftKey:i}=e,s=t(e);if(!$.has(s))return;let o=this._activeDate;if(o){if("ArrowLeft"===s)o=o.minus({day:1});else if("ArrowRight"===s)o=o.plus({day:1});else if("ArrowUp"===s)o=o.minus({week:1});else if("ArrowDown"===s)o=o.plus({week:1});else if("PageUp"===s){const e=i?"year":"month";o=o.minus({[e]:1})}else if("PageDown"===s){const e=i?"year":"month";o=o.plus({[e]:1})}else if("Home"===s){const e=a?"year":"month";o=o.startOf(e)}else if("End"===s){const e=a?"year":"month";o=o.endOf(e)}else D(s)&&(this.viewModel.value=o.toJSDate(),this.close());this._activeDate=o,e.preventDefault(),e.stopPropagation()}}_renderMonth(e,t){const a=w.now(),i=e.startOf("month"),s=e.endOf("month"),o=6,r=7;let n=i.minus({day:h(M(),i.weekday)});const d=[];for(let l=0;l<o;l++){const o=[];for(let d=0;d<r;d++){const r=n.day,d=n.hasSame(e,"day"),l=n.hasSame(t,"day"),h=this._getDayId(n),c=b.fromDateTimes(i,s),u={[x.nearbyMonth]:!c.contains(n),[x.today]:n.hasSame(a,"day"),[x.activeDay]:d,[x.selectedDay]:l};o.push(m("div",{"aria-label":r.toString(),"aria-selected":d.toString(),bind:this,class:this.classes(x.day,u),"data-iso-date":n.toISO(),id:h,onclick:this._handleSelectedDate,onkeydown:this._handleSelectedDate,role:"gridcell"},r)),n=n.plus({day:1})}d.push(m("div",{class:x.week,role:"row"},o))}return d}_renderYearPicker(e){const t={year:"numeric"},a=e,i=P(a.valueOf(),t),s=P(a.plus({year:1}).valueOf(),t),o=P(a.minus({year:1}).valueOf(),t),{disabled:r,messages:n}=this;return m("div",{class:x.yearPicker},m("div",{"aria-label":n.goToPreviousYear,bind:this,class:x.year,key:`previous-year-${r}`,onclick:this._setPreviousYear,onkeydown:this._setPreviousYear,tabIndex:r?void 0:0,title:n.goToPreviousYear},o),m("div",{class:this.classes(x.year,x.selectedYear),id:`${this.id}__selected-year`},i),m("div",{"aria-label":n.goToNextYear,bind:this,class:x.year,key:`next-year-${r}`,onclick:this._setNextYear,onkeydown:this._handleNextYearKeyDown,tabIndex:r?void 0:0,title:n.goToNextYear},s))}_setMonth(e){const t=e.target,a=Number(t.value)+1;this._activeDate&&(this._activeDate=this._activeDate.set({month:a}),this.commitOnMonthChange&&(this.viewModel.value=this._activeDate.toJSDate()))}_setPreviousMonth(){this._activeDate&&(this._activeDate=this._activeDate.minus({month:1}),this.commitOnMonthChange&&(this.viewModel.value=this._activeDate.toJSDate()))}_handlePreviousMonthKeyDown(e){if("Tab"===e.key&&e.shiftKey)return e.preventDefault(),void this.close();D(e.key)&&this._setPreviousMonth()}_setNextMonth(){this._activeDate&&(this._activeDate=this._activeDate.plus({month:1}),this.commitOnMonthChange&&(this.viewModel.value=this._activeDate.toJSDate()))}_setPreviousYear(){this._activeDate=this._activeDate?.minus({year:1})??null}_setNextYear(){this._activeDate=this._activeDate?.plus({year:1})??null}_handleNextYearKeyDown(e){if("Tab"===e.key&&!e.shiftKey)return e.preventDefault(),void this.close();D(e.key)&&this._setNextYear()}_handleSelectedDate(e){const t=e.target;this.viewModel.value=w.fromISO(t.getAttribute("data-iso-date")).toJSDate(),this.close()}};e([o()],C.prototype,"_activeDate",void 0),e([o()],C.prototype,"_calendarPopover",void 0),e([o()],C.prototype,"_isOpen",void 0),e([o()],C.prototype,"dateInputEnabled",void 0),e([o(),v("esri/widgets/support/t9n/DatePicker")],C.prototype,"messages",void 0),e([o()],C.prototype,"value",null),e([o()],C.prototype,"commitOnMonthChange",void 0),e([o({type:c})],C.prototype,"viewModel",void 0),e([o()],C.prototype,"onChange",void 0),e([o()],C.prototype,"disabled",void 0),e([o()],C.prototype,"isOpen",null),e([y()],C.prototype,"_setNextMonth",null),e([y()],C.prototype,"_setPreviousYear",null),e([y()],C.prototype,"_handleSelectedDate",null),C=e([r("esri.widgets.support.DatePicker")],C);const N=C;export{N as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{eventKey as t}from"../../core/events.js";import a from"../../core/Logger.js";import{watch as i,sync as s}from"../../core/reactiveUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import n from"../Widget.js";import{parseDateIntoParts as d,getFirstDayOfWeek as l,getLocaleDayOfWeek as h}from"./datePickerUtils.js";import c from"./DatePickerViewModel.js";import{globalCss as u}from"./globalCss.js";import{legacyIcon as p}from"./legacyIcon.js";import _ from"./Popover.js";import{accessibleHandler as v}from"./decorators/accessibleHandler.js";import{messageBundle as y}from"./decorators/messageBundle.js";import{tsx as m}from"./jsxFactory.js";import{storeNode as g,isActivationKey as D,isRTL as k}from"./widgetUtils.js";import{DateTime as w,Info as f,Interval as b}from"luxon";import{formatDate as P}from"../../intl/date.js";import{getLocale as M}from"../../intl/locale.js";const O="esri-date-picker",x={base:O,datePicker:`${O}__calendar`,monthPicker:`${O}__month-picker`,dayPicker:`${O}__day-picker`,week:`${O}__week-item`,nearbyMonth:`${O}__day-item--nearby-month`,activeDay:`${O}__day-item--active`,today:`${O}__day-item--today`,selectedDay:`${O}__day-item--selected`,day:`${O}__day-item`,dayHeader:`${O}__day-item--header`,yearPicker:`${O}__year-picker`,selectedYear:`${O}__year-picker-item--selected`,year:`${O}__year-picker-item`,monthDropdown:`${O}__month-dropdown`,date:`${O}__date`,datePickerToggle:`${O}__calendar-toggle`,dateInput:`${O}__input`,dateTextInput:`${O}__text-input`,leadingIcon:`${O}__icon--leading`},I=new Set([" ","ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Enter","Home","PageDown","PageUp"]);let $=class extends n{constructor(e,t){super(e,t),this._calendarNode=null,this._inputOrButtonNode=null,this._rootNode=null,this._requestDayPickerFocusOnCreate=!1,this._activeDate=null,this._calendarPopover=new _({owner:this,placement:"bottom-start",anchorElement:()=>this._rootNode,renderContentFunction:this._renderCalendar}),this._isOpen=!1,this.dateInputEnabled=!1,this.messages=null,this.commitOnMonthChange=!1,this.viewModel=new c,this.disabled=!1,this.timeZone=void 0,this.toggle=this.toggle.bind(this)}initialize(){this.addHandles(i((()=>({viewModel:this.viewModel,value:this.viewModel?.value})),(({viewModel:e,value:t})=>{!this.destroyed&&e&&null!=this.onChange&&this.onChange(t)}),s))}destroy(){this._calendarPopover.destroy()}get _dateTimeFormatOptions(){return{year:"numeric",month:"2-digit",day:"2-digit",timeZone:this.timeZone||void 0}}get value(){return this.viewModel.value}set value(e){this.viewModel.value=e}get isOpen(){return this._isOpen}render(){return m("div",{afterCreate:g,bind:this,class:this.classes(x.base,u.widget),"data-node-ref":"_rootNode"},this.dateInputEnabled?this._renderInputAndButtonMode():this._renderButtonOnlyMode())}toggle(){this._isOpen?this.close():this.open()}open(e=!0){this._activeDate=w.fromJSDate(this.viewModel.value),this._isOpen=!0,this._calendarPopover.open=!0,this._requestDayPickerFocusOnCreate=e}close(e=!0){this._activeDate=null,this._isOpen=!1,this._calendarPopover.open=!1,e&&this._inputOrButtonNode?.focus()}_renderButtonOnlyMode(){const e=P(this.viewModel.value,this._dateTimeFormatOptions),{disabled:t,_isOpen:a,messages:i}=this;return m("div",{afterCreate:g,"aria-controls":a?this._getCalendarId():null,"aria-expanded":a.toString(),"aria-haspopup":"true","aria-label":i.setDate,"aria-pressed":a.toString(),bind:this,class:this.classes(u.widgetButton,u.select,x.datePickerToggle),"data-node-ref":"_inputOrButtonNode",key:`date-button-${t}`,onclick:this.toggle,onkeydown:this._handleDateButtonKeyDown,role:"button",tabIndex:t?void 0:0},m("span",{class:x.date},e))}_renderInputAndButtonMode(){const e=P(this.viewModel.value,this._dateTimeFormatOptions),{_isOpen:t,messages:a}=this;return m("div",{class:this.classes(x.dateInput)},m("input",{afterCreate:g,"aria-controls":t?this._getCalendarId():null,"aria-haspopup":"true","aria-label":a.setDate,bind:this,class:this.classes(x.dateTextInput,u.input),"data-node-ref":"_inputOrButtonNode",key:"date-input",onblur:this._handleDateInputBlur,onclick:this._handleDateInputClick,onkeydown:this._handleDateInputKeyDown,type:"text",value:e}),m("span",{"aria-hidden":"true",class:this.classes(x.leadingIcon,p.calendar)}))}_handleDateInputClick(){this.open(!1)}_handleDateInputKeyDown(e){const{key:t}=e;this._isOpen?"Enter"===t?this._handleDateText(e):"Escape"===t&&this.close():"ArrowDown"===t&&(this.open(),e.preventDefault())}_handleDateButtonKeyDown(e){const{key:t,shiftKey:a}=e;this._isOpen&&"Tab"===t&&a?this.close():D(t)&&this.toggle()}_handleDateInputBlur(e){this._isOpen||this._handleDateText(e)}_handleDateText(e){const t=e.currentTarget;let i;try{i=d(t.value,this._dateTimeFormatOptions)}catch(o){return a.getLogger(this).warn(o),void(t.value=P(this.viewModel.value,this._dateTimeFormatOptions))}const s=w.fromObject(i);s.isValid?(this.viewModel.value=s.toJSDate(),this._activeDate=s):t.value=P(this.viewModel.value,this._dateTimeFormatOptions)}_handleDatePickerKeydown(e){"Escape"===t(e)&&(this.close(),e.preventDefault(),e.stopPropagation())}_renderCalendar(){const e=this._activeDate;if(!e)return null;const t=w.fromJSDate(this.viewModel.value);return m("div",{afterCreate:g,bind:this,class:this.classes(x.datePicker,u.widget),"data-node-ref":"_calendarNode",id:this._getCalendarId(),key:"esri-date-picker__calendar",onfocusout:this._onCalendarFocusOut,onkeydown:this._handleDatePickerKeydown,tabIndex:-1},this._renderMonthPicker(e),this._renderDayPicker(e,t),this._renderYearPicker(e))}_getCalendarId(){return`date-picker__calendar--${this.id}`}_onCalendarFocusOut(e){const t=e.relatedTarget;t&&t instanceof Node&&(this._calendarNode?.contains(t)||this._rootNode?.contains(t))||this.close(!1)}_renderMonthPicker(e){const t=k(this.container),a=t?p.right:p.left,i=t?p.left:p.right,s=f.months("long",{locale:M()}).map(((t,a)=>{const i=e.month-1===a;return m("option",{selected:i,value:a.toString()},t)})),{disabled:o,messages:r}=this;return m("div",{class:x.monthPicker},m("div",{"aria-label":r.goToPreviousMonth,bind:this,class:u.button,key:`previous-month-${o}`,onclick:this._setPreviousMonth,onkeydown:this._handlePreviousMonthKeyDown,role:"button",tabIndex:o?void 0:0,title:r.goToPreviousMonth},m("span",{"aria-hidden":"true",class:a})),m("select",{"aria-label":r.selectMonth,"aria-live":"assertive",bind:this,class:this.classes(x.monthDropdown,u.select),disabled:o,id:`${this.id}__month-picker`,onchange:this._setMonth,onkeydown:this._setMonth,title:r.selectMonth},s),m("div",{"aria-label":r.goToNextMonth,bind:this,class:u.button,key:`next-month-${o}`,onclick:this._setNextMonth,onkeydown:this._setNextMonth,role:"button",tabIndex:o?void 0:0,title:r.goToNextMonth},m("span",{"aria-hidden":"true",class:i})))}_renderDayPicker(e,t){const a=this._getWeekLabels(),i=this._getDayId(e),s=this._renderMonth(e,t),{id:o,disabled:r}=this;return m("div",{afterCreate:this._handleDayPickerCreate,"aria-activedescendant":i,"aria-labelledby":`${o}__month-picker ${o}__selected-year`,bind:this,class:x.dayPicker,id:`${o}__day-picker`,key:`day-picker-${r}`,onkeydown:this._handleDayPickerKeydown,role:"grid",tabIndex:r?void 0:0},m("div",{class:x.week,role:"row"},a.map((e=>m("div",{"aria-label":e.name,class:this.classes(x.day,x.dayHeader),role:"columnheader",title:e.name},e.abbr)))),s)}_getDayId(e){return`${this.id}__${P(e.valueOf(),this._dateTimeFormatOptions)}`}_handleDayPickerCreate(e){this._requestDayPickerFocusOnCreate&&(this._requestDayPickerFocusOnCreate=!1,e.focus())}_getWeekLabels(){const e=[],t={weekday:"long"},a={weekday:"narrow"};let i=w.now().set({weekday:l(M())});for(let s=0;s<7;s++)e.push({name:P(i.valueOf(),t),abbr:P(i.valueOf(),a)}),i=i.plus({day:1});return e}_handleDayPickerKeydown(e){const{ctrlKey:a,shiftKey:i}=e,s=t(e);if(!I.has(s))return;let o=this._activeDate;if(o){if("ArrowLeft"===s)o=o.minus({day:1});else if("ArrowRight"===s)o=o.plus({day:1});else if("ArrowUp"===s)o=o.minus({week:1});else if("ArrowDown"===s)o=o.plus({week:1});else if("PageUp"===s){const e=i?"year":"month";o=o.minus({[e]:1})}else if("PageDown"===s){const e=i?"year":"month";o=o.plus({[e]:1})}else if("Home"===s){const e=a?"year":"month";o=o.startOf(e)}else if("End"===s){const e=a?"year":"month";o=o.endOf(e)}else D(s)&&(this.viewModel.value=o.toJSDate(),this.close());this._activeDate=o,e.preventDefault(),e.stopPropagation()}}_renderMonth(e,t){const a=w.now(),i=e.startOf("month"),s=e.endOf("month"),o=6,r=7;let n=i.minus({day:h(M(),i.weekday)});const d=[];for(let l=0;l<o;l++){const o=[];for(let d=0;d<r;d++){const r=n.day,d=n.hasSame(e,"day"),l=n.hasSame(t,"day"),h=this._getDayId(n),c=b.fromDateTimes(i,s),u={[x.nearbyMonth]:!c.contains(n),[x.today]:n.hasSame(a,"day"),[x.activeDay]:d,[x.selectedDay]:l};o.push(m("div",{"aria-label":r.toString(),"aria-selected":d.toString(),bind:this,class:this.classes(x.day,u),"data-iso-date":n.toISO(),id:h,onclick:this._handleSelectedDate,onkeydown:this._handleSelectedDate,role:"gridcell"},r)),n=n.plus({day:1})}d.push(m("div",{class:x.week,role:"row"},o))}return d}_renderYearPicker(e){const t={year:"numeric"},a=e,i=P(a.valueOf(),t),s=P(a.plus({year:1}).valueOf(),t),o=P(a.minus({year:1}).valueOf(),t),{disabled:r,messages:n}=this;return m("div",{class:x.yearPicker},m("div",{"aria-label":n.goToPreviousYear,bind:this,class:x.year,key:`previous-year-${r}`,onclick:this._setPreviousYear,onkeydown:this._setPreviousYear,tabIndex:r?void 0:0,title:n.goToPreviousYear},o),m("div",{class:this.classes(x.year,x.selectedYear),id:`${this.id}__selected-year`},i),m("div",{"aria-label":n.goToNextYear,bind:this,class:x.year,key:`next-year-${r}`,onclick:this._setNextYear,onkeydown:this._handleNextYearKeyDown,tabIndex:r?void 0:0,title:n.goToNextYear},s))}_setMonth(e){const t=e.target,a=Number(t.value)+1;this._activeDate&&(this._activeDate=this._activeDate.set({month:a}),this.commitOnMonthChange&&(this.viewModel.value=this._activeDate.toJSDate()))}_setPreviousMonth(){this._activeDate&&(this._activeDate=this._activeDate.minus({month:1}),this.commitOnMonthChange&&(this.viewModel.value=this._activeDate.toJSDate()))}_handlePreviousMonthKeyDown(e){if("Tab"===e.key&&e.shiftKey)return e.preventDefault(),void this.close();D(e.key)&&this._setPreviousMonth()}_setNextMonth(){this._activeDate&&(this._activeDate=this._activeDate.plus({month:1}),this.commitOnMonthChange&&(this.viewModel.value=this._activeDate.toJSDate()))}_setPreviousYear(){this._activeDate=this._activeDate?.minus({year:1})??null}_setNextYear(){this._activeDate=this._activeDate?.plus({year:1})??null}_handleNextYearKeyDown(e){if("Tab"===e.key&&!e.shiftKey)return e.preventDefault(),void this.close();D(e.key)&&this._setNextYear()}_handleSelectedDate(e){const t=e.target;this.viewModel.value=w.fromISO(t.getAttribute("data-iso-date")).toJSDate(),this.close()}};e([o()],$.prototype,"_activeDate",void 0),e([o()],$.prototype,"_calendarPopover",void 0),e([o()],$.prototype,"_isOpen",void 0),e([o()],$.prototype,"_dateTimeFormatOptions",null),e([o()],$.prototype,"dateInputEnabled",void 0),e([o(),y("esri/widgets/support/t9n/DatePicker")],$.prototype,"messages",void 0),e([o()],$.prototype,"value",null),e([o()],$.prototype,"commitOnMonthChange",void 0),e([o({type:c})],$.prototype,"viewModel",void 0),e([o()],$.prototype,"onChange",void 0),e([o()],$.prototype,"disabled",void 0),e([o()],$.prototype,"timeZone",void 0),e([o()],$.prototype,"isOpen",null),e([v()],$.prototype,"_setNextMonth",null),e([v()],$.prototype,"_setPreviousYear",null),e([v()],$.prototype,"_handleSelectedDate",null),$=e([r("esri.widgets.support.DatePicker")],$);const C=$;export{C 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{deprecatedProperty as t}from"../../../core/deprecate.js";import o from"../../../core/Evented.js";import{handlesGroup as s}from"../../../core/handleUtils.js";import r from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{watch as a}from"../../../core/reactiveUtils.js";import{property as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{deprecatedProperty as t}from"../../../core/deprecate.js";import o from"../../../core/Evented.js";import{handlesGroup as s}from"../../../core/handleUtils.js";import r from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{watch as a}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{isKnowledgeGraphLayer as l}from"../../../layers/support/layerUtils.js";import{findLayerView as p}from"../../../views/draw/support/layerUtils.js";import{isSelectableLayerView2D as u}from"../../../views/support/layerViewUtils.js";import h from"../Selector2D.js";let m=class extends o.EventedAccessor{constructor(e){super(e),this._operationHandlesGroup=null,this.activeOperation=null,this.selector=new h,this.sources=null}initialize(){this.addHandles([a((()=>this._sources),(e=>{this.selector.sources=e,this.activeOperation&&(this.activeOperation.sources=e)}))])}destroy(){this._operationHandlesGroup=i(this._operationHandlesGroup),this.selector.destroy()}get _sources(){const{sources:e,view:t}=this;return t&&e?.length?e.flatMap((e=>{if(u(e))return e;if(l(e)){const o=e.layers||[],s=o.map((e=>{const o=p(t,e)||void 0;return u(o)?o:e}));return s.length?s.toArray():o.length?o.toArray():e}const o=p(t,e)||void 0;return u(o)?o:e})):[]}set cursor(e){this.activeOperation&&(this.activeOperation.cursor=e),this.selector.cursor=e,this._set("cursor",e)}get layers(){return t(r.getLogger(this),"layers",{replacement:"Use SelectionToolbar.sources instead."}),this.sources}set layers(e){t(r.getLogger(this),"layers",{replacement:"Use SelectionToolbar.sources instead."}),this.sources=e}get state(){return this.activeOperation?"active":this.view?.ready&&this._sources.length?"ready":"disabled"}set view(e){this.selector.view=e,this._set("view",e)}async selectionFrom(e,t){const{_sources:o}=this;return this.view&&o.length?this.selector.selectionFrom({geometry:e,selectionOptions:t,sources:o}):[]}cancel(){"active"===this.state&&(this.activeOperation?.cancel(),this._set("activeOperation",null))}activate(e){const{_sources:t,state:o}=this;if("disabled"===o||!t?.length)return;"active"===o&&this.cancel();const r=this.selector.draw({sources:t,operationOptions:e});return this._operationHandlesGroup=s([r.once("complete",(e=>this._onOperationComplete(e))),r.on("selection-change",(e=>this._onOperationSelectionChange(e)))]),this._set("activeOperation",r),r}_onOperationSelectionChange(e){this.emit("selection-change",e)}_onOperationComplete(e){this._operationHandlesGroup=i(this._operationHandlesGroup),this._set("activeOperation",null),this.emit("complete",e)}};e([c()],m.prototype,"_sources",null),e([c({readOnly:!0})],m.prototype,"activeOperation",void 0),e([c()],m.prototype,"cursor",null),e([c()],m.prototype,"layers",null),e([c({readOnly:!0})],m.prototype,"selector",void 0),e([c()],m.prototype,"sources",void 0),e([c({readOnly:!0})],m.prototype,"state",null),e([c()],m.prototype,"view",null),m=e([n("esri.widgets.support.SelectionToolbar.SelectionToolbarViewModel")],m);const d=m;export{d 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../symbols.js";import t from"../../../core/Collection.js";import o from"../../../core/Evented.js";import{debounce as s,ignoreAbortErrors as i}from"../../../core/promiseUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../layers/GraphicsLayer.js";import n from"../../Sketch/SketchViewModel.js";import{getSelectionFromGeometry as a}from"./selectorUtils.js";import p from"../../../symbols/SimpleFillSymbol.js";import h from"../../../symbols/SimpleLineSymbol.js";import m from"../../../symbols/SimpleMarkerSymbol.js";const d=100;let y=class extends o.EventedAccessor{constructor({options:e,view:o}){super(),this._abortController=null,this._activeOptions=null,this._completed=!1,this._dashedFillSymbol=new p({color:[0,0,0,0],outline:{style:"dash",color:[12,207,255],width:2}}),this._dashedLineSymbol=new h({style:"dash",color:[12,207,255],width:2}),this._defaultOptions={createTool:"rectangle",
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../symbols.js";import t from"../../../core/Collection.js";import o from"../../../core/Evented.js";import{debounce as s,ignoreAbortErrors as i}from"../../../core/promiseUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../layers/GraphicsLayer.js";import n from"../../Sketch/SketchViewModel.js";import{getSelectionFromGeometry as a}from"./selectorUtils.js";import p from"../../../symbols/SimpleFillSymbol.js";import h from"../../../symbols/SimpleLineSymbol.js";import m from"../../../symbols/SimpleMarkerSymbol.js";const d=100;let y=class extends o.EventedAccessor{constructor({options:e,view:o}){super(),this._abortController=null,this._activeOptions=null,this._completed=!1,this._dashedFillSymbol=new p({color:[0,0,0,0],outline:{style:"dash",color:[12,207,255],width:2}}),this._dashedLineSymbol=new h({style:"dash",color:[12,207,255],width:2}),this._defaultOptions={createTool:"rectangle",selectionOptions:{overlaps:!0,intersects:!0,contains:!1}},this._processSelectionGeometry=async({canceled:e,completed:t,selector:o})=>{const{_activeOptions:s,sources:i,selection:r,view:l}=this;if(this._abortController&&this._abortController.abort(),(t||e)&&(this._completed=!0),e)return void this._onComplete([],!0);if(!o||!i?.length||!l)return void r.removeAll();const c=new AbortController;this._abortController=c;const{added:n,removed:p}=await a({currentSelection:r,sources:i,options:s.selectionOptions,selector:o,signal:c.signal,view:l});this._abortController===c&&(this._abortController=null),c.signal.aborted||(t?this._onComplete(this.selection.toArray(),!1):(n.length||p.length)&&this.emit("selection-change",{added:n,removed:p,type:"selection-change"}))},this._processDebounced=s(this._processSelectionGeometry,d),this._sketchViewModel=new n,this._sketchGraphicsLayer=new c({listMode:"hide",internal:!0}),this._transparentPointSymbol=new m({color:[0,0,0,0],outline:{style:"none",width:0}}),this.options=null,this.selection=new t,this.sources=null,this.options=e,this.view=o;const{_dashedFillSymbol:i,_dashedLineSymbol:r,_sketchViewModel:l,_sketchGraphicsLayer:y,_transparentPointSymbol:_}=this;l.set({layer:y,activePointSymbol:_,activeLineSymbol:r,activeVertexSymbol:_,activeFillSymbol:i,pointSymbol:_,polygonSymbol:i,polylineSymbol:r,vertexSymbol:_,view:o}),this.addHandles([l.on("create",(e=>this._onSketchEvent(e))),l.on(["undo","redo"],(e=>this._onSketchEvent(e))),l.watch("activeComponent.forceUniformSize",(()=>this._onSketchGeometryChange()))])}initialize(){this._load()}set cursor(e){const t=this._sketchViewModel?.activeComponent;"draw-2d"!==t?.type&&"draw-3d"!==t?.type||(t.cursor=e),this._set("cursor",e)}get state(){const{_completed:e,_sketchViewModel:{state:t}}=this;return e?"complete":"active"===t?"active":"disabled"}set view(e){this._sketchViewModel.view=e,this._set("view",e)}cancel(){return this._sketchViewModel.cancel()}async _load(){await(this.view?.whenReady());const{_defaultOptions:e,options:t}=this,o=t?.createOptions?.cursor||this.cursor||e.createOptions?.cursor,{createTool:s,createOptions:i}=this._activeOptions={...e,...t,createOptions:{...e.createOptions,cursor:o,...t?.createOptions},selectionOptions:{...e.selectionOptions,...t?.selectionOptions}};this._sketchViewModel.create(s,i)}_onSketchEvent(e){const t="create"===e.type?e.graphic:e.graphics[0],o=t?.geometry,s="create"===e.type&&"cancel"===e.state,r="create"===e.type&&"complete"===e.state;i(this._processDebounced({canceled:s,completed:r,selector:o}))}_onSketchGeometryChange(){const e=this._sketchViewModel.createGraphic,t=e?.geometry;t&&i(this._processDebounced({canceled:!1,completed:!1,selector:t}))}_onComplete(e,t){this.removeAllHandles(),this.notifyChange("state"),this.emit("complete",{aborted:t,selection:e,type:"complete"})}};e([r()],y.prototype,"_abortController",void 0),e([r()],y.prototype,"_completed",void 0),e([r()],y.prototype,"cursor",null),e([r()],y.prototype,"options",void 0),e([r({readOnly:!0})],y.prototype,"selection",void 0),e([r()],y.prototype,"sources",void 0),e([r({readOnly:!0})],y.prototype,"state",null),e([r()],y.prototype,"view",null),y=e([l("esri.widgets.support.Selector2D.SelectionOperation2D")],y);const _=y;export{_ 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import t from"../../core/Collection.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import i from"./Selector2D/SelectionOperation2D.js";import{getSelectionFromGeometry as c}from"./Selector2D/selectorUtils.js";let n=class extends s{constructor(o){super(o),this._defaultSelectionOptions={intersects:!0,overlaps:!0,contains:!0},this.options=null,this.sources=null,this.view=null}draw(o){const{operationOptions:s}=o,{view:t}=this;return new i({sources:o.sources??this.sources??[],options:{...s,selectionOptions:{...this._defaultSelectionOptions,...this.options,...s?.selectionOptions}},view:t})}async selectionFrom(o){const{view:s}=this,e=o.sources??this.sources??[];if(!e.length||!s)return[];const r=new t;return await c({selector:o.geometry,currentSelection:r,sources:e,options:{...this._defaultSelectionOptions,...this.options,...o.selectionOptions},view:s}),r.toArray()}};o([e()],n.prototype,"options",void 0),o([e()],n.prototype,"sources",void 0),o([e()],n.prototype,"view",void 0),n=o([r("esri.widgets.support.Selector2D")],n);const p=n;export{p as default};
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import s from"../../core/Accessor.js";import t from"../../core/Collection.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import i from"./Selector2D/SelectionOperation2D.js";import{getSelectionFromGeometry as c}from"./Selector2D/selectorUtils.js";let n=class extends s{constructor(o){super(o),this._defaultSelectionOptions={intersects:!0,overlaps:!0,contains:!0},this.cursor=null,this.options=null,this.sources=null,this.view=null}draw(o){const{operationOptions:s}=o,{view:t}=this;return new i({cursor:this.cursor,sources:o.sources??this.sources??[],options:{...s,selectionOptions:{...this._defaultSelectionOptions,...this.options,...s?.selectionOptions}},view:t})}async selectionFrom(o){const{view:s}=this,e=o.sources??this.sources??[];if(!e.length||!s)return[];const r=new t;return await c({selector:o.geometry,currentSelection:r,sources:e,options:{...this._defaultSelectionOptions,...this.options,...o.selectionOptions},view:s}),r.toArray()}};o([e()],n.prototype,"cursor",void 0),o([e()],n.prototype,"options",void 0),o([e()],n.prototype,"sources",void 0),o([e()],n.prototype,"view",void 0),n=o([r("esri.widgets.support.Selector2D")],n);const p=n;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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import"../../intl.js";import{eventKey as e}from"../../core/events.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"../Widget.js";import{globalCss as
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import"../../intl.js";import{eventKey as e}from"../../core/events.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"../Widget.js";import{globalCss as o}from"./globalCss.js";import a from"./TimePickerViewModel.js";import"./widgetUtils.js";import{messageBundle as n}from"./decorators/messageBundle.js";import{tsx as m}from"./jsxFactory.js";import{DateTime as l}from"luxon";import{getLocale as h}from"../../intl/locale.js";import{formatDate as u}from"../../intl/date.js";const p="esri-time-picker",c={base:p,timePicker:`${p}__date-picker`,timePickerInput:`${p}__input`},d="t",_=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Tab"]);function v(t,e){return null!=t&&u(t.valueOf(),e).includes(" ")}let f=class extends r{constructor(t,e){super(t,e),this._activePart=null,this._activeTime=null,this.messages=null,this.timeZone=null,this.timeZoneName=null,this.viewModel=new a}get _dateTimeFormatOptions(){return{hour:"numeric",minute:"numeric",timeZone:this.timeZone??void 0,timeZoneName:this.timeZoneName??void 0}}get _dateTimeOptions(){return{locale:h(),numberingSystem:"latn",zone:this.timeZone||void 0}}get value(){return this.viewModel.value}set value(t){this.viewModel.value=t}render(){const t=this._activeTime||this.viewModel.value;return m("div",{class:this.classes(c.base,o.widget)},m("input",{afterUpdate:this._handleInputUpdate,"aria-label":this.messages.inputTitle,bind:this,class:this.classes(c.timePickerInput,o.input),onblur:this._handleInputBlur,onclick:this._handleInputClick,onfocus:this._handleInputFocus,oninput:this._handleInputKeydown,onkeydown:this._handleInputKeydown,onpaste:this._handleInputPaste,onwheel:this._handleInputWheel,value:u(t.valueOf(),this._dateTimeFormatOptions)}))}_handleInputBlur(){this._activeTime?.isValid&&(this.viewModel.value=this._activeTime.toJSDate()),this._activeTime=null,this._activePart=null}_handleInputUpdate(t){this._selectPart(t,this._activePart)}_selectPart(t,e){const i=this._activeTime;if(!i||!t)return;const s=u(i.valueOf(),this._dateTimeFormatOptions),r=0,o=s.indexOf(":");if("hours"===e)return void t.setSelectionRange(r,o);const a=o+1,n=a+2;if("minutes"===e)return void t.setSelectionRange(a,n);const m=n+1,l=s.length;"meridiem"!==e||t.setSelectionRange(m,l)}_handleInputFocus(t){this._activePart="hours",this._activeTime=l.fromJSDate(this.viewModel.value,{zone:this.timeZone||void 0}).startOf("minute"),this._selectPart(t.target,"hours")}_caretIndexToPartName(t){const e=this._activeTime?.toFormat(d,{locale:h(),numberingSystem:"latn"});if(!e)return null;const i=e.indexOf(":"),s=e.indexOf(" ");return t<=i?"hours":t>i&&t<=s?"minutes":"meridiem"}_handleInputKeydown(t){const{ctrlKey:i,metaKey:s,shiftKey:r}=t,o=e(t),a=this._activeTime,n=this._activePart,m=/\d/.test(o),l=/^a|p$/i.test(o),h=s||i;if((_.has(o)||m||"meridiem"===n&&l&&!h)&&null!=a){if("ArrowLeft"===o)this._activePart=this._prevPart();else if("ArrowRight"===o)this._activePart=this._nextPart();else if("Tab"===o){const t=r?this._prevPart():this._nextPart();if(t===this._activePart)return;this._activePart=t}else if("ArrowUp"===o)this._shift("up",n);else if("ArrowDown"===o)this._shift("down",n);else if(m)this._setTime(a,n,Number(o));else if(l){const t=o.toLowerCase(),e=a.hour;("a"===t&&e>=12||"p"===t&&e<12)&&this._shift("up",n)}t.preventDefault(),t.stopImmediatePropagation()}else h||(t.preventDefault(),t.stopImmediatePropagation())}_handleInputClick(t){const e=t.target;this._activePart=null,this.renderNow(),this._activePart=this._caretIndexToPartName(e.selectionStart??0)}_getOrderedParts(){return v(this._activeTime,this._dateTimeFormatOptions)?["hours","minutes","meridiem"]:["hours","minutes"]}_prevPart(){const t=this._getOrderedParts(),e=this._activePart?t.indexOf(this._activePart)-1:0;return t[Math.max(e,0)]}_nextPart(){const t=this._getOrderedParts(),e=this._activePart?t.indexOf(this._activePart)+1:0;return t[Math.min(e,t.length-1)]}_setTime(t,e,i){if("hours"===e){const e=v(t,this._dateTimeFormatOptions)?12:24,s=""+t.hour%e,r=i,o=Number(`${s}${i}`);2===s.length||o>e?this._activeTime=t.set({hour:r}):o<=e&&(this._activeTime=t.set({hour:o}))}else if("minutes"===e){const e=59,s=`${t.minute}`,r=i,o=Number(`${s}${i}`);2===s.length||o>e?this._activeTime=t.set({minute:r}):o<e&&(this._activeTime=t.set({minute:o}))}}_parseTime(t){if(!t)return null;let e=l.fromFormat(t,d,this._dateTimeOptions);return e.isValid?e:(e=l.fromISO(t,this._dateTimeOptions),e.isValid?e:(e=l.fromRFC2822(t,this._dateTimeOptions),e.isValid?e:(e=l.fromJSDate(new Date(t),this._dateTimeOptions),e.isValid?e:null)))}_handleInputPaste(t){const e=t.clipboardData?.getData("text/plain"),i=this._parseTime(e);i&&(this._activeTime=i),t.preventDefault(),t.stopImmediatePropagation()}_handleInputWheel(t){const e=t.deltaY<0?"up":"down";this._shift(e,this._activePart)}_shift(t,e){if(!e)return;const i="up"===t?"plus":"minus",s="meridiem"===e?12:1,r="hours"===e?"hour":"minutes"===e?"minute":"hours";this._activeTime=this._activeTime?.[i]({[r]:s})??null}};t([i()],f.prototype,"_dateTimeFormatOptions",null),t([i()],f.prototype,"_dateTimeOptions",null),t([i(),n("esri/widgets/support/t9n/TimePicker")],f.prototype,"messages",void 0),t([i()],f.prototype,"timeZone",void 0),t([i()],f.prototype,"timeZoneName",void 0),t([i()],f.prototype,"value",null),t([i({type:a})],f.prototype,"viewModel",void 0),f=t([s("esri.widgets.support.TimePicker")],f);const T=f;export{T 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../intl.js";import{formatTimestamp as
|
|
5
|
+
import"../../intl.js";import{clamp as n}from"../../core/mathUtils.js";import{formatTimestamp as e,formatTimeOnly as t,formatDateOnly as l,formatDate as o}from"../../intl/date.js";import{utc as i}from"../../time/timeZoneUtils.js";import{DateTime as u,FixedOffsetZone as r}from"luxon";import{getLocale as m}from"../../intl/locale.js";const s=i,a={date:null,dateAsString:null,time:null,timeZoneOffset:null},f=new Map([["hours",3600],["minutes",60],["seconds",1],["deciseconds",.1],["centiseconds",.01],["milliseconds",.001]]),c="yyyy-MM-dd",d="TT";var y;!function(n){n.HM="HH:mm",n.HMS="HH:mm:ss",n.HMS_MS="HH:mm:ss.SSS"}(y||(y={}));const S=[y.HMS_MS,y.HMS,y.HM,d],p="latn",M=new Set(["date-only","time-only","timestamp-offset"]),h=n=>"valueAsDate"in n;function v(n){return{locale:m(),numberingSystem:p,zone:n??s}}function H(n){return n?.isValid?n.toMillis():null}function O(n,e){return null===n?null:u.fromMillis(n,v(e))}function Z(n){if(null==n)return a;const e=u.fromISO(n,{setZone:!0});return{date:e.toJSDate(),dateAsString:e.toFormat(c,v()),time:e.toFormat(y.HMS_MS,v()),timeZoneOffset:e.offset.toString()}}function g(n,e){if(null==n||isNaN(n))return a;const t=O(n,e);return t?{date:t.toJSDate(),dateAsString:t.toFormat(c,v(e)),time:t.toFormat(d,v(e))}:a}function w(n,i,u){if(!n||null==i)return null;switch(n.type){case"date":return o(i,u);case"date-only":return l(i,u);case"time-only":return t(i,u);case"timestamp-offset":return e(i,u);default:return null}}function x(n){const{dateComponent:e,timeComponent:t,timeZoneComponent:l,oldValue:o}=n;if(!e?.value||!t?.value)return null;const{year:m,month:s,day:a}=u.fromFormat(e.value,c),{hour:f,minute:d,second:y,millisecond:S}=V(t,i)??u.now(),p=Z(o),M=null!=l?.value?parseInt(l.value,10):null!=p.timeZoneOffset?parseInt(p.timeZoneOffset,10):(new Date).getTimezoneOffset(),h=r.instance(M),v=u.fromObject({year:m,month:s,day:a,hour:f,minute:d,second:y,millisecond:S},{zone:h});return v.isValid?v.toISO({includeOffset:!0}):null}function F(n){const{dateComponent:e,timeComponent:t,timeZone:l,max:o,min:i,oldValue:r}=n,m=V(e,l);let s=!!n.applyRange;if(!m)return null;let a=null;if(null!=t?.value){const n=V(t,l),e=Date.now(),i=null!=o&&o<e?o:e,r=u.fromMillis(i,v(l)),s=m||r,{year:f,month:c,day:d}=s,{hour:y,minute:S,second:p,millisecond:M}=n||r;a=s.set({year:f,month:c,day:d,hour:y,minute:S,second:p,millisecond:M})}else{const n=O(A({value:r??Date.now(),max:o,min:i}),l),{year:e,month:t,day:u}=m,{hour:f,minute:c,second:d,millisecond:y}=n;s=!0,a=m.set({year:e,month:t,day:u,hour:f,minute:c,second:d,millisecond:y})}if(!a.isValid)return null;const f=a.toMillis();return s?A({value:f,max:o,min:i}):f}function V(n,e){if(!n)return null;let t=null;if(h(n)){const l=n.value;if(!l||Array.isArray(l))return null;t=u.fromFormat(l,c,v(e))}else{if(!n.value)return null;S.find((l=>(t=u.fromFormat(n.value,l,v(e)),t.isValid)))}return t?.isValid?t:null}function j(n){const{max:e,min:t,value:l}=n;return!isNaN(l)&&(!(null!=e&&l>e)&&!(null!=t&&l<t))}function A(e){const{max:t,min:l,value:o}=e;return null!=t&&null!=l?n(o,l,t):null!=t&&o>t?t:null!=l&&o<l?l:o}export{y as TimeStampOffsetPattern,A as clampValueToRange,O as createDateTimeFromFieldValue,M as dateFieldsWithStringFieldValue,H as dateTimeToFieldValue,c as defaultDatePattern,d as defaultTimePattern,v as getDefaultLocaleOptions,x as getISOFieldValueFromDateComponents,w as getLabelForDateFieldValue,V as getLocalDateTimeFromComponent,F as getUnixFieldValueFromDateComponents,h as isCalciteDateComponent,p as numberingSystem,Z as prepareISOFieldValueForDateComponents,g as prepareUnixFieldValueForDateComponents,S as supportedTimeFormats,f as timeResolutionToStepMap,j as valueIsInRange};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[4330],{65845:(e,t,r)=>{r.d(t,{D:()=>n});var a=r(81153);function n(e){e?.writtenProperties&&e.writtenProperties.forEach((({target:e,propName:t,newOrigin:r})=>{(0,a.l)(e)&&r&&e.originOf(t)!==r&&e.updateOrigin(t,r)}))}},81153:(e,t,r)=>{function a(e){return e&&"getAtOrigin"in e&&"originOf"in e}r.d(t,{l:()=>a})},94330:(e,t,r)=>{r.d(t,{save:()=>c,saveAs:()=>d});var a=r(64383),n=r(14661);const o="Stream Service",i="stream-layer-save",l="stream-layer-save-as";function s(e){return{isValid:"stream"===e.type&&!!e.url&&!e.webSocketUrl,errorMessage:"Stream layer should be created using a url to a stream service"}}function u(e){const t=e.layerJSON;return Promise.resolve(t&&Object.keys(t).length?t:null)}async function p(e,t){const{parsedUrl:r,title:a,fullExtent:o}=e;t.url=r.path,t.title||=a,t.extent=null,null!=o&&(t.extent=await(0,n.$o)(o)),(0,n.qj)(t,n.Kz.SINGLE_LAYER)}async function c(e,t){return(0,a.a1)({layer:e,itemType:o,validateLayer:s,createItemData:u,errorNamePrefix:i},t)}async function d(e,t,r){return(0,a.po)({layer:e,itemType:o,validateLayer:s,createItemData:u,errorNamePrefix:l,newItem:t,setItemProperties:p},r)}},64383:(e,t,r)=>{r.d(t,{a1:()=>g,po:()=>v});var a=r(20102),n=r(65845),o=r(48522),i=r(15235),l=r(33516),s=r(14661),u=r(14769);async function p(e){const{layer:t,errorNamePrefix:r,validateLayer:n}=e;await t.load(),function(e,t,r){const n=r(e);if(!n.isValid)throw new a.Z(`${t}:invalid-parameters`,n.errorMessage,{layer:e})}(t,r,n)}function c(e,t){return`Layer (title: ${e.title}, id: ${e.id}) of type '${e.declaredClass}' ${t}`}function d(e,t,r,n){if(e.type!==r)throw new a.Z(`${t}:portal-item-wrong-type`,`Portal item type should be "${r}"`,{item:e,layer:n})}function m(e,t,r){const{portalItem:n}=e;if(!n)throw new a.Z(`${t}:portal-item-not-set`,c(e,"requires the portalItem property to be set"));if(!n.loaded)throw new a.Z(`${t}:portal-item-not-loaded`,c(e,"cannot be saved to a portal item that does not exist or is inaccessible"));(0,u.w)(n),d(n,t,r,e)}function f(e,t,r,a){let n=i.default.from(e);return n.id&&(n=n.clone(),n.id=null),n.type??=r,n.portal??=o.Z.getDefault(),(0,u.w)(n),d(n,t,r,a),n}async function y(e,t,r){"beforeSave"in e&&"function"==typeof e.beforeSave&&await e.beforeSave();const n=e.write({},t);return function(e,t){let r=(e.messages??[]).filter((({type:e})=>"error"===e)).map((({name:e,message:t,details:r})=>new a.Z(e,t,r)));if(t?.ignoreUnsupported&&(r=r.filter((({name:e})=>"layer:unsupported"!==e&&"symbol:unsupported"!==e&&"symbol-layer:unsupported"!==e&&"property:unsupported"!==e&&"url:unsupported"!==e))),r.length>0)throw new a.Z("layer-write:unsupported","Failed to save layer due to unsupported or invalid content. See 'details.errors' for more detailed information",{errors:r})}(t,r),n}function w(e){(0,s.qj)(e,s.Kz.JSAPI),e.typeKeywords&&(e.typeKeywords=e.typeKeywords.filter(((e,t,r)=>r.indexOf(e)===t)))}async function g(e,t){const{layer:r,createItemData:a,errorNamePrefix:o,itemType:i}=e;await p(e),m(r,o,i);const s=r.portalItem,u=(0,l.Y)(s),c=await y(r,u,t),d=await a({layer:r,layerJSON:c},s);return w(s),await s.update({data:d}),(0,n.D)(u),s}async function v(e,t){const{layer:r,createItemData:a,setItemProperties:o,newItem:i,errorNamePrefix:s,itemType:u}=e;await p(e);const c=f(i,s,u,r),d=(0,l.Y)(c),m=await y(r,d,t),g=await a({layer:r,layerJSON:m},c);return await o(r,c),w(c),await async function(e,t,r){const a=e.portal;await a.signIn(),await(a.user?.addItem({item:e,data:t,folder:r?.folder}))}(c,g,t),r.portalItem=c,(0,n.D)(d),c}},33516:(e,t,r)=>{r.d(t,{Y:()=>i,h:()=>o});var a=r(17452),n=r(48522);function o(e){return{origin:"portal-item",url:(0,a.mN)(e.itemUrl),portal:e.portal||n.Z.getDefault(),portalItem:e,readResourcePaths:[]}}function i(e){return{origin:"portal-item",messages:[],writtenProperties:[],url:e.itemUrl?(0,a.mN)(e.itemUrl):null,portal:e.portal||n.Z.getDefault(),portalItem:e}}},14769:(e,t,r)=>{r.d(t,{w:()=>i});var a=r(68773),n=r(20102),o=r(71058);function i(e){if(a.default.apiKey&&(0,o.r)(e.portal.url))throw new n.Z("save-api-key-utils:api-key-not-supported",`Saving is not supported on ${e.portal.url} when using an api key`)}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[7845],{66643:(e,t,s)=>{s.d(t,{Ed:()=>l,UI:()=>p,mt:()=>h,q6:()=>y,vr:()=>f});var r=s(43697),n=s(92036),i=s(70586),o=s(95330),a=s(5600),u=s(52011);function l(e,t,s){return(0,o.as)(e.map(((e,r)=>t.apply(s,[e,r]))))}async function p(e,t,s){return(await(0,o.as)(e.map(((e,r)=>t.apply(s,[e,r]))))).map((e=>e.value))}function c(e){return{ok:!0,value:e}}function d(e){return{ok:!1,error:e}}async function y(e){if(null==e)return{ok:!1,error:new Error("no promise provided")};try{return c(await e)}catch(e){return d(e)}}async function h(e){try{return c(await e)}catch(e){return(0,o.r9)(e),d(e)}}function f(e,t){return new m(e,t)}let m=class extends n.Z{get value(){return null!=(e=this._result)&&!0===e.ok?e.value:null;var e}get error(){return null!=(e=this._result)&&!1===e.ok?e.error:null;var e}get finished(){return null!=this._result}constructor(e,t){super({}),this._result=null,this._abortHandle=null,this.abort=()=>{this._abortController=(0,i.IM)(this._abortController)},this.remove=this.abort,this._abortController=new AbortController;const{signal:s}=this._abortController;this.promise=e(s),this.promise.then((e=>{this._result=c(e),this._cleanup()}),(e=>{this._result=d(e),this._cleanup()})),this._abortHandle=(0,o.fu)(t,this.abort)}normalizeCtorArgs(){return{}}destroy(){this.abort()}_cleanup(){this._abortHandle=(0,i.hw)(this._abortHandle),this._abortController=null}};(0,r._)([(0,a.Cb)()],m.prototype,"value",null),(0,r._)([(0,a.Cb)()],m.prototype,"error",null),(0,r._)([(0,a.Cb)()],m.prototype,"finished",null),(0,r._)([(0,a.Cb)()],m.prototype,"promise",void 0),(0,r._)([(0,a.Cb)()],m.prototype,"_result",void 0),m=(0,r._)([(0,u.j)("esri.core.asyncUtils.ReactiveTask")],m)},61159:(e,t,s)=>{s.d(t,{g:()=>r});const r={supportsStatistics:!0,supportsPercentileStatistics:!0,supportsSpatialAggregationStatistics:!1,supportedSpatialAggregationStatistics:{envelope:!1,centroid:!1,convexHull:!1},supportsCentroid:!0,supportsCacheHint:!1,supportsDistance:!0,supportsDistinct:!0,supportsExtent:!0,supportsGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQuantization:!0,supportsQuantizationEditMode:!1,supportsQueryGeometry:!0,supportsResultType:!1,supportsSqlExpression:!0,supportsMaxRecordCountFactor:!1,supportsStandardizedQueriesOnly:!0,supportsTopFeaturesQuery:!1,supportsQueryByAnonymous:!0,supportsQueryByOthers:!0,supportsHistoricMoment:!1,supportsFormatPBF:!1,supportsDisjointSpatialRelationship:!0,supportsDefaultSpatialReference:!1,supportsFullTextSearch:!1,supportsCompactGeometry:!1,maxRecordCountFactor:void 0,maxRecordCount:void 0,standardMaxRecordCount:void 0,tileMaxRecordCount:void 0}},97845:(e,t,s)=>{s.r(t),s.d(t,{default:()=>b});var r=s(3172),n=s(66643),i=s(20102),o=s(92604),a=s(95330),u=s(33955),l=s(8744),p=s(98732),c=s(37427),d=s(92722),y=s(25278),h=s(23095),f=s(99514),m=s(86719),g=s(35671),_=s(25031);const S={hasAttachments:!1,capabilities:"query, editing, create, delete, update",useStandardizedQueries:!0,supportsCoordinatesQuantization:!0,supportsReturningQueryGeometry:!0,advancedQueryCapabilities:{supportsQueryAttachments:!1,supportsStatistics:!0,supportsPercentileStatistics:!0,supportsReturningGeometryCentroid:!0,supportsQueryWithDistance:!0,supportsDistinct:!0,supportsReturningQueryExtent:!0,supportsReturningGeometryProperties:!1,supportsHavingClause:!0,supportsOrderBy:!0,supportsPagination:!0,supportsQueryWithResultType:!1,supportsSqlExpression:!0,supportsDisjointSpatialRel:!0}};class b{constructor(){this._queryEngine=null,this._snapshotFeatures=async e=>{const t=await this._fetch(e);return this._createFeatures(t)}}destroy(){this._queryEngine?.destroy(),this._queryEngine=this._createDefaultAttributes=null}async load(e,t={}){this._loadOptions={url:e.url,customParameters:e.customParameters};const r=[],[n,{QueryEngine:o,FeatureStore:a}]=await Promise.all([e.url?this._fetch(t?.signal):null,Promise.all([s.e(8968),s.e(5286),s.e(8767),s.e(3376)]).then(s.bind(s,3922)),this._checkProjection(e.spatialReference)]),u=(0,d.my)(n,{geometryType:e.geometryType}),p=e.fields||u.fields||[],c=null!=e.hasZ?e.hasZ:u.hasZ,h=u.geometryType;let b=e.objectIdField||u.objectIdFieldName||"__OBJECTID";const F=e.spatialReference||l.Zn;let w=e.timeInfo;p===u.fields&&u.unknownFields.length>0&&r.push({name:"geojson-layer:unknown-field-types",message:"Some fields types couldn't be inferred from the features and were dropped",details:{unknownFields:u.unknownFields}});const E=new f.Z(p);let I=E.get(b);I?("esriFieldTypeString"!==I.type&&(I.type="esriFieldTypeOID"),I.editable=!1,I.nullable=!1,b=I.name):(I={alias:b,name:b,type:"string"===u.objectIdFieldType?"esriFieldTypeString":"esriFieldTypeOID",editable:!1,nullable:!1},p.unshift(I));const T={};for(const e of p){if(null==e.name&&(e.name=e.alias),null==e.alias&&(e.alias=e.name),!e.name)throw new i.Z("geojson-layer:invalid-field-name","field name is missing",{field:e});if(!m.v.jsonValues.includes(e.type))throw new i.Z("geojson-layer:invalid-field-type",`invalid type for field "${e.name}"`,{field:e});if(e.name!==I.name){const t=(0,g.os)(e);void 0!==t&&(T[e.name]=t)}}if(w){if(w.startTimeField){const e=E.get(w.startTimeField);e?(w.startTimeField=e.name,e.type="esriFieldTypeDate"):w.startTimeField=null}if(w.endTimeField){const e=E.get(w.endTimeField);e?(w.endTimeField=e.name,e.type="esriFieldTypeDate"):w.endTimeField=null}if(w.trackIdField){const e=E.get(w.trackIdField);e?w.trackIdField=e.name:(w.trackIdField=null,r.push({name:"geojson-layer:invalid-timeInfo-trackIdField",message:"trackIdField is missing",details:{timeInfo:w}}))}w.startTimeField||w.endTimeField||(r.push({name:"geojson-layer:invalid-timeInfo",message:"startTimeField and endTimeField are missing",details:{timeInfo:w}}),w=null)}const C=h?(0,y.bU)(h):void 0,j=E.dateFields.length?{timeZoneIANA:_.pt}:null,q={warnings:r,featureErrors:[],layerDefinition:{...S,drawingInfo:C??void 0,templates:(0,y.Hq)(T),extent:void 0,geometryType:h,objectIdField:b,fields:p,hasZ:!!c,timeInfo:w,dateFieldsTimeReference:j}};this._queryEngine=new o({fieldsIndex:f.Z.fromLayerJSON({fields:p,timeInfo:w,dateFieldsTimeReference:j}),geometryType:h,hasM:!1,hasZ:c,objectIdField:b,spatialReference:F,timeInfo:w,featureStore:new a({geometryType:h,hasM:!1,hasZ:c}),cacheSpatialQueries:!0});const x=this._queryEngine.fieldsIndex.requiredFields.indexOf(I);x>-1&&this._queryEngine.fieldsIndex.requiredFields.splice(x,1),this._createDefaultAttributes=(0,y.Dm)(T,b);const v=await this._createFeatures(n);this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,v);const R=this._normalizeFeatures(v,q.featureErrors);this._queryEngine.featureStore.addMany(R);const{fullExtent:k,timeExtent:P}=await this._queryEngine.fetchRecomputedExtents();if(q.layerDefinition.extent=k,P){const{start:e,end:t}=P;q.layerDefinition.timeInfo.timeExtent=[e,t]}return q}async applyEdits(e){const{spatialReference:t,geometryType:s}=this._queryEngine;return await Promise.all([(0,h.b)(t,s),(0,c._W)(e.adds,t),(0,c._W)(e.updates,t)]),await this._waitSnapshotComplete(),this._applyEdits(e)}async queryFeatures(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQuery(e,t.signal)}async queryFeatureCount(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForCount(e,t.signal)}async queryObjectIds(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForIds(e,t.signal)}async queryExtent(e={},t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForExtent(e,t.signal)}async querySnapping(e,t={}){return await this._waitSnapshotComplete(),this._queryEngine.executeQueryForSnapping(e,t.signal)}async refresh(e){this._loadOptions.customParameters=e,this._snapshotTask?.abort(),this._snapshotTask=(0,n.vr)(this._snapshotFeatures),this._snapshotTask.promise.then((e=>{this._queryEngine.featureStore.clear(),this._objectIdGenerator=this._createObjectIdGenerator(this._queryEngine,e);const t=this._normalizeFeatures(e);t&&this._queryEngine.featureStore.addMany(t)}),(e=>{this._queryEngine.featureStore.clear(),(0,a.D_)(e)||o.Z.getLogger("esri.layers.GeoJSONLayer").error(new i.Z("geojson-layer:refresh","An error occurred during refresh",{error:e}))})),await this._waitSnapshotComplete();const{fullExtent:t,timeExtent:s}=await this._queryEngine.fetchRecomputedExtents();return{extent:t,timeExtent:s}}async _createFeatures(e){if(null==e)return[];const{geometryType:t,hasZ:s,objectIdField:r}=this._queryEngine,n=(0,d.lG)(e,{geometryType:t,hasZ:s,objectIdField:r});if(!(0,l.fS)(this._queryEngine.spatialReference,l.Zn))for(const e of n)null!=e.geometry&&(e.geometry=(0,p.GH)((0,c.iV)((0,p.di)(e.geometry,this._queryEngine.geometryType,this._queryEngine.hasZ,!1),l.Zn,this._queryEngine.spatialReference)));return n}async _waitSnapshotComplete(){if(this._snapshotTask&&!this._snapshotTask.finished){try{await this._snapshotTask.promise}catch{}return this._waitSnapshotComplete()}}async _fetch(e){const{url:t,customParameters:s}=this._loadOptions,n=(await(0,r.Z)(t,{responseType:"json",query:{...s},signal:e})).data;return(0,d.O3)(n),n}_normalizeFeatures(e,t){const{objectIdField:s,fieldsIndex:r}=this._queryEngine,n=[];for(const i of e){const e=this._createDefaultAttributes(),o=(0,h.O0)(r,e,i.attributes,!0);o?t?.push(o):(this._assignObjectId(e,i.attributes,!0),i.attributes=e,i.objectId=e[s],n.push(i))}return n}async _applyEdits(e){const{adds:t,updates:s,deletes:r}=e,n={addResults:[],deleteResults:[],updateResults:[],uidToObjectId:{}};if(t?.length&&this._applyAddEdits(n,t),s?.length&&this._applyUpdateEdits(n,s),r?.length){for(const e of r)n.deleteResults.push((0,h.d1)(e));this._queryEngine.featureStore.removeManyById(r)}const{fullExtent:i,timeExtent:o}=await this._queryEngine.fetchRecomputedExtents();return{extent:i,timeExtent:o,featureEditResults:n}}_applyAddEdits(e,t){const{addResults:s}=e,{geometryType:r,hasM:n,hasZ:i,objectIdField:o,spatialReference:a,featureStore:l,fieldsIndex:d}=this._queryEngine,y=[];for(const n of t){if(n.geometry&&r!==(0,u.Ji)(n.geometry)){s.push((0,h.av)("Incorrect geometry type."));continue}const t=this._createDefaultAttributes(),i=(0,h.O0)(d,t,n.attributes);if(i)s.push(i);else{if(this._assignObjectId(t,n.attributes),n.attributes=t,null!=n.uid){const t=n.attributes[o];e.uidToObjectId[n.uid]=t}if(null!=n.geometry){const e=n.geometry.spatialReference??a;n.geometry=(0,c.iV)((0,h.og)(n.geometry,e),e,a)}y.push(n),s.push((0,h.d1)(n.attributes[o]))}}l.addMany((0,p.Yn)([],y,r,i,n,o))}_applyUpdateEdits({updateResults:e},t){const{geometryType:s,hasM:r,hasZ:n,objectIdField:i,spatialReference:o,featureStore:a,fieldsIndex:l}=this._queryEngine;for(const d of t){const{attributes:t,geometry:y}=d,f=t?.[i];if(null==f){e.push((0,h.av)(`Identifier field ${i} missing`));continue}if(!a.has(f)){e.push((0,h.av)(`Feature with object id ${f} missing`));continue}const m=(0,p.EI)(a.getFeature(f),s,n,r);if(null!=y){if(s!==(0,u.Ji)(y)){e.push((0,h.av)("Incorrect geometry type."));continue}const t=y.spatialReference??o;m.geometry=(0,c.iV)((0,h.og)(y,t),t,o)}if(t){const s=(0,h.O0)(l,m.attributes,t);if(s){e.push(s);continue}}a.add((0,p.XA)(m,s,n,r,i)),e.push((0,h.d1)(f))}}_createObjectIdGenerator(e,t){const s=e.fieldsIndex.get(e.objectIdField);if("esriFieldTypeString"===s.type)return()=>s.name+"-"+Date.now().toString(16);let r=Number.NEGATIVE_INFINITY;for(const e of t)e.objectId&&(r=Math.max(r,e.objectId));return r=Math.max(0,r)+1,()=>r++}_assignObjectId(e,t,s=!1){const r=this._queryEngine.objectIdField;e[r]=s&&r in t?t[r]:this._objectIdGenerator()}async _checkProjection(e){try{await(0,c._W)(l.Zn,e)}catch{throw new i.Z("geojson-layer","Projection not supported")}}}},92722:(e,t,s)=>{s.d(t,{O3:()=>E,lG:()=>T,my:()=>I,q9:()=>p});var r=s(20188),n=s(20102),i=s(8744),o=s(70272),a=s(5428),u=s(35671);const l={LineString:"esriGeometryPolyline",MultiLineString:"esriGeometryPolyline",MultiPoint:"esriGeometryMultipoint",Point:"esriGeometryPoint",Polygon:"esriGeometryPolygon",MultiPolygon:"esriGeometryPolygon"};function p(e){return l[e]}function*c(e){switch(e.type){case"Feature":yield e;break;case"FeatureCollection":for(const t of e.features)t&&(yield t)}}function*d(e){if(e)switch(e.type){case"Point":yield e.coordinates;break;case"LineString":case"MultiPoint":yield*e.coordinates;break;case"MultiLineString":case"Polygon":for(const t of e.coordinates)yield*t;break;case"MultiPolygon":for(const t of e.coordinates)for(const e of t)yield*e}}function y(e){for(const t of e)if(t.length>2)return!0;return!1}function h(e){let t=0;for(let s=0;s<e.length;s++){const r=e[s],n=e[(s+1)%e.length];t+=r[0]*n[1]-n[0]*r[1]}return t<=0}function f(e){const t=e[0],s=e[e.length-1];return t[0]===s[0]&&t[1]===s[1]&&t[2]===s[2]||e.push(t),e}function m(e,t,s){switch(t.type){case"LineString":case"MultiPoint":return function(e,t,s){return S(e,t.coordinates,s),e}(e,t,s);case"MultiLineString":return function(e,t,s){for(const r of t.coordinates)S(e,r,s);return e}(e,t,s);case"MultiPolygon":return function(e,t,s){for(const r of t.coordinates){g(e,r[0],s);for(let t=1;t<r.length;t++)_(e,r[t],s)}return e}(e,t,s);case"Point":return function(e,t,s){return F(e,t.coordinates,s),e}(e,t,s);case"Polygon":return function(e,t,s){const r=t.coordinates;g(e,r[0],s);for(let t=1;t<r.length;t++)_(e,r[t],s);return e}(e,t,s)}}function g(e,t,s){const r=f(t);!function(e){return!h(e)}(r)?S(e,r,s):b(e,r,s)}function _(e,t,s){const r=f(t);!function(e){return h(e)}(r)?S(e,r,s):b(e,r,s)}function S(e,t,s){for(const r of t)F(e,r,s);e.lengths.push(t.length)}function b(e,t,s){for(let r=t.length-1;r>=0;r--)F(e,t[r],s);e.lengths.push(t.length)}function F(e,t,s){const[r,n,i]=t;e.coords.push(r,n),s.hasZ&&e.coords.push(i||0)}function w(e){switch(typeof e){case"string":return(0,r.o)(e)?"esriFieldTypeDate":"esriFieldTypeString";case"number":return"esriFieldTypeDouble";default:return"unknown"}}function E(e,t=4326){if(!e)throw new n.Z("geojson-layer:empty","GeoJSON data is empty");if("Feature"!==e.type&&"FeatureCollection"!==e.type)throw new n.Z("geojson-layer:unsupported-geojson-object","missing or not supported GeoJSON object type",{data:e});const{crs:s}=e;if(!s)return;const r="string"==typeof s?s:"name"===s.type?s.properties.name:"EPSG"===s.type?s.properties.code:null,o=(0,i.oR)({wkid:t})?new RegExp(".*(CRS84H?|4326)$","i"):new RegExp(`.*(${t})$`,"i");if(!r||!o.test(r))throw new n.Z("geojson:unsupported-crs","unsupported GeoJSON 'crs' member",{crs:s})}function I(e,t={}){const s=[],r=new Set,n=new Set;let i,o=!1,a=null,l=!1,{geometryType:h=null}=t,f=!1;for(const t of c(e)){const{geometry:e,properties:c,id:m}=t;if((!e||(h||(h=p(e.type)),p(e.type)===h))&&(o||(o=y(d(e))),l||(l=null!=m,l&&(i=typeof m,c&&(a=Object.keys(c).filter((e=>c[e]===m))))),c&&a&&l&&null!=m&&(a.length>1?a=a.filter((e=>c[e]===m)):1===a.length&&(a=c[a[0]]===m?a:[])),!f&&c)){let e=!0;for(const t in c){if(r.has(t))continue;const i=c[t];if(null==i){e=!1,n.add(t);continue}const o=w(i);if("unknown"===o){n.add(t);continue}n.delete(t),r.add(t);const a=(0,u.q6)(t);a&&s.push({name:a,alias:t,type:o})}f=e}}const m=(0,u.q6)(1===a?.length&&a[0]||null)??void 0;if(m)for(const e of s)if(e.name===m&&(0,u.H7)(e)){e.type="esriFieldTypeOID";break}return{fields:s,geometryType:h,hasZ:o,objectIdFieldName:m,objectIdFieldType:i,unknownFields:Array.from(n)}}function T(e,t){return Array.from(function*(e,t={}){const{geometryType:s,objectIdField:r}=t;for(const n of e){const{geometry:e,properties:i,id:u}=n;if(e&&p(e.type)!==s)continue;const l=i||{};let c;r&&(c=l[r],null==u||c||(l[r]=c=u));const d=new o.u_(e?m(new a.Z,e,t):null,l,null,c??void 0);yield d}}(c(e),t))}},25278:(e,t,s)=>{s.d(t,{Dm:()=>p,Hq:()=>c,MS:()=>d,bU:()=>a});var r=s(80442),n=s(22974),i=s(61159),o=s(58333);function a(e){return{renderer:{type:"simple",symbol:"esriGeometryPoint"===e||"esriGeometryMultipoint"===e?o.I4:"esriGeometryPolyline"===e?o.ET:o.lF}}}const u=/^[_$a-zA-Z][_$a-zA-Z0-9]*$/;let l=1;function p(e,t){if((0,r.Z)("esri-csp-restrictions"))return()=>({[t]:null,...e});try{let s=`this.${t} = null;`;for(const t in e)s+=`this${u.test(t)?`.${t}`:`["${t}"]`} = ${JSON.stringify(e[t])};`;const r=new Function(`\n return class AttributesClass$${l++} {\n constructor() {\n ${s};\n }\n }\n `)();return()=>new r}catch(s){return()=>({[t]:null,...e})}}function c(e={}){return[{name:"New Feature",description:"",prototype:{attributes:(0,n.d9)(e)}}]}function d(e,t){return{analytics:{supportsCacheHint:!1},attachment:null,data:{isVersioned:!1,supportsAttachment:!1,supportsM:!1,supportsZ:e},metadata:{supportsAdvancedFieldProperties:!1},operations:{supportsCalculate:!1,supportsTruncate:!1,supportsValidateSql:!1,supportsAdd:t,supportsDelete:t,supportsEditing:t,supportsChangeTracking:!1,supportsQuery:!0,supportsQueryAnalytics:!1,supportsQueryAttachments:!1,supportsQueryTopFeatures:!1,supportsResizeAttachments:!1,supportsSync:!1,supportsUpdate:t,supportsExceedsLimitStatistics:!0,supportsAsyncConvert3D:!1},query:i.g,queryRelated:{supportsCount:!0,supportsOrderBy:!0,supportsPagination:!0,supportsCacheHint:!1},queryTopFeatures:{supportsCacheHint:!1},editing:{supportsGeometryUpdate:t,supportsGlobalId:!1,supportsReturnServiceEditsInSourceSpatialReference:!1,supportsRollbackOnFailure:!1,supportsUpdateWithoutM:!1,supportsUploadWithItemId:!1,supportsDeleteByAnonymous:!1,supportsDeleteByOthers:!1,supportsUpdateByAnonymous:!1,supportsUpdateByOthers:!1,supportsAsyncApplyEdits:!1,zDefault:void 0}}}},58333:(e,t,s)=>{s.d(t,{ET:()=>i,I4:()=>n,eG:()=>u,lF:()=>o,lj:()=>p,qP:()=>a,wW:()=>l});const r=[252,146,31,255],n={type:"esriSMS",style:"esriSMSCircle",size:6,color:r,outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[153,153,153,255]}},i={type:"esriSLS",style:"esriSLSSolid",width:.75,color:r},o={type:"esriSFS",style:"esriSFSSolid",color:[252,146,31,196],outline:{type:"esriSLS",style:"esriSLSSolid",width:.75,color:[255,255,255,191]}},a={type:"esriTS",color:[255,255,255,255],font:{family:"arial-unicode-ms",size:10,weight:"bold"},horizontalAlignment:"center",kerning:!0,haloColor:[0,0,0,255],haloSize:1,rotated:!1,text:"",xoffset:0,yoffset:0,angle:0},u={type:"esriSMS",style:"esriSMSCircle",color:[0,0,0,255],outline:null,size:10.5},l={type:"esriSLS",style:"esriSLSSolid",color:[0,0,0,255],width:1.5},p={type:"esriSFS",style:"esriSFSSolid",color:[0,0,0,255],outline:null}}}]);
|