@aj-shadow/z-abs-complayer-modaldialog-client 0.0.0-aj-beta.221
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/.gitattributes +26 -0
- package/LICENSE.txt +96 -0
- package/README.md +5 -0
- package/npm-shrinkwrap.json +13 -0
- package/package.json +10 -0
- package/project/client/_build/Bundle-CompLayer-Modaldialog-client.bld +38 -0
- package/project/client/_build/Client-CompLayer-Modaldialog-client-jsx.bld +10 -0
- package/project/client/_build/Client-CompLayer-Modaldialog-client.bld +10 -0
- package/project/client/_build/Client-css-CompLayer-Modaldialog-bundle.bld +9 -0
- package/project/client/_build/z-abs-complayer-modaldialog-client.prj +36 -0
- package/project/client/actions/action-modal-dialog.js +29 -0
- package/project/client/css/abstraction_add.css +10 -0
- package/project/client/css/modal-dialog-file.css +5 -0
- package/project/client/css/modal.css +162 -0
- package/project/client/css/modal_body.css +18 -0
- package/project/client/css/modal_header.css +11 -0
- package/project/client/helper/helper-event-listener.js +29 -0
- package/project/client/helper/helper-modal-popover.js +35 -0
- package/project/client/helper/input-analyzer.js +47 -0
- package/project/client/images/actor-image.jsx +260 -0
- package/project/client/images/file-image.jsx +44 -0
- package/project/client/images/msg-image.jsx +31 -0
- package/project/client/modal-dialog-abstraction-add.jsx +992 -0
- package/project/client/modal-dialog-abstraction-properties.jsx +220 -0
- package/project/client/modal-dialog-file-add.jsx +183 -0
- package/project/client/modal-dialog-file-new.jsx +489 -0
- package/project/client/modal-dialog-file-properties.jsx +206 -0
- package/project/client/modal-dialog-file-remove.jsx +157 -0
- package/project/client/modal-dialog-folder-add.jsx +292 -0
- package/project/client/modal-dialog-folder-new.jsx +231 -0
- package/project/client/modal-dialog-folder-properties.jsx +237 -0
- package/project/client/modal-dialog-folder-remove.jsx +149 -0
- package/project/client/modal-dialog-search.jsx +144 -0
- package/project/client/modal-dialog-wizard-list.jsx +49 -0
- package/project/client/modal-dialog-wizard.jsx +145 -0
- package/project/client/modal-dialog-workspace-new.jsx +157 -0
- package/project/client/modal-dialog-workspace-open.jsx +306 -0
- package/project/client/stores/modal-dialog-store.js +63 -0
- package/project/z-abs-complayer-modaldialog-client.tree +41 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import HelperEventListener from './helper/helper-event-listener';
|
|
5
|
+
import HelperModalPopover from './helper/helper-modal-popover';
|
|
6
|
+
import Modal from 'z-abs-complayer-bootstrap-client/client/modal';
|
|
7
|
+
import ModalHeader from 'z-abs-complayer-bootstrap-client/client/modal-header';
|
|
8
|
+
import ModalBody from 'z-abs-complayer-bootstrap-client/client/modal-body';
|
|
9
|
+
import ModalFooter from 'z-abs-complayer-bootstrap-client/client/modal-footer';
|
|
10
|
+
import Popover from 'z-abs-complayer-bootstrap-client/client/popover';
|
|
11
|
+
import ReactComponentBase from 'z-abs-corelayer-client/client/react-component/react-component-base';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export default class ModalDialogFileRemove extends ReactComponentBase {
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
this.helperModalPopover = new HelperModalPopover();
|
|
19
|
+
this.eventListener = new HelperEventListener('keydown', this._keyDown.bind(this), true);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
didMount() {
|
|
23
|
+
this.helperModalPopover.didMount();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
shouldUpdate(nextProps, nextState) {
|
|
27
|
+
return !this.shallowCompare(this.props.heading, nextProps.heading)
|
|
28
|
+
|| !this.shallowCompare(this.props.modalResults, nextProps.modalResults)
|
|
29
|
+
|| !this.shallowCompare(this.state, nextState);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
didUpdate(prevProps, prevState) {
|
|
33
|
+
const previousModalResult = prevProps.modalResults.get(this.props.name);
|
|
34
|
+
const modalResult = this.props.modalResults.get(this.props.name);
|
|
35
|
+
if(modalResult) {
|
|
36
|
+
if(!prevProps.modalResult || (prevProps.modalResult.visible !== modalResult.visible)) {
|
|
37
|
+
if(modalResult.visible) {
|
|
38
|
+
this.eventListener.init();
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.eventListener.exit();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
willUnmount() {
|
|
48
|
+
this.eventListener.exit();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
hide() {
|
|
52
|
+
this.props.onHide();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
_keyDown(e) {
|
|
56
|
+
if(e.ctrlKey && e.shiftKey && 'R' === e.key) {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
this._remove();
|
|
59
|
+
this.hide();
|
|
60
|
+
}
|
|
61
|
+
else if(e.ctrlKey && e.shiftKey && 'D' === e.key) {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
this._delete();
|
|
64
|
+
this.hide();
|
|
65
|
+
}
|
|
66
|
+
else if(e.ctrlKey && e.shiftKey && 'C' === e.key) {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
this.hide();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
_remove(e) {
|
|
73
|
+
this.props.onFileRemove(this.props.file.projectId, this.props.file.key);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
_delete(e) {
|
|
77
|
+
this.props.onFileDelete(this.props.file.projectId, this.props.file.key, !!this.props.file.plugin);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
renderErrorMessage() {
|
|
81
|
+
const modalResult = this.props.modalResults.get(this.props.name);
|
|
82
|
+
if(this.state.error || 'error' === modalResult?.result.code) {
|
|
83
|
+
const msg = this.state.error ? this.state.errorText : modalResult.result.msg;
|
|
84
|
+
const errorDivStyle = {
|
|
85
|
+
float: 'left',
|
|
86
|
+
textAlign: 'left',
|
|
87
|
+
width: 420
|
|
88
|
+
};
|
|
89
|
+
const labelStyle = {
|
|
90
|
+
top: '2px',
|
|
91
|
+
position: 'relative'
|
|
92
|
+
};
|
|
93
|
+
return (
|
|
94
|
+
<div style={errorDivStyle}>
|
|
95
|
+
<p id="file_remove_modal_error_label" className="text-danger control-label modal_body_p_as_label" style={labelStyle}>{msg}</p>
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
renderText() {
|
|
105
|
+
if(null !== this.props.file) {
|
|
106
|
+
return `Do you really want to delete or remove: '${this.props.file.path}/${this.props.file.title}'?`;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
return '';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
render() {
|
|
114
|
+
const modalResult = this.props.modalResults.get(this.props.name);
|
|
115
|
+
const show = modalResult?.visible;
|
|
116
|
+
this.helperModalPopover.onRender();
|
|
117
|
+
return (
|
|
118
|
+
<Modal ref={this.helperModalPopover.modalRef} id="modal_file_remove" aria-labelledby="contained-modal-title-sm" show={show}
|
|
119
|
+
onHide={(e) => {
|
|
120
|
+
this.hide();
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
<ModalHeader closeButton>
|
|
124
|
+
<img className="modal_header_icon pull-left" src="/abs-images/svg/ActorJsA.svg" alt="ActorJs Icon"></img>
|
|
125
|
+
<h4 className="modal_header_heading modal-sm">{this.props.heading}</h4>
|
|
126
|
+
</ModalHeader>
|
|
127
|
+
<ModalBody>
|
|
128
|
+
{this.renderText()}
|
|
129
|
+
</ModalBody>
|
|
130
|
+
<ModalFooter>
|
|
131
|
+
{this.renderErrorMessage()}
|
|
132
|
+
<Popover ref={this.helperModalPopover.getPopoverRef()} placement="bottom" heading="" content="" shortcut="Ctrl+Shift+R" style={{display:'inline-block'}} disabled={!show}>
|
|
133
|
+
<button id="file_remove_remove_button" type="button" className="btn btn-warning"
|
|
134
|
+
onClick={(e) => {
|
|
135
|
+
this._remove(e);
|
|
136
|
+
}}
|
|
137
|
+
>Remove</button>
|
|
138
|
+
</Popover>
|
|
139
|
+
<Popover ref={this.helperModalPopover.getPopoverRef()} placement="bottom" heading="" content="" shortcut="Ctrl+Shift+D" style={{display:'inline-block',marginLeft:'5px'}} disabled={!show}>
|
|
140
|
+
<button id="file_remove_delete_button" type="button" className="btn btn-danger" disabled={!this.props.doDelete}
|
|
141
|
+
onClick={(e) => {
|
|
142
|
+
this._delete(e);
|
|
143
|
+
}}
|
|
144
|
+
>Delete</button>
|
|
145
|
+
</Popover>
|
|
146
|
+
<Popover ref={this.helperModalPopover.getPopoverRef()} placement="bottom" heading="" content="" shortcut="Ctrl+Shift+C" style={{display:'inline-block',marginLeft:'5px'}} disabled={!show}>
|
|
147
|
+
<button id="file_remove_close_button" type="button" className="btn btn-default" disabled={!show}
|
|
148
|
+
onClick={(e) => {
|
|
149
|
+
this.hide();
|
|
150
|
+
}}
|
|
151
|
+
>Close</button>
|
|
152
|
+
</Popover>
|
|
153
|
+
</ModalFooter>
|
|
154
|
+
</Modal>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import HelperEventListener from './helper/helper-event-listener';
|
|
5
|
+
import HelperModalPopover from './helper/helper-modal-popover';
|
|
6
|
+
import FileIcons from 'z-abs-complayer-bootstrap-client/client/icons/file-icons';
|
|
7
|
+
import FolderIcons from 'z-abs-complayer-bootstrap-client/client/icons/folder-icons';
|
|
8
|
+
import Modal from 'z-abs-complayer-bootstrap-client/client/modal';
|
|
9
|
+
import ModalHeader from 'z-abs-complayer-bootstrap-client/client/modal-header';
|
|
10
|
+
import ModalBody from 'z-abs-complayer-bootstrap-client/client/modal-body';
|
|
11
|
+
import ModalFooter from 'z-abs-complayer-bootstrap-client/client/modal-footer';
|
|
12
|
+
import Popover from 'z-abs-complayer-bootstrap-client/client/popover';
|
|
13
|
+
import Tree from 'z-abs-complayer-tree-client/client/react-components/tree';
|
|
14
|
+
import ReactComponentBase from 'z-abs-corelayer-client/client/react-component/react-component-base';
|
|
15
|
+
import React from 'react';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export default class ModalDialogFolderAdd extends ReactComponentBase {
|
|
19
|
+
constructor(props) {
|
|
20
|
+
super(props, {
|
|
21
|
+
name: '',
|
|
22
|
+
types: [],
|
|
23
|
+
project: null
|
|
24
|
+
});
|
|
25
|
+
this.helperModalPopover = new HelperModalPopover();
|
|
26
|
+
this.eventListener = new HelperEventListener('keydown', this._keyDown.bind(this), true);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static getDerivedStateFromProps(props, state) {
|
|
30
|
+
let update = null;
|
|
31
|
+
if(0 === state.types.length) {
|
|
32
|
+
const types = props.folder?.data.types.map((type) => {
|
|
33
|
+
return {
|
|
34
|
+
chosen: 'actorjs' !== type,
|
|
35
|
+
name: type
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
update = {
|
|
39
|
+
types: types ? types : []
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return update;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
didMount() {
|
|
46
|
+
this.helperModalPopover.didMount();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
shouldUpdate(nextProps, nextState) {
|
|
50
|
+
return !this.shallowCompare(this.props.name, nextProps.name)
|
|
51
|
+
|| !this.shallowCompare(this.props.heading, nextProps.heading)
|
|
52
|
+
|| !this.shallowCompare(this.props.result, nextProps.result)
|
|
53
|
+
|| !this.shallowCompare(this.props.project, nextProps.project)
|
|
54
|
+
|| !this.shallowCompare(this.props.current, nextProps.current)
|
|
55
|
+
|| !this.shallowCompare(this.props.original, nextProps.original)
|
|
56
|
+
|| !this.shallowCompare(this.props.modalResults, nextProps.modalResults)
|
|
57
|
+
|| !this.shallowCompare(this.state, nextState);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
didUpdate(prevProps, prevState) {
|
|
61
|
+
const previousModalResult = prevProps.modalResults.get(this.props.name);
|
|
62
|
+
const modalResult = this.props.modalResults.get(this.props.name);
|
|
63
|
+
if(modalResult) {
|
|
64
|
+
if(!prevProps.modalResult || (prevProps.modalResult.visible !== modalResult.visible)) {
|
|
65
|
+
if(modalResult.visible) {
|
|
66
|
+
this.eventListener.init();
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this.eventListener.exit();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
willUnmount() {
|
|
76
|
+
this.eventListener.exit();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
hide() {
|
|
80
|
+
this.updateState({
|
|
81
|
+
name: {$set: ''},
|
|
82
|
+
types: {$set: []}
|
|
83
|
+
});
|
|
84
|
+
this.props.onHide();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_keyDown(e) {
|
|
88
|
+
const disabled = null === this.props.current.folder || !this.props.current.folder.data.path.startsWith(`${this.props.original.folder.data.path}/${this.props.original.folder.title}`);
|
|
89
|
+
if(!e.ctrlKey && !e.shiftKey && 'Enter' === e.key) {
|
|
90
|
+
if(!disabled) {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
const types = [];
|
|
93
|
+
this.state.types.forEach((type) => {
|
|
94
|
+
if(type.chosen) {
|
|
95
|
+
types.push(type.name);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
const data = this.deepCopy(this.props.current.folder.data);
|
|
99
|
+
data.path = `${this.props.folder.data.path}/${this.props.folder.title}`;
|
|
100
|
+
data.types = types;
|
|
101
|
+
this.props.onAdd(this.props.folder.projectId, this.props.current.folder.title, data);
|
|
102
|
+
this.hide();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else if(e.ctrlKey && e.shiftKey && 'C' === e.key) {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
this.hide();
|
|
108
|
+
}
|
|
109
|
+
else if('ArrowUp' === e.key) {
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
else if('ArrowDown' === e.key) {
|
|
113
|
+
|
|
114
|
+
}
|
|
115
|
+
else if('ArrowLeft' === e.key) {
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
else if('ArrowRight' === e.key) {
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
setName(name) {
|
|
125
|
+
this.updateState({
|
|
126
|
+
name: {$set: name}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
setDescription(description) {
|
|
131
|
+
this.updateState({
|
|
132
|
+
description: description
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
renderErrorMessage() {
|
|
137
|
+
const modalResult = this.props.modalResults.get(this.props.name);
|
|
138
|
+
if(this.state.error || 'error' === modalResult?.result.code) {
|
|
139
|
+
const msg = this.state.error ? this.state.errorText : modalResult.result.msg;
|
|
140
|
+
const errorDivStyle = {
|
|
141
|
+
float: 'left',
|
|
142
|
+
textAlign: 'left',
|
|
143
|
+
width: 420
|
|
144
|
+
};
|
|
145
|
+
const labelStyle = {
|
|
146
|
+
top: '2px',
|
|
147
|
+
position: 'relative'
|
|
148
|
+
};
|
|
149
|
+
return (
|
|
150
|
+
<div style={errorDivStyle}>
|
|
151
|
+
<p id="folder_add_modal_error_label" className="text-danger control-label modal_body_p_as_label" style={labelStyle}>{msg}</p>
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
renderTree() {
|
|
161
|
+
const activationFilter = null !== this.props.original.folder ? `${this.props.original.folder.data.path}` : undefined;
|
|
162
|
+
return (
|
|
163
|
+
<Tree id="actor_tree_modul_dialog_folder" project={this.props.project} current={this.props.current} expandCurrentFolder={true} allowExpand={false} activationFilter={activationFilter} folderIcons={FolderIcons} fileIcons={FileIcons}
|
|
164
|
+
onClickFile={(key, title, path, type) => {}}
|
|
165
|
+
onClickFolder={(key, title, data) => {
|
|
166
|
+
this.props.project.select(key, true);
|
|
167
|
+
this.props.onChoose(`${data.path}/${title}`);
|
|
168
|
+
}}
|
|
169
|
+
onToggleFolder={(key, expanded) => {}}
|
|
170
|
+
/>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
renderFileTypes(disabled) {
|
|
175
|
+
if(!disabled && this.props.folder) {
|
|
176
|
+
const fileTypes = this.props.folder.data.types.map((type, index) => {
|
|
177
|
+
if('actorjs' !== type) {
|
|
178
|
+
return (
|
|
179
|
+
<React.Fragment key={`folder_add_input_${type}`}>
|
|
180
|
+
<div className="col-sm-1">
|
|
181
|
+
<input type="checkbox" id={`folder_add_input_type_${type}`} aria-label="..." autoComplete="off" checked={this.state.types[index]?.chosen}
|
|
182
|
+
onChange={(e) => {
|
|
183
|
+
this.state.types[index].chosen = e.currentTarget.checked;
|
|
184
|
+
this.updateState({types: {$set: this.state.types}});
|
|
185
|
+
}}
|
|
186
|
+
/>
|
|
187
|
+
</div>
|
|
188
|
+
<div className="col-sm-1">
|
|
189
|
+
<label htmlFor={`folder_add_input_type_${type}`} className="modal_body_file_type control-label">{type}</label>
|
|
190
|
+
</div>
|
|
191
|
+
</React.Fragment>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return (
|
|
196
|
+
<>
|
|
197
|
+
<hr className="modal_body_hr" />
|
|
198
|
+
<div className="row">
|
|
199
|
+
<div className="col-sm-1" />
|
|
200
|
+
<h5 className="modal_body_file_type_heading col-sm-4">File Types</h5>
|
|
201
|
+
</div>
|
|
202
|
+
<div key="file_types" className="row">
|
|
203
|
+
<div className="col-sm-1" />
|
|
204
|
+
{fileTypes}
|
|
205
|
+
</div>
|
|
206
|
+
</>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
_calculateDepth(node, currentDepth, depth) {
|
|
212
|
+
if(depth > currentDepth.value) {
|
|
213
|
+
++currentDepth.value;
|
|
214
|
+
}
|
|
215
|
+
node.children.forEach((child) => {
|
|
216
|
+
if(child.folder) {
|
|
217
|
+
this._calculateDepth(child, currentDepth, ++depth);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
renderNotFound(disabled) {
|
|
223
|
+
if(disabled && 0 !== this.props.project.source.length) {
|
|
224
|
+
const errorDivStyle = {
|
|
225
|
+
float: 'left',
|
|
226
|
+
textAlign: 'left',
|
|
227
|
+
width: 420
|
|
228
|
+
};
|
|
229
|
+
const labelStyle = {
|
|
230
|
+
top: '2px',
|
|
231
|
+
position: 'relative'
|
|
232
|
+
};
|
|
233
|
+
const currentDepth = {value: 0};
|
|
234
|
+
this._calculateDepth(this.props.project.source[0], currentDepth, 0);
|
|
235
|
+
return (
|
|
236
|
+
<div style={errorDivStyle}>
|
|
237
|
+
<p id="folder_add_modal_error_label" className="text-danger control-label modal_body_p_as_label" style={labelStyle}>No Folders Found</p>
|
|
238
|
+
</div>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
render() {
|
|
244
|
+
this.helperModalPopover.onRender();
|
|
245
|
+
const modalResult = this.props.modalResults.get(this.props.name);
|
|
246
|
+
const show = !!modalResult?.visible;
|
|
247
|
+
const disabled = null === this.props.current.folder || !this.props.current.folder.data.path.startsWith(`${this.props.original.folder.data.path}/${this.props.original.folder.title}`);
|
|
248
|
+
return (
|
|
249
|
+
<Modal ref={this.helperModalPopover.modalRef} id="modal_folder_add" aria-labelledby="contained-modal-title-sm" show={show}
|
|
250
|
+
onHide={(e) => {
|
|
251
|
+
this.hide();
|
|
252
|
+
}}
|
|
253
|
+
>
|
|
254
|
+
<ModalHeader closeButton>
|
|
255
|
+
<img className="modal_header_icon pull-left" src="/abs-images/svg/ActorJsA.svg" alt="ActorJs Icon"></img>
|
|
256
|
+
<h4 className="modal_header_heading modal-sm">{this.props.heading}</h4>
|
|
257
|
+
</ModalHeader>
|
|
258
|
+
<ModalBody className="modal-dialog-file-body">
|
|
259
|
+
{this.renderTree()}
|
|
260
|
+
{this.renderFileTypes(disabled)}
|
|
261
|
+
</ModalBody>
|
|
262
|
+
<ModalFooter>
|
|
263
|
+
{this.renderErrorMessage()}
|
|
264
|
+
{this.renderNotFound(disabled)}
|
|
265
|
+
<Popover ref={this.helperModalPopover.getPopoverRef()} placement="bottom" heading="" content="" shortcut="Enter" style={{display:'inline-block'}} disabled={!show}>
|
|
266
|
+
<button id="folder_add_add_button" type="button" className="btn btn-primary" disabled={disabled}
|
|
267
|
+
onClick={(e) => {
|
|
268
|
+
const types = [];
|
|
269
|
+
this.state.types.forEach((type) => {
|
|
270
|
+
if(type.chosen) {
|
|
271
|
+
types.push(type.name);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
const data = this.deepCopy(this.props.current.folder.data);
|
|
275
|
+
data.path = `${this.props.folder.data.path}/${this.props.folder.title}`;
|
|
276
|
+
data.types = types;
|
|
277
|
+
this.props.onAdd(this.props.folder.projectId, this.props.current.folder.title, data);
|
|
278
|
+
}}
|
|
279
|
+
>Add</button>
|
|
280
|
+
</Popover>
|
|
281
|
+
<Popover ref={this.helperModalPopover.getPopoverRef()} placement="bottom" heading="" content="" shortcut="Ctrl+Shift+C" style={{display:'inline-block',marginLeft:'5px'}} disabled={!show}>
|
|
282
|
+
<button id="folder_add_close_button" type="button" className="btn btn-default" disabled={!show}
|
|
283
|
+
onClick={(e) => {
|
|
284
|
+
this.hide();
|
|
285
|
+
}}
|
|
286
|
+
>Close</button>
|
|
287
|
+
</Popover>
|
|
288
|
+
</ModalFooter>
|
|
289
|
+
</Modal>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import HelperEventListener from './helper/helper-event-listener';
|
|
5
|
+
import HelperModalPopover from './helper/helper-modal-popover';
|
|
6
|
+
import InputAnalyzer from './helper/input-analyzer';
|
|
7
|
+
import Modal from 'z-abs-complayer-bootstrap-client/client/modal';
|
|
8
|
+
import ModalHeader from 'z-abs-complayer-bootstrap-client/client/modal-header';
|
|
9
|
+
import ModalBody from 'z-abs-complayer-bootstrap-client/client/modal-body';
|
|
10
|
+
import ModalFooter from 'z-abs-complayer-bootstrap-client/client/modal-footer';
|
|
11
|
+
import Popover from 'z-abs-complayer-bootstrap-client/client/popover';
|
|
12
|
+
import ReactComponentBase from 'z-abs-corelayer-client/client/react-component/react-component-base';
|
|
13
|
+
import React from 'react';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export default class ModalDialogFolderNew extends ReactComponentBase {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props, {
|
|
19
|
+
folderName: '',
|
|
20
|
+
types: [],
|
|
21
|
+
valid: false,
|
|
22
|
+
error: false,
|
|
23
|
+
errorText: ''
|
|
24
|
+
});
|
|
25
|
+
this.helperModalPopover = new HelperModalPopover();
|
|
26
|
+
this.inputRef = React.createRef();
|
|
27
|
+
this.inputAnalyzer = new InputAnalyzer(this.props.capitalFirst ? true : false);
|
|
28
|
+
this.eventListener = new HelperEventListener('keydown', this._keyDown.bind(this), true);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static getDerivedStateFromProps(props, state) {
|
|
32
|
+
if(0 === state.types.length) {
|
|
33
|
+
const types = props.folder?.data.types.map((type) => {
|
|
34
|
+
return {
|
|
35
|
+
chosen: true,
|
|
36
|
+
name: type
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
types: types ? types : []
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
didMount() {
|
|
49
|
+
this.helperModalPopover.didMount();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
shouldUpdate(nextProps, nextState) {
|
|
53
|
+
return !this.shallowCompare(this.props.name, nextProps.name)
|
|
54
|
+
|| !this.shallowCompare(this.props.heading, nextProps.heading)
|
|
55
|
+
|| !this.shallowCompare(this.props.folder, nextProps.folder)
|
|
56
|
+
|| !this.shallowCompare(this.props.modalResults, nextProps.modalResults)
|
|
57
|
+
|| !this.shallowCompare(this.state, nextState);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
didUpdate(prevProps, prevState) {
|
|
61
|
+
const previousModalResult = prevProps.modalResults.get(this.props.name);
|
|
62
|
+
const modalResult = this.props.modalResults.get(this.props.name);
|
|
63
|
+
if(modalResult) {
|
|
64
|
+
if(!prevProps.modalResult || (prevProps.modalResult.visible !== modalResult.visible)) {
|
|
65
|
+
if(modalResult.visible) {
|
|
66
|
+
this.eventListener.init();
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this.eventListener.exit();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
willUnmount() {
|
|
76
|
+
this.eventListener.exit();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
hide() {
|
|
80
|
+
this.updateState({
|
|
81
|
+
folderName: {$set: ''},
|
|
82
|
+
valid: {$set: false},
|
|
83
|
+
error: {$set: false},
|
|
84
|
+
errorText: {$set: ''}
|
|
85
|
+
});
|
|
86
|
+
this.props.onHide();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
_keyDown(e) {
|
|
90
|
+
if(!e.ctrlKey && !e.shiftKey && 'Enter' === e.key) {
|
|
91
|
+
if(!this.state.error) {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
this.new();
|
|
94
|
+
this.hide();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else if(e.ctrlKey && e.shiftKey && 'C' === e.key) {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
this.hide();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
renderErrorMessage() {
|
|
104
|
+
const modalResult = this.props.modalResults.get(this.props.name);
|
|
105
|
+
if(this.state.error || 'error' === modalResult?.result.code) {
|
|
106
|
+
const msg = this.state.error ? this.state.errorText : modalResult.result.msg;
|
|
107
|
+
const errorDivStyle = {
|
|
108
|
+
float: 'left',
|
|
109
|
+
textAlign: 'left',
|
|
110
|
+
width: 420
|
|
111
|
+
};
|
|
112
|
+
const labelStyle = {
|
|
113
|
+
top: '2px',
|
|
114
|
+
position: 'relative'
|
|
115
|
+
};
|
|
116
|
+
return (
|
|
117
|
+
<div style={errorDivStyle}>
|
|
118
|
+
<p id="folder_new_modal_error_label" className="text-danger control-label modal_body_p_as_label" style={labelStyle}>{msg}</p>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
renderTypes() {
|
|
128
|
+
if(this.props.folder) {
|
|
129
|
+
return this.props.folder.data.types.map((type, index) => {
|
|
130
|
+
if('actorjs' !== type) {
|
|
131
|
+
return (
|
|
132
|
+
<div key={index} className="row">
|
|
133
|
+
<div className="col-sm-2" style={{textAlign: 'right'}}>
|
|
134
|
+
<label htmlFor={`folder_new_input_type_${type}`} className="control-label">{type}</label>
|
|
135
|
+
</div>
|
|
136
|
+
<div className="col-sm-2">
|
|
137
|
+
<input type="checkbox" id={`folder_new_input_type_${type}`} aria-label="..." autoComplete="off" checked={this.state.types[index]?.chosen} style={{marginTop: '12px'}}
|
|
138
|
+
onChange={(e) => {
|
|
139
|
+
this.updateState({types: (types) => {
|
|
140
|
+
types[index].chosen = e.currentTarget.checked;
|
|
141
|
+
}});
|
|
142
|
+
}}
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
render() {
|
|
153
|
+
const modalResult = this.props.modalResults.get(this.props.name);
|
|
154
|
+
const show = modalResult?.visible;
|
|
155
|
+
this.helperModalPopover.onRender();
|
|
156
|
+
return (
|
|
157
|
+
<Modal ref={this.helperModalPopover.modalRef} id="modal_folder_new" aria-labelledby="contained-modal-title-sm" show={show}
|
|
158
|
+
onShown={(e) => {
|
|
159
|
+
this.inputRef.current.focus();
|
|
160
|
+
}}
|
|
161
|
+
onHide={(e) => {
|
|
162
|
+
this.hide();
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
<ModalHeader closeButton>
|
|
166
|
+
<img className="modal_header_icon pull-left" src="/abs-images/svg/ActorJsA.svg" alt="ActorJs Icon"></img>
|
|
167
|
+
<h4 className="modal_header_heading modal-sm">{this.props.heading}</h4>
|
|
168
|
+
</ModalHeader>
|
|
169
|
+
<ModalBody>
|
|
170
|
+
<div className="form-group">
|
|
171
|
+
<div className="row" style={{textAlign: 'right'}}>
|
|
172
|
+
<div className="col-sm-2">
|
|
173
|
+
<label htmlFor="modal_dialog_folder_new_name" className="control-label">Name</label>
|
|
174
|
+
</div>
|
|
175
|
+
<div className="col-sm-9">
|
|
176
|
+
<input ref={this.inputRef} type="text" id="modal_dialog_folder_new_name" className="form-control input-sm" placeholder="folder name" value={this.state.folderName}
|
|
177
|
+
onChange={(e) => {
|
|
178
|
+
const result = this.inputAnalyzer.analyze(e.target.value);
|
|
179
|
+
if(result.success) {
|
|
180
|
+
this.updateState({valid: {$set: true}});
|
|
181
|
+
this.updateState({error: {$set: false}});
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
this.updateState({valid: {$set: false}});
|
|
185
|
+
this.updateState({error: {$set: true}});
|
|
186
|
+
if(!result.regexpValidation) {
|
|
187
|
+
this.updateState({errorText: {$set: `The name contains not allowed characters: '${result.noneValidCharacters}'`}});
|
|
188
|
+
}
|
|
189
|
+
else if(!result.filenameValidation) {
|
|
190
|
+
this.updateState({errorText: {$set: `The filename is not allowed: '${result.noneValidFilename}'`}});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
this.updateState({folderName: {$set: e.target.value}});
|
|
194
|
+
}}
|
|
195
|
+
/>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
{this.renderTypes()}
|
|
199
|
+
</div>
|
|
200
|
+
</ModalBody>
|
|
201
|
+
<ModalFooter>
|
|
202
|
+
{this.renderErrorMessage()}
|
|
203
|
+
<Popover ref={this.helperModalPopover.getPopoverRef()} placement="bottom" heading="" content="" shortcut="Enter" style={{display:'inline-block'}} disabled={!show}>
|
|
204
|
+
<button id="folder_new_new_button" type="button" className="btn btn-primary" disabled={0 === this.state.folderName.length || !this.state.valid}
|
|
205
|
+
onClick={(e) => {
|
|
206
|
+
const types = [];
|
|
207
|
+
this.state.types.forEach((type) => {
|
|
208
|
+
if(type.chosen) {
|
|
209
|
+
types.push(type.name);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
const data = this.deepCopy(this.props.folder.data);
|
|
213
|
+
data.path = `${this.props.folder.data.path}/${this.props.folder.title}`;
|
|
214
|
+
data.type = 'folder';
|
|
215
|
+
data.types = types;
|
|
216
|
+
this.props.onFolderNew(this.props.folder.projectId, this.state.folderName, data);
|
|
217
|
+
}}
|
|
218
|
+
>New</button>
|
|
219
|
+
</Popover>
|
|
220
|
+
<Popover ref={this.helperModalPopover.getPopoverRef()} placement="bottom" heading="" content="" shortcut="Ctrl+Shift+C" style={{display:'inline-block',marginLeft:'5px'}} disabled={!show}>
|
|
221
|
+
<button id="folder_new_close_button" type="button" className="btn btn-default" disabled={!show}
|
|
222
|
+
onClick={(e) => {
|
|
223
|
+
this.hide();
|
|
224
|
+
}}
|
|
225
|
+
>Close</button>
|
|
226
|
+
</Popover>
|
|
227
|
+
</ModalFooter>
|
|
228
|
+
</Modal>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
}
|