@king-design/vue 3.4.3-beta.1 → 3.4.3

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 (54) hide show
  1. package/__tests__/__snapshots__/Vue Next Demos.md +279 -217
  2. package/__tests__/components/editable.spec.ts +1 -1
  3. package/__tests__/components/table.spec.ts +54 -0
  4. package/components/button/index.vdt.js +1 -1
  5. package/components/button/styles.js +3 -3
  6. package/components/diagram/shapes/callout.d.ts +1 -1
  7. package/components/diagram/shapes/circle.d.ts +1 -1
  8. package/components/diagram/shapes/document.d.ts +1 -1
  9. package/components/diagram/shapes/ellipse.d.ts +1 -1
  10. package/components/diagram/shapes/hexagon.d.ts +1 -1
  11. package/components/diagram/shapes/image.d.ts +1 -1
  12. package/components/diagram/shapes/parallelogram.d.ts +1 -1
  13. package/components/diagram/shapes/rectangle.d.ts +1 -1
  14. package/components/diagram/shapes/square.d.ts +1 -1
  15. package/components/diagram/shapes/text.d.ts +1 -1
  16. package/components/dialog/styles.js +3 -3
  17. package/components/dropdown/item.js +5 -2
  18. package/components/editable/index.d.ts +2 -0
  19. package/components/editable/index.js +4 -2
  20. package/components/editable/index.spec.js +39 -0
  21. package/components/editable/index.vdt.js +17 -6
  22. package/components/editable/styles.d.ts +1 -0
  23. package/components/editable/styles.js +3 -0
  24. package/components/ellipsis/index.d.ts +1 -0
  25. package/components/ellipsis/index.js +4 -2
  26. package/components/ellipsis/index.vdt.js +3 -1
  27. package/components/input/styles.js +11 -1
  28. package/components/select/base.d.ts +4 -0
  29. package/components/select/base.js +11 -1
  30. package/components/select/base.vdt.js +2 -1
  31. package/components/select/index.spec.js +47 -0
  32. package/components/select/useImmutable.d.ts +4 -0
  33. package/components/select/useImmutable.js +45 -0
  34. package/components/switch/styles.js +1 -1
  35. package/components/table/cell.d.ts +1 -0
  36. package/components/table/cell.vdt.js +14 -3
  37. package/components/table/column.d.ts +1 -0
  38. package/components/table/column.js +1 -0
  39. package/components/table/row.d.ts +2 -1
  40. package/components/table/row.js +24 -15
  41. package/components/table/row.vdt.js +3 -1
  42. package/components/table/styles.js +2 -2
  43. package/components/table/table.d.ts +3 -0
  44. package/components/table/table.js +3 -1
  45. package/components/table/table.vdt.js +19 -3
  46. package/components/table/useTree.d.ts +1 -1
  47. package/components/table/useTree.js +30 -2
  48. package/components/tooltip/index.spec.js +99 -67
  49. package/components/tooltip/tooltip.d.ts +1 -0
  50. package/components/tooltip/tooltip.js +9 -1
  51. package/components/treeSelect/index.vdt.js +1 -0
  52. package/index.d.ts +2 -2
  53. package/index.js +2 -2
  54. package/package.json +2 -2
