@arcgis/coding-components 5.1.0-next.76 → 5.1.0-next.78

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 (79) hide show
  1. package/dist/cdn/{5U42AMRW.js → 2GTR4354.js} +1 -1
  2. package/dist/cdn/{4ZT5R3ZT.js → 3NV73G2S.js} +1 -1
  3. package/dist/cdn/{EAV4BEUB.js → 4WIAOFPL.js} +1 -1
  4. package/dist/cdn/{3K6GLWE5.js → 53S6IYF4.js} +1 -1
  5. package/dist/cdn/{DTQ4CBQV.js → 57Y2CW44.js} +1 -1
  6. package/dist/cdn/{F54EMO37.js → 5TJYZEFZ.js} +1 -1
  7. package/dist/cdn/{JCPZT6NO.js → 6HREGRCI.js} +1 -1
  8. package/dist/cdn/{2BX4WBIK.js → 7A7GVNCD.js} +1 -1
  9. package/dist/cdn/{2SBA544Y.js → 7ZWSJREH.js} +1 -1
  10. package/dist/cdn/{QDGEKNA2.js → AHRWOU6H.js} +1 -1
  11. package/dist/cdn/{WKV7HW5R.js → C36I7M4Q.js} +1 -1
  12. package/dist/cdn/{BQFM22NK.js → CXAIJ3A2.js} +1 -1
  13. package/dist/cdn/{NMDEW7DJ.js → CZ7ZUZ2F.js} +1 -1
  14. package/dist/cdn/FBVBPQHU.js +4 -0
  15. package/dist/cdn/{QLVA2JT7.js → HUFNKU6D.js} +1 -1
  16. package/dist/cdn/{SN5W5DD6.js → KL4BXZD6.js} +1 -1
  17. package/dist/cdn/{M2TDIEV3.js → LAATODES.js} +1 -1
  18. package/dist/cdn/NAYHYNWO.js +4 -0
  19. package/dist/cdn/{GTQHR2W6.js → PXRC7SQI.js} +1 -1
  20. package/dist/cdn/UYSO3CQD.js +3 -0
  21. package/dist/cdn/{XY4DTHPO.js → VEL4JBV3.js} +1 -1
  22. package/dist/cdn/{KJLCPXUD.js → VMGIIX4A.js} +1 -1
  23. package/dist/cdn/assets/code-editor/sql-expr.worker.js +2 -2
  24. package/dist/cdn/assets/sql-layer-editor/t9n/messages.ar.json +1 -1
  25. package/dist/cdn/assets/sql-layer-editor/t9n/messages.bg.json +1 -1
  26. package/dist/cdn/assets/sql-layer-editor/t9n/messages.bs.json +1 -1
  27. package/dist/cdn/assets/sql-layer-editor/t9n/messages.ca.json +1 -1
  28. package/dist/cdn/assets/sql-layer-editor/t9n/messages.cs.json +1 -1
  29. package/dist/cdn/assets/sql-layer-editor/t9n/messages.da.json +1 -1
  30. package/dist/cdn/assets/sql-layer-editor/t9n/messages.de.json +1 -1
  31. package/dist/cdn/assets/sql-layer-editor/t9n/messages.el.json +1 -1
  32. package/dist/cdn/assets/sql-layer-editor/t9n/messages.en.json +1 -1
  33. package/dist/cdn/assets/sql-layer-editor/t9n/messages.es.json +1 -1
  34. package/dist/cdn/assets/sql-layer-editor/t9n/messages.et.json +1 -1
  35. package/dist/cdn/assets/sql-layer-editor/t9n/messages.fi.json +1 -1
  36. package/dist/cdn/assets/sql-layer-editor/t9n/messages.fr.json +1 -1
  37. package/dist/cdn/assets/sql-layer-editor/t9n/messages.he.json +1 -1
  38. package/dist/cdn/assets/sql-layer-editor/t9n/messages.hr.json +1 -1
  39. package/dist/cdn/assets/sql-layer-editor/t9n/messages.hu.json +1 -1
  40. package/dist/cdn/assets/sql-layer-editor/t9n/messages.id.json +1 -1
  41. package/dist/cdn/assets/sql-layer-editor/t9n/messages.it.json +1 -1
  42. package/dist/cdn/assets/sql-layer-editor/t9n/messages.ja.json +1 -1
  43. package/dist/cdn/assets/sql-layer-editor/t9n/messages.ko.json +1 -1
  44. package/dist/cdn/assets/sql-layer-editor/t9n/messages.lt.json +1 -1
  45. package/dist/cdn/assets/sql-layer-editor/t9n/messages.lv.json +1 -1
  46. package/dist/cdn/assets/sql-layer-editor/t9n/messages.nl.json +1 -1
  47. package/dist/cdn/assets/sql-layer-editor/t9n/messages.no.json +1 -1
  48. package/dist/cdn/assets/sql-layer-editor/t9n/messages.pl.json +1 -1
  49. package/dist/cdn/assets/sql-layer-editor/t9n/messages.pt-BR.json +1 -1
  50. package/dist/cdn/assets/sql-layer-editor/t9n/messages.pt-PT.json +1 -1
  51. package/dist/cdn/assets/sql-layer-editor/t9n/messages.ro.json +1 -1
  52. package/dist/cdn/assets/sql-layer-editor/t9n/messages.ru.json +1 -1
  53. package/dist/cdn/assets/sql-layer-editor/t9n/messages.sk.json +1 -1
  54. package/dist/cdn/assets/sql-layer-editor/t9n/messages.sl.json +1 -1
  55. package/dist/cdn/assets/sql-layer-editor/t9n/messages.sr.json +1 -1
  56. package/dist/cdn/assets/sql-layer-editor/t9n/messages.sv.json +1 -1
  57. package/dist/cdn/assets/sql-layer-editor/t9n/messages.th.json +1 -1
  58. package/dist/cdn/assets/sql-layer-editor/t9n/messages.tr.json +1 -1
  59. package/dist/cdn/assets/sql-layer-editor/t9n/messages.uk.json +1 -1
  60. package/dist/cdn/assets/sql-layer-editor/t9n/messages.vi.json +1 -1
  61. package/dist/cdn/assets/sql-layer-editor/t9n/messages.zh-CN.json +1 -1
  62. package/dist/cdn/assets/sql-layer-editor/t9n/messages.zh-HK.json +1 -1
  63. package/dist/cdn/assets/sql-layer-editor/t9n/messages.zh-TW.json +1 -1
  64. package/dist/cdn/index.js +1 -1
  65. package/dist/chunks/utilities.js +29 -29
  66. package/dist/components/arcgis-sql-layer-editor/customElement.d.ts +18 -0
  67. package/dist/components/arcgis-sql-layer-editor/customElement.js +55 -37
  68. package/dist/docs/api.json +1 -1
  69. package/dist/docs/docs.json +1 -1
  70. package/dist/docs/web-types.json +1 -1
  71. package/dist/loader.js +3 -3
  72. package/dist/types/lumina.d.ts +1 -1
  73. package/dist/types/preact.d.ts +1 -1
  74. package/dist/types/react.d.ts +1 -1
  75. package/dist/types/stencil.d.ts +1 -1
  76. package/package.json +5 -5
  77. package/dist/cdn/ABFGWEVR.js +0 -4
  78. package/dist/cdn/BNZD6ISN.js +0 -2
  79. package/dist/cdn/ZJYULKEI.js +0 -4
