@canlooks/can-ui 0.0.171 → 0.0.173
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/dist/cjs/components/curd/curd.js +1 -1
- package/dist/cjs/components/dataGrid/dataGrid.js +2 -2
- package/dist/cjs/components/dateTimeRangePicker/dateTimeRangePicker.d.ts +2 -3
- package/dist/cjs/components/tabs/tabs.js +0 -1
- package/dist/cjs/components/transitionBase/collapse.js +8 -1
- package/dist/esm/components/curd/curd.js +1 -1
- package/dist/esm/components/dataGrid/dataGrid.js +2 -2
- package/dist/esm/components/dateTimeRangePicker/dateTimeRangePicker.d.ts +2 -3
- package/dist/esm/components/tabs/tabs.js +0 -1
- package/dist/esm/components/transitionBase/collapse.js +9 -2
- package/package.json +1 -1
|
@@ -143,7 +143,7 @@ exports.Curd = (0, react_1.memo)((props) => {
|
|
|
143
143
|
const setInnerRows = (data) => {
|
|
144
144
|
setOptions?.(data);
|
|
145
145
|
_setInnerRows(data);
|
|
146
|
-
containerRef.current.scrollTop = 0;
|
|
146
|
+
containerRef.current.scrollTop = containerRef.current.scrollLeft = 0;
|
|
147
147
|
};
|
|
148
148
|
const [innerTotal, setInnerTotal] = (0, utils_1.useDerivedState)(props.paginationProps?.total || 0);
|
|
149
149
|
const suppressReload = (0, react_1.useRef)(false);
|
|
@@ -89,7 +89,7 @@ exports.DataGrid = (0, react_1.memo)(({ slots, slotProps, columns, rows, rowProp
|
|
|
89
89
|
return new Set(innerExpanded.current);
|
|
90
90
|
}, [innerExpanded.current]);
|
|
91
91
|
const syncOnExpandedChange = (0, utils_1.useSync)(onExpandedChange);
|
|
92
|
-
const toggleExpanded = (
|
|
92
|
+
const toggleExpanded = (key) => {
|
|
93
93
|
const currentExpanded = expandedSet.has(key);
|
|
94
94
|
setInnerExpanded(o => {
|
|
95
95
|
const newExpanded = currentExpanded
|
|
@@ -98,7 +98,7 @@ exports.DataGrid = (0, react_1.memo)(({ slots, slotProps, columns, rows, rowProp
|
|
|
98
98
|
syncOnExpandedChange.current?.(newExpanded, key, !currentExpanded);
|
|
99
99
|
return newExpanded;
|
|
100
100
|
});
|
|
101
|
-
}
|
|
101
|
+
};
|
|
102
102
|
/**
|
|
103
103
|
* ---------------------------------------------------------------
|
|
104
104
|
* 分页
|
|
@@ -2,8 +2,8 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { ColorPropsValue, DivProps, Size } from '../../types';
|
|
3
3
|
import { DatePickerSharedProps, DateTimePickerProps } from '../dateTimePicker';
|
|
4
4
|
import { Dayjs } from 'dayjs';
|
|
5
|
-
type DateValueType = [Dayjs | null, Dayjs | null] | null;
|
|
6
|
-
type PickerType = 'start' | 'end';
|
|
5
|
+
export type DateValueType = [Dayjs | null, Dayjs | null] | null;
|
|
6
|
+
export type PickerType = 'start' | 'end';
|
|
7
7
|
export interface DateTimeRangePickerProps extends DatePickerSharedProps, Omit<DivProps, 'defaultValue' | 'onChange'> {
|
|
8
8
|
startPickerProps?: DateTimePickerProps;
|
|
9
9
|
endPickerProps?: DateTimePickerProps;
|
|
@@ -25,4 +25,3 @@ export interface DateTimeRangePickerProps extends DatePickerSharedProps, Omit<Di
|
|
|
25
25
|
autoFocus?: boolean;
|
|
26
26
|
}
|
|
27
27
|
export declare const DateTimeRangePicker: import("react").MemoExoticComponent<({ startPickerProps, endPickerProps, format, defaultValue, value, onChange, defaultOpenPicker, openPicker, onOpenPickerChange, autoClose, separator, min, max, disabledDates, disabledHours, disabledMinutes, disabledSeconds, variant, size, color, disabled, readOnly, autoFocus, ...props }: DateTimeRangePickerProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
28
|
-
export {};
|
|
@@ -24,7 +24,6 @@ exports.Tabs = (0, react_2.memo)(({ tabs, labelKey = 'label', primaryKey = 'valu
|
|
|
24
24
|
const setInnerValue = (value) => {
|
|
25
25
|
if (!readOnly && !disabled && value !== innerValue.current) {
|
|
26
26
|
_setInnerValue(value);
|
|
27
|
-
console.log(96, value);
|
|
28
27
|
variant === 'line' && setAnimating(true);
|
|
29
28
|
}
|
|
30
29
|
};
|
|
@@ -17,6 +17,7 @@ const Sweeping = ({ ref, in: _in = false, orientation = 'vertical', collapsedSiz
|
|
|
17
17
|
return typeof collapsedSize === 'function' ? collapsedSize() : collapsedSize;
|
|
18
18
|
};
|
|
19
19
|
const [size, setSize] = (0, react_1.useState)(() => !_in ? getCollapsedSize() : 'auto');
|
|
20
|
+
const [transiting, setTransiting] = (0, utils_1.useDerivedState)(true, [_in]);
|
|
20
21
|
const getFullSize = () => {
|
|
21
22
|
const el = innerRef.current;
|
|
22
23
|
let size;
|
|
@@ -69,7 +70,13 @@ const Sweeping = ({ ref, in: _in = false, orientation = 'vertical', collapsedSiz
|
|
|
69
70
|
: collapse();
|
|
70
71
|
}, [_in]);
|
|
71
72
|
return ((0, jsx_runtime_1.jsx)(transitionBase_1.TransitionBase, { ...props, ref: (0, utils_1.cloneRef)(ref, innerRef), in: _in, orientation: orientation, appear: appear, style: {
|
|
72
|
-
[styleProperty]: size,
|
|
73
|
+
...(transiting.current || !_in) && { [styleProperty]: size },
|
|
73
74
|
...props.style
|
|
75
|
+
}, onEntered: () => {
|
|
76
|
+
props.onEntered?.();
|
|
77
|
+
setTransiting(false);
|
|
78
|
+
}, onExited: () => {
|
|
79
|
+
props.onExited?.();
|
|
80
|
+
setTransiting(false);
|
|
74
81
|
} }));
|
|
75
82
|
};
|
|
@@ -140,7 +140,7 @@ export const Curd = memo((props) => {
|
|
|
140
140
|
const setInnerRows = (data) => {
|
|
141
141
|
setOptions?.(data);
|
|
142
142
|
_setInnerRows(data);
|
|
143
|
-
containerRef.current.scrollTop = 0;
|
|
143
|
+
containerRef.current.scrollTop = containerRef.current.scrollLeft = 0;
|
|
144
144
|
};
|
|
145
145
|
const [innerTotal, setInnerTotal] = useDerivedState(props.paginationProps?.total || 0);
|
|
146
146
|
const suppressReload = useRef(false);
|
|
@@ -85,7 +85,7 @@ export const DataGrid = memo(({ slots, slotProps, columns, rows, rowProps, prima
|
|
|
85
85
|
return new Set(innerExpanded.current);
|
|
86
86
|
}, [innerExpanded.current]);
|
|
87
87
|
const syncOnExpandedChange = useSync(onExpandedChange);
|
|
88
|
-
const toggleExpanded =
|
|
88
|
+
const toggleExpanded = (key) => {
|
|
89
89
|
const currentExpanded = expandedSet.has(key);
|
|
90
90
|
setInnerExpanded(o => {
|
|
91
91
|
const newExpanded = currentExpanded
|
|
@@ -94,7 +94,7 @@ export const DataGrid = memo(({ slots, slotProps, columns, rows, rowProps, prima
|
|
|
94
94
|
syncOnExpandedChange.current?.(newExpanded, key, !currentExpanded);
|
|
95
95
|
return newExpanded;
|
|
96
96
|
});
|
|
97
|
-
}
|
|
97
|
+
};
|
|
98
98
|
/**
|
|
99
99
|
* ---------------------------------------------------------------
|
|
100
100
|
* 分页
|
|
@@ -2,8 +2,8 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { ColorPropsValue, DivProps, Size } from '../../types.js';
|
|
3
3
|
import { DatePickerSharedProps, DateTimePickerProps } from '../dateTimePicker/index.js';
|
|
4
4
|
import { Dayjs } from 'dayjs';
|
|
5
|
-
type DateValueType = [Dayjs | null, Dayjs | null] | null;
|
|
6
|
-
type PickerType = 'start' | 'end';
|
|
5
|
+
export type DateValueType = [Dayjs | null, Dayjs | null] | null;
|
|
6
|
+
export type PickerType = 'start' | 'end';
|
|
7
7
|
export interface DateTimeRangePickerProps extends DatePickerSharedProps, Omit<DivProps, 'defaultValue' | 'onChange'> {
|
|
8
8
|
startPickerProps?: DateTimePickerProps;
|
|
9
9
|
endPickerProps?: DateTimePickerProps;
|
|
@@ -25,4 +25,3 @@ export interface DateTimeRangePickerProps extends DatePickerSharedProps, Omit<Di
|
|
|
25
25
|
autoFocus?: boolean;
|
|
26
26
|
}
|
|
27
27
|
export declare const DateTimeRangePicker: import("react").MemoExoticComponent<({ startPickerProps, endPickerProps, format, defaultValue, value, onChange, defaultOpenPicker, openPicker, onOpenPickerChange, autoClose, separator, min, max, disabledDates, disabledHours, disabledMinutes, disabledSeconds, variant, size, color, disabled, readOnly, autoFocus, ...props }: DateTimeRangePickerProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
28
|
-
export {};
|
|
@@ -20,7 +20,6 @@ export const Tabs = memo(({ tabs, labelKey = 'label', primaryKey = 'value', size
|
|
|
20
20
|
const setInnerValue = (value) => {
|
|
21
21
|
if (!readOnly && !disabled && value !== innerValue.current) {
|
|
22
22
|
_setInnerValue(value);
|
|
23
|
-
console.log(96, value);
|
|
24
23
|
variant === 'line' && setAnimating(true);
|
|
25
24
|
}
|
|
26
25
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import { useLayoutEffect, useRef, useState } from 'react';
|
|
3
3
|
import { TransitionBase } from './transitionBase.js';
|
|
4
|
-
import { cloneRef, useUpdateEffect } from '../../utils/index.js';
|
|
4
|
+
import { cloneRef, useDerivedState, useUpdateEffect } from '../../utils/index.js';
|
|
5
5
|
export const Collapse = ({ transitionType = 'sweeping', ...props }) => {
|
|
6
6
|
const Component = transitionType === 'sweeping' ? Sweeping : TransitionBase;
|
|
7
7
|
return (_jsx(Component, { ...props, _mode: transitionType === 'sweeping' ? '_sweeping' : 'collapse' }));
|
|
@@ -13,6 +13,7 @@ const Sweeping = ({ ref, in: _in = false, orientation = 'vertical', collapsedSiz
|
|
|
13
13
|
return typeof collapsedSize === 'function' ? collapsedSize() : collapsedSize;
|
|
14
14
|
};
|
|
15
15
|
const [size, setSize] = useState(() => !_in ? getCollapsedSize() : 'auto');
|
|
16
|
+
const [transiting, setTransiting] = useDerivedState(true, [_in]);
|
|
16
17
|
const getFullSize = () => {
|
|
17
18
|
const el = innerRef.current;
|
|
18
19
|
let size;
|
|
@@ -65,7 +66,13 @@ const Sweeping = ({ ref, in: _in = false, orientation = 'vertical', collapsedSiz
|
|
|
65
66
|
: collapse();
|
|
66
67
|
}, [_in]);
|
|
67
68
|
return (_jsx(TransitionBase, { ...props, ref: cloneRef(ref, innerRef), in: _in, orientation: orientation, appear: appear, style: {
|
|
68
|
-
[styleProperty]: size,
|
|
69
|
+
...(transiting.current || !_in) && { [styleProperty]: size },
|
|
69
70
|
...props.style
|
|
71
|
+
}, onEntered: () => {
|
|
72
|
+
props.onEntered?.();
|
|
73
|
+
setTransiting(false);
|
|
74
|
+
}, onExited: () => {
|
|
75
|
+
props.onExited?.();
|
|
76
|
+
setTransiting(false);
|
|
70
77
|
} }));
|
|
71
78
|
};
|