@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
|
@@ -21,8 +21,8 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
21
21
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
22
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
23
|
import { CellEditorMemo, LibroCodeCellView } from '@difizen/libro-code-cell';
|
|
24
|
+
import { getCellURI } from '@difizen/libro-common';
|
|
24
25
|
import { KernelError } from '@difizen/libro-kernel';
|
|
25
|
-
import { getCellURI } from '@difizen/libro-language-client';
|
|
26
26
|
import { transient } from '@difizen/mana-app';
|
|
27
27
|
import { view, ViewInstance } from '@difizen/mana-app';
|
|
28
28
|
import { getOrigin, useInject } from '@difizen/mana-app';
|
|
@@ -165,7 +165,7 @@ export var JupyterCodeCellView = (_dec = transient(), _dec2 = view('jupyter-code
|
|
|
165
165
|
key: "getEditorOption",
|
|
166
166
|
value: function getEditorOption() {
|
|
167
167
|
var options = _get(_getPrototypeOf(JupyterCodeCellView.prototype), "getEditorOption", this).call(this);
|
|
168
|
-
var uri = getCellURI(this.parent.model, this.model);
|
|
168
|
+
var uri = getCellURI(this.parent.model.filePath, this.model.id);
|
|
169
169
|
return _objectSpread(_objectSpread({}, options), {}, {
|
|
170
170
|
uuid: uri.toString(),
|
|
171
171
|
tooltipProvider: this.tooltipProvider,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ColorRegistry } from '@difizen/mana-app';
|
|
2
|
+
import { ColorContribution } from '@difizen/mana-app';
|
|
3
|
+
export declare class FileColorContribution implements ColorContribution {
|
|
4
|
+
registerColors(colors: ColorRegistry): void;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=file-color-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-color-registry.d.ts","sourceRoot":"","sources":["../../src/file/file-color-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAS,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,qBACa,qBAAsB,YAAW,iBAAiB;IAC7D,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;CAqB5C"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _dec, _class;
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
import { Color, ColorContribution } from '@difizen/mana-app';
|
|
9
|
+
import { singleton } from '@difizen/mana-app';
|
|
10
|
+
export var FileColorContribution = (_dec = singleton({
|
|
11
|
+
contrib: ColorContribution
|
|
12
|
+
}), _dec(_class = /*#__PURE__*/function () {
|
|
13
|
+
function FileColorContribution() {
|
|
14
|
+
_classCallCheck(this, FileColorContribution);
|
|
15
|
+
}
|
|
16
|
+
_createClass(FileColorContribution, [{
|
|
17
|
+
key: "registerColors",
|
|
18
|
+
value: function registerColors(colors) {
|
|
19
|
+
// common
|
|
20
|
+
colors.register(
|
|
21
|
+
// #region antd variable
|
|
22
|
+
{
|
|
23
|
+
id: 'libro.file.label.text',
|
|
24
|
+
defaults: {
|
|
25
|
+
dark: '#F8F8FB',
|
|
26
|
+
light: Color.rgba(0, 0, 0, 0.85)
|
|
27
|
+
},
|
|
28
|
+
description: ''
|
|
29
|
+
}, {
|
|
30
|
+
id: 'libro.file.text',
|
|
31
|
+
defaults: {
|
|
32
|
+
dark: '#E3E4E6',
|
|
33
|
+
light: Color.rgba(0, 0, 0, 0.65)
|
|
34
|
+
},
|
|
35
|
+
description: ''
|
|
36
|
+
}, {
|
|
37
|
+
id: 'libro.file.type.border',
|
|
38
|
+
defaults: {
|
|
39
|
+
dark: '#3B3C42',
|
|
40
|
+
light: Color.rgba(0, 10, 26, 0.1)
|
|
41
|
+
},
|
|
42
|
+
description: ''
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}]);
|
|
46
|
+
return FileColorContribution;
|
|
47
|
+
}()) || _class);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-create-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-create-modal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"file-create-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-create-modal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOnE,OAAO,cAAc,CAAC;AAWtB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,KAAK,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAEhE,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,aAAa,CAAC,CA4K5E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,aAAa,CAGpD,CAAC"}
|
|
@@ -8,9 +8,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
9
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import { ThemeService } from '@difizen/mana-app';
|
|
11
12
|
import { CommandRegistry } from '@difizen/mana-app';
|
|
12
13
|
import { URI, useInject, ViewManager } from '@difizen/mana-app';
|
|
13
|
-
import { Col, Form, message, Row, Input, Modal } from 'antd';
|
|
14
|
+
import { Col, Form, message, Row, Input, Modal, ConfigProvider, theme } from 'antd';
|
|
14
15
|
import { useEffect, useRef, useState } from 'react';
|
|
15
16
|
import "./index.less";
|
|
16
17
|
import { FileView, JSONIcon, JupyterFileService, MoreIcon, NotebookIcon, PythonIcon } from "./index.js";
|
|
@@ -32,6 +33,7 @@ export var FileCreateModalComponent = function FileCreateModalComponent(_ref) {
|
|
|
32
33
|
fileView = _useState4[0],
|
|
33
34
|
setFileView = _useState4[1];
|
|
34
35
|
var inputRef = useRef(null);
|
|
36
|
+
var themeService = useInject(ThemeService);
|
|
35
37
|
var _Form$useForm = Form.useForm(),
|
|
36
38
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
37
39
|
form = _Form$useForm2[0];
|
|
@@ -118,123 +120,128 @@ export var FileCreateModalComponent = function FileCreateModalComponent(_ref) {
|
|
|
118
120
|
});
|
|
119
121
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
120
122
|
});
|
|
121
|
-
return /*#__PURE__*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
onCancel: close,
|
|
125
|
-
width: 788,
|
|
126
|
-
cancelText: "\u53D6\u6D88",
|
|
127
|
-
okText: "\u786E\u5B9A",
|
|
128
|
-
onOk: function onOk() {
|
|
129
|
-
form.submit();
|
|
123
|
+
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
124
|
+
theme: {
|
|
125
|
+
algorithm: themeService.getCurrentTheme().type === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm
|
|
130
126
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
127
|
+
children: /*#__PURE__*/_jsxs(Modal, {
|
|
128
|
+
title: "\u65B0\u5EFA\u6587\u4EF6",
|
|
129
|
+
open: visible,
|
|
130
|
+
onCancel: close,
|
|
131
|
+
width: 788,
|
|
132
|
+
cancelText: "\u53D6\u6D88",
|
|
133
|
+
okText: "\u786E\u5B9A",
|
|
134
|
+
onOk: function onOk() {
|
|
135
|
+
form.submit();
|
|
136
|
+
},
|
|
137
|
+
keyboard: true,
|
|
138
|
+
wrapClassName: "libro-create-file-modal",
|
|
139
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
140
|
+
className: "libro-create-file-path-container",
|
|
141
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
142
|
+
className: "libro-create-file-des",
|
|
143
|
+
children: "\u521B\u5EFA\u4F4D\u7F6E\uFF1A"
|
|
144
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
145
|
+
className: "libro-create-file-path",
|
|
146
|
+
children: data === null || data === void 0 ? void 0 : data.path
|
|
147
|
+
})]
|
|
148
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
136
149
|
className: "libro-create-file-des",
|
|
137
|
-
children: "\
|
|
138
|
-
}), /*#__PURE__*/
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
children: "\u6587\u4EF6\u7C7B\u578B\uFF1A"
|
|
145
|
-
}), /*#__PURE__*/_jsxs(Row, {
|
|
146
|
-
children: [/*#__PURE__*/_jsx(Col, {
|
|
147
|
-
className: "gutter-row",
|
|
148
|
-
style: {
|
|
149
|
-
paddingLeft: 'unset',
|
|
150
|
-
paddingRight: '16px'
|
|
151
|
-
},
|
|
152
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
153
|
-
className: "libro-create-file-type ".concat(fileType === '.ipynb' ? 'active' : ''),
|
|
154
|
-
onClick: function onClick() {
|
|
155
|
-
var _inputRef$current2;
|
|
156
|
-
setFileType('.ipynb');
|
|
157
|
-
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
|
|
150
|
+
children: "\u6587\u4EF6\u7C7B\u578B\uFF1A"
|
|
151
|
+
}), /*#__PURE__*/_jsxs(Row, {
|
|
152
|
+
children: [/*#__PURE__*/_jsx(Col, {
|
|
153
|
+
className: "gutter-row",
|
|
154
|
+
style: {
|
|
155
|
+
paddingLeft: 'unset',
|
|
156
|
+
paddingRight: '16px'
|
|
158
157
|
},
|
|
159
|
-
children:
|
|
160
|
-
className: "libro-create-file-type
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
158
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
159
|
+
className: "libro-create-file-type ".concat(fileType === '.ipynb' ? 'active' : ''),
|
|
160
|
+
onClick: function onClick() {
|
|
161
|
+
var _inputRef$current2;
|
|
162
|
+
setFileType('.ipynb');
|
|
163
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || _inputRef$current2.focus();
|
|
164
|
+
},
|
|
165
|
+
children: [/*#__PURE__*/_jsx(NotebookIcon, {}), /*#__PURE__*/_jsx("span", {
|
|
166
|
+
className: "libro-create-file-type-text",
|
|
167
|
+
children: "Notebook"
|
|
168
|
+
})]
|
|
169
|
+
})
|
|
170
|
+
}), /*#__PURE__*/_jsx(Col, {
|
|
171
|
+
className: "gutter-row",
|
|
172
|
+
style: {
|
|
173
|
+
paddingLeft: 'unset',
|
|
174
|
+
paddingRight: '16px'
|
|
176
175
|
},
|
|
177
|
-
children:
|
|
178
|
-
className: "libro-create-file-type
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
176
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
177
|
+
className: "libro-create-file-type ".concat(fileType === '.py' ? 'active' : ''),
|
|
178
|
+
onClick: function onClick() {
|
|
179
|
+
var _inputRef$current3;
|
|
180
|
+
setFileType('.py');
|
|
181
|
+
(_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 || _inputRef$current3.focus();
|
|
182
|
+
},
|
|
183
|
+
children: [/*#__PURE__*/_jsx(PythonIcon, {}), /*#__PURE__*/_jsx("span", {
|
|
184
|
+
className: "libro-create-file-type-text",
|
|
185
|
+
children: "Python"
|
|
186
|
+
})]
|
|
187
|
+
})
|
|
188
|
+
}), /*#__PURE__*/_jsx(Col, {
|
|
189
|
+
className: "gutter-row",
|
|
190
|
+
style: {
|
|
191
|
+
paddingLeft: 'unset',
|
|
192
|
+
paddingRight: '16px'
|
|
194
193
|
},
|
|
195
|
-
children:
|
|
196
|
-
className: "libro-create-file-type
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
194
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
195
|
+
className: "libro-create-file-type ".concat(fileType === '.json' ? 'active' : ''),
|
|
196
|
+
onClick: function onClick() {
|
|
197
|
+
var _inputRef$current4;
|
|
198
|
+
setFileType('.json');
|
|
199
|
+
(_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 || _inputRef$current4.focus();
|
|
200
|
+
},
|
|
201
|
+
children: [/*#__PURE__*/_jsx(JSONIcon, {}), /*#__PURE__*/_jsx("span", {
|
|
202
|
+
className: "libro-create-file-type-text",
|
|
203
|
+
children: "JSON"
|
|
204
|
+
})]
|
|
205
|
+
})
|
|
206
|
+
}), /*#__PURE__*/_jsx(Col, {
|
|
207
|
+
className: "gutter-row",
|
|
208
|
+
style: {
|
|
209
|
+
paddingLeft: 'unset',
|
|
210
|
+
paddingRight: '16px'
|
|
212
211
|
},
|
|
213
|
-
children:
|
|
214
|
-
className: "libro-create-file-type
|
|
215
|
-
|
|
216
|
-
|
|
212
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
213
|
+
className: "libro-create-file-type ".concat(fileType === undefined ? 'active' : ''),
|
|
214
|
+
onClick: function onClick() {
|
|
215
|
+
var _inputRef$current5;
|
|
216
|
+
setFileType(undefined);
|
|
217
|
+
(_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 || _inputRef$current5.focus();
|
|
218
|
+
},
|
|
219
|
+
children: [/*#__PURE__*/_jsx(MoreIcon, {}), /*#__PURE__*/_jsx("span", {
|
|
220
|
+
className: "libro-create-file-type-text",
|
|
221
|
+
children: "\u5176\u4ED6"
|
|
222
|
+
})]
|
|
223
|
+
})
|
|
224
|
+
})]
|
|
225
|
+
}), /*#__PURE__*/_jsx(Form, {
|
|
226
|
+
layout: "vertical",
|
|
227
|
+
autoComplete: "off",
|
|
228
|
+
form: form,
|
|
229
|
+
onFinish: onFinish,
|
|
230
|
+
className: "libro-create-file-form",
|
|
231
|
+
children: /*#__PURE__*/_jsx(Form.Item, {
|
|
232
|
+
name: "fileName",
|
|
233
|
+
label: "\u6587\u4EF6\u540D\u79F0",
|
|
234
|
+
rules: [{
|
|
235
|
+
required: true,
|
|
236
|
+
validator: validateFileName
|
|
237
|
+
}],
|
|
238
|
+
children: /*#__PURE__*/_jsx(Input, {
|
|
239
|
+
addonAfter: fileType || '',
|
|
240
|
+
ref: inputRef
|
|
241
|
+
})
|
|
217
242
|
})
|
|
218
243
|
})]
|
|
219
|
-
})
|
|
220
|
-
layout: "vertical",
|
|
221
|
-
autoComplete: "off",
|
|
222
|
-
form: form,
|
|
223
|
-
onFinish: onFinish,
|
|
224
|
-
className: "libro-create-file-form",
|
|
225
|
-
children: /*#__PURE__*/_jsx(Form.Item, {
|
|
226
|
-
name: "fileName",
|
|
227
|
-
label: "\u6587\u4EF6\u540D\u79F0",
|
|
228
|
-
rules: [{
|
|
229
|
-
required: true,
|
|
230
|
-
validator: validateFileName
|
|
231
|
-
}],
|
|
232
|
-
children: /*#__PURE__*/_jsx(Input, {
|
|
233
|
-
addonAfter: fileType || '',
|
|
234
|
-
ref: inputRef
|
|
235
|
-
})
|
|
236
|
-
})
|
|
237
|
-
})]
|
|
244
|
+
})
|
|
238
245
|
});
|
|
239
246
|
};
|
|
240
247
|
export var FileCreateModal = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-createdir-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-createdir-modal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"file-createdir-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-createdir-modal.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAWnE,OAAO,cAAc,CAAC;AAEtB,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAChD,cAAc,CAAC,0BAA0B,CAAC,CA+F3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,0BAA0B,CAGpE,CAAC"}
|
|
@@ -8,10 +8,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
9
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import { ThemeService } from '@difizen/mana-app';
|
|
11
12
|
import { URI } from '@difizen/mana-app';
|
|
12
13
|
import { ViewManager } from '@difizen/mana-app';
|
|
13
14
|
import { useInject } from '@difizen/mana-app';
|
|
14
|
-
import { Form, message, Input, Modal } from 'antd';
|
|
15
|
+
import { Form, message, Input, Modal, ConfigProvider, theme } from 'antd';
|
|
15
16
|
import { useEffect, useRef, useState } from 'react';
|
|
16
17
|
import { JupyterFileService } from "./file-service.js";
|
|
17
18
|
import { FileView } from "./file-view/index.js";
|
|
@@ -24,6 +25,7 @@ export var FileCreateDirModalComponent = function FileCreateDirModalComponent(_r
|
|
|
24
25
|
data = _ref.data;
|
|
25
26
|
var fileService = useInject(JupyterFileService);
|
|
26
27
|
var viewManager = useInject(ViewManager);
|
|
28
|
+
var themeService = useInject(ThemeService);
|
|
27
29
|
var inputRef = useRef(null);
|
|
28
30
|
var _useState = useState(),
|
|
29
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -106,60 +108,65 @@ export var FileCreateDirModalComponent = function FileCreateDirModalComponent(_r
|
|
|
106
108
|
});
|
|
107
109
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
|
|
108
110
|
});
|
|
109
|
-
return /*#__PURE__*/
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
onCancel: close,
|
|
113
|
-
cancelText: "\u53D6\u6D88",
|
|
114
|
-
okText: "\u786E\u5B9A",
|
|
115
|
-
onOk: function onOk() {
|
|
116
|
-
form.submit();
|
|
111
|
+
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
112
|
+
theme: {
|
|
113
|
+
algorithm: themeService.getCurrentTheme().type === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm
|
|
117
114
|
},
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
115
|
+
children: /*#__PURE__*/_jsxs(Modal, {
|
|
116
|
+
title: "\u65B0\u5EFA\u6587\u4EF6\u5939",
|
|
117
|
+
open: visible,
|
|
118
|
+
onCancel: close,
|
|
119
|
+
cancelText: "\u53D6\u6D88",
|
|
120
|
+
okText: "\u786E\u5B9A",
|
|
121
|
+
onOk: function onOk() {
|
|
122
|
+
form.submit();
|
|
123
|
+
},
|
|
124
|
+
keyboard: true,
|
|
125
|
+
wrapClassName: "libro-create-dir-modal",
|
|
126
|
+
width: 524,
|
|
127
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
128
|
+
className: "libro-create-file-des",
|
|
129
|
+
children: "\u521B\u5EFA\u4F4D\u7F6E\uFF1A"
|
|
130
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
131
|
+
className: "libro-create-file-path",
|
|
132
|
+
children: data === null || data === void 0 ? void 0 : data.path
|
|
133
|
+
}), /*#__PURE__*/_jsx(Form, {
|
|
134
|
+
layout: "vertical",
|
|
135
|
+
autoComplete: "off",
|
|
136
|
+
form: form,
|
|
137
|
+
onFinish: onFinish,
|
|
138
|
+
className: "libro-create-dir-file-form",
|
|
139
|
+
children: /*#__PURE__*/_jsx(Form.Item, {
|
|
140
|
+
name: "dirName",
|
|
141
|
+
label: "\u6587\u4EF6\u5939\u540D\u79F0",
|
|
142
|
+
rules: [{
|
|
143
|
+
required: true,
|
|
144
|
+
validator: validateDirName
|
|
145
|
+
}],
|
|
146
|
+
children: /*#__PURE__*/_jsx(Input, {
|
|
147
|
+
ref: inputRef,
|
|
148
|
+
onKeyDown: ( /*#__PURE__*/function () {
|
|
149
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e) {
|
|
150
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
151
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
152
|
+
case 0:
|
|
153
|
+
if (e.keyCode === 13) {
|
|
154
|
+
form.submit();
|
|
155
|
+
}
|
|
156
|
+
case 1:
|
|
157
|
+
case "end":
|
|
158
|
+
return _context3.stop();
|
|
159
|
+
}
|
|
160
|
+
}, _callee3);
|
|
161
|
+
}));
|
|
162
|
+
return function (_x5) {
|
|
163
|
+
return _ref4.apply(this, arguments);
|
|
164
|
+
};
|
|
165
|
+
}())
|
|
166
|
+
})
|
|
160
167
|
})
|
|
161
|
-
})
|
|
162
|
-
})
|
|
168
|
+
})]
|
|
169
|
+
})
|
|
163
170
|
});
|
|
164
171
|
};
|
|
165
172
|
export var FileDirCreateModal = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-rename-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-rename-modal.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAOxE,OAAO,cAAc,CAAC;AAEtB,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"file-rename-modal.d.ts","sourceRoot":"","sources":["../../src/file/file-rename-modal.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAOxE,OAAO,cAAc,CAAC;AAEtB,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,aAAa,CAAC,CA6F5E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,aAAa,CAGpD,CAAC"}
|
|
@@ -8,8 +8,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
9
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
import { useInject, ViewManager } from '@difizen/mana-app';
|
|
12
|
-
import { Form, message, Input, Modal } from 'antd';
|
|
11
|
+
import { ThemeService, useInject, ViewManager } from '@difizen/mana-app';
|
|
12
|
+
import { Form, message, Input, Modal, theme, ConfigProvider } from 'antd';
|
|
13
13
|
import { useEffect, useRef, useState } from 'react';
|
|
14
14
|
import { JupyterFileService } from "./file-service.js";
|
|
15
15
|
import { FileView } from "./file-view/index.js";
|
|
@@ -29,6 +29,7 @@ export var FileRenameModalComponent = function FileRenameModalComponent(_ref) {
|
|
|
29
29
|
_useState2 = _slicedToArray(_useState, 2),
|
|
30
30
|
fileView = _useState2[0],
|
|
31
31
|
setFileView = _useState2[1];
|
|
32
|
+
var themeService = useInject(ThemeService);
|
|
32
33
|
useEffect(function () {
|
|
33
34
|
var _inputRef$current;
|
|
34
35
|
viewManager.getOrCreateView(FileView).then(function (view) {
|
|
@@ -102,48 +103,53 @@ export var FileRenameModalComponent = function FileRenameModalComponent(_ref) {
|
|
|
102
103
|
return _ref3.apply(this, arguments);
|
|
103
104
|
};
|
|
104
105
|
}();
|
|
105
|
-
return /*#__PURE__*/_jsx(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
onCancel: close,
|
|
109
|
-
onOk: function onOk() {
|
|
110
|
-
form.submit();
|
|
106
|
+
return /*#__PURE__*/_jsx(ConfigProvider, {
|
|
107
|
+
theme: {
|
|
108
|
+
algorithm: themeService.getCurrentTheme().type === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm
|
|
111
109
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
110
|
+
children: /*#__PURE__*/_jsx(Modal, {
|
|
111
|
+
title: "\u6587\u4EF6\u91CD\u547D\u540D",
|
|
112
|
+
open: visible,
|
|
113
|
+
onCancel: close,
|
|
114
|
+
onOk: function onOk() {
|
|
115
|
+
form.submit();
|
|
116
|
+
},
|
|
117
|
+
wrapClassName: "libro-rename-file-modal",
|
|
118
|
+
children: /*#__PURE__*/_jsx(Form, {
|
|
119
|
+
layout: "vertical",
|
|
120
|
+
autoComplete: "off",
|
|
121
|
+
form: form,
|
|
122
|
+
onFinish: onFinish,
|
|
123
|
+
className: "libro-rename-file-form",
|
|
124
|
+
children: /*#__PURE__*/_jsx(Form.Item, {
|
|
125
|
+
name: "rename",
|
|
126
|
+
label: "\u6587\u4EF6/\u6587\u4EF6\u5939\u540D\u79F0",
|
|
127
|
+
rules: [{
|
|
128
|
+
required: true,
|
|
129
|
+
validator: validateRename
|
|
130
|
+
}],
|
|
131
|
+
initialValue: data === null || data === void 0 ? void 0 : data.fileName,
|
|
132
|
+
children: /*#__PURE__*/_jsx(Input, {
|
|
133
|
+
ref: inputRef,
|
|
134
|
+
onKeyDown: ( /*#__PURE__*/function () {
|
|
135
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(e) {
|
|
136
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
137
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
138
|
+
case 0:
|
|
139
|
+
if (e.keyCode === 13) {
|
|
140
|
+
form.submit();
|
|
141
|
+
}
|
|
142
|
+
case 1:
|
|
143
|
+
case "end":
|
|
144
|
+
return _context3.stop();
|
|
145
|
+
}
|
|
146
|
+
}, _callee3);
|
|
147
|
+
}));
|
|
148
|
+
return function (_x5) {
|
|
149
|
+
return _ref4.apply(this, arguments);
|
|
150
|
+
};
|
|
151
|
+
}())
|
|
152
|
+
})
|
|
147
153
|
})
|
|
148
154
|
})
|
|
149
155
|
})
|