@@ -0,0 +1,45 @@
1
+ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
2
+ import { useInstance } from 'intact-vue-next';
3
+ import { Option } from './option';
4
+ import { OptionGroup } from './group';
5
+ import { eachChildren, isComponentVNode } from '../utils';
6
+ import { useState } from '../../hooks/useState';
7
+ export function useImmutable() {
8
+ var instance = useInstance();
9
+ var immutableValues = useState([]);
10
+ function setImmutableValues() {
11
+ var _instance$get = instance.get(),
12
+ children = _instance$get.children,
13
+ multiple = _instance$get.multiple;
14
+ if (!multiple) return;
15
+ updateImmutableValues(children);
16
+ }
17
+ function updateImmutableValues(children) {
18
+ var _immutableValues = [];
19
+ var loop = function loop(children) {
20
+ eachChildren(children, function (vNode) {
21
+ if (isComponentVNode(vNode, Option)) {
22
+ var _vNode$props = vNode.props,
23
+ disabled = _vNode$props.disabled,
24
+ value = _vNode$props.value;
25
+ if (disabled) {
26
+ _immutableValues.push(value);
27
+ }
28
+ } else if (isComponentVNode(vNode, OptionGroup)) {
29
+ loop(vNode.props.children);
30
+ }
31
+ });
32
+ };
33
+ loop(children);
34
+ immutableValues.set(_immutableValues);
35
+ }
36
+ function isClosable(key) {
37
+ var _context;
38
+ return !_includesInstanceProperty(_context = immutableValues.value).call(_context, key);
39
+ }
40
+ instance.on('$receive:children', setImmutableValues);
41
+ return {
42
+ immutableValues: immutableValues,
43
+ isClosable: isClosable
44
+ };
45
+ }
@@ -78,5 +78,5 @@ export var makeStyles = cache(function makeStyles(k) {
78
78
  padding = _kswitch$size.padding,
79
79
  iconSize = _kswitch$size.iconSize;
80
80
  return /*#__PURE__*/css("&.", k, "-", size, ",&.", k, "-", size, " .", k, "-switch-on,&.", k, "-", size, " .", k, "-switch-off{width:", width, ";height:", height, ";}&.", k, "-", size, "{border-radius:", height, ";.", k, "-switch-bar{width:", height, ";border-radius:", height, ";}.", k, "-switch-wrapper{padding:", padding, ";}.", k, "-switch-on,.", k, "-switch-off{line-height:", height, ";left:0;}.", k, "-switch-on{padding:0 ", height, " 0 calc(", height, " / 3);}.", k, "-switch-off{padding:0 calc(", height, " / 3) 0 ", height, ";}.", k, "-switch-icon{font-size:", iconSize, ";}}");
81
- }), "&.", k, "-checked{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.bgColor, ";}.", k, "-switch-bar{width:100%;}&:hover{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.hoverBgColor, ";}}}&.", k, "-disabled{&,.", k, "-switch-handle{cursor:not-allowed;}&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.disabledBgColor, ";}&.", k, "-checked{&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.disabledBgColor, ";}}}");
81
+ }), " &.", k, "-small .", k, "-switch-on,&.", k, "-small .", k, "-switch-off{font-size:10px;}&.", k, "-checked{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.bgColor, ";}.", k, "-switch-bar{width:100%;}&:hover{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.hoverBgColor, ";}}}&.", k, "-disabled{&,.", k, "-switch-handle{cursor:not-allowed;}&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.disabledBgColor, ";}&.", k, "-checked{&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.disabledBgColor, ";}}}");
82
82
  });
@@ -15,6 +15,7 @@ export interface TableCellProps {
15
15
  rowspan: number;
16
16
  onClickArrow: (e: MouseEvent) => void;
17
17
  hasChildren: boolean;
18
+ loaded: boolean;
18
19
  }
