@difizen/libro-jupyter 0.2.19 → 0.2.21
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/es/cell/jupyter-code-cell-view.js +2 -2
- package/es/file/file-color-registry.d.ts +6 -0
- package/es/file/file-color-registry.d.ts.map +1 -0
- package/es/file/file-color-registry.js +47 -0
- package/es/file/file-create-modal.d.ts.map +1 -1
- package/es/file/file-create-modal.js +117 -110
- package/es/file/file-createdir-modal.d.ts.map +1 -1
- package/es/file/file-createdir-modal.js +60 -53
- package/es/file/file-rename-modal.d.ts.map +1 -1
- package/es/file/file-rename-modal.js +49 -43
- package/es/file/index.less +4 -6
- package/es/file/module.d.ts.map +1 -1
- package/es/file/module.js +2 -1
- package/es/widget/progress/view.js +1 -1
- package/package.json +17 -17
- package/src/cell/jupyter-code-cell-view.tsx +2 -2
- package/src/file/file-color-registry.ts +28 -0
- package/src/file/file-create-modal.tsx +105 -94
- package/src/file/file-createdir-modal.tsx +46 -35
- package/src/file/file-rename-modal.tsx +41 -31
- package/src/file/index.less +4 -6
- package/src/file/module.ts +2 -0
- package/src/widget/progress/view.tsx +1 -1
package/es/file/index.less
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
margin-bottom: 24px;
|
|
7
7
|
height: 100px;
|
|
8
8
|
width: 100px;
|
|
9
|
-
border: 1px solid
|
|
9
|
+
border: 1px solid var(--mana-libro-file-type-border);
|
|
10
10
|
border-radius: 4px;
|
|
11
11
|
cursor: pointer;
|
|
12
12
|
|
|
@@ -52,14 +52,12 @@
|
|
|
52
52
|
|
|
53
53
|
.ant-modal-title {
|
|
54
54
|
font-weight: 500;
|
|
55
|
-
color: rgba(0, 10, 26, 89%);
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
.libro-remove-file-modal {
|
|
60
59
|
.ant-modal-confirm-title {
|
|
61
60
|
font-weight: 500;
|
|
62
|
-
color: rgba(0, 0, 0, 88%);
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
|
|
@@ -83,16 +81,16 @@
|
|
|
83
81
|
.libro-create-file-des {
|
|
84
82
|
margin-bottom: 8px;
|
|
85
83
|
display: inline-block;
|
|
86
|
-
color:
|
|
84
|
+
color: var(--mana-libro-file-label-text);
|
|
87
85
|
letter-spacing: 0;
|
|
88
86
|
line-height: 22px;
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
.libro-create-file-path {
|
|
92
|
-
color:
|
|
90
|
+
color: var(--mana-libro-file-text);
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
.libro-create-file-type-text {
|
|
96
94
|
margin-top: 8px;
|
|
97
|
-
color:
|
|
95
|
+
color: var(--mana-libro-file-text);
|
|
98
96
|
}
|
package/es/file/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/file/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/file/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAc/D,eAAO,MAAM,sBAAsB,YAcR,CAAC"}
|
package/es/file/module.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FileTreeModule, ManaModule } from '@difizen/mana-app';
|
|
2
|
+
import { FileColorContribution } from "./file-color-registry.js";
|
|
2
3
|
import { FileCommandContribution } from "./file-command.js";
|
|
3
4
|
import { FileCreateModalContribution } from "./file-create-modal-contribution.js";
|
|
4
5
|
import { FileCreateDirModalContribution } from "./file-createdir-modal-contribution.js";
|
|
@@ -9,4 +10,4 @@ import { FileTreeLabelProvider } from "./file-tree-label-provider.js";
|
|
|
9
10
|
import { FileView } from "./file-view/index.js";
|
|
10
11
|
import { LibroNavigatableView } from "./navigatable-view.js";
|
|
11
12
|
import { LibroJupyterOpenHandler } from "./open-handler-contribution.js";
|
|
12
|
-
export var LibroJupyterFileModule = ManaModule.create().register(JupyterFileService, FileView, FileNameAlias, FileTreeLabelProvider, LibroNavigatableView, LibroJupyterOpenHandler, FileCommandContribution, FileCreateModalContribution, FileCreateDirModalContribution, FileRenameModalContribution).dependOn(FileTreeModule);
|
|
13
|
+
export var LibroJupyterFileModule = ManaModule.create().register(JupyterFileService, FileColorContribution, FileView, FileNameAlias, FileTreeLabelProvider, LibroNavigatableView, LibroJupyterOpenHandler, FileCommandContribution, FileCreateModalContribution, FileCreateDirModalContribution, FileRenameModalContribution).dependOn(FileTreeModule);
|
|
@@ -28,7 +28,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
28
28
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
29
|
export var LibroProgressWidgetComponent = /*#__PURE__*/forwardRef(function LibroProgressWidgetComponent() {
|
|
30
30
|
var widgetView = useInject(ViewInstance);
|
|
31
|
-
var percent = widgetView.state.max && widgetView.state.min ? widgetView.state.value / ((widgetView.state.max - widgetView.state.min) / 100) : 0;
|
|
31
|
+
var percent = widgetView.state.max !== undefined && widgetView.state.min !== undefined ? widgetView.state.value / ((widgetView.state.max - widgetView.state.min) / 100) : 0;
|
|
32
32
|
if (widgetView.isCommClosed) {
|
|
33
33
|
return null;
|
|
34
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-jupyter",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"libro"
|
|
@@ -31,22 +31,22 @@
|
|
|
31
31
|
"src"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@difizen/libro-cofine-editor": "^0.2.
|
|
35
|
-
"@difizen/libro-code-editor": "^0.2.
|
|
36
|
-
"@difizen/libro-code-cell": "^0.2.
|
|
37
|
-
"@difizen/libro-codemirror": "^0.2.
|
|
38
|
-
"@difizen/libro-rendermime": "^0.2.
|
|
39
|
-
"@difizen/libro-common": "^0.2.
|
|
40
|
-
"@difizen/libro-core": "^0.2.
|
|
41
|
-
"@difizen/libro-kernel": "^0.2.
|
|
42
|
-
"@difizen/libro-l10n": "^0.2.
|
|
43
|
-
"@difizen/libro-output": "^0.2.
|
|
44
|
-
"@difizen/libro-search": "^0.2.
|
|
45
|
-
"@difizen/libro-search-code-cell": "^0.2.
|
|
46
|
-
"@difizen/libro-lsp": "^0.2.
|
|
47
|
-
"@difizen/libro-markdown-cell": "^0.2.
|
|
48
|
-
"@difizen/libro-raw-cell": "^0.2.
|
|
49
|
-
"@difizen/libro-language-client": "^0.2.
|
|
34
|
+
"@difizen/libro-cofine-editor": "^0.2.21",
|
|
35
|
+
"@difizen/libro-code-editor": "^0.2.21",
|
|
36
|
+
"@difizen/libro-code-cell": "^0.2.21",
|
|
37
|
+
"@difizen/libro-codemirror": "^0.2.21",
|
|
38
|
+
"@difizen/libro-rendermime": "^0.2.21",
|
|
39
|
+
"@difizen/libro-common": "^0.2.21",
|
|
40
|
+
"@difizen/libro-core": "^0.2.21",
|
|
41
|
+
"@difizen/libro-kernel": "^0.2.21",
|
|
42
|
+
"@difizen/libro-l10n": "^0.2.21",
|
|
43
|
+
"@difizen/libro-output": "^0.2.21",
|
|
44
|
+
"@difizen/libro-search": "^0.2.21",
|
|
45
|
+
"@difizen/libro-search-code-cell": "^0.2.21",
|
|
46
|
+
"@difizen/libro-lsp": "^0.2.21",
|
|
47
|
+
"@difizen/libro-markdown-cell": "^0.2.21",
|
|
48
|
+
"@difizen/libro-raw-cell": "^0.2.21",
|
|
49
|
+
"@difizen/libro-language-client": "^0.2.21",
|
|
50
50
|
"@difizen/mana-app": "latest",
|
|
51
51
|
"@difizen/mana-l10n": "latest",
|
|
52
52
|
"@ant-design/colors": "^7.0.0",
|
|
@@ -6,9 +6,9 @@ import type {
|
|
|
6
6
|
TooltipProvider,
|
|
7
7
|
TooltipProviderOption,
|
|
8
8
|
} from '@difizen/libro-code-editor';
|
|
9
|
+
import { getCellURI } from '@difizen/libro-common';
|
|
9
10
|
import type { KernelMessage } from '@difizen/libro-kernel';
|
|
10
11
|
import { KernelError } from '@difizen/libro-kernel';
|
|
11
|
-
import { getCellURI } from '@difizen/libro-language-client';
|
|
12
12
|
import { transient } from '@difizen/mana-app';
|
|
13
13
|
import { view, ViewInstance } from '@difizen/mana-app';
|
|
14
14
|
import { getOrigin, useInject } from '@difizen/mana-app';
|
|
@@ -65,7 +65,7 @@ export class JupyterCodeCellView extends LibroCodeCellView {
|
|
|
65
65
|
|
|
66
66
|
protected override getEditorOption(): CodeEditorViewOptions {
|
|
67
67
|
const options = super.getEditorOption();
|
|
68
|
-
const uri = getCellURI(this.parent.model, this.model);
|
|
68
|
+
const uri = getCellURI(this.parent.model.filePath, this.model.id);
|
|
69
69
|
|
|
70
70
|
return {
|
|
71
71
|
...options,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ColorRegistry } from '@difizen/mana-app';
|
|
2
|
+
import { Color, ColorContribution } from '@difizen/mana-app';
|
|
3
|
+
import { singleton } from '@difizen/mana-app';
|
|
4
|
+
|
|
5
|
+
@singleton({ contrib: ColorContribution })
|
|
6
|
+
export class FileColorContribution implements ColorContribution {
|
|
7
|
+
registerColors(colors: ColorRegistry): void {
|
|
8
|
+
// common
|
|
9
|
+
colors.register(
|
|
10
|
+
// #region antd variable
|
|
11
|
+
{
|
|
12
|
+
id: 'libro.file.label.text',
|
|
13
|
+
defaults: { dark: '#F8F8FB', light: Color.rgba(0, 0, 0, 0.85) },
|
|
14
|
+
description: '',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'libro.file.text',
|
|
18
|
+
defaults: { dark: '#E3E4E6', light: Color.rgba(0, 0, 0, 0.65) },
|
|
19
|
+
description: '',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'libro.file.type.border',
|
|
23
|
+
defaults: { dark: '#3B3C42', light: Color.rgba(0, 10, 26, 0.1) },
|
|
24
|
+
description: '',
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ModalItemProps, ModalItem } from '@difizen/mana-app';
|
|
2
|
+
import { ThemeService } from '@difizen/mana-app';
|
|
2
3
|
import { CommandRegistry } from '@difizen/mana-app';
|
|
3
4
|
import { URI, useInject, ViewManager } from '@difizen/mana-app';
|
|
4
|
-
import { Col, Form, message, Row, Input, Modal } from 'antd';
|
|
5
|
+
import { Col, Form, message, Row, Input, Modal, ConfigProvider, theme } from 'antd';
|
|
5
6
|
import type { InputRef } from 'antd';
|
|
6
7
|
import { useEffect, useRef, useState } from 'react';
|
|
7
8
|
import './index.less';
|
|
@@ -33,6 +34,7 @@ export const FileCreateModalComponent: React.FC<ModalItemProps<ModalItemType>> =
|
|
|
33
34
|
const [fileType, setFileType] = useState<FileType>(data?.fileType);
|
|
34
35
|
const [fileView, setFileView] = useState<FileView>();
|
|
35
36
|
const inputRef = useRef<InputRef>(null);
|
|
37
|
+
const themeService = useInject(ThemeService);
|
|
36
38
|
const [form] = Form.useForm();
|
|
37
39
|
|
|
38
40
|
const onFinish = async (values: { fileName: string }) => {
|
|
@@ -83,106 +85,115 @@ export const FileCreateModalComponent: React.FC<ModalItemProps<ModalItemType>> =
|
|
|
83
85
|
inputRef.current?.focus();
|
|
84
86
|
});
|
|
85
87
|
return (
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
okText="确定"
|
|
93
|
-
onOk={() => {
|
|
94
|
-
form.submit();
|
|
88
|
+
<ConfigProvider
|
|
89
|
+
theme={{
|
|
90
|
+
algorithm:
|
|
91
|
+
themeService.getCurrentTheme().type === 'dark'
|
|
92
|
+
? theme.darkAlgorithm
|
|
93
|
+
: theme.defaultAlgorithm,
|
|
95
94
|
}}
|
|
96
|
-
keyboard={true}
|
|
97
|
-
wrapClassName="libro-create-file-modal"
|
|
98
95
|
>
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
96
|
+
<Modal
|
|
97
|
+
title="新建文件"
|
|
98
|
+
open={visible}
|
|
99
|
+
onCancel={close}
|
|
100
|
+
width={788}
|
|
101
|
+
cancelText="取消"
|
|
102
|
+
okText="确定"
|
|
103
|
+
onOk={() => {
|
|
104
|
+
form.submit();
|
|
105
|
+
}}
|
|
106
|
+
keyboard={true}
|
|
107
|
+
wrapClassName="libro-create-file-modal"
|
|
108
|
+
>
|
|
109
|
+
<div className="libro-create-file-path-container">
|
|
110
|
+
<div className="libro-create-file-des">创建位置:</div>
|
|
111
|
+
<span className="libro-create-file-path">{data?.path}</span>
|
|
112
|
+
</div>
|
|
113
|
+
<div className="libro-create-file-des">文件类型:</div>
|
|
114
|
+
<Row>
|
|
115
|
+
<Col
|
|
116
|
+
className="gutter-row"
|
|
117
|
+
style={{ paddingLeft: 'unset', paddingRight: '16px' }}
|
|
117
118
|
>
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
119
|
+
<div
|
|
120
|
+
className={`libro-create-file-type ${
|
|
121
|
+
fileType === '.ipynb' ? 'active' : ''
|
|
122
|
+
}`}
|
|
123
|
+
onClick={() => {
|
|
124
|
+
setFileType('.ipynb');
|
|
125
|
+
inputRef.current?.focus();
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
<NotebookIcon />
|
|
129
|
+
<span className="libro-create-file-type-text">Notebook</span>
|
|
130
|
+
</div>
|
|
131
|
+
</Col>
|
|
132
|
+
<Col
|
|
133
|
+
className="gutter-row"
|
|
134
|
+
style={{ paddingLeft: 'unset', paddingRight: '16px' }}
|
|
132
135
|
>
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}}
|
|
136
|
+
<div
|
|
137
|
+
className={`libro-create-file-type ${fileType === '.py' ? 'active' : ''}`}
|
|
138
|
+
onClick={() => {
|
|
139
|
+
setFileType('.py');
|
|
140
|
+
inputRef.current?.focus();
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
<PythonIcon />
|
|
144
|
+
<span className="libro-create-file-type-text">Python</span>
|
|
145
|
+
</div>
|
|
146
|
+
</Col>
|
|
147
|
+
<Col
|
|
148
|
+
className="gutter-row"
|
|
149
|
+
style={{ paddingLeft: 'unset', paddingRight: '16px' }}
|
|
147
150
|
>
|
|
148
|
-
<
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
inputRef.current?.focus();
|
|
163
|
-
}}
|
|
151
|
+
<div
|
|
152
|
+
className={`libro-create-file-type ${fileType === '.json' ? 'active' : ''}`}
|
|
153
|
+
onClick={() => {
|
|
154
|
+
setFileType('.json');
|
|
155
|
+
inputRef.current?.focus();
|
|
156
|
+
}}
|
|
157
|
+
>
|
|
158
|
+
<JSONIcon />
|
|
159
|
+
<span className="libro-create-file-type-text">JSON</span>
|
|
160
|
+
</div>
|
|
161
|
+
</Col>
|
|
162
|
+
<Col
|
|
163
|
+
className="gutter-row"
|
|
164
|
+
style={{ paddingLeft: 'unset', paddingRight: '16px' }}
|
|
164
165
|
>
|
|
165
|
-
<
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
166
|
+
<div
|
|
167
|
+
className={`libro-create-file-type ${
|
|
168
|
+
fileType === undefined ? 'active' : ''
|
|
169
|
+
}`}
|
|
170
|
+
onClick={() => {
|
|
171
|
+
setFileType(undefined);
|
|
172
|
+
inputRef.current?.focus();
|
|
173
|
+
}}
|
|
174
|
+
>
|
|
175
|
+
<MoreIcon />
|
|
176
|
+
<span className="libro-create-file-type-text">其他</span>
|
|
177
|
+
</div>
|
|
178
|
+
</Col>
|
|
179
|
+
</Row>
|
|
180
|
+
<Form
|
|
181
|
+
layout="vertical"
|
|
182
|
+
autoComplete="off"
|
|
183
|
+
form={form}
|
|
184
|
+
onFinish={onFinish}
|
|
185
|
+
className="libro-create-file-form"
|
|
181
186
|
>
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
187
|
+
<Form.Item
|
|
188
|
+
name="fileName"
|
|
189
|
+
label="文件名称"
|
|
190
|
+
rules={[{ required: true, validator: validateFileName }]}
|
|
191
|
+
>
|
|
192
|
+
<Input addonAfter={fileType || ''} ref={inputRef} />
|
|
193
|
+
</Form.Item>
|
|
194
|
+
</Form>
|
|
195
|
+
</Modal>
|
|
196
|
+
</ConfigProvider>
|
|
186
197
|
);
|
|
187
198
|
};
|
|
188
199
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ModalItem, ModalItemProps } from '@difizen/mana-app';
|
|
2
|
+
import { ThemeService } from '@difizen/mana-app';
|
|
2
3
|
import { URI } from '@difizen/mana-app';
|
|
3
4
|
import { ViewManager } from '@difizen/mana-app';
|
|
4
5
|
import { useInject } from '@difizen/mana-app';
|
|
5
|
-
import { Form, message, Input, Modal } from 'antd';
|
|
6
|
+
import { Form, message, Input, Modal, ConfigProvider, theme } from 'antd';
|
|
6
7
|
import type { InputRef } from 'antd';
|
|
7
8
|
import { useEffect, useRef, useState } from 'react';
|
|
8
9
|
|
|
@@ -19,6 +20,7 @@ export const FileCreateDirModalComponent: React.FC<
|
|
|
19
20
|
> = ({ visible, close, data }: ModalItemProps<FileDirCreateModalItemType>) => {
|
|
20
21
|
const fileService = useInject(JupyterFileService);
|
|
21
22
|
const viewManager = useInject(ViewManager);
|
|
23
|
+
const themeService = useInject(ThemeService);
|
|
22
24
|
const inputRef = useRef<InputRef>(null);
|
|
23
25
|
const [fileView, setFileView] = useState<FileView>();
|
|
24
26
|
const [form] = Form.useForm();
|
|
@@ -61,44 +63,53 @@ export const FileCreateDirModalComponent: React.FC<
|
|
|
61
63
|
inputRef.current?.focus();
|
|
62
64
|
});
|
|
63
65
|
return (
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
onOk={() => {
|
|
71
|
-
form.submit();
|
|
66
|
+
<ConfigProvider
|
|
67
|
+
theme={{
|
|
68
|
+
algorithm:
|
|
69
|
+
themeService.getCurrentTheme().type === 'dark'
|
|
70
|
+
? theme.darkAlgorithm
|
|
71
|
+
: theme.defaultAlgorithm,
|
|
72
72
|
}}
|
|
73
|
-
keyboard={true}
|
|
74
|
-
wrapClassName="libro-create-dir-modal"
|
|
75
|
-
width={524}
|
|
76
73
|
>
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
<Modal
|
|
75
|
+
title="新建文件夹"
|
|
76
|
+
open={visible}
|
|
77
|
+
onCancel={close}
|
|
78
|
+
cancelText="取消"
|
|
79
|
+
okText="确定"
|
|
80
|
+
onOk={() => {
|
|
81
|
+
form.submit();
|
|
82
|
+
}}
|
|
83
|
+
keyboard={true}
|
|
84
|
+
wrapClassName="libro-create-dir-modal"
|
|
85
|
+
width={524}
|
|
85
86
|
>
|
|
86
|
-
<
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
<div className="libro-create-file-des">创建位置:</div>
|
|
88
|
+
<span className="libro-create-file-path">{data?.path}</span>
|
|
89
|
+
<Form
|
|
90
|
+
layout="vertical"
|
|
91
|
+
autoComplete="off"
|
|
92
|
+
form={form}
|
|
93
|
+
onFinish={onFinish}
|
|
94
|
+
className="libro-create-dir-file-form"
|
|
90
95
|
>
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
<Form.Item
|
|
97
|
+
name="dirName"
|
|
98
|
+
label="文件夹名称"
|
|
99
|
+
rules={[{ required: true, validator: validateDirName }]}
|
|
100
|
+
>
|
|
101
|
+
<Input
|
|
102
|
+
ref={inputRef}
|
|
103
|
+
onKeyDown={async (e) => {
|
|
104
|
+
if (e.keyCode === 13) {
|
|
105
|
+
form.submit();
|
|
106
|
+
}
|
|
107
|
+
}}
|
|
108
|
+
/>
|
|
109
|
+
</Form.Item>
|
|
110
|
+
</Form>
|
|
111
|
+
</Modal>
|
|
112
|
+
</ConfigProvider>
|
|
102
113
|
);
|
|
103
114
|
};
|
|
104
115
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useInject, ViewManager } from '@difizen/mana-app';
|
|
1
|
+
import { ThemeService, useInject, ViewManager } from '@difizen/mana-app';
|
|
2
2
|
import type { ModalItem, ModalItemProps, URI } from '@difizen/mana-app';
|
|
3
|
-
import { Form, message, Input, Modal } from 'antd';
|
|
3
|
+
import { Form, message, Input, Modal, theme, ConfigProvider } from 'antd';
|
|
4
4
|
import type { InputRef } from 'antd';
|
|
5
5
|
import { useEffect, useRef, useState } from 'react';
|
|
6
6
|
|
|
@@ -23,6 +23,7 @@ export const FileRenameModalComponent: React.FC<ModalItemProps<ModalItemType>> =
|
|
|
23
23
|
const inputRef = useRef<InputRef>(null);
|
|
24
24
|
const [form] = Form.useForm();
|
|
25
25
|
const [fileView, setFileView] = useState<FileView>();
|
|
26
|
+
const themeService = useInject(ThemeService);
|
|
26
27
|
useEffect(() => {
|
|
27
28
|
viewManager
|
|
28
29
|
.getOrCreateView(FileView)
|
|
@@ -62,39 +63,48 @@ export const FileRenameModalComponent: React.FC<ModalItemProps<ModalItemType>> =
|
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
return (
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
<ConfigProvider
|
|
67
|
+
theme={{
|
|
68
|
+
algorithm:
|
|
69
|
+
themeService.getCurrentTheme().type === 'dark'
|
|
70
|
+
? theme.darkAlgorithm
|
|
71
|
+
: theme.defaultAlgorithm,
|
|
71
72
|
}}
|
|
72
|
-
wrapClassName="libro-rename-file-modal"
|
|
73
73
|
>
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
<Modal
|
|
75
|
+
title="文件重命名"
|
|
76
|
+
open={visible}
|
|
77
|
+
onCancel={close}
|
|
78
|
+
onOk={() => {
|
|
79
|
+
form.submit();
|
|
80
|
+
}}
|
|
81
|
+
wrapClassName="libro-rename-file-modal"
|
|
80
82
|
>
|
|
81
|
-
<Form
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
<Form
|
|
84
|
+
layout="vertical"
|
|
85
|
+
autoComplete="off"
|
|
86
|
+
form={form}
|
|
87
|
+
onFinish={onFinish}
|
|
88
|
+
className="libro-rename-file-form"
|
|
86
89
|
>
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
<Form.Item
|
|
91
|
+
name="rename"
|
|
92
|
+
label="文件/文件夹名称"
|
|
93
|
+
rules={[{ required: true, validator: validateRename }]}
|
|
94
|
+
initialValue={data?.fileName}
|
|
95
|
+
>
|
|
96
|
+
<Input
|
|
97
|
+
ref={inputRef}
|
|
98
|
+
onKeyDown={async (e) => {
|
|
99
|
+
if (e.keyCode === 13) {
|
|
100
|
+
form.submit();
|
|
101
|
+
}
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
</Form.Item>
|
|
105
|
+
</Form>
|
|
106
|
+
</Modal>
|
|
107
|
+
</ConfigProvider>
|
|
98
108
|
);
|
|
99
109
|
};
|
|
100
110
|
|
package/src/file/index.less
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
margin-bottom: 24px;
|
|
7
7
|
height: 100px;
|
|
8
8
|
width: 100px;
|
|
9
|
-
border: 1px solid
|
|
9
|
+
border: 1px solid var(--mana-libro-file-type-border);
|
|
10
10
|
border-radius: 4px;
|
|
11
11
|
cursor: pointer;
|
|
12
12
|
|
|
@@ -52,14 +52,12 @@
|
|
|
52
52
|
|
|
53
53
|
.ant-modal-title {
|
|
54
54
|
font-weight: 500;
|
|
55
|
-
color: rgba(0, 10, 26, 89%);
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
.libro-remove-file-modal {
|
|
60
59
|
.ant-modal-confirm-title {
|
|
61
60
|
font-weight: 500;
|
|
62
|
-
color: rgba(0, 0, 0, 88%);
|
|
63
61
|
}
|
|
64
62
|
}
|
|
65
63
|
|
|
@@ -83,16 +81,16 @@
|
|
|
83
81
|
.libro-create-file-des {
|
|
84
82
|
margin-bottom: 8px;
|
|
85
83
|
display: inline-block;
|
|
86
|
-
color:
|
|
84
|
+
color: var(--mana-libro-file-label-text);
|
|
87
85
|
letter-spacing: 0;
|
|
88
86
|
line-height: 22px;
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
.libro-create-file-path {
|
|
92
|
-
color:
|
|
90
|
+
color: var(--mana-libro-file-text);
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
.libro-create-file-type-text {
|
|
96
94
|
margin-top: 8px;
|
|
97
|
-
color:
|
|
95
|
+
color: var(--mana-libro-file-text);
|
|
98
96
|
}
|
package/src/file/module.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FileTreeModule, ManaModule } from '@difizen/mana-app';
|
|
2
2
|
|
|
3
|
+
import { FileColorContribution } from './file-color-registry.js';
|
|
3
4
|
import { FileCommandContribution } from './file-command.js';
|
|
4
5
|
import { FileCreateModalContribution } from './file-create-modal-contribution.js';
|
|
5
6
|
import { FileCreateDirModalContribution } from './file-createdir-modal-contribution.js';
|
|
@@ -14,6 +15,7 @@ import { LibroJupyterOpenHandler } from './open-handler-contribution.js';
|
|
|
14
15
|
export const LibroJupyterFileModule = ManaModule.create()
|
|
15
16
|
.register(
|
|
16
17
|
JupyterFileService,
|
|
18
|
+
FileColorContribution,
|
|
17
19
|
FileView,
|
|
18
20
|
FileNameAlias,
|
|
19
21
|
FileTreeLabelProvider,
|