@king-design/react 3.5.2 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cascader/index.spec.js +18 -19
- package/components/datepicker/basepicker.d.ts +6 -25
- package/components/datepicker/basepicker.js +22 -234
- package/components/datepicker/calendar.d.ts +36 -6
- package/components/datepicker/calendar.js +4 -0
- package/components/datepicker/calendar.vdt.js +21 -5
- package/components/datepicker/dayjs.d.ts +2 -2
- package/components/datepicker/dayjs.js +6 -0
- package/components/datepicker/helpers.d.ts +8 -7
- package/components/datepicker/helpers.js +2 -3
- package/components/datepicker/index.d.ts +26 -19
- package/components/datepicker/index.js +21 -13
- package/components/datepicker/index.spec.js +1389 -633
- package/components/datepicker/index.vdt.js +43 -46
- package/components/datepicker/shortcuts.d.ts +1 -1
- package/components/datepicker/styles.d.ts +22 -0
- package/components/datepicker/styles.js +26 -4
- package/components/datepicker/useConfirm.d.ts +6 -0
- package/components/datepicker/useConfirm.js +65 -0
- package/components/datepicker/useDisabled.d.ts +7 -5
- package/components/datepicker/useDisabled.js +22 -27
- package/components/datepicker/useFormats.d.ts +2 -2
- package/components/datepicker/useFormats.js +9 -3
- package/components/datepicker/useHighlight.d.ts +14 -0
- package/components/datepicker/useHighlight.js +60 -0
- package/components/datepicker/useKeyboards.js +2 -1
- package/components/datepicker/useMergeRange.d.ts +5 -0
- package/components/datepicker/useMergeRange.js +45 -0
- package/components/datepicker/useMonths.js +5 -3
- package/components/datepicker/usePanel.d.ts +1 -10
- package/components/datepicker/usePanel.js +19 -32
- package/components/datepicker/useQuarters.d.ts +15 -0
- package/components/datepicker/useQuarters.js +36 -0
- package/components/datepicker/useShowDate.js +10 -2
- package/components/datepicker/useStatus.d.ts +1 -1
- package/components/datepicker/useStatus.js +33 -16
- package/components/datepicker/useValue.d.ts +12 -6
- package/components/datepicker/useValue.js +49 -45
- package/components/datepicker/useValueBase.d.ts +28 -0
- package/components/datepicker/useValueBase.js +277 -0
- package/components/datepicker/useWeeks.d.ts +19 -0
- package/components/datepicker/useWeeks.js +48 -0
- package/components/datepicker/useYears.js +6 -3
- package/components/dialog/useFixBody.js +6 -58
- package/components/dropdown/dropdown.d.ts +1 -0
- package/components/dropdown/dropdown.js +7 -4
- package/components/ellipsis/styles.js +1 -1
- package/components/form/styles.js +1 -1
- package/components/input/index.d.ts +2 -0
- package/components/input/index.js +6 -0
- package/components/input/index.spec.js +45 -0
- package/components/input/index.vdt.js +4 -3
- package/components/input/useAutoWidth.d.ts +2 -0
- package/components/input/useAutoWidth.js +19 -1
- package/components/scrollSelect/index.spec.js +4 -6
- package/components/scrollSelect/useMouseEvents.js +22 -9
- package/components/select/base.d.ts +1 -1
- package/components/select/base.js +3 -2
- package/components/select/base.vdt.js +5 -2
- package/components/select/index.spec.js +329 -82
- package/components/select/option.d.ts +1 -0
- package/components/select/option.js +10 -2
- package/components/select/select.d.ts +1 -0
- package/components/select/select.js +4 -2
- package/components/select/styles.d.ts +79 -0
- package/components/select/styles.js +1 -0
- package/components/select/useFilterable.js +2 -1
- package/components/select/useInput.d.ts +1 -1
- package/components/select/useInput.js +7 -4
- package/components/select/useSearchable.js +1 -0
- package/components/table/index.spec.js +84 -6
- package/components/table/useStickyHeader.js +1 -1
- package/components/timepicker/index.spec.js +298 -128
- package/components/timepicker/panelPicker.d.ts +23 -17
- package/components/timepicker/panelPicker.js +7 -4
- package/components/timepicker/panelPicker.vdt.js +8 -4
- package/components/timepicker/selectPicker.d.ts +5 -4
- package/components/timepicker/useConfirm.d.ts +6 -0
- package/components/timepicker/useConfirm.js +19 -0
- package/components/timepicker/useDefaultValue.d.ts +4 -0
- package/components/timepicker/useDefaultValue.js +27 -0
- package/components/timepicker/useDisabled.d.ts +7 -4
- package/components/timepicker/useDisabled.js +13 -4
- package/components/timepicker/useFormats.d.ts +1 -1
- package/components/timepicker/useValue.d.ts +14 -8
- package/components/timepicker/useValue.js +14 -15
- package/components/tour/index.d.ts +2 -0
- package/components/tour/index.js +2 -0
- package/components/tour/index.spec.d.ts +1 -0
- package/components/tour/index.spec.js +356 -0
- package/components/tour/step.d.ts +23 -0
- package/components/tour/step.js +46 -0
- package/components/tour/step.vdt.js +74 -0
- package/components/tour/styles.d.ts +7 -0
- package/components/tour/styles.js +84 -0
- package/components/tour/tour.d.ts +73 -0
- package/components/tour/tour.js +70 -0
- package/components/tour/tour.vdt.js +66 -0
- package/components/tour/useArrow.d.ts +4 -0
- package/components/tour/useArrow.js +40 -0
- package/components/tour/useFixBody.d.ts +4 -0
- package/components/tour/useFixBody.js +17 -0
- package/components/tour/useHighlight.d.ts +4 -0
- package/components/tour/useHighlight.js +31 -0
- package/components/tour/useMaskClosable.d.ts +1 -0
- package/components/tour/useMaskClosable.js +25 -0
- package/components/tour/useNavigation.d.ts +5 -0
- package/components/tour/useNavigation.js +103 -0
- package/components/tour/usePosition.d.ts +6 -0
- package/components/tour/usePosition.js +93 -0
- package/components/tour/useSteps.d.ts +6 -0
- package/components/tour/useSteps.js +68 -0
- package/hooks/useFixBody.d.ts +11 -0
- package/hooks/useFixBody.js +72 -0
- package/index.d.ts +3 -2
- package/index.js +3 -2
- package/package.json +2 -2
|
@@ -1,4 +1,83 @@
|
|
|
1
|
+
import { Sizes } from '../../styles/utils';
|
|
1
2
|
import '../../styles/global';
|
|
3
|
+
type SizeStyles = {
|
|
4
|
+
padding: string;
|
|
5
|
+
height: string;
|
|
6
|
+
fontSize: string;
|
|
7
|
+
};
|
|
8
|
+
declare const defaults: {
|
|
9
|
+
readonly transition: string;
|
|
10
|
+
width: string;
|
|
11
|
+
readonly height: string;
|
|
12
|
+
bgColor: string;
|
|
13
|
+
readonly fontSize: string;
|
|
14
|
+
readonly border: string;
|
|
15
|
+
readonly focusBorder: string;
|
|
16
|
+
readonly hoverBorder: string;
|
|
17
|
+
readonly activeColor: string;
|
|
18
|
+
readonly borderRadius: string;
|
|
19
|
+
suffixGap: string;
|
|
20
|
+
clearGap: string;
|
|
21
|
+
readonly placeholderColor: string;
|
|
22
|
+
disabled: {
|
|
23
|
+
readonly color: string;
|
|
24
|
+
readonly bgColor: string;
|
|
25
|
+
readonly borderColor: string;
|
|
26
|
+
};
|
|
27
|
+
group: {
|
|
28
|
+
readonly labelColor: string;
|
|
29
|
+
labelPadding: string;
|
|
30
|
+
};
|
|
31
|
+
card: {
|
|
32
|
+
height: string;
|
|
33
|
+
readonly itemHoverColor: string;
|
|
34
|
+
itemHoverBgColor: string;
|
|
35
|
+
};
|
|
36
|
+
multiple: {
|
|
37
|
+
checkmark: {
|
|
38
|
+
fontSize: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
tag: {
|
|
42
|
+
margin: string;
|
|
43
|
+
padding: string;
|
|
44
|
+
readonly borderRadius: string;
|
|
45
|
+
readonly bgColor: string;
|
|
46
|
+
disabledBgColor: string;
|
|
47
|
+
delete: {
|
|
48
|
+
gap: string;
|
|
49
|
+
fontSize: string;
|
|
50
|
+
readonly color: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
menuMaxHeight: string;
|
|
54
|
+
empty: {
|
|
55
|
+
padding: string;
|
|
56
|
+
readonly color: string;
|
|
57
|
+
};
|
|
58
|
+
searchable: {
|
|
59
|
+
padding: string;
|
|
60
|
+
headerGap: string;
|
|
61
|
+
readonly border: string;
|
|
62
|
+
header: {
|
|
63
|
+
padding: string;
|
|
64
|
+
gap: string;
|
|
65
|
+
btnPadding: string;
|
|
66
|
+
btnGap: string;
|
|
67
|
+
};
|
|
68
|
+
optionPadding: string;
|
|
69
|
+
footer: {
|
|
70
|
+
padding: string;
|
|
71
|
+
gap: string;
|
|
72
|
+
btnGap: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
flat: {
|
|
76
|
+
readonly color: string;
|
|
77
|
+
};
|
|
78
|
+
} & Record<Sizes, SizeStyles>;
|
|
79
|
+
declare let select: typeof defaults;
|
|
80
|
+
export { select };
|
|
2
81
|
export declare const makeStyles: {
|
|
3
82
|
(k: string): string;
|
|
4
83
|
clearCache(): {};
|
|
@@ -146,6 +146,7 @@ setDefault(function () {
|
|
|
146
146
|
makeMenuStyles == null || makeMenuStyles.clearCache();
|
|
147
147
|
makeGroupStyles == null || makeGroupStyles.clearCache();
|
|
148
148
|
});
|
|
149
|
+
export { select };
|
|
149
150
|
export var makeStyles = cache(function makeStyles(k) {
|
|
150
151
|
return /*#__PURE__*/css("display:inline-flex;align-items:center;vertical-align:middle;position:relative;width:", select.width, ";cursor:pointer;outline:none;border:", select.border, ";background:", select.bgColor, ";transition:border ", select.transition, ",background ", select.transition, ",box-shadow ", select.transition, ";border-radius:", select.borderRadius, ";.", k, "-select-main{flex:1;min-width:0;}.", k, "-select-prefix,.", k, "-select-suffix{display:flex;align-items:center;position:relative;}.", k, "-select-suffix{margin-left:", select.suffixGap, ";}.", k, "-select-placeholder{color:", select.placeholderColor, ";user-select:none;}.", k, "-input .", k, "-input-inner{background:transparent;}&.", k, "-fluid{width:100%;}.", k, "-select-clear{opacity:0;transition:opacity ", select.transition, ",color ", select.transition, "!important;pointer-events:none;position:absolute;z-index:1;top:50%;left:50%;transform:translate(-50%, -50%);}&:hover{border:", select.hoverBorder, ";.", k, "-select-clear.", k, "-show{opacity:1;pointer-events:all;+.", k, "-select-suffix-icon{opacity:0;}}}.", k, "-select-suffix-icon{display:inline-flex;align-items:center;transition:opacity ", select.transition, ";}.", k, "-select-arrow{display:inline-block;transition:transform ", select.transition, ";}&.", k, "-dropdown-open{border:", select.focusBorder, ";.", k, "-select-arrow{transform:rotateX(180deg);}}&:focus{outline:none;border:", select.focusBorder, ";}.", k, "-tags{padding:3px 0;}.", k, "-tag{word-break:break-word;height:auto;max-width:calc(100% - ", getRight(select.tag.margin), " - 1px);}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
151
152
|
var styles = select[size];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { State } from '../../hooks/useState';
|
|
2
2
|
import type { Input } from '../input';
|
|
3
|
-
export declare function useInput(resetKeywords: (
|
|
3
|
+
export declare function useInput(resetKeywords: () => void): {
|
|
4
4
|
onInput: (value: string) => void;
|
|
5
5
|
keywords: State<string>;
|
|
6
6
|
inputRef: import('intact-react').RefObject<Input<string | number>>;
|
|
@@ -29,22 +29,25 @@ export function useInput(resetKeywords) {
|
|
|
29
29
|
component.on('$changed:show', function (show) {
|
|
30
30
|
if (show) {
|
|
31
31
|
focusInput();
|
|
32
|
-
resetKeywords(
|
|
32
|
+
resetKeywords();
|
|
33
33
|
} else if (component.get('multiple')) {
|
|
34
|
-
resetKeywords(
|
|
34
|
+
resetKeywords();
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
component.on('$changed:value', function () {
|
|
38
38
|
var _component$get = component.get(),
|
|
39
39
|
multiple = _component$get.multiple,
|
|
40
|
-
filterable = _component$get.filterable
|
|
40
|
+
filterable = _component$get.filterable,
|
|
41
|
+
keepKeywords = _component$get.keepKeywords;
|
|
41
42
|
if (multiple && filterable) {
|
|
42
43
|
focusInput();
|
|
43
44
|
/**
|
|
44
45
|
* don't reset keywords on multiple mode for continue selection
|
|
45
46
|
* https://github.com/ksc-fe/kpc/issues/983
|
|
46
47
|
*/
|
|
47
|
-
|
|
48
|
+
if (!keepKeywords) {
|
|
49
|
+
resetKeywords();
|
|
50
|
+
}
|
|
48
51
|
}
|
|
49
52
|
});
|
|
50
53
|
return {
|
|
@@ -5,6 +5,7 @@ import _JSON$stringify from "@babel/runtime-corejs3/core-js/json/stringify";
|
|
|
5
5
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
6
6
|
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js/instance/find-index";
|
|
7
7
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
8
|
+
import _Array$from from "@babel/runtime-corejs3/core-js/array/from";
|
|
8
9
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
9
10
|
import { __decorate } from "tslib";
|
|
10
11
|
import BasicDemo from '~/components/table/demos/basic';
|
|
@@ -784,21 +785,20 @@ describe('Table', function () {
|
|
|
784
785
|
return wait();
|
|
785
786
|
case 6:
|
|
786
787
|
expect(element.innerHTML).to.matchSnapshot();
|
|
787
|
-
debugger;
|
|
788
788
|
expect(table.getCheckedData()).to.have.lengthOf(8);
|
|
789
789
|
arrow = element.querySelector('.k-table-arrow');
|
|
790
790
|
arrow.click();
|
|
791
|
-
_context21.next =
|
|
791
|
+
_context21.next = 12;
|
|
792
792
|
return wait();
|
|
793
|
-
case
|
|
793
|
+
case 12:
|
|
794
794
|
expect(element.innerHTML).to.matchSnapshot();
|
|
795
795
|
arrow.click();
|
|
796
|
-
_context21.next =
|
|
796
|
+
_context21.next = 16;
|
|
797
797
|
return wait();
|
|
798
|
-
case
|
|
798
|
+
case 16:
|
|
799
799
|
expect(element.innerHTML).to.matchSnapshot();
|
|
800
800
|
expect(table.getCheckedData()).to.have.lengthOf(8);
|
|
801
|
-
case
|
|
801
|
+
case 18:
|
|
802
802
|
case "end":
|
|
803
803
|
return _context21.stop();
|
|
804
804
|
}
|
|
@@ -1102,4 +1102,82 @@ describe('Table', function () {
|
|
|
1102
1102
|
}
|
|
1103
1103
|
}, _callee24);
|
|
1104
1104
|
})));
|
|
1105
|
+
it('fixHeader with Affix header scroll sync', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25() {
|
|
1106
|
+
var Demo, _mount27, instance, element, scrollContainer, affixWrapper1, affixWrapper2, affixWrapper3;
|
|
1107
|
+
return _regeneratorRuntime.wrap(function _callee25$(_context32) {
|
|
1108
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1109
|
+
case 0:
|
|
1110
|
+
Demo = /*#__PURE__*/function (_Component6) {
|
|
1111
|
+
_inheritsLoose(Demo, _Component6);
|
|
1112
|
+
function Demo() {
|
|
1113
|
+
var _context31;
|
|
1114
|
+
var _this5;
|
|
1115
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
1116
|
+
args[_key5] = arguments[_key5];
|
|
1117
|
+
}
|
|
1118
|
+
_this5 = _Component6.call.apply(_Component6, _concatInstanceProperty(_context31 = [this]).call(_context31, args)) || this;
|
|
1119
|
+
_this5.Table = Table;
|
|
1120
|
+
_this5.TableColumn = TableColumn;
|
|
1121
|
+
return _this5;
|
|
1122
|
+
}
|
|
1123
|
+
Demo.defaults = function defaults() {
|
|
1124
|
+
return {
|
|
1125
|
+
data: _Array$from({
|
|
1126
|
+
length: 10
|
|
1127
|
+
}, function (_, i) {
|
|
1128
|
+
return {
|
|
1129
|
+
name: "Name " + i,
|
|
1130
|
+
column1: "Column1 " + i,
|
|
1131
|
+
column2: "Column2 " + i,
|
|
1132
|
+
column3: "Column3 " + i,
|
|
1133
|
+
action: "Action " + i
|
|
1134
|
+
};
|
|
1135
|
+
}),
|
|
1136
|
+
fixHeader: 200,
|
|
1137
|
+
virtual: false,
|
|
1138
|
+
stickScrollbar: false
|
|
1139
|
+
};
|
|
1140
|
+
};
|
|
1141
|
+
return Demo;
|
|
1142
|
+
}(Component);
|
|
1143
|
+
Demo.template = "\n const {Table, TableColumn} = this;\n const {data, fixHeader, virtual, stickScrollbar} = this.get();\n <Table data={data} fixHeader={fixHeader} virtual={virtual} stickScrollbar={stickScrollbar} ref=\"table\">\n <TableColumn fixed=\"left\" key=\"name\" title=\"Name\" width=\"200\" />\n <TableColumn key=\"column1\" title=\"Column1\" width=\"300\" />\n <TableColumn key=\"column2\" title=\"Column2\" width=\"300\" />\n <TableColumn key=\"column3\" title=\"Column3\" width=\"300\" />\n <TableColumn fixed=\"right\" key=\"action\" title=\"Action\" width=\"200\" />\n </Table>\n ";
|
|
1144
|
+
_mount27 = mount(Demo), instance = _mount27[0], element = _mount27[1]; // Test 1: fixHeader only - scroll left 50px
|
|
1145
|
+
_context32.next = 5;
|
|
1146
|
+
return wait();
|
|
1147
|
+
case 5:
|
|
1148
|
+
scrollContainer = element.querySelector('.k-table-wrapper');
|
|
1149
|
+
scrollContainer.scrollLeft = 50;
|
|
1150
|
+
_context32.next = 9;
|
|
1151
|
+
return wait(100);
|
|
1152
|
+
case 9:
|
|
1153
|
+
affixWrapper1 = element.querySelector('.k-table-affix-header .k-affix-wrapper');
|
|
1154
|
+
expect(affixWrapper1.scrollLeft).to.eql(50);
|
|
1155
|
+
// Test 2: fixHeader + virtual - scroll left 50px more (total 100px)
|
|
1156
|
+
instance.set('virtual', true);
|
|
1157
|
+
_context32.next = 14;
|
|
1158
|
+
return wait();
|
|
1159
|
+
case 14:
|
|
1160
|
+
scrollContainer.scrollLeft = 100;
|
|
1161
|
+
_context32.next = 17;
|
|
1162
|
+
return wait(100);
|
|
1163
|
+
case 17:
|
|
1164
|
+
affixWrapper2 = element.querySelector('.k-table-affix-header .k-affix-wrapper');
|
|
1165
|
+
expect(affixWrapper2.scrollLeft).to.eql(100);
|
|
1166
|
+
// Test 3: stickScrollbar + fixHeader - scroll right 50px (back to 50px)
|
|
1167
|
+
instance.set('stickScrollbar', true);
|
|
1168
|
+
_context32.next = 22;
|
|
1169
|
+
return wait();
|
|
1170
|
+
case 22:
|
|
1171
|
+
scrollContainer.scrollLeft = 50;
|
|
1172
|
+
_context32.next = 25;
|
|
1173
|
+
return wait(100);
|
|
1174
|
+
case 25:
|
|
1175
|
+
affixWrapper3 = element.querySelector('.k-table-affix-header .k-affix-wrapper');
|
|
1176
|
+
expect(affixWrapper3.scrollLeft).to.eql(50);
|
|
1177
|
+
case 27:
|
|
1178
|
+
case "end":
|
|
1179
|
+
return _context32.stop();
|
|
1180
|
+
}
|
|
1181
|
+
}, _callee25);
|
|
1182
|
+
})));
|
|
1105
1183
|
});
|
|
@@ -17,7 +17,7 @@ export function useStickyHeader(callbacks) {
|
|
|
17
17
|
});
|
|
18
18
|
// when the scroll element scroll horizontally, scroll the sticky header too
|
|
19
19
|
callbacks.push(function (scrollLeft) {
|
|
20
|
-
if (isNull(stickHeader.value)) return;
|
|
20
|
+
if (isNull(stickHeader.value) && !instance.get('fixHeader')) return;
|
|
21
21
|
var affixHeadWrapper = headRef.value.parentElement;
|
|
22
22
|
affixHeadWrapper.scrollLeft = scrollLeft;
|
|
23
23
|
});
|