@arcgis/core 4.24.0-next.20220521 → 4.24.0-next.20220525
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/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0ad179f4332d5242cc5f.js +1 -0
- package/assets/esri/core/workers/chunks/{d63f736b3560c577a8a4.js → 112b851bc61ae59fb558.js} +1 -1
- package/assets/esri/core/workers/chunks/{9d738aab0d907cd09a9d.js → 1f4ba2fd71425b875eb4.js} +1 -1
- package/assets/esri/core/workers/chunks/{8cd8dad8bcd5c0ef445e.js → 222d51ad2b897188363c.js} +1 -1
- package/assets/esri/core/workers/chunks/4e982d988c343d71c35e.js +1 -0
- package/assets/esri/core/workers/chunks/{ab2a0480dc2b608deda3.js → 51b0bcd367a563512cbb.js} +1 -1
- package/assets/esri/core/workers/chunks/{18b4f015e1d6be7a8965.js → 5242c9badca17ba2ab25.js} +1 -1
- package/assets/esri/core/workers/chunks/525b24097af208a100da.js +1 -0
- package/assets/esri/core/workers/chunks/533d190f63c31246f3fb.js +1 -0
- package/assets/esri/core/workers/chunks/58b39f18cd0c6579e2fd.js +1 -0
- package/assets/esri/core/workers/chunks/5bfd11944c4bd19f50fb.js +1 -0
- package/assets/esri/core/workers/chunks/660abe7152e55e2bf39c.js +1 -0
- package/assets/esri/core/workers/chunks/{7391422fc51acb96a25d.js → 7727b55b4198eb5d5037.js} +1 -1
- package/assets/esri/core/workers/chunks/{3c8c020d9e723888352b.js → 7f4c1c67551584bb9f0f.js} +1 -1
- package/assets/esri/core/workers/chunks/8bc3129cd2bd85dfd7e3.js +1 -0
- package/assets/esri/core/workers/chunks/{b597c04a4abb98e29d1c.js → 9391126baab105086d1d.js} +1 -1
- package/assets/esri/core/workers/chunks/9b4159f2e4150414b594.js +1 -0
- package/assets/esri/core/workers/chunks/a595e1026c3f7b905b00.js +1 -0
- package/assets/esri/core/workers/chunks/{b362d1ae9a87397ce2c5.js → aa40e324e59038c2f123.js} +1 -1
- package/assets/esri/core/workers/chunks/b86c18b188955aa7f48f.js +1 -0
- package/assets/esri/core/workers/chunks/be78dd8dbb8d8149d27a.js +1 -0
- package/assets/esri/core/workers/chunks/{7cf3cff7b28ff007dbad.js → d29751b88b6bd05e9c9b.js} +1 -1
- package/assets/esri/core/workers/chunks/d8a355386a75adb29980.js +1 -0
- package/assets/esri/core/workers/chunks/ddf3cbca19a02d085b1d.js +1 -0
- package/assets/esri/core/workers/chunks/e47d24c5b9ff34393dbf.js +1 -0
- package/assets/esri/core/workers/chunks/eb20148c756ff919bbbf.js +1 -0
- package/assets/esri/core/workers/chunks/{2f4a8eff11d263fa798a.js → f5d10ea7b8888f822b0c.js} +1 -1
- package/assets/esri/themes/base/_core.scss +0 -2
- package/assets/esri/themes/base/widgets/_Editor.scss +4 -3
- 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/views/interactive/tooltip/t9n/Tooltip.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ar.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_bg.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_bs.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ca.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_cs.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_da.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_de.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_el.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_en.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_es.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_et.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_fi.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_fr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_he.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_hr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_hu.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_id.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_it.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ja.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ko.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_lt.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_lv.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_nb.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_nl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_pl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_pt-BR.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_pt-PT.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ro.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_ru.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sk.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sl.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_sv.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_th.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_tr.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_uk.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_vi.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_zh-CN.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_zh-HK.json +1 -1
- package/assets/esri/views/interactive/tooltip/t9n/Tooltip_zh-TW.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ar.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_bg.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_bs.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ca.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_cs.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_da.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_de.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_el.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_es.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_et.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_fi.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_fr.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_he.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_hr.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_hu.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_id.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_it.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ja.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ko.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_lt.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_lv.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_nb.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_nl.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pl.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pt-BR.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_pt-PT.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ro.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_ru.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sk.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sl.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sr.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_sv.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_th.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_tr.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_uk.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_vi.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-CN.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-HK.json +1 -1
- package/assets/esri/widgets/BasemapLayerList/t9n/BasemapLayerList_zh-TW.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_ar.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_bg.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_bs.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_ca.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_cs.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_da.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_de.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_el.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_en.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_es.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_et.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_fi.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_fr.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_he.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_hr.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_hu.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_id.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_it.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_ja.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_ko.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_lt.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_lv.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_nb.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_nl.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_pl.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_pt-BR.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_pt-PT.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_ro.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_ru.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_sk.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_sl.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_sr.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_sv.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_th.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_tr.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_uk.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_vi.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_zh-CN.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_zh-HK.json +1 -1
- package/assets/esri/widgets/Daylight/t9n/Daylight_zh-TW.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nb.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-TW.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ar.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_bg.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_bs.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ca.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_cs.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_da.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_de.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_el.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_en.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_es.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_et.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_fi.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_fr.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_he.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_hr.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_hu.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_id.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_it.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ja.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ko.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_lt.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_lv.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_nb.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_nl.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_pl.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_pt-BR.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_pt-PT.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ro.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_ru.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_sk.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_sl.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_sr.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_sv.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_th.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_tr.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_uk.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_vi.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_zh-CN.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_zh-HK.json +1 -1
- package/assets/esri/widgets/Weather/t9n/Weather_zh-TW.json +1 -1
- package/chunks/Heatmap.glsl.js +7 -11
- package/chunks/HeatmapDensity.glsl.js +7 -20
- package/chunks/Terrain.glsl.js +38 -41
- package/chunks/geometryEngineBase.js +1 -1
- package/core/Identifiable.js +1 -1
- package/core/accessorSupport/originUtils.js +1 -1
- package/core/accessorSupport/watch.js +1 -1
- package/core/has.js +1 -1
- package/core/lang.js +1 -1
- package/core/maybe.js +1 -1
- package/core/scheduling.js +1 -1
- package/core/watchUtils.js +1 -1
- package/geometry/projection.js +1 -1
- package/geometry/support/aaBoundingRect.js +1 -1
- package/interfaces.d.ts +762 -234
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/TileLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/WMTSLayer.js +1 -1
- package/layers/WebTileLayer.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/controllers/StreamController.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/support/ImageElement.js +1 -1
- package/layers/support/LocalMediaElementSource.js +1 -1
- package/layers/support/VideoElement.d.ts +4 -0
- package/layers/support/VideoElement.js +5 -0
- package/layers/support/imageryRendererUtils.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/renderers/HeatmapRenderer.js +1 -1
- package/renderers/support/HeatmapColorStop.js +1 -1
- package/renderers/support/heatmapUtils.js +1 -1
- package/renderers/support/types.js +1 -1
- package/smartMapping/renderers/heatmap.js +1 -1
- package/smartMapping/statistics/heatmapStatistics.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/PaddedViewState.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushHeatmap.js +1 -1
- package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
- package/views/2d/engine/webgl/enums.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/engine/webgl/techniques/heatmap/TechniqueHeatmap.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/views/2d/layers/features/support/pixelBuffering.js +1 -1
- package/views/2d/layers/features/support/rendererUtils.js +1 -1
- package/views/2d/layers/features/tileRenderers/HeatmapTileRenderer.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/HeatmapSource.js +1 -1
- package/views/2d/magnifier/MagnifierView2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
- package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/Dimensioning/DimensioningTool.js +1 -1
- package/views/3d/analysis/Dimensioning/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Dimensioning/LengthDimensionVisualization.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/environment/CloudyWeather.js +1 -1
- package/views/3d/environment/FoggyWeather.js +1 -1
- package/views/3d/environment/RainyWeather.js +1 -1
- package/views/3d/environment/SceneViewEnvironment.js +1 -1
- package/views/3d/environment/SceneViewEnvironmentManager.js +1 -1
- package/views/3d/environment/SnowyWeather.js +1 -1
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/environment/SunLighting.js +1 -1
- package/views/3d/environment/SunnyWeather.js +1 -1
- package/views/3d/environment/VirtualLighting.js +1 -1
- package/views/3d/environment/weather.js +1 -1
- package/views/3d/interactive/SegmentLabels3D.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/moveGraphic/GraphicMoveTool.js +1 -1
- package/views/3d/interactive/editingTools/originGraphicVisualElementUtils.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/GraphicReshapeTool.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/terrain/GeometryState.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/PatchGeometry.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchGeometryLUT.js +5 -0
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/PlanarPatch.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainConst.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +9 -9
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js +5 -0
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/analysis/analysisViewUtils.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/SegmentDrawAction.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/InteractiveToolBase.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/sketch/SketchLabelOptions.d.ts +4 -0
- package/views/interactive/sketch/SketchLabelOptions.js +5 -0
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +4 -0
- package/views/interactive/sketch/SketchTooltipOptions.js +5 -0
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/interactive/snapping/SceneSnappingManagerPool.js +5 -0
- package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/interactive/snapping/SnappingOperation.js +5 -0
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorkerHandle.js +1 -1
- package/views/interactive/support/viewUtils.js +1 -1
- package/views/interactive/tooltip/DrawTooltipInfos.js +1 -1
- package/views/interactive/tooltip/ExtentTooltipInfos.js +1 -1
- package/views/interactive/tooltip/ReshapeTooltipInfos.js +1 -1
- package/views/interactive/tooltip/SketchTooltipInfo.js +5 -0
- package/views/interactive/tooltip/Tooltip.js +1 -1
- package/views/interactive/tooltip/TransformTooltipInfos.js +1 -1
- package/views/interactive/tooltip/TranslateTooltipInfos.js +5 -0
- package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentMoveZ.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentReshapeMoveGraphic.js +5 -0
- package/views/interactive/tooltip/content/TooltipContentTransformAbsolute.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
- package/views/interactive/tooltip/content/tooltipContentFactory.js +1 -1
- package/views/overlay/TextOverlayItem.js +1 -1
- package/views/support/lengthMeasurementUtils.js +1 -1
- package/webscene/Environment.js +1 -1
- package/webscene/Slide.js +1 -1
- package/webscene/SunLighting.d.ts +4 -0
- package/webscene/SunLighting.js +5 -0
- package/webscene/VirtualLighting.d.ts +4 -0
- package/webscene/VirtualLighting.js +5 -0
- package/webscene/lightingTypes.js +5 -0
- package/webscene/support/SlideEnvironment.js +1 -1
- package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
- package/widgets/Daylight/DaylightViewModel.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTemplates/TemplateItem.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Measurement.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print/FileLink.js +1 -1
- package/widgets/ScaleBar.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/Swipe/SwipeViewModel.js +1 -1
- package/widgets/TableList/TableListViewModel.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
- package/widgets/support/AnalysisViewModel.js +1 -1
- package/widgets/support/AnchorElementViewModel.js +1 -1
- package/widgets/support/tests.js +5 -0
- package/assets/esri/core/workers/chunks/1d109cd048170e2d529a.js +0 -1
- package/assets/esri/core/workers/chunks/38a752f8bd456c8912a8.js +0 -1
- package/assets/esri/core/workers/chunks/4487fb2d274e49bdb2b0.js +0 -1
- package/assets/esri/core/workers/chunks/55b2b80b9e3684feaa8e.js +0 -1
- package/assets/esri/core/workers/chunks/605202e3c29250650492.js +0 -1
- package/assets/esri/core/workers/chunks/7ea06c86adfc827fda08.js +0 -1
- package/assets/esri/core/workers/chunks/816ae3f0513ecf856f8f.js +0 -1
- package/assets/esri/core/workers/chunks/8417b3d5821b306a0fc4.js +0 -1
- package/assets/esri/core/workers/chunks/8793070d288878d6f49b.js +0 -1
- package/assets/esri/core/workers/chunks/88912dbc2b60623bc6a3.js +0 -1
- package/assets/esri/core/workers/chunks/b97a34d2e7cceef1ac41.js +0 -1
- package/assets/esri/core/workers/chunks/cd04bae81e5fc27ec97b.js +0 -1
- package/assets/esri/core/workers/chunks/f6aaee4db0bd5096164c.js +0 -1
- package/assets/esri/core/workers/chunks/f9d83a48b69c5728feba.js +0 -1
- package/assets/esri/core/workers/chunks/fc9b5f40c5179a8c90de.js +0 -1
- package/assets/esri/core/workers/chunks/fe18d2d251a5ad80eb54.js +0 -1
- package/assets/esri/images/search/search-symbol-32.svg +0 -1
- package/assets/esri/themes/base/widgets/_NumericalFeedbackControls.scss +0 -23
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_ar.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_bg.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_bs.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_ca.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_cs.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_da.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_de.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_el.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_en.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_es.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_et.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_fi.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_fr.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_he.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_hr.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_hu.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_id.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_it.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_ja.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_ko.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_lt.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_lv.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_nb.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_nl.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_pl.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_pt-BR.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_pt-PT.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_ro.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_ru.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_sk.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_sl.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_sr.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_sv.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_th.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_tr.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_uk.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_vi.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_zh-CN.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_zh-HK.json +0 -1
- package/assets/esri/widgets/support/NumericalFeedbackControls/t9n/NumericalFeedbackControls_zh-TW.json +0 -1
- package/views/interactive/tooltip/NumericalFeedbackOptions.d.ts +0 -4
- package/views/interactive/tooltip/NumericalFeedbackOptions.js +0 -5
- package/views/interactive/tooltip/SegmentLabelOptions.js +0 -5
- package/views/interactive/tooltip/TooltipOptions.js +0 -5
- package/views/interactive/tooltip/content/TooltipContentExtentMoveXY.js +0 -5
- package/webscene/Lighting.d.ts +0 -4
- package/webscene/Lighting.js +0 -5
- package/widgets/support/NumericalFeedbackControls/NumericalFeedbackControlsViewModel.js +0 -5
- package/widgets/support/NumericalFeedbackControls/VisibleElements.js +0 -5
- package/widgets/support/NumericalFeedbackControls/css.js +0 -5
- package/widgets/support/NumericalFeedbackControls.js +0 -5
package/widgets/Editor.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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import s from"../core/Logger.js";import{isSome as i}from"../core/maybe.js";import{watch as a,on as r,when as o,initial as n}from"../core/reactiveUtils.js";import{aliasOf as l}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as h}from"../layers/support/fieldUtils.js";import m from"../views/interactive/snapping/SnappingOptions.js";import u from"./Attachments.js";import g from"./FeatureForm.js";import v from"./FeatureTemplates.js";import _ from"./Spinner.js";import w from"./Widget.js";import{workflowDeprecation as f}from"./Editor/deprecationUtils.js";import k from"./Editor/EditorViewModel.js";import{ItemList as y}from"./FeatureTemplates/ItemList.js";import{Heading as b,incrementHeadingLevel as C}from"./support/Heading.js";import M from"./support/SnappingControls.js";import{accessibleHandler as A}from"./support/decorators/accessibleHandler.js";import{messageBundle as F}from"./support/decorators/messageBundle.js";import{vmEvent as W}from"./support/decorators/vmEvent.js";import{tsx as T}from"./support/jsxFactory.js";import{classes as S}from"./support/widgetUtils.js";import{substitute as E}from"../intl/substitute.js";const B={base:"esri-editor esri-widget esri-widget--panel",scroller:"esri-editor__scroller",content:"esri-editor__content",contentGroup:"esri-editor__content-group",message:"esri-editor__message",controls:"esri-editor__controls",progressBar:"esri-editor__progress-bar",promptContainer:"esri-editor__prompt",promptHeader:"esri-editor__prompt__header",promptHeading:"esri-editor__prompt__header__heading",promptMessage:"esri-editor__prompt__message",promptDivider:"esri-editor__prompt__divider",promptActions:"esri-editor__prompt__actions",promptOption:"esri-editor__prompt__option",promptOptionPrimary:"esri-editor__prompt__option--primary",promptOptionNegative:"esri-editor__prompt__option--negative",promptOptionPositive:"esri-editor__prompt__option--positive",controlButton:"esri-editor__control-button",overlay:"esri-editor__overlay",warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit",button:"esri-button",buttonDisabled:"esri-button--disabled",buttonSecondary:"esri-button--secondary",buttonTertiary:"esri-button--tertiary",input:"esri-input",interactive:"esri-interactive",select:"esri-select",panelToolbar:"esri-editor__panel-toolbar",panelToolbarSnappingButton:"esri-editor__panel-toolbar__snapping-button",panelContent:"esri-editor__panel-content",panelContentSection:"esri-editor__panel-content--section",updateFeaturesActionButtons:"esri-editor__update-features-action-buttons",updateFeaturesActionButtonsButton:"esri-editor__update-features-action-buttons--button",featureTemplatesContainer:"esri-editor__feature-templates-container",snappingControlsPopover:"esri-editor__snapping-controls-popover",scrimOverlay:"esri-editor__scrim-overlay"},P={undoRedoButtons:!1};function L(e){e.focus()}const j="esri.widgets.Editor",U=s.getLogger(j);let V=class extends(t(w)){constructor(e,t){super(e,t),this._candidateCommitted=!1,this._featureForm=new g,this._stateStack=[],this._attachments=new u({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new v({enableListScroll:!1}),this._filterText="",this._prompt=null,this._spinner=new _,this._snappingPopover=null,this.activeWorkflow=null,this.allowedWorkflows=null,this.useDeprecatedCreateWorkflow=!1,this.headingLevel=4,this.iconClass=B.widgetIcon,this.label=void 0,this.layerInfos=null,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.snappingOptions=new m,this.supportingWidgetDefaults=null,this.view=null,this.viewModel=new k,this.visibleElements={...P},this._setCandidateFeature=(e,t=!1)=>{if(this._candidateCommitted)return;const s=this._assertActiveUpdateWorkflow();s.data.edits.feature=e,t&&(s.next(),this._candidateCommitted=!0)},this._handleSave=this._handleSave.bind(this),this._handleBack=this._handleBack.bind(this),this._handleDone=this._handleDone.bind(this),this._handleDelete=this._handleDelete.bind(this),this._handleAdd=this._handleAdd.bind(this),this._handleEdit=this._handleEdit.bind(this),this._handleAttachmentAdd=this._handleAttachmentAdd.bind(this),this._handleAttachmentUpdate=this._handleAttachmentUpdate.bind(this),this._handleAttachmentDelete=this._handleAttachmentDelete.bind(this),this.EditorPanel=this.EditorPanel.bind(this)}initialize(){const{view:e,snappingOptions:t}=this;this._snappingControls=new M({snappingOptions:t,view:e,visibleElements:{header:!1}}),this.own([a((()=>this.headingLevel),(e=>{this._featureForm.headingLevel=C(e),this._featureTemplates.headingLevel=C(e)}),n),this.viewModel.featureTemplatesViewModel.on("select",(({item:e})=>this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(e):this.startCreateFeaturesWorkflowAtFeatureCreation(e))),a((()=>this.viewModel.state),((e,t)=>{const s=this._stateStack.indexOf(e);-1===s?this._stateStack.push(t):this._stateStack.splice(s)})),a((()=>this.viewModel),(e=>{this._featureForm.viewModel=e?e.featureFormViewModel:null,this._attachments.viewModel=e?e.attachmentsViewModel:null,this._featureTemplates.viewModel=e?e.featureTemplatesViewModel:null,this._spinner.viewModel=e?e.spinnerViewModel:null}),n),a((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t&&t.ui.remove(this._spinner,s),e&&e.ui.add(this._spinner,{key:s,position:"manual"})}),n),r((()=>this.viewModel?.sketchViewModel),"create",(()=>{this.scheduleRender()})),r((()=>this.viewModel?.activeWorkflow),"cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._prompt=null}},secondary:{label:s.form.no,action:()=>(e.deny(),this._prompt=null)}}},this.scheduleRender()})),a((()=>this.supportingWidgetDefaults),(e=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch))}),n),a((()=>this._attachments?.error),(e=>{if(!e)return;const{messages:t,messagesCommon:s}=this;this._prompt={title:t.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:s.form.ok,action:()=>{this._prompt=null}}}}})),a((()=>this.viewModel?.failures),(e=>{if(!e)return;const{messages:t}=this,[{error:s,retry:i,cancel:a}]=e;this._prompt={title:t.errorWarningTitle,message:E(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{i(),this._prompt=null}},secondary:{label:t.ignore,action:()=>(a(),this._prompt=null)}}}})),a((()=>this.viewModel?.state),(e=>{"awaiting-feature-to-update"===e&&(this._filterText=""),"awaiting-update-feature-candidate"===e&&(this._candidateCommitted=!1)})),a((()=>[this._attachments?.selectedFile,this._attachments?.submitting]),(()=>this.scheduleRender())),o((()=>!this.viewModel?.activeWorkflow),(()=>this._featureTemplates.filterText=""))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._snappingControls.destroy()}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-menu.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-scrim.js")])}castVisibleElements(e){return{...P,...e}}startCreateWorkflowAtFeatureTypeSelection(){return f(U,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return f(U,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return f(U,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{_attachments:e,_prompt:t,viewModel:s}=this;if(!s)return T("div",{class:B.base});const{state:a}=s,r=i(t)?T("calcite-scrim",null,this.renderPrompt(t)):null;return T("div",{class:B.base},s.syncing||e.submitting?this.renderProgressBar():null,T("calcite-flow",null,this._stateStack.map((e=>this.renderState(e))),this.renderState(a)),r)}renderState(e){switch(e){case"disabled":break;case"ready":return this.renderLanding(e);case"awaiting-feature-creation-info":return this.renderTemplates(e);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this.renderAttributeEditing(e);case"awaiting-feature-to-update":return this.renderFeatureUpdating(e);case"awaiting-update-feature-candidate":return this.renderFeatureList(e);case"awaiting-feature-to-create":return this.renderFeatureCreation(e);case"adding-attachment":return this.renderAttachmentAdding(e);case"editing-attachment":return this.renderAttachmentEditing(e)}return T("div",null)}isPanelActive(e){return this.viewModel.state===e}renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:i,messagesCommon:a,_handleBack:r,_snappingControls:o,viewModel:{sketchViewModel:n}}=this;return T(t,{active:this.isPanelActive(e),key:"templates-panel",handleBack:r,heading:i.selectTemplate,headingLevel:s,messages:i,messagesCommon:a,sketchViewModel:n,snappingControls:o},this._featureTemplates.render())}renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:i,messagesCommon:a,headingLevel:r,_handleBack:o,_snappingControls:n,viewModel:l}=this,{sketchViewModel:d}=l,c=l.featureFormViewModel;if("create-features"===t.type&&t.pendingFeatures.length<1)return this.renderFeatureCreation(e);const p="update"===t.type&&!t.data.edits.modified||l.syncing,h="update"===t.type?i.editFeature:i.createFeatures,m="update"===t.type?a.update:a.create,u="create-features"===t.type&&"create-new"===t.createFeatureState,g=[{label:"create-features"===t.type&&t.numPendingFeatures>1?E(i.createFeaturesTemplate,{numFeatures:t.numPendingFeatures}):m,type:"primary",disabled:p,clickHandler:this._handleSave}];let v=!1;return"update"===t.type&&(t.data.editableItem.hasAttachments&&(v=!0),t.data.editableItem.supports.includes("delete")&&g.push({label:a.delete,type:"tertiary",clickHandler:this._handleDelete})),T(s,{active:this.isPanelActive(e),key:"attribute-editing-panel",heading:h,headingLevel:r,handleBack:o,messages:i,messagesCommon:a,sketchViewModel:d,snappingControls:n},T("div",{class:B.panelContentSection},T("div",{class:B.contentGroup},c.inputFields.length>0?this._featureForm.render():this.renderMessage(E(i.clickToFinishTemplate,{button:m})),v?T("div",{key:"attachments"},T("div",null,i.attachments),this._attachments.render()):null),u?T("calcite-scrim",null):null),T("div",{class:this._prompt?"":B.scrimOverlay},this.renderControls(g)))}renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_handleBack:i,headingLevel:a,messages:r,messagesCommon:o,_snappingControls:n,viewModel:{sketchViewModel:l}}=this,d=[{label:t.submitting?o.cancel:o.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentAdd}];return T(s,{active:this.isPanelActive(e),key:"attachment-adding-panel",heading:r.addAttachment,headingLevel:a,handleBack:i,messages:r,messagesCommon:o,sketchViewModel:l,snappingControls:n},T("div",{class:this.classes(B.content,B.scroller)},t.render()),this.renderControls(d))}renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_handleBack:i,headingLevel:a,messages:r,messagesCommon:o,_snappingControls:n,viewModel:{sketchViewModel:l}}=this,d=[{label:o.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentUpdate},{label:o.delete,disabled:t.submitting,type:"tertiary",clickHandler:this._handleAttachmentDelete}];return T(s,{active:this.isPanelActive(e),key:"attachment-editing-panel",heading:r.editAttachment,headingLevel:a,handleBack:i,messages:r,messagesCommon:o,sketchViewModel:l,snappingControls:n},T("div",{class:this.classes(B.content,B.scroller)},t.render()),this.renderControls(d))}renderFeatureUpdating(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:r,_snappingControls:o,viewModel:{sketchViewModel:n}}=this;return T(t,{active:this.isPanelActive(e),key:"feature-updating-panel",heading:a.selectFeature,headingLevel:i,handleBack:s,messages:a,messagesCommon:r,sketchViewModel:n,snappingControls:o},T("div",{class:this.classes(B.content,B.scroller)},this.renderMessage(a.selectFeatureToEdit)))}renderMessage(e){return T("div",{class:B.message},e)}renderFeatureCreation(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:r,_snappingControls:o,viewModel:n}=this,{sketchViewModel:l}=n,d=n.sketchViewModel,c=this._assertActiveCreateWorkflow().data.creationInfo.layer,p=d.canUndo()&&d.createGraphic?d.createGraphic:null,h=this._getSketchingTip(c.geometryType,p);return T(t,{active:this.isPanelActive(e),key:"feature-creation-panel",heading:a.placeFeature,headingLevel:i,handleBack:s,messages:a,messagesCommon:r,sketchViewModel:l,snappingControls:o},T("div",{class:this.classes(B.content,B.scroller)},this.renderMessage(h)))}renderControls(e){return T("div",{class:B.controls,key:"controls"},e.map((({disabled:e=!1,label:t,type:s,clickHandler:i},a)=>this.renderButton({label:t,class:this.classes(B.controlButton,B.button,"secondary"===s?B.buttonSecondary:"tertiary"===s?B.buttonTertiary:null,e?B.buttonDisabled:null),disabled:e,clickHandler:i,key:a}))))}renderPrompt({title:e,message:t,context:s,actions:i}){const a=!!i.secondary,r=T("calcite-button",{appearance:"solid",color:"danger"===s?"red":"blue",width:a?"half":"full",onclick:i.primary.action,key:"prompt-primary-button",afterCreate:L},i.primary.label),o=a?T("calcite-button",{appearance:"clear",color:"danger"===s?"red":"blue",width:"half",onclick:i.secondary.action,key:"prompt-secondary-button"},i.secondary.label):null;return T("div",{class:`${B.promptContainer}--${s}`},T("div",{class:B.promptHeader},T("calcite-icon",{icon:"exclamation-mark-triangle"}),T(b,{class:B.promptHeading,level:this.headingLevel},e)),T("div",{class:B.promptMessage},t),T("div",{class:B.promptDivider}),T("div",{class:B.promptActions},o,r))}renderProgressBar(){return T("div",{class:this.classes(B.progressBar),key:"progress-bar"})}renderButton(e){return T("button",{class:e.class,disabled:e.disabled,key:e.key,onclick:e.clickHandler,type:"button"},e.label)}renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:i,messagesCommon:a,_snappingControls:r,viewModel:{sketchViewModel:o}}=this;return T(t,{active:this.isPanelActive(e),key:"landing-panel",heading:i.widgetLabel,headingLevel:s,showBackButton:!1,messages:i,messagesCommon:a,sketchViewModel:o,snappingControls:r},T("div",{key:"edit-actions",class:B.panelContentSection},this.renderUpdateActions()),T("div",{key:"create-actions",class:B.panelContentSection},this.renderCreateActions()))}renderUpdateActions(){const{messages:e,messagesCommon:t}=this;return T("div",null,T(b,{level:C(this.headingLevel)},e.editFeatures),T("div",{class:B.updateFeaturesActionButtons},T("calcite-action",{text:t.select,textEnabled:!0,icon:"cursor",alignment:"start",class:B.updateFeaturesActionButtonsButton,onclick:this._handleEdit})))}renderCreateActions(){const{messages:e}=this;return T("div",null,T(b,{level:C(this.headingLevel)},e.createFeatures),T("div",{key:"templates",class:B.featureTemplatesContainer},this._featureTemplates.render()))}renderFeatureList(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:r,messagesTemplates:o,_snappingControls:n,viewModel:{editableItems:l,sketchViewModel:d}}=this,c=this._assertActiveUpdateWorkflow().data.candidates,p=E(a.multipleFeaturesTemplate,{total:c.length}),h=new Map;let m=0;c.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,i=this._filterText.toLowerCase(),{title:a}=s.layer,r=this.viewModel.editableItems.find((e=>e.layer===s.layer));return r.supports.includes("update")&&(!i||t.toLowerCase().includes(i)||a.toLowerCase().includes(i))})).forEach((e=>{m++;const t=e.data.layer;h.has(t)?h.get(t).items.push(e):h.set(t,{id:`${t.id}`,label:t.title,items:[e]})}));const u=l.filter((({layer:e})=>h.has(e))).map((({layer:e})=>h.get(e))).toArray(),g=m>10||this._filterText.length>0;return T(t,{active:this.isPanelActive(e),key:"feature-list",heading:p,headingLevel:i,handleBack:s,messages:a,messagesCommon:r,sketchViewModel:d,snappingControls:n},y({id:this.id,enableListScroll:!1,filterEnabled:g,filterText:this._filterText,items:u,messages:{filterPlaceholder:o.filterPlaceholder,noItems:o.noItems,noMatches:o.noMatches},onItemMouseEnter:({data:e})=>this._setCandidateFeature(e),onItemMouseLeave:()=>this._setCandidateFeature(null),onItemSelect:({data:e})=>this._setCandidateFeature(e,!0),onFilterChange:e=>this._filterText=e}))}EditorPanel(e,...t){const{active:s,handleBack:i,heading:a,headingLevel:r,key:o,messages:n,messagesCommon:l,showBackButton:d,sketchViewModel:c,snappingControls:p}=e;return T("calcite-panel",{bind:this,key:o,heading:a,headingLevel:r,showBackButton:d??!0,beforeBack:i??null,onCalcitePanelScroll:this._onSnappingPopoverPanelScroll},T("div",{class:B.panelToolbar},T("calcite-popover",{autoClose:s,afterCreate:this._afterSnappingPopoverCreated,afterUpdate:this._afterSnappingPopoverUpdated,bind:this,label:n.snappingSettings,heading:n.snappingSettings,"reference-element":`${o}__snappingButton`,"overlay-positioning":"fixed",placement:"bottom"},T("div",{class:B.snappingControlsPopover},p.render())),T("calcite-button",{id:`${o}__snappingButton`,text:n.snapping,appearance:"transparent",color:"neutral",alignment:"icon-end-space-between","icon-start":"vertex-gps","icon-end":"caret-down",width:"full",class:B.panelToolbarSnappingButton},n.snapping),this.visibleElements.undoRedoButtons?[T("calcite-button",{key:"undo-button",text:l.undo,appearance:"transparent",color:"neutral",alignment:"center","icon-start":"undo",scale:"l",disabled:!c.canUndo(),onclick:c.undo.bind(c)}),T("calcite-button",{key:"redo-button",text:l.redo,appearance:"transparent",color:"neutral",alignment:"center","icon-start":"redo",scale:"l",disabled:!c.canRedo(),onclick:c.redo.bind(c)})]:null),T("div",{class:S(B.scroller,B.panelContent)},t))}_onSnappingPopoverPanelScroll(){this._snappingPopover?.open&&this._snappingPopover.toggle()}_afterSnappingPopoverCreated(e){this._snappingPopover=e}_afterSnappingPopoverUpdated(e){this._snappingPopover=e}_getSketchingTip(e,t){const{messages:s}=this;if("point"===e)return s.tips.clickToAddPoint;if("polygon"===e||"polyline"===e){if(!t)return s.tips.clickToStart;const i=t.geometry,a="polygon"===e?"rings":"paths",[r]=i[a];return"polygon"===e&&r<4?s.tips.clickToContinue:s.tips.clickToContinueThenDoubleClickToEnd}return s.tips.clickToAddFeature}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:i}=e,a=h(t);return a&&i[a]&&`${i[a]}`||E(this.messages.untitledFeatureTemplate,{id:i[s]})}_handleDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.viewModel.deleteFeatureFromWorkflow(),this._prompt=null}},secondary:{label:e.keepFeature,action:()=>this._prompt=null}}}}_handleSave(){const{featureFormViewModel:e}=this.viewModel;e.submit(),!e.submittable||e.validateContingencyConstraints(e.getValues(),{includeIncompleteViolations:!0}).length>0||this.viewModel.activeWorkflow.commit()}_handleAttachmentAdd(){const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.addAttachment().then((()=>t.previous()))}_handleAttachmentUpdate(){const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.updateAttachment().then((()=>t.previous()))}_handleAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.deleteAttachment(e.viewModel.activeAttachmentInfo).then((()=>{t.previous(),this._prompt=null}))}},secondary:{label:e.keepAttachment,action:()=>this._prompt=null}}}}_handleAdd(){this.viewModel.canCreate}_handleEdit(){this.viewModel.canUpdate&&this.viewModel.startUpdateWorkflowAtFeatureSelection()}_handleDone(){this.viewModel.cancelWorkflow({force:!0})}async _handleBack(){const{messages:e}=this,t=this.activeWorkflow,s=()=>{t.hasPreviousStep?t.previous({cancelCurrentStep:!0}):this.viewModel.cancelWorkflow({force:!0})};if("create"===t.type||"create-features"===t.type&&t.numPendingFeatures>0||"update"===t.type&&t.data.edits.modified){const{type:i}=t,a="create"===i?e.cancelAddWarningMessage:e.cancelEditWarningMessage,r="create"===i?e.cancelAddTitle:e.cancelEditTitle,o="create"===i?e.continueAdding:e.continueEditing,n="create"===i?e.discardFeature:e.discardEdits;throw this._prompt={title:r,message:a,context:"danger",actions:{primary:{label:n,action:()=>{s(),this._prompt=null}},secondary:{label:o,action:()=>this._prompt=null}}},this.scheduleRender(),new Error}s()}_assertActiveCreateWorkflow(){const{type:e}=this.viewModel.activeWorkflow;if("create"===e||"create-features"===e)return this.viewModel.activeWorkflow;throw Error("Expected activeWorkflow to be instance of CreateWorkflow or CreateFeaturesWorkflow")}_assertActiveUpdateWorkflow(){if("update"===this.viewModel.activeWorkflow.type)return this.viewModel.activeWorkflow;throw Error("Expected activeWorkflow to be an UpdateWorkflow")}};e([c()],V.prototype,"_attachments",void 0),e([l("viewModel.activeWorkflow")],V.prototype,"activeWorkflow",void 0),e([l("viewModel.allowedWorkflows")],V.prototype,"allowedWorkflows",void 0),e([c()],V.prototype,"useDeprecatedCreateWorkflow",void 0),e([c()],V.prototype,"headingLevel",void 0),e([c()],V.prototype,"iconClass",void 0),e([c({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],V.prototype,"label",void 0),e([l("viewModel.layerInfos")],V.prototype,"layerInfos",void 0),e([c(),F("esri/widgets/Editor/t9n/Editor")],V.prototype,"messages",void 0),e([c(),F("esri/t9n/common")],V.prototype,"messagesCommon",void 0),e([c(),F("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],V.prototype,"messagesTemplates",void 0),e([l("viewModel.snappingOptions")],V.prototype,"snappingOptions",void 0),e([c()],V.prototype,"supportingWidgetDefaults",void 0),e([l("viewModel.view")],V.prototype,"view",void 0),e([c(),W(["workflow-cancel","workflow-commit"])],V.prototype,"viewModel",void 0),e([c()],V.prototype,"visibleElements",void 0),e([d("visibleElements")],V.prototype,"castVisibleElements",null),e([A()],V.prototype,"_handleDelete",null),e([A()],V.prototype,"_handleAttachmentAdd",null),e([A()],V.prototype,"_handleAttachmentUpdate",null),e([A()],V.prototype,"_handleAttachmentDelete",null),e([A()],V.prototype,"_handleAdd",null),e([A()],V.prototype,"_handleEdit",null),e([A()],V.prototype,"_handleDone",null),V=e([p(j)],V);const x=V;export{x as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import s from"../core/Logger.js";import{isSome as i}from"../core/maybe.js";import{watch as a,on as o,when as r,initial as n}from"../core/reactiveUtils.js";import{aliasOf as l}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import{property as c}from"../core/accessorSupport/decorators/property.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{getDisplayFieldName as h}from"../layers/support/fieldUtils.js";import m from"../views/interactive/sketch/SketchLabelOptions.js";import u from"../views/interactive/sketch/SketchTooltipOptions.js";import g from"../views/interactive/snapping/SnappingOptions.js";import v from"./Attachments.js";import _ from"./FeatureForm.js";import w from"./FeatureTemplates.js";import f from"./Spinner.js";import k from"./Widget.js";import{workflowDeprecation as b}from"./Editor/deprecationUtils.js";import y from"./Editor/EditorViewModel.js";import{ItemList as C}from"./FeatureTemplates/ItemList.js";import{Heading as M,incrementHeadingLevel as A}from"./support/Heading.js";import F from"./support/SnappingControls.js";import{accessibleHandler as W}from"./support/decorators/accessibleHandler.js";import{messageBundle as T}from"./support/decorators/messageBundle.js";import{vmEvent as S}from"./support/decorators/vmEvent.js";import{tsx as E}from"./support/jsxFactory.js";import{classes as B}from"./support/widgetUtils.js";import{substitute as P}from"../intl/substitute.js";const j={base:"esri-editor esri-widget esri-widget--panel",scroller:"esri-editor__scroller",content:"esri-editor__content",contentGroup:"esri-editor__content-group",message:"esri-editor__message",controls:"esri-editor__controls",progressBar:"esri-editor__progress-bar",promptContainer:"esri-editor__prompt",promptHeader:"esri-editor__prompt__header",promptHeading:"esri-editor__prompt__header__heading",promptMessage:"esri-editor__prompt__message",promptDivider:"esri-editor__prompt__divider",promptActions:"esri-editor__prompt__actions",promptOption:"esri-editor__prompt__option",promptOptionPrimary:"esri-editor__prompt__option--primary",promptOptionNegative:"esri-editor__prompt__option--negative",promptOptionPositive:"esri-editor__prompt__option--positive",controlButton:"esri-editor__control-button",overlay:"esri-editor__overlay",warningIcon:"esri-icon-notice-triangle",widgetIcon:"esri-icon-edit",button:"esri-button",buttonDisabled:"esri-button--disabled",buttonSecondary:"esri-button--secondary",buttonTertiary:"esri-button--tertiary",input:"esri-input",interactive:"esri-interactive",select:"esri-select",panelToolbar:"esri-editor__panel-toolbar",panelToolbarSnappingButton:"esri-editor__panel-toolbar__snapping-button",panelContent:"esri-editor__panel-content",panelContentMessage:"esri-editor__panel-content--message",panelContentSection:"esri-editor__panel-content--section",updateFeaturesActionButtons:"esri-editor__update-features-action-buttons",updateFeaturesActionButtonsButton:"esri-editor__update-features-action-buttons--button",featureTemplatesContainer:"esri-editor__feature-templates-container",snappingControlsPopover:"esri-editor__snapping-controls-popover"},L=B(j.scroller,j.panelContent),U={undoRedoButtons:!1};function V(e){e.focus()}const x="esri.widgets.Editor",D=s.getLogger(x);let O=class extends(t(k)){constructor(e,t){super(e,t),this._candidateCommitted=!1,this._featureForm=new _,this._stateStack=[],this._attachments=new v({visibleElements:{addSubmitButton:!1,cancelAddButton:!1,cancelUpdateButton:!1,deleteButton:!1,errorMessage:!1,progressBar:!1,updateButton:!1}}),this._featureTemplates=new w({enableListScroll:!1}),this._filterText="",this._prompt=null,this._spinner=new f,this._snappingPopover=null,this.activeWorkflow=null,this.allowedWorkflows=null,this.useDeprecatedCreateWorkflow=!1,this.headingLevel=4,this.iconClass=j.widgetIcon,this.label=void 0,this.labelOptions=new m,this.layerInfos=null,this.messages=null,this.messagesCommon=null,this.messagesTemplates=null,this.snappingOptions=new g,this.tooltipOptions=new u,this.supportingWidgetDefaults=null,this.view=null,this.viewModel=new y,this.visibleElements={...U},this._setCandidateFeature=(e,t=!1)=>{if(this._candidateCommitted)return;const s=this._assertActiveUpdateWorkflow();s.data.edits.feature=e,t&&(s.next(),this._candidateCommitted=!0)},this._handleSave=this._handleSave.bind(this),this._handleBack=this._handleBack.bind(this),this._handleDone=this._handleDone.bind(this),this._handleDelete=this._handleDelete.bind(this),this._handleAdd=this._handleAdd.bind(this),this._handleEdit=this._handleEdit.bind(this),this._handleAttachmentAdd=this._handleAttachmentAdd.bind(this),this._handleAttachmentUpdate=this._handleAttachmentUpdate.bind(this),this._handleAttachmentDelete=this._handleAttachmentDelete.bind(this),this.EditorPanel=this.EditorPanel.bind(this)}initialize(){const{view:e,snappingOptions:t}=this;this._snappingControls=new F({snappingOptions:t,view:e,visibleElements:{header:!1}}),this.own([a((()=>this.headingLevel),(e=>{this._featureForm.headingLevel=A(e),this._featureTemplates.headingLevel=A(e)}),n),this.viewModel.featureTemplatesViewModel.on("select",(({item:e})=>this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(e):this.startCreateFeaturesWorkflowAtFeatureCreation(e))),a((()=>this.viewModel.state),((e,t)=>{const s=this._stateStack.indexOf(e);-1===s?this._stateStack.push(t):this._stateStack.splice(s)})),a((()=>this.viewModel),(e=>{this._featureForm.viewModel=e?e.featureFormViewModel:null,this._attachments.viewModel=e?e.attachmentsViewModel:null,this._featureTemplates.viewModel=e?e.featureTemplatesViewModel:null,this._spinner.viewModel=e?e.spinnerViewModel:null}),n),a((()=>this.view),((e,t)=>{const s=`editor-${this.id}-spinner`;t&&t.ui.remove(this._spinner,s),e&&e.ui.add(this._spinner,{key:s,position:"manual"})}),n),o((()=>this.viewModel?.sketchViewModel),"create",(()=>{this.scheduleRender()})),o((()=>this.viewModel?.activeWorkflow),"cancel-request",(({controller:e})=>{const{messages:t,messagesCommon:s}=this;this._prompt={title:t.cancelRequestTitle,message:t.cancelRequestWarningMessage,context:"danger",actions:{primary:{label:s.form.yes,action:()=>{e.allow(),this._prompt=null}},secondary:{label:s.form.no,action:()=>(e.deny(),this._prompt=null)}}},this.scheduleRender()})),a((()=>this.supportingWidgetDefaults),(e=>{e&&(this._featureForm.set(e.featureForm),this._attachments.set(e.attachments),this._featureTemplates.set(e.featureTemplates),this.viewModel.sketchViewModel.set(e.sketch))}),n),a((()=>this._attachments?.error),(e=>{if(!e)return;const{messages:t,messagesCommon:s}=this;this._prompt={title:t.errorWarningTitle,message:e.message,context:"warning",actions:{primary:{label:s.form.ok,action:()=>{this._prompt=null}}}}})),a((()=>this.viewModel?.failures),(e=>{if(!e)return;const{messages:t}=this,[{error:s,retry:i,cancel:a}]=e;this._prompt={title:t.errorWarningTitle,message:P(t.errorWarningMessageTemplate,{errorMessage:s.message}),context:"warning",actions:{primary:{label:t.retry,action:()=>{i(),this._prompt=null}},secondary:{label:t.ignore,action:()=>(a(),this._prompt=null)}}}})),a((()=>this.viewModel?.state),(e=>{"awaiting-feature-to-update"===e&&(this._filterText=""),"awaiting-update-feature-candidate"===e&&(this._candidateCommitted=!1)})),a((()=>[this._attachments?.selectedFile,this._attachments?.submitting]),(()=>this.scheduleRender())),r((()=>!this.viewModel?.activeWorkflow),(()=>this._featureTemplates.filterText=""))])}destroy(){this._attachments.destroy(),this._featureForm.destroy(),this._featureTemplates.destroy(),this._snappingControls.destroy()}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-action.js"),import("@esri/calcite-components/dist/components/calcite-action-menu.js"),import("@esri/calcite-components/dist/components/calcite-button.js"),import("@esri/calcite-components/dist/components/calcite-flow.js"),import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-loader.js"),import("@esri/calcite-components/dist/components/calcite-panel.js"),import("@esri/calcite-components/dist/components/calcite-popover.js"),import("@esri/calcite-components/dist/components/calcite-scrim.js")])}castVisibleElements(e){return{...U,...e}}startCreateWorkflowAtFeatureTypeSelection(){return b(D,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),this.viewModel.startCreateWorkflowAtFeatureTypeSelection()}startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.viewModel.startCreateFeaturesWorkflowAtFeatureTypeSelection()}startCreateWorkflowAtFeatureCreation(e){return b(D,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),this.viewModel.startCreateWorkflowAtFeatureCreation(e)}startCreateFeaturesWorkflowAtFeatureCreation(e){return this.viewModel.startCreateFeaturesWorkflowAtFeatureCreation(e)}startCreateWorkflowAtFeatureEdit(e){return b(D,"startCreateWorkflowAtFeatureEdit"),this.viewModel.startCreateWorkflowAtFeatureEdit(e)}startUpdateWorkflowAtFeatureSelection(){return this.viewModel.startUpdateWorkflowAtFeatureSelection()}startUpdateWorkflowAtMultipleFeatureSelection(e){return this.viewModel.startUpdateWorkflowAtMultipleFeatureSelection(e)}startUpdateWorkflowAtFeatureEdit(e){return this.viewModel.startUpdateWorkflowAtFeatureEdit(e)}deleteFeatureFromWorkflow(){return this.viewModel.deleteFeatureFromWorkflow()}cancelWorkflow(e){return this.viewModel.cancelWorkflow(e)}render(){const{_attachments:e,_prompt:t,viewModel:s}=this;if(!s)return E("div",{class:j.base});const{state:a}=s,o=i(t)?E("calcite-scrim",null,this.renderPrompt(t)):null;return E("div",{class:j.base},s.syncing||e.submitting?this.renderProgressBar():null,E("calcite-flow",null,this._stateStack.map((e=>this.renderState(e))),this.renderState(a)),o)}renderState(e){switch(e){case"disabled":break;case"ready":return this.renderLanding(e);case"awaiting-feature-creation-info":return this.renderTemplates(e);case"creating-features":case"editing-new-feature":case"editing-existing-feature":return this.renderAttributeEditing(e);case"awaiting-feature-to-update":return this.renderFeatureUpdating(e);case"awaiting-update-feature-candidate":return this.renderFeatureList(e);case"awaiting-feature-to-create":return this.renderFeatureCreation(e);case"adding-attachment":return this.renderAttachmentAdding(e);case"editing-attachment":return this.renderAttachmentEditing(e)}return E("div",null)}isPanelActive(e){return this.viewModel.state===e}renderTemplates(e){const{EditorPanel:t,headingLevel:s,messages:i,messagesCommon:a,_handleBack:o,_snappingControls:r,viewModel:{sketchViewModel:n}}=this;return E(t,{active:this.isPanelActive(e),key:"templates-panel",handleBack:o,heading:i.selectTemplate,headingLevel:s,messages:i,messagesCommon:a,sketchViewModel:n,snappingControls:r},E("div",{class:L},this._featureTemplates.render()))}renderAttributeEditing(e){const{activeWorkflow:t,EditorPanel:s,messages:i,messagesCommon:a,headingLevel:o,_handleBack:r,_snappingControls:n,viewModel:l}=this,{sketchViewModel:d}=l,c=l.featureFormViewModel;if("create-features"===t.type&&t.pendingFeatures.length<1)return this.renderFeatureCreation(e);const p="update"===t.type&&!t.data.edits.modified||l.syncing,h="update"===t.type?i.editFeature:i.createFeatures,m="update"===t.type?a.update:a.create,u="create-features"===t.type&&"create-new"===t.createFeatureState,g=[{label:"create-features"===t.type&&t.numPendingFeatures>1?P(i.createFeaturesTemplate,{numFeatures:t.numPendingFeatures}):m,type:"primary",disabled:p,clickHandler:this._handleSave}];let v=!1;return"update"===t.type&&(t.data.editableItem.hasAttachments&&(v=!0),t.data.editableItem.supports.includes("delete")&&g.push({label:a.delete,type:"tertiary",clickHandler:this._handleDelete})),E(s,{active:this.isPanelActive(e),key:"attribute-editing-panel",heading:h,headingLevel:o,handleBack:r,messages:i,messagesCommon:a,sketchViewModel:d,snappingControls:n},E("div",{class:L},E("div",{class:j.panelContentSection},E("div",{class:j.contentGroup},c.inputFields.length>0?this._featureForm.render():this.renderMessage(P(i.clickToFinishTemplate,{button:m})),v?E("div",{key:"attachments"},E("div",null,i.attachments),this._attachments.render()):null),u?E("calcite-scrim",null):null)),this.renderFooterActions(g))}renderAttachmentAdding(e){const{_attachments:t,EditorPanel:s,_handleBack:i,headingLevel:a,messages:o,messagesCommon:r,_snappingControls:n,viewModel:{sketchViewModel:l}}=this,d=[{label:t.submitting?r.cancel:r.add,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentAdd}];return E(s,{active:this.isPanelActive(e),key:"attachment-adding-panel",heading:o.addAttachment,headingLevel:a,handleBack:i,messages:o,messagesCommon:r,sketchViewModel:l,snappingControls:n},E("div",{class:L},t.render()),this.renderFooterActions(d))}renderAttachmentEditing(e){const{_attachments:t,EditorPanel:s,_handleBack:i,headingLevel:a,messages:o,messagesCommon:r,_snappingControls:n,viewModel:{sketchViewModel:l}}=this,d=[{label:r.update,disabled:t.submitting||!t.selectedFile,type:"primary",clickHandler:this._handleAttachmentUpdate},{label:r.delete,disabled:t.submitting,type:"tertiary",clickHandler:this._handleAttachmentDelete}];return E(s,{active:this.isPanelActive(e),key:"attachment-editing-panel",heading:o.editAttachment,headingLevel:a,handleBack:i,messages:o,messagesCommon:r,sketchViewModel:l,snappingControls:n},E("div",{class:L},t.render()),this.renderFooterActions(d))}renderFeatureUpdating(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:o,_snappingControls:r,viewModel:{sketchViewModel:n}}=this;return E(t,{active:this.isPanelActive(e),key:"feature-updating-panel",heading:a.selectFeature,headingLevel:i,handleBack:s,messages:a,messagesCommon:o,sketchViewModel:n,snappingControls:r},E("div",{class:B(L,j.panelContentMessage)},this.renderMessage(a.selectFeatureToEdit)))}renderMessage(e){return E("div",{class:j.message},e)}renderFeatureCreation(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:o,_snappingControls:r,viewModel:n}=this,{sketchViewModel:l}=n,d=n.sketchViewModel,c=this._assertActiveCreateWorkflow().data.creationInfo.layer,p=d.canUndo()&&d.createGraphic?d.createGraphic:null,h=this._getSketchingTip(c.geometryType,p);return E(t,{active:this.isPanelActive(e),key:"feature-creation-panel",heading:a.placeFeature,headingLevel:i,handleBack:s,messages:a,messagesCommon:o,sketchViewModel:l,snappingControls:r},E("div",{class:B(L,j.panelContentMessage)},this.renderMessage(h)))}renderFooterActions(e){return e.map((({type:e,disabled:t,class:s,...i},a)=>this.renderButton({class:this.classes(j.controlButton,j.button,"secondary"===e?j.buttonSecondary:"tertiary"===e?j.buttonTertiary:null,t?j.buttonDisabled:null,s),disabled:t??!1,key:a,slot:"footer-actions",...i})))}renderPrompt({title:e,message:t,context:s,actions:i}){const a=!!i.secondary,o=E("calcite-button",{appearance:"solid",color:"danger"===s?"red":"blue",width:a?"half":"full",onclick:i.primary.action,key:"prompt-primary-button",afterCreate:V},i.primary.label),r=a?E("calcite-button",{appearance:"clear",color:"danger"===s?"red":"blue",width:"half",onclick:i.secondary.action,key:"prompt-secondary-button"},i.secondary.label):null;return E("div",{class:`${j.promptContainer}--${s}`},E("div",{class:j.promptHeader},E("calcite-icon",{icon:"exclamation-mark-triangle"}),E(M,{class:j.promptHeading,level:this.headingLevel},e)),E("div",{class:j.promptMessage},t),E("div",{class:j.promptDivider}),E("div",{class:j.promptActions},r,o))}renderProgressBar(){return E("div",{class:this.classes(j.progressBar),key:"progress-bar"})}renderButton(e){const{disabled:t,class:s,key:i,clickHandler:a,label:o,...r}=e;return E("calcite-button",{class:s,disabled:t,key:i,onclick:a,type:"button",...r},o)}renderLanding(e){const{EditorPanel:t,headingLevel:s,messages:i,messagesCommon:a,_snappingControls:o,viewModel:{sketchViewModel:r}}=this;return E(t,{active:this.isPanelActive(e),key:"landing-panel",heading:i.widgetLabel,headingLevel:s,showBackButton:!1,messages:i,messagesCommon:a,sketchViewModel:r,snappingControls:o},E("div",{class:L},E("div",{key:"edit-actions",class:j.panelContentSection},this.renderUpdateActions()),E("div",{key:"create-actions",class:j.panelContentSection},this.renderCreateActions())))}renderUpdateActions(){const{messages:e,messagesCommon:t}=this;return E("div",null,E(M,{level:A(this.headingLevel)},e.editFeatures),E("div",{class:j.updateFeaturesActionButtons},E("calcite-action",{text:t.select,textEnabled:!0,icon:"cursor",alignment:"start",class:j.updateFeaturesActionButtonsButton,onclick:this._handleEdit})))}renderCreateActions(){const{messages:e}=this;return E("div",null,E(M,{level:A(this.headingLevel)},e.createFeatures),E("div",{key:"templates",class:j.featureTemplatesContainer},this._featureTemplates.render()))}renderFeatureList(e){const{EditorPanel:t,_handleBack:s,headingLevel:i,messages:a,messagesCommon:o,messagesTemplates:r,_snappingControls:n,viewModel:{editableItems:l,sketchViewModel:d}}=this,c=this._assertActiveUpdateWorkflow().data.candidates,p=P(a.multipleFeaturesTemplate,{total:c.length}),h=new Map;let m=0;c.map((e=>({label:this._getLabel(e),id:e.attributes[e.layer.objectIdField],data:e}))).filter((e=>{const{label:t,data:s}=e,i=this._filterText.toLowerCase(),{title:a}=s.layer,o=this.viewModel.editableItems.find((e=>e.layer===s.layer));return o.supports.includes("update")&&(!i||t.toLowerCase().includes(i)||a.toLowerCase().includes(i))})).forEach((e=>{m++;const t=e.data.layer;h.has(t)?h.get(t).items.push(e):h.set(t,{id:`${t.id}`,label:t.title,items:[e]})}));const u=l.filter((({layer:e})=>h.has(e))).map((({layer:e})=>h.get(e))).toArray(),g=m>10||this._filterText.length>0;return E(t,{active:this.isPanelActive(e),key:"feature-list",heading:p,headingLevel:i,handleBack:s,messages:a,messagesCommon:o,sketchViewModel:d,snappingControls:n},E("div",{class:L},C({id:this.id,enableListScroll:!1,filterEnabled:g,filterText:this._filterText,items:u,messages:{filterPlaceholder:r.filterPlaceholder,noItems:r.noItems,noMatches:r.noMatches},onItemMouseEnter:({data:e})=>this._setCandidateFeature(e),onItemMouseLeave:()=>this._setCandidateFeature(null),onItemSelect:({data:e})=>this._setCandidateFeature(e,!0),onFilterChange:e=>this._filterText=e})))}EditorPanel(e,...t){const{active:s,handleBack:i,heading:a,headingLevel:o,key:r,messages:n,messagesCommon:l,showBackButton:d,sketchViewModel:c,snappingControls:p}=e;return E("calcite-panel",{bind:this,key:r,heading:a,headingLevel:o,showBackButton:d??!0,beforeBack:i??null,onCalcitePanelScroll:this._onSnappingPopoverPanelScroll},E("div",{class:j.panelToolbar},E("calcite-popover",{autoClose:s,afterCreate:this._afterSnappingPopoverCreated,afterUpdate:this._afterSnappingPopoverUpdated,bind:this,label:n.snappingSettings,heading:n.snappingSettings,"reference-element":`${r}__snappingButton`,"overlay-positioning":"fixed",placement:"bottom"},E("div",{class:j.snappingControlsPopover},p.render())),E("calcite-button",{id:`${r}__snappingButton`,text:n.snapping,appearance:"transparent",color:"neutral",alignment:"icon-end-space-between","icon-start":"vertex-gps","icon-end":"caret-down",width:"full",class:j.panelToolbarSnappingButton},n.snapping),this.visibleElements.undoRedoButtons?[E("calcite-button",{key:"undo-button",text:l.undo,appearance:"transparent",color:"neutral",alignment:"center","icon-start":"undo",scale:"l",disabled:!c.canUndo(),onclick:c.undo.bind(c)}),E("calcite-button",{key:"redo-button",text:l.redo,appearance:"transparent",color:"neutral",alignment:"center","icon-start":"redo",scale:"l",disabled:!c.canRedo(),onclick:c.redo.bind(c)})]:null),t)}_onSnappingPopoverPanelScroll(){this._snappingPopover?.open&&this._snappingPopover.toggle()}_afterSnappingPopoverCreated(e){this._snappingPopover=e}_afterSnappingPopoverUpdated(e){this._snappingPopover=e}_getSketchingTip(e,t){const{messages:s}=this;if("point"===e)return s.tips.clickToAddPoint;if("polygon"===e||"polyline"===e){if(!t)return s.tips.clickToStart;const i=t.geometry,a="polygon"===e?"rings":"paths",[o]=i[a];return"polygon"===e&&o<4?s.tips.clickToContinue:s.tips.clickToContinueThenDoubleClickToEnd}return s.tips.clickToAddFeature}_getLabel(e){const t=e.layer;if(!t)return null;const{objectIdField:s}=t,{attributes:i}=e,a=h(t);return a&&i[a]&&`${i[a]}`||P(this.messages.untitledFeatureTemplate,{id:i[s]})}_handleDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteWarningTitle,message:e.deleteWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{this.viewModel.deleteFeatureFromWorkflow(),this._prompt=null}},secondary:{label:e.keepFeature,action:()=>this._prompt=null}}}}_handleSave(){const{featureFormViewModel:e}=this.viewModel;e.submit(),!e.submittable||e.validateContingencyConstraints(e.getValues(),{includeIncompleteViolations:!0}).length>0||this.viewModel.activeWorkflow.commit()}_handleAttachmentAdd(){const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.addAttachment().then((()=>t.previous()))}_handleAttachmentUpdate(){const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.updateAttachment().then((()=>t.previous()))}_handleAttachmentDelete(){const{messages:e,messagesCommon:t}=this;this._prompt={title:e.deleteAttachmentWarningTitle,message:e.deleteAttachmentWarningMessage,context:"danger",actions:{primary:{label:t.delete,action:()=>{const{_attachments:e}=this,{activeWorkflow:t}=this.viewModel;e.deleteAttachment(e.viewModel.activeAttachmentInfo).then((()=>{t.previous(),this._prompt=null}))}},secondary:{label:e.keepAttachment,action:()=>this._prompt=null}}}}_handleAdd(){this.viewModel.canCreate}_handleEdit(){this.viewModel.canUpdate&&this.viewModel.startUpdateWorkflowAtFeatureSelection()}_handleDone(){this.viewModel.cancelWorkflow({force:!0})}async _handleBack(){const{messages:e}=this,t=this.activeWorkflow,s=()=>{t.hasPreviousStep?t.previous({cancelCurrentStep:!0}):this.viewModel.cancelWorkflow({force:!0})};if("create"===t.type||"create-features"===t.type&&t.numPendingFeatures>0||"update"===t.type&&t.data.edits.modified){const{type:i}=t,a="create"===i?e.cancelAddWarningMessage:e.cancelEditWarningMessage,o="create"===i?e.cancelAddTitle:e.cancelEditTitle,r="create"===i?e.continueAdding:e.continueEditing,n="create"===i?e.discardFeature:e.discardEdits;throw this._prompt={title:o,message:a,context:"danger",actions:{primary:{label:n,action:()=>{s(),this._prompt=null}},secondary:{label:r,action:()=>this._prompt=null}}},this.scheduleRender(),new Error}s()}_assertActiveCreateWorkflow(){const{type:e}=this.viewModel.activeWorkflow;if("create"===e||"create-features"===e)return this.viewModel.activeWorkflow;throw Error("Expected activeWorkflow to be instance of CreateWorkflow or CreateFeaturesWorkflow")}_assertActiveUpdateWorkflow(){if("update"===this.viewModel.activeWorkflow.type)return this.viewModel.activeWorkflow;throw Error("Expected activeWorkflow to be an UpdateWorkflow")}};e([c()],O.prototype,"_attachments",void 0),e([l("viewModel.activeWorkflow")],O.prototype,"activeWorkflow",void 0),e([l("viewModel.allowedWorkflows")],O.prototype,"allowedWorkflows",void 0),e([c()],O.prototype,"useDeprecatedCreateWorkflow",void 0),e([c()],O.prototype,"headingLevel",void 0),e([c()],O.prototype,"iconClass",void 0),e([c({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],O.prototype,"label",void 0),e([l("viewModel.labelOptions")],O.prototype,"labelOptions",void 0),e([l("viewModel.layerInfos")],O.prototype,"layerInfos",void 0),e([c(),T("esri/widgets/Editor/t9n/Editor")],O.prototype,"messages",void 0),e([c(),T("esri/t9n/common")],O.prototype,"messagesCommon",void 0),e([c(),T("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],O.prototype,"messagesTemplates",void 0),e([l("viewModel.snappingOptions")],O.prototype,"snappingOptions",void 0),e([l("viewModel.tooltipOptions")],O.prototype,"tooltipOptions",void 0),e([c()],O.prototype,"supportingWidgetDefaults",void 0),e([l("viewModel.view")],O.prototype,"view",void 0),e([c(),S(["workflow-cancel","workflow-commit"])],O.prototype,"viewModel",void 0),e([c()],O.prototype,"visibleElements",void 0),e([d("visibleElements")],O.prototype,"castVisibleElements",null),e([W()],O.prototype,"_handleDelete",null),e([W()],O.prototype,"_handleAttachmentAdd",null),e([W()],O.prototype,"_handleAttachmentUpdate",null),e([W()],O.prototype,"_handleAttachmentDelete",null),e([W()],O.prototype,"_handleAdd",null),e([W()],O.prototype,"_handleEdit",null),e([W()],O.prototype,"_handleDone",null),O=e([p(x)],O);const I=O;export{I 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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../chunks/tslib.es6.js";import{equalsShallow as e}from"../core/lang.js";import{isSome as i,destroyMaybe as s,isNone as o,applySome as r,abortMaybe as n}from"../core/maybe.js";import{memoize as a}from"../core/memoize.js";import{createTask as l,createAbortError as c}from"../core/promiseUtils.js";import{watch as h,initial as d}from"../core/reactiveUtils.js";import{aliasOf as p}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/accessorSupport/ensureType.js";import{property as u}from"../core/accessorSupport/decorators/property.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import _ from"./Widget.js";import{CSS as C}from"./ElevationProfile/css.js";import v from"./ElevationProfile/ElevationProfileViewModel.js";import g from"./ElevationProfile/ElevationProfileVisibleElements.js";import{Legend as f}from"./ElevationProfile/components/Legend.js";import{SettingsButton as y}from"./ElevationProfile/components/SettingsButton.js";import{createChart as w}from"./ElevationProfile/support/chartUtils.js";import{ElevationProfileErrorState as b,PORTRAIT_MODE_PIXEL_BREAKPOINT as k,ElevationProfileState as S,LARGE_CHART_SAMPLES as B}from"./ElevationProfile/support/constants.js";import{onResize as M}from"./support/widgetUtils.js";import{messageBundle as P}from"./support/decorators/messageBundle.js";import{tsx as E}from"./support/jsxFactory.js";var j;!function(t){t.Sketch="sketch",t.SketchCancel="sketch-cancel",t.SketchDone="sketch-done",t.Select="select",t.SelectCancel="select-cancel"}(j||(j={}));const z=[{type:j.Select},{type:j.Sketch}],I={[b.None]:null,[b.NoValidInput]:"noProfile",[b.NoVisibleProfiles]:"noProfile",[b.RefinedButNoChartData]:"noProfile",[b.TooComplex]:"tooComplex",[b.UnknownError]:"unknown",[b.InvalidGeometry]:"invalidGeometry",[b.InvalidElevationInfo]:"invalidElevationInfo"};let A=class extends _{constructor(t,e){super(t,e),this.viewModel=null,this.view=null,this.input=null,this.profiles=null,this.unitOptions=[],this.unit="metric",this.geodesicDistanceThreshold=1e5,this.visibleElements=new g,this.iconClass=C.widgetIcon,this.label=void 0,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this._chartContainer=null,this._chart=null,this._chartInitTask=null,this._chartIsRefined=!1,this._width=0,this._zoomOutButtonVisible=!1,this._getChartUpdateParamsMemoized=a(((t,e,i,s)=>({chart:t,data:e,stationary:i,messages:s}))),this._getDetailsPropsMemoized=a(((t,e)=>({effectiveUnits:t,profiles:e}))),t?.viewModel||(this._defaultViewModel=new v({view:t?.view}),this.viewModel=this._defaultViewModel)}initialize(){this._legend=new f(this._legendProps),this._settingsButton=new y(this._settingsButtonProps),this.own([h((()=>this._legendProps),(t=>this._legend.set(t))),h((()=>this._settingsButtonProps),(t=>this._settingsButton.set(t)))])}postInitialize(){this.own([h((()=>({container:this._chartContainer,width:this._width})),(({container:t,width:e})=>{this._destroyChart(),i(t)&&e>0&&this._initializeChart(t)}),{initial:!0,equals:e}),h((()=>this._chartUpdateParams),(()=>this._updateChart(this._chartUpdateParams)),d)])}destroy(){this._destroyChart(),i(this._defaultViewModel)&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy(),this._legend=s(this._legend),this._settingsButton=s(this._settingsButton)}get _portrait(){return this._width<k}get _chartUpdateParams(){const t=this.view;return this._getChartUpdateParamsMemoized(this._chart,this.viewModel.chartData,!i(t)||t.stationary,this._chartMessages)}get _chartMessages(){return{...this.messagesUnits,...this.messages}}get _legendProps(){return this._getDetailsPropsMemoized(this.viewModel.effectiveUnits,this._profilesArray)}get _profilesArray(){return this.profiles.toArray()}get _settingsButtonProps(){return{viewModel:this.viewModel,visibleElements:this.visibleElements}}render(){const{viewModel:t,visible:e}=this;return E("div",{key:this,class:this.classes({[C.base]:e,[C.esriWidget]:e,[C.esriWidgetDisabled]:e&&"disabled"===t.state,[C.portrait]:this._portrait,[C.refined]:1===t.progress}),"aria-label":this.messages.widgetLabel,afterCreate:t=>{this.own(M(t,(t=>{this._width=t.contentRect.width})))}},e&&this._renderContentForState())}_renderContentForState(){switch(this.viewModel.state){case S.Ready:return this._renderContentForReadyState();case S.Selecting:return this._renderContentForSelectingState();case S.Creating:return this._renderContentForCreatingState();case S.Selected:return this._renderContentForSelectedState();case S.Created:return this._renderContentForCreatedState();case S.Disabled:return this._renderContentForReadyState()}}_renderContentForReadyState(){const{sketchButton:t,selectButton:e}=this.visibleElements,i=this.messages;let s;return s=t&&e?i.readyPrompt:t?i.readyPromptCreateOnly:e?i.readyPromptSelectOnly:i.errors?.noProfile,this._renderContent({prompt:s,chart:!1,actions:z})}_renderContentForSelectingState(){const t=this.view;if(o(t))return null;const e=this.messages[`selectingPrompt-${t.type}`];return this._renderContent({prompt:e,chart:!1,actions:[{type:j.SelectCancel}]})}_renderContentForCreatingState(){const{view:t,viewModel:e}=this;if(o(t))return null;const i=e.hasVertices?[{type:j.SketchCancel},{type:j.SketchDone,disabled:!e.tool.interaction.canStopCreating}]:[{type:j.Select},{type:j.Sketch,disabled:!0}];if(e.errorState===b.NoValidInput){const e=this.messages[`creatingPrompt-${t.type}`];return this._renderContent({chart:!1,actions:i,prompt:e})}const s=this._getErrorMessage();return s?this._renderContent({chart:!1,actions:i,prompt:s}):this._renderContent({chart:!0,actions:i})}_renderContentForSelectedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:z,prompt:t}):this._renderContent({chart:!0,actions:z})}_renderContentForCreatedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:z,prompt:t}):this._renderContent({chart:!0,actions:z})}_getErrorMessage(){const t=I[this.viewModel.errorState];return this.messages?.errors?.[t]}_renderContent(t){const e=i(t.prompt)?this._renderPrompt(t.prompt):t.chart&&this._renderChart(),s=i(this.viewModel.input);return[E("header",{key:"header",class:C.header},this._zoomOutButtonVisible&&this._renderZoomOutButton(),this.visibleElements.clearButton&&s&&this._renderClearButton(),this.visibleElements.settingsButton&&this._settingsButton.render()),E("div",{class:C.mainContainer},...e),this.visibleElements.legend&&this._legend.render(),this._renderActions(t)]}_renderZoomOutButton(){return E("button",{key:"zoom-out",class:C.zoomOutButton,bind:this,onclick:this._onZoomOutButtonClick,title:this.messages.zoomOut,type:"button"})}_onZoomOutButtonClick(){r(this._chart,(t=>t.zoomOut()))}_renderClearButton(){return E("button",{key:"clear-profile",class:C.clearButton,bind:this,onclick:this._onClearButtonClick,title:this.messages.clearProfile,type:"button"})}_onClearButtonClick(){this.viewModel.clear()}_renderPrompt(t){return[E("div",{key:"prompt-container",bind:this,class:C.promptContainer},E("p",null,t))]}_renderChart(){if(!this.visibleElements.chart)return[E("div",{key:"empty-chart-container",class:C.chartContainer})];const t=this._chartIsRefined||this._canRenderChart();if(!t)return[this._renderSpinner({size:"large"}),E("div",{key:"chart-container-empty",class:C.chartContainer})];const{chartData:e,progress:s}=this.viewModel;return[i(e)&&s>0&&s<1&&this._renderSpinner({size:t?"small":"large"}),E("div",{key:"chart-container",bind:this,class:C.chartContainer,afterCreate:this._onChartContainerAfterCreate,afterRemoved:this._onChartContainerRemoved})]}_renderSpinner(t){return E("div",{key:"spinner",class:this.classes(C.chartSpinner,{[C.chartSpinnerSmall]:"small"===t.size}),afterCreate:this._onSpinnerAfterCreate,exitAnimation:this._onSpinnerExit})}_onSpinnerAfterCreate(t){requestAnimationFrame((()=>t.classList.add(C.chartSpinnerVisible)))}_onSpinnerExit(t,e){t.classList.remove(C.chartSpinnerVisible),setTimeout(e,200)}_canRenderChart(){const t=this.viewModel.chartData;if(o(t))return!1;if(!this.viewModel.inputIsSketched)return t.refined;let e=0;for(const{samples:s}of t.lines)e+=i(s)?s.length:0;return t.refined||e<=B}_renderActions({actions:t}){const e=t.map((t=>{switch(t.type){case j.Sketch:return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onSketchButtonClick,className:C.sketchButton,label:this.messages.sketchButtonLabel});case j.SketchCancel:return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:C.sketchCancelButton,label:this.messagesCommon.cancel});case j.SketchDone:return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onDoneButtonClick,className:C.sketchDoneButton,label:this.messagesCommon.done});case j.Select:return this.visibleElements.selectButton&&this._renderAction({action:t,onClick:this._onSelectButtonClick,className:C.selectButton,label:this.messages.selectButtonLabel});case j.SelectCancel:return this.visibleElements.selectButton&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:C.selectCancelButton,label:this.messagesCommon.cancel})}})).filter(Boolean);return e.length?E("footer",{key:"footer",class:C.footer},...e):null}_renderAction({action:t,onClick:e,className:i,label:s}){return E("button",{key:`action-${t.type}`,class:this.classes(C.actionButton,i,{[C.buttonDisabled]:t.disabled}),bind:this,disabled:t.disabled,onclick:e,type:"button"},s)}_onSketchButtonClick(){this.viewModel.start({mode:"sketch"})}_onSelectButtonClick(){this.viewModel.start({mode:"select"})}_onCancelButtonClick(){this.viewModel.cancel()}_onDoneButtonClick(){this.viewModel.stop()}_updateChart(t){const{data:e,chart:s,messages:r,stationary:n}=t;!o(s)&&!o(r)&&n&&this._canRenderChart()&&(s.update(t),this._chartIsRefined=i(e)&&e.refined)}_onChartContainerAfterCreate(t){this._chartContainer=t}_onChartContainerRemoved(){this._chartContainer=null}_initializeChart(t){n(this._chartInitTask),this._chartInitTask=l((async e=>{const i=await w({container:t,abortOptions:{signal:e},onRangeChange:(t,e)=>{this._zoomOutButtonVisible=1!==t||1!==e},onCursorPositionChange:t=>{this.viewModel.hoveredChartPosition=t}});if(e.aborted)throw s(i),c();this._chart=i,this._updateChart(this._chartUpdateParams)}))}_destroyChart(){this._chartInitTask=n(this._chartInitTask),this._chart=s(this._chart),this._chartIsRefined=!1}};t([u({type:v})],A.prototype,"viewModel",void 0),t([p("viewModel.view")],A.prototype,"view",void 0),t([p("viewModel.input")],A.prototype,"input",void 0),t([p("viewModel.profiles")],A.prototype,"profiles",void 0),t([p("viewModel.unitOptions")],A.prototype,"unitOptions",void 0),t([p("viewModel.unit")],A.prototype,"unit",void 0),t([p("viewModel.geodesicDistanceThreshold")],A.prototype,"geodesicDistanceThreshold",void 0),t([u({type:g,nonNullable:!0})],A.prototype,"visibleElements",void 0),t([u()],A.prototype,"iconClass",void 0),t([p("messages.widgetLabel",{overridable:!0})],A.prototype,"label",void 0),t([p("viewModel.visible")],A.prototype,"visible",void 0),t([u(),P("esri/widgets/ElevationProfile/t9n/ElevationProfile")],A.prototype,"messages",void 0),t([u(),P("esri/t9n/common")],A.prototype,"messagesCommon",void 0),t([u(),P("esri/core/t9n/Units")],A.prototype,"messagesUnits",void 0),t([u()],A.prototype,"_chartContainer",void 0),t([u()],A.prototype,"_chart",void 0),t([u()],A.prototype,"_chartInitTask",void 0),t([u()],A.prototype,"_chartIsRefined",void 0),t([u()],A.prototype,"_settingsButton",void 0),t([u()],A.prototype,"_legend",void 0),t([u()],A.prototype,"_width",void 0),t([u()],A.prototype,"_portrait",null),t([u()],A.prototype,"_zoomOutButtonVisible",void 0),t([u()],A.prototype,"_chartUpdateParams",null),t([u()],A.prototype,"_chartMessages",null),t([u()],A.prototype,"_legendProps",null),t([u()],A.prototype,"_profilesArray",null),t([u()],A.prototype,"_settingsButtonProps",null),A=t([m("esri.widgets.ElevationProfile")],A);const D=A;export{D as default};
|
|
5
|
+
import{_ as t}from"../chunks/tslib.es6.js";import{isSome as e,destroyMaybe as i,isNone as s,applySome as o,abortMaybe as r}from"../core/maybe.js";import{memoize as n}from"../core/memoize.js";import{createTask as a,createAbortError as l}from"../core/promiseUtils.js";import{watch as c,initial as h}from"../core/reactiveUtils.js";import{aliasOf as d}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import m from"./Widget.js";import{CSS as _}from"./ElevationProfile/css.js";import C from"./ElevationProfile/ElevationProfileViewModel.js";import v from"./ElevationProfile/ElevationProfileVisibleElements.js";import{Legend as g}from"./ElevationProfile/components/Legend.js";import{SettingsButton as f}from"./ElevationProfile/components/SettingsButton.js";import{createChart as y}from"./ElevationProfile/support/chartUtils.js";import{ElevationProfileErrorState as w,PORTRAIT_MODE_PIXEL_BREAKPOINT as b,ElevationProfileState as k,LARGE_CHART_SAMPLES as S}from"./ElevationProfile/support/constants.js";import{onResize as B}from"./support/widgetUtils.js";import{messageBundle as M}from"./support/decorators/messageBundle.js";import{tsx as P}from"./support/jsxFactory.js";var E;!function(t){t.Sketch="sketch",t.SketchCancel="sketch-cancel",t.SketchDone="sketch-done",t.Select="select",t.SelectCancel="select-cancel"}(E||(E={}));const j=[{type:E.Select},{type:E.Sketch}],z={[w.None]:null,[w.NoValidInput]:"noProfile",[w.NoVisibleProfiles]:"noProfile",[w.RefinedButNoChartData]:"noProfile",[w.TooComplex]:"tooComplex",[w.UnknownError]:"unknown",[w.InvalidGeometry]:"invalidGeometry",[w.InvalidElevationInfo]:"invalidElevationInfo"};let I=class extends m{constructor(t,e){super(t,e),this.viewModel=null,this.view=null,this.input=null,this.profiles=null,this.unitOptions=[],this.unit="metric",this.geodesicDistanceThreshold=1e5,this.visibleElements=new v,this.iconClass=_.widgetIcon,this.label=void 0,this.messages=null,this.messagesCommon=null,this.messagesUnits=null,this._chartContainer=null,this._chart=null,this._chartInitTask=null,this._chartIsRefined=!1,this._width=0,this._zoomOutButtonVisible=!1,this._getChartUpdateParamsMemoized=n(((t,e,i,s)=>({chart:t,data:e,stationary:i,messages:s}))),this._getDetailsPropsMemoized=n(((t,e)=>({effectiveUnits:t,profiles:e}))),t?.viewModel||(this._defaultViewModel=new C({view:t?.view}),this.viewModel=this._defaultViewModel)}initialize(){this._legend=new g(this._legendProps),this._settingsButton=new f(this._settingsButtonProps),this.own([c((()=>this._legendProps),(t=>this._legend.set(t))),c((()=>this._settingsButtonProps),(t=>this._settingsButton.set(t)))])}postInitialize(){this.own([c((()=>({container:this._chartContainer,width:this._width})),(({container:t,width:i})=>{this._destroyChart(),e(t)&&i>0&&this._initializeChart(t)}),h),c((()=>this._chartUpdateParams),(()=>this._updateChart(this._chartUpdateParams)),h)])}destroy(){this._destroyChart(),e(this._defaultViewModel)&&this.viewModel!==this._defaultViewModel&&this._defaultViewModel.destroy(),this._legend=i(this._legend),this._settingsButton=i(this._settingsButton)}get _portrait(){return this._width<b}get _chartUpdateParams(){const t=this.view;return this._getChartUpdateParamsMemoized(this._chart,this.viewModel.chartData,!e(t)||t.stationary,this._chartMessages)}get _chartMessages(){return{...this.messagesUnits,...this.messages}}get _legendProps(){return this._getDetailsPropsMemoized(this.viewModel.effectiveUnits,this._profilesArray)}get _profilesArray(){return this.profiles.toArray()}get _settingsButtonProps(){return{viewModel:this.viewModel,visibleElements:this.visibleElements}}render(){const{viewModel:t,visible:e}=this;return P("div",{key:this,class:this.classes({[_.base]:e,[_.esriWidget]:e,[_.esriWidgetDisabled]:e&&"disabled"===t.state,[_.portrait]:this._portrait,[_.refined]:1===t.progress}),"aria-label":this.messages.widgetLabel,afterCreate:t=>{this.own(B(t,(t=>{this._width=t.contentRect.width})))}},e&&this._renderContentForState())}_renderContentForState(){switch(this.viewModel.state){case k.Ready:return this._renderContentForReadyState();case k.Selecting:return this._renderContentForSelectingState();case k.Creating:return this._renderContentForCreatingState();case k.Selected:return this._renderContentForSelectedState();case k.Created:return this._renderContentForCreatedState();case k.Disabled:return this._renderContentForReadyState()}}_renderContentForReadyState(){const{sketchButton:t,selectButton:e}=this.visibleElements,i=this.messages;let s;return s=t&&e?i.readyPrompt:t?i.readyPromptCreateOnly:e?i.readyPromptSelectOnly:i.errors?.noProfile,this._renderContent({prompt:s,chart:!1,actions:j})}_renderContentForSelectingState(){const t=this.view;if(s(t))return null;const e=this.messages[`selectingPrompt-${t.type}`];return this._renderContent({prompt:e,chart:!1,actions:[{type:E.SelectCancel}]})}_renderContentForCreatingState(){const{view:t,viewModel:e}=this;if(s(t))return null;const i=e.hasVertices?[{type:E.SketchCancel},{type:E.SketchDone,disabled:!e.tool.interaction.canStopCreating}]:[{type:E.Select},{type:E.Sketch,disabled:!0}];if(e.errorState===w.NoValidInput){const e=this.messages[`creatingPrompt-${t.type}`];return this._renderContent({chart:!1,actions:i,prompt:e})}const o=this._getErrorMessage();return o?this._renderContent({chart:!1,actions:i,prompt:o}):this._renderContent({chart:!0,actions:i})}_renderContentForSelectedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:j,prompt:t}):this._renderContent({chart:!0,actions:j})}_renderContentForCreatedState(){const t=this._getErrorMessage();return t?this._renderContent({chart:!1,actions:j,prompt:t}):this._renderContent({chart:!0,actions:j})}_getErrorMessage(){const t=z[this.viewModel.errorState];return this.messages?.errors?.[t]}_renderContent(t){const i=e(t.prompt)?this._renderPrompt(t.prompt):t.chart&&this._renderChart(),s=e(this.viewModel.input);return[P("header",{key:"header",class:_.header},this._zoomOutButtonVisible&&this._renderZoomOutButton(),this.visibleElements.clearButton&&s&&this._renderClearButton(),this.visibleElements.settingsButton&&this._settingsButton.render()),P("div",{class:_.mainContainer},...i),this.visibleElements.legend&&this._legend.render(),this._renderActions(t)]}_renderZoomOutButton(){return P("button",{key:"zoom-out",class:_.zoomOutButton,bind:this,onclick:this._onZoomOutButtonClick,title:this.messages.zoomOut,type:"button"})}_onZoomOutButtonClick(){o(this._chart,(t=>t.zoomOut()))}_renderClearButton(){return P("button",{key:"clear-profile",class:_.clearButton,bind:this,onclick:this._onClearButtonClick,title:this.messages.clearProfile,type:"button"})}_onClearButtonClick(){this.viewModel.clear()}_renderPrompt(t){return[P("div",{key:"prompt-container",bind:this,class:_.promptContainer},P("p",null,t))]}_renderChart(){if(!this.visibleElements.chart)return[P("div",{key:"empty-chart-container",class:_.chartContainer})];const t=this._chartIsRefined||this._canRenderChart();if(!t)return[this._renderSpinner({size:"large"}),P("div",{key:"chart-container-empty",class:_.chartContainer})];const{chartData:i,progress:s}=this.viewModel;return[e(i)&&s>0&&s<1&&this._renderSpinner({size:t?"small":"large"}),P("div",{key:"chart-container",bind:this,class:_.chartContainer,afterCreate:this._onChartContainerAfterCreate,afterRemoved:this._onChartContainerRemoved})]}_renderSpinner(t){return P("div",{key:"spinner",class:this.classes(_.chartSpinner,{[_.chartSpinnerSmall]:"small"===t.size}),afterCreate:this._onSpinnerAfterCreate,exitAnimation:this._onSpinnerExit})}_onSpinnerAfterCreate(t){requestAnimationFrame((()=>t.classList.add(_.chartSpinnerVisible)))}_onSpinnerExit(t,e){t.classList.remove(_.chartSpinnerVisible),setTimeout(e,200)}_canRenderChart(){const t=this.viewModel.chartData;if(s(t))return!1;if(!this.viewModel.inputIsSketched)return t.refined;let i=0;for(const{samples:s}of t.lines)i+=e(s)?s.length:0;return t.refined||i<=S}_renderActions({actions:t}){const e=t.map((t=>{switch(t.type){case E.Sketch:return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onSketchButtonClick,className:_.sketchButton,label:this.messages.sketchButtonLabel});case E.SketchCancel:return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:_.sketchCancelButton,label:this.messagesCommon.cancel});case E.SketchDone:return this.visibleElements.sketchButton&&this._renderAction({action:t,onClick:this._onDoneButtonClick,className:_.sketchDoneButton,label:this.messagesCommon.done});case E.Select:return this.visibleElements.selectButton&&this._renderAction({action:t,onClick:this._onSelectButtonClick,className:_.selectButton,label:this.messages.selectButtonLabel});case E.SelectCancel:return this.visibleElements.selectButton&&this._renderAction({action:t,onClick:this._onCancelButtonClick,className:_.selectCancelButton,label:this.messagesCommon.cancel})}})).filter(Boolean);return e.length?P("footer",{key:"footer",class:_.footer},...e):null}_renderAction({action:t,onClick:e,className:i,label:s}){return P("button",{key:`action-${t.type}`,class:this.classes(_.actionButton,i,{[_.buttonDisabled]:t.disabled}),bind:this,disabled:t.disabled,onclick:e,type:"button"},s)}_onSketchButtonClick(){this.viewModel.start({mode:"sketch"})}_onSelectButtonClick(){this.viewModel.start({mode:"select"})}_onCancelButtonClick(){this.viewModel.cancel()}_onDoneButtonClick(){this.viewModel.stop()}_updateChart(t){const{data:i,chart:o,messages:r,stationary:n}=t;!s(o)&&!s(r)&&n&&this._canRenderChart()&&(o.update(t),this._chartIsRefined=e(i)&&i.refined)}_onChartContainerAfterCreate(t){this._chartContainer=t}_onChartContainerRemoved(){this._chartContainer=null}_initializeChart(t){r(this._chartInitTask),this._chartInitTask=a((async e=>{const s=await y({container:t,abortOptions:{signal:e},onRangeChange:(t,e)=>{this._zoomOutButtonVisible=1!==t||1!==e},onCursorPositionChange:t=>{this.viewModel.hoveredChartPosition=t}});if(e.aborted)throw i(s),l();this._chart=s,this._updateChart(this._chartUpdateParams)}))}_destroyChart(){this._chartInitTask=r(this._chartInitTask),this._chart=i(this._chart),this._chartIsRefined=!1}};t([p({type:C})],I.prototype,"viewModel",void 0),t([d("viewModel.view")],I.prototype,"view",void 0),t([d("viewModel.input")],I.prototype,"input",void 0),t([d("viewModel.profiles")],I.prototype,"profiles",void 0),t([d("viewModel.unitOptions")],I.prototype,"unitOptions",void 0),t([d("viewModel.unit")],I.prototype,"unit",void 0),t([d("viewModel.geodesicDistanceThreshold")],I.prototype,"geodesicDistanceThreshold",void 0),t([p({type:v,nonNullable:!0})],I.prototype,"visibleElements",void 0),t([p()],I.prototype,"iconClass",void 0),t([d("messages.widgetLabel",{overridable:!0})],I.prototype,"label",void 0),t([d("viewModel.visible")],I.prototype,"visible",void 0),t([p(),M("esri/widgets/ElevationProfile/t9n/ElevationProfile")],I.prototype,"messages",void 0),t([p(),M("esri/t9n/common")],I.prototype,"messagesCommon",void 0),t([p(),M("esri/core/t9n/Units")],I.prototype,"messagesUnits",void 0),t([p()],I.prototype,"_chartContainer",void 0),t([p()],I.prototype,"_chart",void 0),t([p()],I.prototype,"_chartInitTask",void 0),t([p()],I.prototype,"_chartIsRefined",void 0),t([p()],I.prototype,"_settingsButton",void 0),t([p()],I.prototype,"_legend",void 0),t([p()],I.prototype,"_width",void 0),t([p()],I.prototype,"_portrait",null),t([p()],I.prototype,"_zoomOutButtonVisible",void 0),t([p()],I.prototype,"_chartUpdateParams",null),t([p()],I.prototype,"_chartMessages",null),t([p()],I.prototype,"_legendProps",null),t([p()],I.prototype,"_profilesArray",null),t([p()],I.prototype,"_settingsButtonProps",null),I=t([u("esri.widgets.ElevationProfile")],I);const U=I;export{U 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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{eventKey as t}from"../../core/events.js";import{watch as i,initial as r}from"../../core/reactiveUtils.js";import{aliasOf as a}from"../../core/accessorSupport/decorators/aliasOf.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import n from"../Widget.js";import l from"./FeatureMedia/FeatureMediaViewModel.js";import d from"./support/FeatureElementInfo.js";import{shouldOpenInNewTab as c}from"./support/featureUtils.js";import{loadChartsModule as m,getColorSet as u}from"../support/chartUtils.js";import{isRTL as h}from"../support/widgetUtils.js";import{messageBundle as p}from"../support/decorators/messageBundle.js";import{tsx as f}from"../support/jsxFactory.js";import{isDarkTheme as v}from"../../support/themeUtils.js";const _={base:"esri-feature-media",mediaContainer:"esri-feature-media__container",mediaItemContainer:"esri-feature-media__item-container",mediaItem:"esri-feature-media__item",mediaItemTitle:"esri-feature-media__item-title",mediaItemCaption:"esri-feature-media__item-caption",mediaPrevious:"esri-feature-media__previous",mediaPreviousIconLTR:"esri-feature-media__previous-icon",mediaPreviousIconRTL:"esri-feature-media__previous-icon--rtl",mediaNext:"esri-feature-media__next",mediaNextIconLTR:"esri-feature-media__next-icon",mediaNextIconRTL:"esri-feature-media__next-icon--rtl",mediaChart:"esri-feature-media__chart",mediaButton:"esri-feature-media__button",mediaIcon:"esri-feature-media__icon",iconLeftTriangleArrow:"esri-icon-left-triangle-arrow",iconRightTriangleArrow:"esri-icon-right-triangle-arrow"},I=.05,M=.95,w=15;let g=class extends n{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this.attributes=null,this.activeMediaInfoIndex=null,this.description=null,this.fieldInfoMap=null,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null,this.viewModel=new l,this.messages=null,this._getChartDependencies=async e=>{const t=await m(),{destroyed:i,viewModel:r}=this;if(i||!r||!e)return;const{activeMediaInfo:a}=r;this._renderChart({chartDiv:e,mediaInfo:a,chartsModule:t})}}initialize(){this._featureElementInfo=new d,this.own([i((()=>[this.viewModel?.activeMediaInfo,this.viewModel?.activeMediaInfoIndex]),(()=>this._setupMediaRefreshTimer()),r),i((()=>[this.viewModel?.description,this.viewModel?.title]),(()=>this._setupFeatureElementInfo()),r)])}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo.destroy()}render(){return f("div",{bind:this,class:_.base,onkeyup:this._handleMediaKeyup},this._featureElementInfo?.render(),this.renderMedia())}renderMedia(){const{formattedMediaInfoCount:e}=this.viewModel;return e?f("div",{key:"media-element-container",class:_.mediaContainer},this.renderMediaPageButton("previous"),this.renderMediaInfo(),this.renderMediaPageButton("next")):null}renderImageMediaInfo(e){const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:r}=this.viewModel,{value:a,refreshInterval:o,altText:s,title:n,type:l}=e,{sourceURL:d,linkURL:m}=a,u=c(m)?"_blank":"_self",h="_blank"===u?"noreferrer":"",p=o?t:null,v=p?p.timestamp:0,_=p?p.sourceURL:d,I=f("img",{alt:s||n,key:`media-${l}-${i}-${r}-${v}`,src:_}),M=m?f("a",{title:n,href:m,rel:h,target:u},I):null;return M||I}renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return f("div",{key:`media-${e.type}-${t}-${i}`,bind:this,class:_.mediaChart,afterCreate:this._getChartDependencies})}renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this.renderImageMediaInfo(e):e.type.includes("chart")?this.renderChartMediaInfo(e):null:null}renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e.title?f("div",{key:"media-title",class:_.mediaItemTitle,innerHTML:e.title}):null,i=e.caption?f("div",{key:"media-caption",class:_.mediaItemCaption,innerHTML:e.caption}):null;return f("div",{key:"media-container",class:_.mediaItemContainer},f("div",{key:"media-item-container",class:_.mediaItem},this.renderMediaInfoType()),t,i)}renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,r=t?this.classes(_.mediaButton,_.mediaPrevious):this.classes(_.mediaButton,_.mediaNext),a=t?this.classes(_.mediaIcon,_.mediaPreviousIconLTR,_.iconLeftTriangleArrow):this.classes(_.mediaIcon,_.mediaNextIconLTR,_.iconRightTriangleArrow),o=t?this.classes(_.mediaIcon,_.mediaPreviousIconRTL,_.iconRightTriangleArrow):this.classes(_.mediaIcon,_.mediaNextIconRTL,_.iconLeftTriangleArrow),s=t?"media-previous":"media-next",n=t?this._previous:this._next;return f("button",{type:"button",key:s,title:i,"aria-label":i,tabIndex:0,class:r,bind:this,onclick:n},f("span",{"aria-hidden":"true",class:a}),f("span",{"aria-hidden":"true",class:o}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_handleMediaKeyup(e){const i=t(e);"ArrowLeft"===i&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===i&&(e.stopPropagation(),this.viewModel.next())}_renderChart(e){const{abilities:t}=this.viewModel,{chartsModule:i,chartDiv:r,mediaInfo:a}=e,{value:o,type:s}=a,{am4core:n}=i,l=u(n);function d(e){e instanceof n.ColorSet&&l&&(e.list=l)}v()&&n.useTheme(i.am4themes_dark);const c=window.matchMedia("(prefers-reduced-motion: reduce)");t.chartAnimation&&!c.matches?n.useTheme(i.am4themes_animated):n.unuseTheme(i.am4themes_animated),n.useTheme(d);const m="pie-chart"===s?this._createPieChart(e):this._createXYChart(e);r.setAttribute("aria-label",a.altText||a.title),m.data=o.series.map((e=>({tooltip:e.tooltip,value:e.value}))).filter((e=>"pie-chart"!==s||e.value>0))}_customizeChartTooltip(e,t){e.label.wrap=!0,e.label.maxWidth=200,e.autoTextColor=!1,e.getFillFromObject=!1,e.label.fill=t.color("#ffffff"),e.background.fill=t.color({r:0,g:0,b:0,a:.7})}_createPieChart(e){const{chartDiv:t,chartsModule:i}=e,{am4core:r,am4charts:a}=i,o=r.create(t,a.PieChart);o.rtl=h(this.container);const s=o.series.push(new a.PieSeries);return s.labels.template.disabled=!0,s.ticks.template.disabled=!0,s.dataFields.value="value",s.dataFields.category="tooltip",this._customizeChartTooltip(s.tooltip,r),s.slices.template.tooltipText=o.rtl?"{category}: %{value.percent.formatNumber('#.0')}":"{category}: {value.percent.formatNumber('#.0')}%",o}_getMinSeriesValue(e){let t=0;return e.forEach((e=>t=Math.min(e.value,t))),t}_createColumnChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=I,l.renderer.maxLabelPosition=M,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueY="value",c.dataFields.categoryX="tooltip",e.cursor=new s.XYCursor,a.series.length>w&&(e.scrollbarX=new o.Scrollbar)}_createBarChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.yAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.inversed=!0,n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dx=n.tooltip.contentWidth}));const l=e.xAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=I,l.renderer.maxLabelPosition=M,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueX="value",c.dataFields.categoryY="tooltip",e.cursor=new s.XYCursor,a.series.length>w&&(e.scrollbarY=new o.Scrollbar)}_createLineChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category="tooltip",n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=I,l.renderer.maxLabelPosition=M,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.LineSeries);c.dataFields.categoryX="tooltip",c.dataFields.valueY="value",e.cursor=new s.XYCursor,a.series.length>w&&(e.scrollbarX=new o.Scrollbar)}_createXYChart(e){const{chartDiv:t,chartsModule:i,mediaInfo:r}=e,{type:a}=r,{am4core:o,am4charts:s}=i,n=o.create(t,s.XYChart);return n.rtl=h(this.container),"column-chart"===a&&this._createColumnChart(n,e),"bar-chart"===a&&this._createBarChart(n,e),"line-chart"===a&&this._createLineChart(n,e),n}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:this._getImageSource(e,t)},this.scheduleRender()}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;e&&"image"===e.type&&e.refreshInterval&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e;if(!t)return;const r=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const a=setInterval((()=>{this._updateMediaInfoTimestamp(i.sourceURL)}),r);this._refreshTimer=a}_getImageSource(e,t){const i=e.includes("?")?"&":"?",[r,a=""]=e.split("#");return`${r}${i}timestamp=${t}${a?"#":""}${a}`}};e([a("viewModel.attributes")],g.prototype,"attributes",void 0),e([a("viewModel.activeMediaInfoIndex")],g.prototype,"activeMediaInfoIndex",void 0),e([a("viewModel.description")],g.prototype,"description",void 0),e([a("viewModel.fieldInfoMap")],g.prototype,"fieldInfoMap",void 0),e([a("viewModel.layer")],g.prototype,"layer",void 0),e([a("viewModel.mediaInfos")],g.prototype,"mediaInfos",void 0),e([a("viewModel.popupTemplate")],g.prototype,"popupTemplate",void 0),e([a("viewModel.relatedInfos")],g.prototype,"relatedInfos",void 0),e([a("viewModel.title")],g.prototype,"title",void 0),e([o({type:l})],g.prototype,"viewModel",void 0),e([o(),p("esri/widgets/Feature/t9n/Feature")],g.prototype,"messages",void 0),g=e([s("esri.widgets.Feature.FeatureMedia")],g);const y=g;export{y as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{eventKey as t}from"../../core/events.js";import{watch as i,initial as r}from"../../core/reactiveUtils.js";import{aliasOf as a}from"../../core/accessorSupport/decorators/aliasOf.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{getColorsFromRenderer as n}from"../../renderers/support/utils.js";import l from"../Widget.js";import d from"./FeatureMedia/FeatureMediaViewModel.js";import c from"./support/FeatureElementInfo.js";import{shouldOpenInNewTab as m}from"./support/featureUtils.js";import{loadChartsModule as u,getColorSet as p}from"../support/chartUtils.js";import{isRTL as h}from"../support/widgetUtils.js";import{messageBundle as f}from"../support/decorators/messageBundle.js";import{tsx as v}from"../support/jsxFactory.js";import{isDarkTheme as _}from"../../support/themeUtils.js";const M={base:"esri-feature-media",mediaContainer:"esri-feature-media__container",mediaItemContainer:"esri-feature-media__item-container",mediaItem:"esri-feature-media__item",mediaItemTitle:"esri-feature-media__item-title",mediaItemCaption:"esri-feature-media__item-caption",mediaPrevious:"esri-feature-media__previous",mediaPreviousIconLTR:"esri-feature-media__previous-icon",mediaPreviousIconRTL:"esri-feature-media__previous-icon--rtl",mediaNext:"esri-feature-media__next",mediaNextIconLTR:"esri-feature-media__next-icon",mediaNextIconRTL:"esri-feature-media__next-icon--rtl",mediaChart:"esri-feature-media__chart",mediaButton:"esri-feature-media__button",mediaIcon:"esri-feature-media__icon",iconLeftTriangleArrow:"esri-icon-left-triangle-arrow",iconRightTriangleArrow:"esri-icon-right-triangle-arrow"},I=.05,y=.95,w=15,g="color",T="tooltip",C="value",b="default";let x=class extends l{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this.attributes=null,this.activeMediaInfoIndex=null,this.description=null,this.fieldInfoMap=null,this.layer=null,this.mediaInfos=null,this.popupTemplate=null,this.relatedInfos=null,this.title=null,this.viewModel=new d,this.messages=null,this._getChartDependencies=async e=>{const t=await u(),{destroyed:i,viewModel:r}=this;if(i||!r||!e)return;const{activeMediaInfo:a}=r,o=await this._getRendererColors(t);this._renderChart({chartDiv:e,mediaInfo:a,chartsModule:t,colorMap:o})}}initialize(){this._featureElementInfo=new c,this.own([i((()=>[this.viewModel?.activeMediaInfo,this.viewModel?.activeMediaInfoIndex]),(()=>this._setupMediaRefreshTimer()),r),i((()=>[this.viewModel?.description,this.viewModel?.title]),(()=>this._setupFeatureElementInfo()),r)])}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo.destroy()}render(){return v("div",{bind:this,class:M.base,onkeyup:this._handleMediaKeyup},this._featureElementInfo?.render(),this.renderMedia())}renderMedia(){const{formattedMediaInfoCount:e}=this.viewModel;return e?v("div",{key:"media-element-container",class:M.mediaContainer},this.renderMediaPageButton("previous"),this.renderMediaInfo(),this.renderMediaPageButton("next")):null}renderImageMediaInfo(e){const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:r}=this.viewModel,{value:a,refreshInterval:o,altText:s,title:n,type:l}=e,{sourceURL:d,linkURL:c}=a,u=m(c)?"_blank":"_self",p="_blank"===u?"noreferrer":"",h=o?t:null,f=h?h.timestamp:0,_=h?h.sourceURL:d,M=v("img",{alt:s||n,key:`media-${l}-${i}-${r}-${f}`,src:_}),I=c?v("a",{title:n,href:c,rel:p,target:u},M):null;return I||M}renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return v("div",{key:`media-${e.type}-${t}-${i}`,bind:this,class:M.mediaChart,afterCreate:this._getChartDependencies})}renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this.renderImageMediaInfo(e):e.type.includes("chart")?this.renderChartMediaInfo(e):null:null}renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e.title?v("div",{key:"media-title",class:M.mediaItemTitle,innerHTML:e.title}):null,i=e.caption?v("div",{key:"media-caption",class:M.mediaItemCaption,innerHTML:e.caption}):null;return v("div",{key:"media-container",class:M.mediaItemContainer},v("div",{key:"media-item-container",class:M.mediaItem},this.renderMediaInfoType()),t,i)}renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,r=t?this.classes(M.mediaButton,M.mediaPrevious):this.classes(M.mediaButton,M.mediaNext),a=t?this.classes(M.mediaIcon,M.mediaPreviousIconLTR,M.iconLeftTriangleArrow):this.classes(M.mediaIcon,M.mediaNextIconLTR,M.iconRightTriangleArrow),o=t?this.classes(M.mediaIcon,M.mediaPreviousIconRTL,M.iconRightTriangleArrow):this.classes(M.mediaIcon,M.mediaNextIconRTL,M.iconLeftTriangleArrow),s=t?"media-previous":"media-next",n=t?this._previous:this._next;return v("button",{type:"button",key:s,title:i,"aria-label":i,tabIndex:0,class:r,bind:this,onclick:n},v("span",{"aria-hidden":"true",class:a}),v("span",{"aria-hidden":"true",class:o}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}async _getRendererColors(e){const{am4core:t}=e,i=this.viewModel?.layer,r=new Map;if(!i)return r;const a=await n(i.renderer);return Array.from(a.values()).every((e=>1===e?.length))?(Array.from(a.keys()).forEach((e=>{r.set(e||b,t.color(a.get(e)[0].toCss(!0)))})),r):r}_handleMediaKeyup(e){const i=t(e);"ArrowLeft"===i&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===i&&(e.stopPropagation(),this.viewModel.next())}_renderChart(e){const{abilities:t}=this.viewModel,{chartsModule:i,chartDiv:r,mediaInfo:a,colorMap:o}=e,{value:s,type:n}=a,{am4core:l}=i,d=p(l);function c(e){e instanceof l.ColorSet&&d&&(e.list=d)}_()&&l.useTheme(i.am4themes_dark);const m=window.matchMedia("(prefers-reduced-motion: reduce)");t.chartAnimation&&!m.matches?l.useTheme(i.am4themes_animated):l.unuseTheme(i.am4themes_animated),l.useTheme(c);const u="pie-chart"===n?this._createPieChart(e):this._createXYChart(e);r.setAttribute("aria-label",a.altText||a.title),u.data=s.series.map(((e,t)=>({[T]:e.tooltip,[C]:e.value,[g]:o.get(s.fields[t]||b)}))).filter((e=>"pie-chart"!==n||e.value>0))}_customizeChartTooltip(e,t){e.label.wrap=!0,e.label.maxWidth=200,e.autoTextColor=!1,e.getFillFromObject=!1,e.label.fill=t.color("#ffffff"),e.background.fill=t.color({r:0,g:0,b:0,a:.7})}_createPieChart(e){const{chartDiv:t,chartsModule:i}=e,{am4core:r,am4charts:a}=i,o=r.create(t,a.PieChart);o.rtl=h(this.container);const s=o.series.push(new a.PieSeries);return s.labels.template.disabled=!0,s.ticks.template.disabled=!0,s.dataFields.value=C,s.dataFields.category=T,this._customizeChartTooltip(s.tooltip,r),s.slices.template.tooltipText=o.rtl?"{category}: %{value.percent.formatNumber('#.0')}":"{category}: {value.percent.formatNumber('#.0')}%",s.slices.template.propertyFields.fill=g,s.slices.template.propertyFields.stroke=g,o}_getMinSeriesValue(e){let t=0;return e.forEach((e=>t=Math.min(e.value,t))),t}_createColumnChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category=T,n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=I,l.renderer.maxLabelPosition=y,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueY=C,c.dataFields.categoryX=T,c.columns.template.propertyFields.fill=g,c.columns.template.propertyFields.stroke=g,e.cursor=new s.XYCursor,a.series.length>w&&(e.scrollbarX=new o.Scrollbar)}_createBarChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.yAxes.push(new s.CategoryAxis);n.dataFields.category=T,n.renderer.inversed=!0,n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dx=n.tooltip.contentWidth}));const l=e.xAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=I,l.renderer.maxLabelPosition=y,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.ColumnSeries);c.dataFields.valueX=C,c.dataFields.categoryY=T,c.columns.template.propertyFields.fill=g,c.columns.template.propertyFields.stroke=g,e.cursor=new s.XYCursor,a.series.length>w&&(e.scrollbarY=new o.Scrollbar)}_createLineChart(e,t){const{chartsModule:i,mediaInfo:r}=t,{value:a}=r,{am4core:o,am4charts:s}=i,n=e.xAxes.push(new s.CategoryAxis);n.dataFields.category=T,n.renderer.labels.template.disabled=!0,this._customizeChartTooltip(n.tooltip,o),n.tooltip.events.on("sizechanged",(()=>{n.tooltip.dy=-n.tooltip.contentHeight}));const l=e.yAxes.push(new s.ValueAxis),d=l.renderer.labels.template;l.renderer.minLabelPosition=I,l.renderer.maxLabelPosition=y,l.min=this._getMinSeriesValue(a.series),this._customizeChartTooltip(l.tooltip,o),d.wrap=!0;const c=e.series.push(new s.LineSeries);c.fillOpacity=.3,c.strokeWidth=2,c.dataFields.categoryX=T,c.dataFields.valueY=C,c.propertyFields.fill=g,c.propertyFields.stroke=g,e.cursor=new s.XYCursor,a.series.length>w&&(e.scrollbarX=new o.Scrollbar)}_createXYChart(e){const{chartDiv:t,chartsModule:i,mediaInfo:r}=e,{type:a}=r,{am4core:o,am4charts:s}=i,n=o.create(t,s.XYChart);return n.rtl=h(this.container),"column-chart"===a&&this._createColumnChart(n,e),"bar-chart"===a&&this._createBarChart(n,e),"line-chart"===a&&this._createLineChart(n,e),n}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:this._getImageSource(e,t)},this.scheduleRender()}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;e&&"image"===e.type&&e.refreshInterval&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e;if(!t)return;const r=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const a=setInterval((()=>{this._updateMediaInfoTimestamp(i.sourceURL)}),r);this._refreshTimer=a}_getImageSource(e,t){const i=e.includes("?")?"&":"?",[r,a=""]=e.split("#");return`${r}${i}timestamp=${t}${a?"#":""}${a}`}};e([a("viewModel.attributes")],x.prototype,"attributes",void 0),e([a("viewModel.activeMediaInfoIndex")],x.prototype,"activeMediaInfoIndex",void 0),e([a("viewModel.description")],x.prototype,"description",void 0),e([a("viewModel.fieldInfoMap")],x.prototype,"fieldInfoMap",void 0),e([a("viewModel.layer")],x.prototype,"layer",void 0),e([a("viewModel.mediaInfos")],x.prototype,"mediaInfos",void 0),e([a("viewModel.popupTemplate")],x.prototype,"popupTemplate",void 0),e([a("viewModel.relatedInfos")],x.prototype,"relatedInfos",void 0),e([a("viewModel.title")],x.prototype,"title",void 0),e([o({type:d})],x.prototype,"viewModel",void 0),e([o(),f("esri/widgets/Feature/t9n/Feature")],x.prototype,"messages",void 0),x=e([s("esri.widgets.Feature.FeatureMedia")],x);const F=x;export{F 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.24/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 i from"../../core/Evented.js";import{HandleOwnerMixin as n}from"../../core/HandleOwner.js";import s from"../../core/Logger.js";import{destroyMaybe as o,isNone as r,isSome as l}from"../../core/maybe.js";import{EsriPromiseMixin as a}from"../../core/Promise.js";import{watch as u}from"../../core/reactiveUtils.js";import{ReentrantObjectPool as c}from"../../core/ReentrantObjectPool.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../form/FormTemplate.js";import f from"../../layers/support/ContingentValue.js";import m from"../../layers/support/LayerContingentValuesCache.js";import{loadArcade as g}from"../../support/arcadeOnDemand.js";import y from"./InputField.js";import _ from"./InputFieldGroup.js";import{onLocaleChange as F}from"../../intl/locale.js";import{fetchMessageBundle as C}from"../../intl/messages.js";function v(e){return!!e.inputFields}const I=new t({attributes:{}}),E="esri.widgets.FeatureForm.FeatureFormViewModel",V=s.getLogger(E),b="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",j="#JSAPI_CONTINGENT_VALUE_ANY_HASH",A="#JSAPI_CONTINGENT_VALUE_NULL_HASH";let x=class extends(n(a(i.EventedAccessor))){constructor(e){super(e),this._arcade=null,this._compiledExpressionLookup=new Map,this._expressionLookup=new Map,this._contingentValuesCache=null,this._fieldPool=new c(y,(e=>this.handles.add(u((()=>e.value),(()=>{e.isUsingValueExpression&&this._afterValueChange(e)})),e.id)),(({id:e})=>this.handles.remove(e))),this._fieldGroupPool=new c(_),this._featureClone=I.clone(),this._initialFeature=I.clone(),this._needsArcade=!1,this._inputFieldCache=new Map,this._inputFieldGroupCache=new Map,this.contingencyConstraintViolations=new Map,this.messages=null,this.strict=!1}initialize(){const e=async()=>this.messages=await C("esri/widgets/FeatureForm/t9n/FeatureForm");e();const t=u((()=>this.layer),(e=>{"feature"===e?.type&&this.addResolvingPromise(m.createLoadedLayerContingentValuesCache(e).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0}),i=u((()=>{const{formTemplate:e}=this;if(r(e))return null;const t=e.expressionInfos??[],i=e.elements??[];return[...t.map((e=>e.expression)),...i?.map((e=>this._getExpressionsFromElementRecursive(e))).flat()]}),(async e=>{if(!e||e.length<1)return this._compiledExpressionLookup.clear(),void this._expressionLookup.clear();const{_compiledExpressionLookup:t,_expressionLookup:n,formTemplate:s}=this,o=new Set(e);if(n.clear(),l(s)&&l(s.expressionInfos))for(const i of s.expressionInfos)o.delete(i.name),n.set(i.name,i.expression);for(const i of t.keys())o.delete(i),n.set(i,i);if(o.size<1)return;this._needsArcade=!0;const r=await g();this._arcade=r;const{arcadeUtils:a}=r;for(const l of o.values())a.hasGeometryOperations(l)&&(await a.enableGeometryOperations(),i.remove()),n.set(l,l),this._setFunctionForExpression(l);this.notifyChange("inputFields")}),{initial:!0});this.handles.add([F(e),i,t])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this._fieldPool.destroy(),this._fieldGroupPool.destroy()}get allInputFields(){return this.inputFields.reduce(((e,t)=>v(t)?[...e,...t.inputFields]:[...e,t]),[])}get _layerFieldsByName(){return new Map(this.layer.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){this._featureClone=e?e.clone():I.clone(),this._initialFeature=this._featureClone.clone(),this._inputFieldCache.clear(),this._inputFieldGroupCache.clear(),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(r(this._contingentValuesCache))return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get inputFields(){const{_arcade:e,_featureClone:t,_initialFeature:i,_inputFieldCache:n,_inputFieldGroupCache:s,_needsArcade:o,formTemplate:r,messages:a,layer:u,state:c}=this;if("ready"!==c||o&&!e)return[];const p=t.clone(),d=Array.from(n.keys()),h=Array.from(s.keys()),f={arcade:e,feature:p,initialFeature:i,layer:u,messages:a},m=l(r)&&r.elements.length>0?this._generateInputFieldsFromElements(r.elements,f):this._generateInputFieldsFromLayerFields(u?.fields,f);return this._cullCaches(m,d,h),this._releasePreviousInputFields(),m.filter((e=>e.visible))}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){e?this._override("layer",e):this._clearOverride("layer")}get state(){return this.messages&&this.get("layer.loaded")?"ready":"disabled"}get submittable(){return!!this.valid||this.allInputFields.filter((e=>!e.valid)).every((({submittable:e})=>e))}get valid(){const e=this.allInputFields;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allInputFields.find((t=>t.name===e))}getValue(e){const{_featureClone:t,layer:i}=this,n=!!i?.getField(e);return t.getAttribute(e)??(n?null:void 0)}setValue(e,t){const{_featureClone:i,strict:n}=this,s=this.findField(e);t=""===t?null:t,s&&i.getAttribute(e)!==t&&(s.value=t,n&&!s.valid||this._afterValueChange(s))}getValues(){return{...this._featureClone.attributes}}submit(){const e=this.allInputFields,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),i=e.filter((e=>!e.valid)).map((({name:e})=>e)),n=this.getValues();if(this.validateContingencyConstraints(n,{includeIncompleteViolations:!0}).length>0)for(const[s,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(s),i.push(s));this.emit("submit",{valid:[...t],invalid:i,values:n})}validateContingencyConstraints(e,t){const{_contingentValuesCache:i}=this,n=new Map;if(this.contingencyConstraintViolations=n,r(i))return[];const{invalid:s,incomplete:o}=i.validateContingencyConstraints(e),l=[...s,...t?.includeIncompleteViolations?o:[]];for(const r of l)for(const e of r.fieldGroup.fields)n.set(e,r);return l}_cullCaches(e,t,i){const n=[],s=[];for(const o of e)v(o)?(s.push(o.label),n.push(...o.inputFields.map((e=>e.name)))):n.push(o.name);this._cullInputFieldCache(n,t),this._cullInputFieldGroupCache(s,i)}_cullInputFieldCache(e,t){const i=t.filter((t=>!e.includes(t)));for(const n in i)this._inputFieldCache.delete(n)}_cullInputFieldGroupCache(e,t){const i=t.filter((t=>!e.includes(t)));for(const n in i)this._inputFieldGroupCache.delete(n)}_releasePreviousInputFields(){const e=this._get("inputFields");if(e&&!(e.length<1))for(const t of e)"groupElement"in t?this._releaseInputFieldGroup(t):this._releaseInputField(t)}_releaseInputFieldGroup(e){e.inputFields.forEach((e=>this._releaseInputField(e))),this._fieldGroupPool.release(e)}_releaseInputField(e){this._fieldPool.release(e)}_emitChangeEvent({name:e,valid:t,value:i}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:i,valid:t})}_generateInputFieldsFromElements(e,t){const i=[];for(const n of e)this._isSupportedElement(n)&&i.push("group"===n.type?this._acquireAndInitializeInputFieldGroup(n,t):this._acquireAndInitializeInputField({field:this._layerFieldsByName.get(n.fieldName),fieldElement:n,...t}));return i}_generateInputFieldsFromLayerFields(e,t){return Array.isArray(e)?e.map((e=>this._acquireAndInitializeInputField({field:e,fieldElement:null,...t}))):(V.warn(E,"No attribute fields found."),[])}_acquireAndInitializeInputField(e){const{arcade:t,feature:i,field:n,fieldElement:s,group:o,initialFeature:r,layer:l,messages:a}=e,u=this._getCompiledExpression(s?.requiredExpression)??void 0,c=this._getCompiledExpression(s?.visibilityExpression)??void 0,p=this._getCompiledExpression(s?.valueExpression)??void 0,d=this._getCompiledExpression(s?.editableExpression)??void 0,h=n.name,f=this._inputFieldCache.get(h)?.value??this.getValue(h),m=this._fieldPool.acquire();return this._inputFieldCache.set(h,m),m.set({field:n,fieldElement:s,arcade:t,feature:i,group:o,initialFeature:r,layer:l,messages:a,requiredFunction:u,visibilityFunction:c,editableFunction:d,valueFunction:p,value:f})}_acquireAndInitializeInputFieldGroup(e,t){const i=this._inputFieldGroupCache.get(e.label)?.state??e.initialState,n=this._fieldGroupPool.acquire();this._inputFieldGroupCache.set(e.label,n);const s=[];for(const a of e.elements)this._isSupportedElement(a)&&s.push(this._acquireAndInitializeInputField({field:this._layerFieldsByName.get(a.fieldName),fieldElement:a,group:n,...t}));const{arcade:o,feature:r}=t,l=this._getCompiledExpression(e.visibilityExpression);return n.set({arcade:o,feature:r,groupElement:e,inputFields:s,state:i,visibilityFunction:l})}_afterValueChange(e){const{name:t,value:i}=e;if(this.get("layer.typeIdField")===e.name&&"types"in this.layer){const e=new Set;this.layer.types.forEach((t=>Object.keys(t.domains).forEach((t=>e.add(t))))),e.forEach((e=>{const t=this.findField(e);t&&t.notifyChange("domain")}))}this._featureClone.setAttribute(t,i),this.notifyChange("inputFields"),this._emitChangeEvent(e)}_getCompiledExpression(e){return this._compiledExpressionLookup.get(this._expressionLookup.get(e))}_getExpressionsFromElementRecursive(e){const t=[];if(e.visibilityExpression&&t.push(e.visibilityExpression),"field"===e.type){const i=["requiredExpression","valueExpression","editableExpression"];for(const n of i)e[n]&&t.push(e[n])}if("group"===e.type&&e.elements)for(const i of e.elements)t.push(...this._getExpressionsFromElementRecursive(i));return t}_setFunctionForExpression(e){const{_arcade:{arcadeUtils:t},_compiledExpressionLookup:i}=this;i.set(e,t.createFunction(e))}_isSupportedElement(e){return"field"===e.type||"group"===e.type||(V.warn("form-info::unsupported-element-type","Only element types 'field' and 'group' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}_joinContingentValues(){const e=this._contingentValuesCache;if(r(e))return[];const t="typeIdField"in this.layer?this.layer.typeIdField:null,i=t?this.getValue(t):null,n=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:s}=r,o=[];for(const n of e)n.isRetired||l(n.subtype)&&n.subtype.code!==i||o.push({values:n.values});o.length>0&&n.push({name:s,fields:t,contingencies:o})}const[s,o]=this._generateJoinPlan(n);return[...s.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,i=[],n=new Set;for(const a of e)for(const e of a.fields)if(t.has(e)){const s=t.get(e),o=a,r=[s.name,o.name].sort().join("|");if(n.has(r))continue;i.push([s,o]),n.add(r),t.set(e,o)}else t.set(e,a);const s=new Set(i.flat()),o=new Set(e);for(const a of s)o.delete(a);const r=new Map,l=new Map;for(const a of new Set(i.flat())){const e=Symbol(a.name);r.set(e,new Set([a])),l.set(a,e)}for(const[a,u]of i){const e=l.get(a),t=l.get(u);if(e===t)continue;const i=r.get(e),n=r.get(t);for(const s of n)i.add(s),l.set(s,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),i=t.shift();let n=t.shift(),s=this._generateJoinKey(i.fields,n.fields),o=new Set([...i.fields,...n.fields]),a=new Map;for(const r of i.contingencies){const[e]=this._hashContingency(r,s.codedValueFields,!0);a.has(e)?a.get(e).push(r):a.set(e,[r])}for(;t.length>0;){const e=new Map,i=t.shift(),l=this._generateJoinKey(o,i.fields);for(const t of n.contingencies){const[i,n]=this._hashContingency(t,s.codedValueFields),o=n?this._findMatchingContingenciesWithAnyHashMask(a,i):a.get(i);if(a.has(j)&&o.push(...this._findMatchingContingenciesContainingAny(t,a.get(j),s.codedValueFields)),!r(o))for(const a of o){const i=s.rangeFields.length>0?this._joinContingenciesWithRangeDomains(a,t,s.rangeFields):this._joinContingencies(a,t);if(r(i))break;const[n]=this._hashContingency(i,l.codedValueFields,!0);e.has(n)?e.get(n).push(i):e.set(n,[i])}}a=e,n=i,s=l,o=new Set([...o,...n.fields])}const u=[];for(const c of n.contingencies){const[e,t]=this._hashContingency(c,s.codedValueFields),i=t?this._findMatchingContingenciesWithAnyHashMask(a,e):a.get(e);if(a.has(j)&&i.push(...this._findMatchingContingenciesContainingAny(c,a.get(j),s.codedValueFields)),!r(i))for(const n of i){const e=s.rangeFields.length>0?this._joinContingenciesWithRangeDomains(n,c,s.rangeFields):this._joinContingencies(n,c);l(e)&&u.push(e)}}return u}_joinContingencies(e,t){const i={values:{...e.values,...t.values}};for(const[n,s]of Object.entries(i.values))"any"===s.objectType&&l(e.values[n])&&(i.values[n]=e.values[n]);return i}_joinContingenciesWithRangeDomains(e,t,i){const n=this._joinContingencies(e,t);for(const s of i){const i=e.values[s],o=t.values[s],{leftIsNull:r,rightIsNull:l,bothAreNull:a,leftIsAny:u,rightIsAny:c,bothAreAny:p,leftIsRange:d,rightIsRange:h}=this._compareObjectTypes(i.objectType,o.objectType);if(a||p)continue;if(r&&c||l&&u){n.values[s]=new f({objectType:"null"});continue}if(r&&h||l&&d)return null;u?(i.minValue=-1/0,i.maxValue=1/0):c&&(o.minValue=-1/0,o.maxValue=1/0);const m=Math.max(i.minValue,o.minValue),g=Math.min(i.maxValue,o.maxValue);if(m>g)return null;n.values[s]=new f({objectType:"range",minValue:m,maxValue:g})}return n}_findMatchingContingenciesContainingAny(e,t,i){return t.filter((t=>i.every((i=>{const n=t.values[i],s=e.values[i];return"any"===n.objectType||"any"===s.objectType||n.codedValue?.code===s.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const i=RegExp(`${t}$`),n=[];for(const[s,o]of e){if(s===j)break;i.test(s)&&n.push(...o)}return n}_generateJoinKey(e,t){const i=Array.isArray(e)?new Set(e):e,n=Array.isArray(t)?new Set(t):t,s=i.size<n.size?i:n,o=s===i?n:i,l=new Set,a=new Set;for(const u of s)if(o.has(u)){const e=this.layer.getFieldDomain(u,{feature:this.feature});if(r(e))continue;switch(e.type){case"coded-value":l.add(u);break;case"range":a.add(u)}}return{codedValueFields:[...l],rangeFields:[...a]}}_hashContingency(e,t,i=!1){if(t.length<1)return[b,!1];const n=[];let s=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(i)return[j,!0];s=!0,n.push(`${o}:.*`)}else"null"===t.objectType?n.push(`${o}:${A}`):n.push(`${o}:${t.codedValue?.code}`)}return[n.sort().join("&"),s]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}};e([p({readOnly:!0})],x.prototype,"allInputFields",null),e([p()],x.prototype,"_layerFieldsByName",null),e([p({readOnly:!0})],x.prototype,"_inputFieldCache",void 0),e([p({readOnly:!0})],x.prototype,"_inputFieldGroupCache",void 0),e([p()],x.prototype,"contingencyConstraintViolations",void 0),e([p()],x.prototype,"feature",null),e([p()],x.prototype,"fieldsWithContingentValues",null),e([p({type:h})],x.prototype,"formTemplate",null),e([p({readOnly:!0,dependsOn:["formTemplate","messages","feature","layer.fields","layer.loaded","state"]})],x.prototype,"inputFields",null),e([p()],x.prototype,"joinedContingentValues",null),e([p()],x.prototype,"layer",null),e([p()],x.prototype,"messages",void 0),e([p()],x.prototype,"state",null),e([p()],x.prototype,"strict",void 0),e([p()],x.prototype,"submittable",null),e([p()],x.prototype,"valid",null),e([p()],x.prototype,"getValues",null),e([p()],x.prototype,"submit",null),x=e([d(E)],x);const w=x;export{w as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import"../../intl.js";import i from"../../core/Evented.js";import{HandleOwnerMixin as n}from"../../core/HandleOwner.js";import s from"../../core/Logger.js";import{destroyMaybe as o,isNone as r,isSome as l}from"../../core/maybe.js";import{EsriPromiseMixin as a}from"../../core/Promise.js";import{watch as u}from"../../core/reactiveUtils.js";import{ReentrantObjectPool as c}from"../../core/ReentrantObjectPool.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import h from"../../form/FormTemplate.js";import f from"../../layers/support/ContingentValue.js";import m from"../../layers/support/LayerContingentValuesCache.js";import{loadArcade as g}from"../../support/arcadeOnDemand.js";import y from"./InputField.js";import _ from"./InputFieldGroup.js";import{onLocaleChange as F}from"../../intl/locale.js";import{fetchMessageBundle as C}from"../../intl/messages.js";const v=new t({attributes:{}}),E="esri.widgets.FeatureForm.FeatureFormViewModel",b=s.getLogger(E),V=["editable","required","value","visibility"],I="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",j="#JSAPI_CONTINGENT_VALUE_ANY_HASH",w="#JSAPI_CONTINGENT_VALUE_NULL_HASH";let A=class extends(n(a(i.EventedAccessor))){constructor(e){super(e),this._arcade=null,this._compiledExpressionLookup=new Map,this._expressionLookup=new Map,this._contingentValuesCache=null,this._fieldPool=new c(y,(e=>this.handles.add(u((()=>e.value),(()=>{e.isUsingValueExpression&&this._afterValueChange(e)})),e.id)),(({id:e})=>this.handles.remove(e))),this._fieldGroupPool=new c(_),this._featureClone=v.clone(),this._initialFeature=v.clone(),this._needsArcade=!1,this._arcadeGeometryOperationsEnabled=!1,this._inputFieldCache=new Map,this._inputFieldGroupCache=new Map,this.contingencyConstraintViolations=new Map,this.messages=null,this.strict=!1}initialize(){const e=async()=>this.messages=await C("esri/widgets/FeatureForm/t9n/FeatureForm");e();const t=u((()=>this.layer),(e=>{"feature"===e?.type&&this.addResolvingPromise(m.createLoadedLayerContingentValuesCache(e).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.handles.add([F(e),t])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this._fieldPool.destroy(),this._fieldGroupPool.destroy()}get allInputFields(){return this.inputFields.reduce(((e,t)=>x(t)?[...e,...t.inputFields]:[...e,t]),[])}get _layerFieldsByName(){return new Map(this.layer.fields.map((e=>[e.name,e])))}get feature(){return this._get("feature")}set feature(e){this._featureClone=e?e.clone():v.clone(),this._initialFeature=this._featureClone.clone(),this._inputFieldCache.clear(),this._inputFieldGroupCache.clear(),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(r(this._contingentValuesCache))return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get formTemplate(){return this.layer&&"formTemplate"in this.layer?this.layer.formTemplate:null}set formTemplate(e){void 0===e?this._clearOverride("formTemplate"):this._override("formTemplate",e)}get inputFields(){const{_arcade:e,_featureClone:t,_initialFeature:i,_inputFieldCache:n,_inputFieldGroupCache:s,_needsArcade:o,formTemplate:r,messages:a,layer:u,state:c}=this;if("ready"!==c||o&&!e)return[];const d=t.clone(),p=Array.from(n.keys()),h=Array.from(s.keys()),f=this._get("inputFields")??[],m={arcade:e,feature:d,initialFeature:i,layer:u,messages:a},g=l(r)&&r.elements.length>0?this._updateInputFieldsFromElements(f,r.elements,m):this._updateInputFieldsFromLayerFields(f,u?.fields,m);return this._cullCaches(g,p,h),this._releasePreviousInputFields(),g}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){e?this._override("layer",e):this._clearOverride("layer")}get state(){return this.messages&&this.get("layer.loaded")?"ready":"disabled"}get submittable(){return!!this.valid||this.allInputFields.filter((e=>!e.valid)).every((({submittable:e})=>e))}get valid(){const e=this.allInputFields;return e.length>0&&e.every((({valid:e})=>e))}findField(e){return this.allInputFields.find((t=>t.name===e))}getValue(e){const{_featureClone:t,layer:i}=this,n=!!i?.getField(e);return t.getAttribute(e)??(n?null:void 0)}setValue(e,t){const{_featureClone:i,strict:n}=this,s=this.findField(e);t=""===t?null:t,s&&i.getAttribute(e)!==t&&(s.value=t,n&&!s.valid||this._afterValueChange(s))}getValues(){return{...this._featureClone.attributes}}submit(){const e=this.allInputFields,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),i=e.filter((e=>!e.valid)).map((({name:e})=>e)),n=this.getValues();if(this.validateContingencyConstraints(n,{includeIncompleteViolations:!0}).length>0)for(const[s,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(s),i.push(s));this.emit("submit",{valid:[...t],invalid:i,values:n})}validateContingencyConstraints(e,t){const{_contingentValuesCache:i}=this,n=new Map;if(this.contingencyConstraintViolations=n,r(i))return[];const{invalid:s,incomplete:o}=i.validateContingencyConstraints(e),l=[...s,...t?.includeIncompleteViolations?o:[]];for(const r of l)for(const e of r.fieldGroup.fields)n.set(e,r);return l}_cullCaches(e,t,i){const n=[],s=[];for(const o of e)x(o)?(s.push(o.label),n.push(...o.inputFields.map((e=>e.name)))):n.push(o.name);this._cullInputFieldCache(n,t),this._cullInputFieldGroupCache(s,i)}_cullInputFieldCache(e,t){const i=t.filter((t=>!e.includes(t)));for(const n in i)this._inputFieldCache.delete(n)}_cullInputFieldGroupCache(e,t){const i=t.filter((t=>!e.includes(t)));for(const n in i)this._inputFieldGroupCache.delete(n)}_releasePreviousInputFields(){const e=this._get("inputFields");if(e&&!(e.length<1))for(const t of e)"groupElement"in t?this._releaseInputFieldGroup(t):this._releaseInputField(t)}_releaseInputFieldGroup(e){e.inputFields.forEach((e=>this._releaseInputField(e))),this._fieldGroupPool.release(e)}_releaseInputField(e){this._fieldPool.release(e)}_emitChangeEvent({name:e,valid:t,value:i}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:i,valid:t})}_updateInputFieldsFromElements(e,t,i){const n=new Map;for(const o of e)if(x(o)){T(n,o.groupElement,o);for(const e of o.inputFields)T(n,e.fieldElement,e)}else T(n,o.fieldElement,o);const s=this._updateInputFieldsRecursive(n,t.filter(this._isSupportedElement),i);for(const[o,r]of n.entries())n.delete(o),r.destroy();return s}_updateInputFieldsRecursive(e,t,i,n=null){const s=[];for(const o of t){const t=e.get(o)??(M(o)?this._makeInputFieldGroupFromGroupElement(o,i):this._makeInputFieldFromFieldElement(o,i,n));if(s.push(t),e.delete(o),M(o)){const n=o.elements.filter((e=>this._isSupportedElement(e)));t.inputFields=this._updateInputFieldsRecursive(e,n,i,t)}}return s}_updateInputFieldsFromLayerFields(e,t,i){if(!Array.isArray(t))return b.warn(E,"No attribute fields found."),[];const n=new Map;for(const u of e)if(x(u)){for(const e of u.inputFields)e.destroy();u.inputFields.length=0,u.destroy()}else n.set(u.field,u);const s=[],{feature:o,initialFeature:r,layer:l,messages:a}=i;for(const u of t){const e=n.get(u)??new y({field:u,feature:o,initialFeature:r,layer:l,messages:a,value:o.getAttribute(u.name)});e.set({fieldElement:null,requiredFunction:null,visibilityFunction:null,valueFunction:null,editableFunction:null}),s.push(e),n.delete(u)}for(const[u,c]of n.entries())n.delete(u),c.destroy();return s}_makeInputFieldFromFieldElement(e,t,i=null){const{feature:n,initialFeature:s,layer:o,messages:r}=t,a=new y({fieldElement:e,field:this._layerFieldsByName.get(e.fieldName),requiredFunction:this._getCompiledExpression(e.requiredExpression),visibilityFunction:this._getCompiledExpression(e.visibilityExpression),valueFunction:this._getCompiledExpression(e.valueExpression),editableFunction:this._getCompiledExpression(e.editableExpression),group:i,feature:n,initialFeature:s,layer:o,messages:r,value:n.getAttribute(e.fieldName)});return a.own(u((()=>a.fieldElement),(e=>l(e)&&e.own(V.map((t=>u((()=>e[`${t}Expression`]),(async e=>{e&&""!==e&&(a[`${t}Function`]=await this._getOrMakeCompiledExpression(e),a.arcade=this._arcade)}),{initial:!0,sync:!0}))))),{initial:!0,sync:!0})),a}_makeInputFieldGroupFromGroupElement(e,t){const{arcade:i,feature:n}=t,s=new _({groupElement:e,visibilityFunction:this._getCompiledExpression(e.visibilityExpression),inputFields:[],arcade:i,feature:n});return s.own(u((()=>s.groupElement),(e=>l(e)&&e.own(u((()=>e.visibilityExpression),(async e=>{e&&""!==e&&(s.visibilityFunction=await this._getOrMakeCompiledExpression(e),s.arcade=this._arcade)}),{initial:!0}))),{initial:!0})),s}_afterValueChange(e){const{name:t,value:i}=e;if(this.get("layer.typeIdField")===e.name&&"types"in this.layer){const e=new Set;this.layer.types.forEach((t=>Object.keys(t.domains).forEach((t=>e.add(t))))),e.forEach((e=>{const t=this.findField(e);t&&t.notifyChange("domain")}))}this._featureClone.setAttribute(t,i),this.notifyChange("inputFields"),this._emitChangeEvent(e)}_getCompiledExpression(e){return this._compiledExpressionLookup.get(this._expressionLookup.get(e))}async _getOrMakeCompiledExpression(e){{if(r(e)||""===e)return null;const t=this._expressionLookup.get(e)??this._addToExpressionLookup(e);if(this._compiledExpressionLookup.has(t))return this._compiledExpressionLookup.get(t);this._arcade||(this._needsArcade=!0,this._arcade=await g());const i=this._arcade.arcadeUtils;return!this._arcadeGeometryOperationsEnabled&&i.hasGeometryOperations(t)&&(await i.enableGeometryOperations(),this._arcadeGeometryOperationsEnabled=!0),this._addToCompiledExpressionLookup(t)}}_addToCompiledExpressionLookup(e){const{_arcade:{arcadeUtils:t},_compiledExpressionLookup:i}=this,n=t.createFunction(e);return i.set(e,n),n}_addToExpressionLookup(e){const{_expressionLookup:t,formTemplate:i}=this,n=(l(i)&&l(i.expressionInfos)?Object.values(i.expressionInfos).find((t=>t.name===e)):null)?.expression??e;return t.set(e,n),e!==n&&t.set(n,n),n}_isSupportedElement(e){return"field"===e.type||"group"===e.type||(b.warn("form-info::unsupported-element-type","Only element types 'field' and 'group' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}_joinContingentValues(){const e=this._contingentValuesCache;if(r(e))return[];const t="typeIdField"in this.layer?this.layer.typeIdField:null,i=t?this.getValue(t):null,n=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:s}=r,o=[];for(const n of e)n.isRetired||l(n.subtype)&&n.subtype.code!==i||o.push({values:n.values});o.length>0&&n.push({name:s,fields:t,contingencies:o})}const[s,o]=this._generateJoinPlan(n);return[...s.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,i=[],n=new Set;for(const a of e)for(const e of a.fields)if(t.has(e)){const s=t.get(e),o=a,r=[s.name,o.name].sort().join("|");if(n.has(r))continue;i.push([s,o]),n.add(r),t.set(e,o)}else t.set(e,a);const s=new Set(i.flat()),o=new Set(e);for(const a of s)o.delete(a);const r=new Map,l=new Map;for(const a of new Set(i.flat())){const e=Symbol(a.name);r.set(e,new Set([a])),l.set(a,e)}for(const[a,u]of i){const e=l.get(a),t=l.get(u);if(e===t)continue;const i=r.get(e),n=r.get(t);for(const s of n)i.add(s),l.set(s,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),i=t.shift();let n=t.shift(),s=this._generateJoinKey(i.fields,n.fields),o=new Set([...i.fields,...n.fields]),a=new Map;for(const r of i.contingencies){const[e]=this._hashContingency(r,s.codedValueFields,!0);a.has(e)?a.get(e).push(r):a.set(e,[r])}for(;t.length>0;){const e=new Map,i=t.shift(),l=this._generateJoinKey(o,i.fields);for(const t of n.contingencies){const[i,n]=this._hashContingency(t,s.codedValueFields),o=n?this._findMatchingContingenciesWithAnyHashMask(a,i):a.get(i);if(a.has(j)&&o.push(...this._findMatchingContingenciesContainingAny(t,a.get(j),s.codedValueFields)),!r(o))for(const a of o){const i=s.rangeFields.length>0?this._joinContingenciesWithRangeDomains(a,t,s.rangeFields):this._joinContingencies(a,t);if(r(i))break;const[n]=this._hashContingency(i,l.codedValueFields,!0);e.has(n)?e.get(n).push(i):e.set(n,[i])}}a=e,n=i,s=l,o=new Set([...o,...n.fields])}const u=[];for(const c of n.contingencies){const[e,t]=this._hashContingency(c,s.codedValueFields),i=t?this._findMatchingContingenciesWithAnyHashMask(a,e):a.get(e);if(a.has(j)&&i.push(...this._findMatchingContingenciesContainingAny(c,a.get(j),s.codedValueFields)),!r(i))for(const n of i){const e=s.rangeFields.length>0?this._joinContingenciesWithRangeDomains(n,c,s.rangeFields):this._joinContingencies(n,c);l(e)&&u.push(e)}}return u}_joinContingencies(e,t){const i={values:{...e.values,...t.values}};for(const[n,s]of Object.entries(i.values))"any"===s.objectType&&l(e.values[n])&&(i.values[n]=e.values[n]);return i}_joinContingenciesWithRangeDomains(e,t,i){const n=this._joinContingencies(e,t);for(const s of i){const i=e.values[s],o=t.values[s],{leftIsNull:r,rightIsNull:l,bothAreNull:a,leftIsAny:u,rightIsAny:c,bothAreAny:d,leftIsRange:p,rightIsRange:h}=this._compareObjectTypes(i.objectType,o.objectType);if(a||d)continue;if(r&&c||l&&u){n.values[s]=new f({objectType:"null"});continue}if(r&&h||l&&p)return null;u?(i.minValue=-1/0,i.maxValue=1/0):c&&(o.minValue=-1/0,o.maxValue=1/0);const m=Math.max(i.minValue,o.minValue),g=Math.min(i.maxValue,o.maxValue);if(m>g)return null;n.values[s]=new f({objectType:"range",minValue:m,maxValue:g})}return n}_findMatchingContingenciesContainingAny(e,t,i){return t.filter((t=>i.every((i=>{const n=t.values[i],s=e.values[i];return"any"===n.objectType||"any"===s.objectType||n.codedValue?.code===s.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const i=RegExp(`${t}$`),n=[];for(const[s,o]of e){if(s===j)break;i.test(s)&&n.push(...o)}return n}_generateJoinKey(e,t){const i=Array.isArray(e)?new Set(e):e,n=Array.isArray(t)?new Set(t):t,s=i.size<n.size?i:n,o=s===i?n:i,l=new Set,a=new Set;for(const u of s)if(o.has(u)){const e=this.layer.getFieldDomain(u,{feature:this.feature});if(r(e))continue;switch(e.type){case"coded-value":l.add(u);break;case"range":a.add(u)}}return{codedValueFields:[...l],rangeFields:[...a]}}_hashContingency(e,t,i=!1){if(t.length<1)return[I,!1];const n=[];let s=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(i)return[j,!0];s=!0,n.push(`${o}:.*`)}else"null"===t.objectType?n.push(`${o}:${w}`):n.push(`${o}:${t.codedValue?.code}`)}return[n.sort().join("&"),s]}_compareObjectTypes(e,t){return{leftIsNull:"null"===e,rightIsNull:"null"===t,bothAreNull:"null"===e&&"null"===t,leftIsAny:"any"===e,rightIsAny:"any"===t,bothAreAny:"any"===e&&"any"===t,leftIsRange:"range"===e,rightIsRange:"range"===t}}};e([d({readOnly:!0})],A.prototype,"allInputFields",null),e([d()],A.prototype,"_layerFieldsByName",null),e([d({readOnly:!0})],A.prototype,"_inputFieldCache",void 0),e([d({readOnly:!0})],A.prototype,"_inputFieldGroupCache",void 0),e([d()],A.prototype,"contingencyConstraintViolations",void 0),e([d()],A.prototype,"feature",null),e([d()],A.prototype,"fieldsWithContingentValues",null),e([d({type:h})],A.prototype,"formTemplate",null),e([d({readOnly:!0})],A.prototype,"inputFields",null),e([d()],A.prototype,"joinedContingentValues",null),e([d()],A.prototype,"layer",null),e([d()],A.prototype,"messages",void 0),e([d()],A.prototype,"state",null),e([d()],A.prototype,"strict",void 0),e([d()],A.prototype,"submittable",null),e([d()],A.prototype,"valid",null),e([d()],A.prototype,"getValues",null),e([d()],A.prototype,"submit",null),A=e([p(E)],A);const x=e=>!!e.inputFields,M=e=>"group"===e.type,T=(e,t,i)=>{l(t)&&e.set(t,i)},G=A;export{G as default};
|
package/widgets/FeatureForm.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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{neverReached as t}from"../core/compilerUtils.js";import{isSome as i,isNone as a}from"../core/maybe.js";import{watch as n}from"../core/reactiveUtils.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{getDomainRange as o}from"../layers/support/domainUtils.js";import{getFieldRange as u}from"../layers/support/fieldUtils.js";import d from"./Widget.js";import p from"./FeatureForm/FeatureFormViewModel.js";import{Heading as c,incrementHeadingLevel as m}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as h}from"./support/decorators/messageBundle.js";import{vmEvent as f}from"./support/decorators/vmEvent.js";import{tsx as _}from"./support/jsxFactory.js";import{DateTime as g}from"luxon";import{getLocale as v}from"../intl/locale.js";const b={base:"esri-feature-form",form:"esri-feature-form__form",formHeader:"esri-feature-form__form-header",label:"esri-feature-form__label",inputField:"esri-feature-form__input",inputDate:"esri-feature-form__input--date",inputTime:"esri-feature-form__input--time",inputRadioGroup:"esri-feature-form__input--radio-group",inputRadio:"esri-feature-form__input--radio",inputRadioLabel:"esri-feature-form__input--radio-label",inputDisabled:"esri-feature-form__input--disabled",inputSwitch:"esri-feature-form__input--switch",inputInvalid:"esri-feature-form__input--invalid",inputIconInvalid:"esri-feature-form__input-icon--invalid",errorMessage:"esri-feature-form__field-error-message",description:"esri-feature-form__description-text",dateInputPart:"esri-feature-form__date-input-part",loneDateInputPart:"esri-feature-form__date-input-part--lone",dateInputContainer:"esri-feature-form__date-input-container",dateFormatHint:"esri-feature-form__date-format-hint",group:"esri-feature-form__group",groupLabel:"esri-feature-form__group-label",groupHeader:"esri-feature-form__group-header",groupHeading:"esri-feature-form__group-header",groupTitle:"esri-feature-form__group-title",groupDescription:"esri-feature-form__group-description",groupToggleIcon:"esri-feature-form__group-toggle-icon",groupCollapsed:"esri-feature-form__group--collapsed",groupSequential:"esri-feature-form__group--sequential",groupActive:"esri-feature-form__group--active",collapseIcon:"esri-icon-up",errorIcon:"esri-icon-notice-triangle",expandIcon:"esri-icon-down",widget:"esri-widget",panel:"esri-widget--panel",input:"esri-input",select:"esri-select"},I={datePattern:"D",timePattern:"tt"};function F(e){return e&&e.inputFields}const y="data-field-name";let w=class extends d{constructor(e,t){super(e,t),this._activeDateFieldEdit=null,this._activeInputName=null,this._activeNumberFieldEdit=null,this._fieldFocusNeeded=!1,this._fieldToInitialIncompatibleDomainValue=new Map,this._switchFieldsWithInitialIncompatibleValue=new Set,this._userUpdatedInputFieldNames=new Set,this.feature=null,this.formTemplate=null,this.groupDisplay="all",this.headingLevel=2,this.label=void 0,this.layer=null,this.messages=null,this.messagesTemplates=null,this.strict=null,this.viewModel=new p,this._handleSwitchClick=e=>{e.target===e.currentTarget&&e.stopImmediatePropagation()},this._handleRadioInputChange=e=>{this._commitInputValue(e.target)},this._handleInputInput=e=>{this._commitInputValue(e.currentTarget,!0)},this._handleFormKeyDown=this._handleFormKeyDown.bind(this),this._handleInputBlur=this._handleInputBlur.bind(this),this._handleInputFocus=this._handleInputFocus.bind(this),this._handleNumberInputMouseDown=this._handleNumberInputMouseDown.bind(this),this._handleInputKeyDown=this._handleInputKeyDown.bind(this),this._handleOptionChange=this._handleOptionChange.bind(this),this._handleGroupClick=this._handleGroupClick.bind(this),this._handleSubmit=this._handleSubmit.bind(this),this._afterInputCreateOrUpdate=this._afterInputCreateOrUpdate.bind(this)}initialize(){this.own([n((()=>this.feature),(()=>{const e=this._getFocusableInput("forward");this._activeInputName=e&&e.name,this._userUpdatedInputFieldNames.clear(),this._fieldToInitialIncompatibleDomainValue.clear(),this._switchFieldsWithInitialIncompatibleValue.clear(),this._fieldFocusNeeded=!0})),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._userUpdatedInputFieldNames.add(e))),this._activeInputName=t,this._fieldFocusNeeded=!0,this.scheduleRender()}}))])}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),import("@esri/calcite-components/dist/components/calcite-input-message.js"),import("@esri/calcite-components/dist/components/calcite-switch.js")])}destroy(){this._userUpdatedInputFieldNames.clear(),this._userUpdatedInputFieldNames=null}getValues(){return null}submit(){return null}render(){const{state:e}=this.viewModel;return _("div",{class:this.classes(b.base,b.widget,b.panel)},"ready"===e?this.renderForm():null)}renderForm(){const e=this.formTemplate?.title?_(c,{key:"title",level:this.headingLevel},this.formTemplate.title):null,t=this.formTemplate?.description?_("p",{class:b.description,key:"description"},this.formTemplate.description):null,i=e||t?_("div",{class:b.formHeader},e,t):null;return _("form",{class:b.form,novalidate:!0,onsubmit:this._handleSubmit,onkeydown:this._handleFormKeyDown},i,this.renderFields())}renderFields(){const{viewModel:{inputFields:e}}=this;return e.map(((e,t)=>F(e)?this.renderGroup(e,t):this.renderLabeledField(e)))}renderGroup(e,t){const{description:i,inputFields:a,label:n,state:s}=e,l=a.filter((e=>e.visible)),r=this.viewModel.findField(this._activeInputName),o=!(!r||r.group!==e),u=`${this.id}_group_${t}`,d=`${this.id}_group-label_${t}`,p=`${this.id}_group-description_${t}`,h=i?_("p",{class:this.classes(b.groupDescription,b.description),id:p},i):null,f="sequential"===this.groupDisplay,g=f?o:"expanded"===s,v=g?b.collapseIcon:b.expandIcon;return _("fieldset",{"aria-expanded":g.toString(),"aria-labelledby":d,"aria-describedby":i?p:"",class:this.classes(b.group,f?b.groupSequential:null,g?null:b.groupCollapsed,o?b.groupActive:null),"data-group":e,id:u,key:t,onclick:this._handleGroupClick},_("button",{role:f?"presentation":void 0,class:b.groupHeader,type:"button",tabIndex:f?-1:0},_("div",{class:b.groupTitle},_(c,{class:b.groupLabel,id:d,level:this.formTemplate?.title?m(this.headingLevel):this.headingLevel},n),h),f?null:_("span",{class:this.classes(v,b.groupToggleIcon)})),l.map((e=>this.renderLabeledField(e))))}_getFocusableInput(e,t){const i=this.viewModel.allInputFields,a="forward"===e?i:i.slice().reverse();let n;if(t)if(F(t))n=a.indexOf(t.inputFields[0]);else{let i;if(this._isInputFieldInGroup(t)&&"collapsed"===t.group.state){const{inputFields:a}=t.group;i="forward"===e?a[a.length-1]:a[0]}else i=t;n=a.indexOf(i)+1}else n=0;for(let s=n;s<a.length;s++){const e=a[s];if(e.visible)return e}return null}renderLabeledField(e){const{label:t,layer:i,type:a}=e;return _("label",{key:`${i.id}-${e.name}`,class:b.label},[t,"unsupported"!==a?this.renderInputField(e):this.renderUnsupportedField(e),this.renderAuxiliaryText(e)])}renderInputField(e){const{domain:t,name:a,type:n,value:s}=e,l=this.getCommonInputProps(e);if("coded-value"===t?.type){if(this._inputFieldHasInputType(e,"switch")){const{fieldElement:t}=e;if(!(this._switchFieldsWithInitialIncompatibleValue.has(a)||null==s||t.input.onValue!==s&&t.input.offValue!==s))return this.renderSwitchInputField(e,l);this._switchFieldsWithInitialIncompatibleValue.add(a)}return"radio-buttons"===e.inputType?this.renderRadioButtonsInputField(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),l):this.renderSelectInputField(e,this._getFieldValueOptions(a,t),l)}return"datetime-picker"===e.inputType||"date"===n?this.renderDateInputField(e,l):"number"===n?_("input",{type:"number",...l,value:i(this._activeNumberFieldEdit)&&this._activeNumberFieldEdit.fieldName===e.name?this._activeNumberFieldEdit.value:`${l.value}`}):"text-area"===e.inputType?_("textarea",{...l}):_("input",{type:"text",...l})}_parseDateTime(e,t,i){if(i){let a=g.fromJSDate(this._parseDate(e,i));const n=g.fromMillis(t.value??Date.now());return a="date"===i?a.set({hour:n.hour,minute:n.minute,second:n.second}):a.set({day:n.day,month:n.month,year:n.year}),a.isValid?a.toMillis():null}const a=g.fromJSDate(this._parseDate(e));return a.isValid?a.toMillis():null}renderDateInputField(e,t){const{value:i,includeTime:a}=e,{date:n,time:s}=this._formatDate(0),l=`${this.id}-${t.key}`,r=`${l}-date`,o=`${l}-time`,{_activeDateFieldEdit:u}=this;let{date:d,time:p}=this._formatDate(i);return u?.fieldName===e.name&&(d=u.date.input?.value??d,p=u.time.input?.value??p),_("div",{key:`${t.key}-date`,class:b.dateInputContainer},_("div",{class:this.classes(b.dateInputPart,a?null:b.loneDateInputPart)},_("input",{"aria-label":e.label,"aria-describedby":r,type:"text",...t,"data-date-part":"date",class:this.classes(t.class,b.inputDate),value:d}),_("div",{class:b.dateFormatHint,id:r},n)),a?_("div",{class:b.dateInputPart,key:"time-input"},_("input",{"aria-describedby":o,"aria-label":e.label,type:"text",...t,"data-date-part":"time",class:this.classes(t.class,b.inputTime),value:p}),_("div",{class:b.dateFormatHint,id:o},s)):null)}renderUnsupportedField(e){const t=this.getCommonInputProps(e);return _("input",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,class:this.classes(b.input,b.inputField,b.inputDisabled),onfocus:t.onfocus,readOnly:!0,tabIndex:t.tabIndex,type:"text",value:t.value,[y]:t[y]})}renderSelectInputField(e,t,i){const{value:n}=e,{messages:s,messagesTemplates:l}=this,r=t.map((e=>e.map((e=>_("calcite-combobox-item",{value:`${e.value}`,"text-label":e.name,key:`#${e.value}`,selected:n===e.value}))))),[o,u]=r;this._registerIncompatibleValue(n,t.flat(),e,(e=>{u.unshift(_("calcite-combobox-item",{value:`${e}`,"text-label":`${e}`,key:"incompatible-option",readOnly:!0}))}));const d=u.length>0?[_("calcite-combobox-item-group",{key:"recommended",label:s.recommended},o),_("calcite-combobox-item-group",{key:"other",label:l.other},u)]:o,p=a(e.fieldElement)||this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.showNoValueOption;if(!e.required&&p){const t="",i=this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty;d.unshift(_("calcite-combobox-item",{value:t,"text-label":this.messages.empty,key:"empty-option"},i))}return _("calcite-combobox",{...i,"selection-mode":"single",disabled:i.readOnly,allowCustomValues:!1,onCalciteComboboxChange:e=>this._handleOptionChange(e.target)},d)}_registerIncompatibleValue(e,t,i,a){const n=this._fieldToInitialIncompatibleDomainValue,s=n.has(i.name);(s||null!=e&&""!==e&&!t.some((t=>t.value===e))||s)&&(s||n.set(i.name,e),a?.(n.get(i.name)))}renderRadioButtonsInputField(e,t,i){const{value:n}=e,s=t.map((t=>this.renderRadioButton({key:t.name,label:t.name,name:e.name,value:t.value,selected:t.value===n,props:i})));this._registerIncompatibleValue(n,t,e);const l=a(e.fieldElement)||this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.showNoValueOption;if(!e.required&&l){const t="",a=this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty,l=n===t||null===n;s.unshift(this.renderRadioButton({key:"empty-option",label:a,name:e.name,value:t,selected:l,props:i}))}return _("div",{key:`${i.key}-radio`,class:b.inputRadioGroup},s)}renderSwitchInputField(e,t){const{value:i}=e,a=!!this._inputFieldHasInputType(e,"switch")&&i===e.fieldElement.input.onValue;return _("calcite-switch",{...t,class:b.inputSwitch,onclick:this._handleSwitchClick,checked:a,disabled:t.readOnly})}renderRadioButton({key:e,name:t,value:i,selected:a,label:n,props:s}){return _("label",{key:e,class:b.inputRadioLabel},_("input",{...s,class:b.inputRadio,name:t,type:"radio",value:i,checked:a,onchange:this._handleRadioInputChange}),n)}renderAuxiliaryText(e){const t=this._userUpdatedInputFieldNames.has(e.name)&&!e.valid?e.errorMessage:i(this.viewModel.contingencyConstraintViolations.get(e.name))?this.messages.validationErrors.valuesIncompatible:null;return i(t)?_("calcite-input-message",{status:"invalid",icon:!0,active:!0},t):e.description?_("div",{key:"description",class:b.description},e.description):void 0}getCommonInputProps(e){const{groupDisplay:t}=this,{editable:a,group:n,hint:s,maxLength:l,minLength:r,name:o,required:u,type:d,valid:p,value:c}=e,m=this._userUpdatedInputFieldNames.has(o),h=!a,f="all"===t&&i(n)&&"collapsed"===n.state;return{afterCreate:this._afterInputCreateOrUpdate,afterUpdate:this._afterInputCreateOrUpdate,"aria-invalid":p?"false":"true",class:this.classes(b.input,b.inputField,h?b.inputDisabled:null,m&&!p?b.inputInvalid:null),key:o,label:o,minlength:r>-1?`${r}`:"",maxlength:l>-1?`${l}`:"",...this._getNumberFieldConstraints(e),readOnly:h,value:null==c?"":`${c}`,[y]:o,onfocus:this._handleInputFocus,oninput:this._handleInputInput,onblur:this._handleInputBlur,onkeydown:this._handleInputKeyDown,onmousedown:"number"===d?this._handleNumberInputMouseDown:null,placeholder:"number"===d||"text"===d?s:"",required:u,tabIndex:f?-1:0}}_isInputFieldInGroup(e){return!F(e)&&i(e.group)}_handleNumberInputMouseDown({target:e}){e.focus(),this.scheduleRender()}_getFieldValueOptions(e,t){const i=t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),a=this.viewModel.fieldsWithContingentValues.has(e)?this._getContingentValueOptions(e):[];if(a.length>0){const e=new Set(a.map((e=>e.value)));return[a,i.filter((t=>!e.has(t.value)))]}return[i,[]]}_getContingentValueOptions(e){const t={};for(const s of this.viewModel.allInputFields){const{name:i,value:n}=s;!a(n)&&i!==e&&this.viewModel.fieldsWithContingentValues.has(i)&&(t[i]=n)}const i=this.viewModel.joinedContingentValues.slice(),n=new Map;for(const s of i){const i=s.values[e];if(a(i)||"code"!==i.objectType&&"null"!==i.objectType)continue;const{code:l,name:r}="null"===i.objectType?{code:"",name:this.messages.empty}:i.codedValue;if(n.has(l))continue;Object.entries(t).every((([e,t])=>!s.values.hasOwnProperty(e)||this._valueIsValidContingentValue(t,s.values[e])))&&n.set(l,{name:r,value:l})}return[...n.values()]}_getInputFieldFromInput(e){return this.viewModel.findField(e.getAttribute(y))}_getNumberFieldConstraints(e){const t=o(e.domain)||u(e.field);return t&&t.max!==Number.MAX_VALUE&&t.min!==Number.MIN_VALUE?t:{min:null,max:null}}_afterInputCreateOrUpdate(e){const{viewModel:t}=this,i=this._getInputFieldFromInput(e),a=t.findField(this._activeInputName),n=this._fieldToInitialIncompatibleDomainValue.get(i.name)===i.value;this._fieldFocusNeeded&&a===i&&("radio-buttons"!==i.inputType||n||e.checked)&&(this._fieldFocusNeeded=!1,e.focus())}_handleInputFocus(e){const t=e.target,i=this._getInputFieldFromInput(t);this._activeInputName=i.name,"date"===i.type?this._syncDateFieldEdits(t):this._isNumberInputField(i)&&this._setUpNumberFieldEdit(t)}_isNumberInputField({domain:e,inputType:t="text-box",type:i}){return"number"===i&&"text-box"===t&&(!e||"coded-value"!==e.type)}_handleInputBlur(e){const t=e.target,a=this._getInputFieldFromInput(t);if("date"===a.type){const i=e.relatedTarget,n=i&&this._getInputFieldFromInput(i);if(n&&"date"===a.type&&"date"===n.type&&a.field===n.field){if(""!==t.value&&""===i.value){const n=i.getAttribute("data-date-part");i.value=this._formatDate(a.value??Date.now())[n],this._parseDate(t.value,t.getAttribute("data-date-part"))&&this._commitInputValue(e.target,!0,!1)}return}}"number"===a.type&&i(this._activeNumberFieldEdit)&&(this._activeNumberFieldEdit.input.value=`${a.value}`,this._activeNumberFieldEdit=null),this._commitInputValue(t),this.scheduleRender()}_commitInputValue(e,t=!1,a=!0){const n=this._getInputFieldFromInput(e);if(this._activeDateFieldEdit){const{date:i,time:s}=this._activeDateFieldEdit,l=this._parseDateTime(e.value,n,i.active?"date":"time"),r=null!==this.viewModel.getValue(n.name),o=i.input&&(s.input||!n.includeTime),u=null===l;if(t){if(u)return;(o||!a||r)&&this._updateDateFieldValue(n,l)}else{if(""===i.input?.value||""===s.input?.value)this._updateDateFieldValue(n,null);else if(o){const e=`${i.input.value} ${s.input?.value??""}`,t=this._parseDateTime(e,n);!(null!==t)&&r||this._updateDateFieldValue(n,t)}this._activeDateFieldEdit=null}}else i(this._activeNumberFieldEdit)&&this._isNumberInputField(n)&&(this._activeNumberFieldEdit.value=e.value),this._updateFieldValue(e)}_handleInputKeyDown(e){const{key:t,altKey:i,ctrlKey:a,metaKey:n}=e,s=this._getInputFieldFromInput(e.target);if("Enter"===t)this._isInputFieldInGroup(s)&&"collapsed"===s.group.state&&(s.group.state="expanded");else{const{type:l}=s.field,r="single"===l||"double"===l,o=!i&&!a&&!n;if(("integer"===l||"small-integer"===l||r)&&o&&1===t.length){const i=Number(t),a=["-","+"],n=["e","."],s=r?[...a,...n]:a;isNaN(i)&&!s.includes(t)&&e.preventDefault()}}}_setUpNumberFieldEdit(e){const t=this._getInputFieldFromInput(e);this._activeNumberFieldEdit={fieldName:t.name,input:e,value:e.value}}_syncDateFieldEdits(e){const t=this._getInputFieldFromInput(e);if("date"!==t.type)return;const i=e.getAttribute("data-date-part"),a="date"===i?{value:e.value,input:e,active:!0}:{...this._activeDateFieldEdit?.date,active:!1},n="time"===i?{value:e.value,input:e,active:!0}:{...this._activeDateFieldEdit?.time,active:!1};this._activeDateFieldEdit={fieldName:t.name,date:a,time:n}}_updateFieldValue(e){const t=e.getAttribute(y);if(this.viewModel.setValue(t,this._parseValue(e)),this._userUpdatedInputFieldNames.add(t),this.viewModel.fieldsWithContingentValues.has(t)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>i(t))));this.viewModel.validateContingencyConstraints(e)}}_updateDateFieldValue(e,t){this.viewModel.setValue(e.name,t),this._userUpdatedInputFieldNames.add(e.name)}_parseValue(e){const t=this._getInputFieldFromInput(e),i=e.value;if(this._inputFieldHasInputType(t,"switch")&&"CALCITE-COMBOBOX"!==e.tagName)return e.checked?t.fieldElement.input.onValue:t.fieldElement.input.offValue;if("radio-buttons"===t.inputType&&"radio"===e.type&&!e.checked)return t.value;const{type:a}=t;if("number"===a)return i?parseFloat(i):null;if("date"===a){if(!i)return null;const a=Number(i);if(!isNaN(a))return a;const n=e.getAttribute("data-date-part"),s=this._parseDate(i,n);if(!s)return null;let l=g.fromJSDate(s);const r=t.domain,o=g.now();let u=o;if(r&&"range"===r.type){const e=g.fromMillis(r.maxValue);o<e&&(u=e)}const d=this.viewModel.getValue(t.name),p=null!=d?g.fromMillis(d):u;return l="date"===n?l.set({hour:p.hour,minute:p.minute,second:p.second}):l.set({day:p.day,month:p.month,year:p.year}),l.toMillis()}return i}_handleOptionChange(e){this._commitInputValue(e),this.scheduleRender()}_handleGroupClick(e){const t=e.currentTarget["data-group"],i="expanded"===t.state,a="sequential"===this.groupDisplay,n=`.${b.groupHeader}`;if(!(i&&!e.target.closest(n))){if(this._activeInputName=this._getFocusableInput("forward",t)?.name,a){const a=e.target.closest(n);if(i&&!a)return;this.viewModel.inputFields.forEach((e=>{F(e)&&e!==t&&(e.state="collapsed")}))}t.state=i?"collapsed":"expanded",this._fieldFocusNeeded=a,this.scheduleRender()}}_handleSubmit(e){e.preventDefault()}_handleFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_formatDate(e){if(null==e)return{date:"",time:""};const t=g.fromMillis(e,{locale:v(),numberingSystem:"latn"});return{date:t.toLocaleString({year:"numeric",month:"2-digit",day:"2-digit"}),time:t.toFormat(I.timePattern)}}_parseDate(e,t){if(null==e||""===e)return null;const{timePattern:i,datePattern:a}=I,n=t?"date"===t?a:i:`${a} ${i}`,s=g.fromFormat(e,n,{locale:v(),numberingSystem:"latn"});return s.isValid?s.toJSDate():null}_inputFieldHasInputType(e,t){return i(e.fieldElement)&&e.fieldElement.input?.type===t}_valueIsValidContingentValue(e,i){switch(i.objectType){case"any":return!0;case"null":return null==e;case"code":return e===i.codedValue?.code;case"range":return e>=i.minValue&&e<=i.maxValue;default:return t(i.objectType),!1}}};e([s("viewModel.feature")],w.prototype,"feature",void 0),e([s("viewModel.formTemplate")],w.prototype,"formTemplate",void 0),e([l()],w.prototype,"groupDisplay",void 0),e([l()],w.prototype,"headingLevel",void 0),e([l({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],w.prototype,"label",void 0),e([s("viewModel.layer")],w.prototype,"layer",void 0),e([l(),h("esri/widgets/FeatureForm/t9n/FeatureForm")],w.prototype,"messages",void 0),e([l(),h("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],w.prototype,"messagesTemplates",void 0),e([s("viewModel.strict")],w.prototype,"strict",void 0),e([l(),f(["value-change","submit"])],w.prototype,"viewModel",void 0),e([s("viewModel.getValues")],w.prototype,"getValues",null),e([s("viewModel.submit")],w.prototype,"submit",null),w=e([r("esri.widgets.FeatureForm")],w);const V=w;export{V as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{neverReached as t}from"../core/compilerUtils.js";import{isSome as i,isNone as a}from"../core/maybe.js";import{watch as n}from"../core/reactiveUtils.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{getDomainRange as o}from"../layers/support/domainUtils.js";import{getFieldRange as u}from"../layers/support/fieldUtils.js";import d from"./Widget.js";import p from"./FeatureForm/FeatureFormViewModel.js";import{Heading as c,incrementHeadingLevel as m}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as h}from"./support/decorators/messageBundle.js";import{vmEvent as f}from"./support/decorators/vmEvent.js";import{tsx as _}from"./support/jsxFactory.js";import{DateTime as g}from"luxon";import{getLocale as v}from"../intl/locale.js";const b={base:"esri-feature-form",form:"esri-feature-form__form",formHeader:"esri-feature-form__form-header",label:"esri-feature-form__label",inputField:"esri-feature-form__input",inputDate:"esri-feature-form__input--date",inputTime:"esri-feature-form__input--time",inputRadioGroup:"esri-feature-form__input--radio-group",inputRadio:"esri-feature-form__input--radio",inputRadioLabel:"esri-feature-form__input--radio-label",inputDisabled:"esri-feature-form__input--disabled",inputSwitch:"esri-feature-form__input--switch",inputInvalid:"esri-feature-form__input--invalid",inputIconInvalid:"esri-feature-form__input-icon--invalid",errorMessage:"esri-feature-form__field-error-message",description:"esri-feature-form__description-text",dateInputPart:"esri-feature-form__date-input-part",loneDateInputPart:"esri-feature-form__date-input-part--lone",dateInputContainer:"esri-feature-form__date-input-container",dateFormatHint:"esri-feature-form__date-format-hint",group:"esri-feature-form__group",groupLabel:"esri-feature-form__group-label",groupHeader:"esri-feature-form__group-header",groupHeading:"esri-feature-form__group-header",groupTitle:"esri-feature-form__group-title",groupDescription:"esri-feature-form__group-description",groupToggleIcon:"esri-feature-form__group-toggle-icon",groupCollapsed:"esri-feature-form__group--collapsed",groupSequential:"esri-feature-form__group--sequential",groupActive:"esri-feature-form__group--active",collapseIcon:"esri-icon-up",errorIcon:"esri-icon-notice-triangle",expandIcon:"esri-icon-down",widget:"esri-widget",panel:"esri-widget--panel",input:"esri-input",select:"esri-select"},I={datePattern:"D",timePattern:"tt"};function F(e){return e&&e.inputFields}const y="data-field-name";let w=class extends d{constructor(e,t){super(e,t),this._activeDateFieldEdit=null,this._activeInputName=null,this._activeNumberFieldEdit=null,this._fieldFocusNeeded=!1,this._fieldToInitialIncompatibleDomainValue=new Map,this._switchFieldsWithInitialIncompatibleValue=new Set,this._userUpdatedInputFieldNames=new Set,this.feature=null,this.formTemplate=null,this.groupDisplay="all",this.headingLevel=2,this.label=void 0,this.layer=null,this.messages=null,this.messagesTemplates=null,this.strict=null,this.viewModel=new p,this._handleSwitchClick=e=>{e.target===e.currentTarget&&e.stopImmediatePropagation()},this._handleRadioInputChange=e=>{this._commitInputValue(e.target)},this._handleInputInput=e=>{this._commitInputValue(e.currentTarget,!0)},this._handleFormKeyDown=this._handleFormKeyDown.bind(this),this._handleInputBlur=this._handleInputBlur.bind(this),this._handleInputFocus=this._handleInputFocus.bind(this),this._handleNumberInputMouseDown=this._handleNumberInputMouseDown.bind(this),this._handleInputKeyDown=this._handleInputKeyDown.bind(this),this._handleOptionChange=this._handleOptionChange.bind(this),this._handleGroupClick=this._handleGroupClick.bind(this),this._handleSubmit=this._handleSubmit.bind(this),this._afterInputCreateOrUpdate=this._afterInputCreateOrUpdate.bind(this)}initialize(){this.own([n((()=>this.feature),(()=>{const e=this._getFocusableInput("forward");this._activeInputName=e&&e.name,this._userUpdatedInputFieldNames.clear(),this._fieldToInitialIncompatibleDomainValue.clear(),this._switchFieldsWithInitialIncompatibleValue.clear(),this._fieldFocusNeeded=!0})),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._userUpdatedInputFieldNames.add(e))),this._activeInputName=t,this._fieldFocusNeeded=!0,this.scheduleRender()}}))])}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),import("@esri/calcite-components/dist/components/calcite-input-message.js"),import("@esri/calcite-components/dist/components/calcite-switch.js")])}destroy(){this._userUpdatedInputFieldNames.clear(),this._userUpdatedInputFieldNames=null}getValues(){return null}submit(){return null}render(){const{state:e}=this.viewModel;return _("div",{class:this.classes(b.base,b.widget,b.panel)},"ready"===e?this.renderForm():null)}renderForm(){const e=this.formTemplate?.title?_(c,{key:"title",level:this.headingLevel},this.formTemplate.title):null,t=this.formTemplate?.description?_("p",{class:b.description,key:"description"},this.formTemplate.description):null,i=e||t?_("div",{class:b.formHeader},e,t):null;return _("form",{class:b.form,novalidate:!0,onsubmit:this._handleSubmit,onkeydown:this._handleFormKeyDown},i,this.renderFields())}renderFields(){const{viewModel:{inputFields:e}}=this;return e.filter((e=>e.visible)).map(((e,t)=>F(e)?this.renderGroup(e,t):this.renderLabeledField(e)))}renderGroup(e,t){const{description:i,inputFields:a,label:n,state:s}=e,l=a.filter((e=>e.visible)),r=this.viewModel.findField(this._activeInputName),o=!(!r||r.group!==e),u=`${this.id}_group_${t}`,d=`${this.id}_group-label_${t}`,p=`${this.id}_group-description_${t}`,h=i?_("p",{class:this.classes(b.groupDescription,b.description),id:p},i):null,f="sequential"===this.groupDisplay,g=f?o:"expanded"===s,v=g?b.collapseIcon:b.expandIcon;return _("fieldset",{"aria-expanded":g.toString(),"aria-labelledby":d,"aria-describedby":i?p:"",class:this.classes(b.group,f?b.groupSequential:null,g?null:b.groupCollapsed,o?b.groupActive:null),"data-group":e,id:u,key:t,onclick:this._handleGroupClick},_("button",{role:f?"presentation":void 0,class:b.groupHeader,type:"button",tabIndex:f?-1:0},_("div",{class:b.groupTitle},_(c,{class:b.groupLabel,id:d,level:this.formTemplate?.title?m(this.headingLevel):this.headingLevel},n),h),f?null:_("span",{class:this.classes(v,b.groupToggleIcon)})),l.map((e=>this.renderLabeledField(e))))}_getFocusableInput(e,t){const i=this.viewModel.allInputFields,a="forward"===e?i:i.slice().reverse();let n;if(t)if(F(t))n=a.indexOf(t.inputFields[0]);else{let i;if(this._isInputFieldInGroup(t)&&"collapsed"===t.group.state){const{inputFields:a}=t.group;i="forward"===e?a[a.length-1]:a[0]}else i=t;n=a.indexOf(i)+1}else n=0;for(let s=n;s<a.length;s++){const e=a[s];if(e.visible)return e}return null}renderLabeledField(e){const{label:t,layer:i,type:a}=e;return _("label",{key:`${i.id}-${e.name}`,class:b.label},[t,"unsupported"!==a?this.renderInputField(e):this.renderUnsupportedField(e),this.renderAuxiliaryText(e)])}renderInputField(e){const{domain:t,name:a,type:n,value:s}=e,l=this.getCommonInputProps(e);if("coded-value"===t?.type){if(this._inputFieldHasInputType(e,"switch")){const{fieldElement:t}=e;if(!(this._switchFieldsWithInitialIncompatibleValue.has(a)||null==s||t.input.onValue!==s&&t.input.offValue!==s))return this.renderSwitchInputField(e,l);this._switchFieldsWithInitialIncompatibleValue.add(a)}return"radio-buttons"===e.inputType?this.renderRadioButtonsInputField(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),l):this.renderSelectInputField(e,this._getFieldValueOptions(a,t),l)}return"datetime-picker"===e.inputType||"date"===n?this.renderDateInputField(e,l):"number"===n?_("input",{type:"number",...l,value:i(this._activeNumberFieldEdit)&&this._activeNumberFieldEdit.fieldName===e.name?this._activeNumberFieldEdit.value:`${l.value}`}):"text-area"===e.inputType?_("textarea",{...l}):_("input",{type:"text",...l})}_parseDateTime(e,t,i){if(i){let a=g.fromJSDate(this._parseDate(e,i));const n=g.fromMillis(t.value??Date.now());return a="date"===i?a.set({hour:n.hour,minute:n.minute,second:n.second}):a.set({day:n.day,month:n.month,year:n.year}),a.isValid?a.toMillis():null}const a=g.fromJSDate(this._parseDate(e));return a.isValid?a.toMillis():null}renderDateInputField(e,t){const{value:i,includeTime:a}=e,{date:n,time:s}=this._formatDate(0),l=`${this.id}-${t.key}`,r=`${l}-date`,o=`${l}-time`,{_activeDateFieldEdit:u}=this;let{date:d,time:p}=this._formatDate(i);return u?.fieldName===e.name&&(d=u.date.input?.value??d,p=u.time.input?.value??p),_("div",{key:`${t.key}-date`,class:b.dateInputContainer},_("div",{class:this.classes(b.dateInputPart,a?null:b.loneDateInputPart)},_("input",{"aria-label":e.label,"aria-describedby":r,type:"text",...t,"data-date-part":"date",class:this.classes(t.class,b.inputDate),value:d}),_("div",{class:b.dateFormatHint,id:r},n)),a?_("div",{class:b.dateInputPart,key:"time-input"},_("input",{"aria-describedby":o,"aria-label":e.label,type:"text",...t,"data-date-part":"time",class:this.classes(t.class,b.inputTime),value:p}),_("div",{class:b.dateFormatHint,id:o},s)):null)}renderUnsupportedField(e){const t=this.getCommonInputProps(e);return _("input",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,class:this.classes(b.input,b.inputField,b.inputDisabled),onfocus:t.onfocus,readOnly:!0,tabIndex:t.tabIndex,type:"text",value:t.value,[y]:t[y]})}renderSelectInputField(e,t,i){const{value:n}=e,{messages:s,messagesTemplates:l}=this,r=t.map((e=>e.map((e=>_("calcite-combobox-item",{value:`${e.value}`,"text-label":e.name,key:`#${e.value}`,selected:n===e.value}))))),[o,u]=r;this._registerIncompatibleValue(n,t.flat(),e,(e=>{u.unshift(_("calcite-combobox-item",{value:`${e}`,"text-label":`${e}`,key:"incompatible-option",readOnly:!0}))}));const d=u.length>0?[_("calcite-combobox-item-group",{key:"recommended",label:s.recommended},o),_("calcite-combobox-item-group",{key:"other",label:l.other},u)]:o,p=a(e.fieldElement)||this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.showNoValueOption;if(!e.required&&p){const t="",i=this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty;d.unshift(_("calcite-combobox-item",{value:t,"text-label":this.messages.empty,key:"empty-option"},i))}return _("calcite-combobox",{...i,"selection-mode":"single",disabled:i.readOnly,allowCustomValues:!1,onCalciteComboboxChange:e=>this._handleOptionChange(e.target)},d)}_registerIncompatibleValue(e,t,i,a){const n=this._fieldToInitialIncompatibleDomainValue,s=n.has(i.name);(s||null!=e&&""!==e&&!t.some((t=>t.value===e))||s)&&(s||n.set(i.name,e),a?.(n.get(i.name)))}renderRadioButtonsInputField(e,t,i){const{value:n}=e,s=t.map((t=>this.renderRadioButton({key:t.name,label:t.name,name:e.name,value:t.value,selected:t.value===n,props:i})));this._registerIncompatibleValue(n,t,e);const l=a(e.fieldElement)||this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.showNoValueOption;if(!e.required&&l){const t="",a=this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty,l=n===t||null===n;s.unshift(this.renderRadioButton({key:"empty-option",label:a,name:e.name,value:t,selected:l,props:i}))}return _("div",{key:`${i.key}-radio`,class:b.inputRadioGroup},s)}renderSwitchInputField(e,t){const{value:i}=e,a=!!this._inputFieldHasInputType(e,"switch")&&i===e.fieldElement.input.onValue;return _("calcite-switch",{...t,class:b.inputSwitch,onclick:this._handleSwitchClick,checked:a,disabled:t.readOnly})}renderRadioButton({key:e,name:t,value:i,selected:a,label:n,props:s}){return _("label",{key:e,class:b.inputRadioLabel},_("input",{...s,class:b.inputRadio,name:t,type:"radio",value:i,checked:a,onchange:this._handleRadioInputChange}),n)}renderAuxiliaryText(e){const t=this._userUpdatedInputFieldNames.has(e.name)&&!e.valid?e.errorMessage:i(this.viewModel.contingencyConstraintViolations.get(e.name))?this.messages.validationErrors.valuesIncompatible:null;return i(t)?_("calcite-input-message",{status:"invalid",icon:!0,active:!0},t):e.description?_("div",{key:"description",class:b.description},e.description):void 0}getCommonInputProps(e){const{groupDisplay:t}=this,{editable:a,group:n,hint:s,maxLength:l,minLength:r,name:o,required:u,type:d,valid:p,value:c}=e,m=this._userUpdatedInputFieldNames.has(o),h=!a,f="all"===t&&i(n)&&"collapsed"===n.state;return{afterCreate:this._afterInputCreateOrUpdate,afterUpdate:this._afterInputCreateOrUpdate,"aria-invalid":p?"false":"true",class:this.classes(b.input,b.inputField,h?b.inputDisabled:null,m&&!p?b.inputInvalid:null),key:o,label:o,minlength:r>-1?`${r}`:"",maxlength:l>-1?`${l}`:"",...this._getNumberFieldConstraints(e),readOnly:h,value:null==c?"":`${c}`,[y]:o,onfocus:this._handleInputFocus,oninput:this._handleInputInput,onblur:this._handleInputBlur,onkeydown:this._handleInputKeyDown,onmousedown:"number"===d?this._handleNumberInputMouseDown:null,placeholder:"number"===d||"text"===d?s:"",required:u,tabIndex:f?-1:0}}_isInputFieldInGroup(e){return!F(e)&&i(e.group)}_handleNumberInputMouseDown({target:e}){e.focus(),this.scheduleRender()}_getFieldValueOptions(e,t){const i=t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),a=this.viewModel.fieldsWithContingentValues.has(e)?this._getContingentValueOptions(e):[];if(a.length>0){const e=new Set(a.map((e=>e.value)));return[a,i.filter((t=>!e.has(t.value)))]}return[i,[]]}_getContingentValueOptions(e){const t={};for(const s of this.viewModel.allInputFields){const{name:i,value:n}=s;!a(n)&&i!==e&&this.viewModel.fieldsWithContingentValues.has(i)&&(t[i]=n)}const i=this.viewModel.joinedContingentValues.slice(),n=new Map;for(const s of i){const i=s.values[e];if(a(i)||"code"!==i.objectType&&"null"!==i.objectType)continue;const{code:l,name:r}="null"===i.objectType?{code:"",name:this.messages.empty}:i.codedValue;if(n.has(l))continue;Object.entries(t).every((([e,t])=>!s.values.hasOwnProperty(e)||this._valueIsValidContingentValue(t,s.values[e])))&&n.set(l,{name:r,value:l})}return[...n.values()]}_getInputFieldFromInput(e){return this.viewModel.findField(e.getAttribute(y))}_getNumberFieldConstraints(e){const t=o(e.domain)||u(e.field);return t&&t.max!==Number.MAX_VALUE&&t.min!==Number.MIN_VALUE?t:{min:null,max:null}}_afterInputCreateOrUpdate(e){const{viewModel:t}=this,i=this._getInputFieldFromInput(e),a=t.findField(this._activeInputName),n=this._fieldToInitialIncompatibleDomainValue.get(i.name)===i.value;this._fieldFocusNeeded&&a===i&&("radio-buttons"!==i.inputType||n||e.checked)&&(this._fieldFocusNeeded=!1,e.focus())}_handleInputFocus(e){const t=e.target,i=this._getInputFieldFromInput(t);this._activeInputName=i.name,"date"===i.type?this._syncDateFieldEdits(t):this._isNumberInputField(i)&&this._setUpNumberFieldEdit(t)}_isNumberInputField({domain:e,inputType:t="text-box",type:i}){return"number"===i&&"text-box"===t&&(!e||"coded-value"!==e.type)}_handleInputBlur(e){const t=e.target,a=this._getInputFieldFromInput(t);if("date"===a.type){const i=e.relatedTarget,n=i&&this._getInputFieldFromInput(i);if(n&&"date"===a.type&&"date"===n.type&&a.field===n.field){if(""!==t.value&&""===i.value){const n=i.getAttribute("data-date-part");i.value=this._formatDate(a.value??Date.now())[n],this._parseDate(t.value,t.getAttribute("data-date-part"))&&this._commitInputValue(e.target,!0,!1)}return}}"number"===a.type&&i(this._activeNumberFieldEdit)&&(this._activeNumberFieldEdit.input.value=`${a.value}`,this._activeNumberFieldEdit=null),this._commitInputValue(t),this.scheduleRender()}_commitInputValue(e,t=!1,a=!0){const n=this._getInputFieldFromInput(e);if(this._activeDateFieldEdit){const{date:i,time:s}=this._activeDateFieldEdit,l=this._parseDateTime(e.value,n,i.active?"date":"time"),r=null!==this.viewModel.getValue(n.name),o=i.input&&(s.input||!n.includeTime),u=null===l;if(t){if(u)return;(o||!a||r)&&this._updateDateFieldValue(n,l)}else{if(""===i.input?.value||""===s.input?.value)this._updateDateFieldValue(n,null);else if(o){const e=`${i.input.value} ${s.input?.value??""}`,t=this._parseDateTime(e,n);!(null!==t)&&r||this._updateDateFieldValue(n,t)}this._activeDateFieldEdit=null}}else i(this._activeNumberFieldEdit)&&this._isNumberInputField(n)&&(this._activeNumberFieldEdit.value=e.value),this._updateFieldValue(e)}_handleInputKeyDown(e){const{key:t,altKey:i,ctrlKey:a,metaKey:n}=e,s=this._getInputFieldFromInput(e.target);if("Enter"===t)this._isInputFieldInGroup(s)&&"collapsed"===s.group.state&&(s.group.state="expanded");else{const{type:l}=s.field,r="single"===l||"double"===l,o=!i&&!a&&!n;if(("integer"===l||"small-integer"===l||r)&&o&&1===t.length){const i=Number(t),a=["-","+"],n=["e","."],s=r?[...a,...n]:a;isNaN(i)&&!s.includes(t)&&e.preventDefault()}}}_setUpNumberFieldEdit(e){const t=this._getInputFieldFromInput(e);this._activeNumberFieldEdit={fieldName:t.name,input:e,value:e.value}}_syncDateFieldEdits(e){const t=this._getInputFieldFromInput(e);if("date"!==t.type)return;const i=e.getAttribute("data-date-part"),a="date"===i?{value:e.value,input:e,active:!0}:{...this._activeDateFieldEdit?.date,active:!1},n="time"===i?{value:e.value,input:e,active:!0}:{...this._activeDateFieldEdit?.time,active:!1};this._activeDateFieldEdit={fieldName:t.name,date:a,time:n}}_updateFieldValue(e){const t=e.getAttribute(y);if(this.viewModel.setValue(t,this._parseValue(e)),this._userUpdatedInputFieldNames.add(t),this.viewModel.fieldsWithContingentValues.has(t)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>i(t))));this.viewModel.validateContingencyConstraints(e)}}_updateDateFieldValue(e,t){this.viewModel.setValue(e.name,t),this._userUpdatedInputFieldNames.add(e.name)}_parseValue(e){const t=this._getInputFieldFromInput(e),i=e.value;if(this._inputFieldHasInputType(t,"switch")&&"CALCITE-COMBOBOX"!==e.tagName)return e.checked?t.fieldElement.input.onValue:t.fieldElement.input.offValue;if("radio-buttons"===t.inputType&&"radio"===e.type&&!e.checked)return t.value;const{type:a}=t;if("number"===a)return i?parseFloat(i):null;if("date"===a){if(!i)return null;const a=Number(i);if(!isNaN(a))return a;const n=e.getAttribute("data-date-part"),s=this._parseDate(i,n);if(!s)return null;let l=g.fromJSDate(s);const r=t.domain,o=g.now();let u=o;if(r&&"range"===r.type){const e=g.fromMillis(r.maxValue);o<e&&(u=e)}const d=this.viewModel.getValue(t.name),p=null!=d?g.fromMillis(d):u;return l="date"===n?l.set({hour:p.hour,minute:p.minute,second:p.second}):l.set({day:p.day,month:p.month,year:p.year}),l.toMillis()}return i}_handleOptionChange(e){this._commitInputValue(e),this.scheduleRender()}_handleGroupClick(e){const t=e.currentTarget["data-group"],i="expanded"===t.state,a="sequential"===this.groupDisplay,n=`.${b.groupHeader}`;if(!(i&&!e.target.closest(n))){if(this._activeInputName=this._getFocusableInput("forward",t)?.name,a){const a=e.target.closest(n);if(i&&!a)return;this.viewModel.inputFields.forEach((e=>{F(e)&&e!==t&&(e.state="collapsed")}))}t.state=i?"collapsed":"expanded",this._fieldFocusNeeded=a,this.scheduleRender()}}_handleSubmit(e){e.preventDefault()}_handleFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_formatDate(e){if(null==e)return{date:"",time:""};const t=g.fromMillis(e,{locale:v(),numberingSystem:"latn"});return{date:t.toLocaleString({year:"numeric",month:"2-digit",day:"2-digit"}),time:t.toFormat(I.timePattern)}}_parseDate(e,t){if(null==e||""===e)return null;const{timePattern:i,datePattern:a}=I,n=t?"date"===t?a:i:`${a} ${i}`,s=g.fromFormat(e,n,{locale:v(),numberingSystem:"latn"});return s.isValid?s.toJSDate():null}_inputFieldHasInputType(e,t){return i(e.fieldElement)&&e.fieldElement.input?.type===t}_valueIsValidContingentValue(e,i){switch(i.objectType){case"any":return!0;case"null":return null==e;case"code":return e===i.codedValue?.code;case"range":return e>=i.minValue&&e<=i.maxValue;default:return t(i.objectType),!1}}};e([s("viewModel.feature")],w.prototype,"feature",void 0),e([s("viewModel.formTemplate")],w.prototype,"formTemplate",void 0),e([l()],w.prototype,"groupDisplay",void 0),e([l()],w.prototype,"headingLevel",void 0),e([l({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],w.prototype,"label",void 0),e([s("viewModel.layer")],w.prototype,"layer",void 0),e([l(),h("esri/widgets/FeatureForm/t9n/FeatureForm")],w.prototype,"messages",void 0),e([l(),h("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],w.prototype,"messagesTemplates",void 0),e([s("viewModel.strict")],w.prototype,"strict",void 0),e([l(),f(["value-change","submit"])],w.prototype,"viewModel",void 0),e([s("viewModel.getValues")],w.prototype,"getValues",null),e([s("viewModel.submit")],w.prototype,"submit",null),w=e([r("esri.widgets.FeatureForm")],w);const V=w;export{V 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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../core/Accessor.js";import{HandleOwnerMixin as o}from"../../core/HandleOwner.js";import
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import r from"../../core/Accessor.js";import{HandleOwnerMixin as o}from"../../core/HandleOwner.js";import s from"../../core/Logger.js";import{isSome as i,isNone as l}from"../../core/maybe.js";import{watch as a,initial as n}from"../../core/reactiveUtils.js";import{property as p}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as m}from"../../core/accessorSupport/decorators/subclass.js";import{renderPreviewHTML as u}from"../../symbols/support/symbolUtils.js";var c;const y=s.getLogger("esri.widgets.FeatureTemplates.TemplateItem");let h=c=class extends(o(r)){constructor(t){super(t),this._activeFetchInfo={id:null,request:null},this.description=null,this.label=null,this.layer=null,this.template=null,this.thumbnail=null}initialize(){this.handles.add(a((()=>{const{layer:t}=this;return[t&&"renderer"in t?t.renderer:null,this.template]}),(()=>{this._activeFetchInfo.id=null,this._activeFetchInfo.request=null,this._set("thumbnail",null)}),n))}clone(){const t=i(this.thumbnail)?this.thumbnail.cloneNode(!0):null,e=new c({layer:this.layer,template:this.template});return e._set("thumbnail",t),e}static async fetchThumbnail(t,e){if(b(t))return y.warn("Thumbnails for sublayers of a SubtypeGroupLayer are not yet supported."),null;const r=await d(t,e);if(l(r))return null;const o={maxSize:36};"dictionary"===t.renderer?.type&&(o.fieldMap=t.renderer.fieldMap,o.feature={attributes:e.prototype.attributes});return await u(r,o)}};async function d(t,r){const{renderer:o}=t;if(o){const t=new e({attributes:r.prototype.attributes}),s=await o.getSymbolAsync(t);if(s)return s}return f(t)}async function f(t){const{geometryType:e}=t,r="point"===e||"multipoint"===e?await import("../../symbols/SimpleMarkerSymbol.js"):"polyline"===e?await import("../../symbols/SimpleLineSymbol.js"):"polygon"===e||"mesh"===e||"multipatch"===e?await import("../../symbols/SimpleFillSymbol.js"):null;return r?new r.default:null}function b(t){return"subtype-group"===t.type}t([p({aliasOf:"template.description"})],h.prototype,"description",void 0),t([p({aliasOf:"template.name"})],h.prototype,"label",void 0),t([p()],h.prototype,"layer",void 0),t([p()],h.prototype,"template",void 0),t([p({readOnly:!0})],h.prototype,"thumbnail",void 0),h=c=t([m("esri.widgets.FeatureTemplates.TemplateItem")],h);const j=h;export{j 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.24/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/Error.js";import{HandleOwner as s}from"../../core/HandleOwner.js";import{isSome as l}from"../../core/maybe.js";import{createTask as r,throwIfAborted as o}from"../../core/promiseUtils.js";import{watch as a,initial as n,syncAndInitial as h}from"../../core/reactiveUtils.js";import{Milliseconds as c}from"../../core/time.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import u from"../../webdoc/Widgets.js";import y from"../../webdoc/widgets/FloorFilter.js";import{GoToMixin as p}from"../support/GoTo.js";function v(e){return"esri.WebMap"===e.declaredClass}function m(e){return"esri.WebScene"===e.declaredClass}let F=class extends(p(s)){constructor(e){super(e),this.filterMenuOpen=!1,this.filterMenuType="site",this.filterMode="base-floors",this.levelsExpanded=!0,this.searchTerm=null,this.view=null,this._updateFloorFilterTask=null}initialize(){this.handles.add([a((()=>this.view?.map),(e=>{l(this._updateFloorFilterTask)&&(this._updateFloorFilterTask.abort(),this._updateFloorFilterTask=null),this._updateFloorFilterTask=r((async t=>{await this._updateFloorFilterFromMap(e),o(t),this._setInitialViewState(e)}))}),n),a((()=>this.view),((e,t)=>{this._unregisterWidget(t),this._registerWidget(e),this._watchSearchResults(e)}),h),a((()=>this.view?.widthBreakpoint),(e=>{this._viewWidthBreakpoint=e})),a((()=>this.view?.heightBreakpoint),(e=>{this._viewHeightBreakpoint=e}))])}destroy(){this._unregisterWidget(this.view),this.view=null,l(this._updateFloorFilterTask)&&(this._updateFloorFilterTask.abort(),this._updateFloorFilterTask=null)}set enabled(e){this._callOverride("enabled",e)}set facility(e){if(e&&this._isOverridden("facility")){const t=this.getFacility(e);this.hasMultipleSites&&(this.site=t?.siteId||void 0)}this._callOverride("facility",e)}set filterFeatures(e){this._callOverride("filterFeatures",e)}set filterLayers(e){this._callOverride("filterLayers",e)}get hasFacilities(){return this.filterLayers?.facilityLayer&&this.filterFeatures?.facilities?.facilitiesInfo?.length>0}get hasLevels(){return this.filterLayers?.levelLayer&&this.filterFeatures?.levels?.levelsInfo?.length>0}get hasMultipleSites(){return this.filterLayers?.siteLayer&&this.filterFeatures?.sites?.sitesInfo?.length>1}get isNormalMode(){let e=!0;const t=this._viewWidthBreakpoint;return"xsmall"!==this._viewHeightBreakpoint&&"xsmall"!==t||(e=!1),e}set level(e){if(!e)return this._callOverride("level",e),this.facility=void 0,this.site=void 0,void this.setFloors(null);let t=null,i=null;const s=e?.split("--");if(s?.length>1&&"all"===s[0]?(i=s[1],t={id:e,facilityId:i,shortName:null,longName:null,levelNumber:null,verticalOrder:null}):(t=this.getLevel(e),i=t?.facilityId),this.level!==e||this.isNormalMode||this.levelsExpanded)t&&this.hasFacilities&&this.hasLevels?(this.facility=i,this.hasMultipleSites&&(this.site=this.getFacility(i)?.siteId),this.setFloors(t)):this._isOverridden("level")&&(this.facility=void 0,this.site=void 0,this.hasMultipleSites&&(this.filterMenuType="site"),this.setFloors(null)),this._callOverride("level",e);else{this.getFacilityLevels(i)?.length>1&&(this.levelsExpanded=!0)}}set longNames(e){this._callOverride("longNames",e)}set minimized(e){this._callOverride("minimized",e)}set pinnedLevels(e){this._callOverride("pinnedLevels",e)}set site(e){this._callOverride("site",e)}get state(){return this.view&&this.filterFeatures&&this.hasFacilities&&this.hasLevels?"ready":this.view&&!this.filterFeatures?"loading":"disabled"}filterFacilities(e){let t=e;this.searchTerm&&(t=e.filter((e=>{const{name:t}=e;return t.toLowerCase().includes(this.searchTerm.toLowerCase())}))),this.site&&(t=t.filter((e=>e.siteId===this.site)));return t.sort(((e,t)=>{const i=e.name,s=t.name;return i>s?1:i===s?0:-1}))}filterSites(e){let t=e;this.searchTerm&&(t=e.filter((e=>{const{name:t}=e;return t.toLowerCase().includes(this.searchTerm.toLowerCase())})));return t.sort(((e,t)=>{const i=e.name,s=t.name;return i>s?1:i===s?0:-1}))}getBaseLevel(e){const t=this.filterFeatures?.levels?.levelsInfo;let i=null;if(e){const{id:s}=e;if(t&&t.length>0&&(t.forEach((e=>{0===e.verticalOrder&&e.facilityId===s&&(i=e)})),!i)){let e=null;t.forEach((t=>{t.facilityId===s&&(e?t.verticalOrder>=0?(e.verticalOrder<0||t.verticalOrder<e.verticalOrder)&&(e=t):e.verticalOrder<0&&t.verticalOrder>e.verticalOrder&&(e=t):e=t)})),e&&(i=e)}}return i}getFacility(e){return this.filterFeatures?.facilities?.facilitiesInfo?.find((t=>t.id===e))??null}getFacilityLevels(e){if(!e||!this.filterFeatures?.levels?.levelsInfo)return[];return this.filterFeatures.levels.levelsInfo.filter((t=>t.facilityId===e)).sort(((e,t)=>{const i=e.verticalOrder,s=t.verticalOrder;return i>s?-1:i===s?0:1}))}getLevel(e){return this.filterFeatures?.levels?.levelsInfo?.find((t=>t.id===e))??null}getSite(e){return this.filterFeatures?.sites?.sitesInfo?.find((t=>t.id===e))??null}goTo(e){const{view:t}=this;if(!t||!e)return;const{geometry:i}=e;if(i&&i.extent){const e={duration:c(1e3),easing:"out-back"},t={target:i.extent,options:e};this.callGoTo(t)}}setFloors(e){this.view?.map?.allLayers?.forEach((e=>{"feature"===e.type&&this._computeViewAllModeFloors(e)})),this.view.floors=new t(this._computeFloors(e))}updateWebDocument(e){if(v(e)){const t=new y({enabled:this.enabled,longNames:this.longNames,minimized:this.minimized,pinnedLevels:this.pinnedLevels,site:this.site??null,facility:this.facility??null,level:this.level??null});e.widgets?e.widgets.floorFilter=t:e.widgets=new u({floorFilter:t})}}_computeFloors(e){if("single-floor"===this.filterMode)this._computeSingleFloor(e);else if("base-floors"===this.filterMode)return"3d"===this.view.type?this._computeBaseFloors3D(e):this._computeBaseFloors(e);return this._computeEmptyFloors()}_computeSingleFloor(e){if(!e)return this._computeEmptyFloors();const t=[];if("all"===e?.id){this.getFacilityLevels(e.facilityId).forEach((e=>{e.id&&t.push(e.id)}))}else e&&t.push(e.id);return t}_computeBaseFloors(e){const t=this.filterFeatures?.levels?.levelsInfo;if(!t||!t.length)return this._computeEmptyFloors();const i=[];if("all"===e?.id){this.getFacilityLevels(e.facilityId).forEach((e=>{e.id&&i.push(e.id)}))}else e&&i.push(e.id);const s=e?.facilityId;return t.forEach((e=>{const{id:t,facilityId:l,verticalOrder:r}=e;(s||0!==r||i.includes(t))&&(l===s||0!==r||i.includes(t))||i.push(t)})),i}_computeBaseFloors3D(e){const t=this.filterFeatures?.levels?.levelsInfo;if(!t||!t.length)return this._computeEmptyFloors();const i=[],s=e?.id.split("--");if(s?.length>1&&"all"===s[0]){this.getFacilityLevels(e.facilityId).forEach((e=>{e.id&&i.push(e.id)}))}else e&&i.push(e.id);const l=e?.facilityId;return t.forEach((e=>{const{id:t,facilityId:s}=e;(l||i.includes(t))&&(s===l||i.includes(t))||i.push(t)})),i}_computeEmptyFloors(){return[]}async _setFilterLayers(){const{view:e}=this;if(!this._isOverridden("filterLayers")){if(!v(e.map)&&!m(e.map))throw new i("Map must be a webmap or webscene");{const t=e.map,i=t?.allLayers;if(i?.items?.length>0){const e={siteLayer:null,facilityLayer:null,levelLayer:null},s=t.floorInfo?.siteLayer?.layerId,l=t.floorInfo?.facilityLayer?.layerId,r=t.floorInfo?.levelLayer?.layerId,o=t.floorInfo?.siteLayer?.sublayerId||t.floorInfo?.facilityLayer?.sublayerId||t.floorInfo?.levelLayer?.sublayerId;if(!l||!r)return;const a=i.items.filter((e=>"feature"===e.type||"scene"===e.type)),n=i.items.filter((e=>"map-image"===e.type));if(n?.length>0&&o){await Promise.all(n.map((e=>e.load())));const i=t.floorInfo?.siteLayer?.sublayerId,o=t.floorInfo?.facilityLayer?.sublayerId,a=t.floorInfo?.levelLayer?.sublayerId;n.forEach((t=>{const n=t.id,h=t?.allSublayers,c=h?.items;(n===s||n===l||n===r)&&c?.length>0&&h.items.forEach((t=>{const l=t.id;n===s&&l===i?e.siteLayer=t:l===o?e.facilityLayer=t:l===a&&(e.levelLayer=t)}))}))}a?.length>0&&a.forEach((t=>{const i=t.id;i===s?e.siteLayer=t:i===l?e.facilityLayer=t:i===r&&(e.levelLayer=t)})),this.filterLayers=e}}}}async _getFilterFeatures(){if(this._isOverridden("filterFeatures"))return this.filterFeatures;const e={sites:null,facilities:null,levels:null},t=await this._getSites();e.sites=t;const i=await this._getFacilities();e.facilities=i;const s=await this._getLevels();return e.levels=s,e}async _getSites(){const{filterLayers:e,view:t}=this,i=t.map,{siteLayer:s}=e,l={sitesInfo:[]};if(!s||!i?.floorInfo?.siteLayer)return l;const r=s.createQuery();r.returnGeometry=!0,r.outFields=["*"],r.returnZ=!0,"type"in s&&"scene"===s.type&&(r.multipatchOption="xyFootprint");const{siteIdField:o,nameField:a}=i.floorInfo.siteLayer,n=await s.queryFeatures(r);if(n?.features?.length>0){n.features.forEach((e=>{const t=e.attributes,i=e.geometry,s=t[o],r=t[a];s&&r&&l.sitesInfo.push({id:s,name:r,geometry:i})}))}return l}async _getFacilities(){const{filterLayers:e,view:t}=this,i=t.map,{facilityLayer:s}=e,l={facilitiesInfo:[]};if(!s||!i?.floorInfo?.facilityLayer)return l;const r=s.createQuery();r.returnGeometry=!0,r.outFields=["*"],r.returnZ=!0,"type"in s&&"scene"===s.type&&(r.multipatchOption="xyFootprint");const{facilityIdField:o,siteIdField:a,nameField:n}=i.floorInfo.facilityLayer,h=await s.queryFeatures(r);if(h?.features?.length>0){h.features.forEach((e=>{const t=e.attributes,i=e.geometry,s=t[o],r=t[a],h=t[n];s&&h&&l.facilitiesInfo.push({id:s,siteId:r,name:h,geometry:i})}))}return l}async _getLevels(){const{filterLayers:e,view:t}=this,i=t.map,{levelLayer:s}=e,l={levelsInfo:[]};if(!s||!i?.floorInfo?.levelLayer)return l;const r=s.createQuery();r.returnGeometry=!0,r.outFields=["*"],r.returnZ=!0;const{levelIdField:o,facilityIdField:a,longNameField:n,shortNameField:h,levelNumberField:c,verticalOrderField:d}=i.floorInfo.levelLayer,f=await s.queryFeatures(r);if(f?.features?.length>0){f.features.forEach((e=>{const t=e.attributes,i=t[o],s=t[a],r=t[n],f=t[h],u=t[c],y=t[d];i&&s&&r&&f&&"number"==typeof u&&"number"==typeof y&&l.levelsInfo.push({id:i,facilityId:s,longName:r,shortName:f,levelNumber:u,verticalOrder:y})}))}return l}_registerWidget(e){const t=e?.persistableViewModels.includes(this);t||e?.persistableViewModels.add(this)}_unregisterWidget(e){e?.persistableViewModels.remove(this)}_watchSearchResults(e){e?.on("select-result-floor",(e=>{const t=this.getLevel(e);t&&this.level!==e&&(this.level=e,this.setFloors(t))}))}async _setInitialViewState(e){if(this.view)try{await this.view.when(),await this._setFilterLayers();const t=await this._getFilterFeatures();if(!t)return;if(this.filterFeatures=t,!this.hasFacilities||!this.hasLevels)return void console.error("Facilities and Levels are required for the Floor Filter widget");if(this.hasMultipleSites||(this.filterMenuType="facility"),this.facility&&this.level){this.filterMenuType="facility";const e=this.getFacility(this.facility),t=this.getLevel(this.level);this.site||(this.site=e.siteId||void 0),this.setFloors(t),this.goTo(e)}else if(this.facility&&!this.level){this.filterMenuType="facility";const e=this.getFacility(this.facility),t=this.getBaseLevel(e);this.site||(this.site=e.siteId||void 0),this.level=t?.id||void 0,this.setFloors(t),this.goTo(e)}else if(!this.facility&&this.level){this.filterMenuType="facility";const e=this.getLevel(this.level),t=this.getFacility(e?.facilityId);this.facility=t?.id||void 0,this.site||(this.site=t?.siteId||void 0),this.setFloors(e),this.goTo(t)}else if(!this.site||this.facility||this.level){if(!e||!v(e))return void this.setFloors(null);const t=e?.widgets?.floorFilter;if(!t)return void this.setFloors(null);t.site&&!this.site&&(this.site=t.site),this.setFloors(null)}else{this.filterMenuType="site";const e=this.getSite(this.site);this.setFloors(null),this.goTo(e)}}catch(t){console.error("Couldn't retrieve sites, facilities, and levels",t)}}_callOverride(e,t){this._override(e,t)}async _updateFloorFilterFromMap(e){if(!e||!v(e))return;const t=e?.widgets?.floorFilter;t&&(this._isOverridden("enabled")||(this.enabled=t.enabled),this._isOverridden("longNames")||(this.longNames=t.longNames),this._isOverridden("minimized")||(this.minimized=t.minimized),this._isOverridden("pinnedLevels")||(this.pinnedLevels=t.pinnedLevels),this._isOverridden("site")||(this.site=t.site),this._isOverridden("facility")||(this.facility=t.facility),this._isOverridden("level")||(this.level=t.level))}_computeViewAllModeFloors(e){const{filterFeatures:i}=this;if(e.floorInfo?.viewAllMode&&this.hasLevels&&this.hasFacilities&&"base-floors"===this.filterMode){const{level:s,facility:l}=this,r=[];i.levels.levelsInfo.forEach((e=>{const{id:t,facilityId:i}=e;l&&i===l?s&&t===s&&r.push(t):r.push(t)})),e.floorInfo.viewAllLevelIds=new t(r)}}};e([d({value:!1})],F.prototype,"enabled",null),e([d({value:void 0})],F.prototype,"facility",null),e([d({value:null})],F.prototype,"filterFeatures",null),e([d({value:null})],F.prototype,"filterLayers",null),e([d()],F.prototype,"filterMenuOpen",void 0),e([d()],F.prototype,"filterMenuType",void 0),e([d()],F.prototype,"filterMode",void 0),e([d()],F.prototype,"hasFacilities",null),e([d()],F.prototype,"hasLevels",null),e([d()],F.prototype,"hasMultipleSites",null),e([d({readOnly:!0})],F.prototype,"isNormalMode",null),e([d({value:void 0})],F.prototype,"level",null),e([d({value:!1})],F.prototype,"longNames",null),e([d()],F.prototype,"levelsExpanded",void 0),e([d({value:!1})],F.prototype,"minimized",null),e([d({value:!1})],F.prototype,"pinnedLevels",null),e([d()],F.prototype,"searchTerm",void 0),e([d({value:void 0})],F.prototype,"site",null),e([d({readOnly:!0})],F.prototype,"state",null),e([d()],F.prototype,"view",void 0),e([d()],F.prototype,"_viewHeightBreakpoint",void 0),e([d()],F.prototype,"_viewWidthBreakpoint",void 0),e([d()],F.prototype,"updateWebDocument",null),F=e([f("esri/widgets/FloorFilter/FloorFilterViewModel")],F);const g=F;export{g as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import i from"../../core/Error.js";import{HandleOwner as s}from"../../core/HandleOwner.js";import{isSome as l}from"../../core/maybe.js";import{createTask as r,throwIfAborted as o}from"../../core/promiseUtils.js";import{watch as a,initial as n,syncAndInitial as h}from"../../core/reactiveUtils.js";import{Milliseconds as c}from"../../core/time.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import u from"../../webdoc/Widgets.js";import y from"../../webdoc/widgets/FloorFilter.js";import{GoToMixin as p}from"../support/GoTo.js";function v(e){return"esri.WebMap"===e.declaredClass}function m(e){return"esri.WebScene"===e.declaredClass}let F=class extends(p(s)){constructor(e){super(e),this.filterMenuOpen=!1,this.filterMenuType="site",this.filterMode="base-floors",this.levelsExpanded=!0,this.searchTerm=null,this.view=null,this._updateFloorFilterTask=null}initialize(){this.handles.add([a((()=>this.view?.map),(e=>{l(this._updateFloorFilterTask)&&(this._updateFloorFilterTask.abort(),this._updateFloorFilterTask=null),this._updateFloorFilterTask=r((async t=>{await this._updateFloorFilterFromMap(e),o(t),this._setInitialViewState(e)}))}),n),a((()=>this.view),((e,t)=>{this._unregisterWidget(t),this._registerWidget(e),this._watchSearchResults(e)}),h),a((()=>this.view?.widthBreakpoint),(e=>{this._viewWidthBreakpoint=e})),a((()=>this.view?.heightBreakpoint),(e=>{this._viewHeightBreakpoint=e}))])}destroy(){this._unregisterWidget(this.view),this.view=null,l(this._updateFloorFilterTask)&&(this._updateFloorFilterTask.abort(),this._updateFloorFilterTask=null)}set enabled(e){this._callOverride("enabled",e)}set facility(e){if(e&&this._isOverridden("facility")){const t=this.getFacility(e);this.hasMultipleSites&&(this.site=t?.siteId||void 0)}this._callOverride("facility",e)}set filterFeatures(e){this._callOverride("filterFeatures",e)}set filterLayers(e){this._callOverride("filterLayers",e)}get hasFacilities(){return this.filterLayers?.facilityLayer&&this.filterFeatures?.facilities?.facilitiesInfo?.length>0}get hasLevels(){return this.filterLayers?.levelLayer&&this.filterFeatures?.levels?.levelsInfo?.length>0}get hasMultipleSites(){return this.filterLayers?.siteLayer&&this.filterFeatures?.sites?.sitesInfo?.length>1}get isNormalMode(){let e=!0;const t=this._viewWidthBreakpoint;return"xsmall"!==this._viewHeightBreakpoint&&"xsmall"!==t||(e=!1),e}set level(e){if(!e)return this._callOverride("level",e),this.facility=void 0,this.site=void 0,void this.setFloors(null);let t=null,i=null;const s=e?.split("--");if(s?.length>1&&"all"===s[0]?(i=s[1],t={id:e,facilityId:i,shortName:null,longName:null,levelNumber:null,verticalOrder:null}):(t=this.getLevel(e),i=t?.facilityId),this.level!==e||this.isNormalMode||this.levelsExpanded)t&&this.hasFacilities&&this.hasLevels?(this.facility=i,this.hasMultipleSites&&(this.site=this.getFacility(i)?.siteId),this.setFloors(t)):this._isOverridden("level")&&(this.facility=void 0,this.site=void 0,this.hasMultipleSites&&(this.filterMenuType="site"),this.setFloors(null)),this._callOverride("level",e);else{this.getFacilityLevels(i)?.length>1&&(this.levelsExpanded=!0)}}set longNames(e){this._callOverride("longNames",e)}set minimized(e){this._callOverride("minimized",e)}set pinnedLevels(e){this._callOverride("pinnedLevels",e)}set site(e){this._callOverride("site",e)}get state(){return this.view&&this.filterFeatures&&this.hasFacilities&&this.hasLevels?"ready":this.view&&!this.filterFeatures?"loading":"disabled"}filterFacilities(e){let t=e;this.searchTerm&&(t=e.filter((e=>{const{name:t}=e;return t.toLowerCase().includes(this.searchTerm.toLowerCase())}))),this.site&&(t=t.filter((e=>e.siteId===this.site)));return t.sort(((e,t)=>{const i=e.name,s=t.name;return i>s?1:i===s?0:-1}))}filterSites(e){let t=e;this.searchTerm&&(t=e.filter((e=>{const{name:t}=e;return t.toLowerCase().includes(this.searchTerm.toLowerCase())})));return t.sort(((e,t)=>{const i=e.name,s=t.name;return i>s?1:i===s?0:-1}))}getBaseLevel(e){const t=this.filterFeatures?.levels?.levelsInfo;let i=null;if(e){const{id:s}=e;if(t&&t.length>0&&(t.forEach((e=>{0===e.verticalOrder&&e.facilityId===s&&(i=e)})),!i)){let e=null;t.forEach((t=>{t.facilityId===s&&(e?t.verticalOrder>=0?(e.verticalOrder<0||t.verticalOrder<e.verticalOrder)&&(e=t):e.verticalOrder<0&&t.verticalOrder>e.verticalOrder&&(e=t):e=t)})),e&&(i=e)}}return i}getFacility(e){return this.filterFeatures?.facilities?.facilitiesInfo?.find((t=>t.id===e))??null}getFacilityLevels(e){if(!e||!this.filterFeatures?.levels?.levelsInfo)return[];return this.filterFeatures.levels.levelsInfo.filter((t=>t.facilityId===e)).sort(((e,t)=>{const i=e.verticalOrder,s=t.verticalOrder;return i>s?-1:i===s?0:1}))}getLevel(e){return this.filterFeatures?.levels?.levelsInfo?.find((t=>t.id===e))??null}getSite(e){return this.filterFeatures?.sites?.sitesInfo?.find((t=>t.id===e))??null}goTo(e){const{view:t}=this;if(!t||!e)return;const{geometry:i}=e;if(i&&i.extent){const e={duration:c(1e3),easing:"out-back"},t={target:i.extent,options:e};this.callGoTo(t)}}setFloors(e){this.view?.map?.allLayers?.forEach((e=>{"feature"===e.type&&this._computeViewAllModeFloors(e)})),this.view.floors=new t(this._computeFloors(e))}updateWebDocument(e){if(v(e)){const t=new y({enabled:this.enabled,longNames:this.longNames,minimized:this.minimized,pinnedLevels:this.pinnedLevels,site:this.site??null,facility:this.facility??null,level:this.level??null});e.widgets?e.widgets.floorFilter=t:e.widgets=new u({floorFilter:t})}}_computeFloors(e){if("single-floor"===this.filterMode)this._computeSingleFloor(e);else if("base-floors"===this.filterMode)return"3d"===this.view.type?this._computeBaseFloors3D(e):this._computeBaseFloors(e);return this._computeEmptyFloors()}_computeSingleFloor(e){if(!e)return this._computeEmptyFloors();const t=[];if("all"===e?.id){this.getFacilityLevels(e.facilityId).forEach((e=>{e.id&&t.push(e.id)}))}else e&&t.push(e.id);return t}_computeBaseFloors(e){const t=this.filterFeatures?.levels?.levelsInfo;if(!t||!t.length)return this._computeEmptyFloors();const i=[];if("all"===e?.id){this.getFacilityLevels(e.facilityId).forEach((e=>{e.id&&i.push(e.id)}))}else e&&i.push(e.id);const s=e?.facilityId;return t.forEach((e=>{const{id:t,facilityId:l,verticalOrder:r}=e;(s||0!==r||i.includes(t))&&(l===s||0!==r||i.includes(t))||i.push(t)})),i}_computeBaseFloors3D(e){const t=this.filterFeatures?.levels?.levelsInfo;if(!t||!t.length)return this._computeEmptyFloors();const i=[],s=e?.id.split("--");if(s?.length>1&&"all"===s[0]){this.getFacilityLevels(e.facilityId).forEach((e=>{e.id&&i.push(e.id)}))}else e&&i.push(e.id);const l=e?.facilityId;return t.forEach((e=>{const{id:t,facilityId:s}=e;(l||i.includes(t))&&(s===l||i.includes(t))||i.push(t)})),i}_computeEmptyFloors(){return[]}async _setFilterLayers(){const{view:e}=this;if(!this._isOverridden("filterLayers")){if(!v(e.map)&&!m(e.map))throw new i("Map must be a webmap or webscene");{const t=e.map,i=t?.allLayers;if(i?.items?.length>0){const e={siteLayer:null,facilityLayer:null,levelLayer:null},s=t.floorInfo?.siteLayer?.layerId,l=t.floorInfo?.facilityLayer?.layerId,r=t.floorInfo?.levelLayer?.layerId,o=t.floorInfo?.siteLayer?.sublayerId||t.floorInfo?.facilityLayer?.sublayerId||t.floorInfo?.levelLayer?.sublayerId;if(!l||!r)return;const a=i.items.filter((e=>"feature"===e.type||"scene"===e.type)),n=i.items.filter((e=>"map-image"===e.type));if(n?.length>0&&o){await Promise.all(n.map((e=>e.load())));const i=t.floorInfo?.siteLayer?.sublayerId,o=t.floorInfo?.facilityLayer?.sublayerId,a=t.floorInfo?.levelLayer?.sublayerId;n.forEach((t=>{const n=t.id,h=t?.allSublayers,c=h?.items;(n===s||n===l||n===r)&&c?.length>0&&h.items.forEach((t=>{const l=t.id;n===s&&l===i?e.siteLayer=t:l===o?e.facilityLayer=t:l===a&&(e.levelLayer=t)}))}))}a?.length>0&&a.forEach((t=>{const i=t.id;i===s?e.siteLayer=t:i===l?e.facilityLayer=t:i===r&&(e.levelLayer=t)})),this.filterLayers=e}}}}async _getFilterFeatures(){if(this._isOverridden("filterFeatures"))return this.filterFeatures;const e={sites:null,facilities:null,levels:null},t=await this._getSites();e.sites=t;const i=await this._getFacilities();e.facilities=i;const s=await this._getLevels();return e.levels=s,e}async _getSites(){const{filterLayers:e,view:t}=this,i=t.map,{siteLayer:s}=e,l={sitesInfo:[]};if(!s||!i?.floorInfo?.siteLayer)return l;const r=s.createQuery();r.returnGeometry=!0,r.outFields=["*"],r.returnZ=!0,"type"in s&&"scene"===s.type&&(r.multipatchOption="xyFootprint");const{siteIdField:o,nameField:a}=i.floorInfo.siteLayer,n=await s.queryFeatures(r);if(n?.features?.length>0){n.features.forEach((e=>{const t=e.attributes,i=e.geometry,s=t[o],r=t[a];s&&r&&l.sitesInfo.push({id:s,name:r,geometry:i})}))}return l}async _getFacilities(){const{filterLayers:e,view:t}=this,i=t.map,{facilityLayer:s}=e,l={facilitiesInfo:[]};if(!s||!i?.floorInfo?.facilityLayer)return l;const r=s.createQuery();r.returnGeometry=!0,r.outFields=["*"],r.returnZ=!0,"type"in s&&"scene"===s.type&&(r.multipatchOption="xyFootprint");const{facilityIdField:o,siteIdField:a,nameField:n}=i.floorInfo.facilityLayer,h=await s.queryFeatures(r);if(h?.features?.length>0){h.features.forEach((e=>{const t=e.attributes,i=e.geometry,s=t[o],r=t[a],h=t[n];s&&h&&l.facilitiesInfo.push({id:s,siteId:r,name:h,geometry:i})}))}return l}async _getLevels(){const{filterLayers:e,view:t}=this,i=t.map,{levelLayer:s}=e,l={levelsInfo:[]};if(!s||!i?.floorInfo?.levelLayer)return l;const r=s.createQuery();r.returnGeometry=!0,r.outFields=["*"],r.returnZ=!0;const{levelIdField:o,facilityIdField:a,longNameField:n,shortNameField:h,levelNumberField:c,verticalOrderField:d}=i.floorInfo.levelLayer,f=await s.queryFeatures(r);if(f?.features?.length>0){f.features.forEach((e=>{const t=e.attributes,i=t[o],s=t[a],r=t[n],f=t[h],u=t[c],y=t[d];i&&s&&r&&f&&"number"==typeof u&&"number"==typeof y&&l.levelsInfo.push({id:i,facilityId:s,longName:r,shortName:f,levelNumber:u,verticalOrder:y})}))}return l}_registerWidget(e){const t=e?.persistableViewModels.includes(this);t||e?.persistableViewModels.add(this)}_unregisterWidget(e){e?.persistableViewModels.remove(this)}_watchSearchResults(e){e?.on("select-result-floor",(e=>{const t=this.getLevel(e);t&&this.level!==e&&(this.level=e,this.setFloors(t))}))}async _setInitialViewState(e){if(this.view)try{await this.view.when(),await this._setFilterLayers();const t=await this._getFilterFeatures();if(!t)return;if(this.filterFeatures=t,!this.hasFacilities||!this.hasLevels)return void console.error("Facilities and Levels are required for the Floor Filter widget");if(this.hasMultipleSites||(this.filterMenuType="facility"),this.facility&&this.level){this.filterMenuType="facility";const e=this.getFacility(this.facility),t=this.getLevel(this.level);this.site||(this.site=e.siteId||void 0),this.setFloors(t)}else if(this.facility&&!this.level){this.filterMenuType="facility";const e=this.getFacility(this.facility),t=this.getBaseLevel(e);this.site||(this.site=e.siteId||void 0),this.level=t?.id||void 0,this.setFloors(t)}else if(!this.facility&&this.level){this.filterMenuType="facility";const e=this.getLevel(this.level),t=this.getFacility(e?.facilityId);this.facility=t?.id||void 0,this.site||(this.site=t?.siteId||void 0),this.setFloors(e)}else if(!this.site||this.facility||this.level){if(!e||!v(e))return void this.setFloors(null);const t=e?.widgets?.floorFilter;if(!t)return void this.setFloors(null);t.site&&!this.site&&(this.site=t.site,this.filterMenuType="facility"),this.setFloors(null)}else this.filterMenuType="site",this.setFloors(null)}catch(t){console.error("Couldn't retrieve sites, facilities, and levels",t)}}_callOverride(e,t){this._override(e,t)}async _updateFloorFilterFromMap(e){if(!e||!v(e))return;const t=e?.widgets?.floorFilter;t&&(this._isOverridden("enabled")||(this.enabled=t.enabled),this._isOverridden("longNames")||(this.longNames=t.longNames),this._isOverridden("minimized")||(this.minimized=t.minimized),this._isOverridden("pinnedLevels")||(this.pinnedLevels=t.pinnedLevels),this._isOverridden("site")||(this.site=t.site),this._isOverridden("facility")||(this.facility=t.facility),this._isOverridden("level")||(this.level=t.level))}_computeViewAllModeFloors(e){const{filterFeatures:i}=this;if(e.floorInfo?.viewAllMode&&this.hasLevels&&this.hasFacilities&&"base-floors"===this.filterMode){const{level:s,facility:l}=this,r=[];i.levels.levelsInfo.forEach((e=>{const{id:t,facilityId:i}=e;l&&i===l?s&&t===s&&r.push(t):r.push(t)})),e.floorInfo.viewAllLevelIds=new t(r)}}};e([d({value:!1})],F.prototype,"enabled",null),e([d({value:void 0})],F.prototype,"facility",null),e([d({value:null})],F.prototype,"filterFeatures",null),e([d({value:null})],F.prototype,"filterLayers",null),e([d()],F.prototype,"filterMenuOpen",void 0),e([d()],F.prototype,"filterMenuType",void 0),e([d()],F.prototype,"filterMode",void 0),e([d()],F.prototype,"hasFacilities",null),e([d()],F.prototype,"hasLevels",null),e([d()],F.prototype,"hasMultipleSites",null),e([d({readOnly:!0})],F.prototype,"isNormalMode",null),e([d({value:void 0})],F.prototype,"level",null),e([d({value:!1})],F.prototype,"longNames",null),e([d()],F.prototype,"levelsExpanded",void 0),e([d({value:!1})],F.prototype,"minimized",null),e([d({value:!1})],F.prototype,"pinnedLevels",null),e([d()],F.prototype,"searchTerm",void 0),e([d({value:void 0})],F.prototype,"site",null),e([d({readOnly:!0})],F.prototype,"state",null),e([d()],F.prototype,"view",void 0),e([d()],F.prototype,"_viewHeightBreakpoint",void 0),e([d()],F.prototype,"_viewWidthBreakpoint",void 0),e([d()],F.prototype,"updateWebDocument",null),F=e([f("esri/widgets/FloorFilter/FloorFilterViewModel")],F);const g=F;export{g as default};
|