@king-design/intact 2.0.3 → 2.0.6
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/dialog/demos/block.md +9 -5
- package/components/dialog/index.md +1 -0
- package/components/dialog/index.ts +8 -7
- package/components/dialog/staticMethods.ts +6 -2
- package/components/table/cell.ts +4 -0
- package/components/table/index.spec.ts +38 -54
- package/components/table/useChecked.ts +1 -1
- package/es/components/cascader/index.d.ts +34 -0
- package/es/components/datepicker/index.d.ts +63 -0
- package/es/components/diagram/index.d.ts +1 -1
- package/es/components/dialog/index.js +6 -5
- package/es/components/dialog/staticMethods.d.ts +1 -0
- package/es/components/dialog/staticMethods.js +3 -2
- package/es/components/select/select.d.ts +33 -0
- package/es/components/steps/context.d.ts +2 -2
- package/es/components/table/cell.js +5 -0
- package/es/components/table/index.spec.js +76 -52
- package/es/components/table/useChecked.js +1 -1
- package/es/components/timepicker/panelPicker.d.ts +54 -0
- package/es/components/treeSelect/index.d.ts +27 -0
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/packages/kpc-react/__tests__/index.js +1 -1
- package/es/site/data/components/menu/demos/collapse/react.d.ts +1 -1
- package/es/site/data/components/menu/demos/size/react.d.ts +1 -1
- package/index.ts +2 -2
- package/package.json +6 -4
|
@@ -50,10 +50,12 @@ import {Button, Dialog} from 'kpc';
|
|
|
50
50
|
<Button @click="show = true" type="primary">Show Dialog</Button>
|
|
51
51
|
<Button @click="show1 = true" type="primary">Show No Footer Dialog</Button>
|
|
52
52
|
<Dialog v-model="show">
|
|
53
|
-
<
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
<template slot="header">
|
|
54
|
+
<div class="k-title">
|
|
55
|
+
<i class="ion-person"></i>
|
|
56
|
+
Custom Header
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
57
59
|
|
|
58
60
|
Dialog Body
|
|
59
61
|
|
|
@@ -65,7 +67,9 @@ import {Button, Dialog} from 'kpc';
|
|
|
65
67
|
</Dialog>
|
|
66
68
|
<Dialog v-model="show1" title="No Footer">
|
|
67
69
|
<template slot="body">body</template>
|
|
68
|
-
<
|
|
70
|
+
<template slot="footer-wrapper">
|
|
71
|
+
<div></div>
|
|
72
|
+
</template>
|
|
69
73
|
</Dialog>
|
|
70
74
|
</div>
|
|
71
75
|
```
|
|
@@ -101,6 +101,7 @@ export type Container = string | ((parentDom: Element, anchor: Node | null) => E
|
|
|
101
101
|
| size | 弹窗尺寸 | `"large"` | `"default"` | `"small"` | `"mini"` | `"default"` |
|
|
102
102
|
| hideIcon | 是否隐藏提示图标 | `boolean` | `false` |
|
|
103
103
|
| hideFooter | 是否隐藏底部按钮 | `boolean` | `false` |
|
|
104
|
+
| ref | 传入一个函数,组件会调用该函数,将当前`Dialog`实例传入 | `(i: Dialog) => void` | `undefined` |
|
|
104
105
|
|
|
105
106
|
其中`Promise`对象会在点击“确定”按钮时`resolve()`,在点击“取消”按钮时`reject()`,你可以在`then()`
|
|
106
107
|
中书写用户点击不同按钮的逻辑
|
|
@@ -15,11 +15,11 @@ export class BaseDialog<
|
|
|
15
15
|
public useAsComponent = false;
|
|
16
16
|
|
|
17
17
|
constructor(
|
|
18
|
-
props: Props<P, BaseDialog> | null | undefined = null
|
|
19
|
-
$vNode: VNodeComponentClass =
|
|
18
|
+
props: Props<P, BaseDialog> | null | undefined = null,
|
|
19
|
+
$vNode: VNodeComponentClass = createVNode(BaseDialog),
|
|
20
20
|
$SVG: boolean = false,
|
|
21
21
|
$mountedQueue: Function[] = [],
|
|
22
|
-
$senior: ComponentClass | null = null
|
|
22
|
+
$senior: ComponentClass | null = null,
|
|
23
23
|
) {
|
|
24
24
|
super(props, $vNode, $SVG, $mountedQueue, $senior);
|
|
25
25
|
}
|
|
@@ -27,11 +27,12 @@ export class BaseDialog<
|
|
|
27
27
|
init() {
|
|
28
28
|
super.init();
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (this.$vNode) {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
if (this.$vNode.tag !== BaseDialog) {
|
|
33
32
|
this.useAsComponent = true;
|
|
34
33
|
}
|
|
34
|
+
|
|
35
|
+
usePosition(this.dialogRef);
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
public show() {
|
|
@@ -50,7 +51,7 @@ export class BaseDialog<
|
|
|
50
51
|
// use as intance
|
|
51
52
|
const mountedQueue = this.$mountedQueue;
|
|
52
53
|
this.$init(null);
|
|
53
|
-
const vNode = this.$vNode
|
|
54
|
+
const vNode = this.$vNode;
|
|
54
55
|
vNode.children = this;
|
|
55
56
|
this.$render(null, vNode, document.body, null, mountedQueue);
|
|
56
57
|
callAll(mountedQueue);
|
|
@@ -7,6 +7,7 @@ export interface AlertDialogProps extends DialogProps {
|
|
|
7
7
|
type?: 'success' | 'warning' | 'error' | 'confirm'
|
|
8
8
|
hideIcon?: boolean
|
|
9
9
|
hideFooter?: boolean
|
|
10
|
+
ref?: (i: Dialog) => void
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export type StaticMethod = (options?: AlertDialogProps) => Promise<void>
|
|
@@ -24,9 +25,12 @@ export function addStaticMethods(Component: typeof Dialog) {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
function show(options: AlertDialogProps = {}) {
|
|
28
|
+
const dialog = new AlertDialog(options);
|
|
29
|
+
dialog.show();
|
|
30
|
+
|
|
31
|
+
if (options.ref) options.ref(dialog);
|
|
32
|
+
|
|
27
33
|
return new Promise<void>((resolve, reject) => {
|
|
28
|
-
const dialog = new AlertDialog(options, null as unknown as VNodeComponentClass<any>, false, [], null);
|
|
29
|
-
dialog.show();
|
|
30
34
|
dialog.on('ok', () => {
|
|
31
35
|
resolve();
|
|
32
36
|
});
|
package/components/table/cell.ts
CHANGED
|
@@ -521,58 +521,42 @@ describe('Table', () => {
|
|
|
521
521
|
expect(instance.get('checkedKeys')).to.eql([3, 4, 1, 2]);
|
|
522
522
|
});
|
|
523
523
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
// document.body.appendChild(container);
|
|
563
|
-
// const app = new Vue({
|
|
564
|
-
// render: h => h('Demo'),
|
|
565
|
-
// components: {
|
|
566
|
-
// Demo
|
|
567
|
-
// }
|
|
568
|
-
// }).$mount(container);
|
|
569
|
-
|
|
570
|
-
// // should show the first dropdown menu
|
|
571
|
-
// app.$el.querySelector('.k-icon').click();
|
|
572
|
-
// const dropdownMenu = app.$el.querySelectorAll('.k-dropdown-menu')[0];
|
|
573
|
-
// expect(dropdownMenu.style.display).to.eql('');
|
|
574
|
-
|
|
575
|
-
// app.$destroy();
|
|
576
|
-
// document.body.removeChild(app.$el);
|
|
577
|
-
// });
|
|
524
|
+
it('should update children in TableCell', async() => {
|
|
525
|
+
const update = sinon.spy();
|
|
526
|
+
class Test extends Component {
|
|
527
|
+
static template = `<div>test</div>`;
|
|
528
|
+
beforeUpdate() {
|
|
529
|
+
update();
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
class Demo extends Component<{data: any[], checkedKeys: number[]}> {
|
|
533
|
+
static template = `
|
|
534
|
+
const {Table, TableColumn, Test} = this;
|
|
535
|
+
<Table data={this.get('data')} ref="table">
|
|
536
|
+
<TableColumn key="a">
|
|
537
|
+
<b:template>
|
|
538
|
+
<Test />
|
|
539
|
+
</b:template>
|
|
540
|
+
</TableColumn>
|
|
541
|
+
</Table>
|
|
542
|
+
`;
|
|
543
|
+
static defaults() {
|
|
544
|
+
return {
|
|
545
|
+
data: [
|
|
546
|
+
{a: 1},
|
|
547
|
+
{a: 2},
|
|
548
|
+
],
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
private Table = Table;
|
|
552
|
+
private TableColumn = TableColumn;
|
|
553
|
+
private Test = Test;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const [instance, element] = mount(Demo);
|
|
557
|
+
element.querySelector<HTMLElement>('tbody tr')!.click();
|
|
558
|
+
|
|
559
|
+
await wait();
|
|
560
|
+
expect(update.callCount).to.eql(1);
|
|
561
|
+
});
|
|
578
562
|
});
|
|
@@ -202,7 +202,7 @@ export function useChecked(
|
|
|
202
202
|
instance.on('$change:data', updateAllCheckedStatus);
|
|
203
203
|
|
|
204
204
|
instance.on('clickRow', (data: any, index: number, key: TableRowKey) => {
|
|
205
|
-
if (instance.get('rowCheckable')) {
|
|
205
|
+
if (instance.get('rowCheckable') && instance.get('checkType') !== 'none') {
|
|
206
206
|
toggleChecked(key, index);
|
|
207
207
|
}
|
|
208
208
|
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TypeDefs } from 'intact';
|
|
2
|
+
import { BaseSelect, BaseSelectProps, BaseSelectEvents, BaseSelectBlocks } from '../select/base';
|
|
3
|
+
export interface CascaderProps<V = any, Multipe extends boolean = boolean> extends BaseSelectProps<V[], Multipe> {
|
|
4
|
+
data?: CascaderData<V>[];
|
|
5
|
+
trigger?: 'click' | 'hover';
|
|
6
|
+
changeOnSelect?: boolean;
|
|
7
|
+
format?: (labels: string[]) => string;
|
|
8
|
+
loadData?: (data: CascaderData<V>) => any;
|
|
9
|
+
filter?: (keywords: string, data: CascaderData<V>) => boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare type CascaderData<V> = {
|
|
12
|
+
value: V;
|
|
13
|
+
label: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
loaded?: boolean;
|
|
16
|
+
children?: CascaderData<V>[];
|
|
17
|
+
};
|
|
18
|
+
export interface CascaderEvents extends BaseSelectEvents {
|
|
19
|
+
}
|
|
20
|
+
export interface CascaderBlocks<V> extends BaseSelectBlocks<V> {
|
|
21
|
+
}
|
|
22
|
+
export declare class Cascader<V = any, Multipe extends boolean = false> extends BaseSelect<CascaderProps<V, Multipe>, CascaderEvents, CascaderBlocks<V>> {
|
|
23
|
+
static template: string | import("intact").Template<any>;
|
|
24
|
+
static typeDefs: Required<TypeDefs<CascaderProps<any, boolean>>>;
|
|
25
|
+
static defaults: () => Partial<CascaderProps<any, boolean>>;
|
|
26
|
+
private value;
|
|
27
|
+
private label;
|
|
28
|
+
private load;
|
|
29
|
+
private filterable;
|
|
30
|
+
private positionObj;
|
|
31
|
+
protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | import("intact").Children[];
|
|
32
|
+
protected getLabel(): import("intact").Children;
|
|
33
|
+
protected hasValue(): any;
|
|
34
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TypeDefs } from 'intact';
|
|
2
|
+
import dayjs from './dayjs';
|
|
3
|
+
import { State } from '../../hooks/useState';
|
|
4
|
+
import { Shortcut } from './shortcuts';
|
|
5
|
+
import { BasePicker, BasePickerProps, BasePickerEvents, BasePickerBlocks, Value } from './basepicker';
|
|
6
|
+
export * as shortcuts from './shortcuts';
|
|
7
|
+
export interface DatepickerProps<V extends Value = Value, M extends boolean = boolean, R extends boolean = boolean> extends BasePickerProps<V extends string ? V : V | string, M, R> {
|
|
8
|
+
type?: 'date' | 'datetime' | 'year' | 'month';
|
|
9
|
+
shortcuts?: Shortcut[];
|
|
10
|
+
}
|
|
11
|
+
export interface DatepickerEvents extends BasePickerEvents {
|
|
12
|
+
}
|
|
13
|
+
export interface DatepickerBlocks<V extends Value = Value, R extends boolean = boolean> extends BasePickerBlocks<V, R> {
|
|
14
|
+
}
|
|
15
|
+
export declare class Datepicker<V extends Value = Value, M extends boolean = false, R extends boolean = false> extends BasePicker<DatepickerProps<V, M, R>, DatepickerEvents, DatepickerBlocks<V, R>> {
|
|
16
|
+
static template: string | import("intact").Template<any>;
|
|
17
|
+
static typeDefs: Required<TypeDefs<DatepickerProps<Value, boolean, boolean>>>;
|
|
18
|
+
static defaults: () => Partial<DatepickerProps<Value, boolean, boolean>>;
|
|
19
|
+
formats: {
|
|
20
|
+
getValueFormat: () => string;
|
|
21
|
+
getShowFormat: () => string;
|
|
22
|
+
createDateByValueFormat: (value: Value) => dayjs.Dayjs;
|
|
23
|
+
createDateByShowFormat: (value: string) => dayjs.Dayjs;
|
|
24
|
+
getShowString: (value: dayjs.Dayjs) => string;
|
|
25
|
+
getValueString: (value: dayjs.Dayjs) => string;
|
|
26
|
+
};
|
|
27
|
+
disabled: {
|
|
28
|
+
isDisabled: (value: dayjs.Dayjs, type?: dayjs.OpUnitType) => boolean;
|
|
29
|
+
isDisabledTime: (value: dayjs.Dayjs, flag: import("./usePanel").PanelFlags) => boolean;
|
|
30
|
+
isDisabledConfirm: () => boolean;
|
|
31
|
+
maxDate: State<dayjs.Dayjs | null>;
|
|
32
|
+
minDate: State<dayjs.Dayjs | null>;
|
|
33
|
+
};
|
|
34
|
+
panel: {
|
|
35
|
+
startPanel: State<import("./usePanel").PanelTypes>;
|
|
36
|
+
endPanel: State<import("./usePanel").PanelTypes>;
|
|
37
|
+
changePanel: (type: import("./usePanel").PanelTypes, flag?: import("./usePanel").PanelFlags) => void;
|
|
38
|
+
getPanel: (flag: import("./usePanel").PanelFlags) => State<import("./usePanel").PanelTypes>;
|
|
39
|
+
reset: () => void;
|
|
40
|
+
startRef: import("intact").RefObject<import("./calendar").DatepickerCalendar>;
|
|
41
|
+
endRef: import("intact").RefObject<import("./calendar").DatepickerCalendar>;
|
|
42
|
+
};
|
|
43
|
+
focusDate: {
|
|
44
|
+
focusDate: State<dayjs.Dayjs | null>;
|
|
45
|
+
reset: () => void;
|
|
46
|
+
};
|
|
47
|
+
value: {
|
|
48
|
+
format: () => string | string[];
|
|
49
|
+
onConfirm: () => void;
|
|
50
|
+
onChangeTime: (date: dayjs.Dayjs, flag: import("./usePanel").PanelFlags) => void;
|
|
51
|
+
getTimeValue: (flag: import("./usePanel").PanelFlags) => dayjs.Dayjs | null | undefined;
|
|
52
|
+
convertToDayjs: (v: Value | [Value, Value] | Value[] | [Value, Value][] | null | undefined) => import("./basepicker").DayjsValue;
|
|
53
|
+
getDayjsValue: () => import("./basepicker").DayjsValue;
|
|
54
|
+
value: State<import("./basepicker").StateValue>;
|
|
55
|
+
setValue: (v: import("./basepicker").StateValueItem, fromInput: boolean) => void;
|
|
56
|
+
onChangeDate: (v: dayjs.Dayjs, flag: import("./usePanel").PanelFlags) => void;
|
|
57
|
+
};
|
|
58
|
+
init(): void;
|
|
59
|
+
protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | import("intact").Children[];
|
|
60
|
+
protected getLabel(): string | string[];
|
|
61
|
+
protected clear(e: MouseEvent): void;
|
|
62
|
+
private setByShortcut;
|
|
63
|
+
}
|
|
@@ -10,7 +10,7 @@ export * from './shapes/rectangle';
|
|
|
10
10
|
export * from './shapes/square';
|
|
11
11
|
export * from './shapes/text';
|
|
12
12
|
export * from './shapes/line';
|
|
13
|
-
declare const DDiamond: import("
|
|
13
|
+
declare const DDiamond: import("misstime").ComponentConstructor<import("./shapes/shape").DShape<import("./shapes/shape").DShapeProps>>, DTriangle: import("misstime").ComponentConstructor<import("./shapes/shape").DShape<import("./shapes/shape").DShapeProps>>, DCylinder: import("misstime").ComponentConstructor<import("./shapes/shape").DShape<import("./shapes/shape").DShapeProps>>, DCloud: import("misstime").ComponentConstructor<import("./shapes/shape").DShape<import("./shapes/shape").DShapeProps>>;
|
|
14
14
|
export { DDiamond, DTriangle, DCylinder, DCloud };
|
|
15
15
|
export * from './layouts/layout';
|
|
16
16
|
export * from './layouts/circle';
|
|
@@ -15,7 +15,7 @@ export var BaseDialog = /*#__PURE__*/function (_BaseDialog2) {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
if ($vNode === void 0) {
|
|
18
|
-
$vNode =
|
|
18
|
+
$vNode = createVNode(BaseDialog);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
if ($SVG === void 0) {
|
|
@@ -38,13 +38,14 @@ export var BaseDialog = /*#__PURE__*/function (_BaseDialog2) {
|
|
|
38
38
|
var _proto = BaseDialog.prototype;
|
|
39
39
|
|
|
40
40
|
_proto.init = function init() {
|
|
41
|
-
_BaseDialog2.prototype.init.call(this);
|
|
41
|
+
_BaseDialog2.prototype.init.call(this); // @ts-ignore
|
|
42
42
|
|
|
43
|
-
usePosition(this.dialogRef);
|
|
44
43
|
|
|
45
|
-
if (this.$vNode) {
|
|
44
|
+
if (this.$vNode.tag !== BaseDialog) {
|
|
46
45
|
this.useAsComponent = true;
|
|
47
46
|
}
|
|
47
|
+
|
|
48
|
+
usePosition(this.dialogRef);
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
_proto.show = function show() {
|
|
@@ -68,7 +69,7 @@ export var BaseDialog = /*#__PURE__*/function (_BaseDialog2) {
|
|
|
68
69
|
|
|
69
70
|
_this2.$init(null);
|
|
70
71
|
|
|
71
|
-
var vNode = _this2.$vNode
|
|
72
|
+
var vNode = _this2.$vNode;
|
|
72
73
|
vNode.children = _this2;
|
|
73
74
|
|
|
74
75
|
_this2.$render(null, vNode, document.body, null, mountedQueue);
|
|
@@ -5,6 +5,7 @@ export interface AlertDialogProps extends DialogProps {
|
|
|
5
5
|
type?: 'success' | 'warning' | 'error' | 'confirm';
|
|
6
6
|
hideIcon?: boolean;
|
|
7
7
|
hideFooter?: boolean;
|
|
8
|
+
ref?: (i: Dialog) => void;
|
|
8
9
|
}
|
|
9
10
|
export declare type StaticMethod = (options?: AlertDialogProps) => Promise<void>;
|
|
10
11
|
export declare function addStaticMethods(Component: typeof Dialog): void;
|
|
@@ -29,9 +29,10 @@ export function addStaticMethods(Component) {
|
|
|
29
29
|
options = {};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
var dialog = new AlertDialog(options);
|
|
33
|
+
dialog.show();
|
|
34
|
+
if (options.ref) options.ref(dialog);
|
|
32
35
|
return new _Promise(function (resolve, reject) {
|
|
33
|
-
var dialog = new AlertDialog(options, null, false, [], null);
|
|
34
|
-
dialog.show();
|
|
35
36
|
dialog.on('ok', function () {
|
|
36
37
|
resolve();
|
|
37
38
|
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Children, TypeDefs } from 'intact';
|
|
2
|
+
import { Option } from './option';
|
|
3
|
+
import { BaseSelect, BaseSelectProps, BaseSelectEvents, BaseSelectBlocks } from './base';
|
|
4
|
+
export interface SelectProps<T = string, Multipe extends boolean = boolean> extends BaseSelectProps<T, Multipe> {
|
|
5
|
+
filter?: (keywords: string, props: any) => boolean;
|
|
6
|
+
searchable?: boolean;
|
|
7
|
+
creatable?: boolean;
|
|
8
|
+
labelMap?: Map<any, Children>;
|
|
9
|
+
card?: boolean;
|
|
10
|
+
autoDisableArrow?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SelectEvents extends BaseSelectEvents {
|
|
13
|
+
}
|
|
14
|
+
export interface SelectBlocks<T> extends BaseSelectBlocks<T> {
|
|
15
|
+
menu: null;
|
|
16
|
+
}
|
|
17
|
+
export declare class Select<T = string, Multipe extends boolean = false> extends BaseSelect<SelectProps<T, Multipe>, SelectEvents, SelectBlocks<T>> {
|
|
18
|
+
static template: string | import("intact").Template<any>;
|
|
19
|
+
static typeDefs: Required<TypeDefs<SelectProps<string, boolean>>>;
|
|
20
|
+
static defaults: () => Partial<SelectProps<string, boolean>>;
|
|
21
|
+
filterable: {
|
|
22
|
+
getCreatedVNode: (children: (string | number | import("intact").VNode<import("intact").VNodeTag>)[]) => import("intact").VNode<typeof Option> | undefined;
|
|
23
|
+
filter: (children: Children) => Children;
|
|
24
|
+
};
|
|
25
|
+
label: {
|
|
26
|
+
getLabel: () => Children;
|
|
27
|
+
activeIndices: import("intact").NonNullableRefObject<number[]>;
|
|
28
|
+
};
|
|
29
|
+
init(): void;
|
|
30
|
+
protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | Children[];
|
|
31
|
+
protected getLabel(): Children;
|
|
32
|
+
private getAllShowedValues;
|
|
33
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const context: {
|
|
2
|
-
Provider: import("
|
|
3
|
-
Consumer: import("
|
|
2
|
+
Provider: import("misstime").ComponentConstructor<import("intact").Component<import("../context").ProviderProps<any>, {}, {}, {}>>;
|
|
3
|
+
Consumer: import("misstime").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<any>, {}, {}, {}>>;
|
|
4
4
|
};
|
|
@@ -988,56 +988,80 @@ describe('Table', function () {
|
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
990
|
}, _callee21);
|
|
991
|
-
})));
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
991
|
+
})));
|
|
992
|
+
it('should update children in TableCell', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22() {
|
|
993
|
+
var update, Test, Demo, _mount24, instance, element;
|
|
994
|
+
|
|
995
|
+
return _regeneratorRuntime.wrap(function _callee22$(_context25) {
|
|
996
|
+
while (1) {
|
|
997
|
+
switch (_context25.prev = _context25.next) {
|
|
998
|
+
case 0:
|
|
999
|
+
update = sinon.spy();
|
|
1000
|
+
|
|
1001
|
+
Test = /*#__PURE__*/function (_Component3) {
|
|
1002
|
+
_inheritsLoose(Test, _Component3);
|
|
1003
|
+
|
|
1004
|
+
function Test() {
|
|
1005
|
+
return _Component3.apply(this, arguments) || this;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
var _proto = Test.prototype;
|
|
1009
|
+
|
|
1010
|
+
_proto.beforeUpdate = function beforeUpdate() {
|
|
1011
|
+
update();
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
return Test;
|
|
1015
|
+
}(Component);
|
|
1016
|
+
|
|
1017
|
+
Test.template = "<div>test</div>";
|
|
1018
|
+
|
|
1019
|
+
Demo = /*#__PURE__*/function (_Component4) {
|
|
1020
|
+
_inheritsLoose(Demo, _Component4);
|
|
1021
|
+
|
|
1022
|
+
function Demo() {
|
|
1023
|
+
var _context24;
|
|
1024
|
+
|
|
1025
|
+
var _this3;
|
|
1026
|
+
|
|
1027
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1028
|
+
args[_key3] = arguments[_key3];
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
_this3 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context24 = [this]).call(_context24, args)) || this;
|
|
1032
|
+
_this3.Table = Table;
|
|
1033
|
+
_this3.TableColumn = TableColumn;
|
|
1034
|
+
_this3.Test = Test;
|
|
1035
|
+
return _this3;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
Demo.defaults = function defaults() {
|
|
1039
|
+
return {
|
|
1040
|
+
data: [{
|
|
1041
|
+
a: 1
|
|
1042
|
+
}, {
|
|
1043
|
+
a: 2
|
|
1044
|
+
}]
|
|
1045
|
+
};
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
return Demo;
|
|
1049
|
+
}(Component);
|
|
1050
|
+
|
|
1051
|
+
Demo.template = "\n const {Table, TableColumn, Test} = this;\n <Table data={this.get('data')} ref=\"table\">\n <TableColumn key=\"a\">\n <b:template>\n <Test />\n </b:template>\n </TableColumn>\n </Table>\n ";
|
|
1052
|
+
_mount24 = mount(Demo), instance = _mount24[0], element = _mount24[1];
|
|
1053
|
+
element.querySelector('tbody tr').click();
|
|
1054
|
+
_context25.next = 9;
|
|
1055
|
+
return wait();
|
|
1056
|
+
|
|
1057
|
+
case 9:
|
|
1058
|
+
expect(update.callCount).to.eql(1);
|
|
1059
|
+
|
|
1060
|
+
case 10:
|
|
1061
|
+
case "end":
|
|
1062
|
+
return _context25.stop();
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}, _callee22);
|
|
1066
|
+
})));
|
|
1043
1067
|
});
|
|
@@ -211,7 +211,7 @@ export function useChecked(getEnableKeys, getAllKeys, isDisabledKey, getGrid, lo
|
|
|
211
211
|
|
|
212
212
|
instance.on('$change:data', updateAllCheckedStatus);
|
|
213
213
|
instance.on('clickRow', function (data, index, key) {
|
|
214
|
-
if (instance.get('rowCheckable')) {
|
|
214
|
+
if (instance.get('rowCheckable') && instance.get('checkType') !== 'none') {
|
|
215
215
|
toggleChecked(key, index);
|
|
216
216
|
}
|
|
217
217
|
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { TypeDefs } from 'intact';
|
|
2
|
+
import { BasePicker } from '../datepicker/basepicker';
|
|
3
|
+
import dayjs from '../datepicker/dayjs';
|
|
4
|
+
import { State } from '../../hooks/useState';
|
|
5
|
+
import { PanelTypes } from '../datepicker/usePanel';
|
|
6
|
+
import { TimepickerProps, TimepickerEvents, TimepickerBlocks } from './constants';
|
|
7
|
+
export declare class PanelPicker<Multipe extends boolean = false, Range extends boolean = false> extends BasePicker<TimepickerProps<Multipe, Range>, TimepickerEvents, TimepickerBlocks> {
|
|
8
|
+
static template: string | import("intact").Template<any>;
|
|
9
|
+
static typeDefs: Required<TypeDefs<TimepickerProps<boolean, boolean>>>;
|
|
10
|
+
formats: {
|
|
11
|
+
getValueFormat: () => string;
|
|
12
|
+
getShowFormat: () => string;
|
|
13
|
+
createDateByValueFormat: (value: import("../datepicker/basepicker").Value) => dayjs.Dayjs;
|
|
14
|
+
createDateByShowFormat: (value: import("../datepicker/basepicker").Value) => dayjs.Dayjs;
|
|
15
|
+
getShowString: (value: dayjs.Dayjs) => string;
|
|
16
|
+
getValueString: (value: dayjs.Dayjs) => string;
|
|
17
|
+
};
|
|
18
|
+
disabled: {
|
|
19
|
+
isDisabled: (value: dayjs.Dayjs, type?: dayjs.OpUnitType) => boolean;
|
|
20
|
+
isDisabledConfirm: () => boolean;
|
|
21
|
+
maxDate: State<dayjs.Dayjs | null>;
|
|
22
|
+
minDate: State<dayjs.Dayjs | null>;
|
|
23
|
+
isDisabledTime: (value: dayjs.Dayjs, flag: import("../datepicker/usePanel").PanelFlags) => boolean;
|
|
24
|
+
isDisabledTimeByStep: (value: string, flag: import("../datepicker/usePanel").PanelFlags) => boolean;
|
|
25
|
+
};
|
|
26
|
+
panel: {
|
|
27
|
+
startPanel: State<PanelTypes>;
|
|
28
|
+
endPanel: State<PanelTypes>;
|
|
29
|
+
changePanel: (type: PanelTypes, flag?: import("../datepicker/usePanel").PanelFlags) => void;
|
|
30
|
+
getPanel: (flag: import("../datepicker/usePanel").PanelFlags) => State<PanelTypes>;
|
|
31
|
+
reset: () => void;
|
|
32
|
+
startRef: import("intact").RefObject<import("../datepicker/calendar").DatepickerCalendar>;
|
|
33
|
+
endRef: import("intact").RefObject<import("../datepicker/calendar").DatepickerCalendar>;
|
|
34
|
+
};
|
|
35
|
+
value: {
|
|
36
|
+
format: () => string | string[];
|
|
37
|
+
onConfirm: () => void;
|
|
38
|
+
getTimeValue: (flag: import("../datepicker/usePanel").PanelFlags) => dayjs.Dayjs | null | undefined;
|
|
39
|
+
convertToDayjs: (v: import("../datepicker/basepicker").Value | [import("../datepicker/basepicker").Value, import("../datepicker/basepicker").Value] | import("../datepicker/basepicker").Value[] | [import("../datepicker/basepicker").Value, import("../datepicker/basepicker").Value][] | null | undefined) => import("../datepicker/basepicker").DayjsValue;
|
|
40
|
+
value: State<import("../datepicker/basepicker").StateValue>;
|
|
41
|
+
setValue: (v: import("../datepicker/basepicker").StateValueItem, fromInput: boolean) => void;
|
|
42
|
+
getDayjsValue: () => import("../datepicker/basepicker").DayjsValue;
|
|
43
|
+
onChangeTime: (date: dayjs.Dayjs, flag: import("../datepicker/usePanel").PanelFlags) => void;
|
|
44
|
+
onChangeTimeByStep: (v: string, flag: import("../datepicker/usePanel").PanelFlags) => void;
|
|
45
|
+
};
|
|
46
|
+
step: {
|
|
47
|
+
options: State<{
|
|
48
|
+
value: string;
|
|
49
|
+
label: string;
|
|
50
|
+
}[] | null>;
|
|
51
|
+
};
|
|
52
|
+
protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | import("intact").Children[];
|
|
53
|
+
protected getLabel(): string | string[];
|
|
54
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TypeDefs, Children, Key } from 'intact';
|
|
2
|
+
import { BaseSelect, BaseSelectProps, BaseSelectEvents, BaseSelectBlocks } from '../select/base';
|
|
3
|
+
import { TreeProps } from '../tree';
|
|
4
|
+
import type { DataItem } from '../tree/useNodes';
|
|
5
|
+
export interface TreeSelectProps<K extends Key = Key, Multipe extends boolean = boolean, Checkbox extends boolean = boolean> extends BaseSelectProps<K, Multipe, Checkbox extends true ? K[] : K | null> {
|
|
6
|
+
data?: TreeProps<K>['data'];
|
|
7
|
+
uncorrelated?: boolean;
|
|
8
|
+
load?: TreeProps<K>['load'];
|
|
9
|
+
showLine?: boolean;
|
|
10
|
+
defaultExpandAll?: boolean;
|
|
11
|
+
checkbox?: Checkbox;
|
|
12
|
+
filter?: (keywords: string, data: DataItem<K>) => boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface TreeSelectEvents extends BaseSelectEvents {
|
|
15
|
+
}
|
|
16
|
+
export interface TreeSelectBlocks<K> extends BaseSelectBlocks<K> {
|
|
17
|
+
}
|
|
18
|
+
export declare class TreeSelect<K extends Key = Key, Checkbox extends boolean = false, Multipe extends boolean = Checkbox extends true ? true : false> extends BaseSelect<TreeSelectProps<K, Multipe, Checkbox>, TreeSelectEvents, TreeSelectBlocks<K>> {
|
|
19
|
+
static template: string | import("intact").Template<any>;
|
|
20
|
+
static typeDefs: Required<TypeDefs<TreeSelectProps<Key, boolean, boolean>>>;
|
|
21
|
+
static defaults: () => Partial<TreeSelectProps<Key, boolean, boolean>>;
|
|
22
|
+
private value;
|
|
23
|
+
init(): void;
|
|
24
|
+
protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | Children[];
|
|
25
|
+
protected getLabel(): Children;
|
|
26
|
+
private filter;
|
|
27
|
+
}
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.6
|
|
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.6";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.6
|
|
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.6';
|
|
63
63
|
/* generate end */
|
|
@@ -73,7 +73,7 @@ describe('React Demos', function () {
|
|
|
73
73
|
return wait(100);
|
|
74
74
|
|
|
75
75
|
case 3:
|
|
76
|
-
// FIXME: I don't why the width of `autoWidth` input is an unexpected value
|
|
76
|
+
// FIXME: I don't know why the width of `autoWidth` input is an unexpected value
|
|
77
77
|
// while we run test on Github Actions.
|
|
78
78
|
innerHTML = element.innerHTML.replace(/(\<input.*?style="width: )(?:.*?)(px;")/g, '$1$2');
|
|
79
79
|
expect(innerHTML).to.matchSnapshot();
|
|
@@ -3,7 +3,7 @@ import { MenuProps } from '@king-design/react';
|
|
|
3
3
|
interface Props extends MenuProps {
|
|
4
4
|
}
|
|
5
5
|
export default class Demo extends React.Component<{}, Props> {
|
|
6
|
-
state: MenuProps<import("
|
|
6
|
+
state: MenuProps<import("misstime").Key>;
|
|
7
7
|
private __test;
|
|
8
8
|
setTheme(theme?: string): void;
|
|
9
9
|
render(): JSX.Element;
|
|
@@ -2,6 +2,6 @@ import React from 'react';
|
|
|
2
2
|
import './index.styl';
|
|
3
3
|
import type { MenuProps } from '@king-design/react';
|
|
4
4
|
export default class Demo extends React.Component {
|
|
5
|
-
state: MenuProps<import("
|
|
5
|
+
state: MenuProps<import("misstime").Key>;
|
|
6
6
|
render(): JSX.Element;
|
|
7
7
|
}
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.6
|
|
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.6';
|
|
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.6",
|
|
4
4
|
"description": "A component library written in Intact for Intact, Vue, React and Angular",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"snapshots": "cross-env UPDATE=1 npm run test",
|
|
9
9
|
"test:all": "lerna exec -- npm run test",
|
|
10
10
|
"test:react": "lerna exec --scope @king-design/react -- npm run test",
|
|
11
|
+
"test:vue": "lerna exec --scope @king-design/vue -- npm run test",
|
|
11
12
|
"snapshots:all": "lerna exec -- npm run snapshots",
|
|
12
13
|
"cover": "cross-env UPDATE=2 npm run test",
|
|
13
14
|
"start": "node server.js",
|
|
@@ -30,7 +31,8 @@
|
|
|
30
31
|
"prelease-patch": "lerna version prepatch --preid beta --force-publish && npm run _publish -- --tag=beta",
|
|
31
32
|
"prelease-minor": "lerna version preminor --preid beta --force-publish && npm run _publish -- --tag=beta",
|
|
32
33
|
"prelease-major": "lerna version premajor --preid beta --force-publish && npm run _publish -- --tag=beta",
|
|
33
|
-
"upload:resources": "gulp upload:resources"
|
|
34
|
+
"upload:resources": "gulp upload:resources",
|
|
35
|
+
"update:deps": "lerna exec -- yarn"
|
|
34
36
|
},
|
|
35
37
|
"repository": {
|
|
36
38
|
"type": "git",
|
|
@@ -114,7 +116,7 @@
|
|
|
114
116
|
"highlight.js": "^10.4.1",
|
|
115
117
|
"history": "^5.0.0",
|
|
116
118
|
"html-webpack-plugin": "5.3.1",
|
|
117
|
-
"intact-react": "^3.0.
|
|
119
|
+
"intact-react": "^3.0.6",
|
|
118
120
|
"istanbul-instrumenter-loader": "^3.0.0",
|
|
119
121
|
"js-yaml": "^4.1.0",
|
|
120
122
|
"karma": "^6.3.2",
|
|
@@ -176,7 +178,7 @@
|
|
|
176
178
|
"dayjs": "^1.10.7",
|
|
177
179
|
"downloadjs": "^1.4.7",
|
|
178
180
|
"enquire.js": "^2.1.6",
|
|
179
|
-
"intact": "^3.0.
|
|
181
|
+
"intact": "^3.0.6",
|
|
180
182
|
"monaco-editor": "^0.26.1",
|
|
181
183
|
"mxgraphx": "^4.0.7",
|
|
182
184
|
"resize-observer-polyfill": "^1.5.1",
|