@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.
Files changed (58) hide show
  1. package/es/components/icons.d.ts +5 -0
  2. package/es/components/icons.d.ts.map +1 -0
  3. package/es/components/index.less +1 -0
  4. package/es/config/config.d.ts +3 -0
  5. package/es/config/config.d.ts.map +1 -0
  6. package/es/configuration/index.d.ts +3 -0
  7. package/es/configuration/index.d.ts.map +1 -0
  8. package/es/configuration/libro-configuration-contribution.d.ts +5 -0
  9. package/es/configuration/libro-configuration-contribution.d.ts.map +1 -0
  10. package/es/configuration/libro-configuration.d.ts +3 -0
  11. package/es/configuration/libro-configuration.d.ts.map +1 -0
  12. package/es/file/file-command.d.ts +1 -0
  13. package/es/file/file-command.d.ts.map +1 -1
  14. package/es/file/file-command.js +14 -6
  15. package/es/file/file-create-modal.d.ts +5 -1
  16. package/es/file/file-create-modal.d.ts.map +1 -1
  17. package/es/file/file-create-modal.js +178 -56
  18. package/es/file/file-createdir-modal-contribution.d.ts +1 -1
  19. package/es/file/file-createdir-modal.d.ts +4 -3
  20. package/es/file/file-createdir-modal.d.ts.map +1 -1
  21. package/es/file/file-createdir-modal.js +122 -59
  22. package/es/file/file-icon.d.ts +11 -0
  23. package/es/file/file-icon.d.ts.map +1 -0
  24. package/es/file/file-icon.js +475 -0
  25. package/es/file/file-name-alias.d.ts +7 -0
  26. package/es/file/file-name-alias.d.ts.map +1 -0
  27. package/es/file/file-protocol.d.ts +14 -0
  28. package/es/file/file-protocol.d.ts.map +1 -0
  29. package/es/file/file-rename-modal.d.ts +1 -0
  30. package/es/file/file-rename-modal.d.ts.map +1 -1
  31. package/es/file/file-rename-modal.js +100 -25
  32. package/es/file/file-tree-label-provider.d.ts +13 -0
  33. package/es/file/file-tree-label-provider.d.ts.map +1 -0
  34. package/es/file/index.d.ts +3 -0
  35. package/es/file/index.d.ts.map +1 -1
  36. package/es/file/index.js +4 -1
  37. package/es/file/index.less +98 -0
  38. package/es/file/navigatable-view.d.ts +7 -5
  39. package/es/file/navigatable-view.d.ts.map +1 -1
  40. package/es/file/navigatable-view.js +14 -3
  41. package/es/file/utils.d.ts +2 -0
  42. package/es/file/utils.d.ts.map +1 -0
  43. package/es/keybind-instructions/keybind-instructions-items.d.ts +14 -0
  44. package/es/keybind-instructions/keybind-instructions-items.d.ts.map +1 -0
  45. package/es/theme/color-registry.d.ts +6 -0
  46. package/es/theme/color-registry.d.ts.map +1 -0
  47. package/es/theme/index.d.ts +2 -0
  48. package/es/theme/index.d.ts.map +1 -0
  49. package/package.json +14 -14
  50. package/src/components/index.less +1 -0
  51. package/src/file/file-command.tsx +11 -6
  52. package/src/file/file-create-modal.tsx +129 -26
  53. package/src/file/file-createdir-modal.tsx +64 -32
  54. package/src/file/file-icon.tsx +502 -0
  55. package/src/file/file-rename-modal.tsx +55 -16
  56. package/src/file/index.less +98 -0
  57. package/src/file/index.ts +3 -0
  58. package/src/file/navigatable-view.tsx +23 -6
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export declare const InfoCircle: React.FC;
3
+ export declare const WarningIcon: React.FC;
4
+ export declare const Location: React.FC;
5
+ //# sourceMappingURL=icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/components/icons.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EA4C9B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAuC/B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EA2B5B,CAAC"}
@@ -20,6 +20,7 @@
20
20
  }
21
21
 
