@aj-shadow/z-abs-complayer-codeeditor-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-Codeeditor-client.bld +41 -0
- package/project/client/_build/Client-CompLayer-Codeeditor-client-jsx.bld +10 -0
- package/project/client/_build/Client-CompLayer-Codeeditor-client.bld +10 -0
- package/project/client/_build/Client-css-CompLayer-Codeeditor-bundle.bld +9 -0
- package/project/client/_build/z-abs-complayer-codeeditor-client.prj +36 -0
- package/project/client/actions/action-code-editor-file.js +78 -0
- package/project/client/actions/action-code-editor-folder.js +41 -0
- package/project/client/actions/action-code-editor-persistent-data.js +23 -0
- package/project/client/actions/action-code-editor-project.js +23 -0
- package/project/client/actions/action-code-editor-workspace.js +35 -0
- package/project/client/actions/data-action-code-editor-file.js +41 -0
- package/project/client/actions/data-action-code-editor-folder.js +33 -0
- package/project/client/actions/data-action-code-editor-persistent-data.js +27 -0
- package/project/client/actions/data-action-code-editor-project.js +20 -0
- package/project/client/actions/data-action-code-editor-workspace.js +27 -0
- package/project/client/components/middle-code-editor-sidebar.jsx +117 -0
- package/project/client/components/middle-code-editor-toolbar.jsx +638 -0
- package/project/client/components/middle-code-editor-view.jsx +400 -0
- package/project/client/components/middle-code-editor.jsx +50 -0
- package/project/client/css/code-editor.css +44 -0
- package/project/client/css/scrollbar-dark.css +8 -0
- package/project/client/css/scrollbar-light.css +6 -0
- package/project/client/css/search.css +40 -0
- package/project/client/css/search_light.css +8 -0
- package/project/client/css/serach_dark.css +8 -0
- package/project/client/css/sidebar-dark.css +21 -0
- package/project/client/css/sidebar-light.css +18 -0
- package/project/client/css/tab.css +19 -0
- package/project/client/css/tab_dark.css +9 -0
- package/project/client/css/tab_light.css +9 -0
- package/project/client/css/view-dark.css +11 -0
- package/project/client/css/view-light.css +10 -0
- package/project/client/stores/code-editor-store.js +1044 -0
- package/project/z-abs-complayer-codeeditor-client.tree +40 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import CodeEditorStore from '../stores/code-editor-store';
|
|
5
|
+
import { ActionCodeEditorFileGet } from '../actions/action-code-editor-file';
|
|
6
|
+
import { ActionCodeEditorFolderGet } from '../actions/action-code-editor-folder';
|
|
7
|
+
import { ActionCodeEditorProjectToggle } from '../actions/action-code-editor-project';
|
|
8
|
+
import FileIcons from 'z-abs-complayer-bootstrap-client/client/icons/file-icons';
|
|
9
|
+
import FolderIcons from 'z-abs-complayer-bootstrap-client/client/icons/folder-icons';
|
|
10
|
+
import Tree from 'z-abs-complayer-tree-client/client/react-components/tree';
|
|
11
|
+
import {RouterContext} from 'z-abs-complayer-router-client/client/react-component/router-context';
|
|
12
|
+
import ReactComponentStore from 'z-abs-corelayer-client/client/react-component/react-component-store';
|
|
13
|
+
import React from 'react';
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export default class MiddleCodeEditorSidebar extends ReactComponentStore {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props, [CodeEditorStore]);
|
|
19
|
+
this.boundMouseUp = this._boundMouseUp.bind(this);
|
|
20
|
+
this.boundMouseMove = this._boundMouseMove.bind(this);
|
|
21
|
+
this.sidebarNode = null;
|
|
22
|
+
this.sidebarWidthMin = 180;
|
|
23
|
+
this.sidebarWidthMax = 720;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
shouldUpdate(nextProps, nextState) {
|
|
27
|
+
return !this.shallowCompare(this.state.CodeEditorStore.project, nextState.CodeEditorStore.project)
|
|
28
|
+
|| !this.shallowCompare(this.state.CodeEditorStore.projects, nextState.CodeEditorStore.projects)
|
|
29
|
+
|| !this.shallowCompare(this.state.CodeEditorStore.current, nextState.CodeEditorStore.current)
|
|
30
|
+
|| !this.shallowCompare(this.state.CodeEditorStore.persistentData, nextState.CodeEditorStore.persistentData);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_boundMouseUp(e) {
|
|
34
|
+
window.removeEventListener('mouseup', this.boundMouseUp, true);
|
|
35
|
+
window.removeEventListener('mousemove', this.boundMouseMove, true);
|
|
36
|
+
this.sidebarNode = null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_boundMouseMove(e) {
|
|
40
|
+
let width = e.clientX + 2;
|
|
41
|
+
if(width < this.sidebarWidthMin) {
|
|
42
|
+
width = this.sidebarWidthMin;
|
|
43
|
+
}
|
|
44
|
+
else if(width > this.sidebarWidthMax) {
|
|
45
|
+
width = this.sidebarWidthMax;
|
|
46
|
+
}
|
|
47
|
+
this.sidebarNode.style.width = `${width}px`;
|
|
48
|
+
this.sidebarNode.nextSibling.style.left = `${width}px`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
renderTree(project, key) {
|
|
52
|
+
return (
|
|
53
|
+
<Tree key={project.projectId} id={`code_editor_tree_code_${key}`} project={project} current={this.state.CodeEditorStore.current} folderIcons={FolderIcons} fileIcons={FileIcons} darkMode={this.state.CodeEditorStore.persistentData.darkMode}
|
|
54
|
+
onClickFile={(key, title, path, type) => {
|
|
55
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFileGet(project.projectId, key, title, path, type, project.plugin));
|
|
56
|
+
}}
|
|
57
|
+
onClickFolder={(key, title, data) => {
|
|
58
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFolderGet(project.projectId, key, title, data));
|
|
59
|
+
}}
|
|
60
|
+
onToggleFolder={(key, expanded) => {
|
|
61
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorProjectToggle(project.projectId, key, expanded));
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
renderTrees() {
|
|
68
|
+
const trees = [];
|
|
69
|
+
this.state.CodeEditorStore.projects.forEach((project, key) => {
|
|
70
|
+
trees.push(this.renderTree(project, key));
|
|
71
|
+
});
|
|
72
|
+
return trees;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
render() {
|
|
76
|
+
const stylePanel = {
|
|
77
|
+
height:'100%'
|
|
78
|
+
};
|
|
79
|
+
const darkMode = this.state.CodeEditorStore.persistentData.darkMode;
|
|
80
|
+
const workspaceName = this.state.CodeEditorStore.current.query?.workspace;
|
|
81
|
+
return (
|
|
82
|
+
<div className={this.theme(darkMode, "sidebar", "middle_sidebar")}>
|
|
83
|
+
<div className={this.theme(darkMode, " panel-default", "panel")} style={stylePanel}>
|
|
84
|
+
<div className={this.theme(darkMode, "panel_body_sidebar")}>
|
|
85
|
+
<div id="code_editor_tree_root">
|
|
86
|
+
<Tree key={this.state.CodeEditorStore.project.projectId} id="code_editor_tree_code_project" project={this.state.CodeEditorStore.project} current={this.state.CodeEditorStore.current} folderIcons={FolderIcons} fileIcons={FileIcons} darkMode={this.state.CodeEditorStore.persistentData.darkMode}
|
|
87
|
+
onClickFile={(key, title, path, type) => {
|
|
88
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFileGet(this.state.CodeEditorStore.project.projectId, key, title, path, type, false, workspaceName));
|
|
89
|
+
}}
|
|
90
|
+
onClickFolder={(key, title, data) => {
|
|
91
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorFolderGet(this.state.CodeEditorStore.project.projectId, key, title, data, workspaceName));
|
|
92
|
+
}}
|
|
93
|
+
onToggleFolder={(key, expanded) => {
|
|
94
|
+
this.dispatch(CodeEditorStore, new ActionCodeEditorProjectToggle(this.state.CodeEditorStore.project.projectId, key, expanded));
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
{this.renderTrees()}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
<div className={this.theme(darkMode, "sidebar_mover")}
|
|
102
|
+
onMouseDown={(e) => {
|
|
103
|
+
if(0 === e.button) {
|
|
104
|
+
this.sidebarNode = e.target.parentNode;
|
|
105
|
+
window.addEventListener('mouseup', this.boundMouseUp, true);
|
|
106
|
+
window.addEventListener('mousemove', this.boundMouseMove, true);
|
|
107
|
+
}
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
MiddleCodeEditorSidebar.contextType = RouterContext;
|