@king-design/vue 3.6.2 → 3.8.0-beta.0
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/__tests__/__snapshots__/Vue Next Demos.md +399 -0
- package/components/anchor/constants.d.ts +2 -0
- package/components/anchor/constants.js +2 -0
- package/components/anchor/index.d.ts +41 -0
- package/components/anchor/index.js +141 -0
- package/components/anchor/index.spec.d.ts +1 -0
- package/components/anchor/index.spec.js +230 -0
- package/components/anchor/index.vdt.js +31 -0
- package/components/anchor/link.d.ts +16 -0
- package/components/anchor/link.js +52 -0
- package/components/anchor/link.vdt.js +49 -0
- package/components/anchor/styles.d.ts +5 -0
- package/components/anchor/styles.js +30 -0
- package/components/anchor/useScroll.d.ts +7 -0
- package/components/anchor/useScroll.js +218 -0
- package/components/bubble/bubble.d.ts +61 -0
- package/components/bubble/bubble.js +81 -0
- package/components/bubble/bubble.vdt.js +85 -0
- package/components/bubble/index.d.ts +1 -0
- package/components/bubble/index.js +1 -0
- package/components/bubble/index.spec.d.ts +1 -0
- package/components/bubble/index.spec.js +771 -0
- package/components/bubble/styles.d.ts +5 -0
- package/components/bubble/styles.js +53 -0
- package/components/bubble/useBubbleDisplay.d.ts +18 -0
- package/components/bubble/useBubbleDisplay.js +300 -0
- package/components/bubbleList/bubbleList.d.ts +87 -0
- package/components/bubbleList/bubbleList.js +75 -0
- package/components/bubbleList/bubbleList.vdt.js +143 -0
- package/components/bubbleList/index.d.ts +1 -0
- package/components/bubbleList/index.js +1 -0
- package/components/bubbleList/index.spec.d.ts +1 -0
- package/components/bubbleList/index.spec.js +1268 -0
- package/components/bubbleList/item.d.ts +16 -0
- package/components/bubbleList/item.js +27 -0
- package/components/bubbleList/item.vdt.js +36 -0
- package/components/bubbleList/styles.d.ts +5 -0
- package/components/bubbleList/styles.js +33 -0
- package/components/bubbleList/useBubbleList.d.ts +28 -0
- package/components/bubbleList/useBubbleList.js +455 -0
- package/components/checkbox/index.d.ts +3 -3
- package/components/dialog/base.vdt.js +1 -1
- package/components/drawer/index.d.ts +3 -0
- package/components/drawer/index.js +22 -3
- package/components/drawer/index.spec.js +83 -0
- package/components/drawer/index.vdt.js +23 -3
- package/components/drawer/styles.js +1 -1
- package/components/drawer/useDrawerResizable.d.ts +10 -0
- package/components/drawer/useDrawerResizable.js +162 -0
- package/components/fileCard/fileCard.d.ts +65 -0
- package/components/fileCard/fileCard.js +72 -0
- package/components/fileCard/fileCard.vdt.js +161 -0
- package/components/fileCard/fileCardAssets.d.ts +1 -0
- package/components/fileCard/fileCardAssets.js +54 -0
- package/components/fileCard/fileCardUtils.d.ts +14 -0
- package/components/fileCard/fileCardUtils.js +94 -0
- package/components/fileCard/index.d.ts +2 -0
- package/components/fileCard/index.js +2 -0
- package/components/fileCard/index.spec.d.ts +1 -0
- package/components/fileCard/index.spec.js +1096 -0
- package/components/fileCard/list.d.ts +29 -0
- package/components/fileCard/list.js +46 -0
- package/components/fileCard/list.vdt.js +71 -0
- package/components/fileCard/styles.d.ts +5 -0
- package/components/fileCard/styles.js +83 -0
- package/components/fileCard/useFileCard.d.ts +45 -0
- package/components/fileCard/useFileCard.js +330 -0
- package/components/fileCard/useFileCardList.d.ts +14 -0
- package/components/fileCard/useFileCardList.js +49 -0
- package/components/form/form.js +2 -1
- package/components/media/context.d.ts +6 -0
- package/components/media/context.js +2 -0
- package/components/media/group.d.ts +12 -0
- package/components/media/group.js +32 -0
- package/components/media/group.vdt.js +50 -0
- package/components/media/index.d.ts +2 -0
- package/components/media/index.js +2 -0
- package/components/media/index.spec.d.ts +1 -0
- package/components/media/index.spec.js +1691 -0
- package/components/media/media.d.ts +37 -0
- package/components/media/media.js +67 -0
- package/components/media/media.vdt.js +202 -0
- package/components/media/mediaAssets.d.ts +4 -0
- package/components/media/mediaAssets.js +9 -0
- package/components/media/mediaUtils.d.ts +6 -0
- package/components/media/mediaUtils.js +66 -0
- package/components/media/styles.d.ts +13 -0
- package/components/media/styles.js +52 -0
- package/components/media/types.d.ts +37 -0
- package/components/media/types.js +1 -0
- package/components/media/useMedia.d.ts +70 -0
- package/components/media/useMedia.js +471 -0
- package/components/media/useMediaGroup.d.ts +15 -0
- package/components/media/useMediaGroup.js +136 -0
- package/components/media/useMediaViewer.d.ts +14 -0
- package/components/media/useMediaViewer.js +129 -0
- package/components/media/viewer.d.ts +24 -0
- package/components/media/viewer.js +54 -0
- package/components/media/viewer.vdt.js +100 -0
- package/components/menu/styles.d.ts +1 -0
- package/components/menu/styles.js +4 -1
- package/components/notification/index.d.ts +1 -0
- package/components/notification/index.js +1 -0
- package/components/notification/index.spec.d.ts +1 -0
- package/components/notification/index.spec.js +317 -0
- package/components/notification/notification.d.ts +39 -0
- package/components/notification/notification.js +183 -0
- package/components/notification/notification.vdt.js +56 -0
- package/components/notification/notifications.d.ts +16 -0
- package/components/notification/notifications.js +51 -0
- package/components/notification/notifications.vdt.js +24 -0
- package/components/notification/styles.d.ts +9 -0
- package/components/notification/styles.js +110 -0
- package/components/radio/index.d.ts +3 -3
- package/components/select/styles.js +1 -1
- package/components/sender/icons.d.ts +3 -0
- package/components/sender/icons.js +17 -0
- package/components/sender/index.d.ts +1 -0
- package/components/sender/index.js +1 -0
- package/components/sender/index.spec.d.ts +1 -0
- package/components/sender/index.spec.js +1597 -0
- package/components/sender/sender.d.ts +104 -0
- package/components/sender/sender.js +111 -0
- package/components/sender/sender.vdt.js +230 -0
- package/components/sender/styles.d.ts +5 -0
- package/components/sender/styles.js +56 -0
- package/components/sender/useAutoResize.d.ts +4 -0
- package/components/sender/useAutoResize.js +99 -0
- package/components/sender/useSenderDrag.d.ts +6 -0
- package/components/sender/useSenderDrag.js +320 -0
- package/components/sender/useSenderInput.d.ts +16 -0
- package/components/sender/useSenderInput.js +101 -0
- package/components/sender/useSenderPaste.d.ts +5 -0
- package/components/sender/useSenderPaste.js +36 -0
- package/components/sender/useSenderUpload.d.ts +11 -0
- package/components/sender/useSenderUpload.js +395 -0
- package/components/skeleton/skeleton.d.ts +2 -1
- package/components/skeleton/skeleton.js +1 -1
- package/components/table/styles.js +1 -1
- package/components/tabs/useActiveBar.js +7 -3
- package/components/tag/base.d.ts +2 -0
- package/components/tag/base.js +3 -0
- package/components/tag/index.spec.js +17 -0
- package/components/tag/index.vdt.js +12 -5
- package/components/tag/styles.d.ts +9 -0
- package/components/tag/styles.js +14 -1
- package/components/tag/useColor.d.ts +7 -0
- package/components/tag/useColor.js +71 -0
- package/components/think/index.d.ts +1 -0
- package/components/think/index.js +1 -0
- package/components/think/index.spec.d.ts +1 -0
- package/components/think/index.spec.js +345 -0
- package/components/think/index.vdt.js +82 -0
- package/components/think/styles.d.ts +5 -0
- package/components/think/styles.js +25 -0
- package/components/think/think.d.ts +28 -0
- package/components/think/think.js +48 -0
- package/components/think/useThinkExpand.d.ts +10 -0
- package/components/think/useThinkExpand.js +56 -0
- package/components/timepicker/index.spec.js +70 -42
- package/components/timepicker/useDefaultValue.js +12 -7
- package/components/timepicker/useStep.js +4 -2
- package/components/transfer/index.d.ts +13 -0
- package/components/transfer/index.js +6 -2
- package/components/transfer/index.spec.js +197 -0
- package/components/transfer/index.vdt.js +28 -5
- package/components/transfer/styles.js +4 -1
- package/components/transfer/useCheck.js +2 -1
- package/components/transfer/usePagination.d.ts +12 -0
- package/components/transfer/usePagination.js +79 -0
- package/components/types.d.ts +4 -2
- package/components/upload/ajaxUploader.d.ts +1 -0
- package/components/upload/ajaxUploader.js +6 -0
- package/components/xmarkdown/index.d.ts +2 -0
- package/components/xmarkdown/index.js +1 -0
- package/components/xmarkdown/index.spec.d.ts +1 -0
- package/components/xmarkdown/index.spec.js +1666 -0
- package/components/xmarkdown/markdown/codeBlockRenderer.d.ts +8 -0
- package/components/xmarkdown/markdown/codeBlockRenderer.js +52 -0
- package/components/xmarkdown/markdown/codeblock.d.ts +8 -0
- package/components/xmarkdown/markdown/codeblock.js +74 -0
- package/components/xmarkdown/markdown/highlight.d.ts +17 -0
- package/components/xmarkdown/markdown/highlight.js +83 -0
- package/components/xmarkdown/markdown/index.d.ts +14 -0
- package/components/xmarkdown/markdown/index.js +14 -0
- package/components/xmarkdown/markdown/mermaid.d.ts +8 -0
- package/components/xmarkdown/markdown/mermaid.js +104 -0
- package/components/xmarkdown/markdown/renderTree.d.ts +54 -0
- package/components/xmarkdown/markdown/renderTree.js +386 -0
- package/components/xmarkdown/markdown/renderer.d.ts +18 -0
- package/components/xmarkdown/markdown/renderer.js +461 -0
- package/components/xmarkdown/markdown/streaming.d.ts +24 -0
- package/components/xmarkdown/markdown/streaming.js +513 -0
- package/components/xmarkdown/markdown/types.d.ts +124 -0
- package/components/xmarkdown/markdown/types.js +6 -0
- package/components/xmarkdown/markdown/utils.d.ts +7 -0
- package/components/xmarkdown/markdown/utils.js +9 -0
- package/components/xmarkdown/markdown.d.ts +1 -0
- package/components/xmarkdown/markdown.js +1 -0
- package/components/xmarkdown/styles.d.ts +5 -0
- package/components/xmarkdown/styles.js +50 -0
- package/components/xmarkdown/useMermaid.d.ts +27 -0
- package/components/xmarkdown/useMermaid.js +745 -0
- package/components/xmarkdown/useXMarkdownContent.d.ts +14 -0
- package/components/xmarkdown/useXMarkdownContent.js +218 -0
- package/components/xmarkdown/useXMarkdownDisplay.d.ts +26 -0
- package/components/xmarkdown/useXMarkdownDisplay.js +569 -0
- package/components/xmarkdown/xmarkdown.d.ts +61 -0
- package/components/xmarkdown/xmarkdown.js +109 -0
- package/components/xmarkdown/xmarkdown.vdt.js +43 -0
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/fonts/iconfont.eot +0 -0
- package/dist/fonts/iconfont.svg +235 -0
- package/dist/fonts/iconfont.ttf +0 -0
- package/dist/fonts/iconfont.woff +0 -0
- package/dist/fonts/iconfont.woff2 +0 -0
- package/dist/fonts/ionicons.eot +0 -0
- package/dist/fonts/ionicons.svg +2230 -0
- package/dist/fonts/ionicons.ttf +0 -0
- package/dist/fonts/ionicons.woff +0 -0
- package/dist/fonts/ionicons.woff2 +0 -0
- package/dist/i18n/en-US.js +1439 -0
- package/dist/i18n/en-US.js.map +1 -0
- package/dist/i18n/en-US.min.js +1 -0
- package/dist/i18n/index.js +283 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/index.min.js +1 -0
- package/dist/index.js +121177 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +1569 -0
- package/dist/kpc.css +4 -0
- package/dist/ksyun.css +4 -0
- package/i18n/en-US.d.ts +27 -0
- package/i18n/en-US.js +29 -1
- package/index.d.ts +11 -2
- package/index.js +11 -2
- package/install.js +2 -0
- package/package.json +10 -2
- package/styles/fonts/iconfont.eot +0 -0
- package/styles/fonts/iconfont.js +1 -1
- package/styles/fonts/iconfont.svg +38 -0
- package/styles/fonts/iconfont.ttf +0 -0
- package/styles/fonts/iconfont.woff +0 -0
- package/styles/fonts/iconfont.woff2 +0 -0
- package/styles/global.js +12 -6
- package/styles/theme.d.ts +8 -0
- package/styles/theme.js +5 -1
- package/yarn-error.log +0 -1013
|
@@ -1,22 +1,41 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
4
|
import template from './index.vdt';
|
|
4
5
|
import { BaseDialog } from '../dialog/base';
|
|
5
6
|
import { placements } from './styles';
|
|
7
|
+
import { useDrawerResizable } from './useDrawerResizable';
|
|
6
8
|
var typeDefs = _extends({}, BaseDialog.typeDefs, {
|
|
7
|
-
placement: placements
|
|
9
|
+
placement: placements,
|
|
10
|
+
resizable: Boolean
|
|
8
11
|
});
|
|
9
12
|
var defaults = function defaults() {
|
|
10
13
|
return _extends({}, BaseDialog.defaults(), {
|
|
11
14
|
placement: 'right',
|
|
12
|
-
draggable: false
|
|
15
|
+
draggable: false,
|
|
16
|
+
resizable: false
|
|
13
17
|
});
|
|
14
18
|
};
|
|
15
19
|
export var Drawer = /*#__PURE__*/function (_BaseDialog) {
|
|
16
20
|
_inheritsLoose(Drawer, _BaseDialog);
|
|
17
21
|
function Drawer() {
|
|
18
|
-
|
|
22
|
+
var _context;
|
|
23
|
+
var _this;
|
|
24
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
|
+
args[_key] = arguments[_key];
|
|
26
|
+
}
|
|
27
|
+
_this = _BaseDialog.call.apply(_BaseDialog, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
28
|
+
_this._resizable = useDrawerResizable(_this.dialogRef);
|
|
29
|
+
return _this;
|
|
19
30
|
}
|
|
31
|
+
var _proto = Drawer.prototype;
|
|
32
|
+
_proto.init = function init() {
|
|
33
|
+
var _this2 = this;
|
|
34
|
+
_BaseDialog.prototype.init.call(this);
|
|
35
|
+
this.watch('width', function (v) {
|
|
36
|
+
_this2._resizable.drawerWidth.set(v || null);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
20
39
|
return Drawer;
|
|
21
40
|
}(BaseDialog);
|
|
22
41
|
Drawer.template = template;
|
|
@@ -167,4 +167,87 @@ describe('Drawer', function () {
|
|
|
167
167
|
}
|
|
168
168
|
}, _callee5);
|
|
169
169
|
})));
|
|
170
|
+
it('should show resize bar when resizable is true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
171
|
+
var Demo, _mount5, instance, element;
|
|
172
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context8) {
|
|
173
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
174
|
+
case 0:
|
|
175
|
+
Demo = /*#__PURE__*/function (_Component2) {
|
|
176
|
+
_inheritsLoose(Demo, _Component2);
|
|
177
|
+
function Demo() {
|
|
178
|
+
var _context7;
|
|
179
|
+
var _this2;
|
|
180
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
181
|
+
args[_key2] = arguments[_key2];
|
|
182
|
+
}
|
|
183
|
+
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context7 = [this]).call(_context7, args)) || this;
|
|
184
|
+
_this2.Drawer = Drawer;
|
|
185
|
+
return _this2;
|
|
186
|
+
}
|
|
187
|
+
return Demo;
|
|
188
|
+
}(Component);
|
|
189
|
+
Demo.template = "\n const {Drawer} = this;\n <Drawer value={true} resizable={true} placement=\"right\">\n <div>Content</div>\n </Drawer>\n ";
|
|
190
|
+
_mount5 = mount(Demo), instance = _mount5[0], element = _mount5[1];
|
|
191
|
+
_context8.next = 5;
|
|
192
|
+
return wait();
|
|
193
|
+
case 5:
|
|
194
|
+
expect(getElement('.k-drawer-resize')).to.not.be.undefined;
|
|
195
|
+
case 6:
|
|
196
|
+
case "end":
|
|
197
|
+
return _context8.stop();
|
|
198
|
+
}
|
|
199
|
+
}, _callee6);
|
|
200
|
+
})));
|
|
201
|
+
it('should update width when dragging', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
202
|
+
var Demo, _mount6, instance, element, drawer, initialWidth, resizeBar, startX;
|
|
203
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context10) {
|
|
204
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
205
|
+
case 0:
|
|
206
|
+
Demo = /*#__PURE__*/function (_Component3) {
|
|
207
|
+
_inheritsLoose(Demo, _Component3);
|
|
208
|
+
function Demo() {
|
|
209
|
+
var _context9;
|
|
210
|
+
var _this3;
|
|
211
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
212
|
+
args[_key3] = arguments[_key3];
|
|
213
|
+
}
|
|
214
|
+
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context9 = [this]).call(_context9, args)) || this;
|
|
215
|
+
_this3.Drawer = Drawer;
|
|
216
|
+
return _this3;
|
|
217
|
+
}
|
|
218
|
+
return Demo;
|
|
219
|
+
}(Component);
|
|
220
|
+
Demo.template = "\n const {Drawer} = this;\n <Drawer value={true} resizable={true} placement=\"right\" ref=\"drawer\">\n <div>Content</div>\n </Drawer>\n ";
|
|
221
|
+
_mount6 = mount(Demo), instance = _mount6[0], element = _mount6[1];
|
|
222
|
+
_context10.next = 5;
|
|
223
|
+
return wait();
|
|
224
|
+
case 5:
|
|
225
|
+
drawer = instance.refs.drawer.dialogRef.value;
|
|
226
|
+
initialWidth = drawer.offsetWidth;
|
|
227
|
+
resizeBar = getElement('.k-drawer-resize');
|
|
228
|
+
startX = resizeBar.getBoundingClientRect().left;
|
|
229
|
+
dispatchEvent(resizeBar, 'mousedown', {
|
|
230
|
+
clientX: startX,
|
|
231
|
+
which: 1
|
|
232
|
+
});
|
|
233
|
+
_context10.next = 12;
|
|
234
|
+
return wait();
|
|
235
|
+
case 12:
|
|
236
|
+
dispatchEvent(document, 'mousemove', {
|
|
237
|
+
clientX: startX - 50
|
|
238
|
+
});
|
|
239
|
+
_context10.next = 15;
|
|
240
|
+
return wait();
|
|
241
|
+
case 15:
|
|
242
|
+
dispatchEvent(document, 'mouseup');
|
|
243
|
+
_context10.next = 18;
|
|
244
|
+
return wait(100);
|
|
245
|
+
case 18:
|
|
246
|
+
expect(drawer.offsetWidth).to.be.greaterThan(initialWidth);
|
|
247
|
+
case 19:
|
|
248
|
+
case "end":
|
|
249
|
+
return _context10.stop();
|
|
250
|
+
}
|
|
251
|
+
}, _callee7);
|
|
252
|
+
})));
|
|
170
253
|
});
|
|
@@ -7,16 +7,36 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
7
7
|
var $this = this;
|
|
8
8
|
var _this$get = this.get(),
|
|
9
9
|
placement = _this$get.placement,
|
|
10
|
-
overlay = _this$get.overlay
|
|
10
|
+
overlay = _this$get.overlay,
|
|
11
|
+
resizable = _this$get.resizable,
|
|
12
|
+
width = _this$get.width;
|
|
13
|
+
var _this$_resizable = this._resizable,
|
|
14
|
+
getResizeBarPosition = _this$_resizable.getResizeBarPosition,
|
|
15
|
+
getHeightResizeBarPosition = _this$_resizable.getHeightResizeBarPosition,
|
|
16
|
+
drawerWidth = _this$_resizable.drawerWidth,
|
|
17
|
+
isResizing = _this$_resizable.isResizing,
|
|
18
|
+
drawerHeight = _this$_resizable.drawerHeight,
|
|
19
|
+
startWidth = _this$_resizable.startWidth,
|
|
20
|
+
startHeight = _this$_resizable.startHeight;
|
|
21
|
+
var shouldShowHeightResizeBar = !!(resizable && (placement === 'top' || placement === 'bottom'));
|
|
11
22
|
var k = this.config.k;
|
|
12
23
|
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-drawer"] = true, _classNameObj[k + "-" + placement] = true, _classNameObj[makeStyles(overlay, k)] = true, _classNameObj);
|
|
13
24
|
return _$su.call($this, {
|
|
14
|
-
'className': _$cn(classNameObj)
|
|
25
|
+
'className': _$cn(classNameObj),
|
|
26
|
+
'width': resizable ? drawerWidth.value || width : width
|
|
15
27
|
}, function ($blocks) {
|
|
16
28
|
var _$blocks = {},
|
|
17
29
|
__$blocks = _$ex({}, $blocks);
|
|
18
30
|
return (_$blocks['_content'] = function ($super) {
|
|
19
|
-
return _$ce(2, 'div', $super(),
|
|
31
|
+
return _$ce(2, 'div', [$super(), !!resizable ? _$ce(2, 'div', null, 1, _$cn(k + "-drawer-resize " + k + "-drawer-resize-" + getResizeBarPosition()), {
|
|
32
|
+
'ev-mousedown': startWidth
|
|
33
|
+
}) : undefined, shouldShowHeightResizeBar ? _$ce(2, 'div', null, 1, _$cn(k + "-drawer-resize-horizontal " + k + "-drawer-resize-" + getHeightResizeBarPosition()), {
|
|
34
|
+
'ev-mousedown': startHeight
|
|
35
|
+
}) : undefined], 0, _$cn(k + "-drawer-content " + (isResizing.value ? k + "-drawer-resizing" : '')), {
|
|
36
|
+
'style': drawerHeight.value ? {
|
|
37
|
+
height: drawerHeight.value + "px"
|
|
38
|
+
} : null
|
|
39
|
+
});
|
|
20
40
|
}, __$blocks['_content'] = function ($super, data) {
|
|
21
41
|
var block = $blocks['_content'];
|
|
22
42
|
var callBlock = function callBlock() {
|
|
@@ -21,7 +21,7 @@ setDefault(function () {
|
|
|
21
21
|
});
|
|
22
22
|
export var makeStyles = cache(function makeStyles(overlay, k) {
|
|
23
23
|
var borderRadius = theme.largeBorderRadius;
|
|
24
|
-
return /*#__PURE__*/css("&.k-drawer{position:fixed;background:transparent;box-shadow:none;border-radius:0;}&.transition-enter-active,&.transition-leave-active,&.transition-appear-active{transition:opacity ", drawer.transition, "!important;overflow:hidden;.", k, "-drawer-content{transition:transform ", drawer.transition, ";}}.", k, "-drawer-content{height:100%;display:flex;background:#fff;flex-direction:column;transform:translateX(0);box-shadow:", drawer.boxShadow, ";.", k, "-dialog-body{flex-grow:1;overflow:auto;}}", makePlacementStyles(k, 'right', "right: 0; height: 100%;", "translateX(100%)", borderRadius + " 0 0 " + borderRadius), " ", makePlacementStyles(k, 'left', 'left: 0; height: 100%;', "translateX(-100%)", "0 " + borderRadius + " " + borderRadius + " 0"), " ", makePlacementStyles(k, 'top', 'left: 50%; top: 0; transform: translateX(-50%);', "translateY(-100%)", "0 0 " + borderRadius + " " + borderRadius), " ", makePlacementStyles(k, 'bottom', 'left: 50%; bottom: 0; transform: translateX(-50%);', "translateY(100%)", "0 " + borderRadius + " " + borderRadius + " 0"), " &.", k, "-top,&.", k, "-bottom{width:100%;}");
|
|
24
|
+
return /*#__PURE__*/css("&.k-drawer{position:fixed;background:transparent;box-shadow:none;border-radius:0;max-height:100vh;}&.transition-enter-active,&.transition-leave-active,&.transition-appear-active{transition:opacity ", drawer.transition, "!important;overflow:hidden;.", k, "-drawer-content{transition:transform ", drawer.transition, ";}}.", k, "-drawer-content{height:100%;max-height:100vh;display:flex;background:#fff;flex-direction:column;transform:translateX(0);box-shadow:", drawer.boxShadow, ";position:relative;.", k, "-dialog-body{flex-grow:1;overflow:auto;}&.", k, "-drawer-resizing{transition:none!important;}}.", k, "-drawer-resize{position:absolute;top:0;bottom:0;width:5px;cursor:col-resize;z-index:10;user-select:none;&:hover{background:rgba(0, 0, 0, 0.1);}&.", k, "-drawer-resize-right{right:0;}&.", k, "-drawer-resize-left{left:0;}}.", k, "-drawer-resize-horizontal{position:absolute;left:0;right:0;height:5px;cursor:row-resize;z-index:10;user-select:none;&:hover{background:rgba(0, 0, 0, 0.1);}&.", k, "-drawer-resize-top{top:0;}&.", k, "-drawer-resize-bottom{bottom:0;}}", makePlacementStyles(k, 'right', "right: 0; height: 100%;", "translateX(100%)", borderRadius + " 0 0 " + borderRadius), " ", makePlacementStyles(k, 'left', 'left: 0; height: 100%;', "translateX(-100%)", "0 " + borderRadius + " " + borderRadius + " 0"), " ", makePlacementStyles(k, 'top', 'left: 50%; top: 0; transform: translateX(-50%);', "translateY(-100%)", "0 0 " + borderRadius + " " + borderRadius), " ", makePlacementStyles(k, 'bottom', 'left: 50%; bottom: 0; transform: translateX(-50%);', "translateY(100%)", "0 " + borderRadius + " " + borderRadius + " 0"), " &.", k, "-top,&.", k, "-bottom{width:100%;}");
|
|
25
25
|
});
|
|
26
26
|
function makePlacementStyles(k, placement, styles, transform, borderRadius) {
|
|
27
27
|
return /*#__PURE__*/css("&.", k, "-drawer.", k, "-", placement, "{", styles, " &.transition-enter-from,&.transition-leave-to,&.transition-appear-from{.", k, "-drawer-content{transform:", transform, ";}}.", k, "-drawer-content{border-radius:", borderRadius, ";}}");
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RefObject } from 'intact-vue-next';
|
|
2
|
+
export declare function useDrawerResizable(drawerRef: RefObject<HTMLElement>): {
|
|
3
|
+
drawerWidth: import("../../hooks/useState").State<string | number | null>;
|
|
4
|
+
drawerHeight: import("../../hooks/useState").State<number | null>;
|
|
5
|
+
isResizing: import("../../hooks/useState").State<boolean>;
|
|
6
|
+
getResizeBarPosition: () => 'left' | 'right';
|
|
7
|
+
getHeightResizeBarPosition: () => 'top' | 'bottom';
|
|
8
|
+
startWidth: (e: MouseEvent) => void;
|
|
9
|
+
startHeight: (e: MouseEvent) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { useInstance, onMounted, onBeforeUnmount } from 'intact-vue-next';
|
|
2
|
+
import { useState } from '../../hooks/useState';
|
|
3
|
+
import { useDraggable } from '../../hooks/useDraggable';
|
|
4
|
+
export function useDrawerResizable(drawerRef) {
|
|
5
|
+
var instance = useInstance();
|
|
6
|
+
var _instance$get = instance.get(),
|
|
7
|
+
width = _instance$get.width;
|
|
8
|
+
var drawerWidth = useState(width || null);
|
|
9
|
+
var drawerHeight = useState(null);
|
|
10
|
+
var isResizing = useState(false);
|
|
11
|
+
var startX = 0;
|
|
12
|
+
var startWidth = 0;
|
|
13
|
+
var startY = 0;
|
|
14
|
+
var startHeight = 0;
|
|
15
|
+
var minWidth = 200; // 最小宽度
|
|
16
|
+
var maxWidth = window.innerWidth; // 最大宽度
|
|
17
|
+
var minHeight = 200; // 最小高度
|
|
18
|
+
var maxHeight = window.innerHeight; // 最大高度
|
|
19
|
+
// 监听窗口大小变化,更新最大宽高
|
|
20
|
+
var handleResize = null;
|
|
21
|
+
onMounted(function () {
|
|
22
|
+
handleResize = function handleResize() {
|
|
23
|
+
maxWidth = window.innerWidth;
|
|
24
|
+
maxHeight = window.innerHeight;
|
|
25
|
+
};
|
|
26
|
+
window.addEventListener('resize', handleResize);
|
|
27
|
+
});
|
|
28
|
+
onBeforeUnmount(function () {
|
|
29
|
+
if (handleResize) {
|
|
30
|
+
window.removeEventListener('resize', handleResize);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
// 宽度拖拽
|
|
34
|
+
function onStartWidth(e) {
|
|
35
|
+
var drawer = drawerRef.value;
|
|
36
|
+
if (!drawer) return;
|
|
37
|
+
startX = e.clientX;
|
|
38
|
+
startWidth = drawer.offsetWidth;
|
|
39
|
+
drawerWidth.set(startWidth);
|
|
40
|
+
isResizing.set(true);
|
|
41
|
+
// 锁定全局样式
|
|
42
|
+
document.body.style.cursor = 'col-resize';
|
|
43
|
+
document.body.style.userSelect = 'none';
|
|
44
|
+
}
|
|
45
|
+
function onMoveWidth(e) {
|
|
46
|
+
var drawer = drawerRef.value;
|
|
47
|
+
if (!drawer) return;
|
|
48
|
+
var _instance$get2 = instance.get(),
|
|
49
|
+
placement = _instance$get2.placement,
|
|
50
|
+
resizable = _instance$get2.resizable;
|
|
51
|
+
// 计算鼠标移动距离
|
|
52
|
+
var deltaX = e.clientX - startX;
|
|
53
|
+
var widthDelta = deltaX;
|
|
54
|
+
// 根据 placement 调整拖拽方向
|
|
55
|
+
if (placement === 'right') {
|
|
56
|
+
widthDelta = -deltaX;
|
|
57
|
+
} else if (placement === 'left') {
|
|
58
|
+
widthDelta = deltaX;
|
|
59
|
+
} else {
|
|
60
|
+
// top / bottom 模式:由于是居中(left: 50%, transform: translateX(-50%))对称增长
|
|
61
|
+
// 宽度变化量应该是位移的两倍才能保持鼠标跟随
|
|
62
|
+
widthDelta = deltaX * 2;
|
|
63
|
+
}
|
|
64
|
+
var newWidth = Math.max(minWidth, Math.min(maxWidth, startWidth + widthDelta));
|
|
65
|
+
drawerWidth.set(newWidth);
|
|
66
|
+
}
|
|
67
|
+
function onEndWidth() {
|
|
68
|
+
isResizing.set(false);
|
|
69
|
+
// 恢复全局样式
|
|
70
|
+
document.body.style.cursor = '';
|
|
71
|
+
document.body.style.userSelect = '';
|
|
72
|
+
}
|
|
73
|
+
var widthDrag = useDraggable({
|
|
74
|
+
onStart: onStartWidth,
|
|
75
|
+
onMove: onMoveWidth,
|
|
76
|
+
onEnd: onEndWidth,
|
|
77
|
+
disable: function disable() {
|
|
78
|
+
var _instance$get3 = instance.get(),
|
|
79
|
+
resizable = _instance$get3.resizable;
|
|
80
|
+
return !resizable;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
// 高度拖拽,仅在 placement 为 top / bottom 时启用
|
|
84
|
+
function onStartHeight(e) {
|
|
85
|
+
var drawer = drawerRef.value;
|
|
86
|
+
if (!drawer) return;
|
|
87
|
+
var _instance$get4 = instance.get(),
|
|
88
|
+
placement = _instance$get4.placement,
|
|
89
|
+
resizable = _instance$get4.resizable;
|
|
90
|
+
if (!resizable || placement !== 'top' && placement !== 'bottom') return;
|
|
91
|
+
startY = e.clientY;
|
|
92
|
+
startHeight = drawer.offsetHeight;
|
|
93
|
+
drawerHeight.set(startHeight);
|
|
94
|
+
isResizing.set(true);
|
|
95
|
+
// 锁定全局样式
|
|
96
|
+
document.body.style.cursor = 'row-resize';
|
|
97
|
+
document.body.style.userSelect = 'none';
|
|
98
|
+
}
|
|
99
|
+
function onMoveHeight(e) {
|
|
100
|
+
var drawer = drawerRef.value;
|
|
101
|
+
if (!drawer) return;
|
|
102
|
+
var _instance$get5 = instance.get(),
|
|
103
|
+
placement = _instance$get5.placement;
|
|
104
|
+
if (placement !== 'top' && placement !== 'bottom') return;
|
|
105
|
+
var deltaY = e.clientY - startY;
|
|
106
|
+
var heightDelta = placement === 'top' ? deltaY : -deltaY;
|
|
107
|
+
var newHeight = Math.max(minHeight, Math.min(maxHeight, startHeight + heightDelta));
|
|
108
|
+
// 设置状态,由模板进行渲染
|
|
109
|
+
drawerHeight.set(newHeight);
|
|
110
|
+
}
|
|
111
|
+
function onEndHeight() {
|
|
112
|
+
isResizing.set(false);
|
|
113
|
+
// 恢复全局样式
|
|
114
|
+
document.body.style.cursor = '';
|
|
115
|
+
document.body.style.userSelect = '';
|
|
116
|
+
}
|
|
117
|
+
var heightDrag = useDraggable({
|
|
118
|
+
onStart: onStartHeight,
|
|
119
|
+
onMove: onMoveHeight,
|
|
120
|
+
onEnd: onEndHeight,
|
|
121
|
+
disable: function disable() {
|
|
122
|
+
var _instance$get6 = instance.get(),
|
|
123
|
+
placement = _instance$get6.placement,
|
|
124
|
+
resizable = _instance$get6.resizable;
|
|
125
|
+
return !resizable || placement !== 'top' && placement !== 'bottom';
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
// 重置 resize 状态
|
|
129
|
+
function resetResizeState() {
|
|
130
|
+
var _instance$get7 = instance.get(),
|
|
131
|
+
width = _instance$get7.width;
|
|
132
|
+
drawerWidth.set(width || null);
|
|
133
|
+
drawerHeight.set(null);
|
|
134
|
+
}
|
|
135
|
+
// 监听 placement 变化,切换时重置 resize 状态
|
|
136
|
+
instance.watch('placement', function (newPlacement, oldPlacement) {
|
|
137
|
+
if (oldPlacement !== undefined && newPlacement !== oldPlacement) {
|
|
138
|
+
resetResizeState();
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
// 获取宽度拖拽条位置
|
|
142
|
+
function getResizeBarPosition() {
|
|
143
|
+
var _instance$get8 = instance.get(),
|
|
144
|
+
placement = _instance$get8.placement;
|
|
145
|
+
return placement === 'right' ? 'left' : 'right';
|
|
146
|
+
}
|
|
147
|
+
// 获取高度拖拽条位置
|
|
148
|
+
function getHeightResizeBarPosition() {
|
|
149
|
+
var _instance$get9 = instance.get(),
|
|
150
|
+
placement = _instance$get9.placement;
|
|
151
|
+
return placement === 'top' ? 'bottom' : 'top';
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
drawerWidth: drawerWidth,
|
|
155
|
+
drawerHeight: drawerHeight,
|
|
156
|
+
isResizing: isResizing,
|
|
157
|
+
getResizeBarPosition: getResizeBarPosition,
|
|
158
|
+
getHeightResizeBarPosition: getHeightResizeBarPosition,
|
|
159
|
+
startWidth: widthDrag.start,
|
|
160
|
+
startHeight: heightDrag.start
|
|
161
|
+
};
|
|
162
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Component, TypeDefs } from 'intact-vue-next';
|
|
2
|
+
import type { Events } from '../types';
|
|
3
|
+
import type { ResolvedFileCardType } from './fileCardUtils';
|
|
4
|
+
import type { MediaMaskValue } from '../media';
|
|
5
|
+
export type { ResolvedFileCardType } from './fileCardUtils';
|
|
6
|
+
export type FileCardType = 'file' | 'image' | 'video' | 'audio' | string;
|
|
7
|
+
export type FileCardStatus = 'default' | 'loading' | 'error' | 'done';
|
|
8
|
+
export type FileCardSize = 'mini' | 'small' | 'default' | 'large';
|
|
9
|
+
export type FileCardNativeProps = Record<string, any>;
|
|
10
|
+
export type FileCardValue = {
|
|
11
|
+
name?: string;
|
|
12
|
+
type?: FileCardType;
|
|
13
|
+
resolvedType: ResolvedFileCardType;
|
|
14
|
+
status: FileCardStatus;
|
|
15
|
+
src?: string;
|
|
16
|
+
poster?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
errorText?: string;
|
|
19
|
+
loadingText?: string;
|
|
20
|
+
byte?: number;
|
|
21
|
+
percent?: number;
|
|
22
|
+
size: FileCardSize;
|
|
23
|
+
};
|
|
24
|
+
export type FileCardMaskValue = FileCardValue & {
|
|
25
|
+
canPreview?: MediaMaskValue['canPreview'];
|
|
26
|
+
preview?: MediaMaskValue['preview'];
|
|
27
|
+
};
|
|
28
|
+
export interface FileCardProps {
|
|
29
|
+
name?: string;
|
|
30
|
+
type?: FileCardType;
|
|
31
|
+
status?: FileCardStatus;
|
|
32
|
+
src?: string;
|
|
33
|
+
poster?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
errorText?: string;
|
|
36
|
+
loadingText?: string;
|
|
37
|
+
byte?: number;
|
|
38
|
+
percent?: number;
|
|
39
|
+
showPreview?: boolean;
|
|
40
|
+
showNameTooltip?: boolean;
|
|
41
|
+
showDelIcon?: boolean;
|
|
42
|
+
icon?: string;
|
|
43
|
+
size?: FileCardSize;
|
|
44
|
+
imageProps?: FileCardNativeProps;
|
|
45
|
+
videoProps?: FileCardNativeProps;
|
|
46
|
+
audioProps?: FileCardNativeProps;
|
|
47
|
+
}
|
|
48
|
+
export interface FileCardEvents {
|
|
49
|
+
click: [FileCardValue, MouseEvent];
|
|
50
|
+
preview: [FileCardValue, MouseEvent];
|
|
51
|
+
delete: [FileCardValue, MouseEvent];
|
|
52
|
+
}
|
|
53
|
+
export interface FileCardBlocks {
|
|
54
|
+
icon: null;
|
|
55
|
+
description: null;
|
|
56
|
+
mask: FileCardMaskValue;
|
|
57
|
+
}
|
|
58
|
+
export declare class FileCard extends Component<FileCardProps, FileCardEvents, FileCardBlocks> {
|
|
59
|
+
static template: string | import('intact-vue-next').Template<any>;
|
|
60
|
+
static typeDefs: Required<TypeDefs<FileCardProps>>;
|
|
61
|
+
static defaults: () => Partial<FileCardProps>;
|
|
62
|
+
static events: Events<FileCardEvents>;
|
|
63
|
+
private config;
|
|
64
|
+
private model;
|
|
65
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import { Component } from 'intact-vue-next';
|
|
4
|
+
import template from './fileCard.vdt';
|
|
5
|
+
import { useConfigContext } from '../config';
|
|
6
|
+
import { useFileCard } from './useFileCard';
|
|
7
|
+
var typeDefs = {
|
|
8
|
+
name: String,
|
|
9
|
+
type: String,
|
|
10
|
+
status: ['default', 'loading', 'error', 'done'],
|
|
11
|
+
src: String,
|
|
12
|
+
poster: String,
|
|
13
|
+
description: String,
|
|
14
|
+
errorText: String,
|
|
15
|
+
loadingText: String,
|
|
16
|
+
byte: Number,
|
|
17
|
+
percent: Number,
|
|
18
|
+
showPreview: Boolean,
|
|
19
|
+
showNameTooltip: Boolean,
|
|
20
|
+
showDelIcon: Boolean,
|
|
21
|
+
icon: String,
|
|
22
|
+
size: ['mini', 'small', 'default', 'large'],
|
|
23
|
+
imageProps: Object,
|
|
24
|
+
videoProps: Object,
|
|
25
|
+
audioProps: Object
|
|
26
|
+
};
|
|
27
|
+
var defaults = function defaults() {
|
|
28
|
+
return {
|
|
29
|
+
name: undefined,
|
|
30
|
+
type: undefined,
|
|
31
|
+
status: 'default',
|
|
32
|
+
src: undefined,
|
|
33
|
+
poster: undefined,
|
|
34
|
+
description: undefined,
|
|
35
|
+
errorText: undefined,
|
|
36
|
+
loadingText: undefined,
|
|
37
|
+
byte: undefined,
|
|
38
|
+
percent: undefined,
|
|
39
|
+
showPreview: true,
|
|
40
|
+
showNameTooltip: false,
|
|
41
|
+
showDelIcon: false,
|
|
42
|
+
icon: undefined,
|
|
43
|
+
size: 'default',
|
|
44
|
+
imageProps: undefined,
|
|
45
|
+
videoProps: undefined,
|
|
46
|
+
audioProps: undefined
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
var events = {
|
|
50
|
+
click: true,
|
|
51
|
+
preview: true,
|
|
52
|
+
delete: true
|
|
53
|
+
};
|
|
54
|
+
export var FileCard = /*#__PURE__*/function (_Component) {
|
|
55
|
+
_inheritsLoose(FileCard, _Component);
|
|
56
|
+
function FileCard() {
|
|
57
|
+
var _context;
|
|
58
|
+
var _this;
|
|
59
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
|
+
args[_key] = arguments[_key];
|
|
61
|
+
}
|
|
62
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
63
|
+
_this.config = useConfigContext();
|
|
64
|
+
_this.model = useFileCard();
|
|
65
|
+
return _this;
|
|
66
|
+
}
|
|
67
|
+
return FileCard;
|
|
68
|
+
}(Component);
|
|
69
|
+
FileCard.template = template;
|
|
70
|
+
FileCard.typeDefs = typeDefs;
|
|
71
|
+
FileCard.defaults = defaults;
|
|
72
|
+
FileCard.events = events;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, createUnknownComponentVNode as _$cc, extend as _$ex, EMPTY_OBJ as _$em, noop as _$no } from 'intact-vue-next';
|
|
3
|
+
import { Icon } from '../icon';
|
|
4
|
+
import { Media } from '../media';
|
|
5
|
+
import { getRestProps, isEmptyString } from '../utils';
|
|
6
|
+
import { makeStyles } from './styles';
|
|
7
|
+
import { _$ } from '../../i18n';
|
|
8
|
+
import { isInvalid, noop } from 'intact-shared';
|
|
9
|
+
export default function ($props, $blocks, $__proto__) {
|
|
10
|
+
var _extends2, _$cn2, _$cn3;
|
|
11
|
+
$blocks || ($blocks = {});
|
|
12
|
+
$props || ($props = {});
|
|
13
|
+
var $this = this;
|
|
14
|
+
var _$blocks = {};
|
|
15
|
+
var __$blocks = {};
|
|
16
|
+
var _this$model = this.model,
|
|
17
|
+
getRootClassNameObj = _this$model.getRootClassNameObj,
|
|
18
|
+
getProgressStyle = _this$model.getProgressStyle,
|
|
19
|
+
onClick = _this$model.onClick,
|
|
20
|
+
isMediaType = _this$model.isMediaType,
|
|
21
|
+
shouldShowDeleteButton = _this$model.shouldShowDeleteButton,
|
|
22
|
+
onDelete = _this$model.onDelete,
|
|
23
|
+
getValue = _this$model.getValue,
|
|
24
|
+
onPreview = _this$model.onPreview,
|
|
25
|
+
isError = _this$model.isError,
|
|
26
|
+
getMediaLoadingText = _this$model.getMediaLoadingText,
|
|
27
|
+
getMediaErrorText = _this$model.getMediaErrorText,
|
|
28
|
+
getMediaErrorArtworkIconSrc = _this$model.getMediaErrorArtworkIconSrc,
|
|
29
|
+
shouldShowMediaStatusLayer = _this$model.shouldShowMediaStatusLayer,
|
|
30
|
+
shouldRenderMediaErrorArtwork = _this$model.shouldRenderMediaErrorArtwork,
|
|
31
|
+
shouldUseMediaErrorArtworkLayout = _this$model.shouldUseMediaErrorArtworkLayout,
|
|
32
|
+
shouldShowVisualMediaProgressText = _this$model.shouldShowVisualMediaProgressText,
|
|
33
|
+
getMediaProgressText = _this$model.getMediaProgressText,
|
|
34
|
+
getFileBadgeClassName = _this$model.getFileBadgeClassName,
|
|
35
|
+
getFileBadgeText = _this$model.getFileBadgeText,
|
|
36
|
+
hasCustomIcon = _this$model.hasCustomIcon,
|
|
37
|
+
getIconSource = _this$model.getIconSource,
|
|
38
|
+
hasBuiltinIcon = _this$model.hasBuiltinIcon,
|
|
39
|
+
getBuiltinIconSource = _this$model.getBuiltinIconSource,
|
|
40
|
+
getFileName = _this$model.getFileName,
|
|
41
|
+
getFileTitleText = _this$model.getFileTitleText,
|
|
42
|
+
getNamePrefix = _this$model.getNamePrefix,
|
|
43
|
+
hasNameSuffix = _this$model.hasNameSuffix,
|
|
44
|
+
getNameSuffix = _this$model.getNameSuffix,
|
|
45
|
+
shouldShowMiniFileStatusTitle = _this$model.shouldShowMiniFileStatusTitle,
|
|
46
|
+
getDisplayDescription = _this$model.getDisplayDescription,
|
|
47
|
+
getMediaType = _this$model.getMediaType,
|
|
48
|
+
getFileMediaType = _this$model.getFileMediaType,
|
|
49
|
+
getMediaStatus = _this$model.getMediaStatus,
|
|
50
|
+
getMediaShowPreview = _this$model.getMediaShowPreview,
|
|
51
|
+
onMediaError = _this$model.onMediaError,
|
|
52
|
+
getMediaSize = _this$model.getMediaSize,
|
|
53
|
+
getFileMediaSize = _this$model.getFileMediaSize,
|
|
54
|
+
shouldShowFileMedia = _this$model.shouldShowFileMedia;
|
|
55
|
+
var _this$get = this.get(),
|
|
56
|
+
className = _this$get.className,
|
|
57
|
+
style = _this$get.style;
|
|
58
|
+
var k = this.config.k;
|
|
59
|
+
var maskBlock = $blocks.mask;
|
|
60
|
+
var isEmptySlot = function isEmptySlot(value) {
|
|
61
|
+
if (isInvalid(value) || isEmptyString(value)) return true;
|
|
62
|
+
if (Array.isArray(value)) return value.every(function (item) {
|
|
63
|
+
return isEmptySlot(item);
|
|
64
|
+
});
|
|
65
|
+
if (value && value.type === 1) return isEmptySlot(value.children);
|
|
66
|
+
return false;
|
|
67
|
+
};
|
|
68
|
+
var value = getValue();
|
|
69
|
+
var shouldShowFileContent = !isMediaType();
|
|
70
|
+
var descriptionSlot = shouldShowFileContent && $blocks.description ? $blocks.description(noop, value) : undefined;
|
|
71
|
+
var fileMaskSlot = shouldShowFileContent && maskBlock ? maskBlock(noop, value) : undefined;
|
|
72
|
+
var hasDescriptionSlot = !isEmptySlot(descriptionSlot);
|
|
73
|
+
var hasFileMaskSlot = !isEmptySlot(fileMaskSlot);
|
|
74
|
+
var isMini = (this.get('size') || 'default') === 'mini';
|
|
75
|
+
var showDescription = !isMini && (hasDescriptionSlot || !!getDisplayDescription());
|
|
76
|
+
var classNameObj = _extends((_extends2 = {}, _extends2[k + "-file-card"] = true, _extends2[className] = className, _extends2[makeStyles(k)] = true, _extends2), getRootClassNameObj());
|
|
77
|
+
return _$cv('div', _extends({
|
|
78
|
+
'className': _$cn(classNameObj)
|
|
79
|
+
}, getRestProps(this), {
|
|
80
|
+
'style': style,
|
|
81
|
+
'ev-click': onClick
|
|
82
|
+
}), [shouldShowDeleteButton() ? _$ce(2, 'div', _$cc(Icon, {
|
|
83
|
+
'className': _$cn(k + "-icon-close-bold"),
|
|
84
|
+
'color': 'inherit'
|
|
85
|
+
}), 2, _$cn(k + "-file-card-delete"), {
|
|
86
|
+
'title': _$('删除'),
|
|
87
|
+
'ev-click': onDelete
|
|
88
|
+
}) : undefined, !shouldShowFileContent ? _$ce(2, 'div', [_$cc(Media, {
|
|
89
|
+
'className': _$cn(k + "-file-card-media-view"),
|
|
90
|
+
'name': getFileName(),
|
|
91
|
+
'type': getMediaType(),
|
|
92
|
+
'status': getMediaStatus(),
|
|
93
|
+
'src': this.get('src'),
|
|
94
|
+
'poster': this.get('poster'),
|
|
95
|
+
'size': getMediaSize(),
|
|
96
|
+
'showPreview': getMediaShowPreview(),
|
|
97
|
+
'showNameTooltip': this.get('showNameTooltip'),
|
|
98
|
+
'imageProps': this.get('imageProps'),
|
|
99
|
+
'videoProps': this.get('videoProps'),
|
|
100
|
+
'audioProps': this.get('audioProps'),
|
|
101
|
+
'ev-preview': onPreview,
|
|
102
|
+
'ev-loadError': onMediaError,
|
|
103
|
+
'$blocks': function ($blocks) {
|
|
104
|
+
var _$blocks = {},
|
|
105
|
+
__$blocks = _$ex({}, $blocks);
|
|
106
|
+
return (_$blocks['error'] = function ($super) {
|
|
107
|
+
return shouldRenderMediaErrorArtwork() ? _$ce(2, 'div', [_$ce(2, 'img', null, 1, _$cn(k + "-file-card-media-error-artwork-icon"), {
|
|
108
|
+
'src': getMediaErrorArtworkIconSrc(),
|
|
109
|
+
'alt': '',
|
|
110
|
+
'draggable': false
|
|
111
|
+
}), _$ce(2, 'span', getMediaErrorText(), 0, _$cn(k + "-file-card-error-text " + k + "-file-card-media-error-artwork-text"))], 4, _$cn(k + "-file-card-media-error-artwork-content")) : undefined;
|
|
112
|
+
}, __$blocks['error'] = function ($super, data) {
|
|
113
|
+
var block = $blocks['error'];
|
|
114
|
+
var callBlock = function callBlock() {
|
|
115
|
+
return _$blocks['error'].call($this, $super, data);
|
|
116
|
+
};
|
|
117
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
118
|
+
}), (_$blocks['mask'] = function ($super, media) {
|
|
119
|
+
return maskBlock && maskBlock(noop, media);
|
|
120
|
+
}, __$blocks['mask'] = function ($super, data) {
|
|
121
|
+
var block = $blocks['mask'];
|
|
122
|
+
var callBlock = function callBlock() {
|
|
123
|
+
return _$blocks['mask'].call($this, $super, data);
|
|
124
|
+
};
|
|
125
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
126
|
+
}), __$blocks;
|
|
127
|
+
}.call($this, _$em)
|
|
128
|
+
}), shouldShowMediaStatusLayer() && !shouldUseMediaErrorArtworkLayout() ? _$ce(2, 'div', _$ce(2, 'span', isError() ? getMediaErrorText() : getMediaLoadingText(), 0, _$cn((_$cn2 = {}, _$cn2[k + "-file-card-media-loading-text"] = !isError(), _$cn2[k + "-file-card-error-text"] = isError(), _$cn2))), 2, _$cn(k + "-file-card-media-status-layer")) : undefined, shouldShowVisualMediaProgressText() ? _$ce(2, 'div', getMediaProgressText(), 0, _$cn(k + "-file-card-media-progress-text")) : undefined], 0, _$cn(k + "-file-card-media-shell")) : _$ce(2, 'div', [_$ce(2, 'div', [shouldShowFileMedia() ? _$cc(Media, {
|
|
129
|
+
'className': _$cn(k + "-file-card-file-media-view"),
|
|
130
|
+
'name': getFileName(),
|
|
131
|
+
'type': getFileMediaType(),
|
|
132
|
+
'src': this.get('src'),
|
|
133
|
+
'poster': this.get('poster'),
|
|
134
|
+
'size': getFileMediaSize(),
|
|
135
|
+
'showPreview': this.get('showPreview'),
|
|
136
|
+
'showNameTooltip': false,
|
|
137
|
+
'imageProps': this.get('imageProps'),
|
|
138
|
+
'videoProps': this.get('videoProps'),
|
|
139
|
+
'audioProps': this.get('audioProps'),
|
|
140
|
+
'ev-preview': onPreview
|
|
141
|
+
}) : _$ce(2, 'div', hasCustomIcon() ? _$ce(2, 'img', null, 1, _$cn(k + "-file-card-file-icon-img"), {
|
|
142
|
+
'src': getIconSource(),
|
|
143
|
+
'alt': getFileName()
|
|
144
|
+
}) : $blocks.icon ? (_$blocks['icon'] = function ($super) {
|
|
145
|
+
return null;
|
|
146
|
+
}, __$blocks['icon'] = function ($super, data) {
|
|
147
|
+
var block = $blocks['icon'];
|
|
148
|
+
var callBlock = function callBlock() {
|
|
149
|
+
return _$blocks['icon'].call($this, $super, data);
|
|
150
|
+
};
|
|
151
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
152
|
+
}, __$blocks['icon'](_$no, getValue())) : hasBuiltinIcon() ? _$ce(2, 'img', null, 1, _$cn(k + "-file-card-file-icon-img"), {
|
|
153
|
+
'src': getBuiltinIconSource(),
|
|
154
|
+
'alt': getFileName()
|
|
155
|
+
}) : _$ce(2, 'span', getFileBadgeText(), 0), 0, _$cn(k + "-file-card-file-icon " + k + "-file-card-file-icon-" + getFileBadgeClassName())), _$ce(2, 'div', [_$ce(2, 'div', shouldShowMiniFileStatusTitle() ? _$ce(2, 'span', getFileTitleText(), 0, _$cn((_$cn3 = {}, _$cn3[k + "-file-card-title-prefix"] = true, _$cn3[k + "-file-card-title-status"] = true, _$cn3[k + "-file-card-title-status-error"] = isError(), _$cn3))) : [_$ce(2, 'span', getNamePrefix(), 0, _$cn(k + "-file-card-title-prefix")), hasNameSuffix() ? _$ce(2, 'span', getNameSuffix(), 0, _$cn(k + "-file-card-title-suffix")) : undefined], 0, _$cn(k + "-file-card-title"), {
|
|
156
|
+
'title': getFileTitleText()
|
|
157
|
+
}), showDescription ? _$ce(2, 'div', hasDescriptionSlot ? descriptionSlot : _$ce(2, 'span', getDisplayDescription(), 0), 0, _$cn(k + "-file-card-description")) : undefined], 0, _$cn(k + "-file-card-file-content"))], 4, _$cn(k + "-file-card-file-main")), hasFileMaskSlot ? _$ce(2, 'div', fileMaskSlot, 0, _$cn(k + "-file-card-mask " + k + "-file-card-file-mask")) : undefined], 0, _$cn(k + "-file-card-file-shell"), {
|
|
158
|
+
'style': getProgressStyle()
|
|
159
|
+
})]);
|
|
160
|
+
}
|
|
161
|
+
;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getBuiltinFileIconByExtension(ext: string, resolvedType?: 'file' | 'image' | 'video' | 'audio'): string;
|