@king-design/intact 2.0.7 → 2.0.9
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/datepicker/index.spec.ts +16 -10
- package/components/dialog/useEscClosable.ts +7 -3
- package/components/dropdown/useKeyboard.ts +1 -1
- package/components/layout/demos/asideFix.md +3 -1
- package/components/layout/demos/fix.md +3 -1
- package/components/portal.ts +20 -22
- package/components/table/styles.ts +11 -0
- package/components/table/useFixedColumns.ts +2 -1
- package/es/components/datepicker/index.spec.js +28 -22
- package/es/components/dialog/useEscClosable.js +9 -3
- package/es/components/dropdown/useKeyboard.js +2 -2
- package/es/components/portal.d.ts +1 -0
- package/es/components/portal.js +11 -11
- package/es/components/table/styles.js +5 -1
- package/es/components/table/useFixedColumns.d.ts +1 -1
- package/es/components/table/useFixedColumns.js +3 -2
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/packages/kpc-react/__tests__/components/{form.spec.d.ts → drawer.spec.d.ts} +0 -0
- package/es/packages/kpc-react/__tests__/components/drawer.spec.js +99 -0
- package/es/packages/kpc-react/__tests__/components/dropdown.spec.js +107 -1
- package/es/packages/kpc-react/__tests__/components/menu.spec.d.ts +1 -0
- package/es/packages/kpc-react/__tests__/components/menu.spec.js +76 -0
- package/es/packages/kpc-react/__tests__/components/tooltip.spec.d.ts +1 -0
- package/es/packages/kpc-react/__tests__/components/{form.spec.js → tooltip.spec.js} +1 -1
- package/es/site/data/components/layout/demos/asideFix/react.js +6 -4
- package/es/site/data/components/layout/demos/fix/react.js +6 -4
- package/index.ts +2 -2
- package/package.json +3 -3
|
@@ -142,32 +142,38 @@ describe('Datepicker', () => {
|
|
|
142
142
|
const [monthValues1, monthValues2]= content.querySelectorAll<HTMLElement>('.k-month-values');
|
|
143
143
|
|
|
144
144
|
nextMonth.click();
|
|
145
|
+
const monthStart = (month + 1) % 12 + 1;
|
|
146
|
+
const yearStart = year + Math.floor((month + 1) / 12);
|
|
147
|
+
const monthEnd = (month + 2) % 12 + 1;
|
|
148
|
+
const yearEnd = year + Math.floor((month + 2) / 12);
|
|
145
149
|
await wait();
|
|
146
|
-
expect(monthValues1.textContent).to.eql(`${
|
|
147
|
-
expect(monthValues2.textContent).to.eql(`${
|
|
150
|
+
expect(monthValues1.textContent).to.eql(`${yearStart}年${monthStart}月`);
|
|
151
|
+
expect(monthValues2.textContent).to.eql(`${yearEnd}年${monthEnd}月`);
|
|
148
152
|
|
|
149
153
|
nextYear.click();
|
|
150
154
|
await wait();
|
|
151
|
-
expect(monthValues1.textContent).to.eql(`${
|
|
152
|
-
expect(monthValues2.textContent).to.eql(`${
|
|
155
|
+
expect(monthValues1.textContent).to.eql(`${yearStart + 1}年${monthStart}月`);
|
|
156
|
+
expect(monthValues2.textContent).to.eql(`${yearEnd + 1}年${monthEnd}月`);
|
|
153
157
|
|
|
154
158
|
const [prevYear] = panel2.querySelectorAll<HTMLElement>('.k-prev');
|
|
155
159
|
prevYear.click();
|
|
156
160
|
await wait();
|
|
157
|
-
expect(monthValues1.textContent).to.eql(`${
|
|
158
|
-
expect(monthValues2.textContent).to.eql(`${
|
|
161
|
+
expect(monthValues1.textContent).to.eql(`${yearStart}年${monthStart}月`);
|
|
162
|
+
expect(monthValues2.textContent).to.eql(`${yearEnd}年${monthEnd}月`);
|
|
159
163
|
|
|
160
164
|
// year panel
|
|
161
165
|
dispatchEvent(monthValues1.firstElementChild!, 'click');
|
|
162
166
|
dispatchEvent(monthValues2.firstElementChild!, 'click');
|
|
163
167
|
await wait();
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
const firstDecadeStart = Math.floor(yearStart / 10) * 10;
|
|
169
|
+
const secondDecadeStart = Math.floor(yearEnd / 10) * 10;
|
|
170
|
+
expect(monthValues1.textContent).to.eql(`${firstDecadeStart}年 - ${firstDecadeStart + 9}年`);
|
|
171
|
+
expect(monthValues1.textContent).to.eql(`${secondDecadeStart}年 - ${secondDecadeStart + 9}年`);
|
|
166
172
|
|
|
167
173
|
nextYear.click();
|
|
168
174
|
await wait();
|
|
169
|
-
expect(monthValues1.textContent).to.eql(`${
|
|
170
|
-
expect(monthValues1.textContent).to.eql(
|
|
175
|
+
expect(monthValues1.textContent).to.eql(`${firstDecadeStart + 10}年 - ${secondDecadeStart + 19}年`);
|
|
176
|
+
expect(monthValues1.textContent).to.eql(`${secondDecadeStart + 10}年 - ${secondDecadeStart + 19}年`);
|
|
171
177
|
});
|
|
172
178
|
|
|
173
179
|
it('range year', async () => {
|
|
@@ -22,13 +22,17 @@ export function useEscClosable() {
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
function onHide() {
|
|
25
|
-
|
|
25
|
+
// the order is uncertain in different frameworks
|
|
26
|
+
const index = dialogs.indexOf(instance);
|
|
27
|
+
// const dialog = dialogs.pop();
|
|
26
28
|
// const dialog = dialogs.shift();
|
|
27
29
|
if (process.env.NODE_ENV !== 'production') {
|
|
28
|
-
if (dialog !== instance) {
|
|
29
|
-
|
|
30
|
+
// if (dialog !== instance) {
|
|
31
|
+
if (index === -1) {
|
|
32
|
+
throw new Error('The dialog has handled hide callback. Maybe it is a bug of KPC');
|
|
30
33
|
}
|
|
31
34
|
}
|
|
35
|
+
dialogs.splice(0, index);
|
|
32
36
|
|
|
33
37
|
if (!dialogs.length) {
|
|
34
38
|
document.removeEventListener('keydown', escClose);
|
package/components/portal.ts
CHANGED
|
@@ -6,14 +6,10 @@ import {
|
|
|
6
6
|
createCommentVNode,
|
|
7
7
|
createTextVNode,
|
|
8
8
|
mount,
|
|
9
|
-
removeVNodeDom,
|
|
10
9
|
patch,
|
|
11
10
|
remove,
|
|
12
11
|
TypeDefs,
|
|
13
|
-
provide,
|
|
14
12
|
inject,
|
|
15
|
-
nextTick,
|
|
16
|
-
callAll,
|
|
17
13
|
} from 'intact';
|
|
18
14
|
import {isString} from 'intact-shared';
|
|
19
15
|
import {DIALOG} from './dialog/constants';
|
|
@@ -42,6 +38,7 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
|
42
38
|
private dialog: Dialog | null = inject(DIALOG, null);
|
|
43
39
|
public mountedQueue?: Function[];
|
|
44
40
|
public mountedDone?: boolean;
|
|
41
|
+
public $isPortal = true;
|
|
45
42
|
|
|
46
43
|
$render(
|
|
47
44
|
lastVNode: VNodeComponentClass<this> | null,
|
|
@@ -50,28 +47,29 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
|
50
47
|
anchor: IntactDom | null,
|
|
51
48
|
mountedQueue: Function[]
|
|
52
49
|
) {
|
|
50
|
+
/**
|
|
51
|
+
* In React, we cannot render real elements in mountedQueue.
|
|
52
|
+
* Because the rendering time of react element is uncontrollable
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
const nextProps = nextVNode.props!;
|
|
56
|
+
const fakeContainer = document.createDocumentFragment();
|
|
57
|
+
|
|
53
58
|
mountedQueue.push(() => {
|
|
54
|
-
const nextProps = nextVNode.props!;
|
|
55
59
|
const parentDom = this.$lastInput!.dom!.parentElement!;
|
|
56
|
-
/**
|
|
57
|
-
* initialize a new mountedQueue to place the callbacks of sub-components to it,
|
|
58
|
-
* so that we can call them before the sibling components of the Portal
|
|
59
|
-
*/
|
|
60
|
-
const mountedQueue: Function[] = [];
|
|
61
60
|
this.initContainer(nextProps.container, parentDom, anchor);
|
|
62
|
-
|
|
63
|
-
mount(
|
|
64
|
-
nextProps.children as VNode,
|
|
65
|
-
this.container!,
|
|
66
|
-
this,
|
|
67
|
-
this.$SVG,
|
|
68
|
-
null,
|
|
69
|
-
mountedQueue,
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
callAll(mountedQueue);
|
|
61
|
+
this.container!.appendChild(fakeContainer);
|
|
73
62
|
});
|
|
74
63
|
|
|
64
|
+
mount(
|
|
65
|
+
nextProps.children as VNode,
|
|
66
|
+
fakeContainer as any,
|
|
67
|
+
this,
|
|
68
|
+
this.$SVG,
|
|
69
|
+
null,
|
|
70
|
+
mountedQueue,
|
|
71
|
+
);
|
|
72
|
+
|
|
75
73
|
super.$render(lastVNode, nextVNode, parentDom, anchor, mountedQueue);
|
|
76
74
|
}
|
|
77
75
|
|
|
@@ -135,7 +133,7 @@ export class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
|
135
133
|
if (!this.container) {
|
|
136
134
|
// find the closest dialog if exists
|
|
137
135
|
let tmp;
|
|
138
|
-
if ((tmp = this.dialog) && (tmp = tmp.dialogRef.value)) {
|
|
136
|
+
if ((tmp = this.dialog) && (tmp !== this.$senior) && (tmp = tmp.dialogRef.value)) {
|
|
139
137
|
this.container = tmp;
|
|
140
138
|
} else {
|
|
141
139
|
this.container = document.body;
|
|
@@ -63,6 +63,8 @@ const defaults = {
|
|
|
63
63
|
draggingOpacity: `.4`,
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
+
const aligns = ['left', 'right', 'center'];
|
|
67
|
+
|
|
66
68
|
let table: typeof defaults;
|
|
67
69
|
setDefault(() => {
|
|
68
70
|
table = deepDefaults(theme, {table: defaults}).table;
|
|
@@ -350,6 +352,15 @@ export function makeStyles() {
|
|
|
350
352
|
.k-table-scrollbar-inner {
|
|
351
353
|
height: 1px;
|
|
352
354
|
}
|
|
355
|
+
|
|
356
|
+
// align
|
|
357
|
+
${aligns.map(type => {
|
|
358
|
+
return css`
|
|
359
|
+
.k-align-${type} {
|
|
360
|
+
text-align: ${type};
|
|
361
|
+
}
|
|
362
|
+
`;
|
|
363
|
+
})}
|
|
353
364
|
`;
|
|
354
365
|
}
|
|
355
366
|
|
|
@@ -144,7 +144,7 @@ export function useFixedColumns(
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
export function getClassAndStyleForFixed(
|
|
147
|
-
{className, fixed}: Props<TableColumnProps>,
|
|
147
|
+
{className, fixed, align}: Props<TableColumnProps>,
|
|
148
148
|
offset: number,
|
|
149
149
|
checkType?: TableProps['checkType'],
|
|
150
150
|
) {
|
|
@@ -153,6 +153,7 @@ export function getClassAndStyleForFixed(
|
|
|
153
153
|
className: cx({
|
|
154
154
|
[className as string]: !!className,
|
|
155
155
|
[`k-fixed-${fixed}`]: !!fixed,
|
|
156
|
+
[`k-align-${align}`]: !!align,
|
|
156
157
|
}),
|
|
157
158
|
style: fixed ? {[fixed]: `${offset + extraOffset}px`} : null,
|
|
158
159
|
};
|
|
@@ -234,7 +234,7 @@ describe('Datepicker', function () {
|
|
|
234
234
|
}, _callee6);
|
|
235
235
|
})));
|
|
236
236
|
it('range date', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
237
|
-
var _mount6, instance, element, select, content, _content$querySelecto, panel1, panel2, _panel1$querySelector, nextMonth, nextYear, _content$querySelecto2, monthValues1, monthValues2, _panel2$querySelector, prevYear;
|
|
237
|
+
var _mount6, instance, element, select, content, _content$querySelecto, panel1, panel2, _panel1$querySelector, nextMonth, nextYear, _content$querySelecto2, monthValues1, monthValues2, monthStart, yearStart, monthEnd, yearEnd, _panel2$querySelector, prevYear, firstDecadeStart, secondDecadeStart;
|
|
238
238
|
|
|
239
239
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
240
240
|
while (1) {
|
|
@@ -252,45 +252,51 @@ describe('Datepicker', function () {
|
|
|
252
252
|
_panel1$querySelector = panel1.querySelectorAll('.k-next'), nextMonth = _panel1$querySelector[0], nextYear = _panel1$querySelector[1];
|
|
253
253
|
_content$querySelecto2 = content.querySelectorAll('.k-month-values'), monthValues1 = _content$querySelecto2[0], monthValues2 = _content$querySelecto2[1];
|
|
254
254
|
nextMonth.click();
|
|
255
|
-
|
|
255
|
+
monthStart = (month + 1) % 12 + 1;
|
|
256
|
+
yearStart = year + Math.floor((month + 1) / 12);
|
|
257
|
+
monthEnd = (month + 2) % 12 + 1;
|
|
258
|
+
yearEnd = year + Math.floor((month + 2) / 12);
|
|
259
|
+
_context7.next = 16;
|
|
256
260
|
return wait();
|
|
257
261
|
|
|
258
|
-
case
|
|
259
|
-
expect(monthValues1.textContent).to.eql(
|
|
260
|
-
expect(monthValues2.textContent).to.eql(
|
|
262
|
+
case 16:
|
|
263
|
+
expect(monthValues1.textContent).to.eql(yearStart + "\u5E74" + monthStart + "\u6708");
|
|
264
|
+
expect(monthValues2.textContent).to.eql(yearEnd + "\u5E74" + monthEnd + "\u6708");
|
|
261
265
|
nextYear.click();
|
|
262
|
-
_context7.next =
|
|
266
|
+
_context7.next = 21;
|
|
263
267
|
return wait();
|
|
264
268
|
|
|
265
|
-
case
|
|
266
|
-
expect(monthValues1.textContent).to.eql(
|
|
267
|
-
expect(monthValues2.textContent).to.eql(
|
|
269
|
+
case 21:
|
|
270
|
+
expect(monthValues1.textContent).to.eql(yearStart + 1 + "\u5E74" + monthStart + "\u6708");
|
|
271
|
+
expect(monthValues2.textContent).to.eql(yearEnd + 1 + "\u5E74" + monthEnd + "\u6708");
|
|
268
272
|
_panel2$querySelector = panel2.querySelectorAll('.k-prev'), prevYear = _panel2$querySelector[0];
|
|
269
273
|
prevYear.click();
|
|
270
|
-
_context7.next =
|
|
274
|
+
_context7.next = 27;
|
|
271
275
|
return wait();
|
|
272
276
|
|
|
273
|
-
case
|
|
274
|
-
expect(monthValues1.textContent).to.eql(
|
|
275
|
-
expect(monthValues2.textContent).to.eql(
|
|
277
|
+
case 27:
|
|
278
|
+
expect(monthValues1.textContent).to.eql(yearStart + "\u5E74" + monthStart + "\u6708");
|
|
279
|
+
expect(monthValues2.textContent).to.eql(yearEnd + "\u5E74" + monthEnd + "\u6708"); // year panel
|
|
276
280
|
|
|
277
281
|
dispatchEvent(monthValues1.firstElementChild, 'click');
|
|
278
282
|
dispatchEvent(monthValues2.firstElementChild, 'click');
|
|
279
|
-
_context7.next =
|
|
283
|
+
_context7.next = 33;
|
|
280
284
|
return wait();
|
|
281
285
|
|
|
282
|
-
case
|
|
283
|
-
|
|
284
|
-
|
|
286
|
+
case 33:
|
|
287
|
+
firstDecadeStart = Math.floor(yearStart / 10) * 10;
|
|
288
|
+
secondDecadeStart = Math.floor(yearEnd / 10) * 10;
|
|
289
|
+
expect(monthValues1.textContent).to.eql(firstDecadeStart + "\u5E74 - " + (firstDecadeStart + 9) + "\u5E74");
|
|
290
|
+
expect(monthValues1.textContent).to.eql(secondDecadeStart + "\u5E74 - " + (secondDecadeStart + 9) + "\u5E74");
|
|
285
291
|
nextYear.click();
|
|
286
|
-
_context7.next =
|
|
292
|
+
_context7.next = 40;
|
|
287
293
|
return wait();
|
|
288
294
|
|
|
289
|
-
case
|
|
290
|
-
expect(monthValues1.textContent).to.eql(
|
|
291
|
-
expect(monthValues1.textContent).to.eql(
|
|
295
|
+
case 40:
|
|
296
|
+
expect(monthValues1.textContent).to.eql(firstDecadeStart + 10 + "\u5E74 - " + (secondDecadeStart + 19) + "\u5E74");
|
|
297
|
+
expect(monthValues1.textContent).to.eql(secondDecadeStart + 10 + "\u5E74 - " + (secondDecadeStart + 19) + "\u5E74");
|
|
292
298
|
|
|
293
|
-
case
|
|
299
|
+
case 42:
|
|
294
300
|
case "end":
|
|
295
301
|
return _context7.stop();
|
|
296
302
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/splice";
|
|
1
2
|
import { useInstance, onUnmounted } from 'intact';
|
|
2
3
|
import { SHOW, HIDE } from './constants'; // only close the top dialog when press ESC
|
|
3
4
|
|
|
@@ -22,14 +23,19 @@ export function useEscClosable() {
|
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
function onHide() {
|
|
25
|
-
|
|
26
|
+
// the order is uncertain in different frameworks
|
|
27
|
+
var index = dialogs.indexOf(instance); // const dialog = dialogs.pop();
|
|
28
|
+
// const dialog = dialogs.shift();
|
|
26
29
|
|
|
27
30
|
if (process.env.NODE_ENV !== 'production') {
|
|
28
|
-
if (dialog !== instance) {
|
|
29
|
-
|
|
31
|
+
// if (dialog !== instance) {
|
|
32
|
+
if (index === -1) {
|
|
33
|
+
throw new Error('The dialog has handled hide callback. Maybe it is a bug of KPC');
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
36
|
|
|
37
|
+
_spliceInstanceProperty(dialogs).call(dialogs, 0, index);
|
|
38
|
+
|
|
33
39
|
if (!dialogs.length) {
|
|
34
40
|
document.removeEventListener('keydown', escClose);
|
|
35
41
|
}
|
|
@@ -123,8 +123,8 @@ export function useMenuKeyboard() {
|
|
|
123
123
|
reset: reset,
|
|
124
124
|
focus: function focus(item) {
|
|
125
125
|
// reset();
|
|
126
|
-
var index = items.indexOf(item);
|
|
127
|
-
|
|
126
|
+
var index = items.indexOf(item); // if (index === -1) debugger
|
|
127
|
+
|
|
128
128
|
focusIndex = index;
|
|
129
129
|
focusItem(item);
|
|
130
130
|
}
|
|
@@ -10,6 +10,7 @@ export declare class Portal<T extends PortalProps = PortalProps> extends Compone
|
|
|
10
10
|
private dialog;
|
|
11
11
|
mountedQueue?: Function[];
|
|
12
12
|
mountedDone?: boolean;
|
|
13
|
+
$isPortal: boolean;
|
|
13
14
|
$render(lastVNode: VNodeComponentClass<this> | null, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[]): void;
|
|
14
15
|
$update(lastVNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this>, parentDom: Element, anchor: IntactDom | null, mountedQueue: Function[], force: boolean): void;
|
|
15
16
|
$unmount(vNode: VNodeComponentClass<this>, nextVNode: VNodeComponentClass<this> | null): void;
|
package/es/components/portal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
-
import { Component, createCommentVNode, createTextVNode, mount, patch, remove, inject
|
|
3
|
+
import { Component, createCommentVNode, createTextVNode, mount, patch, remove, inject } from 'intact';
|
|
4
4
|
import { isString } from 'intact-shared';
|
|
5
5
|
import { DIALOG } from './dialog/constants';
|
|
6
6
|
var typeDefs = {
|
|
@@ -23,6 +23,7 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
23
23
|
_this.dialog = inject(DIALOG, null);
|
|
24
24
|
_this.mountedQueue = void 0;
|
|
25
25
|
_this.mountedDone = void 0;
|
|
26
|
+
_this.$isPortal = true;
|
|
26
27
|
return _this;
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -39,21 +40,20 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
39
40
|
_proto.$render = function $render(lastVNode, nextVNode, parentDom, anchor, mountedQueue) {
|
|
40
41
|
var _this2 = this;
|
|
41
42
|
|
|
43
|
+
/**
|
|
44
|
+
* In React, we cannot render real elements in mountedQueue.
|
|
45
|
+
* Because the rendering time of react element is uncontrollable
|
|
46
|
+
*/
|
|
47
|
+
var nextProps = nextVNode.props;
|
|
48
|
+
var fakeContainer = document.createDocumentFragment();
|
|
42
49
|
mountedQueue.push(function () {
|
|
43
|
-
var nextProps = nextVNode.props;
|
|
44
50
|
var parentDom = _this2.$lastInput.dom.parentElement;
|
|
45
|
-
/**
|
|
46
|
-
* initialize a new mountedQueue to place the callbacks of sub-components to it,
|
|
47
|
-
* so that we can call them before the sibling components of the Portal
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
var mountedQueue = [];
|
|
51
51
|
|
|
52
52
|
_this2.initContainer(nextProps.container, parentDom, anchor);
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
callAll(mountedQueue);
|
|
54
|
+
_this2.container.appendChild(fakeContainer);
|
|
56
55
|
});
|
|
56
|
+
mount(nextProps.children, fakeContainer, this, this.$SVG, null, mountedQueue);
|
|
57
57
|
|
|
58
58
|
_Component.prototype.$render.call(this, lastVNode, nextVNode, parentDom, anchor, mountedQueue);
|
|
59
59
|
};
|
|
@@ -99,7 +99,7 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
99
99
|
// find the closest dialog if exists
|
|
100
100
|
var tmp;
|
|
101
101
|
|
|
102
|
-
if ((tmp = this.dialog) && (tmp = tmp.dialogRef.value)) {
|
|
102
|
+
if ((tmp = this.dialog) && tmp !== this.$senior && (tmp = tmp.dialogRef.value)) {
|
|
103
103
|
this.container = tmp;
|
|
104
104
|
} else {
|
|
105
105
|
this.container = document.body;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _sortInstanceProperty from "@babel/runtime-corejs3/core-js/instance/sort";
|
|
2
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
2
3
|
import { css } from '@emotion/css';
|
|
3
4
|
import { theme, setDefault } from '../../styles/theme';
|
|
4
5
|
import { deepDefaults, palette } from '../../styles/utils';
|
|
@@ -75,6 +76,7 @@ var defaults = {
|
|
|
75
76
|
resizeWidth: "5px",
|
|
76
77
|
draggingOpacity: ".4"
|
|
77
78
|
};
|
|
79
|
+
var aligns = ['left', 'right', 'center'];
|
|
78
80
|
var table;
|
|
79
81
|
setDefault(function () {
|
|
80
82
|
table = deepDefaults(theme, {
|
|
@@ -82,7 +84,9 @@ setDefault(function () {
|
|
|
82
84
|
}).table;
|
|
83
85
|
});
|
|
84
86
|
export function makeStyles() {
|
|
85
|
-
return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";border-top:", table.border, ";position:relative;z-index:0;.k-table-wrapper{border-bottom:", table.border, ";overflow:auto;}table{width:100%;border-spacing:0;table-layout:fixed;td,th{transition:all ", table.transition, ";}}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, ";}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";border-bottom:", table.border, ";&: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%;}.k-table-title-text{flex:1;}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-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{width:", table.group.width, "!important;height:", table.group.width, "!important;margin-left:", table.group.gap, ";position:relative;color:", table.group.color, ";&:hover{color:", theme.color.primary, ";}.k-icon{transition:transform ", table.transition, ";}&.k-dropdown-open .k-icon{transform:rotate(180deg);}}.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-left:", _sortInstanceProperty(table).gap, ";color:", _sortInstanceProperty(table).color, ";}&.k-asc .k-icon.k-desc,&.k-desc .k-icon.k-asc{color:", _sortInstanceProperty(table).disabledColor, ";}}.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{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;}")
|
|
87
|
+
return /*#__PURE__*/css("font-size:", table.fontSize, ";color:", table.color, ";border-top:", table.border, ";position:relative;z-index:0;.k-table-wrapper{border-bottom:", table.border, ";overflow:auto;}table{width:100%;border-spacing:0;table-layout:fixed;td,th{transition:all ", table.transition, ";}}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, ";}}th{padding:", table.thead.padding, ";position:relative;background:", table.thead.bgColor, ";border-bottom:", table.border, ";&: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%;}.k-table-title-text{flex:1;}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-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{width:", table.group.width, "!important;height:", table.group.width, "!important;margin-left:", table.group.gap, ";position:relative;color:", table.group.color, ";&:hover{color:", theme.color.primary, ";}.k-icon{transition:transform ", table.transition, ";}&.k-dropdown-open .k-icon{transform:rotate(180deg);}}.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-left:", _sortInstanceProperty(table).gap, ";color:", _sortInstanceProperty(table).color, ";}&.k-asc .k-icon.k-desc,&.k-desc .k-icon.k-asc{color:", _sortInstanceProperty(table).disabledColor, ";}}.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{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) {
|
|
88
|
+
return /*#__PURE__*/css(".k-align-", type, "{text-align:", type, ";}");
|
|
89
|
+
}), ";");
|
|
86
90
|
}
|
|
87
91
|
export function makeGroupMenuStyles() {
|
|
88
92
|
return /*#__PURE__*/css("max-height:", table.group.menuMaxHeight, ";overflow:auto;.k-dropdown-item.k-active{color:", table.group.activeColor, ";}");
|
|
@@ -15,7 +15,7 @@ export declare function useFixedColumns(getColumns: () => VNodeComponentClass<Ta
|
|
|
15
15
|
getHasFixedLeft: () => boolean;
|
|
16
16
|
getOffsetMap: () => Record<Key, number>;
|
|
17
17
|
};
|
|
18
|
-
export declare function getClassAndStyleForFixed({ className, fixed }: Props<TableColumnProps>, offset: number, checkType?: TableProps['checkType']): {
|
|
18
|
+
export declare function getClassAndStyleForFixed({ className, fixed, align }: Props<TableColumnProps>, offset: number, checkType?: TableProps['checkType']): {
|
|
19
19
|
className: string;
|
|
20
20
|
style: {
|
|
21
21
|
[x: string]: string;
|
|
@@ -125,10 +125,11 @@ export function getClassAndStyleForFixed(_ref2, offset, checkType) {
|
|
|
125
125
|
var _cx, _ref3;
|
|
126
126
|
|
|
127
127
|
var className = _ref2.className,
|
|
128
|
-
fixed = _ref2.fixed
|
|
128
|
+
fixed = _ref2.fixed,
|
|
129
|
+
align = _ref2.align;
|
|
129
130
|
var extraOffset = checkType && checkType !== 'none' && fixed === 'left' ? 40 : 0;
|
|
130
131
|
return {
|
|
131
|
-
className: cx((_cx = {}, _cx[className] = !!className, _cx["k-fixed-" + fixed] = !!fixed, _cx)),
|
|
132
|
+
className: cx((_cx = {}, _cx[className] = !!className, _cx["k-fixed-" + fixed] = !!fixed, _cx["k-align-" + align] = !!align, _cx)),
|
|
132
133
|
style: fixed ? (_ref3 = {}, _ref3[fixed] = offset + extraOffset + "px", _ref3) : null
|
|
133
134
|
};
|
|
134
135
|
}
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.9
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -57,4 +57,4 @@ export * from './components/tree';
|
|
|
57
57
|
export * from './components/treeSelect';
|
|
58
58
|
export * from './components/upload';
|
|
59
59
|
export * from './components/wave';
|
|
60
|
-
export declare const version = "2.0.
|
|
60
|
+
export declare const version = "2.0.9";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.9
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -59,5 +59,5 @@ export * from './components/tree';
|
|
|
59
59
|
export * from './components/treeSelect';
|
|
60
60
|
export * from './components/upload';
|
|
61
61
|
export * from './components/wave';
|
|
62
|
-
export var version = '2.0.
|
|
62
|
+
export var version = '2.0.9';
|
|
63
63
|
/* generate end */
|
|
File without changes
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import * as ReactDOM from 'react-dom';
|
|
6
|
+
import { Drawer, Card } from '../../';
|
|
7
|
+
import { Component } from 'intact-react';
|
|
8
|
+
import { wait, dispatchEvent } from '../../../../test/utils';
|
|
9
|
+
describe('Drawer', function () {
|
|
10
|
+
it('should render react element correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
11
|
+
var container, Test;
|
|
12
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
13
|
+
while (1) {
|
|
14
|
+
switch (_context.prev = _context.next) {
|
|
15
|
+
case 0:
|
|
16
|
+
container = document.createElement('div');
|
|
17
|
+
document.body.appendChild(container);
|
|
18
|
+
|
|
19
|
+
Test = /*#__PURE__*/function (_Component) {
|
|
20
|
+
_inheritsLoose(Test, _Component);
|
|
21
|
+
|
|
22
|
+
function Test() {
|
|
23
|
+
return _Component.apply(this, arguments) || this;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var _proto = Test.prototype;
|
|
27
|
+
|
|
28
|
+
_proto.mounted = function mounted() {
|
|
29
|
+
expect(document.body.contains(this.refs.a));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return Test;
|
|
33
|
+
}(Component);
|
|
34
|
+
|
|
35
|
+
Test.template = "<div ref=\"a\">test</div>";
|
|
36
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Drawer, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Test, null)))), container);
|
|
37
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
38
|
+
document.body.removeChild(container);
|
|
39
|
+
|
|
40
|
+
case 7:
|
|
41
|
+
case "end":
|
|
42
|
+
return _context.stop();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, _callee);
|
|
46
|
+
})));
|
|
47
|
+
it('should handle event correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
48
|
+
var container, click1, click2, _document$querySelect, element1, element2;
|
|
49
|
+
|
|
50
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
51
|
+
while (1) {
|
|
52
|
+
switch (_context2.prev = _context2.next) {
|
|
53
|
+
case 0:
|
|
54
|
+
container = document.createElement('div');
|
|
55
|
+
document.body.appendChild(container);
|
|
56
|
+
click1 = sinon.spy(function () {
|
|
57
|
+
return console.log(1);
|
|
58
|
+
});
|
|
59
|
+
click2 = sinon.spy(function () {
|
|
60
|
+
return console.log(2);
|
|
61
|
+
});
|
|
62
|
+
ReactDOM.render( /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Drawer, {
|
|
63
|
+
value: true,
|
|
64
|
+
title: "1"
|
|
65
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "click",
|
|
67
|
+
onClick: click1
|
|
68
|
+
}, "click")), /*#__PURE__*/React.createElement(Drawer, {
|
|
69
|
+
value: true,
|
|
70
|
+
placement: "left",
|
|
71
|
+
title: "2"
|
|
72
|
+
}, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
|
|
73
|
+
className: "click",
|
|
74
|
+
onClick: click2
|
|
75
|
+
}, "click")))), container);
|
|
76
|
+
_document$querySelect = document.querySelectorAll('.click'), element1 = _document$querySelect[0], element2 = _document$querySelect[1];
|
|
77
|
+
dispatchEvent(element1, 'click');
|
|
78
|
+
_context2.next = 9;
|
|
79
|
+
return wait();
|
|
80
|
+
|
|
81
|
+
case 9:
|
|
82
|
+
expect(click1.callCount).to.eql(1);
|
|
83
|
+
dispatchEvent(element2, 'click');
|
|
84
|
+
_context2.next = 13;
|
|
85
|
+
return wait();
|
|
86
|
+
|
|
87
|
+
case 13:
|
|
88
|
+
expect(click2.callCount).to.eql(1);
|
|
89
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
90
|
+
document.body.removeChild(container);
|
|
91
|
+
|
|
92
|
+
case 16:
|
|
93
|
+
case "end":
|
|
94
|
+
return _context2.stop();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}, _callee2);
|
|
98
|
+
})));
|
|
99
|
+
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
3
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
4
|
import React, { createRef } from 'react';
|
|
4
5
|
import * as ReactDOM from 'react-dom';
|
|
5
|
-
import { Dropdown, DropdownMenu, DropdownItem } from '../../';
|
|
6
|
+
import { Dropdown, DropdownMenu, DropdownItem, Dialog, Layout } from '../../';
|
|
6
7
|
import { getElement, wait } from '../../../../test/utils';
|
|
8
|
+
import { Component } from 'intact-react';
|
|
7
9
|
describe('Dropdown', function () {
|
|
8
10
|
it('should save original events', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
9
11
|
var click, container, button;
|
|
@@ -38,4 +40,108 @@ describe('Dropdown', function () {
|
|
|
38
40
|
}
|
|
39
41
|
}, _callee);
|
|
40
42
|
})));
|
|
43
|
+
it('reproduce #764', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
44
|
+
var _mounted, _updated, Demo, FooDialog, Foo, set, Test, container;
|
|
45
|
+
|
|
46
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
47
|
+
while (1) {
|
|
48
|
+
switch (_context2.prev = _context2.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
_mounted = sinon.spy(function () {
|
|
51
|
+
return console.log('mounted');
|
|
52
|
+
});
|
|
53
|
+
_updated = sinon.spy(function () {
|
|
54
|
+
return console.log('updated');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
58
|
+
_inheritsLoose(Demo, _Component);
|
|
59
|
+
|
|
60
|
+
function Demo() {
|
|
61
|
+
return _Component.apply(this, arguments) || this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var _proto = Demo.prototype;
|
|
65
|
+
|
|
66
|
+
_proto.mounted = function mounted() {
|
|
67
|
+
_mounted();
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
_proto.updated = function updated() {
|
|
71
|
+
_updated();
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return Demo;
|
|
75
|
+
}(Component);
|
|
76
|
+
|
|
77
|
+
Demo.template = "<div>demo {this.get('title')}</div>";
|
|
78
|
+
|
|
79
|
+
FooDialog = function FooDialog() {
|
|
80
|
+
var _React$useState = React.useState({
|
|
81
|
+
title: '0'
|
|
82
|
+
}),
|
|
83
|
+
title = _React$useState[0],
|
|
84
|
+
setTitle = _React$useState[1];
|
|
85
|
+
|
|
86
|
+
React.useEffect(function () {
|
|
87
|
+
setTitle({
|
|
88
|
+
title: '1'
|
|
89
|
+
});
|
|
90
|
+
}, []);
|
|
91
|
+
return /*#__PURE__*/React.createElement(Dialog, {
|
|
92
|
+
title: title.title,
|
|
93
|
+
value: true
|
|
94
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Demo, {
|
|
95
|
+
title: title.title
|
|
96
|
+
})));
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
Foo = function Foo(_ref3) {
|
|
100
|
+
var data = _ref3.data;
|
|
101
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FooDialog, null));
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
Test = function Test() {
|
|
105
|
+
var _React$useState2 = React.useState(false),
|
|
106
|
+
isFoo = _React$useState2[0],
|
|
107
|
+
setIsFoo = _React$useState2[1];
|
|
108
|
+
|
|
109
|
+
var _React$useState3 = React.useState([{
|
|
110
|
+
label: 1,
|
|
111
|
+
key: 1
|
|
112
|
+
}]),
|
|
113
|
+
data = _React$useState3[0],
|
|
114
|
+
setData = _React$useState3[1];
|
|
115
|
+
|
|
116
|
+
set = setIsFoo;
|
|
117
|
+
return /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement("div", {
|
|
118
|
+
onClick: function onClick() {
|
|
119
|
+
return setIsFoo(!isFoo);
|
|
120
|
+
}
|
|
121
|
+
}, "toggle"), isFoo ? /*#__PURE__*/React.createElement(Foo, {
|
|
122
|
+
key: "foo",
|
|
123
|
+
data: data
|
|
124
|
+
}) : /*#__PURE__*/React.createElement("div", null, "test"));
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
container = document.createElement('div');
|
|
128
|
+
document.body.appendChild(container);
|
|
129
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(Test, null), container);
|
|
130
|
+
set(true);
|
|
131
|
+
_context2.next = 13;
|
|
132
|
+
return wait(0);
|
|
133
|
+
|
|
134
|
+
case 13:
|
|
135
|
+
expect(getElement('.k-dialog')).to.be.exist;
|
|
136
|
+
expect(_mounted.calledBefore(_updated)).to.be.true;
|
|
137
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
138
|
+
document.body.removeChild(container);
|
|
139
|
+
|
|
140
|
+
case 17:
|
|
141
|
+
case "end":
|
|
142
|
+
return _context2.stop();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, _callee2);
|
|
146
|
+
})));
|
|
41
147
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import * as ReactDOM from 'react-dom';
|
|
5
|
+
import { Menu, MenuItem } from '../../';
|
|
6
|
+
import { getElement, wait } from '../../../../test/utils';
|
|
7
|
+
describe('Menu', function () {
|
|
8
|
+
it('when we collapse menu, all dropdown menus should be hidden', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
9
|
+
var container, AsideMenu, setCollapse, Test;
|
|
10
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
11
|
+
while (1) {
|
|
12
|
+
switch (_context.prev = _context.next) {
|
|
13
|
+
case 0:
|
|
14
|
+
container = document.createElement('div');
|
|
15
|
+
document.body.appendChild(container);
|
|
16
|
+
|
|
17
|
+
AsideMenu = function AsideMenu(_ref2) {
|
|
18
|
+
var collapse = _ref2.collapse;
|
|
19
|
+
|
|
20
|
+
var _useState = useState(''),
|
|
21
|
+
selectedKey = _useState[0],
|
|
22
|
+
setSelectedKey = _useState[1];
|
|
23
|
+
|
|
24
|
+
return /*#__PURE__*/React.createElement(Menu, {
|
|
25
|
+
collapse: collapse,
|
|
26
|
+
selectedKey: selectedKey
|
|
27
|
+
}, /*#__PURE__*/React.createElement(MenuItem, {
|
|
28
|
+
key: "1"
|
|
29
|
+
}, "option 1", /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(MenuItem, {
|
|
30
|
+
key: "1-1"
|
|
31
|
+
}, /*#__PURE__*/React.createElement("span", null, "option 1-1")))), /*#__PURE__*/React.createElement(MenuItem, {
|
|
32
|
+
key: "2"
|
|
33
|
+
}, "option 2", /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(MenuItem, {
|
|
34
|
+
key: "2-1"
|
|
35
|
+
}, /*#__PURE__*/React.createElement("span", null, "option 2-1")))), /*#__PURE__*/React.createElement(MenuItem, {
|
|
36
|
+
key: "3"
|
|
37
|
+
}, "option 2", /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(MenuItem, {
|
|
38
|
+
key: "2-1"
|
|
39
|
+
}, /*#__PURE__*/React.createElement("span", null, "option 2-1")), /*#__PURE__*/React.createElement(MenuItem, {
|
|
40
|
+
key: "2-2"
|
|
41
|
+
}, /*#__PURE__*/React.createElement("span", null, "option 2-1")))));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
Test = function Test() {
|
|
45
|
+
var _useState2 = useState(false),
|
|
46
|
+
collapse = _useState2[0],
|
|
47
|
+
_setCollapse = _useState2[1];
|
|
48
|
+
|
|
49
|
+
setCollapse = _setCollapse;
|
|
50
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
onClick: function onClick() {
|
|
52
|
+
return _setCollapse(!collapse);
|
|
53
|
+
}
|
|
54
|
+
}, "click"), /*#__PURE__*/React.createElement(AsideMenu, {
|
|
55
|
+
collapse: collapse
|
|
56
|
+
}));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(Test, null), container);
|
|
60
|
+
setCollapse(true);
|
|
61
|
+
_context.next = 8;
|
|
62
|
+
return wait();
|
|
63
|
+
|
|
64
|
+
case 8:
|
|
65
|
+
expect(getElement('.k-dropdown-menu.k-menu')).to.be.not.exist;
|
|
66
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
67
|
+
document.body.removeChild(container);
|
|
68
|
+
|
|
69
|
+
case 11:
|
|
70
|
+
case "end":
|
|
71
|
+
return _context.stop();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}, _callee);
|
|
75
|
+
})));
|
|
76
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
import * as ReactDOM from 'react-dom';
|
|
5
5
|
import { Tooltip, Form, FormItem } from '../../';
|
|
6
6
|
import { getElement, wait, dispatchEvent } from '../../../../test/utils';
|
|
7
|
-
describe('
|
|
7
|
+
describe('Tooltip', function () {
|
|
8
8
|
it('should show Tooltip in append slot', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
9
9
|
var click, container, trigger;
|
|
10
10
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
3
4
|
import { __decorate } from "tslib";
|
|
4
5
|
import React from 'react';
|
|
5
6
|
import { Layout, Header, Aside, Body, Menu, MenuItem, Icon, Breadcrumb, BreadcrumbItem, Button } from '@king-design/react';
|
|
@@ -39,7 +40,8 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
_proto.render = function render() {
|
|
42
|
-
var _this2 = this
|
|
43
|
+
var _this2 = this,
|
|
44
|
+
_context2;
|
|
43
45
|
|
|
44
46
|
return /*#__PURE__*/React.createElement(Layout, {
|
|
45
47
|
className: "layout"
|
|
@@ -112,9 +114,9 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
112
114
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
113
115
|
className: "ion-navicon",
|
|
114
116
|
size: "30"
|
|
115
|
-
}))), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement(Breadcrumb, null, /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Home"), /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Detail")),
|
|
116
|
-
"
|
|
117
|
-
}
|
|
117
|
+
}))), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement(Breadcrumb, null, /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Home"), /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Detail")), _mapInstanceProperty(_context2 = this.state.data).call(_context2, function ($value, $key) {
|
|
118
|
+
return /*#__PURE__*/React.createElement("div", null, "content");
|
|
119
|
+
}))));
|
|
118
120
|
};
|
|
119
121
|
|
|
120
122
|
return Demo;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { Layout, Header, Aside, Body, Menu, MenuItem, Icon, Breadcrumb, BreadcrumbItem } from '@king-design/react';
|
|
5
6
|
import './index.styl';
|
|
@@ -30,7 +31,8 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
30
31
|
var _proto = Demo.prototype;
|
|
31
32
|
|
|
32
33
|
_proto.render = function render() {
|
|
33
|
-
var _this2 = this
|
|
34
|
+
var _this2 = this,
|
|
35
|
+
_context2;
|
|
34
36
|
|
|
35
37
|
return /*#__PURE__*/React.createElement(Layout, {
|
|
36
38
|
className: "layout"
|
|
@@ -114,9 +116,9 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
114
116
|
key: "4"
|
|
115
117
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
116
118
|
className: "ion-gear-b"
|
|
117
|
-
}), "menu 4"))), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement(Breadcrumb, null, /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Home"), /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Detail")),
|
|
118
|
-
"
|
|
119
|
-
}
|
|
119
|
+
}), "menu 4"))), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement(Breadcrumb, null, /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Home"), /*#__PURE__*/React.createElement(BreadcrumbItem, null, "Detail")), _mapInstanceProperty(_context2 = this.state.data).call(_context2, function ($value, $key) {
|
|
120
|
+
return /*#__PURE__*/React.createElement("div", null, "content");
|
|
121
|
+
}))));
|
|
120
122
|
};
|
|
121
123
|
|
|
122
124
|
return Demo;
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.9
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -62,6 +62,6 @@ export * from './components/treeSelect';
|
|
|
62
62
|
export * from './components/upload';
|
|
63
63
|
export * from './components/wave';
|
|
64
64
|
|
|
65
|
-
export const version = '2.0.
|
|
65
|
+
export const version = '2.0.9';
|
|
66
66
|
|
|
67
67
|
/* generate end */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@king-design/intact",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "A component library written in Intact for Intact, Vue, React and Angular",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"highlight.js": "^10.4.1",
|
|
117
117
|
"history": "^5.0.0",
|
|
118
118
|
"html-webpack-plugin": "5.3.1",
|
|
119
|
-
"intact-react": "^3.0.
|
|
119
|
+
"intact-react": "^3.0.9",
|
|
120
120
|
"istanbul-instrumenter-loader": "^3.0.0",
|
|
121
121
|
"js-yaml": "^4.1.0",
|
|
122
122
|
"karma": "^6.3.2",
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"dayjs": "^1.10.7",
|
|
179
179
|
"downloadjs": "^1.4.7",
|
|
180
180
|
"enquire.js": "^2.1.6",
|
|
181
|
-
"intact": "^3.0.
|
|
181
|
+
"intact": "^3.0.10",
|
|
182
182
|
"monaco-editor": "^0.26.1",
|
|
183
183
|
"mxgraphx": "^4.0.7",
|
|
184
184
|
"resize-observer-polyfill": "^1.5.1",
|