@king-design/react 3.2.1 → 3.3.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.
@@ -0,0 +1,14 @@
1
+ import { Component, TypeDefs } from 'intact-react';
2
+ export interface DividerProps {
3
+ borderType?: 'solid' | 'dashed' | 'dotted' | 'double';
4
+ position?: 'left' | 'right' | 'center';
5
+ type?: 'vertical' | 'horizontal';
6
+ theme?: 'light' | 'dark';
7
+ margin?: 'large' | 'default' | 'small' | 'none' | number;
8
+ }
9
+ export declare class Divider extends Component<DividerProps> {
10
+ static template: string | import('intact-react').Template<any>;
11
+ static typeDefs: Required<TypeDefs<DividerProps>>;
12
+ static defaults: () => Partial<DividerProps>;
13
+ private config;
14
+ }
@@ -0,0 +1,38 @@
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-react';
4
+ import template from './index.vdt';
5
+ import { useConfigContext } from '../config';
6
+ var typeDefs = {
7
+ borderType: ['solid', 'dashed', 'dotted', 'double'],
8
+ position: ['left', 'right', 'center'],
9
+ type: ['vertical', 'horizontal'],
10
+ theme: ['light', 'dark'],
11
+ margin: ['large', 'default', 'small', 'none', Number]
12
+ };
13
+ var defaults = function defaults() {
14
+ return {
15
+ borderType: 'solid',
16
+ position: 'center',
17
+ type: 'horizontal',
18
+ theme: 'light',
19
+ margin: 'default'
20
+ };
21
+ };
22
+ export var Divider = /*#__PURE__*/function (_Component) {
23
+ _inheritsLoose(Divider, _Component);
24
+ function Divider() {
25
+ var _context;
26
+ var _this;
27
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28
+ args[_key] = arguments[_key];
29
+ }
30
+ _this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
31
+ _this.config = useConfigContext();
32
+ return _this;
33
+ }
34
+ return Divider;
35
+ }(Component);
36
+ Divider.template = template;
37
+ Divider.typeDefs = typeDefs;
38
+ Divider.defaults = defaults;
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,31 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/extends";
2
+ import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce } from 'intact-react';
3
+ import { makeStyles } from './styles';
4
+ import { getRestProps, addStyle } from '../utils';
5
+ export default function ($props, $blocks, $__proto__) {
6
+ var _classNameObj;
7
+ $blocks || ($blocks = {});
8
+ $props || ($props = {});
9
+ var $this = this;
10
+ var _this$get = this.get(),
11
+ children = _this$get.children,
12
+ className = _this$get.className,
13
+ borderType = _this$get.borderType,
14
+ position = _this$get.position,
15
+ type = _this$get.type,
16
+ theme = _this$get.theme,
17
+ margin = _this$get.margin,
18
+ style = _this$get.style;
19
+ var k = this.config.k;
20
+ var _style = {};
21
+ if (typeof margin === 'number') {
22
+ var _margin = type === 'vertical' ? "0 " + margin + "px" : margin + "px 0";
23
+ _style.margin = _margin;
24
+ }
25
+ var classNameObj = (_classNameObj = {}, _classNameObj[k + "-divider"] = true, _classNameObj[k + "-" + (theme === 'dark' ? 'dark' : 'light')] = theme, _classNameObj[k + "-" + type] = type, _classNameObj[k + "-" + margin] = margin && typeof margin !== 'number', _classNameObj[k + "-with-text"] = children && type === 'horizontal', _classNameObj[k + "-" + position] = position !== 'center', _classNameObj[makeStyles(k, borderType)] = true, _classNameObj[className] = className, _classNameObj);
26
+ return _$cv('div', _extends({}, getRestProps(this), {
27
+ 'className': _$cn(classNameObj),
28
+ 'style': addStyle(style, _style)
29
+ }), children && type === 'horizontal' ? _$ce(2, 'div', children, 0, _$cn(k + "-divider-text")) : undefined);
30
+ }
31
+ ;
@@ -0,0 +1,5 @@
1
+ import '../../styles/global';
2
+ export declare const makeStyles: {
3
+ (k: string, borderType: string): string;
4
+ clearCache(): {};
5
+ };
@@ -0,0 +1,35 @@
1
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
2
+ import { css } from '@emotion/css';
3
+ import { theme, setDefault } from '../../styles/theme';
4
+ import { deepDefaults } from '../../styles/utils';
5
+ import '../../styles/global';
6
+ import { cache } from '../utils';
7
+ var sizes = ['large', 'default', 'small'];
8
+ var defaults = {
9
+ positionOffset: '5%',
10
+ get borderColor() {
11
+ return theme.color.darkBorder;
12
+ },
13
+ light: {
14
+ get borderColor() {
15
+ return theme.color.disabledBg;
16
+ }
17
+ },
18
+ large: {
19
+ get margin() {
20
+ return theme.large.padding;
21
+ }
22
+ }
23
+ };
24
+ var divider;
25
+ setDefault(function () {
26
+ divider = deepDefaults(theme, {
27
+ divider: defaults
28
+ }).divider;
29
+ makeStyles == null || makeStyles.clearCache();
30
+ });
31
+ export var makeStyles = cache(function makeStyles(k, borderType) {
32
+ return /*#__PURE__*/css("&.", k, "-divider{padding:0;border-top:1px ", borderType, " ", divider.borderColor, ";}&.", k, "-light{border-top-color:", divider.light.borderColor, ";&.", k, "-with-text{&::before,&::after{border-top-color:", divider.light.borderColor, ";}}&.", k, "-vertical{border-right-color:", divider.light.borderColor, ";}}&.", k, "-vertical{border-top:0;display:inline-block;height:100%;border-right:1px solid ", divider.borderColor, ";vertical-align:middle;}&.", k, "-horizontal{width:100%;min-width:100%;}&.", k, "-with-text{border-top:0;display:flex;align-items:center;white-space:nowrap;text-align:center;&::before,&::after{width:50%;content:'';transform:translateY(50%);border-top:1px solid ", divider.borderColor, ";}}.", k, "-divider-text{padding:0 16px;}&.", k, "-left{&::before{width:", divider.positionOffset, ";}&::after{width:calc(100% - ", divider.positionOffset, ");}}&.", k, "-right{&::before{width:calc(100% - ", divider.positionOffset, ");}&::after{width:", divider.positionOffset, ";}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
33
+ return /*#__PURE__*/css("&.", k, "-", size, "{margin:", theme[size].margin, " 0;&.", k, "-vertical{margin:0 ", theme[size].margin, ";}}");
34
+ }), ";");
35
+ });
@@ -177,8 +177,8 @@ Dropdown.template = function () {
177
177
  if (this.$isVue || this.$isVueNext) {
178
178
  if (Array.isArray(children)) {
179
179
  children = _filterInstanceProperty(children).call(children, function (child) {
180
- return child !== ' ';
181
- });
180
+ return child !== ' ' && child;
181
+ } /* comment is null in vue3 */);
182
182
  }
