@king-design/intact 3.1.4-beta.0 → 3.1.4-beta.1
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/button/demos/group.md +6 -0
- package/components/button/index.vdt +3 -3
- package/components/button/styles.ts +2 -5
- package/components/card/demos/size.md +34 -0
- package/components/card/index.md +1 -0
- package/components/card/index.ts +5 -1
- package/components/card/index.vdt +2 -1
- package/components/card/styles.ts +43 -5
- package/components/carousel/useAutoplay.ts +5 -2
- package/components/dropdown/usePosition.ts +11 -12
- package/components/icon/styles.ts +1 -0
- package/components/input/styles.ts +1 -0
- package/components/table/table.ts +2 -2
- package/components/table/useFixedColumns.ts +1 -1
- package/components/table/{useRestRowStatus.ts → useResetRowStatus.ts} +1 -1
- package/components/tabs/tab.ts +1 -0
- package/components/wave/index.ts +5 -2
- package/es/components/button/index.vdt.js +1 -2
- package/es/components/button/styles.js +3 -3
- package/es/components/card/index.d.ts +2 -0
- package/es/components/card/index.js +4 -2
- package/es/components/card/index.vdt.js +3 -2
- package/es/components/card/styles.js +22 -3
- package/es/components/carousel/useAutoplay.js +5 -2
- package/es/components/cascader/index.d.ts +45 -0
- package/es/components/datepicker/index.d.ts +63 -0
- package/es/components/diagram/index.d.ts +1 -1
- package/es/components/dropdown/usePosition.js +0 -1
- package/es/components/icon/styles.js +1 -1
- package/es/components/input/styles.js +1 -1
- package/es/components/select/select.d.ts +33 -0
- package/es/components/steps/context.d.ts +3 -3
- package/es/components/table/table.js +2 -2
- package/es/components/table/useFixedColumns.js +1 -1
- package/es/components/table/{useRestRowStatus.d.ts → useResetRowStatus.d.ts} +1 -1
- package/es/components/table/{useRestRowStatus.js → useResetRowStatus.js} +1 -1
- package/es/components/tabs/tab.d.ts +2 -1
- package/es/components/tabs/tab.js +1 -0
- package/es/components/timepicker/panelPicker.d.ts +54 -0
- package/es/components/treeSelect/index.d.ts +28 -0
- package/es/components/wave/index.js +6 -2
- package/es/hooks/useDelayClose.js +11 -6
- package/es/hooks/useMouseOutsidable.js +6 -2
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/button/demos/group/react.js +12 -0
- package/es/site/data/components/card/demos/size/index.d.ts +6 -0
- package/es/site/data/components/card/demos/size/index.js +18 -0
- package/es/site/data/components/card/demos/size/react.d.ts +5 -0
- package/es/site/data/components/card/demos/size/react.js +37 -0
- 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/hooks/useDelayClose.ts +11 -6
- package/hooks/useMouseOutsidable.ts +6 -2
- package/index.ts +2 -2
- package/package.json +2 -2
|
@@ -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';
|
|
@@ -39,7 +39,7 @@ export var sizes = ['large', 'small', 'mini'];
|
|
|
39
39
|
export var makeStyles = cache(function makeStyles(k, color) {
|
|
40
40
|
// create the global icon styles
|
|
41
41
|
makeIconStyles(k);
|
|
42
|
-
return /*#__PURE__*/css("color:", icon.color, ";font-size:", icon.fontSize.default, ";line-height:1;", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
42
|
+
return /*#__PURE__*/css("color:", icon.color, ";font-size:", icon.fontSize.default, ";line-height:1;font-weight:normal;", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
43
43
|
var fontSize = icon.fontSize[size];
|
|
44
44
|
return /*#__PURE__*/css("&.", k, "-", size, "{font-size:", fontSize, ";}");
|
|
45
45
|
}), " ", _mapInstanceProperty(colors).call(colors, function (color) {
|
|
@@ -135,7 +135,7 @@ setDefault(function () {
|
|
|
135
135
|
export var makeStyles = cache(function makeStyles(k) {
|
|
136
136
|
var _context;
|
|
137
137
|
|
|
138
|
-
return /*#__PURE__*/css("display:inline-block;width:", input.width, ";color:", input.color, ";vertical-align:middle;.", k, "-input-wrapper{display:inline-flex;align-items:center;width:100%;position:relative;border:", input.border, ";background-color:", input.bgColor, ";transition:border ", input.transition, ",background ", input.transition, ",box-shadow ", input.transition, ";border-radius:", input.borderRadius, ";&:hover{border:", input.hoverBorder, ";z-index:1;}}&.", k, "-focus .", k, "-input-wrapper{border:", input.focusBorder, ";z-index:1;}.", k, "-input-inner{flex:1;outline:none;color:inherit;font-size:inherit;border:none;background:transparent;padding:0;width:0
|
|
138
|
+
return /*#__PURE__*/css("display:inline-block;width:", input.width, ";color:", input.color, ";vertical-align:middle;.", k, "-input-wrapper{display:inline-flex;align-items:center;width:100%;position:relative;border:", input.border, ";background-color:", input.bgColor, ";transition:border ", input.transition, ",background ", input.transition, ",box-shadow ", input.transition, ";border-radius:", input.borderRadius, ";&:hover{border:", input.hoverBorder, ";z-index:1;}}&.", k, "-focus .", k, "-input-wrapper{border:", input.focusBorder, ";z-index:1;}.", k, "-input-inner{flex:1;outline:none;color:inherit;font-size:inherit;border:none;background:transparent;padding:0;width:0;max-width:100%;&::placeholder{color:", input.placeholderColor, ";}}&.", k, "-fluid{width:100%;}.", k, "-input-prefix,.", k, "-input-suffix{display:flex;align-items:center;gap:", input.clearIconGap, ";color:", theme.color.lightBlack, ";position:relative;}.", k, "-input-prefix{margin-right:", input.clearIconGap, ";}.", k, "-input-suffix{margin-left:", input.clearIconGap, ";}.", k, "-input-clear{opacity:0;transition:opacity ", input.transition, ";pointer-events:none;color:", input.clearIconColor, ";}&:hover .", k, "-input-clear.", k, "-input-show{opacity:1;pointer-events:all;}.", k, "-input-show-password{color:", input.clearIconColor, ";}&.", k, "-stack-clear{.", k, "-input-clear{position:absolute;z-index:1;right:0;&.", k, "-input-show+*{transition:opacity ", input.transition, ";}}&:hover{.", k, "-input-clear.", k, "-input-show+*{opacity:0;}}}&.", k, "-group{display:inline-flex;.", k, "-input-wrapper{border-radius:0;flex:1;}.", k, "-input-wrapper:first-child{border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";}.", k, "-input-wrapper:last-child{border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;}}.", k, "-input-prepend,.", k, "-input-append{display:inline-flex;align-items:center;background-color:", input.groupBgColor, ";border:", input.border, ";white-space:nowrap;.", k, "-btn{margin:-1px;&.", k, "-none:hover{background:transparent;}}.", k, "-select{margin:-1px;text-align:left;}}.", k, "-input-prepend{&,.", k, "-btn,.", k, "-select{z-index:1;border-radius:", input.borderRadius, " 0 0 ", input.borderRadius, ";}}.", k, "-input-append{&,.", k, "-btn,.", k, "-select{z-index:1;border-radius:0 ", input.borderRadius, " ", input.borderRadius, " 0;}}.", k, "-input-padding{padding:0 ", input.groupPaddingGap, ";}.", k, "-input-prepend{border-right:none;}.", k, "-input-append{border-left:none;}&.", k, "-flat{color:", _flatInstanceProperty(input).color, ";.", k, "-input-wrapper{border:none;background:", _flatInstanceProperty(input).bgColor, ";}}&.", k, "-disabled{color:", input.disabledColor, ";cursor:not-allowed;.", k, "-input-wrapper{border-color:", input.disabledBorderColor, ";background:", input.disabledBgColor, ";}.", k, "-input-inner{cursor:not-allowed;}}", _mapInstanceProperty(sizes).call(sizes, function (size) {
|
|
139
139
|
var styles = input[size];
|
|
140
140
|
var sizeClassName = /*#__PURE__*/css("font-size:", styles.fontSize, ";.", k, "-input-wrapper{height:", styles.height, ";padding:0 ", styles.paddingGap, ";}");
|
|
141
141
|
if (size === 'default') return sizeClassName;
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
export declare const context: {
|
|
2
|
-
Provider: import("
|
|
3
|
-
Consumer: import("
|
|
4
|
-
useContext: () => 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
|
+
useContext: () => import("misstime").RefObject<any>;
|
|
5
5
|
};
|
|
@@ -18,7 +18,7 @@ import { useExpandable } from './useExpandable';
|
|
|
18
18
|
import { useSelected } from './useSelected';
|
|
19
19
|
import { useTree } from './useTree';
|
|
20
20
|
import { Tooltip } from '../tooltip/tooltip';
|
|
21
|
-
import {
|
|
21
|
+
import { useResetRowStatus } from './useResetRowStatus';
|
|
22
22
|
import { exportTable as _exportTable } from './exportTable';
|
|
23
23
|
import { useResizable } from './useResizable';
|
|
24
24
|
import { useDraggable } from './useDraggable';
|
|
@@ -117,7 +117,7 @@ export var Table = /*#__PURE__*/function (_Component) {
|
|
|
117
117
|
_this.sortable = useSortable();
|
|
118
118
|
_this.expandable = useExpandable();
|
|
119
119
|
_this.selected = useSelected();
|
|
120
|
-
_this.resetRowStatus =
|
|
120
|
+
_this.resetRowStatus = useResetRowStatus(_this.disableRow.getAllKeys);
|
|
121
121
|
_this.draggable = useDraggable(_this.pagination.data);
|
|
122
122
|
_this.stickyScrollbar = useStickyScrollbar(_this.stickyHeader.elementRef, _this.scroll, _this.width.tableRef, _this.fixedColumns.setScrollPosition);
|
|
123
123
|
_this.config = useConfigContext();
|
|
@@ -89,7 +89,7 @@ export function useFixedColumns(getColumns, _ref, widthMap) {
|
|
|
89
89
|
function updateScrollPositionOnResize() {
|
|
90
90
|
var scrollDom = scrollRef.value;
|
|
91
91
|
|
|
92
|
-
if (scrollDom.scrollWidth - scrollDom.offsetWidth <= 0) {
|
|
92
|
+
if (!hasFixed.value || scrollDom.scrollWidth - scrollDom.offsetWidth <= 0) {
|
|
93
93
|
scrollPosition.set(null);
|
|
94
94
|
} else {
|
|
95
95
|
setScrollPosition(scrollRef.value.scrollLeft);
|
|
@@ -2,7 +2,7 @@ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/i
|
|
|
2
2
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/slice";
|
|
3
3
|
import { useInstance, onBeforeUnmount, onUpdated } from 'intact';
|
|
4
4
|
import { addOrRemove } from './useChecked';
|
|
5
|
-
export function
|
|
5
|
+
export function useResetRowStatus(getAllKeys) {
|
|
6
6
|
var instance = useInstance();
|
|
7
7
|
var allUnmountedRows = [];
|
|
8
8
|
var willUnmounted = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from 'intact';
|
|
1
|
+
import { Component, TypeDefs } from 'intact';
|
|
2
2
|
export interface TabProps {
|
|
3
3
|
value?: any;
|
|
4
4
|
disabled?: boolean;
|
|
@@ -10,6 +10,7 @@ export interface TabEvents {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class Tab extends Component<TabProps, TabEvents> {
|
|
12
12
|
static template: string | import("intact").Template<any>;
|
|
13
|
+
static typeDefs: Required<TypeDefs<TabProps>>;
|
|
13
14
|
private tabs;
|
|
14
15
|
private config;
|
|
15
16
|
private onClick;
|
|
@@ -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,28 @@
|
|
|
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
|
+
expandAll(): void;
|
|
25
|
+
protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | Children[];
|
|
26
|
+
protected getLabel(): Children;
|
|
27
|
+
private filter;
|
|
28
|
+
}
|
|
@@ -35,7 +35,7 @@ export var Wave = /*#__PURE__*/function (_Component) {
|
|
|
35
35
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
36
36
|
_this.instance = null;
|
|
37
37
|
_this.className = void 0;
|
|
38
|
-
_this.timer =
|
|
38
|
+
_this.timer = null;
|
|
39
39
|
_this.config = useConfigContext();
|
|
40
40
|
return _this;
|
|
41
41
|
}
|
|
@@ -95,7 +95,11 @@ export var Wave = /*#__PURE__*/function (_Component) {
|
|
|
95
95
|
if (!node) return;
|
|
96
96
|
node.classList.remove(this.className);
|
|
97
97
|
node.removeEventListener('animationend', this.resetAnimation);
|
|
98
|
-
|
|
98
|
+
|
|
99
|
+
if (this.timer) {
|
|
100
|
+
clearTimeout(this.timer);
|
|
101
|
+
this.timer = null;
|
|
102
|
+
}
|
|
99
103
|
};
|
|
100
104
|
|
|
101
105
|
return Wave;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { onMounted, useInstance, onUnmounted } from 'intact';
|
|
2
2
|
export function useDelayClose(close, duration) {
|
|
3
3
|
var instance = useInstance();
|
|
4
|
-
var timer;
|
|
4
|
+
var timer = null;
|
|
5
5
|
|
|
6
6
|
function delayClose() {
|
|
7
7
|
if (duration) {
|
|
@@ -11,7 +11,7 @@ export function useDelayClose(close, duration) {
|
|
|
11
11
|
|
|
12
12
|
function onMouseEnter(e) {
|
|
13
13
|
instance.trigger('mouseenter', e);
|
|
14
|
-
|
|
14
|
+
clear();
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function onMouseLeave(e) {
|
|
@@ -20,14 +20,19 @@ export function useDelayClose(close, duration) {
|
|
|
20
20
|
// so we must detect the $unmounted status here
|
|
21
21
|
|
|
22
22
|
if (instance.$unmounted) return;
|
|
23
|
-
|
|
23
|
+
clear();
|
|
24
24
|
delayClose();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
function clear() {
|
|
28
|
+
if (timer) {
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
timer = null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
onMounted(delayClose);
|
|
28
|
-
onUnmounted(
|
|
29
|
-
clearTimeout(timer);
|
|
30
|
-
});
|
|
35
|
+
onUnmounted(clear);
|
|
31
36
|
return {
|
|
32
37
|
onMouseEnter: onMouseEnter,
|
|
33
38
|
onMouseLeave: onMouseLeave
|
|
@@ -9,7 +9,7 @@ export function useMouseOutsidable(elementRef, autoAdd) {
|
|
|
9
9
|
autoAdd = true;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
var timer;
|
|
12
|
+
var timer = null;
|
|
13
13
|
|
|
14
14
|
function onMouseDown() {
|
|
15
15
|
document.addEventListener('click', onDocumentClick, true);
|
|
@@ -19,6 +19,7 @@ export function useMouseOutsidable(elementRef, autoAdd) {
|
|
|
19
19
|
function onMouseUp() {
|
|
20
20
|
timer = window.setTimeout(function () {
|
|
21
21
|
document.removeEventListener('click', onDocumentClick, true);
|
|
22
|
+
timer = null;
|
|
22
23
|
});
|
|
23
24
|
document.removeEventListener('mouseup', onMouseUp);
|
|
24
25
|
}
|
|
@@ -36,7 +37,10 @@ export function useMouseOutsidable(elementRef, autoAdd) {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
onBeforeUnmount(function () {
|
|
39
|
-
|
|
40
|
+
if (timer) {
|
|
41
|
+
clearTimeout(timer);
|
|
42
|
+
timer = null;
|
|
43
|
+
}
|
|
40
44
|
|
|
41
45
|
if (autoAdd) {
|
|
42
46
|
elementRef.value.removeEventListener('mousedown', onMouseDown);
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.1.4-beta.
|
|
2
|
+
* @king-design v3.1.4-beta.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -60,4 +60,4 @@ export * from './components/tree';
|
|
|
60
60
|
export * from './components/treeSelect';
|
|
61
61
|
export * from './components/upload';
|
|
62
62
|
export * from './components/wave';
|
|
63
|
-
export declare const version = "3.1.4-beta.
|
|
63
|
+
export declare const version = "3.1.4-beta.1";
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.1.4-beta.
|
|
2
|
+
* @king-design v3.1.4-beta.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -62,5 +62,5 @@ export * from './components/tree';
|
|
|
62
62
|
export * from './components/treeSelect';
|
|
63
63
|
export * from './components/upload';
|
|
64
64
|
export * from './components/wave';
|
|
65
|
-
export var version = '3.1.4-beta.
|
|
65
|
+
export var version = '3.1.4-beta.1';
|
|
66
66
|
/* generate end */
|
|
@@ -138,6 +138,18 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
138
138
|
value: "guangzhou"
|
|
139
139
|
}, "\u5E7F\u5DDE"), /*#__PURE__*/React.createElement(Button, {
|
|
140
140
|
value: "shenzhen"
|
|
141
|
+
}, "\u6DF1\u5733")), /*#__PURE__*/React.createElement(ButtonGroup, {
|
|
142
|
+
seperate: true
|
|
143
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
144
|
+
value: "beijing",
|
|
145
|
+
type: "primary",
|
|
146
|
+
disabled: true
|
|
147
|
+
}, "\u5317\u4EAC"), /*#__PURE__*/React.createElement(Button, {
|
|
148
|
+
value: "shanghai"
|
|
149
|
+
}, "\u4E0A\u6D77"), /*#__PURE__*/React.createElement(Button, {
|
|
150
|
+
value: "guangzhou"
|
|
151
|
+
}, "\u5E7F\u5DDE"), /*#__PURE__*/React.createElement(Button, {
|
|
152
|
+
value: "shenzhen"
|
|
141
153
|
}, "\u6DF1\u5733")));
|
|
142
154
|
};
|
|
143
155
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
export { default as data } from './index.json';
|
|
3
|
+
import { Component } from 'intact';
|
|
4
|
+
import template from './index.vdt';
|
|
5
|
+
import './index.styl';
|
|
6
|
+
|
|
7
|
+
var default_1 = /*#__PURE__*/function (_Component) {
|
|
8
|
+
_inheritsLoose(default_1, _Component);
|
|
9
|
+
|
|
10
|
+
function default_1() {
|
|
11
|
+
return _Component.apply(this, arguments) || this;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return default_1;
|
|
15
|
+
}(Component);
|
|
16
|
+
|
|
17
|
+
default_1.template = template;
|
|
18
|
+
export { default_1 as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Card } from '@king-design/react';
|
|
4
|
+
import './index.styl';
|
|
5
|
+
|
|
6
|
+
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
7
|
+
_inheritsLoose(Demo, _React$Component);
|
|
8
|
+
|
|
9
|
+
function Demo() {
|
|
10
|
+
return _React$Component.apply(this, arguments) || this;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
var _proto = Demo.prototype;
|
|
14
|
+
|
|
15
|
+
_proto.render = function render() {
|
|
16
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Card, {
|
|
17
|
+
title: "\u7528\u6237\u4FE1\u606F",
|
|
18
|
+
type: "border",
|
|
19
|
+
size: "large"
|
|
20
|
+
}, /*#__PURE__*/React.createElement("div", null, "\u5361\u7247\u5185\u5BB9"), /*#__PURE__*/React.createElement("div", null, "\u5361\u7247\u5185\u5BB9")), /*#__PURE__*/React.createElement(Card, {
|
|
21
|
+
title: "\u7528\u6237\u4FE1\u606F",
|
|
22
|
+
type: "border"
|
|
23
|
+
}, /*#__PURE__*/React.createElement("div", null, "\u5361\u7247\u5185\u5BB9"), /*#__PURE__*/React.createElement("div", null, "\u5361\u7247\u5185\u5BB9")), /*#__PURE__*/React.createElement(Card, {
|
|
24
|
+
title: "\u7528\u6237\u4FE1\u606F",
|
|
25
|
+
type: "border",
|
|
26
|
+
size: "small"
|
|
27
|
+
}, /*#__PURE__*/React.createElement("div", null, "\u5361\u7247\u5185\u5BB9"), /*#__PURE__*/React.createElement("div", null, "\u5361\u7247\u5185\u5BB9")), /*#__PURE__*/React.createElement(Card, {
|
|
28
|
+
title: "\u7528\u6237\u4FE1\u606F",
|
|
29
|
+
type: "border",
|
|
30
|
+
size: "mini"
|
|
31
|
+
}, /*#__PURE__*/React.createElement("div", null, "\u5361\u7247\u5185\u5BB9"), /*#__PURE__*/React.createElement("div", null, "\u5361\u7247\u5185\u5BB9")));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return Demo;
|
|
35
|
+
}(React.Component);
|
|
36
|
+
|
|
37
|
+
export { Demo as default };
|
|
@@ -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/hooks/useDelayClose.ts
CHANGED
|
@@ -4,7 +4,7 @@ export function useDelayClose(close: () => void, duration: number) {
|
|
|
4
4
|
const instance = useInstance() as Component<
|
|
5
5
|
{}, {mouseenter: [MouseEvent], mouseleave: [MouseEvent]}
|
|
6
6
|
>;
|
|
7
|
-
let timer: number;
|
|
7
|
+
let timer: number | null = null;
|
|
8
8
|
|
|
9
9
|
function delayClose() {
|
|
10
10
|
if (duration) {
|
|
@@ -14,7 +14,7 @@ export function useDelayClose(close: () => void, duration: number) {
|
|
|
14
14
|
|
|
15
15
|
function onMouseEnter(e: MouseEvent) {
|
|
16
16
|
instance!.trigger('mouseenter', e);
|
|
17
|
-
|
|
17
|
+
clear();
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function onMouseLeave(e: MouseEvent) {
|
|
@@ -25,14 +25,19 @@ export function useDelayClose(close: () => void, duration: number) {
|
|
|
25
25
|
// so we must detect the $unmounted status here
|
|
26
26
|
if (instance!.$unmounted) return;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
clear();
|
|
29
29
|
delayClose();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
function clear() {
|
|
33
|
+
if (timer) {
|
|
34
|
+
clearTimeout(timer);
|
|
35
|
+
timer = null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
32
39
|
onMounted(delayClose);
|
|
33
|
-
onUnmounted(
|
|
34
|
-
clearTimeout(timer);
|
|
35
|
-
});
|
|
40
|
+
onUnmounted(clear);
|
|
36
41
|
|
|
37
42
|
return {onMouseEnter, onMouseLeave};
|
|
38
43
|
}
|
|
@@ -6,7 +6,7 @@ import {onBeforeUnmount, RefObject, onMounted} from 'intact';
|
|
|
6
6
|
import {containsOrEqual} from './useDocumentClick';
|
|
7
7
|
|
|
8
8
|
export function useMouseOutsidable(elementRef: RefObject<HTMLElement>, autoAdd: boolean = true) {
|
|
9
|
-
let timer: number;
|
|
9
|
+
let timer: number | null = null;
|
|
10
10
|
|
|
11
11
|
function onMouseDown() {
|
|
12
12
|
document.addEventListener('click', onDocumentClick, true);
|
|
@@ -16,6 +16,7 @@ export function useMouseOutsidable(elementRef: RefObject<HTMLElement>, autoAdd:
|
|
|
16
16
|
function onMouseUp() {
|
|
17
17
|
timer = window.setTimeout(() => {
|
|
18
18
|
document.removeEventListener('click', onDocumentClick, true);
|
|
19
|
+
timer = null;
|
|
19
20
|
});
|
|
20
21
|
document.removeEventListener('mouseup', onMouseUp);
|
|
21
22
|
}
|
|
@@ -33,7 +34,10 @@ export function useMouseOutsidable(elementRef: RefObject<HTMLElement>, autoAdd:
|
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
onBeforeUnmount(() => {
|
|
36
|
-
|
|
37
|
+
if (timer) {
|
|
38
|
+
clearTimeout(timer);
|
|
39
|
+
timer = null;
|
|
40
|
+
}
|
|
37
41
|
if (autoAdd) {
|
|
38
42
|
elementRef.value!.removeEventListener('mousedown', onMouseDown);
|
|
39
43
|
}
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.1.4-beta.
|
|
2
|
+
* @king-design v3.1.4-beta.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -65,6 +65,6 @@ export * from './components/treeSelect';
|
|
|
65
65
|
export * from './components/upload';
|
|
66
66
|
export * from './components/wave';
|
|
67
67
|
|
|
68
|
-
export const version = '3.1.4-beta.
|
|
68
|
+
export const version = '3.1.4-beta.1';
|
|
69
69
|
|
|
70
70
|
/* generate end */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@king-design/intact",
|
|
3
|
-
"version": "3.1.4-beta.
|
|
3
|
+
"version": "3.1.4-beta.1",
|
|
4
4
|
"description": "A component library written in Intact for Intact, Vue, React and Angular",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
"dependencies": {
|
|
180
180
|
"@babel/runtime-corejs3": "^7.16.0",
|
|
181
181
|
"@emotion/css": "^11.5.0",
|
|
182
|
-
"@king-design/react": "^3.1.4-beta.
|
|
182
|
+
"@king-design/react": "^3.1.4-beta.1",
|
|
183
183
|
"dayjs": "^1.10.7",
|
|
184
184
|
"enquire.js": "^2.1.6",
|
|
185
185
|
"intact": "^3.0.25",
|