@@ -13,6 +13,18 @@ import type { T9nMeta } from "@arcgis/lumina/controllers";
13
13
  * @internal
14
14
  */
15
15
  export abstract class ArcgisSqlLayerEditor extends LitElement {
16
+ /**
17
+ * Options to update on the editor.
18
+ * For example:
19
+ * ```json
20
+ * {
21
+ * "fontSize": 18
22
+ * }
23
+ * ```
24
+ *
25
+ * To get the full list of available options, see the Monaco Editor options [documentation](https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor_editor_api.editor.IEditorOptions.html) for more details.
26
+ */
27
+ accessor editorOptions: editor.IEditorOptions & editor.IGlobalEditorOptions | undefined;
16
28
  /** @default false */
17
29
  accessor hideSideBar: boolean;
18
30
  /**
@@ -24,16 +36,22 @@ export abstract class ArcgisSqlLayerEditor extends LitElement {
24
36
  loading?: string | undefined;
25
37
  profileempty?: string | undefined;
26
38
  tables?: string | undefined;
39
+ placeholder?: string | undefined;
40
+ placeholderexample?: string | undefined;
27
41
  };
28
42
  /** @internal */
29
43
  protected messages: Partial<{
30
44
  loading: string;
31
45
  profileempty: string;
32
46
  tables: string;
47
+ placeholder: string;
48
+ placeholderexample: string;
33
49
  }> & T9nMeta<{
34
50
  loading: string;
35
51
  profileempty: string;
36
52
  tables: string;
53
+ placeholder: string;
54
+ placeholderexample: string;
37
55
  }>;
38
56
  /** @default "none" */
39
57
  accessor openedSidePanel: SidePanelName;
@@ -1,12 +1,12 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { c as r } from "../../chunks/runtime.js";
3
- import { css as l, html as a } from "lit";
4
- import { LitElement as d, createEvent as s, safeClassMap as n } from "@arcgis/lumina";
5
- import { generateGuid as c } from "@arcgis/toolkit/string";
6
- import { u as h } from "../../chunks/useT9n.js";
7
- import { createRef as p, ref as g } from "lit/directives/ref.js";
8
- import { k as m } from "../../chunks/utils.js";
9
- import "@arcgis/arcade-languageservice";
2
+ import { c as p } from "../../chunks/runtime.js";
3
+ import { css as h, html as r } from "lit";
4
+ import { LitElement as g, createEvent as l, safeClassMap as m } from "@arcgis/lumina";
5
+ import { generateGuid as u } from "@arcgis/toolkit/string";
6
+ import { u as f } from "../../chunks/useT9n.js";
7
+ import { createRef as _, ref as b } from "lit/directives/ref.js";
8
+ import { k as d } from "../../chunks/utils.js";
9
+ import { e as E } from "../../chunks/utilities.js";
10
10
  import "@arcgis/core/portal/PortalItem.js";
11
11
  import "@arcgis/core/WebMap.js";
12
12
  import "@arcgis/core/WebScene.js";
@@ -14,52 +14,55 @@ import "@arcgis/core/layers/FeatureLayer.js";
14
14
  import "@arcgis/core/applications/Components/arcadeEditorUtils.js";
15
15
  import "@arcgis/toolkit/predicate";
16
16
  import "vscode-languageserver-types";
17
- import { rethrowError as t } from "@arcgis/toolkit/log";
17
+ import { rethrowError as o } from "@arcgis/toolkit/log";
18
18
  import "@arcgis/core/core/Error.js";
19
- import { d as o } from "../../chunks/language-defaults-base.js";
19
+ import { d as n } from "../../chunks/language-defaults-base.js";
20
20
  import "@arcgis/core/portal/Portal.js";
21
- import { g as _, a as f, b as u, c as b } from "../../chunks/sql-layer-defaults.js";
22
- import { getSqlLayerDiagnosticService as v } from "../../chunks/sql-layer-mode.js";
23
- const S = l`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`;
24
- class E extends d {
21
+ import { g as S, a as v, b as y, c as $ } from "../../chunks/sql-layer-defaults.js";
22
+ import { getSqlLayerDiagnosticService as x } from "../../chunks/sql-layer-mode.js";
23
+ const I = h`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`;
24
+ class L extends g {
25
25
  constructor() {
26
- super(...arguments), this._codeEditorElt = p(), this._disposables = [], this._modelId = c(), this.messages = h(), this._preparing = !1, this._resolvedLanguage = o, this.sideActionBarExpanded = !1, this.script = "", this.hideSideBar = !1, this.openedSidePanel = "none", this.arcgisDiagnosticsChange = s({ bubbles: !1 }), this.arcgisScriptChange = s({ bubbles: !1 });
26
+ super(...arguments), this._codeEditorElt = _(), this._disposables = [], this._modelId = u(), this.messages = f(), this._preparing = !1, this._resolvedLanguage = n, this.sideActionBarExpanded = !1, this.script = "", this.hideSideBar = !1, this.openedSidePanel = "none", this.arcgisDiagnosticsChange = l({ bubbles: !1 }), this.arcgisScriptChange = l({ bubbles: !1 });
27
27
  }
28
28
  static {
29
- this.properties = { _editorProfile: 16, _preparing: 16, _resolvedLanguage: 16, sideActionBarExpanded: 16, profile: 0, script: 1, hideSideBar: 5, messageOverrides: 0, openedSidePanel: 3 };
29
+ this.properties = { _editorProfile: 16, _preparing: 16, _resolvedLanguage: 16, sideActionBarExpanded: 16, profile: 0, script: 1, hideSideBar: 5, messageOverrides: 0, openedSidePanel: 3, editorOptions: 0, editorInstance: 32 };
30
30
  }
31
31
  static {
32
- this.styles = [S];
32
+ this.styles = [I];
33
+ }
34
+ get editorInstance() {
35
+ return this._codeEditorElt.value?.editorInstance;
33
36
  }
34
37
  async setFocus() {
35
38
  await this._codeEditorElt.value?.setFocus();
36
39
  }
37
40
  async load() {
38
- await this._updateDataModelDeps().catch(t(this));
41
+ await this._updateDataModelDeps().catch(o(this));
39
42
  }
40
43
  willUpdate(e) {
41
- e.has("profile") && this._updateDataModelDeps().catch(t(this));
44
+ e.has("profile") && this._updateDataModelDeps().catch(o(this));
42
45
  }
43
46
  async loaded() {
44
- const e = v();
45
- this._disposables.push(e.onDiagnosticsChange((i) => {
46
- i.uri.toString() === this._modelId && !this._preparing && this.arcgisDiagnosticsChange.emit(i.diagnostics);
47
+ const e = x();
48
+ this._disposables.push(e.onDiagnosticsChange((t) => {
49
+ t.uri.toString() === this._modelId && !this._preparing && this.arcgisDiagnosticsChange.emit(t.diagnostics);
47
50
  }));
48
51
  }
49
52
  disconnectedCallback() {
50
53
  for (super.disconnectedCallback(); this._disposables.length; )
51
54
  this._disposables.pop()?.dispose();
52
- _().forEach((e) => e.disposeForModel(this._modelId));
55
+ S().forEach((e) => e.disposeForModel(this._modelId));
53
56
  }
54
57
  async _updateDataModelDeps() {
55
58
  this._preparing = !0;
56
59
  try {
57
- const e = await f(this.profile);
58
- e !== this._resolvedLanguage && (u(this._resolvedLanguage)?.disposeForModel(this._modelId), this._resolvedLanguage = e);
59
- const i = b(this._resolvedLanguage);
60
- await i.setProfileForModel(this._modelId, this.profile, { locale: this.messages._t9nLocale }), this._editorProfile = i.getEditorProfileForModel(this._modelId);
60
+ const e = await v(this.profile);
61
+ e !== this._resolvedLanguage && (y(this._resolvedLanguage)?.disposeForModel(this._modelId), this._resolvedLanguage = e);
62
+ const t = $(this._resolvedLanguage);
63
+ await t.setProfileForModel(this._modelId, this.profile, { locale: this.messages._t9nLocale }), this._editorProfile = t.getEditorProfileForModel(this._modelId);
61
64
  } catch {
62
- this._editorProfile = void 0, this._resolvedLanguage = o;
65
+ this._editorProfile = void 0, this._resolvedLanguage = n;
63
66
  } finally {
64
67
  this._preparing = !1;
65
68
  }
@@ -68,25 +71,40 @@ class E extends d {
68
71
  this.sideActionBarExpanded = !this.sideActionBarExpanded;
69
72
  }
70
73
  _toggleSidePanel(e) {
71
- this.openedSidePanel = this.openedSidePanel === e ? "none" : e, this.openedSidePanel === "none" && this._codeEditorElt.value?.setFocus().catch(t(this));
74
+ this.openedSidePanel = this.openedSidePanel === e ? "none" : e, this.openedSidePanel === "none" && this._codeEditorElt.value?.setFocus().catch(o(this));
72
75
  }
73
76
  _onCodeEditorValueChange(e) {
74
77
  e.stopPropagation(), this.script = e.detail, this.arcgisScriptChange.emit(e.detail);
75
78
  }
76
- _insertAsText(e) {
77
- this._codeEditorElt.value?.insertText(e.detail).catch(t(this));
79
+ async _onItemSelected(e) {
80
+ e.stopPropagation();
81
+ const t = this._getSelectedTableVariable(e.detail);
82
+ if (!t) {
83
+ this._codeEditorElt.value?.insertText(e.detail).catch(o(this));
84
+ return;
85
+ }
86
+ await t.loadSource();
87
+ let i;
88
+ const s = t.fieldInfos.filter((a) => a.type === "geometry" && !i ? (i = a.name, !0) : a.type !== "geometry").map((a) => a.name).filter(Boolean), c = `select ${s.length ? s.join(", ") : "*"} from ${t.snippet};`;
89
+ E(this._codeEditorElt.value?.editorInstance, c, "replace", "");
78
90
  }
79
91
  _getTablesVariable() {
80
- return this._editorProfile?.variables.find(m);
92
+ return this._editorProfile?.variables.find(d);
93
+ }
94
+ _getSelectedTableVariable(e) {
95
+ const t = this._getTablesVariable();
96
+ if (d(t))
97
+ return t.tableVariables.find((i) => i.snippet === e);
81
98
  }
82
99
  render() {
83
- const e = this._getTablesVariable();
84
- return a`<arcgis-code-editor-shell><arcgis-code-editor slot=editor .language=${this._resolvedLanguage} .modelId=${this._modelId} .value=${this.script ?? ""} @arcgisValueChange=${this._onCodeEditorValueChange} ${g(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar && a`<arcgis-editor-variables slot=side-panel .variable=${e} .heading=${this.messages.tables ?? "Tables"} .messageOverrides=${{ profileempty: this.messages.profileempty }} .closed=${this.openedSidePanel !== "variables"} class=${n(this.openedSidePanel === "variables" ? "" : "hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${() => {
100
+ const e = this._getTablesVariable(), i = String(this.messages.placeholderexample ?? "Example: {sqlQueryExample}").replace("{sqlQueryExample}", "select field1, field2 from db.dataset;"), s = `${this.messages.placeholder ?? "Start filtering data using SQL query syntax"}
101
+ ${i}`;
102
+ return r`<arcgis-code-editor-shell><arcgis-code-editor slot=editor .language=${this._resolvedLanguage} .modelId=${this._modelId} .value=${this.script ?? ""} @arcgisValueChange=${this._onCodeEditorValueChange} .editorOptions=${{ placeholder: s, ...this.editorOptions }} ${b(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar && r`<arcgis-editor-variables slot=side-panel .variable=${e} .heading=${this.messages.tables ?? "Tables"} .messageOverrides=${{ profileempty: this.messages.profileempty }} .closed=${this.openedSidePanel !== "variables"} class=${m(this.openedSidePanel === "variables" ? "" : "hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._onItemSelected} @arcgisInternalClosePanel=${() => {
85
103
  this.openedSidePanel = "none";
86
- }} data-panel-name=none></arcgis-editor-variables><calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action id=tables-action .text=${this.messages.tables ?? "Tables"} icon=table .active=${this.openedSidePanel === "variables"} data-panel-name=variables @click=${() => this._toggleSidePanel("variables")}></calcite-action>${!this.sideActionBarExpanded && a`<calcite-tooltip reference-element=tables-action><span>${this.messages.tables ?? "Tables"}</span></calcite-tooltip>` || ""}</calcite-action-bar>` || ""}</arcgis-code-editor-shell>`;
104
+ }} data-panel-name=none></arcgis-editor-variables><calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action id=tables-action .text=${this.messages.tables ?? "Tables"} icon=table .active=${this.openedSidePanel === "variables"} data-panel-name=variables @click=${() => this._toggleSidePanel("variables")}></calcite-action>${!this.sideActionBarExpanded && r`<calcite-tooltip reference-element=tables-action><span>${this.messages.tables ?? "Tables"}</span></calcite-tooltip>` || ""}</calcite-action-bar>` || ""}</arcgis-code-editor-shell>`;
87
105
  }
88
106
  }
89
- r("arcgis-sql-layer-editor", E);
107
+ p("arcgis-sql-layer-editor", L);
90
108
  export {
91
- E as ArcgisSqlLayerEditor
109
+ L as ArcgisSqlLayerEditor
92
110
  };