@hpcc-js/codemirror 2.61.4 → 2.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hpcc-js/codemirror",
3
- "version": "2.61.4",
3
+ "version": "2.62.0",
4
4
  "description": "hpcc-js - Viz Code Mirror",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es6",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@hpcc-js/bundle": "^2.11.5",
45
- "@hpcc-js/codemirror-shim": "^2.34.7",
45
+ "@hpcc-js/codemirror-shim": "^2.35.0",
46
46
  "tslib": "2.6.2"
47
47
  },
48
48
  "repository": {
@@ -56,5 +56,5 @@
56
56
  "url": "https://github.com/hpcc-systems/Visualization/issues"
57
57
  },
58
58
  "homepage": "https://github.com/hpcc-systems/Visualization",
59
- "gitHead": "492a0c771c204bed123cbe0c16a5c7e1cdaaa7f3"
59
+ "gitHead": "9bb3f0696e2fc406b71a41a02036f5a71c35ae76"
60
60
  }
package/src/Editor.ts CHANGED
@@ -8,6 +8,12 @@ export interface IPosition {
8
8
  ch: number;
9
9
  }
10
10
 
11
+ export interface ICompletion {
12
+ list: string[],
13
+ from: number,
14
+ to: number
15
+ }
16
+
11
17
  export class Editor extends HTMLWidget {
12
18
  private _codemirror: CodeMirror.EditorFromTextArea;
13
19
  private _markedText = [];
@@ -170,8 +176,16 @@ export class Editor extends HTMLWidget {
170
176
 
171
177
  update(domNode, Element) {
172
178
  super.update(domNode, Element);
179
+ const extraKeys = this._codemirror.getOption("extraKeys") ?? {};
180
+ if (this.showHints()) {
181
+ extraKeys["Ctrl-Space"] = "autocomplete";
182
+ } else {
183
+ delete extraKeys["Ctrl-Space"];
184
+ }
173
185
  this._codemirror.setOption("readOnly", this.readOnly());
174
186
  this._codemirror.setOption("gutters", this.guttersOption());
187
+ this._codemirror.setOption("extraKeys", extraKeys);
188
+ this._codemirror.setOption("hintOptions", this.showHints() ? { hint: (cm, option) => this.fetchHints(cm, option) } : {});
175
189
  this._codemirror.setSize(this.width() - 2, this.height() - 2);
176
190
  this._codemirror.refresh();
177
191
  }
@@ -180,6 +194,9 @@ export class Editor extends HTMLWidget {
180
194
  changes(changes: object[]) {
181
195
  }
182
196
 
197
+ fetchHints(cm, option): Promise<ICompletion> {
198
+ return Promise.resolve(null);
199
+ }
183
200
  /**
184
201
  * @deprecated Replaced with `option`
185
202
  */
@@ -196,7 +213,10 @@ export interface Editor {
196
213
  gutterMarkerWidth(_: number): this;
197
214
  markerTextAlign(): string;
198
215
  markerTextAlign(_: string): this;
216
+ showHints(): boolean;
217
+ showHints(_: boolean): this;
199
218
  }
200
219
  Editor.prototype.publish("markerTextAlign", "right", "string", "Gutter marker text alignment", ["left", "center", "right"]);
201
220
  Editor.prototype.publish("readOnly", false, "boolean", "If true, the contents will be uneditable");
202
221
  Editor.prototype.publish("gutterMarkerWidth", 0, "number", "Width of gutter marker column displayed to the left of line numbers (pixels)");
222
+ Editor.prototype.publish("showHints", false, "boolean", "Show autocomplete hints on ctrl+space");
@@ -0,0 +1,22 @@
1
+ import { Editor } from "./Editor";
2
+
3
+ export class SQLEditor extends Editor {
4
+ options(): any {
5
+ return {
6
+ ...super.options(),
7
+ mode: "text/x-pgsql",
8
+ foldGutter: true,
9
+ gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
10
+ };
11
+ }
12
+
13
+ sql(): string;
14
+ sql(_: string): this;
15
+ sql(_?: string): string | this {
16
+ if (!arguments.length) return this.text();
17
+ this.text(_);
18
+ return this;
19
+ }
20
+
21
+ }
22
+ SQLEditor.prototype._class += " codemirror_SQLEditor";
@@ -1,3 +1,3 @@
1
1
  export const PKG_NAME = "@hpcc-js/codemirror";
2
- export const PKG_VERSION = "2.61.4";
3
- export const BUILD_VERSION = "2.105.9";
2
+ export const PKG_VERSION = "2.62.0";
3
+ export const BUILD_VERSION = "2.105.11";
package/src/index.ts CHANGED
@@ -9,3 +9,4 @@ export * from "./JSONEditor";
9
9
  export * from "./MarkdownEditor";
10
10
  export * from "./ObservableMarkdownEditor";
11
11
  export * from "./XMLEditor";
12
+ export * from "./SQLEditor";
package/types/Editor.d.ts CHANGED
@@ -4,6 +4,11 @@ export interface IPosition {
4
4
  line: number;
5
5
  ch: number;
6
6
  }
7
+ export interface ICompletion {
8
+ list: string[];
9
+ from: number;
10
+ to: number;
11
+ }
7
12
  export declare class Editor extends HTMLWidget {
8
13
  private _codemirror;
9
14
  private _markedText;
@@ -33,6 +38,7 @@ export declare class Editor extends HTMLWidget {
33
38
  enter(domNode: any, element: any): void;
34
39
  update(domNode: any, Element: any): void;
35
40
  changes(changes: object[]): void;
41
+ fetchHints(cm: any, option: any): Promise<ICompletion>;
36
42
  /**
37
43
  * @deprecated Replaced with `option`
38
44
  */
@@ -45,5 +51,7 @@ export interface Editor {
45
51
  gutterMarkerWidth(_: number): this;
46
52
  markerTextAlign(): string;
47
53
  markerTextAlign(_: string): this;
54
+ showHints(): boolean;
55
+ showHints(_: boolean): this;
48
56
  }
49
57
  //# sourceMappingURL=Editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Editor.d.ts","sourceRoot":"","sources":["../src/Editor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAW,MAAM,iBAAiB,CAAC;AAEtD,OAAO,mBAAmB,CAAC;AAE3B,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACd;AAED,qBAAa,MAAO,SAAQ,UAAU;IAClC,OAAO,CAAC,WAAW,CAAgC;IACnD,OAAO,CAAC,WAAW,CAAM;IACzB,SAAS,CAAC,YAAY,EAAE,MAAM,CAAM;IAEpC,OAAO,IAAI,GAAG;IASd,OAAO,CAAC,QAAQ,CAAsC;IACtD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAC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,EAAE,MAAM,KAAA,GAAG,OAAO,CAAC,WAAW,CAAC;IAG5C;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI;CAG9C;AAGD,MAAM,WAAW,MAAM;IACnB,QAAQ,IAAI,OAAO,CAAC;IACpB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,iBAAiB,IAAI,MAAM,CAAC;IAC5B,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,eAAe,IAAI,MAAM,CAAC;IAC1B,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,SAAS,IAAI,OAAO,CAAC;IACrB,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B"}
@@ -0,0 +1,7 @@
1
+ import { Editor } from "./Editor";
2
+ export declare class SQLEditor extends Editor {
3
+ options(): any;
4
+ sql(): string;
5
+ sql(_: string): this;
6
+ }
7
+ //# sourceMappingURL=SQLEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SQLEditor.d.ts","sourceRoot":"","sources":["../src/SQLEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,SAAU,SAAQ,MAAM;IACjC,OAAO,IAAI,GAAG;IASd,GAAG,IAAI,MAAM;IACb,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;CAOvB"}
@@ -1,4 +1,4 @@
1
1
  export declare const PKG_NAME = "@hpcc-js/codemirror";
2
- export declare const PKG_VERSION = "2.61.4";
3
- export declare const BUILD_VERSION = "2.105.9";
2
+ export declare const PKG_VERSION = "2.62.0";
3
+ export declare const BUILD_VERSION = "2.105.11";
4
4
  //# sourceMappingURL=__package__.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"__package__.d.ts","sourceRoot":"","sources":["../src/__package__.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,wBAAwB,CAAC;AAC9C,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,aAAa,YAAY,CAAC"}
1
+ {"version":3,"file":"__package__.d.ts","sourceRoot":"","sources":["../src/__package__.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,wBAAwB,CAAC;AAC9C,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,aAAa,aAAa,CAAC"}
package/types/index.d.ts CHANGED
@@ -9,4 +9,5 @@ export * from "./JSONEditor";
9
9
  export * from "./MarkdownEditor";
10
10
  export * from "./ObservableMarkdownEditor";
11
11
  export * from "./XMLEditor";
12
+ export * from "./SQLEditor";
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
@@ -4,6 +4,11 @@ export interface IPosition {
4
4
  line: number;
5
5
  ch: number;
6
6
  }
7
+ export interface ICompletion {
8
+ list: string[];
9
+ from: number;
10
+ to: number;
11
+ }
7
12
  export declare class Editor extends HTMLWidget {
8
13
  private _codemirror;
9
14
  private _markedText;
@@ -33,6 +38,7 @@ export declare class Editor extends HTMLWidget {
33
38
  enter(domNode: any, element: any): void;
34
39
  update(domNode: any, Element: any): void;
35
40
  changes(changes: object[]): void;
41
+ fetchHints(cm: any, option: any): Promise<ICompletion>;
36
42
  /**
37
43
  * @deprecated Replaced with `option`
38
44
  */
@@ -45,5 +51,7 @@ export interface Editor {
45
51
  gutterMarkerWidth(_: number): this;
46
52
  markerTextAlign(): string;
47
53
  markerTextAlign(_: string): this;
54
+ showHints(): boolean;
55
+ showHints(_: boolean): this;
48
56
  }
49
57
  //# sourceMappingURL=Editor.d.ts.map
@@ -0,0 +1,7 @@
1
+ import { Editor } from "./Editor";
2
+ export declare class SQLEditor extends Editor {
3
+ options(): any;
4
+ sql(): string;
5
+ sql(_: string): this;
6
+ }
7
+ //# sourceMappingURL=SQLEditor.d.ts.map
@@ -1,4 +1,4 @@
1
1
  export declare const PKG_NAME = "@hpcc-js/codemirror";
2
- export declare const PKG_VERSION = "2.61.4";
3
- export declare const BUILD_VERSION = "2.105.9";
2
+ export declare const PKG_VERSION = "2.62.0";
3
+ export declare const BUILD_VERSION = "2.105.11";
4
4
  //# sourceMappingURL=__package__.d.ts.map
@@ -9,4 +9,5 @@ export * from "./JSONEditor";
9
9
  export * from "./MarkdownEditor";
10
10
  export * from "./ObservableMarkdownEditor";
11
11
  export * from "./XMLEditor";
12
+ export * from "./SQLEditor";
12
13
  //# sourceMappingURL=index.d.ts.map