19
20
  export declare class TableCell extends Component<TableCellProps> {
20
21
  static template: string | import('intact-vue-next').Template<any>;
@@ -1,9 +1,10 @@
1
- import { createElementVNode as _$ce, createUnknownComponentVNode as _$cc, className as _$cn } from 'intact-vue-next';
1
+ import { createUnknownComponentVNode as _$cc, createElementVNode as _$ce, className as _$cn } from 'intact-vue-next';
2
2
  import { getClassAndStyleForFixed } from './useFixedColumns';
3
3
  import { get, noop } from 'intact-shared';
4
4
  import { Button } from '../button';
5
5
  import { Icon } from '../icon';
6
6
  import { getTextByChildren } from '../utils';
7
+ import { Ellipsis } from '../ellipsis';
7
8
  export default function ($props, $blocks, $__proto__) {
8
9
  var _classNameObj;
9
10
  $blocks || ($blocks = {});
@@ -21,7 +22,8 @@ export default function ($props, $blocks, $__proto__) {
21
22
  colspan = _this$get.colspan,
22
23
  rowspan = _this$get.rowspan,
23
24
  onClickArrow = _this$get.onClickArrow,
24
- hasChildren = _this$get.hasChildren;
25
+ hasChildren = _this$get.hasChildren,
26
+ loaded = _this$get.loaded;
25
27
  var k = this.config.k;
26
28
  var blocks = props.$blocks;
27
29
  var children = get(data, props.key);
@@ -31,6 +33,11 @@ export default function ($props, $blocks, $__proto__) {
31
33
  children = template(noop, [data, rowIndex]);
32
34
  }
33
35
  }
36
+ if (props.ellipsis) {
37
+ children = _$cc(Ellipsis, {
38
+ 'children': children
39
+ });
40
+ }
34
41
  var _getClassAndStyleForF = getClassAndStyleForFixed(props, offset, k, checkType),
35
42
  className = _getClassAndStyleForF.className,
36
43
  style = _getClassAndStyleForF.style;
@@ -46,9 +53,13 @@ export default function ($props, $blocks, $__proto__) {
46
53
  'size': 'mini',
47
54
  'className': _$cn(k + "-table-arrow"),
48
55
  'ev-click': onClickArrow,
49
- 'children': _$cc(Icon, {
56
+ 'disabled': loaded === false,
57
+ 'children': loaded !== false ? _$cc(Icon, {
50
58
  'className': _$cn(k + "-icon-right"),
51
59
  'size': 'small'
60
+ }) : _$cc(Icon, {
61
+ 'className': _$cn(k + "-tree-icon ion-load-c"),
62
+ 'rotate': true
52
63
  })
53
64
  }) : undefined, children], 0, _$cn(classNameObj), {
54
65
  'style': style,
@@ -14,6 +14,7 @@ export interface TableColumnProps {
14
14
  exportCell?: (data: any, index: number) => string;
15
15
  minWidth?: number;
16
16
  hidden?: boolean;
17
+ ellipsis?: boolean;
17
18
  cols?: number;
18
19
  rows?: number;
19
20
  prevVNode?: VNodeComponentClass<TableColumn> | null;
@@ -22,6 +22,7 @@ var typeDefs = {
22
22
  exportCell: Function,
23
23
  minWidth: Number,
24
24
  hidden: Boolean,
25
+ ellipsis: Boolean,
25
26
  // offset: null,
26
27
  cols: null,
27
28
  rows: null,
@@ -20,10 +20,11 @@ export interface TableRowProps {
20
20
  spreaded: boolean;
21
21
  hasChildren: boolean;
22
22
  indent: number;
23
- onToggleSpreadRow: (key: TableRowKey) => void;
23
+ onToggleSpreadRow: (key: TableRowKey, rowData?: any) => void;
24
24
  onBeforeUnmount: (key: TableRowKey) => void;
25
25
  offsetMap: Record<Key, number>;
26
26
  animation: boolean;
27
+ loaded: boolean;
27
28
  draggable: boolean;
28
29
  draggingKey: TableRowKey | null;
29
30
  onRowDragStart: DragCallback;
@@ -6,6 +6,7 @@ import template from './row.vdt';
6
6
  import { bind } from '../utils';
7
7
  import { isEqualObject } from '../utils';
8
8
  import { useConfigContext } from '../config';
9
+ import { hasOwn } from 'intact-shared';
9
10
  export var TableRow = /*#__PURE__*/function (_Component) {
10
11
  _inheritsLoose(TableRow, _Component);
11
12
  function TableRow() {
@@ -23,19 +24,26 @@ export var TableRow = /*#__PURE__*/function (_Component) {
23
24
  var lastProps = lastVNode.props;
24
25
  var nextProps = nextVNode.props;
25
26
  var isSame = true;
26
- var key;
27
- for (key in lastProps) {
28
- // ignore index
29
- if (key === 'index') continue;
30
- var lastValue = lastProps[key];
31
- var nextValue = nextProps[key];
32
- // deeply compare for offsetMap
33
- if (key === 'offsetMap' && isEqualObject(lastValue, nextValue)) {
34
- continue;
35
- }
36
- if (lastValue !== nextValue) {
37
- isSame = false;
38
- break;
27
+ if (hasOwn.call(this, 'vueInstance')) {
28
+ // In Vue, we may change value by modifing the same reference,
29
+ // and the new row may be expanded by click tree arrow
30
+ // so we can not compare in this case, #1030
31
+ isSame = false;
32
+ } else {
33
+ var key;
34
+ for (key in lastProps) {
35
+ // ignore index
36
+ if (key === 'index') continue;
37
+ var lastValue = lastProps[key];
38
+ var nextValue = nextProps[key];
39
+ // deeply compare for offsetMap
40
+ if (key === 'offsetMap' && isEqualObject(lastValue, nextValue)) {
41
+ continue;
42
+ }
43
+ if (lastValue !== nextValue) {
44
+ isSame = false;
45
+ break;
46
+ }
39
47
  }
40
48
  }
41
49
  if (!isSame) {
@@ -70,8 +78,9 @@ export var TableRow = /*#__PURE__*/function (_Component) {
70
78
  e.stopPropagation();
71
79
  var _this$get3 = this.get(),
72
80
  onToggleSpreadRow = _this$get3.onToggleSpreadRow,
73
- key = _this$get3.key;
74
- onToggleSpreadRow(key);
81
+ key = _this$get3.key,
82
+ data = _this$get3.data;
83
+ onToggleSpreadRow(key, data);
75
84
  };
76
85
  _proto.onMouseEnter = function onMouseEnter(e) {
77
86
  // for tooltip
@@ -33,7 +33,8 @@ export default function ($props, $blocks, $__proto__) {
33
33
  offsetMap = _this$get.offsetMap,
34
34
  draggable = _this$get.draggable,
35
35
  draggingKey = _this$get.draggingKey,
36
- animation = _this$get.animation;
36
+ animation = _this$get.animation,
37
+ loaded = _this$get.loaded;
37
38
  var k = this.config.k;
38
39
  var classNameObj = (_classNameObj = {}, _classNameObj[k + "-disabled"] = disabled, _classNameObj[k + "-checked"] = checked, _classNameObj[k + "-selected"] = selected, _classNameObj[k + "-spreaded"] = spreaded, _classNameObj[k + "-dragging"] = draggingKey === key, _classNameObj[className] = className, _classNameObj);
39
40
  var getGridItem = function getGridItem(columnIndex) {
@@ -82,6 +83,7 @@ export default function ($props, $blocks, $__proto__) {
82
83
  'columnIndex': columnIndex,
83
84
  'rowIndex': rowIndex,
84
85
  'data': data,
86
+ 'loaded': loaded,
85
87
  'offset': offsetMap[columnKey],
86
88
  'checkType': checkType,
87
89
  'indent': indent,
@@ -90,9 +90,9 @@ setDefault(function () {
90
90
  makeGroupMenuStyles == null || makeGroupMenuStyles.clearCache();
91
91
  });
92
92
  export var makeStyles = cache(function makeStyles(k) {
93
- return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-spacing:0;table-layout:fixed;}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";position:sticky;top:0;z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&.", k, "-fixed-right:before{left:-2px;}&:first-of-type:before{display:none;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-hidden{display:none;}.", k, "-table-arrow{width:", table.arrow.width, "!important;margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
93
+ return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";position:relative;z-index:0;.", k, "-table-wrapper{border-bottom:", table.border, ";overflow:auto;border-radius:", table.borderRadius, ";}table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;}thead{text-align:", table.thead.textAlign, ";font-size:", table.thead.fontSize, ";font-weight:", table.thead.fontWeight, ";z-index:2;tr{height:", table.thead.height, ";&:not(:last-of-type) th{border-bottom:", table.border, ";}}}tfoot{z-index:2;tr{td{border-top:", table.border, ";}}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";line-height:normal;&:before{content:'';height:", table.thead.delimiterHeight, ";position:absolute;background-color:", table.thead.delimiterColor, ";width:1px;left:1px;top:50%;transform:translateY(-50%);}&.", k, "-fixed-right:before{left:-2px;}&:first-of-type:before{display:none;}}.", k, "-table-title{display:inline-flex;align-items:center;max-width:100%;color:", table.thead.color, ";}.", k, "-table-title-text{flex:1;display:inline-flex;line-height:1.4;}tbody{tr{&:hover td{background:", table.tbody.hoverBgcolor, ";}&:last-of-type td{border-bottom-color:transparent;}}}td{padding:", table.tbody.padding, ";border-bottom:", table.border, ";background:", table.bgColor, ";word-wrap:break-word;}.", k, "-fixed-left,.", k, "-fixed-right{position:sticky;z-index:1;&:after{content:'';display:block;transition:box-shadow ", table.transition, ";position:absolute;top:0;bottom:0px;width:10px;pointer-events:none;}}.", k, "-fixed-left:after{right:-11px;}.", k, "-fixed-right:after{left:-11px;}&.", k, "-scroll-left .", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}&.", k, "-scroll-right .", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}&.", k, "-scroll-middle{.", k, "-fixed-left:after{box-shadow:", table.fixLeftShadow, ";}.", k, "-fixed-right:after{box-shadow:", table.fixRightShadow, ";}}.", k, "-fixed-right+.", k, "-fixed-right:after{display:none;}.", k, "-table-affix-header{position:sticky;top:0;left:0;.", k, "-affix-wrapper{overflow:hidden;}&.", k, "-fixed{position:relative;}}&.", k, "-border,&.", k, "-grid{.", k, "-table-wrapper{border-top:", table.border, ";border-left:", table.border, ";border-right:", table.border, ";}}&.", k, "-grid{td:not(:last-of-type),th:not(:last-of-type){border-right:", table.border, ";}th:before{display:none;}}&.", k, "-stripe{tr:nth-child(even):not(:hover) td{background:", table.stripeBgColor, ";}}.", k, "-table-group{margin-left:", table.group.gap, ";}.", k, "-table-check{.", k, "-checkbox,.", k, "-radio{position:relative;top:-1px;}}.", k, "-column-sortable{cursor:pointer;}.", k, "-column-sort{.", k, "-icon{display:block;height:", _sortInstanceProperty(table).iconHeight, ";line-height:", _sortInstanceProperty(table).iconHeight, ";margin:0 0 1px ", _sortInstanceProperty(table).gap, ";}&.", k, "-desc .", k, "-icon.", k, "-desc,&.", k, "-asc .", k, "-icon.", k, "-asc{color:", _sortInstanceProperty(table).enabledColor, ";}}.", k, "-table-spin.", k, "-overlay{z-index:2;}.", k, "-table-empty{text-align:center;}tr.", k, "-expand{td{padding:0;background:#fdfcff;}}&.", k, "-with-expand{tr:not(.", k, "-expand){td{border-bottom:none;}}}.", k, "-table-expand{border-top:", table.border, ";box-sizing:content-box;}tbody tr.", k, "-selected td{background:", table.selectedBgColor, ";}.", k, "-hidden{display:none;}.", k, "-table-arrow{width:", table.arrow.width, "!important;margin-right:", table.arrow.gap, ";transition:transform ", table.transition, ";position:relative;top:-1px;}tr.", k, "-spreaded{.", k, "-table-arrow{transform:rotate(90deg);}}.", k, "-table-resize{height:100%;width:", table.resizeWidth, ";position:absolute;top:0;left:-1px;cursor:ew-resize;}tr.", k, "-dragging{opacity:", table.draggingOpacity, ";}.", k, "-table-scrollbar{overflow-x:auto;overflow-y:hidden;}.", k, "-table-scrollbar-inner{height:1px;}", _mapInstanceProperty(aligns).call(aligns, function (type) {
94
94
  return /*#__PURE__*/css(".", k, "-align-", type, "{text-align:", type, ";}");
95
- }), ">.", k, "-pagination{margin:16px 0;}&.", k, "-fix-header{min-height:0;.", k, "-table-wrapper{height:100%;}}");
95
+ }), ">.", k, "-pagination{margin:16px 0;}&.", k, "-fix-header{min-height:0;.", k, "-table-wrapper{height:100%;}thead{position:sticky;top:0;}}&.", k, "-fix-footer{min-height:0;.", k, "-table-wrapper{height:100%;}tfoot{position:sticky;bottom:0;}}");
96
96
  });
97
97
  export var makeGroupMenuStyles = cache(function makeGroupMenuStyles(k) {
98
98
  return /*#__PURE__*/css("min-width:", table.group.menuMinWidth, "!important;.", k, "-dropdown-item.", k, "-active{color:", table.group.activeColor, ";}.", k, "-table-group-header{padding:", table.group.headerPadding, ";border-bottom:", table.group.headerBorder, ";}.", k, "-table-group-body{max-height:", table.group.menuMaxHeight, ";overflow:auto;}.", k, "-table-group-footer{text-align:right;border-top:", table.group.headerBorder, ";padding:8px;.", k, "-btn{margin-left:8px;}}");
@@ -38,6 +38,8 @@ export interface TableProps<T = any, K extends TableRowKey = TableRowKey, C exte
38
38
  animation?: boolean | [boolean, boolean];
39
39
  hideHeader?: boolean;
40
40
  pagination?: boolean | PaginationProps;
41
+ fixFooter?: boolean;
42
+ load?: (value: T) => Promise<void> | void;
41
43
  }
42
44
  export interface TableEvents<T = any, K extends TableRowKey = number> {
43
45
  clickRow: [T, number, K];
@@ -60,6 +62,7 @@ export interface TableBlocks<T = unknown> {
60
62
  empty: null;
61
63
  tooltip: [T, number];
62
64
  expand: [T, number];
65
+ footer: null;
63
66
  }
64
67
  type CheckType = 'checkbox' | 'radio' | 'none';
65
68
  export type TableCheckType = CheckType;
@@ -61,7 +61,9 @@ var typeDefs = {
61
61
  draggable: Boolean,
62
62
  animation: [Boolean, Array],
63
63
  hideHeader: Boolean,
64
- pagination: [Boolean, Object]
64
+ pagination: [Boolean, Object],
65
+ fixFooter: Boolean,
66
+ load: Function
65
67
  };
66
68
  var defaults = function defaults() {
67
69
  return {
@@ -54,7 +54,8 @@ export default function ($props, $blocks, $__proto__) {
54
54
  draggable = _this$get.draggable,
55
55
  _animation = _this$get.animation,
56
56
  hideHeader = _this$get.hideHeader,
57
- pagination = _this$get.pagination;
57
+ pagination = _this$get.pagination,
58
+ fixFooter = _this$get.fixFooter;
58
59
  var animation = !Array.isArray(_animation) ? [_animation, _animation] : _animation;
59
60
  var _this$columns$getData = this.columns.getData(),
60
61
  columns = _this$columns$getData.columns,
@@ -73,7 +74,7 @@ export default function ($props, $blocks, $__proto__) {
73
74
  elementRef = _this$stickyHeader.elementRef,
74
75
  headRef = _this$stickyHeader.headRef;
75
76
  var k = this.config.k;
76
- var classNameObj = (_classNameObj = {}, _classNameObj[k + "-table"] = true, _classNameObj[k + "-fix-header"] = fixHeader, _classNameObj[k + "-scroll-" + scrollPosition.value] = scrollPosition.value, _classNameObj[k + "-fix-columns"] = hasFixed.value, _classNameObj[k + "-" + type] = type && type !== 'default', _classNameObj[k + "-stripe"] = stripe, _classNameObj[k + "-with-expand"] = $blocks.expand, _classNameObj[className] = className, _classNameObj[makeStyles(k)] = true, _classNameObj);
77
+ var classNameObj = (_classNameObj = {}, _classNameObj[k + "-table"] = true, _classNameObj[k + "-fix-header"] = fixHeader, _classNameObj[k + "-fix-footer"] = fixFooter, _classNameObj[k + "-scroll-" + scrollPosition.value] = scrollPosition.value, _classNameObj[k + "-fix-columns"] = hasFixed.value, _classNameObj[k + "-" + type] = type && type !== 'default', _classNameObj[k + "-stripe"] = stripe, _classNameObj[k + "-with-expand"] = $blocks.expand, _classNameObj[className] = className, _classNameObj[makeStyles(k)] = true, _classNameObj);
77
78
  var style = isStringOrNumber(fixHeader) ? {
78
79
  maxHeight: fixHeader + "px"
79
80
  } : null;
@@ -183,6 +184,7 @@ export default function ($props, $blocks, $__proto__) {
183
184
  'key': key,
184
185
  'cols': cols,
185
186
  'data': value,
187
+ 'loaded': value.loaded,
186
188
  'checkType': checkType,
187
189
  'hasFixedLeft': hasFixedLeft,
188
190
  'onClick': _this.clickRow,
@@ -265,6 +267,20 @@ export default function ($props, $blocks, $__proto__) {
265
267
  'children': rows
266
268
  }) : rows;
267
269
  }(), 0);
270
+ var tfooter = null;
271
+ if ($blocks.footer) {
272
+ tfooter = _$ce(2, 'tfoot', _$ce(2, 'tr', _$ce(2, 'td', (_$blocks['footer'] = function ($super) {
273
+ return null;
274
+ }, __$blocks['footer'] = function ($super, data) {
275
+ var block = $blocks['footer'];
276
+ var callBlock = function callBlock() {
277
+ return _$blocks['footer'].call($this, $super, data);
278
+ };
279
+ return block ? block.call($this, callBlock, data) : callBlock();
280
+ }, __$blocks['footer'](_$no)), 0, _$cn(k + "-table-footer"), {
281
+ 'colspan': colCount
282
+ }), 2, null, null, 'table-footer'), 2);
283
+ }
268
284
  var tableWidthPx = tableWidth.value ? tableWidth.value + "px" : null;
269
285
  var _this$stickyScrollbar = this.stickyScrollbar,
270
286
  shouldStickScrollbar = _this$stickyScrollbar.shouldStickScrollbar,
@@ -287,7 +303,7 @@ export default function ($props, $blocks, $__proto__) {
287
303
  width: tableWidthPx
288
304
  }
289
305
  }, null, headRef)
290
- }) : undefined, _$ce(2, 'table', [colgroup, isNull(stickHeader.value) ? thead : undefined, tbody], 0, null, {
306
+ }) : undefined, _$ce(2, 'table', [colgroup, isNull(stickHeader.value) ? thead : undefined, tbody, $blocks.footer ? tfooter : undefined], 0, null, {
291
307
  'style': {
292
308
  width: tableWidthPx
293
309
  }
@@ -2,7 +2,7 @@ import type { TableRowKey } from './table';
2
2
  import { State } from '../../hooks/useState';
3
3
  export declare function useTree(data: State<any[] | undefined>): {
4
4
  isSpreaded: (key: TableRowKey) => boolean;
5
- toggleSpreadRow: (key: TableRowKey) => void;
5
+ toggleSpreadRow: (key: TableRowKey, rowData?: any) => Promise<void>;
6
6
  loopData: <T>(cb: (value: any, index: number, level: number, meta: T | null) => T, shouldBreak?: boolean) => void;
7
7
  };
8
8
  export declare function loopDataWithChildrenKey<T>(data: any[] | undefined, childrenKey: string | undefined, cb: (value: any, index: number, level: number, meta: T | null) => T, shouldBreak: boolean): void;
@@ -1,3 +1,5 @@
1
+ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
1
3
  import { useInstance } from 'intact-vue-next';
2
4
  import { inArray } from './useChecked';
3
5
  import { toggleArray } from '../utils';
@@ -6,8 +8,34 @@ export function useTree(data) {
6
8
  function isSpreaded(key) {
7
9
  return inArray(instance.get('spreadKeys'), key);
8
10
  }
9
- function toggleSpreadRow(key) {
10
- instance.set('spreadKeys', toggleArray(instance.get('spreadKeys'), key));
11
+ function toggleSpreadRow(_x, _x2) {
12
+ return _toggleSpreadRow.apply(this, arguments);
13
+ }
14
+ function _toggleSpreadRow() {
15
+ _toggleSpreadRow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(key, rowData) {
16
+ var _instance$get2, spreadKeys, load;
17
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
18
+ while (1) switch (_context.prev = _context.next) {
19
+ case 0:
20
+ _instance$get2 = instance.get(), spreadKeys = _instance$get2.spreadKeys, load = _instance$get2.load;
21
+ instance.set('spreadKeys', toggleArray(spreadKeys, key));
22
+ if (!(load && data.value && !rowData.loaded)) {
23
+ _context.next = 8;
24
+ break;
25
+ }
26
+ rowData.loaded = false;
27
+ _context.next = 6;
28
+ return load(rowData);
29
+ case 6:
30
+ rowData.loaded = true;
31
+ instance.forceUpdate();
32
+ case 8:
33
+ case "end":
34
+ return _context.stop();
35
+ }
36
+ }, _callee);
37
+ }));
38
+ return _toggleSpreadRow.apply(this, arguments);
11
39
  }
12
40
  function loopData(cb, shouldBreak) {
13
41
  if (shouldBreak === void 0) {