@arcgis/coding-components 4.31.0-next.2 → 4.31.0-next.21

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 (205) hide show
  1. package/README.md +22 -3
  2. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
  3. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ar.json +1 -1
  4. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bg.json +1 -1
  5. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bs.json +1 -1
  6. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ca.json +6 -6
  7. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.cs.json +1 -1
  8. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.da.json +1 -1
  9. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.de.json +1 -1
  10. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.el.json +1 -1
  11. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.es.json +1 -1
  12. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.et.json +1 -1
  13. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fi.json +1 -1
  14. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fr.json +1 -1
  15. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.he.json +1 -1
  16. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.hr.json +1 -1
  17. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.id.json +1 -1
  18. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.it.json +1 -1
  19. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ko.json +1 -1
  20. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nb.json +1 -1
  21. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nl.json +1 -1
  22. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pl.json +1 -1
  23. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-BR.json +1 -1
  24. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-PT.json +1 -1
  25. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ru.json +1 -1
  26. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sk.json +1 -1
  27. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sl.json +1 -1
  28. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sr.json +1 -1
  29. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sv.json +1 -1
  30. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.th.json +1 -1
  31. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.tr.json +1 -1
  32. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.uk.json +5 -5
  33. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.vi.json +1 -1
  34. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-CN.json +1 -1
  35. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-HK.json +1 -1
  36. package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-TW.json +1 -1
  37. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ca.json +2 -2
  38. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.de.json +1 -1
  39. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.he.json +1 -1
  40. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ca.json +1 -1
  41. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.it.json +1 -1
  42. package/dist/arcgis-coding-components/assets/code-editor/css.worker.js +1 -1
  43. package/dist/arcgis-coding-components/assets/code-editor/html.worker.js +1 -1
  44. package/dist/arcgis-coding-components/assets/code-editor/json.worker.js +1 -1
  45. package/dist/arcgis-coding-components/assets/code-editor/sql-expr.worker.js +33 -0
  46. package/dist/arcgis-coding-components/assets/code-editor/ts.worker.js +1 -1
  47. package/dist/arcgis-coding-components/assets/language-api-panel/t9n/language-api-panel.t9n.ca.json +1 -1
  48. package/dist/arcgis-coding-components/assets/sql-expression-editor/api/sql-expression-api.t9n.en.json +735 -0
  49. package/dist/arcgis-coding-components/index.esm.js +2 -2
  50. package/dist/arcgis-coding-components/{p-7984ea8e.js → p-1b799777.js} +2 -2
  51. package/dist/arcgis-coding-components/p-4d5cf512.entry.js +6 -0
  52. package/dist/arcgis-coding-components/{p-60c2a820.js → p-56266a64.js} +2 -2
  53. package/dist/arcgis-coding-components/{p-e8211ffe.js → p-57b8bcd7.js} +1 -1
  54. package/dist/arcgis-coding-components/{p-9eced6fc.js → p-5b67b62b.js} +2 -2
  55. package/dist/arcgis-coding-components/{p-93a97573.js → p-64137fec.js} +3 -3
  56. package/dist/arcgis-coding-components/{p-e7ee4d64.js → p-6621a80f.js} +3 -3
  57. package/dist/arcgis-coding-components/p-77dd5521.js +6 -0
  58. package/dist/arcgis-coding-components/p-8eb7e694.js +6 -0
  59. package/dist/arcgis-coding-components/p-a2341e0c.js +6 -0
  60. package/dist/arcgis-coding-components/{p-bb7e832e.js → p-b715834b.js} +3 -3
  61. package/dist/arcgis-coding-components/p-cbee273f.js +6 -0
  62. package/dist/arcgis-coding-components/{p-5ef7cce5.js → p-cdc52d2f.js} +1 -1
  63. package/dist/arcgis-coding-components/{p-36fedc23.js → p-d7d1f130.js} +12 -12
  64. package/dist/arcgis-coding-components/p-e1f9b463.entry.js +6 -0
  65. package/dist/arcgis-coding-components/{p-62ee6251.js → p-e5a924a1.js} +1 -1
  66. package/dist/arcgis-coding-components/p-f2d64a9d.js +6 -0
  67. package/dist/arcgis-coding-components/{p-03ea6cd7.js → p-ff62d134.js} +3 -3
  68. package/dist/arcgis-coding-components/p-ffce0588.entry.js +6 -0
  69. package/dist/cjs/{app-globals-aee5f4b5.js → app-globals-a9ef3ca8.js} +1 -1
  70. package/dist/cjs/arcade-defaults-f5241680.js +349 -0
  71. package/dist/cjs/arcade-language-features-0b9f3947.js +274 -0
  72. package/dist/cjs/arcade-mode-cc08d9cd.js +335 -0
  73. package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +181 -1501
  74. package/dist/cjs/arcgis-coding-components.cjs.js +4 -4
  75. package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +81 -0
  76. package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +80 -0
  77. package/dist/cjs/{css-7cc05f76.js → css-bb6a49ec.js} +1 -1
  78. package/dist/cjs/{cssMode-2b0daeae.js → cssMode-e7fac7d7.js} +3 -4
  79. package/dist/cjs/{html-f56911e1.js → html-7ff4071d.js} +3 -4
  80. package/dist/cjs/{htmlMode-43eed674.js → htmlMode-c89193ec.js} +3 -4
  81. package/dist/cjs/{index-b34238a6.js → index-4b7880ab.js} +9 -1
  82. package/dist/cjs/index.cjs.js +4 -3
  83. package/dist/cjs/{javascript-5115cb76.js → javascript-864c0220.js} +3 -4
  84. package/dist/cjs/{jsonMode-550dda36.js → jsonMode-ac4a7be7.js} +3 -4
  85. package/dist/cjs/{arcade-defaults-a8d8f8e2.js → language-defaults-base-57b37f9f.js} +842 -1183
  86. package/dist/cjs/loader.cjs.js +4 -4
  87. package/dist/cjs/sql-expr-defaults-245b036d.js +1347 -0
  88. package/dist/cjs/sql-expr-mode-304f5ce2.js +20844 -0
  89. package/dist/cjs/{tsMode-336306a9.js → tsMode-d30d4ab1.js} +4 -5
  90. package/dist/cjs/{typescript-b395242f.js → typescript-6c87ddb3.js} +3 -4
  91. package/dist/components/arcade-defaults.js +54 -1369
  92. package/dist/components/arcade-language-features.js +271 -0
  93. package/dist/components/arcade-mode.js +4 -264
  94. package/dist/components/arcade-results.js +7 -5
  95. package/dist/components/arcade-suggestions.js +7 -5
  96. package/dist/components/arcade-variables.js +8 -6
  97. package/dist/components/arcgis-arcade-editor.js +37 -35
  98. package/dist/components/arcgis-arcade-results.js +1 -1
  99. package/dist/components/arcgis-arcade-suggestions.js +1 -1
  100. package/dist/components/arcgis-arcade-variables.js +1 -1
  101. package/dist/components/arcgis-assets.d.ts +1 -1
  102. package/dist/components/arcgis-assets.js +1 -1
  103. package/dist/components/arcgis-code-editor.js +1 -1
  104. package/dist/components/arcgis-language-api-panel.js +1 -1
  105. package/dist/components/arcgis-sql-expression-editor.d.ts +11 -0
  106. package/dist/components/arcgis-sql-expression-editor.js +120 -0
  107. package/dist/components/arcgis-sql-expression-fields.d.ts +11 -0
  108. package/dist/components/arcgis-sql-expression-fields.js +11 -0
  109. package/dist/components/chunk-2JTWBRMN.js +1154 -0
  110. package/dist/components/code-editor.js +40 -13
  111. package/dist/components/fields.js +5 -5
  112. package/dist/components/index.js +1 -1
  113. package/dist/components/index2.js +30 -22
  114. package/dist/components/language-api-panel.js +13 -40
  115. package/dist/components/language-defaults-base.js +1309 -0
  116. package/dist/components/markdown.js +1 -1
  117. package/dist/components/sql-expr-defaults.js +196 -0
  118. package/dist/components/sql-expr-mode.js +20842 -0
  119. package/dist/components/sql-expression-fields.js +102 -0
  120. package/dist/components/useT9n.js +45 -8
  121. package/dist/components/utilities.js +1 -1
  122. package/dist/esm/{app-globals-59faaf33.js → app-globals-6d0ca11d.js} +1 -1
  123. package/dist/esm/arcade-defaults-066445c4.js +344 -0
  124. package/dist/esm/arcade-language-features-0e00c199.js +269 -0
  125. package/dist/esm/{arcade-mode-5d46035e.js → arcade-mode-abf1e1cf.js} +3 -263
  126. package/dist/esm/arcgis-arcade-editor_6.entry.js +127 -1447
  127. package/dist/esm/arcgis-coding-components.js +5 -5
  128. package/dist/esm/arcgis-sql-expression-editor.entry.js +77 -0
  129. package/dist/esm/arcgis-sql-expression-fields.entry.js +76 -0
  130. package/dist/esm/{css-e257dc49.js → css-c6dae12d.js} +1 -1
  131. package/dist/esm/{cssMode-c11f7f40.js → cssMode-052bb603.js} +2 -3
  132. package/dist/esm/{html-a6c37a99.js → html-572696a1.js} +2 -3
  133. package/dist/esm/{htmlMode-1270bc7d.js → htmlMode-fc184f2d.js} +2 -3
  134. package/dist/esm/{index-a970952c.js → index-0edd9846.js} +9 -1
  135. package/dist/esm/index.js +4 -3
  136. package/dist/esm/{javascript-ee179624.js → javascript-8bfc0096.js} +3 -4
  137. package/dist/esm/{jsonMode-07502ccb.js → jsonMode-7adf94ff.js} +2 -3
  138. package/dist/esm/{arcade-defaults-9eb28407.js → language-defaults-base-85a7f476.js} +833 -1179
  139. package/dist/esm/loader.js +5 -5
  140. package/dist/esm/sql-expr-defaults-be84ec7f.js +1339 -0
  141. package/dist/esm/sql-expr-mode-a4413e5c.js +20840 -0
  142. package/dist/esm/{tsMode-96749a12.js → tsMode-d10773c8.js} +2 -3
  143. package/dist/esm/{typescript-a3cf9881.js → typescript-9491f23e.js} +2 -3
  144. package/dist/loader/cdn.js +1 -1
  145. package/dist/loader/index.cjs.js +1 -1
  146. package/dist/loader/index.es2017.js +1 -1
  147. package/dist/loader/index.js +1 -1
  148. package/dist/types/components/arcade-editor/arcade-editor.d.ts +45 -10
  149. package/dist/types/components/arcade-results/arcade-results.d.ts +43 -1
  150. package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +22 -1
  151. package/dist/types/components/arcade-variables/arcade-variables.d.ts +28 -1
  152. package/dist/types/components/code-editor/code-editor.d.ts +16 -5
  153. package/dist/types/components/language-api-panel/language-api-panel.d.ts +34 -8
  154. package/dist/types/components/sql-expression-editor/sql-expression-editor.d.ts +24 -0
  155. package/dist/types/components/sql-expression-fields/sql-expression-fields.d.ts +32 -0
  156. package/dist/types/components.d.ts +98 -24
  157. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/arcade-editor.stories.d.ts +8 -1
  158. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/editorContext.d.ts +5 -1
  159. package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/sql-expression-editor/sql-expression-editor.stories.d.ts +13 -0
  160. package/dist/types/dependencies.d.ts +6 -10
  161. package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +1 -0
  162. package/dist/types/utils/arcade-monaco/arcade-profile-strategy.d.ts +9 -0
  163. package/dist/types/utils/fields.d.ts +2 -2
  164. package/dist/types/utils/language-defaults-base.d.ts +2 -9
  165. package/dist/types/utils/profile/editor-profile.d.ts +7 -6
  166. package/dist/types/utils/profile/types.d.ts +53 -65
  167. package/dist/types/utils/profile/utils.d.ts +9 -8
  168. package/dist/types/utils/sql-expr-monaco/DependentFiles/DateOnly.d.ts +41 -0
  169. package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlInterval.d.ts +16 -0
  170. package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlTimestampOffset.d.ts +26 -0
  171. package/dist/types/utils/sql-expr-monaco/DependentFiles/TimeOnly.d.ts +37 -0
  172. package/dist/types/utils/sql-expr-monaco/DependentFiles/UnknownTimeZone.d.ts +11 -0
  173. package/dist/types/utils/sql-expr-monaco/DependentFiles/WhereGrammar.d.ts +122 -0
  174. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlCompareUtils.d.ts +5 -0
  175. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlDateParsingUtils.d.ts +18 -0
  176. package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlUtils.d.ts +6 -0
  177. package/dist/types/utils/sql-expr-monaco/DependentFiles/standardizedFunctions.d.ts +156 -0
  178. package/dist/types/utils/sql-expr-monaco/DependentFiles/support.d.ts +150 -0
  179. package/dist/types/utils/sql-expr-monaco/PeggyGrammar/sql92grammar.d.ts +1397 -0
  180. package/dist/types/utils/sql-expr-monaco/sql-expr-completion.d.ts +6 -0
  181. package/dist/types/utils/sql-expr-monaco/sql-expr-constants.d.ts +45 -0
  182. package/dist/types/utils/sql-expr-monaco/sql-expr-contribution.d.ts +1 -0
  183. package/dist/types/utils/sql-expr-monaco/sql-expr-defaults.d.ts +21 -0
  184. package/dist/types/utils/sql-expr-monaco/sql-expr-language-features.d.ts +39 -0
  185. package/dist/types/utils/sql-expr-monaco/sql-expr-language-syntax.d.ts +8 -0
  186. package/dist/types/utils/sql-expr-monaco/sql-expr-mode.d.ts +43 -0
  187. package/dist/types/utils/sql-expr-monaco/sql-expr-service-accessors.d.ts +19 -0
  188. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-diagnostic-adapter.d.ts +34 -0
  189. package/dist/types/utils/sql-expr-monaco/sql-expr-validation-utils.d.ts +100 -0
  190. package/dist/types/utils/sql-expr-monaco/sql-expr-validation.d.ts +41 -0
  191. package/dist/types/utils/sql-expr-monaco/sql-expr-worker-manager.d.ts +17 -0
  192. package/dist/types/utils/sql-expr-monaco/sql-expr.worker.d.ts +24 -0
  193. package/dist/types/utils/sql-expr-monaco/sql-expression-profile-strategy.d.ts +13 -0
  194. package/dist/types/utils/sql-expr-monaco/types.d.ts +89 -0
  195. package/package.json +27 -21
  196. package/dist/arcgis-coding-components/p-0c6de9b3.js +0 -6
  197. package/dist/arcgis-coding-components/p-81c37dab.entry.js +0 -6
  198. package/dist/cjs/arcade-mode-b85ae7d4.js +0 -595
  199. package/dist/components/chunk-IHYYRFLQ.js +0 -1363
  200. package/dist/types/components/arcade-editor/t9n-types.d.ts +0 -8
  201. package/dist/types/components/arcade-results/t9n-types.d.ts +0 -13
  202. package/dist/types/components/arcade-suggestions/t9n-types.d.ts +0 -6
  203. package/dist/types/components/arcade-variables/t9n-types.d.ts +0 -8
  204. package/dist/types/components/language-api-panel/t9n-types.d.ts +0 -8
  205. package/dist/types/utils/profile/predefined-profile.d.ts +0 -2
