@king-design/vue 3.4.3-beta.2 → 3.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/__tests__/__snapshots__/Vue Next Demos.md +295 -221
  2. package/__tests__/components/editable.spec.ts +1 -1
  3. package/__tests__/components/table.spec.ts +54 -0
  4. package/components/button/group.d.ts +1 -0
  5. package/components/button/group.js +4 -0
  6. package/components/button/group.vdt.js +3 -2
  7. package/components/button/index.vdt.js +1 -1
  8. package/components/button/styles.js +6 -6
  9. package/components/diagram/shapes/callout.d.ts +1 -1
  10. package/components/diagram/shapes/circle.d.ts +1 -1
  11. package/components/diagram/shapes/document.d.ts +1 -1
  12. package/components/diagram/shapes/ellipse.d.ts +1 -1
  13. package/components/diagram/shapes/hexagon.d.ts +1 -1
  14. package/components/diagram/shapes/image.d.ts +1 -1
  15. package/components/diagram/shapes/parallelogram.d.ts +1 -1
  16. package/components/diagram/shapes/rectangle.d.ts +1 -1
  17. package/components/diagram/shapes/square.d.ts +1 -1
  18. package/components/diagram/shapes/text.d.ts +1 -1
  19. package/components/dialog/styles.js +3 -3
  20. package/components/dropdown/item.js +5 -2
  21. package/components/editable/index.d.ts +2 -0
  22. package/components/editable/index.js +4 -2
  23. package/components/editable/index.spec.js +39 -0
  24. package/components/editable/index.vdt.js +17 -6
  25. package/components/editable/styles.d.ts +1 -0
  26. package/components/editable/styles.js +3 -0
  27. package/components/ellipsis/index.d.ts +1 -0
  28. package/components/ellipsis/index.js +4 -2
  29. package/components/ellipsis/index.vdt.js +3 -1
  30. package/components/input/styles.js +11 -1
  31. package/components/menu/styles.js +1 -1
  32. package/components/select/index.spec.js +47 -0
  33. package/components/switch/styles.js +1 -1
  34. package/components/table/cell.d.ts +2 -0
  35. package/components/table/cell.vdt.js +18 -5
  36. package/components/table/column.d.ts +1 -0
  37. package/components/table/column.js +1 -0
  38. package/components/table/column.vdt.js +16 -12
  39. package/components/table/row.d.ts +3 -1
  40. package/components/table/row.js +24 -15
  41. package/components/table/row.vdt.js +6 -2
  42. package/components/table/styles.d.ts +49 -0
  43. package/components/table/styles.js +3 -2
  44. package/components/table/table.d.ts +4 -0
  45. package/components/table/table.js +4 -1
  46. package/components/table/table.vdt.js +29 -4
  47. package/components/table/useColumns.d.ts +9 -0
  48. package/components/table/useColumns.js +29 -1
  49. package/components/table/useTree.d.ts +1 -1
  50. package/components/table/useTree.js +30 -2
  51. package/components/tip/index.d.ts +6 -1
  52. package/components/tip/index.js +12 -1
  53. package/components/tip/index.vdt.js +25 -5
  54. package/components/tip/styles.js +44 -2
  55. package/components/tooltip/index.spec.js +99 -67
  56. package/components/tooltip/tooltip.d.ts +1 -0
  57. package/components/tooltip/tooltip.js +14 -2
  58. package/components/transfer/index.vdt.js +2 -4
  59. package/components/treeSelect/index.vdt.js +1 -0
  60. package/components/upload/index.vdt.js +4 -1
  61. package/components/upload/styles.js +1 -1
  62. package/index.d.ts +2 -2
  63. package/index.js +2 -2
  64. package/install.js +6 -1
  65. package/package.json +2 -2
