@canlooks/can-ui 0.0.168 → 0.0.170
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/curdColumnConfig.d.ts +4 -4
- package/dist/cjs/components/curd/curdColumnConfig.js +3 -3
- package/dist/cjs/components/tabs/tab.d.ts +4 -2
- package/dist/cjs/components/tabs/tab.js +15 -15
- package/dist/cjs/components/tabs/tabs.js +7 -6
- package/dist/cjs/components/tabs/tabs.style.d.ts +1 -0
- package/dist/cjs/components/tabs/tabs.style.js +16 -7
- package/dist/cjs/components/transitionBase/collapse.d.ts +1 -1
- package/dist/cjs/components/transitionBase/collapse.js +41 -30
- package/dist/cjs/components/transitionBase/transitionBase.js +7 -2
- package/dist/cjs/components/transitionBase/transitionBase.style.d.ts +3 -3
- package/dist/cjs/components/transitionBase/transitionBase.style.js +82 -99
- package/dist/cjs/utils/curd.d.ts +3 -3
- package/dist/cjs/utils/curd.js +3 -21
- package/dist/esm/components/curd/curdColumnConfig.d.ts +4 -4
- package/dist/esm/components/curd/curdColumnConfig.js +3 -3
- package/dist/esm/components/tabs/tab.d.ts +4 -2
- package/dist/esm/components/tabs/tab.js +15 -15
- package/dist/esm/components/tabs/tabs.js +8 -7
- package/dist/esm/components/tabs/tabs.style.d.ts +1 -0
- package/dist/esm/components/tabs/tabs.style.js +16 -7
- package/dist/esm/components/transitionBase/collapse.d.ts +1 -1
- package/dist/esm/components/transitionBase/collapse.js +43 -32
- package/dist/esm/components/transitionBase/transitionBase.js +9 -4
- package/dist/esm/components/transitionBase/transitionBase.style.d.ts +3 -3
- package/dist/esm/components/transitionBase/transitionBase.style.js +80 -98
- package/dist/esm/utils/curd.d.ts +3 -3
- package/dist/esm/utils/curd.js +3 -21
- package/package.json +1 -1
|
@@ -3,9 +3,9 @@ import { CurdColumn } from './curd';
|
|
|
3
3
|
import { RowType } from '../dataGrid';
|
|
4
4
|
import { Id } from '../../types';
|
|
5
5
|
export type CurdColumnConfigProps<R extends RowType> = {
|
|
6
|
-
columns
|
|
7
|
-
innerVisible: Id[];
|
|
8
|
-
setInnerVisible: Dispatch<SetStateAction<Id[]>>;
|
|
9
|
-
setInnerOrder: Dispatch<SetStateAction<Id[]>>;
|
|
6
|
+
columns: CurdColumn<R>[] | undefined;
|
|
7
|
+
innerVisible: Id[] | undefined;
|
|
8
|
+
setInnerVisible: Dispatch<SetStateAction<Id[] | undefined>>;
|
|
9
|
+
setInnerOrder: Dispatch<SetStateAction<Id[] | undefined>>;
|
|
10
10
|
};
|
|
11
11
|
export declare const CurdColumnConfig: <R extends RowType>(props: CurdColumnConfigProps<R>) => ReactElement;
|
|
@@ -33,16 +33,16 @@ const CurdColumnConfigContent = (0, react_1.memo)(({ columns, innerVisible, setI
|
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
35
|
const visibleSet = (0, react_1.useMemo)(() => {
|
|
36
|
-
return new Set(innerVisible);
|
|
36
|
+
return innerVisible && new Set(innerVisible);
|
|
37
37
|
}, [innerVisible]);
|
|
38
38
|
const toggleVisible = (key, checked) => {
|
|
39
|
-
!(0, utils_1.isUnset)(key) && setInnerVisible(o => checked
|
|
39
|
+
!(0, utils_1.isUnset)(key) && setInnerVisible((o = []) => checked
|
|
40
40
|
? [...o, key]
|
|
41
41
|
: o.filter(k => k !== key));
|
|
42
42
|
};
|
|
43
43
|
return ((0, jsx_runtime_1.jsx)(bubble_1.Bubble, { css: curdColumnConfig_style_1.style, open: open, onOpenChange: openChangeHandler, placement: "bottomRight", trigger: ['hover', 'click'], content: (0, jsx_runtime_1.jsxs)("div", { className: curdColumnConfig_style_1.classes.content, children: [(0, jsx_runtime_1.jsxs)("div", { className: curdColumnConfig_style_1.classes.title, children: [(0, jsx_runtime_1.jsx)("div", { className: curdColumnConfig_style_1.classes.titleText, children: "\u5217\u8BBE\u7F6E" }), (0, jsx_runtime_1.jsx)("div", { className: curdColumnConfig_style_1.classes.description, children: "\u62D6\u62FD\u8C03\u6574\u987A\u5E8F" })] }), columns?.map((col, i) => {
|
|
44
44
|
const id = col._key;
|
|
45
|
-
const checked = !(0, utils_1.isUnset)(id) && visibleSet.has(id);
|
|
45
|
+
const checked = !(0, utils_1.isUnset)(id) && (!visibleSet || visibleSet.has(id));
|
|
46
46
|
return ((0, jsx_runtime_1.jsx)(sortableItem_1.SortableItem, { id: id ?? i, index: i, component: menuItem_1.MenuItem, className: curdColumnConfig_style_1.classes.item, prefix: (0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { className: curdColumnConfig_style_1.classes.checkbox, checked: checked, onChange: e => {
|
|
47
47
|
e.stopPropagation();
|
|
48
48
|
toggleVisible(id, e.target.checked);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode, Ref } from 'react';
|
|
2
2
|
import { ColorPropsValue, DivProps, Id } from '../../types';
|
|
3
3
|
export interface TabProps extends Omit<DivProps, 'prefix'> {
|
|
4
4
|
prefix?: ReactNode;
|
|
@@ -17,5 +17,7 @@ export interface TabProps extends Omit<DivProps, 'prefix'> {
|
|
|
17
17
|
_active?: boolean;
|
|
18
18
|
/** @private */
|
|
19
19
|
_index?: number;
|
|
20
|
+
/** @private */
|
|
21
|
+
_tabRef?: Ref<HTMLDivElement>;
|
|
20
22
|
}
|
|
21
|
-
export declare const Tab: React.MemoExoticComponent<({ prefix, suffix, color, orientation, label, value, disabled, closable, onClose, sortable, _active, _index, ...props }: TabProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
23
|
+
export declare const Tab: React.MemoExoticComponent<({ prefix, suffix, color, orientation, label, value, disabled, closable, onClose, sortable, _active, _index, _tabRef, ...props }: TabProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
@@ -9,34 +9,34 @@ const tabs_1 = require("./tabs");
|
|
|
9
9
|
const button_1 = require("../button");
|
|
10
10
|
const faXmark_1 = require("@fortawesome/free-solid-svg-icons/faXmark");
|
|
11
11
|
const icon_1 = require("../icon");
|
|
12
|
-
const transitionBase_1 = require("../transitionBase");
|
|
13
12
|
const sortable_1 = require("@dnd-kit/react/sortable");
|
|
14
|
-
|
|
13
|
+
const transitionBase_1 = require("../transitionBase");
|
|
14
|
+
exports.Tab = (0, react_1.memo)(({ prefix, suffix, color, orientation, label, value, disabled, closable, onClose, sortable, _active, _index, _tabRef, ...props }) => {
|
|
15
15
|
const context = (0, tabs_1.useTabsContext)();
|
|
16
16
|
const colorValue = (0, utils_1.useColor)(color ?? context.color);
|
|
17
17
|
const _closable = closable ?? context.closable;
|
|
18
18
|
const closeHandler = (e) => {
|
|
19
|
+
e.stopPropagation();
|
|
19
20
|
onClose?.(e);
|
|
20
21
|
context.onClose?.(value);
|
|
21
22
|
};
|
|
22
23
|
const _sortable = sortable ?? context.sortable;
|
|
24
|
+
const showBorder = context.variant === 'line' && !context.animating && _active;
|
|
23
25
|
const { ref } = (0, sortable_1.useSortable)({
|
|
24
26
|
id: value,
|
|
25
27
|
index: _index,
|
|
26
28
|
disabled: !_sortable
|
|
27
29
|
});
|
|
28
|
-
return ((0, jsx_runtime_1.
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(transitionBase_1.Collapse, { ...(0, utils_1.mergeComponentProps)(props, {
|
|
29
31
|
ref,
|
|
30
|
-
className: tabs_style_1.classes.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
(0, jsx_runtime_1.jsx)("div", { className: tabs_style_1.classes.tabSuffix, children: suffix }), _closable &&
|
|
41
|
-
(0, jsx_runtime_1.jsx)(button_1.Button, { className: tabs_style_1.classes.tabClose, variant: "text", color: "text.secondary", onClick: closeHandler, children: (0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faXmark_1.faXmark }) })] }));
|
|
32
|
+
className: tabs_style_1.classes.tabTransition
|
|
33
|
+
}), orientation: "horizontal", className: tabs_style_1.classes.tabTransition, children: (0, jsx_runtime_1.jsx)("div", { className: tabs_style_1.classes.tabWrapper, children: (0, jsx_runtime_1.jsxs)("div", { ref: _tabRef, className: tabs_style_1.classes.tab, style: {
|
|
34
|
+
borderColor: showBorder ? colorValue : void 0,
|
|
35
|
+
color: _active ? colorValue : void 0
|
|
36
|
+
}, onClick: e => {
|
|
37
|
+
!disabled && props.onClick?.(e);
|
|
38
|
+
}, "data-color": colorValue, "data-disabled": disabled, "data-orientation": orientation, "data-active": _active, children: [!!prefix &&
|
|
39
|
+
(0, jsx_runtime_1.jsx)("div", { className: tabs_style_1.classes.tabPrefix, children: prefix }), (0, jsx_runtime_1.jsx)("div", { className: tabs_style_1.classes.label, children: label }), !!suffix &&
|
|
40
|
+
(0, jsx_runtime_1.jsx)("div", { className: tabs_style_1.classes.tabSuffix, children: suffix }), _closable &&
|
|
41
|
+
(0, jsx_runtime_1.jsx)(button_1.Button, { className: tabs_style_1.classes.tabClose, variant: "text", color: "text.secondary", onClick: closeHandler, children: (0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faXmark_1.faXmark }) })] }) }) }));
|
|
42
42
|
});
|
|
@@ -22,12 +22,13 @@ exports.Tabs = (0, react_2.memo)(({ tabs, labelKey = 'label', primaryKey = 'valu
|
|
|
22
22
|
size ??= theme.size;
|
|
23
23
|
const [innerValue, _setInnerValue] = (0, utils_1.useControlled)(defaultValue, value, onChange);
|
|
24
24
|
const setInnerValue = (value) => {
|
|
25
|
-
if (!readOnly && !disabled) {
|
|
25
|
+
if (!readOnly && !disabled && value !== innerValue.current) {
|
|
26
26
|
_setInnerValue(value);
|
|
27
|
+
console.log(96, value);
|
|
27
28
|
variant === 'line' && setAnimating(true);
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
|
-
const [animating, setAnimating] = (0,
|
|
31
|
+
const [animating, setAnimating] = (0, react_2.useState)(false);
|
|
31
32
|
const setValueInEllipsis = (value) => {
|
|
32
33
|
shouldScroll.current = true;
|
|
33
34
|
setInnerValue(value);
|
|
@@ -39,7 +40,7 @@ exports.Tabs = (0, react_2.memo)(({ tabs, labelKey = 'label', primaryKey = 'valu
|
|
|
39
40
|
return tabs.map((p, i) => {
|
|
40
41
|
const value = p[primaryKey];
|
|
41
42
|
const active = !(0, utils_1.isUnset)(value) && value === innerValue.current;
|
|
42
|
-
return ((0, react_1.createElement)(tab_1.Tab, { ...p, key: p.key ?? value ?? i,
|
|
43
|
+
return ((0, react_1.createElement)(tab_1.Tab, { ...p, key: p.key ?? value ?? i, _tabRef: el => {
|
|
43
44
|
el
|
|
44
45
|
? tabRefs.current.set(value, el)
|
|
45
46
|
: tabRefs.current.delete(value);
|
|
@@ -134,13 +135,13 @@ exports.Tabs = (0, react_2.memo)(({ tabs, labelKey = 'label', primaryKey = 'valu
|
|
|
134
135
|
newTabs && props.onSort(e, newTabs);
|
|
135
136
|
}
|
|
136
137
|
};
|
|
137
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ...props, css: (0, tabs_style_1.useStyle)({ color, variant }), className: (0, utils_1.clsx)(tabs_style_1.classes.root, props.className), "data-size": size, "data-position": position, "data-animating": animating
|
|
138
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ...props, css: (0, tabs_style_1.useStyle)({ color, variant }), className: (0, utils_1.clsx)(tabs_style_1.classes.root, props.className), "data-size": size, "data-position": position, "data-animating": animating, "data-full-width": fullWidth, "data-read-only": readOnly, "data-disabled": disabled, children: [(0, jsx_runtime_1.jsx)("div", { className: tabs_style_1.classes.start, "data-show": shadowStart, children: !!prefix &&
|
|
138
139
|
(0, jsx_runtime_1.jsx)("div", { className: tabs_style_1.classes.prefix, children: prefix }) }), (0, jsx_runtime_1.jsx)("div", { ref: scrollRef, className: tabs_style_1.classes.scroll, onScroll: setShadow, children: (0, jsx_runtime_1.jsx)("div", { className: tabs_style_1.classes.scrollWrap, style: { justifyContent }, children: (0, jsx_runtime_1.jsxs)(TabsContext, { value: (0, react_2.useMemo)(() => ({
|
|
139
140
|
color, variant, closable, onClose, sortable,
|
|
140
|
-
animating
|
|
141
|
+
animating, setAnimating
|
|
141
142
|
}), [
|
|
142
143
|
color, variant, closable, onClose, sortable,
|
|
143
|
-
animating
|
|
144
|
+
animating
|
|
144
145
|
]), children: [(0, jsx_runtime_1.jsx)(react_3.DragDropProvider, { sensors: utils_1.defaultSensors, onDragEnd: dragEndHandler, children: (0, jsx_runtime_1.jsx)(react_transition_group_1.TransitionGroup, { component: null, children: renderTabs() }) }), variant === 'line' &&
|
|
145
146
|
(0, jsx_runtime_1.jsx)(lineIndicator_1.LineIndicator, { value: innerValue.current, position: position, getActiveTab: getActiveTab })] }) }) }), (0, jsx_runtime_1.jsx)("div", { className: tabs_style_1.classes.end, "data-show": shadowEnd, children: !!(suffix || shadowStart || shadowEnd) &&
|
|
146
147
|
(0, jsx_runtime_1.jsxs)("div", { className: tabs_style_1.classes.suffix, children: [(shadowStart || shadowEnd) &&
|
|
@@ -12,6 +12,7 @@ exports.classes = (0, utils_1.defineInnerClasses)('tabs', [
|
|
|
12
12
|
'ellipsis',
|
|
13
13
|
'prefix',
|
|
14
14
|
'suffix',
|
|
15
|
+
'tabTransition',
|
|
15
16
|
'tabWrapper',
|
|
16
17
|
'tab',
|
|
17
18
|
'label',
|
|
@@ -36,6 +37,7 @@ function useStyle({ color, variant }) {
|
|
|
36
37
|
display: flex;
|
|
37
38
|
scrollbar-width: none;
|
|
38
39
|
position: relative;
|
|
40
|
+
overflow: auto;
|
|
39
41
|
|
|
40
42
|
&::-webkit-scrollbar {
|
|
41
43
|
display: none;
|
|
@@ -127,6 +129,10 @@ function useStyle({ color, variant }) {
|
|
|
127
129
|
position: absolute;
|
|
128
130
|
}
|
|
129
131
|
|
|
132
|
+
.${exports.classes.tabTransition} { {
|
|
133
|
+
z-index: 1;
|
|
134
|
+
}}
|
|
135
|
+
|
|
130
136
|
.${exports.classes.tab} {
|
|
131
137
|
display: flex;
|
|
132
138
|
align-items: center;
|
|
@@ -136,7 +142,6 @@ function useStyle({ color, variant }) {
|
|
|
136
142
|
white-space: nowrap;
|
|
137
143
|
text-overflow: ellipsis;
|
|
138
144
|
overflow: hidden;
|
|
139
|
-
z-index: 1;
|
|
140
145
|
-webkit-tap-highlight-color: transparent;
|
|
141
146
|
transition: background-color, color .25s ${easing.easeOut};
|
|
142
147
|
|
|
@@ -229,8 +234,8 @@ function useStyle({ color, variant }) {
|
|
|
229
234
|
variant === 'line'
|
|
230
235
|
? (0, react_1.css) `
|
|
231
236
|
@layer reset {
|
|
232
|
-
.${exports.classes.
|
|
233
|
-
|
|
237
|
+
.${exports.classes.tabWrapper} {
|
|
238
|
+
padding: 0 ${spacing[5]}px;
|
|
234
239
|
}
|
|
235
240
|
|
|
236
241
|
&[data-position=top],
|
|
@@ -313,10 +318,6 @@ function useStyle({ color, variant }) {
|
|
|
313
318
|
// variant === 'card'
|
|
314
319
|
: (0, react_1.css) `
|
|
315
320
|
@layer reset {
|
|
316
|
-
.${exports.classes.scrollWrap} {
|
|
317
|
-
gap: ${spacing[1]}px;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
321
|
.${exports.classes.tab} {
|
|
321
322
|
border: 1px solid ${gray(.1)};
|
|
322
323
|
background-color: ${background.body};
|
|
@@ -328,6 +329,10 @@ function useStyle({ color, variant }) {
|
|
|
328
329
|
|
|
329
330
|
&[data-position=top],
|
|
330
331
|
&[data-position=bottom] {
|
|
332
|
+
.${exports.classes.tabWrapper} {
|
|
333
|
+
padding: 0 2px;
|
|
334
|
+
}
|
|
335
|
+
|
|
331
336
|
.${exports.classes.tab} {
|
|
332
337
|
padding: 10px 15px;
|
|
333
338
|
}
|
|
@@ -367,6 +372,10 @@ function useStyle({ color, variant }) {
|
|
|
367
372
|
|
|
368
373
|
&[data-position=left],
|
|
369
374
|
&[data-position=right] {
|
|
375
|
+
.${exports.classes.tabWrapper} {
|
|
376
|
+
padding: 2px 0;
|
|
377
|
+
}
|
|
378
|
+
|
|
370
379
|
.${exports.classes.tab} {
|
|
371
380
|
padding: 9px 18px;
|
|
372
381
|
}
|
|
@@ -10,55 +10,66 @@ const Collapse = ({ transitionType = 'sweeping', ...props }) => {
|
|
|
10
10
|
return ((0, jsx_runtime_1.jsx)(Component, { ...props, _mode: transitionType === 'sweeping' ? '_sweeping' : 'collapse' }));
|
|
11
11
|
};
|
|
12
12
|
exports.Collapse = Collapse;
|
|
13
|
-
const Sweeping = ({ ref, in: _in = false,
|
|
13
|
+
const Sweeping = ({ ref, in: _in = false, orientation = 'vertical', collapsedSize = 0, appear = true, ...props }) => {
|
|
14
14
|
const innerRef = (0, react_1.useRef)(null);
|
|
15
|
+
const styleProperty = orientation === 'vertical' ? 'height' : 'width';
|
|
15
16
|
const getCollapsedSize = () => {
|
|
16
17
|
return typeof collapsedSize === 'function' ? collapsedSize() : collapsedSize;
|
|
17
18
|
};
|
|
18
|
-
const [size, setSize] = (0, react_1.useState)(() =>
|
|
19
|
-
|
|
20
|
-
return 'auto';
|
|
21
|
-
}
|
|
22
|
-
return getCollapsedSize();
|
|
23
|
-
});
|
|
24
|
-
const [isEntered, setIsEntered] = (0, react_1.useState)(_in && !appear);
|
|
25
|
-
const styleProperty = orientation === 'vertical' ? 'height' : 'width';
|
|
26
|
-
const expand = () => {
|
|
19
|
+
const [size, setSize] = (0, react_1.useState)(() => !_in ? getCollapsedSize() : 'auto');
|
|
20
|
+
const getFullSize = () => {
|
|
27
21
|
const el = innerRef.current;
|
|
22
|
+
let size;
|
|
28
23
|
if (el) {
|
|
29
24
|
el.style.transition = 'none';
|
|
25
|
+
const originalSize = el.style[styleProperty];
|
|
30
26
|
el.style[styleProperty] = 'auto';
|
|
31
|
-
|
|
32
|
-
el.style[styleProperty] =
|
|
27
|
+
size = el[orientation === 'vertical' ? 'offsetHeight' : 'offsetWidth'];
|
|
28
|
+
el.style[styleProperty] = originalSize;
|
|
33
29
|
el.style.transition = '';
|
|
30
|
+
}
|
|
31
|
+
return size;
|
|
32
|
+
};
|
|
33
|
+
const expand = (fromSize) => {
|
|
34
|
+
const fullSize = getFullSize();
|
|
35
|
+
if (typeof fullSize !== 'undefined') {
|
|
36
|
+
if (typeof fromSize !== 'undefined') {
|
|
37
|
+
const el = innerRef.current;
|
|
38
|
+
el.style[styleProperty] = fromSize + 'px';
|
|
39
|
+
}
|
|
34
40
|
requestAnimationFrame(() => {
|
|
35
|
-
setSize(
|
|
41
|
+
setSize(fullSize);
|
|
36
42
|
});
|
|
37
43
|
}
|
|
38
44
|
};
|
|
45
|
+
const getCurrentSize = () => {
|
|
46
|
+
const el = innerRef.current;
|
|
47
|
+
if (el) {
|
|
48
|
+
return el[orientation === 'vertical' ? 'offsetHeight' : 'offsetWidth'];
|
|
49
|
+
}
|
|
50
|
+
};
|
|
39
51
|
const collapse = () => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
const currentSize = getCurrentSize();
|
|
53
|
+
if (typeof currentSize !== 'undefined') {
|
|
54
|
+
const el = innerRef.current;
|
|
55
|
+
el.style[styleProperty] = currentSize + 'px';
|
|
56
|
+
requestAnimationFrame(() => {
|
|
57
|
+
setSize(getCollapsedSize());
|
|
58
|
+
});
|
|
59
|
+
}
|
|
44
60
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// 首次渲染
|
|
49
|
-
mounted.current = true;
|
|
50
|
-
if (!appear) {
|
|
51
|
-
// 若appear为false,则跳过首次动画
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
61
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
62
|
+
if (_in && appear) {
|
|
63
|
+
expand(getCollapsedSize());
|
|
54
64
|
}
|
|
65
|
+
}, []);
|
|
66
|
+
(0, utils_1.useUpdateEffect)(() => {
|
|
55
67
|
_in
|
|
56
68
|
? expand()
|
|
57
69
|
: collapse();
|
|
58
70
|
}, [_in]);
|
|
59
|
-
return ((0, jsx_runtime_1.jsx)(transitionBase_1.TransitionBase, { ...props,
|
|
60
|
-
[styleProperty]:
|
|
61
|
-
...!isEntered && { overflow: 'hidden' },
|
|
71
|
+
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,
|
|
62
73
|
...props.style
|
|
63
|
-
}
|
|
74
|
+
} }));
|
|
64
75
|
};
|
|
@@ -14,7 +14,7 @@ exports.TransitionBase = (({ ref, component: Component = 'div', orientation = 'v
|
|
|
14
14
|
cssArr.push(transitionBase_style_1.fadeStyle);
|
|
15
15
|
switch (_mode) {
|
|
16
16
|
case '_sweeping':
|
|
17
|
-
cssArr.push(transitionBase_style_1.
|
|
17
|
+
cssArr.push((0, transitionBase_style_1.useSweepingStyle)({ orientation }));
|
|
18
18
|
break;
|
|
19
19
|
case 'collapse':
|
|
20
20
|
case 'grow':
|
|
@@ -25,5 +25,10 @@ exports.TransitionBase = (({ ref, component: Component = 'div', orientation = 'v
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
const innerRef = (0, react_1.useRef)(null);
|
|
28
|
-
|
|
28
|
+
const firstOpenChanged = (0, react_1.useRef)(false);
|
|
29
|
+
(0, utils_1.useUpdateEffect)(() => {
|
|
30
|
+
firstOpenChanged.current = true;
|
|
31
|
+
}, [props.in]);
|
|
32
|
+
const unInitClass = !firstOpenChanged.current && !props.in && 'exit-done';
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(react_transition_group_1.CSSTransition, { ...props, css: cssArr, nodeRef: innerRef, className: (0, utils_1.clsx)(transitionBase_style_1.classes.root, props.className, unInitClass), timeout: timeout, appear: appear, children: (0, jsx_runtime_1.jsx)(Component, { ref: (0, utils_1.cloneRef)(ref, innerRef), children: props.children }) }));
|
|
29
34
|
});
|
|
@@ -4,6 +4,6 @@ export declare const classes: {
|
|
|
4
4
|
};
|
|
5
5
|
export declare function useTransitionBaseStyle({ timeout }: Required<Pick<TransitionBaseProps<any>, 'timeout'>>): import("@emotion/utils").SerializedStyles;
|
|
6
6
|
export declare const fadeStyle: () => import("@emotion/utils").SerializedStyles;
|
|
7
|
-
export declare
|
|
8
|
-
export declare function useGrowAndCollapseStyle({ orientation, _mode }: Required<Pick<TransitionBaseProps
|
|
9
|
-
export declare function useSlideStyle({ direction, offset }: Required<Pick<TransitionBaseProps
|
|
7
|
+
export declare function useSweepingStyle({ orientation }: Required<Pick<TransitionBaseProps, 'orientation'>>): import("@emotion/utils").SerializedStyles;
|
|
8
|
+
export declare function useGrowAndCollapseStyle({ orientation, _mode }: Required<Pick<TransitionBaseProps, 'orientation' | '_mode'>>): import("@emotion/utils").SerializedStyles;
|
|
9
|
+
export declare function useSlideStyle({ direction, offset }: Required<Pick<TransitionBaseProps, 'direction' | 'offset'>>): import("@emotion/utils").SerializedStyles;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.fadeStyle = exports.classes = void 0;
|
|
4
4
|
exports.useTransitionBaseStyle = useTransitionBaseStyle;
|
|
5
|
+
exports.useSweepingStyle = useSweepingStyle;
|
|
5
6
|
exports.useGrowAndCollapseStyle = useGrowAndCollapseStyle;
|
|
6
7
|
exports.useSlideStyle = useSlideStyle;
|
|
7
8
|
const react_1 = require("@emotion/react");
|
|
@@ -12,6 +13,7 @@ function useTransitionBaseStyle({ timeout }) {
|
|
|
12
13
|
return (0, utils_1.useCss)(() => (0, react_1.css) `
|
|
13
14
|
@layer reset {
|
|
14
15
|
${timeoutIsNumber ? `transition-duration: ${timeout}ms;` : ''}
|
|
16
|
+
|
|
15
17
|
&.appear-active {
|
|
16
18
|
${!timeoutIsNumber ? `transition-duration: ${timeout.appear}ms;` : ''}
|
|
17
19
|
}
|
|
@@ -28,126 +30,107 @@ function useTransitionBaseStyle({ timeout }) {
|
|
|
28
30
|
}
|
|
29
31
|
exports.fadeStyle = (0, utils_1.defineCss)(({ easing }) => (0, react_1.css) `
|
|
30
32
|
@layer reset {
|
|
31
|
-
transition-property: opacity;
|
|
32
|
-
transition-timing-function: ${easing.easeOut};
|
|
33
|
-
|
|
34
|
-
&,
|
|
35
33
|
&.appear,
|
|
36
|
-
&.
|
|
34
|
+
&.exit,
|
|
35
|
+
&.exit-done {
|
|
37
36
|
opacity: 0;
|
|
38
37
|
}
|
|
39
|
-
|
|
38
|
+
|
|
40
39
|
&.appear-active,
|
|
41
|
-
&.enter
|
|
42
|
-
&.enter-done
|
|
43
|
-
&.exit {
|
|
40
|
+
&.enter,
|
|
41
|
+
&.enter-done {
|
|
44
42
|
opacity: 1;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
&.exit-active,
|
|
48
|
-
&.exit-done {
|
|
49
|
-
opacity: 0;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
`);
|
|
53
|
-
exports.sweepingStyle = (0, utils_1.defineCss)(({ easing }) => (0, react_1.css) `
|
|
54
|
-
@layer reset {
|
|
55
|
-
transition-property: opacity, width, height;
|
|
56
|
-
|
|
57
45
|
&.appear-active,
|
|
58
46
|
&.enter-active,
|
|
59
|
-
&.
|
|
60
|
-
transition-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&.exit-active,
|
|
64
|
-
&.exit-done {
|
|
47
|
+
&.exit-active {
|
|
48
|
+
transition-property: opacity;
|
|
65
49
|
transition-timing-function: ${easing.easeOut};
|
|
66
50
|
}
|
|
67
51
|
}
|
|
68
52
|
`);
|
|
53
|
+
function useSweepingStyle({ orientation }) {
|
|
54
|
+
return (0, utils_1.useCss)(() => (0, react_1.css) `
|
|
55
|
+
@layer reset {
|
|
56
|
+
&.appear,
|
|
57
|
+
&.appear-active,
|
|
58
|
+
&.enter-active,
|
|
59
|
+
&.exit,
|
|
60
|
+
&.exit-active,
|
|
61
|
+
&.exit-done {
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&.appear-active,
|
|
66
|
+
&.enter-active,
|
|
67
|
+
&.exit-active {
|
|
68
|
+
transition-property: opacity, width, height;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`, [orientation]);
|
|
72
|
+
}
|
|
69
73
|
function useGrowAndCollapseStyle({ orientation, _mode }) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
transition-property: opacity, transform;
|
|
79
|
-
${_mode === 'collapse' ? `transform-origin: ${orientation === 'vertical' ? 'top' : 'left'};` : ''}
|
|
80
|
-
&,
|
|
81
|
-
&.appear,
|
|
82
|
-
&.enter {
|
|
83
|
-
transform: ${transformMethod}(0);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
&.appear-active,
|
|
87
|
-
&.enter-active,
|
|
88
|
-
&.enter-done,
|
|
89
|
-
&.exit {
|
|
90
|
-
transform: scale(1);
|
|
91
|
-
}
|
|
74
|
+
let transformMethod = _mode === 'grow'
|
|
75
|
+
? 'scale'
|
|
76
|
+
: orientation === 'vertical'
|
|
77
|
+
? 'scaleY'
|
|
78
|
+
: 'scaleX';
|
|
79
|
+
return (0, utils_1.useCss)(() => (0, react_1.css) `
|
|
80
|
+
@layer reset {
|
|
81
|
+
${_mode === 'collapse' ? `transform-origin: ${orientation === 'vertical' ? 'top' : 'left'};` : ''}
|
|
92
82
|
|
|
93
|
-
|
|
94
|
-
&.exit-done {
|
|
95
|
-
transform: ${transformMethod}(0);
|
|
96
|
-
}
|
|
83
|
+
transition-property: opacity, transform;
|
|
97
84
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
85
|
+
&.appear,
|
|
86
|
+
&.exit,
|
|
87
|
+
&.exit-done {
|
|
88
|
+
transform: ${transformMethod}(0);
|
|
89
|
+
}
|
|
102
90
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
91
|
+
&.appear-active,
|
|
92
|
+
&.enter,
|
|
93
|
+
&.enter-done {
|
|
94
|
+
transform: scale(1);
|
|
106
95
|
}
|
|
107
|
-
|
|
108
|
-
|
|
96
|
+
|
|
97
|
+
&.appear-active,
|
|
98
|
+
&.enter-active,
|
|
99
|
+
&.exit-active {
|
|
100
|
+
transition-property: opacity, transform;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`, [orientation, _mode]);
|
|
109
104
|
}
|
|
110
105
|
function useSlideStyle({ direction, offset }) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
transition-property: opacity, transform;
|
|
120
|
-
|
|
121
|
-
&,
|
|
122
|
-
&.appear,
|
|
123
|
-
&.enter {
|
|
124
|
-
pointer-events: none;
|
|
125
|
-
transform: ${transformMethod}(${offsetValue});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
&.appear-active,
|
|
129
|
-
&.enter-active,
|
|
130
|
-
&.enter-done,
|
|
131
|
-
&.exit {
|
|
132
|
-
pointer-events: inherit;
|
|
133
|
-
transform: translate(0);
|
|
134
|
-
}
|
|
106
|
+
const transformMethod = direction === 'up' || direction === 'down' ? 'translateY' : 'translateX';
|
|
107
|
+
let offsetValue = typeof offset === 'number' ? `${offset}px` : offset;
|
|
108
|
+
if (direction === 'down' || direction === 'right') {
|
|
109
|
+
offsetValue = '-' + offsetValue;
|
|
110
|
+
}
|
|
111
|
+
return (0, utils_1.useCss)(() => (0, react_1.css) `
|
|
112
|
+
@layer reset {
|
|
113
|
+
transition-property: opacity, transform;
|
|
135
114
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
115
|
+
&.appear,
|
|
116
|
+
&.exit,
|
|
117
|
+
&.exit-done {
|
|
118
|
+
pointer-events: none;
|
|
119
|
+
transform: ${transformMethod}(${offsetValue});
|
|
120
|
+
}
|
|
141
121
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
122
|
+
&.appear-active,
|
|
123
|
+
&.enter,
|
|
124
|
+
&.enter-done {
|
|
125
|
+
pointer-events: inherit;
|
|
126
|
+
transform: translate(0);
|
|
127
|
+
}
|
|
146
128
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
129
|
+
&.appear-active,
|
|
130
|
+
&.enter-active,
|
|
131
|
+
&.exit-active {
|
|
132
|
+
transition-property: opacity, transform;
|
|
150
133
|
}
|
|
151
|
-
|
|
152
|
-
|
|
134
|
+
}
|
|
135
|
+
`, [direction, offset]);
|
|
153
136
|
}
|
package/dist/cjs/utils/curd.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const CONTROL_COLUMN_KEY = "$control";
|
|
|
21
21
|
export declare function useCurdColumns<R extends RowType, V extends Id = Id>({ columns, columnConfigurable }: Pick<CurdProps<R, FormValue, V>, 'columns' | 'columnConfigurable'>): {
|
|
22
22
|
orderedColumns: any[];
|
|
23
23
|
actualColumns: (symbol | ColumnType<R>)[];
|
|
24
|
-
innerVisible: import("react").RefObject<Id[]>;
|
|
25
|
-
setInnerVisible: import("react").Dispatch<import("react").SetStateAction<Id[]>>;
|
|
26
|
-
setInnerOrder: import("react").Dispatch<import("react").SetStateAction<Id[]>>;
|
|
24
|
+
innerVisible: import("react").RefObject<Id[] | undefined>;
|
|
25
|
+
setInnerVisible: import("react").Dispatch<import("react").SetStateAction<Id[] | undefined>>;
|
|
26
|
+
setInnerOrder: import("react").Dispatch<import("react").SetStateAction<Id[] | undefined>>;
|
|
27
27
|
};
|