22
22
  p {
23
+ margin: 0;
23
24
  width: calc(100% - 56px);
24
25
  white-space: nowrap;
25
26
  overflow: hidden;
@@ -0,0 +1,3 @@
1
+ import type { ConfigurationNode } from '@difizen/mana-app';
2
+ export declare const LibroAutosaveSetting: ConfigurationNode<boolean>;
3
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG3D,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,OAAO,CAU3D,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './libro-configuration.js';
2
+ export * from './libro-configuration-contribution.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/configuration/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,uCAAuC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ConfigurationContribution } from '@difizen/mana-app';
2
+ export declare class LibroConfigurationContribution implements ConfigurationContribution {
3
+ registerConfigurations(): import("@difizen/mana-app").ConfigurationNode<string>[];
4
+ }
5
+ //# sourceMappingURL=libro-configuration-contribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"libro-configuration-contribution.d.ts","sourceRoot":"","sources":["../../src/configuration/libro-configuration-contribution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAK9D,qBACa,8BAA+B,YAAW,yBAAyB;IAC9E,sBAAsB;CAGvB"}
@@ -0,0 +1,3 @@
1
+ import type { ConfigurationNode } from '@difizen/mana-app';
2
+ export declare const LibroJupyterConfiguration: Record<string, ConfigurationNode<string>>;
3
+ //# sourceMappingURL=libro-configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"libro-configuration.d.ts","sourceRoot":"","sources":["../../src/configuration/libro-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAW/E,CAAC"}
@@ -3,6 +3,7 @@ import { ViewManager } from '@difizen/mana-app';
3
3
  import { CommandContribution, FileStatNode, MenuContribution, ModalService, OpenerService, ToolbarContribution } from '@difizen/mana-app';
4
4
  import { JupyterFileService } from './file-service.js';
5
5
  import { FileView } from './file-view/index.js';
6
+ import './index.less';
6
7
  export declare const FileTreeContextMenuPath: MenuPath;
7
8
  export declare class FileCommandContribution implements CommandContribution, MenuContribution, ToolbarContribution {
8
9
  protected viewManager: ViewManager;
@@ -1 +1 @@
1
- {"version":3,"file":"file-command.d.ts","sourceRoot":"","sources":["../../src/file/file-command.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,YAAY,EAGZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EAEb,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AA6ChD,eAAO,MAAM,uBAAuB,EAAE,QAAqC,CAAC;AAE5E,qBAGa,uBACX,YAAW,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB;IAErE,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACP,WAAW,EAAE,kBAAkB,CAAC;IACtC,YAAY,EAAE,YAAY,CAAC;IAC1B,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC;IAC5D,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;IAC3B,cAAc,EAAE,YAAY,CAAC;gBAEI,WAAW,EAAE,WAAW;IAazD,aAAa,CAAC,IAAI,EAAE,YAAY;IA+ChC,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAkKhD,oBAAoB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;CAQ7D"}
1
+ {"version":3,"file":"file-command.d.ts","sourceRoot":"","sources":["../../src/file/file-command.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,mBAAmB,EACnB,YAAY,EAGZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EAEb,mBAAmB,EAEpB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,cAAc,CAAC;AA4CtB,eAAO,MAAM,uBAAuB,EAAE,QAAqC,CAAC;AAE5E,qBAGa,uBACX,YAAW,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB;IAErE,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACP,WAAW,EAAE,kBAAkB,CAAC;IACtC,YAAY,EAAE,YAAY,CAAC;IAC1B,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC;IAC5D,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;IAC3B,cAAc,EAAE,YAAY,CAAC;gBAEI,WAAW,EAAE,WAAW;IAazD,aAAa,CAAC,IAAI,EAAE,YAAY;IA+ChC,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAsKhD,oBAAoB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;CAQ7D"}
@@ -22,6 +22,7 @@ import { FileRenameModal } from "./file-rename-modal.js";
22
22
  import { JupyterFileService } from "./file-service.js";
23
23
  import { FileView } from "./file-view/index.js";
24
24
  import { copy2clipboard } from "./utils.js";
25
+ import "./index.less";
25
26
  import { jsx as _jsx } from "react/jsx-runtime";
26
27
  var FileCommands = {
27
28
  OPEN_FILE: {
@@ -171,8 +172,12 @@ export var FileCommandContribution = (_dec = singleton({
171
172
  if (FileStatNode.is(node)) {
172
173
  var filePath = node.uri.path.toString();
173
174
  Modal.confirm({
174
- title: '确认删除一下文件或文件夹?',
175
- content: filePath,
175
+ width: 424,
176
+ title: '确认要删除这个文件/文件夹吗?',
177
+ content: "\u8BF7\u786E\u8BA4\u662F\u5426\u5220\u9664\u6587\u4EF6 ".concat(filePath, " \uFF0C\u5220\u9664\u540E\u5C06\u4E0D\u53EF\u6062\u590D\uFF0C\u8BF7\u8C28\u614E\u64CD\u4F5C\u3002"),
178
+ wrapClassName: 'libro-remove-file-modal',
179
+ cancelText: '取消',
180
+ okText: '确定',
176
181
  onOk: function () {
177
182
  var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
178
183
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -309,11 +314,12 @@ export var FileCommandContribution = (_dec = singleton({
309
314
  command.registerCommand(FileCommands.CREATE_FILE, {
310
315
  execute: function () {
311
316
  var _execute3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {
317
+ var _this2$fileView$model;
312
318
  var path;
313
319
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
314
320
  while (1) switch (_context4.prev = _context4.next) {
315
321
  case 0:
316
- path = '/workspace';
322
+ path = ((_this2$fileView$model = _this2.fileView.model.location) === null || _this2$fileView$model === void 0 ? void 0 : _this2$fileView$model.path.toString()) || '/';
317
323
  if (FileStatNode.is(data)) {
318
324
  path = data.fileStat.isDirectory ? data.uri.path.toString() : data.uri.path.dir.toString();
319
325
  }
@@ -335,11 +341,12 @@ export var FileCommandContribution = (_dec = singleton({
335
341
  command.registerCommand(FileCommands.CREATE_DIR, {
336
342
  execute: function () {
337
343
  var _execute4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data) {
344
+ var _this2$fileView$model2;
338
345
  var path;
339
346
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
340
347
  while (1) switch (_context5.prev = _context5.next) {
341
348
  case 0:
342
- path = '/workspace';
349
+ path = ((_this2$fileView$model2 = _this2.fileView.model.location) === null || _this2$fileView$model2 === void 0 ? void 0 : _this2$fileView$model2.path.toString()) || '/';
343
350
  if (FileStatNode.is(data)) {
344
351
  path = data.fileStat.isDirectory ? data.uri.path.toString() : data.uri.path.dir.toString();
345
352
  }
@@ -361,11 +368,12 @@ export var FileCommandContribution = (_dec = singleton({
361
368
  command.registerCommand(FileCommands.COPY_PATH, {
362
369
  execute: function () {
363
370
  var _execute5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(data) {
371
+ var _this2$fileView$model3;
364
372
  var path;
365
373
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
366
374
  while (1) switch (_context6.prev = _context6.next) {
367
375
  case 0:
368
- path = '/workspace';
376
+ path = ((_this2$fileView$model3 = _this2.fileView.model.location) === null || _this2$fileView$model3 === void 0 ? void 0 : _this2$fileView$model3.path.toString()) || '/';
369
377
  if (FileStatNode.is(data)) {
370
378
  path = data.uri.path.toString();
371
379
  }
@@ -391,7 +399,7 @@ export var FileCommandContribution = (_dec = singleton({
391
399
  case 0:
392
400
  relative = '';
393
401
  if (FileStatNode.is(data)) {
394
- relative = pathUtil.relative('/workspace', data.uri.path.toString());
402
+ relative = pathUtil.relative('/', data.uri.path.toString());
395
403
  }
396
404
  copy2clipboard(relative);
397
405
  case 3:
@@ -1,8 +1,12 @@
1
1
  /// <reference types="react" resolution-mode="require"/>
2
- import type { ModalItem, ModalItemProps } from '@difizen/mana-app';
2
+ import type { ModalItemProps, ModalItem } from '@difizen/mana-app';
3
+ import './index.less';
3
4
  export interface ModalItemType {
4
5
  path: string;
6
+ fileType?: FileType;
5
7
  }
8
+ type FileType = '.ipynb' | '.py' | '.json' | '.sql' | undefined;
6
9
  export declare const FileCreateModalComponent: React.FC<ModalItemProps<ModalItemType>>;
7
10
  export declare const FileCreateModal: ModalItem<ModalItemType>;
11
+ export {};
8
12
  //# sourceMappingURL=file-create-modal.d.ts.map
@@ -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,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQnE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,aAAa,CAAC,CAuD5E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,aAAa,CAGpD,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;AAKnE,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,CAmJ5E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,aAAa,CAGpD,CAAC"}
@@ -9,25 +9,94 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
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
11
  import { URI, useInject, ViewManager } from '@difizen/mana-app';
12
- import { Input, Modal } from 'antd';
12
+ import { Col, Form, message, Row, Input, Modal } from 'antd';
13
13
  import { useEffect, useRef, useState } from 'react';
14
- import { FileView, JupyterFileService } from "./index.js";
14
+ import "./index.less";
15
+ import { FileView, JSONIcon, JupyterFileService, MoreIcon, NotebookIcon, PythonIcon } from "./index.js";
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { jsxs as _jsxs } from "react/jsx-runtime";
16
18
  export var FileCreateModalComponent = function FileCreateModalComponent(_ref) {
17
19
  var visible = _ref.visible,
18
20
  close = _ref.close,
19
21
  data = _ref.data;
20
22
  var fileService = useInject(JupyterFileService);
21
23
  var viewManager = useInject(ViewManager);
22
- var _useState = useState(''),
24
+ var _useState = useState(data.fileType),
23
25
  _useState2 = _slicedToArray(_useState, 2),
24
- newFileName = _useState2[0],
25
- setNewFileName = _useState2[1];
26
+ fileType = _useState2[0],
27
+ setFileType = _useState2[1];
26
28
  var _useState3 = useState(),
27
29
  _useState4 = _slicedToArray(_useState3, 2),
28
30
  fileView = _useState4[0],
29
31
  setFileView = _useState4[1];
30
32
  var inputRef = useRef(null);
33
+ var _Form$useForm = Form.useForm(),
34
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
35
+ form = _Form$useForm2[0];
36
+ var onFinish = /*#__PURE__*/function () {
37
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
38
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
39
+ while (1) switch (_context.prev = _context.next) {
40
+ case 0:
41
+ _context.next = 2;
42
+ return form.validateFields();
43
+ case 2:
44
+ close();
45
+ _context.prev = 3;
46
+ _context.next = 6;
47
+ return fileService.newFile(values.fileName + fileType || '', new URI(data.path));
48
+ case 6:
49
+ if (fileView) {
50
+ fileView.model.refresh();
51
+ }
52
+ _context.next = 12;
53
+ break;
54
+ case 9:
55
+ _context.prev = 9;
56
+ _context.t0 = _context["catch"](3);
57
+ message.error('新建文件失败');
58
+ case 12:
59
+ case "end":
60
+ return _context.stop();
61
+ }
62
+ }, _callee, null, [[3, 9]]);
63
+ }));
64
+ return function onFinish(_x) {
65
+ return _ref2.apply(this, arguments);
66
+ };
67
+ }();
68
+ var validateFileName = /*#__PURE__*/function () {
69
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(rule, value, callback) {
70
+ var targetURI, fileRes;
71
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
72
+ while (1) switch (_context2.prev = _context2.next) {
73
+ case 0:
74
+ if (!(!value || !value.length)) {
75
+ _context2.next = 4;
76
+ break;
77
+ }
78
+ throw new Error('请输入文件名');
79
+ case 4:
80
+ targetURI = new URI(data.path + value + (fileType || ''));
81
+ _context2.next = 7;
82
+ return fileService.resolve(targetURI);
83
+ case 7:
84
+ fileRes = _context2.sent;
85
+ if (!fileRes.isFile) {
86
+ _context2.next = 10;
87
+ break;
88
+ }
89
+ throw new Error('文件名称已存在,请重新输入');
90
+ case 10:
91
+ case "end":
92
+ return _context2.stop();
93
+ }
94
+ }, _callee2);
95
+ }));
96
+ return function validateFileName(_x2, _x3, _x4) {
97
+ return _ref3.apply(this, arguments);
98
+ };
99
+ }();
31
100
  useEffect(function () {
32
101
  var _inputRef$current;
33
102
  viewManager.getOrCreateView(FileView).then(function (view) {
@@ -38,61 +107,114 @@ export var FileCreateModalComponent = function FileCreateModalComponent(_ref) {
38
107
  });
39
108
  (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
40
109
  });
41
- return /*#__PURE__*/_jsx(Modal, {
110
+ return /*#__PURE__*/_jsxs(Modal, {
42
111
  title: "\u65B0\u5EFA\u6587\u4EF6",
43
112
  open: visible,
44
113
  onCancel: close,
45
- onOk: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
46
- return _regeneratorRuntime().wrap(function _callee$(_context) {
47
- while (1) switch (_context.prev = _context.next) {
48
- case 0:
49
- _context.next = 2;
50
- return fileService.newFile(newFileName, new URI(data.path));
51
- case 2:
52
- if (fileView) {
53
- fileView.model.refresh();
54
- }
55
- close();
56
- case 4:
57
- case "end":
58
- return _context.stop();
59
- }
60
- }, _callee);
61
- })),
114
+ width: 788,
115
+ cancelText: "\u53D6\u6D88",
116
+ okText: "\u786E\u5B9A",
117
+ onOk: function onOk() {
118
+ form.submit();
119
+ },
62
120
  keyboard: true,
63
- children: /*#__PURE__*/_jsx(Input, {
64
- value: newFileName,
65
- onChange: function onChange(e) {
66
- setNewFileName(e.target.value);
67
- },
68
- ref: inputRef,
69
- onKeyDown: /*#__PURE__*/function () {
70
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(e) {
71
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
72
- while (1) switch (_context2.prev = _context2.next) {
73
- case 0:
74
- if (!(e.keyCode === 13)) {
75
- _context2.next = 5;
76
- break;
77
- }
78
- _context2.next = 3;
79
- return fileService.newFile(newFileName, new URI(data.path));
80
- case 3:
81
- if (fileView) {
82
- fileView.model.refresh();
83
- }
84
- close();
85
- case 5:
86
- case "end":
87
- return _context2.stop();
88
- }
89
- }, _callee2);
90
- }));
91
- return function (_x) {
92
- return _ref3.apply(this, arguments);
93
- };
94
- }()
95
- })
121
+ wrapClassName: "libro-create-file-modal",
122
+ children: [/*#__PURE__*/_jsxs("div", {
123
+ className: "libro-create-file-path-container",
124
+ children: [/*#__PURE__*/_jsx("div", {
125
+ className: "libro-create-file-des",
126
+ children: "\u521B\u5EFA\u4F4D\u7F6E\uFF1A"
127
+ }), /*#__PURE__*/_jsx("span", {
128
+ className: "libro-create-file-path",
129
+ children: data.path
130
+ })]
131
+ }), /*#__PURE__*/_jsx("div", {
132
+ className: "libro-create-file-des",
133
+ children: "\u6587\u4EF6\u7C7B\u578B\uFF1A"
134
+ }), /*#__PURE__*/_jsxs(Row, {
135
+ children: [/*#__PURE__*/_jsx(Col, {
136
+ className: "gutter-row",
137
+ style: {
138
+ paddingLeft: 'unset',
139
+ paddingRight: '16px'
140
+ },
141
+ children: /*#__PURE__*/_jsxs("div", {
142
+ className: "libro-create-file-type ".concat(fileType === '.ipynb' ? 'active' : ''),
143
+ onClick: function onClick() {
144
+ setFileType('.ipynb');
145
+ },
146
+ children: [/*#__PURE__*/_jsx(NotebookIcon, {}), /*#__PURE__*/_jsx("span", {
147
+ className: "libro-create-file-type-text",
148
+ children: "Notebook"
149
+ })]
150
+ })
151
+ }), /*#__PURE__*/_jsx(Col, {
152
+ className: "gutter-row",
153
+ style: {
154
+ paddingLeft: 'unset',
155
+ paddingRight: '16px'
156
+ },
157
+ children: /*#__PURE__*/_jsxs("div", {
158
+ className: "libro-create-file-type ".concat(fileType === '.py' ? 'active' : ''),
159
+ onClick: function onClick() {
160
+ setFileType('.py');
161
+ },
162
+ children: [/*#__PURE__*/_jsx(PythonIcon, {}), /*#__PURE__*/_jsx("span", {
163
+ className: "libro-create-file-type-text",
164
+ children: "Python"
165
+ })]
166
+ })
167
+ }), /*#__PURE__*/_jsx(Col, {
168
+ className: "gutter-row",
169
+ style: {
170
+ paddingLeft: 'unset',
171
+ paddingRight: '16px'
172
+ },
173
+ children: /*#__PURE__*/_jsxs("div", {
174
+ className: "libro-create-file-type ".concat(fileType === '.json' ? 'active' : ''),
175
+ onClick: function onClick() {
176
+ setFileType('.json');
177
+ },
178
+ children: [/*#__PURE__*/_jsx(JSONIcon, {}), /*#__PURE__*/_jsx("span", {
179
+ className: "libro-create-file-type-text",
180
+ children: "JSON"
181
+ })]
182
+ })
183
+ }), /*#__PURE__*/_jsx(Col, {
184
+ className: "gutter-row",
185
+ style: {
186
+ paddingLeft: 'unset',
187
+ paddingRight: '16px'
188
+ },
189
+ children: /*#__PURE__*/_jsxs("div", {
190
+ className: "libro-create-file-type ".concat(fileType === undefined ? 'active' : ''),
191
+ onClick: function onClick() {
192
+ setFileType(undefined);
193
+ },
194
+ children: [/*#__PURE__*/_jsx(MoreIcon, {}), /*#__PURE__*/_jsx("span", {
195
+ className: "libro-create-file-type-text",
196
+ children: "\u5176\u4ED6"
197
+ })]
198
+ })
199
+ })]
200
+ }), /*#__PURE__*/_jsx(Form, {
201
+ layout: "vertical",
202
+ autoComplete: "off",
203
+ form: form,
204
+ onFinish: onFinish,
205
+ className: "libro-create-file-form",
206
+ children: /*#__PURE__*/_jsx(Form.Item, {
207
+ name: "fileName",
208
+ label: "\u6587\u4EF6\u540D\u79F0",
209
+ rules: [{
210
+ required: true,
211
+ validator: validateFileName
212
+ }],
213
+ children: /*#__PURE__*/_jsx(Input, {
214
+ addonAfter: fileType || ''
215
+ })
216
+ })
217
+ })]
96
218
  });
97
219
  };
98
220
  export var FileCreateModal = {
@@ -1,5 +1,5 @@
1
1
  import { ModalContribution } from '@difizen/mana-app';
2
2
  export declare class FileCreateDirModalContribution implements ModalContribution {
3
- registerModal(): import("@difizen/mana-app").ModalItem<import("./file-createdir-modal.js").ModalItemType>;
3
+ registerModal(): import("@difizen/mana-app").ModalItem<import("./file-createdir-modal.js").FileDirCreateModalItemType>;
4
4
  }
5
5
  //# sourceMappingURL=file-createdir-modal-contribution.d.ts.map
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" resolution-mode="require"/>
2
2
  import type { ModalItem, ModalItemProps } from '@difizen/mana-app';
3
- export interface ModalItemType {
3
+ import './index.less';
4
+ export interface FileDirCreateModalItemType {
4
5
  path: string;
5
6
  }
6
- export declare const FileCreateDirModalComponent: React.FC<ModalItemProps<ModalItemType>>;
7
- export declare const FileDirCreateModal: ModalItem<ModalItemType>;
7
+ export declare const FileCreateDirModalComponent: React.FC<ModalItemProps<FileDirCreateModalItemType>>;
8
+ export declare const FileDirCreateModal: ModalItem<FileDirCreateModalItemType>;
8
9
  //# sourceMappingURL=file-createdir-modal.d.ts.map
@@ -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;AAYnE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,2BAA2B,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC,aAAa,CAAC,CAsD/E,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,aAAa,CAGvD,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;AAUnE,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,CAqF3C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,0BAA0B,CAGpE,CAAC"}