@@ -35,7 +35,7 @@ describe('Editable', () => {
35
35
  container.querySelector<HTMLDivElement>('.k-icon')!.click();
36
36
  await wait();
37
37
 
38
- const input = container.querySelector('.k-input input') as HTMLInputElement;
38
+ const input = container.querySelector('.k-input textarea') as HTMLTextAreaElement;
39
39
  expect(input.selectionStart).to.eql(0);
40
40
  expect(input.selectionEnd).to.eql(1);
41
41
 
@@ -0,0 +1,54 @@
1
+ import {createApp, render} from 'vue';
2
+ import {mount, unmount, dispatchEvent, getElement, wait} from '@/test/utils';
3
+ import {Table, TableColumn, Input} from '../../';
4
+
5
+ describe('Table', () => {
6
+ it('should update Input in children rows', async () => {
7
+ const container = document.createElement('div');
8
+ document.body.appendChild(container);
9
+ const vue = createApp({
10
+ template: `
11
+ <Table ref="table" :data="data" checkType="none">
12
+ <TableColumn key="discount" title="折扣">
13
+ <template v-slot="[data]">
14
+ <Input v-model="data.discount" />
15
+ </template>
16
+ </TableColumn>
17
+ </Table>
18
+ `,
19
+ components: {
20
+ Table, TableColumn, Input
21
+ },
22
+ data() {
23
+ return {
24
+ data: [
25
+ {
26
+ discount: "3.5",
27
+ children: [
28
+ {
29
+ discount: "4.5",
30
+ },
31
+ ],
32
+ },
33
+ ],
34
+ }
35
+ }
36
+ }).mount(container);
37
+
38
+ const table = vue.$refs.table as Table;
39
+ table.set('spreadKeys', [0]);
40
+ await wait();
41
+
42
+ const [, input] = document.querySelectorAll('input');
43
+ dispatchEvent(input, 'focus');
44
+ input.value = 'a';
45
+ dispatchEvent(input, 'input')
46
+ dispatchEvent(input, 'blur');
47
+
48
+ await wait();
49
+ expect(input.value).to.eql('a');
50
+
51
+ render(null, container);
52
+ document.body.removeChild(container);
53
+ });
54
+ });
@@ -5,6 +5,7 @@ export interface ButtonGroupProps {
5
5
  checkType?: 'none' | 'radio' | 'checkbox';
6
6
  fluid?: boolean;
7
7
  seperate?: boolean;
8
+ separate?: boolean;
8
9
  btnWidth?: number | string;
9
10
  }
10
11
  export declare class ButtonGroup extends Component<ButtonGroupProps> {
@@ -11,6 +11,7 @@ var typeDefs = {
11
11
  fluid: Boolean,
12
12
  checkType: ['none', 'radio', 'checkbox'],
13
13
  seperate: Boolean,
14
+ separate: Boolean,
14
15
  btnWidth: [Number, String]
15
16
  };
16
17
  var defaults = function defaults() {
@@ -33,6 +34,9 @@ export var ButtonGroup = /*#__PURE__*/function (_Component) {
33
34
  var _proto = ButtonGroup.prototype;
34
35
  _proto.init = function init() {
35
36
  provide(BUTTON_GROUP, this);
37
+ if (typeof this.get().seperate === 'boolean') {
38
+ console.warn("`seperate` is a typo which will be removed in next version, please using `separate` instead");
39
+ }
36
40
  };
37
41
  _proto.setValue = function setValue(v) {
38
42
  var _this$get = this.get(),
@@ -12,9 +12,10 @@ export default function ($props, $blocks, $__proto__) {
12
12
  vertical = _this$get.vertical,
13
13
  children = _this$get.children,
14
14
  fluid = _this$get.fluid,
15
- seperate = _this$get.seperate;
15
+ seperate = _this$get.seperate,
16
+ separate = _this$get.separate;
16
17
  var k = this.config.k;
17
- var classNameObj = (_classNameObj = {}, _classNameObj[k + "-btns"] = true, _classNameObj[k + "-vertical"] = vertical, _classNameObj[k + "-fluid"] = fluid, _classNameObj[k + "-seperate"] = seperate, _classNameObj[className] = className, _classNameObj[makeButtonGroupStyles(k)] = true, _classNameObj);
18
+ var classNameObj = (_classNameObj = {}, _classNameObj[k + "-btns"] = true, _classNameObj[k + "-vertical"] = vertical, _classNameObj[k + "-fluid"] = fluid, _classNameObj[k + "-separate"] = typeof separate === 'boolean' ? separate : separate, _classNameObj[className] = className, _classNameObj[makeButtonGroupStyles(k)] = true, _classNameObj);
18
19
  return _$cv('div', _extends({
19
20
  'className': _$cn(classNameObj)
20
21
  }, getRestProps(this)), children);
@@ -55,7 +55,7 @@ export default function ($props, $blocks, $__proto__) {
55
55
  }
56
56
  });
57
57
  }
58
- var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(size)] = size !== 'default', _classNameObj[cls(type)] = !color, _classNameObj[cls("btn-icon")] = icon, _classNameObj[className] = className, _classNameObj[cls('circle')] = circle, _classNameObj[cls('loading')] = loading, _classNameObj[cls('fluid')] = fluid, _classNameObj[cls('active')] = checked, _classNameObj[cls('disabled')] = disabled || loading, _classNameObj[cls('ghost')] = ghost, _classNameObj[cls('custom')] = color, _classNameObj[makeButtonStyles(k, iconSide, color)] = true, _classNameObj);
58
+ var classNameObj = (_classNameObj = {}, _classNameObj[cls('btn')] = true, _classNameObj[cls(size)] = size !== 'default', _classNameObj[cls(type)] = !color, _classNameObj[cls("btn-icon")] = icon, _classNameObj[className] = className, _classNameObj[cls('circle')] = circle, _classNameObj[cls('loading')] = loading, _classNameObj[cls('fluid')] = fluid, _classNameObj[cls('active')] = checked, _classNameObj[cls('custom')] = color, _classNameObj[cls('disabled')] = disabled || loading, _classNameObj[cls('ghost')] = ghost, _classNameObj[makeButtonStyles(k, iconSide, color)] = true, _classNameObj);
59
59
  var loadingIcon = _$cc(Icon, {
60
60
  'className': _$cn("ion-load-c " + k + "-icon-loading"),
61
61
  'size': size /*loadingSizeMap[size]*/,
@@ -11,7 +11,7 @@ var btnStyles = {
11
11
  return theme.color.text;
12
12
  },
13
13
  bgColor: '#fff',
14
- lineHeight: '1.15',
14
+ lineHeight: '1',
15
15
  get padding() {
16
16
  return "0 16px";
17
17
  },
@@ -199,8 +199,8 @@ export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide, color
199
199
  // extract static styles to individual css method for performance
200
200
  css("display:inline-flex;align-items:center;justify-content:center;cursor:pointer;height:", button.height, ";padding:", button.padding, ";outline:none;vertical-align:middle;color:", button.color, ";background:", button.bgColor, ";border-radius:", button.borderRadius, ";border:1px solid ", button.borderColor, ";font-size:", button.fontSize, ";white-space:nowrap;transition:all ", button.transition, ";line-height:", button.lineHeight, ";.", k, "-icon{color:inherit;}&.", k, "-default,&.", k, "-none,&.", k, "-flat{.", k, "-icon{color:", theme.color.lightBlack, ";}&:hover{.", k, "-icon{color:inherit;}}}&:hover,&:focus{border-color:", button.hoverBorderColor, ";color:", button.hoverColor, ";}&:active{background:", palette(theme.color.primary, -4), ";}.", k, "-button-input{position:absolute;opacity:0;width:0;height:0;}", _mapInstanceProperty(types).call(types, function (type) {
201
201
  var typeStyles = button[type];
202
- return /*#__PURE__*/css("&.", k, "-", type, "{background:", typeStyles.bgColor, ";color:", typeStyles.color, ";border-color:", typeStyles.borderColor, ";&:hover,&:focus{background:", palette(typeStyles.bgColor, -1), ";border-color:", typeStyles.hoverBorderColor, ";color:", typeStyles.color, ";}&:active{background:", palette(typeStyles.bgColor, 1), ";border-color:", palette(typeStyles.borderColor, 1), ";}}");
203
- }), "&.", k, "-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}}", color && /*#__PURE__*/css("&.", k, "-custom{color:", color, ";border-color:", color, ";&:hover,&:focus{background:", palette(color, -4), ";}&:active{background:", palette(color, -3), ";}}"), " &.", k, "-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";background:", link.hoverBgColor, ";}}&.", k, "-none,&.", k, "-link,&.", k, "-flat{background:transparent;&,&:hover{border:none;}&.", k, "-active{color:", theme.color.primary, ";}}&.", k, "-none:hover{background:", button.none.hoverBgColor, ";}&.", k, "-flat{background:", button.none.hoverBgColor, ";}&.", k, "-disabled{.", k, "-icon{color:inherit;}&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.", k, "-none.", k, "-disabled,&.", k, "-link.", k, "-disabled{&,&:hover{background:transparent;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
202
+ return /*#__PURE__*/css("&.", k, "-", type, "{background:", typeStyles.bgColor, ";color:", typeStyles.color, ";border-color:", typeStyles.borderColor, ";&:hover,&:focus{background:", palette(typeStyles.bgColor, -1), ";border-color:", typeStyles.hoverBorderColor, ";color:", typeStyles.color, ";}&:active{background:", palette(typeStyles.bgColor, 1), ";border-color:", palette(typeStyles.borderColor, 1), ";}&.", k, "-disabled{&,&:hover{background:", palette(typeStyles.bgColor, -2), ";color:", palette(typeStyles.color, -2), ";border-color:", palette(typeStyles.borderColor, -2), ";}}}");
203
+ }), "&.", k, "-secondary{color:", secondary.color, ";border-color:", secondary.borderColor, ";&:hover,&:focus{background:", secondary.hoverBgColor, ";}&:active{background:", secondary.activeBgColor, ";}&.", k, "-disabled{border:none;}}", color && /*#__PURE__*/css("&.", k, "-custom{color:", color, ";border-color:", color, ";&:hover,&:focus{background:", palette(color, -4), ";}&:active{background:", palette(color, -3), ";}&.", k, "-disabled{border:none;}}"), " &.", k, "-link{color:", link.color, ";&:hover{color:", link.hoverColor, ";background:", link.hoverBgColor, ";}}&.", k, "-none,&.", k, "-link,&.", k, "-flat{background:transparent;&,&:hover{border:none;}&.", k, "-active{color:", theme.color.primary, ";}}&.", k, "-none:hover{background:", button.none.hoverBgColor, ";}&.", k, "-flat{background:", button.none.hoverBgColor, ";}&.", k, "-disabled{.", k, "-icon{color:inherit;}&,&:hover{color:", button.disabled.color, ";background:", button.disabled.bgColor, ";border-color:", button.disabled.borderColor, ";cursor:not-allowed;}}&.", k, "-none.", k, "-disabled,&.", k, "-link.", k, "-disabled{&,&:hover{background:transparent;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
204
204
  var styles = button[size];
205
205
  return /*#__PURE__*/css("&.", k, "-", size, "{font-size:", styles.fontSize, ";height:", styles.height, ";padding:", styles.padding, ";&.", k, "-btn-icon{width:", styles.height, ";}}");
206
206
  }), "&.", k, "-btn-icon{width:", button.height, ";padding:0;.", k, "-icon{margin:0;}}&.", k, "-fluid{width:100%;padding:0;}&.", k, "-circle{border-radius:calc(", button.large.height, " / 2);}&.", k, "-loading{", _mapInstanceProperty(types).call(types, function (type) {
@@ -219,13 +219,13 @@ export var makeButtonStyles = cache(function makeButtonStyles(k, iconSide, color
219
219
  }), ";.", k, "-icon-loading{margin-left:-1em;}}}"), ";"));
220
220
  });
