@king-design/intact 3.1.1 → 3.1.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 (252) hide show
  1. package/components/affix/styles.ts +4 -2
  2. package/components/badge/index.vdt +1 -1
  3. package/components/badge/styles.ts +4 -3
  4. package/components/breadcrumb/index.vdt +1 -1
  5. package/components/breadcrumb/styles.ts +4 -2
  6. package/components/button/styles.ts +7 -5
  7. package/components/card/styles.ts +4 -2
  8. package/components/carousel/styles.ts +7 -4
  9. package/components/cascader/index.vdt +2 -1
  10. package/components/cascader/styles.ts +7 -4
  11. package/components/checkbox/index.vdt +1 -1
  12. package/components/checkbox/styles.ts +4 -2
  13. package/components/code/styles.ts +3 -2
  14. package/components/collapse/index.spec.ts +1 -1
  15. package/components/collapse/item.vdt +1 -1
  16. package/components/collapse/styles.ts +16 -12
  17. package/components/colorpicker/styles.ts +7 -4
  18. package/components/copy/styles.ts +3 -2
  19. package/components/datepicker/styles.ts +10 -6
  20. package/components/diagram/styles.ts +3 -2
  21. package/components/dialog/index.spec.ts +30 -0
  22. package/components/dialog/styles.ts +10 -6
  23. package/components/dialog/usePosition.ts +4 -0
  24. package/components/drawer/styles.ts +4 -2
  25. package/components/dropdown/styles.ts +7 -4
  26. package/components/dropdown/usePosition.ts +19 -9
  27. package/components/editable/styles.ts +4 -2
  28. package/components/form/styles.ts +7 -4
  29. package/components/grid/styles.ts +12 -9
  30. package/components/icon/index.vdt +1 -1
  31. package/components/icon/styles.ts +4 -2
  32. package/components/input/styles.ts +8 -5
  33. package/components/layout/styles.ts +13 -9
  34. package/components/menu/demos/recursive.md +340 -0
  35. package/components/menu/styles.ts +21 -16
  36. package/components/message/styles.ts +7 -5
  37. package/components/pagination/styles.ts +4 -2
  38. package/components/popover/content.vdt +1 -1
  39. package/components/popover/styles.ts +4 -2
  40. package/components/portal.ts +16 -3
  41. package/components/progress/styles.ts +4 -4
  42. package/components/radio/styles.ts +4 -2
  43. package/components/rate/styles.ts +4 -2
  44. package/components/scrollSelect/styles.ts +4 -2
  45. package/components/select/base.ts +3 -2
  46. package/components/select/base.vdt +1 -1
  47. package/components/select/styles.ts +10 -6
  48. package/components/skeleton/styles.ts +7 -4
  49. package/components/slider/styles.ts +4 -2
  50. package/components/spin/styles.ts +4 -4
  51. package/components/spinner/styles.ts +4 -3
  52. package/components/split/styles.ts +4 -2
  53. package/components/steps/index.vdt +2 -2
  54. package/components/steps/styles.ts +7 -5
  55. package/components/switch/styles.ts +4 -2
  56. package/components/table/column.ts +2 -0
  57. package/components/table/column.vdt +7 -3
  58. package/components/table/demos/basic.md +2 -2
  59. package/components/table/demos/fixColumn.md +3 -1
  60. package/components/table/demos/groupHeader.md +11 -11
  61. package/components/table/demos/scheme.md +1 -1
  62. package/components/table/index.spec.ts +8 -3
  63. package/components/table/styles.ts +11 -8
  64. package/components/table/table.vdt +3 -4
  65. package/components/table/useColumns.ts +1 -0
  66. package/components/table/useFixedColumns.ts +27 -49
  67. package/components/table/useGroup.ts +5 -0
  68. package/components/table/useResizable.ts +38 -10
  69. package/components/table/useWidth.ts +3 -0
  70. package/components/tabs/styles.ts +4 -2
  71. package/components/tag/styles.ts +7 -4
  72. package/components/timeline/styles.ts +7 -5
  73. package/components/timepicker/styles.ts +4 -2
  74. package/components/tip/styles.ts +4 -2
  75. package/components/tooltip/content.vdt +1 -1
  76. package/components/tooltip/styles.ts +4 -2
  77. package/components/transfer/styles.ts +4 -2
  78. package/components/tree/demos/checkbox.md +1 -0
  79. package/components/tree/demos/contextmenu.md +10 -1
  80. package/components/tree/index.spec.ts +7 -0
  81. package/components/tree/styles.ts +4 -2
  82. package/components/tree/useChecked.ts +3 -0
  83. package/components/treeSelect/styles.ts +4 -2
  84. package/components/upload/styles.ts +7 -4
  85. package/components/upload/useFiles.ts +3 -2
  86. package/components/utils.ts +10 -4
  87. package/components/wave/styles.ts +4 -2
  88. package/es/components/affix/styles.d.ts +4 -1
  89. package/es/components/affix/styles.js +4 -2
  90. package/es/components/badge/index.vdt.js +1 -1
  91. package/es/components/badge/styles.d.ts +4 -1
  92. package/es/components/badge/styles.js +4 -2
  93. package/es/components/breadcrumb/index.vdt.js +1 -1
  94. package/es/components/breadcrumb/styles.d.ts +4 -1
  95. package/es/components/breadcrumb/styles.js +4 -2
  96. package/es/components/button/styles.d.ts +8 -2
  97. package/es/components/button/styles.js +7 -4
  98. package/es/components/card/styles.d.ts +4 -1
  99. package/es/components/card/styles.js +4 -2
  100. package/es/components/carousel/styles.d.ts +8 -2
  101. package/es/components/carousel/styles.js +7 -4
  102. package/es/components/cascader/index.vdt.js +3 -1
  103. package/es/components/cascader/styles.d.ts +8 -2
  104. package/es/components/cascader/styles.js +7 -4
  105. package/es/components/checkbox/index.vdt.js +1 -1
  106. package/es/components/checkbox/styles.d.ts +4 -1
  107. package/es/components/checkbox/styles.js +4 -2
  108. package/es/components/code/styles.d.ts +4 -1
  109. package/es/components/code/styles.js +3 -2
  110. package/es/components/collapse/index.spec.js +1 -1
  111. package/es/components/collapse/item.vdt.js +3 -3
  112. package/es/components/collapse/styles.d.ts +8 -2
  113. package/es/components/collapse/styles.js +11 -8
  114. package/es/components/colorpicker/styles.d.ts +8 -2
  115. package/es/components/colorpicker/styles.js +7 -4
  116. package/es/components/copy/styles.d.ts +4 -1
  117. package/es/components/copy/styles.js +3 -2
  118. package/es/components/datepicker/styles.d.ts +12 -3
  119. package/es/components/datepicker/styles.js +10 -6
  120. package/es/components/diagram/styles.d.ts +4 -1
  121. package/es/components/diagram/styles.js +3 -2
  122. package/es/components/dialog/index.spec.js +61 -1
  123. package/es/components/dialog/styles.d.ts +12 -3
  124. package/es/components/dialog/styles.js +10 -6
  125. package/es/components/dialog/usePosition.js +7 -0
  126. package/es/components/drawer/styles.d.ts +4 -1
  127. package/es/components/drawer/styles.js +4 -2
  128. package/es/components/dropdown/styles.d.ts +8 -2
  129. package/es/components/dropdown/styles.js +7 -4
  130. package/es/components/dropdown/usePosition.js +14 -11
  131. package/es/components/editable/styles.d.ts +4 -1
  132. package/es/components/editable/styles.js +4 -2
  133. package/es/components/form/styles.d.ts +8 -2
  134. package/es/components/form/styles.js +7 -4
  135. package/es/components/grid/styles.d.ts +8 -2
  136. package/es/components/grid/styles.js +12 -13
  137. package/es/components/icon/index.vdt.js +1 -1
  138. package/es/components/icon/styles.d.ts +4 -1
  139. package/es/components/icon/styles.js +4 -2
  140. package/es/components/input/styles.d.ts +8 -2
  141. package/es/components/input/styles.js +7 -4
  142. package/es/components/layout/styles.d.ts +16 -4
  143. package/es/components/layout/styles.js +13 -8
  144. package/es/components/menu/styles.d.ts +16 -4
  145. package/es/components/menu/styles.js +14 -9
  146. package/es/components/message/styles.d.ts +8 -2
  147. package/es/components/message/styles.js +7 -4
  148. package/es/components/pagination/styles.d.ts +4 -1
  149. package/es/components/pagination/styles.js +4 -2
  150. package/es/components/popover/content.vdt.js +1 -1
  151. package/es/components/popover/styles.d.ts +4 -1
  152. package/es/components/popover/styles.js +4 -2
  153. package/es/components/portal.js +15 -3
  154. package/es/components/progress/styles.d.ts +4 -1
  155. package/es/components/progress/styles.js +4 -2
  156. package/es/components/radio/styles.d.ts +4 -1
  157. package/es/components/radio/styles.js +4 -2
  158. package/es/components/rate/styles.d.ts +4 -1
  159. package/es/components/rate/styles.js +4 -2
  160. package/es/components/scrollSelect/styles.d.ts +4 -1
  161. package/es/components/scrollSelect/styles.js +4 -2
  162. package/es/components/select/base.js +3 -1
  163. package/es/components/select/base.vdt.js +1 -1
  164. package/es/components/select/styles.d.ts +12 -3
  165. package/es/components/select/styles.js +10 -6
  166. package/es/components/skeleton/styles.d.ts +8 -2
  167. package/es/components/skeleton/styles.js +7 -4
  168. package/es/components/slider/styles.d.ts +4 -1
  169. package/es/components/slider/styles.js +4 -2
  170. package/es/components/spin/styles.d.ts +4 -1
  171. package/es/components/spin/styles.js +4 -2
  172. package/es/components/spinner/styles.d.ts +4 -1
  173. package/es/components/spinner/styles.js +4 -2
  174. package/es/components/split/styles.d.ts +4 -1
  175. package/es/components/split/styles.js +4 -2
  176. package/es/components/steps/index.vdt.js +2 -2
  177. package/es/components/steps/styles.d.ts +4 -3
  178. package/es/components/steps/styles.js +9 -4
  179. package/es/components/switch/styles.d.ts +4 -1
  180. package/es/components/switch/styles.js +4 -2
  181. package/es/components/table/column.d.ts +1 -0
  182. package/es/components/table/column.js +2 -1
  183. package/es/components/table/column.vdt.js +9 -3
  184. package/es/components/table/index.spec.js +18 -11
  185. package/es/components/table/styles.d.ts +8 -2
  186. package/es/components/table/styles.js +8 -5
  187. package/es/components/table/table.vdt.js +3 -4
  188. package/es/components/table/useColumns.js +1 -0
  189. package/es/components/table/useFixedColumns.d.ts +3 -3
  190. package/es/components/table/useFixedColumns.js +27 -46
  191. package/es/components/table/useGroup.d.ts +1 -0
  192. package/es/components/table/useGroup.js +11 -1
  193. package/es/components/table/useResizable.js +41 -5
  194. package/es/components/table/useWidth.js +3 -0
  195. package/es/components/tabs/styles.d.ts +4 -1
  196. package/es/components/tabs/styles.js +4 -2
  197. package/es/components/tag/styles.d.ts +8 -2
  198. package/es/components/tag/styles.js +7 -4
  199. package/es/components/timeline/styles.d.ts +8 -2
  200. package/es/components/timeline/styles.js +7 -5
  201. package/es/components/timepicker/styles.d.ts +4 -1
  202. package/es/components/timepicker/styles.js +4 -2
  203. package/es/components/tip/styles.d.ts +4 -1
  204. package/es/components/tip/styles.js +4 -2
  205. package/es/components/tooltip/content.vdt.js +1 -1
  206. package/es/components/tooltip/styles.d.ts +4 -1
  207. package/es/components/tooltip/styles.js +4 -2
  208. package/es/components/transfer/styles.d.ts +4 -1
  209. package/es/components/transfer/styles.js +4 -2
  210. package/es/components/tree/index.spec.js +13 -1
  211. package/es/components/tree/styles.d.ts +4 -1
  212. package/es/components/tree/styles.js +4 -2
  213. package/es/components/tree/useChecked.js +4 -0
  214. package/es/components/treeSelect/styles.d.ts +4 -1
  215. package/es/components/treeSelect/styles.js +4 -2
  216. package/es/components/upload/styles.d.ts +8 -2
  217. package/es/components/upload/styles.js +7 -4
  218. package/es/components/upload/useFiles.js +3 -2
  219. package/es/components/utils.d.ts +10 -2
  220. package/es/components/utils.js +9 -2
  221. package/es/components/wave/styles.d.ts +4 -1
  222. package/es/components/wave/styles.js +4 -2
  223. package/es/i18n/en-US.d.ts +1 -0
  224. package/es/i18n/en-US.js +1 -0
  225. package/es/index.d.ts +2 -2
  226. package/es/index.js +2 -2
  227. package/es/packages/kpc-react/__tests__/components/cascader.spec.js +0 -1
  228. package/es/site/data/components/menu/demos/recursive/index.d.ts +29 -0
  229. package/es/site/data/components/menu/demos/recursive/index.js +57 -0
  230. package/es/site/data/components/menu/demos/recursive/react.d.ts +2 -0
  231. package/es/site/data/components/menu/demos/recursive/react.js +69 -0
  232. package/es/site/data/components/table/demos/basic/react.js +4 -2
  233. package/es/site/data/components/table/demos/fixColumn/react.js +2 -1
  234. package/es/site/data/components/table/demos/groupHeader/react.js +11 -20
  235. package/es/site/data/components/table/demos/scheme/react.js +2 -1
  236. package/es/site/data/components/tree/demos/checkbox/index.d.ts +12 -2
  237. package/es/site/data/components/tree/demos/checkbox/index.js +1 -0
  238. package/es/site/data/components/tree/demos/checkbox/react.d.ts +12 -2
  239. package/es/site/data/components/tree/demos/checkbox/react.js +1 -0
  240. package/es/site/data/components/tree/demos/contextmenu/index.d.ts +1 -0
  241. package/es/site/data/components/tree/demos/contextmenu/index.js +1 -0
  242. package/es/site/data/components/tree/demos/contextmenu/react.d.ts +1 -0
  243. package/es/site/data/components/tree/demos/contextmenu/react.js +1 -0
  244. package/es/site/src/components/article/index.js +6 -2
  245. package/es/styles/fonts/iconfont.d.ts +4 -1
  246. package/es/styles/fonts/iconfont.js +1 -1
  247. package/es/styles/global.js +7 -2
  248. package/i18n/en-US.ts +1 -0
  249. package/index.ts +2 -2
  250. package/package.json +3 -3
  251. package/styles/fonts/iconfont.ts +2 -2
  252. package/styles/global.ts +32 -0
