@king-design/intact 3.1.1-beta.3 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/affix/styles.ts +4 -2
- package/components/badge/index.vdt +1 -1
- package/components/badge/styles.ts +4 -3
- package/components/breadcrumb/index.vdt +1 -1
- package/components/breadcrumb/styles.ts +4 -2
- package/components/button/styles.ts +7 -5
- package/components/card/styles.ts +4 -2
- package/components/carousel/styles.ts +7 -4
- package/components/cascader/index.vdt +2 -1
- package/components/cascader/styles.ts +7 -4
- package/components/checkbox/index.vdt +1 -1
- package/components/checkbox/styles.ts +4 -2
- package/components/code/styles.ts +3 -2
- package/components/collapse/index.spec.ts +1 -1
- package/components/collapse/styles.ts +7 -4
- package/components/colorpicker/styles.ts +7 -4
- package/components/copy/styles.ts +3 -2
- package/components/datepicker/styles.ts +10 -6
- package/components/diagram/styles.ts +3 -2
- package/components/dialog/styles.ts +10 -6
- package/components/drawer/styles.ts +4 -2
- package/components/dropdown/styles.ts +7 -4
- package/components/editable/styles.ts +4 -2
- package/components/form/index.md +1 -0
- package/components/form/index.spec.ts +17 -0
- package/components/form/item.ts +2 -0
- package/components/form/styles.ts +7 -4
- package/components/form/useDirty.ts +4 -0
- package/components/grid/styles.ts +12 -9
- package/components/icon/index.vdt +1 -1
- package/components/icon/styles.ts +4 -2
- package/components/input/styles.ts +8 -5
- package/components/layout/styles.ts +13 -9
- package/components/menu/demos/recursive.md +340 -0
- package/components/menu/styles.ts +21 -16
- package/components/message/styles.ts +7 -5
- package/components/pagination/styles.ts +4 -2
- package/components/popover/content.vdt +1 -1
- package/components/popover/demos/basic.md +1 -0
- package/components/popover/styles.ts +12 -2
- package/components/progress/styles.ts +4 -4
- package/components/radio/styles.ts +4 -2
- package/components/rate/styles.ts +4 -2
- package/components/scrollSelect/styles.ts +4 -2
- package/components/select/base.ts +3 -2
- package/components/select/base.vdt +1 -1
- package/components/select/styles.ts +10 -6
- package/components/skeleton/styles.ts +7 -4
- package/components/slider/styles.ts +4 -2
- package/components/spin/styles.ts +4 -4
- package/components/spinner/styles.ts +4 -3
- package/components/split/styles.ts +4 -2
- package/components/steps/index.vdt +2 -2
- package/components/steps/styles.ts +7 -5
- package/components/switch/styles.ts +4 -2
- package/components/table/column.ts +2 -0
- package/components/table/column.vdt +7 -3
- package/components/table/demos/basic.md +2 -2
- package/components/table/demos/fixColumn.md +3 -1
- package/components/table/demos/groupHeader.md +11 -11
- package/components/table/demos/scheme.md +1 -1
- package/components/table/index.spec.ts +8 -3
- package/components/table/styles.ts +11 -8
- package/components/table/table.vdt +3 -4
- package/components/table/useColumns.ts +1 -0
- package/components/table/useFixedColumns.ts +27 -49
- package/components/table/useGroup.ts +5 -0
- package/components/table/useResizable.ts +38 -10
- package/components/table/useWidth.ts +3 -0
- package/components/tabs/styles.ts +4 -2
- package/components/tag/styles.ts +7 -4
- package/components/timeline/styles.ts +7 -5
- package/components/timepicker/styles.ts +4 -2
- package/components/tip/styles.ts +4 -2
- package/components/tooltip/content.vdt +1 -1
- package/components/tooltip/styles.ts +4 -2
- package/components/transfer/styles.ts +4 -2
- package/components/tree/demos/checkbox.md +1 -0
- package/components/tree/demos/contextmenu.md +10 -1
- package/components/tree/index.spec.ts +7 -0
- package/components/tree/styles.ts +4 -2
- package/components/tree/useChecked.ts +3 -0
- package/components/treeSelect/styles.ts +4 -2
- package/components/upload/styles.ts +7 -4
- package/components/utils.ts +10 -4
- package/components/wave/styles.ts +4 -2
- package/es/components/affix/styles.d.ts +4 -1
- package/es/components/affix/styles.js +4 -2
- package/es/components/badge/index.vdt.js +1 -1
- package/es/components/badge/styles.d.ts +4 -1
- package/es/components/badge/styles.js +4 -2
- package/es/components/breadcrumb/index.vdt.js +1 -1
- package/es/components/breadcrumb/styles.d.ts +4 -1
- package/es/components/breadcrumb/styles.js +4 -2
- package/es/components/button/styles.d.ts +8 -2
- package/es/components/button/styles.js +7 -4
- package/es/components/card/styles.d.ts +4 -1
- package/es/components/card/styles.js +4 -2
- package/es/components/carousel/styles.d.ts +8 -2
- package/es/components/carousel/styles.js +7 -4
- package/es/components/cascader/index.vdt.js +3 -1
- package/es/components/cascader/styles.d.ts +8 -2
- package/es/components/cascader/styles.js +7 -4
- package/es/components/checkbox/index.vdt.js +1 -1
- package/es/components/checkbox/styles.d.ts +4 -1
- package/es/components/checkbox/styles.js +4 -2
- package/es/components/code/styles.d.ts +4 -1
- package/es/components/code/styles.js +3 -2
- package/es/components/collapse/index.spec.js +1 -1
- package/es/components/collapse/styles.d.ts +8 -2
- package/es/components/collapse/styles.js +7 -4
- package/es/components/colorpicker/styles.d.ts +8 -2
- package/es/components/colorpicker/styles.js +7 -4
- package/es/components/copy/styles.d.ts +4 -1
- package/es/components/copy/styles.js +3 -2
- package/es/components/datepicker/styles.d.ts +12 -3
- package/es/components/datepicker/styles.js +10 -6
- package/es/components/diagram/styles.d.ts +4 -1
- package/es/components/diagram/styles.js +3 -2
- package/es/components/dialog/styles.d.ts +12 -3
- package/es/components/dialog/styles.js +10 -6
- package/es/components/drawer/styles.d.ts +4 -1
- package/es/components/drawer/styles.js +4 -2
- package/es/components/dropdown/styles.d.ts +8 -2
- package/es/components/dropdown/styles.js +7 -4
- package/es/components/editable/styles.d.ts +4 -1
- package/es/components/editable/styles.js +4 -2
- package/es/components/form/index.spec.js +43 -0
- package/es/components/form/item.d.ts +1 -0
- package/es/components/form/item.js +2 -1
- package/es/components/form/styles.d.ts +8 -2
- package/es/components/form/styles.js +7 -4
- package/es/components/form/useDirty.js +4 -0
- package/es/components/grid/styles.d.ts +8 -2
- package/es/components/grid/styles.js +12 -13
- package/es/components/icon/index.vdt.js +1 -1
- package/es/components/icon/styles.d.ts +4 -1
- package/es/components/icon/styles.js +4 -2
- package/es/components/input/styles.d.ts +8 -2
- package/es/components/input/styles.js +7 -4
- package/es/components/layout/styles.d.ts +16 -4
- package/es/components/layout/styles.js +13 -8
- package/es/components/menu/styles.d.ts +16 -4
- package/es/components/menu/styles.js +14 -9
- package/es/components/message/styles.d.ts +8 -2
- package/es/components/message/styles.js +7 -4
- package/es/components/pagination/styles.d.ts +4 -1
- package/es/components/pagination/styles.js +4 -2
- package/es/components/popover/content.vdt.js +1 -1
- package/es/components/popover/styles.d.ts +4 -1
- package/es/components/popover/styles.js +8 -3
- package/es/components/progress/styles.d.ts +4 -1
- package/es/components/progress/styles.js +4 -2
- package/es/components/radio/styles.d.ts +4 -1
- package/es/components/radio/styles.js +4 -2
- package/es/components/rate/styles.d.ts +4 -1
- package/es/components/rate/styles.js +4 -2
- package/es/components/scrollSelect/styles.d.ts +4 -1
- package/es/components/scrollSelect/styles.js +4 -2
- package/es/components/select/base.js +3 -1
- package/es/components/select/base.vdt.js +1 -1
- package/es/components/select/styles.d.ts +12 -3
- package/es/components/select/styles.js +10 -6
- package/es/components/skeleton/styles.d.ts +8 -2
- package/es/components/skeleton/styles.js +7 -4
- package/es/components/slider/styles.d.ts +4 -1
- package/es/components/slider/styles.js +4 -2
- package/es/components/spin/styles.d.ts +4 -1
- package/es/components/spin/styles.js +4 -2
- package/es/components/spinner/styles.d.ts +4 -1
- package/es/components/spinner/styles.js +4 -2
- package/es/components/split/styles.d.ts +4 -1
- package/es/components/split/styles.js +4 -2
- package/es/components/steps/index.vdt.js +2 -2
- package/es/components/steps/styles.d.ts +4 -3
- package/es/components/steps/styles.js +9 -4
- package/es/components/switch/styles.d.ts +4 -1
- package/es/components/switch/styles.js +4 -2
- package/es/components/table/column.d.ts +1 -0
- package/es/components/table/column.js +2 -1
- package/es/components/table/column.vdt.js +9 -3
- package/es/components/table/index.spec.js +18 -11
- package/es/components/table/styles.d.ts +8 -2
- package/es/components/table/styles.js +8 -5
- package/es/components/table/table.vdt.js +3 -4
- package/es/components/table/useColumns.js +1 -0
- package/es/components/table/useFixedColumns.d.ts +3 -3
- package/es/components/table/useFixedColumns.js +27 -46
- package/es/components/table/useGroup.d.ts +1 -0
- package/es/components/table/useGroup.js +11 -1
- package/es/components/table/useResizable.js +41 -5
- package/es/components/table/useWidth.js +3 -0
- package/es/components/tabs/styles.d.ts +4 -1
- package/es/components/tabs/styles.js +4 -2
- package/es/components/tag/styles.d.ts +8 -2
- package/es/components/tag/styles.js +7 -4
- package/es/components/timeline/styles.d.ts +8 -2
- package/es/components/timeline/styles.js +7 -5
- package/es/components/timepicker/styles.d.ts +4 -1
- package/es/components/timepicker/styles.js +4 -2
- package/es/components/tip/styles.d.ts +4 -1
- package/es/components/tip/styles.js +4 -2
- package/es/components/tooltip/content.vdt.js +1 -1
- package/es/components/tooltip/styles.d.ts +4 -1
- package/es/components/tooltip/styles.js +4 -2
- package/es/components/transfer/styles.d.ts +4 -1
- package/es/components/transfer/styles.js +4 -2
- package/es/components/tree/index.spec.js +13 -1
- package/es/components/tree/styles.d.ts +4 -1
- package/es/components/tree/styles.js +4 -2
- package/es/components/tree/useChecked.js +4 -0
- package/es/components/treeSelect/styles.d.ts +4 -1
- package/es/components/treeSelect/styles.js +4 -2
- package/es/components/upload/styles.d.ts +8 -2
- package/es/components/upload/styles.js +7 -4
- package/es/components/utils.d.ts +10 -2
- package/es/components/utils.js +9 -2
- package/es/components/wave/styles.d.ts +4 -1
- package/es/components/wave/styles.js +4 -2
- package/es/i18n/en-US.d.ts +1 -0
- package/es/i18n/en-US.js +1 -0
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/menu/demos/recursive/index.d.ts +29 -0
- package/es/site/data/components/menu/demos/recursive/index.js +57 -0
- package/es/site/data/components/menu/demos/recursive/react.d.ts +2 -0
- package/es/site/data/components/menu/demos/recursive/react.js +69 -0
- package/es/site/data/components/popover/demos/basic/react.js +2 -1
- package/es/site/data/components/table/demos/basic/react.js +4 -2
- package/es/site/data/components/table/demos/fixColumn/react.js +2 -1
- package/es/site/data/components/table/demos/groupHeader/react.js +11 -20
- package/es/site/data/components/table/demos/scheme/react.js +2 -1
- package/es/site/data/components/tree/demos/checkbox/index.d.ts +12 -2
- package/es/site/data/components/tree/demos/checkbox/index.js +1 -0
- package/es/site/data/components/tree/demos/checkbox/react.d.ts +12 -2
- package/es/site/data/components/tree/demos/checkbox/react.js +1 -0
- package/es/site/data/components/tree/demos/contextmenu/index.d.ts +1 -0
- package/es/site/data/components/tree/demos/contextmenu/index.js +1 -0
- package/es/site/data/components/tree/demos/contextmenu/react.d.ts +1 -0
- package/es/site/data/components/tree/demos/contextmenu/react.js +1 -0
- package/es/site/src/components/article/index.js +6 -2
- package/es/styles/fonts/iconfont.d.ts +4 -1
- package/es/styles/fonts/iconfont.js +1 -1
- package/es/styles/global.js +1 -1
- package/i18n/en-US.ts +1 -0
- package/index.ts +2 -2
- package/package.json +3 -3
- package/styles/fonts/iconfont.ts +2 -2
- package/styles/global.ts +22 -0
|
@@ -3,6 +3,7 @@ import { css } from '@emotion/css';
|
|
|
3
3
|
import { deepDefaults, sizes } from '../../styles/utils';
|
|
4
4
|
import { theme, setDefault } from '../../styles/theme';
|
|
5
5
|
import '../../styles/global';
|
|
6
|
+
import { cache } from '../utils';
|
|
6
7
|
var defaults = {
|
|
7
8
|
get borderRadius() {
|
|
8
9
|
return theme.borderRadius;
|
|
@@ -68,8 +69,9 @@ setDefault(function () {
|
|
|
68
69
|
spinner = deepDefaults(theme, {
|
|
69
70
|
spinner: defaults
|
|
70
71
|
}).spinner;
|
|
72
|
+
makeStyles == null ? void 0 : makeStyles.clearCache();
|
|
71
73
|
});
|
|
72
|
-
export function makeStyles(k) {
|
|
74
|
+
export var makeStyles = cache(function makeStyles(k) {
|
|
73
75
|
return /*#__PURE__*/css("display:inline-block;vertical-align:middle;border:", spinner.border, ";border-radius:", spinner.borderRadius, ";&:hover{border-color:", spinner.hoverBorderColor, ";.", k, "-spinner-btn{background:", spinner.hoverBtnBg, ";}.", k, "-left{border-radius:", spinner.borderRadius, " 0 0 ", spinner.borderRadius, ";}.", k, "-right{border-radius:0 ", spinner.borderRadius, " ", spinner.borderRadius, " 0;}}.", k, "-spinner-input{width:", spinner.default.inputWidth, ";.", k, "-input-wrapper{border:none;border-radius:0;&:hover{border:none;}}&.", k, "-focus .", k, "-input-wrapper{border:none;}.", k, "-input-inner{text-align:center;}}.", k, "-spinner-icon{font-size:", spinner.default.iconFontSize, ";}&.", k, "-vertical{position:relative;font-size:0;", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
74
76
|
var generate = function generate() {
|
|
75
77
|
return /*#__PURE__*/css(".", k, "-spinner-input{padding-right:", theme[size].height, ";width:", spinner.vertical[size].width, ";}");
|
|
@@ -93,4 +95,4 @@ export function makeStyles(k) {
|
|
|
93
95
|
return /*#__PURE__*/css("&.", k, "-", size, "{", generate(), ";}");
|
|
94
96
|
}
|
|
95
97
|
}), ";");
|
|
96
|
-
}
|
|
98
|
+
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import '../../styles/global';
|
|
2
2
|
export declare type Mode = 'horizontal' | 'vertical';
|
|
3
3
|
export declare const kls: (className: string, k: string) => string;
|
|
4
|
-
export declare
|
|
4
|
+
export declare const makeStyles: {
|
|
5
|
+
(k: string): string;
|
|
6
|
+
clearCache(): {};
|
|
7
|
+
};
|
|
@@ -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
|
export var kls = function kls(className, k) {
|
|
6
7
|
return k + "-split-" + className;
|
|
7
8
|
};
|
|
@@ -49,7 +50,8 @@ setDefault(function () {
|
|
|
49
50
|
split = deepDefaults(theme, {
|
|
50
51
|
split: defaults
|
|
51
52
|
}).split;
|
|
53
|
+
makeStyles == null ? void 0 : makeStyles.clearCache();
|
|
52
54
|
});
|
|
53
|
-
export function makeStyles(k) {
|
|
55
|
+
export var makeStyles = cache(function makeStyles(k) {
|
|
54
56
|
return /*#__PURE__*/css("display:flex;height:100%;&>.", kls('first', k), ",&>.", kls('last', k), "{overflow:auto;position:relative;}&>.", kls('first', k), "{flex:0 0 auto;}&>.", kls('last', k), "{flex:auto;}&.", k, "-first-auto{&>.", kls('first', k), "{flex:auto;}&>.", kls('last', k), "{flex:0 0 auto;}}&:not(.", k, "-resizing){&>.", kls('first', k), ",&>.", kls('last', k), "{transition:all ", split.transition, ";}}&>.", kls('line-wrapper', k), "{flex:0 0 auto;text-align:center;overflow:hidden;.", kls('line', k), "{height:100%;background:", split.bgColor, ";position:relative;}.", kls('drag-lines', k), "{background:", split.boderColor, ";position:absolute;}}&.", k, "-horizontal{&>.", kls('line-wrapper', k), "{cursor:col-resize;width:", split.splitLineSize, ";.", kls('line', k), "{border-left:", split.baseBorder, ";border-right:", split.baseBorder, ";}.", kls('drag-lines', k), "{height:", split.dragLinesSize, ";width:100%;top:50%;margin-top:", split.dragLineMargin, ";box-shadow:", split.boxShadow('horizontal'), ";}}}&.", k, "-vertical{flex-direction:column;&>.", kls('line-wrapper', k), "{cursor:row-resize;height:", split.splitLineSize, ";.", kls('line', k), "{border-top:", split.baseBorder, ";border-bottom:", split.baseBorder, ";}.", kls('drag-lines', k), "{width:", split.dragLinesSize, ";height:100%;left:50%;margin-left:", split.dragLineMargin, ";box-shadow:", split.boxShadow('vertical'), ";}}}");
|
|
55
|
-
}
|
|
57
|
+
});
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
|
2
2
|
import { createUnknownComponentVNode as _$cc, createVNode as _$cv, className as _$cn } from 'intact';
|
|
3
3
|
import { getRestProps, eachChildren } from '../utils';
|
|
4
4
|
import { Step } from './step';
|
|
5
|
-
import {
|
|
5
|
+
import { makeStyles } from './styles';
|
|
6
6
|
import { context as StepsContext } from './context';
|
|
7
7
|
export default function ($props, $blocks, $__proto__) {
|
|
8
8
|
var _classNameObj;
|
|
@@ -21,7 +21,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
21
21
|
vertical = _this$get.vertical;
|
|
22
22
|
|
|
23
23
|
var k = this.config.k;
|
|
24
|
-
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-steps"] = true, _classNameObj[className] = className, _classNameObj[k + "-" + type] = true, _classNameObj[k + "-clickable"] = clickable, _classNameObj[k + "-vertical"] = vertical, _classNameObj[
|
|
24
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-steps"] = true, _classNameObj[className] = className, _classNameObj[k + "-" + type] = true, _classNameObj[k + "-clickable"] = clickable, _classNameObj[k + "-vertical"] = vertical, _classNameObj[makeStyles(k)] = true, _classNameObj);
|
|
25
25
|
var stepIndex = 0;
|
|
26
26
|
var steps = [];
|
|
27
27
|
eachChildren(children, function (vNode) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import '../../styles/global';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
4
|
-
|
|
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, palette } from '../../styles/utils';
|
|
5
5
|
import '../../styles/global';
|
|
6
|
+
import { cache } from '../utils';
|
|
6
7
|
var defaults = {
|
|
7
8
|
gap: '10px',
|
|
8
9
|
|
|
@@ -141,11 +142,12 @@ setDefault(function () {
|
|
|
141
142
|
steps = deepDefaults(theme, {
|
|
142
143
|
steps: defaults
|
|
143
144
|
}).steps;
|
|
145
|
+
makeStyles == null ? void 0 : makeStyles.clearCache();
|
|
144
146
|
});
|
|
145
147
|
var stepStatus = ['done', 'active', 'error'];
|
|
146
|
-
export function
|
|
148
|
+
export var makeStyles = cache(function makeStyles(k) {
|
|
147
149
|
return /*#__PURE__*/css("display:flex;", makeCommonStyles(k), ";&.", k, "-default{", makeDefaultStyles(k), ";}&.", k, "-line,&.", k, "-line-compact,&.", k, "-simple{", makeLineStyles(k), ";}&.", k, "-line-compact{", makeLineCompactStyles(k), ";}&.", k, "-simple{", makeSimpleStyles(k), ";}&.", k, "-clickable{.", k, "-done{cursor:pointer;.", k, "-step-wrapper:hover .", k, "-step-mark{background:", steps.done.markHoverBgColor, ";}}}", makeVerticalStyles(k), ";");
|
|
148
|
-
}
|
|
150
|
+
});
|
|
149
151
|
|
|
150
152
|
function makeDefaultStyles(k) {
|
|
151
153
|
var defaults = steps.default;
|
|
@@ -176,6 +178,8 @@ function makeSimpleStyles(k) {
|
|
|
176
178
|
return /*#__PURE__*/css(".", k, "-step-mark{width:", simple.markWidth, ";height:", simple.markWidth, ";background:", simple.markBgColor, ";}.", k, "-step-wrapper{font-size:0;&:before,&:after{top:", top, ";}}.", k, "-step-main{font-size:", theme.default.fontSize, ";}.", k, "-step-tail{margin-top:", top, ";}.", k, "-step{&.", k, "-done{.", k, "-step-mark{background:", simple.doneMarkBgColor, ";}}&.", k, "-error{.", k, "-step-mark{background:", simple.errorMarkBgColor, ";}}}");
|
|
177
179
|
}
|
|
178
180
|
|
|
181
|
+
;
|
|
182
|
+
|
|
179
183
|
function center(flex) {
|
|
180
184
|
if (flex === void 0) {
|
|
181
185
|
flex = 'flex';
|
|
@@ -184,13 +188,14 @@ function center(flex) {
|
|
|
184
188
|
return /*#__PURE__*/css("display:", flex, ";align-items:center;justify-content:center;");
|
|
185
189
|
}
|
|
186
190
|
|
|
187
|
-
|
|
191
|
+
function makeCommonStyles(k) {
|
|
188
192
|
return /*#__PURE__*/css(".", k, "-step{position:relative;flex:1;", _mapInstanceProperty(stepStatus).call(stepStatus, function (status) {
|
|
189
193
|
var styles = steps[status];
|
|
190
194
|
return /*#__PURE__*/css("&.", k, "-", status, "{.", k, "-step-mark{color:", styles.markColor, ";border-color:", styles.markBorderColor, ";background:", styles.markBgColor, ";}.", k, "-step-main{color:", styles.mainColor, ";}}");
|
|
191
195
|
}), ";}.", k, "-step-mark{", center('inline-flex'), ";border:", steps.default.markborder, ";border-radius:50%;vertical-align:top;color:", steps.markColor, ";background:", steps.markBgColor, ";}");
|
|
192
196
|
}
|
|
193
|
-
|
|
197
|
+
|
|
198
|
+
function makeVerticalStyles(k) {
|
|
194
199
|
var verticalLine = steps.vertical.line;
|
|
195
200
|
return /*#__PURE__*/css("&.", k, "-vertical{&.", k, "-default{height:auto;width:", steps.default.height, ";writing-mode:vertical-rl;letter-spacing:1px;", makeArrow(true, k), ";.", k, "-step-wrapper{width:100%;padding:", steps.default.padding, " 0;}.", k, "-step-mark{margin-right:0;margin-bottom:", steps.gap, ";}.", k, "-step-title{padding-right:0;padding-bottom:", steps.gap, ";}}&.", k, "-line,&.", k, "-line-compact,&.", k, "-simple{flex-direction:column;.", k, "-step{flex:none;min-height:", verticalLine.minHeight, ";}.", k, "-step-wrapper{display:flex;width:auto;text-align:left;}.", k, "-step-main{flex:1;padding:0 0 ", verticalLine.padding, " ", verticalLine.padding, ";}.", k, "-step-title{display:flex;align-items:center;height:", steps.line.markWidth, ";&:after{display:none;}}.", k, "-step-wrapper{&:before,&:after{display:none;}}.", k, "-step-tail{position:absolute;left:calc(", steps.line.markWidth, " / 2 - ", steps.line.lineWidth, " / 2);height:100%;width:", steps.line.lineWidth, ";background:", steps.line.lineColor, ";}.", k, "-step:last-of-type{.", k, "-step-tail{display:none;}}}&.", k, "-simple{.", k, "-step-tail{left:calc(", steps.simple.markWidth, " / 2 - ", steps.line.lineWidth, " / 2);}.", k, "-step-title{height:", steps.simple.markWidth, ";margin-bottom:", steps.vertical.simple.titleGap, ";}}}");
|
|
196
201
|
}
|
|
@@ -3,6 +3,7 @@ import { css } from '@emotion/css';
|
|
|
3
3
|
import { theme, setDefault } from '../../styles/theme';
|
|
4
4
|
import { deepDefaults, sizes, palette } from '../../styles/utils';
|
|
5
5
|
import '../../styles/global';
|
|
6
|
+
import { cache } from '../utils';
|
|
6
7
|
var defaults = {
|
|
7
8
|
get transition() {
|
|
8
9
|
return theme.transition.middle;
|
|
@@ -71,8 +72,9 @@ setDefault(function () {
|
|
|
71
72
|
kswitch = deepDefaults(theme, {
|
|
72
73
|
switch: defaults
|
|
73
74
|
}).switch;
|
|
75
|
+
makeStyles == null ? void 0 : makeStyles.clearCache();
|
|
74
76
|
});
|
|
75
|
-
export function makeStyles(k) {
|
|
77
|
+
export var makeStyles = cache(function makeStyles(k) {
|
|
76
78
|
return /*#__PURE__*/css("display:inline-block;vertical-align:middle;background:", kswitch.bgColor, ";position:relative;cursor:pointer;user-select:none;overflow:hidden;box-sizing:content-box;transition:background ", kswitch.transition, ";input{opacity:0;position:absolute;}.", k, "-switch-bar,.", k, "-switch-off{box-sizing:border-box;}.", k, "-switch-bar{position:absolute;text-align:right;overflow:hidden;}.", k, "-switch-wrapper{display:inline-block;position:relative;z-index:1;border-radius:", kswitch.handleBorderRadius, ";}.", k, "-switch-bar,.", k, "-switch-wrapper{height:100%;background:", kswitch.bgColor, ";transition:all ", kswitch.transition, ";}&:hover{&,.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.hoverBgColor, ";}}.", k, "-switch-handle{border-radius:", kswitch.handleBorderRadius, ";background:", kswitch.handleBgColor, ";height:100%;cursor:pointer;transition:left ", kswitch.transition, ";display:inline-block;img{height:100%;visibility:hidden;}}.", k, "-switch-on,.", k, "-switch-off{position:absolute;font-size:", kswitch.fontSize, ";color:", kswitch.color, ";text-align:center;}&.", k, "-dragging{.", k, "-switch-bar,.", k, "-switch-wrapper{background:", kswitch.checked.bgColor, ";transition:background ", kswitch.transition, ";}}&:focus{outline:none;}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
77
79
|
var _kswitch$size = kswitch[size],
|
|
78
80
|
width = _kswitch$size.width,
|
|
@@ -80,4 +82,4 @@ export function makeStyles(k) {
|
|
|
80
82
|
padding = _kswitch$size.padding;
|
|
81
83
|
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, ";}}");
|
|
82
84
|
}), "&.", 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, ";}}}");
|
|
83
|
-
}
|
|
85
|
+
});
|
|
@@ -45,7 +45,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
45
45
|
confirm = _this$group.confirm,
|
|
46
46
|
dropdownRef = _this$group.dropdownRef,
|
|
47
47
|
localGroupValue = _this$group.localGroupValue,
|
|
48
|
-
isEmptyValue = _this$group.isEmptyValue
|
|
48
|
+
isEmptyValue = _this$group.isEmptyValue,
|
|
49
|
+
checkAll = _this$group.checkAll;
|
|
49
50
|
var k = this.config.k;
|
|
50
51
|
return _$cc(TableContext.Consumer, {
|
|
51
52
|
'children': function children(checkType) {
|
|
@@ -150,20 +151,25 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
150
151
|
}) : _$ce(2, 'span', $value.label, 0)
|
|
151
152
|
});
|
|
152
153
|
}, $this), 4, _$cn(k + "-table-group-body")), multiple ? _$ce(2, 'div', [_$cc(Button, {
|
|
154
|
+
'size': 'mini',
|
|
155
|
+
'type': 'link',
|
|
156
|
+
'ev-click': checkAll,
|
|
157
|
+
'children': _$('全选')
|
|
158
|
+
}), _$cc(Button, {
|
|
153
159
|
'size': 'small',
|
|
154
160
|
'disabled': isEmptyValue(localGroupValue.value),
|
|
155
161
|
'type': 'secondary',
|
|
156
162
|
'ev-click': function evClick() {
|
|
157
163
|
return reset(onChange);
|
|
158
164
|
},
|
|
159
|
-
'children': '重置'
|
|
165
|
+
'children': _$('重置')
|
|
160
166
|
}), _$cc(Button, {
|
|
161
167
|
'type': 'primary',
|
|
162
168
|
'size': 'small',
|
|
163
169
|
'ev-click': function evClick() {
|
|
164
170
|
return confirm(onChange);
|
|
165
171
|
},
|
|
166
|
-
'children': '确定'
|
|
172
|
+
'children': _$('确定')
|
|
167
173
|
})], 4, _$cn(k + "-table-group-footer")) : undefined]
|
|
168
174
|
})]
|
|
169
175
|
}, 'dropdown', dropdownRef) : undefined, sortable ? _$ce(2, 'div', [_$cc(Icon, {
|
|
@@ -366,7 +366,7 @@ describe('Table', function () {
|
|
|
366
366
|
}, _callee6);
|
|
367
367
|
})));
|
|
368
368
|
it('group', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
369
|
-
var _mount7, instance, element, _instance$refs4, __test1, __test2, _element$querySelecto8, table1, table2, icon, dropdown, item, icon2, dropdown2, _dropdown2$querySelec, item1, item2, _dropdown2$querySelec2, reset, confirm, newDropdown;
|
|
369
|
+
var _mount7, instance, element, _instance$refs4, __test1, __test2, _element$querySelecto8, table1, table2, icon, dropdown, item, icon2, dropdown2, _dropdown2$querySelec, item1, item2, _dropdown2$querySelec2, checkAll, reset, confirm, newDropdown;
|
|
370
370
|
|
|
371
371
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
372
372
|
while (1) {
|
|
@@ -420,7 +420,7 @@ describe('Table', function () {
|
|
|
420
420
|
status: []
|
|
421
421
|
}); // click confirm
|
|
422
422
|
|
|
423
|
-
_dropdown2$querySelec2 = dropdown2.querySelectorAll('.k-table-group-footer .k-btn'),
|
|
423
|
+
_dropdown2$querySelec2 = dropdown2.querySelectorAll('.k-table-group-footer .k-btn'), checkAll = _dropdown2$querySelec2[0], reset = _dropdown2$querySelec2[1], confirm = _dropdown2$querySelec2[2];
|
|
424
424
|
confirm.click();
|
|
425
425
|
_context7.next = 35;
|
|
426
426
|
return wait();
|
|
@@ -443,28 +443,35 @@ describe('Table', function () {
|
|
|
443
443
|
|
|
444
444
|
case 44:
|
|
445
445
|
expect(dropdown2.innerHTML).to.matchSnapshot();
|
|
446
|
-
confirm.click();
|
|
447
|
-
_context7.next = 48;
|
|
448
|
-
return wait();
|
|
449
|
-
|
|
450
|
-
case 48:
|
|
451
446
|
expect(instance.get('multipleGroup')).to.eql({
|
|
452
447
|
status: []
|
|
453
|
-
}); //
|
|
448
|
+
}); // click checkAll
|
|
449
|
+
|
|
450
|
+
dispatchEvent(icon2, 'click');
|
|
451
|
+
_context7.next = 49;
|
|
452
|
+
return wait();
|
|
453
|
+
|
|
454
|
+
case 49:
|
|
455
|
+
checkAll.click();
|
|
456
|
+
_context7.next = 52;
|
|
457
|
+
return wait();
|
|
458
|
+
|
|
459
|
+
case 52:
|
|
460
|
+
expect(dropdown2.querySelectorAll('.k-checkbox.k-checked')).to.length(2); // update group
|
|
454
461
|
|
|
455
462
|
instance.set('statusGroup', [{
|
|
456
463
|
label: 'label',
|
|
457
464
|
value: 'value'
|
|
458
465
|
}]);
|
|
459
466
|
dispatchEvent(icon, 'click');
|
|
460
|
-
_context7.next =
|
|
467
|
+
_context7.next = 57;
|
|
461
468
|
return wait(500);
|
|
462
469
|
|
|
463
|
-
case
|
|
470
|
+
case 57:
|
|
464
471
|
newDropdown = getElement('.k-table-group-dropdown');
|
|
465
472
|
expect(newDropdown.innerHTML).to.matchSnapshot();
|
|
466
473
|
|
|
467
|
-
case
|
|
474
|
+
case 59:
|
|
468
475
|
case "end":
|
|
469
476
|
return _context7.stop();
|
|
470
477
|
}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import '../../styles/global';
|
|
2
|
-
export declare
|
|
3
|
-
|
|
2
|
+
export declare const makeStyles: {
|
|
3
|
+
(k: string): string;
|
|
4
|
+
clearCache(): {};
|
|
5
|
+
};
|
|
6
|
+
export declare const makeGroupMenuStyles: {
|
|
7
|
+
(k: string): string;
|
|
8
|
+
clearCache(): {};
|
|
9
|
+
};
|
|
@@ -4,6 +4,7 @@ import { css } from '@emotion/css';
|
|
|
4
4
|
import { theme, setDefault } from '../../styles/theme';
|
|
5
5
|
import { deepDefaults, palette } from '../../styles/utils';
|
|
6
6
|
import '../../styles/global';
|
|
7
|
+
import { cache } from '../utils';
|
|
7
8
|
var defaults = {
|
|
8
9
|
get transition() {
|
|
9
10
|
return theme.transition.large;
|
|
@@ -101,12 +102,14 @@ setDefault(function () {
|
|
|
101
102
|
table = deepDefaults(theme, {
|
|
102
103
|
table: defaults
|
|
103
104
|
}).table;
|
|
105
|
+
makeStyles == null ? void 0 : makeStyles.clearCache();
|
|
106
|
+
makeGroupMenuStyles == null ? void 0 : makeGroupMenuStyles.clearCache();
|
|
104
107
|
});
|
|
105
|
-
export function makeStyles(k) {
|
|
106
|
-
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;
|
|
108
|
+
export var makeStyles = cache(function makeStyles(k) {
|
|
109
|
+
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%);}&: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, "-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) {
|
|
107
110
|
return /*#__PURE__*/css(".", k, "-align-", type, "{text-align:", type, ";}");
|
|
108
111
|
}), ">.", k, "-pagination{margin:16px 0;}&.", k, "-fix-header{min-height:0;.", k, "-table-wrapper{height:100%;}}");
|
|
109
|
-
}
|
|
110
|
-
export function makeGroupMenuStyles(k) {
|
|
112
|
+
});
|
|
113
|
+
export var makeGroupMenuStyles = cache(function makeGroupMenuStyles(k) {
|
|
111
114
|
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;}}");
|
|
112
|
-
}
|
|
115
|
+
});
|
|
@@ -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
|
-
|
|
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,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VNodeComponentClass, Props,
|
|
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,
|
|
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.
|
|
19
|
+
instance.watch('children', handleFixedColumnsAndUpdate, {
|
|
20
|
+
presented: true
|
|
21
|
+
});
|
|
20
22
|
watchState(widthMap, function () {
|
|
21
|
-
|
|
22
|
-
updateScrollPositionOnResize();
|
|
23
|
+
return nextTick(handleFixedColumnsAndUpdate);
|
|
23
24
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
onMounted(function () {
|
|
25
|
+
useResizeObserver(scrollRef, handleFixedColumnsAndUpdate, true);
|
|
26
|
+
|
|
27
|
+
function handleFixedColumnsAndUpdate() {
|
|
28
|
+
handleFixedColumns();
|
|
29
29
|
updateScrollPositionOnResize();
|
|
30
|
-
|
|
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
|
-
|
|
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
|
-
|
|
57
|
+
_offsetMap[key] = value;
|
|
68
58
|
hasFixedLeft = true;
|
|
69
59
|
} else if (fixed === 'right') {
|
|
70
60
|
var _value = 0;
|
|
71
|
-
var
|
|
61
|
+
var nextVNode = props.nextVNode;
|
|
72
62
|
|
|
73
|
-
while (
|
|
74
|
-
var _props2 =
|
|
63
|
+
while (nextVNode) {
|
|
64
|
+
var _props2 = nextVNode.props;
|
|
75
65
|
|
|
76
66
|
if (_props2.fixed === 'right') {
|
|
77
|
-
|
|
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
|
-
|
|
70
|
+
nextVNode = _props2.nextVNode;
|
|
85
71
|
}
|
|
86
72
|
|
|
87
|
-
|
|
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
|
|
138
|
-
var
|
|
139
|
-
|
|
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
|
}
|
|
@@ -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
|
}
|