221
221
  export var makeButtonGroupStyles = cache(function makeButtonGroupStyles(k) {
222
- return /*#__PURE__*/css("display:inline-flex;align-items:center;flex-wrap:wrap;vertical-align:middle;.", k, "-btn{margin:0;vertical-align:middle;&:hover,&:focus,&.", k, "-active{z-index:1;position:relative;}}&.", k, "-fluid{width:100%;}&:not(.", k, "-vertical):not(.", k, "-seperate){>.", k, "-btn{", _mapInstanceProperty(types).call(types, function (type) {
222
+ return /*#__PURE__*/css("display:inline-flex;align-items:center;flex-wrap:wrap;vertical-align:middle;.", k, "-btn{margin:0;vertical-align:middle;&:hover,&:focus,&.", k, "-active{z-index:1;position:relative;}}&.", k, "-fluid{width:100%;}&:not(.", k, "-vertical):not(.", k, "-separate){>.", k, "-btn{", _mapInstanceProperty(types).call(types, function (type) {
223
223
  if (type === 'active') return;
224
224
  var borderColor = button.group[type].borderColor;
225
225
  return /*#__PURE__*/css("&.", k, "-", type, ":not(:first-child){border-left-color:", borderColor, ";}&.", k, "-", type, ":not(:last-child){border-right-color:", borderColor, ";}");
226
- }), ";&:not(:first-child){margin-left:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-top-right-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-bottom-left-radius:0;}}&.", k, "-fluid{display:flex;>.", k, "-btn{flex:1;}}}&.", k, "-vertical:not(.", k, "-seperate){flex-direction:column;>.", k, "-btn{", _mapInstanceProperty(types).call(types, function (type) {
226
+ }), ";&:not(:first-child){margin-left:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-top-right-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-bottom-left-radius:0;}}&.", k, "-fluid{display:flex;>.", k, "-btn{flex:1;}}}&.", k, "-vertical:not(.", k, "-separate){flex-direction:column;>.", k, "-btn{", _mapInstanceProperty(types).call(types, function (type) {
227
227
  if (type === 'active') return;
228
228
  var borderColor = button.group[type].borderColor;
229
229
  return /*#__PURE__*/css("&.", k, "-", type, ":not(:first-child){border-top-color:", borderColor, ";}&.", k, "-", type, ":not(:last-child){border-bottom-color:", borderColor, ";}");
230
- }), ";&:not(.", k, "-btn-icon){width:100%;}&:not(:first-child){margin-top:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-bottom-left-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-top-right-radius:0;}}}&.", k, "-seperate{gap:8px;}");
230
+ }), ";&:not(.", k, "-btn-icon){width:100%;}&:not(:first-child){margin-top:-1px;&:not(:last-child){border-radius:0;}}&:not(:only-child):first-child{border-bottom-left-radius:0;border-bottom-right-radius:0;}&:not(:only-child):last-child{border-top-left-radius:0;border-top-right-radius:0;}}}&.", k, "-separate{gap:8px;}");
231
231
  });
