From 20beef06518bfa08db60b8c5a06c637dab0f2b92 Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Mon, 27 Apr 2020 18:18:21 +0530 Subject: update to pull from master --- package.json | 3 +++ 1 file changed, 3 insertions(+) (limited to 'package.json') diff --git a/package.json b/package.json index f1b4be520..9c2d4602c 100644 --- a/package.json +++ b/package.json @@ -114,6 +114,7 @@ "@types/react": "^16.9.19", "@types/react-autosuggest": "^9.3.13", "@types/react-color": "^2.17.3", + "@types/react-grid-layout": "^0.17.1", "@types/react-measure": "^2.0.6", "@types/react-table": "^6.8.6", "@types/request": "^2.48.4", @@ -230,10 +231,12 @@ "react-dimensions": "^1.3.1", "react-dom": "^16.12.0", "react-golden-layout": "^1.0.6", + "react-grid-layout": "^0.18.3", "react-image-lightbox-with-rotate": "^5.1.1", "react-jsx-parser": "^1.21.0", "react-measure": "^2.2.4", "react-mosaic": "0.0.20", + "react-resizable": "^1.10.1", "react-simple-dropdown": "^3.2.3", "react-split-pane": "^0.1.89", "react-table": "^6.11.5", -- cgit v1.2.3-70-g09d2 From 21a967e6daba3bf7048028d3ae6d8bd36c325e29 Mon Sep 17 00:00:00 2001 From: usodhi <61431818+usodhi@users.noreply.github.com> Date: Sun, 24 May 2020 10:46:21 +0530 Subject: install --- package-lock.json | 18 +++++++----------- package.json | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'package.json') diff --git a/package-lock.json b/package-lock.json index f1487d1f5..2e70478d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -940,6 +940,7 @@ "version": "0.17.1", "resolved": "https://registry.npmjs.org/@types/react-grid-layout/-/react-grid-layout-0.17.1.tgz", "integrity": "sha512-1ssQjX3X2A89jx94jECJ0Ze2EHFRYlBHjRh2pnlwjJj1WaEijXUNvwKnUzKwgNFnyZ91Pzqu9Z3V7Atzi9ge7A==", + "dev": true, "requires": { "@types/react": "*" } @@ -7975,6 +7976,11 @@ "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" }, + "lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=" + }, "lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", @@ -14015,16 +14021,6 @@ "prop-types": "^15.6.0" } }, - "react-golden-layout": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/react-golden-layout/-/react-golden-layout-1.0.6.tgz", - "integrity": "sha512-KZQ17Bnd+LfyCqe2scVMznrGKTciX3VwoT3y4xn3Qok9hknCvVXZfXe2RSX5zNG7FlLJzWt0VWqy8qZBHpQVuQ==", - "requires": { - "golden-layout": "^1.5.9", - "react": "^16.3.0", - "react-dom": "^16.3.0" - } - }, "react-grid-layout": { "version": "0.18.3", "resolved": "https://registry.npmjs.org/react-grid-layout/-/react-grid-layout-0.18.3.tgz", @@ -18024,4 +18020,4 @@ } } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 146ea0722..f314423ff 100644 --- a/package.json +++ b/package.json @@ -231,4 +231,4 @@ "xoauth2": "^1.2.0", "xregexp": "^4.3.0" } -} \ No newline at end of file +} -- cgit v1.2.3-70-g09d2 From 5f98ef4f693366181879e2907dfd6aa5dbe5da2c Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Mon, 25 May 2020 16:35:03 -0500 Subject: minor bug fixes --- package-lock.json | 2 +- package.json | 2 +- src/client/views/nodes/ScriptingBox.tsx | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'package.json') diff --git a/package-lock.json b/package-lock.json index f675beb94..8b10d91f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17976,4 +17976,4 @@ } } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 8bf1e6b74..ca82d523d 100644 --- a/package.json +++ b/package.json @@ -228,4 +228,4 @@ "xoauth2": "^1.2.0", "xregexp": "^4.3.0" } -} \ No newline at end of file +} diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index 73288eec4..5bcb5f348 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -60,10 +60,10 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent(value) } - set _paramsTypes(value: string[]) { this.dataDoc[this.props.fieldKey + "-paramsTypes"] = new List(value) } - set _paramsValues(value: string[]) { this.dataDoc[this.props.fieldKey + "-paramsValues"] = new List(value) } - set _paramsCollapsed(value: boolean[]) { this.dataDoc[this.props.fieldKey + "-paramsCollapsed"] = new List(value) } + set _paramsNames(value: string[]) { this.dataDoc[this.props.fieldKey + "-paramsNames"] = new List(value); } + set _paramsTypes(value: string[]) { this.dataDoc[this.props.fieldKey + "-paramsTypes"] = new List(value); } + set _paramsValues(value: string[]) { this.dataDoc[this.props.fieldKey + "-paramsValues"] = new List(value); } + set _paramsCollapsed(value: boolean[]) { this.dataDoc[this.props.fieldKey + "-paramsCollapsed"] = new List(value); } stopPropagation = (e: React.SyntheticEvent) => e.stopPropagation(); @@ -116,7 +116,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent Date: Mon, 1 Jun 2020 11:16:07 -0500 Subject: playing around with autosuggest module --- package-lock.json | 31 +- package.json | 12 +- src/client/views/nodes/ScriptingBox.scss | 76 + src/client/views/nodes/ScriptingBox.tsx | 108 +- yarn.lock | 11838 +++++++++++++++++++++++++++++ 5 files changed, 12031 insertions(+), 34 deletions(-) create mode 100644 yarn.lock (limited to 'package.json') diff --git a/package-lock.json b/package-lock.json index 6e7ed611b..aa6caf9cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1165,6 +1165,14 @@ } } }, + "@types/webscopeio__react-textarea-autocomplete": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/@types/webscopeio__react-textarea-autocomplete/-/webscopeio__react-textarea-autocomplete-4.6.1.tgz", + "integrity": "sha512-rdiDMsTbyFJRbC2BYKIgiAFG/SFkaDGYQYfzo3U2T+EjMCE0JZ8IHZ9nZrJ2Tm83Blrj66cnaEc0H3iwwRqQMA==", + "requires": { + "@types/react": "*" + } + }, "@types/xregexp": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/@types/xregexp/-/xregexp-4.3.0.tgz", @@ -1361,6 +1369,15 @@ "@xtuc/long": "4.2.2" } }, + "@webscopeio/react-textarea-autocomplete": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/@webscopeio/react-textarea-autocomplete/-/react-textarea-autocomplete-4.6.3.tgz", + "integrity": "sha512-09aVXwhxIcfpU3Qyx5zxAec73BDE/32BGTWZkXDCB5yZEzU5Qnw++68Lvv/Z/oB+ifqFsG9JOoXf2S0lz6mwcg==", + "requires": { + "custom-event": "^1.0.1", + "textarea-caret": "3.0.2" + } + }, "@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", @@ -4176,6 +4193,11 @@ "array-find-index": "^1.0.1" } }, + "custom-event": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", + "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=" + }, "cyclist": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", @@ -11078,7 +11100,7 @@ "dependencies": { "minimist": { "version": "1.2.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" } } @@ -11288,7 +11310,7 @@ "dependencies": { "safe-buffer": { "version": "5.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" } } @@ -16029,6 +16051,11 @@ } } }, + "textarea-caret": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/textarea-caret/-/textarea-caret-3.0.2.tgz", + "integrity": "sha1-82DEhpmqGr9xhoCkOjGoUGZcLK8=" + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", diff --git a/package.json b/package.json index ca82d523d..ecda98596 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,6 @@ "tsc": "tsc" }, "devDependencies": { - "@types/chai": "^4.2.7", - "@types/mocha": "^5.2.6", - "@types/react-dom": "^16.9.5", - "@types/webpack-dev-middleware": "^2.0.2", - "@types/webpack-hot-middleware": "^2.25.0", "@types/adm-zip": "^0.4.32", "@types/animejs": "^2.0.2", "@types/archiver": "^3.0.0", @@ -30,6 +25,7 @@ "@types/bcrypt-nodejs": "0.0.30", "@types/bluebird": "^3.5.29", "@types/body-parser": "^1.17.1", + "@types/chai": "^4.2.7", "@types/color": "^3.0.1", "@types/connect-flash": "0.0.34", "@types/cookie-parser": "^1.4.2", @@ -46,6 +42,7 @@ "@types/libxmljs": "^0.18.5", "@types/lodash": "^4.14.149", "@types/mobile-detect": "^1.3.4", + "@types/mocha": "^5.2.6", "@types/mongodb": "^3.3.14", "@types/mongoose": "^5.5.43", "@types/node": "^10.17.13", @@ -69,6 +66,7 @@ "@types/react": "^16.9.19", "@types/react-autosuggest": "^9.3.13", "@types/react-color": "^2.17.3", + "@types/react-dom": "^16.9.5", "@types/react-measure": "^2.0.6", "@types/react-table": "^6.8.6", "@types/request": "^2.48.4", @@ -82,6 +80,8 @@ "@types/uuid": "^3.4.6", "@types/valid-url": "^1.0.3", "@types/webpack": "^4.41.3", + "@types/webpack-dev-middleware": "^2.0.2", + "@types/webpack-hot-middleware": "^2.25.0", "@types/xregexp": "^4.3.0", "@types/youtube": "0.0.39", "awesome-typescript-loader": "^5.2.1", @@ -117,6 +117,8 @@ "@hig/flyout": "^1.2.0", "@hig/theme-context": "^2.1.3", "@hig/theme-data": "^2.13.0", + "@types/webscopeio__react-textarea-autocomplete": "^4.6.1", + "@webscopeio/react-textarea-autocomplete": "^4.6.3", "adm-zip": "^0.4.13", "archiver": "^3.1.1", "array-batcher": "^1.2.3", diff --git a/src/client/views/nodes/ScriptingBox.scss b/src/client/views/nodes/ScriptingBox.scss index d369045f4..256119809 100644 --- a/src/client/views/nodes/ScriptingBox.scss +++ b/src/client/views/nodes/ScriptingBox.scss @@ -32,6 +32,82 @@ resize: none; padding: 7px; overflow-y: scroll; + + body { + font-family: Arial, Helvetica, sans-serif; + border: 1px solid red; + } + + .rta { + position: relative; + font-size: 18px; + width: 100%; + height: 100%; + margin-bottom: 60px !important; + } + .rta__loader.rta__loader--empty-suggestion-data { + border-radius: 3px; + box-shadow: 0 0 5px rgba(27, 31, 35, 0.1); + padding: 5px; + } + .rta--loading .rta__loader.rta__loader--suggestion-data { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: rgba(255, 255, 255, 0.8); + } + .rta--loading .rta__loader.rta__loader--suggestion-data > * { + position: relative; + top: 50%; + } + .rta__textarea { + width: 100%; + height: 100%; + font-size: 1em; + } + .rta__autocomplete { + position: absolute; + display: block; + margin-top: 1em; + } + .rta__autocomplete--top { + margin-top: 0; + margin-bottom: 1em; + max-height: 100px; + overflow-y: auto; + } + .rta__list { + margin: 0; + padding: 0; + background: #fff; + border: 1px solid #dfe2e5; + border-radius: 3px; + box-shadow: 0 0 5px rgba(27, 31, 35, 0.1); + list-style: none; + } + .rta__entity { + background: white; + width: 100%; + text-align: left; + outline: none; + } + .rta__entity:hover { + cursor: pointer; + } + .rta__item:not(:last-child) { + border-bottom: 1px solid #dfe2e5; + } + .rta__entity > * { + padding-left: 4px; + padding-right: 4px; + } + .rta__entity--selected { + color: #fff; + text-decoration: none; + background: #0366d6; + } } .scriptingBox-plist { diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index 51d4cb56e..0831d7042 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -18,8 +18,10 @@ import { FieldView, FieldViewProps } from "../nodes/FieldView"; import { OverlayView } from "../OverlayView"; import { DocumentIconContainer } from "./DocumentIcon"; import "./ScriptingBox.scss"; -import Autosuggest from "react-autosuggest"; -import { emptyFunction } from '../../../Utils'; + +import ReactTextareaAutocomplete from "@webscopeio/react-textarea-autocomplete"; +import "@webscopeio/react-textarea-autocomplete/style.css"; + const ScriptingSchema = createSchema({}); type ScriptingDocument = makeInterface<[typeof ScriptingSchema, typeof documentSchema]>; @@ -30,16 +32,15 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent void; @observable private _errorMessage: string = ""; @observable private _applied: boolean = false; - @observable private _suggested: boolean = false; @observable private _scriptKeys: any = Scripting.getGlobals(); - @observable private _scriptingGlobals: any = Scripting.getGlobalObj(); @observable private _currWord: string = ""; - @observable private _suggestions: any[] = []; + @observable private _suggestions: string[] = []; // vars included in fields that store parameters types and names and the script itself @computed get paramsNames() { return this.compileParams.map(p => p.split(":")[0].trim()); } @@ -153,7 +154,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent { + specificContextMenu = (): void => { const existingOptions = ContextMenu.Instance.findByDescription("Options..."); const options = existingOptions && "subitems" in existingOptions ? existingOptions.subitems : []; options.push({ description: "Create a Copy", event: this.onCopy, icon: "copy" }); @@ -166,7 +167,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent this._overlayDisposer?.()} + return
this._overlayDisposer?.()} ref={ele => ele && this.createDashEventsTarget(ele, (e, de) => this.onDrop(e, de, parameter))} > suggestion; - renderSuggestion = (suggestion: string) => { - return (null); + // @action + // handleKeyPress(e: React.ChangeEvent) { + + // this.rawScript = e.target.value; + // this._currWord = e.target.value.split(" ")[e.target.value.split(" ").length - 1]; + // this._suggestions = []; + + // this._scriptKeys.forEach((element: string | string[]) => { + // if (element.indexOf(this._currWord) >= 0) { + // this._suggestions.push(element); + // } + // }); + // console.log(this._suggestions); + // } + + @action + handleKeyPress(num: number) { + + const scriptString = this.rawScript.slice(0, num); + + this._currWord = scriptString.split(" ")[scriptString.split(" ").length - 1]; + this._suggestions = []; + + this._scriptKeys.forEach((element: string) => { + if (element.indexOf(this._currWord) >= 0) { + this._suggestions.push(StrCast(element)); + } + }); + + console.log(this._suggestions); + return (this._suggestions); } @action - handleKeyPress(e: React.ChangeEvent) { + handleToken(str: string) { - this.rawScript = e.target.value; - this._currWord = e.target.value.split(" ")[e.target.value.split(" ").length - 1]; + this._currWord = str; this._suggestions = []; - this._scriptKeys.forEach((element: string | string[]) => { + this._scriptKeys.forEach((element: string) => { if (element.indexOf(this._currWord) >= 0) { - this._suggestions.push(element); + this._suggestions.push(StrCast(element)); } }); + console.log(this._suggestions); + return (this._suggestions); } // inputs for scripting div (script box, params box, and params column) @@ -323,22 +353,46 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent
; + // const scriptText = + //