@elliemae/ds-codeeditor 2.2.0-alpha.4 → 3.0.0-next.2
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/cjs/DSCodeEditor.js +116 -120
- package/cjs/components/DSCodeEditorForm.js +109 -86
- package/cjs/components/DSCodeEditorImpl.js +52 -62
- package/cjs/index.js +10 -36
- package/esm/DSCodeEditor.js +103 -89
- package/esm/components/DSCodeEditorForm.js +101 -56
- package/esm/components/DSCodeEditorImpl.js +42 -32
- package/esm/index.js +1 -7
- package/package.json +6 -6
- package/cjs/DSCodeEditor.js.map +0 -7
- package/cjs/components/DSCodeEditorForm.js.map +0 -7
- package/cjs/components/DSCodeEditorImpl.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/esm/DSCodeEditor.js.map +0 -7
- package/esm/components/DSCodeEditorForm.js.map +0 -7
- package/esm/components/DSCodeEditorImpl.js.map +0 -7
- package/esm/index.js.map +0 -7
|
@@ -1,50 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var DSCodeEditorImpl_exports = {};
|
|
29
|
-
__export(DSCodeEditorImpl_exports, {
|
|
30
|
-
default: () => DSCodeEditorImpl_default
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_react = __toESM(require("react"));
|
|
34
|
-
var import_react_ace = __toESM(require("react-ace"));
|
|
35
|
-
var import_ds_modal = __toESM(require("@elliemae/ds-modal"));
|
|
36
|
-
var import_DSCodeEditorForm = __toESM(require("./DSCodeEditorForm"));
|
|
37
|
-
var import_javascript = require("brace/mode/javascript.js");
|
|
38
|
-
var import_tomorrow = require("brace/theme/tomorrow.js");
|
|
39
|
-
class DSCodeEditorImpl extends import_react.Component {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var AceEditor = require('react-ace');
|
|
6
|
+
var DSModal = require('@elliemae/ds-modal');
|
|
7
|
+
var DSCodeEditorForm = require('./DSCodeEditorForm.js');
|
|
8
|
+
require('brace/mode/javascript.js');
|
|
9
|
+
require('brace/theme/tomorrow.js');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
16
|
+
var AceEditor__default = /*#__PURE__*/_interopDefaultLegacy(AceEditor);
|
|
17
|
+
var DSModal__default = /*#__PURE__*/_interopDefaultLegacy(DSModal);
|
|
18
|
+
|
|
19
|
+
class DSCodeEditorImpl extends React.Component {
|
|
40
20
|
constructor(props) {
|
|
41
21
|
super(props);
|
|
42
22
|
this.state = {
|
|
43
23
|
value: props.value,
|
|
44
24
|
errors: []
|
|
45
25
|
};
|
|
46
|
-
this.reactAceComponent =
|
|
26
|
+
this.reactAceComponent = /*#__PURE__*/React__default["default"].createRef();
|
|
47
27
|
}
|
|
28
|
+
|
|
48
29
|
render() {
|
|
49
30
|
const {
|
|
50
31
|
onSave,
|
|
@@ -62,37 +43,46 @@ class DSCodeEditorImpl extends import_react.Component {
|
|
|
62
43
|
style,
|
|
63
44
|
containerProps
|
|
64
45
|
} = this.props;
|
|
65
|
-
const {
|
|
66
|
-
|
|
46
|
+
const {
|
|
47
|
+
value,
|
|
48
|
+
errors
|
|
49
|
+
} = this.state;
|
|
50
|
+
return /*#__PURE__*/_jsx__default["default"](DSModal__default["default"], {
|
|
67
51
|
centered: false,
|
|
68
|
-
confirmLabel,
|
|
69
|
-
containerProps,
|
|
70
|
-
isOpen,
|
|
71
|
-
modalTitle,
|
|
72
|
-
modalType,
|
|
52
|
+
confirmLabel: confirmLabel,
|
|
53
|
+
containerProps: containerProps,
|
|
54
|
+
isOpen: isOpen,
|
|
55
|
+
modalTitle: modalTitle,
|
|
56
|
+
modalType: modalType,
|
|
73
57
|
onClose: () => onClose(value, fileName, errors),
|
|
74
58
|
onConfirm: () => onSave(value, fileName, errors),
|
|
75
59
|
onReject: () => onReject(value, fileName, errors),
|
|
76
|
-
rejectLabel,
|
|
77
|
-
size,
|
|
78
|
-
style
|
|
79
|
-
},
|
|
80
|
-
fileName,
|
|
60
|
+
rejectLabel: rejectLabel,
|
|
61
|
+
size: size,
|
|
62
|
+
style: style
|
|
63
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](DSCodeEditorForm, {
|
|
64
|
+
fileName: fileName,
|
|
81
65
|
reactAceComponent: this.reactAceComponent
|
|
82
|
-
}),
|
|
66
|
+
}), /*#__PURE__*/jsxRuntime.jsx(AceEditor__default["default"], {
|
|
83
67
|
ref: this.reactAceComponent,
|
|
84
|
-
editorProps: {
|
|
85
|
-
|
|
86
|
-
|
|
68
|
+
editorProps: {
|
|
69
|
+
$blockScrolling: true
|
|
70
|
+
},
|
|
71
|
+
maxLines: maxLines,
|
|
72
|
+
minLines: minLines,
|
|
87
73
|
mode: "javascript",
|
|
88
74
|
name: "ace-code-edior",
|
|
89
|
-
onChange:
|
|
90
|
-
|
|
75
|
+
onChange: val => this.setState({
|
|
76
|
+
value: val
|
|
77
|
+
}),
|
|
78
|
+
onValidate: annotations => this.setState({
|
|
79
|
+
errors: annotations
|
|
80
|
+
}),
|
|
91
81
|
theme: "tomorrow",
|
|
92
|
-
value
|
|
82
|
+
value: value
|
|
93
83
|
}));
|
|
94
84
|
}
|
|
85
|
+
|
|
95
86
|
}
|
|
96
|
-
|
|
97
|
-
module.exports =
|
|
98
|
-
//# sourceMappingURL=DSCodeEditorImpl.js.map
|
|
87
|
+
|
|
88
|
+
module.exports = DSCodeEditorImpl;
|
package/cjs/index.js
CHANGED
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
CodeEditorWithSchema: () => import_DSCodeEditor.CodeEditorWithSchema,
|
|
31
|
-
default: () => import_DSCodeEditor.default
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_DSCodeEditor = require("./DSCodeEditor");
|
|
35
|
-
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var DSCodeEditor = require('./DSCodeEditor.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.CodeEditorWithSchema = DSCodeEditor.CodeEditorWithSchema;
|
|
10
|
+
exports["default"] = DSCodeEditor["default"];
|
package/esm/DSCodeEditor.js
CHANGED
|
@@ -1,102 +1,116 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import { useState, useRef } from 'react';
|
|
4
|
+
import { PropTypes, describe } from 'react-desc';
|
|
5
|
+
import DSModal, { modalTypes } from '@elliemae/ds-modal';
|
|
6
|
+
import AceEditor from 'react-ace';
|
|
7
|
+
import DSCodeEditorForm from './components/DSCodeEditorForm.js';
|
|
8
|
+
import 'brace/mode/javascript.js';
|
|
9
|
+
import 'brace/theme/tomorrow.js';
|
|
10
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
11
|
+
|
|
12
|
+
const DSCodeEditor = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
containerProps = {},
|
|
15
|
+
value: defaultValue = '',
|
|
16
|
+
onSave = () => null,
|
|
17
|
+
onClose = () => null,
|
|
18
|
+
onReject = () => null,
|
|
19
|
+
onChange = () => null,
|
|
20
|
+
isOpen = false,
|
|
21
|
+
fileName = '',
|
|
22
|
+
confirmLabel = 'Save',
|
|
23
|
+
maxLines = 20,
|
|
24
|
+
minLines = 20,
|
|
25
|
+
modalTitle = 'Javascript Editor',
|
|
26
|
+
modalType = 'confirm',
|
|
27
|
+
rejectLabel = 'Close',
|
|
28
|
+
size = 'large',
|
|
29
|
+
style = {},
|
|
30
|
+
useModal = true,
|
|
31
|
+
showHeader = true,
|
|
32
|
+
showSyntaxChecks = true
|
|
33
|
+
} = _ref;
|
|
34
|
+
const [{
|
|
35
|
+
value,
|
|
36
|
+
errors
|
|
37
|
+
}, setState] = useState({
|
|
31
38
|
value: defaultValue,
|
|
32
39
|
errors: []
|
|
33
40
|
});
|
|
34
41
|
const reactAceComponent = useRef();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
42
|
+
|
|
43
|
+
const editor = /*#__PURE__*/jsxs(Fragment, {
|
|
44
|
+
children: [showHeader && /*#__PURE__*/_jsx(DSCodeEditorForm, {
|
|
45
|
+
fileName: fileName,
|
|
46
|
+
reactAceComponent: reactAceComponent
|
|
47
|
+
}), /*#__PURE__*/jsx(AceEditor, {
|
|
48
|
+
ref: reactAceComponent,
|
|
49
|
+
editorProps: {
|
|
50
|
+
$blockScrolling: true
|
|
51
|
+
},
|
|
52
|
+
maxLines: maxLines,
|
|
53
|
+
minLines: minLines,
|
|
54
|
+
mode: "javascript",
|
|
55
|
+
name: "ace-code-edior",
|
|
56
|
+
onChange: val => {
|
|
57
|
+
setState({
|
|
58
|
+
errors,
|
|
59
|
+
value: val
|
|
60
|
+
});
|
|
61
|
+
onChange(val, errors);
|
|
62
|
+
},
|
|
63
|
+
onValidate: annotations => setState({
|
|
64
|
+
value,
|
|
65
|
+
errors: annotations
|
|
66
|
+
}),
|
|
67
|
+
theme: "tomorrow",
|
|
68
|
+
setOptions: {
|
|
69
|
+
useWorker: showSyntaxChecks
|
|
70
|
+
},
|
|
71
|
+
value: value
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (!useModal) return editor;
|
|
76
|
+
return /*#__PURE__*/_jsx(DSModal, {
|
|
59
77
|
centered: false,
|
|
60
|
-
confirmLabel,
|
|
61
|
-
containerProps,
|
|
62
|
-
isOpen,
|
|
63
|
-
modalTitle,
|
|
64
|
-
modalType,
|
|
78
|
+
confirmLabel: confirmLabel,
|
|
79
|
+
containerProps: containerProps,
|
|
80
|
+
isOpen: isOpen,
|
|
81
|
+
modalTitle: modalTitle,
|
|
82
|
+
modalType: modalType,
|
|
65
83
|
onClose: () => onClose(value, fileName, errors),
|
|
66
84
|
onConfirm: () => onSave(value, fileName, errors),
|
|
67
85
|
onReject: () => onReject(value, fileName, errors),
|
|
68
|
-
rejectLabel,
|
|
69
|
-
size,
|
|
70
|
-
style
|
|
71
|
-
}, editor);
|
|
86
|
+
rejectLabel: rejectLabel,
|
|
87
|
+
size: size,
|
|
88
|
+
style: style
|
|
89
|
+
}, void 0, editor);
|
|
72
90
|
};
|
|
91
|
+
|
|
73
92
|
const codeEditorProps = {
|
|
74
|
-
containerProps: PropTypes.object.description(
|
|
75
|
-
value: PropTypes.string.description(
|
|
76
|
-
onSave: PropTypes.func.description(
|
|
77
|
-
onClose: PropTypes.func.description(
|
|
78
|
-
onReject: PropTypes.func.description(
|
|
79
|
-
onChange: PropTypes.func.description(
|
|
80
|
-
isOpen: PropTypes.bool.description(
|
|
81
|
-
fileName: PropTypes.string.description(
|
|
82
|
-
maxLines: PropTypes.number.description(
|
|
83
|
-
minLines: PropTypes.number.description(
|
|
84
|
-
modalTitle: PropTypes.string.description(
|
|
85
|
-
confirmLabel: PropTypes.string.description(
|
|
86
|
-
rejectLabel: PropTypes.string.description(
|
|
87
|
-
modalType: PropTypes.oneOf(modalTypes).description(
|
|
88
|
-
size: PropTypes.oneOf([
|
|
89
|
-
style: PropTypes.object.description(
|
|
90
|
-
useModal: PropTypes.bool.description(
|
|
91
|
-
showHeader: PropTypes.bool.description(
|
|
92
|
-
showSyntaxChecks: PropTypes.bool.description(
|
|
93
|
+
containerProps: PropTypes.object.description('Set of Properties attached to the main container'),
|
|
94
|
+
value: PropTypes.string.description('editors content').isRequired,
|
|
95
|
+
onSave: PropTypes.func.description('function called when the user press save'),
|
|
96
|
+
onClose: PropTypes.func.description('function called when the user closes the modal'),
|
|
97
|
+
onReject: PropTypes.func.description('function called when is rejected'),
|
|
98
|
+
onChange: PropTypes.func.description('function executed when code editor value changes').isRequired,
|
|
99
|
+
isOpen: PropTypes.bool.description('Whether the modal is opened or not').defaultValue(false),
|
|
100
|
+
fileName: PropTypes.string.description('File name to open in the editor'),
|
|
101
|
+
maxLines: PropTypes.number.description('Max lines in the editor content').defaultValue(20),
|
|
102
|
+
minLines: PropTypes.number.description('Min lines in the editor content').defaultValue(20),
|
|
103
|
+
modalTitle: PropTypes.string.description('Modal title').defaultValue('Javascript Editor'),
|
|
104
|
+
confirmLabel: PropTypes.string.description('Customize modal confirm label').defaultValue('Save'),
|
|
105
|
+
rejectLabel: PropTypes.string.description('Customize modal rejection label').defaultValue('Close'),
|
|
106
|
+
modalType: PropTypes.oneOf(modalTypes).description('Modal type').defaultValue('confirm'),
|
|
107
|
+
size: PropTypes.oneOf(['xsmall', 'small', 'medium', 'large', 'xlarge']).description('modal size').defaultValue('large'),
|
|
108
|
+
style: PropTypes.object.description('css inline style'),
|
|
109
|
+
useModal: PropTypes.bool.description('whether to use code editor inside modal or not').defaultValue(true),
|
|
110
|
+
showHeader: PropTypes.bool.description('show editors header').defaultValue(true),
|
|
111
|
+
showSyntaxChecks: PropTypes.bool.description('show syntax warnings and checks').defaultValue(true)
|
|
93
112
|
};
|
|
94
|
-
DSCodeEditor.propTypes = codeEditorProps;
|
|
95
113
|
const CodeEditorWithSchema = describe(DSCodeEditor);
|
|
96
114
|
CodeEditorWithSchema.propTypes = codeEditorProps;
|
|
97
|
-
|
|
98
|
-
export {
|
|
99
|
-
CodeEditorWithSchema,
|
|
100
|
-
DSCodeEditor_default as default
|
|
101
|
-
};
|
|
102
|
-
//# sourceMappingURL=DSCodeEditor.js.map
|
|
115
|
+
|
|
116
|
+
export { CodeEditorWithSchema, DSCodeEditor as default };
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.find.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.find.js';
|
|
5
|
+
import 'core-js/modules/es.string.replace.js';
|
|
6
|
+
import 'core-js/modules/es.string.replace-all.js';
|
|
7
|
+
import { Component } from 'react';
|
|
8
|
+
import DSButton from '@elliemae/ds-button';
|
|
9
|
+
import { DSInputGroup, DSTextBox, DSCheckbox } from '@elliemae/ds-form';
|
|
10
|
+
import { convertPropToCssClassName, aggregatedClasses } from '@elliemae/ds-classnames';
|
|
11
|
+
import { ChevronSmallLeft, ChevronSmallRight } from '@elliemae/ds-icons';
|
|
12
|
+
|
|
13
|
+
var _DSButton, _ChevronSmallRight;
|
|
14
|
+
const blockName = 'code-editor';
|
|
15
|
+
const {
|
|
16
|
+
cssClassName,
|
|
17
|
+
classNameBlock
|
|
18
|
+
} = convertPropToCssClassName(blockName);
|
|
19
|
+
const CheckOptionsGroup = aggregatedClasses('div')("".concat(blockName, "-options-group"));
|
|
20
|
+
|
|
10
21
|
class DSCodeEditorForm extends Component {
|
|
11
22
|
constructor(props) {
|
|
12
23
|
super(props);
|
|
@@ -15,17 +26,25 @@ class DSCodeEditorForm extends Component {
|
|
|
15
26
|
replace: false,
|
|
16
27
|
isCaseSensitive: false,
|
|
17
28
|
isWholeWord: false,
|
|
18
|
-
filteredText:
|
|
19
|
-
replaceText:
|
|
29
|
+
filteredText: '',
|
|
30
|
+
replaceText: ''
|
|
20
31
|
};
|
|
21
32
|
}
|
|
33
|
+
|
|
22
34
|
searchWord(isReplace, all) {
|
|
23
35
|
const {
|
|
24
36
|
reactAceComponent: {
|
|
25
|
-
current: {
|
|
37
|
+
current: {
|
|
38
|
+
editor
|
|
39
|
+
}
|
|
26
40
|
}
|
|
27
41
|
} = this.props;
|
|
28
|
-
const {
|
|
42
|
+
const {
|
|
43
|
+
isCaseSensitive,
|
|
44
|
+
isWholeWord,
|
|
45
|
+
filteredText,
|
|
46
|
+
replaceText
|
|
47
|
+
} = this.state;
|
|
29
48
|
const options = {
|
|
30
49
|
backwards: false,
|
|
31
50
|
wrap: true,
|
|
@@ -35,6 +54,7 @@ class DSCodeEditorForm extends Component {
|
|
|
35
54
|
};
|
|
36
55
|
editor.find(filteredText, options);
|
|
37
56
|
const selectedContent = editor.getSelectedText();
|
|
57
|
+
|
|
38
58
|
if (isReplace && replaceText && selectedContent) {
|
|
39
59
|
if (all) {
|
|
40
60
|
editor.findAll(filteredText, options);
|
|
@@ -45,93 +65,118 @@ class DSCodeEditorForm extends Component {
|
|
|
45
65
|
}
|
|
46
66
|
}
|
|
47
67
|
}
|
|
68
|
+
|
|
48
69
|
render() {
|
|
49
|
-
const {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
const {
|
|
71
|
+
fileName
|
|
72
|
+
} = this.props;
|
|
73
|
+
const {
|
|
74
|
+
find,
|
|
75
|
+
replace,
|
|
76
|
+
isCaseSensitive,
|
|
77
|
+
isWholeWord,
|
|
78
|
+
filteredText,
|
|
79
|
+
replaceText
|
|
80
|
+
} = this.state;
|
|
81
|
+
return /*#__PURE__*/_jsx("div", {
|
|
82
|
+
className: "".concat(cssClassName)
|
|
83
|
+
}, void 0, fileName ? /*#__PURE__*/_jsx("div", {
|
|
84
|
+
className: classNameBlock('file-name')
|
|
85
|
+
}, void 0, "File Name: ", /*#__PURE__*/_jsx("span", {}, void 0, " ", fileName, " ")) : null, /*#__PURE__*/_jsx("div", {
|
|
86
|
+
className: classNameBlock('find-replace-btn')
|
|
87
|
+
}, void 0, !find && !replace ? /*#__PURE__*/_jsx(DSButton, {
|
|
58
88
|
buttonType: "secondary",
|
|
59
89
|
labelText: "Find",
|
|
60
|
-
onClick: () => this.setState({
|
|
90
|
+
onClick: () => this.setState({
|
|
91
|
+
find: true
|
|
92
|
+
}),
|
|
61
93
|
size: "m"
|
|
62
|
-
}) : null, !replace ?
|
|
94
|
+
}) : null, !replace ? /*#__PURE__*/_jsx(DSButton, {
|
|
63
95
|
buttonType: "secondary",
|
|
64
96
|
labelText: "Find & Replace",
|
|
65
|
-
onClick: () => this.setState({
|
|
97
|
+
onClick: () => this.setState({
|
|
98
|
+
replace: true
|
|
99
|
+
}),
|
|
66
100
|
size: "m"
|
|
67
|
-
}) : null), find || replace ?
|
|
68
|
-
className: classNameBlock(
|
|
69
|
-
},
|
|
101
|
+
}) : null), find || replace ? /*#__PURE__*/_jsx(DSInputGroup, {
|
|
102
|
+
className: classNameBlock('find')
|
|
103
|
+
}, void 0, /*#__PURE__*/_jsx(DSTextBox, {
|
|
70
104
|
className: "find-word",
|
|
71
105
|
fluidWidth: false,
|
|
72
106
|
id: "find-textbox",
|
|
73
|
-
onChange:
|
|
107
|
+
onChange: e => this.setState({
|
|
108
|
+
filteredText: e.currentTarget.value
|
|
109
|
+
}),
|
|
74
110
|
placeholder: "Find",
|
|
75
|
-
rightComponent:
|
|
76
|
-
className: classNameBlock(
|
|
77
|
-
},
|
|
78
|
-
icon:
|
|
111
|
+
rightComponent: /*#__PURE__*/_jsx("div", {
|
|
112
|
+
className: classNameBlock('next-back-btn')
|
|
113
|
+
}, void 0, _DSButton || (_DSButton = /*#__PURE__*/_jsx(DSButton, {
|
|
114
|
+
icon: /*#__PURE__*/_jsx(ChevronSmallLeft, {}),
|
|
79
115
|
size: "m"
|
|
80
|
-
}),
|
|
81
|
-
icon:
|
|
116
|
+
})), /*#__PURE__*/_jsx(DSButton, {
|
|
117
|
+
icon: _ChevronSmallRight || (_ChevronSmallRight = /*#__PURE__*/_jsx(ChevronSmallRight, {})),
|
|
82
118
|
onClick: () => this.searchWord(),
|
|
83
119
|
size: "m"
|
|
84
120
|
})),
|
|
85
121
|
value: filteredText
|
|
86
|
-
}),
|
|
122
|
+
}), /*#__PURE__*/_jsx(CheckOptionsGroup, {}, void 0, /*#__PURE__*/_jsx(DSCheckbox, {
|
|
87
123
|
checked: isCaseSensitive,
|
|
88
124
|
id: "case-sensitive-check",
|
|
89
125
|
labelText: "Case Sensitive",
|
|
90
126
|
name: "case-sensitive-check",
|
|
91
|
-
onChange: () => this.setState({
|
|
92
|
-
|
|
127
|
+
onChange: () => this.setState({
|
|
128
|
+
isCaseSensitive: !isCaseSensitive
|
|
129
|
+
})
|
|
130
|
+
}), /*#__PURE__*/_jsx(DSCheckbox, {
|
|
93
131
|
checked: isWholeWord,
|
|
94
132
|
id: "whole-word-check",
|
|
95
133
|
labelText: "Whole Word",
|
|
96
134
|
name: "whole-word-check",
|
|
97
|
-
onChange: () => this.setState({
|
|
98
|
-
|
|
135
|
+
onChange: () => this.setState({
|
|
136
|
+
isWholeWord: !isWholeWord
|
|
137
|
+
})
|
|
138
|
+
}), /*#__PURE__*/_jsx(DSCheckbox, {
|
|
99
139
|
checked: replace,
|
|
100
140
|
id: "replace-check",
|
|
101
141
|
labelText: "Replace",
|
|
102
142
|
name: "replace-check",
|
|
103
|
-
onChange: () => this.setState({
|
|
104
|
-
|
|
143
|
+
onChange: () => this.setState({
|
|
144
|
+
replace: !replace
|
|
145
|
+
})
|
|
146
|
+
})), /*#__PURE__*/_jsx(DSButton, {
|
|
105
147
|
buttonType: "secondary",
|
|
106
148
|
labelText: "Done",
|
|
107
|
-
onClick: () => this.setState({
|
|
149
|
+
onClick: () => this.setState({
|
|
150
|
+
replace: false,
|
|
151
|
+
find: false
|
|
152
|
+
}),
|
|
108
153
|
size: "m"
|
|
109
|
-
})) : null, replace ?
|
|
110
|
-
className: classNameBlock(
|
|
111
|
-
},
|
|
154
|
+
})) : null, replace ? /*#__PURE__*/_jsx("div", {
|
|
155
|
+
className: classNameBlock('replace')
|
|
156
|
+
}, void 0, /*#__PURE__*/_jsx(DSTextBox, {
|
|
112
157
|
className: "find-word",
|
|
113
158
|
fluidWidth: false,
|
|
114
159
|
id: "replace-textbox",
|
|
115
|
-
onChange:
|
|
160
|
+
onChange: e => this.setState({
|
|
161
|
+
replaceText: e.currentTarget.value
|
|
162
|
+
}),
|
|
116
163
|
placeholder: "Replace",
|
|
117
164
|
value: replaceText
|
|
118
|
-
}),
|
|
119
|
-
className: classNameBlock(
|
|
120
|
-
},
|
|
165
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
166
|
+
className: classNameBlock('replace-btns')
|
|
167
|
+
}, void 0, /*#__PURE__*/_jsx(DSButton, {
|
|
121
168
|
buttonType: "secondary",
|
|
122
169
|
labelText: "Replace",
|
|
123
170
|
onClick: () => this.searchWord(true, false),
|
|
124
171
|
size: "m"
|
|
125
|
-
}),
|
|
172
|
+
}), /*#__PURE__*/_jsx(DSButton, {
|
|
126
173
|
buttonType: "secondary",
|
|
127
174
|
labelText: "Replace All",
|
|
128
175
|
onClick: () => this.searchWord(true, true),
|
|
129
176
|
size: "m"
|
|
130
177
|
}))) : null);
|
|
131
178
|
}
|
|
179
|
+
|
|
132
180
|
}
|
|
133
|
-
|
|
134
|
-
export {
|
|
135
|
-
DSCodeEditorForm_default as default
|
|
136
|
-
};
|
|
137
|
-
//# sourceMappingURL=DSCodeEditorForm.js.map
|
|
181
|
+
|
|
182
|
+
export { DSCodeEditorForm as default };
|