@esri/solutions-components 0.8.60 → 0.8.62

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. package/dist/cjs/basemap-gallery_7.cjs.entry.js +2 -2
  2. package/dist/cjs/buffer-tools_3.cjs.entry.js +2 -2
  3. package/dist/cjs/calcite-action-pad_2.cjs.entry.js +2 -2
  4. package/dist/cjs/calcite-alert_4.cjs.entry.js +4 -4
  5. package/dist/cjs/calcite-block_5.cjs.entry.js +4 -4
  6. package/dist/cjs/calcite-dropdown-group_2.cjs.entry.js +2 -2
  7. package/dist/cjs/calcite-flow_6.cjs.entry.js +2 -2
  8. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +3 -3
  9. package/dist/cjs/card-manager_3.cjs.entry.js +32 -8
  10. package/dist/cjs/consent-manager.cjs.entry.js +2 -2
  11. package/dist/cjs/crowdsource-manager.cjs.entry.js +4 -12
  12. package/dist/cjs/crowdsource-reporter.cjs.entry.js +2 -2
  13. package/dist/cjs/{downloadUtils-2e169425.js → downloadUtils-85009d64.js} +6 -3
  14. package/dist/cjs/feature-list.cjs.entry.js +4 -4
  15. package/dist/cjs/{helpers-95c28cf3.js → helpers-0104985c.js} +1 -1
  16. package/dist/cjs/{index.es-301b8d18.js → index.es-cc49d45d.js} +3 -3
  17. package/dist/cjs/instant-apps-ckeditor-wrapper_3.cjs.entry.js +5 -5
  18. package/dist/cjs/instant-apps-control-panel.cjs.entry.js +2 -2
  19. package/dist/cjs/instant-apps-create.cjs.entry.js +4 -4
  20. package/dist/cjs/instant-apps-export.cjs.entry.js +4 -4
  21. package/dist/cjs/instant-apps-header.cjs.entry.js +2 -2
  22. package/dist/cjs/instant-apps-interactive-legend-classic.cjs.entry.js +3 -3
  23. package/dist/cjs/instant-apps-interactive-legend-count_2.cjs.entry.js +3 -3
  24. package/dist/cjs/instant-apps-interactive-legend-group-legend-element-caption.cjs.entry.js +3 -3
  25. package/dist/cjs/instant-apps-interactive-legend-group-legend-element_5.cjs.entry.js +3 -3
  26. package/dist/cjs/instant-apps-interactive-legend.cjs.entry.js +5 -5
  27. package/dist/cjs/instant-apps-keyboard-shortcuts.cjs.entry.js +4 -4
  28. package/dist/cjs/instant-apps-language-switcher.cjs.entry.js +6 -6
  29. package/dist/cjs/instant-apps-language-translator.cjs.entry.js +6 -6
  30. package/dist/cjs/instant-apps-measurement.cjs.entry.js +4 -4
  31. package/dist/cjs/instant-apps-popover.cjs.entry.js +4 -4
  32. package/dist/cjs/instant-apps-scoreboard.cjs.entry.js +4 -4
  33. package/dist/cjs/instant-apps-sign-in.cjs.entry.js +4 -4
  34. package/dist/cjs/instant-apps-splash.cjs.entry.js +4 -4
  35. package/dist/cjs/{languageSwitcher-f0bb94fa.js → languageSwitcher-dc2dd354.js} +1 -1
  36. package/dist/cjs/{languageUtil-f22ce913.js → languageUtil-a3e1eafd.js} +1 -1
  37. package/dist/cjs/layout-manager.cjs.entry.js +2 -2
  38. package/dist/cjs/{loadModules-36d49819.js → loadModules-8567855e.js} +1 -1
  39. package/dist/cjs/loader.cjs.js +1 -1
  40. package/dist/cjs/{locale-708985a1.js → locale-1d07e942.js} +2 -2
  41. package/dist/cjs/{locale-f6fd03d2.js → locale-31289fc5.js} +1 -1
  42. package/dist/cjs/map-select-tools_3.cjs.entry.js +3 -3
  43. package/dist/cjs/{popupUtils-36e57a27.js → popupUtils-fe880b9e.js} +2 -2
  44. package/dist/cjs/public-notification.cjs.entry.js +3 -3
  45. package/dist/cjs/solution-configuration.cjs.entry.js +3 -3
  46. package/dist/cjs/solution-contents_3.cjs.entry.js +3 -3
  47. package/dist/cjs/{solution-store-d9f3ea44.js → solution-store-4e35404b.js} +10 -0
  48. package/dist/cjs/solutions-components.cjs.js +1 -1
  49. package/dist/cjs/spatial-ref.cjs.entry.js +2 -2
  50. package/dist/cjs/store-manager.cjs.entry.js +1 -1
  51. package/dist/cjs/{utils-31a22d49.js → utils-0ab15745.js} +1 -1
  52. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +1 -11
  53. package/dist/collection/components/layer-table/layer-table.js +29 -5
  54. package/dist/collection/utils/downloadUtils.js +4 -1
  55. package/dist/collection/utils/downloadUtils.ts +4 -1
  56. package/dist/components/crowdsource-manager.js +3 -12
  57. package/dist/components/downloadUtils.js +4 -1
  58. package/dist/components/layer-table2.js +29 -5
  59. package/dist/components/solution-store.js +10 -0
  60. package/dist/esm/basemap-gallery_7.entry.js +2 -2
  61. package/dist/esm/buffer-tools_3.entry.js +2 -2
  62. package/dist/esm/calcite-action-pad_2.entry.js +2 -2
  63. package/dist/esm/calcite-alert_4.entry.js +4 -4
  64. package/dist/esm/calcite-block_5.entry.js +4 -4
  65. package/dist/esm/calcite-dropdown-group_2.entry.js +2 -2
  66. package/dist/esm/calcite-flow_6.entry.js +2 -2
  67. package/dist/esm/calcite-shell-panel_14.entry.js +3 -3
  68. package/dist/esm/card-manager_3.entry.js +32 -8
  69. package/dist/esm/consent-manager.entry.js +2 -2
  70. package/dist/esm/crowdsource-manager.entry.js +4 -12
  71. package/dist/esm/crowdsource-reporter.entry.js +2 -2
  72. package/dist/esm/{downloadUtils-5fbd8a40.js → downloadUtils-f2c49e23.js} +6 -3
  73. package/dist/esm/feature-list.entry.js +4 -4
  74. package/dist/esm/{helpers-3d53560f.js → helpers-3407a4b6.js} +1 -1
  75. package/dist/esm/{index.es-66571353.js → index.es-680dba03.js} +3 -3
  76. package/dist/esm/instant-apps-ckeditor-wrapper_3.entry.js +5 -5
  77. package/dist/esm/instant-apps-control-panel.entry.js +2 -2
  78. package/dist/esm/instant-apps-create.entry.js +4 -4
  79. package/dist/esm/instant-apps-export.entry.js +4 -4
  80. package/dist/esm/instant-apps-header.entry.js +2 -2
  81. package/dist/esm/instant-apps-interactive-legend-classic.entry.js +3 -3
  82. package/dist/esm/instant-apps-interactive-legend-count_2.entry.js +3 -3
  83. package/dist/esm/instant-apps-interactive-legend-group-legend-element-caption.entry.js +3 -3
  84. package/dist/esm/instant-apps-interactive-legend-group-legend-element_5.entry.js +3 -3
  85. package/dist/esm/instant-apps-interactive-legend.entry.js +5 -5
  86. package/dist/esm/instant-apps-keyboard-shortcuts.entry.js +4 -4
  87. package/dist/esm/instant-apps-language-switcher.entry.js +6 -6
  88. package/dist/esm/instant-apps-language-translator.entry.js +6 -6
  89. package/dist/esm/instant-apps-measurement.entry.js +4 -4
  90. package/dist/esm/instant-apps-popover.entry.js +4 -4
  91. package/dist/esm/instant-apps-scoreboard.entry.js +4 -4
  92. package/dist/esm/instant-apps-sign-in.entry.js +4 -4
  93. package/dist/esm/instant-apps-splash.entry.js +4 -4
  94. package/dist/esm/{languageSwitcher-b665499d.js → languageSwitcher-9db90f1e.js} +1 -1
  95. package/dist/esm/{languageUtil-a3e6adf6.js → languageUtil-2b6e191a.js} +1 -1
  96. package/dist/esm/layout-manager.entry.js +2 -2
  97. package/dist/esm/{loadModules-9c062d08.js → loadModules-03ba7abe.js} +1 -1
  98. package/dist/esm/loader.js +1 -1
  99. package/dist/esm/{locale-28d48640.js → locale-4adfc8cf.js} +1 -1
  100. package/dist/esm/{locale-b4e7d56f.js → locale-d66155ee.js} +2 -2
  101. package/dist/esm/map-select-tools_3.entry.js +3 -3
  102. package/dist/esm/{popupUtils-4a91aa2a.js → popupUtils-21b9dbe5.js} +2 -2
  103. package/dist/esm/public-notification.entry.js +3 -3
  104. package/dist/esm/solution-configuration.entry.js +3 -3
  105. package/dist/esm/solution-contents_3.entry.js +3 -3
  106. package/dist/esm/{solution-store-1c36ce1d.js → solution-store-840c5489.js} +10 -0
  107. package/dist/esm/solutions-components.js +1 -1
  108. package/dist/esm/spatial-ref.entry.js +2 -2
  109. package/dist/esm/store-manager.entry.js +1 -1
  110. package/dist/esm/{utils-5484fcbf.js → utils-efd425d4.js} +1 -1
  111. package/dist/solutions-components/{p-9e3b0220.entry.js → p-0534b446.entry.js} +1 -1
  112. package/dist/solutions-components/{p-ce4b6931.entry.js → p-09de2308.entry.js} +1 -1
  113. package/dist/solutions-components/{p-5cc6eb18.js → p-12f9f81d.js} +1 -1
  114. package/dist/solutions-components/{p-0cd87dca.entry.js → p-1412173c.entry.js} +1 -1
  115. package/dist/solutions-components/{p-b7123452.entry.js → p-14900698.entry.js} +1 -1
  116. package/dist/solutions-components/{p-00291b93.js → p-17946a3f.js} +3 -3
  117. package/dist/solutions-components/{p-427b4593.js → p-1c64264d.js} +1 -1
  118. package/dist/solutions-components/{p-7696af8e.entry.js → p-1d285ae1.entry.js} +1 -1
  119. package/dist/solutions-components/{p-ccd1e256.entry.js → p-2671a80b.entry.js} +1 -1
  120. package/dist/solutions-components/{p-881ead62.entry.js → p-2a8b04de.entry.js} +1 -1
  121. package/dist/solutions-components/{p-d2de2b2a.entry.js → p-2e2e975a.entry.js} +1 -1
  122. package/dist/solutions-components/{p-44fea43a.js → p-2fb21ae5.js} +1 -1
  123. package/dist/solutions-components/{p-c742acd9.js → p-2fc63144.js} +1 -1
  124. package/dist/solutions-components/{p-969828ab.entry.js → p-30f0687e.entry.js} +1 -1
  125. package/dist/solutions-components/p-318eac43.entry.js +6 -0
  126. package/dist/solutions-components/{p-6e6e6d23.entry.js → p-3ec70ff5.entry.js} +1 -1
  127. package/dist/solutions-components/{p-bbc7dd5e.entry.js → p-4250f852.entry.js} +1 -1
  128. package/dist/solutions-components/{p-90864588.entry.js → p-42c2d9d8.entry.js} +1 -1
  129. package/dist/solutions-components/{p-36e199e0.entry.js → p-4bfec58a.entry.js} +1 -1
  130. package/dist/solutions-components/{p-ae50581b.entry.js → p-4c8fdf0b.entry.js} +1 -1
  131. package/dist/solutions-components/{p-65581d83.js → p-4cd4cb85.js} +1 -1
  132. package/dist/solutions-components/{p-2d6d44b5.entry.js → p-6067b27a.entry.js} +1 -1
  133. package/dist/solutions-components/{p-986ee365.entry.js → p-62e5aea4.entry.js} +1 -1
  134. package/dist/solutions-components/{p-c6fd40f9.entry.js → p-6e65d93b.entry.js} +1 -1
  135. package/dist/solutions-components/{p-d73b90ab.entry.js → p-7058b4fa.entry.js} +1 -1
  136. package/dist/solutions-components/{p-932d6f29.entry.js → p-72347474.entry.js} +1 -1
  137. package/dist/solutions-components/{p-91142a26.js → p-75cb415f.js} +1 -1
  138. package/dist/solutions-components/{p-6c7a990a.entry.js → p-80e42752.entry.js} +1 -1
  139. package/dist/solutions-components/{p-3e8562b5.entry.js → p-8100a48d.entry.js} +1 -1
  140. package/dist/solutions-components/{p-b92e9047.entry.js → p-83640661.entry.js} +1 -1
  141. package/dist/solutions-components/{p-2467b476.entry.js → p-83fdb1d4.entry.js} +1 -1
  142. package/dist/solutions-components/{p-1c3c83a5.js → p-841863b8.js} +1 -1
  143. package/dist/solutions-components/{p-a8d62b7d.entry.js → p-967411c5.entry.js} +1 -1
  144. package/dist/solutions-components/{p-af2c8aa9.js → p-ac122d9e.js} +1 -1
  145. package/dist/solutions-components/{p-cb4842dd.entry.js → p-b0985f9d.entry.js} +1 -1
  146. package/dist/solutions-components/{p-dae9d5b3.entry.js → p-bc8b4f68.entry.js} +1 -1
  147. package/dist/solutions-components/{p-bd871071.entry.js → p-bf0bb8c2.entry.js} +1 -1
  148. package/dist/solutions-components/{p-ffd41e25.js → p-c0bf1d9f.js} +3 -3
  149. package/dist/solutions-components/{p-2afdcdfc.js → p-c1936856.js} +1 -1
  150. package/dist/solutions-components/p-cd8d6e52.entry.js +6 -0
  151. package/dist/solutions-components/{p-bb7463ed.entry.js → p-d3a2d182.entry.js} +1 -1
  152. package/dist/solutions-components/{p-e80751f4.entry.js → p-d61bbc4c.entry.js} +1 -1
  153. package/dist/solutions-components/{p-2961c63c.entry.js → p-d72b4031.entry.js} +1 -1
  154. package/dist/solutions-components/{p-61f88049.entry.js → p-ddd9d50f.entry.js} +1 -1
  155. package/dist/solutions-components/{p-295f850a.entry.js → p-df2fc967.entry.js} +1 -1
  156. package/dist/solutions-components/{p-1e6c6ec4.entry.js → p-e900ec51.entry.js} +1 -1
  157. package/dist/solutions-components/{p-df56c019.entry.js → p-ed71dfdc.entry.js} +1 -1
  158. package/dist/solutions-components/{p-219f209e.entry.js → p-ee62f91c.entry.js} +1 -1
  159. package/dist/solutions-components/{p-e8ed3fa6.entry.js → p-f629ed65.entry.js} +1 -1
  160. package/dist/solutions-components/solutions-components.esm.js +1 -1
  161. package/dist/solutions-components/utils/downloadUtils.ts +4 -1
  162. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +0 -4
  163. package/dist/types/components/layer-table/layer-table.d.ts +8 -0
  164. package/package.json +6 -6
  165. package/dist/solutions-components/p-13404ad7.entry.js +0 -6
  166. package/dist/solutions-components/p-d300430b.entry.js +0 -6
  167. package/dist/solutions-components_commit.txt +0 -8
  168. /package/dist/cjs/{esri-loader-a56cbcbe.js → esri-loader-08dc41bd.js} +0 -0
  169. /package/dist/esm/{esri-loader-781d738a.js → esri-loader-c6842c6b.js} +0 -0
  170. /package/dist/solutions-components/{p-6a68306c.js → p-0a24ad5f.js} +0 -0
