@difizen/libro-jupyter 0.1.0 → 0.1.1
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/components/icons.d.ts +5 -0
- package/es/components/icons.d.ts.map +1 -0
- package/es/components/index.less +1 -0
- package/es/config/config.d.ts +3 -0
- package/es/config/config.d.ts.map +1 -0
- package/es/configuration/index.d.ts +3 -0
- package/es/configuration/index.d.ts.map +1 -0
- package/es/configuration/libro-configuration-contribution.d.ts +5 -0
- package/es/configuration/libro-configuration-contribution.d.ts.map +1 -0
- package/es/configuration/libro-configuration.d.ts +3 -0
- package/es/configuration/libro-configuration.d.ts.map +1 -0
- package/es/file/file-command.d.ts +1 -0
- package/es/file/file-command.d.ts.map +1 -1
- package/es/file/file-command.js +14 -6
- package/es/file/file-create-modal.d.ts +5 -1
- package/es/file/file-create-modal.d.ts.map +1 -1
- package/es/file/file-create-modal.js +178 -56
- package/es/file/file-createdir-modal-contribution.d.ts +1 -1
- package/es/file/file-createdir-modal.d.ts +4 -3
- package/es/file/file-createdir-modal.d.ts.map +1 -1
- package/es/file/file-createdir-modal.js +122 -59
- package/es/file/file-icon.d.ts +11 -0
- package/es/file/file-icon.d.ts.map +1 -0
- package/es/file/file-icon.js +475 -0
- package/es/file/file-name-alias.d.ts +7 -0
- package/es/file/file-name-alias.d.ts.map +1 -0
- package/es/file/file-protocol.d.ts +14 -0
- package/es/file/file-protocol.d.ts.map +1 -0
- package/es/file/file-rename-modal.d.ts +1 -0
- package/es/file/file-rename-modal.d.ts.map +1 -1
- package/es/file/file-rename-modal.js +100 -25
- package/es/file/file-tree-label-provider.d.ts +13 -0
- package/es/file/file-tree-label-provider.d.ts.map +1 -0
- package/es/file/index.d.ts +3 -0
- package/es/file/index.d.ts.map +1 -1
- package/es/file/index.js +4 -1
- package/es/file/index.less +98 -0
- package/es/file/navigatable-view.d.ts +7 -5
- package/es/file/navigatable-view.d.ts.map +1 -1
- package/es/file/navigatable-view.js +14 -3
- package/es/file/utils.d.ts +2 -0
- package/es/file/utils.d.ts.map +1 -0
- package/es/keybind-instructions/keybind-instructions-items.d.ts +14 -0
- package/es/keybind-instructions/keybind-instructions-items.d.ts.map +1 -0
- package/es/theme/color-registry.d.ts +6 -0
- package/es/theme/color-registry.d.ts.map +1 -0
- package/es/theme/index.d.ts +2 -0
- package/es/theme/index.d.ts.map +1 -0
- package/package.json +14 -14
- package/src/components/index.less +1 -0
- package/src/file/file-command.tsx +11 -6
- package/src/file/file-create-modal.tsx +129 -26
- package/src/file/file-createdir-modal.tsx +64 -32
- package/src/file/file-icon.tsx +502 -0
- package/src/file/file-rename-modal.tsx +55 -16
- package/src/file/index.less +98 -0
- package/src/file/index.ts +3 -0
- package/src/file/navigatable-view.tsx +23 -6
|
@@ -11,12 +11,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
11
11
|
import { URI } from '@difizen/mana-app';
|
|
12
12
|
import { ViewManager } from '@difizen/mana-app';
|
|
13
13
|
import { useInject } from '@difizen/mana-app';
|
|
14
|
-
import { Input } from 'antd';
|
|
15
|
-
import { Modal } from 'antd';
|
|
14
|
+
import { Form, message, Input, Modal } from 'antd';
|
|
16
15
|
import { useEffect, useRef, useState } from 'react';
|
|
17
16
|
import { JupyterFileService } from "./file-service.js";
|
|
18
17
|
import { FileView } from "./file-view/index.js";
|
|
18
|
+
import "./index.less";
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
21
|
export var FileCreateDirModalComponent = function FileCreateDirModalComponent(_ref) {
|
|
21
22
|
var visible = _ref.visible,
|
|
22
23
|
close = _ref.close,
|
|
@@ -24,14 +25,77 @@ export var FileCreateDirModalComponent = function FileCreateDirModalComponent(_r
|
|
|
24
25
|
var fileService = useInject(JupyterFileService);
|
|
25
26
|
var viewManager = useInject(ViewManager);
|
|
26
27
|
var inputRef = useRef(null);
|
|
27
|
-
var _useState = useState(
|
|
28
|
+
var _useState = useState(),
|
|
28
29
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
fileView = _useState2[0],
|
|
31
|
+
setFileView = _useState2[1];
|
|
32
|
+
var _Form$useForm = Form.useForm(),
|
|
33
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
34
|
+
form = _Form$useForm2[0];
|
|
35
|
+
var onFinish = /*#__PURE__*/function () {
|
|
36
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
|
|
37
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
38
|
+
while (1) switch (_context.prev = _context.next) {
|
|
39
|
+
case 0:
|
|
40
|
+
_context.next = 2;
|
|
41
|
+
return form.validateFields();
|
|
42
|
+
case 2:
|
|
43
|
+
close();
|
|
44
|
+
_context.prev = 3;
|
|
45
|
+
_context.next = 6;
|
|
46
|
+
return fileService.newFileDir(values.dirName, new URI(data.path));
|
|
47
|
+
case 6:
|
|
48
|
+
if (fileView) {
|
|
49
|
+
fileView.model.refresh();
|
|
50
|
+
}
|
|
51
|
+
_context.next = 12;
|
|
52
|
+
break;
|
|
53
|
+
case 9:
|
|
54
|
+
_context.prev = 9;
|
|
55
|
+
_context.t0 = _context["catch"](3);
|
|
56
|
+
message.error('新建文件夹失败');
|
|
57
|
+
case 12:
|
|
58
|
+
case "end":
|
|
59
|
+
return _context.stop();
|
|
60
|
+
}
|
|
61
|
+
}, _callee, null, [[3, 9]]);
|
|
62
|
+
}));
|
|
63
|
+
return function onFinish(_x) {
|
|
64
|
+
return _ref2.apply(this, arguments);
|
|
65
|
+
};
|
|
66
|
+
}();
|
|
67
|
+
var validateDirName = /*#__PURE__*/function () {
|
|
68
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(rule, value, callback) {
|
|
69
|
+
var targetURI, fileRes;
|
|
70
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
71
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
if (!(!value || !value.length)) {
|
|
74
|
+
_context2.next = 4;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
throw new Error('请输入文件夹名');
|
|
78
|
+
case 4:
|
|
79
|
+
targetURI = new URI(data.path + value);
|
|
80
|
+
_context2.next = 7;
|
|
81
|
+
return fileService.resolve(targetURI);
|
|
82
|
+
case 7:
|
|
83
|
+
fileRes = _context2.sent;
|
|
84
|
+
if (!fileRes.isDirectory) {
|
|
85
|
+
_context2.next = 10;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
throw new Error('文件夹名称已存在,请重新输入');
|
|
89
|
+
case 10:
|
|
90
|
+
case "end":
|
|
91
|
+
return _context2.stop();
|
|
92
|
+
}
|
|
93
|
+
}, _callee2);
|
|
94
|
+
}));
|
|
95
|
+
return function validateDirName(_x2, _x3, _x4) {
|
|
96
|
+
return _ref3.apply(this, arguments);
|
|
97
|
+
};
|
|
98
|
+
}();
|
|
35
99
|
useEffect(function () {
|
|
36
100
|
var _inputRef$current;
|
|
37
101
|
viewManager.getOrCreateView(FileView).then(function (view) {
|
|
@@ -42,61 +106,60 @@ export var FileCreateDirModalComponent = function FileCreateDirModalComponent(_r
|
|
|
42
106
|
});
|
|
43
107
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
44
108
|
});
|
|
45
|
-
return /*#__PURE__*/
|
|
109
|
+
return /*#__PURE__*/_jsxs(Modal, {
|
|
46
110
|
title: "\u65B0\u5EFA\u6587\u4EF6\u5939",
|
|
47
111
|
open: visible,
|
|
48
112
|
onCancel: close,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return fileService.newFileDir(dirName, new URI(data.path));
|
|
55
|
-
case 2:
|
|
56
|
-
if (fileView) {
|
|
57
|
-
fileView.model.refresh();
|
|
58
|
-
}
|
|
59
|
-
close();
|
|
60
|
-
case 4:
|
|
61
|
-
case "end":
|
|
62
|
-
return _context.stop();
|
|
63
|
-
}
|
|
64
|
-
}, _callee);
|
|
65
|
-
})),
|
|
113
|
+
cancelText: "\u53D6\u6D88",
|
|
114
|
+
okText: "\u786E\u5B9A",
|
|
115
|
+
onOk: function onOk() {
|
|
116
|
+
form.submit();
|
|
117
|
+
},
|
|
66
118
|
keyboard: true,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
119
|
+
wrapClassName: "libro-create-dir-modal",
|
|
120
|
+
width: 524,
|
|
121
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
122
|
+
className: "libro-create-file-des",
|
|
123
|
+
children: "\u521B\u5EFA\u4F4D\u7F6E\uFF1A"
|
|
124
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
125
|
+
className: "libro-create-file-path",
|
|
126
|
+
children: data.path
|
|
127
|
+
}), /*#__PURE__*/_jsx(Form, {
|
|
128
|
+
layout: "vertical",
|
|
129
|
+
autoComplete: "off",
|
|
130
|
+
form: form,
|
|
131
|
+
onFinish: onFinish,
|
|
132
|
+
className: "libro-create-dir-file-form",
|
|
133
|
+
children: /*#__PURE__*/_jsx(Form.Item, {
|
|
134
|
+
name: "dirName",
|
|
135
|
+
label: "\u6587\u4EF6\u5939\u540D\u79F0",
|
|
136
|
+
rules: [{
|
|
137
|
+
required: true,
|
|
138
|
+
validator: validateDirName
|
|
139
|
+
}],
|
|
140
|
+
children: /*#__PURE__*/_jsx(Input, {
|
|
141
|
+
ref: inputRef,
|
|
142
|
+
onKeyDown: /*#__PURE__*/function () {
|
|
143
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e) {
|
|
144
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
145
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
146
|
+
case 0:
|
|
147
|
+
if (e.keyCode === 13) {
|
|
148
|
+
form.submit();
|
|
149
|
+
}
|
|
150
|
+
case 1:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context3.stop();
|
|
81
153
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return _context2.stop();
|
|
92
|
-
}
|
|
93
|
-
}, _callee2);
|
|
94
|
-
}));
|
|
95
|
-
return function (_x) {
|
|
96
|
-
return _ref3.apply(this, arguments);
|
|
97
|
-
};
|
|
98
|
-
}()
|
|
99
|
-
})
|
|
154
|
+
}, _callee3);
|
|
155
|
+
}));
|
|
156
|
+
return function (_x5) {
|
|
157
|
+
return _ref4.apply(this, arguments);
|
|
158
|
+
};
|
|
159
|
+
}()
|
|
160
|
+
})
|
|
161
|
+
})
|
|
162
|
+
})]
|
|
100
163
|
});
|
|
101
164
|
};
|
|
102
165
|
export var FileDirCreateModal = {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface IProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
width?: string;
|
|
4
|
+
height?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function NotebookIcon(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function SQLIcon(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function JSONIcon(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function PythonIcon(props: IProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function MoreIcon(prop: IProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=file-icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-icon.d.ts","sourceRoot":"","sources":["../../src/file/file-icon.tsx"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,2CA6BzC;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,2CA6BpC;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,2CA8DrC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,2CA8CvC;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,2CAiUpC"}
|