@@ -70,7 +70,7 @@ export default function ($props, $blocks, $__proto__) {
70
70
  scrollPosition = _this$fixedColumns.scrollPosition,
71
71
  hasFixed = _this$fixedColumns.hasFixed,
72
72
  getHasFixedLeft = _this$fixedColumns.getHasFixedLeft,
73
- getOffsetMap = _this$fixedColumns.getOffsetMap;
73
+ offsetMap = _this$fixedColumns.offsetMap;
74
74
  var scrollRef = this.scroll.scrollRef;
75
75
  var _this$stickyHeader = this.stickyHeader,
76
76
  stickHeader = _this$stickyHeader.stickHeader,
@@ -107,7 +107,6 @@ export default function ($props, $blocks, $__proto__) {
107
107
  getAllStatus = _this$checked.getAllStatus,
108
108
  onChangeChecked = _this$checked.onChangeChecked;
109
109
  var allCheckedStatus = getAllCheckedStatus();
110
- var offsetMap = getOffsetMap();
111
110
  var thead = hideHeader ? null : _$cc(TableContext.Provider, {
112
111
  'value': checkType,
113
112
  'children': _$cc(GroupContext.Provider, {
@@ -126,7 +125,7 @@ export default function ($props, $blocks, $__proto__) {
126
125
  onStart: onStart
127
126
  },
128
127
  'children': _$cc(FixedColumnsContext.Provider, {
129
- 'value': offsetMap,
128
+ 'value': offsetMap.value,
130
129
  'children': _$ce(2, 'thead', _$ma(columns, function ($value, $key) {
131
130
  return _$ce(2, 'tr', function () {
132
131
  var ths = [$key === 0 && checkType !== 'none' ? _$cv('th', _extends({}, getClassAndStyleForFixed({
@@ -214,7 +213,7 @@ export default function ($props, $blocks, $__proto__) {
214
213
  'indent': indentSize,
215
214
  'onToggleSpreadRow': toggleSpreadRow,
216
215
  'onBeforeUnmount': _this.resetRowStatus.onRowBeforeUnmount,
217
- 'offsetMap': offsetMap,
216
+ 'offsetMap': offsetMap.value,
218
217
  'animation': animation[1],
219
218
  'draggable': draggable,
220
219
  'draggingKey': draggingKey.value,
@@ -41,6 +41,7 @@ export function useColumns() {
41
41
 
42
42
  ret = true;
43
43
  var clonedVNode = directClone(vNode);
44
+ if (currentVNode) currentVNode.props.nextVNode = clonedVNode;
44
45
 
45
46
  var props = _extends({}, clonedVNode.props, {
46
47
  cols: 0,
@@ -1,4 +1,4 @@
1
- import { VNodeComponentClass, Props, RefObject, Key } from 'intact';
1
+ import { VNodeComponentClass, Props, Key } from 'intact';
2
2
  import { TableColumn, TableColumnProps } from './column';
3
3
  import type { TableProps, TableRowKey } from './table';
4
4
  import { State } from '../../hooks/useState';
@@ -7,14 +7,14 @@ declare type ScrollPosition = 'left' | 'middle' | 'right';
7
7
  export declare const context: {
8
8
  Provider: import("intact").ComponentConstructor<import("intact").Component<import("../context").ProviderProps<any>, {}, {}, {}>>;
9
9
  Consumer: import("intact").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<any>, {}, {}, {}>>;
10
- useContext: () => RefObject<any>;
10
+ useContext: () => import("intact").RefObject<any>;
11
11
  };
12
12
  export declare function useFixedColumns(getColumns: () => VNodeComponentClass<TableColumn>[][], { scrollRef, callbacks }: ReturnType<typeof useScroll>, widthMap: State<Record<TableRowKey, number>>): {
13
13
  scrollPosition: State<ScrollPosition | null>;
14
14
  setScrollPosition: (scrollLeft: number) => void;
15
15
  hasFixed: State<boolean>;
16
+ offsetMap: State<Record<Key, number>>;
16
17
  getHasFixedLeft: () => boolean;
17
- getOffsetMap: () => Record<Key, number>;
18
18
  };
19
19
  export declare function getClassAndStyleForFixed({ className, fixed, align }: Props<TableColumnProps>, offset: number, k: string, checkType?: TableProps['checkType']): {
20
20
  className: string;
@@ -1,10 +1,10 @@
1
- import { useInstance, onMounted, onUnmounted } from 'intact';
1
+ import { useInstance, findDomFromVNode, nextTick } from 'intact';
2
2
  import { useState } from '../../hooks/useState';
3
3
  import { cx } from '@emotion/css';
4
- import { isNullOrUndefined, isString, error } from 'intact-shared';
5
- import { throttle } from '../utils';
6
4
  import { watchState } from '../../hooks/useState';
7
5
  import { createContext } from '../context';
6
+ import { useResizeObserver } from '../../hooks/useResizeObserver';
7
+ import { isEqualObject } from '../utils';
8
8
  export var context = createContext();
9
9
  export function useFixedColumns(getColumns, _ref, widthMap) {
10
10
  var scrollRef = _ref.scrollRef,
@@ -12,38 +12,32 @@ export function useFixedColumns(getColumns, _ref, widthMap) {
12
12
  var instance = useInstance();
13
13
  var scrollPosition = useState(null);
14
14
  var hasFixed = useState(false);
15
+ var offsetMap = useState({}, isEqualObject);
15
16
  var hasFixedLeft = false;
16
17
  var hasFixedRight = false;
17
- var offsetMap = {};
18
18
  callbacks.push(setScrollPosition);
19
- instance.on('$receive:children', handleFixedColumns);
19
+ instance.watch('children', handleFixedColumnsAndUpdate, {
20
+ presented: true
21
+ });
20
22
  watchState(widthMap, function () {
21
- handleFixedColumns();
22
- updateScrollPositionOnResize();
23
+ return nextTick(handleFixedColumnsAndUpdate);
23
24
  });
24
- var throttleUpdate = throttle(function () {
25
- if (instance.$unmounted) return;
26
- updateScrollPositionOnResize();
27
- }, 100);
28
- onMounted(function () {
25
+ useResizeObserver(scrollRef, handleFixedColumnsAndUpdate, true);
26
+
27
+ function handleFixedColumnsAndUpdate() {
28
+ handleFixedColumns();
29
29
  updateScrollPositionOnResize();
30
- window.addEventListener('resize', throttleUpdate);
31
- });
32
- onUnmounted(function () {
33
- window.removeEventListener('resize', throttleUpdate);
34
- });
30
+ }
35
31
 
36
32
  function handleFixedColumns() {
37
33
  var columns = getColumns();
34
+ var _offsetMap = {};
38
35
  hasFixedLeft = false;
39
36
  hasFixedRight = false;
40
- offsetMap = {};
41
37
  columns.forEach(function (columns, row) {
42
- var offset = 0;
43
38
  columns.forEach(function (vNode, col) {
44
39
  var props = vNode.props;
45
40
  var key = props.key;
46
- offsetMap[key] = 0;
47
41
  var fixed = props.fixed;
48
42
 
49
43
  if (fixed === 'left') {
@@ -54,41 +48,34 @@ export function useFixedColumns(getColumns, _ref, widthMap) {
54
48
  var _props = prevVNode.props;
55
49
 
56
50
  if (_props.fixed === 'left') {
57
- if (process.env.NODE_ENV !== 'production') {
58
- validateWidth(_props);
59
- }
60
-
61
- value += widthMap.value[_props.key] || parseInt(_props.width, 10) || 0;
51
+ value += getWidth(prevVNode);
62
52
  }
63
53
 
64
54
  prevVNode = _props.prevVNode;
65
55
  }
66
56
 
67
- offsetMap[key] = value;
57
+ _offsetMap[key] = value;
68
58
  hasFixedLeft = true;
69
59
  } else if (fixed === 'right') {
70
60
  var _value = 0;
71
- var lastVNode = columns[columns.length - 1];
61
+ var nextVNode = props.nextVNode;
72
62
 
73
- while (vNode !== lastVNode) {
74
- var _props2 = lastVNode.props;
63
+ while (nextVNode) {
64
+ var _props2 = nextVNode.props;
75
65
 
76
66
  if (_props2.fixed === 'right') {
77
- if (process.env.NODE_ENV !== 'production') {
78
- validateWidth(_props2);
79
- }
80
-
81
- _value += widthMap.value[_props2.key] || parseInt(_props2.width, 10) || 0;
67
+ _value += getWidth(nextVNode);
82
68
  }
83
69
 
84
- lastVNode = _props2.prevVNode;
70
+ nextVNode = _props2.nextVNode;
85
71
  }
86
72
 
87
- offsetMap[key] = _value;
73
+ _offsetMap[key] = _value;
88
74
  hasFixedRight = true;
89
75
  }
90
76
  });
91
77
  });
78
+ offsetMap.set(_offsetMap);
92
79
  hasFixed.set(hasFixedLeft || hasFixedRight);
93
80
  }
94
81
 
@@ -113,11 +100,9 @@ export function useFixedColumns(getColumns, _ref, widthMap) {
113
100
  scrollPosition: scrollPosition,
114
101
  setScrollPosition: setScrollPosition,
115
102
  hasFixed: hasFixed,
103
+ offsetMap: offsetMap,
116
104
  getHasFixedLeft: function getHasFixedLeft() {
117
105
  return hasFixedLeft;
118
- },
119
- getOffsetMap: function getOffsetMap() {
120
- return offsetMap;
121
106
  }
122
107
  };
123
108
  }
@@ -134,11 +119,7 @@ export function getClassAndStyleForFixed(_ref2, offset, k, checkType) {
134
119
  };
135
120
  }
136
121
 
137
- function validateWidth(_ref4) {
138
- var width = _ref4.width,
139
- key = _ref4.key;
140
-
141
- if (isNullOrUndefined(width) || isString(width) && !/\d+(px)?/.test(width)) {
142
- error("The width must be specified with 'px' when the column has fixed. <TableColumn key=\"" + key + "\" />");
143
- }
122
+ function getWidth(vNode) {
123
+ var dom = findDomFromVNode(vNode, true);
124
+ return dom.offsetWidth;
144
125
  }
@@ -20,5 +20,6 @@ export declare function useGroup(): {
20
20
  dropdownRef: import("intact").RefObject<Dropdown>;
21
21
  localGroupValue: import("../../hooks/useState").State<any>;
22
22
  isEmptyValue: (groupValue: any) => boolean | undefined;
23
+ checkAll: () => void;
23
24
  };
24
25
  export {};
@@ -1,4 +1,5 @@
1
1
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
2
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
2
3
  import _trimInstanceProperty from "@babel/runtime-corejs3/core-js/instance/trim";
3
4
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
4
5
  import { useInstance, createRef } from 'intact';
@@ -62,6 +63,14 @@ export function useGroup() {
62
63
  confirm(onChange);
63
64
  }
64
65
 
66
+ function checkAll() {
67
+ var _filteredGroup$value;
68
+
69
+ localGroupValue.set((_filteredGroup$value = filteredGroup.value) == null ? void 0 : _mapInstanceProperty(_filteredGroup$value).call(_filteredGroup$value, function (item) {
70
+ return item.value;
71
+ }));
72
+ }
73
+
65
74
  function isEmptyValue(groupValue) {
66
75
  var _instance$get4 = instance.get(),
67
76
  multiple = _instance$get4.multiple;
@@ -98,6 +107,7 @@ export function useGroup() {
98
107
  confirm: confirm,
99
108
  dropdownRef: dropdownRef,
100
109
  localGroupValue: localGroupValue,
101
- isEmptyValue: isEmptyValue
110
+ isEmptyValue: isEmptyValue,
111
+ checkAll: checkAll
102
112
  };
103
113
  }
@@ -9,15 +9,17 @@ export function useResizable(scrollRef, tableRef, tableWidth, widthMap, storeWid
9
9
  var x;
10
10
  var prevVNode;
11
11
  var prevTh;
12
+ var prevMinWidth;
12
13
  var currentVNode;
13
14
  var currentTh;
14
- var minWidth;
15
+ var currentMinWidth;
16
+ var nextVNode;
15
17
 
16
18
  function onStart(e) {
17
19
  containerWidth = scrollRef.value.clientWidth;
18
20
  x = e.clientX; // find the previous column but exclude the hidden columns, #467
19
21
 
20
- prevVNode = currentVNode = e._vNode;
22
+ prevVNode = nextVNode = currentVNode = e._vNode;
21
23
  prevTh;
22
24
 
23
25
  do {
@@ -26,7 +28,20 @@ export function useResizable(scrollRef, tableRef, tableWidth, widthMap, storeWid
26
28
  } while (window.getComputedStyle(prevTh).display === 'none');
27
29
 
28
30
  currentTh = findDomFromVNode(currentVNode, true);
29
- minWidth = prevVNode.props.minWidth || instance.get('minColWidth');
31
+ prevMinWidth = prevVNode.props.minWidth || instance.get('minColWidth');
32
+ currentMinWidth = currentVNode.props.minWidth || instance.get('minColWidth');
33
+
34
+ while (nextVNode = (_nextVNode = nextVNode) == null ? void 0 : _nextVNode.props.nextVNode) {
35
+ var _nextVNode;
36
+
37
+ var th = findDomFromVNode(nextVNode, true);
38
+
39
+ if (window.getComputedStyle(th).display === 'none') {
40
+ continue;
41
+ }
42
+
43
+ break;
44
+ }
30
45
  }
31
46
 
32
47
  function onMove(e) {
@@ -35,14 +50,35 @@ export function useResizable(scrollRef, tableRef, tableWidth, widthMap, storeWid
35
50
  var delX = e.clientX - x;
36
51
  if (delX === 0) return;
37
52
  var newPrevWidth = prevTh.offsetWidth + delX;
38
- if (newPrevWidth < minWidth && delX < 0) return;
39
53
  var newCurrentWidth = currentTh.offsetWidth - delX;
40
54
  var newTableWidth = tableRef.value.offsetWidth + delX;
55
+ var isCurrentFixedRight = currentVNode.props.fixed === 'right'; // const isPrevFixedRight = prevVNode.props!.fixed === 'right';
56
+
57
+ if ((newPrevWidth < prevMinWidth || isCurrentFixedRight) && delX < 0) {
58
+ // if (nextVNode) return;
59
+ // the last column, we should expand its width
60
+ if (newPrevWidth < prevMinWidth) {
61
+ newPrevWidth -= delX;
62
+ newTableWidth -= delX;
63
+ }
64
+ }
65
+
41
66
  var currentKey = currentVNode.props.key;
42
67
  var prevKey = prevVNode.props.key;
43
- x = e.clientX;
44
68
  var map = (_map = {}, _map[prevKey] = newPrevWidth, _map);
45
69
 
70
+ if (!nextVNode || isCurrentFixedRight) {
71
+ newTableWidth -= delX;
72
+
73
+ if (newCurrentWidth < currentMinWidth && delX > 0) {
74
+ newCurrentWidth = currentMinWidth;
75
+ }
76
+
77
+ map[currentKey] = newCurrentWidth;
78
+ }
79
+
80
+ x = e.clientX;
81
+
46
82
  if (containerWidth > newTableWidth) {
47
83
  map[currentKey] = newCurrentWidth;
48
84
  } else {
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime-corejs3/helpers/extends";
1
2
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
2
3
  import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
3
4
  import { useInstance, onMounted, createRef } from 'intact';
@@ -100,6 +101,8 @@ export function useWidth(scrollRef, getColumns) {
100
101
  });
101
102
 
102
103
  if (shouldUpdate) {
104
+ // let useFixedColumns to update scroll position
105
+ widthMap.set(_extends({}, widthMap.value));
103
106
  instance.forceUpdate(function () {
104
107
  // check again because it may affect other columns
105
108
  if (!isStop) {
@@ -1,2 +1,5 @@
1
1
  import '../../styles/global';
2
- export declare function makeStyles(k: string): string;
2
+ export declare const makeStyles: {
3
+ (k: string): string;
4
+ clearCache(): {};
5
+ };
@@ -3,6 +3,7 @@ import { css } from '@emotion/css';
3
3
  import { theme, setDefault } from '../../styles/theme';
4
4
  import { deepDefaults, sizes } from '../../styles/utils';
5
5
  import '../../styles/global';
6
+ import { cache } from '../utils';
6
7
  var closeFontSizeMap = {
7
8
  large: '24px',
8
9
  default: '20px',
@@ -107,10 +108,11 @@ setDefault(function () {
107
108
  tabs = deepDefaults(theme, {
108
109
  tabs: defaults
109
110
  }).tabs;
111
+ makeStyles == null ? void 0 : makeStyles.clearCache();
110
112
  });
111
- export function makeStyles(k) {
113
+ export var makeStyles = cache(function makeStyles(k) {
112
114
  return /*#__PURE__*/css(makeCommonStyles(k), ";", makeScrollStyles(k), ";&.", k, "-type-default{", makeDefaultStyles(k), ";}&.", k, "-type-card{", makeCardStyles(k), ";}&.", k, "-type-flat-card{", makeFlatCardStyles(k), ";}");
113
- }
115
+ });
114
116
 
115
117
  function makeCommonStyles(k) {
116
118
  var active = tabs.active;
@@ -65,5 +65,11 @@ declare const defaults: {
65
65
  };
66
66
  declare let tag: typeof defaults;
67
67
  export { tag };
68
- export declare function makeStyles(k: string): string;
69
- export declare function makeTagsStyles(k: string): string;
68
+ export declare const makeStyles: {
69
+ (k: string): string;
70
+ clearCache(): {};
71
+ };
72
+ export declare const makeTagsStyles: {
73
+ (k: string): string;
74
+ clearCache(): {};
75
+ };
@@ -3,6 +3,7 @@ import { css } from '@emotion/css';
3
3
  import { deepDefaults, sizes, palette } from '../../styles/utils';
4
4
  import { theme, setDefault } from '../../styles/theme';
5
5
  import '../../styles/global';
6
+ import { cache } from '../utils';
6
7
  var types = ['primary', 'warning', 'danger', 'success', 'disabled'];
7
8
  var defaults = deepDefaults({
8
9
  get border() {
@@ -112,9 +113,11 @@ setDefault(function () {
112
113
  tag = deepDefaults(theme, {
113
114
  tag: defaults
114
115
  }).tag;
116
+ makeStyles == null ? void 0 : makeStyles.clearCache();
117
+ makeTagsStyles == null ? void 0 : makeTagsStyles.clearCache();
115
118
  });
116
119
  export { tag };
117
- export function makeStyles(k) {
120
+ export var makeStyles = cache(function makeStyles(k) {
118
121
  return /*#__PURE__*/css("display:inline-flex;align-items:center;padding:", tag.padding, ";border:", tag.border, ";border-radius:", tag.borderRadius, ";font-size:", tag.fontSize, ";height:", tag.height, ";.", k, "-tag-close{font-size:", tag.close.fontSize, ";margin-left:", tag.close.gap, ";width:", tag.close.width, ";}&.", k, "-none{border:none;background:", tag.none.bgColor, ";}", _mapInstanceProperty(types).call(types, function (t) {
119
122
  var styles = tag[t];
120
123
  return /*#__PURE__*/css("&.", k, "-", t, "{color:", styles.color, ";border-color:", styles.color, ";background:", styles.bgColor, ";}");
@@ -123,7 +126,7 @@ export function makeStyles(k) {
123
126
  var styles = tag[s];
124
127
  return /*#__PURE__*/css("&.", k, "-", s, "{padding:", styles.padding, ";height:", styles.height, ";font-size:", styles.fontSize, ";.", k, "-tag-close{font-size:", styles.close.fontSize, ";margin-left:", styles.close.gap, ";}}");
125
128
  }), "&.", k, "-dashed{border-style:dashed;}&.", k, "-dragging{opacity:0;}");
126
- }
127
- export function makeTagsStyles(k) {
129
+ });
130
+ export var makeTagsStyles = cache(function makeTagsStyles(k) {
128
131
  return /*#__PURE__*/css("display:flex;flex-wrap:wrap;gap:", defaults.tags.gap, ";position:relative;overflow:hidden;&.", k, "-nowrap{flex-wrap:nowrap;.", k, "-tag{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:0;}}.", k, "-tags-more{cursor:default;font-family:monospace;}.", k, "-tag.", k, "-draggable{cursor:move;}");
129
- }
132
+ });
@@ -2,6 +2,12 @@ import '../../styles/global';
2
2
  declare type ValueOf<T extends readonly any[]> = T[number];
3
3
  export declare type Types = ValueOf<typeof types>;
4
4
  export declare const types: readonly ["primary", "warning", "danger", "success"];
5
- export declare function makeStyles(k: string): string;
6
- export declare function makeItemStyles(k: string): string;
5
+ export declare const makeStyles: {
6
+ (k: string): string;
7
+ clearCache(): {};
8
+ };
9
+ export declare const makeItemStyles: {
10
+ (k: string): string;
11
+ clearCache(): {};
12
+ };
7
13
  export {};
@@ -3,6 +3,7 @@ import { css } from '@emotion/css';
3
3
  import { theme, setDefault } from '../../styles/theme';
4
4
  import { deepDefaults, sizes } from '../../styles/utils';
5
5
  import '../../styles/global';
6
+ import { cache } from '../utils';
6
7
  var widthMap = {
7
8
  large: '13px',
8
9
  default: '9px',
@@ -47,11 +48,13 @@ setDefault(function () {
47
48
  timeline = deepDefaults(theme, {
48
49
  timeline: defaults
49
50
  }).timeline;
51
+ makeStyles == null ? void 0 : makeStyles.clearCache();
52
+ makeItemStyles == null ? void 0 : makeItemStyles.clearCache();
50
53
  });
51
- export function makeStyles(k) {
54
+ export var makeStyles = cache(function makeStyles(k) {
52
55
  return /*#__PURE__*/css("font-size:", timeline.fontSize, ";padding-top:calc(", theme.lineHeight, "em / 2);");
53
- }
54
- export function makeItemStyles(k) {
56
+ });
57
+ export var makeItemStyles = cache(function makeItemStyles(k) {
55
58
  return /*#__PURE__*/css("position:relative;padding:", timeline.padding, ";.", k, "-timeline-indicator{width:", timeline.indicator.width, ";position:absolute;left:0;top:0;height:100%;text-align:center;}.", k, "-timeline-dot{position:relative;z-index:1;transform:translateY(-50%);}.", k, "-timeline-circle{position:relative;background:", theme.color.primary, ";border-radius:50%;left:50%;}.", k, "-timeline-line{position:absolute;height:100%;border-left:", timeline.lineBorder, ";top:0;left:50%;}.", k, "-timeline-content{position:relative;top:calc(-0.5 * ", theme.lineHeight, "em);}&:last-of-type{.", k, "-timeline-line{display:none;}}", _mapInstanceProperty(types).call(types, function (type) {
56
59
  var typeStyles = timeline[type];
57
60
  return /*#__PURE__*/css("&.", k, "-", type, "{.", k, "-timeline-indicator{color:", typeStyles.color, ";}.", k, "-timeline-circle{background:", typeStyles.color, ";}}");
@@ -61,5 +64,4 @@ export function makeItemStyles(k) {
61
64
  if (size === 'default') return sizeClassName;
62
65
  return /*#__PURE__*/css("&.", k, "-", size, "{", sizeClassName, ";}");
63
66
  }), ";");
64
- }
65
- ;
67
+ });
@@ -1,2 +1,5 @@
1
1
  import '../../styles/global';
2
- export declare function makePanelStyles(k: string): string;
2
+ export declare const makePanelStyles: {
3
+ (k: string): string;
4
+ clearCache(): {};
5
+ };
@@ -3,6 +3,7 @@ import { theme, setDefault } from '../../styles/theme';
3
3
  import { deepDefaults } from '../../styles/utils';
4
4
  import '../../styles/global';
5
5
  import { datepicker, makePanelStyles as makePanelStylesBase } from '../datepicker/styles';
6
+ import { cache } from '../utils';
6
7
  var defaults = {
7
8
  get border() {
8
9
  return datepicker.border;
@@ -23,7 +24,8 @@ setDefault(function () {
23
24
  timepicker = deepDefaults(theme, {
24
25
  timepicker: defaults
25
26
  }).timepicker;
27
+ makePanelStyles == null ? void 0 : makePanelStyles.clearCache();
26
28
  });
27
- export function makePanelStyles(k) {
29
+ export var makePanelStyles = cache(function makePanelStyles(k) {
28
30
  return cx(makePanelStylesBase(k), /*#__PURE__*/css("&.", k, "-time-content{.", k, "-datepicker-time{padding:", timepicker.padding, ";}.", k, "-scroll-select{height:", timepicker.scrollHeight, ";}}&.", k, "-range{.", k, "-datepicker-time{width:auto;border:", timepicker.border, ";}.", k, "-scroll-select{height:", timepicker.range.scrollHeight, ";}.", k, "-datepicker-calendar-wrapper{padding:", timepicker.range.padding, ";width:", timepicker.range.width, ";border:none;}.", k, "-timepicker-title{text-align:center;margin-bottom:", timepicker.range.titleGap, ";}}"));
29
- }
31
+ });
@@ -1,2 +1,5 @@
1
1
  import '../../styles/global';
2
- export declare function makeStyles(k: string): string;
2
+ export declare const makeStyles: {
3
+ (k: string): string;
4
+ clearCache(): {};
5
+ };
@@ -2,6 +2,7 @@ import { theme, setDefault } from '../../styles/theme';
2
2
  import { css } from '@emotion/css';
3
3
  import '../../styles/global';
4
4
  import { deepDefaults } from '../../styles/utils';
5
+ import { cache } from '../utils';
5
6
  var defaults = {
6
7
  title: {
7
8
  fontSize: '14px',
@@ -23,7 +24,8 @@ setDefault(function () {
23
24
  tip = deepDefaults(theme, {
24
25
  tip: defaults
25
26
  }).tip;
27
+ makeStyles == null ? void 0 : makeStyles.clearCache();
26
28
  });
27
- export function makeStyles(k) {
29
+ export var makeStyles = cache(function makeStyles(k) {
28
30
  return /*#__PURE__*/css("&.", k, "-tip{display:flex;height:auto;padding:0;color:", tip.color, "!important;align-items:flex-start;}.", k, "-tip-wrapper{flex:1;padding:", tip.padding, ";}.", k, "-tip-title{font-size:", tip.title.fontSize, ";margin-bottom:", tip.title.gap, ";font-weight:", tip.title.fontWeight, ";}&.", k, "-fade-leave-active{position:relative;}.", k, "-tip-close:hover{background:none;}");
29
- }
31
+ });
@@ -1,6 +1,6 @@
1
1
  import { superCall as _$su, className as _$cn, extend as _$ex, EMPTY_OBJ as _$em, noop as _$no, createElementVNode as _$ce, createUnknownComponentVNode as _$cc } from 'intact';
2
2
  import { Button } from '../button';
3
- import makeStyles from './styles';
3
+ import { makeStyles } from './styles';
4
4
  export default function ($props, $blocks, $__proto__) {
5
5
  var _classNameObj;
6
6
 
@@ -23,5 +23,8 @@ declare const defaults: {
23
23
  export declare let tooltip: typeof defaults;
24
24
  export declare type Theme = 'dark' | 'light';
25
25
  export declare const themes: Theme[];
26
- export default function makeStyles(k: string): string;
26
+ export declare const makeStyles: {
27
+ (k: string): string;
28
+ clearCache(): {};
29
+ };
27
30
  export {};
@@ -4,6 +4,7 @@ import { css } from '@emotion/css';
4
4
  import { theme, setDefault } from '../../styles/theme';
5
5
  import { deepDefaults } from '../../styles/utils';
6
6
  import '../../styles/global';
7
+ import { cache } from '../utils';
7
8
  var defaults = {
8
9
  padding: '8px 12px',
9
10
 
@@ -48,6 +49,7 @@ setDefault(function () {
48
49
  tooltip = deepDefaults(theme, {
49
50
  tooltip: defaults
50
51
  }).tooltip;
52
+ makeStyles == null ? void 0 : makeStyles.clearCache();
51
53
  });
52
54
  export var themes = ['dark', 'light'];
53
55
  var directionMap = {
@@ -56,7 +58,7 @@ var directionMap = {
56
58
  left: 'right',
57
59
  right: 'left'
58
60
  };
59
- export default function makeStyles(k) {
61
+ export var makeStyles = cache(function makeStyles(k) {
60
62
  var arrowLong = tooltip.arrow.width;
61
63
  var arrowShort = "calc(" + arrowLong + " - 1px)"; // use &.${k}-tooltip-content to override css in dropdown menu
62
64
 
@@ -82,4 +84,4 @@ export default function makeStyles(k) {
82
84
  return /*#__PURE__*/css("&.", k, "-", direction, "{border-", borderDirection, "-color:", borderColor, ";&:before{border-", borderDirection, "-color:", bgColor, ";}}");
83
85
  }), ";}}");
84
86
  }), ".", k, "-tooltip-footer{padding-top:", tooltip.confirm.gaps, ";.", k, "-btn:not(:first-of-type){margin-left:", tooltip.confirm.gaps, ";}}&.", k, "-small{padding:", tooltip.smallPadding, ";}}");
85
- }
87
+ });
@@ -1,2 +1,5 @@
1
1
  import '../../styles/global';
2
- export declare function makeStyles(k: string): string;
2
+ export declare const makeStyles: {
3
+ (k: string): string;
4
+ clearCache(): {};
5
+ };
@@ -2,6 +2,7 @@ import { css } from '@emotion/css';
2
2
  import { theme, setDefault } from '../../styles/theme';
3
3
  import { deepDefaults } from '../../styles/utils';
4
4
  import '../../styles/global';
5
+ import { cache } from '../utils';
5
6
  var defaults = {
6
7
  fontSize: '12px',
7
8
  searchGap: '16px',
@@ -61,7 +62,8 @@ setDefault(function () {
61
62
  transfer = deepDefaults(theme, {
62
63
  transfer: defaults
63
64
  }).transfer;
65
+ makeStyles == null ? void 0 : makeStyles.clearCache();
64
66
  });
65
- export function makeStyles(k) {
67
+ export var makeStyles = cache(function makeStyles(k) {
66
68
  return /*#__PURE__*/css("font-size:", transfer.fontSize, ";.", k, "-transfer-panel,.", k, "-transfer-arrows{display:inline-block;vertical-align:middle;}.", k, "-transfer-panel{width:", transfer.panel.width, ";border:", transfer.panel.border, ";border-radius:", transfer.panel.borderRadius, ";height:", transfer.panel.height, ";display:inline-flex;flex-direction:column;overflow:auto;}.", k, "-transfer-title{line-height:", transfer.title.lineHeight, ";background:", transfer.title.bgColor, ";padding:", transfer.title.padding, ";.", k, "-checkbox{color:", transfer.title.color, ";font-size:", transfer.title.fontSize, ";}}.", k, "-transfer-count{float:right;margin-left:", transfer.title.countGap, ";}.", k, "-transfer-list{overflow:auto;position:relative;flex:1;}.", k, "-transfer-item{color:", transfer.item.color, ";background:", transfer.item.bgColor, ";user-select:none;width:100%;&:not(.", k, "-disabled):hover{background:", transfer.item.hoverBgColor, ";color:", transfer.item.hoverColor, ";p{color:", transfer.item.hoverColor, ";}}.", k, "-checkbox{padding:", transfer.item.padding, ";display:flex;}p{margin:0;color:", transfer.item.descColor, ";}&.", k, "-disabled{p{color:", theme.color.disabled, ";}}}.", k, "-input{width:auto;margin:", transfer.searchGap, ";}.", k, "-transfer-arrows{.", k, "-btn{display:flex;margin:", transfer.arrow.gap, ";}}");
67
- }
69
+ });
@@ -108,8 +108,20 @@ describe('Tree', function () {
108
108
 
109
109
  case 35:
110
110
  expect(element.outerHTML).to.matchSnapshot();
111
+ checkbox4.click();
112
+ _context2.next = 39;
113
+ return wait();
114
+
115
+ case 39:
116
+ instance.set('checkedKeys', ['floor-2']);
117
+ _context2.next = 42;
118
+ return wait();
119
+
120
+ case 42:
121
+ expect(checkbox2.classList.contains('k-checked')).to.be.true;
122
+ expect(checkbox2.classList.contains('k-indeterminate')).to.be.false;
111
123
 
112
- case 36:
124
+ case 44:
113
125
  case "end":
114
126
  return _context2.stop();
115
127
  }
@@ -1,2 +1,5 @@
1
1
  import '../../styles/global';
2
- export declare function makeStyles(k: string): string;
2
+ export declare const makeStyles: {
3
+ (k: string): string;
4
+ clearCache(): {};
5
+ };