@neo4j-cypher/react-codemirror 1.0.3 → 2.0.0-next.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/CHANGELOG.md +7 -0
- package/LICENSE.md +201 -0
- package/README.md +26 -27
- package/dist/cjs/index.cjs +1455 -0
- package/dist/cjs/index.cjs.map +7 -0
- package/dist/esm/index.mjs +1468 -0
- package/dist/esm/index.mjs.map +7 -0
- package/dist/types/CypherEditor.d.ts +118 -0
- package/dist/types/e2e_tests/auto-completion.spec.d.ts +1 -0
- package/dist/types/e2e_tests/e2e-utils.d.ts +12 -0
- package/dist/types/e2e_tests/extra-keybindings.spec.d.ts +1 -0
- package/dist/types/e2e_tests/history-navigation.spec.d.ts +1 -0
- package/dist/types/e2e_tests/mock-data.d.ts +3779 -0
- package/dist/types/e2e_tests/performance-test.spec.d.ts +1 -0
- package/dist/types/e2e_tests/sanity-checks.spec.d.ts +1 -0
- package/dist/types/e2e_tests/syntax-highlighting.spec.d.ts +1 -0
- package/dist/types/e2e_tests/syntax-validation.spec.d.ts +1 -0
- package/dist/types/icons.d.ts +2 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/lang-cypher/ParserAdapter.d.ts +14 -0
- package/dist/types/lang-cypher/autocomplete.d.ts +3 -0
- package/dist/types/lang-cypher/constants.d.ts +31 -0
- package/dist/types/lang-cypher/contants.test.d.ts +1 -0
- package/dist/types/lang-cypher/create-cypher-theme.d.ts +26 -0
- package/dist/types/lang-cypher/lang-cypher.d.ts +7 -0
- package/dist/types/lang-cypher/syntax-validation.d.ts +3 -0
- package/dist/types/lang-cypher/theme-icons.d.ts +7 -0
- package/dist/types/ndl-tokens-copy.d.ts +379 -0
- package/dist/types/ndl-tokens-copy.test.d.ts +1 -0
- package/dist/types/neo4j-setup.d.ts +2 -0
- package/dist/types/repl-mode.d.ts +8 -0
- package/dist/types/themes.d.ts +11 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +60 -34
- package/src/CypherEditor.tsx +316 -0
- package/src/e2e_tests/auto-completion.spec.tsx +232 -0
- package/src/e2e_tests/e2e-utils.ts +75 -0
- package/src/e2e_tests/extra-keybindings.spec.tsx +57 -0
- package/src/e2e_tests/history-navigation.spec.tsx +144 -0
- package/src/e2e_tests/mock-data.ts +4310 -0
- package/src/e2e_tests/performance-test.spec.tsx +71 -0
- package/src/e2e_tests/sanity-checks.spec.tsx +87 -0
- package/src/e2e_tests/syntax-highlighting.spec.tsx +198 -0
- package/src/e2e_tests/syntax-validation.spec.tsx +157 -0
- package/src/icons.ts +87 -0
- package/src/index.ts +5 -0
- package/src/lang-cypher/ParserAdapter.ts +92 -0
- package/src/lang-cypher/autocomplete.ts +65 -0
- package/src/lang-cypher/constants.ts +61 -0
- package/src/lang-cypher/contants.test.ts +104 -0
- package/src/lang-cypher/create-cypher-theme.ts +207 -0
- package/src/lang-cypher/lang-cypher.ts +32 -0
- package/src/lang-cypher/syntax-validation.ts +24 -0
- package/src/lang-cypher/theme-icons.ts +27 -0
- package/src/ndl-tokens-copy.test.ts +11 -0
- package/src/ndl-tokens-copy.ts +379 -0
- package/src/neo4j-setup.tsx +129 -0
- package/src/repl-mode.ts +214 -0
- package/src/themes.ts +130 -0
- package/es/CypherEditor.js +0 -262
- package/es/react-codemirror.js +0 -1
- package/lib/CypherEditor.js +0 -272
- package/lib/react-codemirror.js +0 -13
- package/src/CypherEditor.d.ts +0 -310
- package/src/react-codemirror.d.ts +0 -18
package/es/CypherEditor.js
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import React, { Component } from "react";
|
|
3
|
-
import { createCypherEditor, reactiveOptionKeys, defaultOptions } from "@neo4j-cypher/codemirror";
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
class CypherEditor extends Component {
|
|
6
|
-
constructor(props) {
|
|
7
|
-
super(props);
|
|
8
|
-
_defineProperty(this, "setEditorRef", ref => {
|
|
9
|
-
this.editorRef = ref;
|
|
10
|
-
});
|
|
11
|
-
_defineProperty(this, "valueChanged", (value, changes) => {
|
|
12
|
-
this.lastValue = value;
|
|
13
|
-
const {
|
|
14
|
-
onValueChanged
|
|
15
|
-
} = this.props;
|
|
16
|
-
onValueChanged && onValueChanged(value, changes);
|
|
17
|
-
});
|
|
18
|
-
_defineProperty(this, "focusChanged", focused => {
|
|
19
|
-
const {
|
|
20
|
-
onFocusChanged
|
|
21
|
-
} = this.props;
|
|
22
|
-
this.setState({
|
|
23
|
-
focused
|
|
24
|
-
});
|
|
25
|
-
onFocusChanged && onFocusChanged(focused);
|
|
26
|
-
});
|
|
27
|
-
_defineProperty(this, "scrollChanged", scrollInfo => {
|
|
28
|
-
const {
|
|
29
|
-
onScrollChanged
|
|
30
|
-
} = this.props;
|
|
31
|
-
onScrollChanged && onScrollChanged(scrollInfo);
|
|
32
|
-
});
|
|
33
|
-
_defineProperty(this, "positionChanged", positionObject => {
|
|
34
|
-
this.lastPosition = (positionObject || {
|
|
35
|
-
position: null
|
|
36
|
-
}).position;
|
|
37
|
-
const {
|
|
38
|
-
onPositionChanged
|
|
39
|
-
} = this.props;
|
|
40
|
-
onPositionChanged && onPositionChanged(positionObject);
|
|
41
|
-
});
|
|
42
|
-
_defineProperty(this, "selectionChanged", selection => {
|
|
43
|
-
this.lastSelection = selection;
|
|
44
|
-
const {
|
|
45
|
-
onSelectionChanged
|
|
46
|
-
} = this.props;
|
|
47
|
-
onSelectionChanged && onSelectionChanged(selection);
|
|
48
|
-
});
|
|
49
|
-
_defineProperty(this, "autocompleteChanged", (autocompleteOpen, options, option) => {
|
|
50
|
-
const {
|
|
51
|
-
onAutocompleteChanged
|
|
52
|
-
} = this.props;
|
|
53
|
-
onAutocompleteChanged && onAutocompleteChanged(autocompleteOpen, options, option);
|
|
54
|
-
});
|
|
55
|
-
_defineProperty(this, "searchChanged", (searchOpen, text, matches) => {
|
|
56
|
-
const {
|
|
57
|
-
onSearchChanged
|
|
58
|
-
} = this.props;
|
|
59
|
-
onSearchChanged && onSearchChanged(searchOpen, text, matches);
|
|
60
|
-
});
|
|
61
|
-
_defineProperty(this, "lineNumberClick", (line, event) => {
|
|
62
|
-
const {
|
|
63
|
-
onLineNumberClick
|
|
64
|
-
} = this.props;
|
|
65
|
-
onLineNumberClick && onLineNumberClick(line, event);
|
|
66
|
-
});
|
|
67
|
-
_defineProperty(this, "keyDown", event => {
|
|
68
|
-
const {
|
|
69
|
-
onKeyDown
|
|
70
|
-
} = this.props;
|
|
71
|
-
onKeyDown && onKeyDown(event);
|
|
72
|
-
});
|
|
73
|
-
_defineProperty(this, "keyUp", event => {
|
|
74
|
-
const {
|
|
75
|
-
onKeyUp
|
|
76
|
-
} = this.props;
|
|
77
|
-
onKeyUp && onKeyUp(event);
|
|
78
|
-
});
|
|
79
|
-
this.state = {
|
|
80
|
-
focused: false
|
|
81
|
-
};
|
|
82
|
-
this.lastValue = null;
|
|
83
|
-
this.lastPosition = null;
|
|
84
|
-
this.lastSelection = null;
|
|
85
|
-
}
|
|
86
|
-
componentDidMount() {
|
|
87
|
-
const {
|
|
88
|
-
autocomplete,
|
|
89
|
-
autocompleteCloseOnBlur,
|
|
90
|
-
autocompleteOpen,
|
|
91
|
-
autocompleteTriggerStrings,
|
|
92
|
-
autofocus,
|
|
93
|
-
bracketMatching,
|
|
94
|
-
closeBrackets,
|
|
95
|
-
cursorWide,
|
|
96
|
-
cypherLanguage,
|
|
97
|
-
history,
|
|
98
|
-
indentUnit,
|
|
99
|
-
lineNumberFormatter,
|
|
100
|
-
lineNumbers,
|
|
101
|
-
lineWrapping,
|
|
102
|
-
lint,
|
|
103
|
-
placeholder,
|
|
104
|
-
position,
|
|
105
|
-
readOnly,
|
|
106
|
-
readOnlyCursor,
|
|
107
|
-
schema,
|
|
108
|
-
search,
|
|
109
|
-
searchMatches,
|
|
110
|
-
searchOpen,
|
|
111
|
-
searchText,
|
|
112
|
-
searchTop,
|
|
113
|
-
selection,
|
|
114
|
-
tabKey,
|
|
115
|
-
theme,
|
|
116
|
-
tooltipAbsolute,
|
|
117
|
-
parseOnSetValue,
|
|
118
|
-
value,
|
|
119
|
-
onEditorCreated,
|
|
120
|
-
preExtensions,
|
|
121
|
-
postExtensions
|
|
122
|
-
} = this.props;
|
|
123
|
-
this.value = value;
|
|
124
|
-
const {
|
|
125
|
-
editor
|
|
126
|
-
} = createCypherEditor(this.editorRef, {
|
|
127
|
-
autocomplete,
|
|
128
|
-
autocompleteCloseOnBlur,
|
|
129
|
-
autocompleteOpen,
|
|
130
|
-
autocompleteTriggerStrings,
|
|
131
|
-
autofocus,
|
|
132
|
-
bracketMatching,
|
|
133
|
-
closeBrackets,
|
|
134
|
-
cursorWide,
|
|
135
|
-
cypherLanguage,
|
|
136
|
-
history,
|
|
137
|
-
indentUnit,
|
|
138
|
-
lineNumberFormatter,
|
|
139
|
-
lineNumbers,
|
|
140
|
-
lineWrapping,
|
|
141
|
-
lint,
|
|
142
|
-
placeholder,
|
|
143
|
-
position,
|
|
144
|
-
readOnly,
|
|
145
|
-
readOnlyCursor,
|
|
146
|
-
schema,
|
|
147
|
-
search,
|
|
148
|
-
searchMatches,
|
|
149
|
-
searchOpen,
|
|
150
|
-
searchText,
|
|
151
|
-
searchTop,
|
|
152
|
-
selection,
|
|
153
|
-
tabKey,
|
|
154
|
-
theme,
|
|
155
|
-
tooltipAbsolute,
|
|
156
|
-
parseOnSetValue,
|
|
157
|
-
value,
|
|
158
|
-
preExtensions,
|
|
159
|
-
postExtensions
|
|
160
|
-
});
|
|
161
|
-
this.cypherEditor = editor;
|
|
162
|
-
this.cypherEditor.onValueChanged(this.valueChanged);
|
|
163
|
-
this.cypherEditor.onFocusChanged(this.focusChanged);
|
|
164
|
-
this.cypherEditor.onScrollChanged(this.scrollChanged);
|
|
165
|
-
this.cypherEditor.onPositionChanged(this.positionChanged);
|
|
166
|
-
this.cypherEditor.onSelectionChanged(this.selectionChanged);
|
|
167
|
-
this.cypherEditor.onAutocompleteChanged(this.autocompleteChanged);
|
|
168
|
-
this.cypherEditor.onSearchChanged(this.searchChanged);
|
|
169
|
-
this.cypherEditor.onLineNumberClick(this.lineNumberClick);
|
|
170
|
-
this.cypherEditor.onKeyDown(this.keyDown);
|
|
171
|
-
this.cypherEditor.onKeyUp(this.keyUp);
|
|
172
|
-
onEditorCreated && onEditorCreated(this.cypherEditor);
|
|
173
|
-
}
|
|
174
|
-
componentWillUnmount() {
|
|
175
|
-
if (this.cypherEditor) {
|
|
176
|
-
this.cypherEditor.offValueChanged(this.valueChanged);
|
|
177
|
-
this.cypherEditor.offFocusChanged(this.focusChanged);
|
|
178
|
-
this.cypherEditor.offScrollChanged(this.scrollChanged);
|
|
179
|
-
this.cypherEditor.offPositionChanged(this.positionChanged);
|
|
180
|
-
this.cypherEditor.offSelectionChanged(this.selectionChanged);
|
|
181
|
-
this.cypherEditor.offAutocompleteChanged(this.autocompleteChanged);
|
|
182
|
-
this.cypherEditor.offSearchChanged(this.searchChanged);
|
|
183
|
-
this.cypherEditor.offLineNumberClick(this.lineNumberClick);
|
|
184
|
-
this.cypherEditor.offKeyDown(this.keyDown);
|
|
185
|
-
this.cypherEditor.offKeyUp(this.keyUp);
|
|
186
|
-
this.cypherEditor.destroy();
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
componentDidUpdate(prevProps) {
|
|
190
|
-
if (prevProps.value !== this.props.value) {
|
|
191
|
-
this.value = this.props.value;
|
|
192
|
-
}
|
|
193
|
-
for (let key of reactiveOptionKeys) {
|
|
194
|
-
if (prevProps[key] !== this.props[key]) {
|
|
195
|
-
this.updateOption({
|
|
196
|
-
[key]: this.props[key]
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
updateOption(prop) {
|
|
202
|
-
if (!this.cypherEditor) {
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
const key = Object.keys(prop).pop();
|
|
206
|
-
if (key === "value") {
|
|
207
|
-
if (prop[key] === this.lastValue) {
|
|
208
|
-
return;
|
|
209
|
-
} else {
|
|
210
|
-
this.lastValue = prop[key];
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
if (key === "position") {
|
|
214
|
-
const {
|
|
215
|
-
position
|
|
216
|
-
} = this.cypherEditor.getPositionForValue(prop[key]) || {
|
|
217
|
-
position: null
|
|
218
|
-
};
|
|
219
|
-
if (position === this.lastPosition) {
|
|
220
|
-
return;
|
|
221
|
-
} else {
|
|
222
|
-
this.lastPosition = position;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (key === "selection") {
|
|
226
|
-
if (prop[key] === this.lastSelection) {
|
|
227
|
-
return;
|
|
228
|
-
} else {
|
|
229
|
-
this.lastSelection = prop[key];
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
const methodName = "set" + key[0].toUpperCase() + key.slice(1);
|
|
233
|
-
if (this.cypherEditor[methodName]) {
|
|
234
|
-
this.cypherEditor[methodName](prop[key]);
|
|
235
|
-
}
|
|
236
|
-
const autofocusProps = this.props.autofocusProps !== undefined ? this.props.autofocusProps : defaultOptions.autofocusProps;
|
|
237
|
-
if (autofocusProps.includes(key)) {
|
|
238
|
-
this.cypherEditor.focus();
|
|
239
|
-
}
|
|
240
|
-
const clearHistoryProps = this.props.clearHistoryProps !== undefined ? this.props.clearHistoryProps : defaultOptions.clearHistoryProps;
|
|
241
|
-
if (clearHistoryProps.includes(key)) {
|
|
242
|
-
this.cypherEditor.clearHistory();
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
render() {
|
|
246
|
-
const {
|
|
247
|
-
className,
|
|
248
|
-
focusedClassName,
|
|
249
|
-
style
|
|
250
|
-
} = this.props;
|
|
251
|
-
const {
|
|
252
|
-
focused
|
|
253
|
-
} = this.state;
|
|
254
|
-
const editorClassName = (className ? className + " " : "") + (focused && focusedClassName ? focusedClassName : "");
|
|
255
|
-
return /*#__PURE__*/_jsx("div", {
|
|
256
|
-
className: editorClassName,
|
|
257
|
-
style: style,
|
|
258
|
-
ref: this.setEditorRef
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
export default CypherEditor;
|
package/es/react-codemirror.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as CypherEditor } from "./CypherEditor";
|
package/lib/CypherEditor.js
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _codemirror = require("@neo4j-cypher/codemirror");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
class CypherEditor extends _react.Component {
|
|
15
|
-
constructor(props) {
|
|
16
|
-
super(props);
|
|
17
|
-
(0, _defineProperty2.default)(this, "setEditorRef", ref => {
|
|
18
|
-
this.editorRef = ref;
|
|
19
|
-
});
|
|
20
|
-
(0, _defineProperty2.default)(this, "valueChanged", (value, changes) => {
|
|
21
|
-
this.lastValue = value;
|
|
22
|
-
const {
|
|
23
|
-
onValueChanged
|
|
24
|
-
} = this.props;
|
|
25
|
-
onValueChanged && onValueChanged(value, changes);
|
|
26
|
-
});
|
|
27
|
-
(0, _defineProperty2.default)(this, "focusChanged", focused => {
|
|
28
|
-
const {
|
|
29
|
-
onFocusChanged
|
|
30
|
-
} = this.props;
|
|
31
|
-
this.setState({
|
|
32
|
-
focused
|
|
33
|
-
});
|
|
34
|
-
onFocusChanged && onFocusChanged(focused);
|
|
35
|
-
});
|
|
36
|
-
(0, _defineProperty2.default)(this, "scrollChanged", scrollInfo => {
|
|
37
|
-
const {
|
|
38
|
-
onScrollChanged
|
|
39
|
-
} = this.props;
|
|
40
|
-
onScrollChanged && onScrollChanged(scrollInfo);
|
|
41
|
-
});
|
|
42
|
-
(0, _defineProperty2.default)(this, "positionChanged", positionObject => {
|
|
43
|
-
this.lastPosition = (positionObject || {
|
|
44
|
-
position: null
|
|
45
|
-
}).position;
|
|
46
|
-
const {
|
|
47
|
-
onPositionChanged
|
|
48
|
-
} = this.props;
|
|
49
|
-
onPositionChanged && onPositionChanged(positionObject);
|
|
50
|
-
});
|
|
51
|
-
(0, _defineProperty2.default)(this, "selectionChanged", selection => {
|
|
52
|
-
this.lastSelection = selection;
|
|
53
|
-
const {
|
|
54
|
-
onSelectionChanged
|
|
55
|
-
} = this.props;
|
|
56
|
-
onSelectionChanged && onSelectionChanged(selection);
|
|
57
|
-
});
|
|
58
|
-
(0, _defineProperty2.default)(this, "autocompleteChanged", (autocompleteOpen, options, option) => {
|
|
59
|
-
const {
|
|
60
|
-
onAutocompleteChanged
|
|
61
|
-
} = this.props;
|
|
62
|
-
onAutocompleteChanged && onAutocompleteChanged(autocompleteOpen, options, option);
|
|
63
|
-
});
|
|
64
|
-
(0, _defineProperty2.default)(this, "searchChanged", (searchOpen, text, matches) => {
|
|
65
|
-
const {
|
|
66
|
-
onSearchChanged
|
|
67
|
-
} = this.props;
|
|
68
|
-
onSearchChanged && onSearchChanged(searchOpen, text, matches);
|
|
69
|
-
});
|
|
70
|
-
(0, _defineProperty2.default)(this, "lineNumberClick", (line, event) => {
|
|
71
|
-
const {
|
|
72
|
-
onLineNumberClick
|
|
73
|
-
} = this.props;
|
|
74
|
-
onLineNumberClick && onLineNumberClick(line, event);
|
|
75
|
-
});
|
|
76
|
-
(0, _defineProperty2.default)(this, "keyDown", event => {
|
|
77
|
-
const {
|
|
78
|
-
onKeyDown
|
|
79
|
-
} = this.props;
|
|
80
|
-
onKeyDown && onKeyDown(event);
|
|
81
|
-
});
|
|
82
|
-
(0, _defineProperty2.default)(this, "keyUp", event => {
|
|
83
|
-
const {
|
|
84
|
-
onKeyUp
|
|
85
|
-
} = this.props;
|
|
86
|
-
onKeyUp && onKeyUp(event);
|
|
87
|
-
});
|
|
88
|
-
this.state = {
|
|
89
|
-
focused: false
|
|
90
|
-
};
|
|
91
|
-
this.lastValue = null;
|
|
92
|
-
this.lastPosition = null;
|
|
93
|
-
this.lastSelection = null;
|
|
94
|
-
}
|
|
95
|
-
componentDidMount() {
|
|
96
|
-
const {
|
|
97
|
-
autocomplete,
|
|
98
|
-
autocompleteCloseOnBlur,
|
|
99
|
-
autocompleteOpen,
|
|
100
|
-
autocompleteTriggerStrings,
|
|
101
|
-
autofocus,
|
|
102
|
-
bracketMatching,
|
|
103
|
-
closeBrackets,
|
|
104
|
-
cursorWide,
|
|
105
|
-
cypherLanguage,
|
|
106
|
-
history,
|
|
107
|
-
indentUnit,
|
|
108
|
-
lineNumberFormatter,
|
|
109
|
-
lineNumbers,
|
|
110
|
-
lineWrapping,
|
|
111
|
-
lint,
|
|
112
|
-
placeholder,
|
|
113
|
-
position,
|
|
114
|
-
readOnly,
|
|
115
|
-
readOnlyCursor,
|
|
116
|
-
schema,
|
|
117
|
-
search,
|
|
118
|
-
searchMatches,
|
|
119
|
-
searchOpen,
|
|
120
|
-
searchText,
|
|
121
|
-
searchTop,
|
|
122
|
-
selection,
|
|
123
|
-
tabKey,
|
|
124
|
-
theme,
|
|
125
|
-
tooltipAbsolute,
|
|
126
|
-
parseOnSetValue,
|
|
127
|
-
value,
|
|
128
|
-
onEditorCreated,
|
|
129
|
-
preExtensions,
|
|
130
|
-
postExtensions
|
|
131
|
-
} = this.props;
|
|
132
|
-
this.value = value;
|
|
133
|
-
const {
|
|
134
|
-
editor
|
|
135
|
-
} = (0, _codemirror.createCypherEditor)(this.editorRef, {
|
|
136
|
-
autocomplete,
|
|
137
|
-
autocompleteCloseOnBlur,
|
|
138
|
-
autocompleteOpen,
|
|
139
|
-
autocompleteTriggerStrings,
|
|
140
|
-
autofocus,
|
|
141
|
-
bracketMatching,
|
|
142
|
-
closeBrackets,
|
|
143
|
-
cursorWide,
|
|
144
|
-
cypherLanguage,
|
|
145
|
-
history,
|
|
146
|
-
indentUnit,
|
|
147
|
-
lineNumberFormatter,
|
|
148
|
-
lineNumbers,
|
|
149
|
-
lineWrapping,
|
|
150
|
-
lint,
|
|
151
|
-
placeholder,
|
|
152
|
-
position,
|
|
153
|
-
readOnly,
|
|
154
|
-
readOnlyCursor,
|
|
155
|
-
schema,
|
|
156
|
-
search,
|
|
157
|
-
searchMatches,
|
|
158
|
-
searchOpen,
|
|
159
|
-
searchText,
|
|
160
|
-
searchTop,
|
|
161
|
-
selection,
|
|
162
|
-
tabKey,
|
|
163
|
-
theme,
|
|
164
|
-
tooltipAbsolute,
|
|
165
|
-
parseOnSetValue,
|
|
166
|
-
value,
|
|
167
|
-
preExtensions,
|
|
168
|
-
postExtensions
|
|
169
|
-
});
|
|
170
|
-
this.cypherEditor = editor;
|
|
171
|
-
this.cypherEditor.onValueChanged(this.valueChanged);
|
|
172
|
-
this.cypherEditor.onFocusChanged(this.focusChanged);
|
|
173
|
-
this.cypherEditor.onScrollChanged(this.scrollChanged);
|
|
174
|
-
this.cypherEditor.onPositionChanged(this.positionChanged);
|
|
175
|
-
this.cypherEditor.onSelectionChanged(this.selectionChanged);
|
|
176
|
-
this.cypherEditor.onAutocompleteChanged(this.autocompleteChanged);
|
|
177
|
-
this.cypherEditor.onSearchChanged(this.searchChanged);
|
|
178
|
-
this.cypherEditor.onLineNumberClick(this.lineNumberClick);
|
|
179
|
-
this.cypherEditor.onKeyDown(this.keyDown);
|
|
180
|
-
this.cypherEditor.onKeyUp(this.keyUp);
|
|
181
|
-
onEditorCreated && onEditorCreated(this.cypherEditor);
|
|
182
|
-
}
|
|
183
|
-
componentWillUnmount() {
|
|
184
|
-
if (this.cypherEditor) {
|
|
185
|
-
this.cypherEditor.offValueChanged(this.valueChanged);
|
|
186
|
-
this.cypherEditor.offFocusChanged(this.focusChanged);
|
|
187
|
-
this.cypherEditor.offScrollChanged(this.scrollChanged);
|
|
188
|
-
this.cypherEditor.offPositionChanged(this.positionChanged);
|
|
189
|
-
this.cypherEditor.offSelectionChanged(this.selectionChanged);
|
|
190
|
-
this.cypherEditor.offAutocompleteChanged(this.autocompleteChanged);
|
|
191
|
-
this.cypherEditor.offSearchChanged(this.searchChanged);
|
|
192
|
-
this.cypherEditor.offLineNumberClick(this.lineNumberClick);
|
|
193
|
-
this.cypherEditor.offKeyDown(this.keyDown);
|
|
194
|
-
this.cypherEditor.offKeyUp(this.keyUp);
|
|
195
|
-
this.cypherEditor.destroy();
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
componentDidUpdate(prevProps) {
|
|
199
|
-
if (prevProps.value !== this.props.value) {
|
|
200
|
-
this.value = this.props.value;
|
|
201
|
-
}
|
|
202
|
-
for (let key of _codemirror.reactiveOptionKeys) {
|
|
203
|
-
if (prevProps[key] !== this.props[key]) {
|
|
204
|
-
this.updateOption({
|
|
205
|
-
[key]: this.props[key]
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
updateOption(prop) {
|
|
211
|
-
if (!this.cypherEditor) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
const key = Object.keys(prop).pop();
|
|
215
|
-
if (key === "value") {
|
|
216
|
-
if (prop[key] === this.lastValue) {
|
|
217
|
-
return;
|
|
218
|
-
} else {
|
|
219
|
-
this.lastValue = prop[key];
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
if (key === "position") {
|
|
223
|
-
const {
|
|
224
|
-
position
|
|
225
|
-
} = this.cypherEditor.getPositionForValue(prop[key]) || {
|
|
226
|
-
position: null
|
|
227
|
-
};
|
|
228
|
-
if (position === this.lastPosition) {
|
|
229
|
-
return;
|
|
230
|
-
} else {
|
|
231
|
-
this.lastPosition = position;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
if (key === "selection") {
|
|
235
|
-
if (prop[key] === this.lastSelection) {
|
|
236
|
-
return;
|
|
237
|
-
} else {
|
|
238
|
-
this.lastSelection = prop[key];
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
const methodName = "set" + key[0].toUpperCase() + key.slice(1);
|
|
242
|
-
if (this.cypherEditor[methodName]) {
|
|
243
|
-
this.cypherEditor[methodName](prop[key]);
|
|
244
|
-
}
|
|
245
|
-
const autofocusProps = this.props.autofocusProps !== undefined ? this.props.autofocusProps : _codemirror.defaultOptions.autofocusProps;
|
|
246
|
-
if (autofocusProps.includes(key)) {
|
|
247
|
-
this.cypherEditor.focus();
|
|
248
|
-
}
|
|
249
|
-
const clearHistoryProps = this.props.clearHistoryProps !== undefined ? this.props.clearHistoryProps : _codemirror.defaultOptions.clearHistoryProps;
|
|
250
|
-
if (clearHistoryProps.includes(key)) {
|
|
251
|
-
this.cypherEditor.clearHistory();
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
render() {
|
|
255
|
-
const {
|
|
256
|
-
className,
|
|
257
|
-
focusedClassName,
|
|
258
|
-
style
|
|
259
|
-
} = this.props;
|
|
260
|
-
const {
|
|
261
|
-
focused
|
|
262
|
-
} = this.state;
|
|
263
|
-
const editorClassName = (className ? className + " " : "") + (focused && focusedClassName ? focusedClassName : "");
|
|
264
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
265
|
-
className: editorClassName,
|
|
266
|
-
style: style,
|
|
267
|
-
ref: this.setEditorRef
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
var _default = CypherEditor;
|
|
272
|
-
exports.default = _default;
|
package/lib/react-codemirror.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
Object.defineProperty(exports, "CypherEditor", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _CypherEditor.default;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _CypherEditor = _interopRequireDefault(require("./CypherEditor"));
|