@@ -0,0 +1,102 @@
1
+ /*!
2
+ * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
+ * v4.31.0-next.21
5
+ */
6
+ import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h } from '@stencil/core/internal/client';
7
+ import { u as useControllerManager } from './chunk-2JTWBRMN.js';
8
+ import { s as sqlExprDefaults } from './sql-expr-defaults.js';
9
+ import "@esri/calcite-components/dist/components/calcite-block.js";
10
+ import "@esri/calcite-components/dist/components/calcite-flow.js";
11
+ import "@esri/calcite-components/dist/components/calcite-flow-item.js";
12
+ import "@esri/calcite-components/dist/components/calcite-list.js";
13
+ import "@esri/calcite-components/dist/components/calcite-list-item.js";
14
+ import "@esri/calcite-components/dist/components/calcite-action.js";
15
+
16
+ const sqlExpressionFieldsCss = ":host calcite-flow{height:100%}:host calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}";
17
+ const ArcgisSqlExpressionFieldsStyle0 = sqlExpressionFieldsCss;
18
+
19
+ const __cmpMeta = [1,"arcgis-sql-expression-fields",{"loading":[1028],"modelId":[1025,"model-id"],"_mutationCounter":[32],"_flowItemRenderers":[32],"_filterValue":[32]},undefined,{"modelId":["modelIdPropChanged"]}];
20
+ const SqlExpressionFields = /*@__PURE__*/ proxyCustomElement(class SqlExpressionFields extends HTMLElement {
21
+ connectedCallback() { this.manager._connectedCallback(); }
22
+ constructor() {
23
+ super();
24
+ this.__registerHost();
25
+ this.constructor.__registerControllers = ()=>__cmpMeta[2]??{};
26
+ this.__attachShadow();
27
+ this.arcgisClose = createEvent(this, "arcgisClose", 3);
28
+ this.arcgisFieldSelected = createEvent(this, "arcgisFieldSelected", 3);
29
+ this.manager = useControllerManager(this,forceUpdate);
30
+ // #endregion
31
+ // #region Private Methods
32
+ this._handleSelectField = (event) => {
33
+ if (event.target instanceof HTMLElement) {
34
+ const tagName = event.target.tagName;
35
+ switch (tagName.toLowerCase()) {
36
+ case "calcite-list-item":
37
+ // TODO: why is value missing from HTMLCalciteListElement type?
38
+ this.arcgisFieldSelected.emit(event.target.value ?? "");
39
+ break;
40
+ case "calcite-action":
41
+ event.stopPropagation();
42
+ break;
43
+ }
44
+ }
45
+ };
46
+ this._emitClose = () => {
47
+ this.arcgisClose.emit();
48
+ };
49
+ this._mutationCounter = 1;
50
+ this._flowItemRenderers = [];
51
+ this._filterValue = "";
52
+ this.loading = false;
53
+ this.modelId = undefined;
54
+ }
55
+ modelIdPropChanged() {
56
+ this._flowItemRenderers = [];
57
+ }
58
+ // #endregion
59
+ // #region Lifecycle
60
+ disconnectedCallback() {
61
+ this.manager._disconnectedCallback();
62
+ this._flowObserver?.disconnect();
63
+ }
64
+ // #endregion
65
+ render() {
66
+ const layer = sqlExprDefaults.getFeatureLayerForModel(this.modelId ?? "");
67
+ if (this.loading || !this.modelId || !layer) {
68
+ return h("calcite-block", { heading: "Available Fields" });
69
+ }
70
+ return (h("calcite-flow", null, h("calcite-flow-item", { heading: "Available Fields", closable: true, description: "Select a field to insert into the expression", onCalciteFlowItemClose: this._emitClose }, h("calcite-list", { filterEnabled: true }, layer.fields.map((field) => (h("calcite-list-item", { key: field.name, onClick: this._handleSelectField, label: field.name, description: field.alias, value: field.name }, field.domain && (h("calcite-action", { slot: "actions-end", text: "open", icon: "chevron-right", onClick: () => {
71
+ const domain = field.domain;
72
+ if (domain.type === "coded-value") {
73
+ this._flowItemRenderers = [
74
+ ...this._flowItemRenderers,
75
+ () => (h("calcite-flow-item", { closable: true, heading: "Domains", description: field.name, onCalciteFlowItemClose: this._emitClose }, h("calcite-list", null, domain.codedValues.map((value) => (h("calcite-list-item", { key: value.code, onClick: this._handleSelectField, label: value.name, description: String(value.code), value: value.code })))))),
76
+ ];
77
+ }
78
+ } }))))))), this._flowItemRenderers.map((renderer) => renderer())));
79
+ }
80
+ static get assetsDirs() { return ["assets"]; }
81
+ get el() { return this; }
82
+ static get watchers() { return {
83
+ "modelId": ["modelIdPropChanged"]
84
+ }; }
85
+ static get style() { return ArcgisSqlExpressionFieldsStyle0; }
86
+ }, __cmpMeta);
87
+ function defineCustomElement() {
88
+ if (typeof customElements === "undefined") {
89
+ return;
90
+ }
91
+ const components = ["arcgis-sql-expression-fields"];
92
+ components.forEach(tagName => { switch (tagName) {
93
+ case "arcgis-sql-expression-fields":
94
+ if (!customElements.get(tagName)) {
95
+ customElements.define(tagName, SqlExpressionFields);
96
+ }
97
+ break;
98
+ } });
99
+ }
100
+ defineCustomElement();
101
+
102
+ export { SqlExpressionFields as S, defineCustomElement as d };
@@ -1,36 +1,73 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.2
4
+ * v4.31.0-next.21
5
5
  */