183
183
  }
184
184
  if (process.env.NODE_ENV !== 'production') {
@@ -0,0 +1,16 @@
1
+ import { Component, TypeDefs } from 'intact-react';
2
+ import { Options } from '../position';
3
+ export type Position = Options;
4
+ export interface EllipsisProps {
5
+ maxLines?: number;
6
+ disabled?: boolean;
7
+ position?: Position | 'left' | 'bottom' | 'right' | 'top';
8
+ theme?: 'light' | 'dark';
9
+ }
10
+ export declare class Ellipsis extends Component<EllipsisProps> {
11
+ static template: string | import('intact-react').Template<any>;
12
+ static typeDefs: Required<TypeDefs<EllipsisProps>>;
13
+ static defaults: () => Partial<EllipsisProps>;
14
+ private ellipsis;
15
+ private config;
16
+ }
@@ -0,0 +1,36 @@
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-react';
4
+ import template from './index.vdt';
5
+ import { useEllipsis } from './useEllipsis';
6
+ import { useConfigContext } from '../config';
7
+ var typeDefs = {
8
+ maxLines: Number,
9
+ disabled: Boolean,
10
+ position: [Object, 'left', 'bottom', 'right', 'top'],
11
+ theme: ['light', 'dark']
12
+ };
13
+ var defaults = function defaults() {
14
+ return {
15
+ disabled: false,
16
+ theme: 'light'
17
+ };
18
+ };
19
+ export var Ellipsis = /*#__PURE__*/function (_Component) {
20
+ _inheritsLoose(Ellipsis, _Component);
21
+ function Ellipsis() {
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 = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
28
+ _this.ellipsis = useEllipsis();
29
+ _this.config = useConfigContext();
30
+ return _this;
31
+ }
32
+ return Ellipsis;
33
+ }(Component);
34
+ Ellipsis.template = template;
35
+ Ellipsis.typeDefs = typeDefs;
36
+ Ellipsis.defaults = defaults;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,94 @@
1
+ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
3
+ import BasicDemo from '~/components/ellipsis/demos/basic';
4
+ import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/utils';
5
+ describe('Ellipsis', function () {
6
+ afterEach(function () {
7
+ return unmount();
8
+ });
9
+ it('should support drag Ellipsis', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
10
+ var _mount, instance, element, _element$querySelecto, ellipsis1, ellipsis2, dragLine, children1, content1, children2, content2;
11
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
12
+ while (1) switch (_context.prev = _context.next) {
13
+ case 0:
14
+ _mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
15
+ _element$querySelecto = element.querySelectorAll('.k-ellipsis'), ellipsis1 = _element$querySelecto[0], ellipsis2 = _element$querySelecto[1];
16
+ dragLine = element.querySelector('.k-split-line-wrapper'); // There is no tooltip content by default
17
+ expect(getElement('.k-tooltip-content')).to.be.undefined;
18
+ // mouse move
19
+ dispatchEvent(dragLine, 'mousedown', {
20
+ which: 1,
21
+ clientX: 200,
22
+ clientY: 0
23
+ });
24
+ dispatchEvent(document, 'mousemove', {
25
+ clientX: 100,
26
+ clientY: 0
27
+ });
28
+ dispatchEvent(dragLine, 'mouseup');
29
+ _context.next = 9;
30
+ return wait(200);
31
+ case 9:
32
+ expect(element.outerHTML).to.matchSnapshot();
33
+ // mouseenter ellipsis dom
34
+ children1 = ellipsis1.firstElementChild;
35
+ dispatchEvent(children1, 'mouseenter');
36
+ _context.next = 14;
37
+ return wait(0);
38
+ case 14:
39
+ expect(children1.classList.contains('k-dropdown-open')).to.be.true;
40
+ content1 = getElement('.k-tooltip-content');
41
+ expect(content1.textContent).eql('测试测试测试测试测试测试');
42
+ children2 = ellipsis2.firstElementChild;
43
+ dispatchEvent(children2, 'mouseenter');
44
+ _context.next = 21;
45
+ return wait(0);
46
+ case 21:
47
+ content2 = getElement('.k-tooltip-content');
48
+ expect(content2.textContent).eql('最大几行忽略最大几行忽略最大几行忽略');
49
+ case 23:
50
+ case "end":
51
+ return _context.stop();
52
+ }
53
+ }, _callee);
54
+ })));
55
+ it('should disabled tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
56
+ var _mount2, instance, element, ellipsis3, dragLine, children3;
57
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
58
+ while (1) switch (_context2.prev = _context2.next) {
59
+ case 0:
60
+ _mount2 = mount(BasicDemo), instance = _mount2[0], element = _mount2[1];
61
+ ellipsis3 = element.querySelectorAll('.k-ellipsis')[2];
62
+ dragLine = element.querySelector('.k-split-line-wrapper');
63
+ dispatchEvent(dragLine, 'mousedown', {
64
+ which: 1,
65
+ clientX: 200,
66
+ clientY: 0
67
+ });
68
+ dispatchEvent(document, 'mousemove', {
69
+ clientX: 300,
70
+ clientY: 0
71
+ });
72
+ dispatchEvent(dragLine, 'mouseup');
73
+ _context2.next = 8;
74
+ return wait(200);
75
+ case 8:
76
+ // disabled close tooltip
77
+ expect(ellipsis3.firstElementChild.classList.contains('k-dropdown-open')).to.be.false;
78
+ instance.set('disabled', false);
79
+ _context2.next = 12;
80
+ return wait();
81
+ case 12:
82
+ children3 = ellipsis3.firstElementChild;
83
+ dispatchEvent(children3, 'mouseenter');
84
+ _context2.next = 16;
85
+ return wait();
86
+ case 16:
87
+ expect(children3.classList.contains('k-dropdown-open')).to.be.true;
88
+ case 17:
89
+ case "end":
90
+ return _context2.stop();
91
+ }
92
+ }, _callee2);
93
+ })));
94
+ });
@@ -0,0 +1,50 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/extends";
2
+ import { createElementVNode as _$ce, className as _$cn, createVNode as _$cv, createUnknownComponentVNode as _$cc, extend as _$ex, EMPTY_OBJ as _$em } from 'intact-react';
3
+ import { makeStyles } from './styles';
4
+ import { Tooltip } from '../tooltip';
5
+ import { getRestProps, addStyle } from '../utils';
6
+ export default function ($props, $blocks, $__proto__) {
7
+ var _$cn2, _$cn3;
8
+ $blocks || ($blocks = {});
9
+ $props || ($props = {});
10
+ var $this = this;
11
+ var _this$get = this.get(),
12
+ children = _this$get.children,
13
+ className = _this$get.className,
14
+ maxLines = _this$get.maxLines,
15
+ disabled = _this$get.disabled,
16
+ position = _this$get.position,
17
+ theme = _this$get.theme,
18
+ style = _this$get.style;
19
+ var k = this.config.k;
20
+ var _this$ellipsis = this.ellipsis,
21
+ showTooltip = _this$ellipsis.showTooltip,
22
+ ellipsisRef = _this$ellipsis.ellipsisRef;
23
+ var tooltip = showTooltip.value && !disabled;
24
+ var wrapper = _$ce(2, 'div', children, 0, _$cn((_$cn2 = {
25
+ 'c-ellipsis': true
26
+ }, _$cn2[k + "-ellipsis-wrapper"] = true, _$cn2[className] = className && !tooltip, _$cn2)));
27
+ return _$cv('div', _extends({}, getRestProps(this), {
28
+ 'className': _$cn((_$cn3 = {}, _$cn3[k + "-ellipsis"] = true, _$cn3[k + "-multiline"] = maxLines, _$cn3[makeStyles(k, maxLines)] = true, _$cn3)),
29
+ 'ref': ellipsisRef
30
+ }), tooltip ? _$cc(Tooltip, {
31
+ 'position': position,
32
+ 'theme': theme,
33
+ 'className': _$cn(className),
34
+ 'children': wrapper,
35
+ '$blocks': function ($blocks) {
36
+ var _$blocks = {},
37
+ __$blocks = _$ex({}, $blocks);
38
+ return (_$blocks['content'] = function ($super) {
39
+ return children;
40
+ }, __$blocks['content'] = function ($super, data) {
41
+ var block = $blocks['content'];
42
+ var callBlock = function callBlock() {
43
+ return _$blocks['content'].call($this, $super, data);
44
+ };
45
+ return block ? block.call($this, callBlock, data) : callBlock();
46
+ }), __$blocks;
47
+ }.call($this, _$em)
48
+ }) : wrapper);
49
+ }
50
+ ;
@@ -0,0 +1,5 @@
1
+ import '../../styles/global';
2
+ export declare const makeStyles: {
3
+ (k: string, maxLines: number): string;
4
+ clearCache(): {};
5
+ };
@@ -0,0 +1,10 @@
1
+ import { css } from '@emotion/css';
2
+ import { setDefault } from '../../styles/theme';
3
+ import '../../styles/global';
4
+ import { cache } from '../utils';
5
+ setDefault(function () {
6
+ makeStyles == null || makeStyles.clearCache();
7
+ });
8
+ export var makeStyles = cache(function makeStyles(k, maxLines) {
9
+ return /*#__PURE__*/css("width:100%;&.", k, "-multiline{.k-ellipsis-wrapper{white-space:normal;display:-webkit-box;-webkit-line-clamp:", maxLines, ";-webkit-box-orient:vertical;}}");
10
+ });
@@ -0,0 +1,4 @@
1
+ export declare function useEllipsis(): {
2
+ ellipsisRef: import('intact-react').RefObject<HTMLDivElement>;
3
+ showTooltip: import("../../hooks/useState").State<boolean>;
4
+ };
@@ -0,0 +1,21 @@
1
+ import { useInstance, createRef } from 'intact-react';
2
+ import { useResizeObserver } from '../../hooks/useResizeObserver';
3
+ import { useState } from '../../hooks/useState';
4
+ export function useEllipsis() {
5
+ var instance = useInstance();
6
+ var ellipsisRef = createRef();
7
+ var showTooltip = useState(false);
8
+ useResizeObserver(ellipsisRef, isShowTooltip);
9
+ function isShowTooltip() {
10
+ var isMulti = instance.get('maxLines');
11
+ var element = ellipsisRef.value.children[0];
12
+ var _showTooltip = isMulti ? element.scrollHeight > element.clientHeight : element.offsetWidth < element.scrollWidth;
13
+ requestAnimationFrame(function () {
14
+ showTooltip.set(_showTooltip);
15
+ });
16
+ }
17
+ return {
18
+ ellipsisRef: ellipsisRef,
19
+ showTooltip: showTooltip
20
+ };
21
+ }
@@ -5,6 +5,7 @@ import { Dropdown, DropdownItem } from '../dropdown';
5
5
  import { Tooltip } from '../tooltip';
