@arcgis/core 4.33.0-next.20250516 → 4.33.0-next.20250517
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/applications/Components/QuantityFormatter.d.ts +4 -0
- package/applications/Components/QuantityFormatter.js +5 -0
- package/arcade/ArcadeDate.js +1 -1
- package/arcade/enum.js +5 -0
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/functions/convertdirection.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/geometry/functions.js +1 -1
- package/arcade/geometry/unitConversion.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0fd6d80393722132e044.js → 0229c573fa8a2fff2d8b.js} +2 -2
- package/assets/esri/core/workers/chunks/{612f6739c9399fbae4d0.js → 094e8aae6dada24c8115.js} +1 -1
- package/assets/esri/core/workers/chunks/{ffaa977cd97a2b7190c5.js → 0c2dccec20c0994366fe.js} +1 -1
- package/assets/esri/core/workers/chunks/151d6354e7bc105b25c0.js +346 -0
- package/assets/esri/core/workers/chunks/1cf0fae3f2e848a2a738.js +1 -0
- package/assets/esri/core/workers/chunks/24327d01cb2c5c55a4b7.js +1 -0
- package/assets/esri/core/workers/chunks/{1a010d877b8428e755fb.js → 2841888fdbc2770e90c8.js} +1 -1
- package/assets/esri/core/workers/chunks/{7e1dc8e5e18f18dd21e2.js → 29fb64826bb1351aca8d.js} +2 -2
- package/assets/esri/core/workers/chunks/{4e0d2458f4d7a35bb97c.js → 2ce5cc797ae0d66c8678.js} +1 -1
- package/assets/esri/core/workers/chunks/{9d564f79b82d427fc1da.js → 2fd30428309f4c517d4c.js} +1 -1
- package/assets/esri/core/workers/chunks/3ca6f893fd58f5b17af5.js +1 -0
- package/assets/esri/core/workers/chunks/{52d160cb7921ae7a4f57.js → 3fc44d8cef392b4b9c7a.js} +1 -1
- package/assets/esri/core/workers/chunks/417293f00b2c21cc3175.js +1 -0
- package/assets/esri/core/workers/chunks/{4cb199b547e5b97e65fb.js → 48cedef1c926d11164b7.js} +1 -1
- package/assets/esri/core/workers/chunks/{563594357f3648652a5c.js → 4b21c4815533a43835c3.js} +1 -1
- package/assets/esri/core/workers/chunks/{921c040d0497031fd8ff.js → 54da9c7fd1088a8076ce.js} +1 -1
- package/assets/esri/core/workers/chunks/{ab9614555a15f04396f6.js → 54f981fe0f8851767be9.js} +2 -2
- package/assets/esri/core/workers/chunks/{28d9e2ffc3059a55311e.js → 59f701c30bcd9088b291.js} +1 -1
- package/assets/esri/core/workers/chunks/5d50a8d0427eab0a2514.js +1 -0
- package/assets/esri/core/workers/chunks/5f4ca51b82daf0e51010.js +1 -0
- package/assets/esri/core/workers/chunks/{05c80002c37002ac99e8.js → 5f6719286a6c9a3ac74b.js} +1 -1
- package/assets/esri/core/workers/chunks/{a09b5700c92bb76c3234.js → 638ecabe3e22978af5a3.js} +1 -1
- package/assets/esri/core/workers/chunks/{9fff43ffcd5602ccc50f.js → 649caffe8f5dbaad0d7b.js} +1 -1
- package/assets/esri/core/workers/chunks/{4480e4b61affb3b2e9d6.js → 6648e68f00d28e12bcf9.js} +1 -1
- package/assets/esri/core/workers/chunks/66a1b92358344dd28ee1.js +1 -0
- package/assets/esri/core/workers/chunks/{b92a34f88569c481ed10.js → 67338948e470c1251d8a.js} +3 -3
- package/assets/esri/core/workers/chunks/{a8d043b73e087bee7c40.js → 67c5f1112a7c65e9eeff.js} +1 -1
- package/assets/esri/core/workers/chunks/6a225393b63e1e8c7933.js +1 -0
- package/assets/esri/core/workers/chunks/6c29a768f02dc7ce0ed6.js +1 -0
- package/assets/esri/core/workers/chunks/{fbd2f45d5adce4ca323f.js → 73ddb356121add556994.js} +2 -2
- package/assets/esri/core/workers/chunks/{a6ca68ef6311ffc365b2.js → 73e179b04bb931ca9b86.js} +1 -1
- package/assets/esri/core/workers/chunks/7678177555570682154e.js +1 -0
- package/assets/esri/core/workers/chunks/7b9d14cc4a466ef18d71.js +1 -0
- package/assets/esri/core/workers/chunks/7e6141b5baae47682f97.js +1 -0
- package/assets/esri/core/workers/chunks/{257db39a1ba1a11ebfb4.js → 8365707e408d19988356.js} +1 -1
- package/assets/esri/core/workers/chunks/8a2cee726b7843c7408a.js +1 -0
- package/assets/esri/core/workers/chunks/{b1e275607d9754079f60.js → 8eadf90d938753691044.js} +1 -1
- package/assets/esri/core/workers/chunks/{ff4e7da880b206fd98ec.js → 9049c81445cc044286f1.js} +1 -1
- package/assets/esri/core/workers/chunks/9588328d4ed6b0f04166.js +2 -0
- package/assets/esri/core/workers/chunks/{dcf5719f38ad40b92941.js → 9826a1c66885dbbdc130.js} +1 -1
- package/assets/esri/core/workers/chunks/{4954e0cf4a40e45d237f.js → 9c8e66da6cf32ace0914.js} +1 -1
- package/assets/esri/core/workers/chunks/9cac00d4bfac14aaae12.js +1 -0
- package/assets/esri/core/workers/chunks/{d60da671aba70485050e.js → 9f18392933c06f1d63b6.js} +1 -1
- package/assets/esri/core/workers/chunks/{c3b2b05996e2008adbe3.js → a9f16323666042a9d47f.js} +1 -1
- package/assets/esri/core/workers/chunks/aad9a693813b47a51530.js +2 -0
- package/assets/esri/core/workers/chunks/{654fe135d41af81daa13.js → be1f3cac908c28c64401.js} +1 -1
- package/assets/esri/core/workers/chunks/bf4d9cdcbe6bb8bc9d39.js +1 -0
- package/assets/esri/core/workers/chunks/{d49518eb4b351afc5f00.js → ca3851ca2621879eb887.js} +1 -1
- package/assets/esri/core/workers/chunks/{56db71ea7eb8a5652d98.js → ca62e7ec102a1bb879dc.js} +1 -1
- package/assets/esri/core/workers/chunks/cb16ba9512ae0a09c55d.js +1 -0
- package/assets/esri/core/workers/chunks/{8c1242ffd48b3ef800fa.js → d103e184ddf9beec779d.js} +1 -1
- package/assets/esri/core/workers/chunks/d3d98ea5b5e56fc60a31.js +1 -0
- package/assets/esri/core/workers/chunks/{5719471414810b6a9aec.js → d9d9180689bcf71af00f.js} +1 -1
- package/assets/esri/core/workers/chunks/{dcaeb57c69d432118604.js → db13c93b4d708a2481db.js} +1 -1
- package/assets/esri/core/workers/chunks/{2c3bfa75286376388806.js → db192728fa0ee08a776a.js} +1 -1
- package/assets/esri/core/workers/chunks/{40b8e53c8b1c447eff7e.js → e2d012078d51dc2b2802.js} +1 -1
- package/assets/esri/core/workers/chunks/e385a27fd1ac2123a05f.js +1 -0
- package/assets/esri/core/workers/chunks/{e85f892ea44d67d53ff0.js → f3b51aa0a1a8fc3b231c.js} +2 -2
- package/assets/esri/core/workers/chunks/f74f8ed3f17713a208c3.js +1 -0
- package/assets/esri/core/workers/chunks/f9567108862629f25c8b.js +1 -0
- package/assets/esri/core/workers/chunks/fa99abc572b382e7e0c7.js +1 -0
- package/assets/esri/themes/base/widgets/_Directions.scss +74 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_en.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_no.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_ar.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_bg.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_bs.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_ca.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_cs.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_da.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_de.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_el.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_es.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_et.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_fi.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_fr.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_he.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_hr.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_hu.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_id.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_it.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_ja.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_ko.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_lt.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_lv.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_nl.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_no.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_pl.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_pt-BR.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_pt-PT.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_ro.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_ru.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_sk.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_sl.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_sr.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_sv.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_th.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_tr.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_uk.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_vi.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_zh-CN.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_zh-HK.json +1 -1
- package/assets/esri/widgets/Search/t9n/Search_zh-TW.json +1 -1
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ar.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_bg.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_bs.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ca.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_cs.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_da.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_de.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_el.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_es.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_et.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_fi.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_fr.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_he.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_hr.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_hu.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_id.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_it.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ja.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ko.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_lt.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_lv.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_nl.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_no.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pl.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pt-BR.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_pt-PT.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ro.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_ru.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sk.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sl.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sr.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_sv.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_th.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_tr.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_uk.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_vi.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-CN.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-HK.json +1 -0
- package/assets/esri/widgets/support/FilterBuilder/t9n/FilterBuilder_zh-TW.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ar.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_bg.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_bs.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ca.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_cs.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_da.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_de.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_el.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_es.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_et.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_fi.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_fr.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_he.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_hr.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_hu.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_id.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_it.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ja.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ko.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_lt.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_lv.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_nl.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_no.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pl.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pt-BR.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_pt-PT.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ro.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_ru.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sk.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sl.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sr.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_sv.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_th.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_tr.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_uk.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_vi.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-CN.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-HK.json +1 -0
- package/assets/esri/widgets/support/FilterCondition/t9n/FilterCondition_zh-TW.json +1 -0
- package/chunks/Bufferer-Dw9Qi4T1.js +5 -0
- package/chunks/Distance2DCalculator-CXhBP-8I.js +5 -0
- package/chunks/Envelope.js +1 -1
- package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +5 -0
- package/chunks/Geometry.js +1 -1
- package/chunks/MultiPathImpl.js +5 -0
- package/chunks/OperatorClip.js +1 -1
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorDensify.js +1 -1
- package/chunks/OperatorGeneralize.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/distanceOperator.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBoundary.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorConvexHull.js +1 -1
- package/geometry/operators/gx/operatorDifference.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorIntersection.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/gx/operatorSimplify.js +1 -1
- package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/gx/operatorUnion.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/initNoPeFactory.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry.js +1 -1
- package/interfaces.d.ts +68 -11
- package/layers/KnowledgeGraphLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/graphics/sources/support/QueryTask.js +1 -1
- package/package.json +1 -1
- package/pointCloudRenderers.js +1 -1
- package/rasterRenderers.js +1 -1
- package/renderers.js +1 -1
- package/rest/query/executeForCount.js +1 -1
- package/support/revision.js +1 -1
- package/symbols.js +1 -1
- package/views/2d/interactive/editingTools/draw/DrawGraphicTool2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementController.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/Dimension/DimensionController.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
- package/views/3d/analysis/DimensionAnalysisView3D.js +1 -1
- package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementController.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/support/measurementUtils.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentMove.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/layers/DimensionLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshViewLabeler.js +1 -1
- package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/ViewshedLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
- package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/support/LayerViewAnalysisViewManager.js +1 -1
- package/views/3d/layers/support/MediaLayerInteraction.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/LinkChartView.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/DrawScreenTool.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/draw/PointDrawAction.js +1 -1
- package/views/draw/PolygonDrawAction.js +1 -1
- package/views/draw/PolylineDrawAction.js +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/reshapeTooltipUtils.js +1 -1
- package/views/draw/support/tooltipUtils.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/coordinateHelper.js +1 -1
- package/views/interactive/snapping/LineSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/SelfSnappingEngine.js +1 -1
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/support/automaticAreaMeasurementUtils.js +1 -1
- package/views/support/automaticLengthMeasurementUtils.js +1 -1
- package/views/support/extentUtils.js +1 -1
- package/views/support/geodesicAreaMeasurementUtils.js +1 -1
- package/views/support/geodesicLengthMeasurementUtils.js +1 -1
- package/views/support/geodesicMeasurementUtils.js +1 -1
- package/views/support/layerViewUtils.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/CatalogLayerList.js +1 -1
- package/widgets/Directions/css.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DTool.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.d.ts +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflowData.d.ts +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/support/GridControls/GridControlsViewModel.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/assets/esri/core/workers/chunks/009730713ed9bc7c7388.js +0 -1
- package/assets/esri/core/workers/chunks/0817ddd885ce8b2459cb.js +0 -1
- package/assets/esri/core/workers/chunks/0cce3770591b0730cf22.js +0 -1
- package/assets/esri/core/workers/chunks/1991f0d0f0a12175f849.js +0 -1
- package/assets/esri/core/workers/chunks/19c50f052eba0553bf4d.js +0 -1
- package/assets/esri/core/workers/chunks/1f194ffea16cc6595ecc.js +0 -1
- package/assets/esri/core/workers/chunks/320e821af81138fe12ac.js +0 -1
- package/assets/esri/core/workers/chunks/394b9723d108cff7136e.js +0 -1
- package/assets/esri/core/workers/chunks/4a362a35bcdb8405a53a.js +0 -1
- package/assets/esri/core/workers/chunks/52a3d0e041717da7697e.js +0 -1
- package/assets/esri/core/workers/chunks/5f766bcb751d66fbf1c8.js +0 -1
- package/assets/esri/core/workers/chunks/a70a86ba4e487f62f683.js +0 -346
- package/assets/esri/core/workers/chunks/aeb5bbe861f65544d504.js +0 -1
- package/assets/esri/core/workers/chunks/b52b28a6f422b10ff166.js +0 -1
- package/assets/esri/core/workers/chunks/c07c1bb7ae09136dc1f6.js +0 -1
- package/assets/esri/core/workers/chunks/cbbca011f8b176d4b5db.js +0 -1
- package/assets/esri/core/workers/chunks/cd5c380196db7fb55242.js +0 -1
- package/assets/esri/core/workers/chunks/ce321fd8fc5551e190ec.js +0 -1
- package/assets/esri/core/workers/chunks/ce53ddda04e09ba2f860.js +0 -1
- package/assets/esri/core/workers/chunks/d6ab65ad864782c50705.js +0 -1
- package/assets/esri/core/workers/chunks/da3c62a851a4332f6dda.js +0 -1
- package/assets/esri/core/workers/chunks/db3f710d770adf631b28.js +0 -2
- package/assets/esri/core/workers/chunks/f4c6ea630cecf0f260d7.js +0 -2
- package/chunks/Bufferer-CicaNej1.js +0 -5
- package/chunks/Distance2DCalculator-C1KHhZwD.js +0 -5
- package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +0 -5
- package/chunks/QuadraticBezier.js +0 -5
- /package/assets/esri/core/workers/chunks/{0fd6d80393722132e044.js.LICENSE.txt → 0229c573fa8a2fff2d8b.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{7e1dc8e5e18f18dd21e2.js.LICENSE.txt → 29fb64826bb1351aca8d.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ab9614555a15f04396f6.js.LICENSE.txt → 54f981fe0f8851767be9.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{fbd2f45d5adce4ca323f.js.LICENSE.txt → 73ddb356121add556994.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{db3f710d770adf631b28.js.LICENSE.txt → 9588328d4ed6b0f04166.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{f4c6ea630cecf0f260d7.js.LICENSE.txt → aad9a693813b47a51530.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{e85f892ea44d67d53ff0.js.LICENSE.txt → f3b51aa0a1a8fc3b231c.js.LICENSE.txt} +0 -0
package/widgets/Directions.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import{isSome as t}from"../core/arrayUtils.js";import s from"../core/Collection.js";import{makeHandle as i}from"../core/handleUtils.js";import{destroyMaybe as o}from"../core/maybe.js";import{debounce as r,isAbortError as a}from"../core/promiseUtils.js";import{watch as n,initial as l,on as c}from"../core/reactiveUtils.js";import{escapeRegExpString as d}from"../core/string.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import p from"../portal/Portal.js";import{defaultUnitPropertyMetadata as u}from"../properties/defaultUnit.js";import v from"../rest/support/Stop.js";import g from"../symbols/SimpleMarkerSymbol.js";import w from"./Search.js";import _ from"./Widget.js";import{css as y}from"./Directions/css.js";import{DirectionsSearchTool as b}from"./Directions/DirectionsSearchTool.js";import f from"./Directions/DirectionsViewModel.js";import S from"./Directions/DirectionsVisibleElements.js";import{formatDistance as M,formatDuration as k,DepartureTimeOption as I,getIconName as F}from"./Directions/support/directionsUtils.js";import{isArcGISWorldGeocoder as T,meteredArcGISLocatorUrl as D}from"./Search/support/locatorUtils.js";import{loadCalciteComponents as x}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{tsx as R}from"./support/jsxFactory.js";function A(e){const{branchName:s,displayText:i,exitName:o,intersectingName:r,name:a,towardName:n}=e;if(null==i)return null;const l=[s,o,r,a,n].filter(t).sort(((e,t)=>t.length-e.length)).map((e=>d(e)));if(!l.length)return i;const c=new RegExp(l.join("|"),"g"),h=i.matchAll(c);let m=0;const p=[];for(const{0:t,index:d}of h)p.push(i.slice(m,d),R("span",{class:y.labelEmphasize,key:`maneuver-${d}`},t)),m=d+t.length;return p.push(i.slice(m)),R("span",null,p)}let L=class extends _{constructor(e,t){super(e,t),this._activeManeuver=null,this._placeholderStops=new s([new v,new v]),this._portalFolderCombobox=null,this._portalFolders=null,this._portalItemNameInput=null,this._portalUserName=null,this._sections=null,this._stopsToSearches=new Map,this._currentFlowItem="primary",this._parentFlowItem="primary",this._saveState="initialized",this._searchTool=null,this.headingLevel=2,this.messages=null,this.messagesUnits=null,this.searchProperties=null,this.viewModel=new f,this.visibleElements=new S,this._solveRouteDebounced=r((()=>this._solveRoute()))}initialize(){this.addHandles([n((()=>this.viewModel.layer),(()=>{try{this.viewModel.load()}catch{}}),l),n((()=>this.viewModel.layer?.routeInfo),(()=>{this._sections=this._getStopSections()}),l),n((()=>this.viewModel.layer?.stops.toArray()),(e=>{e&&this.view?.activeTool&&this._searchTool&&this.view.activeTool===this._searchTool&&!e.includes(this._searchTool.stop)&&(this.view.tools.remove(this._searchTool),this._searchTool=null)}))])}loadDependencies(){return x({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"block-section":()=>import("@esri/calcite-components/dist/components/calcite-block-section"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}destroy(){this._stopsToSearches.forEach(o)}get apiKey(){return this.viewModel.apiKey}set apiKey(e){this.viewModel.apiKey=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"right"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get lastRoute(){return this.viewModel.lastRoute}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxStops(){return this.viewModel.maxStops}set maxStops(e){this.viewModel.maxStops=e}get unit(){return this.defaultUnit}set unit(e){this._overrideIfSome("unit",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}acquireSearch(e){const{view:t}=this.viewModel;if(this._stopsToSearches.has(e)){const s=this._stopsToSearches.get(e);return s.view=t,this._overrideDefaultSources(s),s}const s=new w({icon:!1,popupEnabled:!1,resultGraphicEnabled:!1,view:t,...this.searchProperties});return this._normalizeSearchSources(s),this.addHandles([c((()=>s.allSources),"change",(()=>this._normalizeSearchSources(s))),s.on("search-clear",(()=>{e.geometry=null,e.name=null,this.viewModel.layer?.removeResult()})),s.on("select-result",(()=>{const t=s.selectedResult;e.geometry=t?.feature.geometry,e.name=t?.name,this._solveRouteDebounced()})),n((()=>s.searchTerm),(t=>{e.name=t}))],s),this._stopsToSearches.set(e,s),s}getDirections(){return this.viewModel.getDirections()}render(){return R("div",{class:this.classes(y.base,E.widget,E.panel)},R("calcite-flow",null,this._renderPrimaryFlowItem(),this._renderDirectionsFlowItem(),this._renderEditFlowItem(),this._renderSaveFlowItem()))}save(){return this.viewModel.save()}saveAs(e,t={}){return this.viewModel.saveAs(e,t)}zoomToRoute(){return this.viewModel.zoomToRoute()}_applyLocatorSourceOverrides({allSources:e}){for(const t of e)"url"in t&&t.url&&(t.locationType??="street",T(t.url)&&this.apiKey&&null==t.apiKey&&(t.apiKey=this.apiKey,t.url=D))}_disposeSearch(e){if(!e||!this._stopsToSearches.has(e))return;const t=this._stopsToSearches.get(e);this.removeHandles(t),t.destroy(),this._stopsToSearches.delete(e)}_getEffectiveStops(){return this.viewModel.layer?.stops??this._placeholderStops}_getErrorDescription(){switch(this.viewModel.lastError?.name){case"directions-view-model:unable-to-route":return this.messages.errors.unableToRoute;case"directions-view-model:service-metadata-unavailable":return this.messages.errors.unableToLoadServiceMetadata;default:return this.messages.errors.unknownError}}_getNetworkFeatureName(e){switch(e.type){case"stop":switch(e.locationType){case"stop":default:return this.messages.networkFeatures.stops.stop;case"waypoint":return this.messages.networkFeatures.stops.waypoint;case"break":return this.messages.networkFeatures.stops.break}case"point-barrier":return this.messages.networkFeatures.pointBarrier;case"polyline-barrier":return this.messages.networkFeatures.polylineBarrier;case"polygon-barrier":return this.messages.networkFeatures.polygonBarrier}}_getRouteCostSummary(){const e=this.viewModel.layer?.routeInfo;if(!e)return null;const t=e.totalDistance??0,s=e.totalDuration??0,{messagesUnits:i,unit:o}=this;return{distance:M(i,t,o),duration:k(s)}}_getStopSections(){if(!this.viewModel.layer)return null;const{directionPoints:e,directionLines:t,stops:s}=this.viewModel.layer;if(!e||!t)return null;const i=[];let o=null;for(const r of e){const{objectId:e,stopId:a}=r;if(null!=a){const e=s.find((({objectId:e})=>e===a));o&&o.stop===e||(o={stop:e,directions:[]},i.push(o));continue}if(null==o)continue;const n=t.find((({directionPointId:t})=>t===e));null!=n&&o.directions.push({directionPoint:r,directionLine:n})}return i}_handleLocateStopAction(e){const{view:t}=this;if(!t)return;const s="directions-search-tool";this.removeHandles(s),this._searchTool=new b({stop:e,view:t}),this.addHandles([this._searchTool.on("click",(async t=>{if(t.mapPoint&&this._stopsToSearches.has(e)){const s=this._stopsToSearches.get(e),i=await s.search(t.mapPoint),o=i?.results?.[0].results?.[0];if(o){const{feature:t,name:i}=o;s.searchTerm=i,e.geometry=t.geometry}}this.removeHandles(s)})),i((()=>{this._searchTool&&(this.view?.tools.remove(this._searchTool),this._searchTool=null)}))],s),t.addAndActivateTool(this._searchTool)}_handleEditingDoneClick(){this.viewModel.stopEditing(),this._currentFlowItem="primary"}async _handleSaveLayerAsAction(){const e=p.getDefault();try{await e.signIn()}catch(t){if(a(t)||"identity-manager:user-aborted"===t.name)return;return this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",void(this._saveState="connect-to-portal-error")}this._saveState="fetch-portal-information",this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",this._portalUserName=e.user?.username;try{this._portalFolders=await(e.user?.fetchFolders())}catch{return void(this._saveState="fetch-portal-information-error")}this._saveState="save-layer"}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){for(const t of e.viewModel.defaultSources)t.autoNavigate=!1}_renderClearRouteAction(e){return R("calcite-action",{icon:"trash",key:"clear-route",onclick:()=>{this._currentFlowItem="primary",this.viewModel.reset()},...e,text:this.messages.common.clear,textEnabled:!0})}_renderDeleteStopAction(e){const t=this._getEffectiveStops();return R("calcite-action",{icon:"trash",onclick:()=>{t.remove(e),this._disposeSearch(e),this._solveRouteDebounced()},scale:"s",slot:"actions-end",text:this.messages.deleteStop,title:this.messages.deleteStop})}_renderDepartureTime(){const{DEPART_AT:e,NOW:t,UNSPECIFIED:s}=I;return R("calcite-label",{class:y.departureTime,key:"departure-time"},this.messages.departureTime,R("calcite-combobox",{clearDisabled:!0,label:this.messages.departureTime,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.departureOption=t[0].value,this._solveRouteDebounced())}},R("calcite-combobox-item",{heading:this.messages.leaveNow,key:t,label:this.messages.leaveNow,selected:this.viewModel.departureOption===t,value:t}),R("calcite-combobox-item",{heading:this.messages.departAt,key:e,label:this.messages.departAt,selected:this.viewModel.departureOption===e,value:e}),R("calcite-combobox-item",{heading:this.messages.timeUnspecified,key:s,label:this.messages.timeUnspecified,selected:this.viewModel.departureOption===s,value:s})))}_renderDepartureTimeOptions(){return this.viewModel.departureOption!==I.DEPART_AT?null:R("div",{class:y.departureTimeOptions},R("calcite-input-date-picker",{scale:"s",value:this.viewModel.departureIsoDate,onCalciteInputDatePickerChange:({currentTarget:{value:e}})=>{Array.isArray(e)||(this.viewModel.departureIsoDate=e,this._solveRouteDebounced())}}),R("calcite-input-time-picker",{scale:"s",value:this.viewModel.departureIsoTime,onCalciteInputTimePickerClose:({currentTarget:{value:e}})=>{this.viewModel.departureIsoTime=e,this._solveRouteDebounced()}}))}_renderDirectionsFlowItem(){if("directions"!==this._currentFlowItem)return null;const e=this._getRouteCostSummary();if(!this._sections||!e)return null;const{distance:t,duration:s}=e,{formattedEta:i}=this.viewModel,o=this._sections.at(0)?.stop.name??"",r=this._sections.at(-1)?.stop.name??"";return R("calcite-flow-item",{key:"directions-flow-item",overlayPositioning:"fixed",selected:"directions"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem="primary"}},R("div",{class:y.directionsHeader,slot:"header-content"},R("div",{class:y.headerStops},R("span",null,this.messages.from)," ",R("span",{class:y.directionsHeaderStopName},o),R("span",null,this.messages.to)," ",R("span",{class:y.directionsHeaderStopName},r)),R("div",{class:y.flexColumn},R("span",null,`${s} (${t})`),i?R("span",null,i):null)),this._renderRouteLayerActions({slot:"header-menu-actions"}),R("calcite-accordion",{class:y.accordion,iconPosition:"start",selectionMode:"single"},this._sections.map(((e,t)=>{const{stop:s,directions:i}=e,{name:o}=s;return R("calcite-accordion-item",{expanded:0===t,heading:o??"",key:`stop-${t}`},R("calcite-action",{icon:"zoom-to-object",onclick:()=>{this.viewModel.centerAt(s)},slot:"actions-end",text:this.messages.panToStop}),this._renderDirectionTurns(i))}))))}_renderDirectionTurns(e){return R("calcite-list",{label:this.messages.drivingDirections,selectionMode:"none"},e.map(((e,t)=>{const{directionPoint:s,directionLine:i}=e,{distance:o,duration:r}=i,a=M(this.messagesUnits,o??0,this.unit),n=k(r??0),l=a&&n?`${a} | ${n}`:`${a||n}`,c=A(s),d=F(s.directionPointType);return R("calcite-list-item",{class:y.labelNoBottomMargin,key:`driving-direction-${t}`,onpointerenter:()=>{this.viewModel.highlight(i)},onpointerleave:()=>{this.viewModel.clearHighlights()},onCalciteListItemSelect:()=>{this._activeManeuver===i?this.zoomToRoute():(this._activeManeuver=i,this.viewModel.centerAt(i.geometry))}},R("calcite-icon",{icon:d,slot:"content-start"}),R("div",{slot:"content"},R("calcite-label",{layout:"inline",scale:"s"},c),R("calcite-label",{layout:"inline",scale:"s"},l)))})))}_renderEditFlowItem(){return"edit"!==this._currentFlowItem?null:R("calcite-flow-item",{heading:this.messages.editRoute,headingLevel:this.headingLevel,key:"edit-flow-item",loading:"routing"===this.viewModel.state,selected:"edit"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this.viewModel.stopEditing(),this._currentFlowItem="primary"}},R("div",{class:y.flexColumn,key:"edit-container"},R("div",{class:y.editToolbarContainer},R("calcite-label",{layout:"inline",scale:"s"},this.messages.automaticallySolve,R("calcite-switch",{checked:this.viewModel.autoSolve,scale:"s",onCalciteSwitchChange:e=>{this.viewModel.autoSolve=e.target.checked}})),R("div",{class:y.editToolbar},R("calcite-action",{disabled:!this.viewModel.layer||this.viewModel.layer.stops.length>=this.maxStops,icon:"flag",onclick:()=>{this.viewModel.create("stop")},scale:"s",text:this.messages.networkFeatures.stops.stop,textEnabled:!0}),R("calcite-action",{icon:"line",onclick:()=>{this.viewModel.create("polyline-barrier")},scale:"s",text:this.messages.barrier,textEnabled:!0}),R("calcite-action",{class:y.solveRoute,disabled:this.viewModel.autoSolve,icon:"refresh",onclick:()=>{this._solveRouteDebounced()},scale:"s",text:this.messages.solve,textEnabled:!0}))),R("div",{class:y.selectedFeatureContainer},R("calcite-list",{label:this.messages.selectedNetworkFeatures,scale:"s",selectionMode:"none"},this.viewModel.selectedNetworkFeatures?.toArray().map(((e,t)=>R("calcite-list-item",{description:this._getNetworkFeatureName(e),key:`network-feature-${t}`,label:e.name??e.objectId?.toString()??this.messages.unnamed},R("calcite-action",{icon:"trash",onclick:()=>{this.viewModel.remove(e),this.viewModel.autoSolve&&this._solveRouteDebounced()},scale:"s",slot:"actions-end",text:this.messages.common.delete})))))),R("div",{class:y.editFooter},this._renderEditFooterContent())))}_renderEditFooterContent(){return this.viewModel.lastError?this._renderErrorNotice():R("calcite-button",{appearance:"outline-fill",bind:this,onclick:this._handleEditingDoneClick,width:"full"},this.messages.common.done)}_renderErrorNotice(){return R("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this._getErrorDescription()))}_renderFooter(){if(!this.viewModel.layer)return R("div",{class:y.primaryFooter,key:"footer-missing-layer"},R("calcite-notice",{icon:"information",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this.messages.missingLayer)));if("unauthenticated"===this.viewModel.state)return R("div",{class:y.primaryFooterCentered,key:"footer-sign-in"},R("calcite-label",null,this.messages.signInRequired),R("calcite-button",{onclick:()=>{this.viewModel.load().catch((()=>{}))}},this.messages.common.auth.signIn));if("routing"===this.viewModel.state)return R("div",{class:this.classes(y.primaryFooter,y.primaryFooterLoader),key:"footer-routing"},R("calcite-loader",{label:this.messages.solve,scale:"s"}));if("error"===this.viewModel.state)return R("div",{class:y.primaryFooter,key:"footer-service-error"},this._renderErrorNotice());if(!this.viewModel.layer?.routeInfo)return R("div",{class:y.primaryFooter,key:"footer-unsolved-route"},R("calcite-notice",{icon:"information",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this.messages.directionsPlaceholder)));const e=this._getRouteCostSummary();if(!e||!this.viewModel.layer?.directionPoints)return R("div",{class:y.primaryFooter,key:"footer-invalid-route"},R("calcite-notice",{icon:"exclamation-mark-triangle",kind:"danger",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this.messages.invalidRoute)));const{distance:t,duration:s}=e,{formattedEta:i}=this.viewModel;return R("div",{class:y.routeItem,key:"footer-directions-summary"},R("button",{"aria-busy":"false","aria-label":this.messages.viewDrivingDirections,"aria-live":"polite",class:y.routeItemButton,onclick:()=>{this._currentFlowItem="directions"},type:"button"},R("div",{class:y.routeItemButtonContent},R("span",{class:y.routeItemLabel},`${s} (${t})`),R("span",{class:y.routeItemDescription},i)),R("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s"})),R("calcite-dropdown",null,R("calcite-action",{icon:"ellipsis",slot:"trigger",text:"Route actions"}),this._renderRouteLayerActions()))}_renderInteractiveRouteActions(){return R("div",{class:y.actionContainer,key:"interactive-route-action-container"},R("calcite-button",{appearance:"outline",class:y.addStopButton,disabled:this._getEffectiveStops().length>=this.maxStops,iconStart:"plus",kind:"neutral",label:this.messages.addStop,onclick:()=>{const e=new g;this.viewModel.layer?.stops.add(new v({symbol:e}))},width:"half"},this.messages.addStop),R("calcite-button",{appearance:"outline",class:y.editRouteButton,disabled:"2d"!==this.viewModel.view?.type,iconStart:"pencil",kind:"neutral",label:this.messages.editRoute,onclick:()=>{this._currentFlowItem="edit",this.viewModel.startEditing()},width:"half"},this.messages.editRoute))}_renderLocateStopAction(e){if(null!=e.name||null!=e.geometry)return null;const t=this._getEffectiveStops().indexOf(e),s=!!this.view?.activeTool&&this.view.activeTool===this._searchTool&&this._searchTool.stop===e;return R("calcite-action",{active:s,icon:"crosshair",key:`stop-location-action-${t}`,onclick:()=>this._handleLocateStopAction(e),scale:"s",slot:"actions-end",text:this.messages.pickALocationOnTheMap,title:this.messages.pickALocationOnTheMap})}_renderOptimizeStopOrder(){const{routeParameters:e}=this.viewModel,{findBestSequence:t,preserveFirstStop:s,preserveLastStop:i}=e;return R("calcite-block-section",{class:y.optimizeSection,text:this.messages.optimizeOrder,toggleDisplay:"switch",onCalciteBlockSectionToggle:({target:t})=>{e.findBestSequence=t.expanded,this._solveRouteDebounced()}},t?[R("calcite-label",{class:y.optimizeSwitches,key:"preserve-first-stop",layout:"inline-space-between"},this.messages.preserveFirstStop,R("calcite-switch",{checked:s,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveFirstStop=t,this._solveRouteDebounced()}})),R("calcite-label",{class:y.optimizeSwitches,key:"preserve-last-stop",layout:"inline-space-between"},this.messages.preserveLastStop,R("calcite-switch",{checked:i,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveLastStop=t,this._solveRouteDebounced()}}))]:null)}_renderPrimaryFlowItem(){return R("calcite-flow-item",{key:"primary-flow-item",loading:"initializing"===this.viewModel.state,selected:"primary"===this._currentFlowItem},R("calcite-panel",{class:y.primaryFlowItem,disabled:!this.viewModel.layer||"unauthenticated"===this.viewModel.state||"error"===this.viewModel.state&&!this.viewModel.serviceDescription},this._renderStops(),this._renderInteractiveRouteActions(),this._renderSeparator(),this._renderRouteSolveOptions()),this._renderFooter())}_renderRouteLayerActions(e){return[this._renderClearRouteAction(e),this._renderSaveLayerAction(e),this._renderSaveLayerAsAction(e),this._renderViewItemDetailsAction(e)]}_renderRouteSolveOptions(){return R("div",{class:y.marginInlineMedium,key:"route-solve-options"},this._renderTravelModes(),this._renderDepartureTime(),this._renderDepartureTimeOptions(),this._renderOptimizeStopOrder())}_renderSaveContent(){switch(this._saveState){case"initialized":return this._renderSaveInitialized();case"connect-to-portal":return this._renderSaveProcessing(this.messages.identity.lblSigning);case"connect-to-portal-error":return this._renderSaveError(this.messages.errors.authenticating);case"fetch-portal-information":return this._renderSaveProcessing(this.messages.processing.fetching);case"fetch-portal-information-error":return this._renderSaveError(this.messages.errors.fetching);case"save-layer":return this._renderSaveLayerSettings();case"saving":return this._renderSaveProcessing(this.messages.processing.saving);case"saving-error":return this._renderSaveError(this.messages.errors.saving)}}_renderSaveError(e){return R("calcite-panel",{class:y.paddingMedium,key:"save-layer-error"},R("div",{class:y.saveError},R("calcite-icon",{class:y.saveErrorIcon,icon:"exclamation-mark-triangle",scale:"l",textLabel:this.messages.common.errorMessage}),R("calcite-label",{class:y.saveErrorLabel},e)),R("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.close))}_renderSaveInitialized(){return R("calcite-panel",{class:y.paddingMedium,key:"save-layer-initialized"})}_renderSaveFlowItem(){return"save"!==this._currentFlowItem?null:R("calcite-flow-item",{heading:this.messages.saveLayer,headingLevel:this.headingLevel,key:"save-layer-flow-item",selected:"save"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem=this._parentFlowItem}},this._renderSaveContent())}_renderSaveLayerAction(e){if(!this.visibleElements.saveButton)return null;const t=this.viewModel.layer,s=t?.routeInfo,i=t?.portalItem?.itemControl;return R("calcite-action",{disabled:!(!!s&&("admin"===i||"update"===i)),icon:"save",key:"save-route",onclick:()=>{this.viewModel.layer?.save()},...e,text:this.messages.common.save,textEnabled:!0})}_renderSaveLayerAsAction(e){if(!this.visibleElements.saveAsButton)return null;const t=!this.viewModel.layer?.routeInfo;return R("calcite-action",{disabled:t,icon:"save-as",key:"save-as-route",onclick:()=>{this._handleSaveLayerAsAction()},...e,text:this.messages.common.saveAs,textEnabled:!0})}_renderSaveLayerSettings(){if(null==this.layer||null==this._portalFolders||null==this._portalUserName)return this._renderSaveInitialized();const{stops:e}=this.layer,t=`${e.at(0).name} - ${e.at(-1).name}`,s=[R("calcite-combobox-item",{heading:`${this._portalUserName} (${this.messages.common.home})`,key:y.folderHome,selected:!0,value:y.folderHome}),...this._portalFolders.map((e=>R("calcite-combobox-item",{heading:e.title??"",key:`${y.folder}-${e.id}`,value:e.id})))];return R("calcite-panel",{key:"save-layer-panel"},R("div",{class:y.paddingMedium},R("calcite-label",null,this.messages.laverName,R("calcite-input",{afterCreate:e=>{this._portalItemNameInput=e},label:this.messages.laverName,value:t})),R("calcite-label",null,this.messages.saveInFolder,R("calcite-combobox",{afterCreate:e=>{this._portalFolderCombobox=e},clearDisabled:!0,label:this.messages.saveInFolder,overlayPositioning:"fixed",selectionMode:"single"},s))),R("calcite-button",{onclick:()=>{if(this._saveState="saving",null==this.layer||null==this._portalFolders)return;const e=this._portalItemNameInput?.value,t=this._portalFolderCombobox?.value,s=this._portalFolders.find((({id:e})=>e===t));this.layer.saveAs({title:e},{folder:s}).then((()=>{this._currentFlowItem=this._parentFlowItem})).catch((()=>{this._saveState="saving-error"}))},slot:"footer-actions",width:"full"},this.messages.common.save),R("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.cancel))}_renderSaveProcessing(e){return R("calcite-panel",{class:y.marginInlineMedium,key:"save-layer-processing"},R("calcite-loader",{class:y.saveProcessLoader,label:e,text:e}))}_renderSeparator(){return R("div",{class:y.separator})}_renderStop(e){const t=this.acquireSearch(e);null!=e.name&&(t.searchTerm=e.name);const s=this._getEffectiveStops(),i=this._renderLocateStopAction(e),o=s.length>2&&this._renderDeleteStopAction(e);return R("calcite-list-item",{key:e,value:e},i,o,R("div",{class:y.stopItem,slot:"content"},t.render()))}_renderStops(){const e=this._getEffectiveStops();for(const t of this._stopsToSearches.keys())e.includes(t)||this._disposeSearch(t);return R("div",{class:y.stopContainer,key:y.stopContainer},R("calcite-list",{class:y.stopList,dragEnabled:!0,label:this.messages.widgetLabel,scale:"s",onCalciteListOrderChange:({detail:t})=>{e.reorder(t.dragEl.value,t.newIndex),this._solveRouteDebounced()}},e.toArray().map((e=>this._renderStop(e)))),2===e.length&&R("calcite-action",{icon:"arrow-up-down",onclick:()=>{e.reverse(),this._solveRouteDebounced()},scale:"s",text:this.messages.reverseStops}))}_renderTravelModes(){return this.viewModel.travelModes.length?R("calcite-label",{key:"travel-modes"},this.messages.mode,R("calcite-combobox",{clearDisabled:!0,label:this.messages.mode,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.selectedTravelMode=t[0].value,this._solveRouteDebounced())}},this.viewModel.travelModes.map((e=>R("calcite-combobox-item",{heading:e.name,key:e.id,label:e.name,selected:this.viewModel.selectedTravelMode?.id===e.id,value:e}))))):null}_renderViewItemDetailsAction(e){if(!this.visibleElements.layerDetails)return null;const t=this.viewModel.layer?.portalItem;return R("calcite-action",{disabled:!t,icon:"launch",key:"open-route-details-link",onclick:()=>{t&&window.open(`${t.portal.url}/home/item.html?id=${t.id}`,"_blank")},...e,text:this.messages.viewLayerDetails,textEnabled:!0})}async _solveRoute(){this.viewModel.updateDepartureTime();if(!((this.viewModel.layer?.stops.filter((({geometry:e})=>!!e)).length??0)<2))try{await this.viewModel.getDirections()}catch{}}};e([h()],L.prototype,"_currentFlowItem",void 0),e([h()],L.prototype,"_saveState",void 0),e([h()],L.prototype,"_searchTool",void 0),e([h()],L.prototype,"apiKey",null),e([h(u)],L.prototype,"defaultUnit",void 0),e([h()],L.prototype,"goToOverride",null),e([h()],L.prototype,"headingLevel",void 0),e([h()],L.prototype,"icon",null),e([h()],L.prototype,"label",null),e([h({readOnly:!0})],L.prototype,"lastRoute",null),e([h()],L.prototype,"layer",null),e([h()],L.prototype,"maxStops",null),e([h(),C("esri/widgets/Directions/t9n/Directions")],L.prototype,"messages",void 0),e([h(),C("esri/core/t9n/Units")],L.prototype,"messagesUnits",void 0),e([h()],L.prototype,"searchProperties",void 0),e([h()],L.prototype,"unit",null),e([h()],L.prototype,"view",null),e([h({type:f})],L.prototype,"viewModel",void 0),e([h({type:S,nonNullable:!0})],L.prototype,"visibleElements",void 0),L=e([m("esri.widgets.Directions")],L);const j=L;export{j as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import{isSome as t}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{addEventListener as s}from"../core/events.js";import{makeHandle as o}from"../core/handleUtils.js";import{destroyMaybe as r}from"../core/maybe.js";import{debounce as n,isAbortError as a}from"../core/promiseUtils.js";import{watch as l,initial as c,on as d}from"../core/reactiveUtils.js";import{escapeRegExpString as h}from"../core/string.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import u from"../portal/Portal.js";import{defaultUnitPropertyMetadata as v}from"../properties/defaultUnit.js";import _ from"../rest/support/Stop.js";import g from"../symbols/SimpleMarkerSymbol.js";import w from"./Search.js";import y from"./Widget.js";import{css as b}from"./Directions/css.js";import{DirectionsSearchTool as S}from"./Directions/DirectionsSearchTool.js";import f from"./Directions/DirectionsViewModel.js";import k from"./Directions/DirectionsVisibleElements.js";import{formatDistance as C,formatDuration as D,DepartureTimeOption as M,getIconName as I}from"./Directions/support/directionsUtils.js";import{isArcGISWorldGeocoder as T,meteredArcGISLocatorUrl as F}from"./Search/support/locatorUtils.js";import{loadCalciteComponents as P}from"./support/componentsUtils.js";import{globalCss as x}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as E}from"./support/decorators/messageBundle.js";import{tsx as R}from"./support/jsxFactory.js";function L(e){const{branchName:i,displayText:s,exitName:o,intersectingName:r,name:n,towardName:a}=e;if(null==s)return null;const l=[i,o,r,n,a].filter(t).sort(((e,t)=>t.length-e.length)).map((e=>h(e)));if(!l.length)return s;const c=new RegExp(l.join("|"),"g"),d=s.matchAll(c);let m=0;const p=[];for(const{0:t,index:h}of d)p.push(s.slice(m,h),R("span",{class:b.labelEmphasize,key:`maneuver-${h}`},t)),m=h+t.length;return p.push(s.slice(m)),R("span",null,p)}let A=class extends y{constructor(e,t){super(e,t),this._activeManeuver=null,this._placeholderStops=new i([new _,new _]),this._portalFolderCombobox=null,this._portalFolders=null,this._portalItemNameInput=null,this._portalUserName=null,this._printDocument=null,this._printDocumentParent=null,this._sections=null,this._stopsToSearches=new Map,this._printDocumentOpen=!1,this._currentFlowItem="primary",this._parentFlowItem="primary",this._saveState="initialized",this._searchTool=null,this.headingLevel=2,this.messages=null,this.messagesUnits=null,this.searchProperties=null,this.viewModel=new f,this.visibleElements=new k,this._solveRouteDebounced=n((()=>this._solveRoute()))}initialize(){this.addHandles([l((()=>this.viewModel.layer),(()=>{try{this.viewModel.load()}catch{}}),c),l((()=>this.viewModel.layer?.routeInfo),(()=>{this._sections=this._getStopSections()}),c),l((()=>this.viewModel.layer?.stops.toArray()),(e=>{e&&this.view?.activeTool&&this._searchTool&&this.view.activeTool===this._searchTool&&!e.includes(this._searchTool.stop)&&(this.view.tools.remove(this._searchTool),this._searchTool=null)})),s(window,"beforeprint",this._beforePrint.bind(this)),s(window,"afterprint",this._afterPrint.bind(this))])}loadDependencies(){return P({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"action-menu":()=>import("@esri/calcite-components/dist/components/calcite-action-menu"),"block-section":()=>import("@esri/calcite-components/dist/components/calcite-block-section"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}destroy(){this._stopsToSearches.forEach(r)}get apiKey(){return this.viewModel.apiKey}set apiKey(e){this.viewModel.apiKey=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"right"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get lastRoute(){return this.viewModel.lastRoute}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxStops(){return this.viewModel.maxStops}set maxStops(e){this.viewModel.maxStops=e}get unit(){return this.defaultUnit}set unit(e){this._overrideIfSome("unit",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}acquireSearch(e){const{view:t}=this.viewModel;if(this._stopsToSearches.has(e)){const i=this._stopsToSearches.get(e);return i.view=t,this._overrideDefaultSources(i),i}const i=new w({icon:!1,popupEnabled:!1,resultGraphicEnabled:!1,view:t,...this.searchProperties});return this._normalizeSearchSources(i),this.addHandles([d((()=>i.allSources),"change",(()=>this._normalizeSearchSources(i))),i.on("search-clear",(()=>{e.geometry=null,e.name=null,this.viewModel.layer?.removeResult()})),i.on("select-result",(()=>{const t=i.selectedResult;e.geometry=t?.feature.geometry,e.name=t?.name,this._solveRouteDebounced()})),l((()=>i.searchTerm),(t=>{e.name=t}))],i),this._stopsToSearches.set(e,i),i}getDirections(){return this.viewModel.getDirections()}render(){return R("div",{class:this.classes(b.base,x.widget,x.panel)},R("calcite-flow",null,this._renderPrimaryFlowItem(),this._renderDirectionsFlowItem(),this._renderEditFlowItem(),this._renderSaveFlowItem()),this._renderPrintDocument())}save(){return this.viewModel.save()}saveAs(e,t={}){return this.viewModel.saveAs(e,t)}zoomToRoute(){return this.viewModel.zoomToRoute()}_afterPrint(){this._printDocumentOpen&&this._printDocument&&this._printDocumentParent?.appendChild(this._printDocument)}_applyLocatorSourceOverrides({allSources:e}){for(const t of e)"url"in t&&t.url&&(t.locationType??="street",T(t.url)&&this.apiKey&&null==t.apiKey&&(t.apiKey=this.apiKey,t.url=F))}_beforePrint(){this._printDocumentOpen&&this._printDocument&&document.body.appendChild(this._printDocument)}_disposeSearch(e){if(!e||!this._stopsToSearches.has(e))return;const t=this._stopsToSearches.get(e);this.removeHandles(t),t.destroy(),this._stopsToSearches.delete(e)}_getEffectiveStops(){return this.viewModel.layer?.stops??this._placeholderStops}_getErrorDescription(){switch(this.viewModel.lastError?.name){case"directions-view-model:unable-to-route":return this.messages.errors.unableToRoute;case"directions-view-model:service-metadata-unavailable":return this.messages.errors.unableToLoadServiceMetadata;default:return this.messages.errors.unknownError}}_getNetworkFeatureName(e){switch(e.type){case"stop":switch(e.locationType){case"stop":default:return this.messages.networkFeatures.stops.stop;case"waypoint":return this.messages.networkFeatures.stops.waypoint;case"break":return this.messages.networkFeatures.stops.break}case"point-barrier":return this.messages.networkFeatures.pointBarrier;case"polyline-barrier":return this.messages.networkFeatures.polylineBarrier;case"polygon-barrier":return this.messages.networkFeatures.polygonBarrier}}_getRouteCostSummary(){const e=this.viewModel.layer?.routeInfo;if(!e)return null;const t=e.totalDistance??0,i=e.totalDuration??0,{messagesUnits:s,unit:o}=this;return{distance:C(s,t,o),duration:D(i)}}_getStopSections(){if(!this.viewModel.layer)return null;const{directionPoints:e,directionLines:t,stops:i}=this.viewModel.layer;if(!e||!t)return null;const s=[];let o=null;for(const r of e){const{objectId:e,stopId:n}=r;if(null!=n){const e=i.find((({objectId:e})=>e===n));o&&o.stop===e||(o={stop:e,directions:[]},s.push(o));continue}if(null==o)continue;const a=t.find((({directionPointId:t})=>t===e));null!=a&&o.directions.push({directionPoint:r,directionLine:a})}return s}_handleAddStopClick(){const e=new g;this.viewModel.layer?.stops.add(new _({symbol:e}))}_handleAutoSolveChange({target:e}){this.viewModel.autoSolve=e.checked}_handleCreatePolylineBarrierClick(){this.viewModel.create("polyline-barrier")}_handleClearRouteClick(){this._currentFlowItem="primary",this.viewModel.reset()}_handleCreateStopClick(){this.viewModel.create("stop")}_handleDeleteNetworkFeatureClick(e){this.viewModel.remove(e),this.viewModel.autoSolve&&this._solveRouteDebounced()}_handleDeleteStopClick(e){this._getEffectiveStops().remove(e),this._disposeSearch(e),this._solveRouteDebounced()}_handleDepartureDateChange({currentTarget:{value:e}}){Array.isArray(e)||(this.viewModel.departureIsoDate=e,this._solveRouteDebounced())}_handleDepartureTimeChange({currentTarget:{value:e}}){this.viewModel.departureIsoTime=e,this._solveRouteDebounced()}_handleDepartureTimeOptionChange({currentTarget:e}){const{selectedItems:t}=e;t.length&&(this.viewModel.departureOption=t[0].value,this._solveRouteDebounced())}_handleDirectionsFlowItemBackClick(e){e.stopPropagation(),this._currentFlowItem="primary"}_handleDirectionTurnItemSelect(e){this._activeManeuver===e?this.zoomToRoute():(this._activeManeuver=e,this.viewModel.centerAt(e.geometry))}_handleDirectionTurnPointerEnter(e){this.viewModel.highlight(e)}_handleDirectionTurnPointerLeave(){this.viewModel.clearHighlights()}_handleEditFlowItemBackClick(e){e.stopPropagation(),this.viewModel.stopEditing(),this._currentFlowItem="primary"}_handleEditingDoneClick(){this.viewModel.stopEditing(),this._currentFlowItem="primary"}_handleEditRouteClick(){this._currentFlowItem="edit",this.viewModel.startEditing()}_handleItemDetailsClick(){const e=this.viewModel.layer?.portalItem;e&&window.open(`${e.portal.url}/home/item.html?id=${e.id}`,"_blank")}_handleLocateStopClick(e){const{view:t}=this;if(!t)return;const i="directions-search-tool";this.removeHandles(i),this._searchTool=new S({stop:e,view:t}),this.addHandles([this._searchTool.on("click",(async t=>{if(t.mapPoint&&this._stopsToSearches.has(e)){const i=this._stopsToSearches.get(e),s=await i.search(t.mapPoint),o=s?.results?.[0].results?.[0];if(o){const{feature:t,name:s}=o;i.searchTerm=s,e.geometry=t.geometry}}this.removeHandles(i)})),o((()=>{this._searchTool&&(this.view?.tools.remove(this._searchTool),this._searchTool=null)}))],i),t.addAndActivateTool(this._searchTool)}_handleOptimizeStopOrderToggle({target:{expanded:e}}){this.viewModel.routeParameters.findBestSequence=e,this._solveRouteDebounced()}_handlePanToStopClick(e){this.viewModel.centerAt(e)}_handlePreserveFirstStopChange({target:{checked:e}}){this.viewModel.routeParameters.preserveFirstStop=e,this._solveRouteDebounced()}_handlePreserveLastStopChange({target:{checked:e}}){this.viewModel.routeParameters.preserveLastStop=e,this._solveRouteDebounced()}_handlePrintDocumentAfterCreate(e){e.focus(),this._printDocument=e,this._printDocumentParent=e.parentElement}_handlePrintDocumentClick(){this._printDocumentOpen=!0}_handlePrintDocumentCloseClick(){this._printDocumentOpen=!1}_handlePrintDocumentKeyDown(e){"Escape"===e.key&&(this._printDocumentOpen=!1)}_handlePrintDocumentPrintClick(){window.print()}_handleResolveRouteClick(){this._solveRouteDebounced()}_handleReverseStopOrderClick(){this._getEffectiveStops().reverse(),this._solveRouteDebounced()}_handleSaveErrorCloseClick(){this._currentFlowItem=this._parentFlowItem}_handleSaveFlowItemBackClick(e){e.stopPropagation(),this._currentFlowItem=this._parentFlowItem}async _handleSaveLayerAs(){const e=u.getDefault();try{await e.signIn()}catch(t){if(a(t)||"identity-manager:user-aborted"===t.name)return;return this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",void(this._saveState="connect-to-portal-error")}this._saveState="fetch-portal-information",this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",this._portalUserName=e.user?.username;try{this._portalFolders=await(e.user?.fetchFolders())}catch{return void(this._saveState="fetch-portal-information-error")}this._saveState="save-layer"}_handleSaveLayerClick(){this.viewModel.layer?.save()}_handleSaveLayerButtonClick(){if(this._saveState="saving",null==this.layer||null==this._portalFolders)return;const e=this._portalItemNameInput?.value,t=this._portalFolderCombobox?.value,i=this._portalFolders.find((({id:e})=>e===t));this.layer.saveAs({title:e},{folder:i}).then((()=>{this._currentFlowItem=this._parentFlowItem})).catch((()=>{this._saveState="saving-error"}))}_handleSaveLayerCancelClick(){this._currentFlowItem=this._parentFlowItem}_handleSaveLayerFolderCreate(e){this._portalFolderCombobox=e}_handleSaveLayerNameCreate(e){this._portalItemNameInput=e}_handleSignInClick(){this.viewModel.load().catch((()=>{}))}_handleStopListReorder({detail:{dragEl:e,newIndex:t}}){this._getEffectiveStops().reorder(e.value,t),this._solveRouteDebounced()}_handleTravelModeChange({currentTarget:{selectedItems:e}}){e.length&&(this.viewModel.selectedTravelMode=e[0].value,this._solveRouteDebounced())}_handleViewDrivingDirectionsClick(){this._currentFlowItem="directions"}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){for(const t of e.viewModel.defaultSources)t.autoNavigate=!1}_renderClearRouteAction(e){return R("calcite-action",{bind:this,icon:"trash",key:"clear-route",onclick:this._handleClearRouteClick,...e,text:this.messages.common.clear,textEnabled:!0})}_renderDeleteStopAction(e){return R("calcite-action",{icon:"trash",onclick:this._handleDeleteStopClick.bind(this,e),scale:"s",slot:"actions-end",text:this.messages.deleteStop,title:this.messages.deleteStop})}_renderDepartureTime(){const{DEPART_AT:e,NOW:t,UNSPECIFIED:i}=M;return R("calcite-label",{class:b.departureTime,key:"departure-time"},this.messages.departureTime,R("calcite-combobox",{bind:this,clearDisabled:!0,label:this.messages.departureTime,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:this._handleDepartureTimeOptionChange},R("calcite-combobox-item",{heading:this.messages.leaveNow,key:t,label:this.messages.leaveNow,selected:this.viewModel.departureOption===t,value:t}),R("calcite-combobox-item",{heading:this.messages.departAt,key:e,label:this.messages.departAt,selected:this.viewModel.departureOption===e,value:e}),R("calcite-combobox-item",{heading:this.messages.timeUnspecified,key:i,label:this.messages.timeUnspecified,selected:this.viewModel.departureOption===i,value:i})))}_renderDepartureTimeOptions(){return this.viewModel.departureOption!==M.DEPART_AT?null:R("div",{class:b.departureTimeOptions},R("calcite-input-date-picker",{bind:this,scale:"s",value:this.viewModel.departureIsoDate,onCalciteInputDatePickerChange:this._handleDepartureDateChange}),R("calcite-input-time-picker",{bind:this,scale:"s",value:this.viewModel.departureIsoTime,onCalciteInputTimePickerClose:this._handleDepartureTimeChange}))}_renderDirectionsFlowItem(){if("directions"!==this._currentFlowItem)return null;const e=this._getRouteCostSummary();if(!this._sections||!e)return null;const{distance:t,duration:i}=e,{formattedEta:s}=this.viewModel,o=this._sections.at(0)?.stop.name??"",r=this._sections.at(-1)?.stop.name??"";return R("calcite-flow-item",{bind:this,key:"directions-flow-item",overlayPositioning:"fixed",selected:"directions"===this._currentFlowItem,onCalciteFlowItemBack:this._handleDirectionsFlowItemBackClick},R("div",{class:b.directionsHeader,slot:"header-content"},R("div",{class:b.headerStops},R("span",null,this.messages.from)," ",R("span",{class:b.directionsHeaderStopName},o),R("span",null,this.messages.to)," ",R("span",{class:b.directionsHeaderStopName},r)),R("div",{class:b.flexColumn},R("span",null,`${i} (${t})`),s?R("span",null,s):null)),this._renderRouteLayerActions({slot:"header-menu-actions"}),R("calcite-accordion",{class:b.accordion,iconPosition:"start",selectionMode:"single"},this._sections.map(((e,t)=>this._renderDirectionSection(e,t)))))}_renderDirectionSection(e,t){const{stop:i,directions:s}=e,{name:o}=i;return R("calcite-accordion-item",{expanded:0===t,heading:o??"",key:`stop-${t}`},R("calcite-action",{icon:"zoom-to-object",onclick:this._handlePanToStopClick.bind(this,i),slot:"actions-end",text:this.messages.panToStop}),this._renderDirectionTurns(s))}_renderDirectionTurns(e){return R("calcite-list",{label:this.messages.drivingDirections,selectionMode:"none"},e.map(((e,t)=>{const{directionPoint:i,directionLine:s}=e,{distance:o,duration:r}=s,n=C(this.messagesUnits,o??0,this.unit),a=D(r??0),l=n&&a?`${n} | ${a}`:`${n||a}`,c=L(i),d=I(i.directionPointType);return R("calcite-list-item",{class:b.labelNoBottomMargin,key:`driving-direction-${t}`,onpointerenter:this._handleDirectionTurnPointerEnter.bind(this,s),onpointerleave:this._handleDirectionTurnPointerLeave.bind(this),onCalciteListItemSelect:this._handleDirectionTurnItemSelect.bind(this,s)},R("calcite-icon",{icon:d,slot:"content-start"}),R("div",{slot:"content"},R("calcite-label",{layout:"inline",scale:"s"},c),R("calcite-label",{layout:"inline",scale:"s"},l)))})))}_renderEditFlowItem(){return"edit"!==this._currentFlowItem?null:R("calcite-flow-item",{bind:this,heading:this.messages.editRoute,headingLevel:this.headingLevel,key:"edit-flow-item",loading:"routing"===this.viewModel.state,selected:"edit"===this._currentFlowItem,onCalciteFlowItemBack:this._handleEditFlowItemBackClick},R("div",{class:b.flexColumn,key:"edit-container"},R("div",{class:b.editToolbarContainer},R("calcite-label",{layout:"inline",scale:"s"},this.messages.automaticallySolve,R("calcite-switch",{bind:this,checked:this.viewModel.autoSolve,scale:"s",onCalciteSwitchChange:this._handleAutoSolveChange})),R("div",{class:b.editToolbar},R("calcite-action",{bind:this,disabled:!this.viewModel.layer||this.viewModel.layer.stops.length>=this.maxStops,icon:"flag",onclick:this._handleCreateStopClick,scale:"s",text:this.messages.networkFeatures.stops.stop,textEnabled:!0}),R("calcite-action",{bind:this,icon:"line",onclick:this._handleCreatePolylineBarrierClick,scale:"s",text:this.messages.barrier,textEnabled:!0}),R("calcite-action",{bind:this,class:b.solveRoute,disabled:this.viewModel.autoSolve,icon:"refresh",onclick:this._handleResolveRouteClick,scale:"s",text:this.messages.solve,textEnabled:!0}))),R("div",{class:b.selectedFeatureContainer},R("calcite-list",{label:this.messages.selectedNetworkFeatures,scale:"s",selectionMode:"none"},this.viewModel.selectedNetworkFeatures?.toArray().map(((e,t)=>R("calcite-list-item",{description:this._getNetworkFeatureName(e),key:`network-feature-${t}`,label:e.name??e.objectId?.toString()??this.messages.unnamed},R("calcite-action",{icon:"trash",onclick:this._handleDeleteNetworkFeatureClick.bind(this,e),scale:"s",slot:"actions-end",text:this.messages.common.delete})))))),R("div",{class:b.editFooter},this._renderEditFooterContent())))}_renderEditFooterContent(){return this.viewModel.lastError?this._renderErrorNotice():R("calcite-button",{appearance:"outline-fill",bind:this,onclick:this._handleEditingDoneClick,width:"full"},this.messages.common.done)}_renderErrorNotice(){return R("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0},R("calcite-label",{class:b.labelNoBottomMargin,slot:"message"},this._getErrorDescription()))}_renderFooter(){if(!this.viewModel.layer)return R("div",{class:b.primaryFooter,key:"footer-missing-layer"},R("calcite-notice",{icon:"information",open:!0},R("calcite-label",{class:b.labelNoBottomMargin,slot:"message"},this.messages.missingLayer)));if("unauthenticated"===this.viewModel.state)return R("div",{class:b.primaryFooterCentered,key:"footer-sign-in"},R("calcite-label",null,this.messages.signInRequired),R("calcite-button",{bind:this,onclick:this._handleSignInClick},this.messages.common.auth.signIn));if("routing"===this.viewModel.state)return R("div",{class:this.classes(b.primaryFooter,b.primaryFooterLoader),key:"footer-routing"},R("calcite-loader",{label:this.messages.solve,scale:"s"}));if("error"===this.viewModel.state)return R("div",{class:b.primaryFooter,key:"footer-service-error"},this._renderErrorNotice());if(!this.viewModel.layer?.routeInfo)return R("div",{class:b.primaryFooter,key:"footer-unsolved-route"},R("calcite-notice",{icon:"information",open:!0},R("calcite-label",{class:b.labelNoBottomMargin,slot:"message"},this.messages.directionsPlaceholder)));const e=this._getRouteCostSummary();if(!e||!this.viewModel.layer?.directionPoints)return R("div",{class:b.primaryFooter,key:"footer-invalid-route"},R("calcite-notice",{icon:"exclamation-mark-triangle",kind:"danger",open:!0},R("calcite-label",{class:b.labelNoBottomMargin,slot:"message"},this.messages.invalidRoute)));const{distance:t,duration:i}=e,{formattedEta:s}=this.viewModel;return R("div",{class:b.routeItem,key:"footer-directions-summary"},R("button",{"aria-busy":"false","aria-label":this.messages.viewDrivingDirections,"aria-live":"polite",bind:this,class:b.routeItemButton,onclick:this._handleViewDrivingDirectionsClick,type:"button"},R("div",{class:b.routeItemButtonContent},R("span",{class:b.routeItemLabel},`${i} (${t})`),R("span",{class:b.routeItemDescription},s)),R("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s"})),R("calcite-action-menu",{label:"test"},R("calcite-action",{icon:"ellipsis",key:"route-actions",slot:"trigger",text:"Route actions"}),this._renderRouteLayerActions()))}_renderInteractiveRouteActions(){return R("div",{class:b.actionContainer,key:b.actionContainer},R("calcite-button",{appearance:"outline",bind:this,class:b.addStopButton,disabled:this._getEffectiveStops().length>=this.maxStops,iconStart:"plus",kind:"neutral",label:this.messages.addStop,onclick:this._handleAddStopClick,width:"half"},this.messages.addStop),R("calcite-button",{appearance:"outline",bind:this,class:b.editRouteButton,disabled:"2d"!==this.viewModel.view?.type,iconStart:"pencil",kind:"neutral",label:this.messages.editRoute,onclick:this._handleEditRouteClick,width:"half"},this.messages.editRoute))}_renderLocateStopAction(e){if(null!=e.name||null!=e.geometry)return null;const t=this._getEffectiveStops().indexOf(e),i=!!this.view?.activeTool&&this.view.activeTool===this._searchTool&&this._searchTool.stop===e;return R("calcite-action",{active:i,icon:"crosshair",key:`stop-location-action-${t}`,onclick:this._handleLocateStopClick.bind(this,e),scale:"s",slot:"actions-end",text:this.messages.pickALocationOnTheMap,title:this.messages.pickALocationOnTheMap})}_renderOptimizeStopOrder(){const{routeParameters:e}=this.viewModel,{findBestSequence:t,preserveFirstStop:i,preserveLastStop:s}=e;return R("calcite-block-section",{bind:this,class:b.optimizeSection,text:this.messages.optimizeOrder,toggleDisplay:"switch",onCalciteBlockSectionToggle:this._handleOptimizeStopOrderToggle},t?[R("calcite-label",{class:b.optimizeSwitches,key:"preserve-first-stop",layout:"inline-space-between"},this.messages.preserveFirstStop,R("calcite-switch",{bind:this,checked:i,scale:"s",onCalciteSwitchChange:this._handlePreserveFirstStopChange})),R("calcite-label",{class:b.optimizeSwitches,key:"preserve-last-stop",layout:"inline-space-between"},this.messages.preserveLastStop,R("calcite-switch",{bind:this,checked:s,scale:"s",onCalciteSwitchChange:this._handlePreserveLastStopChange}))]:null)}_renderPrimaryFlowItem(){return R("calcite-flow-item",{key:"primary-flow-item",loading:"initializing"===this.viewModel.state,selected:"primary"===this._currentFlowItem},R("calcite-panel",{class:b.primaryFlowItem,disabled:!this.viewModel.layer||"unauthenticated"===this.viewModel.state||"error"===this.viewModel.state&&!this.viewModel.serviceDescription},this._renderStops(),this._renderInteractiveRouteActions(),this._renderSeparator(),this._renderRouteSolveOptions()),this._renderFooter())}_renderPrintDocument(){if(!this._printDocumentOpen)return null;const e=this._getRouteCostSummary();if(!this._sections||!e)return null;const{distance:t,duration:i}=e,{formattedEta:s}=this.viewModel,o=this._sections.at(0)?.stop.name??"",r=this._sections.at(-1)?.stop.name??"";return R("div",{afterCreate:this._handlePrintDocumentAfterCreate,bind:this,class:b.printDocument,onkeydown:this._handlePrintDocumentKeyDown,tabindex:0},R("div",{class:b.printBody},R("div",{class:b.printHeader},R("div",{class:b.printHeaderLabel},R("div",{class:b.headerStops},R("span",null,this.messages.from)," ",R("span",{class:b.directionsHeaderStopName},o),R("span",null,this.messages.to)," ",R("span",{class:b.directionsHeaderStopName},r))),R("div",{class:this.classes(b.printHeaderButtons,b.printHideOnPrint)},R("calcite-button",{class:b.printDocumentPrint,iconStart:"print",onclick:this._handlePrintDocumentPrintClick},this.messages.common.print),R("calcite-button",{appearance:"outline",bind:this,class:b.printDocumentClose,iconStart:"x-circle",onclick:this._handlePrintDocumentCloseClick},this.messages.common.close))),R("div",{class:b.directionsHeader},R("span",null,`${i} (${t})`),s?R("span",null,s):null),this._sections.map(((e,t)=>this._renderPrintSection(e,t)))))}_renderPrintManuever(e,t){const{directionPoint:i,directionLine:s}=e,{distance:o,duration:r}=s,n=C(this.messagesUnits,o??0,this.unit),a=D(r??0),l=n&&a?`${n} | ${a}`:`${n||a}`,c=L(i),d=I(i.directionPointType);return R("div",{class:this.classes(b.flexRow,b.printAvoidPageBreak),key:`direction-${t}`},R("calcite-icon",{icon:d}),R("div",{class:b.flexColumn},R("span",null,c),R("span",null,l)))}_renderPrintRouteAction(e){const t=!this.viewModel.layer?.routeInfo;return R("calcite-action",{bind:this,disabled:t,icon:"print",key:"print-route",onclick:this._handlePrintDocumentClick,...e,text:this.messages.common.print,textEnabled:!0})}_renderPrintSection({stop:e,directions:t},i){return R("div",{class:b.printSection,key:`section-${i}`},R("span",{class:b.directionsHeaderStopName},e.name??""),t.map(((e,t)=>this._renderPrintManuever(e,t))))}_renderRouteLayerActions(e){return[this._renderClearRouteAction(e),this._renderSaveLayerAction(e),this._renderSaveLayerAsAction(e),this._renderPrintRouteAction(e),this._renderViewItemDetailsAction(e)]}_renderRouteSolveOptions(){return R("div",{class:b.marginInlineMedium,key:"route-solve-options"},this._renderTravelModes(),this._renderDepartureTime(),this._renderDepartureTimeOptions(),this._renderOptimizeStopOrder())}_renderSaveContent(){switch(this._saveState){case"initialized":return this._renderSaveInitialized();case"connect-to-portal":return this._renderSaveProcessing(this.messages.identity.lblSigning);case"connect-to-portal-error":return this._renderSaveError(this.messages.errors.authenticating);case"fetch-portal-information":return this._renderSaveProcessing(this.messages.processing.fetching);case"fetch-portal-information-error":return this._renderSaveError(this.messages.errors.fetching);case"save-layer":return this._renderSaveLayerSettings();case"saving":return this._renderSaveProcessing(this.messages.processing.saving);case"saving-error":return this._renderSaveError(this.messages.errors.saving)}}_renderSaveError(e){return R("calcite-panel",{class:b.paddingMedium,key:"save-layer-error"},R("div",{class:b.saveError},R("calcite-icon",{class:b.saveErrorIcon,icon:"exclamation-mark-triangle",scale:"l",textLabel:this.messages.common.errorMessage}),R("calcite-label",{class:b.saveErrorLabel},e)),R("calcite-button",{appearance:"outline",bind:this,onclick:this._handleSaveErrorCloseClick,slot:"footer-actions",width:"full"},this.messages.common.close))}_renderSaveInitialized(){return R("calcite-panel",{class:b.paddingMedium,key:"save-layer-initialized"})}_renderSaveFlowItem(){return"save"!==this._currentFlowItem?null:R("calcite-flow-item",{bind:this,heading:this.messages.saveLayer,headingLevel:this.headingLevel,key:"save-layer-flow-item",selected:"save"===this._currentFlowItem,onCalciteFlowItemBack:this._handleSaveFlowItemBackClick},this._renderSaveContent())}_renderSaveLayerAction(e){if(!this.visibleElements.saveButton)return null;const t=this.viewModel.layer,i=t?.routeInfo,s=t?.portalItem?.itemControl;return R("calcite-action",{bind:this,disabled:!(!!i&&("admin"===s||"update"===s)),icon:"save",key:"save-route",onclick:this._handleSaveLayerClick,...e,text:this.messages.common.save,textEnabled:!0})}_renderSaveLayerAsAction(e){if(!this.visibleElements.saveAsButton)return null;const t=!this.viewModel.layer?.routeInfo;return R("calcite-action",{disabled:t,icon:"save-as",key:"save-as-route",onclick:()=>{this._handleSaveLayerAs()},...e,text:this.messages.common.saveAs,textEnabled:!0})}_renderSaveLayerSettings(){if(null==this.layer||null==this._portalFolders||null==this._portalUserName)return this._renderSaveInitialized();const{stops:e}=this.layer,t=`${e.at(0).name} - ${e.at(-1).name}`,i=[R("calcite-combobox-item",{heading:`${this._portalUserName} (${this.messages.common.home})`,key:b.folderHome,selected:!0,value:b.folderHome}),...this._portalFolders.map((e=>R("calcite-combobox-item",{heading:e.title??"",key:`${b.folder}-${e.id}`,value:e.id})))];return R("calcite-panel",{key:"save-layer-panel"},R("div",{class:b.paddingMedium},R("calcite-label",null,this.messages.layerName,R("calcite-input",{afterCreate:this._handleSaveLayerNameCreate,bind:this,label:this.messages.layerName,value:t})),R("calcite-label",null,this.messages.saveInFolder,R("calcite-combobox",{afterCreate:this._handleSaveLayerFolderCreate,bind:this,clearDisabled:!0,label:this.messages.saveInFolder,overlayPositioning:"fixed",selectionMode:"single"},i))),R("calcite-button",{bind:this,onclick:this._handleSaveLayerButtonClick,slot:"footer-actions",width:"full"},this.messages.common.save),R("calcite-button",{appearance:"outline",bind:this,onclick:this._handleSaveLayerCancelClick,slot:"footer-actions",width:"full"},this.messages.common.cancel))}_renderSaveProcessing(e){return R("calcite-panel",{class:b.marginInlineMedium,key:"save-layer-processing"},R("calcite-loader",{class:b.saveProcessLoader,label:e,text:e}))}_renderSeparator(){return R("div",{class:b.separator})}_renderStop(e){const t=this.acquireSearch(e);null!=e.name&&(t.searchTerm=e.name);const i=this._getEffectiveStops(),s=this._renderLocateStopAction(e),o=i.length>2&&this._renderDeleteStopAction(e);return R("calcite-list-item",{key:e,value:e},s,o,R("div",{class:b.stopItem,slot:"content"},t.render()))}_renderStops(){const e=this._getEffectiveStops();for(const t of this._stopsToSearches.keys())e.includes(t)||this._disposeSearch(t);return R("div",{class:b.stopContainer,key:b.stopContainer},R("calcite-list",{bind:this,class:b.stopList,dragEnabled:!0,label:this.messages.widgetLabel,scale:"s",onCalciteListOrderChange:this._handleStopListReorder},e.toArray().map((e=>this._renderStop(e)))),2===e.length&&R("calcite-action",{bind:this,icon:"arrow-up-down",onclick:this._handleReverseStopOrderClick,scale:"s",text:this.messages.reverseStops}))}_renderTravelMode(e){const{id:t,name:i}=e;return R("calcite-combobox-item",{heading:i,key:t,label:i,selected:this.viewModel.selectedTravelMode?.id===t,value:e})}_renderTravelModes(){return this.viewModel.travelModes.length?R("calcite-label",{key:"travel-modes"},this.messages.mode,R("calcite-combobox",{bind:this,clearDisabled:!0,label:this.messages.mode,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:this._handleTravelModeChange},this.viewModel.travelModes.map((e=>this._renderTravelMode(e))))):null}_renderViewItemDetailsAction(e){return this.visibleElements.layerDetails?R("calcite-action",{bind:this,disabled:!this.viewModel.layer?.portalItem,icon:"launch",key:"open-route-details-link",onclick:this._handleItemDetailsClick,...e,text:this.messages.viewLayerDetails,textEnabled:!0}):null}async _solveRoute(){this.viewModel.updateDepartureTime();if(!((this.viewModel.layer?.stops.filter((({geometry:e})=>!!e)).length??0)<2))try{await this.viewModel.getDirections()}catch{}}};e([m()],A.prototype,"_printDocumentOpen",void 0),e([m()],A.prototype,"_currentFlowItem",void 0),e([m()],A.prototype,"_saveState",void 0),e([m()],A.prototype,"_searchTool",void 0),e([m()],A.prototype,"apiKey",null),e([m(v)],A.prototype,"defaultUnit",void 0),e([m()],A.prototype,"goToOverride",null),e([m()],A.prototype,"headingLevel",void 0),e([m()],A.prototype,"icon",null),e([m()],A.prototype,"label",null),e([m({readOnly:!0})],A.prototype,"lastRoute",null),e([m()],A.prototype,"layer",null),e([m()],A.prototype,"maxStops",null),e([m(),E("esri/widgets/Directions/t9n/Directions")],A.prototype,"messages",void 0),e([m(),E("esri/core/t9n/Units")],A.prototype,"messagesUnits",void 0),e([m()],A.prototype,"searchProperties",void 0),e([m()],A.prototype,"unit",null),e([m()],A.prototype,"view",null),e([m({type:f})],A.prototype,"viewModel",void 0),e([m({type:k,nonNullable:!0})],A.prototype,"visibleElements",void 0),A=e([p("esri.widgets.Directions")],A);const O=A;export{O 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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import"../../intl.js";import{getContrast as i,multiplyOpacity as r,BrightnessThreshold as s}from"../../core/colorUtils.js";import{handlesGroup as o}from"../../core/handleUtils.js";import{destroyMaybe as n}from"../../core/maybe.js";import{watch as a,initial as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import"../../intl.js";import{getContrast as i,multiplyOpacity as r,BrightnessThreshold as s}from"../../core/colorUtils.js";import{handlesGroup as o}from"../../core/handleUtils.js";import{destroyMaybe as n}from"../../core/maybe.js";import{watch as a,initial as l}from"../../core/reactiveUtils.js";import{formatDecimal as p,formatImperialLength as m,formatMetricLength as c}from"../../core/unitFormatUtils.js";import{convertUnit as h}from"../../core/unitUtils.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as y}from"../../core/support/UpdatingHandles.js";import v from"../../geometry/Point.js";import g from"../../geometry/Polyline.js";import{e as _,l as f}from"../../chunks/geodeticDensifyOperator.js";import{e as w,l as L}from"../../chunks/geodeticLengthOperator.js";import{e as j}from"../../chunks/lengthOperator.js";import{isSupported as b,geodesicLengths as S,geodesicDensify as M}from"../../geometry/support/geodesicUtils.js";import x from"../../layers/GraphicsLayer.js";import C from"../../symbols/CIMSymbol.js";import A from"../../symbols/Font.js";import k from"../../symbols/SimpleMarkerSymbol.js";import G from"../../symbols/TextSymbol.js";import{ViewingMode as O}from"../../views/ViewingMode.js";import{SnappingVisualizer2D as D}from"../../views/2d/interactive/SnappingVisualizer2D.js";import H from"../../views/draw/Draw.js";import{createCoordinateHelper as P}from"../../views/interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as R,screenToMap as U,dragManipulatedObject as T}from"../../views/interactive/dragEventPipeline.js";import{GraphicManipulator as E}from"../../views/interactive/GraphicManipulator.js";import{InteractiveToolBase as I}from"../../views/interactive/InteractiveToolBase.js";import{EditGeometry as z}from"../../views/interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as V}from"../../views/interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as B}from"../../views/interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as F}from"../../views/interactive/snapping/SnappingDragPipelineStep.js";import{setupSnappingToggleHandles as W}from"../../views/interactive/snapping/snappingUtils.js";import{fetchMessageBundle as N}from"../../intl/messages.js";import{onLocaleChange as q}from"../../intl/locale.js";const J=1e5;let K=class extends I{constructor(e){super(e),this._measurementLayer=new x({internal:!0,listMode:"hide",visible:!1}),this._manipulatorLayer=new x({internal:!0,listMode:"hide",visible:!1}),this._snappingLayer=new x({internal:!0,listMode:"hide",visible:!1}),this._updatingHandles=new y,this._vertices=[],this._drawActive=!1,this.measurement=null,this.measurementLabel=null}initialize(){N("esri/core/t9n/Units").then((e=>{this.messages=e}));const e=this.view;this._draw=new H({view:e}),e.map.addMany([this._measurementLayer,this._manipulatorLayer,this._snappingLayer]),e.focus(),this.addHandles([q((async()=>{this.messages=await N("esri/core/t9n/Units")})),a((()=>[this.unit,this.messages]),(()=>{this._updatePolylines()}),l),a((()=>[this.view.effectiveTheme.accentColor,this.view.effectiveTheme.textColor]),(()=>{if(!this._vertices.length)return;const e=this._vertices.map((({coord:e})=>e));for(const{handle:t}of this._vertices)t.remove();this._vertices=[],this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._snappingLayer.removeAll(),this.manipulators.removeAll(),this._updateSketch(e)}))]),W(this)}destroy(){const{map:e}=this.view;this._draw.view=null,this._draw=n(this._draw),e.removeMany([this._measurementLayer,this._manipulatorLayer,this._snappingLayer]),this._measurementLayer.removeAll(),this._manipulatorLayer.removeAll(),this._snappingLayer.removeAll(),this._set("measurement",null),this._set("measurementLabel",null),this._measurementLayer=n(this._measurementLayer),this._manipulatorLayer=n(this._manipulatorLayer),this._snappingLayer=n(this._snappingLayer),this._updatingHandles=n(this._updatingHandles),this._resetVertices()}get cursor(){return this._drawActive?"crosshair":null}set editable(e){this._set("editable",e),e||this._draw.reset()}get snappingOptions(){return this.snappingManager.options}get updating(){return this._updatingHandles.updating||this.snappingManager.updating}onActivate(){this._drawActive||0!==this._vertices.length||this._startSketch()}onShow(){this._measurementLayer.visible=!0,this._manipulatorLayer.visible=!0,this._snappingLayer.visible=!0}onHide(){this._measurementLayer.visible=!1,this._manipulatorLayer.visible=!1,this._snappingLayer.visible=!1}_getSnappingContext(e){return new B({elevationInfo:{mode:"on-the-ground",offset:0},pointer:e,editGeometryOperations:new V(new z("point",P(!1,!1,this.view.spatialReference)),O.Local),visualizer:new D(this._snappingLayer)})}_resetVertices(){for(const{handle:e}of this._vertices)e.remove();this._vertices=[]}_startSketch(){this._drawActive=!0;const{snappingManager:e}=this,t=this._draw.create("polyline",{mode:"click",snappingManager:e});t.on(["vertex-add","vertex-update","vertex-remove","cursor-update","undo","redo"],(e=>this._updateSketch(e.vertices))),t.on("draw-complete",(()=>{this._stopSketch()}))}_stopSketch(){this.manipulators.forEach((({manipulator:e})=>{e.interactive=!0})),this._drawActive=!1,this.finishToolCreation()}_updateSketch(e){const{spatialReference:t}=this.view;for(;this._vertices.length>e.length;){const{handle:e,manipulator:t}=this._vertices.pop();e.remove(),this.manipulators.remove(t)}for(let l=this._vertices.length;l<e.length;l++){const[i,r]=e[l],s=new v({x:i,y:r,spatialReference:t}),n=Q(s,this.view,this._manipulatorLayer);this.manipulators.add(n);const a=V.fromGeometry(s,O.Local),p=[a.on("vertex-update",(e=>{const t=e.vertices.at(0);t&&(this._vertices[l].coord=[t.pos[0],t.pos[1]],this._updatePolylines())})),R(n,((e,t,i,r)=>{const s=this._getSnappingContext(r),{snappingManager:o}=this,n=this._updatingHandles,{snappingStep:l}=F({snappingContext:s,snappingManager:o,updatingHandles:n});t.next(U(this.view)).next((t=>{if("start"===t.action){const i=new v(t.mapStart);e.graphic.geometry=i,a.trySetGeometry(i)}return t})).next(...l).next(T({operations:a})).next((()=>{e.graphic.geometry=a.data.geometry}))}))];this._vertices.push({manipulator:n,coord:[i,r],handle:o(p)})}const i=this._vertices.length-1,r=this._vertices[i],[s,n]=e[i];r.coord[0]===s&&r.coord[1]===n||(r.coord=[s,n],r.manipulator.graphic.geometry=new v({x:s,y:n,spatialReference:t}));const a=this._drawActive?this._vertices[i].manipulator:null;this.manipulators.forEach((({manipulator:e})=>{e.interactive=null==a||e!==a})),this._updatePolylines()}_updatePolylines(){if(this._vertices.length<2)return void this._measurementLayer.removeAll();const e=X(this._vertices.map((({coord:e})=>e)),this.view.spatialReference);if(!e)return;const{measurement:o,drawing:n,original:a}=e;this._set("measurement",o);const l=$(this.messages,o,this.unit);let p,m;this._set("measurementLabel",l);const{graphics:c}=this._measurementLayer,h=2===c.length,{effectiveTheme:u}=this.view;h?(p=c.at(0),m=c.at(1)):(p=new t({symbol:new C({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[14,12],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],enable:!0,capStyle:"Butt",joinStyle:"Round",width:3.5,color:i(u.accentColor).toArray()},{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:5,color:u.accentColor.toArray()}]}}})}),m=new t({symbol:new G({color:u.textColor,haloColor:r(i(u.textColor,s.Low),.5),haloSize:2,font:new A({size:14,family:"sans-serif"})})}),c.removeAll(),c.addMany([p,m])),p.geometry=n,m.geometry=a.extent?.center,m.symbol.text=l}};function Q(e,i,s){const o=r(i.effectiveTheme.accentColor,.5),n={type:"simple-line",width:0},a=8,l=new k({style:"circle",color:o,size:a,outline:n}),p=new k({style:"circle",color:o,size:1.5*a,outline:n}),m=new t({geometry:e,symbol:l});return new E({view:i,layer:s,graphic:m,focusedSymbol:p})}function X(e,t){const i=new g({paths:[e],spatialReference:t});let r,s;return t.isGeographic?b(t)?(r=S([i],"meters")[0],s=M(i,J)):(r=w(i,{unit:"meters"}),s=_(i,J,{unit:"meters"})):t.isWebMercator?(r=w(i,{unit:"meters"}),s=_(i,J,{unit:"meters"})):(r=j(i,{unit:"meters"}),s=i),{measurement:{geometry:s,length:r},original:i,drawing:s}}function Y(e){return null!=e}async function Z(e){(e?.isGeographic&&!b(e)||e?.isWebMercator)&&await Promise.all([f(),L()])}function $(e,t,i){if(!t||!e)return"";switch(i){case"metric":return c(e,t.length,"meters");case"imperial":return m(e,t.length,"meters");default:return p(e,h(t.length,"meters",i),i)}}e([u()],K.prototype,"_drawActive",void 0),e([u({readOnly:!0})],K.prototype,"cursor",null),e([u({value:!0})],K.prototype,"editable",null),e([u({readOnly:!0})],K.prototype,"measurement",void 0),e([u({readOnly:!0})],K.prototype,"measurementLabel",void 0),e([u()],K.prototype,"messages",void 0),e([u({constructOnly:!0})],K.prototype,"snappingManager",void 0),e([u()],K.prototype,"unit",void 0),e([u()],K.prototype,"updating",null),e([u({constructOnly:!0})],K.prototype,"view",void 0),K=e([d("esri.widgets.DistanceMeasurement2D.DistanceMeasurement2DTool")],K);export{K as DistanceMeasurement2DTool,X as createDistanceMeasurementInfo2D,$ as createDistanceMeasurementLabel,Y as isSupported,Z as loadGeometryOperators};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{isSome as e}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import s from"../../core/Evented.js";import{makeHandle as o}from"../../core/handleUtils.js";import n from"../../core/Logger.js";import{destroyMaybe as l,abortMaybe as p,removeMaybe as d}from"../../core/maybe.js";import{throwIfAborted as c,createResolver as u}from"../../core/promiseUtils.js";import{watch as h,on as w,when as f,syncAndInitial as m,initial as y,sync as g,whenOnce as k}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as W}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as F}from"../../editing/templateUtils.js";import M from"../../layers/GraphicsLayer.js";import{isEditableLayer as E}from"../../layers/support/editableLayers.js";import{isFeatureLayer as I,isSubtypeGroupLayer as T,getOwningPortalUrl as V}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as b}from"../../portal/support/urlUtils.js";import A from"../../views/interactive/sketch/SketchOptions.js";import{SnappingManager as L}from"../../views/interactive/snapping/SnappingManager.js";import U from"../../views/interactive/snapping/SnappingOptions.js";import C from"../Attachments/AttachmentsViewModel.js";import O from"./CreateFeaturesWorkflow.js";import{UpdateFeaturesWorkflow as S}from"./UpdateFeaturesWorkflow.js";import j from"./UpdateWorkflow.js";import{getLayersFromWorkflow as P,isUpdateWorkflow as R,whenEditorLayerView as H}from"./workflowUtils.js";import G from"./support/EditorItem.js";import{makeTemplateGroupInfoForLayer as x}from"../FeatureTemplates/featureTemplatesUtils.js";import D from"../FeatureTemplates/FeatureTemplatesViewModel.js";import B from"../Sketch/SketchViewModel.js";import q from"../Spinner/SpinnerViewModel.js";import{goTo as N}from"../support/goToUtils.js";function Q(t,e){return t?.find((t=>t.layer===e))}let z=class extends s.EventedAccessor{constructor(t){super(t),this._templatesByLayer=new Map,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new M({listMode:"hide",internal:!0}),this._snappingManager=null,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new W,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new r,this.editorItems=new r,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new C({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new D({disabledItemFunction:({layer:t})=>this._itemIsSuspended(t)}),this.layerInfos=null,this.ownSketchViewModel=new B({layer:this._sketchGraphicsLayer}),this.sketchOptions=new A,this.snappingOptions=new U({attributeRulesEnabled:!0}),this.spinnerViewModel=new q,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.back=async()=>{this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>await(this.activeWorkflow?.save()),this.selectFeature=(t,e=!1)=>{const a=this.activeWorkflow;this._candidateCommitted||"update"!==a?.type||(a.data.rootFeature=t,e&&(a.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([h((()=>{const t=this.view,e=t?.map?.editableLayers.toArray(),a=t?.allLayerViews,r=a?.filter((t=>!!e?.includes(t.layer)));return[e,r,this.layerInfos]}),(()=>this._updateEditorItems()),m),h((()=>this.hideTemplatesForInactiveLayers),(()=>this.syncFeatureTemplates())),w((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),w((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),w((()=>this.activeWorkflow),"complete",(()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)})),f((()=>this.view?.map),(t=>t.add(this._sketchGraphicsLayer)),y),w((()=>this.editorItems),"change",(()=>this._afterEditorItemsChange())),h((()=>[this.canCreate,this.canUpdateVisible]),(()=>this._afterEditorItemsChange())),h((()=>this.page),((t,e)=>{const a=[...this.pageStack];if(-1===a.indexOf(t))a.push(t);else for(;a.length&&a.at(-1)!==t;)a.pop();this.pageStack=a}),m),f((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),w((()=>this.featureTemplatesViewModel),"select",(async({item:t,oldItem:e})=>{const{activeWorkflow:a}=this;if(a){if("update"===a.type&&"awaiting-feature-creation-info"===a.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(e,{emit:!1})}}if(!t)return;const r={layer:t.layer,template:t.template};if(t.supportsUpload)return this.featureTemplatesViewModel.select(e,{emit:!1}),this.startCreateFeaturesWorkflow(r);this.startCreateFeaturesWorkflowAtFeatureCreation(r)})),h((()=>[this.view,this.featureTemplatesViewModel]),(([t,e])=>{e.view=t}),m),w((()=>this.view),"key-down",(t=>{"Escape"===t.key&&this.activeWorkflow?.keyboardCancellationEnabled&&(t.stopPropagation(),this.back())})),w((()=>this.sketchViewModel),["create","delete","update"],(t=>{const{activeWorkflow:e}=this,a="update"===e?.type,r=P(e),i=a?e?.activeWorkflow?.parentLayer:void 0,s=`sketch-${t.type}`;this.emit(s,{type:s,detail:t,layer:r[0],layers:r,parentLayer:i})}),g),h((()=>this.view),(t=>{if(this._snappingManager=l(this._snappingManager),!t)return;const e=this.snappingOptions;this._snappingManager=new L({view:t,options:e}),this.ownSketchViewModel.snappingManager=this._snappingManager}),m),h((()=>this.snappingOptions),(t=>{this._snappingManager&&(this._snappingManager.options=t)}),m)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then((()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null})),this._updateItemsTask=p(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=d(this._sketchEventListenerHandle)}get _featureTemplatesLayersAndTables(){const t=new r;for(const e of this.editorItems){const a=this.hideTemplatesForInactiveLayers&&!e.visible;e.supportsCreateFeaturesWorkflow&&!a&&t.push(e.layer)}return t}get activeLeafWorkflow(){const t=this.activeWorkflow;return t&&R(t)?t.activeWorkflow??t:t}get canCreate(){return this.editorItems.some((t=>t.supportsCreateFeaturesWorkflow))}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some((t=>t.supportsUpdateWorkflow))}get canUpdateVisible(){return this.editorItems.some((t=>t.supportsUpdateWorkflow&&t.visible))}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter((t=>"scene"===t.type||!t.isTable))}get featureFormViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeFeatureFormViewModel:"create-features"===t?.type?t.featureFormViewModel:null}get formViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeFeatureFormViewModel:"create-features"===t?.type?t.featureFormViewModel:"update-features"===t?.type?t.formViewModel:null}get utilityNetworkAssociationAddAssociationViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(t){this.sketchOptions.labels=t}get sketchViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeSketchViewModel:"create-features"===t?.type?t.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return"disabled";const t=this.attachmentsViewModel.mode;if("add"===t)return"adding-attachment";if("edit"===t)return"editing-attachment";const{activeWorkflow:e}=this;return e?.stepId?"update"===e.type&&e.activeWorkflow?.stepId?e.activeWorkflow.stepId:e.stepId:"ready"}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(t){this.sketchOptions.tooltips=t}get valueOptions(){return this.sketchOptions.values}set valueOptions(t){this.sketchOptions.values=t}set view(t){this.ownSketchViewModel.view=t,this.spinnerViewModel.view=t,this._set("view",t)}get canZoomTo(){const t=this.sketchViewModel,e=t?.createGraphic?.geometry?.type;return!(!t?.updateGraphics?.length&&"multipoint"!==e)}get page(){const{activeWorkflow:t,state:e}=this;if("update"===t?.type&&null!=t?.activeWorkflow?.featureFormViewModel?.associatedLayer)return"viewing-associated-features";if("update"===t?.type&&null!=t?.activeWorkflow?.featureFormViewModel?.associationId)return"viewing-associated-layers";if("update"===t?.type&&"awaiting-feature-to-update"===t.stepId)return"ready";if("create-features"===t?.type&&0===t.numPendingFeatures){const e=t.data.upload;if(e)return"default"===e.state?"ready":"creating-features-upload-details"}return e??"disabled"}get featureFormDisabled(){const{activeWorkflow:t}=this;return"update"===t?.type&&!1===t.activeEditorItem?.capabilities.update.attributes}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:t}=this;return!!t&&"update"===t.type&&!!t.activeEditorItem?.capabilities.delete.enabled}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}getTemplatesForLayer(t){return this._templatesByLayer.get(t)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateFeaturesWorkflowAtFeatureCreation(t){return this.startCreateFeaturesWorkflow(t,"creating-features")}async startCreateFeaturesWorkflow(t,e="awaiting-feature-creation-info"){if(await k((()=>!this.updating)),!this.canCreate)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled.");const a=this._createUpdatingResolver();try{await this._cancelWorkflow();const a=this._createCreateFeaturesWorkflow(t,e);this._set("activeWorkflow",a),await a.start()}catch(r){this._logErrorAndCancelWorkflow(r)}finally{a.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(t){await k((()=>!this.updating));const e=this._createUpdatingResolver();try{const{initialFeature:e}=t,a=e.sourceLayer=e.layer,r=a?this.findEditorItemForLayer(a):void 0;if(!r?.supportsCreateFeaturesWorkflow)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled for this layer.");await this._cancelWorkflow();const s=this._createCreateFeaturesWorkflow({initialFeature:e,layer:r.layer,maxFeatures:1},"creating-features");this._set("activeWorkflow",s),await s.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async startUpdateFeaturesWorkflow(t){if(await k((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update features workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateFeaturesWorkflow(t);this._set("activeWorkflow",e),await e.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await k((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow();this._set("activeWorkflow",t),await t.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{t.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(t){if(await k((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow("awaiting-update-feature-candidate");e.data.candidates=t,this._set("activeWorkflow",e),await e.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async startUpdateWorkflowAtFeatureEdit(t){if(await k((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow("editing-existing-feature");e.data.rootFeature=t,this._set("activeWorkflow",e),await e.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async deleteFeatureFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteActiveFeature():this._logError("editing:unsupported-workflow","Deleting a feature requires an active update workflow.")}async deleteAssociationFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteActiveAssociation():this._logError("editing:unsupported-workflow","Deleting an association requires an active update workflow.")}async cancelWorkflow(t){return this._cancelWorkflow({warnIfNoWorkflow:!0,...t})}findEditorItemForLayer(t){return this.editorItems.find((e=>e.layer===t))}itemHasInvalidFormTemplate(t){return null!=t&&!0===this.findEditorItemForLayer(t.layer)?.hasInvalidFormTemplate}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(t){const a=this.sketchViewModel,r=t?t.geometry:a?.updateGraphics.length?a?.updateGraphics.toArray().map((t=>t.geometry)).filter(e):a?.createGraphic?.geometry;r&&this.view&&N(this.view,r)}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}restrictFeatureTemplatesViewModelToLayer(t){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([t]),o((()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}))}async _getEditorItemCandidates(t){const{view:e}=this;if(!e?.map)return[];const{map:a}=e,r=a.editableLayers.toArray(),i=a.allTables.toArray().filter((t=>I(t)||T(t)));return await Promise.allSettled([...r.flatMap((t=>this._getLayerLoadPromise(t))),...i.flatMap((t=>this._getLayerLoadPromise(t)))]),c(t),[...r.reverse(),...i.reverse()].filter((t=>E(t)&&("mesh"!==t.geometryType||"3d"===e.type))).flatMap((t=>"subtype-group"===t.type?t.sublayers.toArray():t))}_getLayerLoadPromise(t){return T(t)?t.loadAll():t.load()}_drainEditorItems(){this.editorItems.drain((t=>t.destroy()))}_updateEditorItems(){p(this._updateItemsTask);const{view:t}=this,e=a((async e=>{if(!t?.map||!t?.allLayerViews)return;const a=await this._getEditorItemCandidates(e);if(!a.length)return void this._drainEditorItems();const r=[],i=[],s=[],{layerInfos:o}=this;for(const l of a){const e=Q(o,l),a=await H(t,l).catch((()=>null));(e?r:a?i:s).push(new G({layer:l,layerInfo:e,layerView:a}))}o?.length&&r.sort(((t,e)=>o.findIndex((({layer:e})=>e===t.layer))-o.findIndex((({layer:t})=>t===e.layer))));const n=[...r,...i,...s];e.aborted||(this._drainEditorItems(),this.editorItems.addMany(n))}));this._updatingHandles.addPromise(e.promise),this._updateItemsTask=e}_updateTemplates(){p(this._updateTemplatesTask);const t=a((async t=>{const e=this._templatesByLayer,a=this._featureTemplatesLayersAndTables.filter((t=>!e.has(t)));if(a.length>0){const r=await F(a.toArray(),this.view,t);for(const{layer:t,templates:a}of r)e.set(t,a)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}));this._updatingHandles.addPromise(t.promise),this._updateTemplatesTask=t}_setFeatureTemplatesViewModelLayers(t){const e=this._templatesByLayer,a=[];for(const r of t){const t=e.get(r);t&&t.length>0&&a.push(x(r,t))}this.featureTemplatesViewModel.templateInfos=a}_afterEditorItemsChange(){const{activeWorkflow:t}=this;if(this.syncFeatureTemplates(),!t)return;const{stepId:e}=t;"create-features"!==t.type?"update"===t.type&&("awaiting-feature-to-update"===e&&!this.canUpdateVisible||"awaiting-update-feature-candidate"===e&&!t.hasUpdatableCandidates)&&this._cancelWorkflow():"awaiting-feature-creation-info"!==e||this.canCreate||this._cancelWorkflow()}async _cancelWorkflow(t){const e=this.activeWorkflow;if(!e)return void(t?.warnIfNoWorkflow&&this._logError("editing:no-active-workflow","There is no active workflow to cancel."));if(!t||!1!==t.force){this.emit("workflow-cancel"),this._set("activeWorkflow",null);try{await e.cancel(t)}finally{e.destroy()}}else try{await e.cancel(t),this._set("activeWorkflow",null),e.destroy()}catch(a){}}_createCreateFeaturesWorkflow(t,e){return O.create({viewModel:this,creationInfo:t,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,applyEditsCallback:(t,e,a)=>this._applyEdits(t,e,a),applyEditsFeatureServiceCallback:(t,e,a)=>this._applyEditsFeatureService(t,e,a),addAttachmentsCallback:(t,e)=>this._addAttachments(t,e)})}_createUpdateFeaturesWorkflow(t){const e=S.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,features:t,applyEdits:(t,e,a)=>this._applyEdits(t,e,a),applyEditsFeatureService:(t,e,a)=>this._applyEditsFeatureService(t,e,a)});return e.addHandles(w((()=>e),"commit",(()=>{e.destroy(),this.activeWorkflow===e&&this._set("activeWorkflow",null)}))),e}_createUpdateWorkflow(t){return j.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEditsCallback:(t,e,a)=>this._applyEdits(t,e,a),applyEditsFeatureServiceCallback:(t,e,a)=>this._applyEditsFeatureService(t,e,a),addAttachmentsCallback:(t,e)=>this._addAttachments(t,e)})}_addAttachments(t,e){const a=e.map((e=>this._addAttachment(t,e.feature,e.attachment)))??[];return Promise.all(a)}async _addAttachment(t,e,a){let r=null;if(!("addAttachment"in t)||null==t.capabilities?.attachment)throw new i("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(r=await(t.addAttachment?.(e,a).catch((t=>{throw t?.error||t})))??null,r))),r}async _applyEdits(t,e,a){let r=null;const i=t.url?await V(t.url):null,s={returnServiceEditsOption:(!i||!b(i))&&!RegExp("/hosted/","i").test(t.url)?"original-and-current-features":void 0,...a};return await this._queueOperation((async()=>{const{view:a}=this;if(!a)return null;const i=await H(a,t).catch((()=>null));return r=await t.applyEdits(e,s),i&&await k((()=>!i.updating)),r})),r}async _applyEditsFeatureService(t,e,a){let r=null;return await this._queueOperation((async()=>r=await t.applyEdits(e,a))),r}_queueOperation(t){this._activityQueue.push(t);const e=(t,e)=>{const a=e.indexOf(t);a>-1&&e.splice(a,1)};return t().then((t=>(Array.isArray(t)?t.forEach((t=>this._handleEditsResultError(t))):this._handleEditsResultError(t),t))).catch((a=>{this._logError("editing:operation-error","An error occurred.",{error:a});const r={error:a,retry:()=>(e(r,this.failures),this._queueOperation(t)),cancel:()=>{e(r,this.failures)}};this._set("failures",[...this.failures,r])})).then((()=>{e(t,this._activityQueue)}))}_handleEditsResultError(t){if(null!=t&&"error"in t&&null!=t.error)throw t.error;if(null!=t&&"addFeatureResults"in t){const{addFeatureResults:e,deleteFeatureResults:a,updateFeatureResults:r}=t,i=e.find((t=>!!t.error))||r.find((t=>!!t.error))||a.find((t=>!!t.error));if(i)throw i.error}}_createUpdatingResolver(){const t=u();return this._updatingHandles.addPromise(t.promise),t}_logErrorAndCancelWorkflow(t){const{name:e,message:a,details:r}=t;this._logError(e??"editing:workflow-start-failed",a??void 0,r??t),this._cancelWorkflow({force:!0})}_itemIsSuspended(t){const e=this.findEditorItemForLayer(t);return null!=e&&(!e.visible||e.disabled)}_logError(t,e,a){n.getLogger(this).error(new i(t,e,a))}};t([v()],z.prototype,"_featureTemplatesLayersAndTables",null),t([v()],z.prototype,"_snappingManager",void 0),t([v({readOnly:!0})],z.prototype,"activeWorkflow",void 0),t([v()],z.prototype,"activeLeafWorkflow",null),t([v({readOnly:!0})],z.prototype,"_activityQueue",void 0),t([v({readOnly:!0})],z.prototype,"canCreate",null),t([v()],z.prototype,"canCreateVisible",null),t([v({readOnly:!0})],z.prototype,"canUpdate",null),t([v()],z.prototype,"canUpdateVisible",null),t([v()],z.prototype,"featureTemplatesLayers",null),t([v()],z.prototype,"editorItems",void 0),t([v({readOnly:!0})],z.prototype,"failures",void 0),t([v()],z.prototype,"hideTemplatesForInactiveLayers",void 0),t([v({type:C})],z.prototype,"attachmentsViewModel",void 0),t([v()],z.prototype,"featureFormViewModel",null),t([v()],z.prototype,"formViewModel",null),t([v()],z.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),t([v({type:D})],z.prototype,"featureTemplatesViewModel",void 0),t([v()],z.prototype,"labelOptions",null),t([v()],z.prototype,"layerInfos",void 0),t([v()],z.prototype,"ownSketchViewModel",void 0),t([v()],z.prototype,"sketchOptions",void 0),t([v()],z.prototype,"sketchViewModel",null),t([v({type:U,nonNullable:!0})],z.prototype,"snappingOptions",void 0),t([v()],z.prototype,"spinnerViewModel",void 0),t([v()],z.prototype,"state",null),t([v({readOnly:!0})],z.prototype,"syncing",null),t([v()],z.prototype,"updating",null),t([v()],z.prototype,"tooltipOptions",null),t([v()],z.prototype,"valueOptions",null),t([v()],z.prototype,"view",null),t([v()],z.prototype,"canZoomTo",null),t([v()],z.prototype,"pageStack",void 0),t([v()],z.prototype,"showDiscardEditsPrompt",void 0),t([v()],z.prototype,"_candidateCommitted",void 0),t([v()],z.prototype,"page",null),t([v()],z.prototype,"featureFormDisabled",null),t([v()],z.prototype,"featureFormHasAssociation",null),t([v()],z.prototype,"canGoBack",null),t([v()],z.prototype,"shouldShowDeleteButton",null),t([v()],z.prototype,"hasPendingEdits",null),t([v()],z.prototype,"snappingManager",null),z=t([_("esri.widgets.Editor.EditorViewModel")],z);const Z=z;export{Z as default};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{isSome as e}from"../../core/arrayUtils.js";import{createTask as a}from"../../core/asyncUtils.js";import r from"../../core/Collection.js";import i from"../../core/Error.js";import s from"../../core/Evented.js";import{makeHandle as o}from"../../core/handleUtils.js";import n from"../../core/Logger.js";import{destroyMaybe as l,abortMaybe as p,removeMaybe as d}from"../../core/maybe.js";import{throwIfAborted as c,createResolver as u}from"../../core/promiseUtils.js";import{watch as h,on as w,when as f,syncAndInitial as m,initial as y,sync as g,whenOnce as k}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as _}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as W}from"../../core/support/UpdatingHandles.js";import{getTemplatesForLayers as F}from"../../editing/templateUtils.js";import M from"../../layers/GraphicsLayer.js";import{isEditableLayer as E}from"../../layers/support/editableLayers.js";import{isFeatureLayer as I,isSubtypeGroupLayer as T,getOwningPortalUrl as V}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as b}from"../../portal/support/urlUtils.js";import A from"../../views/interactive/sketch/SketchOptions.js";import{SnappingManager as L}from"../../views/interactive/snapping/SnappingManager.js";import U from"../../views/interactive/snapping/SnappingOptions.js";import C from"../Attachments/AttachmentsViewModel.js";import O from"./CreateFeaturesWorkflow.js";import S from"./UpdateFeaturesWorkflow.js";import j from"./UpdateWorkflow.js";import{getLayersFromWorkflow as P,isUpdateWorkflow as R,whenEditorLayerView as H}from"./workflowUtils.js";import G from"./support/EditorItem.js";import{makeTemplateGroupInfoForLayer as x}from"../FeatureTemplates/featureTemplatesUtils.js";import D from"../FeatureTemplates/FeatureTemplatesViewModel.js";import B from"../Sketch/SketchViewModel.js";import q from"../Spinner/SpinnerViewModel.js";import{goTo as N}from"../support/goToUtils.js";function Q(t,e){return t?.find((t=>t.layer===e))}let z=class extends s.EventedAccessor{constructor(t){super(t),this._templatesByLayer=new Map,this._sketchEventListenerHandle=null,this._sketchGraphicsLayer=new M({listMode:"hide",internal:!0}),this._snappingManager=null,this._updateItemsTask=null,this._updateTemplatesTask=null,this._updatingHandles=new W,this._featureTemplatesViewModelIsRestricted=!1,this.activeWorkflow=null,this._activityQueue=new r,this.editorItems=new r,this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new C({capabilities:{editing:!0}}),this.featureTemplatesViewModel=new D({disabledItemFunction:({layer:t})=>this._itemIsSuspended(t)}),this.layerInfos=null,this.ownSketchViewModel=new B({layer:this._sketchGraphicsLayer}),this.sketchOptions=new A,this.snappingOptions=new U({attributeRulesEnabled:!0}),this.spinnerViewModel=new q,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.back=async()=>{this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>await(this.activeWorkflow?.save()),this.selectFeature=(t,e=!1)=>{const a=this.activeWorkflow;this._candidateCommitted||"update"!==a?.type||(a.data.rootFeature=t,e&&(a.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([h((()=>{const t=this.view,e=t?.map?.editableLayers.toArray(),a=t?.allLayerViews,r=a?.filter((t=>!!e?.includes(t.layer)));return[e,r,this.layerInfos]}),(()=>this._updateEditorItems()),m),h((()=>this.hideTemplatesForInactiveLayers),(()=>this.syncFeatureTemplates())),w((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),w((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),w((()=>this.activeWorkflow),"complete",(()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)})),f((()=>this.view?.map),(t=>t.add(this._sketchGraphicsLayer)),y),w((()=>this.editorItems),"change",(()=>this._afterEditorItemsChange())),h((()=>[this.canCreate,this.canUpdateVisible]),(()=>this._afterEditorItemsChange())),h((()=>this.page),((t,e)=>{const a=[...this.pageStack];if(-1===a.indexOf(t))a.push(t);else for(;a.length&&a.at(-1)!==t;)a.pop();this.pageStack=a}),m),f((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),w((()=>this.featureTemplatesViewModel),"select",(async({item:t,oldItem:e})=>{const{activeWorkflow:a}=this;if(a){if("update"===a.type&&"awaiting-feature-creation-info"===a.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(e,{emit:!1})}}if(!t)return;const r={layer:t.layer,template:t.template};if(t.supportsUpload)return this.featureTemplatesViewModel.select(e,{emit:!1}),this.startCreateFeaturesWorkflow(r);this.startCreateFeaturesWorkflowAtFeatureCreation(r)})),h((()=>[this.view,this.featureTemplatesViewModel]),(([t,e])=>{e.view=t}),m),w((()=>this.view),"key-down",(t=>{"Escape"===t.key&&this.activeWorkflow?.keyboardCancellationEnabled&&(t.stopPropagation(),this.back())})),w((()=>this.sketchViewModel),["create","delete","update"],(t=>{const{activeWorkflow:e}=this,a="update"===e?.type,r=P(e),i=a?e?.activeWorkflow?.parentLayer:void 0,s=`sketch-${t.type}`;this.emit(s,{type:s,detail:t,layer:r[0],layers:r,parentLayer:i})}),g),h((()=>this.view),(t=>{if(this._snappingManager=l(this._snappingManager),!t)return;const e=this.snappingOptions;this._snappingManager=new L({view:t,options:e}),this.ownSketchViewModel.snappingManager=this._snappingManager}),m),h((()=>this.snappingOptions),(t=>{this._snappingManager&&(this._snappingManager.options=t)}),m)])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then((()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null})),this._updateItemsTask=p(this._updateItemsTask),this._updatingHandles.destroy(),this._sketchEventListenerHandle=d(this._sketchEventListenerHandle)}get _featureTemplatesLayersAndTables(){const t=new r;for(const e of this.editorItems){const a=this.hideTemplatesForInactiveLayers&&!e.visible;e.supportsCreateFeaturesWorkflow&&!a&&t.push(e.layer)}return t}get activeLeafWorkflow(){const t=this.activeWorkflow;return t&&R(t)?t.activeWorkflow??t:t}get canCreate(){return this.editorItems.some((t=>t.supportsCreateFeaturesWorkflow))}get canCreateVisible(){return!!this.featureTemplatesLayers.length}get canUpdate(){return this.editorItems.some((t=>t.supportsUpdateWorkflow))}get canUpdateVisible(){return this.editorItems.some((t=>t.supportsUpdateWorkflow&&t.visible))}get featureTemplatesLayers(){return this._featureTemplatesLayersAndTables.filter((t=>"scene"===t.type||!t.isTable))}get featureFormViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeFeatureFormViewModel:"create-features"===t?.type?t.featureFormViewModel:null}get formViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeFeatureFormViewModel:"create-features"===t?.type?t.featureFormViewModel:"update-features"===t?.type?t.formViewModel:null}get utilityNetworkAssociationAddAssociationViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeUtilityNetworkAssociationAddAssociationViewModel:null}get labelOptions(){return this.sketchOptions.labels}set labelOptions(t){this.sketchOptions.labels=t}get sketchViewModel(){const{activeWorkflow:t}=this;return"update"===t?.type?t.activeSketchViewModel:"create-features"===t?.type?t.sketchViewModel:this.ownSketchViewModel}get state(){if(!this.view?.ready)return"disabled";const t=this.attachmentsViewModel.mode;if("add"===t)return"adding-attachment";if("edit"===t)return"editing-attachment";const{activeWorkflow:e}=this;return e?.stepId?"update"===e.type&&e.activeWorkflow?.stepId?e.activeWorkflow.stepId:e.stepId:"ready"}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchOptions.tooltips}set tooltipOptions(t){this.sketchOptions.tooltips=t}get valueOptions(){return this.sketchOptions.values}set valueOptions(t){this.sketchOptions.values=t}set view(t){this.ownSketchViewModel.view=t,this.spinnerViewModel.view=t,this._set("view",t)}get canZoomTo(){const t=this.sketchViewModel,e=t?.createGraphic?.geometry?.type;return!(!t?.updateGraphics?.length&&"multipoint"!==e)}get page(){const{activeWorkflow:t,state:e}=this;if("update"===t?.type&&null!=t?.activeWorkflow?.featureFormViewModel?.associatedLayer)return"viewing-associated-features";if("update"===t?.type&&null!=t?.activeWorkflow?.featureFormViewModel?.associationId)return"viewing-associated-layers";if("update"===t?.type&&"awaiting-feature-to-update"===t.stepId)return"ready";if("create-features"===t?.type&&0===t.numPendingFeatures){const e=t.data.upload;if(e)return"default"===e.state?"ready":"creating-features-upload-details"}return e??"disabled"}get featureFormDisabled(){const{activeWorkflow:t}=this;return"update"===t?.type&&!1===t.activeEditorItem?.capabilities.update.attributes}get featureFormHasAssociation(){return!!this.featureFormViewModel?.activeAssociation}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:t}=this;return!!t&&"update"===t.type&&!!t.activeEditorItem?.capabilities.delete.enabled}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}get snappingManager(){return this._snappingManager}getTemplatesForLayer(t){return this._templatesByLayer.get(t)??[]}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateFeaturesWorkflowAtFeatureCreation(t){return this.startCreateFeaturesWorkflow(t,"creating-features")}async startCreateFeaturesWorkflow(t,e="awaiting-feature-creation-info"){if(await k((()=>!this.updating)),!this.canCreate)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled.");const a=this._createUpdatingResolver();try{await this._cancelWorkflow();const a=this._createCreateFeaturesWorkflow(t,e);this._set("activeWorkflow",a),await a.start()}catch(r){this._logErrorAndCancelWorkflow(r)}finally{a.resolve()}}async startCreateFeaturesWorkflowAtFeatureEdit(t){await k((()=>!this.updating));const e=this._createUpdatingResolver();try{const{initialFeature:e}=t,a=e.sourceLayer=e.layer,r=a?this.findEditorItemForLayer(a):void 0;if(!r?.supportsCreateFeaturesWorkflow)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled for this layer.");await this._cancelWorkflow();const s=this._createCreateFeaturesWorkflow({initialFeature:e,layer:r.layer,maxFeatures:1},"creating-features");this._set("activeWorkflow",s),await s.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async startUpdateFeaturesWorkflow(t){if(await k((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update features workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateFeaturesWorkflow(t);this._set("activeWorkflow",e),await e.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async startUpdateWorkflowAtFeatureSelection(){if(await k((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const t=this._createUpdatingResolver();try{await this._cancelWorkflow();const t=this._createUpdateWorkflow();this._set("activeWorkflow",t),await t.start()}catch(e){this._logErrorAndCancelWorkflow(e)}finally{t.resolve()}}async startUpdateWorkflowAtMultipleFeatureSelection(t){if(await k((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow("awaiting-update-feature-candidate");e.data.candidates=t,this._set("activeWorkflow",e),await e.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async startUpdateWorkflowAtFeatureEdit(t){if(await k((()=>!this.updating)),!this.canUpdate)return void this._logError("editing:unsupported-workflow","Update workflow is unsupported or disabled.");const e=this._createUpdatingResolver();try{await this._cancelWorkflow();const e=this._createUpdateWorkflow("editing-existing-feature");e.data.rootFeature=t,this._set("activeWorkflow",e),await e.start()}catch(a){this._logErrorAndCancelWorkflow(a)}finally{e.resolve()}}async deleteFeatureFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteActiveFeature():this._logError("editing:unsupported-workflow","Deleting a feature requires an active update workflow.")}async deleteAssociationFromWorkflow(){const{activeWorkflow:t}=this;t&&"update"===t.type?await t.deleteActiveAssociation():this._logError("editing:unsupported-workflow","Deleting an association requires an active update workflow.")}async cancelWorkflow(t){return this._cancelWorkflow({warnIfNoWorkflow:!0,...t})}findEditorItemForLayer(t){return this.editorItems.find((e=>e.layer===t))}itemHasInvalidFormTemplate(t){return null!=t&&!0===this.findEditorItemForLayer(t.layer)?.hasInvalidFormTemplate}syncFeatureTemplates(){this._featureTemplatesViewModelIsRestricted||this._updateTemplates()}zoomTo(t){const a=this.sketchViewModel,r=t?t.geometry:a?.updateGraphics.length?a?.updateGraphics.toArray().map((t=>t.geometry)).filter(e):a?.createGraphic?.geometry;r&&this.view&&N(this.view,r)}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}restrictFeatureTemplatesViewModelToLayer(t){return this._featureTemplatesViewModelIsRestricted=!0,this._setFeatureTemplatesViewModelLayers([t]),o((()=>{this._featureTemplatesViewModelIsRestricted=!1,this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}))}async _getEditorItemCandidates(t){const{view:e}=this;if(!e?.map)return[];const{map:a}=e,r=a.editableLayers.toArray(),i=a.allTables.toArray().filter((t=>I(t)||T(t)));return await Promise.allSettled([...r.flatMap((t=>this._getLayerLoadPromise(t))),...i.flatMap((t=>this._getLayerLoadPromise(t)))]),c(t),[...r.reverse(),...i.reverse()].filter((t=>E(t)&&("mesh"!==t.geometryType||"3d"===e.type))).flatMap((t=>"subtype-group"===t.type?t.sublayers.toArray():t))}_getLayerLoadPromise(t){return T(t)?t.loadAll():t.load()}_drainEditorItems(){this.editorItems.drain((t=>t.destroy()))}_updateEditorItems(){p(this._updateItemsTask);const{view:t}=this,e=a((async e=>{if(!t?.map||!t?.allLayerViews)return;const a=await this._getEditorItemCandidates(e);if(!a.length)return void this._drainEditorItems();const r=[],i=[],s=[],{layerInfos:o}=this;for(const l of a){const e=Q(o,l),a=await H(t,l).catch((()=>null));(e?r:a?i:s).push(new G({layer:l,layerInfo:e,layerView:a}))}o?.length&&r.sort(((t,e)=>o.findIndex((({layer:e})=>e===t.layer))-o.findIndex((({layer:t})=>t===e.layer))));const n=[...r,...i,...s];e.aborted||(this._drainEditorItems(),this.editorItems.addMany(n))}));this._updatingHandles.addPromise(e.promise),this._updateItemsTask=e}_updateTemplates(){p(this._updateTemplatesTask);const t=a((async t=>{const e=this._templatesByLayer,a=this._featureTemplatesLayersAndTables.filter((t=>!e.has(t)));if(a.length>0){const r=await F(a.toArray(),this.view,t);for(const{layer:t,templates:a}of r)e.set(t,a)}this._setFeatureTemplatesViewModelLayers(this.featureTemplatesLayers)}));this._updatingHandles.addPromise(t.promise),this._updateTemplatesTask=t}_setFeatureTemplatesViewModelLayers(t){const e=this._templatesByLayer,a=[];for(const r of t){const t=e.get(r);t&&t.length>0&&a.push(x(r,t))}this.featureTemplatesViewModel.templateInfos=a}_afterEditorItemsChange(){const{activeWorkflow:t}=this;if(this.syncFeatureTemplates(),!t)return;const{stepId:e}=t;"create-features"!==t.type?"update"===t.type&&("awaiting-feature-to-update"===e&&!this.canUpdateVisible||"awaiting-update-feature-candidate"===e&&!t.hasUpdatableCandidates)&&this._cancelWorkflow():"awaiting-feature-creation-info"!==e||this.canCreate||this._cancelWorkflow()}async _cancelWorkflow(t){const e=this.activeWorkflow;if(!e)return void(t?.warnIfNoWorkflow&&this._logError("editing:no-active-workflow","There is no active workflow to cancel."));if(!t||!1!==t.force){this.emit("workflow-cancel"),this._set("activeWorkflow",null);try{await e.cancel(t)}finally{e.destroy()}}else try{await e.cancel(t),this._set("activeWorkflow",null),e.destroy()}catch(a){}}_createCreateFeaturesWorkflow(t,e){return O.create({viewModel:this,creationInfo:t,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:e,applyEditsCallback:(t,e,a)=>this._applyEdits(t,e,a),applyEditsFeatureServiceCallback:(t,e,a)=>this._applyEditsFeatureService(t,e,a),addAttachmentsCallback:(t,e)=>this._addAttachments(t,e)})}_createUpdateFeaturesWorkflow(t){const e=S.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,features:t,applyEdits:(t,e,a)=>this._applyEdits(t,e,a),applyEditsFeatureService:(t,e,a)=>this._applyEditsFeatureService(t,e,a)});return e.addHandles(w((()=>e),"commit",(()=>{e.destroy(),this.activeWorkflow===e&&this._set("activeWorkflow",null)}))),e}_createUpdateWorkflow(t){return j.create({viewModel:this,sketchOptions:this.sketchOptions,snappingManager:this._snappingManager,startAt:t,applyEditsCallback:(t,e,a)=>this._applyEdits(t,e,a),applyEditsFeatureServiceCallback:(t,e,a)=>this._applyEditsFeatureService(t,e,a),addAttachmentsCallback:(t,e)=>this._addAttachments(t,e)})}_addAttachments(t,e){const a=e.map((e=>this._addAttachment(t,e.feature,e.attachment)))??[];return Promise.all(a)}async _addAttachment(t,e,a){let r=null;if(!("addAttachment"in t)||null==t.capabilities?.attachment)throw new i("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(r=await(t.addAttachment?.(e,a).catch((t=>{throw t?.error||t})))??null,r))),r}async _applyEdits(t,e,a){let r=null;const i=t.url?await V(t.url):null,s={returnServiceEditsOption:(!i||!b(i))&&!RegExp("/hosted/","i").test(t.url)?"original-and-current-features":void 0,...a};return await this._queueOperation((async()=>{const{view:a}=this;if(!a)return null;const i=await H(a,t).catch((()=>null));return r=await t.applyEdits(e,s),i&&await k((()=>!i.updating)),r})),r}async _applyEditsFeatureService(t,e,a){let r=null;return await this._queueOperation((async()=>r=await t.applyEdits(e,a))),r}_queueOperation(t){this._activityQueue.push(t);const e=(t,e)=>{const a=e.indexOf(t);a>-1&&e.splice(a,1)};return t().then((t=>(Array.isArray(t)?t.forEach((t=>this._handleEditsResultError(t))):this._handleEditsResultError(t),t))).catch((a=>{this._logError("editing:operation-error","An error occurred.",{error:a});const r={error:a,retry:()=>(e(r,this.failures),this._queueOperation(t)),cancel:()=>{e(r,this.failures)}};this._set("failures",[...this.failures,r])})).then((()=>{e(t,this._activityQueue)}))}_handleEditsResultError(t){if(null!=t&&"error"in t&&null!=t.error)throw t.error;if(null!=t&&"addFeatureResults"in t){const{addFeatureResults:e,deleteFeatureResults:a,updateFeatureResults:r}=t,i=e.find((t=>!!t.error))||r.find((t=>!!t.error))||a.find((t=>!!t.error));if(i)throw i.error}}_createUpdatingResolver(){const t=u();return this._updatingHandles.addPromise(t.promise),t}_logErrorAndCancelWorkflow(t){const{name:e,message:a,details:r}=t;this._logError(e??"editing:workflow-start-failed",a??void 0,r??t),this._cancelWorkflow({force:!0})}_itemIsSuspended(t){const e=this.findEditorItemForLayer(t);return null!=e&&(!e.visible||e.disabled)}_logError(t,e,a){n.getLogger(this).error(new i(t,e,a))}};t([v()],z.prototype,"_featureTemplatesLayersAndTables",null),t([v()],z.prototype,"_snappingManager",void 0),t([v({readOnly:!0})],z.prototype,"activeWorkflow",void 0),t([v()],z.prototype,"activeLeafWorkflow",null),t([v({readOnly:!0})],z.prototype,"_activityQueue",void 0),t([v({readOnly:!0})],z.prototype,"canCreate",null),t([v()],z.prototype,"canCreateVisible",null),t([v({readOnly:!0})],z.prototype,"canUpdate",null),t([v()],z.prototype,"canUpdateVisible",null),t([v()],z.prototype,"featureTemplatesLayers",null),t([v()],z.prototype,"editorItems",void 0),t([v({readOnly:!0})],z.prototype,"failures",void 0),t([v()],z.prototype,"hideTemplatesForInactiveLayers",void 0),t([v({type:C})],z.prototype,"attachmentsViewModel",void 0),t([v()],z.prototype,"featureFormViewModel",null),t([v()],z.prototype,"formViewModel",null),t([v()],z.prototype,"utilityNetworkAssociationAddAssociationViewModel",null),t([v({type:D})],z.prototype,"featureTemplatesViewModel",void 0),t([v()],z.prototype,"labelOptions",null),t([v()],z.prototype,"layerInfos",void 0),t([v()],z.prototype,"ownSketchViewModel",void 0),t([v()],z.prototype,"sketchOptions",void 0),t([v()],z.prototype,"sketchViewModel",null),t([v({type:U,nonNullable:!0})],z.prototype,"snappingOptions",void 0),t([v()],z.prototype,"spinnerViewModel",void 0),t([v()],z.prototype,"state",null),t([v({readOnly:!0})],z.prototype,"syncing",null),t([v()],z.prototype,"updating",null),t([v()],z.prototype,"tooltipOptions",null),t([v()],z.prototype,"valueOptions",null),t([v()],z.prototype,"view",null),t([v()],z.prototype,"canZoomTo",null),t([v()],z.prototype,"pageStack",void 0),t([v()],z.prototype,"showDiscardEditsPrompt",void 0),t([v()],z.prototype,"_candidateCommitted",void 0),t([v()],z.prototype,"page",null),t([v()],z.prototype,"featureFormDisabled",null),t([v()],z.prototype,"featureFormHasAssociation",null),t([v()],z.prototype,"canGoBack",null),t([v()],z.prototype,"shouldShowDeleteButton",null),t([v()],z.prototype,"hasPendingEdits",null),t([v()],z.prototype,"snappingManager",null),z=t([_("esri.widgets.Editor.EditorViewModel")],z);const Z=z;export{Z as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{unique as e,isSome as r}from"../../core/arrayUtils.js";import o from"../../core/Collection.js";import i from"../../core/Error.js";import a from"../../core/Logger.js";import{destroyMaybe as s}from"../../core/maybe.js";import{whenOnce as n}from"../../core/reactiveUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{isTable as u}from"../../layers/support/layerUtils.js";import{hasEffectiveFeatureExpressionInfo as p}from"../../support/elevationInfoUtils.js";import c from"../BatchAttributeForm/BatchAttributeFormViewModel.js";import f from"./UpdateFeaturesWorkflowData.js";import h from"./Workflow.js";import{whenEditorLayerView as m}from"./workflowUtils.js";import{SketchController as w}from"./support/SketchController.js";var y;const g=()=>a.getLogger("esri.widgets.Editor.UpdateFeaturesWorkflow");let F=y=class extends h{constructor(t){super(t),this.type="update-features",this._formViewModel=null,this._sketchController=null}async initialize(){this._initializeFormViewModel();try{await this._updatingHandles.addPromise((async()=>{const{fullFeatures:t}=await this.data.when();this._formViewModel.features=new o(t),await this._initializeVisuals(t)})())}catch(t){this.cancel({force:!0,error:new i("update-features-workflow:initialize","Failed to initialize the workflow data.",t)})}}destroy(){this._sketchController=s(this._sketchController),this._formViewModel.destroy()}get features(){return this.data.features}get formViewModel(){return this._formViewModel}get hasPendingEdits(){const{data:t}=this;return t.features.some((e=>!!t.getPendingEditsForFeature(e)?.modified))}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get selectedFeature(){return this.data.selectedFeature}get updating(){return this._updatingHandles.updating||this._formViewModel.updating||!!this._sketchController?.updating}static create(t){const{applyEdits:o,applyEditsFeatureService:i,...a}=t,s=e(t.features.map((t=>t.sourceLayer??t.layer))).map((e=>t.viewModel.editorItems.find((t=>t.layer===e)))).filter(r),n=new y({data:new f({...a,editorItems:s}),onCommit:v(t.applyEdits)});return n._set("steps",k()),n}enter(){throw new Error("Method not implemented.")}exit(t){throw new Error("Method not implemented.")}async reset(){}async start(){await super.start(),await n((()=>!this.updating))}_initializeFormViewModel(){const{data:t}=this,e=t.viewModel.view,r=new c({editType:"UPDATE",map:e?.map,spatialReference:e?.spatialReference,timeZone:t.timeZone});this._formViewModel=r,this.addHandles(r.on("value-change",(e=>{for(const r of e.features)t.getPendingEditsForFeature(r)?.setAttribute(e.fieldName,e.value);this._sketchController?.notifyAttributesChanged(e)})))}async _initializeHighlights(t,e,r){const o=await m(r,e);this.addHandles(o.highlight(t))}async _initializeSketchController(t,e,r){const o=new w({sourceLayer:e,view:r,features:t});this._sketchController=o,await n((()=>!o.updating));const{data:i}=this;await o.startUpdatingFeatures(t,(t=>{const e=[];for(const{feature:r,geometry:o}of t)i.getPendingEditsForFeature(r)?.updateGeometry(o),e.push(r);this._formViewModel.notifyGeometriesChanged(e)}),(()=>{g().warnOnce("editor:batch-update-visual-variables","UpdateFeaturesWorkflow does not currently support modifying visual variables through the scale and rotate tools.")}))}async _initializeVisuals(t){const{data:e}=this,{view:r}=e.viewModel;if(!r)return;const o=M(e);if(u(o))return;const i=e.getEditorItemForLayer(o);return!i?.capabilities.update.geometry||"3d"===r?.type&&p(o.elevationInfo)?this._initializeHighlights(t,o,r):this._initializeSketchController(t,o,r)}};t([l()],F.prototype,"features",null),t([l()],F.prototype,"formViewModel",null),t([l()],F.prototype,"hasPendingEdits",null),t([l()],F.prototype,"parent",null),t([l()],F.prototype,"parentLayer",null),t([l()],F.prototype,"selectedFeature",null),t([l()],F.prototype,"type",void 0),t([l()],F.prototype,"updating",null),t([l()],F.prototype,"_formViewModel",void 0),t([l()],F.prototype,"_sketchController",void 0),F=y=t([d("esri.widgets.Editor.UpdateFeaturesWorkflow")],F);const _=F;function k(){return[{id:"editing-features",async setUp(){},async tearDown(){}}]}function v(t){return async e=>{const r=M(e),{stagedForDelete:o}=e,i=[];for(const t of e.fullFeatures){const r=e.getPendingEditsForFeature(t);if(!r?.modified&&!o)continue;const a=t.clone();if(!r?.attributesModified||o){const e=t.sourceLayer;if(!e){g().warn("Feature has no sourceLayer. It will not be included in any applyEdits payload.");continue}const r=e.objectIdField;if(a.attributes={[r]:t.getAttribute(r)},"scene"===e.type&&null!=e.infoFor3D){const r=e.associatedLayer?.globalIdField;null!=r&&a.setAttribute(r,t.getAttribute(r))}}r?.geometryModified&&!o||(a.geometry=null),i.push(a)}if(0===i.length)return void g().warn("No features to update. Workflow will finish without applying any edits");const a=o?"deleteFeatures":"updateFeatures";await t(r,{[a]:i})}}function M(t){if(t.layers.length>1)throw new i("update-features-workflow:multiple-layers-not-supported","The UpdateFeaturesWorkflow does not support updating features from multiple layers.");return t.layers[0]}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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import{unique as e,isSome as r}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import{abortHandle as o}from"../../core/handleUtils.js";import i from"../../core/Promise.js";import{throwIfAborted as a,isAbortError as l}from"../../core/promiseUtils.js";import n from"../../core/ReactiveMap.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import d from"./Edits.js";import{groupFeaturesByLayer as f,fetchFullFeatures as c}from"./workflowUtils.js";let h=class extends i{constructor(t){super(t),this.editorItems=[],this.features=[],this.parent=null,this.selectedFeature=null,this.sketchOptions=null,this.snappingManager=null,this.stagedForDelete=!1,this.viewModel=null,this._editorItemsByLayer=new n,this._fullFeatures=new Map,this._pendingEdits=new n}initialize(){const t=new AbortController;this.addResolvingPromise(this._initializeFullFeatures(t.signal).then((e=>{a(t.signal),this._initializeEdits(e)})).catch((t=>{if(l(t))throw new s("update-features-workflow:full-features-aborted","Fetching of full features was aborted.");throw t}))),this.addHandles(o(t)),this._initializeEditorItemsByLayer()}get fullFeatures(){return Array.from(this._fullFeatures.values())}get layers(){return e(this.features.map((t=>t.sourceLayer)).filter(r))}set timeZone(t){this._set("timeZone",t),this._pendingEdits.forEach((e=>{e.timeZone=t}))}getEditorItemForLayer(t){return this._editorItemsByLayer.get(t)}getFeatureTitle(t){return this._pendingEdits.get(t)?.displayTitle}getPendingEditsForFeature(t){return this._pendingEdits.get(this._fullFeatures.get(t)??t)}isSubmittable(t){const e=this._pendingEdits.get(t);return!!e&&(e.submittable||e.isAssociation)}_initializeEditorItemsByLayer(){for(const t of this.editorItems)this._editorItemsByLayer.set(t.layer,t)}_initializeEdits(t){const{timeZone:e}=this;for(const r of t){const t=new d({feature:r,timeZone:e});t.trackChanges(),this._pendingEdits.set(r,t)}}async _initializeFullFeatures(t){const{spatialReference:e}=this.viewModel.view,r=this._fullFeatures,o=f(this.features),i=Array.from(o.entries()).map((async([o,i])=>{const a=await c(i,o,e,t);if(a.length!==i.length)throw new s("editor:update-features-workflow:fetch-full-features-incomplete","Failed to fetch full features for one or more of the provided features.");const l=o.objectIdField,n=(t,e)=>t.attributes[l]>e.attributes[l]?1:-1,u=i.sort(n),p=a.sort(n);for(let t=0;t<u.length;t++)r.set(u[t],p[t]);return a}));return(await Promise.all(i)).flat()}};t([u({constructOnly:!0})],h.prototype,"editorItems",void 0),t([u({constructOnly:!0})],h.prototype,"features",void 0),t([u()],h.prototype,"fullFeatures",null),t([u()],h.prototype,"layers",null),t([u()],h.prototype,"parent",void 0),t([u()],h.prototype,"selectedFeature",void 0),t([u({constructOnly:!0})],h.prototype,"sketchOptions",void 0),t([u()],h.prototype,"snappingManager",void 0),t([u()],h.prototype,"stagedForDelete",void 0),t([u()],h.prototype,"timeZone",null),t([u()],h.prototype,"viewModel",void 0),t([u()],h.prototype,"_fullFeatures",void 0),h=t([p("esri.widgets.Editor.UpdateFeaturesWorkflowData")],h);export{
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import{unique as e,isSome as r}from"../../core/arrayUtils.js";import s from"../../core/Error.js";import{abortHandle as o}from"../../core/handleUtils.js";import i from"../../core/Promise.js";import{throwIfAborted as a,isAbortError as l}from"../../core/promiseUtils.js";import n from"../../core/ReactiveMap.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import d from"./Edits.js";import{groupFeaturesByLayer as f,fetchFullFeatures as c}from"./workflowUtils.js";let h=class extends i{constructor(t){super(t),this.editorItems=[],this.features=[],this.parent=null,this.selectedFeature=null,this.sketchOptions=null,this.snappingManager=null,this.stagedForDelete=!1,this.viewModel=null,this._editorItemsByLayer=new n,this._fullFeatures=new Map,this._pendingEdits=new n}initialize(){const t=new AbortController;this.addResolvingPromise(this._initializeFullFeatures(t.signal).then((e=>{a(t.signal),this._initializeEdits(e)})).catch((t=>{if(l(t))throw new s("update-features-workflow:full-features-aborted","Fetching of full features was aborted.");throw t}))),this.addHandles(o(t)),this._initializeEditorItemsByLayer()}get fullFeatures(){return Array.from(this._fullFeatures.values())}get layers(){return e(this.features.map((t=>t.sourceLayer)).filter(r))}set timeZone(t){this._set("timeZone",t),this._pendingEdits.forEach((e=>{e.timeZone=t}))}getEditorItemForLayer(t){return this._editorItemsByLayer.get(t)}getFeatureTitle(t){return this._pendingEdits.get(t)?.displayTitle}getPendingEditsForFeature(t){return this._pendingEdits.get(this._fullFeatures.get(t)??t)}isSubmittable(t){const e=this._pendingEdits.get(t);return!!e&&(e.submittable||e.isAssociation)}_initializeEditorItemsByLayer(){for(const t of this.editorItems)this._editorItemsByLayer.set(t.layer,t)}_initializeEdits(t){const{timeZone:e}=this;for(const r of t){const t=new d({feature:r,timeZone:e});t.trackChanges(),this._pendingEdits.set(r,t)}}async _initializeFullFeatures(t){const{spatialReference:e}=this.viewModel.view,r=this._fullFeatures,o=f(this.features),i=Array.from(o.entries()).map((async([o,i])=>{const a=await c(i,o,e,t);if(a.length!==i.length)throw new s("editor:update-features-workflow:fetch-full-features-incomplete","Failed to fetch full features for one or more of the provided features.");const l=o.objectIdField,n=(t,e)=>t.attributes[l]>e.attributes[l]?1:-1,u=i.sort(n),p=a.sort(n);for(let t=0;t<u.length;t++)r.set(u[t],p[t]);return a}));return(await Promise.all(i)).flat()}};t([u({constructOnly:!0})],h.prototype,"editorItems",void 0),t([u({constructOnly:!0})],h.prototype,"features",void 0),t([u()],h.prototype,"fullFeatures",null),t([u()],h.prototype,"layers",null),t([u()],h.prototype,"parent",void 0),t([u()],h.prototype,"selectedFeature",void 0),t([u({constructOnly:!0})],h.prototype,"sketchOptions",void 0),t([u()],h.prototype,"snappingManager",void 0),t([u()],h.prototype,"stagedForDelete",void 0),t([u()],h.prototype,"timeZone",null),t([u()],h.prototype,"viewModel",void 0),t([u()],h.prototype,"_fullFeatures",void 0),h=t([p("esri.widgets.Editor.UpdateFeaturesWorkflowData")],h);const m=h;export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{floatEqualUlp as e,lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{distance as s,lerp as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{m as a}from"../../../chunks/vec32.js";import i from"../../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../../geometry/projection.js";import l from"../../../geometry/SpatialReference.js";import{geodesicLengths as f,isSupported as h,inverseGeodeticSolver as p,directGeodeticSolver as m}from"../../../geometry/support/geodesicUtils.js";import{getElevationOffset as d}from"../../../support/elevationInfoUtils.js";import{ProfileGenerationError as g,ProfileGenerationErrorCause as w}from"./ProfileGenerationError.js";async function
|
|
5
|
+
import{floatEqualUlp as e,lerp as t}from"../../../core/mathUtils.js";import{throwIfAborted as n}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as r}from"../../../core/unitUtils.js";import{distance as s,lerp as o}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{m as a}from"../../../chunks/vec32.js";import i from"../../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../../geometry/projection.js";import l from"../../../geometry/SpatialReference.js";import{geodesicLengths as f,isSupported as h,inverseGeodeticSolver as p,directGeodeticSolver as m}from"../../../geometry/support/geodesicUtils.js";import{getElevationOffset as d}from"../../../support/elevationInfoUtils.js";import{ProfileGenerationError as g,ProfileGenerationErrorCause as w}from"./ProfileGenerationError.js";async function R(e,t,s,o,a,i,h){let p,m,d;const R=e.spatialReference,v=R.isGeographic||R.isWebMercator;let P=0;if(!v){const{execute:t}=await import("../../../geometry/operators/lengthOperator.js");n(h),P=await t(e,{unit:"meters"}),n(h)}const Z=1/r(o);if(v){await c([{source:R,dest:o},{source:R,dest:l.WGS84}],h);const n=T(e);p=f([n],"meters")[0];const r=y(p,a);if(I(e,p,r)>i)throw new g(w.TooComplex);const v=j(n,t,s);({densifiedPath:m,distances:d}=U(v,r,Z)),m=u(m,o)}else{await c([{source:R,dest:o}],h),p=P;const r=y(p,a);if(I(e,p,r)>i)throw new g(w.TooComplex);const l=j(e,t,s);({densifiedPath:m,distances:d}=A(l,r,Z)),n(h),m=u(m,o)}return{densifiedPath:m,pathLength:p*Z,distances:d}}function y(e,t){const n=e/t.densificationMaxSamples;return Math.max(t.samplingDistance,n)}function j(e,t,n){if(null==t)return Z(e);const r=e.spatialReference,s=t.mode,o=d(t,r);let a=null;switch(n.type){case"2d":a=v(e,s,o);break;case"3d":a=P(e,s,o,n)}return null==a?Z(e):new i({hasZ:!0,hasM:!1,spatialReference:r,paths:x(e.paths,a)})}function v({hasZ:e},t,n){return"absolute-height"===t?e?([e,t,r])=>[e,t,r+n]:([e,t])=>[e,t,n]:null}function P({spatialReference:e,hasZ:t},n,r,{elevationProvider:s}){const o=(t,n,r,o)=>s?.getElevation(t,n,r,e,o)??0;switch(n){case"on-the-ground":return([e,t])=>[e,t,o(e,t,0,"ground")];case"absolute-height":return t?([e,t,n])=>[e,t,n+r]:([e,t])=>[e,t,r];case"relative-to-ground":return t?([e,t,n])=>[e,t,n+o(e,t,n,"ground")+r]:([e,t])=>[e,t,o(e,t,0,"ground")+r];case"relative-to-scene":return t?([e,t,n])=>[e,t,n+o(e,t,n,"scene")+r]:([e,t])=>[e,t,o(e,t,0,"scene")+r];default:return null}}function Z(e){return e.hasZ?new i({hasZ:!1,hasM:!1,spatialReference:e.spatialReference,paths:x(e.paths,(([e,t])=>[e,t]))}):e}function x(e,t){const n=e.length,r=new Array(n);for(let s=0;s<n;++s){const n=e[s],o=n.length,a=new Array(n.length);r[s]=a;for(let e=0;e<o;++e)a[e]=t(n[e])}return r}function M(e){return S(e)&&e.paths.length>0&&e.paths.every((e=>e.length>=2))}function S(e){return null!=e&&"polyline"===e.type}function b(t,n,s,o,a){const{spatialReference:c,hasZ:u}=t,l={from:null,to:null,distance:0,azimuth:0,reverseAzimuth:0,spatialReference:c,metersPerSR:r(c)},f=[],h=[];let p=0;for(let r=0;r<t.paths.length;++r){const i=t.paths[r],c=new Array,u=new Array;let m=0;for(let t=1;t<i.length;++t){const r=i[t-1],f=i[t],h=o(l,r,f);let d;for(d=m;d<h.distance&&!e(d,h.distance);d+=n)c.push(a(h,d)),u.push((p+d)*s);m=d-h.distance,p+=h.distance,c.push(f),u.push(p*s)}f[r]=c,h[r]=u}return{densifiedPath:new i({spatialReference:c,hasZ:u,paths:f}),distances:h}}function A(e,t,n){const{hasZ:r}=e;return b(e,t,n,G,r?E:C)}function U(e,t,n){const{hasZ:r}=e;return b(e,t,n,z,r?k:W)}function z(e,t,n){return e.distance=0,p(e,t,n,e.spatialReference),e.from=t,e.to=n,e}function G(e,t,n){return e.from=t,e.to=n,e.distance=s(n,t)*e.metersPerSR,e}function W({from:e,azimuth:t,spatialReference:n},r){return m([0,0],e,t,r,n)}function k({from:e,to:n,azimuth:r,distance:s,spatialReference:o},a){const i=a/s,c=[0,0,t(e[2],n[2],i)];return m(c,e,r,a,o),c}function C({from:e,to:t,distance:n},r){return o([0,0],e,t,r/n)}function E({from:e,to:t,distance:n},r){return a([0,0,0],e,t,r/n)}function T(e){return h(e.spatialReference)?e:u(e,l.WGS84)}function D(e){return e.paths.reduce(((e,t)=>e+t.length),0)}function I(e,t,n){return D(e)+Math.floor(t/n)+Math.max(0,e.paths.reduce((e=>1+e),0)-1)}export{D as countPoints,R as densifyPath,S as isPolyline,M as isValidInputPath,j as toAbsoluteHeightElevation};
|
package/widgets/LayerList.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.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import i from"../core/Identifiable.js";import o from"../core/ReactiveMap.js";import{on as s,watch as l,initial as r}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import{css as p}from"./LayerList/css.js";import c from"./LayerList/LayerListItem.js";import m from"./LayerList/LayerListViewModel.js";import h from"./LayerList/LayerListVisibleElements.js";import y from"./LayerList/ListItem.js";import{minDragEnabledItems as u,minFilterItems as g,getItem as _,getLayerType as L,removeDestroyedListItems as f,setFilterPredicate as v,sortLayersToIds as I,sortChildLayersToIds as b}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as w}from"./support/componentsUtils.js";import{globalCss as C}from"./support/globalCss.js";import{calciteListFilterProps as E}from"./support/listUtils.js";import{setFocus as F}from"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as O}from"./support/decorators/vmEvent.js";import{tsx as T}from"./support/jsxFactory.js";const P=t.ofType(y),A="nested";let j=class extends(i.IdentifiableMixin(d)){constructor(e,i){super(e,i),this._rootListEl=null,this._activeItem=null,this._tooltipReferenceMap=new o,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new o,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=u,this.minFilterItems=g,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new P,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new m,this.visibilityAppearance="default",this.visibleElements=new h,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=_(e);if(!l?.sortable)return!1;const r=_(t),a=L(t),n=_(i),d=L(i),p=!!a&&!!d&&a===d,c={selected:l,from:r,to:n},m=t.group,h=i.group,y=r?.layer?.type??"",u=n?.layer?.type??"",g=new Set(["map-image","catalog","knowledge-graph"]),f="sublayer";return m&&h&&"function"==typeof s?s.call(null,c):p&&!g.has(y)&&!g.has(u)&&l?.layer?.type!==f},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(p.item)));this._activeItem=_(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o))if(this._lastDragDetail=e,this._selectedDragItemLayerUid=s.value,o!==i)this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l});else{const e=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(o,e)}}}initialize(){this.addHandles([s((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),r),s((()=>this.viewModel.operationalItems),"change",(()=>f(this.selectedItems)),r),l((()=>[this.filterPredicate,this._rootListEl]),(()=>v(this._rootListEl,this.filterPredicate)))])}loadDependencies(){return w({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _totalItems(){return this.viewModel.operationalItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer?.type)))).length}get _visibleItems(){return this.operationalItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleItems.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get _dragEnabled(){return this._totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this._totalItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map(((t,i)=>this._renderLayerFlowItem(t,i===e.length-1)))}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,{_visibleItems:t}=this,i={[C.hidden]:"loading"===e,[C.disabled]:"disabled"===e};return T("div",{class:this.classes(p.base,C.widget,C.panel,i)},t?.length?[this._renderItemTooltips(),this._renderItems()]:this._renderNoItems())}async _createFlowList(e,t){const{_layerListMap:i}=this,o=i.get(e);if(o)return o;const s="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const o=new AbortController,{signal:s}=o;this._openedLayersController=o,e.forEach(((i,o)=>{t.includes(o)||(i.destroy(),e.delete(o))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,s))));if(s.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?T("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:t.get(e.layer?.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(){return this._visibleItems?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return T("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return T("div",{class:p.itemMessage,key:"esri-layer-list__no-items"},T("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:o,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,_onCatalogOpen:p,_onTablesOpen:c,layerTablesEnabled:m}=this;return new t({headingLevel:i,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,...o,catalogLayer:e,layerTablesEnabled:m,onCatalogOpen:p,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:o,dragEnabled:s}=this;return new t({headingLevel:i,selectionMode:o,dragEnabled:s,...this._getTableListParams(e)})}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:o}=this,s=e.title||this.messages.untitledLayer;return T("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),o.pop();const t=o.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map((({title:i,panel:o},s)=>{const l=()=>this._handlePanelFlowItemBack(o);return T("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:o.title,headingLevel:this.headingLevel,key:`flow-panel-${o.uid}`,selected:!t.length&&s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},o.render(),T("calcite-button",{appearance:"transparent",onclick:l,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,F(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,F(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,F(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:i,_openedPanelItems:o,_filterEnabled:s,_rootGroupUid:l,visibleElements:{closeButton:r,collapseButton:a,heading:n,flow:d},_dragEnabled:c,selectionMode:m,filterText:h,openedLayers:y,filterPlaceholder:u,messages:g}=this,_=[T("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:r,closed:!e,collapsed:t,collapsible:a,heading:n?g.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!y.length&&!o.length,onCalciteFlowItemClose:()=>this.visible=!1},T("calcite-list",{afterCreate:e=>{this._rootListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{this._rootListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":l,displayMode:A,dragEnabled:c,filterEnabled:s,filterPlaceholder:u,filterProps:E,filterText:s?h:"",group:l,key:"root-list",label:g.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:m,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},i?.toArray().map((e=>this._renderItem(e))),i?.length&&s?T("div",{class:p.filterNoResults,slot:"filter-no-results"},T("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null)),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?d?T("calcite-flow",{key:"root-flow"},_):_:null}_renderItem(e,t,i){return T(c,{activeItem:this._activeItem,canMove:this._canMove,css:p,displayMode:A,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=_(i),l=_(e),r=_(t);this.viewModel.moveListItem(s,r,l,o)}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_sortLayers(e,t){if(e)if(e===this._rootListEl)I(this.view?.map?.layers,t);else{const i=_(e);if(!i)return;b(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>_(e))).filter(Boolean);i.removeAll(),i.addMany(o)}};e([a()],j.prototype,"_rootListEl",void 0),e([a()],j.prototype,"_activeItem",void 0),e([a()],j.prototype,"_tooltipReferenceMap",void 0),e([a()],j.prototype,"_focusRootFlowItem",void 0),e([a()],j.prototype,"_focusPanelFlowItem",void 0),e([a()],j.prototype,"_focusLayerFlowItem",void 0),e([a()],j.prototype,"_layerListMap",void 0),e([a()],j.prototype,"_totalItems",null),e([a()],j.prototype,"_visibleItems",null),e([a()],j.prototype,"_openedPanelItems",null),e([a()],j.prototype,"_dragEnabled",null),e([a()],j.prototype,"_filterEnabled",null),e([a()],j.prototype,"_renderedOpenLayerFlowItems",null),e([a({readOnly:!0})],j.prototype,"catalogLayerList",void 0),e([a()],j.prototype,"catalogOptions",void 0),e([a()],j.prototype,"collapsed",void 0),e([a()],j.prototype,"dragEnabled",void 0),e([a()],j.prototype,"filterPlaceholder",void 0),e([a()],j.prototype,"filterPredicate",void 0),e([a()],j.prototype,"filterText",void 0),e([a()],j.prototype,"headingLevel",void 0),e([a()],j.prototype,"icon",null),e([a()],j.prototype,"knowledgeGraphOptions",void 0),e([a()],j.prototype,"label",null),e([a()],j.prototype,"layerTablesEnabled",void 0),e([a()],j.prototype,"listItemCanGiveFunction",void 0),e([a()],j.prototype,"listItemCanReceiveFunction",void 0),e([a()],j.prototype,"listItemCreatedFunction",null),e([a()],j.prototype,"mapImageOptions",void 0),e([a(),M("esri/widgets/LayerList/t9n/LayerList")],j.prototype,"messages",void 0),e([a(),M("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([a()],j.prototype,"minDragEnabledItems",void 0),e([a()],j.prototype,"minFilterItems",void 0),e([a({readOnly:!0})],j.prototype,"openedLayers",void 0),e([a({readOnly:!0})],j.prototype,"openedLayerLists",void 0),e([a()],j.prototype,"operationalItems",null),e([a()],j.prototype,"selectedItems",void 0),e([a()],j.prototype,"selectionMode",void 0),e([a({readOnly:!0})],j.prototype,"tableList",void 0),e([a()],j.prototype,"tileOptions",void 0),e([a()],j.prototype,"view",null),e([O("trigger-action"),a({type:m})],j.prototype,"viewModel",void 0),e([a()],j.prototype,"visibilityAppearance",void 0),e([a({type:h,nonNullable:!0})],j.prototype,"visibleElements",void 0),j=e([n("esri.widgets.LayerList")],j);const D=j;export{D as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../core/Collection.js";import i from"../core/Identifiable.js";import o from"../core/ReactiveMap.js";import{on as s,watch as l,initial as r}from"../core/reactiveUtils.js";import{property as a}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import"../core/RandomLCG.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import{css as p}from"./LayerList/css.js";import c from"./LayerList/LayerListItem.js";import m from"./LayerList/LayerListViewModel.js";import h from"./LayerList/LayerListVisibleElements.js";import y from"./LayerList/ListItem.js";import{minDragEnabledItems as u,minFilterItems as g,getItem as _,getLayerType as L,removeDestroyedListItems as f,setFilterPredicate as v,sortLayersToIds as I,sortChildLayersToIds as w}from"./LayerList/support/layerListUtils.js";import{loadCalciteComponents as b}from"./support/componentsUtils.js";import{globalCss as C}from"./support/globalCss.js";import{calciteListFilterProps as E}from"./support/listUtils.js";import{setFocus as F}from"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{vmEvent as O}from"./support/decorators/vmEvent.js";import{tsx as T}from"./support/jsxFactory.js";const P=t.ofType(y),A="nested";let j=class extends(i.IdentifiableMixin(d)){constructor(e,i){super(e,i),this._rootListEl=null,this._activeItem=null,this._tooltipReferenceMap=new o,this._focusRootFlowItem=!1,this._focusPanelFlowItem=!1,this._focusLayerFlowItem=null,this._layerListMap=new o,this._lastDragDetail=null,this._selectedDragItemLayerUid=null,this._rootGroupUid=`operational-${this.uid}`,this._openedLayersController=null,this.catalogLayerList=null,this.catalogOptions=null,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterPredicate=null,this.filterText="",this.headingLevel=2,this.knowledgeGraphOptions=null,this.layerTablesEnabled=new t(["knowledge-graph"]),this.listItemCanGiveFunction=null,this.listItemCanReceiveFunction=null,this.mapImageOptions=null,this.messages=null,this.messagesCommon=null,this.minDragEnabledItems=u,this.minFilterItems=g,this.openedLayers=new t,this.openedLayerLists=new t,this.selectedItems=new P,this.selectionMode="none",this.tableList=null,this.tileOptions=null,this.viewModel=new m,this.visibilityAppearance="default",this.visibleElements=new h,this._canMove=({dragEl:e,fromEl:t,toEl:i},o)=>{const s="pull"===o?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,l=_(e);if(!l?.sortable)return!1;const r=_(t),a=L(t),n=_(i),d=L(i),p=!!a&&!!d&&a===d,c={selected:l,from:r,to:n},m=t.group,h=i.group,y=r?.layer?.type??"",u=n?.layer?.type??"",g=new Set(["map-image","catalog","knowledge-graph"]),f="sublayer";return m&&h&&"function"==typeof s?s.call(null,c):p&&!g.has(y)&&!g.has(u)&&l?.layer?.type!==f},this._onCatalogOpen=e=>{this.openedLayers.push(e.layer?.parent),this._focusLayerFlowItem=e.layer?.uid},this._onTablesOpen=e=>{this.openedLayers.push(e.layer),this._focusLayerFlowItem=e.layer?.uid},this._onPanelOpen=()=>{this._focusPanelFlowItem=!0},this._onTooltipReferenceChange=(e,t)=>{t?this._tooltipReferenceMap.set(e,t):this._tooltipReferenceMap.delete(e)},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this._clearActiveItem=()=>{this._activeItem=null},this._setActiveItem=e=>{if("default"!==this.visibilityAppearance)return;const t=Array.from(e.composedPath()).find((e=>e.classList?.contains(p.item)));this._activeItem=_(t)},this._onCalciteListOrderChange=e=>{const{_lastDragDetail:t}=this,{toEl:i,fromEl:o,dragEl:s,newIndex:l}=e;if(o&&i&&!(t?.newIndex===l&&t?.dragEl===s&&t?.toEl===i&&t?.fromEl===o))if(this._lastDragDetail=e,this._selectedDragItemLayerUid=s.value,o!==i)this._moveLayerFromChildList({toEl:i,fromEl:o,dragEl:s,newIndex:l});else{const e=Array.from(o.children).filter((e=>e?.matches("calcite-list-item"))).map((e=>e.value));this._sortLayers(o,e)}}}initialize(){this.addHandles([s((()=>this.openedLayers),"change",(()=>this._handleOpenedLayersChange()),r),s((()=>this.viewModel.operationalItems),"change",(()=>f(this.selectedItems)),r),l((()=>[this.filterPredicate,this._rootListEl]),(()=>v(this._rootListEl,this.filterPredicate)))])}loadDependencies(){return b({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")})}destroy(){this._destroyOpenedLayerLists(),this._tooltipReferenceMap.clear()}get _totalItems(){return this.viewModel.operationalItems.flatten((e=>e.children.filter((e=>"catalog-dynamic-group"!==e.layer?.type)))).length}get _visibleItems(){return this.operationalItems?.filter((e=>!e.hidden&&(this.visibleElements.errors||!e.error)))}get _openedPanelItems(){return this._visibleItems.flatten((e=>e.children)).filter((({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled))}get _dragEnabled(){return this._totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this._totalItems>=this.minFilterItems&&this.visibleElements.filter}get _renderedOpenLayerFlowItems(){const{openedLayers:e}=this;return e.toArray().map(((t,i)=>this._renderLayerFlowItem(t,i===e.length-1)))}get icon(){return"layers"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get listItemCreatedFunction(){return this.viewModel.listItemCreatedFunction}set listItemCreatedFunction(e){this.viewModel.listItemCreatedFunction=e}get operationalItems(){return this.viewModel.operationalItems}set operationalItems(e){this.viewModel.operationalItems=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}render(){const e=this.viewModel?.state,t={[C.hidden]:"loading"===e,[C.disabled]:"disabled"===e};return T("div",{class:this.classes(p.base,C.widget,C.panel,t)},this._renderItemTooltips(),this._renderItems())}async _createFlowList(e,t){const{_layerListMap:i}=this,o=i.get(e);if(o)return o;const s="catalog"===e.type?await this._createCatalogLayerList(e):await this._createTableList(e);return t.aborted||i.set(e,s),s}async _handleOpenedLayersChange(){const{_layerListMap:e,openedLayers:t,openedLayerLists:i}=this;this._openedLayersController?.abort();const o=new AbortController,{signal:s}=o;this._openedLayersController=o,e.forEach(((i,o)=>{t.includes(o)||(i.destroy(),e.delete(o))}));const l=await Promise.all(t.map((e=>this._createFlowList(e,s))));if(s.aborted)return;i.removeAll(),i.addMany(l);const r=i.at(-1);r?"catalogLayer"in r?(this._set("catalogLayerList",r),this._set("tableList",null)):(this._set("catalogLayerList",null),this._set("tableList",r)):(this._set("catalogLayerList",null),this._set("tableList",null))}_destroyOpenedLayerLists(){this.openedLayerLists.destroyAll(),this.openedLayers.removeAll(),this._layerListMap.clear()}_renderItemTooltip(e){const{_tooltipReferenceMap:t,messages:i}=this;return e?T("calcite-tooltip",{key:`tooltip-${e.layer?.uid}`,overlayPositioning:"fixed",referenceElement:t.get(e.layer?.uid)},i.layerIncompatibleTooltip):null}_renderItemTooltipNodes(e){return e.incompatible?this._renderItemTooltip(e):e.children?.filter((e=>!e.hidden)).toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderItemTooltips(){return this._visibleItems?.toArray().map((e=>this._renderItemTooltipNodes(e)))}_renderNoItemsMessage(){return T("div",{slot:"message"},this.messages.noItemsToDisplay)}_renderNoItems(){return T("div",{class:p.itemMessage,key:"esri-layer-list__no-items"},T("calcite-notice",{icon:"information",kind:"info",open:!0,width:"full"},this._renderNoItemsMessage()))}async _createCatalogLayerList(e){const{default:t}=await import("./CatalogLayerList.js"),{headingLevel:i,catalogOptions:o,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,_onCatalogOpen:p,_onTablesOpen:c,layerTablesEnabled:m}=this;return new t({headingLevel:i,view:s,filterPlaceholder:l,listItemCreatedFunction:r,minFilterItems:a,selectionMode:n,visibilityAppearance:d,...o,catalogLayer:e,layerTablesEnabled:m,onCatalogOpen:p,onTablesOpen:c})}_getTableListParams(e){switch(e.type){case"knowledge-graph":return{...this.knowledgeGraphOptions,tables:e.tables};case"map-image":return{...this.mapImageOptions,tables:e.subtables};case"tile":return{...this.tileOptions,tables:e.subtables};default:return null}}async _createTableList(e){const{default:t}=await import("./TableList.js"),{headingLevel:i,selectionMode:o,dragEnabled:s}=this;return new t({headingLevel:i,selectionMode:o,dragEnabled:s,...this._getTableListParams(e)})}_renderLayerFlowItem(e,t){const{messages:i,openedLayers:o}=this,s=e.title||this.messages.untitledLayer;return T("calcite-flow-item",{afterCreate:this._focusLayerFlowItemNode,afterUpdate:this._focusLayerFlowItemNode,bind:this,"data-layer-uid":e.uid,description:s,heading:i["catalog"===e.type?"catalogLayers":"tables"],headingLevel:this.headingLevel,key:`flow-layer-list-${e.uid}`,selected:t,onCalciteFlowItemBack:e=>{e.preventDefault(),o.pop();const t=o.at(-1);t?this._focusLayerFlowItem=t.uid:this._focusRootFlowItem=!0}},this._layerListMap.get(e)?.render())}_renderPanelFlowItems(){const{_openedPanelItems:e,openedLayers:t}=this;return e.toArray().map((({title:i,panel:o},s)=>{const l=()=>this._handlePanelFlowItemBack(o);return T("calcite-flow-item",{afterCreate:this._focusPanelFlowItemNode,afterUpdate:this._focusPanelFlowItemNode,bind:this,description:i,heading:o.title,headingLevel:this.headingLevel,key:`flow-panel-${o.uid}`,selected:!t.length&&s===e.length-1,onCalciteFlowItemBack:e=>{e.preventDefault(),l()}},o.render(),T("calcite-button",{appearance:"transparent",onclick:l,slot:"footer-actions",width:"full"},this.messagesCommon.back))}))}_handlePanelFlowItemBack(e){e.open=!1,this._focusRootFlowItem=!0}_focusRootFlowItemNode(e){this._focusRootFlowItem&&(this._focusRootFlowItem=!1,F(e))}_focusLayerFlowItemNode(e){this._focusLayerFlowItem===e.dataset.layerUid&&(this._focusLayerFlowItem=null,F(e))}_focusPanelFlowItemNode(e){this._focusPanelFlowItem&&(this._focusPanelFlowItem=!1,F(e))}_renderItems(){const{visible:e,collapsed:t,_visibleItems:i,_openedPanelItems:o,_filterEnabled:s,_rootGroupUid:l,visibleElements:{closeButton:r,collapseButton:a,heading:n,flow:d},_dragEnabled:c,selectionMode:m,filterText:h,openedLayers:y,filterPlaceholder:u,messages:g}=this,_=[T("calcite-flow-item",{afterCreate:this._focusRootFlowItemNode,afterUpdate:this._focusRootFlowItemNode,bind:this,closable:r,closed:!e,collapsed:t,collapsible:a,heading:n?g.widgetLabel:void 0,headingLevel:this.headingLevel,key:"root-flow-item",selected:!y.length&&!o.length,onCalciteFlowItemClose:()=>this.visible=!1},i?.length?T("calcite-list",{afterCreate:e=>{this._rootListEl=e,e.addEventListener("focusin",this._setActiveItem),e.addEventListener("focusout",this._clearActiveItem)},afterRemoved:e=>{this._rootListEl=null,e.removeEventListener("focusin",this._setActiveItem),e.removeEventListener("focusout",this._clearActiveItem)},canPull:e=>this._canMove(e,"pull"),canPut:e=>this._canMove(e,"put"),"data-layer-type":l,displayMode:A,dragEnabled:c,filterEnabled:s,filterPlaceholder:u,filterProps:E,filterText:s?h:"",group:l,key:"root-list",label:g.widgetLabel,onmouseleave:this._clearActiveItem,onmouseover:this._setActiveItem,selectionAppearance:"border",selectionMode:m,onCalciteListChange:e=>this._handleCalciteListChange(e),onCalciteListDragEnd:e=>this._handleCalciteListDragEnd(e.detail),onCalciteListFilter:e=>this.filterText=e.currentTarget?.filterText??"",onCalciteListOrderChange:e=>this._onCalciteListOrderChange(e.detail)},i.toArray().map((e=>this._renderItem(e))),s?T("div",{class:p.filterNoResults,slot:"filter-no-results"},T("calcite-notice",{kind:"info",open:!0,width:"full"},this._renderNoItemsMessage())):null):this._renderNoItems()),this._renderPanelFlowItems(),this._renderedOpenLayerFlowItems];return e?d?T("calcite-flow",{key:"root-flow"},_):_:null}_renderItem(e,t,i){return T(c,{activeItem:this._activeItem,canMove:this._canMove,css:p,displayMode:A,dragEnabled:this.dragEnabled,item:e,key:`layerListItem-${e.layer?.uid}`,layerTablesEnabled:this.layerTablesEnabled,listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,messagesCommon:this.messagesCommon,parent:t,parentTitles:i,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.selectionMode,visibilityAppearance:this.visibilityAppearance,visibleElements:this.visibleElements,onAction:this._onTriggerAction,onCatalogOpen:this._onCatalogOpen,onPanelOpen:this._onPanelOpen,onSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,onTablesOpen:this._onTablesOpen,onTooltipReferenceChange:this._onTooltipReferenceChange})}_moveLayerFromChildList({toEl:e,fromEl:t,dragEl:i,newIndex:o}){const s=_(i),l=_(e),r=_(t);this.viewModel.moveListItem(s,r,l,o)}_handleCalciteListDragEnd(e){const{fromEl:t,dragEl:i,oldIndex:o}=e;t.insertBefore(i,t.children[o])}_sortLayers(e,t){if(e)if(e===this._rootListEl)I(this.view?.map?.layers,t);else{const i=_(e);if(!i)return;w(i,t)}}_handleCalciteListChange(e){const{selectionMode:t,selectedItems:i}=this;if("none"===t)return;const o=e.target.selectedItems.map((e=>_(e))).filter(Boolean);i.removeAll(),i.addMany(o)}};e([a()],j.prototype,"_rootListEl",void 0),e([a()],j.prototype,"_activeItem",void 0),e([a()],j.prototype,"_tooltipReferenceMap",void 0),e([a()],j.prototype,"_focusRootFlowItem",void 0),e([a()],j.prototype,"_focusPanelFlowItem",void 0),e([a()],j.prototype,"_focusLayerFlowItem",void 0),e([a()],j.prototype,"_layerListMap",void 0),e([a()],j.prototype,"_totalItems",null),e([a()],j.prototype,"_visibleItems",null),e([a()],j.prototype,"_openedPanelItems",null),e([a()],j.prototype,"_dragEnabled",null),e([a()],j.prototype,"_filterEnabled",null),e([a()],j.prototype,"_renderedOpenLayerFlowItems",null),e([a({readOnly:!0})],j.prototype,"catalogLayerList",void 0),e([a()],j.prototype,"catalogOptions",void 0),e([a()],j.prototype,"collapsed",void 0),e([a()],j.prototype,"dragEnabled",void 0),e([a()],j.prototype,"filterPlaceholder",void 0),e([a()],j.prototype,"filterPredicate",void 0),e([a()],j.prototype,"filterText",void 0),e([a()],j.prototype,"headingLevel",void 0),e([a()],j.prototype,"icon",null),e([a()],j.prototype,"knowledgeGraphOptions",void 0),e([a()],j.prototype,"label",null),e([a()],j.prototype,"layerTablesEnabled",void 0),e([a()],j.prototype,"listItemCanGiveFunction",void 0),e([a()],j.prototype,"listItemCanReceiveFunction",void 0),e([a()],j.prototype,"listItemCreatedFunction",null),e([a()],j.prototype,"mapImageOptions",void 0),e([a(),M("esri/widgets/LayerList/t9n/LayerList")],j.prototype,"messages",void 0),e([a(),M("esri/t9n/common")],j.prototype,"messagesCommon",void 0),e([a()],j.prototype,"minDragEnabledItems",void 0),e([a()],j.prototype,"minFilterItems",void 0),e([a({readOnly:!0})],j.prototype,"openedLayers",void 0),e([a({readOnly:!0})],j.prototype,"openedLayerLists",void 0),e([a()],j.prototype,"operationalItems",null),e([a()],j.prototype,"selectedItems",void 0),e([a()],j.prototype,"selectionMode",void 0),e([a({readOnly:!0})],j.prototype,"tableList",void 0),e([a()],j.prototype,"tileOptions",void 0),e([a()],j.prototype,"view",null),e([O("trigger-action"),a({type:m})],j.prototype,"viewModel",void 0),e([a()],j.prototype,"visibilityAppearance",void 0),e([a({type:h,nonNullable:!0})],j.prototype,"visibleElements",void 0),j=e([n("esri.widgets.LayerList")],j);const D=j;export{D as default};
|