@king-design/react 2.0.12 → 2.0.13
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/__tests__/__snapshots__/React Demos.md +59 -59
- package/components/code/index.d.ts +2 -2
- package/components/code/useEditor.js +1 -1
- package/components/drawer/index.spec.js +48 -0
- package/components/dropdown/dropdown.d.ts +2 -1
- package/components/dropdown/dropdown.js +31 -14
- package/components/dropdown/index.spec.js +58 -0
- package/components/portal.js +9 -2
- package/components/select/styles.js +2 -2
- package/components/table/row.d.ts +1 -0
- package/components/table/row.vdt.js +5 -6
- package/components/table/table.d.ts +1 -0
- package/components/table/table.js +4 -2
- package/components/table/table.vdt.js +111 -104
- package/components/timepicker/index.d.ts +1 -0
- package/components/timepicker/index.js +1 -0
- package/components/tooltip/index.d.ts +1 -1
- package/hooks/useDocumentClick.js +29 -2
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, TypeDefs } from 'intact-react';
|
|
2
|
-
import type { editor } from 'monaco-editor';
|
|
2
|
+
import type { editor, default as monaco } from 'monaco-editor';
|
|
3
3
|
import type { Events } from '../types';
|
|
4
4
|
export interface CodeProps {
|
|
5
5
|
value?: string;
|
|
@@ -11,7 +11,7 @@ export interface CodeProps {
|
|
|
11
11
|
options?: editor.IStandaloneEditorConstructionOptions;
|
|
12
12
|
}
|
|
13
13
|
export interface CodeEvents {
|
|
14
|
-
ready: [editor.IStandaloneCodeEditor, typeof editor];
|
|
14
|
+
ready: [editor.IStandaloneCodeEditor, typeof editor, typeof monaco];
|
|
15
15
|
}
|
|
16
16
|
export declare class Code extends Component<CodeProps, CodeEvents> {
|
|
17
17
|
static template: string | import("intact").Template<any>;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
2
4
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
5
|
import BasicDemo from '~/components/drawer/demos/basic';
|
|
4
6
|
import PlacementDemo from '~/components/drawer/demos/placement';
|
|
5
7
|
import overlayDemo from '~/components/drawer/demos/overlay';
|
|
6
8
|
import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/utils';
|
|
9
|
+
import { Component } from 'intact-react';
|
|
10
|
+
import { Drawer } from '.';
|
|
11
|
+
import { Dialog } from '../dialog';
|
|
7
12
|
describe('Drawer', function () {
|
|
8
13
|
afterEach(function (done) {
|
|
9
14
|
unmount();
|
|
@@ -159,4 +164,47 @@ describe('Drawer', function () {
|
|
|
159
164
|
}
|
|
160
165
|
}, _callee4);
|
|
161
166
|
})));
|
|
167
|
+
it('nested dialog', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
168
|
+
var Demo, _mount4, instance, element;
|
|
169
|
+
|
|
170
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context6) {
|
|
171
|
+
while (1) {
|
|
172
|
+
switch (_context6.prev = _context6.next) {
|
|
173
|
+
case 0:
|
|
174
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
175
|
+
_inheritsLoose(Demo, _Component);
|
|
176
|
+
|
|
177
|
+
function Demo() {
|
|
178
|
+
var _context5;
|
|
179
|
+
|
|
180
|
+
var _this;
|
|
181
|
+
|
|
182
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
183
|
+
args[_key] = arguments[_key];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context5 = [this]).call(_context5, args)) || this;
|
|
187
|
+
_this.Dialog = Dialog;
|
|
188
|
+
_this.Drawer = Drawer;
|
|
189
|
+
return _this;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return Demo;
|
|
193
|
+
}(Component);
|
|
194
|
+
|
|
195
|
+
Demo.template = "\n const {Dialog, Drawer} = this;\n <Drawer value={true}>\n <Dialog value={true} ref=\"dialog\">Dialog</Dialog>\n </Drawer>\n ";
|
|
196
|
+
_mount4 = mount(Demo), instance = _mount4[0], element = _mount4[1];
|
|
197
|
+
_context6.next = 5;
|
|
198
|
+
return wait();
|
|
199
|
+
|
|
200
|
+
case 5:
|
|
201
|
+
expect(instance.refs.dialog.dialogRef.value.parentElement.parentElement).to.eql(document.body);
|
|
202
|
+
|
|
203
|
+
case 6:
|
|
204
|
+
case "end":
|
|
205
|
+
return _context6.stop();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}, _callee5);
|
|
209
|
+
})));
|
|
162
210
|
});
|
|
@@ -8,7 +8,7 @@ export declare type PositionShorthand = 'left' | 'bottom' | 'right' | 'top';
|
|
|
8
8
|
export declare const DROPDOWN = "Dropdown";
|
|
9
9
|
export declare const ROOT_DROPDOWN = "RootDropdown";
|
|
10
10
|
export interface DropdownProps {
|
|
11
|
-
trigger?: 'hover' | 'click' | 'contextmenu';
|
|
11
|
+
trigger?: 'hover' | 'click' | 'contextmenu' | 'focus';
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
value?: boolean;
|
|
14
14
|
position?: Position | 'left' | 'bottom' | 'right' | 'top';
|
|
@@ -52,6 +52,7 @@ export declare class Dropdown<T extends DropdownProps = DropdownProps, E extends
|
|
|
52
52
|
private onEnter;
|
|
53
53
|
private onContextMenu;
|
|
54
54
|
private onLeave;
|
|
55
|
+
private initEventCallbacks;
|
|
55
56
|
private callOriginalCallback;
|
|
56
57
|
private normalizeTriggerProps;
|
|
57
58
|
}
|
|
@@ -14,7 +14,7 @@ import { usePosition } from './usePosition';
|
|
|
14
14
|
export var DROPDOWN = 'Dropdown';
|
|
15
15
|
export var ROOT_DROPDOWN = 'RootDropdown';
|
|
16
16
|
var typeDefs = {
|
|
17
|
-
trigger: ['hover', 'click', 'contextmenu'],
|
|
17
|
+
trigger: ['hover', 'click', 'contextmenu', 'focus'],
|
|
18
18
|
disabled: Boolean,
|
|
19
19
|
value: Boolean,
|
|
20
20
|
position: [Object, 'left', 'bottom', 'right', 'top'],
|
|
@@ -154,6 +154,33 @@ export var Dropdown = /*#__PURE__*/function (_Component) {
|
|
|
154
154
|
this.hide();
|
|
155
155
|
};
|
|
156
156
|
|
|
157
|
+
_proto.initEventCallbacks = function initEventCallbacks(trigger) {
|
|
158
|
+
var props = {};
|
|
159
|
+
|
|
160
|
+
switch (trigger) {
|
|
161
|
+
case 'focus':
|
|
162
|
+
props['ev-focusin'] = this.onEnter;
|
|
163
|
+
props['ev-focusout'] = this.onLeave;
|
|
164
|
+
break;
|
|
165
|
+
|
|
166
|
+
case 'contextmenu':
|
|
167
|
+
props['ev-contextmenu'] = this.onContextMenu;
|
|
168
|
+
break;
|
|
169
|
+
|
|
170
|
+
default:
|
|
171
|
+
props['ev-click'] = this.onEnter;
|
|
172
|
+
|
|
173
|
+
if (trigger === 'hover') {
|
|
174
|
+
props['ev-mouseenter'] = this.onEnter;
|
|
175
|
+
props['ev-mouseleave'] = this.onLeave;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return props;
|
|
182
|
+
};
|
|
183
|
+
|
|
157
184
|
_proto.callOriginalCallback = function callOriginalCallback(name, e) {
|
|
158
185
|
var callback = this.triggerProps[name];
|
|
159
186
|
var callbackOnDropdown = this.get(name);
|
|
@@ -229,19 +256,7 @@ Dropdown.template = function () {
|
|
|
229
256
|
trigger = _children[0],
|
|
230
257
|
menu = _children[1];
|
|
231
258
|
var triggerType = this.get('trigger');
|
|
232
|
-
var props =
|
|
233
|
-
|
|
234
|
-
if (triggerType !== 'contextmenu') {
|
|
235
|
-
props['ev-click'] = this.onEnter;
|
|
236
|
-
|
|
237
|
-
if (triggerType === 'hover') {
|
|
238
|
-
props['ev-mouseenter'] = this.onEnter;
|
|
239
|
-
props['ev-mouseleave'] = this.onLeave;
|
|
240
|
-
}
|
|
241
|
-
} else {
|
|
242
|
-
props['ev-contextmenu'] = this.onContextMenu;
|
|
243
|
-
}
|
|
244
|
-
|
|
259
|
+
var props = this.initEventCallbacks(triggerType);
|
|
245
260
|
var clonedTrigger = isTextChildren(trigger) ? createVNode('span', null, trigger) : directClone(trigger);
|
|
246
261
|
var triggerProps = this.triggerProps = this.normalizeTriggerProps(trigger.props || EMPTY_OBJ); // add a className for opening status
|
|
247
262
|
|
|
@@ -275,7 +290,9 @@ function useDocumentClickForDropdown(dropdown) {
|
|
|
275
290
|
var _useDocumentClick = useDocumentClick(elementRef, function (e) {
|
|
276
291
|
// case 1: if click an trigger and the trigger type is hover, ignore it
|
|
277
292
|
// case 2: if right click on trigger and the trigger type is contextmenu, ignore it
|
|
293
|
+
// case 3: if click on trigger and the trigger type is focus, do nothing
|
|
278
294
|
var trigger = dropdown.get('trigger');
|
|
295
|
+
if (trigger === 'focus') return;
|
|
279
296
|
var isHover = trigger === 'hover';
|
|
280
297
|
|
|
281
298
|
if (isHover || trigger === 'contextmenu') {
|
|
@@ -483,4 +483,62 @@ describe('Dropdown', function () {
|
|
|
483
483
|
}
|
|
484
484
|
}, _callee9);
|
|
485
485
|
})));
|
|
486
|
+
it('trigger: focus', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
487
|
+
var Demo, _mount9, instance;
|
|
488
|
+
|
|
489
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context14) {
|
|
490
|
+
while (1) {
|
|
491
|
+
switch (_context14.prev = _context14.next) {
|
|
492
|
+
case 0:
|
|
493
|
+
Demo = /*#__PURE__*/function (_Component4) {
|
|
494
|
+
_inheritsLoose(Demo, _Component4);
|
|
495
|
+
|
|
496
|
+
function Demo() {
|
|
497
|
+
var _context13;
|
|
498
|
+
|
|
499
|
+
var _this4;
|
|
500
|
+
|
|
501
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
502
|
+
args[_key4] = arguments[_key4];
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context13 = [this]).call(_context13, args)) || this;
|
|
506
|
+
_this4.Dropdown = Dropdown;
|
|
507
|
+
_this4.DropdownItem = DropdownItem;
|
|
508
|
+
_this4.DropdownMenu = DropdownMenu;
|
|
509
|
+
return _this4;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
return Demo;
|
|
513
|
+
}(Component);
|
|
514
|
+
|
|
515
|
+
Demo.template = "\n const {Dropdown, DropdownMenu, DropdownItem} = this;\n <div>\n <Dropdown trigger=\"focus\">\n <input ref=\"trigger\" />\n <DropdownMenu>\n <DropdownItem>test1</DropdownItem>\n <DropdownItem>test2</DropdownItem>\n </DropdownMenu>\n </Dropdown>\n </div>\n ";
|
|
516
|
+
_mount9 = mount(Demo), instance = _mount9[0];
|
|
517
|
+
dispatchEvent(instance.refs.trigger, 'focusin');
|
|
518
|
+
_context14.next = 6;
|
|
519
|
+
return wait(500);
|
|
520
|
+
|
|
521
|
+
case 6:
|
|
522
|
+
expect(getElement('.k-dropdown-menu')).to.be.exist; // clicking anywhere should not hide menu
|
|
523
|
+
|
|
524
|
+
dispatchEvent(document, 'click');
|
|
525
|
+
_context14.next = 10;
|
|
526
|
+
return wait(500);
|
|
527
|
+
|
|
528
|
+
case 10:
|
|
529
|
+
expect(getElement('.k-dropdown-menu')).to.be.exist;
|
|
530
|
+
dispatchEvent(instance.refs.trigger, 'focusout');
|
|
531
|
+
_context14.next = 14;
|
|
532
|
+
return wait(700);
|
|
533
|
+
|
|
534
|
+
case 14:
|
|
535
|
+
expect(getElement('.k-dropdown-menu')).to.not.be.exist;
|
|
536
|
+
|
|
537
|
+
case 15:
|
|
538
|
+
case "end":
|
|
539
|
+
return _context14.stop();
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}, _callee10);
|
|
543
|
+
})));
|
|
486
544
|
});
|
package/components/portal.js
CHANGED
|
@@ -3,6 +3,7 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/con
|
|
|
3
3
|
import { Component, createCommentVNode, createTextVNode, mount, patch, remove, inject } from 'intact-react';
|
|
4
4
|
import { isString } from 'intact-shared';
|
|
5
5
|
import { DIALOG } from './dialog/constants';
|
|
6
|
+
import { BaseDialog } from './dialog/base';
|
|
6
7
|
var typeDefs = {
|
|
7
8
|
container: [String, Function]
|
|
8
9
|
};
|
|
@@ -96,8 +97,13 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
if (!this.container) {
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
if (this.$senior instanceof BaseDialog) {
|
|
101
|
+
// Dialog and Drawer must be inserted into document.body
|
|
102
|
+
this.container = document.body;
|
|
103
|
+
} else {
|
|
104
|
+
// find the closest dialog if exists
|
|
105
|
+
this.container = parentDom.closest('.k-dialog') || document.body;
|
|
106
|
+
}
|
|
101
107
|
/**
|
|
102
108
|
* @FIXME: We cannot get parent ref from sub component in Vue
|
|
103
109
|
*/
|
|
@@ -108,6 +114,7 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
108
114
|
// } else {
|
|
109
115
|
// this.container = document.body;
|
|
110
116
|
// }
|
|
117
|
+
|
|
111
118
|
}
|
|
112
119
|
};
|
|
113
120
|
|
|
@@ -94,7 +94,7 @@ var defaults = deepDefaults({
|
|
|
94
94
|
},
|
|
95
95
|
tag: {
|
|
96
96
|
margin: "3px 8px 3px 0",
|
|
97
|
-
padding: "
|
|
97
|
+
padding: "3px 8px",
|
|
98
98
|
|
|
99
99
|
get borderRadius() {
|
|
100
100
|
return theme.borderRadius;
|
|
@@ -188,7 +188,7 @@ setDefault(function () {
|
|
|
188
188
|
}).select;
|
|
189
189
|
});
|
|
190
190
|
export default function makeStyles() {
|
|
191
|
-
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{color:", select.iconColor, ";position:relative;}.k-select-suffix{margin-left:", select.suffixGap, ";}.k-select-placeholder{color:", select.placeholderColor, ";user-select:none;}&.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-block;transition:opacity ", select.transition, ";}.k-select-arrow{display:inline-block;transition:transform ", select.transition, ";&.k-disabled{color:", select.disabledArrowColor, ";}}&.k-dropdown-open{border:", select.focusBorder, ";.k-select-arrow{transform:rotateX(180deg);}}&:focus{outline:none;border:", select.focusBorder, ";}&.k-disabled{color:", select.disabled.color, ";cursor:not-allowed;background:", select.disabled.bgColor, ";border-color:", select.disabled.borderColor, ";.k-select-tag{background:", select.tag.disabledBgColor, ";}}.k-select-values{display:inline-block;margin-right:-", getRight(select.tag.margin), "
|
|
191
|
+
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{color:", select.iconColor, ";position:relative;}.k-select-suffix{margin-left:", select.suffixGap, ";}.k-select-placeholder{color:", select.placeholderColor, ";user-select:none;}&.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-block;transition:opacity ", select.transition, ";}.k-select-arrow{display:inline-block;transition:transform ", select.transition, ";&.k-disabled{color:", select.disabledArrowColor, ";}}&.k-dropdown-open{border:", select.focusBorder, ";.k-select-arrow{transform:rotateX(180deg);}}&:focus{outline:none;border:", select.focusBorder, ";}&.k-disabled{color:", select.disabled.color, ";cursor:not-allowed;background:", select.disabled.bgColor, ";border-color:", select.disabled.borderColor, ";.k-select-tag{background:", select.tag.disabledBgColor, ";}}.k-select-values{display:inline-block;margin-right:-", getRight(select.tag.margin), ";width:100%;&.k-with-values{margin:0;}}.k-select-tag{display:inline-flex;align-items:center;padding:", select.tag.padding, ";background:", select.tag.bgColor, ";border-radius:", select.tag.borderRadius, ";margin:", select.tag.margin, ";max-width:calc(100% - ", getRight(select.tag.margin), " - 1px);}.k-select-text{max-width:calc(100% - 18px);word-break:break-word;}.k-select-close{margin-left:", select.tag.delete.gap, ";font-size:", select.tag.delete.fontSize, ";color:", select.tag.delete.color, ";}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
192
192
|
var styles = select[size];
|
|
193
193
|
var className = /*#__PURE__*/css("font-size:", styles.fontSize, ";min-height:", styles.height, ";padding:", styles.padding, ";");
|
|
194
194
|
if (size === 'default') return className;
|
|
@@ -23,6 +23,7 @@ export interface TableRowProps {
|
|
|
23
23
|
onToggleSpreadRow: (key: TableRowKey) => void;
|
|
24
24
|
onBeforeUnmount: (key: TableRowKey) => void;
|
|
25
25
|
offsetMap: Record<Key, number>;
|
|
26
|
+
animation: boolean;
|
|
26
27
|
draggable: boolean;
|
|
27
28
|
draggingKey: TableRowKey | null;
|
|
28
29
|
onRowDragStart: DragCallback;
|
|
@@ -5,7 +5,7 @@ import { getClassAndStyleForFixed } from './useFixedColumns';
|
|
|
5
5
|
import { Checkbox } from '../checkbox';
|
|
6
6
|
import { Radio } from '../radio';
|
|
7
7
|
import { TableCell } from './cell';
|
|
8
|
-
import { createElementVNode, className as cx } from 'intact';
|
|
8
|
+
import { createElementVNode, className as cx, createFragment } from 'intact';
|
|
9
9
|
export default function ($props, $blocks, $__proto__) {
|
|
10
10
|
var _classNameObj,
|
|
11
11
|
_this = this;
|
|
@@ -34,7 +34,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
34
34
|
key = _this$get.key,
|
|
35
35
|
offsetMap = _this$get.offsetMap,
|
|
36
36
|
draggable = _this$get.draggable,
|
|
37
|
-
draggingKey = _this$get.draggingKey
|
|
37
|
+
draggingKey = _this$get.draggingKey,
|
|
38
|
+
animation = _this$get.animation;
|
|
38
39
|
|
|
39
40
|
var classNameObj = (_classNameObj = {
|
|
40
41
|
'k-disabled': disabled,
|
|
@@ -110,16 +111,14 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
110
111
|
'key': columnKey
|
|
111
112
|
}, columnKey));
|
|
112
113
|
});
|
|
113
|
-
|
|
114
|
-
var rows = _$cc(TransitionGroup, {
|
|
114
|
+
var rows = animation ? _$cc(TransitionGroup, {
|
|
115
115
|
'name': 'k-fade-expand',
|
|
116
116
|
'move': false,
|
|
117
117
|
'children': vNodes
|
|
118
|
-
});
|
|
118
|
+
}) : createFragment(vNodes, 8);
|
|
119
119
|
/* const rows = vNodes; */
|
|
120
120
|
// for performance, no normalize
|
|
121
121
|
|
|
122
|
-
|
|
123
122
|
return createElementVNode(2, 'tr', rows, 2, cx(classNameObj), {
|
|
124
123
|
'data-key': key,
|
|
125
124
|
'ev-mouseenter': this.onMouseEnter,
|
|
@@ -34,6 +34,7 @@ export interface TableProps<T = any, K extends TableRowKey = TableRowKey, C exte
|
|
|
34
34
|
minColWidth?: number;
|
|
35
35
|
widthStoreKey?: string;
|
|
36
36
|
draggable?: boolean;
|
|
37
|
+
animation?: boolean | [boolean, boolean];
|
|
37
38
|
}
|
|
38
39
|
export interface TableEvents<T = any, K extends TableRowKey = number> {
|
|
39
40
|
clickRow: [T, number, K];
|
|
@@ -56,7 +56,8 @@ var typeDefs = {
|
|
|
56
56
|
resizable: Boolean,
|
|
57
57
|
minColWidth: Number,
|
|
58
58
|
widthStoreKey: String,
|
|
59
|
-
draggable: Boolean
|
|
59
|
+
draggable: Boolean,
|
|
60
|
+
animation: [Boolean, Array]
|
|
60
61
|
};
|
|
61
62
|
|
|
62
63
|
var defaults = function defaults() {
|
|
@@ -69,7 +70,8 @@ var defaults = function defaults() {
|
|
|
69
70
|
rowExpandable: true,
|
|
70
71
|
childrenKey: 'children',
|
|
71
72
|
indent: 32,
|
|
72
|
-
minColWidth: 40
|
|
73
|
+
minColWidth: 40,
|
|
74
|
+
animation: true
|
|
73
75
|
};
|
|
74
76
|
};
|
|
75
77
|
|
|
@@ -57,7 +57,10 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
57
57
|
tooltipContainer = _this$get.tooltipContainer,
|
|
58
58
|
showIndeterminate = _this$get.showIndeterminate,
|
|
59
59
|
resizable = _this$get.resizable,
|
|
60
|
-
draggable = _this$get.draggable
|
|
60
|
+
draggable = _this$get.draggable,
|
|
61
|
+
_animation = _this$get.animation;
|
|
62
|
+
|
|
63
|
+
var animation = !Array.isArray(_animation) ? [_animation, _animation] : _animation;
|
|
61
64
|
|
|
62
65
|
var _this$columns$getData = this.columns.getData(),
|
|
63
66
|
columns = _this$columns$getData.columns,
|
|
@@ -130,10 +133,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
130
133
|
'children': _$cc(FixedColumnsContext.Provider, {
|
|
131
134
|
'value': offsetMap,
|
|
132
135
|
'children': _$ce(2, 'thead', _$ma(columns, function ($value, $key) {
|
|
133
|
-
return _$ce(2, 'tr',
|
|
134
|
-
'
|
|
135
|
-
'move': false,
|
|
136
|
-
'children': [$key === 0 && checkType !== 'none' ? _$cv('th', _extends({}, getClassAndStyleForFixed({
|
|
136
|
+
return _$ce(2, 'tr', function () {
|
|
137
|
+
var ths = [$key === 0 && checkType !== 'none' ? _$cv('th', _extends({}, getClassAndStyleForFixed({
|
|
137
138
|
fixed: hasFixedLeft ? 'left' : false
|
|
138
139
|
}, 0), {
|
|
139
140
|
'rowspan': maxRows,
|
|
@@ -143,8 +144,13 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
143
144
|
'indeterminate': showIndeterminate && allCheckedStatus == AllCheckedStatus.Indeterminate,
|
|
144
145
|
'ev-$change:value': toggleCheckedAll,
|
|
145
146
|
'disabled': !hasData
|
|
146
|
-
}) : undefined) : undefined, $value]
|
|
147
|
-
|
|
147
|
+
}) : undefined) : undefined, $value];
|
|
148
|
+
return animation[1] ? _$cc(TransitionGroup, {
|
|
149
|
+
'name': 'k-fade-expand',
|
|
150
|
+
'move': false,
|
|
151
|
+
'children': ths
|
|
152
|
+
}) : ths;
|
|
153
|
+
}(), 0);
|
|
148
154
|
}, $this), 4)
|
|
149
155
|
})
|
|
150
156
|
})
|
|
@@ -181,115 +187,116 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
181
187
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
182
188
|
}, __$blocks['empty'](_$no)), 0, 'k-table-empty', {
|
|
183
189
|
'colspan': colCount
|
|
184
|
-
}), 2, null, null, 'table-empty') :
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
var spreaded = isSpreaded(key);
|
|
195
|
-
var hasChildren = !!childrenKey && Array.isArray(value[childrenKey]);
|
|
196
|
-
var indentSize = indent ? indent * level : 0;
|
|
190
|
+
}), 2, null, null, 'table-empty') : function () {
|
|
191
|
+
var rows = [];
|
|
192
|
+
loopData(function (value, index, level, hidden) {
|
|
193
|
+
// don't render if row is hidden
|
|
194
|
+
if (hidden) return hidden;
|
|
195
|
+
var status = allStatus[index];
|
|
196
|
+
var key = allKeys[index];
|
|
197
|
+
var spreaded = isSpreaded(key);
|
|
198
|
+
var hasChildren = !!childrenKey && Array.isArray(value[childrenKey]);
|
|
199
|
+
var indentSize = indent ? indent * level : 0;
|
|
197
200
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
201
|
+
var row = _$cc(TableRow, {
|
|
202
|
+
'key': key,
|
|
203
|
+
'cols': cols,
|
|
204
|
+
'data': value,
|
|
205
|
+
'checkType': checkType,
|
|
206
|
+
'hasFixedLeft': hasFixedLeft,
|
|
207
|
+
'onClick': _this.clickRow,
|
|
208
|
+
'checked': status.checked,
|
|
209
|
+
'indeterminate': status.indeterminate,
|
|
210
|
+
'index': index,
|
|
211
|
+
'disabled': status.disabled,
|
|
212
|
+
'allDisabled': status.allDisabled,
|
|
213
|
+
'className': _$cn(rowClassName && rowClassName(value, index, key)),
|
|
214
|
+
'merge': merge,
|
|
215
|
+
'grid': getGrid(),
|
|
216
|
+
'onChangeChecked': onChangeChecked,
|
|
217
|
+
'selected': isSelected(key),
|
|
218
|
+
'spreaded': spreaded,
|
|
219
|
+
'hasChildren': hasChildren,
|
|
220
|
+
'indent': indentSize,
|
|
221
|
+
'onToggleSpreadRow': toggleSpreadRow,
|
|
222
|
+
'onBeforeUnmount': _this.resetRowStatus.onRowBeforeUnmount,
|
|
223
|
+
'offsetMap': offsetMap,
|
|
224
|
+
'animation': animation[1],
|
|
225
|
+
'draggable': draggable,
|
|
226
|
+
'draggingKey': draggingKey.value,
|
|
227
|
+
'onRowDragStart': onRowDragStart,
|
|
228
|
+
'onRowDragEnd': onRowDragEnd,
|
|
229
|
+
'onRowDragOver': onRowDragOver
|
|
230
|
+
}, key);
|
|
227
231
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
232
|
+
if ($blocks.tooltip) {
|
|
233
|
+
var content = (_$blocks['tooltip'] = function ($super) {
|
|
234
|
+
return null;
|
|
235
|
+
}, __$blocks['tooltip'] = function ($super, data) {
|
|
236
|
+
var block = $blocks['tooltip'];
|
|
233
237
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
238
|
+
var callBlock = function callBlock() {
|
|
239
|
+
return _$blocks['tooltip'].call($this, $super, data);
|
|
240
|
+
};
|
|
237
241
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
242
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
243
|
+
}, __$blocks['tooltip'](_$no, [value, index]));
|
|
244
|
+
row = _$cc(Tooltip, {
|
|
245
|
+
'key': key,
|
|
246
|
+
'position': tooltipPosition,
|
|
247
|
+
'container': tooltipContainer,
|
|
248
|
+
'children': row,
|
|
249
|
+
'$blocks': function ($blocks) {
|
|
250
|
+
var _$blocks = {},
|
|
251
|
+
__$blocks = _$ex({}, $blocks);
|
|
248
252
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
+
return (_$blocks['content'] = function ($super) {
|
|
254
|
+
return content;
|
|
255
|
+
}, __$blocks['content'] = function ($super, data) {
|
|
256
|
+
var block = $blocks['content'];
|
|
253
257
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
258
|
+
var callBlock = function callBlock() {
|
|
259
|
+
return _$blocks['content'].call($this, $super, data);
|
|
260
|
+
};
|
|
257
261
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
262
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
263
|
+
}), __$blocks;
|
|
264
|
+
}.call($this, _$em)
|
|
265
|
+
}, key);
|
|
266
|
+
}
|
|
263
267
|
|
|
264
|
-
|
|
268
|
+
rows.push(row);
|
|
265
269
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
if ($blocks.expand) {
|
|
271
|
+
var expanded = isExpanded(key);
|
|
272
|
+
rows.push(_$ce(2, 'tr', _$ce(2, 'td', _$cc(Transition, _extends({}, expandAnimationCallbacks, {
|
|
273
|
+
'children': expanded ? _$ce(2, 'div', (_$blocks['expand'] = function ($super) {
|
|
274
|
+
return null;
|
|
275
|
+
}, __$blocks['expand'] = function ($super, data) {
|
|
276
|
+
var block = $blocks['expand'];
|
|
273
277
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
278
|
+
var callBlock = function callBlock() {
|
|
279
|
+
return _$blocks['expand'].call($this, $super, data);
|
|
280
|
+
};
|
|
277
281
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
282
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
283
|
+
}, __$blocks['expand'](_$no, [value, index])), 0, 'k-table-expand') : undefined
|
|
284
|
+
})), 2, null, {
|
|
285
|
+
'colspan': colCount
|
|
286
|
+
}), 2, _$cn({
|
|
287
|
+
"k-expand": true,
|
|
288
|
+
'k-expanded': expanded
|
|
289
|
+
}), null, key + ".$expand"));
|
|
290
|
+
}
|
|
287
291
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
292
|
+
return hidden || !spreaded;
|
|
293
|
+
});
|
|
294
|
+
return animation[0] ? _$cc(TransitionGroup, {
|
|
295
|
+
'name': 'k-fade-in-left',
|
|
296
|
+
'move': !draggingKey.value,
|
|
297
|
+
'children': rows
|
|
298
|
+
}) : rows;
|
|
299
|
+
}(), 0);
|
|
293
300
|
|
|
294
301
|
var tableWidthPx = tableWidth.value ? tableWidth.value + "px" : null;
|
|
295
302
|
var _this$stickyScrollbar = this.stickyScrollbar,
|
|
@@ -3,6 +3,7 @@ import { TimepickerProps, TimepickerEvents, TimepickerBlocks } from './constants
|
|
|
3
3
|
import { SelectPicker } from './selectPicker';
|
|
4
4
|
export type { TimepickerProps, TimepickerEvents, TimepickerBlocks };
|
|
5
5
|
export declare class Timepicker<Multipe extends boolean = false, Range extends boolean = false> extends Component<TimepickerProps<Multipe, Range>, TimepickerEvents, TimepickerBlocks<Range>> {
|
|
6
|
+
static $doubleVNodes: boolean;
|
|
6
7
|
static template(this: Timepicker): import("intact").VNode<typeof SelectPicker>;
|
|
7
8
|
static typeDefs: Required<import("intact").TypeDefs<TimepickerProps<boolean, boolean>>>;
|
|
8
9
|
}
|