6
6
  import { Icon } from '../icon';
7
7
  import { Menu } from './menu';
8
+ import { Ellipsis } from '../ellipsis';
8
9
  import { getRestProps, expandAnimationCallbacks } from '../utils';
9
10
  import { isNullOrUndefined } from 'intact-shared';
10
11
  import { makeItemStyles, makeTitleStyles, makeNestedMenuStyles } from './styles';
@@ -18,7 +19,8 @@ export default function ($props, $blocks, $__proto__) {
18
19
  var _rootMenu$get = rootMenu.get(),
19
20
  theme = _rootMenu$get.theme,
20
21
  type = _rootMenu$get.type,
21
- rootDot = _rootMenu$get.dot;
22
+ rootDot = _rootMenu$get.dot,
23
+ size = _rootMenu$get.size;
22
24
  var _this$get = this.get(),
23
25
  children = _this$get.children,
24
26
  key = _this$get.key,
@@ -46,7 +48,10 @@ export default function ($props, $blocks, $__proto__) {
46
48
  var _$cn2;
47
49
  return _$ce(2, 'div', [showDot ? _$cc(Icon, {
48
50
  'className': _$cn(k + "-menu-dot ion-record")
49
- }) : undefined, _$ce(2, 'div', children, 0, _$cn(k + "-menu-name")), subMenuVNode ? _$cc(Icon, {
51
+ }) : undefined, _$ce(2, 'div', _$cc(Ellipsis, {
52
+ 'position': 'bottom',
53
+ 'children': children
54
+ }), 2, _$cn(k + "-menu-name")), subMenuVNode ? _$cc(Icon, {
50
55
  'className': _$cn(k + "-menu-item-arrow ion-arrow-down-b")
51
56
  }) : undefined], 0, _$cn((_$cn2 = {}, _$cn2[k + "-menu-item-title"] = true, _$cn2[makeTitleStyles(k)] = true, _$cn2)), {
52
57
  'ev-click': _this.onClick.bind(_this, subMenuVNode)
@@ -62,7 +67,7 @@ export default function ($props, $blocks, $__proto__) {
62
67
  if (subMenuVNode) {
63
68
  var _$cn3;
64
69
  var paddingLeft = _this.parentMenu.get('_paddingLeft');
65
- var _makeNestedMenuStyles = makeNestedMenuStyles(k, showDot || !!iconVNode, paddingLeft),
70
+ var _makeNestedMenuStyles = makeNestedMenuStyles(k, showDot || !!iconVNode, paddingLeft, size),
66
71
  _classname = _makeNestedMenuStyles[0],
67
72
  _paddingLeft = _makeNestedMenuStyles[1];
68
73
  var _className = _$cn((_$cn3 = {}, _$cn3[_classname] = true, _$cn3[subMenuVNode.className] = subMenuVNode.className, _$cn3[k + "-sub-menu"] = true, _$cn3));
@@ -78,6 +78,6 @@ export declare const makeItemStyles: {
78
78
  clearCache(): {};
79
79
  };
80
80
  export declare const makeNestedMenuStyles: {
81
- (k: string, hasIcon: boolean, parentPaddingLeft?: string | undefined): string;
81
+ (k: string, hasIcon: boolean, parentPaddingLeft: string | undefined, size: "small" | "large" | "default" | undefined): string;
82
82
  clearCache(): {};
83
83
  };
@@ -112,7 +112,7 @@ export { menu };
112
112
  export var makeMenuStyles = cache(function makeMenuStyles(k) {
113
113
  // we must increase the priority by adding &.${k}-menu
114
114
  // to override the css of dropdownMenu
115
- return /*#__PURE__*/css("&.", k, "-menu{width:", menu.width, ";transition:width ", menu.transition, ";background:", menu.bgColor, ";font-size:", menu.fontSize, ";position:relative;}.", k, "-icon{width:", menu.icon.width, ";margin-right:", menu.icon.gap, ";text-align:center;flex-shrink:0;}.", k, "-menu-header{height:", menu.header.height, ";padding:0 21px;color:", menu.header.color, ";font-size:", menu.header.fontSize, ";font-weight:bold;}.", k, "-menu-body{padding:", menu.item.bodyPadding, ";max-height:calc(100vh - ", menu.header.height, ");overflow-y:auto;}.", k, "-menu-title{height:", menu.title.height, ";border-top:", menu.border, ";margin-top:4px;.", k, "-menu-name{transition:all ", menu.transition, ";height:", menu.title.height, ";color:", menu.title.color, ";font-weight:bold;}}.", k, "-menu-arrow-box{width:14px;height:60px;cursor:pointer;background:", menu.bgColor, ";border-radius:0 8px 8px 0;position:absolute;display:flex;align-items:center;justify-content:center;top:50%;left:calc(", menu.width, " - 2px);transition:left ", menu.transition, ";transform:translateY(-50%);border:", menu.border, ";border-left:none;.", k, "-icon{margin-right:0;}&:hover{.", k, "-menu-arrow:before{color:", menu.item.activeBgColor, ";}}}&.", k, "-light{border:1px solid ", theme.color.disabledBg, ";background:", menu.light.bgColor, ";.", k, "-menu-header{color:", menu.light.title.color, ";}.", k, "-menu-item{.", k, "-menu-item-title{color:", menu.light.item.color, ";&:hover{background:", menu.light.item.hoverBg, ";}}.", k, "-menu-item-arrow{color:", menu.light.item.color, ";}&.", k, "-highlighted{>.", k, "-menu-item-title{color:", menu.light.item.hoverColor, ";}}&.", k, "-disabled{>.", k, "-menu-item-title{color:", menu.light.item.disabledColor, "!important;}}}.", k, "-menu-title{border-top:", menu.light.border, ";.", k, "-menu-name{color:", menu.light.title.color, ";}}.", k, "-menu-arrow-box{background:", menu.light.bgColor, ";border:", menu.light.border, ";border-left:none;&:hover{.", k, "-menu-arrow:before{color:", menu.light.active.color, ";}}}.", k, "-menu:not(.", k, "-dropdown-menu){background:", menu.light.bgColor, ";}&.", k, "-horizontal{.", k, "-menu-header{border-right:", menu.light.border, ";}.", k, "-menu-body>.", k, "-menu-title{border-right:", menu.light.border, ";}}.", k, "-menu-item.", k, "-active{>.", k, "-menu-item-title{color:", menu.light.active.color, "!important;background:", menu.light.active.bgColor, ";}}.", k, "-sub-menu{.", k, "-menu-item-title,.", k, "-menu-item-arrow{color:", menu.light.item.subTitleColor, "!important;}}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
115
+ return /*#__PURE__*/css("&.", k, "-menu{width:", menu.width, ";transition:width ", menu.transition, ";background:", menu.bgColor, ";font-size:", menu.fontSize, ";position:relative;}.", k, "-icon{width:", menu.icon.width, ";margin-right:", menu.icon.gap, ";text-align:center;flex-shrink:0;}.", k, "-menu-header{height:", menu.header.height, ";padding:0 21px;color:", menu.header.color, ";font-size:", menu.header.fontSize, ";font-weight:bold;}.", k, "-menu-body{padding:", menu.item.bodyPadding, ";max-height:calc(100% - ", menu.header.height, ");overflow-y:auto;overflow-x:hidden;}.", k, "-menu-title{height:", menu.title.height, ";border-top:", menu.border, ";margin-top:4px;.", k, "-menu-name{transition:all ", menu.transition, ";height:", menu.title.height, ";color:", menu.title.color, ";font-weight:bold;}}.", k, "-menu-arrow-box{width:14px;height:60px;cursor:pointer;background:", menu.bgColor, ";border-radius:0 8px 8px 0;position:absolute;display:flex;align-items:center;justify-content:center;top:50%;left:calc(", menu.width, " - 2px);transition:left ", menu.transition, ";transform:translateY(-50%);border:", menu.border, ";border-left:none;.", k, "-icon{margin-right:0;}&:hover{.", k, "-menu-arrow:before{color:", menu.item.activeBgColor, ";}}}&.", k, "-light{border:1px solid ", theme.color.disabledBg, ";border-top:0;background:", menu.light.bgColor, ";.", k, "-menu-header{color:", menu.light.title.color, ";}.", k, "-menu-item{.", k, "-menu-item-title{color:", menu.light.item.color, ";&:hover{background:", menu.light.item.hoverBg, ";}}.", k, "-menu-item-arrow{color:", menu.light.item.color, ";}&.", k, "-highlighted{>.", k, "-menu-item-title{color:", menu.light.item.hoverColor, ";}}&.", k, "-disabled{>.", k, "-menu-item-title{color:", menu.light.item.disabledColor, "!important;}}}.", k, "-menu-title{border-top:", menu.light.border, ";.", k, "-menu-name{color:", menu.light.title.color, ";}}.", k, "-menu-arrow-box{background:", menu.light.bgColor, ";border:", menu.light.border, ";border-left:none;&:hover{.", k, "-menu-arrow:before{color:", menu.light.active.color, ";}}}.", k, "-menu:not(.", k, "-dropdown-menu){background:", menu.light.bgColor, ";}&.", k, "-horizontal{.", k, "-menu-header{border-right:", menu.light.border, ";}.", k, "-menu-body>.", k, "-menu-title{border-right:", menu.light.border, ";}}.", k, "-menu-item.", k, "-active{>.", k, "-menu-item-title{color:", menu.light.active.color, "!important;background:", menu.light.active.bgColor, ";}}.", k, "-sub-menu{.", k, "-menu-item-title,.", k, "-menu-item-arrow{color:", menu.light.item.subTitleColor, "!important;}}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
116
116
  var styles = menu[size];
117
117
  return /*#__PURE__*/css("&.", k, "-", size, "{width:", styles.width, ";font-size:", styles.fontSize, ";.", k, "-menu{font-size:", styles.fontSize, ";}.", k, "-menu-arrow-box{left:calc(", styles.width, " - 2px);}}");
118
118
  }), "&.", k, "-collapsed{width:calc(", menu.icon.width, " + (", getLeft(menu.item.padding), " + ", getLeft(menu.item.bodyPadding), ") * 2);.", k, "-icon{margin-right:0;}.", k, "-menu-item-arrow{display:none;}}&.", k, "-collapsed-arrow{width:0px;border-left:none;.", k, "-menu-body{overflow:hidden;padding:0;}.", k, "-menu-arrow-box{left:0;.", k, "-menu-arrow:before{transform:rotateY(180deg);}}}&.", k, "-dropdown-menu{width:fit-content;min-width:", menu.dropdown.minWidth, ";.", k, "-menu-item-arrow{transform:rotate(-90deg);}}&.", k, "-horizontal{width:auto;display:flex;.", k, "-menu-body{display:flex;align-items:center;.", k, "-menu-title{border-top:none;border-right:", menu.border, ";}}}");
@@ -123,12 +123,13 @@ export var makeTitleStyles = cache(function makeTitleStyles(k) {
123
123
  });
124
124
  export var makeItemStyles = cache(function makeItemStyles(k) {
125
125
  var item = menu.item;
126
- return /*#__PURE__*/css(".", k, "-menu-item-title{transition:all ", menu.transition, ";cursor:pointer;height:", item.height, ";&:hover{padding:", item.padding, ";border-radius:", menu.borderRadius, ";background:#2a2a30;}&>.", k, "-menu-item-arrow:before{font-size:small;}}.", k, "-menu-name{flex:1;display:flex;align-items:center;min-width:0;span{overflow:hidden;text-overflow:ellipsis;min-width:0;}.", k, "-icon{color:inherit;}}.", k, "-menu-item-arrow{color:", item.color, ";margin:0 0 0 ", menu.icon.gap, ";transition:transform ", menu.transition, ";}&.", k, "-expanded{>.", k, "-menu-item-title{color:", item.hoverColor, ";.", k, "-menu-item-arrow{transform:rotate(180deg);}}}&.", k, "-highlighted{>.", k, "-menu-item-title{color:", menu.light.item.hoverColor, ";}}&.", k, "-active{>.", k, "-menu-item-title{border-radius:", menu.borderRadius, ";color:", item.activeBgColor, "!important;background:", item.hoverBgColor, ";}}&.", k, "-disabled{>.", k, "-menu-item-title{color:", item.disabledColor, "!important;cursor:not-allowed;}}.", k, "-menu-dot{font-size:", item.dotFontSize, ";transform:scale(.4);}");
126
+ return /*#__PURE__*/css(".", k, "-menu-item-title{transition:all ", menu.transition, ";cursor:pointer;height:", item.height, ";&:hover{padding:", item.padding, ";border-radius:", menu.borderRadius, ";background:#2a2a30;}&>.", k, "-menu-item-arrow:before{font-size:small;}}.", k, "-menu-name{flex:1;display:flex;align-items:center;min-width:0;.", k, "-icon{color:inherit;display:inline-block;}}.", k, "-menu-item-arrow{color:", item.color, ";margin:0 0 0 ", menu.icon.gap, ";transition:transform ", menu.transition, ";}&.", k, "-expanded{>.", k, "-menu-item-title{color:", item.hoverColor, ";.", k, "-menu-item-arrow{transform:rotate(180deg);}}}&.", k, "-highlighted{>.", k, "-menu-item-title{color:", menu.light.item.hoverColor, ";}}&.", k, "-active{>.", k, "-menu-item-title{border-radius:", menu.borderRadius, ";color:", item.activeBgColor, "!important;background:", item.hoverBgColor, ";}}&.", k, "-disabled{>.", k, "-menu-item-title{color:", item.disabledColor, "!important;cursor:not-allowed;}}.", k, "-menu-dot{font-size:", item.dotFontSize, ";transform:scale(.4);}");
127
127
  });
128
- export var makeNestedMenuStyles = cache(function makeNestedMenuStyles(k, hasIcon, parentPaddingLeft) {
128
+ export var makeNestedMenuStyles = cache(function makeNestedMenuStyles(k, hasIcon, parentPaddingLeft, size) {
129
129
  if (parentPaddingLeft === void 0) {
130
130
  parentPaddingLeft = getLeft(menu.item.padding);
131
131
  }
132
- var paddingLeft = "" + parentPaddingLeft + (hasIcon ? ' + ' + menu.icon.width + ' + ' + menu.icon.gap : '');
133
- return [/*#__PURE__*/css("&.", k, "-menu{position:relative;width:auto;background:", menu.bgColor, ";border:none;.", k, "-menu-body{padding:0;.", k, "-menu-item-title{padding-left:calc(", paddingLeft, ");}.", k, "-menu-item-title,.", k, "-menu-item-arrow{color:", menu.item.subTitleColor, ";}}}"), paddingLeft];
132
+ var fontSize = "" + (size === 'small' ? menu.small.fontSize : menu.fontSize);
133
+ var paddingLeft = "" + parentPaddingLeft + (hasIcon ? ' + ' + menu.icon.width + ' + ' + menu.icon.gap : ' + ' + fontSize);
134
+ return [/*#__PURE__*/css("&.", k, "-menu{position:relative;width:auto;background:", menu.bgColor, ";border:none;.", k, "-menu-body{padding:0;max-height:100%;.", k, "-menu-item-title{padding-left:calc(", paddingLeft, ");}.", k, "-menu-item-title,.", k, "-menu-item-arrow{color:", menu.item.subTitleColor, ";}}}"), paddingLeft];
134
135
  });
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime-corejs3/helpers/extends";
2
- import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce } from 'intact-react';
2
+ import { createVNode as _$cv, className as _$cn, createElementVNode as _$ce, createUnknownComponentVNode as _$cc } from 'intact-react';
3
3
  import { Icon } from '../icon';
4
+ import { Ellipsis } from '../ellipsis';
4
5
  import { getRestProps, findChildren, isComponentVNode } from '../utils';
5
6
  import { makeTitleStyles } from './styles';
6
7
  export default function ($props, $blocks, $__proto__) {
@@ -18,7 +19,10 @@ export default function ($props, $blocks, $__proto__) {
18
19
  var classNameObj = (_classNameObj = {}, _classNameObj[k + "-menu-title"] = true, _classNameObj[className] = className, _classNameObj);
19
20
  return _$cv('div', _extends({
20
21
  'className': _$cn(classNameObj)
21
- }, getRestProps(this)), _$ce(2, 'div', !collapse ? _$ce(2, 'span', children, 0) : findChildren(children, function (vNode) {
22
+ }, getRestProps(this)), _$ce(2, 'div', !collapse ? _$cc(Ellipsis, {
23
+ 'position': 'bottom',
24
+ 'children': children
25
+ }) : findChildren(children, function (vNode) {
22
26
  return isComponentVNode(vNode, Icon);
23
27
  }), 0, _$cn((_$cn2 = {}, _$cn2[k + "-menu-name"] = true, _$cn2[makeTitleStyles(k)] = true, _$cn2))));
24
28
  }
@@ -160,7 +160,7 @@ export default function ($props, $blocks, $__proto__) {
160
160
  onRowDragEnd = _this$draggable.onRowDragEnd,
161
161
  draggingKey = _this$draggable.draggingKey;
162
162
  var tbody = _$ce(2, 'tbody', !hasData ? _$ce(2, 'tr', _$ce(2, 'td', (_$blocks['empty'] = function ($super) {
163
- return _$('/(ㄒoㄒ)/~~ 没有找到亲要的数据哦~');
163
+ return _$('暂无数据');
164
164
  }, __$blocks['empty'] = function ($super, data) {
165
165
  var block = $blocks['empty'];
166
166
  var callBlock = function callBlock() {
@@ -1,11 +1,13 @@
1
1
  import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
3
3
  import ClosableDemo from '~/components/tag/demos/closable';
4
- import { mount, wait, dispatchEvent, getElement } from '../../test/utils';
4
+ import { mount, unmount, wait, dispatchEvent, getElement } from '../../test/utils';
5
5
  import TagsDemo from '~/components/tag/demos/tags';
6
6
  import DraggableDemo from '~/components/tag/demos/draggable';
7
7
  describe('Tag', function () {
8
- // afterEach(() => unmount());
8
+ afterEach(function () {
9
+ return unmount();
10
+ });
9
11
  it('should not close tag if we has prevented default', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
10
12
  var _mount, instance, element, btns, preventDefaultBtn, commonBtn;
11
13
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -55,7 +55,8 @@ export default function ($props, $blocks, $__proto__) {
55
55
  var _$blocks = {},
56
56
  __$blocks = _$ex({}, $blocks);
57
57
  return (_$blocks['content'] = function ($super) {
58
- return _$ce(2, 'div', hiddenChildren.value, 0, _$cn(classNameObj));
58
+ var _extends2;
59
+ return _$ce(2, 'div', hiddenChildren.value, 0, _$cn(_extends({}, classNameObj, (_extends2 = {}, _extends2[k + "-nowrap"] = false, _extends2))));
59
60
  }, __$blocks['content'] = function ($super, data) {
60
61
  var block = $blocks['content'];
61
62
  var callBlock = function callBlock() {
@@ -0,0 +1,15 @@
1
+ import { Component, TypeDefs } from 'intact-react';
2
+ export interface ViewProps {
3
+ tag?: string;
4
+ }
5
+ /**
6
+ * A component only used in React or Vue to bind event, so that
7
+ * it can use Intact Event system to stop propagation (stopPropagation).
8
+ */
9
+ export declare class View extends Component<ViewProps> {
10
+ static template(this: View): import('intact-react').VNode<string>;
11
+ static typeDefs: Required<TypeDefs<ViewProps>>;
12
+ static defaults(): {
13
+ tag: string;
14
+ };
15
+ }
@@ -0,0 +1,30 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime-corejs3/helpers/objectWithoutPropertiesLoose";
2
+ import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
3
+ var _excluded = ["tag"];
4
+ import { Component, createVNode as h } from 'intact-react';
5
+ var typeDefs = {
6
+ tag: String
7
+ };
8
+ /**
9
+ * A component only used in React or Vue to bind event, so that
10
+ * it can use Intact Event system to stop propagation (stopPropagation).
11
+ */
12
+ export var View = /*#__PURE__*/function (_Component) {
13
+ _inheritsLoose(View, _Component);
14
+ function View() {
15
+ return _Component.apply(this, arguments) || this;
16
+ }
17
+ View.template = function template() {
18
+ var _this$get = this.get(),
19
+ tag = _this$get.tag,
20
+ rest = _objectWithoutPropertiesLoose(_this$get, _excluded);
21
+ return h(tag, rest);
22
+ };
23
+ View.defaults = function defaults() {
24
+ return {
25
+ tag: 'div'
26
+ };
27
+ };
28
+ return View;
29
+ }(Component);
30
+ View.typeDefs = typeDefs;
package/i18n/en-US.d.ts CHANGED
@@ -73,7 +73,7 @@ declare const i18n: {
73
73
  前往: string;
74
74
  页: string;
75
75
  '\u5171 {n} \u6761': string;
76
- '/(\u3112o\u3112)/~~ \u6CA1\u6709\u627E\u5230\u4EB2\u8981\u7684\u6570\u636E\u54E6~': string;
76
+ 暂无数据: string;
77
77
  重置: string;
78
78
  请输入: string;
79
79
  请选择: string;
package/i18n/en-US.js CHANGED
@@ -80,7 +80,7 @@ var i18n = {
80
80
  '页': '',
81
81
  '共 {n} 条': 'Total {n}',
82
82
  // table
83
- '/(ㄒoㄒ)/~~ 没有找到亲要的数据哦~': '/(ㄒoㄒ)/~~ No data to display.',
83
+ '暂无数据': 'No data to display.',
84
84
  '重置': 'Reset',
85
85
  // transfer
86
86
  '请输入': 'Please enter',