@@ -12,7 +12,7 @@ export declare class DCallout extends DShape {
12
12
  rotatable?: boolean | undefined;
13
13
  editable?: boolean | undefined;
14
14
  connectable?: boolean | undefined;
15
- strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
15
+ strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
16
16
  label?: string | number | undefined;
17
17
  style?: Record<string, string | number> | undefined;
18
18
  data?: any;
@@ -12,7 +12,7 @@ export declare class DCircle extends DShape {
12
12
  rotatable?: boolean | undefined;
13
13
  editable?: boolean | undefined;
14
14
  connectable?: boolean | undefined;
15
- strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
15
+ strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
16
16
  label?: string | number | undefined;
17
17
  style?: Record<string, string | number> | undefined;
18
18
  data?: any;
@@ -12,7 +12,7 @@ export declare class DDocument extends DShape {
12
12
  rotatable?: boolean | undefined;
13
13
  editable?: boolean | undefined;
14
14
  connectable?: boolean | undefined;
15
- strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
15
+ strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
16
16
  label?: string | number | undefined;
17
17
  style?: Record<string, string | number> | undefined;
18
18
  data?: any;
@@ -12,7 +12,7 @@ export declare class DEllipse extends DShape {
12
12
  rotatable?: boolean | undefined;
13
13
  editable?: boolean | undefined;
14
14
  connectable?: boolean | undefined;
15
- strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
15
+ strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
16
16
  label?: string | number | undefined;
17
17
  style?: Record<string, string | number> | undefined;
18
18
  data?: any;
@@ -12,7 +12,7 @@ export declare class DHexagon extends DShape {
12
12
  rotatable?: boolean | undefined;
13
13
  editable?: boolean | undefined;
14
14
  connectable?: boolean | undefined;
15
- strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
15
+ strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
16
16
  label?: string | number | undefined;
17
17
  style?: Record<string, string | number> | undefined;
18
18
  data?: any;
@@ -18,7 +18,7 @@ export declare class DImage extends DShape<DImageProps> {
18
18
  rotatable?: boolean | undefined;
19
19
  editable?: boolean | undefined;
20
20
  connectable?: boolean | undefined;
21
- strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
21
+ strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
22
22
  label?: string | number | undefined;
23
23
  style?: Record<string, string | number> | undefined;
24
24
  data?: any;
@@ -12,7 +12,7 @@ export declare class DParallelogram extends DShape {
12
12
  rotatable?: boolean | undefined;
13
13
  editable?: boolean | undefined;
14
14
  connectable?: boolean | undefined;
15
- strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
15
+ strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
16
16
  label?: string | number | undefined;
17
17
  style?: Record<string, string | number> | undefined;
18
18
  data?: any;
@@ -18,7 +18,7 @@ export declare class DRectangle extends DShape<DRectangleProps> {
18
18
  rotatable?: boolean | undefined;
19
19
  editable?: boolean | undefined;
20
20
  connectable?: boolean | undefined;
21
- strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
21
+ strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
22
22
  label?: string | number | undefined;
23
23
  style?: Record<string, string | number> | undefined;
24
24
  data?: any;
@@ -13,7 +13,7 @@ export declare class DSquare extends DRectangle {
13
13
  rotatable?: boolean | undefined;
14
14
  editable?: boolean | undefined;
15
15
  connectable?: boolean | undefined;
16
- strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
16
+ strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
17
17
  label?: string | number | undefined;
18
18
  style?: Record<string, string | number> | undefined;
19
19
  data?: any;
@@ -12,7 +12,7 @@ export declare class DText extends DShape {
12
12
  rotatable?: boolean | undefined;
13
13
  editable?: boolean | undefined;
14
14
  connectable?: boolean | undefined;
15
- strokeStyle?: "solid" | "dashed" | "dotted" | undefined;
15
+ strokeStyle?: "dashed" | "dotted" | "solid" | undefined;
16
16
  label?: string | number | undefined;
17
17
  style?: Record<string, string | number> | undefined;
18
18
  data?: any;
@@ -58,11 +58,11 @@ var defaults = {
58
58
  padding: "0 24px",
59
59
  bodyMarginTop: "-25px",
60
60
  tipIconMarginBottom: '10px',
61
- tipIconFontSize: '37px',
62
- tipIconLineHeight: '37px',
61
+ tipIconFontSize: '24px',
62
+ tipIconLineHeight: '24px',
63
63
  // with title
64
64
  titleFontWeight: '500',
65
- titleTipIconFontSize: '37px',
65
+ titleTipIconFontSize: '24px',
66
66
  titleFontSize: '14px',
67
67
  wrapperPaddingLeft: '8px',
68
68
  titleBodyMarginTop: '-36px'
@@ -50,8 +50,11 @@ export var DropdownItem = /*#__PURE__*/function (_Component) {
50
50
  // hide all dropdowns
51
51
  var dropdown = this.dropdown;
52
52
  do {
53
- dropdown.hide(true);
54
- } while (dropdown = dropdown.dropdown);
53
+ if (!dropdown.$isTooltip) {
54
+ dropdown.hide(true);
55
+ }
56
+ dropdown = dropdown.dropdown;
57
+ } while (dropdown);
55
58
  }
56
59
  };
57
60
  _proto.hasSubMenu = function hasSubMenu() {
@@ -1,4 +1,5 @@
1
1
  import { Component, TypeDefs } from 'intact-vue-next';
2
+ import type { AutoRows } from '../input';
2
3
  import type { Events } from '../types';
3
4
  type Value = string | number;
4
5
  export interface EditableProps<V extends Value = Value> {
@@ -10,6 +11,7 @@ export interface EditableProps<V extends Value = Value> {
10
11
  tip?: Value;
11
12
  trim?: boolean;
12
13
  invalid?: boolean;
14
+ rows?: string | number | 'auto' | AutoRows;
13
15
  }
14
16
  export interface EditableEvents<V extends Value = Value> {
15
17
  error: [string];
@@ -15,13 +15,15 @@ var typeDefs = {
15
15
  disabled: Boolean,
16
16
  tip: [String, Number],
17
17
  trim: Boolean,
18
- invalid: Boolean
18
+ invalid: Boolean,
19
+ rows: [String, Number, 'auto', Object]
19
20
  };
20
21
  var defaults = function defaults() {
21
22
  return {
22
23
  required: true,
23
24
  tip: _$('编辑'),
24
- trim: true
25
+ trim: true,
26
+ rows: 1
25
27
  };
26
28
  };
27
29
  var events = {
@@ -4,6 +4,7 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/con
4
4
  import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
5
5
  import BasicDemo from '~/components/editable/demos/basic';
6
6
  import ValidateDemo from '~/components/editable/demos/validate';
7
+ import TextAreaDemo from '~/components/editable/demos/textarea';
7
8
  import { mount, unmount, dispatchEvent, wait } from '../../test/utils';
8
9
  import { Editable } from './';
9
10
  import { Component, findDomFromVNode } from 'intact-vue-next';
@@ -183,4 +184,42 @@ describe('Editable', function () {
183
184
  }
184
185
  }, _callee3);
185
186
  })));
187
+ it('should auto use input or textarea', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
188
+ var _mount4, instance, element, editable, input, textarea, textarea2;
189
+ return _regeneratorRuntime.wrap(function _callee4$(_context5) {
190
+ while (1) switch (_context5.prev = _context5.next) {
191
+ case 0:
192
+ _mount4 = mount(TextAreaDemo), instance = _mount4[0], element = _mount4[1];
193
+ editable = instance.refs.__test; // @ts-ignore
194
+ editable.edit();
195
+ _context5.next = 5;
196
+ return wait();
197
+ case 5:
198
+ expect(element.innerHTML).to.matchSnapshot();
199
+ input = element.querySelector('input');
200
+ textarea = element.querySelector('textarea');
201
+ expect(input).to.be.null;
202
+ textarea.value = 'test';
203
+ dispatchEvent(textarea, 'blur');
204
+ _context5.next = 13;
205
+ return wait();
206
+ case 13:
207
+ expect(instance.get('text')).to.eql('test');
208
+ editable.set('rows', 1);
209
+ _context5.next = 17;
210
+ return wait();
211
+ case 17:
212
+ // @ts-ignore
213
+ editable.edit();
214
+ _context5.next = 20;
215
+ return wait();
216
+ case 20:
217
+ textarea2 = element.querySelector('textarea');
218
+ expect(textarea2).to.be.null;
219
+ case 22:
220
+ case "end":
221
+ return _context5.stop();
222
+ }
223
+ }, _callee4);
224
+ })));
186
225
  });
@@ -5,6 +5,7 @@ import { Input } from '../input';
5
5
  import { Icon } from '../icon';
6
6
  import { makeStyles } from './styles';
7
7
  import { Tooltip } from '../tooltip';
8
+ import { isNullOrUndefined } from 'intact-shared';
8
9
  export default function ($props, $blocks, $__proto__) {
9
10
  var _classNameObj;
10
11
  $blocks || ($blocks = {});
@@ -18,21 +19,31 @@ export default function ($props, $blocks, $__proto__) {
18
19
  validate = _this$get.validate,
19
20
  disabled = _this$get.disabled,
20
21
  tip = _this$get.tip,
21
- invalid = _this$get.invalid;
22
+ invalid = _this$get.invalid,
23
+ rows = _this$get.rows;
22
24
  var k = this.config.k;
23
25
  var classNameObj = (_classNameObj = {}, _classNameObj[k + "-editable"] = true, _classNameObj[k + "-editing"] = editing, _classNameObj[k + "-disabled"] = disabled, _classNameObj[k + "-invalid"] = invalid, _classNameObj[className] = className, _classNameObj[makeStyles(k)] = true, _classNameObj);
26
+ var isTextArea = !isNullOrUndefined(rows) && rows != '1';
27
+ var inputProps = _extends({
28
+ autoWidth: !isTextArea,
29
+ fluid: isTextArea
30
+ }, isTextArea && {
31
+ type: 'textarea'
32
+ }, {
33
+ rows: rows
34
+ }, (!isTextArea || rows === 'auto') && {
35
+ size: 'mini'
36
+ });
24
37
  return _$cv('div', _extends({}, getRestProps(this), {
25
38
  'className': _$cn(classNameObj)
26
- }), [_$ce(2, 'div', !editing ? children : _$cc(Input, {
27
- 'size': 'mini',
39
+ }), [_$ce(2, 'div', !editing ? children : _$cc(Input, _extends({
28
40
  'defaultValue': value,
29
41
  'ev-blur': this.onBlur,
30
42
  'ev-keydown': this.onKeydown,
31
43
  'ref': this.inputRef,
32
44
  'frozenOnInput': true,
33
- 'ev-$mounted': this.select,
34
- 'autoWidth': true
35
- }, null, this.inputRef), 0, 'c-ellipsis'), !disabled && !editing ? _$cc(Tooltip, {
45
+ 'ev-$mounted': this.select
46
+ }, inputProps), null, this.inputRef), 0, 'c-ellipsis'), !disabled && !editing ? _$cc(Tooltip, {
36
47
  'content': tip,
37
48
  'children': _$cc(Icon, {
38
49
  'className': _$cn(k + "-icon-edit " + k + "-editable-icon"),
@@ -1,6 +1,7 @@
1
1
  import '../../styles/global';
2
2
  declare const defaults: {
3
3
  iconGap: string;
4
+ readonly smallPadding: string;
4
5
  invalid: {
5
6
  readonly border: string;
6
7
  };
@@ -5,6 +5,9 @@ import '../../styles/global';
5
5
  import { cache } from '../utils';
6
6
  var defaults = {
7
7
  iconGap: '0 0 0 8px',
8
+ get smallPadding() {
9
+ return theme.small.padding;
10
+ },
8
11
  // invalid
9
12
  invalid: {
10
13
  get border() {
@@ -6,6 +6,7 @@ export interface EllipsisProps {
6
6
  disabled?: boolean;
7
7
  position?: Position | 'left' | 'bottom' | 'right' | 'top';
8
8
  theme?: 'light' | 'dark';
9
+ hoverable?: boolean;
9
10
  }
10
11
  export declare class Ellipsis extends Component<EllipsisProps> {
11
12
  static template: string | import('intact-vue-next').Template<any>;
@@ -8,12 +8,14 @@ var typeDefs = {
8
8
  maxLines: Number,
9
9
  disabled: Boolean,
10
10
  position: [Object, 'left', 'bottom', 'right', 'top'],
11
- theme: ['light', 'dark']
11
+ theme: ['light', 'dark'],
12
+ hoverable: Boolean
12
13
  };
13
14
  var defaults = function defaults() {
14
15
  return {
15
16
  disabled: false,
16
- theme: 'light'
17
+ theme: 'light',
18
+ hoverable: false
17
19
  };
18
20
  };
19
21
  export var Ellipsis = /*#__PURE__*/function (_Component) {
@@ -15,7 +15,8 @@ export default function ($props, $blocks, $__proto__) {
15
15
  disabled = _this$get.disabled,
16
16
  position = _this$get.position,
17
17
  theme = _this$get.theme,
18
- style = _this$get.style;
18
+ style = _this$get.style,
19
+ hoverable = _this$get.hoverable;
19
20
  var k = this.config.k;
20
21
  var _this$ellipsis = this.ellipsis,
21
22
  showTooltip = _this$ellipsis.showTooltip,
@@ -31,6 +32,7 @@ export default function ($props, $blocks, $__proto__) {
31
32
  'position': position,
32
33
  'theme': theme,
33
34
  'className': _$cn(className),
35
+ 'hoverable': hoverable,
34
36
  'children': wrapper,
35
37
  '$blocks': function ($blocks) {
36
38
  var _$blocks = {},
@@ -6,6 +6,12 @@ import { deepDefaults, sizes } from '../../styles/utils';
6
6
  import '../../styles/global';
7
7
  import { Input } from './';
8
8
  import { cache } from '../utils';
9
+ var textareaSize = {
10
+ mini: '0',
11
+ small: '1px',
12
+ default: '5px',
13
+ large: '7px'
14
+ };
9
15
  var defaults = deepDefaults({
10
16
  get transition() {
11
17
  return theme.transition.middle;
@@ -85,6 +91,7 @@ var defaults = deepDefaults({
85
91
  }
86
92
  }, sizes.reduce(function (memo, size) {
87
93
  var styles = theme[size];
94
+ var textareaStyles = textareaSize[size];
88
95
  memo[size] = {
89
96
  get fontSize() {
90
97
  return styles.fontSize;
@@ -94,6 +101,9 @@ var defaults = deepDefaults({
94
101
  },
95
102
  get paddingGap() {
96
103
  return styles.padding;
104
+ },
105
+ get padding() {
106
+ return textareaStyles;
97
107
  }
98
108
  };
99
109
  return memo;
@@ -110,7 +120,7 @@ export var makeStyles = cache(function makeStyles(k) {
110
120
  var _context;
111
121
  return /*#__PURE__*/css("display:inline-block;width:", input.width, ";color:", input.color, ";vertical-align:middle;.", k, "-input-wrapper{display:inline-flex;align-items:center;width:100%;position:relative;border:", input.border, ";background-color:", input.bgColor, ";transition:border ", input.transition, ",background ", input.transition, ",box-shadow ", input.transition, ";border-radius:", input.borderRadius, ";&:hover{border:", input.hoverBorder, ";z-index:1;}}&.", k, "-focus .", k, "-input-wrapper{border:", input.focusBorder, ";z-index:1;}.", k, "-input-inner{flex:1;outline:none;color:inherit;font-size:inherit;border:none;background:transparent;padding:0;width:0;max-width:100%;&::placeholder{color:", input.placeholderColor, ";}}&.", k, "-fluid{width:100%;}.", k, "-input-prefix,.", k, "-input-suffix{display:flex;align-items:center;gap:", input.clearIconGap, ";color:", theme.color.lightBlack, ";position:relative;}.", k, "-input-prefix{margin-right:", input.clearIconGap, ";}.", k, "-input-suffix{margin-left:", input.clearIconGap, ";}.", k, "-input-clear{opacity:0;transition:opacity ", input.transition, ";pointer-events:none;color:", input.clearIconColor, ";}&:hover .", k, "-input-clear.", k, "-input-show{opacity:1;pointer-events:all;}.", k, "-input-show-password{color:", input.clearIconColor, ";}&.", k, "-stack-clear{.", k, "-input-clear{position:absolute;z-index:1;right:0;&.", k, "-input-show+*{transition:opacity ", input.transition, ";}}&:hover{.", k, "-input-clear.", k, "-input-show+*{opacity:0;}}}&.", k, "-group{display:inline-flex;.", k, "-input-wrapper{border-radius:0;flex:1;}.", k, "-input-wrapper:first-child{border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";}.", k, "-input-wrapper:last-child{border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;}}.", k, "-input-prepend,.", k, "-input-append{display:inline-flex;align-items:center;background-color:", input.groupBgColor, ";border:", input.border, ";white-space:nowrap;.", k, "-btn{margin:-1px;&.", k, "-none:hover{background:transparent;}}.", k, "-select{margin:-1px;text-align:left;}}.", k, "-input-prepend{&,.", k, "-btn,.", k, "-select{z-index:1;border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";}}.", k, "-input-append{&,.", k, "-btn,.", k, "-select{z-index:1;border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;}}.", k, "-input-padding{padding:0 ", input.groupPaddingGap, ";}.", k, "-input-prepend{border-right:none;}.", k, "-input-append{border-left:none;}&.", k, "-flat{color:", _flatInstanceProperty(input).color, ";.", k, "-input-wrapper{border:none;background:", _flatInstanceProperty(input).bgColor, ";}}&.", k, "-disabled{color:", input.disabledColor, ";cursor:not-allowed;.", k, "-input-wrapper{border-color:", input.disabledBorderColor, ";background:", input.disabledBgColor, ";}.", k, "-input-inner{cursor:not-allowed;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
112
122
  var styles = input[size];
113
- var sizeClassName = /*#__PURE__*/css("font-size:", styles.fontSize, ";.", k, "-input-wrapper{height:", styles.height, ";padding:0 ", styles.paddingGap, ";}");
123
+ var sizeClassName = /*#__PURE__*/css("font-size:", styles.fontSize, ";.", k, "-input-wrapper{height:", styles.height, ";padding:0 ", styles.paddingGap, ";.", k, "-textarea{padding:", styles.padding, " ", styles.paddingGap, ";}}");
114
124
  if (size === 'default') return sizeClassName;
115
125
  return /*#__PURE__*/css("&.", k, "-", size, "{", sizeClassName, ";}");
116
126
  }), "&.", k, "-inline{.", k, "-input-wrapper{height:auto;border:none;border-radius:0;padding:0;}}&.", k, "-type-textarea{.", k, "-input-wrapper{display:inline-block;padding:0;height:auto;}.", k, "-textarea{width:100%;padding:", input.textareaPadding, ";line-height:1.5;vertical-align:top;}.", k, "-input-suffix{margin:0;justify-content:flex-end;}}", _mapInstanceProperty(_context = Input.typeDefs.resize).call(_context, function (type) {
@@ -115,7 +115,7 @@ export var makeMenuStyles = cache(function makeMenuStyles(k) {
115
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 16px;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;scrollbar-width:none;}.", 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-right: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) {
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
- }), "&.", 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-header{padding:0;}.", k, "-menu-header{padding:0;}.", 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, ";}}}");
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-header{padding:0;}.", 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, ";}}}");
119
119
  });
120
120
  export var makeTitleStyles = cache(function makeTitleStyles(k) {
121
121
  var item = menu.item;
@@ -13,6 +13,7 @@ import { Tooltip } from '../tooltip';
13
13
  import { Component } from 'intact-vue-next';
14
14
  import { Select, Option } from '../select';
15
15
  import SearchableDemo from '~/components/select/demos/searchable';
16
+ import ImmutableDemo from '~/components/select/demos/immutable';
16
17
  describe('Select', function () {
17
18
  afterEach(function (done) {
18
19
  unmount();
@@ -449,6 +450,52 @@ describe('Select', function () {
449
450
  }
450
451
  }, _callee10);
451
452
  })));
453
+ it('disabled option does not allow clearable and close', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
454
+ var _mount12, instance, element, _element$querySelecto7, clear1, _element$querySelecto8, tag1, _element$querySelecto9, clear2, _element$querySelecto10, clear3;
455
+ return _regeneratorRuntime.wrap(function _callee11$(_context13) {
456
+ while (1) switch (_context13.prev = _context13.next) {
457
+ case 0:
458
+ _mount12 = mount(ImmutableDemo), instance = _mount12[0], element = _mount12[1];
459
+ instance.set('days', ['Tuesday', 'Friday']);
460
+ _context13.next = 4;
461
+ return wait();
462
+ case 4:
463
+ expect(element.outerHTML).to.matchSnapshot();
464
+ _element$querySelecto7 = element.querySelectorAll('.k-select-clear'), clear1 = _element$querySelecto7[0];
465
+ clear1.click();
466
+ _context13.next = 9;
467
+ return wait();
468
+ case 9:
469
+ _element$querySelecto8 = element.querySelectorAll('.k-tag'), tag1 = _element$querySelecto8[0];
470
+ expect(tag1.className).not.contain("k-closable");
471
+ expect(instance.get('days')).to.eql(['Tuesday', 'Friday']);
472
+ instance.set('days', ['Monday', 'Tuesday']);
473
+ _context13.next = 15;
474
+ return wait();
475
+ case 15:
476
+ _element$querySelecto9 = element.querySelectorAll('.k-select-clear'), clear2 = _element$querySelecto9[0];
477
+ clear2.click();
478
+ _context13.next = 19;
479
+ return wait();
480
+ case 19:
481
+ expect(instance.get('days')).to.eql(['Tuesday']);
482
+ instance.set('days', ['Monday', 'Wednesday']);
483
+ _context13.next = 23;
484
+ return wait();
485
+ case 23:
486
+ _element$querySelecto10 = element.querySelectorAll('.k-select-clear'), clear3 = _element$querySelecto10[0];
487
+ clear3.click();
488
+ _context13.next = 27;
489
+ return wait();
490
+ case 27:
491
+ expect(instance.get('days')).to.eql([]);
492
+ // expect(clear).to.be.null;
493
+ case 28:
494
+ case "end":
495
+ return _context13.stop();
496
+ }
497
+ }, _callee11);
498
+ })));
452
499
  // it('should trigger change event correctly', async () => {
453
500
  // const spy = sinon.spy();
454
501
  // class Demo extends Component {