6
- import { m as makeController } from './chunk-IHYYRFLQ.js';
7
- import { p as startLocaleObserver, r as getElementLocales } from './index2.js';
6
+ import { m as makeController, w as watch } from './chunk-2JTWBRMN.js';
7
+ import { n as startLocaleObserver, p as getElementLocales } from './index2.js';
8
8
  import { getArcgisAssetPath as getAssetPath } from "./arcgis-assets.js";
9
9
 
10
- var makeT9nController = (getAssetPath) => ({ blocking = false, name } = {}) => (
10
+ var makeT9nController = (getAssetPath) => (options = {}) => (
11
11
  // eslint-disable-next-line @typescript-eslint/promise-function-async
12
12
  makeController((component, controller) => {
13
+ const componentWithOverrides = component;
13
14
  controller.onLifecycle(
14
15
  () => startLocaleObserver(
15
16
  component.el,
16
17
  getAssetPath("./assets"),
17
18
  ({ t9nLocale, t9nStrings, lang }) => {
18
- controller.exports = { ...t9nStrings, _lang: lang, _t9nLocale: t9nLocale };
19
+ const withoutOverrides = {
20
+ ...t9nStrings,
21
+ _lang: lang,
22
+ _t9nLocale: t9nLocale,
23
+ _loading: false
24
+ };
25
+ controller.exports = withoutOverrides;
19
26
  const label = t9nStrings.componentLabel ?? t9nStrings.widgetLabel;
20
27
  if (typeof label === "string" && "label" in component && component.label == null) {
21
28
  component.label ?? (component.label = label);
22
29
  }
30
+ applyOverrides(componentWithOverrides.messageOverrides);
23
31
  },
24
- name
32
+ options.name
25
33
  )
26
34
  );
27
- if (blocking) {
35
+ function applyOverrides(messageOverrides) {
36
+ const currentValue = controller.exports;
37
+ const rawMessages = currentValue._original ?? currentValue;
38
+ const updated = deepMerge(rawMessages, messageOverrides);
39
+ updated._original = rawMessages;
40
+ controller.exports = updated;
41
+ }
42
+ if ("messageOverrides" in componentWithOverrides) {
43
+ controller.onLifecycle(() => watch(componentWithOverrides, "messageOverrides", applyOverrides));
44
+ }
45
+ if (options.blocking) {
28
46
  return controller.ready;
29
47
  }
30
48
  const locale = getElementLocales(component.el);
31
- return { _lang: locale.lang, _t9nLocale: locale.t9nLocale };
49
+ const pending = {
50
+ _lang: locale.lang,
51
+ _t9nLocale: locale.t9nLocale,
52
+ _loading: true
53
+ };
54
+ return pending;
32
55
  })
33
56
  );
57
+ function deepMerge(original, overwrites) {
58
+ if (!overwrites) {
59
+ return original;
60
+ }
61
+ const merged = { ...original };
62
+ Object.entries(overwrites).forEach(([key, value]) => {
63
+ if (typeof value === "object") {
64
+ merged[key] = deepMerge(original[key], value);
65
+ } else {
66
+ merged[key] = value ?? original[key];
67
+ }
68
+ });
69
+ return merged;
70
+ }
34
71
 
35
72
  const useT9n = makeT9nController(getAssetPath);
36
73
 
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.2
4
+ * v4.31.0-next.21
5
5
  */
6
6
  import { d as createFilterExpression } from './index2.js';
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
- * v4.31.0-next.2
4
+ * v4.31.0-next.21
5
5
  */
6
6
  const globalScripts = () => {};
7
7
 
@@ -0,0 +1,344 @@
1
+ /*!
2
+ * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
+ * See https://js.arcgis.com/4.31/esri/copyright.txt for details.
4
+ * v4.31.0-next.21
5
+ */
6
+ import { m as main, f as fieldsToProfileValues, i as isPredefinedProfile, a as isFeatureSetCollectionDefinition, b as isFeatureSetDefinition, c as isFeatureDefinition, s as supportedLocales, L as LanguageDefaultsBase, d as fetchT9nStringsBundle, E as EditorProfile, U as Uri } from './language-defaults-base-85a7f476.js';
7
+ import { g as getAssetPath } from './index-0edd9846.js';
8
+
9
+ /**
10
+ * Returns the arcade diagnostic service.
11
+ * Example:
12
+ * ```ts
13
+ * const diagnosticService = await getArcadeDiagnosticService();
14
+ * diagnosticService.onDidChangeDiagnostics(({uri, diaganostics }) => {
15
+ * // Filter the diagnostics for the uri of interest
16
+ * // Do something with the diagnostics
17
+ * });
18
+ * ```
19
+ */
20
+ async function getArcadeDiagnosticService() {
21
+ const mode = await getMode();
22
+ return mode.getArcadeDiagnosticService();
23
+ }
24
+ /**
25
+ * Returns the arcade worker for the model.
26
+ * Example:
27
+ * ```ts
28
+ * const arcadeWorker = await getArcadeWorker(model.uri);
29
+ * ```
30
+ * @returns arcade worker
31
+ */
32
+ async function getArcadeWorker(uri) {
33
+ const mode = await getMode();
34
+ return await mode.getArcadeWorker(uri);
35
+ }
36
+ /**
37
+ * Request the arcade mode
38
+ * @returns arcade mode module
39
+ */
40
+ async function getMode() {
41
+ return await import('./arcade-mode-abf1e1cf.js');
42
+ }
43
+
44
+ // #region convert editor profile to apiProfile
45
+ /**
46
+ * Converts an editor profile to an api profile.
47
+ * The api profile is an optimized version of the editor profile designed for minimal data transfer between the main thread and the worker.
48
+ */
49
+ async function arcadeEditorToApiProfile(editorProfile) {
50
+ const { apiVersion, bundles, hiddenApiItems } = editorProfile.toEditorProfileDefinition();
51
+ const variables = await variablesToLSVariable(editorProfile.dictionaryVariables);
52
+ return { apiVersion, bundles, variables, hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()) };
53
+ }
54
+ async function variablesToLSVariable(editorVariables, kind = main.exports.CompletionItemKind.Variable) {
55
+ return await Promise.all(editorVariables.map(async (editorVariable) => {
56
+ switch (editorVariable.type) {
57
+ case "dictionary":
58
+ return await dictionaryToLSDictionary(editorVariable, kind);
59
+ case "feature":
60
+ return await featureToLSFeature(editorVariable, kind);
61
+ default:
62
+ return variableToLSVariable(editorVariable, kind);
63
+ }
64
+ }));
65
+ }
66
+ function variableToLSVariable(editorVariable, kind) {
67
+ const { name, type } = editorVariable;
68
+ const description = editorVariable.getDescription();
69
+ return {
70
+ name,
71
+ description,
72
+ type,
73
+ completion: {
74
+ label: name,
75
+ detail: name,
76
+ insertText: name,
77
+ insertTextMode: main.exports.InsertTextMode.asIs,
78
+ insertTextFormat: main.exports.InsertTextFormat.PlainText,
79
+ kind,
80
+ documentation: { kind: "markdown", value: description },
81
+ },
82
+ };
83
+ }
84
+ async function featureToLSFeature(editorFeature, kind) {
85
+ // Get the source for the definition
86
+ const source = await editorFeature.loadSource();
87
+ const { name } = editorFeature;
88
+ const description = editorFeature.getDescription();
89
+ const resultCompletion = {
90
+ label: name,
91
+ detail: name,
92
+ insertText: name,
93
+ insertTextMode: main.exports.InsertTextMode.asIs,
94
+ insertTextFormat: main.exports.InsertTextFormat.PlainText,
95
+ kind,
96
+ };
97
+ const result = {
98
+ name,
99
+ description,
100
+ type: "dictionary",
101
+ properties: [],
102
+ completion: resultCompletion,
103
+ };
104
+ // No source definition, then it will be a feature without any known fields
105
+ if (!source) {
106
+ return result;
107
+ }
108
+ // Create properties for the fields and the aliases
109
+ // Also improve the feature completion documentation
110
+ const [properties, featureCompletionDescription] = fieldsToProfileValues(source.fields, description, true);
111
+ result.properties = properties;
112
+ resultCompletion.documentation = { kind: "markdown", value: featureCompletionDescription };
113
+ return result;
114
+ }
115
+ async function dictionaryToLSDictionary(editorDictionary, kind) {
116
+ const { name, dictionaryVariables: variables } = editorDictionary;
117
+ const description = editorDictionary.getDescription();
118
+ const completionDescription = variables.reduce((previous, p) => {
119
+ if (previous !== "") {
120
+ previous += " \n \n";
121
+ }
122
+ previous += `**${p.name}** \n${p.type}`;
123
+ const description = p.getDescription();
124
+ if (description) {
125
+ previous += ` \n${description}`;
126
+ }
127
+ return previous;
128
+ }, description);
129
+ return {
130
+ name,
131
+ description,
132
+ type: "dictionary",
133
+ properties: await variablesToLSVariable(variables, main.exports.CompletionItemKind.Field),
134
+ completion: {
135
+ label: name,
136
+ detail: name,
137
+ insertText: name,
138
+ insertTextMode: main.exports.InsertTextMode.asIs,
139
+ insertTextFormat: main.exports.InsertTextFormat.PlainText,
140
+ kind,
141
+ documentation: { kind: "markdown", value: completionDescription },
142
+ },
143
+ };
144
+ }
145
+ // #endregion
146
+ // #region predefined profile to editor profile definition
147
+ /**
148
+ * Get a PredefinedProfile for a locale. If not already loaded then fetch it.
149
+ * If the locale doesn't exist or the locale profile file doesn't exist then returns
150
+ * the english version of the profile.
151
+ */
152
+ async function getSdkPredefinedProfiles(locale = "en") {
153
+ const profiles = sdkPredefinedProfilesMap.get(locale);
154
+ if (profiles) {
155
+ return profiles;
156
+ }
157
+ if (!supportedLocales.has(locale)) {
158
+ return await getSdkPredefinedProfiles("en");
159
+ }
160
+ try {
161
+ const response = await fetch(getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
162
+ if (response.ok) {
163
+ return cacheSdkPredefinedProfiles(locale, (await response.json()));
164
+ }
165
+ if (locale === "en") {
166
+ return null;
167
+ }
168
+ return await getSdkPredefinedProfiles("en");
169
+ }
170
+ catch {
171
+ return null;
172
+ }
173
+ }
174
+ const sdkPredefinedProfilesMap = new Map();
175
+ /**
176
+ * Convert a stored profile into a PredefinedProfile and add it to the in-memory
177
+ * Map of profiles per locale.
178
+ */
179
+ function cacheSdkPredefinedProfiles(locale, profiles) {
180
+ const map = new Map();
181
+ profiles.forEach((profile) => {
182
+ map.set(profile.id, profile);
183
+ });
184
+ sdkPredefinedProfilesMap.set(locale, map);
185
+ return map;
186
+ }
187
+ async function getSdkPredefinedProfile(id, locale = "en") {
188
+ const profiles = await getSdkPredefinedProfiles(locale);
189
+ return profiles?.get(id) ?? null;
190
+ }
191
+ function isExtendedPredefinedProfileDefinition(item) {
192
+ return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
193
+ }
194
+ function convertApiVariables(variables) {
195
+ return variables?.map(convertApiVariable);
196
+ }
197
+ function convertApiVariable(variable) {
198
+ switch (variable.type) {
199
+ case "dictionary":
200
+ return {
201
+ ...variable,
202
+ type: variable.type,
203
+ properties: convertApiVariables(variable.properties),
204
+ };
205
+ case "array": {
206
+ return {
207
+ ...variable,
208
+ type: variable.type,
209
+ elementType: { type: "number", name: "number" },
210
+ };
211
+ }
212
+ default:
213
+ return { ...variable, type: variable.type };
214
+ }
215
+ }
216
+ async function convertToEditorProfileDefinition(predefinedProfile, locale = "en") {
217
+ if (!isPredefinedProfile(predefinedProfile)) {
218
+ return undefined;
219
+ }
220
+ const sdkPredefinedProfile = await getSdkPredefinedProfile(predefinedProfile.id, locale);
221
+ if (!sdkPredefinedProfile) {
222
+ return undefined;
223
+ }
224
+ const editorProfile = {
225
+ bundles: [...sdkPredefinedProfile.bundles],
226
+ variables: [],
227
+ hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase()),
228
+ };
229
+ // Merge the SDK variables' definitions/properties with the predefined profile definitions.
230
+ sdkPredefinedProfile.variables.forEach((predefinedVariable) => {
231
+ // Don't include disabled variables
232
+ if (predefinedProfile.disabledVariables?.includes(predefinedVariable.name)) {
233
+ return;
234
+ }
235
+ // Try to get a definition from the predefined profile, for the variable that needs one.
236
+ const definition = predefinedProfile.definitions[predefinedVariable.name];
237
+ // Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
238
+ // despite the type checking from the switch statement.
239
+ switch (predefinedVariable.type) {
240
+ case "dictionary": {
241
+ // For dictionary, we support properties overrride
242
+ return editorProfile.variables.push(convertApiVariable({
243
+ ...predefinedVariable,
244
+ type: predefinedVariable.type,
245
+ properties: Array.isArray(definition) ? [...definition] : predefinedVariable.properties,
246
+ }));
247
+ }
248
+ case "feature":
249
+ // If the definition is not valid, then we don't include it.
250
+ if (!isFeatureDefinition(definition)) {
251
+ return;
252
+ }
253
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
254
+ case "featureSet":
255
+ // If the definition is not valid, then we don't include it.
256
+ if (!isFeatureSetDefinition(definition)) {
257
+ return;
258
+ }
259
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
260
+ case "featureSetCollection":
261
+ // If the definition is not valid, then we don't include it.
262
+ if (!isFeatureSetCollectionDefinition(definition)) {
263
+ return;
264
+ }
265
+ return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
266
+ default:
267
+ return editorProfile.variables.push(convertApiVariable(predefinedVariable));
268
+ }
269
+ });
270
+ if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
271
+ editorProfile.variables.push(...(predefinedProfile.additionalVariables ?? []));
272
+ }
273
+ return editorProfile;
274
+ }
275
+ // #endregion
276
+
277
+ const arcadeLanguageId = "arcade";
278
+ class ArcadeLanguageServiceDefaults extends LanguageDefaultsBase {
279
+ constructor() {
280
+ super(...arguments);
281
+ this._languageId = arcadeLanguageId;
282
+ this._languageOptions = {};
283
+ }
284
+ /**
285
+ * Create an EditorProfile for the given model id using the given definition and locale.
286
+ * The EditorProfile is used by the the Arcade Language service as well by the cosing components.
287
+ * The definition can be a pre-defined profile or an editor profile definition.
288
+ * If the locale is not provided then the 'en' locale is used.
289
+ * @param modelId The model id for which to create the context.
290
+ * @param definition The definition to use for the model context.
291
+ * @param locale The locale to use for the model context.
292
+ * @returns The EditorProfile for the model.
293
+ */
294
+ async setProfileForModel(modelId, definition, apiContext = { locale: "en" }) {
295
+ // Convert pre-defined profile to a runtime profile
296
+ if (isPredefinedProfile(definition)) {
297
+ definition = await convertToEditorProfileDefinition(definition, apiContext.locale);
298
+ }
299
+ const profileStrings = await fetchT9nStringsBundle(apiContext.locale, getAssetPath("./assets/arcade-language/t9n"), "profile.t9n.");
300
+ if (!profileStrings) {
301
+ throw new Error(`Failed to load the language bundle for ${apiContext.locale}`);
302
+ }
303
+ this.disposeForModel(modelId);
304
+ const key = this._getApiKey(modelId);
305
+ const editorProfile = new EditorProfile(definition, profileStrings);
306
+ this._profileMap.set(key, editorProfile);
307
+ const apiProfile = await arcadeEditorToApiProfile(editorProfile);
308
+ this.updateApiContextForModel(modelId, {
309
+ locale: apiContext.locale,
310
+ profile: apiProfile,
311
+ snippets: apiContext.snippets,
312
+ });
313
+ }
314
+ /**
315
+ * Set or update the Arcade language service options.
316
+ * @param languageOptions The language options to set.
317
+ */
318
+ setLanguageOptions(languageOptions = {}) {
319
+ // Check if options have actually changed.
320
+ // Avoid restarting the worker when no updates.
321
+ // Today we only have the 'assetsPath' as a property
322
+ if (this._languageOptions.assetsPath === languageOptions.assetsPath) {
323
+ return;
324
+ }
325
+ this._languageOptions = { ...this._languageOptions, ...languageOptions };
326
+ this._onDidChange.fire(this);
327
+ }
328
+ /**
329
+ * Gets the API library for the given model id.
330
+ * @param modelId The model id for which to get the API library.
331
+ * @returns The API library for the model.
332
+ */
333
+ async getApiLibrary(modelId) {
334
+ const uri = Uri.parse(modelId);
335
+ const worker = await getArcadeWorker(uri);
336
+ return await worker.getApiLibrary(this.getApiContextForModel(uri));
337
+ }
338
+ }
339
+ const arcadeDefaults = new ArcadeLanguageServiceDefaults();
340
+ const arcade = {
341
+ setProfileForModel: arcadeDefaults.setProfileForModel.bind(arcadeDefaults),
342
+ };
343
+
344
+ export { arcade as a, arcadeDefaults as b, getMode as c, getArcadeDiagnosticService as g };