@arcgis/core 4.28.0-rc.0 → 4.28.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/components/assets/icon/addConstant16.json +1 -0
- package/assets/components/assets/icon/addConstant24.json +1 -0
- package/assets/components/assets/icon/addConstant32.json +1 -0
- package/assets/components/assets/icon/addRasterVariable16.json +1 -0
- package/assets/components/assets/icon/addRasterVariable24.json +1 -0
- package/assets/components/assets/icon/addRasterVariable32.json +1 -0
- package/assets/components/assets/icon/addRasters16.json +1 -0
- package/assets/components/assets/icon/addRasters24.json +1 -0
- package/assets/components/assets/icon/addRasters32.json +1 -0
- package/assets/components/assets/icon/alertOffCircle16F.json +1 -0
- package/assets/components/assets/icon/alertOffCircle24F.json +1 -0
- package/assets/components/assets/icon/alertOffCircle32F.json +1 -0
- package/assets/components/assets/icon/boxChartSeries16.json +1 -0
- package/assets/components/assets/icon/boxChartSeries24.json +1 -0
- package/assets/components/assets/icon/boxChartSeries32.json +1 -0
- package/assets/components/assets/icon/breakRecurrence16.json +1 -0
- package/assets/components/assets/icon/breakRecurrence24.json +1 -0
- package/assets/components/assets/icon/breakRecurrence32.json +1 -0
- package/assets/components/assets/icon/bulletPoint16.json +1 -1
- package/assets/components/assets/icon/bulletPoint24.json +1 -1
- package/assets/components/assets/icon/bulletPoint32.json +1 -1
- package/assets/components/assets/icon/bulletPointLarge16.json +1 -0
- package/assets/components/assets/icon/bulletPointLarge24.json +1 -0
- package/assets/components/assets/icon/bulletPointLarge32.json +1 -0
- package/assets/components/assets/icon/chevronEnd16.json +1 -0
- package/assets/components/assets/icon/chevronEnd24.json +1 -0
- package/assets/components/assets/icon/chevronEnd32.json +1 -0
- package/assets/components/assets/icon/chevronStart16.json +1 -0
- package/assets/components/assets/icon/chevronStart24.json +1 -0
- package/assets/components/assets/icon/chevronStart32.json +1 -0
- package/assets/components/assets/icon/configureGridUnit16.json +1 -0
- package/assets/components/assets/icon/configureGridUnit24.json +1 -0
- package/assets/components/assets/icon/configureGridUnit32.json +1 -0
- package/assets/components/assets/icon/dimensionsUnit16.json +1 -0
- package/assets/components/assets/icon/dimensionsUnit24.json +1 -0
- package/assets/components/assets/icon/dimensionsUnit32.json +1 -0
- package/assets/components/assets/icon/dimensionsWall16.json +1 -0
- package/assets/components/assets/icon/dimensionsWall24.json +1 -0
- package/assets/components/assets/icon/dimensionsWall32.json +1 -0
- package/assets/components/assets/icon/flipVertical16.json +1 -0
- package/assets/components/assets/icon/flipVertical24.json +1 -0
- package/assets/components/assets/icon/flipVertical32.json +1 -0
- package/assets/components/assets/icon/imageCollectionExplorer16.json +1 -0
- package/assets/components/assets/icon/imageCollectionExplorer24.json +1 -0
- package/assets/components/assets/icon/imageCollectionExplorer32.json +1 -0
- package/assets/components/assets/icon/imageMagnifyingGlass16.json +1 -0
- package/assets/components/assets/icon/imageMagnifyingGlass24.json +1 -0
- package/assets/components/assets/icon/imageMagnifyingGlass32.json +1 -0
- package/assets/components/assets/icon/launch216.json +1 -0
- package/assets/components/assets/icon/launch224.json +1 -0
- package/assets/components/assets/icon/launch232.json +1 -0
- package/assets/components/assets/icon/mergeDetails16.json +1 -0
- package/assets/components/assets/icon/mergeDetails24.json +1 -0
- package/assets/components/assets/icon/mergeDetails32.json +1 -0
- package/assets/components/assets/icon/mergeUnits16.json +1 -0
- package/assets/components/assets/icon/mergeUnits24.json +1 -0
- package/assets/components/assets/icon/mergeUnits32.json +1 -0
- package/assets/components/assets/icon/minusCircle16F.json +1 -0
- package/assets/components/assets/icon/minusCircle24F.json +1 -0
- package/assets/components/assets/icon/minusCircle32F.json +1 -0
- package/assets/components/assets/icon/polygonSelect16.json +1 -0
- package/assets/components/assets/icon/polygonSelect24.json +1 -0
- package/assets/components/assets/icon/polygonSelect32.json +1 -0
- package/assets/components/assets/icon/projectMission16.json +1 -0
- package/assets/components/assets/icon/projectMission24.json +1 -0
- package/assets/components/assets/icon/projectMission32.json +1 -0
- package/assets/components/assets/icon/projectTemplate16.json +1 -0
- package/assets/components/assets/icon/projectTemplate24.json +1 -0
- package/assets/components/assets/icon/projectTemplate32.json +1 -0
- package/assets/components/assets/icon/properties16.json +1 -0
- package/assets/components/assets/icon/properties24.json +1 -0
- package/assets/components/assets/icon/properties32.json +1 -0
- package/assets/components/assets/icon/saveAs16.json +1 -0
- package/assets/components/assets/icon/saveAs24.json +1 -0
- package/assets/components/assets/icon/saveAs32.json +1 -0
- package/assets/components/assets/icon/splitUnits16.json +1 -0
- package/assets/components/assets/icon/splitUnits24.json +1 -0
- package/assets/components/assets/icon/splitUnits32.json +1 -0
- package/assets/components/assets/icon/storage16.json +1 -0
- package/assets/components/assets/icon/storage24.json +1 -0
- package/assets/components/assets/icon/storage32.json +1 -0
- package/assets/components/assets/panel/t9n/messages.json +3 -1
- package/assets/components/assets/panel/t9n/messages_ar.json +3 -1
- package/assets/components/assets/panel/t9n/messages_bg.json +3 -1
- package/assets/components/assets/panel/t9n/messages_bs.json +3 -1
- package/assets/components/assets/panel/t9n/messages_ca.json +3 -1
- package/assets/components/assets/panel/t9n/messages_cs.json +3 -1
- package/assets/components/assets/panel/t9n/messages_da.json +3 -1
- package/assets/components/assets/panel/t9n/messages_de.json +3 -1
- package/assets/components/assets/panel/t9n/messages_el.json +3 -1
- package/assets/components/assets/panel/t9n/messages_en.json +3 -1
- package/assets/components/assets/panel/t9n/messages_es.json +3 -1
- package/assets/components/assets/panel/t9n/messages_et.json +3 -1
- package/assets/components/assets/panel/t9n/messages_fi.json +3 -1
- package/assets/components/assets/panel/t9n/messages_fr.json +3 -1
- package/assets/components/assets/panel/t9n/messages_he.json +3 -1
- package/assets/components/assets/panel/t9n/messages_hr.json +3 -1
- package/assets/components/assets/panel/t9n/messages_hu.json +3 -1
- package/assets/components/assets/panel/t9n/messages_id.json +3 -1
- package/assets/components/assets/panel/t9n/messages_it.json +3 -1
- package/assets/components/assets/panel/t9n/messages_ja.json +3 -1
- package/assets/components/assets/panel/t9n/messages_ko.json +3 -1
- package/assets/components/assets/panel/t9n/messages_lt.json +3 -1
- package/assets/components/assets/panel/t9n/messages_lv.json +3 -1
- package/assets/components/assets/panel/t9n/messages_nl.json +3 -1
- package/assets/components/assets/panel/t9n/messages_no.json +3 -1
- package/assets/components/assets/panel/t9n/messages_pl.json +3 -1
- package/assets/components/assets/panel/t9n/messages_pt-BR.json +3 -1
- package/assets/components/assets/panel/t9n/messages_pt-PT.json +3 -1
- package/assets/components/assets/panel/t9n/messages_ro.json +3 -1
- package/assets/components/assets/panel/t9n/messages_ru.json +3 -1
- package/assets/components/assets/panel/t9n/messages_sk.json +3 -1
- package/assets/components/assets/panel/t9n/messages_sl.json +3 -1
- package/assets/components/assets/panel/t9n/messages_sr.json +3 -1
- package/assets/components/assets/panel/t9n/messages_sv.json +3 -1
- package/assets/components/assets/panel/t9n/messages_th.json +3 -1
- package/assets/components/assets/panel/t9n/messages_tr.json +3 -1
- package/assets/components/assets/panel/t9n/messages_uk.json +3 -1
- package/assets/components/assets/panel/t9n/messages_vi.json +3 -1
- package/assets/components/assets/panel/t9n/messages_zh-CN.json +3 -1
- package/assets/components/assets/panel/t9n/messages_zh-HK.json +3 -1
- package/assets/components/assets/panel/t9n/messages_zh-TW.json +3 -1
- package/assets/components/assets/table/t9n/messages_ar.json +5 -5
- package/assets/components/assets/table/t9n/messages_bg.json +5 -5
- package/assets/components/assets/table/t9n/messages_bs.json +5 -5
- package/assets/components/assets/table/t9n/messages_ca.json +5 -5
- package/assets/components/assets/table/t9n/messages_cs.json +5 -5
- package/assets/components/assets/table/t9n/messages_da.json +5 -5
- package/assets/components/assets/table/t9n/messages_de.json +5 -5
- package/assets/components/assets/table/t9n/messages_el.json +5 -5
- package/assets/components/assets/table/t9n/messages_es.json +5 -5
- package/assets/components/assets/table/t9n/messages_et.json +5 -5
- package/assets/components/assets/table/t9n/messages_fi.json +5 -5
- package/assets/components/assets/table/t9n/messages_fr.json +4 -4
- package/assets/components/assets/table/t9n/messages_he.json +5 -5
- package/assets/components/assets/table/t9n/messages_hr.json +5 -5
- package/assets/components/assets/table/t9n/messages_hu.json +5 -5
- package/assets/components/assets/table/t9n/messages_id.json +5 -5
- package/assets/components/assets/table/t9n/messages_it.json +5 -5
- package/assets/components/assets/table/t9n/messages_ja.json +5 -5
- package/assets/components/assets/table/t9n/messages_ko.json +5 -5
- package/assets/components/assets/table/t9n/messages_lt.json +5 -5
- package/assets/components/assets/table/t9n/messages_lv.json +5 -5
- package/assets/components/assets/table/t9n/messages_nl.json +5 -5
- package/assets/components/assets/table/t9n/messages_no.json +5 -5
- package/assets/components/assets/table/t9n/messages_pl.json +5 -5
- package/assets/components/assets/table/t9n/messages_pt-BR.json +5 -5
- package/assets/components/assets/table/t9n/messages_pt-PT.json +5 -5
- package/assets/components/assets/table/t9n/messages_ro.json +5 -5
- package/assets/components/assets/table/t9n/messages_ru.json +5 -5
- package/assets/components/assets/table/t9n/messages_sk.json +5 -5
- package/assets/components/assets/table/t9n/messages_sl.json +5 -5
- package/assets/components/assets/table/t9n/messages_sr.json +5 -5
- package/assets/components/assets/table/t9n/messages_sv.json +5 -5
- package/assets/components/assets/table/t9n/messages_th.json +5 -5
- package/assets/components/assets/table/t9n/messages_tr.json +5 -5
- package/assets/components/assets/table/t9n/messages_uk.json +5 -5
- package/assets/components/assets/table/t9n/messages_vi.json +5 -5
- package/assets/components/assets/table/t9n/messages_zh-CN.json +5 -5
- package/assets/components/assets/table/t9n/messages_zh-HK.json +5 -5
- package/assets/components/assets/table/t9n/messages_zh-TW.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_ar.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_bg.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_bs.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_ca.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_cs.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_da.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_de.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_el.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_es.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_et.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_fi.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_fr.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_he.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_hr.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_hu.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_id.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_it.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_ja.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_ko.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_lt.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_lv.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_nl.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_no.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_pl.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_pt-BR.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_pt-PT.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_ro.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_ru.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_sk.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_sl.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_sr.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_sv.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_th.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_tr.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_uk.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_vi.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_zh-CN.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_zh-HK.json +5 -5
- package/assets/components/assets/table-cell/t9n/messages_zh-TW.json +5 -5
- package/assets/components/assets/table-header/t9n/messages_ar.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_bg.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_bs.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_ca.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_cs.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_da.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_de.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_el.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_es.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_et.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_fi.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_fr.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_he.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_hr.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_hu.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_id.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_it.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_ja.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_ko.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_lt.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_lv.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_nl.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_no.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_pl.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_pt-BR.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_pt-PT.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_ro.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_ru.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_sk.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_sl.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_sr.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_sv.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_th.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_tr.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_uk.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_vi.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_zh-CN.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_zh-HK.json +6 -6
- package/assets/components/assets/table-header/t9n/messages_zh-TW.json +6 -6
- package/assets/components/assets/time-picker/t9n/messages_ar.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_bg.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_bs.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_ca.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_cs.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_da.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_de.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_el.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_es.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_et.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_fi.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_fr.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_he.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_hr.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_hu.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_id.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_it.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_ja.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_ko.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_lt.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_lv.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_nl.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_no.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_pl.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_pt-BR.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_pt-PT.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_ro.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_ru.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_sk.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_sl.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_sr.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_sv.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_th.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_tr.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_uk.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_vi.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_zh-CN.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_zh-HK.json +3 -0
- package/assets/components/assets/time-picker/t9n/messages_zh-TW.json +3 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{02120d192eafd7612475.js → 0036b6df93a17e57e3b9.js} +1 -1
- package/assets/esri/core/workers/chunks/09886c56427c4b3f18b5.js +1 -0
- package/assets/esri/core/workers/chunks/{24a0cf405195421c0d06.js → 1461910bd37aea28948b.js} +1 -1
- package/assets/esri/core/workers/chunks/{d60d5f006375f7fcc88c.js → 16d45f439b89da3ec835.js} +1 -1
- package/assets/esri/core/workers/chunks/1ef3533abdd937ae2794.js +1 -0
- package/assets/esri/core/workers/chunks/31cb4c73764555b40328.js +1 -0
- package/assets/esri/core/workers/chunks/{40633064c290dc2af9ea.js → 369f2ef414498c17a05a.js} +1 -1
- package/assets/esri/core/workers/chunks/435f04e3964b1c6d4880.js +1 -0
- package/assets/esri/core/workers/chunks/4781e2011a32d7724889.js +1 -0
- package/assets/esri/core/workers/chunks/{18ab9cc85a1a7988fdfd.js → 4c3345ffbe79ee0167fb.js} +1 -1
- package/assets/esri/core/workers/chunks/4e60ac00b15b34a3b5f5.js +1 -0
- package/assets/esri/core/workers/chunks/505132c47dbdf5fdeacc.js +1 -0
- package/assets/esri/core/workers/chunks/{a5a7bbdd8298016535bc.js → 7f6840c53a456524b74c.js} +1 -1
- package/assets/esri/core/workers/chunks/{36ab90fb34b9716a9983.js → 8634d6a62f4de973e39b.js} +1 -1
- package/assets/esri/core/workers/chunks/a9a0194120ec65a00f6d.js +1 -0
- package/assets/esri/core/workers/chunks/adf6bcf2447c95aeb440.js +1 -0
- package/assets/esri/core/workers/chunks/aeb3efa91165dd3d2493.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/b3243695e0edfcbca276.js +1 -0
- package/assets/esri/core/workers/chunks/{e8c7cc974420c0b92d0e.js → b98a2191cb997d632438.js} +1 -1
- package/assets/esri/core/workers/chunks/c0061d993e1ede22b1dc.js +1 -0
- package/assets/esri/core/workers/chunks/{f2718e260f594537f7fd.js → c2be3b9aa28e454cf931.js} +1 -1
- package/assets/esri/core/workers/chunks/c4df42fe859a9115a6e4.js +1 -0
- package/assets/esri/core/workers/chunks/{52cef7cd3aaaa4f45c94.js → c607fe4df3ca054f9aa8.js} +1 -1
- package/assets/esri/core/workers/chunks/{e93442c6d92229f3a4b0.js → ca023e409bb7de9a69ab.js} +1 -1
- package/assets/esri/core/workers/chunks/{8f3680fee85a05839489.js → e52b9e423c0ba4134309.js} +1 -1
- package/assets/esri/core/workers/chunks/{c92e75b79aff7b505b31.js → e53df0f018a82e3a35bd.js} +1 -1
- package/assets/esri/core/workers/chunks/ea953f5a0a975f7bd7b9.js +1 -0
- package/assets/esri/core/workers/chunks/f183a4b52095e4c498b4.js +1 -0
- package/assets/esri/core/workers/chunks/{8e4c4ba900a90373217f.js → f221b9c6ae6c7eb4ca01.js} +1 -1
- package/assets/esri/core/workers/chunks/{0beebbb0c6dad0e742d7.js → f72a5af2a7ca1536f10a.js} +1 -1
- package/assets/esri/core/workers/chunks/{adfbc168be8c49b51e1b.js → f99deed4120f605b6cd6.js} +1 -1
- package/assets/esri/t9n/common.json +1 -1
- package/assets/esri/t9n/common_ar.json +1 -1
- package/assets/esri/t9n/common_bg.json +1 -1
- package/assets/esri/t9n/common_bs.json +1 -1
- package/assets/esri/t9n/common_ca.json +1 -1
- package/assets/esri/t9n/common_cs.json +1 -1
- package/assets/esri/t9n/common_da.json +1 -1
- package/assets/esri/t9n/common_de.json +1 -1
- package/assets/esri/t9n/common_el.json +1 -1
- package/assets/esri/t9n/common_en.json +1 -1
- package/assets/esri/t9n/common_es.json +1 -1
- package/assets/esri/t9n/common_et.json +1 -1
- package/assets/esri/t9n/common_fi.json +1 -1
- package/assets/esri/t9n/common_fr.json +1 -1
- package/assets/esri/t9n/common_he.json +1 -1
- package/assets/esri/t9n/common_hr.json +1 -1
- package/assets/esri/t9n/common_hu.json +1 -1
- package/assets/esri/t9n/common_id.json +1 -1
- package/assets/esri/t9n/common_it.json +1 -1
- package/assets/esri/t9n/common_ja.json +1 -1
- package/assets/esri/t9n/common_ko.json +1 -1
- package/assets/esri/t9n/common_lt.json +1 -1
- package/assets/esri/t9n/common_lv.json +1 -1
- package/assets/esri/t9n/common_nb.json +1 -1
- package/assets/esri/t9n/common_nl.json +1 -1
- package/assets/esri/t9n/common_pl.json +1 -1
- package/assets/esri/t9n/common_pt-BR.json +1 -1
- package/assets/esri/t9n/common_pt-PT.json +1 -1
- package/assets/esri/t9n/common_ro.json +1 -1
- package/assets/esri/t9n/common_ru.json +1 -1
- package/assets/esri/t9n/common_sk.json +1 -1
- package/assets/esri/t9n/common_sl.json +1 -1
- package/assets/esri/t9n/common_sr.json +1 -1
- package/assets/esri/t9n/common_sv.json +1 -1
- package/assets/esri/t9n/common_th.json +1 -1
- package/assets/esri/t9n/common_tr.json +1 -1
- package/assets/esri/t9n/common_uk.json +1 -1
- package/assets/esri/t9n/common_vi.json +1 -1
- package/assets/esri/t9n/common_zh-CN.json +1 -1
- package/assets/esri/t9n/common_zh-HK.json +1 -1
- package/assets/esri/t9n/common_zh-TW.json +1 -1
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +10 -14
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/ComponentShader.glsl.js +27 -27
- package/core/sql/WhereClauseCache.js +1 -1
- package/geometry/support/meshUtils/loadExternal.js +1 -1
- package/interfaces.d.ts +3 -19
- package/kernel.js +1 -1
- package/layers/graphics/data/AttributesBuilder.js +1 -1
- package/layers/graphics/data/FeatureStore.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/attributeSupport.js +1 -1
- package/layers/graphics/data/geometryUtils.js +5 -0
- package/layers/graphics/data/queryUtils.js +5 -0
- package/layers/graphics/data/queryValidationUtils.js +5 -0
- package/layers/graphics/data/spatialQuerySupport.js +1 -1
- package/layers/support/fieldProperties.js +1 -1
- package/layers/support/rasterFormats/Lerc.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
- package/package.json +2 -2
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolHelper.js +1 -1
- package/views/2d/engine/BitmapContainer.js +1 -1
- package/views/2d/engine/BitmapTile.js +1 -1
- package/views/2d/engine/Container.js +1 -1
- package/views/2d/engine/DisplayObject.js +1 -1
- package/views/2d/engine/FeatureContainer.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/flow/FlowContainer.js +1 -1
- package/views/2d/engine/imagery/RasterVFContainer.js +1 -1
- package/views/2d/engine/webgl/OverlayContainer.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/TileContainer.js +1 -1
- package/views/2d/engine/webgl/WGLContainer.js +1 -1
- package/views/2d/layers/GroupLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/MapNotesLayerView2D.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/support/FeatureFilter.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/i3s/I3SQueryEngine.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/VertexDiscardByOpacity.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +54 -33
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +1 -2
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LineCalloutTechniqueConfiguration.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/webdoc/webdocLoadUtils.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/InputBase.js +1 -1
- package/widgets/FeatureForm/RelationshipInput.js +1 -1
- package/widgets/FeatureForm/css.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
- package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/112e89da628bdea5355c.js +0 -1
- package/assets/esri/core/workers/chunks/1856d16d738f44f58084.js +0 -1
- package/assets/esri/core/workers/chunks/1a36703ebe934749646e.js +0 -1
- package/assets/esri/core/workers/chunks/3e40c8402ff7a8fe48b9.js +0 -1
- package/assets/esri/core/workers/chunks/3ea0b872436fce84b927.js +0 -1
- package/assets/esri/core/workers/chunks/42ec4c80b0c2944cd65c.js +0 -1
- package/assets/esri/core/workers/chunks/6b1856303d1562f05100.js +0 -1
- package/assets/esri/core/workers/chunks/784ffd52315a4d55d683.js +0 -1
- package/assets/esri/core/workers/chunks/97aecf210938015cc7a3.js +0 -1
- package/assets/esri/core/workers/chunks/b4f31d291c05b5f8ddac.js +0 -1
- package/assets/esri/core/workers/chunks/b99bc08a01e9250b0a31.js +0 -1
- package/assets/esri/core/workers/chunks/dca925a0d73f967f6897.js +0 -1
- package/assets/esri/core/workers/chunks/e8688b6cc3b3c1010b43.js +0 -1
- package/assets/esri/core/workers/chunks/eda86faa708cfe4c9f9a.js +0 -1
- package/layers/graphics/data/utils.js +0 -5
- package/views/2d/engine/webgl/GroupContainer.js +0 -5
- package/views/3d/analysis/DimensionAnalysisView3D.d.ts +0 -4
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../Viewpoint.js";import t from"../core/Error.js";import r from"../core/Logger.js";import{urlToObject as o}from"../core/urlUtils.js";import{geographicToWebMercator as i}from"../geometry/support/webMercatorUtils.js";import a from"../portal/Portal.js";import{project as n}from"../rest/geometryService/project.js";import s from"../rest/support/ProjectParameters.js";function l(e,t){return t.resourceInfo?p(
|
|
5
|
+
import e from"../Viewpoint.js";import t from"../core/Error.js";import r from"../core/Logger.js";import{urlToObject as o}from"../core/urlUtils.js";import{geographicToWebMercator as i}from"../geometry/support/webMercatorUtils.js";import a from"../portal/Portal.js";import{project as n}from"../rest/geometryService/project.js";import s from"../rest/support/ProjectParameters.js";function l(e,t){return t.resourceInfo?p(t,t.resourceInfo,{origin:e.origin}):t.portalItem?.id?c(e,t,t.portalItem):Promise.resolve()}function p(e,t,r){const o={context:{...r,layerContainerType:"operational-layers"}};return e.portalItem&&(o.context.portal=e.portalItem.portal||a.getDefault()),import("../layers/support/layersCreator.js").then((({populateOperationalLayers:r})=>{const i=[],a=t.operationalLayers;a?.length&&i.push(r(e.layers,a,o));const n={...o,context:{...o.context,layerContainerType:"tables"},defaultLayerType:"ArcGISFeatureLayer"},s=t.tables;return s?.length&&i.push(r(e.tables,s,n)),Promise.allSettled(i).then((()=>{}))}))}async function c(e,i,n){if(await n.load().catch((r=>{throw new t(`${e.name}:load-portal-item`,"Failed to load portal item",{error:r})})),n.type!==e.itemType)throw new t(`${e.name}:invalid-portal-item`,`Invalid portal item type '${n.type}', expected '${e.itemType}'`,{type:n.type});const s=await n.fetchData();i.resourceInfo=s;const l={origin:e.origin,url:o(n.itemUrl),portal:n.portal||a.getDefault(),portalItem:n,readResourcePaths:[]};await m(e,i,s,l),i.resourceReferences={portalItem:n,paths:l.readResourcePaths};const p=await f(i.initialViewProperties,n,r.getLogger(i));if(p){const t=i.initialViewProperties?.clone()??e.createInitialViewProperties();t.viewpoint=p,i.initialViewProperties=t}}function m(e,t,r,o){const i=u(e,r);return t.read(i,o),p(t,i,o)}function u(e,t){const r=e.parseVersion(t.version||"",e.name);return e.currentVersion.validate(r),t.version=`${r.major}.${r.minor}`,t}async function f(t,r,o){const i=t?.viewpoint?.targetGeometry;if(i)return null;const a=await y(t,r,o);if(!a)return null;return new e({targetGeometry:a})}async function y(e,t,r){const o=e?.spatialReference,a=t?.extent;if(!o||!a)return null;if(o.isWGS84)return a.clone();if(o.isWebMercator)return i(a);const{getGeometryServiceURL:l}=await import("../portal/support/geometryServiceUtils.js");try{const e=await l(t),r=new s;r.geometries=[a],r.outSpatialReference=o;return(await n(e,r))[0]}catch(p){r.error("Error projecting item's extent:",p)}return null}export{l as loadFromSource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{createTask as t}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecated as r}from"../../core/deprecate.js";import i from"../../core/Error.js";import s from"../../core/Evented.js";import{makeHandle as o}from"../../core/handleUtils.js";import n from"../../core/Logger.js";import{abortMaybe as l}from"../../core/maybe.js";import{throwIfAborted as d}from"../../core/promiseUtils.js";import{watch as p,on as c,when as u,whenOnce as h,syncAndInitial as w,initial as f}from"../../core/reactiveUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as k}from"../../core/support/UpdatingHandles.js";import v from"../../layers/GraphicsLayer.js";import{isEditableLayer as g}from"../../layers/support/editableLayers.js";import{isTable as W,getOwningPortalUrl as _,getEffectiveLayerCapabilities as b,isFeatureLayer as F}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as C}from"../../portal/support/urlUtils.js";import E from"../Attachments/AttachmentsViewModel.js";import I from"./CreateFeaturesWorkflow.js";import U from"./CreateWorkflow.js";import{workflowDeprecation as A}from"./deprecationUtils.js";import T from"./UpdateWorkflow.js";import{whenEditorLayerView as V}from"./workflowUtils.js";import{formTemplateHasInvalidFields as M}from"../FeatureForm/featureFormUtils.js";import O from"../FeatureForm/FeatureFormViewModel.js";import j from"../FeatureTemplates/FeatureTemplatesViewModel.js";import L from"../Sketch/SketchViewModel.js";import S from"../Spinner/SpinnerViewModel.js";const P="esri.widgets.Editor.EditorViewModel",D=n.getLogger(P),x=["create","create-features","update"];function G(e,t,a){D.error(new i(e,t,a))}function H(e,t){return e?e.find((e=>e.layer===t)):void 0}let N=class extends s.EventedAccessor{constructor(e){super(e),this._editableItems=new a,this._sketchGraphicsLayer=new v({listMode:"hide",internal:!0}),this._updateEditableItemsTask=null,this._updatingHandles=new k,this._featureTemplatesViewModelLocked=!1,this._syncFeatureTemplatesOnNextUnlock=!1,this.activeWorkflow=null,this._activityQueue=[],this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new E({capabilities:{editing:!0}}),this.featureFormViewModel=new O,this.featureTemplatesViewModel=new j({disabledItemFunction:({layer:e})=>this._itemIsSuspended(e)}),this.sketchViewModel=new L({layer:this._sketchGraphicsLayer}),this.spinnerViewModel=new S,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.useDeprecatedCreateWorkflow=!1,this.back=async()=>{this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>{const{featureFormViewModel:e}=this;if(e.submit(),!e.submittable)return;const t=e.getValues();e.validateContingencyConstraints(t,{includeIncompleteViolations:!0}).length>0||await(this.activeWorkflow?.save())},this.selectFeature=(e,t=!1)=>{const a=this.activeWorkflow;this._candidateCommitted||"update"!==a?.type||(a.data.rootFeature=e,t&&(a.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([p((()=>{const e=this.view?.map?.editableLayers.filter((({parent:e,visible:t})=>e&&"visible"in e?t&&e.visible:t)),t=this.view?.allLayerViews,a=t?.filter((t=>!!e?.includes(t.layer)&&!t.suspended));return[e,a,this.layerInfos,this.allowedWorkflows,this.hideTemplatesForInactiveLayers]}),(()=>this._updateEditableItems()),w),c((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),c((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),c((()=>this.activeWorkflow),"complete",(()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)})),u((()=>this.view?.map),(e=>e.add(this._sketchGraphicsLayer)),f),p((()=>this.view?.timeZone),(e=>this.featureFormViewModel.timeZone=e)),p((()=>this._editableItems.toArray()),(()=>{const{activeWorkflow:e}=this;if(this.syncFeatureTemplates(),!e)return;const{stepId:t}=e;"create"!==e.type?"update"===e.type&&("awaiting-feature-to-update"===t&&!this.canUpdate||"awaiting-update-feature-candidate"===t&&!e.data.candidates.some((e=>{const t=this._editableItems.find((t=>t.layer===e.layer));return t&&t.supports.includes("update")})))&&this._cancelWorkflow():"awaiting-feature-creation-info"!==t||this.canCreate||this._cancelWorkflow()})),p((()=>this.page),((e,t)=>{const a=[...this.pageStack];if(-1===a.indexOf(e))a.push(e);else for(;a.length&&a.at(-1)!==e;)a.pop();this.pageStack=a}),w),u((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),c((()=>this.featureTemplatesViewModel),"select",(async({item:e,oldItem:t})=>{const{activeWorkflow:a}=this;if(a){if("update"===a.type&&"awaiting-feature-creation-info"===a.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(t,{emit:!1})}}if(!e)return;const r={layer:e.layer,template:e.template};if(e.supportsUpload)return this.featureTemplatesViewModel.select(t,{emit:!1}),this.startCreateFeaturesWorkflow(r);this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(r):this.startCreateFeaturesWorkflowAtFeatureCreation(r)})),c((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this.activeWorkflow?.keyboardCancellationEnabled&&this.back()}))])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then((()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null})),this._updateEditableItemsTask=l(this._updateEditableItemsTask),this._updatingHandles.destroy()}get allowedWorkflows(){return this._get("allowedWorkflows")}set allowedWorkflows(e){e&&0!==e.length||(e=[...x]),this._set("allowedWorkflows",e)}get canCreate(){return this._editableItems.some((e=>e.supports.includes("create")&&!e.suspended))}get canUpdate(){return this._editableItems.some((({attachmentsOnUpdateEnabled:e,layer:t,supports:a,suspended:r})=>{const i=!r&&(a.includes("update")||a.includes("delete")||e),s=t.parent,o=!(s&&"visible"in s)||!!s.visible;return t.visible&&o&&i}))}get editableItems(){return this._editableItems}get labelOptions(){return this.sketchViewModel.labelOptions}set labelOptions(e){this.sketchViewModel.labelOptions=e}set layerInfos(e){e?.some((e=>("allowAttachments"in e&&r(D,"Property: layerInfo.allowAttachments",{replacement:"layerInfo.attachmentsOnCreateEnabled or layerInfo.attachmentsOnUpdateEnabled",version:"4.26"}),!0))),this._set("layerInfos",e)}get snappingOptions(){return this.sketchViewModel.snappingOptions}set snappingOptions(e){this.sketchViewModel.snappingOptions=e}get state(){if(!this.view?.ready)return"disabled";const e=this.attachmentsViewModel.mode;if("add"===e)return"adding-attachment";if("edit"===e)return"editing-attachment";const{activeWorkflow:t}=this;return t?"update"===t.type&&t.activeWorkflow?.stepId?t.activeWorkflow.stepId:t.stepId:"ready"}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchViewModel.tooltipOptions}set tooltipOptions(e){this.sketchViewModel.tooltipOptions=e}set view(e){this.sketchViewModel.view=e,this.spinnerViewModel.view=e,this._set("view",e)}get page(){const{activeWorkflow:e,state:t}=this;if("update"===e?.type&&"awaiting-feature-to-update"===e.stepId)return"ready";if("create-features"===e?.type&&0===e.numPendingFeatures){const t=e.data.upload;if(t)return"default"===t.state?"ready":"creating-features-upload-details"}return t??"disabled"}get featureFormDisabled(){const{activeWorkflow:e}=this;return"update"===e?.type&&!1===e.activeEditableItem?.attributeUpdatesEnabled}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:e}=this;return!!e&&"update"===e.type&&!!e.activeEditableItem?.supports.includes("delete")}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}async startCreateWorkflowAtFeatureTypeSelection(){if(A(D,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),await h((()=>!this.updating)),!this.canCreate)return void G("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createCreateWorkflow();await e.start(),this._set("activeWorkflow",e)}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateWorkflowAtFeatureCreation(e){if(A(D,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),await h((()=>!this.updating)),!this.canCreate)return void G("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createCreateWorkflow("awaiting-feature-to-create");t.data.creationInfo=e,await t.start(),this._set("activeWorkflow",t)}async startCreateFeaturesWorkflowAtFeatureCreation(e){return this.startCreateFeaturesWorkflow(e,"creating-features")}async startCreateFeaturesWorkflow(e,t="awaiting-feature-creation-info"){if(await h((()=>!this.updating)),!this.canCreate)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled.");await this._cancelWorkflow();const a=this._createCreateFeaturesWorkflow(e,t);await a.start(),this._set("activeWorkflow",a)}async startCreateWorkflowAtFeatureEdit(e){if(A(D,"startCreateWorkflowAtFeatureEdit"),await h((()=>!this.updating)),!this.canCreate)return void G("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createCreateWorkflow("editing-new-feature");t.data.edits.feature=e,await t.start(),this._set("activeWorkflow",t)}async startCreateFeaturesWorkflowAtFeatureEdit(e){await h((()=>!this.updating));const{initialFeature:t}=e,a=t.sourceLayer,r=a?this.findEditableItemForLayer(a):void 0;if(!this.canCreate||!r)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled.");await this._cancelWorkflow();const s=this._createCreateFeaturesWorkflow({initialFeature:t,layer:r.layer,maxFeatures:1},"creating-features");await s.start(),this._set("activeWorkflow",s)}async startUpdateWorkflowAtFeatureSelection(){if(await h((()=>!this.updating)),!this.canUpdate)return void G("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createUpdateWorkflow();await e.start(),this._set("activeWorkflow",e)}async startUpdateWorkflowAtMultipleFeatureSelection(e){if(await h((()=>!this.updating)),!this.canUpdate)return void G("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createUpdateWorkflow("awaiting-update-feature-candidate");t.data.candidates=e,await t.start(),this._set("activeWorkflow",t)}async startUpdateWorkflowAtFeatureEdit(e){if(await h((()=>!this.updating)),!this.canUpdate)return void G("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createUpdateWorkflow("editing-existing-feature");t.data.rootFeature=e,await t.start(),this._set("activeWorkflow",t)}async deleteFeatureFromWorkflow(){const{activeWorkflow:e}=this;e&&"update"===e.type?await e.deleteActiveFeature():G("editing:unsupported-workflow","Deleting requires an active update workflow.")}async cancelWorkflow(e){return this._cancelWorkflow({warnIfNoWorkflow:!0,...e})}findEditableItemForLayer(e){const t="subtype-sublayer"===e.type?e.parent:e;return this._editableItems.find((e=>e.layer===t))}itemHasInvalidFormTemplate(e){return!!e&&(this.findEditableItemForLayer(e.layer)?.hasInvalidFormTemplate??!1)}itemHasUnsupportedFields(e){return!!e&&(this.findEditableItemForLayer(e.layer)?.hasUnsupportedFields??!1)}syncFeatureTemplates(){if(this._featureTemplatesViewModelLocked)return void(this._syncFeatureTemplatesOnNextUnlock=!0);const e=[];for(const{layer:t,supports:a}of this._editableItems)t.loaded&&a.includes("create")&&!W(t)&&e.push(t);this.featureTemplatesViewModel.layers=e}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}lockFeatureTemplatesViewModel(){return this._featureTemplatesViewModelLocked=!0,o((()=>{this._featureTemplatesViewModelLocked=!1,this._syncFeatureTemplatesOnNextUnlock&&(this.syncFeatureTemplates(),this._syncFeatureTemplatesOnNextUnlock=!1)}))}async _updateEditableItems(){l(this._updateEditableItemsTask);const e=t((async e=>{const t=this.view?.allLayerViews,r=this.view?.map,i=r?.editableLayers.toArray()??[],s=r?.allTables.toArray().filter(F)??[];await Promise.all(s.map((e=>e.load())));const o=s.filter((e=>g(e))),n=[...i.reverse(),...o.reverse()].filter((e=>"mesh"!==e.geometryType||"3d"===this.view?.type));if(!t||!i)return;const l=[],p=[];for(const a of n){const r=t.find((e=>e.layer===a)),i=r?l:p,s=!!r?.suspended;if(!s||!this.hideTemplatesForInactiveLayers)if("subtype-group"===a.type){await a.loadAll(),d(e);for(let e=a.sublayers.length-1;e>=0;--e)i.push(this._makeEditableItemForLayer(a.sublayers.at(e),s))}else i.push(this._makeEditableItemForLayer(a,s))}if(e.aborted)return;const c=this._editableItems;this._editableItems=new a(l.concat(p)),c.destroy()}));this._updatingHandles.addPromise(e.promise),this._updateEditableItemsTask=e}async _cancelWorkflow(e){const t=this.activeWorkflow;if(!t)return void(e?.warnIfNoWorkflow&&G("editing:no-active-workflow","There is no active workflow to cancel."));if(!e||!1!==e.force)return this.emit("workflow-cancel"),this._set("activeWorkflow",null),void await t.cancel(e);await t.cancel(e),this._set("activeWorkflow",null)}_createCreateFeaturesWorkflow(e,t){return I.create({viewModel:this,creationInfo:e,startAt:t,applyEditsCallback:(e,t,a)=>this._applyEdits(e,t,a),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_createCreateWorkflow(e){return U.create(this,e,((e,t,a)=>this._applyEdits(e,t,a)))}_createUpdateWorkflow(e){return T.create(this,e,((e,t)=>this._applyEdits(e,t)))}_addAttachments(e,t){const a=t.map((t=>this._addAttachment(e,t.feature,t.attachment)))??[];return Promise.all(a)}async _addAttachment(e,t,a){let r=null;if("geojson"===e.type||"scene"===e.type||"oriented-imagery"===e.type)throw new i("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(r=await(e.addAttachment?.(t,a).catch((e=>{throw e?.error||e})))??null,r))),r}async _applyEdits(e,t,a){let r=null;const i=e.url?await _(e.url):null,s={returnServiceEditsOption:(!i||!C(i))&&!RegExp("/hosted/","i").test(e.url)?"original-and-current-features":void 0,...a};return await this._queueOperation((async()=>{const{view:a}=this;if(!a)return null;const i=await V(a,e).catch((()=>null));return r=await e.applyEdits(t,s),i&&await h((()=>!i.updating)),r})),r}_queueOperation(e){this._activityQueue.push(e),this.notifyChange("syncing");const t=(e,t)=>{const a=t.indexOf(e);a>-1&&t.splice(a,1)};return e().then((e=>{if(null!=e&&"error"in e&&null!=e.error)throw e.error;if(null!=e&&"addFeatureResults"in e){const{addFeatureResults:t,deleteFeatureResults:a,updateFeatureResults:r}=e,i=t.find((e=>!!e.error))||r.find((e=>!!e.error))||a.find((e=>!!e.error));if(i)throw i.error}return e})).catch((a=>{G("editing:operation-error","An error occurred.",{error:a});const r={error:a,retry:()=>(t(r,this.failures),this._queueOperation(e)),cancel:()=>{t(r,this.failures)}};this._set("failures",[...this.failures,r])})).then((()=>{t(e,this._activityQueue),this.notifyChange("syncing")}))}_makeEditableItemForLayer(e,t=!0){const a=b(e),r=a?.operations,i=H(this.layerInfos,e),s=M(e),o=s||t,{allowedWorkflows:n}=this,l=n.includes("create")||n.includes("create-features"),d=n.includes("update"),p=e=>!i||!1!==i.enabled&&!1!==i[e],c=l&&!!r?.supportsAdd&&p("addEnabled"),u=d&&!!r?.supportsUpdate&&p("updateEnabled"),h=!o&&d&&!!r?.supportsDelete&&p("deleteEnabled"),w=[];c&&w.push("create"),u&&w.push("update"),h&&w.push("delete");const f=u&&!o&&(!i||!1!==i.attributeUpdatesEnabled),m=u&&!o&&!!a?.editing?.supportsGeometryUpdate&&(!i||!1!==i.geometryUpdatesEnabled),y=!(!a?.data?.supportsAttachment||i&&!1===i.allowAttachments);return{layer:e,supports:w,suspended:t,attributeUpdatesEnabled:f,geometryUpdatesEnabled:m,hasAttachments:y,attachmentsOnCreateEnabled:y&&l&&(!i||!1!==i.attachmentsOnCreateEnabled),attachmentsOnUpdateEnabled:!o&&y&&(!i||!1!==i.attachmentsOnUpdateEnabled),hasInvalidFormTemplate:s,hasUnsupportedFields:!1}}_itemIsSuspended(e){return this.findEditableItemForLayer(e)?.suspended??!1}};e([m()],N.prototype,"_editableItems",void 0),e([m({readOnly:!0})],N.prototype,"activeWorkflow",void 0),e([m({readOnly:!0})],N.prototype,"_activityQueue",void 0),e([m({value:[...x]})],N.prototype,"allowedWorkflows",null),e([m({readOnly:!0})],N.prototype,"canCreate",null),e([m({readOnly:!0})],N.prototype,"canUpdate",null),e([m()],N.prototype,"editableItems",null),e([m({readOnly:!0})],N.prototype,"failures",void 0),e([m()],N.prototype,"hideTemplatesForInactiveLayers",void 0),e([m()],N.prototype,"attachmentsViewModel",void 0),e([m()],N.prototype,"featureFormViewModel",void 0),e([m()],N.prototype,"featureTemplatesViewModel",void 0),e([m()],N.prototype,"labelOptions",null),e([m()],N.prototype,"layerInfos",null),e([m()],N.prototype,"sketchViewModel",void 0),e([m()],N.prototype,"snappingOptions",null),e([m()],N.prototype,"spinnerViewModel",void 0),e([m()],N.prototype,"state",null),e([m({readOnly:!0})],N.prototype,"syncing",null),e([m()],N.prototype,"updating",null),e([m()],N.prototype,"tooltipOptions",null),e([m()],N.prototype,"view",null),e([m()],N.prototype,"pageStack",void 0),e([m()],N.prototype,"showDiscardEditsPrompt",void 0),e([m()],N.prototype,"_candidateCommitted",void 0),e([m()],N.prototype,"page",null),e([m()],N.prototype,"featureFormDisabled",null),e([m()],N.prototype,"canGoBack",null),e([m()],N.prototype,"shouldShowDeleteButton",null),e([m()],N.prototype,"hasPendingEdits",null),e([m()],N.prototype,"useDeprecatedCreateWorkflow",void 0),N=e([y(P)],N);const q=N;export{q as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{createTask as t}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecated as r}from"../../core/deprecate.js";import i from"../../core/Error.js";import s from"../../core/Evented.js";import{makeHandle as o}from"../../core/handleUtils.js";import n from"../../core/Logger.js";import{abortMaybe as l}from"../../core/maybe.js";import{throwIfAborted as d}from"../../core/promiseUtils.js";import{watch as p,on as c,when as u,whenOnce as h,syncAndInitial as w,initial as f}from"../../core/reactiveUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as k}from"../../core/support/UpdatingHandles.js";import v from"../../layers/GraphicsLayer.js";import{isEditableLayer as g}from"../../layers/support/editableLayers.js";import{isTable as W,getOwningPortalUrl as _,getEffectiveLayerCapabilities as b,isFeatureLayer as F}from"../../layers/support/layerUtils.js";import{parseKnownArcGISOnlineDomain as C}from"../../portal/support/urlUtils.js";import E from"../Attachments/AttachmentsViewModel.js";import I from"./CreateFeaturesWorkflow.js";import U from"./CreateWorkflow.js";import{workflowDeprecation as A}from"./deprecationUtils.js";import T from"./UpdateWorkflow.js";import{whenEditorLayerView as V}from"./workflowUtils.js";import{formTemplateHasInvalidFields as M}from"../FeatureForm/featureFormUtils.js";import O from"../FeatureForm/FeatureFormViewModel.js";import j from"../FeatureTemplates/FeatureTemplatesViewModel.js";import L from"../Sketch/SketchViewModel.js";import S from"../Spinner/SpinnerViewModel.js";const P="esri.widgets.Editor.EditorViewModel",D=n.getLogger(P),x=["create","create-features","update"];function G(e,t,a){D.error(new i(e,t,a))}function H(e,t){return e?e.find((e=>e.layer===t)):void 0}let N=class extends s.EventedAccessor{constructor(e){super(e),this._editableItems=new a,this._sketchGraphicsLayer=new v({listMode:"hide",internal:!0}),this._updateEditableItemsTask=null,this._updatingHandles=new k,this._featureTemplatesViewModelLocked=!1,this._syncFeatureTemplatesOnNextUnlock=!1,this.activeWorkflow=null,this._activityQueue=[],this.failures=[],this.hideTemplatesForInactiveLayers=!1,this.attachmentsViewModel=new E({capabilities:{editing:!0}}),this.featureFormViewModel=new O,this.featureTemplatesViewModel=new j({disabledItemFunction:({layer:e})=>this._itemIsSuspended(e)}),this.sketchViewModel=new L({layer:this._sketchGraphicsLayer}),this.spinnerViewModel=new S,this.pageStack=[],this.showDiscardEditsPrompt=()=>Promise.resolve(!0),this._candidateCommitted=!1,this.useDeprecatedCreateWorkflow=!1,this.back=async()=>{this.canGoBack&&(this.activeWorkflow?.hasPreviousStep?await this.activeWorkflow.back(this.showDiscardEditsPrompt):await this._cancelWorkflow({force:!this.hasPendingEdits}))},this.saveWorkflow=async()=>{const{featureFormViewModel:e}=this;if(e.submit(),!e.submittable)return;const t=e.getValues();e.validateContingencyConstraints(t,{includeIncompleteViolations:!0}).length>0||await(this.activeWorkflow?.save())},this.selectFeature=(e,t=!1)=>{const a=this.activeWorkflow;this._candidateCommitted||"update"!==a?.type||(a.data.rootFeature=e,t&&(a.next(),this._candidateCommitted=!0))}}initialize(){this.addHandles([p((()=>{const e=this.view?.map?.editableLayers.filter((({parent:e,visible:t})=>e&&"visible"in e?t&&e.visible:t)),t=this.view?.allLayerViews,a=t?.filter((t=>!!e?.includes(t.layer)&&!t.suspended));return[e,a,this.layerInfos,this.allowedWorkflows,this.hideTemplatesForInactiveLayers]}),(()=>this._updateEditableItems()),w),c((()=>this.activeWorkflow),"cancel",(()=>this.emit("workflow-cancel"))),c((()=>this.activeWorkflow),"commit",(()=>this.emit("workflow-commit"))),c((()=>this.activeWorkflow),"complete",(()=>{this.emit("workflow-commit"),this._set("activeWorkflow",null)})),u((()=>this.view?.map),(e=>e.add(this._sketchGraphicsLayer)),f),p((()=>this.view?.timeZone),(e=>this.featureFormViewModel.timeZone=e)),p((()=>this._editableItems.toArray()),(()=>{const{activeWorkflow:e}=this;if(this.syncFeatureTemplates(),!e)return;const{stepId:t}=e;"create"!==e.type?"update"===e.type&&("awaiting-feature-to-update"===t&&!this.canUpdate||"awaiting-update-feature-candidate"===t&&!e.data.candidates.some((e=>{const t=this._editableItems.find((t=>t.layer===e.layer));return t&&t.supports.includes("update")})))&&this._cancelWorkflow():"awaiting-feature-creation-info"!==t||this.canCreate||this._cancelWorkflow()})),p((()=>this.page),((e,t)=>{const a=[...this.pageStack];if(-1===a.indexOf(e))a.push(e);else for(;a.length&&a.at(-1)!==e;)a.pop();this.pageStack=a}),w),u((()=>"awaiting-update-feature-candidate"===this.state),(()=>this._candidateCommitted=!1)),c((()=>this.featureTemplatesViewModel),"select",(async({item:e,oldItem:t})=>{const{activeWorkflow:a}=this;if(a){if("update"===a.type&&"awaiting-feature-creation-info"===a.activeWorkflow?.stepId)return;try{await this.cancelWorkflow({force:!this.hasPendingEdits})}catch{return void this.featureTemplatesViewModel.select(t,{emit:!1})}}if(!e)return;const r={layer:e.layer,template:e.template};if(e.supportsUpload)return this.featureTemplatesViewModel.select(t,{emit:!1}),this.startCreateFeaturesWorkflow(r);this.useDeprecatedCreateWorkflow?this.startCreateWorkflowAtFeatureCreation(r):this.startCreateFeaturesWorkflowAtFeatureCreation(r)})),c((()=>this.view),"key-down",(e=>{"Escape"===e.key&&this.activeWorkflow?.keyboardCancellationEnabled&&this.back()}))])}destroy(){this._cancelWorkflow({warnIfNoWorkflow:!1}).then((()=>{this.view?.map?.remove(this._sketchGraphicsLayer),this.view=null})),this._updateEditableItemsTask=l(this._updateEditableItemsTask),this._updatingHandles.destroy()}get allowedWorkflows(){return this._get("allowedWorkflows")}set allowedWorkflows(e){e&&0!==e.length||(e=[...x]),this._set("allowedWorkflows",e)}get canCreate(){return this._editableItems.some((e=>e.supports.includes("create")&&!e.suspended))}get canUpdate(){return this._editableItems.some((({attachmentsOnUpdateEnabled:e,layer:t,supports:a,suspended:r})=>{const i=!r&&(a.includes("update")||a.includes("delete")||e),s=t.parent,o=!(s&&"visible"in s)||!!s.visible;return t.visible&&o&&i}))}get editableItems(){return this._editableItems}get labelOptions(){return this.sketchViewModel.labelOptions}set labelOptions(e){this.sketchViewModel.labelOptions=e}set layerInfos(e){e?.some((e=>("allowAttachments"in e&&r(D,"Property: layerInfo.allowAttachments",{replacement:"layerInfo.attachmentsOnCreateEnabled or layerInfo.attachmentsOnUpdateEnabled",version:"4.26"}),!0))),this._set("layerInfos",e)}get snappingOptions(){return this.sketchViewModel.snappingOptions}set snappingOptions(e){this.sketchViewModel.snappingOptions=e}get state(){if(!this.view?.ready)return"disabled";const e=this.attachmentsViewModel.mode;if("add"===e)return"adding-attachment";if("edit"===e)return"editing-attachment";const{activeWorkflow:t}=this;return t?"update"===t.type&&t.activeWorkflow?.stepId?t.activeWorkflow.stepId:t.stepId:"ready"}get syncing(){return this._activityQueue.length>0}get updating(){return this._updatingHandles.updating||!0===this.activeWorkflow?.updating}get tooltipOptions(){return this.sketchViewModel.tooltipOptions}set tooltipOptions(e){this.sketchViewModel.tooltipOptions=e}set view(e){this.sketchViewModel.view=e,this.spinnerViewModel.view=e,this._set("view",e)}get page(){const{activeWorkflow:e,state:t}=this;if("update"===e?.type&&"awaiting-feature-to-update"===e.stepId)return"ready";if("create-features"===e?.type&&0===e.numPendingFeatures){const t=e.data.upload;if(t)return"default"===t.state?"ready":"creating-features-upload-details"}return t??"disabled"}get featureFormDisabled(){const{activeWorkflow:e}=this;return"update"===e?.type&&!1===e.activeEditableItem?.attributeUpdatesEnabled}get canGoBack(){return null!=this.activeWorkflow&&!this.syncing}get shouldShowDeleteButton(){const{activeWorkflow:e}=this;return!!e&&"update"===e.type&&!!e.activeEditableItem?.supports.includes("delete")}get hasPendingEdits(){return this.activeWorkflow?.hasPendingEdits??!1}async startCreateWorkflowAtFeatureTypeSelection(){if(A(D,"startCreateWorkflowAtFeatureTypeSelection","startCreateFeaturesWorkflowAtFeatureTypeSelection"),await h((()=>!this.updating)),!this.canCreate)return void G("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createCreateWorkflow();await e.start(),this._set("activeWorkflow",e)}async startCreateFeaturesWorkflowAtFeatureTypeSelection(){return this.startCreateFeaturesWorkflow()}async startCreateWorkflowAtFeatureCreation(e){if(A(D,"startCreateWorkflowAtFeatureCreation","startCreateFeaturesWorkflowAtFeatureCreation"),await h((()=>!this.updating)),!this.canCreate)return void G("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createCreateWorkflow("awaiting-feature-to-create");t.data.creationInfo=e,await t.start(),this._set("activeWorkflow",t)}async startCreateFeaturesWorkflowAtFeatureCreation(e){return this.startCreateFeaturesWorkflow(e,"creating-features")}async startCreateFeaturesWorkflow(e,t="awaiting-feature-creation-info"){if(await h((()=>!this.updating)),!this.canCreate)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled.");await this._cancelWorkflow();const a=this._createCreateFeaturesWorkflow(e,t);await a.start(),this._set("activeWorkflow",a)}async startCreateWorkflowAtFeatureEdit(e){if(A(D,"startCreateWorkflowAtFeatureEdit"),await h((()=>!this.updating)),!this.canCreate)return void G("editing:unsupported-workflow","Create workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createCreateWorkflow("editing-new-feature");t.data.edits.feature=e,await t.start(),this._set("activeWorkflow",t)}async startCreateFeaturesWorkflowAtFeatureEdit(e){await h((()=>!this.updating));const{initialFeature:t}=e,a=t.sourceLayer,r=a?this.findEditableItemForLayer(a):void 0;if(!this.canCreate||!r)throw new i("editing:unsupported-workflow","Creating features is unsupported or disabled.");await this._cancelWorkflow();const s=this._createCreateFeaturesWorkflow({initialFeature:t,layer:r.layer,maxFeatures:1},"creating-features");await s.start(),this._set("activeWorkflow",s)}async startUpdateWorkflowAtFeatureSelection(){if(await h((()=>!this.updating)),!this.canUpdate)return void G("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const e=this._createUpdateWorkflow();await e.start(),this._set("activeWorkflow",e)}async startUpdateWorkflowAtMultipleFeatureSelection(e){if(await h((()=>!this.updating)),!this.canUpdate)return void G("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createUpdateWorkflow("awaiting-update-feature-candidate");t.data.candidates=e,await t.start(),this._set("activeWorkflow",t)}async startUpdateWorkflowAtFeatureEdit(e){if(await h((()=>!this.updating)),!this.canUpdate)return void G("editing:unsupported-workflow","Update workflow is unsupported or disabled.");await this._cancelWorkflow();const t=this._createUpdateWorkflow("editing-existing-feature");t.data.rootFeature=e,await t.start(),this._set("activeWorkflow",t)}async deleteFeatureFromWorkflow(){const{activeWorkflow:e}=this;e&&"update"===e.type?await e.deleteActiveFeature():G("editing:unsupported-workflow","Deleting requires an active update workflow.")}async cancelWorkflow(e){return this._cancelWorkflow({warnIfNoWorkflow:!0,...e})}findEditableItemForLayer(e){const t="subtype-sublayer"===e.type?e.parent:e;return this._editableItems.find((e=>e.layer===t))}itemHasInvalidFormTemplate(e){return!!e&&(this.findEditableItemForLayer(e.layer)?.hasInvalidFormTemplate??!1)}itemHasUnsupportedFields(e){return!!e&&(this.findEditableItemForLayer(e.layer)?.hasUnsupportedFields??!1)}syncFeatureTemplates(){if(this._featureTemplatesViewModelLocked)return void(this._syncFeatureTemplatesOnNextUnlock=!0);const e=[];for(const{layer:t,supports:a}of this._editableItems)t.loaded&&a.includes("create")&&!W(t)&&e.push(t);this.featureTemplatesViewModel.layers=e}async toggleUpdateWorkflow(){this.canUpdate&&(this.hasPendingEdits&&!await this.showDiscardEditsPrompt()||(this.activeWorkflow&&"awaiting-feature-to-update"===this.state?await this.cancelWorkflow({force:!0}):await this.startUpdateWorkflowAtFeatureSelection()))}lockFeatureTemplatesViewModel(){return this._featureTemplatesViewModelLocked=!0,o((()=>{this._featureTemplatesViewModelLocked=!1,this._syncFeatureTemplatesOnNextUnlock&&(this.syncFeatureTemplates(),this._syncFeatureTemplatesOnNextUnlock=!1)}))}async _updateEditableItems(){l(this._updateEditableItemsTask);const e=t((async e=>{const t=this.view?.allLayerViews,r=this.view?.map,i=r?.editableLayers.toArray()??[],s=r?.allTables.toArray().filter(F)??[];await Promise.allSettled(s.map((e=>e.load())));const o=s.filter((e=>g(e))),n=[...i.reverse(),...o.reverse()].filter((e=>"mesh"!==e.geometryType||"3d"===this.view?.type));if(!t||!i)return;const l=[],p=[];for(const a of n){const r=t.find((e=>e.layer===a)),i=r?l:p,s=!!r?.suspended;if(!s||!this.hideTemplatesForInactiveLayers)if("subtype-group"===a.type){await a.loadAll(),d(e);for(let e=a.sublayers.length-1;e>=0;--e)i.push(this._makeEditableItemForLayer(a.sublayers.at(e),s))}else i.push(this._makeEditableItemForLayer(a,s))}if(e.aborted)return;const c=this._editableItems;this._editableItems=new a(l.concat(p)),c.destroy()}));this._updatingHandles.addPromise(e.promise),this._updateEditableItemsTask=e}async _cancelWorkflow(e){const t=this.activeWorkflow;if(!t)return void(e?.warnIfNoWorkflow&&G("editing:no-active-workflow","There is no active workflow to cancel."));if(!e||!1!==e.force)return this.emit("workflow-cancel"),this._set("activeWorkflow",null),void await t.cancel(e);await t.cancel(e),this._set("activeWorkflow",null)}_createCreateFeaturesWorkflow(e,t){return I.create({viewModel:this,creationInfo:e,startAt:t,applyEditsCallback:(e,t,a)=>this._applyEdits(e,t,a),addAttachmentsCallback:(e,t)=>this._addAttachments(e,t)})}_createCreateWorkflow(e){return U.create(this,e,((e,t,a)=>this._applyEdits(e,t,a)))}_createUpdateWorkflow(e){return T.create(this,e,((e,t)=>this._applyEdits(e,t)))}_addAttachments(e,t){const a=t.map((t=>this._addAttachment(e,t.feature,t.attachment)))??[];return Promise.all(a)}async _addAttachment(e,t,a){let r=null;if("geojson"===e.type||"scene"===e.type||"oriented-imagery"===e.type)throw new i("editor:attachments-not-supported","Adding attachments is not supported for this layer type");return await this._queueOperation((async()=>(r=await(e.addAttachment?.(t,a).catch((e=>{throw e?.error||e})))??null,r))),r}async _applyEdits(e,t,a){let r=null;const i=e.url?await _(e.url):null,s={returnServiceEditsOption:(!i||!C(i))&&!RegExp("/hosted/","i").test(e.url)?"original-and-current-features":void 0,...a};return await this._queueOperation((async()=>{const{view:a}=this;if(!a)return null;const i=await V(a,e).catch((()=>null));return r=await e.applyEdits(t,s),i&&await h((()=>!i.updating)),r})),r}_queueOperation(e){this._activityQueue.push(e),this.notifyChange("syncing");const t=(e,t)=>{const a=t.indexOf(e);a>-1&&t.splice(a,1)};return e().then((e=>{if(null!=e&&"error"in e&&null!=e.error)throw e.error;if(null!=e&&"addFeatureResults"in e){const{addFeatureResults:t,deleteFeatureResults:a,updateFeatureResults:r}=e,i=t.find((e=>!!e.error))||r.find((e=>!!e.error))||a.find((e=>!!e.error));if(i)throw i.error}return e})).catch((a=>{G("editing:operation-error","An error occurred.",{error:a});const r={error:a,retry:()=>(t(r,this.failures),this._queueOperation(e)),cancel:()=>{t(r,this.failures)}};this._set("failures",[...this.failures,r])})).then((()=>{t(e,this._activityQueue),this.notifyChange("syncing")}))}_makeEditableItemForLayer(e,t=!0){const a=b(e),r=a?.operations,i=H(this.layerInfos,e),s=M(e),o=s||t,{allowedWorkflows:n}=this,l=n.includes("create")||n.includes("create-features"),d=n.includes("update"),p=e=>!i||!1!==i.enabled&&!1!==i[e],c=l&&!!r?.supportsAdd&&p("addEnabled"),u=d&&!!r?.supportsUpdate&&p("updateEnabled"),h=!o&&d&&!!r?.supportsDelete&&p("deleteEnabled"),w=[];c&&w.push("create"),u&&w.push("update"),h&&w.push("delete");const f=u&&!o&&(!i||!1!==i.attributeUpdatesEnabled),m=u&&!o&&!!a?.editing?.supportsGeometryUpdate&&(!i||!1!==i.geometryUpdatesEnabled),y=!(!a?.data?.supportsAttachment||i&&!1===i.allowAttachments);return{layer:e,supports:w,suspended:t,attributeUpdatesEnabled:f,geometryUpdatesEnabled:m,hasAttachments:y,attachmentsOnCreateEnabled:y&&l&&(!i||!1!==i.attachmentsOnCreateEnabled),attachmentsOnUpdateEnabled:!o&&y&&(!i||!1!==i.attachmentsOnUpdateEnabled),hasInvalidFormTemplate:s,hasUnsupportedFields:!1}}_itemIsSuspended(e){return this.findEditableItemForLayer(e)?.suspended??!1}};e([m()],N.prototype,"_editableItems",void 0),e([m({readOnly:!0})],N.prototype,"activeWorkflow",void 0),e([m({readOnly:!0})],N.prototype,"_activityQueue",void 0),e([m({value:[...x]})],N.prototype,"allowedWorkflows",null),e([m({readOnly:!0})],N.prototype,"canCreate",null),e([m({readOnly:!0})],N.prototype,"canUpdate",null),e([m()],N.prototype,"editableItems",null),e([m({readOnly:!0})],N.prototype,"failures",void 0),e([m()],N.prototype,"hideTemplatesForInactiveLayers",void 0),e([m()],N.prototype,"attachmentsViewModel",void 0),e([m()],N.prototype,"featureFormViewModel",void 0),e([m()],N.prototype,"featureTemplatesViewModel",void 0),e([m()],N.prototype,"labelOptions",null),e([m()],N.prototype,"layerInfos",null),e([m()],N.prototype,"sketchViewModel",void 0),e([m()],N.prototype,"snappingOptions",null),e([m()],N.prototype,"spinnerViewModel",void 0),e([m()],N.prototype,"state",null),e([m({readOnly:!0})],N.prototype,"syncing",null),e([m()],N.prototype,"updating",null),e([m()],N.prototype,"tooltipOptions",null),e([m()],N.prototype,"view",null),e([m()],N.prototype,"pageStack",void 0),e([m()],N.prototype,"showDiscardEditsPrompt",void 0),e([m()],N.prototype,"_candidateCommitted",void 0),e([m()],N.prototype,"page",null),e([m()],N.prototype,"featureFormDisabled",null),e([m()],N.prototype,"canGoBack",null),e([m()],N.prototype,"shouldShowDeleteButton",null),e([m()],N.prototype,"hasPendingEdits",null),e([m()],N.prototype,"useDeprecatedCreateWorkflow",void 0),N=e([y(P)],N);const q=N;export{q as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{isSome as o}from"../../../core/arrayUtils.js";import{ClonableMixin as l}from"../../../core/Clonable.js";import a from"../../../core/Collection.js";import{IdentifiableMixin as s}from"../../../core/Identifiable.js";import{ignoreAbortErrors as i,debounce as n}from"../../../core/promiseUtils.js";import{watch as u,initial as d}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../rest/support/RelationshipQuery.js";import{getFixedFieldName as c,findRelatedLayer as C}from"../support/featureUtils.js";import{getComputedAttributes as b,parseFormTemplateString as g,getFieldsInTitleAndDesc as _}from"../../FeatureForm/featureFormUtils.js";const F=100;let f=class extends(l(s(r))){constructor(e){super(e),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await i(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await i(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,F),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,F),this._queryPageDebounced=n(this._queryPageController,F),this._query=async()=>{const{_queryAbortController:e,relatedFeatures:t}=this;this.featureCount&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.removeAll(),this.destroyed||t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal}))))},this.addHandles([u((()=>[this.displayCount,this.graphic,this.layer,this.layer?.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount]),(()=>this._queryDebounced()),d),u((()=>[this.featurePage,this.showAllEnabled]),(()=>this._queryPageDebounced())),u((()=>[this.layer,this.relationshipId,this.objectId,this.canQuery]),(()=>this._queryFeatureCountDebounced()))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.removeAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,l=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),l))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map((e=>{const r=e.clone();return r.field=c(e.field,t),r})):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canLoad(){return!!this.map&&"number"==typeof this.relationshipId&&"number"==typeof this.objectId}get canQuery(){const e=this.layer?.capabilities?.queryRelated;return!!(this.relatedLayer&&this.relationship&&"number"==typeof this.relationshipId&&"number"==typeof this.objectId&&e?.supportsCount&&e?.supportsPagination)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}set displayCount(e){const t=0,r=10;this._set("displayCount",Math.min(Math.max(e,t),r))}get displayCount(){return this._get("displayCount")}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get("relatedFeatures")||new a}get relatedFeatureInfos(){const{itemDescriptionFieldName:e,relatedFeatures:t,relatedLayer:r}=this;if(!t.length||!r)return[];const o=r&&"formTemplate"in r&&r.formTemplate,l=o&&o?.title||void 0;return t.map((t=>{let o;if(e){const l=t.getAttribute(e),a=r.fieldsIndex.get(e);if(a){const t=b([l],[a])[e];null!=t&&(o=t.toString())}}return{feature:t,description:o,title:l?g(l,t.attributes,r.fieldsIndex):void 0}})).toArray()}get relatedLayer(){const{layer:e,map:t,relationship:r}=this;return e?.loaded&&t&&r?C(t,e,r)??null:null}get relationship(){const{relationshipId:e,layer:t}=this;return"number"==typeof e?t?.relationships?.find((({id:t})=>t===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new a}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:r,canQuery:o,_loaded:l,canLoad:a}=this;return t||a&&!l?"loading":e||r?"querying":o?"ready":"disabled"}getRelatedFeatureByObjectId(e){return this.relatedFeatures.find((t=>t.getObjectId()===e))}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.forEach((e=>!e.destroyed&&e.destroy())),this.relatedFeatureViewModels.removeAll()}async _queryFeatureCount(){const{layer:e,relatedLayer:t,relationshipId:r,objectId:o,_queryFeatureCountAbortController:l,canQuery:a,supportsCacheHint:s}=this;if(await(e?.load()),await(t?.load()),!a||!e||!t)return void this._set("featureCount",0);const i=t.createQuery(),n=new p({cacheHint:s,relationshipId:r,returnGeometry:!1,objectIds:[o],where:i.where??void 0}),u=await e.queryRelatedFeaturesCount(n,{signal:l?.signal});this._set("featureCount",u[o]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:r}=this;return t?e:r?e.slice(0,r):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:r,_queryPageAbortController:o,featureCount:l}=this;!r||t<2||!l||e.addMany(await this._queryRelatedFeatures({signal:o?.signal}))}async _queryRelatedFeatures(e){const{orderByFieldsFixedCasing:t,showAllEnabled:r,featuresPerPage:l,displayCount:a,layer:s,relationshipId:i,featurePage:n,featureCount:u,relatedLayer:d,supportsCacheHint:y}=this,{canQuery:h,objectId:c}=this;if(!h||!s||!d)return[];const C=r?((n-1)*l+u)%u:0,b=r?l:a,g=d.objectIdField,F=[...t.map((e=>e.field)),..._(d),g].filter(o),f=t.map((e=>`${e.field} ${e.order}`)),m=d.createQuery(),q=new p({orderByFields:f,start:C,num:b,outFields:F,cacheHint:y,relationshipId:i,returnGeometry:!1,objectIds:[c],where:m.where??void 0}),A=await s.queryRelatedFeatures(q,{signal:e?.signal}),w=A[c]?.features||[];return w.forEach((e=>{e.sourceLayer=d,e.layer=d})),w}};e([y()],f.prototype,"_loaded",void 0),e([y()],f.prototype,"_queryAbortController",void 0),e([y()],f.prototype,"_queryPageAbortController",void 0),e([y()],f.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],f.prototype,"featurePage",null),e([y()],f.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],f.prototype,"orderByFieldsFixedCasing",null),e([y({readOnly:!0})],f.prototype,"supportsCacheHint",null),e([y({readOnly:!0})],f.prototype,"canLoad",null),e([y({readOnly:!0})],f.prototype,"canQuery",null),e([y()],f.prototype,"description",void 0),e([y({readOnly:!0})],f.prototype,"itemDescriptionFieldName",null),e([y({value:3})],f.prototype,"displayCount",null),e([y({type:t})],f.prototype,"graphic",void 0),e([y()],f.prototype,"layer",void 0),e([y()],f.prototype,"map",void 0),e([y({readOnly:!0})],f.prototype,"objectId",null),e([y({readOnly:!0})],f.prototype,"objectIdField",null),e([y()],f.prototype,"orderByFields",void 0),e([y({readOnly:!0})],f.prototype,"relatedFeatures",null),e([y({readOnly:!0})],f.prototype,"relatedFeatureInfos",null),e([y({readOnly:!0})],f.prototype,"relatedLayer",null),e([y({readOnly:!0})],f.prototype,"relationship",null),e([y()],f.prototype,"featureCount",void 0),e([y({readOnly:!0})],f.prototype,"relatedFeatureViewModels",null),e([y()],f.prototype,"relationshipId",void 0),e([y()],f.prototype,"showAllEnabled",void 0),e([y()],f.prototype,"state",null),e([y()],f.prototype,"title",void 0),e([y()],f.prototype,"getRelatedFeatureByObjectId",null),f=e([h("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],f);const m=f;export{m as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{isSome as o}from"../../../core/arrayUtils.js";import{ClonableMixin as l}from"../../../core/Clonable.js";import a from"../../../core/Collection.js";import{IdentifiableMixin as s}from"../../../core/Identifiable.js";import{ignoreAbortErrors as i,debounce as n}from"../../../core/promiseUtils.js";import{watch as u,initial as d}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/has.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import p from"../../../rest/support/RelationshipQuery.js";import{getFixedFieldName as c,findRelatedLayer as C}from"../support/featureUtils.js";import{getComputedAttributes as b,parseFormTemplateString as g,getFieldsInTitleAndDesc as _}from"../../FeatureForm/featureFormUtils.js";const F=100;let f=class extends(l(s(r))){constructor(e){super(e),this._loaded=!1,this._queryAbortController=null,this._queryPageAbortController=null,this._queryFeatureCountAbortController=null,this.featuresPerPage=10,this.description=null,this.graphic=null,this.layer=null,this.map=null,this.orderByFields=null,this.featureCount=0,this.relationshipId=null,this.showAllEnabled=!1,this.title=null,this._cancelQuery=()=>{const{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{const{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._cancelQueryPage=()=>{const{_queryPageAbortController:e}=this;e&&e.abort(),this._queryPageAbortController=null},this._queryController=async()=>{this._cancelQuery();const e=new AbortController;this._queryAbortController=e,await i(this._query()),this._queryAbortController===e&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();const e=new AbortController;this._queryFeatureCountAbortController=e,await i(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryPageController=async()=>{const e=new AbortController;this._queryPageAbortController=e,await i(this._queryPage()),this._queryPageAbortController===e&&(this._queryPageAbortController=null)},this._queryDebounced=n(this._queryController,F),this._queryFeatureCountDebounced=n(this._queryFeatureCountController,F),this._queryPageDebounced=n(this._queryPageController,F),this._query=async()=>{const{_queryAbortController:e,relatedFeatures:t}=this;this.featureCount&&(this._destroyRelatedFeatureViewModels(),this.featurePage=1,t.removeAll(),this.destroyed||t.addMany(this._sliceFeatures(await this._queryRelatedFeatures({signal:e?.signal}))))},this.addHandles([u((()=>[this.displayCount,this.graphic,this.layer,this.layer?.loaded,this.map,this.orderByFields,this.relationshipId,this.featuresPerPage,this.showAllEnabled,this.canQuery,this.featureCount]),(()=>this._queryDebounced()),d),u((()=>[this.featurePage,this.showAllEnabled]),(()=>this._queryPageDebounced())),u((()=>[this.layer,this.relationshipId,this.objectId,this.canQuery]),(()=>this._queryFeatureCountDebounced()))])}destroy(){this._destroyRelatedFeatureViewModels(),this.relatedFeatures.removeAll(),this._cancelQuery(),this._cancelQueryFeatureCount(),this._cancelQueryPage()}set featurePage(e){const{featuresPerPage:t,featureCount:r}=this,o=1,l=Math.ceil(r/t)||1;this._set("featurePage",Math.min(Math.max(e,o),l))}get featurePage(){return this._get("featurePage")}get orderByFieldsFixedCasing(){const{orderByFields:e,relatedLayer:t}=this;return e&&t?.loaded?e.map((e=>{const r=e.clone();return r.field=c(e.field,t),r})):e??[]}get supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get canLoad(){return!!this.map&&"number"==typeof this.relationshipId&&"number"==typeof this.objectId}get canQuery(){const e=this.layer?.capabilities?.queryRelated;return!!(this.relatedLayer&&this.relationship&&"number"==typeof this.relationshipId&&"number"==typeof this.objectId&&e?.supportsCount&&e?.supportsPagination)}get itemDescriptionFieldName(){return this.orderByFieldsFixedCasing[0]?.field||null}set displayCount(e){const t=0,r=10;this._set("displayCount",Math.min(Math.max(e,t),r))}get displayCount(){return this._get("displayCount")}get objectId(){return(this.objectIdField&&this.graphic?.attributes?.[this.objectIdField])??null}get objectIdField(){return this.layer?.objectIdField||null}get relatedFeatures(){return this._get("relatedFeatures")||new a}get relatedFeatureInfos(){const{itemDescriptionFieldName:e,relatedFeatures:t,relatedLayer:r}=this;if(!t.length||!r)return[];const o=r&&"formTemplate"in r&&r.formTemplate,l=o&&o?.title||void 0;return t.map((t=>{let o;if(e){const l=t.getAttribute(e),a=r.fieldsIndex.get(e);if(a){const t=b({values:[l],fields:[a]})[e];null!=t&&(o=t.toString())}}return{feature:t,description:o,title:l?g({label:l,attributes:t.attributes,fieldsIndex:r.fieldsIndex}):void 0}})).toArray()}get relatedLayer(){const{layer:e,map:t,relationship:r}=this;return e?.loaded&&t&&r?C(t,e,r)??null:null}get relationship(){const{relationshipId:e,layer:t}=this;return"number"==typeof e?t?.relationships?.find((({id:t})=>t===e))??null:null}get relatedFeatureViewModels(){return this._get("relatedFeatureViewModels")||new a}get state(){const{_queryAbortController:e,_queryFeatureCountAbortController:t,_queryPageAbortController:r,canQuery:o,_loaded:l,canLoad:a}=this;return t||a&&!l?"loading":e||r?"querying":o?"ready":"disabled"}getRelatedFeatureByObjectId(e){return this.relatedFeatures.find((t=>t.getObjectId()===e))}_destroyRelatedFeatureViewModels(){this.relatedFeatureViewModels?.forEach((e=>!e.destroyed&&e.destroy())),this.relatedFeatureViewModels.removeAll()}async _queryFeatureCount(){const{layer:e,relatedLayer:t,relationshipId:r,objectId:o,_queryFeatureCountAbortController:l,canQuery:a,supportsCacheHint:s}=this;if(await(e?.load()),await(t?.load()),!a||!e||!t)return void this._set("featureCount",0);const i=t.createQuery(),n=new p({cacheHint:s,relationshipId:r,returnGeometry:!1,objectIds:[o],where:i.where??void 0}),u=await e.queryRelatedFeaturesCount(n,{signal:l?.signal});this._set("featureCount",u[o]||0)}_sliceFeatures(e){const{showAllEnabled:t,displayCount:r}=this;return t?e:r?e.slice(0,r):[]}async _queryPage(){const{relatedFeatures:e,featurePage:t,showAllEnabled:r,_queryPageAbortController:o,featureCount:l}=this;!r||t<2||!l||e.addMany(await this._queryRelatedFeatures({signal:o?.signal}))}async _queryRelatedFeatures(e){const{orderByFieldsFixedCasing:t,showAllEnabled:r,featuresPerPage:l,displayCount:a,layer:s,relationshipId:i,featurePage:n,featureCount:u,relatedLayer:d,supportsCacheHint:y}=this,{canQuery:h,objectId:c}=this;if(!h||!s||!d)return[];const C=r?((n-1)*l+u)%u:0,b=r?l:a,g=d.objectIdField,F=[...t.map((e=>e.field)),..._(d),g].filter(o),f=t.map((e=>`${e.field} ${e.order}`)),m=d.createQuery(),q=new p({orderByFields:f,start:C,num:b,outFields:F,cacheHint:y,relationshipId:i,returnGeometry:!1,objectIds:[c],where:m.where??void 0}),A=await s.queryRelatedFeatures(q,{signal:e?.signal}),w=A[c]?.features||[];return w.forEach((e=>{e.sourceLayer=d,e.layer=d})),w}};e([y()],f.prototype,"_loaded",void 0),e([y()],f.prototype,"_queryAbortController",void 0),e([y()],f.prototype,"_queryPageAbortController",void 0),e([y()],f.prototype,"_queryFeatureCountAbortController",void 0),e([y({value:1})],f.prototype,"featurePage",null),e([y()],f.prototype,"featuresPerPage",void 0),e([y({readOnly:!0})],f.prototype,"orderByFieldsFixedCasing",null),e([y({readOnly:!0})],f.prototype,"supportsCacheHint",null),e([y({readOnly:!0})],f.prototype,"canLoad",null),e([y({readOnly:!0})],f.prototype,"canQuery",null),e([y()],f.prototype,"description",void 0),e([y({readOnly:!0})],f.prototype,"itemDescriptionFieldName",null),e([y({value:3})],f.prototype,"displayCount",null),e([y({type:t})],f.prototype,"graphic",void 0),e([y()],f.prototype,"layer",void 0),e([y()],f.prototype,"map",void 0),e([y({readOnly:!0})],f.prototype,"objectId",null),e([y({readOnly:!0})],f.prototype,"objectIdField",null),e([y()],f.prototype,"orderByFields",void 0),e([y({readOnly:!0})],f.prototype,"relatedFeatures",null),e([y({readOnly:!0})],f.prototype,"relatedFeatureInfos",null),e([y({readOnly:!0})],f.prototype,"relatedLayer",null),e([y({readOnly:!0})],f.prototype,"relationship",null),e([y()],f.prototype,"featureCount",void 0),e([y({readOnly:!0})],f.prototype,"relatedFeatureViewModels",null),e([y()],f.prototype,"relationshipId",void 0),e([y()],f.prototype,"showAllEnabled",void 0),e([y()],f.prototype,"state",null),e([y()],f.prototype,"title",void 0),e([y()],f.prototype,"getRelatedFeatureByObjectId",null),f=e([h("esri.widgets.Feature.FeatureRelationship.FeatureRelationshipViewModel")],f);const m=f;export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{deprecatedProperty as n}from"../../core/deprecate.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import{EsriPromiseMixin as r}from"../../core/Promise.js";import{watch as a}from"../../core/reactiveUtils.js";import{templateHasKey as l}from"../../core/string.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../core/support/UpdatingHandles.js";import c from"../../form/FormTemplate.js";import h from"../../layers/support/ContingentValue.js";import{isEditableLayer as f}from"../../layers/support/editableLayers.js";import m from"../../layers/support/LayerContingentValuesCache.js";import{utc as g,unknown as y,system as _}from"../../time/timeZoneUtils.js";import{flattenFieldInputs as v,isGroupInput as I,flattenRelationshipInputs as F,parseFormTemplateString as C,isGroupElement as E,isFieldElement as x,isRelationshipElement as V,isRelationshipInput as b,isFieldInput as w,getNormalizedFeatureTypeInfo as j,valueIsValidContingentValue as T}from"./featureFormUtils.js";import A from"./FieldInput.js";import{createFormExpressionArcadeExecutor as M}from"./FormExpressionArcadeExecutor.js";import{FormExpressionsManager as R}from"./FormExpressionsManager.js";import H from"./GroupInput.js";import S from"./RelationshipInput.js";const N=new t({attributes:{}}),L=["editableExpression","requiredExpression","valueExpression","visibilityExpression"],k=["visibilityExpression"],U=["editableExpression","visibilityExpression"],P="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",W="#JSAPI_CONTINGENT_VALUE_ANY_HASH",G="#JSAPI_CONTINGENT_VALUE_NULL_HASH",O="esri.widgets.FeatureForm.FeatureFormViewModel",Z=i.getLogger(O);let $=class extends(r(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=N.clone(),this._initialFeature=N.clone(),this._timeZone=null,this._updatingHandles=new d,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.relatedRecordCallbacks=null,this.strict=!1}initialize(){const e=a((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.arcadeEditType]),(async([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),{equals:([e,t,n,s,i],[o,r,a,l,u])=>e===o&&t===r&&n===a&&s===l&&i===u,initial:!0}),t=a((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._updatingHandles.addPromise(this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))))})),n=a((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(m.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:f(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get allFieldInputs(){return v(this.inputs)}get allGroupInputs(){return this.inputs.filter(I)}get allRelationshipInputs(){return F(this.inputs)}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():N.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get fieldsWithInvalidCodedValue(){const e=this.allFieldInputs;return new Set(e.filter((e=>{const{name:t,domain:n,value:s}=e;if("coded-value"===n?.type){const e=this.getFieldValueOptionsForField(t);return null!=s&&""!==s&&!e.flat().some((e=>e.value===s))}return!1})))}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 formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?C(e.description,this.getValues(),t.fieldsIndex):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?C(e.title,this.getValues(),t.fieldsIndex):null}get formHeaderVisible(){const{activeRelationshipInput:e,formDescription:t,formTitle:n}=this;return!(e||!t&&!n)}set inputFields(e){n(Z,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs=e}get inputFields(){return n(Z,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>e.showAllEnabled=!1)),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return g;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===y?t||g:this._timeZone||_}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}get view(){return n(Z,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._get("view")}set view(e){n(Z,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._set("view",e),e?.map&&(this.map=e.map)}findField(e){return this.allFieldInputs.find((t=>t.name===e))}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map((({name:e,code:t})=>({name:e,value:t}))):[],i=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(i.length>0){const e=new Set(i.map((e=>e.value)));return[i,s.filter((t=>!e.has(t.value)))]}return[s,[]]}getValue(e){const{_featureClone:t,layer:n}=this,s=!!n?.getField(e);return t.getAttribute(e)??(s?null:void 0)}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),null!=this._expressionsManager&&this._updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:n}=this;n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated())))}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _updateInputs(){this._stopExpressions();const{_featureClone:e,_initialFeature:t,arcadeEditType:n,formTemplate:s,inputs:i,layer:o}=this;if(!o)return;const r={arcadeEditType:n,feature:e,initialFeature:t,layer:o},a=i.slice(),l=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(a,s.elements,r):this._updateInputsUsingLayerFields(a,o?.fields,r);this.inputs=l,await this._startExpressions()}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(I(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(z),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}_updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):E(a)?this._makeGroupInputFromElement(a,s):x(a)?this._makeFieldInputFromElement(a,s,i):V(a)?this._makeRelationshipInputFromElement(a,s,i):null;if(n){if(r.push(n),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),I(n)){const{feature:e}=s;n.set({feature:e})}else if(b(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else n.set(s);if(E(a)){const e=a.elements.filter((e=>z(e)));n.inputs=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return i.getLogger(this).warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const i of e)if(I(i)){for(const e of i.inputs)e.destroy();i.inputs.length=0,i.destroy()}else b(i)?i.destroy():w(i)&&(null!==i.element?i.destroy():s.set(i.field,i));const o=[],{arcadeEditType:r,feature:a,initialFeature:l,layer:u}=n;for(const i of t){const e=s.get(i)??new A({arcadeEditType:r,field:i,feature:a,initialFeature:l,layer:u,value:a?.getAttribute(i.name)??null,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden});o.push(e),s.delete(i)}for(const[i,p]of s.entries())s.delete(i),p.destroy();return o}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r}=t,{fieldName:a}=e,l=a&&this._layerFieldsByName.get(a);return l?new A({arcadeEditType:s,element:e,field:l,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden}):null}_makeGroupInputFromElement(e,t){const{feature:n,layer:s}=t;return new H({element:e,inputs:[],feature:n,layer:s})}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o}=t;return new S({element:e,feature:i,group:n,layer:o,map:s})}_assignExpressionExecutors(e,t,n){const s=E(t)?k:V(t)?U:L,i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const i=t[o],{_expressionExecutorLookup:r}=this;if(null!=i&&""!==i){const t=this._expressionInfosLookup.get(i)?.expression??i;if(r.has(t))e[s]=this._useExecutor(r.get(t));else if(n.has(t)){const i=n.get(t).then((t=>(e[s]=t,t)));n.set(t,i)}else{const i=M(t,this.layer).then((n=>(e[s]=this._useExecutor(n),r.set(t,n),n)));n.set(t,i)}}}return i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new R({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),await this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:u}=j(o);if(t===a&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);s.sourceLayer=this.feature.sourceLayer=e}const e=new Set;for(const t of u)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}}if(null!=i){const{description:e,title:n}=i;n&&l(n,t)&&this.notifyChange("formTitle"),e&&l(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=j(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(W)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(W),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(W)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(W),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:d,leftIsRange:c,rightIsRange:f}=this._compareObjectTypes(n.objectType,o.objectType);if(l||d)continue;if(r&&p||a&&u){s.values[i]=new h({objectType:"null"});continue}if(r&&f||a&&c)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const m=Math.max(n.minValue,o.minValue),g=Math.min(n.maxValue,o.maxValue);if(m>g)return null;s.values[i]=new h({objectType:"range",minValue:m,maxValue:g})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===W)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,r=new Set,a=new Set;for(const l of i)if(o.has(l)){const e=this.layer?.getFieldDomain(l,{feature:this.feature});if(null==e)continue;switch(e.type){case"coded-value":r.add(l);break;case"range":a.add(l)}}return{codedValueFields:[...r],rangeFields:[...a]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every((([e,n])=>!t.values.hasOwnProperty(e)||T(n,t.values[e])))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[P,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[W,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${G}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_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}}};function z(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||(i.getLogger(O).warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}e([u()],$.prototype,"_expressionInfosLookup",null),e([u()],$.prototype,"_featureClone",void 0),e([u()],$.prototype,"_timeZone",void 0),e([u()],$.prototype,"activeRelationshipInput",null),e([u()],$.prototype,"_arcadeContextInfo",null),e([u()],$.prototype,"allFieldInputs",null),e([u()],$.prototype,"allGroupInputs",null),e([u()],$.prototype,"allRelationshipInputs",null),e([u()],$.prototype,"_layerFieldsByName",null),e([u()],$.prototype,"arcadeEditType",void 0),e([u()],$.prototype,"contingencyConstraintViolations",void 0),e([u()],$.prototype,"disabled",void 0),e([u()],$.prototype,"feature",null),e([u()],$.prototype,"fieldsWithContingentValues",null),e([u()],$.prototype,"fieldsWithInvalidCodedValue",null),e([u({type:c})],$.prototype,"formTemplate",null),e([u()],$.prototype,"formDescription",null),e([u()],$.prototype,"formTitle",null),e([u()],$.prototype,"formHeaderVisible",null),e([u()],$.prototype,"highlightHelper",void 0),e([u()],$.prototype,"inputs",void 0),e([u()],$.prototype,"inputFields",null),e([u()],$.prototype,"joinedContingentValues",null),e([u()],$.prototype,"layer",null),e([u()],$.prototype,"map",void 0),e([u()],$.prototype,"relatedRecordCallbacks",void 0),e([u()],$.prototype,"relationshipId",null),e([u()],$.prototype,"spatialReference",null),e([u()],$.prototype,"state",null),e([u()],$.prototype,"strict",void 0),e([u()],$.prototype,"submittable",null),e([u()],$.prototype,"timeZone",null),e([u()],$.prototype,"updating",null),e([u()],$.prototype,"valid",null),e([u()],$.prototype,"view",null),e([u()],$.prototype,"getValues",null),e([u()],$.prototype,"submit",null),$=e([p(O)],$);const D=$;export{D as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{deprecatedProperty as n}from"../../core/deprecate.js";import s from"../../core/Evented.js";import i from"../../core/Logger.js";import{destroyMaybe as o}from"../../core/maybe.js";import{EsriPromiseMixin as r}from"../../core/Promise.js";import{watch as a}from"../../core/reactiveUtils.js";import{templateHasKey as l}from"../../core/string.js";import{property as u}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as d}from"../../core/support/UpdatingHandles.js";import c from"../../form/FormTemplate.js";import h from"../../layers/support/ContingentValue.js";import{isEditableLayer as f}from"../../layers/support/editableLayers.js";import m from"../../layers/support/LayerContingentValuesCache.js";import{utc as g,unknown as y,system as _}from"../../time/timeZoneUtils.js";import{flattenFieldInputs as v,isGroupInput as I,flattenRelationshipInputs as F,parseFormTemplateString as C,isGroupElement as E,isFieldElement as x,isRelationshipElement as V,isRelationshipInput as b,isFieldInput as w,getNormalizedFeatureTypeInfo as j,valueIsValidContingentValue as T}from"./featureFormUtils.js";import A from"./FieldInput.js";import{createFormExpressionArcadeExecutor as M}from"./FormExpressionArcadeExecutor.js";import{FormExpressionsManager as R}from"./FormExpressionsManager.js";import H from"./GroupInput.js";import S from"./RelationshipInput.js";const N=new t({attributes:{}}),Z=["editableExpression","requiredExpression","valueExpression","visibilityExpression"],L=["visibilityExpression"],k=["editableExpression","visibilityExpression"],U="#JSAPI_CONTINGENT_VALUE_EMPTY_HASH",P="#JSAPI_CONTINGENT_VALUE_ANY_HASH",W="#JSAPI_CONTINGENT_VALUE_NULL_HASH",G="esri.widgets.FeatureForm.FeatureFormViewModel",O=i.getLogger(G);let $=class extends(r(s.EventedAccessor)){constructor(e){super(e),this._expressionExecutorsInUse=new Set,this._expressionExecutorLookup=new Map,this._expressionsManager=null,this._contingentValuesCache=null,this._featureClone=N.clone(),this._initialFeature=N.clone(),this._timeZone=null,this._updatingHandles=new d,this.arcadeEditType="NA",this.contingencyConstraintViolations=new Map,this.disabled=!1,this.highlightHelper=null,this.inputs=[],this.map=null,this.relatedRecordCallbacks=null,this.strict=!1}initialize(){const e=a((()=>[this.layer,!!this.layer?.loaded,this.formTemplate,this.feature,this.timeZone,this.arcadeEditType]),(async([e,t])=>{null!=e&&(t?this._updatingHandles.addPromise(this._updateInputs()):e.load().catch((()=>{})))}),{equals:([e,t,n,s,i,o],[r,a,l,u,p,d])=>e===r&&t===a&&n===l&&s===u&&i===p&&o===d,initial:!0}),t=a((()=>this._arcadeContextInfo),(e=>{null!=this._expressionsManager&&(this._expressionsManager.arcadeContextInfo=e,this._updatingHandles.addPromise(this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))))})),n=a((()=>this.layer),(e=>{const t="subtype-sublayer"===e?.type?e.parent:"feature"===e?.type?e:null;t&&this.addResolvingPromise(m.createLoadedLayerContingentValuesCache(t).then((e=>{this._contingentValuesCache=e,this.notifyChange("fieldsWithContingentValues")})))}),{initial:!0});this.addHandles([e,t,n])}destroy(){this.feature=null,this.layer=null,this._contingentValuesCache=o(this._contingentValuesCache),this.highlightHelper?.removeAll(),this._updatingHandles.destroy()}get _expressionInfosLookup(){return new Map(this.formTemplate?.expressionInfos?.map((e=>[e.name,e])))}get activeRelationshipInput(){return this.allRelationshipInputs.find((e=>e.relationshipId===this.relationshipId))}get _arcadeContextInfo(){const{_initialFeature:e,arcadeEditType:t,layer:n,map:s,spatialReference:i,timeZone:o}=this;return{layer:f(n)?n:null,originalFeature:e,editType:t,map:s,spatialReference:i,timeZone:o}}get allFieldInputs(){return v(this.inputs)}get allGroupInputs(){return this.inputs.filter(I)}get allRelationshipInputs(){return F(this.inputs)}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():N.clone(),this._initialFeature=this._featureClone.clone(),this._expressionsManager&&(this._expressionsManager.feature=this._featureClone),e?(this._resetFieldInputValues(this._featureClone),this.allRelationshipInputs.forEach((t=>t.feature=e))):(this.inputs.forEach((e=>e.destroy())),this.inputs.length=0),this.contingencyConstraintViolations.clear(),this._set("feature",e)}get fieldsWithContingentValues(){if(null==this._contingentValuesCache)return new Set;const e=this._contingentValuesCache.fieldGroups.flatMap((e=>e.fields));return new Set(e)}get fieldsWithInvalidCodedValue(){const e=this.allFieldInputs;return new Set(e.filter((e=>{const{name:t,domain:n,value:s}=e;if("coded-value"===n?.type){const e=this.getFieldValueOptionsForField(t);return null!=s&&""!==s&&!e.flat().some((e=>e.value===s))}return!1})))}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 formDescription(){const{formTemplate:e,layer:t}=this;return e?.description&&t?C({label:e.description,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formTitle(){const{formTemplate:e,layer:t}=this;return e?.title&&t?C({label:e.title,attributes:this.getValues(),fieldsIndex:t.fieldsIndex,timeZone:this.timeZone}):null}get formHeaderVisible(){const{activeRelationshipInput:e,formDescription:t,formTitle:n}=this;return!(e||!t&&!n)}set inputFields(e){n(O,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs=e}get inputFields(){return n(O,"inputFields",{replacement:"FeatureFormViewModel.inputs",version:"4.27"}),this.inputs}get joinedContingentValues(){return this._joinContingentValues()}get layer(){return this.feature?.sourceLayer&&"applyEdits"in this.feature.sourceLayer?this.feature.sourceLayer:null}set layer(e){this._override("layer",e)}get relationshipId(){return this._get("relationshipId")}set relationshipId(e){const t=this.allRelationshipInputs;if(null!=e&&e===this.relationshipId||t.forEach((e=>e.showAllEnabled=!1)),null!=e){const n=t.find((t=>t.relationshipId===e));n&&(n.showAllEnabled=!0)}this._set("relationshipId",e)}get spatialReference(){return this.layer?.spatialReference??null}set spatialReference(e){this._override("spatialReference",e)}get state(){return this.layer?.loaded?"ready":"disabled"}get submittable(){return!!this.valid||this.allFieldInputs.filter((e=>!e.valid)).every((({submittable:e})=>e))}get timeZone(){const{layer:e}=this;if(e&&"datesInUnknownTimezone"in e&&e.datesInUnknownTimezone)return g;const t=e&&"preferredTimeZone"in e&&e.preferredTimeZone;return this._timeZone===y?t||g:this._timeZone||_}set timeZone(e){this._timeZone=e}get updating(){return this._updatingHandles.updating}get valid(){const e=this.allFieldInputs;return e.length>0&&e.every((({valid:e})=>e))}get view(){return n(O,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._get("view")}set view(e){n(O,"view",{replacement:"FeatureForm.map",version:"4.27"}),this._set("view",e),e?.map&&(this.map=e.map)}findField(e){return this.allFieldInputs.find((t=>t.name===e))}getFieldValueOptionsForField(e,t){const n=this.findField(e);if(!n)return[[],[]];const s="coded-value"===n.domain?.type?n.domain.codedValues.map((({name:e,code:t})=>({name:e,value:t}))):[],i=this.fieldsWithContingentValues.has(e)?this._getContingentValueOptionsForField(e,t):[];if(i.length>0){const e=new Set(i.map((e=>e.value)));return[i,s.filter((t=>!e.has(t.value)))]}return[s,[]]}getValue(e){const{_featureClone:t,layer:n}=this,s=!!n?.getField(e);return t.getAttribute(e)??(s?null:void 0)}setValue(e,t){const{_featureClone:n,strict:s}=this,i=this.findField(e);t=""===t?null:t,i&&n.getAttribute(e)!==t&&(i.value=t,s&&!i.valid||(this._afterValueChange(i),null!=this._expressionsManager&&this._updatingHandles.addPromise(this._expressionsManager.evaluateInvalidated([i.name]).finally((()=>this._afterExpressionsEvaluated())))))}getValues(){return{...this._featureClone.attributes}}overrideInitialFeature(e){this._initialFeature=e}submit(){const e=this.allFieldInputs,t=new Set(e.filter((e=>e.valid)).map((({name:e})=>e))),n=e.filter((e=>!e.valid)).map((({name:e})=>e)),s=this.getValues();if(this.validateContingencyConstraints(s,{includeIncompleteViolations:!0}).length>0)for(const[i,o]of this.contingencyConstraintViolations.entries())"error"===o.type&&(t.delete(i),n.push(i));this.emit("submit",{valid:[...t],invalid:n,values:s})}validateContingencyConstraints(e,t){const{_contingentValuesCache:n}=this,s=new Map;if(this.contingencyConstraintViolations=s,null==n)return[];const{invalid:i,incomplete:o}=n.validateContingencyConstraints(e),r=[...i,...t?.includeIncompleteViolations?o:[]];for(const a of r)for(const e of a.fieldGroup.fields)s.set(e,a);return r}notifyFeatureGeometryChanged(){const{_expressionsManager:e,feature:t,_featureClone:n}=this;n.geometry=t.geometry,null!=e&&this._updatingHandles.addPromise(e.evaluateInvalidatedByGeometry().finally((()=>this._afterExpressionsEvaluated())))}_emitChangeEvent({name:e,valid:t,value:n}){this.emit("value-change",{layer:this.layer,feature:this.feature,fieldName:e,value:n,valid:t})}async _updateInputs(){this._stopExpressions();const{_featureClone:e,_initialFeature:t,arcadeEditType:n,formTemplate:s,inputs:i,layer:o,timeZone:r}=this;if(!o)return;const a={arcadeEditType:n,feature:e,initialFeature:t,layer:o,timeZone:r},l=i.slice(),u=s?.elements&&s.elements.length>0?await this._updateInputsUsingFormElements(l,s.elements,a):this._updateInputsUsingLayerFields(l,o?.fields,a);this.inputs=u,await this._startExpressions()}async _updateInputsUsingFormElements(e,t,n){const s=new Map;for(const r of e)if(I(r)){s.set(r.element,r);for(const e of r.inputs)e.element&&s.set(e.element,e)}else r.element&&s.set(r.element,r);const i=new Map,o=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:s,updatedElements:t.filter(z),sharedInitializationProperties:n,group:null,newExpressionExecutorPromises:i});for(const[r,a]of s.entries())s.delete(r),a.destroy();return await Promise.all(Array.from(i.values())),o}_updateInputsUsingFormElementsRecursive(e){const{existingInputsByElement:t,updatedElements:n,sharedInitializationProperties:s,group:i,newExpressionExecutorPromises:o}=e,r=[];for(const a of n){const e=t.has(a),n=e?t.get(a):E(a)?this._makeGroupInputFromElement(a,s):x(a)?this._makeFieldInputFromElement(a,s,i):V(a)?this._makeRelationshipInputFromElement(a,s,i):null;if(n){if(r.push(n),this._assignExpressionExecutors(n,a,o),e)if(t.delete(a),I(n)){const{feature:e,timeZone:t}=s;n.set({feature:e,timeZone:t})}else if(b(n)){const e=this.relationshipId===a.relationshipId;n.set(s),n.set({map:this.map,showAllEnabled:e})}else n.set(s);if(E(a)){const e=a.elements.filter((e=>z(e)));n.inputs=this._updateInputsUsingFormElementsRecursive({existingInputsByElement:t,updatedElements:e,sharedInitializationProperties:s,group:n,newExpressionExecutorPromises:o})}}}return r}_updateInputsUsingLayerFields(e,t,n){if(!Array.isArray(t))return i.getLogger(this).warn(this.declaredClass,"No attribute fields found."),[];const s=new Map;for(const i of e)if(I(i)){for(const e of i.inputs)e.destroy();i.inputs.length=0,i.destroy()}else b(i)?i.destroy():w(i)&&(null!==i.element?i.destroy():s.set(i.field,i));const o=[],{arcadeEditType:r,feature:a,initialFeature:l,layer:u,timeZone:p}=n;for(const i of t){const e=s.get(i)??new A({arcadeEditType:r,field:i,feature:a,initialFeature:l,layer:u,value:a?.getAttribute(i.name)??null,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:p});o.push(e),s.delete(i)}for(const[i,d]of s.entries())s.delete(i),d.destroy();return o}_resetFieldInputValues(e){for(const t of this.allFieldInputs)t.value=e.getAttribute(t.name)}_makeFieldInputFromElement(e,t,n){const{arcadeEditType:s,feature:i,initialFeature:o,layer:r,timeZone:a}=t,{fieldName:l}=e,u=l&&this._layerFieldsByName.get(l);return u?new A({arcadeEditType:s,element:e,field:u,value:i?.getAttribute(e.fieldName)??null,feature:i,initialFeature:o,layer:r,group:n,preservesValueWhenHidden:this.formTemplate?.preserveFieldValuesWhenHidden,timeZone:a}):null}_makeGroupInputFromElement(e,t){const{feature:n,layer:s}=t;return new H({element:e,inputs:[],feature:n,layer:s})}_makeRelationshipInputFromElement(e,t,n=null){const{map:s}=this,{feature:i,layer:o,timeZone:r}=t;return new S({element:e,feature:i,group:n,layer:o,map:s,timeZone:r})}_assignExpressionExecutors(e,t,n){const s=E(t)?L:V(t)?k:Z,i=[];for(const o of s){const s=`${o}Executor`;if(e[s]){this._useExecutor(e[s]);continue}const i=t[o],{_expressionExecutorLookup:r}=this;if(null!=i&&""!==i){const t=this._expressionInfosLookup.get(i)?.expression??i;if(r.has(t))e[s]=this._useExecutor(r.get(t));else if(n.has(t)){const i=n.get(t).then((t=>(e[s]=t,t)));n.set(t,i)}else{const i=M(t,this.layer).then((n=>(e[s]=this._useExecutor(n),r.set(t,n),n)));n.set(t,i)}}}return i}_createExpressionsManager(e){const{_arcadeContextInfo:t,_featureClone:n,allFieldInputs:s,formTemplate:i}=this;this._expressionsManager=new R({executors:e,feature:n,arcadeContextInfo:t,fieldInputs:s,preserveFieldValuesWhenHidden:!0===i?.preserveFieldValuesWhenHidden})}async _startExpressions(){if(0===this._expressionExecutorsInUse.size)return;const e=Array.from(this._expressionExecutorsInUse);this._createExpressionsManager(e),await this._expressionsManager.evaluateAll().finally((()=>this._afterExpressionsEvaluated()))}_stopExpressions(){this._expressionsManager=o(this._expressionsManager),this._expressionExecutorsInUse.clear()}_useExecutor(e){return this._expressionExecutorsInUse.add(e),e}_afterValueChange(e){const{name:t,value:n}=e,{_featureClone:s,formTemplate:i,layer:o}=this;if(!o)return;const r=s.getAttribute(t);s.setAttribute(t,n);const{typeFieldName:a,types:u}=j(o);if(t===a&&n!==r){if("subtype-sublayer"===o.type){const e=o.parent?.findSublayerForFeature(s);s.sourceLayer=this.feature.sourceLayer=e}const e=new Set;for(const t of u)if(t.domains&&"object"==typeof t.domains)for(const n of Object.keys(t.domains))e.add(n);for(const t of e){const e=this.findField(t);e&&e.notifyChange("domain")}}if(null!=i){const{description:e,title:n}=i;n&&l(n,t)&&this.notifyChange("formTitle"),e&&l(e,t)&&this.notifyChange("formDescription")}this._emitChangeEvent(e)}_afterExpressionsEvaluated(){const{_featureClone:e}=this;for(const t of this.allFieldInputs)t.value!==e.getAttribute(t.name)&&this._afterValueChange(t)}_joinContingentValues(){const e=this._contingentValuesCache;if(null==e)return[];const{typeFieldName:t}=j(this.layer),n=t?this.getValue(t):null,s=[];for(const r of e.fieldGroups){const{contingencies:e,fields:t,name:i}=r,o=[];for(const s of e)s.isRetired||null!=s.subtype&&s.subtype.code!==n||o.push({values:s.values});o.length>0&&s.push({name:i,fields:t,contingencies:o})}const[i,o]=this._generateJoinPlan(s);return[...i.flatMap((e=>this._joinFieldGroupContingencies(e))),...o.flatMap((e=>e.contingencies))]}_generateJoinPlan(e){const t=new Map,n=[],s=new Set;for(const l of e)for(const e of l.fields)if(t.has(e)){const i=t.get(e),o=l,r=[i.name,o.name].sort().join("|");if(s.has(r))continue;n.push([i,o]),s.add(r),t.set(e,o)}else t.set(e,l);const i=new Set(n.flat()),o=new Set(e);for(const l of i)o.delete(l);const r=new Map,a=new Map;for(const l of new Set(n.flat())){const e=Symbol(l.name);r.set(e,new Set([l])),a.set(l,e)}for(const[l,u]of n){const e=a.get(l),t=a.get(u);if(e===t)continue;const n=r.get(e),s=r.get(t);for(const i of s)n.add(i),a.set(i,e);r.delete(t)}return[[...r.values()].map((e=>[...e])),[...o]]}_joinFieldGroupContingencies(e){const t=e.slice(),n=t.shift();let s=t.shift(),i=this._generateJoinKey(n.fields,s.fields),o=new Set([...n.fields,...s.fields]),r=new Map;for(const l of n.contingencies){const[e]=this._hashContingency(l,i.codedValueFields,!0);r.has(e)?r.get(e)?.push(l):r.set(e,[l])}for(;t.length>0;){const e=new Map,n=t.shift(),a=this._generateJoinKey(o,n.fields);for(const t of s.contingencies){const[n,s]=this._hashContingency(t,i.codedValueFields),o=s?this._findMatchingContingenciesWithAnyHashMask(r,n):r.get(n);if(r.has(P)&&o?.push(...this._findMatchingContingenciesContainingAny(t,r.get(P),i.codedValueFields)),null!=o)for(const r of o){const n=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(r,t,i.rangeFields):this._joinContingencies(r,t);if(null==n)break;const[s]=this._hashContingency(n,a.codedValueFields,!0);e.has(s)?e.get(s)?.push(n):e.set(s,[n])}}r=e,s=n,i=a,o=new Set([...o,...s.fields])}const a=[];for(const l of s.contingencies){const[e,t]=this._hashContingency(l,i.codedValueFields),n=t?this._findMatchingContingenciesWithAnyHashMask(r,e):r.get(e);if(r.has(P)&&n.push(...this._findMatchingContingenciesContainingAny(l,r.get(P),i.codedValueFields)),null!=n)for(const s of n){const e=i.rangeFields.length>0?this._joinContingenciesWithRangeDomains(s,l,i.rangeFields):this._joinContingencies(s,l);null!=e&&a.push(e)}}return a}_joinContingencies(e,t){const n={values:{...e.values,...t.values}};for(const[s,i]of Object.entries(n.values))"any"===i.objectType&&null!=e.values[s]&&(n.values[s]=e.values[s]);return n}_joinContingenciesWithRangeDomains(e,t,n){const s=this._joinContingencies(e,t);for(const i of n){const n=e.values[i],o=t.values[i],{leftIsNull:r,rightIsNull:a,bothAreNull:l,leftIsAny:u,rightIsAny:p,bothAreAny:d,leftIsRange:c,rightIsRange:f}=this._compareObjectTypes(n.objectType,o.objectType);if(l||d)continue;if(r&&p||a&&u){s.values[i]=new h({objectType:"null"});continue}if(r&&f||a&&c)return null;u?(n.minValue=-1/0,n.maxValue=1/0):p&&(o.minValue=-1/0,o.maxValue=1/0);const m=Math.max(n.minValue,o.minValue),g=Math.min(n.maxValue,o.maxValue);if(m>g)return null;s.values[i]=new h({objectType:"range",minValue:m,maxValue:g})}return s}_findMatchingContingenciesContainingAny(e,t,n){return t.filter((t=>n.every((n=>{const s=t.values[n],i=e.values[n];return"any"===s.objectType||"any"===i.objectType||s.codedValue?.code===i.codedValue?.code}))))}_findMatchingContingenciesWithAnyHashMask(e,t){const n=RegExp(`${t}$`),s=[];for(const[i,o]of e){if(i===P)break;n.test(i)&&s.push(...o)}return s}_generateJoinKey(e,t){const n=Array.isArray(e)?new Set(e):e,s=Array.isArray(t)?new Set(t):t,i=n.size<s.size?n:s,o=i===n?s:n,r=new Set,a=new Set;for(const l of i)if(o.has(l)){const e=this.layer?.getFieldDomain(l,{feature:this.feature});if(null==e)continue;switch(e.type){case"coded-value":r.add(l);break;case"range":a.add(l)}}return{codedValueFields:[...r],rangeFields:[...a]}}_contingencyIsValid(e,t){const n={};for(const{name:s,value:i}of this.allFieldInputs)this.fieldsWithContingentValues.has(s)&&null!=i&&s!==e&&(n[s]=i);return Object.entries(n).every((([e,n])=>!t.values.hasOwnProperty(e)||T(n,t.values[e])))}_getContingentValueOptionsForField(e,t){const n=this.joinedContingentValues.slice(),s=new Map,i={code:"",name:t??"No value"};for(const o of n){const t=o.values[e];if("code"===t?.objectType||"null"===t?.objectType){const{code:n,name:r}=t.codedValue&&"null"!==t.objectType?t.codedValue:i;!s.has(n)&&this._contingencyIsValid(e,o)&&s.set(n,{name:r,value:n})}}return[...s.values()]}_hashContingency(e,t,n=!1){if(t.length<1)return[U,!1];const s=[];let i=!1;for(const o of t){const t=e.values[o];if("any"===t.objectType){if(n)return[P,!0];i=!0,s.push(`${o}:.*`)}else"null"===t.objectType?s.push(`${o}:${W}`):s.push(`${o}:${t.codedValue?.code}`)}return[s.sort().join("&"),i]}_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}}};function z(e){return"field"===e.type||"group"===e.type||"relationship"===e.type||(i.getLogger(G).warn("form-info::unsupported-element-type","Only element types 'field', 'group' and 'relationship' are supported",`Element ${e.label} has unsupported type '${e.type}'`),!1)}e([u()],$.prototype,"_expressionInfosLookup",null),e([u()],$.prototype,"_featureClone",void 0),e([u()],$.prototype,"_timeZone",void 0),e([u()],$.prototype,"activeRelationshipInput",null),e([u()],$.prototype,"_arcadeContextInfo",null),e([u()],$.prototype,"allFieldInputs",null),e([u()],$.prototype,"allGroupInputs",null),e([u()],$.prototype,"allRelationshipInputs",null),e([u()],$.prototype,"_layerFieldsByName",null),e([u()],$.prototype,"arcadeEditType",void 0),e([u()],$.prototype,"contingencyConstraintViolations",void 0),e([u()],$.prototype,"disabled",void 0),e([u()],$.prototype,"feature",null),e([u()],$.prototype,"fieldsWithContingentValues",null),e([u()],$.prototype,"fieldsWithInvalidCodedValue",null),e([u({type:c})],$.prototype,"formTemplate",null),e([u()],$.prototype,"formDescription",null),e([u()],$.prototype,"formTitle",null),e([u()],$.prototype,"formHeaderVisible",null),e([u()],$.prototype,"highlightHelper",void 0),e([u()],$.prototype,"inputs",void 0),e([u()],$.prototype,"inputFields",null),e([u()],$.prototype,"joinedContingentValues",null),e([u()],$.prototype,"layer",null),e([u()],$.prototype,"map",void 0),e([u()],$.prototype,"relatedRecordCallbacks",void 0),e([u()],$.prototype,"relationshipId",null),e([u()],$.prototype,"spatialReference",null),e([u()],$.prototype,"state",null),e([u()],$.prototype,"strict",void 0),e([u()],$.prototype,"submittable",null),e([u()],$.prototype,"timeZone",null),e([u()],$.prototype,"updating",null),e([u()],$.prototype,"valid",null),e([u()],$.prototype,"view",null),e([u()],$.prototype,"getValues",null),e([u()],$.prototype,"submit",null),$=e([p(G)],$);const D=$;export{D as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";let r=class extends t{constructor(e){super(e),this.element=null,this.feature=null,this.layer=null,this.timeZone=null,this.type=null,this.visibilityExpressionExecutor=null}get description(){return this.element?.description}get evaluatedVisibilityExpression(){const{visibilityExpressionExecutor:e}=this;return null!=e?!!e.lastEvaluatedValue:null}get label(){return this.element?.label}get visible(){return null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element}};e([s({readOnly:!0})],r.prototype,"description",null),e([s({constructOnly:!0})],r.prototype,"element",void 0),e([s()],r.prototype,"evaluatedVisibilityExpression",null),e([s()],r.prototype,"feature",void 0),e([s()],r.prototype,"label",null),e([s()],r.prototype,"layer",void 0),e([s()],r.prototype,"timeZone",void 0),e([s()],r.prototype,"type",void 0),e([s()],r.prototype,"visible",null),e([s()],r.prototype,"visibilityExpressionExecutor",void 0),r=e([o("esri.widgets.FeatureForm.InputBase")],r);const i=r;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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import{watch as t,initial as r}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as l}from"../../layers/support/layerUtils.js";import o from"../Feature/FeatureRelationship/FeatureRelationshipViewModel.js";import{isRelatableFeatureSupportedLayer as a}from"../Feature/support/featureUtils.js";import n from"./EditableInput.js";const p=3;let d=class extends n{constructor(e){super(e),this._relationshipVM=null,this.group=null,this.type="relationship",this.addHandles([t((()=>({feature:this.feature,element:this.element,layer:this.layer})),(e=>this._createRelationshipVM(e)),r)])}destroy(){this._relationshipVM?.destroy()}get canAddRelatedFeature(){const{editable:e,featureCount:t,relationship:r}=this;if(!r||!this.loaded||!this.relatedLayerAllowsAdds)return!1;const{cardinality:s,role:i}=r;return!("one-to-one"===s&&t>0)&&("many-to-many"!==s&&(!("one-to-many"===s&&"destination"===i&&t>0)&&e))}get displayCount(){return this.element.displayCount??p}get displayType(){return this.element.displayType}get editable(){return!!this.relatedLayerAllowsEdits&&(this.evaluatedEditableExpression??!0)}get featureCount(){return this._relationshipVM?.featureCount??0}get loaded(){return"
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import{watch as t,initial as r}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{getEffectiveLayerCapabilities as l}from"../../layers/support/layerUtils.js";import o from"../Feature/FeatureRelationship/FeatureRelationshipViewModel.js";import{isRelatableFeatureSupportedLayer as a}from"../Feature/support/featureUtils.js";import n from"./EditableInput.js";const p=3;let d=class extends n{constructor(e){super(e),this._relationshipVM=null,this.group=null,this.type="relationship",this.addHandles([t((()=>({feature:this.feature,element:this.element,layer:this.layer})),(e=>this._createRelationshipVM(e)),r)])}destroy(){this._relationshipVM?.destroy()}get canAddRelatedFeature(){const{editable:e,featureCount:t,relationship:r}=this;if(!r||!this.loaded||!this.relatedLayerAllowsAdds)return!1;const{cardinality:s,role:i}=r;return!("one-to-one"===s&&t>0)&&("many-to-many"!==s&&(!("one-to-many"===s&&"destination"===i&&t>0)&&e))}get displayCount(){return this.element.displayCount??p}get displayType(){return this.element.displayType}get editable(){return!!this.relatedLayerAllowsEdits&&(this.evaluatedEditableExpression??!0)}get featureCount(){return this._relationshipVM?.featureCount??0}get loaded(){return"loading"!==this._relationshipVM?.state}get map(){return this._get("map")}set map(e){e&&this._relationshipVM?.set("map",e),this._set("map",e)}get orderByFields(){return this.element.orderByFields}get originHasValidKey(){return!(!this.relationship||!this.feature.getAttribute(this.relationship.keyField))}get relationship(){return this._relationshipVM?.relationship}get relationshipId(){return this.element.relationshipId}get relatedFeatureInfos(){return this._relationshipVM?.relatedFeatureInfos??[]}get relatedLayer(){return this._relationshipVM?.relatedLayer}get relatedLayerIsTable(){return!!this.relatedLayer?.isTable}get relatedLayerAllowsAdds(){const{relatedLayer:e}=this;if(!e||!this.relatedLayerAllowsEdits)return!1;const t=l(e);return!!t?.operations?.supportsAdd}get relatedLayerAllowsEdits(){const{relatedLayer:e}=this;if(!e)return!1;const t=l(e);return!!t?.operations?.supportsEditing}get showAllEnabled(){return this._get("showAllEnabled")}set showAllEnabled(e){this._relationshipVM?.set("showAllEnabled",e),this._set("showAllEnabled",e)}get showAllActionVisible(){return!this.showAllEnabled&&this.featureCount>0&&this.featureCount>this.displayCount}get visible(){const{relationship:e}=this;if(!e)return!1;const{cardinality:t}=e;return"many-to-many"!==t&&(null!=this.evaluatedVisibilityExpression?this.evaluatedVisibilityExpression:null!=this.element)}get updating(){return"loading"===this._relationshipVM?.state||"querying"===this._relationshipVM?.state}incrementPage(){this._relationshipVM&&this._relationshipVM.featurePage++}getRelatedFeatureByObjectId(e){return this._relationshipVM?.getRelatedFeatureByObjectId(e)}_createRelationshipVM(e){const{feature:t,element:r,layer:s}=e;if(this._relationshipVM?.destroy(),!t||!r||!s)return;const{displayCount:i,map:l,orderByFields:n,relationshipId:p,showAllEnabled:d}=this;a(s)&&(this._relationshipVM=new o({graphic:t,displayCount:i,layer:s,map:l,orderByFields:n,relationshipId:p,showAllEnabled:d}))}};e([s()],d.prototype,"_relationshipVM",void 0),e([s()],d.prototype,"canAddRelatedFeature",null),e([s()],d.prototype,"displayCount",null),e([s()],d.prototype,"displayType",null),e([s()],d.prototype,"editable",null),e([s()],d.prototype,"featureCount",null),e([s()],d.prototype,"group",void 0),e([s()],d.prototype,"loaded",null),e([s()],d.prototype,"map",null),e([s()],d.prototype,"orderByFields",null),e([s()],d.prototype,"originHasValidKey",null),e([s()],d.prototype,"relationship",null),e([s()],d.prototype,"relationshipId",null),e([s()],d.prototype,"relatedFeatureInfos",null),e([s()],d.prototype,"relatedLayer",null),e([s()],d.prototype,"relatedLayerIsTable",null),e([s()],d.prototype,"relatedLayerAllowsAdds",null),e([s()],d.prototype,"relatedLayerAllowsEdits",null),e([s()],d.prototype,"showAllEnabled",null),e([s()],d.prototype,"showAllActionVisible",null),e([s({readOnly:!0})],d.prototype,"type",void 0),e([s()],d.prototype,"visible",null),e([s()],d.prototype,"updating",null),d=e([i("esri.widgets.FeatureForm.RelationshipInput")],d);const u=d;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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e="esri-feature-form",t=`${e}__group`,r=`${e}__input`,
|
|
5
|
+
const e="esri-feature-form",t=`${e}__group`,r=`${e}__input`,a=`${e}__related-records`,i={base:e,form:`${e}__form`,formHeader:`${e}__form-header`,label:`${e}__label`,labelTextContent:`${e}__label-text-content`,fieldInput:`${r}`,fieldInputWrapper:`${r}-wrapper`,fieldInputLoader:`${r}-loader`,inputRadio:`${r}--radio`,inputRadioGroup:`${r}--radio-group`,inputRadioLabel:`${r}--radio-label`,inputDisabled:`${r}--disabled`,inputSwitch:`${r}--switch`,inputInvalid:`${r}--invalid`,centeredButton:`${e}__centered-button`,description:`${e}__description-text`,listObserver:`${e}__list-observer`,relatedRecordsHeader:`${a}_header`,relatedRecordsLabel:`${a}_label`,relatedRecordsList:`${a}_list`,dateInputContainer:`${`${e}__date`}-input-container`,group:t,groupSequential:`${t}--sequential`,groupActive:`${t}--active`};export{i as css};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../intl.js";import{isSome as e}from"../../core/arrayUtils.js";import{neverReached as t}from"../../core/compilerUtils.js";import{templateHasKey as
|
|
5
|
+
import"../../intl.js";import{isSome as e}from"../../core/arrayUtils.js";import{neverReached as t}from"../../core/compilerUtils.js";import{templateHasKey as n,replace as r}from"../../core/string.js";import{DomainValidationError as o}from"../../layers/support/domainUtils.js";import{isDateField as i,NumericRangeValidationError as a,TypeValidationError as l}from"../../layers/support/fieldUtils.js";import{getLabelForDateFieldValue as s}from"../support/dateUtils.js";import{substitute as u}from"../../intl/substitute.js";const m=e=>"field"===e?.type,p=e=>"group"===e?.type,d=e=>"relationship"===e?.type,c=e=>!p(e)&&null!=e.group,f=e=>"field"===e.type,y=e=>"group"===e.type,b=e=>"relationship"===e.type,T=e=>e.reduce(((e,t)=>p(t)?[...e,...t.inputs]:[...e,t]),[]),E=e=>T(e).filter(m),v=e=>T(e).filter(d),O=e=>null!=e&&(g(e,"combo-box")||g(e,"radio-buttons")),g=(e,t)=>null!=e&&e.input?.type===t,x=e=>null!=e&&(g(e,"text-box")||g(e,"text-area")),j=({domain:e,inputType:t="text-box",dataType:n})=>"number"===n&&"text-box"===t&&(!e||"coded-value"!==e.type),V=e=>"items"in e,h={typeFieldName:null,types:[]};function U(t){const{attributes:r,fieldsIndex:o,label:i,timeZone:a}=t,l=Object.keys(r).filter((e=>n(i,e))),s=l.map((e=>r[e])),u=l.map((e=>o.get(e))).filter(e);return _(i,N({values:s,fields:u,timeZone:a}))}function N(e){const{fields:t,values:n,timeZone:r}=e,o=t.map(((e,t)=>{let o=n[t];if(e.domain&&"coded-value"===e.domain.type){const t=e.domain.codedValues.find((e=>e.code===o));t?.name&&(o=t.name)}return i(e)&&(o=s(e,o,{timeZone:"date"===e.type?r:void 0})),[e.name,o]}));return Object.fromEntries(o)}function _(e,t){return r(r(e,(e=>`{${e.toLowerCase()}}`)),Object.fromEntries(Object.entries(t).map((([e,t])=>[e.toLowerCase(),t]))))}const A=e=>e?"subtype-sublayer"===e.type?{typeFieldName:e.parent?.subtypeField,types:e.parent?.subtypes??[]}:"types"in e&&e.types?{typeFieldName:e.typeIdField,types:e.types.map((({id:e,name:t,domains:n})=>({code:e,name:t,domains:n})))}:h:h,I=(e,t)=>{if(!e)return!0;const{operations:n}=e;switch(t){case"INSERT":return n.supportsAdd;case"UPDATE":case"DELETE":return n.supportsUpdate;default:return!0}};var L;!function(e){e.TOO_SHORT="length-validation-error::too-short"}(L||(L={}));const F={type:"number"},D={type:"number",intlOptions:{notation:"scientific"}},R={day:"2-digit",month:"2-digit",year:"numeric",hour:"numeric",minute:"numeric",second:"numeric"};function Z(e){return e>=1e7||e<=-1e7}const w=(e,t,n)=>{const{dataType:r,error:i,minLength:s,value:m,required:p}=e;if(!t||!i)return null;if(p&&null===m)return t.validationErrors.cannotBeNull;if(i===o.VALUE_OUT_OF_RANGE||i===a.OUT_OF_RANGE){const o=e.range,i={type:"date",intlOptions:{...R,timeZone:n??void 0}};return u(t.validationErrors.outsideRange,o,{format:{max:"date"===r?i:Z(o.max)?D:F,min:"date"===r?i:Z(o.min)?D:F}})}return i===o.INVALID_CODED_VALUE?t.validationErrors.invalidCodedValue:i===l.INVALID_TYPE?t.validationErrors.invalidType:i===L.TOO_SHORT?u(t.validationErrors.tooShort,{min:s}):null},C=e=>{if(!e)return;const t=e.layer,n=t&&"geometryType"in t?t.geometryType:void 0,r=e.geometry?.type;return"polyline"===r||"polyline"===n?"line":r||n||"table"},S=e=>{const t=[];if(e.formTemplate){const{description:r,title:o}=e.formTemplate;e.fields?.forEach((e=>{const i=o&&n(o,e.name),a=r&&n(r,e.name);(i||a)&&t.push(e.name)}))}return t};function G(e){if("formTemplate"in e&&e.formTemplate){return(e.formTemplate.elements?.filter(f)??[]).some((({fieldName:t})=>!e.fieldsIndex.get(t)))}return!1}function H(e,t){return null==e||t.onValue!==e&&t.offValue!==e}function P(e,n){switch(n.objectType){case"any":return!0;case"null":return null==e;case"code":return e===n.codedValue?.code;case"range":return null!=e&&null!=n.minValue&&null!=n.maxValue&&+e>=n.minValue&&+e<=n.maxValue;default:return t(n.objectType),!1}}export{L as LengthValidationError,I as capabilitiesAllowEditType,E as flattenFieldInputs,T as flattenInputs,v as flattenRelationshipInputs,G as formTemplateHasInvalidFields,N as getComputedAttributes,w as getErrorMessageForFieldInput,S as getFieldsInTitleAndDesc,C as getIconForFeature,A as getNormalizedFeatureTypeInfo,f as isFieldElement,g as isFieldElementWithInputType,O as isFieldElementWithShowNoValueOptionInput,x as isFieldElementWithTextInput,m as isFieldInput,y as isGroupElement,p as isGroupInput,c as isInputInGroupInput,j as isNumberFieldInput,b as isRelationshipElement,d as isRelationshipInput,V as isTemplateItemGroup,U as parseFormTemplateString,_ as substituteFieldTemplatesInString,H as valueIsInvalidSwitchValue,P as valueIsValidContingentValue};
|
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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{deprecatedProperty as i}from"../core/deprecate.js";import o from"../core/Logger.js";import{watch as n,whenOnce as a}from"../core/reactiveUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/has.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as l}from"../layers/support/fieldUtils.js";import d from"./Widget.js";import{css as p}from"./FeatureForm/css.js";import{isGroupInput as c,isFieldInput as u,isRelationshipInput as m,isInputInGroupInput as h,isFieldElementWithInputType as v,getErrorMessageForFieldInput as _,getIconForFeature as g,isNumberFieldInput as b}from"./FeatureForm/featureFormUtils.js";import f from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as C}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as y,numberingSystem as F,prepareISOFieldValueForDateComponents as R,prepareUnixFieldValueForDateComponents as w,getISOFieldValueFromDateComponents as O,getUnixFieldValueFromDateComponents as k}from"./support/dateUtils.js";import{globalCss as I}from"./support/globalCss.js";import{Heading as M,incrementHeadingLevel as D}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as V}from"./support/decorators/messageBundle.js";import{vmEvent as x}from"./support/decorators/vmEvent.js";import{tsx as N}from"./support/jsxFactory.js";import{substitute as L}from"../intl/substitute.js";const T="data-field-name",j="esri.widgets.FeatureForm",S=o.getLogger(j);let E=class extends d{constructor(e,t){super(e,t),this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new f,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,relatedRecordCallbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,relatedRecordCallbacks:o}=this;i&&o?.addRelatedRecord&&o.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n((()=>this.feature),(()=>{a((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._inputsWithChanges.clear(),this._dateComponentMap.clear(),this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),n((()=>this.groupDisplay),(()=>this._syncGroupInputStates())),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),n((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange()))])}loadDependencies(){return C({block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button.js"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const e=this.relatedRecordCallbacks;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get relatedRecordCallbacks(){return this.viewModel.relatedRecordCallbacks}set relatedRecordCallbacks(e){this.viewModel.relatedRecordCallbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return i(S,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view}set view(e){i(S,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return N("div",{class:this.classes(p.base,I.widget,I.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return N("form",{class:p.form,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderHeader(),this._renderContent())}_renderHeader(){const e=this.viewModel;if(!e.formHeaderVisible)return;const t=null!=e.formTitle&&N(M,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&N("p",{class:p.description,key:"description"},e.formDescription);return N("div",{class:p.formHeader},t,i)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderActiveRelationshipInput(e.activeRelationshipInput):e.inputs.filter(t).filter((e=>e.visible)).map(((e,t)=>c(e)?this._renderGroup(e,t):u(e)?this._renderLabeledField(e):m(e)?this._renderRelationshipInput(e):void 0))}_renderActiveRelationshipInput(e){return this._renderRelationshipInput(e)}_renderDescriptionOrEmpty(e,t){return null==e?null:N("div",{class:this.classes(p.description),id:t},e)}_renderGroup(e,t){const{disabled:i,formTemplate:o,headingLevel:n}=this,{description:a,inputs:s,label:r,open:l}=e,d=s.filter((e=>e.visible)),c=this.viewModel.findField(this._focusedFieldName),h=c?.group===e,v=`${this.id}_group_${t}`,_="sequential"===this.groupDisplay;return N("calcite-block",{class:this.classes(p.group,_?p.groupSequential:null,h?p.groupActive:null,i?p.inputDisabled:null),collapsible:!0,"data-group":e,description:a||void 0,disabled:i,heading:`${r}`,headingLevel:o?.title?D(n):n,id:v,key:v,open:l,onCalciteBlockToggle:({target:t})=>this._onGroupToggle(t,e)},d.map((e=>u(e)?this._renderLabeledField(e):m(e)?this._renderRelationshipInput(e):void 0)))}_getFocusableInput(e,t){const i=this.viewModel.allFieldInputs,o="forward"===e?i:i.slice().reverse();let n;if(!t||m(t))n=0;else if(c(t)){const e=t.inputs.find(u);n=e?o.indexOf(e):0}else{let i;if(h(t)&&!t.group.open){const o=t.group.inputs.filter(u);i="forward"===e?o[o.length-1]:o[0]}else i=t;n=o.indexOf(i)+1}for(let a=n;a<o.length;a++){const e=o[a];if(e.visible&&u(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:o,layer:n,required:a}=e,s={"aria-label":a?L(this.messages.requiredFieldLabel,{name:o}):o,class:p.label,key:`${n.id}-${i.uid}-${e.name}`},r=[N("div",{class:p.labelTextContent,key:"labelTextContainer"},o,a?N("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===t&&"coded-value"!==e.domain?.type?N("label",{...s},r):N("calcite-label",{...s},r)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:n,updating:a}=e,s=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(n,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),s):this._renderComboBoxComponent(e,t,s):this._renderSwitchComponent(e,s)}if("datetime-picker"===o||"date"===t)return this._renderDateComponents(e,s);const r="number"===t?this._renderNumberComponent(e,s):this._renderStringComponent(e,s);return a?N("div",{class:p.fieldInputWrapper,key:`${s.key}-input-updating-wrapper`},r,N("div",{class:p.fieldInputLoader},N("calcite-progress",{type:"indeterminate"}))):r}_renderStringComponent(e,t){return N("calcite-input",{...t,type:"text-area"===e.inputType?"textarea":"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)})}_renderNumberComponent(e,t){return N("calcite-input-number",{...t,integer:l(e.field),type:"number",onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.target)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldCompnents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,y(e.field,t.value,{timeZone:this.timeZone}))}}_renderDateOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:n,max:a,min:s,key:r,readOnly:l}=t;return N("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:n,"data-date-part":"date","data-field-name":t[T],key:`${r}-date-input`,max:null!=a?`${a}`:void 0,min:null!=s?`${s}`:void 0,numberingSystem:F,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:l,value:null!=o?`${o}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:n,key:a,readOnly:s}=t;return N("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:n,"data-date-part":"time","data-field-name":t[T],key:`${a}-time-input`,numberingSystem:F,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,valid:o,value:n}=e,{class:a,key:s,readOnly:r}=t,l=null!=n?`${n}`:void 0,{dateAsString:d,time:c,timeZoneOffset:u}=R(l),m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,numberingSystem:F,overlayPositioning:"fixed",readOnly:r,[T]:i,onfocus:this._onComponentFocus};return N("div",{class:p.dateInputContainer,key:`${s}-date-time-container`},N("calcite-input-date-picker",{...m,class:a,"data-date-part":"date",key:`${s}-date-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:d??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),N("calcite-input-time-picker",{...m,class:a,"data-date-part":"time",key:`${s}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:c??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}),e.includeTimeOffset?N("calcite-input-time-zone",{...m,class:a,"data-date-part":"timeZone",key:`${s}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:u??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderDateFieldCompnents(e,t){const{includeTime:i,name:o,valid:n,value:a}=e,{class:s,max:r,min:l,key:d,readOnly:c}=t,{timeZone:u}=this,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:F,overlayPositioning:"fixed",readOnly:c,[T]:o,onfocus:this._onComponentFocus},{dateAsString:h,time:v}=w(a,u),_=null!=r?w(r,u):void 0,g=null!=l?w(l,u):void 0;return N("div",{class:p.dateInputContainer,key:`${d}-date-time-container`},N("calcite-input-date-picker",{...m,class:s,"data-date-part":"date",key:`${d}-date-input`,max:_?.dateAsString??void 0,min:g?.dateAsString??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:h??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),i?N("calcite-input-time-picker",{...m,class:s,"data-date-part":"time",key:`${d}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:v??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return N("calcite-input",{...i,class:this.classes(p.fieldInput,p.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:n}=e,{messages:a,messagesTemplates:s,viewModel:r,_inputsWithChanges:l}=this,d=t.map((e=>e.map((({name:e,value:t})=>N("calcite-combobox-item",{key:`#${t}`,selected:o===t,textLabel:e,value:`${t}`}))))),[p,c]=d;this.viewModel.fieldsWithInvalidCodedValue.has(e)&&c.unshift(N("calcite-combobox-item",{key:"incompatible-option",readOnly:!0,textLabel:`${e.value}`,value:`${e.value}`}));const u=c.length>0?[N("calcite-combobox-item-group",{key:"recommended",label:a.recommended},p),N("calcite-combobox-item-group",{key:"other",label:s.other},c)]:p,m="INSERT"===r.arcadeEditType,h=l.has(n),v=null==o&&(!m||h);if(e.showNoValueOptionEnabled){const t="",i=e.showNoValueLabel||a.empty;u.unshift(N("calcite-combobox-item",{key:"empty-option",selected:v,textLabel:a.empty,value:t},i))}const _=m&&e.showNoValueOptionEnabled&&!h?()=>{}:i.onblur;return N("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,disabled:i.readOnly,onblur:_,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({target:e})=>{v&&0===e.selectedItems.length?this._ignoreDeselectionOfNoValueOption(e):this._saveValueFromComponent(e)}},u)}_renderRadioButtonComponents(e,t,i){const{name:o,value:n}=e,a=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===n,props:i})));if(e.showNoValueOptionEnabled){const t="",s=e.showNoValueLabel||this.messages.empty,r=n===t||null===n;a.unshift(this._renderRadioButtonComponent({key:"empty-option",label:s,name:o,value:t,selected:r,props:i}))}return N("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:p.inputRadioGroup,"data-field-name":i[T],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},a)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!v(e.element,"switch")&&i===e.element.input.onValue;return N("calcite-switch",{...t,checked:o,class:p.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.target)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:n,props:a}){return N("calcite-label",{class:p.inputRadioLabel,key:e,layout:"inline"},N("calcite-radio-button",{...a,afterCreate:void 0,afterUpdate:void 0,checked:o,class:p.inputRadio,disabled:a.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({target:e})=>{e.checked&&this._saveValueFromComponent(e)}}),n)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.valid?_(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?N("calcite-input-message",{icon:!0,status:"invalid"},i):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:o}=e,{relatedRecordCallbacks:n}=this;if(!o||!n?.showAllRelatedRecords)return;const a=this.messages;return N("calcite-list-item",{description:L(a.totalCount,{count:t}),label:a.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},N("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o}=e,{messages:n,relatedRecordCallbacks:a}=this;if(t&&a?.addRelatedRecord&&o)return N("calcite-button",{alignment:"center",appearance:"outline-fill",class:p.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>this._onAddRelatedRecordsClick(i,o),round:!0,scale:"s",width:"half"},e.relatedLayerIsTable?n.addRecord:n.addFeature)}_renderRelatedRecordListItem(e,t){const{feature:i,description:o,title:n}=e,{feature:a,relatedRecordCallbacks:s}=this,{highlightHelper:r}=this.viewModel,l=()=>{r?.removeAll(),s?.editRelatedRecord&&a&&s.editRelatedRecord({parentFeature:a,relationshipId:t,relatedFeature:i})},d=r?()=>r.add(i):void 0,p=r?()=>r.remove(i):void 0;return N("calcite-list-item",{bind:this,description:o,key:`${t}-${i.uid}`,label:n,onclick:l,onmouseenter:d,onmouseleave:p,value:n},N("calcite-icon",{icon:g(i),scale:"m",slot:"content-start"}),N("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:o}=e,n=o?null:this._renderDescriptionOrEmpty(e.description),a=t>0?this._renderRelatedRecordsList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0;return N("calcite-label",{class:this.classes(p.label,p.relationshipLabel),key:`relationship-${i}-container`},N("div",null,this._renderRelatedRecordsHeaderContainer(e),n,a),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return N("div",{class:p.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},N("span",null,e.label),t?N("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return N("calcite-list",{class:p.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:t}=this,i=e.relatedLayerIsTable?t.noOriginKeyRecord:t.noOriginKeyFeature,o=e.relationship?.keyField,n=this.viewModel.findField(o),a=n?.label,s=L(i,{relatedLayerName:e.relatedLayer?.title,originKeyField:a});return N("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},N("div",{slot:"message"},s))}_renderNoRelatedRecordsNotice(){return N("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},N("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return N("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:p.listObserver,key:"feature-observer"})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:n,maxLength:a,minLength:s,name:r,range:{max:l,min:d},required:c,valid:u,value:m}=e,h=this._inputsWithChanges.has(r),v=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":u?"false":"true",class:this.classes(p.fieldInput,v?p.inputDisabled:null,h&&!u?p.inputInvalid:null),key:r,label:n,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:a>-1?a:void 0,minLength:s>-1?s:void 0,placeholder:o??void 0,readOnly:v,required:c,value:null==m?"":`${m}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[T]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(T))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value){const t=e.value,i=new ResizeObserver((()=>{e.value=void 0,e.value=t,i.unobserve(e)}));i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);b(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,h(i)&&(i.group.open=!0),e.setFocus())}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null,this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const t=this._getFieldInputFromHTMLElement(e),i=t.field.type,{name:o}=t,n=this._dateComponentMap.get(o);if(!n)return;const a=this.viewModel.getValue(o);let s=null;s="date-only"===i||"time-only"===i?e.value:"timestamp-offset"===i?null!=e.value?O({dateComponent:n.date,timeComponent:n.time,timeZoneComponent:n.timeZone,oldValue:a}):null:null!=e.value?k({oldValue:a,dateComponent:n.date,timeComponent:n.time,timeZone:this.timeZone,max:t.range?.max,min:t.range?.min}):null,null!==s&&e.value?a!==s&&this._updateFieldValue(o,s):this._updateFieldValue(o,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e);this._updateFieldValue(t.name,this._parseValue(e))}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&h(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){if(this.viewModel.setValue(e,t),this._inputsWithChanges.add(e),this.viewModel.fieldsWithContingentValues.has(e)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return v(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:i}=e;0===i.length&&t&&"selected"in t?t.selected=!0:S.warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.open?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach((e=>{e!==t&&(e.open=!1)}))):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter((e=>e.open));0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach((e=>e.open=!1))}};e([s()],E.prototype,"_listObserverNode",void 0),e([s()],E.prototype,"_relatedRecordsEnabled",null),e([s()],E.prototype,"disabled",null),e([s()],E.prototype,"feature",null),e([s()],E.prototype,"formTemplate",null),e([s()],E.prototype,"groupDisplay",void 0),e([s()],E.prototype,"headingLevel",void 0),e([s()],E.prototype,"label",null),e([s()],E.prototype,"layer",null),e([s()],E.prototype,"map",null),e([s(),V("esri/widgets/FeatureForm/t9n/FeatureForm")],E.prototype,"messages",void 0),e([s(),V("esri/t9n/common")],E.prototype,"messagesCommon",void 0),e([s(),V("esri/widgets/Feature/t9n/Feature")],E.prototype,"messagesFeature",void 0),e([s(),V("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],E.prototype,"messagesTemplates",void 0),e([s()],E.prototype,"relatedRecordCallbacks",null),e([s()],E.prototype,"relationshipId",null),e([s()],E.prototype,"spatialReference",null),e([s()],E.prototype,"strict",null),e([s()],E.prototype,"timeZone",null),e([s()],E.prototype,"view",null),e([s(),x(["value-change","submit"])],E.prototype,"viewModel",void 0),E=e([r(j)],E);const U=E;export{U as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{isSome as t}from"../core/arrayUtils.js";import{deprecatedProperty as i}from"../core/deprecate.js";import o from"../core/Logger.js";import{watch as n,whenOnce as a}from"../core/reactiveUtils.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import"../core/accessorSupport/ensureType.js";import"../core/has.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import{isIntegerField as l}from"../layers/support/fieldUtils.js";import d from"./Widget.js";import{css as p}from"./FeatureForm/css.js";import{isGroupInput as c,isFieldInput as u,isRelationshipInput as m,isInputInGroupInput as h,isFieldElementWithInputType as v,getErrorMessageForFieldInput as _,getIconForFeature as g,isNumberFieldInput as b}from"./FeatureForm/featureFormUtils.js";import f from"./FeatureForm/FeatureFormViewModel.js";import{loadCalciteComponents as C}from"./support/componentsUtils.js";import{getLabelForDateFieldValue as y,numberingSystem as F,prepareISOFieldValueForDateComponents as R,prepareUnixFieldValueForDateComponents as w,getISOFieldValueFromDateComponents as O,getUnixFieldValueFromDateComponents as k}from"./support/dateUtils.js";import{globalCss as I}from"./support/globalCss.js";import{Heading as M,incrementHeadingLevel as D}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as V}from"./support/decorators/messageBundle.js";import{vmEvent as x}from"./support/decorators/vmEvent.js";import{tsx as N}from"./support/jsxFactory.js";import{substitute as L}from"../intl/substitute.js";const T="data-field-name",j="esri.widgets.FeatureForm",S=o.getLogger(j);let E=class extends d{constructor(e,t){super(e,t),this._attemptFocusOnNextRender=!1,this._dateComponentMap=new Map,this._inputsWithChanges=new Set,this._focusedFieldName=null,this._listObserverNode=null,this._listObserver=new IntersectionObserver((e=>{e.length&&e[0].isIntersecting&&this._incrementRelatedRecordPage()}),{root:window.document}),this.groupDisplay="all",this.headingLevel=2,this.messages=null,this.messagesCommon=null,this.messagesFeature=null,this.messagesTemplates=null,this.viewModel=new f,this._onShowAllRelatedRecordsClick=e=>{const{feature:t,relatedRecordCallbacks:i}=this;t&&i?.showAllRelatedRecords&&i.showAllRelatedRecords({parentFeature:t,relationshipId:e})},this._onAddRelatedRecordsClick=(e,t)=>{const{feature:i,relatedRecordCallbacks:o}=this;i&&o?.addRelatedRecord&&o.addRelatedRecord({parentFeature:i,relatedLayer:t,relationshipId:e})},this._onFormKeyDown=this._onFormKeyDown.bind(this),this._onFormSubmit=this._onFormSubmit.bind(this),this._onGroupToggle=this._onGroupToggle.bind(this),this._onComponentBlur=this._onComponentBlur.bind(this),this._onComponentFocus=this._onComponentFocus.bind(this),this._onComponentKeyDown=this._onComponentKeyDown.bind(this),this._afterComponentCreate=this._afterComponentCreate.bind(this),this._afterComponentCreateOrUpdate=this._afterComponentCreateOrUpdate.bind(this),this._afterDateComponentCreate=this._afterDateComponentCreate.bind(this),this._afterDateComponentCreateOrUpdate=this._afterDateComponentCreateOrUpdate.bind(this),this._afterRadioGroupCreateOrUpdate=this._afterRadioGroupCreateOrUpdate.bind(this)}initialize(){this.addHandles([n((()=>this.feature),(()=>{a((()=>!this.viewModel.updating)).then((()=>{const e=this._getFocusableInput("forward");this._inputsWithChanges.clear(),this._dateComponentMap.clear(),this._syncGroupInputStates(),this._focusedFieldName=e?.name||null,this._attemptFocusOnNextRender=!0}))})),n((()=>this.groupDisplay),(()=>this._syncGroupInputStates())),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._inputsWithChanges.add(e))),this._focusedFieldName=t,this._attemptFocusOnNextRender=!0,this.scheduleRender()}})),n((()=>[this.viewModel.activeRelationshipInput,this._listObserverNode]),(()=>this._onObserverChange()))])}loadDependencies(){return C({block:()=>import("@esri/calcite-components/dist/components/calcite-block.js"),button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox.js"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),"combobox-item-group":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker.js"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message.js"),"input-number":()=>import("@esri/calcite-components/dist/components/calcite-input-number.js"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker.js"),"input-time-zone":()=>import("@esri/calcite-components/dist/components/calcite-input-time-zone.js"),label:()=>import("@esri/calcite-components/dist/components/calcite-label.js"),list:()=>import("@esri/calcite-components/dist/components/calcite-list.js"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item.js"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader.js"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice.js"),progress:()=>import("@esri/calcite-components/dist/components/calcite-progress.js"),"radio-button":()=>import("@esri/calcite-components/dist/components/calcite-radio-button.js"),"radio-button-group":()=>import("@esri/calcite-components/dist/components/calcite-radio-button-group.js"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch.js")})}destroy(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode)}get _relatedRecordsEnabled(){const e=this.relatedRecordCallbacks;return!(!e||!(e.addRelatedRecord||e.editRelatedRecord||e.showAllRelatedRecords))}get disabled(){return this.viewModel.disabled}set disabled(e){this.viewModel.disabled=e}get feature(){return this.viewModel.feature}set feature(e){this.viewModel.feature=e}get formTemplate(){return this.viewModel.formTemplate}set formTemplate(e){this.viewModel.formTemplate=e}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get map(){return this.viewModel.map}set map(e){this.viewModel.map=e}get relatedRecordCallbacks(){return this.viewModel.relatedRecordCallbacks}set relatedRecordCallbacks(e){this.viewModel.relatedRecordCallbacks=e}get relationshipId(){return this.viewModel.relationshipId}set relationshipId(e){this.viewModel.relationshipId=e}get spatialReference(){return this.viewModel.spatialReference}set spatialReference(e){this.viewModel.spatialReference=e}get strict(){return this.viewModel.strict}set strict(e){this.viewModel.strict=e}get timeZone(){return this.viewModel.timeZone}set timeZone(e){this.viewModel.timeZone=e}get view(){return i(S,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view}set view(e){i(S,"view",{replacement:"Use FeatureForm.map instead.",version:"4.27"}),this.viewModel.view=e}getValues(){return this.viewModel.getValues()}submit(){return this.viewModel.submit()}render(){const{state:e}=this.viewModel;return N("div",{class:this.classes(p.base,I.widget,I.panel)},"ready"===e?this._renderForm():null)}_renderForm(){return N("form",{class:p.form,novalidate:!0,onkeydown:this._onFormKeyDown,onsubmit:this._onFormSubmit},this._renderHeader(),this._renderContent())}_renderHeader(){const e=this.viewModel;if(!e.formHeaderVisible)return;const t=null!=e.formTitle&&N(M,{key:"title",level:this.headingLevel},e.formTitle),i=null!=e.formDescription&&N("p",{class:p.description,key:"description"},e.formDescription);return N("div",{class:p.formHeader},t,i)}_renderContent(){const{viewModel:e}=this;return e.activeRelationshipInput?this._renderActiveRelationshipInput(e.activeRelationshipInput):e.inputs.filter(t).filter((e=>e.visible)).map(((e,t)=>c(e)?this._renderGroup(e,t):u(e)?this._renderLabeledField(e):m(e)?this._renderRelationshipInput(e):void 0))}_renderActiveRelationshipInput(e){return this._renderRelationshipInput(e)}_renderDescriptionOrEmpty(e,t){return null==e?null:N("div",{class:this.classes(p.description),id:t},e)}_renderGroup(e,t){const{disabled:i,formTemplate:o,headingLevel:n}=this,{description:a,inputs:s,label:r,open:l}=e,d=s.filter((e=>e.visible)),c=this.viewModel.findField(this._focusedFieldName),h=c?.group===e,v=`${this.id}_group_${t}`,_="sequential"===this.groupDisplay;return N("calcite-block",{class:this.classes(p.group,_?p.groupSequential:null,h?p.groupActive:null,i?p.inputDisabled:null),collapsible:!0,"data-group":e,description:a||void 0,disabled:i,heading:`${r}`,headingLevel:o?.title?D(n):n,id:v,key:v,open:l,onCalciteBlockToggle:({target:t})=>this._onGroupToggle(t,e)},d.map((e=>u(e)?this._renderLabeledField(e):m(e)?this._renderRelationshipInput(e):void 0)))}_getFocusableInput(e,t){const i=this.viewModel.allFieldInputs,o="forward"===e?i:i.slice().reverse();let n;if(!t||m(t))n=0;else if(c(t)){const e=t.inputs.find(u);n=e?o.indexOf(e):0}else{let i;if(h(t)&&!t.group.open){const o=t.group.inputs.filter(u);i="forward"===e?o[o.length-1]:o[0]}else i=t;n=o.indexOf(i)+1}for(let a=n;a<o.length;a++){const e=o[a];if(e.visible&&u(e))return e}return null}_renderLabeledField(e){const{dataType:t,feature:i,label:o,layer:n,required:a}=e,s={"aria-label":a?L(this.messages.requiredFieldLabel,{name:o}):o,class:p.label,key:`${n.id}-${i.uid}-${e.name}`},r=[N("div",{class:p.labelTextContent,key:"labelTextContainer"},o,a?N("span",{"aria-hidden":"true",title:this.messagesCommon.required},"*"):void 0),"unsupported"!==t?this._renderFieldInput(e):this._renderReadOnlyComponent(e),this._renderAuxiliaryText(e)];return"date"===t&&"coded-value"!==e.domain?.type?N("label",{...s},r):N("calcite-label",{...s},r)}_renderFieldInput(e){const{dataType:t,domain:i,inputType:o,name:n,updating:a}=e,s=this.getCommonInputProps(e);if("coded-value"===i?.type){const t=this.viewModel.getFieldValueOptionsForField(n,this.messages.empty);return"switch"!==o||e.hasInvalidSwitchValue?"radio-buttons"===o?this._renderRadioButtonComponents(e,t.flat(),s):this._renderComboBoxComponent(e,t,s):this._renderSwitchComponent(e,s)}if("datetime-picker"===o||"date"===t)return this._renderDateComponents(e,s);const r="number"===t?this._renderNumberComponent(e,s):this._renderStringComponent(e,s);return a?N("div",{class:p.fieldInputWrapper,key:`${s.key}-input-updating-wrapper`},r,N("div",{class:p.fieldInputLoader},N("calcite-progress",{type:"indeterminate"}))):r}_renderStringComponent(e,t){return N("calcite-input",{...t,type:"text-area"===e.inputType?"textarea":"text",onCalciteInputInput:e=>this._saveValueFromComponent(e.target)})}_renderNumberComponent(e,t){return N("calcite-input-number",{...t,integer:l(e.field),type:"number",onCalciteInputNumberInput:e=>this._saveValueFromComponent(e.target)})}_renderDateComponents(e,t){const{field:i}=e;switch(i.type){case"date":return this._renderDateFieldCompnents(e,t);case"date-only":return this._renderDateOnlyFieldComponent(e,t);case"time-only":return this._renderTimeOnlyFieldComponent(e,t);case"timestamp-offset":return this._renderTimestampOffsetFieldComponents(e,t);default:return this._renderReadOnlyComponent(e,y(e.field,t.value,{timeZone:this.timeZone}))}}_renderDateOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:n,max:a,min:s,key:r,readOnly:l}=t;return N("calcite-input-date-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:n,"data-date-part":"date","data-field-name":t[T],key:`${r}-date-input`,max:null!=a?`${a}`:void 0,min:null!=s?`${s}`:void 0,numberingSystem:F,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:l,value:null!=o?`${o}`:void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimeOnlyFieldComponent(e,t){const{valid:i,value:o}=e,{class:n,key:a,readOnly:s}=t;return N("calcite-input-time-picker",{afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!i,class:n,"data-date-part":"time","data-field-name":t[T],key:`${a}-time-input`,numberingSystem:F,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},onfocus:this._onComponentFocus,overlayPositioning:"fixed",readOnly:s,step:e.timeStep,value:null!=o?`${o}`:void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)})}_renderTimestampOffsetFieldComponents(e,t){const{name:i,valid:o,value:n}=e,{class:a,key:s,readOnly:r}=t,l=null!=n?`${n}`:void 0,{dateAsString:d,time:c,timeZoneOffset:u}=R(l),m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!o,numberingSystem:F,overlayPositioning:"fixed",readOnly:r,[T]:i,onfocus:this._onComponentFocus};return N("div",{class:p.dateInputContainer,key:`${s}-date-time-container`},N("calcite-input-date-picker",{...m,class:a,"data-date-part":"date",key:`${s}-date-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:d??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),N("calcite-input-time-picker",{...m,class:a,"data-date-part":"time",key:`${s}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:e.timeStep,value:c??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}),e.includeTimeOffset?N("calcite-input-time-zone",{...m,class:a,"data-date-part":"timeZone",key:`${s}-timezone-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:u??"0",onCalciteInputTimeZoneChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderDateFieldCompnents(e,t){const{includeTime:i,name:o,valid:n,value:a}=e,{class:s,max:r,min:l,key:d,readOnly:c}=t,{timeZone:u}=this,m={afterCreate:this._afterDateComponentCreate,afterUpdate:this._afterDateComponentCreateOrUpdate,"aria-invalid":!n,numberingSystem:F,overlayPositioning:"fixed",readOnly:c,[T]:o,onfocus:this._onComponentFocus},{dateAsString:h,time:v}=w(a,u),_=null!=r?w(r,u):void 0,g=null!=l?w(l,u):void 0;return N("div",{class:p.dateInputContainer,key:`${d}-date-time-container`},N("calcite-input-date-picker",{...m,class:s,"data-date-part":"date",key:`${d}-date-input`,max:_?.dateAsString??void 0,min:g?.dateAsString??void 0,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},value:h??void 0,onCalciteInputDatePickerChange:e=>this._saveValueFromDateComponent(e.target)}),i?N("calcite-input-time-picker",{...m,class:s,"data-date-part":"time",key:`${d}-time-input`,onblur:e=>{this._focusedFieldName=null,this._saveValueFromDateComponent(e.target)},step:1,value:v??void 0,onCalciteInputTimePickerChange:e=>this._saveValueFromDateComponent(e.target)}):null)}_renderReadOnlyComponent(e,t){const i=this.getCommonInputProps(e);return N("calcite-input",{...i,class:this.classes(p.fieldInput,p.inputDisabled),readOnly:!0,type:"text",value:null!=t?`${t}`:i.value})}_renderComboBoxComponent(e,t,i){const{value:o,name:n}=e,{messages:a,messagesTemplates:s,viewModel:r,_inputsWithChanges:l}=this,d=t.map((e=>e.map((({name:e,value:t})=>N("calcite-combobox-item",{key:`#${t}`,selected:o===t,textLabel:e,value:`${t}`}))))),[p,c]=d;this.viewModel.fieldsWithInvalidCodedValue.has(e)&&c.unshift(N("calcite-combobox-item",{key:"incompatible-option",readOnly:!0,textLabel:`${e.value}`,value:`${e.value}`}));const u=c.length>0?[N("calcite-combobox-item-group",{key:"recommended",label:a.recommended},p),N("calcite-combobox-item-group",{key:"other",label:s.other},c)]:p,m="INSERT"===r.arcadeEditType,h=l.has(n),v=null==o&&(!m||h);if(e.showNoValueOptionEnabled){const t="",i=e.showNoValueLabel||a.empty;u.unshift(N("calcite-combobox-item",{key:"empty-option",selected:v,textLabel:a.empty,value:t},i))}const _=m&&e.showNoValueOptionEnabled&&!h?()=>{}:i.onblur;return N("calcite-combobox",{...i,allowCustomValues:!1,clearDisabled:!0,disabled:i.readOnly,onblur:_,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({target:e})=>{v&&0===e.selectedItems.length?this._ignoreDeselectionOfNoValueOption(e):this._saveValueFromComponent(e)}},u)}_renderRadioButtonComponents(e,t,i){const{name:o,value:n}=e,a=t.map((({name:e,value:t})=>this._renderRadioButtonComponent({key:e,label:e,name:o,value:t,selected:t===n,props:i})));if(e.showNoValueOptionEnabled){const t="",s=e.showNoValueLabel||this.messages.empty,r=n===t||null===n;a.unshift(this._renderRadioButtonComponent({key:"empty-option",label:s,name:o,value:t,selected:r,props:i}))}return N("calcite-radio-button-group",{afterCreate:this._afterRadioGroupCreateOrUpdate,afterUpdate:this._afterRadioGroupCreateOrUpdate,class:p.inputRadioGroup,"data-field-name":i[T],key:`${i.key}-radio-group`,layout:"vertical",name:i.key,required:i.required},a)}_renderSwitchComponent(e,t){const{value:i}=e,o=!!v(e.element,"switch")&&i===e.element.input.onValue;return N("calcite-switch",{...t,checked:o,class:p.inputSwitch,disabled:t.readOnly,onblur:()=>{this._focusedFieldName=null},onCalciteSwitchChange:e=>this._saveValueFromComponent(e.target)})}_renderRadioButtonComponent({key:e,name:t,value:i,selected:o,label:n,props:a}){return N("calcite-label",{class:p.inputRadioLabel,key:e,layout:"inline"},N("calcite-radio-button",{...a,afterCreate:void 0,afterUpdate:void 0,checked:o,class:p.inputRadio,disabled:a.readOnly,name:t,onblur:()=>{this._focusedFieldName=null},value:i,onCalciteRadioButtonChange:({target:e})=>{e.checked&&this._saveValueFromComponent(e)}}),n)}_renderAuxiliaryText(e){const t=e.name,i=this._inputsWithChanges.has(t)&&!e.valid?_(e,this.messages,this.timeZone):null!=this.viewModel.contingencyConstraintViolations.get(t)?this.messages.validationErrors.valuesIncompatible:null!=e.valueExpressionExecutor&&e.valueExpressionExecutor.stale?this.messages.valueExpressionError:null;return null!=i?N("calcite-input-message",{icon:!0,status:"invalid"},i):this._renderDescriptionOrEmpty(e.description)}_renderShowAllRelatedRecordsListItem(e){const{featureCount:t,relationshipId:i,showAllActionVisible:o}=e,{relatedRecordCallbacks:n}=this;if(!o||!n?.showAllRelatedRecords)return;const a=this.messages;return N("calcite-list-item",{description:L(a.totalCount,{count:t}),label:a.showAll,value:!0,onCalciteListItemSelect:()=>this._onShowAllRelatedRecordsClick(i)},N("calcite-icon",{icon:"list",scale:"s",slot:"content-end"}))}_renderAddRelatedRecordButton(e){const{canAddRelatedFeature:t,relationshipId:i,relatedLayer:o}=e,{messages:n,relatedRecordCallbacks:a}=this;if(t&&a?.addRelatedRecord&&o)return N("calcite-button",{alignment:"center",appearance:"outline-fill",class:p.centeredButton,disabled:e.updating||!e.originHasValidKey,iconStart:"plus",key:`${i}-add-button`,onclick:()=>this._onAddRelatedRecordsClick(i,o),round:!0,scale:"s",width:"half"},e.relatedLayerIsTable?n.addRecord:n.addFeature)}_renderRelatedRecordListItem(e,t){const{feature:i,description:o,title:n}=e,{feature:a,relatedRecordCallbacks:s}=this,{highlightHelper:r}=this.viewModel,l=()=>{r?.removeAll(),s?.editRelatedRecord&&a&&s.editRelatedRecord({parentFeature:a,relationshipId:t,relatedFeature:i})},d=r?()=>r.add(i):void 0,p=r?()=>r.remove(i):void 0;return N("calcite-list-item",{bind:this,description:o,key:`${t}-${i.uid}`,label:n,onclick:l,onmouseenter:d,onmouseleave:p,value:n},N("calcite-icon",{icon:g(i),scale:"m",slot:"content-start"}),N("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}_renderRelationshipInput(e){if(!this._relatedRecordsEnabled||!e.editable)return;const{featureCount:t,relationshipId:i,showAllEnabled:o}=e,n=o?null:this._renderDescriptionOrEmpty(e.description),a=t>0?this._renderRelatedRecordsList(e):e.loaded?e.originHasValidKey?this._renderNoRelatedRecordsNotice():this._renderNoValidOriginKeyNotice(e):void 0;return N("calcite-label",{class:this.classes(p.label,p.relatedRecordsLabel),key:`relationship-${i}-container`},N("div",null,this._renderRelatedRecordsHeaderContainer(e),n,a),this._renderAddRelatedRecordButton(e))}_renderRelatedRecordsHeaderContainer(e){const t=e.updating||!e.loaded;return N("div",{class:p.relatedRecordsHeader,key:`relationship-${e.relationshipId}-header`},N("span",null,e.label),t?N("calcite-loader",{inline:!0,key:"loader",label:this.messagesCommon?.loading,scale:"s",type:"indeterminate"}):void 0)}_renderRelatedRecordsList(e){const{relationshipId:t}=e;return N("calcite-list",{class:p.relatedRecordsList},e.relatedFeatureInfos.map((e=>this._renderRelatedRecordListItem(e,t))),this._renderShowAllRelatedRecordsListItem(e),this._renderObserverNode())}_renderNoValidOriginKeyNotice(e){const{messages:t}=this,i=e.relatedLayerIsTable?t.noOriginKeyRecord:t.noOriginKeyFeature,o=e.relationship?.keyField,n=this.viewModel.findField(o),a=n?.label,s=L(i,{relatedLayerName:e.relatedLayer?.title,originKeyField:a});return N("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},N("div",{slot:"message"},s))}_renderNoRelatedRecordsNotice(){return N("calcite-notice",{icon:"information",kind:"brand",open:!0,scale:"s",width:"full"},N("div",{slot:"message"},this.messagesFeature.noRelatedFeatures))}_renderObserverNode(){if(this.viewModel.activeRelationshipInput?.showAllEnabled)return N("div",{afterCreate:this._afterListObserverCreated,afterRemoved:this._afterListObserverRemoved,bind:this,class:p.listObserver,key:"feature-observer"})}getCommonInputProps(e){const{disabled:t}=this,{editable:i,hint:o,label:n,maxLength:a,minLength:s,name:r,range:{max:l,min:d},required:c,valid:u,value:m}=e,h=this._inputsWithChanges.has(r),v=!i||t;return{afterCreate:this._afterComponentCreate,afterUpdate:this._afterComponentCreateOrUpdate,"aria-invalid":u?"false":"true",class:this.classes(p.fieldInput,v?p.inputDisabled:null,h&&!u?p.inputInvalid:null),key:r,label:n,max:null!=l?l:void 0,min:null!=d?d:void 0,maxLength:a>-1?a:void 0,minLength:s>-1?s:void 0,placeholder:o??void 0,readOnly:v,required:c,value:null==m?"":`${m}`,onblur:this._onComponentBlur,onfocus:this._onComponentFocus,onkeydown:this._onComponentKeyDown,[T]:r}}_getFieldInputFromHTMLElement(e){return this.viewModel.findField(e.getAttribute(T))}_afterDateComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e),i=e.dataset.datePart,o=this._dateComponentMap.get(t.name);if("valueAsDate"in e&&null!=e.value){const t=e.value,i=new ResizeObserver((()=>{e.value=void 0,e.value=t,i.unobserve(e)}));i.observe(e)}if(null!=o)switch(i){case"date":o.date=e;break;case"time":o.time=e;break;case"timeZone":o.timeZone=e}else this._dateComponentMap.set(t.name,{[i]:e});this._afterDateComponentCreateOrUpdate(e)}_afterDateComponentCreateOrUpdate(e){this._afterComponentCreateOrUpdate(e)}_afterComponentCreate(e){const t=this._getFieldInputFromHTMLElement(e);b(t)&&null!=e.value&&"setNumberValue"in e&&e.setNumberValue({committing:!1,value:e.value,origin:"direct"}),this._afterComponentCreateOrUpdate(e)}_afterRadioGroupCreateOrUpdate(e){const t=e.selectedItem,i=e.querySelector("calcite-radio-button"),o=t||i;o&&this._afterComponentCreateOrUpdate(o)}_afterComponentCreateOrUpdate(e){const{viewModel:t}=this,i=this._getFieldInputFromHTMLElement(e),o=t.findField(this._focusedFieldName);this._attemptFocusOnNextRender&&o===i&&(this._attemptFocusOnNextRender=!1,h(i)&&(i.group.open=!0),e.setFocus())}_onComponentFocus(e){const t=e.target,i=this._getFieldInputFromHTMLElement(t);this._focusedFieldName=i.name}_onComponentBlur(e){const t=e.target;this._focusedFieldName=null,this._saveValueFromComponent(t)}_saveValueFromDateComponent(e){const t=this._getFieldInputFromHTMLElement(e),i=t.field.type,{name:o}=t,n=this._dateComponentMap.get(o);if(!n)return;const a=this.viewModel.getValue(o);let s=null;s="date-only"===i||"time-only"===i?e.value:"timestamp-offset"===i?null!=e.value?O({dateComponent:n.date,timeComponent:n.time,timeZoneComponent:n.timeZone,oldValue:a}):null:null!=e.value?k({oldValue:a,dateComponent:n.date,timeComponent:n.time,timeZone:this.timeZone,max:t.range?.max,min:t.range?.min}):null,null!==s&&e.value?a!==s&&this._updateFieldValue(o,s):this._updateFieldValue(o,null)}_saveValueFromComponent(e){const t=this._getFieldInputFromHTMLElement(e);this._updateFieldValue(t.name,this._parseValue(e))}_onComponentKeyDown({key:e,target:t}){const i=this._getFieldInputFromHTMLElement(t);"Enter"===e&&h(i)&&!i.group.open&&(i.group.open=!0)}_updateFieldValue(e,t){if(this.viewModel.setValue(e,t),this._inputsWithChanges.add(e),this.viewModel.fieldsWithContingentValues.has(e)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>null!=t)));this.viewModel.validateContingencyConstraints(e)}}_parseValue(e){const t=this._getFieldInputFromHTMLElement(e),i=e.value;return v(t.element,"switch")?e.checked?t.element.input.onValue:t.element.input.offValue:null==i||""===i?null:"number"===t.dataType?"-0"===i||"-0."===i||"-0,"===i?i:parseFloat(i):"date"===t.field.type?parseFloat(i):i}_ignoreDeselectionOfNoValueOption(e){const{firstChild:t,selectedItems:i}=e;0===i.length&&t&&"selected"in t?t.selected=!0:S.warnOnce("Failed to override user attempt to deselect 'No value' option.")}_onGroupToggle(e,t){e.open?(t.open=!0,this._focusedFieldName=this._getFocusableInput("forward",t)?.name||null,this._attemptFocusOnNextRender=!0,"sequential"===this.groupDisplay&&this.viewModel.allGroupInputs.forEach((e=>{e!==t&&(e.open=!1)}))):t.open=!1,this.scheduleRender()}_onFormSubmit(e){e.preventDefault()}_onFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_afterListObserverCreated(e){this.viewModel.activeRelationshipInput&&(this._listObserverNode=e)}_afterListObserverRemoved(){this._listObserverNode=null}_onObserverChange(){this._listObserverNode&&this._listObserver.unobserve(this._listObserverNode);const e=this.viewModel.activeRelationshipInput;e&&this._listObserverNode&&e.showAllEnabled&&this._listObserver.observe(this._listObserverNode)}_incrementRelatedRecordPage(){const e=this.viewModel.activeRelationshipInput;e?.incrementPage()}_syncGroupInputStates(){if("sequential"!==this.groupDisplay)return;const e=this.viewModel.allGroupInputs;if(!e.length)return;const t=e.filter((e=>e.open));0===t.length?e[0].open=!0:t.length>1&&t.slice(1).forEach((e=>e.open=!1))}};e([s()],E.prototype,"_listObserverNode",void 0),e([s()],E.prototype,"_relatedRecordsEnabled",null),e([s()],E.prototype,"disabled",null),e([s()],E.prototype,"feature",null),e([s()],E.prototype,"formTemplate",null),e([s()],E.prototype,"groupDisplay",void 0),e([s()],E.prototype,"headingLevel",void 0),e([s()],E.prototype,"label",null),e([s()],E.prototype,"layer",null),e([s()],E.prototype,"map",null),e([s(),V("esri/widgets/FeatureForm/t9n/FeatureForm")],E.prototype,"messages",void 0),e([s(),V("esri/t9n/common")],E.prototype,"messagesCommon",void 0),e([s(),V("esri/widgets/Feature/t9n/Feature")],E.prototype,"messagesFeature",void 0),e([s(),V("esri/widgets/FeatureTemplates/t9n/FeatureTemplates")],E.prototype,"messagesTemplates",void 0),e([s()],E.prototype,"relatedRecordCallbacks",null),e([s()],E.prototype,"relationshipId",null),e([s()],E.prototype,"spatialReference",null),e([s()],E.prototype,"strict",null),e([s()],E.prototype,"timeZone",null),e([s()],E.prototype,"view",null),e([s(),x(["value-change","submit"])],E.prototype,"viewModel",void 0),E=e([r(j)],E);const U=E;export{U as default};
|