@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
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var _context;
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
4
|
+
import { useInstance } from 'intact-vue-next';
|
|
5
|
+
import { palette } from '../../styles/utils';
|
|
6
|
+
import { useState } from '../../hooks/useState';
|
|
7
|
+
import { useReceive } from '../../hooks/useReceive';
|
|
8
|
+
import { theme } from '../../styles/theme';
|
|
9
|
+
// type 支持的颜色
|
|
10
|
+
var TYPE_COLORS = ['default', 'primary', 'danger', 'success', 'warning'];
|
|
11
|
+
// color 支持的扩展内置颜色
|
|
12
|
+
var EXTENDED_COLORS = ['purple', 'teal', 'blue', 'yellow'];
|
|
13
|
+
// 所有内置颜色
|
|
14
|
+
var BUILT_IN_COLORS = _concatInstanceProperty(_context = []).call(_context, TYPE_COLORS, EXTENDED_COLORS);
|
|
15
|
+
export function getIconColorValue(color, disabled) {
|
|
16
|
+
if (disabled) return theme.color.disabled;
|
|
17
|
+
if (!color || color === 'default') return 'default';
|
|
18
|
+
if (_includesInstanceProperty(BUILT_IN_COLORS).call(BUILT_IN_COLORS, color)) {
|
|
19
|
+
var themeColor = theme.color[color];
|
|
20
|
+
return themeColor;
|
|
21
|
+
}
|
|
22
|
+
return color;
|
|
23
|
+
}
|
|
24
|
+
export function useColor() {
|
|
25
|
+
var instance = useInstance();
|
|
26
|
+
var effectiveColor = useState(undefined);
|
|
27
|
+
var colorClassName = useState(undefined);
|
|
28
|
+
var customStyle = useState({});
|
|
29
|
+
var iconColor = useState(undefined);
|
|
30
|
+
function updateColor() {
|
|
31
|
+
var _instance$get = instance.get(),
|
|
32
|
+
color = _instance$get.color,
|
|
33
|
+
type = _instance$get.type,
|
|
34
|
+
disabled = _instance$get.disabled;
|
|
35
|
+
var _effectiveColor = color || (_includesInstanceProperty(TYPE_COLORS).call(TYPE_COLORS, type) ? type : undefined); // color优先
|
|
36
|
+
effectiveColor.set(_effectiveColor);
|
|
37
|
+
var isBuiltIn = _effectiveColor ? _includesInstanceProperty(BUILT_IN_COLORS).call(BUILT_IN_COLORS, _effectiveColor) : false;
|
|
38
|
+
// 内置颜色 - 更新 colorClassName
|
|
39
|
+
if (_effectiveColor && isBuiltIn && _effectiveColor !== 'default') {
|
|
40
|
+
colorClassName.set(_effectiveColor);
|
|
41
|
+
} else {
|
|
42
|
+
colorClassName.set(undefined);
|
|
43
|
+
}
|
|
44
|
+
// 自定义颜色 - 更新 customStyle
|
|
45
|
+
if (_effectiveColor && !isBuiltIn && !disabled) {
|
|
46
|
+
var bgColor = palette(_effectiveColor, -4);
|
|
47
|
+
customStyle.set({
|
|
48
|
+
color: _effectiveColor,
|
|
49
|
+
borderColor: _effectiveColor,
|
|
50
|
+
backgroundColor: bgColor
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
customStyle.set({});
|
|
54
|
+
}
|
|
55
|
+
// 更新 iconColor
|
|
56
|
+
if (!_effectiveColor && !disabled) {
|
|
57
|
+
iconColor.set('default');
|
|
58
|
+
} else {
|
|
59
|
+
var _iconColor = getIconColorValue(_effectiveColor, disabled);
|
|
60
|
+
iconColor.set(_iconColor);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
useReceive(['color', 'type', 'disabled'], updateColor);
|
|
64
|
+
updateColor();
|
|
65
|
+
return {
|
|
66
|
+
effectiveColor: effectiveColor,
|
|
67
|
+
colorClassName: colorClassName,
|
|
68
|
+
customStyle: customStyle,
|
|
69
|
+
iconColor: iconColor
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './think';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './think';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
4
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
5
|
+
import { Component } from 'intact-vue-next';
|
|
6
|
+
import { mount, unmount, wait } from '../../test/utils';
|
|
7
|
+
import { Think } from '.';
|
|
8
|
+
describe('Think', function () {
|
|
9
|
+
afterEach(function () {
|
|
10
|
+
unmount();
|
|
11
|
+
});
|
|
12
|
+
it('should render title and content', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
13
|
+
var Demo, _mount, element;
|
|
14
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
15
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
16
|
+
case 0:
|
|
17
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
18
|
+
_inheritsLoose(Demo, _Component);
|
|
19
|
+
function Demo() {
|
|
20
|
+
var _context;
|
|
21
|
+
var _this;
|
|
22
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
23
|
+
args[_key] = arguments[_key];
|
|
24
|
+
}
|
|
25
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
26
|
+
_this.Think = Think;
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
return Demo;
|
|
30
|
+
}(Component);
|
|
31
|
+
Demo.template = "\n const { Think } = this;\n <div>\n <Think title=\"\u5DF2\u601D\u8003\uFF08\u7528\u65F6 6 \u79D2\uFF09\" content=\"\u5148\u62C6\u89E3\u95EE\u9898\uFF0C\u518D\u7EC4\u7EC7\u7B54\u6848\u3002\" />\n </div>\n ";
|
|
32
|
+
_mount = mount(Demo), element = _mount[1];
|
|
33
|
+
expect(element.querySelector('.k-think-title').textContent).to.contain('已思考');
|
|
34
|
+
expect(element.querySelector('.k-think-text').textContent).to.contain('先拆解问题');
|
|
35
|
+
case 5:
|
|
36
|
+
case "end":
|
|
37
|
+
return _context2.stop();
|
|
38
|
+
}
|
|
39
|
+
}, _callee);
|
|
40
|
+
})));
|
|
41
|
+
it('should toggle content and trigger expand event', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
42
|
+
var Demo, _mount2, instance, element, root, status;
|
|
43
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context4) {
|
|
44
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
45
|
+
case 0:
|
|
46
|
+
Demo = /*#__PURE__*/function (_Component2) {
|
|
47
|
+
_inheritsLoose(Demo, _Component2);
|
|
48
|
+
function Demo() {
|
|
49
|
+
var _context3;
|
|
50
|
+
var _this2;
|
|
51
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
52
|
+
args[_key2] = arguments[_key2];
|
|
53
|
+
}
|
|
54
|
+
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context3 = [this]).call(_context3, args)) || this;
|
|
55
|
+
_this2.Think = Think;
|
|
56
|
+
return _this2;
|
|
57
|
+
}
|
|
58
|
+
Demo.defaults = function defaults() {
|
|
59
|
+
return {
|
|
60
|
+
expanded: true
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
return Demo;
|
|
64
|
+
}(Component);
|
|
65
|
+
Demo.template = "\n const { Think } = this;\n <div>\n <Think\n v-model:expanded=\"expanded\"\n content=\"thinking content\"\n />\n </div>\n ";
|
|
66
|
+
_mount2 = mount(Demo), instance = _mount2[0], element = _mount2[1];
|
|
67
|
+
root = element.querySelector('.k-think');
|
|
68
|
+
status = element.querySelector('.k-think-status');
|
|
69
|
+
expect(root.classList.contains('k-think-expanded')).to.be.true;
|
|
70
|
+
status.click();
|
|
71
|
+
_context4.next = 9;
|
|
72
|
+
return wait(50);
|
|
73
|
+
case 9:
|
|
74
|
+
expect(instance.get('expanded')).to.eql(false);
|
|
75
|
+
expect(root.classList.contains('k-think-expanded')).to.be.false;
|
|
76
|
+
case 11:
|
|
77
|
+
case "end":
|
|
78
|
+
return _context4.stop();
|
|
79
|
+
}
|
|
80
|
+
}, _callee2);
|
|
81
|
+
})));
|
|
82
|
+
it('should respect defaultExpanded in uncontrolled mode', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
83
|
+
var Demo, _mount3, element, root, status;
|
|
84
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context6) {
|
|
85
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
86
|
+
case 0:
|
|
87
|
+
Demo = /*#__PURE__*/function (_Component3) {
|
|
88
|
+
_inheritsLoose(Demo, _Component3);
|
|
89
|
+
function Demo() {
|
|
90
|
+
var _context5;
|
|
91
|
+
var _this3;
|
|
92
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
93
|
+
args[_key3] = arguments[_key3];
|
|
94
|
+
}
|
|
95
|
+
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context5 = [this]).call(_context5, args)) || this;
|
|
96
|
+
_this3.Think = Think;
|
|
97
|
+
return _this3;
|
|
98
|
+
}
|
|
99
|
+
return Demo;
|
|
100
|
+
}(Component);
|
|
101
|
+
Demo.template = "\n const { Think } = this;\n <div>\n <Think\n title=\"\u5DF2\u601D\u8003\"\n content=\"\u9ED8\u8BA4\u6298\u53E0\u5185\u5BB9\"\n defaultExpanded={false}\n />\n </div>\n ";
|
|
102
|
+
_mount3 = mount(Demo), element = _mount3[1];
|
|
103
|
+
root = element.querySelector('.k-think');
|
|
104
|
+
_context6.next = 6;
|
|
105
|
+
return wait(50);
|
|
106
|
+
case 6:
|
|
107
|
+
expect(root.classList.contains('k-think-expanded')).to.be.false;
|
|
108
|
+
status = element.querySelector('.k-think-status');
|
|
109
|
+
status.click();
|
|
110
|
+
_context6.next = 11;
|
|
111
|
+
return wait(50);
|
|
112
|
+
case 11:
|
|
113
|
+
expect(root.classList.contains('k-think-expanded')).to.be.true;
|
|
114
|
+
expect(element.querySelector('.k-think-text').textContent).to.contain('默认折叠内容');
|
|
115
|
+
case 13:
|
|
116
|
+
case "end":
|
|
117
|
+
return _context6.stop();
|
|
118
|
+
}
|
|
119
|
+
}, _callee3);
|
|
120
|
+
})));
|
|
121
|
+
it('should reflect loading state on root and icon', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
122
|
+
var Demo, _mount4, element, root, icon;
|
|
123
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context8) {
|
|
124
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
Demo = /*#__PURE__*/function (_Component4) {
|
|
127
|
+
_inheritsLoose(Demo, _Component4);
|
|
128
|
+
function Demo() {
|
|
129
|
+
var _context7;
|
|
130
|
+
var _this4;
|
|
131
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
132
|
+
args[_key4] = arguments[_key4];
|
|
133
|
+
}
|
|
134
|
+
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context7 = [this]).call(_context7, args)) || this;
|
|
135
|
+
_this4.Think = Think;
|
|
136
|
+
return _this4;
|
|
137
|
+
}
|
|
138
|
+
return Demo;
|
|
139
|
+
}(Component);
|
|
140
|
+
Demo.template = "\n const { Think } = this;\n <div>\n <Think title=\"\u601D\u8003\u4E2D\" loading content=\"\u5185\u5BB9\" />\n </div>\n ";
|
|
141
|
+
_mount4 = mount(Demo), element = _mount4[1];
|
|
142
|
+
_context8.next = 5;
|
|
143
|
+
return wait(50);
|
|
144
|
+
case 5:
|
|
145
|
+
root = element.querySelector('.k-think');
|
|
146
|
+
expect(root.classList.contains('k-think-loading')).to.be.true;
|
|
147
|
+
icon = root.querySelector('.k-think-icon i');
|
|
148
|
+
expect(icon.classList.contains('ion-load-c')).to.be.true;
|
|
149
|
+
expect(icon.classList.contains('k-rotate')).to.be.true;
|
|
150
|
+
case 10:
|
|
151
|
+
case "end":
|
|
152
|
+
return _context8.stop();
|
|
153
|
+
}
|
|
154
|
+
}, _callee4);
|
|
155
|
+
})));
|
|
156
|
+
it('should apply blink class when blink is true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
157
|
+
var Demo, _mount5, element, root;
|
|
158
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context10) {
|
|
159
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
160
|
+
case 0:
|
|
161
|
+
Demo = /*#__PURE__*/function (_Component5) {
|
|
162
|
+
_inheritsLoose(Demo, _Component5);
|
|
163
|
+
function Demo() {
|
|
164
|
+
var _context9;
|
|
165
|
+
var _this5;
|
|
166
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
167
|
+
args[_key5] = arguments[_key5];
|
|
168
|
+
}
|
|
169
|
+
_this5 = _Component5.call.apply(_Component5, _concatInstanceProperty(_context9 = [this]).call(_context9, args)) || this;
|
|
170
|
+
_this5.Think = Think;
|
|
171
|
+
return _this5;
|
|
172
|
+
}
|
|
173
|
+
return Demo;
|
|
174
|
+
}(Component);
|
|
175
|
+
Demo.template = "\n const { Think } = this;\n <div>\n <Think title=\"\u95EA\u70C1\u6807\u9898\" blink content=\"\u6B63\u6587\" />\n </div>\n ";
|
|
176
|
+
_mount5 = mount(Demo), element = _mount5[1];
|
|
177
|
+
_context10.next = 5;
|
|
178
|
+
return wait(50);
|
|
179
|
+
case 5:
|
|
180
|
+
root = element.querySelector('.k-think');
|
|
181
|
+
expect(root.classList.contains('k-think-blink')).to.be.true;
|
|
182
|
+
case 7:
|
|
183
|
+
case "end":
|
|
184
|
+
return _context10.stop();
|
|
185
|
+
}
|
|
186
|
+
}, _callee5);
|
|
187
|
+
})));
|
|
188
|
+
it('should set max width from maxWidthString', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
189
|
+
var Demo, _mount6, element, root;
|
|
190
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context12) {
|
|
191
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
192
|
+
case 0:
|
|
193
|
+
Demo = /*#__PURE__*/function (_Component6) {
|
|
194
|
+
_inheritsLoose(Demo, _Component6);
|
|
195
|
+
function Demo() {
|
|
196
|
+
var _context11;
|
|
197
|
+
var _this6;
|
|
198
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
199
|
+
args[_key6] = arguments[_key6];
|
|
200
|
+
}
|
|
201
|
+
_this6 = _Component6.call.apply(_Component6, _concatInstanceProperty(_context11 = [this]).call(_context11, args)) || this;
|
|
202
|
+
_this6.Think = Think;
|
|
203
|
+
return _this6;
|
|
204
|
+
}
|
|
205
|
+
return Demo;
|
|
206
|
+
}(Component);
|
|
207
|
+
Demo.template = "\n const { Think } = this;\n <div>\n <Think title=\"\u6807\u9898\" content=\"\u5185\u5BB9\" maxWidthString=\"480px\" />\n </div>\n ";
|
|
208
|
+
_mount6 = mount(Demo), element = _mount6[1];
|
|
209
|
+
_context12.next = 5;
|
|
210
|
+
return wait(50);
|
|
211
|
+
case 5:
|
|
212
|
+
root = element.querySelector('.k-think');
|
|
213
|
+
expect(root.style.maxWidth).to.eql('480px');
|
|
214
|
+
case 7:
|
|
215
|
+
case "end":
|
|
216
|
+
return _context12.stop();
|
|
217
|
+
}
|
|
218
|
+
}, _callee6);
|
|
219
|
+
})));
|
|
220
|
+
it('should emit expand with next expanded value', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
221
|
+
var last, Demo, _mount7, instance, element, status;
|
|
222
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context14) {
|
|
223
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
224
|
+
case 0:
|
|
225
|
+
Demo = /*#__PURE__*/function (_Component7) {
|
|
226
|
+
_inheritsLoose(Demo, _Component7);
|
|
227
|
+
function Demo() {
|
|
228
|
+
var _context13;
|
|
229
|
+
var _this7;
|
|
230
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
231
|
+
args[_key7] = arguments[_key7];
|
|
232
|
+
}
|
|
233
|
+
_this7 = _Component7.call.apply(_Component7, _concatInstanceProperty(_context13 = [this]).call(_context13, args)) || this;
|
|
234
|
+
_this7.Think = Think;
|
|
235
|
+
_this7.onExpand = function (v) {
|
|
236
|
+
last = v;
|
|
237
|
+
};
|
|
238
|
+
return _this7;
|
|
239
|
+
}
|
|
240
|
+
Demo.defaults = function defaults() {
|
|
241
|
+
return {
|
|
242
|
+
expanded: false
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
return Demo;
|
|
246
|
+
}(Component);
|
|
247
|
+
Demo.template = "\n const { Think } = this;\n <div>\n <Think\n v-model:expanded=\"expanded\"\n content=\"c\"\n ev-expand={this.onExpand}\n />\n </div>\n ";
|
|
248
|
+
_mount7 = mount(Demo), instance = _mount7[0], element = _mount7[1];
|
|
249
|
+
status = element.querySelector('.k-think-status');
|
|
250
|
+
status.click();
|
|
251
|
+
_context14.next = 7;
|
|
252
|
+
return wait(50);
|
|
253
|
+
case 7:
|
|
254
|
+
expect(last).to.eql(true);
|
|
255
|
+
expect(instance.get('expanded')).to.eql(true);
|
|
256
|
+
status.click();
|
|
257
|
+
_context14.next = 12;
|
|
258
|
+
return wait(50);
|
|
259
|
+
case 12:
|
|
260
|
+
expect(last).to.eql(false);
|
|
261
|
+
expect(instance.get('expanded')).to.eql(false);
|
|
262
|
+
case 14:
|
|
263
|
+
case "end":
|
|
264
|
+
return _context14.stop();
|
|
265
|
+
}
|
|
266
|
+
}, _callee7);
|
|
267
|
+
})));
|
|
268
|
+
it('should hide arrow and content region when there is no content', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
269
|
+
var Demo, _mount8, element;
|
|
270
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context16) {
|
|
271
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
272
|
+
case 0:
|
|
273
|
+
Demo = /*#__PURE__*/function (_Component8) {
|
|
274
|
+
_inheritsLoose(Demo, _Component8);
|
|
275
|
+
function Demo() {
|
|
276
|
+
var _context15;
|
|
277
|
+
var _this8;
|
|
278
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
279
|
+
args[_key8] = arguments[_key8];
|
|
280
|
+
}
|
|
281
|
+
_this8 = _Component8.call.apply(_Component8, _concatInstanceProperty(_context15 = [this]).call(_context15, args)) || this;
|
|
282
|
+
_this8.Think = Think;
|
|
283
|
+
return _this8;
|
|
284
|
+
}
|
|
285
|
+
return Demo;
|
|
286
|
+
}(Component);
|
|
287
|
+
Demo.template = "\n const { Think } = this;\n <div>\n <Think title=\"\u4EC5\u6807\u9898\" />\n </div>\n ";
|
|
288
|
+
_mount8 = mount(Demo), element = _mount8[1];
|
|
289
|
+
_context16.next = 5;
|
|
290
|
+
return wait(50);
|
|
291
|
+
case 5:
|
|
292
|
+
expect(element.querySelector('.k-think-arrow')).to.be.null;
|
|
293
|
+
expect(element.querySelector('.k-think-wrapper')).to.be.null;
|
|
294
|
+
case 7:
|
|
295
|
+
case "end":
|
|
296
|
+
return _context16.stop();
|
|
297
|
+
}
|
|
298
|
+
}, _callee8);
|
|
299
|
+
})));
|
|
300
|
+
it('should not render extra and content wrappers for empty conditional slots', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
301
|
+
var Demo, _mount9, instance, element;
|
|
302
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context18) {
|
|
303
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
304
|
+
case 0:
|
|
305
|
+
Demo = /*#__PURE__*/function (_Component9) {
|
|
306
|
+
_inheritsLoose(Demo, _Component9);
|
|
307
|
+
function Demo() {
|
|
308
|
+
var _context17;
|
|
309
|
+
var _this9;
|
|
310
|
+
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
|
311
|
+
args[_key9] = arguments[_key9];
|
|
312
|
+
}
|
|
313
|
+
_this9 = _Component9.call.apply(_Component9, _concatInstanceProperty(_context17 = [this]).call(_context17, args)) || this;
|
|
314
|
+
_this9.Think = Think;
|
|
315
|
+
return _this9;
|
|
316
|
+
}
|
|
317
|
+
Demo.defaults = function defaults() {
|
|
318
|
+
return {
|
|
319
|
+
showSlot: false
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
return Demo;
|
|
323
|
+
}(Component);
|
|
324
|
+
Demo.template = "\n const { Think } = this;\n <div>\n <Think title=\"\u4EC5\u6807\u9898\">\n <b:extra>\n <span v-if={this.get('showSlot')} class=\"conditional-extra\">extra</span>\n </b:extra>\n <b:content>\n <span v-if={this.get('showSlot')} class=\"conditional-content\">content</span>\n </b:content>\n </Think>\n </div>\n ";
|
|
325
|
+
_mount9 = mount(Demo), instance = _mount9[0], element = _mount9[1];
|
|
326
|
+
_context18.next = 5;
|
|
327
|
+
return wait(50);
|
|
328
|
+
case 5:
|
|
329
|
+
expect(element.querySelector('.k-think-extra')).to.eql(null);
|
|
330
|
+
expect(element.querySelector('.k-think-arrow')).to.eql(null);
|
|
331
|
+
expect(element.querySelector('.k-think-wrapper')).to.eql(null);
|
|
332
|
+
instance.set('showSlot', true);
|
|
333
|
+
_context18.next = 11;
|
|
334
|
+
return wait(50);
|
|
335
|
+
case 11:
|
|
336
|
+
expect(element.querySelector('.conditional-extra').textContent).to.eql('extra');
|
|
337
|
+
expect(element.querySelector('.conditional-content').textContent).to.eql('content');
|
|
338
|
+
expect(element.querySelector('.k-think-arrow')).not.to.eql(null);
|
|
339
|
+
case 14:
|
|
340
|
+
case "end":
|
|
341
|
+
return _context18.stop();
|
|
342
|
+
}
|
|
343
|
+
}, _callee9);
|
|
344
|
+
})));
|
|
345
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, noop as _$no, createUnknownComponentVNode as _$cc } from 'intact-vue-next';
|
|
3
|
+
import { Transition } from 'intact-vue-next';
|
|
4
|
+
import { Icon } from '../icon';
|
|
5
|
+
import { isInvalid, noop } from 'intact-shared';
|
|
6
|
+
import { expandAnimationCallbacks, getRestProps, isEmptyString } from '../utils';
|
|
7
|
+
import { makeStyles } from './styles';
|
|
8
|
+
export default function ($props, $blocks, $__proto__) {
|
|
9
|
+
var _classNameObj;
|
|
10
|
+
$blocks || ($blocks = {});
|
|
11
|
+
$props || ($props = {});
|
|
12
|
+
var $this = this;
|
|
13
|
+
var _$blocks = {};
|
|
14
|
+
var __$blocks = {};
|
|
15
|
+
var _this$think = this.think,
|
|
16
|
+
hasContentProp = _this$think.hasContentProp,
|
|
17
|
+
isExpanded = _this$think.isExpanded,
|
|
18
|
+
getRootStyle = _this$think.getRootStyle,
|
|
19
|
+
getTitleText = _this$think.getTitleText,
|
|
20
|
+
getContentText = _this$think.getContentText,
|
|
21
|
+
onToggle = _this$think.onToggle;
|
|
22
|
+
var _this$get = this.get(),
|
|
23
|
+
className = _this$get.className,
|
|
24
|
+
loading = _this$get.loading,
|
|
25
|
+
blink = _this$get.blink,
|
|
26
|
+
children = _this$get.children;
|
|
27
|
+
var k = this.config.k;
|
|
28
|
+
var isEmptySlot = function isEmptySlot(value) {
|
|
29
|
+
if (isInvalid(value) || isEmptyString(value)) return true;
|
|
30
|
+
if (Array.isArray(value)) return value.every(function (item) {
|
|
31
|
+
return isEmptySlot(item);
|
|
32
|
+
});
|
|
33
|
+
if (value && value.type === 1) return isEmptySlot(value.children);
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
var extraSlot = $blocks.extra ? $blocks.extra(noop) : undefined;
|
|
37
|
+
var contentSlot = $blocks.content ? $blocks.content(noop) : undefined;
|
|
38
|
+
var hasExtraSlot = !isEmptySlot(extraSlot);
|
|
39
|
+
var hasContentSlot = !isEmptySlot(contentSlot);
|
|
40
|
+
var hasContent = hasContentSlot || !!children || hasContentProp();
|
|
41
|
+
var expanded = isExpanded();
|
|
42
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-think"] = true, _classNameObj[k + "-think-expanded"] = expanded, _classNameObj[k + "-think-loading"] = loading, _classNameObj[k + "-think-blink"] = blink, _classNameObj[className] = className, _classNameObj[makeStyles(k)] = true, _classNameObj);
|
|
43
|
+
return _$cv('div', _extends({
|
|
44
|
+
'className': _$cn(classNameObj),
|
|
45
|
+
'style': getRootStyle()
|
|
46
|
+
}, getRestProps(this)), [_$ce(2, 'button', [_$ce(2, 'div', [_$ce(2, 'span', $blocks.icon ? (_$blocks['icon'] = function ($super) {
|
|
47
|
+
return null;
|
|
48
|
+
}, __$blocks['icon'] = function ($super, data) {
|
|
49
|
+
var block = $blocks['icon'];
|
|
50
|
+
var callBlock = function callBlock() {
|
|
51
|
+
return _$blocks['icon'].call($this, $super, data);
|
|
52
|
+
};
|
|
53
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
54
|
+
}, __$blocks['icon'](_$no)) : _$cc(Icon, {
|
|
55
|
+
'className': _$cn(loading ? 'ion-load-c' : 'k-icon-think'),
|
|
56
|
+
'rotate': loading
|
|
57
|
+
}), 0, _$cn(k + "-think-icon")), _$ce(2, 'span', $blocks.title ? (_$blocks['title'] = function ($super) {
|
|
58
|
+
return null;
|
|
59
|
+
}, __$blocks['title'] = function ($super, data) {
|
|
60
|
+
var block = $blocks['title'];
|
|
61
|
+
var callBlock = function callBlock() {
|
|
62
|
+
return _$blocks['title'].call($this, $super, data);
|
|
63
|
+
};
|
|
64
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
65
|
+
}, __$blocks['title'](_$no)) : _$ce(2, 'span', getTitleText(), 0), 0, _$cn(k + "-think-title"))], 4, _$cn(k + "-think-status-main")), _$ce(2, 'div', [hasExtraSlot ? _$ce(2, 'div', extraSlot, 0, _$cn(k + "-think-extra")) : undefined, hasContent ? _$cc(Icon, {
|
|
66
|
+
'className': _$cn(k + "-think-arrow k-icon-right")
|
|
67
|
+
}) : undefined], 0, _$cn(k + "-think-status-side"))], 4, _$cn(k + "-think-status"), {
|
|
68
|
+
'type': 'button',
|
|
69
|
+
'ev-click': onToggle
|
|
70
|
+
}), hasContent ? _$cc(Transition, _extends({
|
|
71
|
+
'show': expanded
|
|
72
|
+
}, expandAnimationCallbacks, {
|
|
73
|
+
'onEnter': function onEnter(el) {
|
|
74
|
+
expandAnimationCallbacks.onEnter(el);
|
|
75
|
+
},
|
|
76
|
+
'onAfterLeave': function onAfterLeave(el) {
|
|
77
|
+
expandAnimationCallbacks.onAfterLeave(el);
|
|
78
|
+
},
|
|
79
|
+
'children': _$ce(2, 'div', _$ce(2, 'div', hasContentSlot ? contentSlot : children ? children : _$ce(2, 'div', getContentText(), 0, _$cn(k + "-think-text")), 0, _$cn(k + "-think-content")), 2, _$cn(k + "-think-wrapper"))
|
|
80
|
+
})) : undefined]);
|
|
81
|
+
}
|
|
82
|
+
;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { css } from '@emotion/css';
|
|
2
|
+
import { theme, setDefault } from '../../styles/theme';
|
|
3
|
+
import { deepDefaults } from '../../styles/utils';
|
|
4
|
+
import '../../styles/global';
|
|
5
|
+
import { cache } from '../utils';
|
|
6
|
+
var defaults = {
|
|
7
|
+
color: theme.color.text,
|
|
8
|
+
titleColor: theme.color.lightBlack,
|
|
9
|
+
titleFontSize: '12px',
|
|
10
|
+
extraColor: theme.color.placeholder,
|
|
11
|
+
lineColor: '#D0D9D9',
|
|
12
|
+
contentColor: theme.color.lightBlack,
|
|
13
|
+
contentBorderRadius: '10px',
|
|
14
|
+
iconColor: theme.color.primary
|
|
15
|
+
};
|
|
16
|
+
var think;
|
|
17
|
+
setDefault(function () {
|
|
18
|
+
think = deepDefaults(theme, {
|
|
19
|
+
think: defaults
|
|
20
|
+
}).think;
|
|
21
|
+
makeStyles == null || makeStyles.clearCache();
|
|
22
|
+
});
|
|
23
|
+
export var makeStyles = cache(function makeStyles(k) {
|
|
24
|
+
return /*#__PURE__*/css("display:block;width:100%;min-height:0;color:", think.color, ";& .", k, "-think-wrapper.k-expand-enter-from,& .", k, "-think-wrapper.k-expand-leave-to,& .", k, "-think-wrapper.k-expand-enter-active,& .", k, "-think-wrapper.k-expand-leave-active{opacity:1!important;transition:height ", theme.transition.large, "!important;}.", k, "-think-status{display:flex;align-items:center;gap:8px;width:100%;padding:0;border:0;background:transparent;color:inherit;cursor:pointer;text-align:left;}.", k, "-think-status-main,.", k, "-think-status-side{display:inline-flex;align-items:center;gap:8px;min-width:0;}.", k, "-think-icon{color:", think.iconColor, ";line-height:1;flex:0 0 auto;}.", k, "-think-title{color:", think.titleColor, ";font-size:", think.titleFontSize, ";font-weight:400;min-width:0;line-height:1.5;}.", k, "-think-extra{color:", think.extraColor, ";font-size:12px;line-height:1.5;}.", k, "-think-arrow{transition:transform ", theme.transition.small, ";color:", think.extraColor, ";flex:0 0 auto;}.", k, "-think-wrapper{width:100%;box-sizing:border-box;overflow:hidden;}.", k, "-think-content{position:relative;margin-top:8px;margin-left:7px;padding-left:16px;background-image:repeating-linear-gradient(\n to bottom,\n ", think.lineColor, " 0 3.86px,\n transparent 3.86px 7.72px\n );background-repeat:no-repeat;background-size:1px calc(100% - 12px);background-position:0 6px;color:", think.contentColor, ";font-size:13px;line-height:1.7;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;&::before,&::after{content:'';position:absolute;left:0.5px;width:6px;height:5px;background:", think.lineColor, ";transform:translateX(-50%);}&::before{top:0;clip-path:polygon(0 0, 100% 0, 58.333% 100%, 41.667% 100%);}&::after{bottom:0;clip-path:polygon(41.667% 0, 58.333% 0, 100% 100%, 0 100%);}}.", k, "-think-text{border-radius:", think.contentBorderRadius, ";}&.", k, "-think-expanded .", k, "-think-arrow{transform:rotate(90deg);}&.", k, "-think-blink .", k, "-think-title{animation:", k, "-think-blink 1.2s ease-in-out infinite;}@keyframes ", k, "-think-blink{0%,100%{opacity:1;}50%{opacity:0.56;}}");
|
|
25
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component, TypeDefs } from 'intact-vue-next';
|
|
2
|
+
import type { Events } from '../types';
|
|
3
|
+
export interface ThinkProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
content?: string | number;
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
blink?: boolean;
|
|
8
|
+
defaultExpanded?: boolean;
|
|
9
|
+
expanded?: boolean;
|
|
10
|
+
maxWidthString?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ThinkEvents {
|
|
13
|
+
expand: [boolean];
|
|
14
|
+
}
|
|
15
|
+
export interface ThinkBlocks {
|
|
16
|
+
icon: null;
|
|
17
|
+
title: null;
|
|
18
|
+
extra: null;
|
|
19
|
+
content: null;
|
|
20
|
+
}
|
|
21
|
+
export declare class Think extends Component<ThinkProps, ThinkEvents, ThinkBlocks> {
|
|
22
|
+
static template: string | import('intact-vue-next').Template<any>;
|
|
23
|
+
static typeDefs: Required<TypeDefs<ThinkProps>>;
|
|
24
|
+
static defaults: () => Partial<ThinkProps>;
|
|
25
|
+
static events: Events<ThinkEvents>;
|
|
26
|
+
private config;
|
|
27
|
+
private think;
|
|
28
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 './index.vdt';
|
|
5
|
+
import { useConfigContext } from '../config';
|
|
6
|
+
import { useThinkExpand } from './useThinkExpand';
|
|
7
|
+
var typeDefs = {
|
|
8
|
+
title: String,
|
|
9
|
+
content: [String, Number],
|
|
10
|
+
loading: Boolean,
|
|
11
|
+
blink: Boolean,
|
|
12
|
+
defaultExpanded: Boolean,
|
|
13
|
+
expanded: Boolean,
|
|
14
|
+
maxWidthString: String
|
|
15
|
+
};
|
|
16
|
+
var defaults = function defaults() {
|
|
17
|
+
return {
|
|
18
|
+
title: undefined,
|
|
19
|
+
content: undefined,
|
|
20
|
+
loading: false,
|
|
21
|
+
blink: false,
|
|
22
|
+
defaultExpanded: true,
|
|
23
|
+
expanded: undefined,
|
|
24
|
+
maxWidthString: '640px'
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
var events = {
|
|
28
|
+
expand: true
|
|
29
|
+
};
|
|
30
|
+
export var Think = /*#__PURE__*/function (_Component) {
|
|
31
|
+
_inheritsLoose(Think, _Component);
|
|
32
|
+
function Think() {
|
|
33
|
+
var _context;
|
|
34
|
+
var _this;
|
|
35
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
36
|
+
args[_key] = arguments[_key];
|
|
37
|
+
}
|
|
38
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
39
|
+
_this.config = useConfigContext();
|
|
40
|
+
_this.think = useThinkExpand();
|
|
41
|
+
return _this;
|
|
42
|
+
}
|
|
43
|
+
return Think;
|
|
44
|
+
}(Component);
|
|
45
|
+
Think.template = template;
|
|
46
|
+
Think.typeDefs = typeDefs;
|
|
47
|
+
Think.defaults = defaults;
|
|
48
|
+
Think.events = events;
|