@difizen/libro-core 0.1.1 → 0.1.2
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/add-cell/index.less +1 -1
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts +1 -2
- package/es/add-cell/libro-add-cell-slot-contribution.d.ts.map +1 -1
- package/es/add-cell/libro-add-cell-slot-contribution.js +12 -6
- package/es/add-cell/libro-add-cell-view.d.ts +4 -4
- package/es/add-cell/libro-add-cell-view.d.ts.map +1 -1
- package/es/add-cell/libro-add-cell-view.js +4 -6
- package/es/cell/libro-cell-contribution.d.ts +1 -2
- package/es/cell/libro-cell-contribution.d.ts.map +1 -1
- package/es/cell/libro-cell-contribution.js +14 -8
- package/es/cell/libro-cell-model.d.ts +9 -0
- package/es/cell/libro-cell-model.d.ts.map +1 -1
- package/es/cell/libro-cell-model.js +53 -11
- package/es/cell/libro-cell-protocol.d.ts +2 -0
- package/es/cell/libro-cell-protocol.d.ts.map +1 -1
- package/es/cell/libro-cell-view.d.ts +6 -2
- package/es/cell/libro-cell-view.d.ts.map +1 -1
- package/es/cell/libro-cell-view.js +54 -24
- package/es/cell/libro-edit-cell-view.d.ts +6 -12
- package/es/cell/libro-edit-cell-view.d.ts.map +1 -1
- package/es/cell/libro-edit-cell-view.js +9 -4
- package/es/cell/libro-executable-cell-view.d.ts +2 -0
- package/es/cell/libro-executable-cell-view.d.ts.map +1 -1
- package/es/cell/libro-executable-cell-view.js +4 -1
- package/es/collapse-service.d.ts +1 -1
- package/es/collapse-service.d.ts.map +1 -1
- package/es/collapse-service.js +1 -1
- package/es/command/document-commands.d.ts +1 -2
- package/es/command/document-commands.d.ts.map +1 -1
- package/es/command/document-commands.js +3 -2
- package/es/command/kernel-command.d.ts.map +1 -1
- package/es/command/kernel-command.js +3 -0
- package/es/command/libro-command-contribution.d.ts +0 -1
- package/es/command/libro-command-contribution.d.ts.map +1 -1
- package/es/command/libro-command-contribution.js +179 -129
- package/es/command/libro-command-register.d.ts +0 -1
- package/es/command/libro-command-register.d.ts.map +1 -1
- package/es/command/libro-command-register.js +13 -7
- package/es/command/notebook-commands.d.ts.map +1 -1
- package/es/command/notebook-commands.js +17 -4
- package/es/components/cell-protocol.d.ts +5 -5
- package/es/components/cell-protocol.d.ts.map +1 -1
- package/es/components/dnd-cell-item-render.d.ts +6 -2
- package/es/components/dnd-cell-item-render.d.ts.map +1 -1
- package/es/components/dnd-cell-item-render.js +194 -89
- package/es/components/dnd-component/custom-drag-layer.d.ts +1 -1
- package/es/components/dnd-component/custom-drag-layer.d.ts.map +1 -1
- package/es/components/dnd-component/custom-drag-layer.js +3 -4
- package/es/components/dnd-component/default-dnd-content.d.ts +2 -1
- package/es/components/dnd-component/default-dnd-content.d.ts.map +1 -1
- package/es/components/dnd-component/default-dnd-content.js +100 -44
- package/es/components/dnd-component/dnd-context.js +1 -1
- package/es/components/dnd-component/dnd-list.d.ts +9 -5
- package/es/components/dnd-component/dnd-list.d.ts.map +1 -1
- package/es/components/dnd-component/dnd-list.js +93 -26
- package/es/components/dnd-component/index.d.ts +1 -1
- package/es/components/dnd-component/index.d.ts.map +1 -1
- package/es/components/dnd-component/index.js +2 -2
- package/es/components/dnd-component/index.less +8 -0
- package/es/components/dnd-component/overscanIndices-getter.d.ts +22 -0
- package/es/components/dnd-component/overscanIndices-getter.d.ts.map +1 -0
- package/es/components/dnd-component/overscanIndices-getter.js +58 -0
- package/es/components/dnd-component/virtualized-manager.d.ts +19 -0
- package/es/components/dnd-component/virtualized-manager.d.ts.map +1 -0
- package/es/components/dnd-component/virtualized-manager.js +60 -0
- package/es/components/index.d.ts +2 -2
- package/es/components/index.d.ts.map +1 -1
- package/es/components/index.js +2 -2
- package/es/components/libro-virtualized-render.d.ts +15 -0
- package/es/components/libro-virtualized-render.d.ts.map +1 -0
- package/es/components/libro-virtualized-render.js +174 -0
- package/es/content/index.d.ts +1 -0
- package/es/content/index.d.ts.map +1 -1
- package/es/content/index.js +2 -1
- package/es/content/libro-content-contribution.d.ts +2 -2
- package/es/content/libro-content-contribution.d.ts.map +1 -1
- package/es/content/libro-content-contribution.js +2 -3
- package/es/content/libro-content-module.d.ts.map +1 -1
- package/es/content/libro-content-module.js +3 -2
- package/es/content/libro-content-protocol.d.ts +5 -0
- package/es/content/libro-content-protocol.d.ts.map +1 -1
- package/es/content/libro-content-protocol.js +2 -1
- package/es/content/libro-content-service.d.ts +5 -3
- package/es/content/libro-content-service.d.ts.map +1 -1
- package/es/content/libro-content-service.js +36 -8
- package/es/content/libro-save-content-contribution.d.ts +6 -0
- package/es/content/libro-save-content-contribution.d.ts.map +1 -0
- package/es/content/libro-save-content-contribution.js +27 -0
- package/es/formatter/index.d.ts +6 -0
- package/es/formatter/index.d.ts.map +1 -0
- package/es/formatter/index.js +5 -0
- package/es/formatter/libro-formatter-json-contribution.d.ts +18 -0
- package/es/formatter/libro-formatter-json-contribution.d.ts.map +1 -0
- package/es/formatter/libro-formatter-json-contribution.js +41 -0
- package/es/formatter/libro-formatter-manager.d.ts +16 -0
- package/es/formatter/libro-formatter-manager.d.ts.map +1 -0
- package/es/formatter/libro-formatter-manager.js +86 -0
- package/es/formatter/libro-formatter-module.d.ts +3 -0
- package/es/formatter/libro-formatter-module.d.ts.map +1 -0
- package/es/formatter/libro-formatter-module.js +7 -0
- package/es/formatter/libro-formatter-protocol.d.ts +37 -0
- package/es/formatter/libro-formatter-protocol.d.ts.map +1 -0
- package/es/formatter/libro-formatter-protocol.js +18 -0
- package/es/formatter/libro-formatter-string-contribution.d.ts +18 -0
- package/es/formatter/libro-formatter-string-contribution.d.ts.map +1 -0
- package/es/formatter/libro-formatter-string-contribution.js +41 -0
- package/es/formatter/libro-formatter-trans-default-contribution.d.ts +7 -0
- package/es/formatter/libro-formatter-trans-default-contribution.d.ts.map +1 -0
- package/es/formatter/libro-formatter-trans-default-contribution.js +19 -0
- package/es/index.d.ts +5 -1
- package/es/index.d.ts.map +1 -1
- package/es/index.js +6 -2
- package/es/index.less +135 -58
- package/es/libro-context-key.d.ts.map +1 -1
- package/es/libro-model.d.ts +13 -2
- package/es/libro-model.d.ts.map +1 -1
- package/es/libro-model.js +149 -70
- package/es/libro-protocol.d.ts +44 -2
- package/es/libro-protocol.d.ts.map +1 -1
- package/es/libro-protocol.js +16 -3
- package/es/libro-service.d.ts +1 -1
- package/es/libro-service.d.ts.map +1 -1
- package/es/libro-service.js +29 -20
- package/es/{configuration/libro-configuration-contribution.d.ts → libro-setting-contribution.d.ts} +2 -2
- package/es/libro-setting-contribution.d.ts.map +1 -0
- package/es/{configuration/libro-configuration-contribution.js → libro-setting-contribution.js} +8 -9
- package/es/{configuration/libro-configuration.d.ts → libro-setting.d.ts} +3 -2
- package/es/libro-setting.d.ts.map +1 -0
- package/es/{configuration/libro-configuration.js → libro-setting.js} +17 -7
- package/es/libro-view.d.ts +21 -8
- package/es/libro-view.d.ts.map +1 -1
- package/es/libro-view.js +477 -338
- package/es/material-from-designer.d.ts +3 -0
- package/es/material-from-designer.d.ts.map +1 -1
- package/es/material-from-designer.js +112 -1
- package/es/module.d.ts.map +1 -1
- package/es/module.js +20 -5
- package/es/output/output-area.d.ts +3 -4
- package/es/output/output-area.d.ts.map +1 -1
- package/es/output/output-area.js +23 -16
- package/es/output/output-contribution.d.ts +0 -1
- package/es/output/output-contribution.d.ts.map +1 -1
- package/es/output/output-contribution.js +14 -9
- package/es/output/output-model.d.ts +2 -2
- package/es/output/output-model.d.ts.map +1 -1
- package/es/output/output-model.js +2 -2
- package/es/output/output-protocol.d.ts.map +1 -1
- package/es/output/output-protocol.js +0 -2
- package/es/settings/index.d.ts +5 -0
- package/es/settings/index.d.ts.map +1 -0
- package/es/settings/index.js +4 -0
- package/es/settings/index.less +3 -0
- package/es/settings/module.d.ts +3 -0
- package/es/settings/module.d.ts.map +1 -0
- package/es/settings/module.js +4 -0
- package/es/settings/setting-editor/configuration-panel-view.d.ts +13 -0
- package/es/settings/setting-editor/configuration-panel-view.d.ts.map +1 -0
- package/es/settings/setting-editor/configuration-panel-view.js +115 -0
- package/es/settings/setting-editor/configuration-render-contribution.d.ts +6 -0
- package/es/settings/setting-editor/configuration-render-contribution.d.ts.map +1 -0
- package/es/settings/setting-editor/configuration-render-contribution.js +77 -0
- package/es/settings/setting-editor/default-node-render.d.ts +9 -0
- package/es/settings/setting-editor/default-node-render.d.ts.map +1 -0
- package/es/settings/setting-editor/default-node-render.js +79 -0
- package/es/settings/setting-editor/index.d.ts +7 -0
- package/es/settings/setting-editor/index.d.ts.map +1 -0
- package/es/settings/setting-editor/index.js +6 -0
- package/es/settings/setting-editor/index.less +12 -0
- package/es/settings/setting-editor/module.d.ts +3 -0
- package/es/settings/setting-editor/module.d.ts.map +1 -0
- package/es/settings/setting-editor/module.js +7 -0
- package/es/settings/setting-editor/setting-editor-view.d.ts +15 -0
- package/es/settings/setting-editor/setting-editor-view.d.ts.map +1 -0
- package/es/settings/setting-editor/setting-editor-view.js +169 -0
- package/es/settings/setting-editor/setting-tree-service.d.ts +9 -0
- package/es/settings/setting-editor/setting-tree-service.d.ts.map +1 -0
- package/es/settings/setting-editor/setting-tree-service.js +118 -0
- package/es/settings/setting-editor/setting-tree-view.d.ts +19 -0
- package/es/settings/setting-editor/setting-tree-view.d.ts.map +1 -0
- package/es/settings/setting-editor/setting-tree-view.js +88 -0
- package/es/settings/settings-contribution.d.ts +7 -0
- package/es/settings/settings-contribution.d.ts.map +1 -0
- package/es/settings/settings-contribution.js +36 -0
- package/es/settings/settings-modal.d.ts +5 -0
- package/es/settings/settings-modal.d.ts.map +1 -0
- package/es/settings/settings-modal.js +53 -0
- package/es/settings/settings-modal.less +3 -0
- package/es/settings/settings-protocol.d.ts +4 -0
- package/es/settings/settings-protocol.d.ts.map +1 -0
- package/es/settings/settings-protocol.js +5 -0
- package/es/slot/libro-slot-manager.d.ts +2 -2
- package/es/slot/libro-slot-manager.d.ts.map +1 -1
- package/es/slot/libro-slot-manager.js +14 -8
- package/es/slot/libro-slot-view.d.ts +3 -3
- package/es/slot/libro-slot-view.d.ts.map +1 -1
- package/es/slot/libro-slot-view.js +2 -2
- package/es/theme/libro-color-registry.d.ts.map +1 -1
- package/es/theme/libro-color-registry.js +7 -0
- package/es/toolbar/all-outputs-scroll-icon.d.ts +3 -0
- package/es/toolbar/all-outputs-scroll-icon.d.ts.map +1 -0
- package/es/toolbar/all-outputs-scroll-icon.js +10 -0
- package/es/toolbar/libro-toolbar.d.ts +2 -1
- package/es/toolbar/libro-toolbar.d.ts.map +1 -1
- package/es/toolbar/libro-toolbar.js +44 -8
- package/es/toolbar/restart-clear-outputs-modal.d.ts +1 -2
- package/es/toolbar/restart-clear-outputs-modal.d.ts.map +1 -1
- package/es/toolbar/restart-clear-outputs-modal.js +2 -2
- package/es/toolbar/shutdown-modal.d.ts +1 -2
- package/es/toolbar/shutdown-modal.d.ts.map +1 -1
- package/es/toolbar/shutdown-modal.js +2 -2
- package/es/toolbar/side-toolar-more-select.d.ts.map +1 -1
- package/es/toolbar/side-toolar-more-select.js +2 -2
- package/es/virtualized-manager-helper.d.ts +11 -0
- package/es/virtualized-manager-helper.d.ts.map +1 -0
- package/es/virtualized-manager-helper.js +51 -0
- package/es/virtualized-manager.d.ts +19 -0
- package/es/virtualized-manager.d.ts.map +1 -0
- package/es/virtualized-manager.js +61 -0
- package/package.json +9 -6
- package/src/add-cell/index.less +1 -1
- package/src/add-cell/libro-add-cell-slot-contribution.ts +1 -4
- package/src/add-cell/libro-add-cell-view.tsx +13 -6
- package/src/cell/libro-cell-contribution.ts +2 -6
- package/src/cell/libro-cell-model.ts +57 -4
- package/src/cell/libro-cell-protocol.ts +2 -0
- package/src/cell/libro-cell-view.tsx +21 -9
- package/src/cell/libro-edit-cell-view.tsx +10 -9
- package/src/cell/libro-executable-cell-view.ts +6 -1
- package/src/collapse-service.ts +1 -1
- package/src/command/document-commands.ts +3 -5
- package/src/command/kernel-command.ts +3 -0
- package/src/command/libro-command-contribution.ts +107 -91
- package/src/command/libro-command-register.ts +1 -4
- package/src/command/notebook-commands.ts +16 -3
- package/src/components/cell-protocol.ts +5 -5
- package/src/components/dnd-cell-item-render.tsx +239 -92
- package/src/components/dnd-component/custom-drag-layer.tsx +5 -6
- package/src/components/dnd-component/default-dnd-content.tsx +113 -42
- package/src/components/dnd-component/dnd-context.tsx +1 -1
- package/src/components/dnd-component/dnd-list.tsx +135 -43
- package/src/components/dnd-component/index.less +8 -0
- package/src/components/dnd-component/index.tsx +1 -1
- package/src/components/dnd-component/overscanIndices-getter.ts +92 -0
- package/src/components/dnd-component/virtualized-manager.ts +34 -0
- package/src/components/index.ts +2 -2
- package/src/components/libro-virtualized-render.tsx +178 -0
- package/src/content/index.ts +1 -0
- package/src/content/libro-content-contribution.ts +2 -3
- package/src/content/libro-content-module.ts +11 -3
- package/src/content/libro-content-protocol.ts +6 -0
- package/src/content/libro-content-service.ts +26 -8
- package/src/content/libro-save-content-contribution.ts +12 -0
- package/src/formatter/index.ts +5 -0
- package/src/formatter/libro-formatter-json-contribution.ts +42 -0
- package/src/formatter/libro-formatter-manager.ts +85 -0
- package/src/formatter/libro-formatter-module.ts +19 -0
- package/src/formatter/libro-formatter-protocol.ts +63 -0
- package/src/formatter/libro-formatter-string-contribution.ts +41 -0
- package/src/formatter/libro-formatter-trans-default-contribution.ts +15 -0
- package/src/index.less +135 -58
- package/src/index.tsx +6 -1
- package/src/libro-context-key.ts +3 -3
- package/src/libro-model.ts +87 -23
- package/src/libro-protocol.ts +81 -4
- package/src/libro-service.ts +4 -13
- package/src/{configuration/libro-configuration-contribution.ts → libro-setting-contribution.ts} +7 -8
- package/src/{configuration/libro-configuration.ts → libro-setting.ts} +18 -7
- package/src/libro-view.tsx +273 -141
- package/src/material-from-designer.tsx +93 -1
- package/src/module.ts +29 -7
- package/src/output/output-area.tsx +18 -12
- package/src/output/output-contribution.ts +2 -6
- package/src/output/output-model.tsx +3 -3
- package/src/output/output-protocol.ts +0 -1
- package/src/settings/index.less +3 -0
- package/src/settings/index.ts +4 -0
- package/src/settings/module.ts +8 -0
- package/src/settings/setting-editor/configuration-panel-view.tsx +89 -0
- package/src/settings/setting-editor/configuration-render-contribution.ts +81 -0
- package/src/settings/setting-editor/default-node-render.tsx +65 -0
- package/src/settings/setting-editor/index.less +12 -0
- package/src/settings/setting-editor/index.ts +6 -0
- package/src/settings/setting-editor/module.ts +17 -0
- package/src/settings/setting-editor/setting-editor-view.tsx +93 -0
- package/src/settings/setting-editor/setting-tree-service.ts +82 -0
- package/src/settings/setting-editor/setting-tree-view.tsx +95 -0
- package/src/settings/settings-contribution.tsx +24 -0
- package/src/settings/settings-modal.less +3 -0
- package/src/settings/settings-modal.tsx +50 -0
- package/src/settings/settings-protocol.ts +7 -0
- package/src/slot/libro-slot-manager.ts +1 -3
- package/src/slot/libro-slot-view.tsx +2 -5
- package/src/theme/libro-color-registry.ts +6 -0
- package/src/toolbar/all-outputs-scroll-icon.tsx +19 -0
- package/src/toolbar/libro-toolbar.tsx +30 -5
- package/src/toolbar/restart-clear-outputs-modal.tsx +3 -3
- package/src/toolbar/shutdown-modal.tsx +3 -3
- package/src/toolbar/side-toolar-more-select.tsx +2 -1
- package/src/virtualized-manager-helper.ts +29 -0
- package/src/virtualized-manager.ts +34 -0
- package/es/configuration/libro-configuration-contribution.d.ts.map +0 -1
- package/es/configuration/libro-configuration.d.ts.map +0 -1
|
@@ -31,6 +31,27 @@ export const ClearOutlined: React.FC = () => (
|
|
|
31
31
|
</svg>
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
+
export const PauseCircleOutlined: React.FC = () => (
|
|
35
|
+
<svg
|
|
36
|
+
width="21px"
|
|
37
|
+
height="21px"
|
|
38
|
+
viewBox="0 0 20 20"
|
|
39
|
+
version="1.1"
|
|
40
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
41
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
42
|
+
>
|
|
43
|
+
<g id="原色" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
44
|
+
<g id="time-out" fillRule="nonzero" fill="#7B7B7B">
|
|
45
|
+
<rect id="矩形" fill="#000000" opacity="0" x="0" y="0" width="20" height="20" />
|
|
46
|
+
<path
|
|
47
|
+
d="M10,1.25 C5.16796875,1.25 1.25,5.16796875 1.25,10 C1.25,14.8320312 5.16796875,18.75 10,18.75 C14.8320312,18.75 18.75,14.8320312 18.75,10 C18.75,5.16796875 14.8320312,1.25 10,1.25 Z M10,17.265625 C5.98828125,17.265625 2.734375,14.0117187 2.734375,10 C2.734375,5.98828125 5.98828125,2.734375 10,2.734375 C14.0117187,2.734375 17.265625,5.98828125 17.265625,10 C17.265625,14.0117187 14.0117187,17.265625 10,17.265625 Z M8.28125,6.875 L7.34375,6.875 C7.2578125,6.875 7.1875,6.9453125 7.1875,7.03125 L7.1875,12.96875 C7.1875,13.0546875 7.2578125,13.125 7.34375,13.125 L8.28125,13.125 C8.3671875,13.125 8.4375,13.0546875 8.4375,12.96875 L8.4375,7.03125 C8.4375,6.9453125 8.3671875,6.875 8.28125,6.875 Z M12.65625,6.875 L11.71875,6.875 C11.6328125,6.875 11.5625,6.9453125 11.5625,7.03125 L11.5625,12.96875 C11.5625,13.0546875 11.6328125,13.125 11.71875,13.125 L12.65625,13.125 C12.7421875,13.125 12.8125,13.0546875 12.8125,12.96875 L12.8125,7.03125 C12.8125,6.9453125 12.7421875,6.875 12.65625,6.875 Z"
|
|
48
|
+
id="形状"
|
|
49
|
+
/>
|
|
50
|
+
</g>
|
|
51
|
+
</g>
|
|
52
|
+
</svg>
|
|
53
|
+
);
|
|
54
|
+
|
|
34
55
|
export const Reload: React.FC = () => (
|
|
35
56
|
<svg
|
|
36
57
|
width="18px"
|
|
@@ -421,7 +442,13 @@ export const AddCellOutlined: React.FC<{ className: string }> = (prop) => (
|
|
|
421
442
|
xmlns="http://www.w3.org/2000/svg"
|
|
422
443
|
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
423
444
|
>
|
|
424
|
-
<g
|
|
445
|
+
<g
|
|
446
|
+
id="页面-1"
|
|
447
|
+
stroke="none"
|
|
448
|
+
strokeWidth="1"
|
|
449
|
+
fill="currentColor"
|
|
450
|
+
fillRule="evenodd"
|
|
451
|
+
>
|
|
425
452
|
<g id="2.0-添加-cell" transform="translate(-277.000000, -363.000000)">
|
|
426
453
|
<g id="Icon/01-Line/add" transform="translate(277.937500, 363.562500)">
|
|
427
454
|
<path d="M15.9375,7.546875 C16.040625,7.546875 16.125,7.63125 16.125,7.734375 L16.125,9.140625 C16.125,9.24375 16.040625,9.328125 15.9375,9.328125 L8.953125,9.328125 L8.953125,16.6875 C8.953125,16.7910534 8.86917839,16.875 8.765625,16.875 L7.359375,16.875 C7.25582161,16.875 7.171875,16.7910534 7.171875,16.6875 L7.171875,9.328125 L0.1875,9.328125 C0.084375,9.328125 0,9.24375 0,9.140625 L0,7.734375 C0,7.63125 0.084375,7.546875 0.1875,7.546875 L7.171875,7.546875 L7.171875,0.1875 C7.171875,0.0839466094 7.25582161,0 7.359375,0 L8.765625,0 C8.86917839,0 8.953125,0.0839466094 8.953125,0.1875 L8.953125,7.546875 L15.9375,7.546875 Z" />
|
|
@@ -455,3 +482,68 @@ export const ArrowRight: React.FC = () => (
|
|
|
455
482
|
</g>
|
|
456
483
|
</svg>
|
|
457
484
|
);
|
|
485
|
+
|
|
486
|
+
export const EnableOutputScroll: React.FC = () => (
|
|
487
|
+
<svg
|
|
488
|
+
width="16px"
|
|
489
|
+
height="16px"
|
|
490
|
+
viewBox="0 0 16 16"
|
|
491
|
+
version="1.1"
|
|
492
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
493
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
494
|
+
>
|
|
495
|
+
<g
|
|
496
|
+
id="libro-enable-output-scroll"
|
|
497
|
+
stroke="none"
|
|
498
|
+
strokeWidth="1"
|
|
499
|
+
fill="none"
|
|
500
|
+
fillRule="evenodd"
|
|
501
|
+
>
|
|
502
|
+
<g id="2.1固定icon" transform="translate(-314.000000, -344.000000)">
|
|
503
|
+
<g id="编组-15备份-4" transform="translate(314.000000, 344.000000)">
|
|
504
|
+
<g
|
|
505
|
+
id="编组"
|
|
506
|
+
transform="translate(2.045455, 0.909091)"
|
|
507
|
+
fill="currentColor"
|
|
508
|
+
fillRule="nonzero"
|
|
509
|
+
>
|
|
510
|
+
<path
|
|
511
|
+
d="M11.7897727,12.8551136 L0.142045455,12.8551136 C0.0639204545,12.8551136 0,12.9190341 0,12.9971591 L0,14.0625 C0,14.140625 0.0639204545,14.2045455 0.142045455,14.2045455 L11.7897727,14.2045455 C11.8678977,14.2045455 11.9318182,14.140625 11.9318182,14.0625 L11.9318182,12.9971591 C11.9318182,12.9190341 11.8678977,12.8551136 11.7897727,12.8551136 Z M11.7897727,0 L0.142045455,0 C0.0639204545,0 0,0.0639204545 0,0.142045455 L0,1.20738636 C0,1.28551136 0.0639204545,1.34943182 0.142045455,1.34943182 L11.7897727,1.34943182 C11.8678977,1.34943182 11.9318182,1.28551136 11.9318182,1.20738636 L11.9318182,0.142045455 C11.9318182,0.0639204545 11.8678977,0 11.7897727,0 Z M6.45454545,2.18181818 C6.50475316,2.18181818 6.54545455,2.22251957 6.54545455,2.27272727 L6.54457706,4.38181818 L7.71985588,4.38219105 C7.81269273,4.38219105 7.8690036,4.47350599 7.84182654,4.55214864 L7.82106326,4.58993253 L6.03129054,6.85378196 C5.98157463,6.91947798 5.88214281,6.91947798 5.83065133,6.85378196 L4.0408786,4.58993253 C3.97518258,4.50648082 4.0355519,4.38219105 4.14208599,4.38219105 L5.27257706,4.38181818 L5.27272727,2.27272727 C5.27272727,2.22251957 5.31342866,2.18181818 5.36363636,2.18181818 L6.45454545,2.18181818 Z M5.83096591,7.34055398 C5.88068182,7.27485795 5.98011364,7.27485795 6.03160511,7.34055398 L7.82137784,9.60617898 C7.88707386,9.68963068 7.82670455,9.81392045 7.72017045,9.81392045 L6.54457706,9.81381818 L6.54545455,11.9090909 C6.54545455,11.9592986 6.50475316,12 6.45454545,12 L5.36363636,12 C5.31342866,12 5.27272727,11.9592986 5.27272727,11.9090909 L5.27257706,9.81381818 L4.14240057,9.81392045 C4.04956372,9.81392045 3.99325284,9.72260552 4.0204299,9.64396286 L4.04119318,9.60617898 Z"
|
|
512
|
+
id="形状"
|
|
513
|
+
/>
|
|
514
|
+
</g>
|
|
515
|
+
</g>
|
|
516
|
+
</g>
|
|
517
|
+
</g>
|
|
518
|
+
</svg>
|
|
519
|
+
);
|
|
520
|
+
|
|
521
|
+
export const DisableOutputScroll: React.FC = () => (
|
|
522
|
+
<svg
|
|
523
|
+
width="16px"
|
|
524
|
+
height="16px"
|
|
525
|
+
viewBox="0 0 16 16"
|
|
526
|
+
version="1.1"
|
|
527
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
528
|
+
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
529
|
+
>
|
|
530
|
+
<g id="页面-1" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
531
|
+
<g id="4.1取消固定" transform="translate(-314.000000, -344.000000)">
|
|
532
|
+
<g id="编组-15备份" transform="translate(314.000000, 344.000000)">
|
|
533
|
+
<rect id="矩形" x="0" y="0" width="16" height="16" rx="4" />
|
|
534
|
+
<g
|
|
535
|
+
id="编组"
|
|
536
|
+
transform="translate(2.000000, 1.000000)"
|
|
537
|
+
fill="currentColor"
|
|
538
|
+
fillRule="nonzero"
|
|
539
|
+
>
|
|
540
|
+
<path
|
|
541
|
+
d="M11.7897727,12.8551136 L0.142045455,12.8551136 C0.0639204545,12.8551136 0,12.9190341 0,12.9971591 L0,14.0625 C0,14.140625 0.0639204545,14.2045455 0.142045455,14.2045455 L11.7897727,14.2045455 C11.8678977,14.2045455 11.9318182,14.140625 11.9318182,14.0625 L11.9318182,12.9971591 C11.9318182,12.9190341 11.8678977,12.8551136 11.7897727,12.8551136 Z M11.7897727,0 L0.142045455,0 C0.0639204545,0 0,0.0639204545 0,0.142045455 L0,1.20738636 C0,1.28551136 0.0639204545,1.34943182 0.142045455,1.34943182 L11.7897727,1.34943182 C11.8678977,1.34943182 11.9318182,1.28551136 11.9318182,1.20738636 L11.9318182,0.142045455 C11.9318182,0.0639204545 11.8678977,0 11.7897727,0 Z M7.72017045,4.72301136 C7.82670455,4.72301136 7.88707386,4.59872159 7.82137784,4.51526989 L6.03160511,2.24964489 C5.98011364,2.18394886 5.88068182,2.18394886 5.83096591,2.24964489 L4.04119318,4.51526989 C3.97549716,4.59872159 4.03409091,4.72301136 4.14240057,4.72301136 L5.32670455,4.72301136 L5.32670455,9.48153409 L4.21164773,9.48153409 C4.10511364,9.48153409 4.04474432,9.60582386 4.11044034,9.68927557 L5.90021307,11.953125 C5.95170455,12.018821 6.05113636,12.018821 6.10085227,11.953125 L7.890625,9.68927557 C7.95632102,9.60582386 7.89772727,9.48153409 7.78941761,9.48153409 L6.60511364,9.48153409 L6.60511364,4.72301136 L7.72017045,4.72301136 Z"
|
|
542
|
+
id="形状"
|
|
543
|
+
/>
|
|
544
|
+
</g>
|
|
545
|
+
</g>
|
|
546
|
+
</g>
|
|
547
|
+
</g>
|
|
548
|
+
</svg>
|
|
549
|
+
);
|
package/src/module.ts
CHANGED
|
@@ -11,34 +11,43 @@ import {
|
|
|
11
11
|
} from './collapse-service.js';
|
|
12
12
|
import { LibroCommandModule } from './command/index.js';
|
|
13
13
|
import {
|
|
14
|
+
BetweenCellProvider,
|
|
14
15
|
CellExecutionTimeProvider,
|
|
15
|
-
LibroCellExecutionTime,
|
|
16
16
|
CellInputBottonBlankProvider,
|
|
17
|
-
LibroCellInputBottonBlank,
|
|
18
17
|
CellOutputVisulizationProvider,
|
|
19
|
-
LibroCellVisualization,
|
|
20
18
|
LibroBetweenCellContent,
|
|
21
|
-
|
|
19
|
+
LibroCellExecutionTime,
|
|
20
|
+
LibroCellInputBottonBlank,
|
|
21
|
+
LibroCellVisualization,
|
|
22
22
|
} from './components/index.js';
|
|
23
|
-
import { LibroConfigurationContribution } from './configuration/libro-configuration-contribution.js';
|
|
24
23
|
import { LibroContentModule } from './content/index.js';
|
|
24
|
+
import { LibroFormatterModule } from './formatter/index.js';
|
|
25
25
|
import { LirboContextKey } from './libro-context-key.js';
|
|
26
26
|
import { LibroModel } from './libro-model.js';
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
ModelFactory,
|
|
29
|
+
NotebookOption,
|
|
30
|
+
VirtualizedManagerOption,
|
|
31
|
+
VirtualizedManagerOptionFactory,
|
|
32
|
+
} from './libro-protocol.js';
|
|
28
33
|
import { LibroService } from './libro-service.js';
|
|
34
|
+
import { LibroSettingContribution } from './libro-setting-contribution.js';
|
|
29
35
|
import { LibroViewTracker } from './libro-view-tracker.js';
|
|
30
36
|
import { LibroView } from './libro-view.js';
|
|
31
37
|
import { OutputModule } from './output/index.js';
|
|
32
38
|
import { LibroSlotModule } from './slot/index.js';
|
|
33
39
|
import { LibroColorRegistry } from './theme/libro-color-registry.js';
|
|
40
|
+
import { VirtualizedManagerHelper } from './virtualized-manager-helper.js';
|
|
41
|
+
import { VirtualizedManager } from './virtualized-manager.js';
|
|
34
42
|
|
|
35
43
|
export const LibroModule = ManaModule.create()
|
|
36
44
|
.register(
|
|
45
|
+
VirtualizedManager,
|
|
37
46
|
LibroService,
|
|
38
47
|
LirboContextKey,
|
|
39
48
|
LibroModel,
|
|
40
49
|
LibroView,
|
|
41
|
-
|
|
50
|
+
LibroSettingContribution,
|
|
42
51
|
LibroColorRegistry,
|
|
43
52
|
LibroViewTracker,
|
|
44
53
|
{
|
|
@@ -62,6 +71,18 @@ export const LibroModule = ManaModule.create()
|
|
|
62
71
|
};
|
|
63
72
|
},
|
|
64
73
|
},
|
|
74
|
+
VirtualizedManagerHelper,
|
|
75
|
+
VirtualizedManager,
|
|
76
|
+
{
|
|
77
|
+
token: VirtualizedManagerOptionFactory,
|
|
78
|
+
useFactory: (ctx) => {
|
|
79
|
+
return (target: VirtualizedManagerOptionFactory) => {
|
|
80
|
+
const child = ctx.container.createChild();
|
|
81
|
+
child.register({ token: VirtualizedManagerOption, useValue: target });
|
|
82
|
+
return child.get(VirtualizedManager);
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
},
|
|
65
86
|
{
|
|
66
87
|
token: CellExecutionTimeProvider,
|
|
67
88
|
useValue: LibroCellExecutionTime,
|
|
@@ -88,4 +109,5 @@ export const LibroModule = ManaModule.create()
|
|
|
88
109
|
ConfigurationModule,
|
|
89
110
|
OutputModule,
|
|
90
111
|
LibroContentModule,
|
|
112
|
+
LibroFormatterModule,
|
|
91
113
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { IOutput } from '@difizen/libro-common';
|
|
2
2
|
import { isError, isStream } from '@difizen/libro-common';
|
|
3
|
-
import type { ViewComponent } from '@difizen/mana-app';
|
|
4
|
-
import type { Contribution } from '@difizen/mana-app';
|
|
3
|
+
import type { ViewComponent, Contribution } from '@difizen/mana-app';
|
|
5
4
|
import {
|
|
6
5
|
ViewOption,
|
|
7
6
|
getOrigin,
|
|
@@ -12,10 +11,8 @@ import {
|
|
|
12
11
|
view,
|
|
13
12
|
ViewInstance,
|
|
14
13
|
} from '@difizen/mana-app';
|
|
15
|
-
import { Emitter } from '@difizen/mana-app';
|
|
16
|
-
import {
|
|
17
|
-
import { prop } from '@difizen/mana-app';
|
|
18
|
-
import React, { useEffect } from 'react';
|
|
14
|
+
import { Emitter, prop, contrib, inject, transient } from '@difizen/mana-app';
|
|
15
|
+
import { useEffect, forwardRef } from 'react';
|
|
19
16
|
import { v4 } from 'uuid';
|
|
20
17
|
|
|
21
18
|
import { ExecutableCellView } from '../cell/index.js';
|
|
@@ -28,16 +25,24 @@ import type {
|
|
|
28
25
|
} from './output-protocol.js';
|
|
29
26
|
import { OutputContribution } from './output-protocol.js';
|
|
30
27
|
|
|
31
|
-
const LibroOutputAreaRender =
|
|
32
|
-
function LibroOutputAreaRender(
|
|
28
|
+
const LibroOutputAreaRender = forwardRef<HTMLDivElement>(
|
|
29
|
+
function LibroOutputAreaRender(props, ref) {
|
|
33
30
|
const outputArea = useInject<LibroOutputArea>(ViewInstance);
|
|
34
31
|
|
|
32
|
+
// const cellModel = outputArea.cell.model;
|
|
33
|
+
// const executing = ExecutableCellModel.is(cellModel) && cellModel.executing;
|
|
34
|
+
|
|
35
35
|
useEffect(() => {
|
|
36
36
|
outputArea.onUpdateEmitter.fire();
|
|
37
37
|
}, [outputArea.onUpdateEmitter, outputArea.outputs]);
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
|
-
<div
|
|
40
|
+
<div
|
|
41
|
+
className="libro-output-area"
|
|
42
|
+
ref={ref}
|
|
43
|
+
//设置最小高度,用于优化长文本输出再次执行时的页面的滚动控制
|
|
44
|
+
// style={{ minHeight: `${executing ? outputArea.lastOutputContainerHeight + 'px' : 'unset'}` }}
|
|
45
|
+
>
|
|
41
46
|
{outputArea.outputs.map((output) => {
|
|
42
47
|
return <ViewRender view={output} key={output.id} />;
|
|
43
48
|
})}
|
|
@@ -50,12 +55,13 @@ const LibroOutputAreaRender = React.forwardRef<HTMLDivElement>(
|
|
|
50
55
|
@view('libro-output-area')
|
|
51
56
|
export class LibroOutputArea extends BaseView implements BaseOutputArea {
|
|
52
57
|
override view: ViewComponent = LibroOutputAreaRender;
|
|
58
|
+
@contrib(OutputContribution)
|
|
59
|
+
outputProvider: Contribution.Provider<OutputContribution>;
|
|
53
60
|
cell: CellView;
|
|
54
61
|
@prop()
|
|
55
62
|
outputs: BaseOutputView[] = [];
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
outputProvider: Contribution.Provider<OutputContribution>;
|
|
64
|
+
// lastOutputContainerHeight?: number;
|
|
59
65
|
|
|
60
66
|
constructor(@inject(ViewOption) option: IOutputAreaOption) {
|
|
61
67
|
super();
|
|
@@ -187,7 +193,7 @@ export class LibroOutputArea extends BaseView implements BaseOutputArea {
|
|
|
187
193
|
* messages of the same type.
|
|
188
194
|
*/
|
|
189
195
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
190
|
-
protected shouldCombine(
|
|
196
|
+
protected shouldCombine(options: {
|
|
191
197
|
output: IOutput;
|
|
192
198
|
lastModel: BaseOutputView;
|
|
193
199
|
}): boolean {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ViewManager } from '@difizen/mana-app';
|
|
2
|
-
import { inject, singleton } from '@difizen/mana-app';
|
|
1
|
+
import { inject, singleton, ViewManager } from '@difizen/mana-app';
|
|
3
2
|
|
|
4
3
|
import { LibroOutputView } from './output-model.js';
|
|
5
4
|
import type { IOutputOptions } from './output-protocol.js';
|
|
@@ -7,10 +6,7 @@ import { OutputContribution } from './output-protocol.js';
|
|
|
7
6
|
|
|
8
7
|
@singleton({ contrib: OutputContribution })
|
|
9
8
|
export class DefaultOutputContribution implements OutputContribution {
|
|
10
|
-
viewManager: ViewManager;
|
|
11
|
-
constructor(@inject(ViewManager) viewManager: ViewManager) {
|
|
12
|
-
this.viewManager = viewManager;
|
|
13
|
-
}
|
|
9
|
+
@inject(ViewManager) viewManager: ViewManager;
|
|
14
10
|
canHandle = () => 1;
|
|
15
11
|
factory(output: IOutputOptions) {
|
|
16
12
|
return this.viewManager.getOrCreateView(LibroOutputView, output);
|
|
@@ -23,15 +23,15 @@ export class LibroOutputView extends BaseView implements BaseOutputView {
|
|
|
23
23
|
|
|
24
24
|
// 增加cell属性,使得通过output可以找到Cell
|
|
25
25
|
cell: CellView;
|
|
26
|
-
type: string;
|
|
27
26
|
|
|
28
27
|
@prop()
|
|
29
28
|
raw: IOutput;
|
|
30
|
-
|
|
31
29
|
@prop()
|
|
32
30
|
data: JSONObject;
|
|
33
31
|
@prop()
|
|
34
32
|
metadata: PartialJSONObject;
|
|
33
|
+
type: string;
|
|
34
|
+
trusted: boolean;
|
|
35
35
|
constructor(@inject(ViewOption) options: IOutputOptions) {
|
|
36
36
|
super();
|
|
37
37
|
this.raw = options.output;
|
|
@@ -43,7 +43,7 @@ export class LibroOutputView extends BaseView implements BaseOutputView {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
render: FC<{ output: BaseOutputView }> = LibroOutputModelRender;
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
override dispose() {
|
|
48
48
|
//
|
|
49
49
|
}
|
|
@@ -8,7 +8,6 @@ import type { View } from '@difizen/mana-app';
|
|
|
8
8
|
import { Syringe } from '@difizen/mana-app';
|
|
9
9
|
|
|
10
10
|
import type { CellView } from '../libro-protocol.js';
|
|
11
|
-
// import type { CellModel } from '../libro-protocol';
|
|
12
11
|
|
|
13
12
|
export const CellOption = Symbol('CellOption');
|
|
14
13
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ManaModule } from '@difizen/mana-app';
|
|
2
|
+
|
|
3
|
+
import { SettingEditorModule } from './setting-editor/index.js';
|
|
4
|
+
import { SettingsContribution } from './settings-contribution.js';
|
|
5
|
+
|
|
6
|
+
export const SettingsModule = ManaModule.create()
|
|
7
|
+
.register(SettingsContribution)
|
|
8
|
+
.dependOn(SettingEditorModule);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { ConfigurationNode } from '@difizen/mana-app';
|
|
2
|
+
import {
|
|
3
|
+
BaseView,
|
|
4
|
+
prop,
|
|
5
|
+
transient,
|
|
6
|
+
useInject,
|
|
7
|
+
view,
|
|
8
|
+
ViewInstance,
|
|
9
|
+
ConfigurationRenderRegistry,
|
|
10
|
+
useConfigurationValue,
|
|
11
|
+
SchemaValidator,
|
|
12
|
+
} from '@difizen/mana-app';
|
|
13
|
+
import { Form } from 'antd';
|
|
14
|
+
import React from 'react';
|
|
15
|
+
|
|
16
|
+
import './index.less';
|
|
17
|
+
|
|
18
|
+
const layout = {
|
|
19
|
+
labelCol: { span: 8 },
|
|
20
|
+
wrapperCol: { span: 16 },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const ConfigurationNodeRender: React.FC<{ node: ConfigurationNode<any> }> = ({
|
|
24
|
+
node,
|
|
25
|
+
}) => {
|
|
26
|
+
const configurationRenderRegistry = useInject(ConfigurationRenderRegistry);
|
|
27
|
+
const schemaValidator = useInject(SchemaValidator);
|
|
28
|
+
const Render = configurationRenderRegistry.getConfigurationRender(node);
|
|
29
|
+
const [value, setValue] = useConfigurationValue(node);
|
|
30
|
+
return (
|
|
31
|
+
<div key={node.id}>
|
|
32
|
+
{Render && (
|
|
33
|
+
<div id={node.id}>
|
|
34
|
+
<Form.Item
|
|
35
|
+
label={node.title}
|
|
36
|
+
extra={node.description}
|
|
37
|
+
rules={[
|
|
38
|
+
{
|
|
39
|
+
validator: (_, currentVal) => {
|
|
40
|
+
const valid = schemaValidator.validateNode(node, currentVal);
|
|
41
|
+
if (valid) {
|
|
42
|
+
return Promise.resolve();
|
|
43
|
+
}
|
|
44
|
+
return Promise.reject(new Error('invalid value'));
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
]}
|
|
48
|
+
hasFeedback
|
|
49
|
+
>
|
|
50
|
+
<Render
|
|
51
|
+
label={node.title}
|
|
52
|
+
value={value}
|
|
53
|
+
schema={node.schema}
|
|
54
|
+
onChange={(val) => {
|
|
55
|
+
setValue(val);
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
</Form.Item>
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const DefaultConfigurationViewComponent: React.FC = () => {
|
|
66
|
+
const [form] = Form.useForm();
|
|
67
|
+
const viewInstance = useInject<ConfigurationPanelView>(ViewInstance);
|
|
68
|
+
const configs = viewInstance.configurationNodes;
|
|
69
|
+
return (
|
|
70
|
+
<Form
|
|
71
|
+
{...layout}
|
|
72
|
+
form={form}
|
|
73
|
+
className={`libro-configuration-site-card ${viewInstance.className}`}
|
|
74
|
+
>
|
|
75
|
+
{configs?.map((config) => {
|
|
76
|
+
return <ConfigurationNodeRender node={config} key={config.id} />;
|
|
77
|
+
})}
|
|
78
|
+
</Form>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
@transient()
|
|
83
|
+
@view('ConfigurationPanel')
|
|
84
|
+
export class ConfigurationPanelView extends BaseView {
|
|
85
|
+
override view = DefaultConfigurationViewComponent;
|
|
86
|
+
|
|
87
|
+
@prop()
|
|
88
|
+
configurationNodes: ConfigurationNode<any>[] = [];
|
|
89
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ConfigurationRender } from '@difizen/mana-app';
|
|
2
|
+
import { singleton, ConfigurationRenderContribution } from '@difizen/mana-app';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
DefaultCheckbox,
|
|
6
|
+
DefaultInput,
|
|
7
|
+
DefaultInputNumber,
|
|
8
|
+
DefaultSelect,
|
|
9
|
+
DefaultSwitch,
|
|
10
|
+
DefaultDatePicker,
|
|
11
|
+
} from './default-node-render.js';
|
|
12
|
+
|
|
13
|
+
@singleton({ contrib: [ConfigurationRenderContribution] })
|
|
14
|
+
export class DefaultConfigurationRenderContribution
|
|
15
|
+
implements ConfigurationRenderContribution
|
|
16
|
+
{
|
|
17
|
+
registerConfigurationRenders(): ConfigurationRender[] {
|
|
18
|
+
return [
|
|
19
|
+
{
|
|
20
|
+
canHandle: (config) => {
|
|
21
|
+
if (config.type === 'input') {
|
|
22
|
+
return 1;
|
|
23
|
+
} else {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
component: DefaultInput,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
canHandle: (config) => {
|
|
31
|
+
if (config.type === 'checkbox') {
|
|
32
|
+
return 1;
|
|
33
|
+
} else {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
component: DefaultCheckbox,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
canHandle: (config) => {
|
|
41
|
+
if (config.type === 'switch') {
|
|
42
|
+
return 1;
|
|
43
|
+
} else {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
component: DefaultSwitch,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
canHandle: (config) => {
|
|
51
|
+
if (config.type === 'inputnumber') {
|
|
52
|
+
return 1;
|
|
53
|
+
} else {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
component: DefaultInputNumber,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
canHandle: (config) => {
|
|
61
|
+
if (config.type === 'select') {
|
|
62
|
+
return 1;
|
|
63
|
+
} else {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
component: DefaultSelect,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
canHandle: (config) => {
|
|
71
|
+
if (config.type === 'datepicker') {
|
|
72
|
+
return 1;
|
|
73
|
+
} else {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
component: DefaultDatePicker,
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { RenderProps } from '@difizen/mana-app';
|
|
2
|
+
import { l10n } from '@difizen/mana-l10n';
|
|
3
|
+
import { Checkbox, DatePicker, Input, InputNumber, Select, Switch } from 'antd';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
const { Option } = Select;
|
|
8
|
+
|
|
9
|
+
export const DefaultInput: React.FC<RenderProps<string>> = ({ value, onChange }) => (
|
|
10
|
+
<Input value={value} onChange={(event) => onChange(event.target.value)} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const DefaultInputNumber: React.FC<RenderProps<number>> = ({
|
|
14
|
+
value,
|
|
15
|
+
onChange,
|
|
16
|
+
schema,
|
|
17
|
+
}) => (
|
|
18
|
+
<InputNumber
|
|
19
|
+
value={value}
|
|
20
|
+
min={schema.minimum ?? Number.MIN_SAFE_INTEGER}
|
|
21
|
+
max={schema.maximum ?? Number.MAX_SAFE_INTEGER}
|
|
22
|
+
onChange={(val) => onChange(val)}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const DefaultCheckbox: React.FC<RenderProps<boolean>> = ({
|
|
27
|
+
value,
|
|
28
|
+
onChange,
|
|
29
|
+
}) => {
|
|
30
|
+
return (
|
|
31
|
+
<Checkbox checked={value} onChange={(event) => onChange(event.target.checked)}>
|
|
32
|
+
{value ? l10n.t('开启') : l10n.t('关闭')}
|
|
33
|
+
</Checkbox>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const DefaultSwitch: React.FC<RenderProps<boolean>> = ({ value, onChange }) => (
|
|
38
|
+
<Switch checked={value} onChange={(checked: boolean) => onChange(checked)} />
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export const DefaultSelect: React.FC<RenderProps<string>> = ({
|
|
42
|
+
value,
|
|
43
|
+
onChange,
|
|
44
|
+
schema,
|
|
45
|
+
}) => (
|
|
46
|
+
<Select value={value} onChange={(val: string) => onChange(val)}>
|
|
47
|
+
{schema['enum'].map((val: string) => (
|
|
48
|
+
<Option key={val} value={val}>
|
|
49
|
+
{val}
|
|
50
|
+
</Option>
|
|
51
|
+
))}
|
|
52
|
+
</Select>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const dateFormat = 'YYYY/MM/DD';
|
|
56
|
+
|
|
57
|
+
export const DefaultDatePicker: React.FC<RenderProps<string>> = ({
|
|
58
|
+
value,
|
|
59
|
+
onChange,
|
|
60
|
+
}) => (
|
|
61
|
+
<DatePicker
|
|
62
|
+
value={dayjs(value, dateFormat)}
|
|
63
|
+
onChange={(date, dateString) => onChange(dateString)}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ManaModule, ConfigurationModule } from '@difizen/mana-app';
|
|
2
|
+
|
|
3
|
+
import { ConfigurationPanelView } from './configuration-panel-view.js';
|
|
4
|
+
import { DefaultConfigurationRenderContribution } from './configuration-render-contribution.js';
|
|
5
|
+
import { SettingEditorView } from './setting-editor-view.js';
|
|
6
|
+
import { SettingTreeService } from './setting-tree-service.js';
|
|
7
|
+
import { SettingTreeView } from './setting-tree-view.js';
|
|
8
|
+
|
|
9
|
+
export const SettingEditorModule = ManaModule.create()
|
|
10
|
+
.register(
|
|
11
|
+
SettingEditorView,
|
|
12
|
+
DefaultConfigurationRenderContribution,
|
|
13
|
+
ConfigurationPanelView,
|
|
14
|
+
SettingTreeView,
|
|
15
|
+
SettingTreeService,
|
|
16
|
+
)
|
|
17
|
+
.dependOn(ConfigurationModule);
|