@geoscene/core 4.23.9 → 4.23.12

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.
Files changed (229) hide show
  1. package/assets/geoscene/core/workers/chunks/6f827a32646bab0a8777.js +1 -1
  2. package/assets/geoscene/core/workers/chunks/7f91f70ef69a7e24f8e2.js +1 -1
  3. package/assets/geoscene/core/workers/chunks/85fde4b92b0c212f5ff6.js +1 -1
  4. package/assets/geoscene/core/workers/chunks/9f458f10dc65b185f66e.js +1 -1
  5. package/assets/geoscene/themes/base/_Overlay.scss +2 -2
  6. package/assets/geoscene/themes/base/_OverlayItem.scss +12 -12
  7. package/assets/geoscene/themes/base/_Ui.scss +32 -32
  8. package/assets/geoscene/themes/base/_View.scss +31 -31
  9. package/assets/geoscene/themes/base/_animation.scss +6 -6
  10. package/assets/geoscene/themes/base/_core.scss +2 -2
  11. package/assets/geoscene/themes/base/_mixins.scss +43 -43
  12. package/assets/geoscene/themes/base/icons/style.css +190 -190
  13. package/assets/geoscene/themes/base/icons/style.scss +376 -376
  14. package/assets/geoscene/themes/base/icons/variables.scss +187 -187
  15. package/assets/geoscene/themes/base/widgets/_AreaMeasurement2D.scss +4 -4
  16. package/assets/geoscene/themes/base/widgets/_AreaMeasurement3D.scss +4 -4
  17. package/assets/geoscene/themes/base/widgets/_Attachments.scss +48 -48
  18. package/assets/geoscene/themes/base/widgets/_Attribution.scss +9 -9
  19. package/assets/geoscene/themes/base/widgets/_BasemapGallery.scss +39 -39
  20. package/assets/geoscene/themes/base/widgets/_BasemapLayerList.scss +100 -100
  21. package/assets/geoscene/themes/base/widgets/_BasemapToggle.scss +22 -22
  22. package/assets/geoscene/themes/base/widgets/_BinaryColorSizeSlider.scss +2 -2
  23. package/assets/geoscene/themes/base/widgets/_Bookmarks.scss +48 -48
  24. package/assets/geoscene/themes/base/widgets/_BuildingDisciplinesTree.scss +3 -3
  25. package/assets/geoscene/themes/base/widgets/_BuildingExplorer.scss +4 -4
  26. package/assets/geoscene/themes/base/widgets/_BuildingLevelPicker.scss +4 -4
  27. package/assets/geoscene/themes/base/widgets/_BuildingPhasePicker.scss +4 -4
  28. package/assets/geoscene/themes/base/widgets/_ButtonMenu.scss +21 -21
  29. package/assets/geoscene/themes/base/widgets/_ClassedColorSlider.scss +2 -2
  30. package/assets/geoscene/themes/base/widgets/_ClassedSizeSlider.scss +2 -2
  31. package/assets/geoscene/themes/base/widgets/_ColorPicker.scss +3 -3
  32. package/assets/geoscene/themes/base/widgets/_ColorSizeSlider.scss +2 -2
  33. package/assets/geoscene/themes/base/widgets/_ColorSlider.scss +2 -2
  34. package/assets/geoscene/themes/base/widgets/_Compass.scss +3 -3
  35. package/assets/geoscene/themes/base/widgets/_CoordinateConversion.scss +51 -51
  36. package/assets/geoscene/themes/base/widgets/_DatePicker.scss +34 -34
  37. package/assets/geoscene/themes/base/widgets/_Daylight.scss +63 -63
  38. package/assets/geoscene/themes/base/widgets/_DirectLineMeasurement3D.scss +2 -2
  39. package/assets/geoscene/themes/base/widgets/_Directions.scss +98 -98
  40. package/assets/geoscene/themes/base/widgets/_DistanceMeasurement2D.scss +2 -2
  41. package/assets/geoscene/themes/base/widgets/_Editor.scss +56 -56
  42. package/assets/geoscene/themes/base/widgets/_ElevationProfile.scss +19 -19
  43. package/assets/geoscene/themes/base/widgets/_Expand.scss +58 -58
  44. package/assets/geoscene/themes/base/widgets/_Feature.scss +13 -13
  45. package/assets/geoscene/themes/base/widgets/_FeatureContent.scss +24 -24
  46. package/assets/geoscene/themes/base/widgets/_FeatureForm.scss +36 -36
  47. package/assets/geoscene/themes/base/widgets/_FeatureMedia.scss +17 -17
  48. package/assets/geoscene/themes/base/widgets/_FeatureTable.scss +26 -26
  49. package/assets/geoscene/themes/base/widgets/_FeatureTemplates.scss +9 -9
  50. package/assets/geoscene/themes/base/widgets/_FloorFilter.scss +93 -93
  51. package/assets/geoscene/themes/base/widgets/_Grid.scss +6 -6
  52. package/assets/geoscene/themes/base/widgets/_HeatmapSlider.scss +2 -2
  53. package/assets/geoscene/themes/base/widgets/_Histogram.scss +10 -10
  54. package/assets/geoscene/themes/base/widgets/_HistogramRangeSlider.scss +27 -27
  55. package/assets/geoscene/themes/base/widgets/_IdentityForm.scss +5 -5
  56. package/assets/geoscene/themes/base/widgets/_IdentityModal.scss +13 -13
  57. package/assets/geoscene/themes/base/widgets/_ItemList.scss +18 -18
  58. package/assets/geoscene/themes/base/widgets/_LayerList.scss +89 -89
  59. package/assets/geoscene/themes/base/widgets/_Legend.scss +95 -95
  60. package/assets/geoscene/themes/base/widgets/_LineOfSight.scss +9 -9
  61. package/assets/geoscene/themes/base/widgets/_NavigationToggle.scss +14 -14
  62. package/assets/geoscene/themes/base/widgets/_OpacitySlider.scss +2 -2
  63. package/assets/geoscene/themes/base/widgets/_Popup.scss +167 -167
  64. package/assets/geoscene/themes/base/widgets/_Print.scss +52 -52
  65. package/assets/geoscene/themes/base/widgets/_ScaleBar.scss +28 -28
  66. package/assets/geoscene/themes/base/widgets/_ScaleRangeSlider.scss +29 -29
  67. package/assets/geoscene/themes/base/widgets/_Search.scss +50 -50
  68. package/assets/geoscene/themes/base/widgets/_SearchResultRenderer.scss +7 -7
  69. package/assets/geoscene/themes/base/widgets/_SelectionToolbar.scss +3 -3
  70. package/assets/geoscene/themes/base/widgets/_ShadowCast.scss +17 -17
  71. package/assets/geoscene/themes/base/widgets/_SizeSlider.scss +2 -2
  72. package/assets/geoscene/themes/base/widgets/_Sketch.scss +24 -24
  73. package/assets/geoscene/themes/base/widgets/_Slice.scss +5 -5
  74. package/assets/geoscene/themes/base/widgets/_Slider.scss +70 -70
  75. package/assets/geoscene/themes/base/widgets/_SnappingControls.scss +16 -16
  76. package/assets/geoscene/themes/base/widgets/_Spinner.scss +12 -12
  77. package/assets/geoscene/themes/base/widgets/_Swipe.scss +15 -15
  78. package/assets/geoscene/themes/base/widgets/_TableList.scss +57 -57
  79. package/assets/geoscene/themes/base/widgets/_TimePicker.scss +3 -3
  80. package/assets/geoscene/themes/base/widgets/_TimeSlider.scss +28 -28
  81. package/assets/geoscene/themes/base/widgets/_UtilityNetworkTrace.scss +8 -8
  82. package/assets/geoscene/themes/base/widgets/_Weather.scss +2 -2
  83. package/assets/geoscene/themes/base/widgets/_Widget.scss +95 -95
  84. package/assets/geoscene/themes/base/widgets/_Zoom.scss +8 -8
  85. package/assets/geoscene/themes/dark/main.css +1 -1
  86. package/assets/geoscene/themes/dark/main.scss +3 -3
  87. package/assets/geoscene/themes/dark-blue/main.css +1 -1
  88. package/assets/geoscene/themes/dark-blue/main.scss +3 -3
  89. package/assets/geoscene/themes/dark-green/main.css +1 -1
  90. package/assets/geoscene/themes/dark-green/main.scss +3 -3
  91. package/assets/geoscene/themes/dark-purple/main.css +1 -1
  92. package/assets/geoscene/themes/dark-purple/main.scss +3 -3
  93. package/assets/geoscene/themes/dark-red/main.css +1 -1
  94. package/assets/geoscene/themes/dark-red/main.scss +3 -3
  95. package/assets/geoscene/themes/light/main.css +1 -1
  96. package/assets/geoscene/themes/light/main.scss +2 -2
  97. package/assets/geoscene/themes/light/view.css +1 -1
  98. package/assets/geoscene/themes/light-blue/main.css +1 -1
  99. package/assets/geoscene/themes/light-blue/main.scss +3 -3
  100. package/assets/geoscene/themes/light-green/main.css +1 -1
  101. package/assets/geoscene/themes/light-green/main.scss +3 -3
  102. package/assets/geoscene/themes/light-purple/main.css +1 -1
  103. package/assets/geoscene/themes/light-purple/main.scss +3 -3
  104. package/assets/geoscene/themes/light-red/main.css +1 -1
  105. package/assets/geoscene/themes/light-red/main.scss +3 -3
  106. package/identity/IdentityForm.js +1 -1
  107. package/identity/IdentityManagerBase.js +1 -1
  108. package/identity/IdentityModal.js +1 -1
  109. package/interfaces.d.ts +1 -1
  110. package/package.json +1 -1
  111. package/portal/schemas/definitions.js +1 -1
  112. package/portal/schemas/sceneLayerItem.js +1 -1
  113. package/support/basemapDefinitions.js +1 -1
  114. package/support/groundUtils.js +1 -1
  115. package/symbols/support/styleUtils.js +1 -1
  116. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  117. package/views/2d/layers/support/clusterUtils.js +1 -1
  118. package/views/2d/navigation/ZoomBox.js +1 -1
  119. package/views/3d/externalRenderers.js +1 -1
  120. package/views/3d/layers/I3SMeshView3D.js +1 -1
  121. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  122. package/views/BreakpointsOwner.js +1 -1
  123. package/views/DOMContainer.js +1 -1
  124. package/views/input/BrowserEventSource.js +1 -1
  125. package/views/overlay/LineOverlayItem.js +1 -1
  126. package/views/overlay/TextOverlayItem.js +1 -1
  127. package/views/overlay/ViewOverlay.js +1 -1
  128. package/views/ui/Component.js +1 -1
  129. package/views/ui/UI.js +1 -1
  130. package/views/webgl/context-util.js +1 -1
  131. package/widgets/AreaMeasurement2D.js +1 -1
  132. package/widgets/AreaMeasurement3D.js +1 -1
  133. package/widgets/Attachments.js +1 -1
  134. package/widgets/Attribution.js +1 -1
  135. package/widgets/BasemapGallery.js +1 -1
  136. package/widgets/BasemapLayerList.js +1 -1
  137. package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
  138. package/widgets/BasemapToggle.js +1 -1
  139. package/widgets/Bookmarks.js +1 -1
  140. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
  141. package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
  142. package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
  143. package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
  144. package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
  145. package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
  146. package/widgets/BuildingExplorer.js +1 -1
  147. package/widgets/Compass.js +1 -1
  148. package/widgets/CoordinateConversion.js +1 -1
  149. package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
  150. package/widgets/Daylight.js +1 -1
  151. package/widgets/DirectLineMeasurement3D.js +1 -1
  152. package/widgets/Directions/support/resources.js +1 -1
  153. package/widgets/Directions.js +1 -1
  154. package/widgets/DistanceMeasurement2D.js +1 -1
  155. package/widgets/Editor/deprecationUtils.js +1 -1
  156. package/widgets/Editor.js +1 -1
  157. package/widgets/ElevationProfile/css.js +1 -1
  158. package/widgets/Expand.js +1 -1
  159. package/widgets/Feature/FeatureAttachments.js +1 -1
  160. package/widgets/Feature/FeatureContent.js +1 -1
  161. package/widgets/Feature/FeatureExpression.js +1 -1
  162. package/widgets/Feature/FeatureFields.js +1 -1
  163. package/widgets/Feature/FeatureMedia.js +1 -1
  164. package/widgets/Feature/support/FeatureElementInfo.js +1 -1
  165. package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
  166. package/widgets/Feature/support/featureUtils.js +1 -1
  167. package/widgets/Feature.js +1 -1
  168. package/widgets/FeatureForm.js +1 -1
  169. package/widgets/FeatureTable/AttachmentsColumn.js +1 -1
  170. package/widgets/FeatureTable/FieldColumn.js +1 -1
  171. package/widgets/FeatureTable/Grid/Column.js +1 -1
  172. package/widgets/FeatureTable/Grid/EditorColumn.js +1 -1
  173. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  174. package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
  175. package/widgets/FeatureTable.js +1 -1
  176. package/widgets/FeatureTemplates/ItemList.js +1 -1
  177. package/widgets/FeatureTemplates.js +1 -1
  178. package/widgets/FloorFilter.js +1 -1
  179. package/widgets/Fullscreen.js +1 -1
  180. package/widgets/Histogram.js +1 -1
  181. package/widgets/HistogramRangeSlider.js +1 -1
  182. package/widgets/Home.js +1 -1
  183. package/widgets/LayerList/ListItemPanel.js +1 -1
  184. package/widgets/LayerList.js +1 -1
  185. package/widgets/Legend/styles/Card.js +1 -1
  186. package/widgets/Legend/styles/Classic.js +1 -1
  187. package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
  188. package/widgets/Legend/styles/support/univariateUtils.js +1 -1
  189. package/widgets/Legend.js +1 -1
  190. package/widgets/LineOfSight.js +1 -1
  191. package/widgets/Locate.js +1 -1
  192. package/widgets/Measurement.js +1 -1
  193. package/widgets/NavigationToggle.js +1 -1
  194. package/widgets/Popup.js +1 -1
  195. package/widgets/Print.js +1 -1
  196. package/widgets/ScaleBar.js +1 -1
  197. package/widgets/ScaleRangeSlider.js +1 -1
  198. package/widgets/Search/SearchResultRenderer.js +1 -1
  199. package/widgets/Search.js +1 -1
  200. package/widgets/ShadowCast/css.js +1 -1
  201. package/widgets/Sketch.js +1 -1
  202. package/widgets/Slice.js +1 -1
  203. package/widgets/Slider.js +1 -1
  204. package/widgets/Spinner.js +1 -1
  205. package/widgets/Swipe.js +1 -1
  206. package/widgets/TableList.js +1 -1
  207. package/widgets/TimeSlider.js +1 -1
  208. package/widgets/Track.js +1 -1
  209. package/widgets/UtilityNetworkTrace.js +1 -1
  210. package/widgets/Weather/css.js +1 -1
  211. package/widgets/Widget.js +1 -1
  212. package/widgets/Zoom/IconButton.js +1 -1
  213. package/widgets/Zoom.js +1 -1
  214. package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
  215. package/widgets/smartMapping/ClassedColorSlider.js +1 -1
  216. package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
  217. package/widgets/smartMapping/ColorSizeSlider.js +1 -1
  218. package/widgets/smartMapping/ColorSlider.js +1 -1
  219. package/widgets/smartMapping/HeatmapSlider.js +1 -1
  220. package/widgets/smartMapping/OpacitySlider.js +1 -1
  221. package/widgets/smartMapping/SizeSlider.js +1 -1
  222. package/widgets/support/ColorPicker.js +1 -1
  223. package/widgets/support/DatePicker.js +1 -1
  224. package/widgets/support/Heading.js +1 -1
  225. package/widgets/support/Popover.js +1 -1
  226. package/widgets/support/SelectionToolbar.js +1 -1
  227. package/widgets/support/SnappingControls.js +1 -1
  228. package/widgets/support/TimePicker.js +1 -1
  229. package/widgets/support/widgetThemeUtils.js +1 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import"../../../intl.js";import e from"../../../core/Logger.js";import{isNone as t,isSome as r}from"../../../core/maybe.js";import{replace as n}from"../../../core/string.js";import{formatDate as i,convertDateFormatToIntlOptions as o}from"../../../intl/date.js";import{formatNumber as a,convertNumberFormatToIntlOptions as u}from"../../../intl/number.js";import{featureHasFields as l}from"../../../layers/support/fieldUtils.js";import s from"../../../popup/support/FieldInfoFormat.js";import{loadArcade as f}from"../../../support/arcadeOnDemand.js";const c="geoscene.widgets.Feature.support.featureUtils",d=e.getLogger(c),p=/href=(""|'')/gi,m=/(\{([^\{\r\n]+)\})/g,y=/\'/g,g=/^\s*expression\//i,h=/(\n)/gi,b=/[\u00A0-\u9999<>\&]/gim,F=/href\s*=\s*(?:\"([^\"]+)\"|\'([^\']+)\')/gi,I=/^(?:mailto:|tel:)/,w="relationships/",N=o("short-date-short-time");function x(e){if(!t(e))return e.get("sourceLayer")||e.get("layer")}async function E(e,t){return"function"==typeof e?e.call(null,t):e}function v(e=""){if(e)return!I.test(e.trim().toLowerCase())}function j(e){return!!e&&g.test(e)}function T(e,t){if(!j(t)||!e)return null;const r=t.replace(g,"").toLowerCase();let n;return e.some((e=>e.name.toLowerCase()===r&&(n=e,!0))),n}function C(e,t){const r=T(t,null==e?void 0:e.fieldName);return r?r.title||null:e?e.label||e.fieldName:null}function q(e,t){const r=t.get(e.toLowerCase());return`{${r&&r.fieldName||e}}`}function D(e){return e.replace(p,"")}function R(e,t){const r=M(t,e);return r?r.name:e}function L(e,t){return e&&e.map((e=>R(e,t)))}function M(e,t){return e&&"function"==typeof e.getField?e.getField(t):null}function U(e){return`${e}`.trim()}function $({attributes:e,globalAttributes:t,layer:r,text:n,expressionAttributes:i,fieldInfoMap:o}){return n?A({formattedAttributes:t,template:P(n,{...t,...i,...e},r),fieldInfoMap:o}):""}function A({formattedAttributes:e,template:t,fieldInfoMap:r}){return U(D(n(n(t,(e=>q(e,r))),e)))}function O(e,t,r=!1){const n=t[e];if("string"==typeof n){const i="%27",o=(r?encodeURIComponent(n):n).replace(y,i);t[e]=o}}function S(e,t=!1){const r={...e};return Object.keys(r).forEach((e=>O(e,r,t))),r}function G(e,t,r){const i=(t=U(t))&&"{"!==t[0];return n(e,S(r,i))}function k(e,t){return e.replace(m,((e,r,n)=>{const i=M(t,n);return i?`{${i.name}}`:r}))}function P(e,t,r){const n=k(e,r);return n?n.replace(F,((e,r,n)=>G(e,r||n,t))):n}function _(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function z(e){return"feature"===(null==e?void 0:e.type)}function H(e){return"map-image"===(null==e?void 0:e.type)}function Q(e){return!(null==e||!e.layer)}function Z(e,t){const r=t.fieldInfos,n=t.fieldName,i=B(r,n),o=null==i?void 0:i.clone(),l=t.preventPlacesFormatting,f=t.layer,c=M(f,n);if(o&&"date"===(null==c?void 0:c.type)){const e=o.format||new s;e.dateFormat=e.dateFormat||"short-date-short-time",e.dateTimeFormatOptions=z(f)&&f.datesInUnknownTimezone||Q(f)&&H(f.layer)&&f.layer.datesInUnknownTimezone?{timeZone:"UTC"}:null,o.format=e}const d=o&&o.format;return"string"==typeof(e=_(e,d))||null==e||null==d?ee(e):l?a(e,{...u(d),minimumFractionDigits:0,maximumFractionDigits:20}):d.format(e)}function B(e,t){if(!e||!e.length||!t)return;const r=t.toLowerCase();let n;return e.some((e=>!(!e.fieldName||e.fieldName.toLowerCase()!==r)&&(n=e,!0))),n}function J({fieldName:e,graphic:t,layer:r}){if(ae(e))return null;if(!r||"function"!=typeof r.getFeatureType)return null;const{typeIdField:n}=r;if(!n||e!==n)return null;const i=r.getFeatureType(t);return i?i.name:null}function K({fieldName:e,value:t,graphic:r,layer:n}){if(ae(e))return null;if(!n||"function"!=typeof n.getFieldDomain)return null;const i=n.getFieldDomain(e,{feature:r});return i&&"coded-value"===i.type?i.getName(t):null}function V(e,t){const{creatorField:r,creationDateField:n,editorField:o,editDateField:a}=e;if(!t)return;const u=t[a];if("number"==typeof u){const e=t[o];return{type:"edit",date:i(u,N),user:e}}const l=t[n];if("number"==typeof l){const e=t[r];return{type:"create",date:i(l,N),user:e}}return null}function W(e,t){const r=new Map;return e&&e.forEach((e=>{const n=R(e.fieldName,t);e.fieldName=n,r.set(n.toLowerCase(),e)})),r}function X(e){const t=[];if(!e)return t;const{fieldInfos:r,content:n}=e;return r&&t.push(...r),n&&Array.isArray(n)?(n.forEach((e=>{if("fields"===e.type){const r=e&&e.fieldInfos;r&&t.push(...r)}})),t):t}function Y(e){return e.replace(b,(e=>`&#${e.charCodeAt(0)};`))}function ee(e){return"string"==typeof e?e.replace(h,'<br class="esri-text-new-line" />'):e}function te(e){const{value:t,fieldName:r,fieldInfos:n,fieldInfoMap:o,layer:a,graphic:u}=e;if(null==t)return"";const l=K({fieldName:r,value:t,graphic:u,layer:a});if(l)return l;const s=J({fieldName:r,graphic:u,layer:a});if(s)return s;if(o.get(r.toLowerCase()))return Z(t,{fieldInfos:n,fieldName:r,layer:a});const f=a&&a.fieldsIndex;return f&&f.isDateField(r)?i(t,N):ee(t)}function re({fieldInfos:e,attributes:t,layer:r,graphic:n,fieldInfoMap:i,relatedInfos:o}){const a={};return null==o||o.forEach((e=>se(a,e))),Object.keys(t).forEach((o=>{const u=t[o];a[o]=te({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:r,value:u,graphic:n})})),a}async function ne(e,t){var r,n;const{layer:i,graphic:o,outFields:a,objectIds:u,returnGeometry:l,spatialReference:s}=e,f=u[0];if("number"!=typeof f&&"string"!=typeof f){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:i,graphic:o,objectId:f,requiredFields:a};return d.warn(e,t),null}if(null==(r=i.capabilities)||null==(n=r.operations)||!n.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:i,graphic:o,requiredFields:a,returnGeometry:l};return d.warn(e,t),null}const c=i.createQuery();c.objectIds=u,c.outFields=null!=a&&a.length?a:[i.objectIdField],c.returnGeometry=!!l,c.returnZ=!!l,c.returnM=!!l,c.outSpatialReference=s;return(await i.queryFeatures(c,t)).features[0]}async function ie(e){var t;if(null==(t=e.expressionInfos)||!t.length)return!1;const r=await f(),{arcadeUtils:{hasGeometryFunctions:n}}=r;return n(e)}async function oe({graphic:e,popupTemplate:t,layer:r,spatialReference:n},i){if(!r||!t)return;if("function"==typeof r.load&&await r.load(i),!e.attributes)return;const o=e.attributes[r.objectIdField];if(null==o)return;const a=[o],u=await t.getRequiredFields(r.fieldsIndex),s=l(u,e),f=s?[]:u,c=t.returnGeometry||await ie(t);if(s&&!c)return;const d=await ne({layer:r,graphic:e,outFields:f,objectIds:a,returnGeometry:c,spatialReference:n},i);d&&(d.geometry&&(e.geometry=d.geometry),d.attributes&&(e.attributes={...e.attributes,...d.attributes}))}function ae(e=""){return!!e&&-1!==e.indexOf(w)}function ue(e){return e?`${w}${e.layerId}/${e.fieldName}`:""}function le({attributes:e,graphic:t,relatedInfo:r}){e&&t&&r&&Object.keys(t.attributes).forEach((n=>{const i=ue({layerId:r.relation.id.toString(),fieldName:n});e[i]=t.attributes[n]}))}function se(e,t){e&&t&&(t.relatedFeatures&&t.relatedFeatures&&t.relatedFeatures.forEach((r=>le({attributes:e,graphic:r,relatedInfo:t}))),t.relatedStatsFeatures&&t.relatedStatsFeatures&&t.relatedStatsFeatures.forEach((r=>le({attributes:e,graphic:r,relatedInfo:t}))))}const fe=e=>{if(!e)return!1;const t=e.toUpperCase();return t.indexOf("CURRENT_TIMESTAMP")>-1||t.indexOf("CURRENT_DATE")>-1||t.indexOf("CURRENT_TIME")>-1},ce=({layer:e,method:t,query:n,definitionExpression:i})=>{var o,a;if(null==(o=e.capabilities)||null==(a=o.query)||!a.supportsCacheHint||"attachments"===t)return;const u=r(n.where)&&n.where,l=r(n.geometry)&&n.geometry;fe(i)||fe(u)||"extent"===(null==l?void 0:l.type)||"tile"===n.resultType||(n.cacheHint=!0)},de=({query:e,layer:t,method:r})=>{ce({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})},pe=({queryPayload:e,layer:t,method:r})=>{ce({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})};export{ee as applyTextFormattingHTML,W as createfieldInfoMap,k as fixTokens,re as formatAttributes,V as formatEditInfo,Z as formatValueToFieldInfo,X as getAllFieldInfos,B as getFieldInfo,C as getFieldInfoLabel,R as getFixedFieldName,L as getFixedFieldNames,x as getSourceLayer,E as graphicCallback,Y as htmlEntities,j as isExpressionField,ae as isRelatedField,de as preLayerQueryCallback,pe as preRequestCallback,oe as queryUpdatedFeature,v as shouldOpenInNewTab,A as substituteAttributes,$ as substituteFieldsInLinksAndAttributes};
5
+ import"../../../intl.js";import e from"../../../core/Logger.js";import{isNone as t,isSome as r}from"../../../core/maybe.js";import{replace as n}from"../../../core/string.js";import{formatDate as i,convertDateFormatToIntlOptions as o}from"../../../intl/date.js";import{formatNumber as a,convertNumberFormatToIntlOptions as u}from"../../../intl/number.js";import{featureHasFields as l}from"../../../layers/support/fieldUtils.js";import s from"../../../popup/support/FieldInfoFormat.js";import{loadArcade as f}from"../../../support/arcadeOnDemand.js";const c="geoscene.widgets.Feature.support.featureUtils",d=e.getLogger(c),p=/href=(""|'')/gi,m=/(\{([^\{\r\n]+)\})/g,y=/\'/g,g=/^\s*expression\//i,h=/(\n)/gi,b=/[\u00A0-\u9999<>\&]/gim,F=/href\s*=\s*(?:\"([^\"]+)\"|\'([^\']+)\')/gi,I=/^(?:mailto:|tel:)/,w="relationships/",N=o("short-date-short-time");function x(e){if(!t(e))return e.get("sourceLayer")||e.get("layer")}async function E(e,t){return"function"==typeof e?e.call(null,t):e}function v(e=""){if(e)return!I.test(e.trim().toLowerCase())}function j(e){return!!e&&g.test(e)}function T(e,t){if(!j(t)||!e)return null;const r=t.replace(g,"").toLowerCase();let n;return e.some((e=>e.name.toLowerCase()===r&&(n=e,!0))),n}function C(e,t){const r=T(t,null==e?void 0:e.fieldName);return r?r.title||null:e?e.label||e.fieldName:null}function q(e,t){const r=t.get(e.toLowerCase());return`{${r&&r.fieldName||e}}`}function D(e){return e.replace(p,"")}function R(e,t){const r=M(t,e);return r?r.name:e}function L(e,t){return e&&e.map((e=>R(e,t)))}function M(e,t){return e&&"function"==typeof e.getField?e.getField(t):null}function U(e){return`${e}`.trim()}function $({attributes:e,globalAttributes:t,layer:r,text:n,expressionAttributes:i,fieldInfoMap:o}){return n?A({formattedAttributes:t,template:P(n,{...t,...i,...e},r),fieldInfoMap:o}):""}function A({formattedAttributes:e,template:t,fieldInfoMap:r}){return U(D(n(n(t,(e=>q(e,r))),e)))}function O(e,t,r=!1){const n=t[e];if("string"==typeof n){const i="%27",o=(r?encodeURIComponent(n):n).replace(y,i);t[e]=o}}function S(e,t=!1){const r={...e};return Object.keys(r).forEach((e=>O(e,r,t))),r}function G(e,t,r){const i=(t=U(t))&&"{"!==t[0];return n(e,S(r,i))}function k(e,t){return e.replace(m,((e,r,n)=>{const i=M(t,n);return i?`{${i.name}}`:r}))}function P(e,t,r){const n=k(e,r);return n?n.replace(F,((e,r,n)=>G(e,r||n,t))):n}function _(e,t){if("string"==typeof e&&t&&null==t.dateFormat&&(null!=t.places||null!=t.digitSeparator)){const t=Number(e);if(!isNaN(t))return t}return e}function z(e){return"feature"===(null==e?void 0:e.type)}function H(e){return"map-image"===(null==e?void 0:e.type)}function Q(e){return!(null==e||!e.layer)}function Z(e,t){const r=t.fieldInfos,n=t.fieldName,i=B(r,n),o=null==i?void 0:i.clone(),l=t.preventPlacesFormatting,f=t.layer,c=M(f,n);if(o&&"date"===(null==c?void 0:c.type)){const e=o.format||new s;e.dateFormat=e.dateFormat||"short-date-short-time",e.dateTimeFormatOptions=z(f)&&f.datesInUnknownTimezone||Q(f)&&H(f.layer)&&f.layer.datesInUnknownTimezone?{timeZone:"UTC"}:null,o.format=e}const d=o&&o.format;return"string"==typeof(e=_(e,d))||null==e||null==d?ee(e):l?a(e,{...u(d),minimumFractionDigits:0,maximumFractionDigits:20}):d.format(e)}function B(e,t){if(!e||!e.length||!t)return;const r=t.toLowerCase();let n;return e.some((e=>!(!e.fieldName||e.fieldName.toLowerCase()!==r)&&(n=e,!0))),n}function J({fieldName:e,graphic:t,layer:r}){if(ae(e))return null;if(!r||"function"!=typeof r.getFeatureType)return null;const{typeIdField:n}=r;if(!n||e!==n)return null;const i=r.getFeatureType(t);return i?i.name:null}function K({fieldName:e,value:t,graphic:r,layer:n}){if(ae(e))return null;if(!n||"function"!=typeof n.getFieldDomain)return null;const i=n.getFieldDomain(e,{feature:r});return i&&"coded-value"===i.type?i.getName(t):null}function V(e,t){const{creatorField:r,creationDateField:n,editorField:o,editDateField:a}=e;if(!t)return;const u=t[a];if("number"==typeof u){const e=t[o];return{type:"edit",date:i(u,N),user:e}}const l=t[n];if("number"==typeof l){const e=t[r];return{type:"create",date:i(l,N),user:e}}return null}function W(e,t){const r=new Map;return e&&e.forEach((e=>{const n=R(e.fieldName,t);e.fieldName=n,r.set(n.toLowerCase(),e)})),r}function X(e){const t=[];if(!e)return t;const{fieldInfos:r,content:n}=e;return r&&t.push(...r),n&&Array.isArray(n)?(n.forEach((e=>{if("fields"===e.type){const r=e&&e.fieldInfos;r&&t.push(...r)}})),t):t}function Y(e){return e.replace(b,(e=>`&#${e.charCodeAt(0)};`))}function ee(e){return"string"==typeof e?e.replace(h,'<br class="geoscene-text-new-line" />'):e}function te(e){const{value:t,fieldName:r,fieldInfos:n,fieldInfoMap:o,layer:a,graphic:u}=e;if(null==t)return"";const l=K({fieldName:r,value:t,graphic:u,layer:a});if(l)return l;const s=J({fieldName:r,graphic:u,layer:a});if(s)return s;if(o.get(r.toLowerCase()))return Z(t,{fieldInfos:n,fieldName:r,layer:a});const f=a&&a.fieldsIndex;return f&&f.isDateField(r)?i(t,N):ee(t)}function re({fieldInfos:e,attributes:t,layer:r,graphic:n,fieldInfoMap:i,relatedInfos:o}){const a={};return null==o||o.forEach((e=>se(a,e))),Object.keys(t).forEach((o=>{const u=t[o];a[o]=te({fieldName:o,fieldInfos:e,fieldInfoMap:i,layer:r,value:u,graphic:n})})),a}async function ne(e,t){var r,n;const{layer:i,graphic:o,outFields:a,objectIds:u,returnGeometry:l,spatialReference:s}=e,f=u[0];if("number"!=typeof f&&"string"!=typeof f){const e="Could not query required fields for the specified feature. The feature's ID is invalid.",t={layer:i,graphic:o,objectId:f,requiredFields:a};return d.warn(e,t),null}if(null==(r=i.capabilities)||null==(n=r.operations)||!n.supportsQuery){const e="The specified layer cannot be queried. The following fields will not be available.",t={layer:i,graphic:o,requiredFields:a,returnGeometry:l};return d.warn(e,t),null}const c=i.createQuery();c.objectIds=u,c.outFields=null!=a&&a.length?a:[i.objectIdField],c.returnGeometry=!!l,c.returnZ=!!l,c.returnM=!!l,c.outSpatialReference=s;return(await i.queryFeatures(c,t)).features[0]}async function ie(e){var t;if(null==(t=e.expressionInfos)||!t.length)return!1;const r=await f(),{arcadeUtils:{hasGeometryFunctions:n}}=r;return n(e)}async function oe({graphic:e,popupTemplate:t,layer:r,spatialReference:n},i){if(!r||!t)return;if("function"==typeof r.load&&await r.load(i),!e.attributes)return;const o=e.attributes[r.objectIdField];if(null==o)return;const a=[o],u=await t.getRequiredFields(r.fieldsIndex),s=l(u,e),f=s?[]:u,c=t.returnGeometry||await ie(t);if(s&&!c)return;const d=await ne({layer:r,graphic:e,outFields:f,objectIds:a,returnGeometry:c,spatialReference:n},i);d&&(d.geometry&&(e.geometry=d.geometry),d.attributes&&(e.attributes={...e.attributes,...d.attributes}))}function ae(e=""){return!!e&&-1!==e.indexOf(w)}function ue(e){return e?`${w}${e.layerId}/${e.fieldName}`:""}function le({attributes:e,graphic:t,relatedInfo:r}){e&&t&&r&&Object.keys(t.attributes).forEach((n=>{const i=ue({layerId:r.relation.id.toString(),fieldName:n});e[i]=t.attributes[n]}))}function se(e,t){e&&t&&(t.relatedFeatures&&t.relatedFeatures&&t.relatedFeatures.forEach((r=>le({attributes:e,graphic:r,relatedInfo:t}))),t.relatedStatsFeatures&&t.relatedStatsFeatures&&t.relatedStatsFeatures.forEach((r=>le({attributes:e,graphic:r,relatedInfo:t}))))}const fe=e=>{if(!e)return!1;const t=e.toUpperCase();return t.indexOf("CURRENT_TIMESTAMP")>-1||t.indexOf("CURRENT_DATE")>-1||t.indexOf("CURRENT_TIME")>-1},ce=({layer:e,method:t,query:n,definitionExpression:i})=>{var o,a;if(null==(o=e.capabilities)||null==(a=o.query)||!a.supportsCacheHint||"attachments"===t)return;const u=r(n.where)&&n.where,l=r(n.geometry)&&n.geometry;fe(i)||fe(u)||"extent"===(null==l?void 0:l.type)||"tile"===n.resultType||(n.cacheHint=!0)},de=({query:e,layer:t,method:r})=>{ce({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})},pe=({queryPayload:e,layer:t,method:r})=>{ce({layer:t,method:r,query:e,definitionExpression:`${t.definitionExpression} ${t.serviceDefinitionExpression}`})};export{ee as applyTextFormattingHTML,W as createfieldInfoMap,k as fixTokens,re as formatAttributes,V as formatEditInfo,Z as formatValueToFieldInfo,X as getAllFieldInfos,B as getFieldInfo,C as getFieldInfoLabel,R as getFixedFieldName,L as getFixedFieldNames,x as getSourceLayer,E as graphicCallback,Y as htmlEntities,j as isExpressionField,ae as isRelatedField,de as preLayerQueryCallback,pe as preRequestCallback,oe as queryUpdatedFeature,v as shouldOpenInNewTab,A as substituteAttributes,$ as substituteFieldsInLinksAndAttributes};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{init as t}from"../core/watchUtils.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as i}from"../core/accessorSupport/decorators/cast.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import l from"./Feature/FeatureAttachments.js";import d from"./Feature/FeatureContent.js";import a from"./Feature/FeatureExpression.js";import c from"./Feature/FeatureFields.js";import u from"./Feature/FeatureMedia.js";import p from"./Feature/FeatureViewModel.js";import{FeatureContentMixin as m}from"./Feature/support/FeatureContentMixin.js";import{Heading as h}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as g}from"./support/jsxFactory.js";import{substitute as f}from"../intl/substitute.js";const y={iconText:"geoscene-icon-font-fallback-text",iconLoading:"geoscene-icon-loading-indicator esri-rotating",esriTable:"esri-widget__table",geosceneWidget:"esri-widget",base:"esri-feature",container:"esri-feature__size-container",title:"esri-feature__title",main:"esri-feature__main-container",btn:"esri-feature__button",icon:"esri-feature__icon",content:"esri-feature__content",contentElement:"esri-feature__content-element",text:"esri-feature__text",lastEditedInfo:"esri-feature__last-edited-info",fields:"esri-feature__fields",fieldHeader:"esri-feature__field-header",fieldData:"esri-feature__field-data",fieldDataDate:"esri-feature__field-data--date",loadingSpinnerContainer:"esri-feature__loading-container",spinner:"esri-feature__loading-spinner"},_={title:!0,content:!0,lastEditedInfo:!0};let w=class extends(m(o)){constructor(e,t){super(e,t),this._contentWidgets=[],this.graphic=null,this.defaultPopupTemplateEnabled=!1,this.headingLevel=2,this.label=void 0,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.spatialReference=null,this.title=null,this.visibleElements={..._},this.map=null,this.view=null,this.viewModel=new p}initialize(){this.own(t(this,"viewModel.contentViewModels",(()=>this._setupContentWidgets())))}loadDependencies(){return import("@esri/calcite-components/dist/components/calcite-notice.js")}destroy(){this._destroyContentWidgets()}castVisibleElements(e){return{..._,...e}}render(){const{state:e}=this.viewModel,t=g("div",{class:y.container,key:"container"},this.renderTitle(),"error"===e?this.renderError():"loading"===e?this.renderLoading():this.renderContentContainer());return g("div",{class:this.classes(y.base,y.geosceneWidget)},t)}setActiveMedia(e,t){this.viewModel.setActiveMedia(e,t)}nextMedia(e){this.viewModel.nextMedia(e)}previousMedia(e){this.viewModel.previousMedia(e)}renderError(){const{messagesCommon:e,messages:t,visibleElements:s}=this;return g("calcite-notice",{active:!0,color:"red",icon:"exclamation-mark-circle",scale:"s"},s.title?g("div",{key:"error-title",slot:"title"},e.errorMessage):null,g("div",{key:"error-message",slot:"message"},t.loadingError))}renderLoading(){return g("div",{key:"loading-container",class:y.loadingSpinnerContainer},g("span",{class:this.classes(y.iconLoading,y.spinner)}))}renderContentContainer(){const{visibleElements:e}=this;return e.content?g("div",{class:y.main},[this.renderContent(),this.renderLastEditInfo()]):null}renderTitle(){const{visibleElements:e,title:t}=this;return e.title?g(h,{level:this.headingLevel,class:y.title,innerHTML:t}):null}renderContent(){const e=this.viewModel.content,t="content";if(!e)return null;if(Array.isArray(e))return e.length?g("div",{key:`${t}-content-elements`},e.map(this.renderContentElement,this)):null;if("string"==typeof e){const e=this._contentWidgets[0];return!e||e.destroyed?null:g("div",{key:`${t}-content`},e.render())}return this.renderNodeContent(e)}renderContentElement(e,t){const{visibleElements:s}=this;if("boolean"!=typeof s.content&&!s.content[e.type])return null;switch(e.type){case"attachments":return this.renderAttachments(t);case"custom":return this.renderCustom(e,t);case"fields":return this.renderFields(t);case"media":return this.renderMedia(t);case"text":return this.renderText(e,t);case"expression":return this.renderExpression(t);default:return null}}renderAttachments(e){const t=this._contentWidgets[e];if(!t||t.destroyed)return null;const{state:s,attachmentInfos:i}=t.viewModel;return"loading"===s||i.length>0?g("div",{key:this._buildKey("attachments-element",e),class:this.classes(y.contentElement)},t.render()):null}renderExpression(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:g("div",{key:this._buildKey("expression-element",e),class:y.contentElement},t.render())}renderCustom(e,t){const{creator:s}=e,i=this._contentWidgets[t];return!i||i.destroyed?null:s?g("div",{key:this._buildKey("custom-element",t),class:y.contentElement},i.render()):null}renderFields(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:g("div",{key:this._buildKey("fields-element",e),class:y.contentElement},t.render())}renderMedia(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:g("div",{key:this._buildKey("media-element",e),class:y.contentElement},t.render())}renderLastEditInfo(){const{visibleElements:e,messages:t}=this,{lastEditInfo:s}=this.viewModel;if(!s||!e.lastEditedInfo)return null;const{date:i,user:n}=s,r="edit"===s.type?n?t.lastEditedByUser:t.lastEdited:n?t.lastCreatedByUser:t.lastCreated,o=f(r,{date:i,user:n});return g("div",{key:"edit-info-element",class:this.classes(y.lastEditedInfo,y.contentElement)},o)}renderText(e,t){const s=e.text,i=this._contentWidgets[t];return!i||i.destroyed?null:s?g("div",{key:this._buildKey("text-element",t),class:this.classes(y.contentElement,y.text)},i.render()):null}_buildKey(e,...t){return`${e}__${this.get("viewModel.graphic.uid")||"0"}-${t.join("-")}`}_destroyContentWidget(e){e&&(e.viewModel=null,!e.destroyed&&e.destroy())}_destroyContentWidgets(){this._contentWidgets.forEach((e=>this._destroyContentWidget(e))),this._contentWidgets=[]}_setupContentWidgets(){this._destroyContentWidgets();const{headingLevel:e,visibleElements:t}=this,s=this.get("viewModel.content"),{contentViewModels:i}=this.viewModel;if(Array.isArray(s))s.forEach(((s,n)=>{"attachments"===s.type&&(this._contentWidgets[n]=new l({displayType:s.displayType,headingLevel:t.title?e+1:e,viewModel:i[n]})),"fields"===s.type&&(this._contentWidgets[n]=new c({viewModel:i[n]})),"media"===s.type&&(this._contentWidgets[n]=new u({viewModel:i[n]})),"text"===s.type&&(this._contentWidgets[n]=new d({viewModel:i[n]})),"custom"===s.type&&(this._contentWidgets[n]=new d({viewModel:i[n]})),"expression"===s.type&&(this._contentWidgets[n]=new a({viewModel:i[n]}))}),this);else{const e=i[0];e&&!e.destroyed&&(this._contentWidgets[0]=new d({viewModel:e}))}this.scheduleRender()}};e([s("viewModel.graphic")],w.prototype,"graphic",void 0),e([s("viewModel.defaultPopupTemplateEnabled")],w.prototype,"defaultPopupTemplateEnabled",void 0),e([n()],w.prototype,"headingLevel",void 0),e([n({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],w.prototype,"label",void 0),e([n(),v("geoscene/widgets/Feature/t9n/Feature")],w.prototype,"messages",void 0),e([n(),v("geoscene/t9n/common")],w.prototype,"messagesCommon",void 0),e([n(),v("geoscene/widgets/support/t9n/uriUtils")],w.prototype,"messagesURIUtils",void 0),e([s("viewModel.spatialReference")],w.prototype,"spatialReference",void 0),e([s("viewModel.title")],w.prototype,"title",void 0),e([n()],w.prototype,"visibleElements",void 0),e([i("visibleElements")],w.prototype,"castVisibleElements",null),e([s("viewModel.map")],w.prototype,"map",void 0),e([s("viewModel.view")],w.prototype,"view",void 0),e([n({type:p})],w.prototype,"viewModel",void 0),w=e([r("geoscene.widgets.Feature")],w);const M=w;export{M as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{init as t}from"../core/watchUtils.js";import{aliasOf as s}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as i}from"../core/accessorSupport/decorators/cast.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import o from"./Widget.js";import l from"./Feature/FeatureAttachments.js";import d from"./Feature/FeatureContent.js";import a from"./Feature/FeatureExpression.js";import c from"./Feature/FeatureFields.js";import u from"./Feature/FeatureMedia.js";import p from"./Feature/FeatureViewModel.js";import{FeatureContentMixin as m}from"./Feature/support/FeatureContentMixin.js";import{Heading as h}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as v}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as g}from"./support/jsxFactory.js";import{substitute as f}from"../intl/substitute.js";const y={iconText:"geoscene-icon-font-fallback-text",iconLoading:"geoscene-icon-loading-indicator geoscene-rotating",esriTable:"geoscene-widget__table",geosceneWidget:"geoscene-widget",base:"geoscene-feature",container:"geoscene-feature__size-container",title:"geoscene-feature__title",main:"geoscene-feature__main-container",btn:"geoscene-feature__button",icon:"geoscene-feature__icon",content:"geoscene-feature__content",contentElement:"geoscene-feature__content-element",text:"geoscene-feature__text",lastEditedInfo:"geoscene-feature__last-edited-info",fields:"geoscene-feature__fields",fieldHeader:"geoscene-feature__field-header",fieldData:"geoscene-feature__field-data",fieldDataDate:"geoscene-feature__field-data--date",loadingSpinnerContainer:"geoscene-feature__loading-container",spinner:"geoscene-feature__loading-spinner"},_={title:!0,content:!0,lastEditedInfo:!0};let w=class extends(m(o)){constructor(e,t){super(e,t),this._contentWidgets=[],this.graphic=null,this.defaultPopupTemplateEnabled=!1,this.headingLevel=2,this.label=void 0,this.messages=null,this.messagesCommon=null,this.messagesURIUtils=null,this.spatialReference=null,this.title=null,this.visibleElements={..._},this.map=null,this.view=null,this.viewModel=new p}initialize(){this.own(t(this,"viewModel.contentViewModels",(()=>this._setupContentWidgets())))}loadDependencies(){return import("@esri/calcite-components/dist/components/calcite-notice.js")}destroy(){this._destroyContentWidgets()}castVisibleElements(e){return{..._,...e}}render(){const{state:e}=this.viewModel,t=g("div",{class:y.container,key:"container"},this.renderTitle(),"error"===e?this.renderError():"loading"===e?this.renderLoading():this.renderContentContainer());return g("div",{class:this.classes(y.base,y.geosceneWidget)},t)}setActiveMedia(e,t){this.viewModel.setActiveMedia(e,t)}nextMedia(e){this.viewModel.nextMedia(e)}previousMedia(e){this.viewModel.previousMedia(e)}renderError(){const{messagesCommon:e,messages:t,visibleElements:s}=this;return g("calcite-notice",{active:!0,color:"red",icon:"exclamation-mark-circle",scale:"s"},s.title?g("div",{key:"error-title",slot:"title"},e.errorMessage):null,g("div",{key:"error-message",slot:"message"},t.loadingError))}renderLoading(){return g("div",{key:"loading-container",class:y.loadingSpinnerContainer},g("span",{class:this.classes(y.iconLoading,y.spinner)}))}renderContentContainer(){const{visibleElements:e}=this;return e.content?g("div",{class:y.main},[this.renderContent(),this.renderLastEditInfo()]):null}renderTitle(){const{visibleElements:e,title:t}=this;return e.title?g(h,{level:this.headingLevel,class:y.title,innerHTML:t}):null}renderContent(){const e=this.viewModel.content,t="content";if(!e)return null;if(Array.isArray(e))return e.length?g("div",{key:`${t}-content-elements`},e.map(this.renderContentElement,this)):null;if("string"==typeof e){const e=this._contentWidgets[0];return!e||e.destroyed?null:g("div",{key:`${t}-content`},e.render())}return this.renderNodeContent(e)}renderContentElement(e,t){const{visibleElements:s}=this;if("boolean"!=typeof s.content&&!s.content[e.type])return null;switch(e.type){case"attachments":return this.renderAttachments(t);case"custom":return this.renderCustom(e,t);case"fields":return this.renderFields(t);case"media":return this.renderMedia(t);case"text":return this.renderText(e,t);case"expression":return this.renderExpression(t);default:return null}}renderAttachments(e){const t=this._contentWidgets[e];if(!t||t.destroyed)return null;const{state:s,attachmentInfos:i}=t.viewModel;return"loading"===s||i.length>0?g("div",{key:this._buildKey("attachments-element",e),class:this.classes(y.contentElement)},t.render()):null}renderExpression(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:g("div",{key:this._buildKey("expression-element",e),class:y.contentElement},t.render())}renderCustom(e,t){const{creator:s}=e,i=this._contentWidgets[t];return!i||i.destroyed?null:s?g("div",{key:this._buildKey("custom-element",t),class:y.contentElement},i.render()):null}renderFields(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:g("div",{key:this._buildKey("fields-element",e),class:y.contentElement},t.render())}renderMedia(e){const t=this._contentWidgets[e];return!t||t.destroyed?null:g("div",{key:this._buildKey("media-element",e),class:y.contentElement},t.render())}renderLastEditInfo(){const{visibleElements:e,messages:t}=this,{lastEditInfo:s}=this.viewModel;if(!s||!e.lastEditedInfo)return null;const{date:i,user:n}=s,r="edit"===s.type?n?t.lastEditedByUser:t.lastEdited:n?t.lastCreatedByUser:t.lastCreated,o=f(r,{date:i,user:n});return g("div",{key:"edit-info-element",class:this.classes(y.lastEditedInfo,y.contentElement)},o)}renderText(e,t){const s=e.text,i=this._contentWidgets[t];return!i||i.destroyed?null:s?g("div",{key:this._buildKey("text-element",t),class:this.classes(y.contentElement,y.text)},i.render()):null}_buildKey(e,...t){return`${e}__${this.get("viewModel.graphic.uid")||"0"}-${t.join("-")}`}_destroyContentWidget(e){e&&(e.viewModel=null,!e.destroyed&&e.destroy())}_destroyContentWidgets(){this._contentWidgets.forEach((e=>this._destroyContentWidget(e))),this._contentWidgets=[]}_setupContentWidgets(){this._destroyContentWidgets();const{headingLevel:e,visibleElements:t}=this,s=this.get("viewModel.content"),{contentViewModels:i}=this.viewModel;if(Array.isArray(s))s.forEach(((s,n)=>{"attachments"===s.type&&(this._contentWidgets[n]=new l({displayType:s.displayType,headingLevel:t.title?e+1:e,viewModel:i[n]})),"fields"===s.type&&(this._contentWidgets[n]=new c({viewModel:i[n]})),"media"===s.type&&(this._contentWidgets[n]=new u({viewModel:i[n]})),"text"===s.type&&(this._contentWidgets[n]=new d({viewModel:i[n]})),"custom"===s.type&&(this._contentWidgets[n]=new d({viewModel:i[n]})),"expression"===s.type&&(this._contentWidgets[n]=new a({viewModel:i[n]}))}),this);else{const e=i[0];e&&!e.destroyed&&(this._contentWidgets[0]=new d({viewModel:e}))}this.scheduleRender()}};e([s("viewModel.graphic")],w.prototype,"graphic",void 0),e([s("viewModel.defaultPopupTemplateEnabled")],w.prototype,"defaultPopupTemplateEnabled",void 0),e([n()],w.prototype,"headingLevel",void 0),e([n({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],w.prototype,"label",void 0),e([n(),v("geoscene/widgets/Feature/t9n/Feature")],w.prototype,"messages",void 0),e([n(),v("geoscene/t9n/common")],w.prototype,"messagesCommon",void 0),e([n(),v("geoscene/widgets/support/t9n/uriUtils")],w.prototype,"messagesURIUtils",void 0),e([s("viewModel.spatialReference")],w.prototype,"spatialReference",void 0),e([s("viewModel.title")],w.prototype,"title",void 0),e([n()],w.prototype,"visibleElements",void 0),e([i("visibleElements")],w.prototype,"castVisibleElements",null),e([s("viewModel.map")],w.prototype,"map",void 0),e([s("viewModel.view")],w.prototype,"view",void 0),e([n({type:p})],w.prototype,"viewModel",void 0),w=e([r("geoscene.widgets.Feature")],w);const M=w;export{M as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{neverReached as t}from"../core/compilerUtils.js";import{isSome as i,isNone as a}from"../core/maybe.js";import{aliasOf as n}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{getDomainRange as r}from"../layers/support/domainUtils.js";import{getFieldRange as o}from"../layers/support/fieldUtils.js";import u from"./Widget.js";import d from"./FeatureForm/FeatureFormViewModel.js";import{Heading as p,incrementHeadingLevel as c}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as h}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";import{DateTime as _}from"luxon";import{getLocale as v}from"../intl/locale.js";const g={base:"esri-feature-form",form:"esri-feature-form__form",formHeader:"esri-feature-form__form-header",label:"esri-feature-form__label",inputField:"esri-feature-form__input",inputDate:"esri-feature-form__input--date",inputTime:"esri-feature-form__input--time",inputRadioGroup:"esri-feature-form__input--radio-group",inputRadio:"esri-feature-form__input--radio",inputRadioLabel:"esri-feature-form__input--radio-label",inputDisabled:"esri-feature-form__input--disabled",inputSwitch:"esri-feature-form__input--switch",inputInvalid:"esri-feature-form__input--invalid",inputIconInvalid:"esri-feature-form__input-icon--invalid",errorMessage:"esri-feature-form__field-error-message",description:"esri-feature-form__description-text",dateInputPart:"esri-feature-form__date-input-part",loneDateInputPart:"esri-feature-form__date-input-part--lone",dateInputContainer:"esri-feature-form__date-input-container",dateFormatHint:"esri-feature-form__date-format-hint",group:"esri-feature-form__group",groupLabel:"esri-feature-form__group-label",groupHeader:"esri-feature-form__group-header",groupHeading:"esri-feature-form__group-header",groupTitle:"esri-feature-form__group-title",groupDescription:"esri-feature-form__group-description",groupToggleIcon:"esri-feature-form__group-toggle-icon",groupCollapsed:"esri-feature-form__group--collapsed",groupSequential:"esri-feature-form__group--sequential",groupActive:"esri-feature-form__group--active",collapseIcon:"geoscene-icon-up",errorIcon:"geoscene-icon-notice-triangle",expandIcon:"geoscene-icon-down",widget:"esri-widget",panel:"esri-widget--panel",input:"esri-input",select:"esri-select"},b={datePattern:"D",timePattern:"tt"};function I(e){return e&&e.inputFields}const y="data-field-name";let F=class extends u{constructor(e,t){super(e,t),this._activeDateFieldEdit=null,this._activeInputName=null,this._activeNumberFieldEdit=null,this._fieldFocusNeeded=!1,this._fieldToInitialIncompatibleDomainValue=new Map,this._switchFieldsWithInitialIncompatibleValue=new Set,this._userUpdatedInputFieldNames=new Set,this.description=null,this.feature=null,this.fieldConfig=null,this.formTemplate=null,this.groupDisplay="all",this.headingLevel=2,this.label=void 0,this.layer=null,this.messages=null,this.messagesTemplates=null,this.strict=null,this.title=null,this.viewModel=new d,this._handleSwitchClick=e=>{e.target===e.currentTarget&&e.stopImmediatePropagation()},this._handleRadioInputChange=e=>{this._commitInputValue(e.target)},this._handleInputInput=e=>{this._commitInputValue(e.currentTarget,!0)},this._handleFormKeyDown=this._handleFormKeyDown.bind(this),this._handleInputBlur=this._handleInputBlur.bind(this),this._handleInputFocus=this._handleInputFocus.bind(this),this._handleNumberInputMouseDown=this._handleNumberInputMouseDown.bind(this),this._handleInputKeyDown=this._handleInputKeyDown.bind(this),this._handleOptionChange=this._handleOptionChange.bind(this),this._handleGroupClick=this._handleGroupClick.bind(this),this._handleSubmit=this._handleSubmit.bind(this),this._afterInputCreateOrUpdate=this._afterInputCreateOrUpdate.bind(this)}initialize(){this.own(this.watch("feature",(()=>{const e=this._getFocusableInput("forward");this._activeInputName=e&&e.name,this._userUpdatedInputFieldNames.clear(),this._fieldToInitialIncompatibleDomainValue.clear(),this._switchFieldsWithInitialIncompatibleValue.clear(),this._fieldFocusNeeded=!0})),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._userUpdatedInputFieldNames.add(e))),this._activeInputName=t,this._fieldFocusNeeded=!0,this.scheduleRender()}})))}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),import("@esri/calcite-components/dist/components/calcite-input-message.js"),import("@esri/calcite-components/dist/components/calcite-switch.js")])}destroy(){this._userUpdatedInputFieldNames.clear(),this._userUpdatedInputFieldNames=null}getValues(){return null}submit(){return null}render(){const{state:e}=this.viewModel;return f("div",{class:this.classes(g.base,g.widget,g.panel)},"ready"===e?this.renderForm():null)}renderForm(){const e=this.title?f(p,{key:"title",level:this.headingLevel},this.title):null,t=this.description?f("p",{class:g.description,key:"description"},this.description):null,i=e||t?f("div",{class:g.formHeader},e,t):null;return f("form",{class:g.form,novalidate:!0,onsubmit:this._handleSubmit,onkeydown:this._handleFormKeyDown},i,this.renderFields())}renderFields(){const{viewModel:{inputFields:e}}=this;return e.map(((e,t)=>I(e)?this.renderGroup(e,t):this.renderLabeledField(e)))}renderGroup(e,t){const{description:i,inputFields:a,label:n,state:l}=e,s=a.filter((e=>e.visible)),r=this.viewModel.findField(this._activeInputName),o=!(!r||r.group!==e),u=`${this.id}_group_${t}`,d=`${this.id}_group-label_${t}`,m=`${this.id}_group-description_${t}`,h=i?f("p",{class:this.classes(g.groupDescription,g.description),id:m},i):null,_="sequential"===this.groupDisplay,v=_?o:"expanded"===l,b=v?g.collapseIcon:g.expandIcon;return f("fieldset",{"aria-expanded":v.toString(),"aria-labelledby":d,"aria-describedby":i?m:"",class:this.classes(g.group,_?g.groupSequential:null,v?null:g.groupCollapsed,o?g.groupActive:null),"data-group":e,id:u,key:t,onclick:this._handleGroupClick},f("button",{role:_?"presentation":void 0,class:g.groupHeader,type:"button",tabIndex:_?-1:0},f("div",{class:g.groupTitle},f(p,{class:g.groupLabel,id:d,level:this.title?c(this.headingLevel):this.headingLevel},n),h),_?null:f("span",{class:this.classes(b,g.groupToggleIcon)})),s.map((e=>this.renderLabeledField(e))))}_getFocusableInput(e,t){const i=this.viewModel.allInputFields,a="forward"===e?i:i.slice().reverse();let n;if(t)if(I(t))n=a.indexOf(t.inputFields[0]);else{let i;if(this._isInputFieldInGroup(t)&&"collapsed"===t.group.state){const{inputFields:a}=t.group;i="forward"===e?a[a.length-1]:a[0]}else i=t;n=a.indexOf(i)+1}else n=0;for(let l=n;l<a.length;l++){const e=a[l];if(e.visible)return e}return null}renderLabeledField(e){const{label:t,layer:i,type:a}=e;return f("label",{key:`${i.id}-${e.name}`,class:g.label},[t,"unsupported"!==a?this.renderInputField(e):this.renderUnsupportedField(e),this.renderAuxiliaryText(e)])}renderInputField(e){const{domain:t,name:a,type:n,value:l}=e,s=this.getCommonInputProps(e);if("coded-value"===(null==t?void 0:t.type)){if(this._inputFieldHasInputType(e,"switch")){const{fieldElement:t}=e;if(!(this._switchFieldsWithInitialIncompatibleValue.has(a)||null==l||t.input.onValue!==l&&t.input.offValue!==l))return this.renderSwitchInputField(e,s);this._switchFieldsWithInitialIncompatibleValue.add(a)}return"radio-buttons"===e.inputType?this.renderRadioButtonsInputField(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),s):this.renderSelectInputField(e,this._getFieldValueOptions(a,t),s)}return"datetime-picker"===e.inputType||"date"===n?this.renderDateInputField(e,s):"number"===n?f("input",{type:"number",...s,value:i(this._activeNumberFieldEdit)&&this._activeNumberFieldEdit.fieldName===e.name?this._activeNumberFieldEdit.value:`${s.value}`}):"text-area"===e.inputType?f("textarea",{...s}):f("input",{type:"text",...s})}_parseDateTime(e,t,i){if(i){var a;let n=_.fromJSDate(this._parseDate(e,i));const l=_.fromMillis(null!=(a=t.value)?a:Date.now());return n="date"===i?n.set({hour:l.hour,minute:l.minute,second:l.second}):n.set({day:l.day,month:l.month,year:l.year}),n.isValid?n.toMillis():null}const n=_.fromJSDate(this._parseDate(e));return n.isValid?n.toMillis():null}renderDateInputField(e,t){const{value:i,includeTime:a}=e,{date:n,time:l}=this._formatDate(0),s=`${this.id}-${t.key}`,r=`${s}-date`,o=`${s}-time`,{_activeDateFieldEdit:u}=this;let{date:d,time:p}=this._formatDate(i);var c,m,h,_;(null==u?void 0:u.fieldName)===e.name&&(d=null!=(c=null==(m=u.date.input)?void 0:m.value)?c:d,p=null!=(h=null==(_=u.time.input)?void 0:_.value)?h:p);return f("div",{key:`${t.key}-date`,class:g.dateInputContainer},f("div",{class:this.classes(g.dateInputPart,a?null:g.loneDateInputPart)},f("input",{"aria-label":e.label,"aria-describedby":r,type:"text",...t,"data-date-part":"date",class:this.classes(t.class,g.inputDate),value:d}),f("div",{class:g.dateFormatHint,id:r},n)),a?f("div",{class:g.dateInputPart,key:"time-input"},f("input",{"aria-describedby":o,"aria-label":e.label,type:"text",...t,"data-date-part":"time",class:this.classes(t.class,g.inputTime),value:p}),f("div",{class:g.dateFormatHint,id:o},l)):null)}renderUnsupportedField(e){const t=this.getCommonInputProps(e);return f("input",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,class:this.classes(g.input,g.inputField,g.inputDisabled),onfocus:t.onfocus,readOnly:!0,tabIndex:t.tabIndex,type:"text",value:t.value,[y]:t[y]})}renderSelectInputField(e,t,i){const{value:n}=e,{messages:l,messagesTemplates:s}=this,r=t.map((e=>e.map((e=>f("calcite-combobox-item",{value:`${e.value}`,"text-label":e.name,key:`#${e.value}`,selected:n===e.value}))))),[o,u]=r;this._registerIncompatibleValue(n,t.flat(),e,(e=>{u.unshift(f("calcite-combobox-item",{value:`${e}`,"text-label":`${e}`,key:"incompatible-option",readOnly:!0}))}));const d=u.length>0?[f("calcite-combobox-item-group",{key:"recommended",label:l.recommended},o),f("calcite-combobox-item-group",{key:"other",label:s.other},u)]:o,p=a(e.fieldElement)||this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.showNoValueOption;if(!e.required&&p){const t="",i=this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty;d.unshift(f("calcite-combobox-item",{value:t,"text-label":this.messages.empty,key:"empty-option"},i))}return f("calcite-combobox",{...i,"selection-mode":"single",disabled:i.readOnly,allowCustomValues:!1,onCalciteComboboxChange:e=>this._handleOptionChange(e.target)},d)}_registerIncompatibleValue(e,t,i,a){const n=this._fieldToInitialIncompatibleDomainValue,l=n.has(i.name);(l||null!=e&&""!==e&&!t.find((t=>t.value===e))||l)&&(l||n.set(i.name,e),null==a||a(n.get(i.name)))}renderRadioButtonsInputField(e,t,i){const{value:n}=e,l=t.map((t=>this.renderRadioButton({key:t.name,label:t.name,name:e.name,value:t.value,selected:t.value===n,props:i})));this._registerIncompatibleValue(n,t,e);const s=a(e.fieldElement)||this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.showNoValueOption;if(!e.required&&s){const t="",a=this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty,s=n===t||null===n;l.unshift(this.renderRadioButton({key:"empty-option",label:a,name:e.name,value:t,selected:s,props:i}))}return f("div",{key:`${i.key}-radio`,class:g.inputRadioGroup},l)}renderSwitchInputField(e,t){const{value:i}=e,a=!!this._inputFieldHasInputType(e,"switch")&&i===e.fieldElement.input.onValue;return f("calcite-switch",{...t,class:g.inputSwitch,onclick:this._handleSwitchClick,checked:a,disabled:t.readOnly})}renderRadioButton({key:e,name:t,value:i,selected:a,label:n,props:l}){return f("label",{key:e,class:g.inputRadioLabel},f("input",{...l,class:g.inputRadio,name:t,type:"radio",value:i,checked:a,onchange:this._handleRadioInputChange}),n)}renderAuxiliaryText(e){const t=this._userUpdatedInputFieldNames.has(e.name)&&!e.valid?e.errorMessage:i(this.viewModel.contingencyConstraintViolations.get(e.name))?this.messages.validationErrors.valuesIncompatible:null;return i(t)?f("calcite-input-message",{status:"invalid",icon:!0,active:!0},t):e.description?f("div",{key:"description",class:g.description},e.description):void 0}getCommonInputProps(e){const{groupDisplay:t}=this,{editable:a,group:n,hint:l,maxLength:s,minLength:r,name:o,required:u,type:d,valid:p,value:c}=e,m=this._userUpdatedInputFieldNames.has(o),h=!a,f="all"===t&&i(n)&&"collapsed"===n.state;return{afterCreate:this._afterInputCreateOrUpdate,afterUpdate:this._afterInputCreateOrUpdate,"aria-invalid":p?"false":"true",class:this.classes(g.input,g.inputField,h?g.inputDisabled:null,m&&!p?g.inputInvalid:null),key:o,label:o,minlength:r>-1?`${r}`:"",maxlength:s>-1?`${s}`:"",...this._getNumberFieldConstraints(e),readOnly:h,value:null==c?"":`${c}`,[y]:o,onfocus:this._handleInputFocus,oninput:this._handleInputInput,onblur:this._handleInputBlur,onkeydown:this._handleInputKeyDown,onmousedown:"number"===d?this._handleNumberInputMouseDown:null,placeholder:"number"===d||"text"===d?l:"",required:u,tabIndex:f?-1:0}}_isInputFieldInGroup(e){return!I(e)&&i(e.group)}_handleNumberInputMouseDown({target:e}){e.focus(),this.scheduleRender()}_getFieldValueOptions(e,t){const i=t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),a=this.viewModel.fieldsWithContingentValues.has(e)?this._getContingentValueOptions(e):[];if(a.length>0){const e=new Set(a.map((e=>e.value)));return[a,i.filter((t=>!e.has(t.value)))]}return[i,[]]}_getContingentValueOptions(e){const t={};for(const l of this.viewModel.allInputFields){const{name:i,value:n}=l;!a(n)&&i!==e&&this.viewModel.fieldsWithContingentValues.has(i)&&(t[i]=n)}const i=this.viewModel.joinedContingentValues.slice(),n=new Map;for(const l of i){const i=l.values[e];if(a(i)||"code"!==i.objectType&&"null"!==i.objectType)continue;const{code:s,name:r}="null"===i.objectType?{code:"",name:this.messages.empty}:i.codedValue;if(n.has(s))continue;Object.entries(t).every((([e,t])=>!l.values.hasOwnProperty(e)||this._valueIsValidContingentValue(t,l.values[e])))&&n.set(s,{name:r,value:s})}return[...n.values()]}_getInputFieldFromInput(e){return this.viewModel.findField(e.getAttribute(y))}_getNumberFieldConstraints(e){const t=r(e.domain)||o(e.field);return t&&t.max!==Number.MAX_VALUE&&t.min!==Number.MIN_VALUE?t:{min:null,max:null}}_afterInputCreateOrUpdate(e){const{viewModel:t}=this,i=this._getInputFieldFromInput(e),a=t.findField(this._activeInputName),n=this._fieldToInitialIncompatibleDomainValue.get(i.name)===i.value;this._fieldFocusNeeded&&a===i&&("radio-buttons"!==i.inputType||n||e.checked)&&(this._fieldFocusNeeded=!1,e.focus())}_handleInputFocus(e){const t=e.target,i=this._getInputFieldFromInput(t);this._activeInputName=i.name,"date"===i.type?this._syncDateFieldEdits(t):this._isNumberInputField(i)&&this._setUpNumberFieldEdit(t)}_isNumberInputField({domain:e,inputType:t="text-box",type:i}){return"number"===i&&"text-box"===t&&(!e||"coded-value"!==e.type)}_handleInputBlur(e){const t=e.target,a=this._getInputFieldFromInput(t);if("date"===a.type){const i=e.relatedTarget,l=i&&this._getInputFieldFromInput(i);if(l&&"date"===a.type&&"date"===l.type&&a.field===l.field){if(""!==t.value&&""===i.value){var n;const l=i.getAttribute("data-date-part");i.value=this._formatDate(null!=(n=a.value)?n:Date.now())[l],this._parseDate(t.value,t.getAttribute("data-date-part"))&&this._commitInputValue(e.target,!0,!1)}return}}"number"===a.type&&i(this._activeNumberFieldEdit)&&(this._activeNumberFieldEdit.input.value=`${a.value}`,this._activeNumberFieldEdit=null),this._commitInputValue(t),this.scheduleRender()}_commitInputValue(e,t=!1,a=!0){const n=this._getInputFieldFromInput(e);if(this._activeDateFieldEdit){const{date:i,time:u}=this._activeDateFieldEdit,d=this._parseDateTime(e.value,n,i.active?"date":"time"),p=null!==this.viewModel.getValue(n.name),c=i.input&&(u.input||!n.includeTime),m=null===d;if(t){if(m)return;(c||!a||p)&&this._updateDateFieldValue(n,d)}else{var l,s;if(""===(null==(l=i.input)?void 0:l.value)||""===(null==(s=u.input)?void 0:s.value))this._updateDateFieldValue(n,null);else if(c){var r,o;const e=`${i.input.value} ${null!=(r=null==(o=u.input)?void 0:o.value)?r:""}`,t=this._parseDateTime(e,n);!(null!==t)&&p||this._updateDateFieldValue(n,t)}this._activeDateFieldEdit=null}}else i(this._activeNumberFieldEdit)&&this._isNumberInputField(n)&&(this._activeNumberFieldEdit.value=e.value),this._updateFieldValue(e)}_handleInputKeyDown(e){const{key:t,altKey:i,ctrlKey:a,metaKey:n}=e,l=this._getInputFieldFromInput(e.target);if("Enter"===t)this._isInputFieldInGroup(l)&&"collapsed"===l.group.state&&(l.group.state="expanded");else{const{type:s}=l.field,r="single"===s||"double"===s,o=!i&&!a&&!n;if(("integer"===s||"small-integer"===s||r)&&o&&1===t.length){const i=Number(t),a=["-","+"],n=["e","."],l=r?[...a,...n]:a;isNaN(i)&&-1===l.indexOf(t)&&e.preventDefault()}}}_setUpNumberFieldEdit(e){const t=this._getInputFieldFromInput(e);this._activeNumberFieldEdit={fieldName:t.name,input:e,value:e.value}}_syncDateFieldEdits(e){var t,i;const a=this._getInputFieldFromInput(e);if("date"!==a.type)return;const n=e.getAttribute("data-date-part"),l="date"===n?{value:e.value,input:e,active:!0}:{...null==(t=this._activeDateFieldEdit)?void 0:t.date,active:!1},s="time"===n?{value:e.value,input:e,active:!0}:{...null==(i=this._activeDateFieldEdit)?void 0:i.time,active:!1};this._activeDateFieldEdit={fieldName:a.name,date:l,time:s}}_updateFieldValue(e){const t=e.getAttribute(y);if(this.viewModel.setValue(t,this._parseValue(e)),this._userUpdatedInputFieldNames.add(t),this.viewModel.fieldsWithContingentValues.has(t)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>i(t))));this.viewModel.validateContingencyConstraints(e)}}_updateDateFieldValue(e,t){this.viewModel.setValue(e.name,t),this._userUpdatedInputFieldNames.add(e.name)}_parseValue(e){const t=this._getInputFieldFromInput(e),i=e.value;if(this._inputFieldHasInputType(t,"switch")&&"CALCITE-COMBOBOX"!==e.tagName)return e.checked?t.fieldElement.input.onValue:t.fieldElement.input.offValue;if("radio-buttons"===t.inputType&&"radio"===e.type&&!e.checked)return t.value;const{type:a}=t;if("number"===a)return i?parseFloat(i):null;if("date"===a){if(!i)return null;const a=Number(i);if(!isNaN(a))return a;const n=e.getAttribute("data-date-part"),l=this._parseDate(i,n);if(!l)return null;let s=_.fromJSDate(l);const r=t.domain,o=_.now();let u=o;if(r&&"range"===r.type){const e=_.fromMillis(r.maxValue);o<e&&(u=e)}const d=this.viewModel.getValue(t.name),p=null!=d?_.fromMillis(d):u;return s="date"===n?s.set({hour:p.hour,minute:p.minute,second:p.second}):s.set({day:p.day,month:p.month,year:p.year}),s.toMillis()}return i}_handleOptionChange(e){this._commitInputValue(e),this.scheduleRender()}_handleGroupClick(e){var t;const i=e.currentTarget["data-group"],a="expanded"===i.state,n="sequential"===this.groupDisplay,l=`.${g.groupHeader}`;if(!(a&&!e.target.closest(l))){if(this._activeInputName=null==(t=this._getFocusableInput("forward",i))?void 0:t.name,n){const t=e.target.closest(l);if(a&&!t)return;this.viewModel.inputFields.forEach((e=>{I(e)&&e!==i&&(e.state="collapsed")}))}i.state=a?"collapsed":"expanded",this._fieldFocusNeeded=n,this.scheduleRender()}}_handleSubmit(e){e.preventDefault()}_handleFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_formatDate(e){if(null==e)return{date:"",time:""};const t=_.fromMillis(e,{locale:v(),numberingSystem:"latn"});return{date:t.toLocaleString({year:"numeric",month:"2-digit",day:"2-digit"}),time:t.toFormat(b.timePattern)}}_parseDate(e,t){if(null==e||""===e)return null;const{timePattern:i,datePattern:a}=b,n=t?"date"===t?a:i:`${a} ${i}`,l=_.fromFormat(e,n,{locale:v(),numberingSystem:"latn"});return l.isValid?l.toJSDate():null}_inputFieldHasInputType(e,t){var a;return i(e.fieldElement)&&(null==(a=e.fieldElement.input)?void 0:a.type)===t}_valueIsValidContingentValue(e,i){var a;switch(i.objectType){case"any":return!0;case"null":return null==e;case"code":return e===(null==(a=i.codedValue)?void 0:a.code);case"range":return e>=i.minValue&&e<=i.maxValue;default:return t(i.objectType),!1}}};e([n("viewModel.description")],F.prototype,"description",void 0),e([n("viewModel.feature")],F.prototype,"feature",void 0),e([n("viewModel.fieldConfig")],F.prototype,"fieldConfig",void 0),e([n("viewModel.formTemplate")],F.prototype,"formTemplate",void 0),e([l()],F.prototype,"groupDisplay",void 0),e([l()],F.prototype,"headingLevel",void 0),e([l({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],F.prototype,"label",void 0),e([n("viewModel.layer")],F.prototype,"layer",void 0),e([l(),m("geoscene/widgets/FeatureForm/t9n/FeatureForm")],F.prototype,"messages",void 0),e([l(),m("geoscene/widgets/FeatureTemplates/t9n/FeatureTemplates")],F.prototype,"messagesTemplates",void 0),e([n("viewModel.strict")],F.prototype,"strict",void 0),e([n("viewModel.title")],F.prototype,"title",void 0),e([l(),h(["value-change","submit"])],F.prototype,"viewModel",void 0),e([n("viewModel.getValues")],F.prototype,"getValues",null),e([n("viewModel.submit")],F.prototype,"submit",null),F=e([s("geoscene.widgets.FeatureForm")],F);const w=F;export{w as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{neverReached as t}from"../core/compilerUtils.js";import{isSome as i,isNone as a}from"../core/maybe.js";import{aliasOf as n}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{subclass as s}from"../core/accessorSupport/decorators/subclass.js";import{getDomainRange as r}from"../layers/support/domainUtils.js";import{getFieldRange as o}from"../layers/support/fieldUtils.js";import u from"./Widget.js";import d from"./FeatureForm/FeatureFormViewModel.js";import{Heading as p,incrementHeadingLevel as c}from"./support/Heading.js";import"./support/widgetUtils.js";import{messageBundle as m}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as h}from"./support/decorators/vmEvent.js";import{tsx as f}from"./support/jsxFactory.js";import{DateTime as _}from"luxon";import{getLocale as v}from"../intl/locale.js";const g={base:"geoscene-feature-form",form:"geoscene-feature-form__form",formHeader:"geoscene-feature-form__form-header",label:"geoscene-feature-form__label",inputField:"geoscene-feature-form__input",inputDate:"geoscene-feature-form__input--date",inputTime:"geoscene-feature-form__input--time",inputRadioGroup:"geoscene-feature-form__input--radio-group",inputRadio:"geoscene-feature-form__input--radio",inputRadioLabel:"geoscene-feature-form__input--radio-label",inputDisabled:"geoscene-feature-form__input--disabled",inputSwitch:"geoscene-feature-form__input--switch",inputInvalid:"geoscene-feature-form__input--invalid",inputIconInvalid:"geoscene-feature-form__input-icon--invalid",errorMessage:"geoscene-feature-form__field-error-message",description:"geoscene-feature-form__description-text",dateInputPart:"geoscene-feature-form__date-input-part",loneDateInputPart:"geoscene-feature-form__date-input-part--lone",dateInputContainer:"geoscene-feature-form__date-input-container",dateFormatHint:"geoscene-feature-form__date-format-hint",group:"geoscene-feature-form__group",groupLabel:"geoscene-feature-form__group-label",groupHeader:"geoscene-feature-form__group-header",groupHeading:"geoscene-feature-form__group-header",groupTitle:"geoscene-feature-form__group-title",groupDescription:"geoscene-feature-form__group-description",groupToggleIcon:"geoscene-feature-form__group-toggle-icon",groupCollapsed:"geoscene-feature-form__group--collapsed",groupSequential:"geoscene-feature-form__group--sequential",groupActive:"geoscene-feature-form__group--active",collapseIcon:"geoscene-icon-up",errorIcon:"geoscene-icon-notice-triangle",expandIcon:"geoscene-icon-down",widget:"geoscene-widget",panel:"geoscene-widget--panel",input:"geoscene-input",select:"geoscene-select"},b={datePattern:"D",timePattern:"tt"};function I(e){return e&&e.inputFields}const y="data-field-name";let F=class extends u{constructor(e,t){super(e,t),this._activeDateFieldEdit=null,this._activeInputName=null,this._activeNumberFieldEdit=null,this._fieldFocusNeeded=!1,this._fieldToInitialIncompatibleDomainValue=new Map,this._switchFieldsWithInitialIncompatibleValue=new Set,this._userUpdatedInputFieldNames=new Set,this.description=null,this.feature=null,this.fieldConfig=null,this.formTemplate=null,this.groupDisplay="all",this.headingLevel=2,this.label=void 0,this.layer=null,this.messages=null,this.messagesTemplates=null,this.strict=null,this.title=null,this.viewModel=new d,this._handleSwitchClick=e=>{e.target===e.currentTarget&&e.stopImmediatePropagation()},this._handleRadioInputChange=e=>{this._commitInputValue(e.target)},this._handleInputInput=e=>{this._commitInputValue(e.currentTarget,!0)},this._handleFormKeyDown=this._handleFormKeyDown.bind(this),this._handleInputBlur=this._handleInputBlur.bind(this),this._handleInputFocus=this._handleInputFocus.bind(this),this._handleNumberInputMouseDown=this._handleNumberInputMouseDown.bind(this),this._handleInputKeyDown=this._handleInputKeyDown.bind(this),this._handleOptionChange=this._handleOptionChange.bind(this),this._handleGroupClick=this._handleGroupClick.bind(this),this._handleSubmit=this._handleSubmit.bind(this),this._afterInputCreateOrUpdate=this._afterInputCreateOrUpdate.bind(this)}initialize(){this.own(this.watch("feature",(()=>{const e=this._getFocusableInput("forward");this._activeInputName=e&&e.name,this._userUpdatedInputFieldNames.clear(),this._fieldToInitialIncompatibleDomainValue.clear(),this._switchFieldsWithInitialIncompatibleValue.clear(),this._fieldFocusNeeded=!0})),this.on("submit",(e=>{if(e.invalid.length>0){const[t]=e.invalid;e.invalid.forEach((e=>this._userUpdatedInputFieldNames.add(e))),this._activeInputName=t,this._fieldFocusNeeded=!0,this.scheduleRender()}})))}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-combobox.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item.js"),import("@esri/calcite-components/dist/components/calcite-combobox-item-group.js"),import("@esri/calcite-components/dist/components/calcite-input-message.js"),import("@esri/calcite-components/dist/components/calcite-switch.js")])}destroy(){this._userUpdatedInputFieldNames.clear(),this._userUpdatedInputFieldNames=null}getValues(){return null}submit(){return null}render(){const{state:e}=this.viewModel;return f("div",{class:this.classes(g.base,g.widget,g.panel)},"ready"===e?this.renderForm():null)}renderForm(){const e=this.title?f(p,{key:"title",level:this.headingLevel},this.title):null,t=this.description?f("p",{class:g.description,key:"description"},this.description):null,i=e||t?f("div",{class:g.formHeader},e,t):null;return f("form",{class:g.form,novalidate:!0,onsubmit:this._handleSubmit,onkeydown:this._handleFormKeyDown},i,this.renderFields())}renderFields(){const{viewModel:{inputFields:e}}=this;return e.map(((e,t)=>I(e)?this.renderGroup(e,t):this.renderLabeledField(e)))}renderGroup(e,t){const{description:i,inputFields:a,label:n,state:l}=e,s=a.filter((e=>e.visible)),r=this.viewModel.findField(this._activeInputName),o=!(!r||r.group!==e),u=`${this.id}_group_${t}`,d=`${this.id}_group-label_${t}`,m=`${this.id}_group-description_${t}`,h=i?f("p",{class:this.classes(g.groupDescription,g.description),id:m},i):null,_="sequential"===this.groupDisplay,v=_?o:"expanded"===l,b=v?g.collapseIcon:g.expandIcon;return f("fieldset",{"aria-expanded":v.toString(),"aria-labelledby":d,"aria-describedby":i?m:"",class:this.classes(g.group,_?g.groupSequential:null,v?null:g.groupCollapsed,o?g.groupActive:null),"data-group":e,id:u,key:t,onclick:this._handleGroupClick},f("button",{role:_?"presentation":void 0,class:g.groupHeader,type:"button",tabIndex:_?-1:0},f("div",{class:g.groupTitle},f(p,{class:g.groupLabel,id:d,level:this.title?c(this.headingLevel):this.headingLevel},n),h),_?null:f("span",{class:this.classes(b,g.groupToggleIcon)})),s.map((e=>this.renderLabeledField(e))))}_getFocusableInput(e,t){const i=this.viewModel.allInputFields,a="forward"===e?i:i.slice().reverse();let n;if(t)if(I(t))n=a.indexOf(t.inputFields[0]);else{let i;if(this._isInputFieldInGroup(t)&&"collapsed"===t.group.state){const{inputFields:a}=t.group;i="forward"===e?a[a.length-1]:a[0]}else i=t;n=a.indexOf(i)+1}else n=0;for(let l=n;l<a.length;l++){const e=a[l];if(e.visible)return e}return null}renderLabeledField(e){const{label:t,layer:i,type:a}=e;return f("label",{key:`${i.id}-${e.name}`,class:g.label},[t,"unsupported"!==a?this.renderInputField(e):this.renderUnsupportedField(e),this.renderAuxiliaryText(e)])}renderInputField(e){const{domain:t,name:a,type:n,value:l}=e,s=this.getCommonInputProps(e);if("coded-value"===(null==t?void 0:t.type)){if(this._inputFieldHasInputType(e,"switch")){const{fieldElement:t}=e;if(!(this._switchFieldsWithInitialIncompatibleValue.has(a)||null==l||t.input.onValue!==l&&t.input.offValue!==l))return this.renderSwitchInputField(e,s);this._switchFieldsWithInitialIncompatibleValue.add(a)}return"radio-buttons"===e.inputType?this.renderRadioButtonsInputField(e,t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),s):this.renderSelectInputField(e,this._getFieldValueOptions(a,t),s)}return"datetime-picker"===e.inputType||"date"===n?this.renderDateInputField(e,s):"number"===n?f("input",{type:"number",...s,value:i(this._activeNumberFieldEdit)&&this._activeNumberFieldEdit.fieldName===e.name?this._activeNumberFieldEdit.value:`${s.value}`}):"text-area"===e.inputType?f("textarea",{...s}):f("input",{type:"text",...s})}_parseDateTime(e,t,i){if(i){var a;let n=_.fromJSDate(this._parseDate(e,i));const l=_.fromMillis(null!=(a=t.value)?a:Date.now());return n="date"===i?n.set({hour:l.hour,minute:l.minute,second:l.second}):n.set({day:l.day,month:l.month,year:l.year}),n.isValid?n.toMillis():null}const n=_.fromJSDate(this._parseDate(e));return n.isValid?n.toMillis():null}renderDateInputField(e,t){const{value:i,includeTime:a}=e,{date:n,time:l}=this._formatDate(0),s=`${this.id}-${t.key}`,r=`${s}-date`,o=`${s}-time`,{_activeDateFieldEdit:u}=this;let{date:d,time:p}=this._formatDate(i);var c,m,h,_;(null==u?void 0:u.fieldName)===e.name&&(d=null!=(c=null==(m=u.date.input)?void 0:m.value)?c:d,p=null!=(h=null==(_=u.time.input)?void 0:_.value)?h:p);return f("div",{key:`${t.key}-date`,class:g.dateInputContainer},f("div",{class:this.classes(g.dateInputPart,a?null:g.loneDateInputPart)},f("input",{"aria-label":e.label,"aria-describedby":r,type:"text",...t,"data-date-part":"date",class:this.classes(t.class,g.inputDate),value:d}),f("div",{class:g.dateFormatHint,id:r},n)),a?f("div",{class:g.dateInputPart,key:"time-input"},f("input",{"aria-describedby":o,"aria-label":e.label,type:"text",...t,"data-date-part":"time",class:this.classes(t.class,g.inputTime),value:p}),f("div",{class:g.dateFormatHint,id:o},l)):null)}renderUnsupportedField(e){const t=this.getCommonInputProps(e);return f("input",{afterCreate:t.afterCreate,afterUpdate:t.afterUpdate,class:this.classes(g.input,g.inputField,g.inputDisabled),onfocus:t.onfocus,readOnly:!0,tabIndex:t.tabIndex,type:"text",value:t.value,[y]:t[y]})}renderSelectInputField(e,t,i){const{value:n}=e,{messages:l,messagesTemplates:s}=this,r=t.map((e=>e.map((e=>f("calcite-combobox-item",{value:`${e.value}`,"text-label":e.name,key:`#${e.value}`,selected:n===e.value}))))),[o,u]=r;this._registerIncompatibleValue(n,t.flat(),e,(e=>{u.unshift(f("calcite-combobox-item",{value:`${e}`,"text-label":`${e}`,key:"incompatible-option",readOnly:!0}))}));const d=u.length>0?[f("calcite-combobox-item-group",{key:"recommended",label:l.recommended},o),f("calcite-combobox-item-group",{key:"other",label:s.other},u)]:o,p=a(e.fieldElement)||this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.showNoValueOption;if(!e.required&&p){const t="",i=this._inputFieldHasInputType(e,"combo-box")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty;d.unshift(f("calcite-combobox-item",{value:t,"text-label":this.messages.empty,key:"empty-option"},i))}return f("calcite-combobox",{...i,"selection-mode":"single",disabled:i.readOnly,allowCustomValues:!1,onCalciteComboboxChange:e=>this._handleOptionChange(e.target)},d)}_registerIncompatibleValue(e,t,i,a){const n=this._fieldToInitialIncompatibleDomainValue,l=n.has(i.name);(l||null!=e&&""!==e&&!t.find((t=>t.value===e))||l)&&(l||n.set(i.name,e),null==a||a(n.get(i.name)))}renderRadioButtonsInputField(e,t,i){const{value:n}=e,l=t.map((t=>this.renderRadioButton({key:t.name,label:t.name,name:e.name,value:t.value,selected:t.value===n,props:i})));this._registerIncompatibleValue(n,t,e);const s=a(e.fieldElement)||this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.showNoValueOption;if(!e.required&&s){const t="",a=this._inputFieldHasInputType(e,"radio-buttons")&&e.fieldElement.input.noValueOptionLabel||this.messages.empty,s=n===t||null===n;l.unshift(this.renderRadioButton({key:"empty-option",label:a,name:e.name,value:t,selected:s,props:i}))}return f("div",{key:`${i.key}-radio`,class:g.inputRadioGroup},l)}renderSwitchInputField(e,t){const{value:i}=e,a=!!this._inputFieldHasInputType(e,"switch")&&i===e.fieldElement.input.onValue;return f("calcite-switch",{...t,class:g.inputSwitch,onclick:this._handleSwitchClick,checked:a,disabled:t.readOnly})}renderRadioButton({key:e,name:t,value:i,selected:a,label:n,props:l}){return f("label",{key:e,class:g.inputRadioLabel},f("input",{...l,class:g.inputRadio,name:t,type:"radio",value:i,checked:a,onchange:this._handleRadioInputChange}),n)}renderAuxiliaryText(e){const t=this._userUpdatedInputFieldNames.has(e.name)&&!e.valid?e.errorMessage:i(this.viewModel.contingencyConstraintViolations.get(e.name))?this.messages.validationErrors.valuesIncompatible:null;return i(t)?f("calcite-input-message",{status:"invalid",icon:!0,active:!0},t):e.description?f("div",{key:"description",class:g.description},e.description):void 0}getCommonInputProps(e){const{groupDisplay:t}=this,{editable:a,group:n,hint:l,maxLength:s,minLength:r,name:o,required:u,type:d,valid:p,value:c}=e,m=this._userUpdatedInputFieldNames.has(o),h=!a,f="all"===t&&i(n)&&"collapsed"===n.state;return{afterCreate:this._afterInputCreateOrUpdate,afterUpdate:this._afterInputCreateOrUpdate,"aria-invalid":p?"false":"true",class:this.classes(g.input,g.inputField,h?g.inputDisabled:null,m&&!p?g.inputInvalid:null),key:o,label:o,minlength:r>-1?`${r}`:"",maxlength:s>-1?`${s}`:"",...this._getNumberFieldConstraints(e),readOnly:h,value:null==c?"":`${c}`,[y]:o,onfocus:this._handleInputFocus,oninput:this._handleInputInput,onblur:this._handleInputBlur,onkeydown:this._handleInputKeyDown,onmousedown:"number"===d?this._handleNumberInputMouseDown:null,placeholder:"number"===d||"text"===d?l:"",required:u,tabIndex:f?-1:0}}_isInputFieldInGroup(e){return!I(e)&&i(e.group)}_handleNumberInputMouseDown({target:e}){e.focus(),this.scheduleRender()}_getFieldValueOptions(e,t){const i=t.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),a=this.viewModel.fieldsWithContingentValues.has(e)?this._getContingentValueOptions(e):[];if(a.length>0){const e=new Set(a.map((e=>e.value)));return[a,i.filter((t=>!e.has(t.value)))]}return[i,[]]}_getContingentValueOptions(e){const t={};for(const l of this.viewModel.allInputFields){const{name:i,value:n}=l;!a(n)&&i!==e&&this.viewModel.fieldsWithContingentValues.has(i)&&(t[i]=n)}const i=this.viewModel.joinedContingentValues.slice(),n=new Map;for(const l of i){const i=l.values[e];if(a(i)||"code"!==i.objectType&&"null"!==i.objectType)continue;const{code:s,name:r}="null"===i.objectType?{code:"",name:this.messages.empty}:i.codedValue;if(n.has(s))continue;Object.entries(t).every((([e,t])=>!l.values.hasOwnProperty(e)||this._valueIsValidContingentValue(t,l.values[e])))&&n.set(s,{name:r,value:s})}return[...n.values()]}_getInputFieldFromInput(e){return this.viewModel.findField(e.getAttribute(y))}_getNumberFieldConstraints(e){const t=r(e.domain)||o(e.field);return t&&t.max!==Number.MAX_VALUE&&t.min!==Number.MIN_VALUE?t:{min:null,max:null}}_afterInputCreateOrUpdate(e){const{viewModel:t}=this,i=this._getInputFieldFromInput(e),a=t.findField(this._activeInputName),n=this._fieldToInitialIncompatibleDomainValue.get(i.name)===i.value;this._fieldFocusNeeded&&a===i&&("radio-buttons"!==i.inputType||n||e.checked)&&(this._fieldFocusNeeded=!1,e.focus())}_handleInputFocus(e){const t=e.target,i=this._getInputFieldFromInput(t);this._activeInputName=i.name,"date"===i.type?this._syncDateFieldEdits(t):this._isNumberInputField(i)&&this._setUpNumberFieldEdit(t)}_isNumberInputField({domain:e,inputType:t="text-box",type:i}){return"number"===i&&"text-box"===t&&(!e||"coded-value"!==e.type)}_handleInputBlur(e){const t=e.target,a=this._getInputFieldFromInput(t);if("date"===a.type){const i=e.relatedTarget,l=i&&this._getInputFieldFromInput(i);if(l&&"date"===a.type&&"date"===l.type&&a.field===l.field){if(""!==t.value&&""===i.value){var n;const l=i.getAttribute("data-date-part");i.value=this._formatDate(null!=(n=a.value)?n:Date.now())[l],this._parseDate(t.value,t.getAttribute("data-date-part"))&&this._commitInputValue(e.target,!0,!1)}return}}"number"===a.type&&i(this._activeNumberFieldEdit)&&(this._activeNumberFieldEdit.input.value=`${a.value}`,this._activeNumberFieldEdit=null),this._commitInputValue(t),this.scheduleRender()}_commitInputValue(e,t=!1,a=!0){const n=this._getInputFieldFromInput(e);if(this._activeDateFieldEdit){const{date:i,time:u}=this._activeDateFieldEdit,d=this._parseDateTime(e.value,n,i.active?"date":"time"),p=null!==this.viewModel.getValue(n.name),c=i.input&&(u.input||!n.includeTime),m=null===d;if(t){if(m)return;(c||!a||p)&&this._updateDateFieldValue(n,d)}else{var l,s;if(""===(null==(l=i.input)?void 0:l.value)||""===(null==(s=u.input)?void 0:s.value))this._updateDateFieldValue(n,null);else if(c){var r,o;const e=`${i.input.value} ${null!=(r=null==(o=u.input)?void 0:o.value)?r:""}`,t=this._parseDateTime(e,n);!(null!==t)&&p||this._updateDateFieldValue(n,t)}this._activeDateFieldEdit=null}}else i(this._activeNumberFieldEdit)&&this._isNumberInputField(n)&&(this._activeNumberFieldEdit.value=e.value),this._updateFieldValue(e)}_handleInputKeyDown(e){const{key:t,altKey:i,ctrlKey:a,metaKey:n}=e,l=this._getInputFieldFromInput(e.target);if("Enter"===t)this._isInputFieldInGroup(l)&&"collapsed"===l.group.state&&(l.group.state="expanded");else{const{type:s}=l.field,r="single"===s||"double"===s,o=!i&&!a&&!n;if(("integer"===s||"small-integer"===s||r)&&o&&1===t.length){const i=Number(t),a=["-","+"],n=["e","."],l=r?[...a,...n]:a;isNaN(i)&&-1===l.indexOf(t)&&e.preventDefault()}}}_setUpNumberFieldEdit(e){const t=this._getInputFieldFromInput(e);this._activeNumberFieldEdit={fieldName:t.name,input:e,value:e.value}}_syncDateFieldEdits(e){var t,i;const a=this._getInputFieldFromInput(e);if("date"!==a.type)return;const n=e.getAttribute("data-date-part"),l="date"===n?{value:e.value,input:e,active:!0}:{...null==(t=this._activeDateFieldEdit)?void 0:t.date,active:!1},s="time"===n?{value:e.value,input:e,active:!0}:{...null==(i=this._activeDateFieldEdit)?void 0:i.time,active:!1};this._activeDateFieldEdit={fieldName:a.name,date:l,time:s}}_updateFieldValue(e){const t=e.getAttribute(y);if(this.viewModel.setValue(t,this._parseValue(e)),this._userUpdatedInputFieldNames.add(t),this.viewModel.fieldsWithContingentValues.has(t)){const e=Object.fromEntries(Object.entries(this.getValues()).filter((([e,t])=>i(t))));this.viewModel.validateContingencyConstraints(e)}}_updateDateFieldValue(e,t){this.viewModel.setValue(e.name,t),this._userUpdatedInputFieldNames.add(e.name)}_parseValue(e){const t=this._getInputFieldFromInput(e),i=e.value;if(this._inputFieldHasInputType(t,"switch")&&"CALCITE-COMBOBOX"!==e.tagName)return e.checked?t.fieldElement.input.onValue:t.fieldElement.input.offValue;if("radio-buttons"===t.inputType&&"radio"===e.type&&!e.checked)return t.value;const{type:a}=t;if("number"===a)return i?parseFloat(i):null;if("date"===a){if(!i)return null;const a=Number(i);if(!isNaN(a))return a;const n=e.getAttribute("data-date-part"),l=this._parseDate(i,n);if(!l)return null;let s=_.fromJSDate(l);const r=t.domain,o=_.now();let u=o;if(r&&"range"===r.type){const e=_.fromMillis(r.maxValue);o<e&&(u=e)}const d=this.viewModel.getValue(t.name),p=null!=d?_.fromMillis(d):u;return s="date"===n?s.set({hour:p.hour,minute:p.minute,second:p.second}):s.set({day:p.day,month:p.month,year:p.year}),s.toMillis()}return i}_handleOptionChange(e){this._commitInputValue(e),this.scheduleRender()}_handleGroupClick(e){var t;const i=e.currentTarget["data-group"],a="expanded"===i.state,n="sequential"===this.groupDisplay,l=`.${g.groupHeader}`;if(!(a&&!e.target.closest(l))){if(this._activeInputName=null==(t=this._getFocusableInput("forward",i))?void 0:t.name,n){const t=e.target.closest(l);if(a&&!t)return;this.viewModel.inputFields.forEach((e=>{I(e)&&e!==i&&(e.state="collapsed")}))}i.state=a?"collapsed":"expanded",this._fieldFocusNeeded=n,this.scheduleRender()}}_handleSubmit(e){e.preventDefault()}_handleFormKeyDown(e){"Enter"===e.key&&this.viewModel.submit()}_formatDate(e){if(null==e)return{date:"",time:""};const t=_.fromMillis(e,{locale:v(),numberingSystem:"latn"});return{date:t.toLocaleString({year:"numeric",month:"2-digit",day:"2-digit"}),time:t.toFormat(b.timePattern)}}_parseDate(e,t){if(null==e||""===e)return null;const{timePattern:i,datePattern:a}=b,n=t?"date"===t?a:i:`${a} ${i}`,l=_.fromFormat(e,n,{locale:v(),numberingSystem:"latn"});return l.isValid?l.toJSDate():null}_inputFieldHasInputType(e,t){var a;return i(e.fieldElement)&&(null==(a=e.fieldElement.input)?void 0:a.type)===t}_valueIsValidContingentValue(e,i){var a;switch(i.objectType){case"any":return!0;case"null":return null==e;case"code":return e===(null==(a=i.codedValue)?void 0:a.code);case"range":return e>=i.minValue&&e<=i.maxValue;default:return t(i.objectType),!1}}};e([n("viewModel.description")],F.prototype,"description",void 0),e([n("viewModel.feature")],F.prototype,"feature",void 0),e([n("viewModel.fieldConfig")],F.prototype,"fieldConfig",void 0),e([n("viewModel.formTemplate")],F.prototype,"formTemplate",void 0),e([l()],F.prototype,"groupDisplay",void 0),e([l()],F.prototype,"headingLevel",void 0),e([l({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],F.prototype,"label",void 0),e([n("viewModel.layer")],F.prototype,"layer",void 0),e([l(),m("geoscene/widgets/FeatureForm/t9n/FeatureForm")],F.prototype,"messages",void 0),e([l(),m("geoscene/widgets/FeatureTemplates/t9n/FeatureTemplates")],F.prototype,"messagesTemplates",void 0),e([n("viewModel.strict")],F.prototype,"strict",void 0),e([n("viewModel.title")],F.prototype,"title",void 0),e([l(),h(["value-change","submit"])],F.prototype,"viewModel",void 0),e([n("viewModel.getValues")],F.prototype,"getValues",null),e([n("viewModel.submit")],F.prototype,"submit",null),F=e([s("geoscene.widgets.FeatureForm")],F);const w=F;export{w as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import o from"./Grid/Column.js";const s={attachmentsColumn:"esri-feature-table__column--attachments"};let a=class extends o{constructor(t){super(t),this.header="",this.path="EsriFeatureTableAttachmentsColumn",this.renderFunction=({root:t,rowData:e})=>{const r=this._countFromItem(e.item).toString();t.innerHTML=`<div class="${s.attachmentsColumn}">${r}</div>`},this.sortable=!1,this.textAlign="center"}_countFromItem(t){return t.attachments&&t.attachments.length||0}};t([e({constructOnly:!0})],a.prototype,"header",void 0),t([e({readOnly:!0})],a.prototype,"path",void 0),t([e()],a.prototype,"renderFunction",void 0),t([e({readOnly:!0})],a.prototype,"sortable",void 0),t([e({readOnly:!0})],a.prototype,"textAlign",void 0),a=t([r("geoscene.widgets.FeatureTable.AttachmentsColumn")],a);const n=a;export{n as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import{property as e}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as r}from"../../core/accessorSupport/decorators/subclass.js";import o from"./Grid/Column.js";const s={attachmentsColumn:"geoscene-feature-table__column--attachments"};let a=class extends o{constructor(t){super(t),this.header="",this.path="EsriFeatureTableAttachmentsColumn",this.renderFunction=({root:t,rowData:e})=>{const r=this._countFromItem(e.item).toString();t.innerHTML=`<div class="${s.attachmentsColumn}">${r}</div>`},this.sortable=!1,this.textAlign="center"}_countFromItem(t){return t.attachments&&t.attachments.length||0}};t([e({constructOnly:!0})],a.prototype,"header",void 0),t([e({readOnly:!0})],a.prototype,"path",void 0),t([e()],a.prototype,"renderFunction",void 0),t([e({readOnly:!0})],a.prototype,"sortable",void 0),t([e({readOnly:!0})],a.prototype,"textAlign",void 0),a=t([r("geoscene.widgets.FeatureTable.AttachmentsColumn")],a);const n=a;export{n as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{convertDateFormatToIntlOptions as i,formatDate as l}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as o,formatNumber as a}from"../../intl/number.js";import r from"../../layers/support/CodedValueDomain.js";import{isNumericField as u,isStringField as s}from"../../layers/support/fieldUtils.js";import d from"../FeatureForm/InputField.js";import c from"./Grid/EditorColumn.js";import p from"../support/DatePicker.js";import m from"../support/TimePicker.js";import{renderingSanitizer as h}from"../support/widgetUtils.js";const f={cancelEdit:"Escape"},v={headerContent:"esri-field-column__header-content",input:"esri-field-column__cell-input",inputContainer:"esri-field-column__cell__input-container",dateInputContainer:"esri-field-column__cell__date-input-container",dateInputWrapper:"esri-field-column__cell__date-input-wrapper",button:"esri-field-column__button",saveIcon:"geoscene-icon-save",trashIcon:"geoscene-icon-trash",locked:"geoscene-icon-locked"},g=i("short-date-short-time"),y=i("short-date"),b=o({digitSeparator:!0,places:null});function _(e){return"feature"===(null==e?void 0:e.type)}let F=class extends c{constructor(e){super(e),this._inputField=null,this.alias=null,this.cellValueFormatFunction=({rowData:e,value:t})=>{if(this.formatFunction){const{config:e,field:n}=this;return this.formatFunction({config:e,field:n,value:h.sanitize(t)})}if(null===t)return"&nbsp;";const{config:n,field:r,type:s}=this,{item:{feature:d}}=e,c=this._getDomainForFeature(d);if(c)return this._getComputedDomain(t,c);if("date"===s){var p;const e=null!=n&&null!=(p=n.format)&&p.dateFormat?i(n.format.dateFormat):!1===(null==n?void 0:n.includeTime)?y:g,o=_(this.layer)&&this.layer.datesInUnknownTimezone?{timeZone:"UTC"}:null;return t?l(t,{...e,...o}):null}if(u(r)){const e=null!=n&&n.format?o(n.format):b;return a(parseFloat(t),e)}return h.sanitize(t)},this.cellValueValidatorFunction=({oldValue:e,value:t})=>e!==t,this.config=null,this.defaultValue=null,this.description=null,this.editingEnabled=!1,this.field=null,this.formatFunction=null,this.headerRenderFunction=e=>{const{root:t}=e,{editable:n,editingEnabled:i,headerMenuEnabled:l,sortable:o}=this;if(this.removeCellContent(t),t.classList.add(v.headerContent),i&&!n&&t.appendChild(this.createLockedElement()),o)this.headerSorterRenderFunction(e);else{const{header:e,path:n}=this,i=document.createElement("div");i.innerHTML=e||n,t.appendChild(i)}l&&this.headerMenuRenderFunction(e)},this.inputRenderFunction=({root:e,column:t,rowData:n})=>{var i,l;if(null!=(i=this.activeEditInfo)&&i.updating)return;if(!this.editable)return;const o=this.getCellValue(t,n),a=this.createInputElement({root:e,column:t,rowData:n,value:o});if(this._set("activeEditInfo",{column:t,input:a,root:e,rowData:n,updating:!0,oldValue:o}),"date"===this.type)return void this._renderDateEditors(o,e,a);const r=this.createInputContainer();r.appendChild(a),this.removeCellContent(e),e.appendChild(r),a.focus(),a instanceof HTMLInputElement&&a.select(),null==(l=this.grid)||l.notifyResize()},this.layer=null,this.menuConfig=null,this.name=null,this.nullable=!0,this.parseInputValueFunction=({input:e})=>{const t=this._inputField,n=e.value,{required:i,type:l}=t;return i||""!==n?"number"===l||"date"===l?parseFloat(n):n:null},this.type=null,this.updateRowItemFunction=({rowData:e,column:t,value:n})=>{e.item.feature.attributes[t.path]=n}}get editable(){var e,t,n;return this.editingEnabled?this.config?!1!==this.config.editable&&(null==(t=this.field)?void 0:t.editable):null==(n=this.field)?void 0:n.editable:!!this.config&&(!0===this.config.editable&&(null==(e=this.field)?void 0:e.editable))}get header(){var e;return(null==(e=this.config)?void 0:e.label)||this.alias||this.path||null}get hidden(){const{config:e}=this;return!1===(null==e?void 0:e.visible)||this._get("hidden")||!1}set hidden(e){this._set("hidden",e)}get loadingMessage(){var e;return(null==(e=this.messages)?void 0:e.loading)||"..."}get maxLength(){var e,t;const n=null==(e=this.field)?void 0:e.length,i=null==(t=this.config)?void 0:t.maxLength;return!isNaN(i)&&i>=-1&&(-1===n||i<=n)?i:n}get path(){var e;return(null==(e=this.field)?void 0:e.name)||null}get required(){const e=this.get("field.nullable"),t=this.get("config.required");return this.editable&&(!e||!0===t)}get sortable(){var e;return!1!==(null==(e=this.config)?void 0:e.sortable)}createInputElement({rowData:e,value:t}){const{item:n}=e;if(!n||!n.feature)return null;this._inputField=this._setUpInputField(n.feature,t);const{field:i,maxLength:l,required:o}=this,{domain:a}=this._inputField;let r=null;"coded-value"===(null==a?void 0:a.type)?(r=this._createSelectElement(t,a.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),this._inputField),r.onchange=()=>{r.onblur=null,d()}):(r=document.createElement("input"),r.type=u(i)?"number":"text",l>-1&&(r.maxLength=l)),r.classList.add(v.input),r.value=t,r.required=o;let s=!1;r.onkeydown=e=>{s=e.key===f.cancelEdit},r.onblur=()=>{r.onblur=null,d()};const d=()=>{s?this.cancel():this.submit(),this._inputField=null};return r}createInputContainer(){const e=document.createElement("div");return e.classList.add(v.inputContainer),e}createLockedElement(){const e=document.createElement("div");return e.classList.add(v.locked),e}getCellValue({path:e},{item:t}){var n,i,l;return null!=(n=null==t||null==(i=t.feature)||null==(l=i.attributes)?void 0:l[e])?n:null}_renderDateEditors(e,t,n){var i;const{config:l,messagesCommon:o}=this,a=e?new Date(e):new Date(Date.now()),r=new p({dateInputEnabled:!0,value:a}),u=new m({value:a});n.value=a.getTime().toString();let s=!e;const d=()=>{s=!0;const e=this._getCombinedDateTime(r.value,u.value);n.value=e.getTime().toString()},c=()=>{s?this.submit():this.cancel()},h=()=>{n.value=null,this.submit()};r.watch("value",(()=>d())),u.watch("value",(()=>d()));const f=document.createElement("div"),g=document.createElement("div");r.container=f,u.container=g;const y=document.createElement("button");y.classList.add(v.button,v.saveIcon),y.onclick=()=>c(),y.title=null==o?void 0:o.save;const b=document.createElement("button");b.classList.add(v.button,v.trashIcon),b.onclick=()=>h(),b.title=null==o?void 0:o.clear;const _=document.createElement("div");_.classList.add(v.dateInputWrapper),_.appendChild(f),!1!==l.includeTime&&_.appendChild(g);const F=document.createElement("div");F.classList.add(v.dateInputContainer),F.appendChild(_),F.appendChild(y),F.appendChild(b),r.when((()=>{var e;return null==(e=this.grid)?void 0:e.notifyResize()})),u.when((()=>{var e;return null==(e=this.grid)?void 0:e.notifyResize()})),this.removeCellContent(t),t.appendChild(F),null==(i=this.grid)||i.notifyResize()}_createSelectElement(e,t,n){let i=!1;const l=t.map((t=>{t.value===e&&(i=!0);const n=document.createElement("option");return n.text=t.name,n.value=t.value,n}));if(null!=e&&""!==e&&!i){const t=document.createElement("option");t.text=e,t.value=e,l.unshift(t)}if(!n.required&&null==n.value){const e=document.createElement("option");e.value="",l.unshift(e)}const o=document.createElement("select");return l.forEach((e=>o.add(e))),o.value=e,o}_setUpInputField(e,t){const{config:n,field:i,layer:l}=this,o=new d({config:n,feature:e,field:i,layer:l,group:null,messages:null});return o.set("value",t),o}_isDomainCompatible(e){const{field:t}=this;if(e&&"coded-value"===e.type){const n=typeof e.codedValues[0].code;if("string"===n&&s(t)||"number"===n&&u(t))return!0}return!(!e||"range"!==e.type||!u(t))}_getDomainForFeature(e){const{layer:t,name:n}=this;if("wfs"===t.type||"geojson"===t.type)return null;const{typeIdField:i}=t,l=i===n,o=this.get("field.domain");if(l&&!o)return new r({name:"__internal-type-based-coded-value-domain__",codedValues:t.types.map((({id:e,name:t})=>({code:e,name:t})))});const a=i&&t.getFieldDomain(n,{feature:e})||o,u=this.get("config.domain");return this._isDomainCompatible(u)?u:a}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const n=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return n&&n.length?n[0].name:e}return null}_getCombinedDateTime(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds())}};e([t({readOnly:!0,aliasOf:"field.alias"})],F.prototype,"alias",void 0),e([t()],F.prototype,"cellValueFormatFunction",void 0),e([t()],F.prototype,"cellValueValidatorFunction",void 0),e([t()],F.prototype,"config",void 0),e([t({readOnly:!0,aliasOf:"field.defaultValue"})],F.prototype,"defaultValue",void 0),e([t({readOnly:!0,aliasOf:"field.description"})],F.prototype,"description",void 0),e([t({readOnly:!0})],F.prototype,"editable",null),e([t()],F.prototype,"editingEnabled",void 0),e([t()],F.prototype,"field",void 0),e([t()],F.prototype,"formatFunction",void 0),e([t({readOnly:!0})],F.prototype,"header",null),e([t()],F.prototype,"hidden",null),e([t()],F.prototype,"headerRenderFunction",void 0),e([t()],F.prototype,"inputRenderFunction",void 0),e([t()],F.prototype,"layer",void 0),e([t({readOnly:!0})],F.prototype,"loadingMessage",null),e([t()],F.prototype,"maxLength",null),e([t({readOnly:!0,aliasOf:"config.menuConfig"})],F.prototype,"menuConfig",void 0),e([t({readOnly:!0,aliasOf:"field.name"})],F.prototype,"name",void 0),e([t({readOnly:!0,aliasOf:"field.nullable"})],F.prototype,"nullable",void 0),e([t()],F.prototype,"parseInputValueFunction",void 0),e([t({readOnly:!0})],F.prototype,"path",null),e([t({readOnly:!0})],F.prototype,"required",null),e([t()],F.prototype,"sortable",null),e([t({readOnly:!0,aliasOf:"field.type"})],F.prototype,"type",void 0),e([t()],F.prototype,"updateRowItemFunction",void 0),F=e([n("geoscene.widgets.FeatureTable.FieldColumn")],F);const C=F;export{C as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";import{convertDateFormatToIntlOptions as i,formatDate as l}from"../../intl/date.js";import{convertNumberFormatToIntlOptions as o,formatNumber as a}from"../../intl/number.js";import r from"../../layers/support/CodedValueDomain.js";import{isNumericField as u,isStringField as s}from"../../layers/support/fieldUtils.js";import d from"../FeatureForm/InputField.js";import c from"./Grid/EditorColumn.js";import p from"../support/DatePicker.js";import m from"../support/TimePicker.js";import{renderingSanitizer as h}from"../support/widgetUtils.js";const f={cancelEdit:"Escape"},v={headerContent:"geoscene-field-column__header-content",input:"geoscene-field-column__cell-input",inputContainer:"geoscene-field-column__cell__input-container",dateInputContainer:"geoscene-field-column__cell__date-input-container",dateInputWrapper:"geoscene-field-column__cell__date-input-wrapper",button:"geoscene-field-column__button",saveIcon:"geoscene-icon-save",trashIcon:"geoscene-icon-trash",locked:"geoscene-icon-locked"},g=i("short-date-short-time"),y=i("short-date"),b=o({digitSeparator:!0,places:null});function _(e){return"feature"===(null==e?void 0:e.type)}let F=class extends c{constructor(e){super(e),this._inputField=null,this.alias=null,this.cellValueFormatFunction=({rowData:e,value:t})=>{if(this.formatFunction){const{config:e,field:n}=this;return this.formatFunction({config:e,field:n,value:h.sanitize(t)})}if(null===t)return"&nbsp;";const{config:n,field:r,type:s}=this,{item:{feature:d}}=e,c=this._getDomainForFeature(d);if(c)return this._getComputedDomain(t,c);if("date"===s){var p;const e=null!=n&&null!=(p=n.format)&&p.dateFormat?i(n.format.dateFormat):!1===(null==n?void 0:n.includeTime)?y:g,o=_(this.layer)&&this.layer.datesInUnknownTimezone?{timeZone:"UTC"}:null;return t?l(t,{...e,...o}):null}if(u(r)){const e=null!=n&&n.format?o(n.format):b;return a(parseFloat(t),e)}return h.sanitize(t)},this.cellValueValidatorFunction=({oldValue:e,value:t})=>e!==t,this.config=null,this.defaultValue=null,this.description=null,this.editingEnabled=!1,this.field=null,this.formatFunction=null,this.headerRenderFunction=e=>{const{root:t}=e,{editable:n,editingEnabled:i,headerMenuEnabled:l,sortable:o}=this;if(this.removeCellContent(t),t.classList.add(v.headerContent),i&&!n&&t.appendChild(this.createLockedElement()),o)this.headerSorterRenderFunction(e);else{const{header:e,path:n}=this,i=document.createElement("div");i.innerHTML=e||n,t.appendChild(i)}l&&this.headerMenuRenderFunction(e)},this.inputRenderFunction=({root:e,column:t,rowData:n})=>{var i,l;if(null!=(i=this.activeEditInfo)&&i.updating)return;if(!this.editable)return;const o=this.getCellValue(t,n),a=this.createInputElement({root:e,column:t,rowData:n,value:o});if(this._set("activeEditInfo",{column:t,input:a,root:e,rowData:n,updating:!0,oldValue:o}),"date"===this.type)return void this._renderDateEditors(o,e,a);const r=this.createInputContainer();r.appendChild(a),this.removeCellContent(e),e.appendChild(r),a.focus(),a instanceof HTMLInputElement&&a.select(),null==(l=this.grid)||l.notifyResize()},this.layer=null,this.menuConfig=null,this.name=null,this.nullable=!0,this.parseInputValueFunction=({input:e})=>{const t=this._inputField,n=e.value,{required:i,type:l}=t;return i||""!==n?"number"===l||"date"===l?parseFloat(n):n:null},this.type=null,this.updateRowItemFunction=({rowData:e,column:t,value:n})=>{e.item.feature.attributes[t.path]=n}}get editable(){var e,t,n;return this.editingEnabled?this.config?!1!==this.config.editable&&(null==(t=this.field)?void 0:t.editable):null==(n=this.field)?void 0:n.editable:!!this.config&&(!0===this.config.editable&&(null==(e=this.field)?void 0:e.editable))}get header(){var e;return(null==(e=this.config)?void 0:e.label)||this.alias||this.path||null}get hidden(){const{config:e}=this;return!1===(null==e?void 0:e.visible)||this._get("hidden")||!1}set hidden(e){this._set("hidden",e)}get loadingMessage(){var e;return(null==(e=this.messages)?void 0:e.loading)||"..."}get maxLength(){var e,t;const n=null==(e=this.field)?void 0:e.length,i=null==(t=this.config)?void 0:t.maxLength;return!isNaN(i)&&i>=-1&&(-1===n||i<=n)?i:n}get path(){var e;return(null==(e=this.field)?void 0:e.name)||null}get required(){const e=this.get("field.nullable"),t=this.get("config.required");return this.editable&&(!e||!0===t)}get sortable(){var e;return!1!==(null==(e=this.config)?void 0:e.sortable)}createInputElement({rowData:e,value:t}){const{item:n}=e;if(!n||!n.feature)return null;this._inputField=this._setUpInputField(n.feature,t);const{field:i,maxLength:l,required:o}=this,{domain:a}=this._inputField;let r=null;"coded-value"===(null==a?void 0:a.type)?(r=this._createSelectElement(t,a.codedValues.map((({code:e,name:t})=>({value:e,name:t}))),this._inputField),r.onchange=()=>{r.onblur=null,d()}):(r=document.createElement("input"),r.type=u(i)?"number":"text",l>-1&&(r.maxLength=l)),r.classList.add(v.input),r.value=t,r.required=o;let s=!1;r.onkeydown=e=>{s=e.key===f.cancelEdit},r.onblur=()=>{r.onblur=null,d()};const d=()=>{s?this.cancel():this.submit(),this._inputField=null};return r}createInputContainer(){const e=document.createElement("div");return e.classList.add(v.inputContainer),e}createLockedElement(){const e=document.createElement("div");return e.classList.add(v.locked),e}getCellValue({path:e},{item:t}){var n,i,l;return null!=(n=null==t||null==(i=t.feature)||null==(l=i.attributes)?void 0:l[e])?n:null}_renderDateEditors(e,t,n){var i;const{config:l,messagesCommon:o}=this,a=e?new Date(e):new Date(Date.now()),r=new p({dateInputEnabled:!0,value:a}),u=new m({value:a});n.value=a.getTime().toString();let s=!e;const d=()=>{s=!0;const e=this._getCombinedDateTime(r.value,u.value);n.value=e.getTime().toString()},c=()=>{s?this.submit():this.cancel()},h=()=>{n.value=null,this.submit()};r.watch("value",(()=>d())),u.watch("value",(()=>d()));const f=document.createElement("div"),g=document.createElement("div");r.container=f,u.container=g;const y=document.createElement("button");y.classList.add(v.button,v.saveIcon),y.onclick=()=>c(),y.title=null==o?void 0:o.save;const b=document.createElement("button");b.classList.add(v.button,v.trashIcon),b.onclick=()=>h(),b.title=null==o?void 0:o.clear;const _=document.createElement("div");_.classList.add(v.dateInputWrapper),_.appendChild(f),!1!==l.includeTime&&_.appendChild(g);const F=document.createElement("div");F.classList.add(v.dateInputContainer),F.appendChild(_),F.appendChild(y),F.appendChild(b),r.when((()=>{var e;return null==(e=this.grid)?void 0:e.notifyResize()})),u.when((()=>{var e;return null==(e=this.grid)?void 0:e.notifyResize()})),this.removeCellContent(t),t.appendChild(F),null==(i=this.grid)||i.notifyResize()}_createSelectElement(e,t,n){let i=!1;const l=t.map((t=>{t.value===e&&(i=!0);const n=document.createElement("option");return n.text=t.name,n.value=t.value,n}));if(null!=e&&""!==e&&!i){const t=document.createElement("option");t.text=e,t.value=e,l.unshift(t)}if(!n.required&&null==n.value){const e=document.createElement("option");e.value="",l.unshift(e)}const o=document.createElement("select");return l.forEach((e=>o.add(e))),o.value=e,o}_setUpInputField(e,t){const{config:n,field:i,layer:l}=this,o=new d({config:n,feature:e,field:i,layer:l,group:null,messages:null});return o.set("value",t),o}_isDomainCompatible(e){const{field:t}=this;if(e&&"coded-value"===e.type){const n=typeof e.codedValues[0].code;if("string"===n&&s(t)||"number"===n&&u(t))return!0}return!(!e||"range"!==e.type||!u(t))}_getDomainForFeature(e){const{layer:t,name:n}=this;if("wfs"===t.type||"geojson"===t.type)return null;const{typeIdField:i}=t,l=i===n,o=this.get("field.domain");if(l&&!o)return new r({name:"__internal-type-based-coded-value-domain__",codedValues:t.types.map((({id:e,name:t})=>({code:e,name:t})))});const a=i&&t.getFieldDomain(n,{feature:e})||o,u=this.get("config.domain");return this._isDomainCompatible(u)?u:a}_getComputedDomain(e,t){if(!t)return null;if("range"===t.type)return e;if("coded-value"===t.type){const n=t.codedValues.filter((t=>t.hasOwnProperty("code")&&t.code===e));return n&&n.length?n[0].name:e}return null}_getCombinedDateTime(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),t.getHours(),t.getMinutes(),t.getSeconds())}};e([t({readOnly:!0,aliasOf:"field.alias"})],F.prototype,"alias",void 0),e([t()],F.prototype,"cellValueFormatFunction",void 0),e([t()],F.prototype,"cellValueValidatorFunction",void 0),e([t()],F.prototype,"config",void 0),e([t({readOnly:!0,aliasOf:"field.defaultValue"})],F.prototype,"defaultValue",void 0),e([t({readOnly:!0,aliasOf:"field.description"})],F.prototype,"description",void 0),e([t({readOnly:!0})],F.prototype,"editable",null),e([t()],F.prototype,"editingEnabled",void 0),e([t()],F.prototype,"field",void 0),e([t()],F.prototype,"formatFunction",void 0),e([t({readOnly:!0})],F.prototype,"header",null),e([t()],F.prototype,"hidden",null),e([t()],F.prototype,"headerRenderFunction",void 0),e([t()],F.prototype,"inputRenderFunction",void 0),e([t()],F.prototype,"layer",void 0),e([t({readOnly:!0})],F.prototype,"loadingMessage",null),e([t()],F.prototype,"maxLength",null),e([t({readOnly:!0,aliasOf:"config.menuConfig"})],F.prototype,"menuConfig",void 0),e([t({readOnly:!0,aliasOf:"field.name"})],F.prototype,"name",void 0),e([t({readOnly:!0,aliasOf:"field.nullable"})],F.prototype,"nullable",void 0),e([t()],F.prototype,"parseInputValueFunction",void 0),e([t({readOnly:!0})],F.prototype,"path",null),e([t({readOnly:!0})],F.prototype,"required",null),e([t()],F.prototype,"sortable",null),e([t({readOnly:!0,aliasOf:"field.type"})],F.prototype,"type",void 0),e([t()],F.prototype,"updateRowItemFunction",void 0),F=e([n("geoscene.widgets.FeatureTable.FieldColumn")],F);const C=F;export{C as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Evented.js";import{HandleOwnerMixin as o}from"../../../core/HandleOwner.js";import{isSome as i}from"../../../core/maybe.js";import{watch as r}from"../../../core/watchUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import l from"./support/ButtonMenu.js";import{renderingSanitizer as d}from"../../support/widgetUtils.js";const a={sortAscIcon:"geoscene-icon-arrow-up",sortDescIcon:"geoscene-icon-arrow-down",menuContainer:"esri-column__menu-container",menuIcon:"geoscene-icon-handle-horizontal",sorter:"esri-column__sorter"},u={keyboardSort1:"Enter",keyboardSort2:"Spacebar"};let c=class extends(o(e.EventedAccessor)){constructor(t){super(t),this._menuContainer=null,this.activeRowIndex=null,this.autoWidth=!1,this.cellValueFormatFunction=({value:t})=>d.sanitize(t),this.flexGrow=1,this.footerRenderFunction=null,this.frozen=!1,this.grid=null,this.header=null,this.headerRenderFunction=t=>{const{root:e}=t,{header:o,headerMenuEnabled:i,path:r,sortable:n}=this;if(this.removeCellContent(e),n)return this.headerSorterRenderFunction(t),void(i&&this.headerMenuRenderFunction(t));i&&this.headerMenuRenderFunction(t);const s=o||r;e.innerHTML!==s&&(e.innerHTML=s)},this.headerMenuRenderFunction=({root:t})=>{var e,o;(null==(e=this.menu)||null==(o=e.items)?void 0:o.length)&&t.appendChild(this._menuContainer)},this.headerSorterRenderFunction=({root:t})=>{var e;const{header:o,path:i,sortElement:r}=this,n=o||i;if(!r)return void(t.innerHTML=n);r.innerHTML!==n&&r.setAttribute("innerHTML",n),t.appendChild(r);const s=null==(e=this.grid)?void 0:e.getSlotElementByName(t.slot),l=null==s?void 0:s.parentElement;l&&!l.onkeydown&&(l.onkeydown=({key:t})=>{t!==u.keyboardSort1&&t!==u.keyboardSort2||r.click()})},this.hidden=!1,this.headerMenuEnabled=!0,this.initialSortPriority=null,this.menu=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.renderFunction=({root:t,column:e,rowData:o})=>{const i=this.getCellValue(e,o),r=this.cellValueFormatFunction({column:e,rowData:o,value:i});t.innerHTML!==r&&(t.innerHTML=r)},this.resizable=!0,this.sortable=!0,this.sortElement=null,this.textAlign="start",this.width=200}initialize(){const{messages:t,path:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e),this._menuContainer=document.createElement("div"),this._menuContainer.classList.add(a.menuContainer),this.menu=new l({label:null==t?void 0:t.options,iconClass:a.menuIcon,...this.menuConfig}),this.menu.container=this._menuContainer,this.menu.set("items",this.getMenuItems()),this.handles.add([r(this,"hidden",(()=>{var t;return null==(t=this.menu)?void 0:t.set("open",!1)}))])}destroy(){var t;null==(t=this.menu)||t.destroy()}set direction(t){this.sortable&&(this.sortElement&&(t?this.sortElement.direction!==t&&this.sortElement.setAttribute("direction",t):this.sortElement.removeAttribute("direction")),this._set("direction",t))}get direction(){return this._get("direction")||null}set path(t){this.sortElement&&this.sortElement.path!==t&&this.sortElement.setAttribute("path",t),this._set("path",t)}getMenuItems(){const{menuConfig:t,sortable:e}=this,o=null==t?void 0:t.items,i=this.getSortMenuItems(),r=[];return e&&r.push(...i),(null==o?void 0:o.length)&&r.push(...o),r.length?r:null}getSortMenuItems(){const{messages:t}=this;return[{selected:"asc"===this.direction,iconClass:a.sortAscIcon,label:null==t?void 0:t.sortAsc,autoCloseMenu:!0,clickFunction:()=>this.set("direction","asc"!==this.direction?"asc":null)},{selected:"desc"===this.direction,iconClass:a.sortDescIcon,label:null==t?void 0:t.sortDesc,autoCloseMenu:!0,clickFunction:()=>this.set("direction","desc"!==this.direction?"desc":null)}]}getCellValue(t,e){var o;return null!=(o=null==e?void 0:e.item[null==t?void 0:t.path])?o:""}createSortElement(){const{direction:t,header:e,path:o,initialSortPriority:r}=this,n=e||o,s=document.createElement("vaadin-grid-sorter");return s.classList.add(a.sorter),s.setAttribute("path",o),s.setAttribute("title",n),s.innerHTML=n,t&&s.setAttribute("direction",t),i(r)&&(s._initialOrder=r),s.addEventListener("direction-changed",(()=>{this.direction!==s.direction&&this._set("direction",s.direction)})),s}removeCellContent(t){if(t)for(;t.firstChild;)try{t.removeChild(t.firstChild)}catch(e){}}};t([n()],c.prototype,"activeRowIndex",void 0),t([n()],c.prototype,"autoWidth",void 0),t([n()],c.prototype,"cellValueFormatFunction",void 0),t([n()],c.prototype,"direction",null),t([n()],c.prototype,"flexGrow",void 0),t([n()],c.prototype,"footerRenderFunction",void 0),t([n()],c.prototype,"frozen",void 0),t([n()],c.prototype,"grid",void 0),t([n()],c.prototype,"header",void 0),t([n()],c.prototype,"headerRenderFunction",void 0),t([n()],c.prototype,"headerMenuRenderFunction",void 0),t([n()],c.prototype,"headerSorterRenderFunction",void 0),t([n()],c.prototype,"hidden",void 0),t([n()],c.prototype,"headerMenuEnabled",void 0),t([n({constructOnly:!0})],c.prototype,"initialSortPriority",void 0),t([n()],c.prototype,"menu",void 0),t([n()],c.prototype,"menuConfig",void 0),t([n()],c.prototype,"messages",void 0),t([n()],c.prototype,"messagesCommon",void 0),t([n()],c.prototype,"path",null),t([n()],c.prototype,"renderFunction",void 0),t([n()],c.prototype,"resizable",void 0),t([n()],c.prototype,"sortable",void 0),t([n({readOnly:!0})],c.prototype,"sortElement",void 0),t([n()],c.prototype,"textAlign",void 0),t([n()],c.prototype,"width",void 0),c=t([s("geoscene.widgets.FeatureTable.Grid.Column")],c);const h=c;export{h as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Evented.js";import{HandleOwnerMixin as o}from"../../../core/HandleOwner.js";import{isSome as i}from"../../../core/maybe.js";import{watch as r}from"../../../core/watchUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";import l from"./support/ButtonMenu.js";import{renderingSanitizer as d}from"../../support/widgetUtils.js";const a={sortAscIcon:"geoscene-icon-arrow-up",sortDescIcon:"geoscene-icon-arrow-down",menuContainer:"geoscene-column__menu-container",menuIcon:"geoscene-icon-handle-horizontal",sorter:"geoscene-column__sorter"},u={keyboardSort1:"Enter",keyboardSort2:"Spacebar"};let c=class extends(o(e.EventedAccessor)){constructor(t){super(t),this._menuContainer=null,this.activeRowIndex=null,this.autoWidth=!1,this.cellValueFormatFunction=({value:t})=>d.sanitize(t),this.flexGrow=1,this.footerRenderFunction=null,this.frozen=!1,this.grid=null,this.header=null,this.headerRenderFunction=t=>{const{root:e}=t,{header:o,headerMenuEnabled:i,path:r,sortable:n}=this;if(this.removeCellContent(e),n)return this.headerSorterRenderFunction(t),void(i&&this.headerMenuRenderFunction(t));i&&this.headerMenuRenderFunction(t);const s=o||r;e.innerHTML!==s&&(e.innerHTML=s)},this.headerMenuRenderFunction=({root:t})=>{var e,o;(null==(e=this.menu)||null==(o=e.items)?void 0:o.length)&&t.appendChild(this._menuContainer)},this.headerSorterRenderFunction=({root:t})=>{var e;const{header:o,path:i,sortElement:r}=this,n=o||i;if(!r)return void(t.innerHTML=n);r.innerHTML!==n&&r.setAttribute("innerHTML",n),t.appendChild(r);const s=null==(e=this.grid)?void 0:e.getSlotElementByName(t.slot),l=null==s?void 0:s.parentElement;l&&!l.onkeydown&&(l.onkeydown=({key:t})=>{t!==u.keyboardSort1&&t!==u.keyboardSort2||r.click()})},this.hidden=!1,this.headerMenuEnabled=!0,this.initialSortPriority=null,this.menu=null,this.menuConfig=null,this.messages=null,this.messagesCommon=null,this.renderFunction=({root:t,column:e,rowData:o})=>{const i=this.getCellValue(e,o),r=this.cellValueFormatFunction({column:e,rowData:o,value:i});t.innerHTML!==r&&(t.innerHTML=r)},this.resizable=!0,this.sortable=!0,this.sortElement=null,this.textAlign="start",this.width=200}initialize(){const{messages:t,path:e}=this;this._set("sortElement",this.createSortElement()),this.sortElement.setAttribute("path",e),this._menuContainer=document.createElement("div"),this._menuContainer.classList.add(a.menuContainer),this.menu=new l({label:null==t?void 0:t.options,iconClass:a.menuIcon,...this.menuConfig}),this.menu.container=this._menuContainer,this.menu.set("items",this.getMenuItems()),this.handles.add([r(this,"hidden",(()=>{var t;return null==(t=this.menu)?void 0:t.set("open",!1)}))])}destroy(){var t;null==(t=this.menu)||t.destroy()}set direction(t){this.sortable&&(this.sortElement&&(t?this.sortElement.direction!==t&&this.sortElement.setAttribute("direction",t):this.sortElement.removeAttribute("direction")),this._set("direction",t))}get direction(){return this._get("direction")||null}set path(t){this.sortElement&&this.sortElement.path!==t&&this.sortElement.setAttribute("path",t),this._set("path",t)}getMenuItems(){const{menuConfig:t,sortable:e}=this,o=null==t?void 0:t.items,i=this.getSortMenuItems(),r=[];return e&&r.push(...i),(null==o?void 0:o.length)&&r.push(...o),r.length?r:null}getSortMenuItems(){const{messages:t}=this;return[{selected:"asc"===this.direction,iconClass:a.sortAscIcon,label:null==t?void 0:t.sortAsc,autoCloseMenu:!0,clickFunction:()=>this.set("direction","asc"!==this.direction?"asc":null)},{selected:"desc"===this.direction,iconClass:a.sortDescIcon,label:null==t?void 0:t.sortDesc,autoCloseMenu:!0,clickFunction:()=>this.set("direction","desc"!==this.direction?"desc":null)}]}getCellValue(t,e){var o;return null!=(o=null==e?void 0:e.item[null==t?void 0:t.path])?o:""}createSortElement(){const{direction:t,header:e,path:o,initialSortPriority:r}=this,n=e||o,s=document.createElement("vaadin-grid-sorter");return s.classList.add(a.sorter),s.setAttribute("path",o),s.setAttribute("title",n),s.innerHTML=n,t&&s.setAttribute("direction",t),i(r)&&(s._initialOrder=r),s.addEventListener("direction-changed",(()=>{this.direction!==s.direction&&this._set("direction",s.direction)})),s}removeCellContent(t){if(t)for(;t.firstChild;)try{t.removeChild(t.firstChild)}catch(e){}}};t([n()],c.prototype,"activeRowIndex",void 0),t([n()],c.prototype,"autoWidth",void 0),t([n()],c.prototype,"cellValueFormatFunction",void 0),t([n()],c.prototype,"direction",null),t([n()],c.prototype,"flexGrow",void 0),t([n()],c.prototype,"footerRenderFunction",void 0),t([n()],c.prototype,"frozen",void 0),t([n()],c.prototype,"grid",void 0),t([n()],c.prototype,"header",void 0),t([n()],c.prototype,"headerRenderFunction",void 0),t([n()],c.prototype,"headerMenuRenderFunction",void 0),t([n()],c.prototype,"headerSorterRenderFunction",void 0),t([n()],c.prototype,"hidden",void 0),t([n()],c.prototype,"headerMenuEnabled",void 0),t([n({constructOnly:!0})],c.prototype,"initialSortPriority",void 0),t([n()],c.prototype,"menu",void 0),t([n()],c.prototype,"menuConfig",void 0),t([n()],c.prototype,"messages",void 0),t([n()],c.prototype,"messagesCommon",void 0),t([n()],c.prototype,"path",null),t([n()],c.prototype,"renderFunction",void 0),t([n()],c.prototype,"resizable",void 0),t([n()],c.prototype,"sortable",void 0),t([n({readOnly:!0})],c.prototype,"sortElement",void 0),t([n()],c.prototype,"textAlign",void 0),t([n()],c.prototype,"width",void 0),c=t([s("geoscene.widgets.FeatureTable.Grid.Column")],c);const h=c;export{h as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import o from"./Column.js";const i={input:"esri-editor-column__cell-input",inputContainer:"esri-editor-column__cell-input--container"},a={showInput:"Enter",hideInput:"Escape"};let u=class extends o{constructor(t){super(t),this.activeEditInfo=null,this.cellValueValidatorFunction=({oldValue:t,value:e})=>t!==e,this.editable=!1,this.inputRenderFunction=({root:t,column:e,rowData:n})=>{var o,i;if(null!=(o=this.activeEditInfo)&&o.updating)return;if(!this.editable)return;const a=this.getCellValue(e,n),u=this.createInputElement({root:t,column:e,rowData:n,value:a});this._set("activeEditInfo",{column:e,input:u,root:t,rowData:n,updating:!0,oldValue:a});const r=this.createInputContainer();r.appendChild(u),this.removeCellContent(t),t.appendChild(r),u.focus(),u instanceof HTMLInputElement&&u.select(),null==(i=this.grid)||i.notifyResize()},this.loadingMessage="",this.inputType="text",this.maxLength=null,this.parseInputValueFunction=({input:t})=>t.value,this.renderFunction=t=>{var e;const{root:n,column:o,rowData:i}=t,{activeEditInfo:u}=this;if(u&&u.updating)return;const r=this.getCellValue(o,i),l=this.cellValueFormatFunction({column:o,rowData:i,value:r});n.onclick=()=>n.focus(),n.ondblclick=()=>this.inputRenderFunction(t),n.ontouchend=()=>this.inputRenderFunction(t);const s=null==(e=this.grid)?void 0:e.getSlotElementByName(n.slot),c=null==s?void 0:s.parentElement;c&&!c.onkeydown&&(c.onkeydown=e=>{e.key!==a.showInput||this.activeEditInfo||this.inputRenderFunction(t),e.key===a.hideInput&&this.activeEditInfo&&this.cancel()}),(null==l?void 0:l.toString())!==n.innerHTML&&(n.innerHTML=l)},this.required=!1,this.store=null,this.updateRowItemFunction=({rowData:t,column:e,value:n})=>{t.item[e.path]=n},this.updateStoreItemFunction=({rowData:t,column:e,value:n})=>{var o;return null==(o=this.store)?void 0:o.updateItem({index:t.index,name:e.path,value:n})}}cancel(){var t;const{activeEditInfo:e}=this;if(!e)return;const{column:n,root:o,rowData:i,oldValue:a}=e;this._set("activeEditInfo",null);const u=this.cellValueFormatFunction({column:n,rowData:i,value:a});o.innerHTML=u,null==(t=this.grid)||t.notifyResize()}createInputContainer(){const t=document.createElement("div");return t.classList.add(i.inputContainer),t}createInputElement({value:t}){const e=document.createElement("input");return e.classList.add(i.input),e.maxLength=this.maxLength,e.type=this.inputType,e.value=t,e.onblur=()=>{e.onblur=null,this.submit()},e}async submit(){var t;const{activeEditInfo:e}=this;if(!e)return;const{column:n,input:o,root:i,rowData:a,oldValue:u}=e,r=this.parseInputValueFunction({input:o,column:n,rowData:a});if(!this.cellValueValidatorFunction({value:r,oldValue:u,column:n,rowData:a}))this.cancel();else{i.innerHTML=this.loadingMessage,null==(t=this.grid)||t.notifyResize();try{var l;await this.updateStoreItemFunction({rowData:a,column:n,value:r}),this.updateRowItemFunction({rowData:a,column:n,value:r});const t=this.getCellValue(n,a),e=this.cellValueFormatFunction({column:n,rowData:a,value:t});i.innerHTML=e,this.emit("value-change",{column:n,rowData:a,value:t}),this._set("activeEditInfo",null),null==(l=this.grid)||l.notifyResize()}catch(s){this.cancel()}}}};t([e({readOnly:!0})],u.prototype,"activeEditInfo",void 0),t([e()],u.prototype,"cellValueValidatorFunction",void 0),t([e()],u.prototype,"editable",void 0),t([e()],u.prototype,"inputRenderFunction",void 0),t([e({constructOnly:!0})],u.prototype,"loadingMessage",void 0),t([e()],u.prototype,"inputType",void 0),t([e()],u.prototype,"maxLength",void 0),t([e()],u.prototype,"parseInputValueFunction",void 0),t([e()],u.prototype,"renderFunction",void 0),t([e()],u.prototype,"required",void 0),t([e()],u.prototype,"store",void 0),t([e()],u.prototype,"updateRowItemFunction",void 0),t([e()],u.prototype,"updateStoreItemFunction",void 0),u=t([n("geoscene.widgets.FeatureTable.EditorColumn")],u);const r=u;export{r as default};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import o from"./Column.js";const i={input:"geoscene-editor-column__cell-input",inputContainer:"geoscene-editor-column__cell-input--container"},a={showInput:"Enter",hideInput:"Escape"};let u=class extends o{constructor(t){super(t),this.activeEditInfo=null,this.cellValueValidatorFunction=({oldValue:t,value:e})=>t!==e,this.editable=!1,this.inputRenderFunction=({root:t,column:e,rowData:n})=>{var o,i;if(null!=(o=this.activeEditInfo)&&o.updating)return;if(!this.editable)return;const a=this.getCellValue(e,n),u=this.createInputElement({root:t,column:e,rowData:n,value:a});this._set("activeEditInfo",{column:e,input:u,root:t,rowData:n,updating:!0,oldValue:a});const r=this.createInputContainer();r.appendChild(u),this.removeCellContent(t),t.appendChild(r),u.focus(),u instanceof HTMLInputElement&&u.select(),null==(i=this.grid)||i.notifyResize()},this.loadingMessage="",this.inputType="text",this.maxLength=null,this.parseInputValueFunction=({input:t})=>t.value,this.renderFunction=t=>{var e;const{root:n,column:o,rowData:i}=t,{activeEditInfo:u}=this;if(u&&u.updating)return;const r=this.getCellValue(o,i),l=this.cellValueFormatFunction({column:o,rowData:i,value:r});n.onclick=()=>n.focus(),n.ondblclick=()=>this.inputRenderFunction(t),n.ontouchend=()=>this.inputRenderFunction(t);const s=null==(e=this.grid)?void 0:e.getSlotElementByName(n.slot),c=null==s?void 0:s.parentElement;c&&!c.onkeydown&&(c.onkeydown=e=>{e.key!==a.showInput||this.activeEditInfo||this.inputRenderFunction(t),e.key===a.hideInput&&this.activeEditInfo&&this.cancel()}),(null==l?void 0:l.toString())!==n.innerHTML&&(n.innerHTML=l)},this.required=!1,this.store=null,this.updateRowItemFunction=({rowData:t,column:e,value:n})=>{t.item[e.path]=n},this.updateStoreItemFunction=({rowData:t,column:e,value:n})=>{var o;return null==(o=this.store)?void 0:o.updateItem({index:t.index,name:e.path,value:n})}}cancel(){var t;const{activeEditInfo:e}=this;if(!e)return;const{column:n,root:o,rowData:i,oldValue:a}=e;this._set("activeEditInfo",null);const u=this.cellValueFormatFunction({column:n,rowData:i,value:a});o.innerHTML=u,null==(t=this.grid)||t.notifyResize()}createInputContainer(){const t=document.createElement("div");return t.classList.add(i.inputContainer),t}createInputElement({value:t}){const e=document.createElement("input");return e.classList.add(i.input),e.maxLength=this.maxLength,e.type=this.inputType,e.value=t,e.onblur=()=>{e.onblur=null,this.submit()},e}async submit(){var t;const{activeEditInfo:e}=this;if(!e)return;const{column:n,input:o,root:i,rowData:a,oldValue:u}=e,r=this.parseInputValueFunction({input:o,column:n,rowData:a});if(!this.cellValueValidatorFunction({value:r,oldValue:u,column:n,rowData:a}))this.cancel();else{i.innerHTML=this.loadingMessage,null==(t=this.grid)||t.notifyResize();try{var l;await this.updateStoreItemFunction({rowData:a,column:n,value:r}),this.updateRowItemFunction({rowData:a,column:n,value:r});const t=this.getCellValue(n,a),e=this.cellValueFormatFunction({column:n,rowData:a,value:t});i.innerHTML=e,this.emit("value-change",{column:n,rowData:a,value:t}),this._set("activeEditInfo",null),null==(l=this.grid)||l.notifyResize()}catch(s){this.cancel()}}}};t([e({readOnly:!0})],u.prototype,"activeEditInfo",void 0),t([e()],u.prototype,"cellValueValidatorFunction",void 0),t([e()],u.prototype,"editable",void 0),t([e()],u.prototype,"inputRenderFunction",void 0),t([e({constructOnly:!0})],u.prototype,"loadingMessage",void 0),t([e()],u.prototype,"inputType",void 0),t([e()],u.prototype,"maxLength",void 0),t([e()],u.prototype,"parseInputValueFunction",void 0),t([e()],u.prototype,"renderFunction",void 0),t([e()],u.prototype,"required",void 0),t([e()],u.prototype,"store",void 0),t([e()],u.prototype,"updateRowItemFunction",void 0),t([e()],u.prototype,"updateStoreItemFunction",void 0),u=t([n("geoscene.widgets.FeatureTable.EditorColumn")],u);const r=u;export{r as default};
@@ -956,4 +956,4 @@ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Col
956
956
  <template class="header" id="headerTemplate">
957
957
  <vaadin-grid-sorter path="[[path]]" direction="{{direction}}">[[_getHeader(header, path)]]</vaadin-grid-sorter>
958
958
  </template>
959
- `}static get is(){return"vaadin-grid-sort-column"}static get properties(){return{path:String,direction:{type:String,notify:!0}}}_prepareHeaderTemplate(){const e=this._prepareTemplatizer(this.$.headerTemplate);return e.templatizer.dataHost=this,e}_getHeader(e,t){return e||this._generateHeader(t)}}customElements.define(Ka.is,Ka);const Qa={selectionColumn:!0,columnMenus:!0},el={base:"esri-grid",content:"esri-grid__content",grid:"esri-grid__grid",noColumnMenu:"esri-grid--no-column-menu",widget:"esri-widget"};let tl=class extends(s(c)){constructor(e,i){super(e,i),this._grid=null,this._headerStyles="display: flex; font-weight: 400;",this._hostStyles='font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1em; background-color: inherit; color: inherit;',this._rowHoverStyles="background-color: var(--lumo-row-background-hover);",this._columnElements=[],this.cellClassNameGenerator=null,this.columns=null,this.columnReorderingEnabled=null,this.dataProvider=null,this.itemIdPath=null,this.label=void 0,this.messages=null,this.multiSortEnabled=null,this.pageSize=null,this.rowDetailsRenderer=null,this.selectedItems=new t,this.size=null,this.store=null,this.viewModel=new u,this.visibleElements={...Qa}}initialize(){this.handles.add([this.columns.on("change",(()=>this._syncColumnRenderers())),n(this,"viewModel.size",(()=>this._updateGridSize())),n(this,"store.state",((e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshPageCache()})),o(this,"_grid.$.table","scroll",(()=>{var e;null==(e=this.viewModel)||e.closeColumnMenus()}))])}destroy(){var e;this.handles.removeAll(),this.resetColumns(),null==(e=this.columns)||e.destroy()}resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}get sortOrders(){return this._grid._sorters.filter((e=>!!e)).map((({direction:e,path:t})=>({direction:e,path:t})))}castVisibleElements(e){return{...Qa,...e}}render(){const{columnMenus:e}=this.visibleElements;return m("div",{bind:this,class:this.classes(el.base,el.widget,{[el.noColumnMenu]:!e})},m("div",{bind:this,class:el.content},this.renderGrid()))}renderGrid(){return m("vaadin-grid",{...this.getGridProps()},this.renderAllColumns())}renderAllColumns(){if("disabled"!==this.viewModel.state&&this.columns&&this.columns.length)return[this.renderSelectionColumn(),this.renderColumns()]}renderSelectionColumn(){return m("vaadin-grid-selection-column",{_selectAllHidden:!0,selectAll:!1,bind:this,hidden:!this.visibleElements.selectionColumn,sortable:!1,frozen:!p(this.container)})}renderColumns(){return this.columns.items.map(((e,t)=>m("vaadin-grid-column",{...this.getColumnProps(e,t)})))}getGridProps(){const{columnReorderingEnabled:e,id:t,multiSortEnabled:i,pageSize:s,size:r}=this;return{_safari:!1,class:el.grid,id:`${t}_grid`,theme:"compact column-borders",ref:"grid",bind:this,afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,columnReorderingAllowed:e,pageSize:s,size:r,multiSort:i}}getColumnProps(e,t){const{id:i}=this,{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,path:h,resizable:c,textAlign:u,width:p}=e;return{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,key:`${i}_${l}_${r(t)?t:h}`,path:h,resizable:c,"text-align":u,width:"number"==typeof p?`${p}px`:p,bind:this,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){var e,t;let i=!1;if(this._grid){if(null!=(e=this._grid._sorters)&&e.length&&(this._grid._sorters.forEach((e=>{e._order=null,e.direction=null})),i=!0),null!=(t=this.columns)&&t.length){!!this.columns.find((e=>!!e.direction))&&(this.columns.forEach((e=>e.direction=null)),i=!0)}i&&(this.notifyChange("sortOrders"),this.scheduleRender())}}deselectItem(e){this._deselectRowByItem(e)}deselectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._deselectRowByItem(t)}findColumn(){}generateCellClassNames(){var e;null==(e=this._grid)||e.generateCellClassNames()}getSlotElementByName(e){var t,i;return null==(t=this._grid)||null==(i=t.shadowRoot)?void 0:i.querySelector(`slot[name='${e}']`)}hideColumn(e){var t;null==(t=this.viewModel)||t.hideColumn(e),this.scheduleRender()}notifyResize(){var e;null==(e=this._grid)||e.notifyResize()}recalculateColumnWidths(){var e;null==(e=this._grid)||e.recalculateColumnWidths()}async reset(){var e;this._clearSelection(),await(null==(e=this.store)?void 0:e.reset()),this.scrollToTop()}refreshPageCache(){var e;null==(e=this._grid)||e.clearCache()}selectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{t.findIndex((t=>t.objectId===e.objectId))<0&&this._grid.selectedItems.push(e)})),this._updateSelectionProps(),this._grid.render()}deselectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{const i=t.findIndex((t=>t.objectId===e.objectId));i>-1&&t.splice(i,1)})),this._grid.selectedItems=t,this._updateSelectionProps(),this._grid.render()}selectItem(e){this._selectRowByItem(e)}selectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._selectRowByItem(t)}showColumn(e){var t;null==(t=this.viewModel)||t.showColumn(e),this.scheduleRender()}sort({path:e,direction:t}){var i;null==(i=this.viewModel)||i.sortColumn(e,t),this.notifyChange("sortOrders")}scrollToIndex(e){var t;null==(t=this._grid)||t.scrollToIndex(e)}scrollToTop(){var e;null==(e=this._grid)||e.scrollToIndex(0)}isEditingActive(){return!!this._getActiveEditInfo().length}getSelectedRowIds(){return this.selectedItems.map((e=>e.objectId)).toArray()}_afterGridCreate(e){const{cellClassNameGenerator:t,dataProvider:i,itemIdPath:s,rowDetailsRenderer:n}=this;e.cellClassNameGenerator=t,e.dataProvider=i,e.rowDetailsRenderer=n,e.itemIdPath=s,this._grid=e,customElements.whenDefined("vaadin-grid").then((()=>{this._appendStyles(),this._addGridEventListeners()})),this._grid.__updateSorter=e=>{const t=this._grid,i=t._sorters,s=-1===i.indexOf(e);if(e.direction||!s)if(e._order=null,t.multiSort)t._removeArrayItem(i,e),e.direction&&(r(e._initialOrder)?(s?i[e._initialOrder]=e:i.splice(e._initialOrder,0,e),e._initialOrder=null):i.unshift(e)),t.__updateSortOrders();else if(e.direction){const s=i.filter((t=>t!==e));t._sorters=[e],s.forEach((e=>{e._order=null,e.direction=null}))}}}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._applyRenderersToColumnElement(e),this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_syncColumnRenderers(){this._columnElements.forEach((e=>this._applyRenderersToColumnElement(e)))}_appendStyles(){var e;const t=null==(e=this._grid)?void 0:e.shadowRoot,i=document.createElement("style");i.textContent=`\n :host { ${this._hostStyles} }\n [part~="header-cell"] ::slotted(vaadin-grid-cell-content) { ${this._headerStyles} }\n [part~="row"]:hover [part~="body-cell"] { ${this._rowHoverStyles} }\n `,null==t||t.appendChild(i)}_updateGridSize(){this._grid&&(this._grid.size=this.size||0,this.scheduleRender())}_getActiveEditInfo(){if(!this.columns||this.columns.length)return[];return this.columns.filter((e=>"activeEditInfo"in e)).map((e=>e.activeEditInfo)).items}_addGridEventListeners(){const{_grid:e}=this;this.handles.add([i(e,"click",(e=>this._onRowClick(e))),i(e,"selected-items-changed",(e=>this._onSelectionChange(e))),i(e,"sorter-changed",(()=>this.notifyChange("sortOrders")))])}_onRowClick(e){const{_grid:t}=this,i=t.getEventContext(e),{item:s,section:r}=i;s&&r&&"details"!==r&&"header"!==r&&this.emit("row-click",{context:i,native:e})}_selectRowByItem(e){var t;null==(t=this._grid)||t.selectItem(e)}_deselectRowByItem(e){var t;null==(t=this._grid)||t.deselectItem(e)}_clearSelection(){this._grid.selectedItems=[],this._updateSelectionProps(),this._grid.render()}_onSelectionChange(e){const t=e;if("selectedItems.splices"===t.detail.path){const{removed:e,index:i,object:s}=t.detail.value.indexSplices[0];this._updateSelectionProps(),this.emit("selection-change",{index:i,added:s,removed:e})}}_updateSelectionProps(){this.selectedItems.length&&this.selectedItems.removeAll(),this._grid&&this.selectedItems.addMany(this._grid.selectedItems)}_applyRenderersToColumnElement(e){const t=e.getAttribute("path"),i=this.viewModel.findColumn(t);if(i)try{i.renderFunction&&(e.renderer=(e,t,s)=>i.renderFunction({root:e,column:t,rowData:s})),i.footerRenderFunction&&(e.footerRenderer=(e,t)=>i.footerRenderFunction({root:e,column:t})),i.headerRenderFunction&&(e.headerRenderer=(e,t)=>i.headerRenderFunction({root:e,column:t}))}catch(s){}}};e([d()],tl.prototype,"_grid",void 0),e([a("viewModel.cellClassNameGenerator")],tl.prototype,"cellClassNameGenerator",void 0),e([a("viewModel.columns")],tl.prototype,"columns",void 0),e([a("viewModel.columnReorderingEnabled")],tl.prototype,"columnReorderingEnabled",void 0),e([a("viewModel.dataProvider")],tl.prototype,"dataProvider",void 0),e([d()],tl.prototype,"itemIdPath",void 0),e([d({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],tl.prototype,"label",void 0),e([d(),_("geoscene/widgets/FeatureTable/t9n/FeatureTable")],tl.prototype,"messages",void 0),e([a("viewModel.multiSortEnabled")],tl.prototype,"multiSortEnabled",void 0),e([a("viewModel.pageSize")],tl.prototype,"pageSize",void 0),e([a("viewModel.rowDetailsRenderer")],tl.prototype,"rowDetailsRenderer",void 0),e([d({readOnly:!0})],tl.prototype,"selectedItems",void 0),e([a("viewModel.size")],tl.prototype,"size",void 0),e([d({readOnly:!0})],tl.prototype,"sortOrders",null),e([a("viewModel.store")],tl.prototype,"store",void 0),e([d()],tl.prototype,"viewModel",void 0),e([d()],tl.prototype,"visibleElements",void 0),e([l("visibleElements")],tl.prototype,"castVisibleElements",null),e([a("viewModel.findColumn")],tl.prototype,"findColumn",null),tl=e([h("geoscene.widgets.FeatureTable.Grid.Grid")],tl);const il=tl;export{il as default};
959
+ `}static get is(){return"vaadin-grid-sort-column"}static get properties(){return{path:String,direction:{type:String,notify:!0}}}_prepareHeaderTemplate(){const e=this._prepareTemplatizer(this.$.headerTemplate);return e.templatizer.dataHost=this,e}_getHeader(e,t){return e||this._generateHeader(t)}}customElements.define(Ka.is,Ka);const Qa={selectionColumn:!0,columnMenus:!0},el={base:"geoscene-grid",content:"geoscene-grid__content",grid:"geoscene-grid__grid",noColumnMenu:"geoscene-grid--no-column-menu",widget:"geoscene-widget"};let tl=class extends(s(c)){constructor(e,i){super(e,i),this._grid=null,this._headerStyles="display: flex; font-weight: 400;",this._hostStyles='font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1em; background-color: inherit; color: inherit;',this._rowHoverStyles="background-color: var(--lumo-row-background-hover);",this._columnElements=[],this.cellClassNameGenerator=null,this.columns=null,this.columnReorderingEnabled=null,this.dataProvider=null,this.itemIdPath=null,this.label=void 0,this.messages=null,this.multiSortEnabled=null,this.pageSize=null,this.rowDetailsRenderer=null,this.selectedItems=new t,this.size=null,this.store=null,this.viewModel=new u,this.visibleElements={...Qa}}initialize(){this.handles.add([this.columns.on("change",(()=>this._syncColumnRenderers())),n(this,"viewModel.size",(()=>this._updateGridSize())),n(this,"store.state",((e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshPageCache()})),o(this,"_grid.$.table","scroll",(()=>{var e;null==(e=this.viewModel)||e.closeColumnMenus()}))])}destroy(){var e;this.handles.removeAll(),this.resetColumns(),null==(e=this.columns)||e.destroy()}resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}get sortOrders(){return this._grid._sorters.filter((e=>!!e)).map((({direction:e,path:t})=>({direction:e,path:t})))}castVisibleElements(e){return{...Qa,...e}}render(){const{columnMenus:e}=this.visibleElements;return m("div",{bind:this,class:this.classes(el.base,el.widget,{[el.noColumnMenu]:!e})},m("div",{bind:this,class:el.content},this.renderGrid()))}renderGrid(){return m("vaadin-grid",{...this.getGridProps()},this.renderAllColumns())}renderAllColumns(){if("disabled"!==this.viewModel.state&&this.columns&&this.columns.length)return[this.renderSelectionColumn(),this.renderColumns()]}renderSelectionColumn(){return m("vaadin-grid-selection-column",{_selectAllHidden:!0,selectAll:!1,bind:this,hidden:!this.visibleElements.selectionColumn,sortable:!1,frozen:!p(this.container)})}renderColumns(){return this.columns.items.map(((e,t)=>m("vaadin-grid-column",{...this.getColumnProps(e,t)})))}getGridProps(){const{columnReorderingEnabled:e,id:t,multiSortEnabled:i,pageSize:s,size:r}=this;return{_safari:!1,class:el.grid,id:`${t}_grid`,theme:"compact column-borders",ref:"grid",bind:this,afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,columnReorderingAllowed:e,pageSize:s,size:r,multiSort:i}}getColumnProps(e,t){const{id:i}=this,{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,path:h,resizable:c,textAlign:u,width:p}=e;return{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,key:`${i}_${l}_${r(t)?t:h}`,path:h,resizable:c,"text-align":u,width:"number"==typeof p?`${p}px`:p,bind:this,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){var e,t;let i=!1;if(this._grid){if(null!=(e=this._grid._sorters)&&e.length&&(this._grid._sorters.forEach((e=>{e._order=null,e.direction=null})),i=!0),null!=(t=this.columns)&&t.length){!!this.columns.find((e=>!!e.direction))&&(this.columns.forEach((e=>e.direction=null)),i=!0)}i&&(this.notifyChange("sortOrders"),this.scheduleRender())}}deselectItem(e){this._deselectRowByItem(e)}deselectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._deselectRowByItem(t)}findColumn(){}generateCellClassNames(){var e;null==(e=this._grid)||e.generateCellClassNames()}getSlotElementByName(e){var t,i;return null==(t=this._grid)||null==(i=t.shadowRoot)?void 0:i.querySelector(`slot[name='${e}']`)}hideColumn(e){var t;null==(t=this.viewModel)||t.hideColumn(e),this.scheduleRender()}notifyResize(){var e;null==(e=this._grid)||e.notifyResize()}recalculateColumnWidths(){var e;null==(e=this._grid)||e.recalculateColumnWidths()}async reset(){var e;this._clearSelection(),await(null==(e=this.store)?void 0:e.reset()),this.scrollToTop()}refreshPageCache(){var e;null==(e=this._grid)||e.clearCache()}selectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{t.findIndex((t=>t.objectId===e.objectId))<0&&this._grid.selectedItems.push(e)})),this._updateSelectionProps(),this._grid.render()}deselectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{const i=t.findIndex((t=>t.objectId===e.objectId));i>-1&&t.splice(i,1)})),this._grid.selectedItems=t,this._updateSelectionProps(),this._grid.render()}selectItem(e){this._selectRowByItem(e)}selectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._selectRowByItem(t)}showColumn(e){var t;null==(t=this.viewModel)||t.showColumn(e),this.scheduleRender()}sort({path:e,direction:t}){var i;null==(i=this.viewModel)||i.sortColumn(e,t),this.notifyChange("sortOrders")}scrollToIndex(e){var t;null==(t=this._grid)||t.scrollToIndex(e)}scrollToTop(){var e;null==(e=this._grid)||e.scrollToIndex(0)}isEditingActive(){return!!this._getActiveEditInfo().length}getSelectedRowIds(){return this.selectedItems.map((e=>e.objectId)).toArray()}_afterGridCreate(e){const{cellClassNameGenerator:t,dataProvider:i,itemIdPath:s,rowDetailsRenderer:n}=this;e.cellClassNameGenerator=t,e.dataProvider=i,e.rowDetailsRenderer=n,e.itemIdPath=s,this._grid=e,customElements.whenDefined("vaadin-grid").then((()=>{this._appendStyles(),this._addGridEventListeners()})),this._grid.__updateSorter=e=>{const t=this._grid,i=t._sorters,s=-1===i.indexOf(e);if(e.direction||!s)if(e._order=null,t.multiSort)t._removeArrayItem(i,e),e.direction&&(r(e._initialOrder)?(s?i[e._initialOrder]=e:i.splice(e._initialOrder,0,e),e._initialOrder=null):i.unshift(e)),t.__updateSortOrders();else if(e.direction){const s=i.filter((t=>t!==e));t._sorters=[e],s.forEach((e=>{e._order=null,e.direction=null}))}}}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._applyRenderersToColumnElement(e),this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_syncColumnRenderers(){this._columnElements.forEach((e=>this._applyRenderersToColumnElement(e)))}_appendStyles(){var e;const t=null==(e=this._grid)?void 0:e.shadowRoot,i=document.createElement("style");i.textContent=`\n :host { ${this._hostStyles} }\n [part~="header-cell"] ::slotted(vaadin-grid-cell-content) { ${this._headerStyles} }\n [part~="row"]:hover [part~="body-cell"] { ${this._rowHoverStyles} }\n `,null==t||t.appendChild(i)}_updateGridSize(){this._grid&&(this._grid.size=this.size||0,this.scheduleRender())}_getActiveEditInfo(){if(!this.columns||this.columns.length)return[];return this.columns.filter((e=>"activeEditInfo"in e)).map((e=>e.activeEditInfo)).items}_addGridEventListeners(){const{_grid:e}=this;this.handles.add([i(e,"click",(e=>this._onRowClick(e))),i(e,"selected-items-changed",(e=>this._onSelectionChange(e))),i(e,"sorter-changed",(()=>this.notifyChange("sortOrders")))])}_onRowClick(e){const{_grid:t}=this,i=t.getEventContext(e),{item:s,section:r}=i;s&&r&&"details"!==r&&"header"!==r&&this.emit("row-click",{context:i,native:e})}_selectRowByItem(e){var t;null==(t=this._grid)||t.selectItem(e)}_deselectRowByItem(e){var t;null==(t=this._grid)||t.deselectItem(e)}_clearSelection(){this._grid.selectedItems=[],this._updateSelectionProps(),this._grid.render()}_onSelectionChange(e){const t=e;if("selectedItems.splices"===t.detail.path){const{removed:e,index:i,object:s}=t.detail.value.indexSplices[0];this._updateSelectionProps(),this.emit("selection-change",{index:i,added:s,removed:e})}}_updateSelectionProps(){this.selectedItems.length&&this.selectedItems.removeAll(),this._grid&&this.selectedItems.addMany(this._grid.selectedItems)}_applyRenderersToColumnElement(e){const t=e.getAttribute("path"),i=this.viewModel.findColumn(t);if(i)try{i.renderFunction&&(e.renderer=(e,t,s)=>i.renderFunction({root:e,column:t,rowData:s})),i.footerRenderFunction&&(e.footerRenderer=(e,t)=>i.footerRenderFunction({root:e,column:t})),i.headerRenderFunction&&(e.headerRenderer=(e,t)=>i.headerRenderFunction({root:e,column:t}))}catch(s){}}};e([d()],tl.prototype,"_grid",void 0),e([a("viewModel.cellClassNameGenerator")],tl.prototype,"cellClassNameGenerator",void 0),e([a("viewModel.columns")],tl.prototype,"columns",void 0),e([a("viewModel.columnReorderingEnabled")],tl.prototype,"columnReorderingEnabled",void 0),e([a("viewModel.dataProvider")],tl.prototype,"dataProvider",void 0),e([d()],tl.prototype,"itemIdPath",void 0),e([d({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],tl.prototype,"label",void 0),e([d(),_("geoscene/widgets/FeatureTable/t9n/FeatureTable")],tl.prototype,"messages",void 0),e([a("viewModel.multiSortEnabled")],tl.prototype,"multiSortEnabled",void 0),e([a("viewModel.pageSize")],tl.prototype,"pageSize",void 0),e([a("viewModel.rowDetailsRenderer")],tl.prototype,"rowDetailsRenderer",void 0),e([d({readOnly:!0})],tl.prototype,"selectedItems",void 0),e([a("viewModel.size")],tl.prototype,"size",void 0),e([d({readOnly:!0})],tl.prototype,"sortOrders",null),e([a("viewModel.store")],tl.prototype,"store",void 0),e([d()],tl.prototype,"viewModel",void 0),e([d()],tl.prototype,"visibleElements",void 0),e([l("visibleElements")],tl.prototype,"castVisibleElements",null),e([a("viewModel.findColumn")],tl.prototype,"findColumn",null),tl=e([h("geoscene.widgets.FeatureTable.Grid.Grid")],tl);const il=tl;export{il as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import{eventKey as t}from"../../../../core/events.js";import{HandleOwnerMixin as n}from"../../../../core/HandleOwner.js";import{isSome as o}from"../../../../core/maybe.js";import{watch as s}from"../../../../core/watchUtils.js";import{aliasOf as i}from"../../../../core/accessorSupport/decorators/aliasOf.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import l from"../../../Widget.js";import d from"./ButtonMenuViewModel.js";import u from"../../../support/Popover.js";import{isRTL as c,isActivationKey as m}from"../../../support/widgetUtils.js";import"../../../../core/Logger.js";import{tsx as p}from"../../../support/jsxFactory.js";const h={base:"esri-button-menu",content:"esri-button-menu__content",contentWrapper:"esri-button-menu__content-wrapper",itemWrapper:"esri-button-menu__item-wrapper",label:"esri-button-menu__label",icon:"esri-button-menu__icon",item:"esri-button-menu__item",itemLabel:"esri-button-menu__item-label",itemLabelContent:"esri-button-menu__item-label-content",selectableMenuItem:"esri-button-menu__item--selectable",selectedMenuItem:"esri-button-menu__item--selected",checkbox:"esri-button-menu__checkbox",embeddedContentWrapper:"esri-button-menu__embedded-content-wrapper",button:"esri-button-menu__button",buttonSelected:"esri-button-menu__button--selected",defaultIconClass:"geoscene-icon-menu",widget:"esri-widget"};let b=class extends(n(l)){constructor(e,t){super(e,t),this._menuContentNode=null,this._popover=null,this._rootNode=null,this.iconClass=null,this.items=null,this.label=null,this.open=null,this.viewModel=new d,this._handleOutsideClick=this._handleOutsideClick.bind(this)}postInitialize(){this._popover=new u({owner:this,open:!!this.open,placement:c(this.container)?"bottom-start":"bottom-end",renderContentFunction:this.renderMenuContent,anchorElement:this._rootNode}),this.handles.add([s(this,"open",(e=>this._popover.set("open",e)))]),document.addEventListener("click",this._handleOutsideClick)}destroy(){var e;null==(e=this._popover)||e.destroy(),this._popover=null,document.removeEventListener("click",this._handleOutsideClick)}_handleOutsideClick(e){var t,n;if(!this.open||!this._rootNode||!this._menuContentNode)return;const o=e.target;null!=(t=this._menuContentNode)&&t.contains(o)||null!=(n=this._rootNode)&&n.contains(o)||(this.open=!1)}render(){return p("div",{afterCreate:this._afterRootNodeCreate,bind:this,"data-node-ref":"_rootNode",class:this.classes(h.base,h.widget),key:"menu"},this.renderMenuButton())}renderMenuButton(){const{iconClass:e,id:t,label:n,open:o}=this,s=this.classes([h.button,e||h.defaultIconClass,o?h.buttonSelected:null]);return p("button",{"aria-pressed":o.toString(),"aria-controls":`${t}-menu`,"aria-expanded":o.toString(),"aria-haspopup":"true","aria-label":n,bind:this,class:s,id:`${t}-button`,title:n,selected:o,onclick:this._toggleOpen,tabindex:"0",type:"button"})}renderMenuContent(){var e;const{id:t,open:n}=this;return p("div",{afterCreate:this._afterMenuContentNodeCreate,bind:this,class:h.content,"data-node-ref":"_menuContentNode",key:"esri-button-menu-content",hidden:!n},p("ul",{"aria-labelledby":`${t}-button`,bind:this,class:h.itemWrapper,id:`${t}-menu`,role:"menu"},(null==(e=this.items)?void 0:e.length)&&this.renderItems()))}renderItems(){var e;return null==(e=this.items)?void 0:e.map(((e,t)=>this.renderItem(e,t)))}renderItem(e,t,n){var s;const i=o(n)?`${this.id}-menu-item-${t}-${n}`:`${this.id}-menu-item-${t}`,r=`${i}-label`,a=this.classes(h.item,e.selectionEnabled?h.selectableMenuItem:null,e.selectionEnabled&&e.selected?h.selectedMenuItem:null);return p("li",{afterCreate:this._afterMenuItemCreate,bind:this,class:a,"data-item-index":t,"data-item-subIndex":n,for:i,key:i,onkeydown:t=>this._handleMenuItemKeydown(t,e),onclick:t=>this._handleMenuItemInteraction(t,e),role:"menuitem",tabindex:"0"},p("input",{disabled:!0,checked:e.selected,class:h.checkbox,id:i,name:i,tabindex:"-1",type:"checkbox"}),p("label",{bind:this,class:this.classes(h.button,h.itemLabel),for:i,id:r},p("span",{class:this.classes(h.icon,e.iconClass),"aria-hidden":"true"}),p("span",{class:h.itemLabelContent},e.label)),p("ul",{"aria-labelledby":r,class:h.embeddedContentWrapper,id:`${this.id}-submenu`,role:"menu"},null==e||null==(s=e.items)?void 0:s.map(((e,n)=>this.renderItem(e,t,n)))))}_afterRootNodeCreate(e){var t;this._rootNode=e,null==(t=this._popover)||t.set("anchorElement",(()=>e))}_handleMenuItemInteraction(e,t){t.selected=!t.selected,t.open=!(!t.selected||!t.items),t.autoCloseMenu&&this.set("open",!1),t.clickFunction&&t.clickFunction({event:e,item:t}),e.stopPropagation()}_handleMenuItemKeydown(e,n){const o=t(e);m(o)&&this._handleMenuItemInteraction(e,n),"Escape"===o&&(this.open=!1,e.preventDefault(),e.stopPropagation())}_afterMenuContentNodeCreate(e){this._menuContentNode=e,e.focus()}_toggleOpen(){this.open=!this.open}_afterMenuItemCreate(e){0===e["data-item-index"]&&e.focus()}};e([r()],b.prototype,"iconClass",void 0),e([i("viewModel.items")],b.prototype,"items",void 0),e([r()],b.prototype,"label",void 0),e([i("viewModel.open")],b.prototype,"open",void 0),e([r()],b.prototype,"viewModel",void 0),b=e([a("geoscene.widgets.FeatureTable.Grid.support.ButtonMenu")],b);const _=b;export{_ as default};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import{eventKey as t}from"../../../../core/events.js";import{HandleOwnerMixin as n}from"../../../../core/HandleOwner.js";import{isSome as o}from"../../../../core/maybe.js";import{watch as s}from"../../../../core/watchUtils.js";import{aliasOf as i}from"../../../../core/accessorSupport/decorators/aliasOf.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import l from"../../../Widget.js";import d from"./ButtonMenuViewModel.js";import u from"../../../support/Popover.js";import{isRTL as c,isActivationKey as m}from"../../../support/widgetUtils.js";import"../../../../core/Logger.js";import{tsx as p}from"../../../support/jsxFactory.js";const h={base:"geoscene-button-menu",content:"geoscene-button-menu__content",contentWrapper:"geoscene-button-menu__content-wrapper",itemWrapper:"geoscene-button-menu__item-wrapper",label:"geoscene-button-menu__label",icon:"geoscene-button-menu__icon",item:"geoscene-button-menu__item",itemLabel:"geoscene-button-menu__item-label",itemLabelContent:"geoscene-button-menu__item-label-content",selectableMenuItem:"geoscene-button-menu__item--selectable",selectedMenuItem:"geoscene-button-menu__item--selected",checkbox:"geoscene-button-menu__checkbox",embeddedContentWrapper:"geoscene-button-menu__embedded-content-wrapper",button:"geoscene-button-menu__button",buttonSelected:"geoscene-button-menu__button--selected",defaultIconClass:"geoscene-icon-menu",widget:"geoscene-widget"};let b=class extends(n(l)){constructor(e,t){super(e,t),this._menuContentNode=null,this._popover=null,this._rootNode=null,this.iconClass=null,this.items=null,this.label=null,this.open=null,this.viewModel=new d,this._handleOutsideClick=this._handleOutsideClick.bind(this)}postInitialize(){this._popover=new u({owner:this,open:!!this.open,placement:c(this.container)?"bottom-start":"bottom-end",renderContentFunction:this.renderMenuContent,anchorElement:this._rootNode}),this.handles.add([s(this,"open",(e=>this._popover.set("open",e)))]),document.addEventListener("click",this._handleOutsideClick)}destroy(){var e;null==(e=this._popover)||e.destroy(),this._popover=null,document.removeEventListener("click",this._handleOutsideClick)}_handleOutsideClick(e){var t,n;if(!this.open||!this._rootNode||!this._menuContentNode)return;const o=e.target;null!=(t=this._menuContentNode)&&t.contains(o)||null!=(n=this._rootNode)&&n.contains(o)||(this.open=!1)}render(){return p("div",{afterCreate:this._afterRootNodeCreate,bind:this,"data-node-ref":"_rootNode",class:this.classes(h.base,h.widget),key:"menu"},this.renderMenuButton())}renderMenuButton(){const{iconClass:e,id:t,label:n,open:o}=this,s=this.classes([h.button,e||h.defaultIconClass,o?h.buttonSelected:null]);return p("button",{"aria-pressed":o.toString(),"aria-controls":`${t}-menu`,"aria-expanded":o.toString(),"aria-haspopup":"true","aria-label":n,bind:this,class:s,id:`${t}-button`,title:n,selected:o,onclick:this._toggleOpen,tabindex:"0",type:"button"})}renderMenuContent(){var e;const{id:t,open:n}=this;return p("div",{afterCreate:this._afterMenuContentNodeCreate,bind:this,class:h.content,"data-node-ref":"_menuContentNode",key:"geoscene-button-menu-content",hidden:!n},p("ul",{"aria-labelledby":`${t}-button`,bind:this,class:h.itemWrapper,id:`${t}-menu`,role:"menu"},(null==(e=this.items)?void 0:e.length)&&this.renderItems()))}renderItems(){var e;return null==(e=this.items)?void 0:e.map(((e,t)=>this.renderItem(e,t)))}renderItem(e,t,n){var s;const i=o(n)?`${this.id}-menu-item-${t}-${n}`:`${this.id}-menu-item-${t}`,r=`${i}-label`,a=this.classes(h.item,e.selectionEnabled?h.selectableMenuItem:null,e.selectionEnabled&&e.selected?h.selectedMenuItem:null);return p("li",{afterCreate:this._afterMenuItemCreate,bind:this,class:a,"data-item-index":t,"data-item-subIndex":n,for:i,key:i,onkeydown:t=>this._handleMenuItemKeydown(t,e),onclick:t=>this._handleMenuItemInteraction(t,e),role:"menuitem",tabindex:"0"},p("input",{disabled:!0,checked:e.selected,class:h.checkbox,id:i,name:i,tabindex:"-1",type:"checkbox"}),p("label",{bind:this,class:this.classes(h.button,h.itemLabel),for:i,id:r},p("span",{class:this.classes(h.icon,e.iconClass),"aria-hidden":"true"}),p("span",{class:h.itemLabelContent},e.label)),p("ul",{"aria-labelledby":r,class:h.embeddedContentWrapper,id:`${this.id}-submenu`,role:"menu"},null==e||null==(s=e.items)?void 0:s.map(((e,n)=>this.renderItem(e,t,n)))))}_afterRootNodeCreate(e){var t;this._rootNode=e,null==(t=this._popover)||t.set("anchorElement",(()=>e))}_handleMenuItemInteraction(e,t){t.selected=!t.selected,t.open=!(!t.selected||!t.items),t.autoCloseMenu&&this.set("open",!1),t.clickFunction&&t.clickFunction({event:e,item:t}),e.stopPropagation()}_handleMenuItemKeydown(e,n){const o=t(e);m(o)&&this._handleMenuItemInteraction(e,n),"Escape"===o&&(this.open=!1,e.preventDefault(),e.stopPropagation())}_afterMenuContentNodeCreate(e){this._menuContentNode=e,e.focus()}_toggleOpen(){this.open=!this.open}_afterMenuItemCreate(e){0===e["data-item-index"]&&e.focus()}};e([r()],b.prototype,"iconClass",void 0),e([i("viewModel.items")],b.prototype,"items",void 0),e([r()],b.prototype,"label",void 0),e([i("viewModel.open")],b.prototype,"open",void 0),e([r()],b.prototype,"viewModel",void 0),b=e([a("geoscene.widgets.FeatureTable.Grid.support.ButtonMenu")],b);const _=b;export{_ as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{on as l,watch as o}from"../core/reactiveUtils.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as s}from"../core/accessorSupport/decorators/cast.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import a from"./FeatureTable/FeatureTableViewModel.js";import c from"./FeatureTable/Grid/support/ButtonMenu.js";import u from"./FeatureTable/Grid/support/ButtonMenuItem.js";import"./support/widgetUtils.js";import{messageBundle as h}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as m}from"./support/jsxFactory.js";import{onLocaleChange as p}from"../intl/locale.js";import{substitute as g}from"../intl/substitute.js";import{fetchMessageBundle as v}from"../intl/messages.js";const w={header:!0,menu:!0,menuItems:{clearSelection:!0,refreshData:!0,toggleColumns:!0,selectedRecordsShowAllToggle:!0,selectedRecordsShowSelectedToggle:!0,zoomToSelection:!0},selectionColumn:!0,columnMenus:!0},b={base:"esri-feature-table",header:"esri-feature-table__header",title:"esri-feature-table__title",content:"esri-feature-table__content",loader:"esri-feature-table__loader",loaderContainer:"esri-feature-table__loader-container",menuContainer:"esri-feature-table__menu",menuIcon:"geoscene-icon-handle-horizontal",menuItemGroupOpenedIcon:"geoscene-icon-down",menuItemGroupClosedIcon:"geoscene-icon-right",checkmarkIcon:"geoscene-icon-check-mark",widget:"esri-widget"};let f=class extends(t(d)){constructor(e,t){super(e,t),this.activeSortOrders=null,this.attachmentsEnabled=null,this.autoRefreshEnabled=null,this.columnReorderingEnabled=null,this.columns=null,this.editingEnabled=null,this.fieldConfigs=null,this.filterGeometry=null,this.grid=null,this.highlightOnRowSelectEnabled=null,this.label=void 0,this.layer=null,this.messages=null,this.menu=null,this.menuConfig=null,this.multiSortEnabled=null,this.pageSize=null,this.relatedRecordsEnabled=null,this.state=null,this.view=null,this.viewModel=new a,this.visibleElements={...w}}initialize(){var e,t,i;const s=async()=>this.messages=await v("geoscene/widgets/FeatureTable/t9n/FeatureTable");s(),this.handles.add([p(s),l((()=>this.viewModel.columns),"change",(()=>this._syncMenuConfig())),l((()=>this.viewModel.activeFilters),"change",(()=>this._syncMenuConfig())),l((()=>this.grid.selectedItems),"change",(e=>{this._syncMenuConfig(),this._onSelectionChange(e)})),o((()=>[this.viewModel.store.querying,this.viewModel.store.syncing]),(()=>this.scheduleRender())),o((()=>this.menuConfig),(()=>this._syncMenuConfig())),o((()=>this.messages),(()=>{var e;this.menu.label=null==(e=this.messages)?void 0:e.options,this._syncMenuConfig()}))]),this._set("menu",new c({label:null==(e=this.messages)?void 0:e.options,iconClass:b.menuIcon,...this.menuConfig}));const{attachmentsEnabled:n,relatedRecordsEnabled:r}=this;null==(t=this.viewModel)||null==(i=t.store)||i.set({attachmentsEnabled:n,relatedRecordsEnabled:r})}destroy(){var e;this.clearSelection(),this.handles.removeAll(),null==(e=this.menu)||e.destroy()}castVisibleElements(e){var t;const l={...w,...e};return null==(t=this.grid)||t.set("visibleElements",{...this.grid.visibleElements,selectionColumn:l.selectionColumn,columnMenus:l.columnMenus}),l}clearHighlights(){}clearSelection(){}clearSelectionFilter(){}deselectRows(){}filterBySelection(){}hideColumn(e){var t;null==(t=this.grid)||t.hideColumn(e),this._syncMenuConfig()}refresh(){}showColumn(e){var t;null==(t=this.grid)||t.showColumn(e),this._syncMenuConfig()}sortColumn(){}selectRows(){}scrollToIndex(){}render(){var e;return m("div",{bind:this,class:this.classes(b.base,b.widget)},this.visibleElements.header?this._renderHeader():null,m("div",{class:b.content},"disabled"!==this.state&&(null==(e=this.grid)?void 0:e.render())))}zoomToSelection(){}_renderHeader(){return m("div",{key:"header",class:b.header},this._renderLoader(),this._renderTitle(),this.visibleElements.menu?this._renderMenu():null)}_renderTitle(){return m("div",{class:b.title,key:"title"},this._getTitle())}_getTitle(){const{grid:e,layer:{title:t},messages:l,viewModel:{size:o}}=this;return e?g(l.header,{title:t,count:o,selected:e.selectedItems.length||0}):""}_renderLoader(){const{state:e,store:t}=this.viewModel,l="loading"===e||t.syncing||t.querying;return m("div",{class:b.loaderContainer},l?m("div",{class:b.loader,key:"loader"}):null)}_renderMenu(){return m("div",{class:b.menuContainer},this.menu.render())}_onSelectionChange(e){const{added:t,removed:l}=e;this.emit("selection-change",{added:[...t],removed:[...l]})}_syncMenuConfig(){var e;null==(e=this.menu)||e.set({...this.menuConfig,items:this._getMenuItems()})}_getMenuItems(){var e;const t=null==(e=this.menuConfig)?void 0:e.items,l=this._getDefaultMenuItems(),o=[];return(null==l?void 0:l.length)&&o.push(...l),(null==t?void 0:t.length)&&o.push(...t),o}_getDefaultMenuItems(){var e;const{messages:t,viewModel:l,visibleElements:o}=this,{menuItems:i}=o,s=[];if((null==i?void 0:i.refreshData)&&s.push(new u({selectionEnabled:!1,label:null==t?void 0:t.refreshData,clickFunction:()=>this.refresh()})),this._hasActiveSelection()){const e=this.grid.selectedItems.length,l=this._getSelectionFilter();if((null==i?void 0:i.clearSelection)&&s.push(new u({selectionEnabled:!1,label:null==t?void 0:t.clearSelection,clickFunction:()=>this.clearSelection()})),null!=i&&i.zoomToSelection&&this.view&&s.push(new u({selectionEnabled:!1,label:null==t?void 0:t.zoomToSelection,clickFunction:()=>this.viewModel.zoomToSelection()})),null!=i&&i.selectedRecordsShowSelectedToggle&&(!l||e!==l.objectIds.length)){const e=t.showSelected,l=new u({selectionEnabled:!1,label:e,clickFunction:()=>{this.filterBySelection(),l.set("label",e)}});s.push(l)}}if(null!=i&&i.selectedRecordsShowAllToggle&&this._hasSelectionFilter()){const e=t.showAllRecords,l=new u({selectionEnabled:!1,label:e,clickFunction:()=>{this.clearSelectionFilter(),l.set("label",e)}});s.push(l)}return(null==i?void 0:i.toggleColumns)&&s.push(new u({iconClass:b.menuItemGroupClosedIcon,label:null==t?void 0:t.toggleColumns,clickFunction:this._toggleMenuItemSelectedIcon,items:null==l||null==(e=l.columns)?void 0:e.items.map((({header:e,hidden:t,path:l})=>new u({label:e||l,selected:!t,selectionEnabled:!0,iconClass:b.checkmarkIcon,clickFunction:()=>this._toggleColumnFromMenuItem(l)})))})),s.length?s:null}_toggleMenuItemSelectedIcon({item:e}){null==e||e.set("iconClass",null!=e&&e.selected?b.menuItemGroupOpenedIcon:b.menuItemGroupClosedIcon)}_toggleColumnFromMenuItem(e){const{grid:t,viewModel:l}=this,o=l.findColumn(e);null!=o&&o.hidden?t.showColumn(e):t.hideColumn(e)}_hasActiveSelection(){var e,t;return!(null==(e=this.grid)||null==(t=e.selectedItems)||!t.length)}_getSelectionFilter(){var e;return null==(e=this.viewModel.activeFilters)?void 0:e.find((e=>"selection"===e.type))}_hasSelectionFilter(){return!!this._getSelectionFilter()}};e([i("viewModel.activeSortOrders")],f.prototype,"activeSortOrders",void 0),e([i("viewModel.attachmentsEnabled")],f.prototype,"attachmentsEnabled",void 0),e([i("viewModel.autoRefreshEnabled")],f.prototype,"autoRefreshEnabled",void 0),e([i("viewModel.columnReorderingEnabled")],f.prototype,"columnReorderingEnabled",void 0),e([i("viewModel.columns")],f.prototype,"columns",void 0),e([i("viewModel.editingEnabled")],f.prototype,"editingEnabled",void 0),e([i("viewModel.fieldConfigs")],f.prototype,"fieldConfigs",void 0),e([i("viewModel.filterGeometry")],f.prototype,"filterGeometry",void 0),e([i("viewModel.grid")],f.prototype,"grid",void 0),e([i("viewModel.highlightOnRowSelectEnabled")],f.prototype,"highlightOnRowSelectEnabled",void 0),e([n({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],f.prototype,"label",void 0),e([i("viewModel.layer")],f.prototype,"layer",void 0),e([n(),h("geoscene/widgets/FeatureTable/t9n/FeatureTable")],f.prototype,"messages",void 0),e([n({readOnly:!0})],f.prototype,"menu",void 0),e([n()],f.prototype,"menuConfig",void 0),e([i("viewModel.multiSortEnabled")],f.prototype,"multiSortEnabled",void 0),e([i("viewModel.pageSize")],f.prototype,"pageSize",void 0),e([i("viewModel.relatedRecordsEnabled")],f.prototype,"relatedRecordsEnabled",void 0),e([i("viewModel.state")],f.prototype,"state",void 0),e([i("viewModel.view")],f.prototype,"view",void 0),e([n()],f.prototype,"viewModel",void 0),e([n()],f.prototype,"visibleElements",void 0),e([s("visibleElements")],f.prototype,"castVisibleElements",null),e([i("viewModel.clearHighlights")],f.prototype,"clearHighlights",null),e([i("viewModel.clearSelection")],f.prototype,"clearSelection",null),e([i("viewModel.clearSelectionFilter")],f.prototype,"clearSelectionFilter",null),e([i("viewModel.deselectRows")],f.prototype,"deselectRows",null),e([i("viewModel.filterBySelection")],f.prototype,"filterBySelection",null),e([i("viewModel.refresh")],f.prototype,"refresh",null),e([i("viewModel.sortColumn")],f.prototype,"sortColumn",null),e([i("viewModel.selectRows")],f.prototype,"selectRows",null),e([i("viewModel.scrollToIndex")],f.prototype,"scrollToIndex",null),e([i("viewModel.zoomToSelection")],f.prototype,"zoomToSelection",null),f=e([r("geoscene.widgets.FeatureTable")],f);const y=f;export{y as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import"../intl.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{on as l,watch as o}from"../core/reactiveUtils.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as s}from"../core/accessorSupport/decorators/cast.js";import{property as n}from"../core/accessorSupport/decorators/property.js";import{subclass as r}from"../core/accessorSupport/decorators/subclass.js";import d from"./Widget.js";import a from"./FeatureTable/FeatureTableViewModel.js";import c from"./FeatureTable/Grid/support/ButtonMenu.js";import u from"./FeatureTable/Grid/support/ButtonMenuItem.js";import"./support/widgetUtils.js";import{messageBundle as h}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{tsx as m}from"./support/jsxFactory.js";import{onLocaleChange as p}from"../intl/locale.js";import{substitute as g}from"../intl/substitute.js";import{fetchMessageBundle as v}from"../intl/messages.js";const w={header:!0,menu:!0,menuItems:{clearSelection:!0,refreshData:!0,toggleColumns:!0,selectedRecordsShowAllToggle:!0,selectedRecordsShowSelectedToggle:!0,zoomToSelection:!0},selectionColumn:!0,columnMenus:!0},b={base:"geoscene-feature-table",header:"geoscene-feature-table__header",title:"geoscene-feature-table__title",content:"geoscene-feature-table__content",loader:"geoscene-feature-table__loader",loaderContainer:"geoscene-feature-table__loader-container",menuContainer:"geoscene-feature-table__menu",menuIcon:"geoscene-icon-handle-horizontal",menuItemGroupOpenedIcon:"geoscene-icon-down",menuItemGroupClosedIcon:"geoscene-icon-right",checkmarkIcon:"geoscene-icon-check-mark",widget:"geoscene-widget"};let f=class extends(t(d)){constructor(e,t){super(e,t),this.activeSortOrders=null,this.attachmentsEnabled=null,this.autoRefreshEnabled=null,this.columnReorderingEnabled=null,this.columns=null,this.editingEnabled=null,this.fieldConfigs=null,this.filterGeometry=null,this.grid=null,this.highlightOnRowSelectEnabled=null,this.label=void 0,this.layer=null,this.messages=null,this.menu=null,this.menuConfig=null,this.multiSortEnabled=null,this.pageSize=null,this.relatedRecordsEnabled=null,this.state=null,this.view=null,this.viewModel=new a,this.visibleElements={...w}}initialize(){var e,t,i;const s=async()=>this.messages=await v("geoscene/widgets/FeatureTable/t9n/FeatureTable");s(),this.handles.add([p(s),l((()=>this.viewModel.columns),"change",(()=>this._syncMenuConfig())),l((()=>this.viewModel.activeFilters),"change",(()=>this._syncMenuConfig())),l((()=>this.grid.selectedItems),"change",(e=>{this._syncMenuConfig(),this._onSelectionChange(e)})),o((()=>[this.viewModel.store.querying,this.viewModel.store.syncing]),(()=>this.scheduleRender())),o((()=>this.menuConfig),(()=>this._syncMenuConfig())),o((()=>this.messages),(()=>{var e;this.menu.label=null==(e=this.messages)?void 0:e.options,this._syncMenuConfig()}))]),this._set("menu",new c({label:null==(e=this.messages)?void 0:e.options,iconClass:b.menuIcon,...this.menuConfig}));const{attachmentsEnabled:n,relatedRecordsEnabled:r}=this;null==(t=this.viewModel)||null==(i=t.store)||i.set({attachmentsEnabled:n,relatedRecordsEnabled:r})}destroy(){var e;this.clearSelection(),this.handles.removeAll(),null==(e=this.menu)||e.destroy()}castVisibleElements(e){var t;const l={...w,...e};return null==(t=this.grid)||t.set("visibleElements",{...this.grid.visibleElements,selectionColumn:l.selectionColumn,columnMenus:l.columnMenus}),l}clearHighlights(){}clearSelection(){}clearSelectionFilter(){}deselectRows(){}filterBySelection(){}hideColumn(e){var t;null==(t=this.grid)||t.hideColumn(e),this._syncMenuConfig()}refresh(){}showColumn(e){var t;null==(t=this.grid)||t.showColumn(e),this._syncMenuConfig()}sortColumn(){}selectRows(){}scrollToIndex(){}render(){var e;return m("div",{bind:this,class:this.classes(b.base,b.widget)},this.visibleElements.header?this._renderHeader():null,m("div",{class:b.content},"disabled"!==this.state&&(null==(e=this.grid)?void 0:e.render())))}zoomToSelection(){}_renderHeader(){return m("div",{key:"header",class:b.header},this._renderLoader(),this._renderTitle(),this.visibleElements.menu?this._renderMenu():null)}_renderTitle(){return m("div",{class:b.title,key:"title"},this._getTitle())}_getTitle(){const{grid:e,layer:{title:t},messages:l,viewModel:{size:o}}=this;return e?g(l.header,{title:t,count:o,selected:e.selectedItems.length||0}):""}_renderLoader(){const{state:e,store:t}=this.viewModel,l="loading"===e||t.syncing||t.querying;return m("div",{class:b.loaderContainer},l?m("div",{class:b.loader,key:"loader"}):null)}_renderMenu(){return m("div",{class:b.menuContainer},this.menu.render())}_onSelectionChange(e){const{added:t,removed:l}=e;this.emit("selection-change",{added:[...t],removed:[...l]})}_syncMenuConfig(){var e;null==(e=this.menu)||e.set({...this.menuConfig,items:this._getMenuItems()})}_getMenuItems(){var e;const t=null==(e=this.menuConfig)?void 0:e.items,l=this._getDefaultMenuItems(),o=[];return(null==l?void 0:l.length)&&o.push(...l),(null==t?void 0:t.length)&&o.push(...t),o}_getDefaultMenuItems(){var e;const{messages:t,viewModel:l,visibleElements:o}=this,{menuItems:i}=o,s=[];if((null==i?void 0:i.refreshData)&&s.push(new u({selectionEnabled:!1,label:null==t?void 0:t.refreshData,clickFunction:()=>this.refresh()})),this._hasActiveSelection()){const e=this.grid.selectedItems.length,l=this._getSelectionFilter();if((null==i?void 0:i.clearSelection)&&s.push(new u({selectionEnabled:!1,label:null==t?void 0:t.clearSelection,clickFunction:()=>this.clearSelection()})),null!=i&&i.zoomToSelection&&this.view&&s.push(new u({selectionEnabled:!1,label:null==t?void 0:t.zoomToSelection,clickFunction:()=>this.viewModel.zoomToSelection()})),null!=i&&i.selectedRecordsShowSelectedToggle&&(!l||e!==l.objectIds.length)){const e=t.showSelected,l=new u({selectionEnabled:!1,label:e,clickFunction:()=>{this.filterBySelection(),l.set("label",e)}});s.push(l)}}if(null!=i&&i.selectedRecordsShowAllToggle&&this._hasSelectionFilter()){const e=t.showAllRecords,l=new u({selectionEnabled:!1,label:e,clickFunction:()=>{this.clearSelectionFilter(),l.set("label",e)}});s.push(l)}return(null==i?void 0:i.toggleColumns)&&s.push(new u({iconClass:b.menuItemGroupClosedIcon,label:null==t?void 0:t.toggleColumns,clickFunction:this._toggleMenuItemSelectedIcon,items:null==l||null==(e=l.columns)?void 0:e.items.map((({header:e,hidden:t,path:l})=>new u({label:e||l,selected:!t,selectionEnabled:!0,iconClass:b.checkmarkIcon,clickFunction:()=>this._toggleColumnFromMenuItem(l)})))})),s.length?s:null}_toggleMenuItemSelectedIcon({item:e}){null==e||e.set("iconClass",null!=e&&e.selected?b.menuItemGroupOpenedIcon:b.menuItemGroupClosedIcon)}_toggleColumnFromMenuItem(e){const{grid:t,viewModel:l}=this,o=l.findColumn(e);null!=o&&o.hidden?t.showColumn(e):t.hideColumn(e)}_hasActiveSelection(){var e,t;return!(null==(e=this.grid)||null==(t=e.selectedItems)||!t.length)}_getSelectionFilter(){var e;return null==(e=this.viewModel.activeFilters)?void 0:e.find((e=>"selection"===e.type))}_hasSelectionFilter(){return!!this._getSelectionFilter()}};e([i("viewModel.activeSortOrders")],f.prototype,"activeSortOrders",void 0),e([i("viewModel.attachmentsEnabled")],f.prototype,"attachmentsEnabled",void 0),e([i("viewModel.autoRefreshEnabled")],f.prototype,"autoRefreshEnabled",void 0),e([i("viewModel.columnReorderingEnabled")],f.prototype,"columnReorderingEnabled",void 0),e([i("viewModel.columns")],f.prototype,"columns",void 0),e([i("viewModel.editingEnabled")],f.prototype,"editingEnabled",void 0),e([i("viewModel.fieldConfigs")],f.prototype,"fieldConfigs",void 0),e([i("viewModel.filterGeometry")],f.prototype,"filterGeometry",void 0),e([i("viewModel.grid")],f.prototype,"grid",void 0),e([i("viewModel.highlightOnRowSelectEnabled")],f.prototype,"highlightOnRowSelectEnabled",void 0),e([n({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],f.prototype,"label",void 0),e([i("viewModel.layer")],f.prototype,"layer",void 0),e([n(),h("geoscene/widgets/FeatureTable/t9n/FeatureTable")],f.prototype,"messages",void 0),e([n({readOnly:!0})],f.prototype,"menu",void 0),e([n()],f.prototype,"menuConfig",void 0),e([i("viewModel.multiSortEnabled")],f.prototype,"multiSortEnabled",void 0),e([i("viewModel.pageSize")],f.prototype,"pageSize",void 0),e([i("viewModel.relatedRecordsEnabled")],f.prototype,"relatedRecordsEnabled",void 0),e([i("viewModel.state")],f.prototype,"state",void 0),e([i("viewModel.view")],f.prototype,"view",void 0),e([n()],f.prototype,"viewModel",void 0),e([n()],f.prototype,"visibleElements",void 0),e([s("visibleElements")],f.prototype,"castVisibleElements",null),e([i("viewModel.clearHighlights")],f.prototype,"clearHighlights",null),e([i("viewModel.clearSelection")],f.prototype,"clearSelection",null),e([i("viewModel.clearSelectionFilter")],f.prototype,"clearSelectionFilter",null),e([i("viewModel.deselectRows")],f.prototype,"deselectRows",null),e([i("viewModel.filterBySelection")],f.prototype,"filterBySelection",null),e([i("viewModel.refresh")],f.prototype,"refresh",null),e([i("viewModel.sortColumn")],f.prototype,"sortColumn",null),e([i("viewModel.selectRows")],f.prototype,"selectRows",null),e([i("viewModel.scrollToIndex")],f.prototype,"scrollToIndex",null),e([i("viewModel.zoomToSelection")],f.prototype,"zoomToSelection",null),f=e([r("geoscene.widgets.FeatureTable")],f);const y=f;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{Heading as e}from"../support/Heading.js";import{tsx as t}from"../support/jsxFactory.js";import{classes as i,isActivationKey as n}from"../support/widgetUtils.js";const s={base:"esri-item-list",list:"esri-item-list__list",group:"esri-item-list__group",scroller:"esri-item-list__scroller",groupHeader:"esri-item-list__group__header",item:"esri-item-list__list-item",itemSelected:"esri-item-list__list-item--selected",itemContainer:"esri-item-list__list-item-container",itemLabel:"esri-item-list__list-item-label",noMatchesMessage:"esri-item-list__no-matches-message",noItemsMessage:"esri-item-list__no-items-message",filterContainer:"esri-item-list__filter-container",filterContainerSticky:"esri-item-list__filter-container--sticky",filterPlaceholder:"esri-item-list__filter-placeholder",filterInput:"esri-item-list__filter-input",filterPlaceholderText:"esri-item-list__filter-placeholder-text",searchIcon:"geoscene-icon-search",widget:"esri-widget",input:"esri-input"};function l(e){var i;const{id:n,identify:s,filterEnabled:l=!0,headingLevel:r=4,items:c,selectedItem:m,messages:u,filterText:d="",onFilterChange:I,renderIcon:f,onItemMouseLeave:g,onItemMouseEnter:p,onItemSelect:_}=e,h=null==(i=e.enableListScroll)||i;return t("div",{key:n},l?a({filterText:d,messages:u,onFilterChange:I,id:n}):null,o({enableListScroll:h,identify:s,items:c,selectedItem:m,messages:u,filterText:d,headingLevel:r,renderIcon:f,onItemMouseLeave:g,onItemMouseEnter:p,onItemSelect:_}))}function r(e){return!!e.items}function o(e){const{headingLevel:i,identify:n,items:l,renderIcon:o,filterText:a,onItemMouseLeave:u,onItemMouseEnter:d,onItemSelect:I,selectedItem:f}=e,g=e.enableListScroll?s.scroller:null;return 0===l.length?t("div",{class:s.noMatchesMessage,key:"no-matches"},e.messages.noMatches):t("div",{class:g,key:"item-container"},l.map((e=>r(e)?m({group:e,filterText:a,headingLevel:i,identify:n,onItemMouseLeave:u,onItemMouseEnter:d,onItemSelect:I,renderIcon:o,selectedItem:f}):c({item:e,identify:n,grouped:!0,onItemMouseLeave:u,onItemMouseEnter:d,onItemSelect:I,renderIcon:o,filterText:a,selectedItem:f}))))}function a(e){const{messages:i,filterText:n,enableListScroll:l}=e;return t("div",{key:"filter",class:l?null:s.filterContainerSticky},t("calcite-input",{onCalciteInputInput:t=>{const i=t.currentTarget;e.onFilterChange&&e.onFilterChange(i.value)},placeholder:i.filterPlaceholder,value:n,type:"search"}))}function c(e){const{identify:l,item:r,selectedItem:o,grouped:a,onItemSelect:c,onItemMouseEnter:m,onItemMouseLeave:u,renderIcon:d}=e,I=`${(null==l?void 0:l(r))||r.id}__${r.label}`,f=o?`${(null==l?void 0:l(o))||o.id}__${o.label}`:"";return t("calcite-list-item",{"aria-level":a?"2":"","data-item":r,key:I,class:i(s.item,I===f?s.itemSelected:""),label:r.label,onclick:e=>{const t=e.currentTarget["data-item"];c&&c(t)},onmouseenter:e=>{const t=e.currentTarget["data-item"];m&&m(t)},onkeydown:e=>{if(!n(e.key))return;const t=e.currentTarget["data-item"];c&&c(t)},onmouseleave:e=>{const t=e.currentTarget["data-item"];u&&u(t)},tabIndex:0},t("div",{slot:"content-start"},d&&d({item:r})))}function m(i){const{group:n,identify:l,onItemMouseLeave:r,onItemMouseEnter:o,onItemSelect:a,filterText:m,renderIcon:u,selectedItem:d,headingLevel:I}=i;return t("div",{class:s.group,key:n.label},t(e,{level:I,class:s.groupHeader},n.label),n.items.map((e=>c({item:e,identify:l,grouped:!0,onItemMouseLeave:r,onItemMouseEnter:o,onItemSelect:a,renderIcon:u,filterText:m,selectedItem:d}))))}function u(e){const{match:i,text:n}=e;let l=null;if(i){const e=n.toLowerCase(),s=i.toLowerCase(),r=e.indexOf(s);if(-1===r)l=n;else{const e=n.substring(0,r),s=n.substr(r,i.length),o=n.substring(r+i.length);l=t("span",null,e,t("strong",null,s),o)}}else l=n;return t("span",{class:s.itemLabel},l)}export{l as ItemList,m as renderGroup,c as renderItem,u as renderLabel};
5
+ import{Heading as e}from"../support/Heading.js";import{tsx as t}from"../support/jsxFactory.js";import{classes as i,isActivationKey as n}from"../support/widgetUtils.js";const s={base:"geoscene-item-list",list:"geoscene-item-list__list",group:"geoscene-item-list__group",scroller:"geoscene-item-list__scroller",groupHeader:"geoscene-item-list__group__header",item:"geoscene-item-list__list-item",itemSelected:"geoscene-item-list__list-item--selected",itemContainer:"geoscene-item-list__list-item-container",itemLabel:"geoscene-item-list__list-item-label",noMatchesMessage:"geoscene-item-list__no-matches-message",noItemsMessage:"geoscene-item-list__no-items-message",filterContainer:"geoscene-item-list__filter-container",filterContainerSticky:"geoscene-item-list__filter-container--sticky",filterPlaceholder:"geoscene-item-list__filter-placeholder",filterInput:"geoscene-item-list__filter-input",filterPlaceholderText:"geoscene-item-list__filter-placeholder-text",searchIcon:"geoscene-icon-search",widget:"geoscene-widget",input:"geoscene-input"};function l(e){var i;const{id:n,identify:s,filterEnabled:l=!0,headingLevel:r=4,items:c,selectedItem:m,messages:u,filterText:d="",onFilterChange:I,renderIcon:f,onItemMouseLeave:g,onItemMouseEnter:p,onItemSelect:_}=e,h=null==(i=e.enableListScroll)||i;return t("div",{key:n},l?a({filterText:d,messages:u,onFilterChange:I,id:n}):null,o({enableListScroll:h,identify:s,items:c,selectedItem:m,messages:u,filterText:d,headingLevel:r,renderIcon:f,onItemMouseLeave:g,onItemMouseEnter:p,onItemSelect:_}))}function r(e){return!!e.items}function o(e){const{headingLevel:i,identify:n,items:l,renderIcon:o,filterText:a,onItemMouseLeave:u,onItemMouseEnter:d,onItemSelect:I,selectedItem:f}=e,g=e.enableListScroll?s.scroller:null;return 0===l.length?t("div",{class:s.noMatchesMessage,key:"no-matches"},e.messages.noMatches):t("div",{class:g,key:"item-container"},l.map((e=>r(e)?m({group:e,filterText:a,headingLevel:i,identify:n,onItemMouseLeave:u,onItemMouseEnter:d,onItemSelect:I,renderIcon:o,selectedItem:f}):c({item:e,identify:n,grouped:!0,onItemMouseLeave:u,onItemMouseEnter:d,onItemSelect:I,renderIcon:o,filterText:a,selectedItem:f}))))}function a(e){const{messages:i,filterText:n,enableListScroll:l}=e;return t("div",{key:"filter",class:l?null:s.filterContainerSticky},t("calcite-input",{onCalciteInputInput:t=>{const i=t.currentTarget;e.onFilterChange&&e.onFilterChange(i.value)},placeholder:i.filterPlaceholder,value:n,type:"search"}))}function c(e){const{identify:l,item:r,selectedItem:o,grouped:a,onItemSelect:c,onItemMouseEnter:m,onItemMouseLeave:u,renderIcon:d}=e,I=`${(null==l?void 0:l(r))||r.id}__${r.label}`,f=o?`${(null==l?void 0:l(o))||o.id}__${o.label}`:"";return t("calcite-list-item",{"aria-level":a?"2":"","data-item":r,key:I,class:i(s.item,I===f?s.itemSelected:""),label:r.label,onclick:e=>{const t=e.currentTarget["data-item"];c&&c(t)},onmouseenter:e=>{const t=e.currentTarget["data-item"];m&&m(t)},onkeydown:e=>{if(!n(e.key))return;const t=e.currentTarget["data-item"];c&&c(t)},onmouseleave:e=>{const t=e.currentTarget["data-item"];u&&u(t)},tabIndex:0},t("div",{slot:"content-start"},d&&d({item:r})))}function m(i){const{group:n,identify:l,onItemMouseLeave:r,onItemMouseEnter:o,onItemSelect:a,filterText:m,renderIcon:u,selectedItem:d,headingLevel:I}=i;return t("div",{class:s.group,key:n.label},t(e,{level:I,class:s.groupHeader},n.label),n.items.map((e=>c({item:e,identify:l,grouped:!0,onItemMouseLeave:r,onItemMouseEnter:o,onItemSelect:a,renderIcon:u,filterText:m,selectedItem:d}))))}function u(e){const{match:i,text:n}=e;let l=null;if(i){const e=n.toLowerCase(),s=i.toLowerCase(),r=e.indexOf(s);if(-1===r)l=n;else{const e=n.substring(0,r),s=n.substr(r,i.length),o=n.substring(r+i.length);l=t("span",null,e,t("strong",null,s),o)}}else l=n;return t("span",{class:s.itemLabel},l)}export{l as ItemList,m as renderGroup,c as renderItem,u as renderLabel};
@@ -2,4 +2,4 @@
2
2
  All material copyright GeoScene, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.geoscene.cn/4.23/geoscene/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{isNone as r}from"../core/maybe.js";import{init as s}from"../core/watchUtils.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as o}from"../core/accessorSupport/decorators/cast.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import c from"./FeatureTemplates/FeatureTemplatesViewModel.js";import{ItemList as d}from"./FeatureTemplates/ItemList.js";import m from"./FeatureTemplates/TemplateItem.js";import"./support/widgetUtils.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as u}from"./support/decorators/vmEvent.js";import{tsx as h}from"./support/jsxFactory.js";const f={base:"esri-feature-templates",loader:"esri-feature-templates__loader",widget:"esri-widget"};function v(e){return"items"in e}function b(e){return e.length>0&&v(e[0])}function I(e){const{label:t}=e;return v(e)?t:`${t}–${e.layer.id}`}const y={filter:!0};let g=class extends(t(a)){constructor(e,t){super(e,t),this._iconIntersectionObserver=new IntersectionObserver(((e,t)=>{e.forEach((async e=>{if(e.isIntersecting){const s=e.target;if(s["data-has-icon"])return void t.unobserve(s);const i=s["data-item"],{layer:o,template:l}=i;s["data-has-icon"]=!0;const n=await m.fetchThumbnail(o,l).catch((()=>(s["data-has-icon"]=!1,null)));if(r(n))return;s.appendChild(n)}}))})),this.enableListScroll=!0,this.filterFunction=null,this.filterText="",this.groupBy=null,this.headingLevel=4,this.label=void 0,this.layers=null,this.messages=null,this.selectedItem=null,this.viewModel=new c,this.visibleElements={...y},this.renderItemIcon=this.renderItemIcon.bind(this),this._afterItemCreateOrUpdate=this._afterItemCreateOrUpdate.bind(this),this._afterItemRemoved=this._afterItemRemoved.bind(this)}initialize(){const e=({label:e})=>!this.filterText||e.toLowerCase().indexOf(this.filterText.toLowerCase())>-1;this.own(s(this,"viewModel",((t,r)=>{t&&!t.filterFunction&&(this.filterFunction=e),r&&r!==t&&r.filterFunction===e&&(r.filterFunction=null)})))}destroy(){this._iconIntersectionObserver&&(this._iconIntersectionObserver.disconnect(),this._iconIntersectionObserver=null)}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-input.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-progress.js")])}castVisibleElements(e){return{...y,...e}}select(e){return null}render(){const{enableListScroll:e,filterText:t,headingLevel:r,messages:s,viewModel:{items:i,selectedItem:o,state:l}}=this,n=this.visibleElements.filter;if(b(i)){const e=i.find((e=>e.label===c.nullGroupBy.label));e&&(e.label=s.other)}return h("div",{class:this.classes(f.base,f.widget),"aria-label":s.widgetLabel},"loading"===l?this.renderLoader():"ready"===l?h(d,{id:this.id,identify:I,filterText:t,items:i,headingLevel:r,messages:{filterPlaceholder:s.filterPlaceholder,noItems:s.noItems,noMatches:s.noMatches},filterEnabled:n,onItemSelect:e=>{this.viewModel.select(e)},onFilterChange:e=>{this.filterText=e,this.viewModel.refresh()},renderIcon:this.renderItemIcon,selectedItem:o,enableListScroll:e}):null)}renderItemIcon({item:e}){return h("span",{key:"icon",afterCreate:this._afterItemCreateOrUpdate,afterUpdate:this._afterItemCreateOrUpdate,afterRemoved:this._afterItemRemoved,"data-item":e,"data-has-icon":!1})}renderLoader(){return h("div",{class:f.loader,key:"loader"})}_afterItemCreateOrUpdate(e){var t;null==(t=this._iconIntersectionObserver)||t.observe(e)}_afterItemRemoved(e){var t;null==(t=this._iconIntersectionObserver)||t.unobserve(e)}};e([l()],g.prototype,"enableListScroll",void 0),e([i("viewModel.filterFunction")],g.prototype,"filterFunction",void 0),e([l()],g.prototype,"filterText",void 0),e([i("viewModel.groupBy")],g.prototype,"groupBy",void 0),e([l()],g.prototype,"headingLevel",void 0),e([l({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],g.prototype,"label",void 0),e([i("viewModel.layers")],g.prototype,"layers",void 0),e([l(),p("geoscene/widgets/FeatureTemplates/t9n/FeatureTemplates")],g.prototype,"messages",void 0),e([i("viewModel.selectedItem")],g.prototype,"selectedItem",void 0),e([l(),u("select")],g.prototype,"viewModel",void 0),e([l()],g.prototype,"visibleElements",void 0),e([o("visibleElements")],g.prototype,"castVisibleElements",null),e([i("viewModel.select")],g.prototype,"select",null),g=e([n("geoscene.widgets.FeatureTemplates")],g);const w=g;export{w as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{HandleOwnerMixin as t}from"../core/HandleOwner.js";import{isNone as r}from"../core/maybe.js";import{init as s}from"../core/watchUtils.js";import{aliasOf as i}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import{cast as o}from"../core/accessorSupport/decorators/cast.js";import{property as l}from"../core/accessorSupport/decorators/property.js";import{subclass as n}from"../core/accessorSupport/decorators/subclass.js";import a from"./Widget.js";import c from"./FeatureTemplates/FeatureTemplatesViewModel.js";import{ItemList as d}from"./FeatureTemplates/ItemList.js";import m from"./FeatureTemplates/TemplateItem.js";import"./support/widgetUtils.js";import{messageBundle as p}from"./support/decorators/messageBundle.js";import"../core/Logger.js";import{vmEvent as u}from"./support/decorators/vmEvent.js";import{tsx as h}from"./support/jsxFactory.js";const f={base:"geoscene-feature-templates",loader:"geoscene-feature-templates__loader",widget:"geoscene-widget"};function v(e){return"items"in e}function b(e){return e.length>0&&v(e[0])}function I(e){const{label:t}=e;return v(e)?t:`${t}–${e.layer.id}`}const y={filter:!0};let g=class extends(t(a)){constructor(e,t){super(e,t),this._iconIntersectionObserver=new IntersectionObserver(((e,t)=>{e.forEach((async e=>{if(e.isIntersecting){const s=e.target;if(s["data-has-icon"])return void t.unobserve(s);const i=s["data-item"],{layer:o,template:l}=i;s["data-has-icon"]=!0;const n=await m.fetchThumbnail(o,l).catch((()=>(s["data-has-icon"]=!1,null)));if(r(n))return;s.appendChild(n)}}))})),this.enableListScroll=!0,this.filterFunction=null,this.filterText="",this.groupBy=null,this.headingLevel=4,this.label=void 0,this.layers=null,this.messages=null,this.selectedItem=null,this.viewModel=new c,this.visibleElements={...y},this.renderItemIcon=this.renderItemIcon.bind(this),this._afterItemCreateOrUpdate=this._afterItemCreateOrUpdate.bind(this),this._afterItemRemoved=this._afterItemRemoved.bind(this)}initialize(){const e=({label:e})=>!this.filterText||e.toLowerCase().indexOf(this.filterText.toLowerCase())>-1;this.own(s(this,"viewModel",((t,r)=>{t&&!t.filterFunction&&(this.filterFunction=e),r&&r!==t&&r.filterFunction===e&&(r.filterFunction=null)})))}destroy(){this._iconIntersectionObserver&&(this._iconIntersectionObserver.disconnect(),this._iconIntersectionObserver=null)}loadDependencies(){return Promise.all([import("@esri/calcite-components/dist/components/calcite-icon.js"),import("@esri/calcite-components/dist/components/calcite-input.js"),import("@esri/calcite-components/dist/components/calcite-list-item.js"),import("@esri/calcite-components/dist/components/calcite-progress.js")])}castVisibleElements(e){return{...y,...e}}select(e){return null}render(){const{enableListScroll:e,filterText:t,headingLevel:r,messages:s,viewModel:{items:i,selectedItem:o,state:l}}=this,n=this.visibleElements.filter;if(b(i)){const e=i.find((e=>e.label===c.nullGroupBy.label));e&&(e.label=s.other)}return h("div",{class:this.classes(f.base,f.widget),"aria-label":s.widgetLabel},"loading"===l?this.renderLoader():"ready"===l?h(d,{id:this.id,identify:I,filterText:t,items:i,headingLevel:r,messages:{filterPlaceholder:s.filterPlaceholder,noItems:s.noItems,noMatches:s.noMatches},filterEnabled:n,onItemSelect:e=>{this.viewModel.select(e)},onFilterChange:e=>{this.filterText=e,this.viewModel.refresh()},renderIcon:this.renderItemIcon,selectedItem:o,enableListScroll:e}):null)}renderItemIcon({item:e}){return h("span",{key:"icon",afterCreate:this._afterItemCreateOrUpdate,afterUpdate:this._afterItemCreateOrUpdate,afterRemoved:this._afterItemRemoved,"data-item":e,"data-has-icon":!1})}renderLoader(){return h("div",{class:f.loader,key:"loader"})}_afterItemCreateOrUpdate(e){var t;null==(t=this._iconIntersectionObserver)||t.observe(e)}_afterItemRemoved(e){var t;null==(t=this._iconIntersectionObserver)||t.unobserve(e)}};e([l()],g.prototype,"enableListScroll",void 0),e([i("viewModel.filterFunction")],g.prototype,"filterFunction",void 0),e([l()],g.prototype,"filterText",void 0),e([i("viewModel.groupBy")],g.prototype,"groupBy",void 0),e([l()],g.prototype,"headingLevel",void 0),e([l({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],g.prototype,"label",void 0),e([i("viewModel.layers")],g.prototype,"layers",void 0),e([l(),p("geoscene/widgets/FeatureTemplates/t9n/FeatureTemplates")],g.prototype,"messages",void 0),e([i("viewModel.selectedItem")],g.prototype,"selectedItem",void 0),e([l(),u("select")],g.prototype,"viewModel",void 0),e([l()],g.prototype,"visibleElements",void 0),e([o("visibleElements")],g.prototype,"castVisibleElements",null),e([i("viewModel.select")],g.prototype,"select",null),g=e([n("geoscene.widgets.FeatureTemplates")],g);const w=g;export{w as default};