@@ -3,4 +3,4 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{r as a,c as t,h as n,H as s,F as e,g as i}from"./p-fa1ceaf9.js";import{g as r,a as l,s as o,E as c,b as p,l as g,c as u}from"./p-5cc6eb18.js";import{l as d}from"./p-65581d83.js";import{c as h}from"./p-427b4593.js";import{g as v,f as m}from"./p-c742acd9.js";import"./p-8c6d9b5a.js";import"./p-6a68306c.js";import"./p-d4056c1c.js";import"./p-af2c8aa9.js";const _="instant-apps-language-translator",b={BASE:_,header:`${_}__header`,headerText:`${_}__header-text`,savingIndicator:`${_}__saving-indicator`,closeButton:`${_}__close-button`,headerTip:`${_}__header-tip`,topBar:`${_}__top-bar`,topBarSection:`${_}__top-bar-section`,collapseSearchContainer:`${_}__collapse-search-container`,userLangText:`${_}__user-lang-text`,lastItem:`${_}--last-item`,writingIcon:`${_}__writing-icon`},f=class{constructor(n){a(this,n),this.translatorDataUpdated=t(this,"translatorDataUpdated",7),this.portalItem=void 0,this.appSettings=void 0,this.locales=void 0,this.open=!1,this.userLocaleInputOnChangeCallback=void 0,this.translatedLocaleInputOnChangeCallback=void 0,this.saving=!1,this.messages=void 0,this.isCollapse=!0}handleT9nItemUpdate(){this.translatorDataUpdated.emit()}handleLocaleChange(){this.initUIData(),this.initSelectLanguage()}handleAppSettings(){this.initUIData(),this.initSelectLanguage()}async componentDidLoad(){this.initialize()}async initialize(){const[a,t]=await d(["esri/intl","esri/request"]);this.intl=a,this.request=t,await this.initMessages(),this.initUIData(),this.initPortalItemResourceT9nData(),this.initSelectLanguage()}async initMessages(){try{const{el:a}=this,t=await r(a);return this.messages=t,Promise.resolve()}catch(a){return Promise.reject()}}initUIData(){const{appSettings:a,locales:t}=this,n=l(a,t);o.set("uiData",n)}initSelectLanguage(){var a,t;if(!this.intl)return;const{locales:n}=this,s=null!==(t=null===(a=null==n?void 0:n[0])||void 0===a?void 0:a.locale)&&void 0!==t?t:this.intl.getLocale(),e=o.get("currentLanguage");0===this.locales.filter((a=>a.locale===e)).length&&o.set("currentLanguage",s)}async initPortalItemResourceT9nData(){try{const a=await v(this.portalItem);o.set("portalItemResource",a);const t=await m(this.request,a);o.set("portalItemResourceT9n",null!=t?t:{})}catch(a){}}render(){return n(s,{key:"fc32ca4cd8da2d20de670b77e7e6e324fbe15e80"},this.renderModal(),this.renderPopoverTip())}renderModal(){return n("calcite-modal",{open:this.open,scale:"l",fullscreen:!0,onCalciteModalClose:this.close.bind(this)},this.renderHeader(),this.renderContent(),this.renderPrimaryButton())}renderPopoverTip(){var a;return n("calcite-popover",{label:"",referenceElement:"headerTip",placement:"trailing","auto-close":!0,closable:!0},n("div",{class:b.headerTip},null===(a=this.messages)||void 0===a?void 0:a.headerTip))}renderHeader(){const a=o.get("saving");return n("header",{class:b.header,slot:"header"},this.renderHeaderText(),a?this.renderSavingIndicator():null)}renderHeaderText(){const{messages:a}=this;return n("div",{class:b.headerText},n("span",null,null==a?void 0:a.header),n("calcite-button",{id:"headerTip",appearance:"transparent"},n("calcite-icon",{icon:c.Popover,scale:"s"})))}renderSavingIndicator(){var a;const t=o.get("saving"),s=null===(a=this.messages)||void 0===a?void 0:a.saving;return n("div",{class:b.savingIndicator},t?n("calcite-loader",{label:s,inline:!0}):null,n("span",null,s))}renderContent(){const a=p(this.locales);return n("div",{slot:"content"},this.renderTopBar(),(null==a?void 0:a.length)>0?this.renderUIData():this.renderNotice())}renderTopBar(){return n("div",{class:b.topBar},this.renderLeadingTopBarSection(),this.renderTrailingTopBarSection())}renderLeadingTopBarSection(){return n("div",{class:b.topBarSection},this.renderUserLocale(),this.renderCollapseSearchContainer())}renderUserLocale(){var a;const t=null===(a=this.messages)||void 0===a?void 0:a.languages,s=h(this.el);return n("div",{class:b.userLangText},null==t?void 0:t[s])}renderCollapseSearchContainer(){return n("div",{class:b.collapseSearchContainer},this.renderExpandCollapseButton(),this.renderSearch())}renderExpandCollapseButton(){const{isCollapse:a,messages:t}=this,s=a?null==t?void 0:t.collapseAll:null==t?void 0:t.expandAll;return n(e,null,n("slot",{name:"primary-custom-action"}),n("slot",{name:"secondary-custom-action"}),n("calcite-button",{onClick:this.handleExpandCollapseAll.bind(this),appearance:"transparent","icon-start":c.ExpandCollapse},s))}renderSearch(){var a;return n("instant-apps-language-translator-search",{onSuggestionSelected:this.onSuggestionSelect.bind(this),t9nPlaceholder:null===(a=this.messages)||void 0===a?void 0:a.searchPlaceholder})}renderTrailingTopBarSection(){return n("div",{class:b.topBarSection},this.renderLanguageSelection(),n("slot",{name:"translation-custom-action"}))}renderLanguageSelection(){var a;return n("calcite-label",{layout:"inline"},null===(a=this.messages)||void 0===a?void 0:a.translatedLanguage,n("calcite-select",{label:"",onCalciteSelectChange:this.handleLanguageSelection.bind(this)},this.renderTranslatedLangOptions()))}renderTranslatedLangOptions(){const a=o.get("uiData"),t=null==a?void 0:a.get("locales"),s=p(t);return null==s?void 0:s.map((a=>{const{messages:t}=this,s=null==t?void 0:t.translatedLanguageNames,e=null==t?void 0:t.languages;return n("calcite-option",{key:`translated-lang-option-${a}`,value:a},`${null==s?void 0:s[a]} - ${null==e?void 0:e[a]}`)}))}renderUIData(){if(!(null==g?void 0:g.uiData))return;const a=u();return n("div",null,null==a?void 0:a.map(((t,n)=>this.renderUIDataItem(t,n,a.length))))}renderNotice(){var a;const t=null===(a=this.messages)||void 0===a?void 0:a.noLanguage;return n("calcite-notice",{open:!0,icon:"exclamation-mark-triangle",kind:"warning"},n("div",{slot:"title"},null==t?void 0:t.title),n("div",{slot:"message"},null==t?void 0:t.message))}renderUIDataItem(a,t,s){var e,i;const r=null===(i=null===(e=this.appSettings)||void 0===e?void 0:e.translatedLanguageLabels)||void 0===i?void 0:i[g.currentLanguage],l=`${t===s-1?b.lastItem:""}`,o=this.appSettings.content.filter((t=>t.id===a))[0];return n("instant-apps-language-translator-item",{key:`${a}-${t}`,class:l,fieldName:a,translatedLanguageLabels:r,setting:o,userLocaleInputOnChangeCallback:this.userLocaleInputOnChangeCallback,translatedLocaleInputOnChangeCallback:this.translatedLocaleInputOnChangeCallback})}renderPrimaryButton(){var a;return n("calcite-button",{onClick:()=>this.open=!1,slot:"primary",class:b.closeButton},null===(a=this.messages)||void 0===a?void 0:a.close)}handleExpandCollapseAll(){this.isCollapse=!this.isCollapse;const a=new Map(g.uiData);u().forEach((t=>a.get(t).expanded=this.isCollapse)),o.set("uiData",a)}onSuggestionSelect(a){const t=a.detail,n=new Map(g.uiData);u().forEach((a=>{n.get(a).selected=a===t})),o.set("uiData",n)}close(){this.open=!1}handleLanguageSelection(a){o.set("currentLanguage",a.target.value)}async getTranslationData(){return o.get("portalItemResourceT9n")}async setTranslationData(a){return o.set("portalItemResourceT9n",a)}async getPortalItemResource(){return o.get("portalItemResource")}async batchWriteToPortalItemResource(a){o.set("saving",!0);try{const t=await this.getPortalItemResource(),n=JSON.stringify(a),s=new Blob([n],{type:"application/json"});return await t.update(s),setTimeout((()=>o.set("saving",!1)),1500),this.translatorDataUpdated.emit(),Promise.resolve()}catch(a){return console.error("Error writing to portal item resource: ",a),o.set("saving",!1),Promise.reject()}}get el(){return i(this)}static get watchers(){return{locales:["handleLocaleChange"],appSettings:["handleAppSettings"]}}};f.style=".sc-instant-apps-language-translator-h{display:block}.sc-instant-apps-language-translator-h calcite-modal.sc-instant-apps-language-translator{--calcite-modal-content-padding:0}.sc-instant-apps-language-translator-h .instant-apps-language-translator__header.sc-instant-apps-language-translator{display:flex;justify-content:space-between;width:100%}.sc-instant-apps-language-translator-h .instant-apps-language-translator__header-text.sc-instant-apps-language-translator{font-size:18px}.sc-instant-apps-language-translator-h .instant-apps-language-translator__saving-indicator.sc-instant-apps-language-translator{display:flex;align-items:center;font-size:14.5px;color:var(--calcite-color-brand)}.sc-instant-apps-language-translator-h .instant-apps-language-translator__writing-icon.sc-instant-apps-language-translator{display:flex;justify-content:center;align-items:center;margin-right:5px}.sc-instant-apps-language-translator-h .instant-apps-language-translator__close-button.sc-instant-apps-language-translator{width:175px}.sc-instant-apps-language-translator-h .instant-apps-language-translator__header-tip.sc-instant-apps-language-translator{padding:20px;max-width:45vw}.sc-instant-apps-language-translator-h .instant-apps-language-translator__top-bar.sc-instant-apps-language-translator{display:flex;width:100%;position:sticky;top:0;background:var(--calcite-color-foreground-1);z-index:1}.sc-instant-apps-language-translator-h .instant-apps-language-translator__top-bar.sc-instant-apps-language-translator calcite-label.sc-instant-apps-language-translator{--calcite-label-margin-bottom:0;font-weight:var(--calcite-font-weight-medium)}.sc-instant-apps-language-translator-h .instant-apps-language-translator__top-bar-section.sc-instant-apps-language-translator{box-sizing:border-box;display:flex;align-items:center;width:50%;padding:0.5%}.sc-instant-apps-language-translator-h .instant-apps-language-translator__user-lang-text.sc-instant-apps-language-translator{font-weight:var(--calcite-font-weight-medium)}.sc-instant-apps-language-translator-h .instant-apps-language-translator__top-bar-section.sc-instant-apps-language-translator:first-child{display:flex;justify-content:space-between}.sc-instant-apps-language-translator-h .instant-apps-language-translator__top-bar-section.sc-instant-apps-language-translator:nth-child(2) calcite-select.sc-instant-apps-language-translator{width:255px}.sc-instant-apps-language-translator-h .instant-apps-language-translator__collapse-search-container.sc-instant-apps-language-translator{display:flex;justify-content:space-between}.sc-instant-apps-language-translator-h .instant-apps-language-translator__collapse-search-container.sc-instant-apps-language-translator calcite-input.sc-instant-apps-language-translator{width:300px;margin-left:30px}.ck.ck-reset.ck-editor.ck-rounded-corners.sc-instant-apps-language-translator{margin-top:10px !important;margin-left:55px !important}.ck-editor__editable.sc-instant-apps-language-translator{height:70px !important;font-size:0.875rem !important;line-height:1.375 !important}.ck.ck-editor__editable_inline.sc-instant-apps-language-translator>.sc-instant-apps-language-translator:first-child,.ck.ck-editor__editable_inline.sc-instant-apps-language-translator>.sc-instant-apps-language-translator:last-child{--ck-spacing-large:0.5rem !important}";export{f as instant_apps_language_translator}
6
+ import{r as a,c as t,h as n,H as s,F as e,g as i}from"./p-fa1ceaf9.js";import{g as r,a as l,s as o,E as c,b as p,l as g,c as u}from"./p-12f9f81d.js";import{l as d}from"./p-4cd4cb85.js";import{c as h}from"./p-1c64264d.js";import{g as v,f as m}from"./p-2fc63144.js";import"./p-8c6d9b5a.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-ac122d9e.js";const _="instant-apps-language-translator",b={BASE:_,header:`${_}__header`,headerText:`${_}__header-text`,savingIndicator:`${_}__saving-indicator`,closeButton:`${_}__close-button`,headerTip:`${_}__header-tip`,topBar:`${_}__top-bar`,topBarSection:`${_}__top-bar-section`,collapseSearchContainer:`${_}__collapse-search-container`,userLangText:`${_}__user-lang-text`,lastItem:`${_}--last-item`,writingIcon:`${_}__writing-icon`},f=class{constructor(n){a(this,n),this.translatorDataUpdated=t(this,"translatorDataUpdated",7),this.portalItem=void 0,this.appSettings=void 0,this.locales=void 0,this.open=!1,this.userLocaleInputOnChangeCallback=void 0,this.translatedLocaleInputOnChangeCallback=void 0,this.saving=!1,this.messages=void 0,this.isCollapse=!0}handleT9nItemUpdate(){this.translatorDataUpdated.emit()}handleLocaleChange(){this.initUIData(),this.initSelectLanguage()}handleAppSettings(){this.initUIData(),this.initSelectLanguage()}async componentDidLoad(){this.initialize()}async initialize(){const[a,t]=await d(["esri/intl","esri/request"]);this.intl=a,this.request=t,await this.initMessages(),this.initUIData(),this.initPortalItemResourceT9nData(),this.initSelectLanguage()}async initMessages(){try{const{el:a}=this,t=await r(a);return this.messages=t,Promise.resolve()}catch(a){return Promise.reject()}}initUIData(){const{appSettings:a,locales:t}=this,n=l(a,t);o.set("uiData",n)}initSelectLanguage(){var a,t;if(!this.intl)return;const{locales:n}=this,s=null!==(t=null===(a=null==n?void 0:n[0])||void 0===a?void 0:a.locale)&&void 0!==t?t:this.intl.getLocale(),e=o.get("currentLanguage");0===this.locales.filter((a=>a.locale===e)).length&&o.set("currentLanguage",s)}async initPortalItemResourceT9nData(){try{const a=await v(this.portalItem);o.set("portalItemResource",a);const t=await m(this.request,a);o.set("portalItemResourceT9n",null!=t?t:{})}catch(a){}}render(){return n(s,{key:"fc32ca4cd8da2d20de670b77e7e6e324fbe15e80"},this.renderModal(),this.renderPopoverTip())}renderModal(){return n("calcite-modal",{open:this.open,scale:"l",fullscreen:!0,onCalciteModalClose:this.close.bind(this)},this.renderHeader(),this.renderContent(),this.renderPrimaryButton())}renderPopoverTip(){var a;return n("calcite-popover",{label:"",referenceElement:"headerTip",placement:"trailing","auto-close":!0,closable:!0},n("div",{class:b.headerTip},null===(a=this.messages)||void 0===a?void 0:a.headerTip))}renderHeader(){const a=o.get("saving");return n("header",{class:b.header,slot:"header"},this.renderHeaderText(),a?this.renderSavingIndicator():null)}renderHeaderText(){const{messages:a}=this;return n("div",{class:b.headerText},n("span",null,null==a?void 0:a.header),n("calcite-button",{id:"headerTip",appearance:"transparent"},n("calcite-icon",{icon:c.Popover,scale:"s"})))}renderSavingIndicator(){var a;const t=o.get("saving"),s=null===(a=this.messages)||void 0===a?void 0:a.saving;return n("div",{class:b.savingIndicator},t?n("calcite-loader",{label:s,inline:!0}):null,n("span",null,s))}renderContent(){const a=p(this.locales);return n("div",{slot:"content"},this.renderTopBar(),(null==a?void 0:a.length)>0?this.renderUIData():this.renderNotice())}renderTopBar(){return n("div",{class:b.topBar},this.renderLeadingTopBarSection(),this.renderTrailingTopBarSection())}renderLeadingTopBarSection(){return n("div",{class:b.topBarSection},this.renderUserLocale(),this.renderCollapseSearchContainer())}renderUserLocale(){var a;const t=null===(a=this.messages)||void 0===a?void 0:a.languages,s=h(this.el);return n("div",{class:b.userLangText},null==t?void 0:t[s])}renderCollapseSearchContainer(){return n("div",{class:b.collapseSearchContainer},this.renderExpandCollapseButton(),this.renderSearch())}renderExpandCollapseButton(){const{isCollapse:a,messages:t}=this,s=a?null==t?void 0:t.collapseAll:null==t?void 0:t.expandAll;return n(e,null,n("slot",{name:"primary-custom-action"}),n("slot",{name:"secondary-custom-action"}),n("calcite-button",{onClick:this.handleExpandCollapseAll.bind(this),appearance:"transparent","icon-start":c.ExpandCollapse},s))}renderSearch(){var a;return n("instant-apps-language-translator-search",{onSuggestionSelected:this.onSuggestionSelect.bind(this),t9nPlaceholder:null===(a=this.messages)||void 0===a?void 0:a.searchPlaceholder})}renderTrailingTopBarSection(){return n("div",{class:b.topBarSection},this.renderLanguageSelection(),n("slot",{name:"translation-custom-action"}))}renderLanguageSelection(){var a;return n("calcite-label",{layout:"inline"},null===(a=this.messages)||void 0===a?void 0:a.translatedLanguage,n("calcite-select",{label:"",onCalciteSelectChange:this.handleLanguageSelection.bind(this)},this.renderTranslatedLangOptions()))}renderTranslatedLangOptions(){const a=o.get("uiData"),t=null==a?void 0:a.get("locales"),s=p(t);return null==s?void 0:s.map((a=>{const{messages:t}=this,s=null==t?void 0:t.translatedLanguageNames,e=null==t?void 0:t.languages;return n("calcite-option",{key:`translated-lang-option-${a}`,value:a},`${null==s?void 0:s[a]} - ${null==e?void 0:e[a]}`)}))}renderUIData(){if(!(null==g?void 0:g.uiData))return;const a=u();return n("div",null,null==a?void 0:a.map(((t,n)=>this.renderUIDataItem(t,n,a.length))))}renderNotice(){var a;const t=null===(a=this.messages)||void 0===a?void 0:a.noLanguage;return n("calcite-notice",{open:!0,icon:"exclamation-mark-triangle",kind:"warning"},n("div",{slot:"title"},null==t?void 0:t.title),n("div",{slot:"message"},null==t?void 0:t.message))}renderUIDataItem(a,t,s){var e,i;const r=null===(i=null===(e=this.appSettings)||void 0===e?void 0:e.translatedLanguageLabels)||void 0===i?void 0:i[g.currentLanguage],l=`${t===s-1?b.lastItem:""}`,o=this.appSettings.content.filter((t=>t.id===a))[0];return n("instant-apps-language-translator-item",{key:`${a}-${t}`,class:l,fieldName:a,translatedLanguageLabels:r,setting:o,userLocaleInputOnChangeCallback:this.userLocaleInputOnChangeCallback,translatedLocaleInputOnChangeCallback:this.translatedLocaleInputOnChangeCallback})}renderPrimaryButton(){var a;return n("calcite-button",{onClick:()=>this.open=!1,slot:"primary",class:b.closeButton},null===(a=this.messages)||void 0===a?void 0:a.close)}handleExpandCollapseAll(){this.isCollapse=!this.isCollapse;const a=new Map(g.uiData);u().forEach((t=>a.get(t).expanded=this.isCollapse)),o.set("uiData",a)}onSuggestionSelect(a){const t=a.detail,n=new Map(g.uiData);u().forEach((a=>{n.get(a).selected=a===t})),o.set("uiData",n)}close(){this.open=!1}handleLanguageSelection(a){o.set("currentLanguage",a.target.value)}async getTranslationData(){return o.get("portalItemResourceT9n")}async setTranslationData(a){return o.set("portalItemResourceT9n",a)}async getPortalItemResource(){return o.get("portalItemResource")}async batchWriteToPortalItemResource(a){o.set("saving",!0);try{const t=await this.getPortalItemResource(),n=JSON.stringify(a),s=new Blob([n],{type:"application/json"});return await t.update(s),setTimeout((()=>o.set("saving",!1)),1500),this.translatorDataUpdated.emit(),Promise.resolve()}catch(a){return console.error("Error writing to portal item resource: ",a),o.set("saving",!1),Promise.reject()}}get el(){return i(this)}static get watchers(){return{locales:["handleLocaleChange"],appSettings:["handleAppSettings"]}}};f.style=".sc-instant-apps-language-translator-h{display:block}.sc-instant-apps-language-translator-h calcite-modal.sc-instant-apps-language-translator{--calcite-modal-content-padding:0}.sc-instant-apps-language-translator-h .instant-apps-language-translator__header.sc-instant-apps-language-translator{display:flex;justify-content:space-between;width:100%}.sc-instant-apps-language-translator-h .instant-apps-language-translator__header-text.sc-instant-apps-language-translator{font-size:18px}.sc-instant-apps-language-translator-h .instant-apps-language-translator__saving-indicator.sc-instant-apps-language-translator{display:flex;align-items:center;font-size:14.5px;color:var(--calcite-color-brand)}.sc-instant-apps-language-translator-h .instant-apps-language-translator__writing-icon.sc-instant-apps-language-translator{display:flex;justify-content:center;align-items:center;margin-right:5px}.sc-instant-apps-language-translator-h .instant-apps-language-translator__close-button.sc-instant-apps-language-translator{width:175px}.sc-instant-apps-language-translator-h .instant-apps-language-translator__header-tip.sc-instant-apps-language-translator{padding:20px;max-width:45vw}.sc-instant-apps-language-translator-h .instant-apps-language-translator__top-bar.sc-instant-apps-language-translator{display:flex;width:100%;position:sticky;top:0;background:var(--calcite-color-foreground-1);z-index:1}.sc-instant-apps-language-translator-h .instant-apps-language-translator__top-bar.sc-instant-apps-language-translator calcite-label.sc-instant-apps-language-translator{--calcite-label-margin-bottom:0;font-weight:var(--calcite-font-weight-medium)}.sc-instant-apps-language-translator-h .instant-apps-language-translator__top-bar-section.sc-instant-apps-language-translator{box-sizing:border-box;display:flex;align-items:center;width:50%;padding:0.5%}.sc-instant-apps-language-translator-h .instant-apps-language-translator__user-lang-text.sc-instant-apps-language-translator{font-weight:var(--calcite-font-weight-medium)}.sc-instant-apps-language-translator-h .instant-apps-language-translator__top-bar-section.sc-instant-apps-language-translator:first-child{display:flex;justify-content:space-between}.sc-instant-apps-language-translator-h .instant-apps-language-translator__top-bar-section.sc-instant-apps-language-translator:nth-child(2) calcite-select.sc-instant-apps-language-translator{width:255px}.sc-instant-apps-language-translator-h .instant-apps-language-translator__collapse-search-container.sc-instant-apps-language-translator{display:flex;justify-content:space-between}.sc-instant-apps-language-translator-h .instant-apps-language-translator__collapse-search-container.sc-instant-apps-language-translator calcite-input.sc-instant-apps-language-translator{width:300px;margin-left:30px}.ck.ck-reset.ck-editor.ck-rounded-corners.sc-instant-apps-language-translator{margin-top:10px !important;margin-left:55px !important}.ck-editor__editable.sc-instant-apps-language-translator{height:70px !important;font-size:0.875rem !important;line-height:1.375 !important}.ck.ck-editor__editable_inline.sc-instant-apps-language-translator>.sc-instant-apps-language-translator:first-child,.ck.ck-editor__editable_inline.sc-instant-apps-language-translator>.sc-instant-apps-language-translator:last-child{--ck-spacing-large:0.5rem !important}";export{f as instant_apps_language_translator}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
- import{r as a,c as x,h as e,H as t,g as n}from"./p-fa1ceaf9.js";import{g as m}from"./p-ffd41e25.js";import{n as l}from"./p-eed41e1a.js";import"./p-6a68306c.js";import"./p-d4056c1c.js";import"./p-3d7cff5e.js";import"./p-a230b270.js";import"./p-c1cf3ebc.js";
6
+ import{r as a,c as x,h as e,H as t,g as n}from"./p-fa1ceaf9.js";import{g as m}from"./p-c0bf1d9f.js";import{n as l}from"./p-eed41e1a.js";import"./p-0a24ad5f.js";import"./p-d4056c1c.js";import"./p-3d7cff5e.js";import"./p-a230b270.js";import"./p-c1cf3ebc.js";
7
7
  /** @license
8
8
  * Copyright 2022 Esri
9
9
  *