@antscorp/antsomi-ui 1.3.3-beta.26 → 1.3.3-beta.27
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.
|
@@ -56,17 +56,18 @@ export const ResizeGrid = props => {
|
|
|
56
56
|
onChangeTimoutRef.current = setTimeout(() => {
|
|
57
57
|
if (containerRef.current && cellsRef.current && cellsRef.current[0]) {
|
|
58
58
|
const container = containerRef.current.getBoundingClientRect();
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
// Object.values(cordinatesRef.current);
|
|
60
|
+
const childs = Object.values(cellsRef.current).map(cell => {
|
|
61
|
+
if (!cell || !cell.current)
|
|
62
|
+
return;
|
|
63
|
+
const childBox = cell.current.getBoundingClientRect();
|
|
64
|
+
return {
|
|
65
|
+
width: childBox.width,
|
|
66
|
+
height: childBox.height,
|
|
67
|
+
x: childBox.x - container.x,
|
|
68
|
+
y: childBox.y - container.y,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
70
71
|
if (typeof onChange === 'function') {
|
|
71
72
|
onChange(grid, childs);
|
|
72
73
|
acceptUpdateRef.current = false;
|
|
@@ -583,7 +584,7 @@ export const ResizeGrid = props => {
|
|
|
583
584
|
// await new Promise(r => {setTimeout(r, 100)});
|
|
584
585
|
// console.log('wait', idx, cellsRef[idx])
|
|
585
586
|
// }
|
|
586
|
-
// console.log('set corr', idx,
|
|
587
|
+
// console.log('set corr', idx, cellsRef.current[idx], cellsRef)
|
|
587
588
|
if (containerRef.current) {
|
|
588
589
|
const container = containerRef.current.getBoundingClientRect();
|
|
589
590
|
const childRef = cellsRef.current[idx];
|
|
@@ -72,10 +72,14 @@ export const Cell = ({ cell, idx, down, downCell, up, setRef, downSelect, upSele
|
|
|
72
72
|
// console.log('TRANSFORM', idx, buildTranform(cell))
|
|
73
73
|
return (React.createElement(StyledCell, { ref: cellRef, className: "cell",
|
|
74
74
|
// onClick={handleActiveCell}
|
|
75
|
-
onMouseOver: handleHoverSelect, onFocus: e => e, onMouseDown: handleDownCell, onMouseUp: handleUpCell, onDoubleClick: handlUnMerge, borderStyle: borderStyle || 'unset', style: Object.assign(Object.assign({ gridArea: buildGridArea(cell), width: cell.width ? `${cell.width}px` : 'unset', height: cell.height ? `${cell.height}px` : 'unset', transform: buildTranform(cell)
|
|
75
|
+
onMouseOver: handleHoverSelect, onFocus: e => e, onMouseDown: handleDownCell, onMouseUp: handleUpCell, onDoubleClick: handlUnMerge, borderStyle: borderStyle || 'unset', style: Object.assign(Object.assign({ gridArea: buildGridArea(cell), width: cell.width ? `${cell.width}px` : 'unset', height: cell.height ? `${cell.height}px` : 'unset', transform: buildTranform(cell) }, (cell.active &&
|
|
76
76
|
(activeStyle || {
|
|
77
77
|
outline: '1px solid #005eb8',
|
|
78
78
|
}))), style) },
|
|
79
|
-
renderCellContent(),
|
|
79
|
+
React.createElement("div", { className: "cell-content" }, renderCellContent()),
|
|
80
|
+
React.createElement("div", { className: "cell-border", style: {
|
|
81
|
+
borderTop: cell.rowStart === 1 ? borderStyle : 'unset',
|
|
82
|
+
borderLeft: cell.colStart === 1 ? borderStyle : 'unset',
|
|
83
|
+
} }),
|
|
80
84
|
['top', 'right', 'bottom', 'left'].map(direction => (React.createElement("div", { key: direction, className: `resize-${direction}`, onMouseDown: e => handleDown(e, direction, idx), onMouseUp: e => handleUp(e, direction, idx) })))));
|
|
81
85
|
};
|
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
// Libraries
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
export const StyledCell = styled.div `
|
|
4
|
-
border: ${props => props.borderStyle};
|
|
5
|
-
border-top: none;
|
|
6
|
-
border-left: none;
|
|
4
|
+
// border: ${props => props.borderStyle};
|
|
5
|
+
// border-top: none;
|
|
6
|
+
// border-left: none;
|
|
7
|
+
// box-shadow: 1px 1px 0px 1px rgba(0, 0, 0, 0.1);
|
|
7
8
|
position: relative;
|
|
8
9
|
user-select: none;
|
|
9
10
|
|
|
11
|
+
.cell-border {
|
|
12
|
+
position: absolute;
|
|
13
|
+
inset: 0;
|
|
14
|
+
border: 1px solid #005eb8;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
border: ${props => props.borderStyle};
|
|
17
|
+
border-top: none;
|
|
18
|
+
border-left: none;
|
|
19
|
+
z-index: 1;
|
|
20
|
+
}
|
|
21
|
+
.cell-content {
|
|
22
|
+
position: relative;
|
|
23
|
+
height: 100%;
|
|
24
|
+
width: 100%;
|
|
25
|
+
z-index: 2;
|
|
26
|
+
}
|
|
10
27
|
.resize-top,
|
|
11
28
|
.resize-right,
|
|
12
29
|
.resize-bottom,
|
|
13
30
|
.resize-left {
|
|
14
31
|
position: absolute;
|
|
32
|
+
z-index: 3;
|
|
15
33
|
}
|
|
16
34
|
|
|
17
35
|
.resize-top,
|
package/es/test.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createRoot } from 'react-dom/client';
|
|
|
4
4
|
import '@antscorp/icons/main.css';
|
|
5
5
|
import { ConfigProvider, EdgeSetting, GradientSetting, IconSelection, PositionSetting, SettingWrapper,
|
|
6
6
|
// Slider,
|
|
7
|
-
SliderWithInputNumber, Space, UploadImage, RateV2, ResizeGrid, } from './components';
|
|
7
|
+
SliderWithInputNumber, Space, UploadImage, Tabs, RateV2, ResizeGrid, } from './components';
|
|
8
8
|
// import { Slider } from 'antd';
|
|
9
9
|
import { Slider } from '@antscorp/antsomi-ui/es/components/atoms/Slider';
|
|
10
10
|
import { Rate } from './components/atoms/Rate';
|
|
@@ -115,7 +115,7 @@ export const App = () => {
|
|
|
115
115
|
}, containerStyle: {
|
|
116
116
|
// border: '15px dotted green',
|
|
117
117
|
}, cellBorder: "1px dashed blue" }),
|
|
118
|
-
React.createElement("button", { onClick: () => setGrid({ cols: rand(), rows: rand() }) }, "change"),
|
|
118
|
+
React.createElement("button", { type: "button", onClick: () => setGrid({ cols: rand(), rows: rand() }) }, "change"),
|
|
119
119
|
React.createElement(SettingWrapper, { vertical: true, label: "Color Setting" },
|
|
120
120
|
React.createElement(GradientSetting, null)),
|
|
121
121
|
React.createElement(SliderWithInputNumber, { label: "Size (px)", labelStyling: { marginTop: 10 }, min: 0, max: 100, value: sliderValue, onAfterChange: handleChangeSlider }),
|
|
@@ -152,6 +152,18 @@ export const App = () => {
|
|
|
152
152
|
console.log('onChangeSvg', value);
|
|
153
153
|
} }))))));
|
|
154
154
|
// ------------------------ Media template components test end -------------------------
|
|
155
|
+
return (React.createElement(Tabs, { items: [
|
|
156
|
+
{
|
|
157
|
+
key: '1',
|
|
158
|
+
label: 'Tab 1',
|
|
159
|
+
children: React.createElement("div", null, "hello"),
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
key: '2',
|
|
163
|
+
label: 'Tab 2',
|
|
164
|
+
children: React.createElement("div", null, "hello 2"),
|
|
165
|
+
},
|
|
166
|
+
] }));
|
|
155
167
|
return (React.createElement("div", { style: { width: '500px', margin: '32px' } },
|
|
156
168
|
React.createElement(GradientSetting, { onChange: e => console.log('gradient change') }),
|
|
157
169
|
React.createElement("br", null),
|