@antscorp/antsomi-ui 1.3.3-beta.3 → 1.3.3-beta.30
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/index.js +1 -1
- package/dist/public/icons/stars_slider.png +0 -0
- package/es/assets/images/stars_slider.png +0 -0
- package/es/components/atoms/Button/index.d.ts +1 -8
- package/es/components/atoms/Flex/Flex.d.ts +2 -0
- package/es/components/atoms/Flex/Flex.js +1 -0
- package/es/components/atoms/Flex/index.d.ts +1 -0
- package/es/components/atoms/Flex/index.js +1 -0
- package/es/components/atoms/Input/Input.d.ts +14 -3
- package/es/components/atoms/Input/Input.js +7 -3
- package/es/components/atoms/InputDynamic/EditCaretPositioning.d.ts +2 -0
- package/es/components/atoms/InputDynamic/EditCaretPositioning.js +89 -0
- package/es/components/atoms/InputDynamic/InputDynamic.d.ts +29 -0
- package/es/components/atoms/InputDynamic/InputDynamic.js +320 -0
- package/es/components/atoms/InputDynamic/PopupShortLink.d.ts +16 -0
- package/es/components/atoms/InputDynamic/PopupShortLink.js +98 -0
- package/es/components/atoms/InputDynamic/index.d.ts +2 -0
- package/es/components/atoms/InputDynamic/index.js +1 -0
- package/es/components/atoms/InputDynamic/styled.d.ts +12 -0
- package/es/components/atoms/InputDynamic/styled.js +279 -0
- package/es/components/atoms/InputDynamic/utils.d.ts +22 -0
- package/es/components/atoms/InputDynamic/utils.js +751 -0
- package/es/components/atoms/Pagination/index.d.ts +1 -0
- package/es/components/atoms/Popover/Popover.d.ts +1 -1
- package/es/components/atoms/Popover/styled.d.ts +1 -1
- package/es/components/atoms/Progress/Progress.d.ts +1 -1
- package/es/components/atoms/Radio/index.d.ts +3 -3
- package/es/components/atoms/RateV2/RateV2.d.ts +18 -0
- package/es/components/atoms/RateV2/RateV2.js +73 -0
- package/es/components/atoms/RateV2/index.d.ts +1 -0
- package/es/components/atoms/RateV2/index.js +1 -0
- package/es/components/atoms/RequiredLabel/index.d.ts +1 -0
- package/es/components/atoms/RequiredLabel/index.js +4 -3
- package/es/components/atoms/Slider/index.d.ts +2 -1
- package/es/components/atoms/Slider/index.js +7 -14
- package/es/components/atoms/SliderV2/index.d.ts +6 -0
- package/es/components/atoms/SliderV2/index.js +21 -0
- package/es/components/atoms/Space/Space.d.ts +1 -1
- package/es/components/atoms/Spin/styled.d.ts +1 -1
- package/es/components/atoms/Statistic/Statistic.d.ts +1 -4
- package/es/components/atoms/index.d.ts +6 -0
- package/es/components/atoms/index.js +4 -0
- package/es/components/common/ConfigProvider/GlobalStyle.js +69 -2
- package/es/components/molecules/Collapse/Collapse.d.ts +3 -3
- package/es/components/molecules/Collapse/Collapse.js +9 -0
- package/es/components/molecules/ColorSetting/styled.d.ts +1 -8
- package/es/components/molecules/FontSetting/constants.d.ts +3 -0
- package/es/components/molecules/FontSetting/constants.js +22 -0
- package/es/components/molecules/FontSetting/index.d.ts +10 -4
- package/es/components/molecules/FontSetting/index.js +36 -35
- package/es/components/molecules/FontSetting/types.d.ts +1 -1
- package/es/components/molecules/Form/Form.d.ts +1 -0
- package/es/components/molecules/Form/Form.js +1 -0
- package/es/components/molecules/Form/index.d.ts +1 -0
- package/es/components/molecules/Form/index.js +1 -0
- package/es/components/molecules/IconSelection/styled.d.ts +1 -8
- package/es/components/molecules/Modal/Modal.d.ts +2 -2
- package/es/components/molecules/Modal/index.d.ts +1 -0
- package/es/components/molecules/Modal/styled.d.ts +1 -1
- package/es/components/molecules/ModalV2/ModalV2.d.ts +5 -0
- package/es/components/molecules/ModalV2/ModalV2.js +26 -0
- package/es/components/molecules/ModalV2/index.d.ts +2 -0
- package/es/components/molecules/ModalV2/index.js +1 -0
- package/es/components/molecules/ModalV2/styled.d.ts +7 -0
- package/es/components/molecules/ModalV2/styled.js +22 -0
- package/es/components/molecules/Popconfirm/Popconfirm.d.ts +1 -1
- package/es/components/molecules/PreviewModal/PreviewModal.d.ts +7 -0
- package/es/components/molecules/PreviewModal/PreviewModal.js +30 -0
- package/es/components/molecules/PreviewModal/index.d.ts +2 -0
- package/es/components/molecules/PreviewModal/index.js +1 -0
- package/es/components/molecules/PreviewModal/styled.d.ts +4 -0
- package/es/components/molecules/PreviewModal/styled.js +39 -0
- package/es/components/molecules/ResizeGrid/ResizeGrid.d.ts +3 -0
- package/es/components/molecules/ResizeGrid/ResizeGrid.js +640 -0
- package/es/components/molecules/ResizeGrid/components/Cell/Cell.d.ts +3 -0
- package/es/components/molecules/ResizeGrid/components/Cell/Cell.js +85 -0
- package/es/components/molecules/ResizeGrid/components/Cell/index.d.ts +1 -0
- package/es/components/molecules/ResizeGrid/components/Cell/index.js +1 -0
- package/es/components/molecules/ResizeGrid/components/Cell/styled.d.ts +3 -0
- package/es/components/molecules/ResizeGrid/components/Cell/styled.js +80 -0
- package/es/components/molecules/ResizeGrid/constant.d.ts +35 -0
- package/es/components/molecules/ResizeGrid/constant.js +111 -0
- package/es/components/molecules/ResizeGrid/index.d.ts +2 -0
- package/es/components/molecules/ResizeGrid/index.js +1 -0
- package/es/components/molecules/ResizeGrid/styled.d.ts +10 -0
- package/es/components/molecules/ResizeGrid/styled.js +55 -0
- package/es/components/molecules/ResizeGrid/types.d.ts +144 -0
- package/es/components/molecules/ResizeGrid/types.js +1 -0
- package/es/components/molecules/Select/Select.d.ts +6 -4
- package/es/components/molecules/Select/Select.js +23 -2
- package/es/components/molecules/TreeSelect/TreeSelect.d.ts +3 -4
- package/es/components/molecules/index.d.ts +6 -0
- package/es/components/molecules/index.js +4 -0
- package/es/components/organism/Help/styled.d.ts +6 -16
- package/es/components/organism/Table/ExplorePivotTable/styled.d.ts +1 -0
- package/es/constants/theme.js +30 -3
- package/es/hooks/useDeepCompareEffect.d.ts +1 -0
- package/es/hooks/useDeepCompareEffect.js +21 -0
- package/es/locales/en/translation.json +2 -1
- package/es/locales/i18n.d.ts +2 -0
- package/es/locales/translations.d.ts +1 -0
- package/es/locales/vi/translation.json +2 -1
- package/es/test.js +164 -66
- package/es/utils/common.d.ts +2 -0
- package/es/utils/common.js +16 -0
- package/package.json +8 -4
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { buildGridArea, buildTranform } from '../../constant';
|
|
3
|
+
import { StyledCell } from './styled';
|
|
4
|
+
import { useDeepCompareEffect } from '../../../../../hooks/useDeepCompareEffect';
|
|
5
|
+
export const Cell = ({ cell, idx, down, downCell, up, setRef, downSelect, upSelect, hoverSelect, unMerge, renderCell, style, isPreviewMode, borderStyle, activeStyle, activeCell, setCordinate, rowPercentage, colPercentage, ctrlKeyRef, }) => {
|
|
6
|
+
const { objectFit, image } = cell;
|
|
7
|
+
const downRef = useRef(false);
|
|
8
|
+
const timeoutRef = useRef();
|
|
9
|
+
const cellRef = useRef(null);
|
|
10
|
+
useDeepCompareEffect(() => {
|
|
11
|
+
clearTimeout(timeoutRef.current);
|
|
12
|
+
timeoutRef.current = setTimeout(() => {
|
|
13
|
+
setCordinate(idx, cellRef);
|
|
14
|
+
}, 500);
|
|
15
|
+
}, [idx, cell, rowPercentage, colPercentage, cellRef]);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setRef(idx, cellRef);
|
|
18
|
+
}, [idx, cell]);
|
|
19
|
+
const handleHoverSelect = e => {
|
|
20
|
+
hoverSelect(idx, cell);
|
|
21
|
+
};
|
|
22
|
+
const handleDownCell = e => {
|
|
23
|
+
downSelect(idx, cell);
|
|
24
|
+
};
|
|
25
|
+
const handleUpCell = e => {
|
|
26
|
+
upSelect(idx, cell);
|
|
27
|
+
};
|
|
28
|
+
const handleDown = (e, direction, idx) => {
|
|
29
|
+
e.stopPropagation();
|
|
30
|
+
downRef.current = true;
|
|
31
|
+
// console.log('down', direction, idx, e)
|
|
32
|
+
const type = ['top', 'bottom'].includes(direction) ? 'row' : 'column';
|
|
33
|
+
const line = {
|
|
34
|
+
top: cell.rowStart,
|
|
35
|
+
right: cell.colEnd,
|
|
36
|
+
bottom: cell.rowEnd,
|
|
37
|
+
left: cell.colStart,
|
|
38
|
+
}[direction];
|
|
39
|
+
if ((ctrlKeyRef === null || ctrlKeyRef === void 0 ? void 0 : ctrlKeyRef.current) ||
|
|
40
|
+
(direction === 'top' && cell.movedTop) ||
|
|
41
|
+
(direction === 'right' && cell.movedRight) ||
|
|
42
|
+
(direction === 'bottom' && cell.movedBottom) ||
|
|
43
|
+
(direction === 'left' && cell.movedLeft)) {
|
|
44
|
+
downCell(e, type, line, idx, direction, cell, cellRef);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
down(e, type, line, idx, direction, cell, cellRef);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const handleUp = (e, direction, idx) => {
|
|
51
|
+
e.stopPropagation();
|
|
52
|
+
// console.log('up', direction, idx, e)
|
|
53
|
+
downRef.current = false;
|
|
54
|
+
up(e, direction, idx);
|
|
55
|
+
};
|
|
56
|
+
const handlUnMerge = e => {
|
|
57
|
+
unMerge(cell, idx);
|
|
58
|
+
};
|
|
59
|
+
const renderCellContent = () => renderCell
|
|
60
|
+
? renderCell(cell, idx)
|
|
61
|
+
: !!image &&
|
|
62
|
+
image.imageUrl && (React.createElement("div", { className: "imageWrapper" },
|
|
63
|
+
React.createElement("img", { src: image.imageUrl, alt: "menu", style: image.imageStyles })));
|
|
64
|
+
// const handleActiveCell = e => {
|
|
65
|
+
// activeCell(e, cell, idx);
|
|
66
|
+
// };
|
|
67
|
+
// const handleDrag = (direction, idx, e) => {
|
|
68
|
+
// if (!downRef.current) return;
|
|
69
|
+
// console.log(direction, idx, e)
|
|
70
|
+
// drag(e, direction, idx)
|
|
71
|
+
// }
|
|
72
|
+
// console.log('TRANSFORM', idx, buildTranform(cell))
|
|
73
|
+
return (React.createElement(StyledCell, { ref: cellRef, className: "cell",
|
|
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) }, (cell.active &&
|
|
76
|
+
(activeStyle || {
|
|
77
|
+
outline: '1px solid #005eb8',
|
|
78
|
+
}))), style) },
|
|
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
|
+
} }),
|
|
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) })))));
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Cell } from './Cell';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Cell } from './Cell';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const StyledCell = styled.div `
|
|
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);
|
|
8
|
+
position: relative;
|
|
9
|
+
user-select: none;
|
|
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
|
+
}
|
|
27
|
+
.resize-top,
|
|
28
|
+
.resize-right,
|
|
29
|
+
.resize-bottom,
|
|
30
|
+
.resize-left {
|
|
31
|
+
position: absolute;
|
|
32
|
+
z-index: 3;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.resize-top,
|
|
36
|
+
.resize-bottom {
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: 3px;
|
|
39
|
+
left: -1px;
|
|
40
|
+
cursor: row-resize;
|
|
41
|
+
}
|
|
42
|
+
.resize-left,
|
|
43
|
+
.resize-right {
|
|
44
|
+
width: 3px;
|
|
45
|
+
height: 100%;
|
|
46
|
+
top: -1px;
|
|
47
|
+
cursor: col-resize;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.resize-top {
|
|
51
|
+
// background: red;
|
|
52
|
+
top: -1px;
|
|
53
|
+
}
|
|
54
|
+
.resize-right {
|
|
55
|
+
// background: green;
|
|
56
|
+
right: -1px;
|
|
57
|
+
}
|
|
58
|
+
.resize-bottom {
|
|
59
|
+
// background: blue;
|
|
60
|
+
bottom: -1px;
|
|
61
|
+
}
|
|
62
|
+
.resize-left {
|
|
63
|
+
// background: yellow;
|
|
64
|
+
left: -1px;
|
|
65
|
+
}
|
|
66
|
+
.imageWrapper {
|
|
67
|
+
height: 100%;
|
|
68
|
+
max-width: 100%;
|
|
69
|
+
max-height: 100%;
|
|
70
|
+
img {
|
|
71
|
+
display: block;
|
|
72
|
+
width: 100%;
|
|
73
|
+
height: 100%;
|
|
74
|
+
max-width: 100%;
|
|
75
|
+
max-height: 100%;
|
|
76
|
+
object-fit: contain;
|
|
77
|
+
-webkit-user-drag: none;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TGrid } from './types';
|
|
2
|
+
export declare const GRID_TEMPLATE: {
|
|
3
|
+
GRID_2_3: {
|
|
4
|
+
rows: number;
|
|
5
|
+
cols: number;
|
|
6
|
+
};
|
|
7
|
+
GRID_5_5: {
|
|
8
|
+
rows: number;
|
|
9
|
+
cols: number;
|
|
10
|
+
};
|
|
11
|
+
GRID_2_2: {
|
|
12
|
+
rows: number;
|
|
13
|
+
cols: number;
|
|
14
|
+
};
|
|
15
|
+
GRID_2_3_1: {
|
|
16
|
+
rows: number;
|
|
17
|
+
cols: number;
|
|
18
|
+
childs: ({
|
|
19
|
+
rowStart: number;
|
|
20
|
+
colStart: number;
|
|
21
|
+
colEnd: number;
|
|
22
|
+
} | {
|
|
23
|
+
rowStart: number;
|
|
24
|
+
colStart: number;
|
|
25
|
+
colEnd?: undefined;
|
|
26
|
+
})[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare const buildCell: (cell: any) => any;
|
|
30
|
+
export declare const buildGrid: (inputGrid: Partial<TGrid>) => TGrid;
|
|
31
|
+
export declare const buildGridArea: (box: any) => string;
|
|
32
|
+
export declare const buildTranform: (box: any) => string;
|
|
33
|
+
export declare const MIN_SIZE = 32;
|
|
34
|
+
export declare const THREADHOLD = 3;
|
|
35
|
+
export declare const getSafety: (fn: any, defaultValue?: string) => any;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export const GRID_TEMPLATE = {
|
|
2
|
+
GRID_2_3: {
|
|
3
|
+
rows: 2,
|
|
4
|
+
cols: 3,
|
|
5
|
+
},
|
|
6
|
+
GRID_5_5: {
|
|
7
|
+
rows: 5,
|
|
8
|
+
cols: 5,
|
|
9
|
+
},
|
|
10
|
+
GRID_2_2: {
|
|
11
|
+
rows: 2,
|
|
12
|
+
cols: 2,
|
|
13
|
+
},
|
|
14
|
+
GRID_2_3_1: {
|
|
15
|
+
rows: 2,
|
|
16
|
+
cols: 3,
|
|
17
|
+
childs: [
|
|
18
|
+
{
|
|
19
|
+
rowStart: 1,
|
|
20
|
+
colStart: 1,
|
|
21
|
+
colEnd: 4,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
rowStart: 2,
|
|
25
|
+
colStart: 1,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
rowStart: 2,
|
|
29
|
+
colStart: 2,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
rowStart: 2,
|
|
33
|
+
colStart: 3,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export const buildCell = cell => (Object.assign({ rowEnd: cell.rowEnd || cell.rowStart + 1, colEnd: cell.colEnd || cell.colStart + 1 }, cell));
|
|
39
|
+
export const buildGrid = (inputGrid) => {
|
|
40
|
+
let childs = [];
|
|
41
|
+
const grid = JSON.parse(JSON.stringify(inputGrid));
|
|
42
|
+
let buildCol = !grid.gridTemplateColumns || !grid.gridTemplateColumns.length;
|
|
43
|
+
const buildRow = !grid.gridTemplateRows || !grid.gridTemplateRows.length;
|
|
44
|
+
const buildChild = !grid.childs || !grid.childs.length;
|
|
45
|
+
const gridTemplateColumns = grid.gridTemplateColumns || [];
|
|
46
|
+
const gridTemplateRows = grid.gridTemplateRows || [];
|
|
47
|
+
if (!buildChild && grid.childs) {
|
|
48
|
+
childs = grid.childs.map(buildCell);
|
|
49
|
+
}
|
|
50
|
+
if (buildChild || buildRow || buildCol) {
|
|
51
|
+
Array(grid.rows)
|
|
52
|
+
.fill(1)
|
|
53
|
+
.forEach((_, row) => {
|
|
54
|
+
if (buildRow && grid.rows) {
|
|
55
|
+
gridTemplateRows.push(100 / grid.rows);
|
|
56
|
+
}
|
|
57
|
+
Array(grid.cols)
|
|
58
|
+
.fill(1)
|
|
59
|
+
.forEach((__, col) => {
|
|
60
|
+
if (buildChild) {
|
|
61
|
+
childs.push({
|
|
62
|
+
rowStart: row + 1,
|
|
63
|
+
rowEnd: row + 2,
|
|
64
|
+
colStart: col + 1,
|
|
65
|
+
colEnd: col + 2,
|
|
66
|
+
active: false,
|
|
67
|
+
// image: {
|
|
68
|
+
// imageStyles: {},
|
|
69
|
+
// imageSettings: {},
|
|
70
|
+
// imageUrl: 'https://source.unsplash.com/random/300×300'
|
|
71
|
+
// },
|
|
72
|
+
objectFit: 'contain',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (buildCol && grid.cols) {
|
|
76
|
+
gridTemplateColumns.push(100 / grid.cols);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
buildCol = false;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return Object.assign(Object.assign({ rows: grid.rows || 1, cols: grid.rows || 1 }, grid), { gridTemplateColumns,
|
|
83
|
+
gridTemplateRows,
|
|
84
|
+
childs });
|
|
85
|
+
};
|
|
86
|
+
export const buildGridArea = box =>
|
|
87
|
+
// console.log('area', box, `${box.rowStart} / ${box.colStart} / ${box.rowEnd} / ${box.colEnd}`)
|
|
88
|
+
`${box.rowStart} / ${box.colStart} / ${box.rowEnd} / ${box.colEnd}`;
|
|
89
|
+
export const buildTranform = box => {
|
|
90
|
+
const { transformX, transformY } = box;
|
|
91
|
+
if (transformX && transformY) {
|
|
92
|
+
return `translate(${transformX}px, ${transformY}px)`;
|
|
93
|
+
}
|
|
94
|
+
if (transformX) {
|
|
95
|
+
return `translateX(${transformX}px)`;
|
|
96
|
+
}
|
|
97
|
+
if (transformY) {
|
|
98
|
+
return `translateY(${transformY}px)`;
|
|
99
|
+
}
|
|
100
|
+
return 'unset';
|
|
101
|
+
};
|
|
102
|
+
export const MIN_SIZE = 32;
|
|
103
|
+
export const THREADHOLD = 3;
|
|
104
|
+
export const getSafety = (fn, defaultValue = '') => {
|
|
105
|
+
try {
|
|
106
|
+
return fn();
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
return defaultValue;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ResizeGrid } from './ResizeGrid';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const StyledGrid: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
isCompact: boolean;
|
|
3
|
+
}, never>;
|
|
4
|
+
export declare const StyledMiddleLayer: import("styled-components").StyledComponent<"div", any, {
|
|
5
|
+
isCompact?: boolean | undefined;
|
|
6
|
+
}, never>;
|
|
7
|
+
export declare const StyledBGLayer: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
isCompact?: boolean | undefined;
|
|
9
|
+
}, never>;
|
|
10
|
+
export declare const StyledLine: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const StyledGrid = styled.div `
|
|
4
|
+
width: 100%;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
position: relative;
|
|
7
|
+
|
|
8
|
+
* {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.grid-container {
|
|
13
|
+
position: relative;
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
display: grid;
|
|
17
|
+
background: transparent;
|
|
18
|
+
aspect-ratio: ${props => (props.isCompact ? '3 / 1' : '3 / 2')};
|
|
19
|
+
z-index: 3;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
export const StyledMiddleLayer = styled.div `
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
position: absolute;
|
|
26
|
+
inset: 0;
|
|
27
|
+
// background: red;
|
|
28
|
+
z-index: 2;
|
|
29
|
+
`;
|
|
30
|
+
export const StyledBGLayer = styled.div `
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
position: absolute;
|
|
34
|
+
inset: 0;
|
|
35
|
+
// background: red;
|
|
36
|
+
z-index: 1;
|
|
37
|
+
background-repeat: no-repeat;
|
|
38
|
+
background-position: top left;
|
|
39
|
+
background-size: 100% 100%;
|
|
40
|
+
`;
|
|
41
|
+
export const StyledLine = styled.div `
|
|
42
|
+
position: absolute;
|
|
43
|
+
width: 100%;
|
|
44
|
+
height: 100%;
|
|
45
|
+
top: -1px;
|
|
46
|
+
left: -1px;
|
|
47
|
+
background: red;
|
|
48
|
+
|
|
49
|
+
&.vertical {
|
|
50
|
+
width: 1px;
|
|
51
|
+
}
|
|
52
|
+
&.horizontal {
|
|
53
|
+
height: 1px;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type TImageStyles = {
|
|
3
|
+
borderTopLeftRadius?: string;
|
|
4
|
+
borderTopRightRadius?: string;
|
|
5
|
+
borderBottomRightRadius?: string;
|
|
6
|
+
borderBottomLeftRadius?: string;
|
|
7
|
+
borderTopWidth?: string;
|
|
8
|
+
borderRightWidth?: string;
|
|
9
|
+
borderBottomWidth?: string;
|
|
10
|
+
borderLeftWidth?: string;
|
|
11
|
+
borderStyle?: string;
|
|
12
|
+
borderColor?: string;
|
|
13
|
+
boxShadow?: string;
|
|
14
|
+
opacity?: number;
|
|
15
|
+
width?: string;
|
|
16
|
+
height?: string;
|
|
17
|
+
objectPosition?: string;
|
|
18
|
+
objectFit?: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
|
19
|
+
paddingTop?: string;
|
|
20
|
+
paddingRight?: string;
|
|
21
|
+
paddingBottom?: string;
|
|
22
|
+
paddingLeft?: string;
|
|
23
|
+
};
|
|
24
|
+
export type TImageSettings = {
|
|
25
|
+
borderRadiusStyle?: string;
|
|
26
|
+
borderRadiusSuffix?: string;
|
|
27
|
+
linkedBorderRadiusInput?: boolean;
|
|
28
|
+
linkedBorderWidthInput?: boolean;
|
|
29
|
+
linkedPaddingInput?: boolean;
|
|
30
|
+
paddingSuffix?: string;
|
|
31
|
+
boxShadowStyle?: string;
|
|
32
|
+
boxShadowColor?: string;
|
|
33
|
+
boxShadowBlur?: string;
|
|
34
|
+
boxShadowSpread?: string;
|
|
35
|
+
boxShadowHorizontal?: string;
|
|
36
|
+
boxShadowVertical?: string;
|
|
37
|
+
boxShadowInset?: boolean;
|
|
38
|
+
widthSuffix?: string;
|
|
39
|
+
heightSuffix?: string;
|
|
40
|
+
};
|
|
41
|
+
export type TImage = {
|
|
42
|
+
imageUrl: string;
|
|
43
|
+
imageStyles: TImageStyles;
|
|
44
|
+
imageSettings: TImageSettings;
|
|
45
|
+
};
|
|
46
|
+
export type TCell = {
|
|
47
|
+
idx?: number;
|
|
48
|
+
cellRef?: React.RefObject<HTMLElement>;
|
|
49
|
+
rowStart: number;
|
|
50
|
+
rowEnd: number;
|
|
51
|
+
colStart: number;
|
|
52
|
+
colEnd: number;
|
|
53
|
+
width?: number;
|
|
54
|
+
height?: number;
|
|
55
|
+
transformX?: number;
|
|
56
|
+
transformY?: number;
|
|
57
|
+
movedTop?: boolean;
|
|
58
|
+
movedRight?: boolean;
|
|
59
|
+
movedBottom?: boolean;
|
|
60
|
+
movedLeft?: boolean;
|
|
61
|
+
image?: TImage;
|
|
62
|
+
objectFit?: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
|
63
|
+
active?: boolean;
|
|
64
|
+
};
|
|
65
|
+
export interface CellProps {
|
|
66
|
+
cell: TCell;
|
|
67
|
+
idx: number;
|
|
68
|
+
rowPercentage: number;
|
|
69
|
+
colPercentage: number;
|
|
70
|
+
down: Function;
|
|
71
|
+
downCell: Function;
|
|
72
|
+
up: Function;
|
|
73
|
+
setRef: Function;
|
|
74
|
+
setCordinate: Function;
|
|
75
|
+
downSelect: Function;
|
|
76
|
+
upSelect: Function;
|
|
77
|
+
hoverSelect: Function;
|
|
78
|
+
unMerge: Function;
|
|
79
|
+
renderCell?: Function;
|
|
80
|
+
activeCell?: Function;
|
|
81
|
+
borderStyle?: string;
|
|
82
|
+
style?: React.CSSProperties;
|
|
83
|
+
activeStyle?: React.CSSProperties;
|
|
84
|
+
isPreviewMode?: boolean;
|
|
85
|
+
ctrlKeyRef?: React.RefObject<boolean>;
|
|
86
|
+
}
|
|
87
|
+
export type TGrid = {
|
|
88
|
+
rows: number;
|
|
89
|
+
cols: number;
|
|
90
|
+
gridTemplateColumns: number[];
|
|
91
|
+
gridTemplateRows: number[];
|
|
92
|
+
childs: TCell[];
|
|
93
|
+
};
|
|
94
|
+
export type TStartRef = {
|
|
95
|
+
clientX: number;
|
|
96
|
+
clientY: number;
|
|
97
|
+
type: 'row' | 'column';
|
|
98
|
+
line: number;
|
|
99
|
+
};
|
|
100
|
+
export type TCellExtend = TCell & {
|
|
101
|
+
cellRef: React.RefObject<HTMLElement>;
|
|
102
|
+
idx: number;
|
|
103
|
+
};
|
|
104
|
+
export type TStartCellRef = {
|
|
105
|
+
clientX: number;
|
|
106
|
+
clientY: number;
|
|
107
|
+
direction: 'top' | 'right' | 'bottom' | 'left';
|
|
108
|
+
isRevert: boolean;
|
|
109
|
+
leftCells: Record<string, TCellExtend>;
|
|
110
|
+
rightCells: Record<string, TCellExtend>;
|
|
111
|
+
};
|
|
112
|
+
export type TSelected = {
|
|
113
|
+
idx: number;
|
|
114
|
+
cell: TCell;
|
|
115
|
+
};
|
|
116
|
+
export type TSelectedEnd = {
|
|
117
|
+
cell: TCell;
|
|
118
|
+
idx: number;
|
|
119
|
+
hCells: number[];
|
|
120
|
+
};
|
|
121
|
+
export interface IResizeGridProps {
|
|
122
|
+
grid?: Partial<TGrid>;
|
|
123
|
+
renderCell?: Function;
|
|
124
|
+
onChange?: Function;
|
|
125
|
+
selectColor?: string;
|
|
126
|
+
image?: string;
|
|
127
|
+
imageSize?: 'cover' | 'contain' | 'fill';
|
|
128
|
+
imagePosition?: string;
|
|
129
|
+
cellStyle?: React.CSSProperties;
|
|
130
|
+
isPreviewMode?: boolean;
|
|
131
|
+
cellBorder?: string;
|
|
132
|
+
cellActiveStyle?: React.CSSProperties;
|
|
133
|
+
containerStyle?: React.CSSProperties;
|
|
134
|
+
isCompact?: boolean;
|
|
135
|
+
delayUpdate?: number;
|
|
136
|
+
}
|
|
137
|
+
export type TCordinate = {
|
|
138
|
+
x: number;
|
|
139
|
+
y: number;
|
|
140
|
+
width: number;
|
|
141
|
+
height: number;
|
|
142
|
+
xEnd: number;
|
|
143
|
+
yEnd: number;
|
|
144
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { SelectProps as AntdSelectProps } from 'antd';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { TextProps } from '../../atoms/Text';
|
|
3
4
|
export interface SelectProps extends AntdSelectProps {
|
|
5
|
+
label?: string | React.ReactNode;
|
|
6
|
+
labelProps?: TextProps;
|
|
4
7
|
}
|
|
5
8
|
declare const Select: (<ValueType = any, OptionType extends import("rc-select/lib/Select").DefaultOptionType | import("rc-select/lib/Select").BaseOptionType = import("rc-select/lib/Select").DefaultOptionType>(props: AntdSelectProps<ValueType, OptionType> & {
|
|
6
9
|
children?: React.ReactNode;
|
|
7
|
-
} & {
|
|
8
|
-
|
|
9
|
-
}) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
10
|
+
} & React.RefAttributes<import("antd").RefSelectProps>) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) & {
|
|
11
|
+
displayName?: string | undefined;
|
|
10
12
|
SECRET_COMBOBOX_MODE_DO_NOT_USE: string;
|
|
11
13
|
Option: import("rc-select/lib/Option").OptionFC;
|
|
12
14
|
OptGroup: import("rc-select/lib/OptGroup").OptionGroupFC;
|
|
13
|
-
_InternalPanelDoNotUseOrYouWillBeFired:
|
|
15
|
+
_InternalPanelDoNotUseOrYouWillBeFired: (props: import("antd/es/_util/type").AnyObject) => React.JSX.Element;
|
|
14
16
|
} & React.FC<SelectProps>;
|
|
15
17
|
export { Select };
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
var _a;
|
|
2
13
|
// Libraries
|
|
3
14
|
import { Select as AntdSelect } from 'antd';
|
|
4
15
|
import React from 'react';
|
|
16
|
+
// Components
|
|
17
|
+
import { Flex } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
18
|
+
import { Text } from '../../atoms/Text';
|
|
5
19
|
// Icons
|
|
6
20
|
import Icon from '@antscorp/icons';
|
|
7
21
|
// Constants
|
|
8
|
-
import { THEME } from '
|
|
22
|
+
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
23
|
+
// Styled
|
|
9
24
|
import { StyledTag, TagCloseBtn } from './styled';
|
|
10
25
|
const tagRender = (props) => {
|
|
11
26
|
const { label, closable, onClose } = props;
|
|
@@ -18,11 +33,17 @@ const tagRender = (props) => {
|
|
|
18
33
|
fontSize: 10,
|
|
19
34
|
} })) }, label));
|
|
20
35
|
};
|
|
21
|
-
const CustomSelect = props =>
|
|
36
|
+
const CustomSelect = props => {
|
|
37
|
+
const { label, labelProps } = props, rest = __rest(props, ["label", "labelProps"]);
|
|
38
|
+
return (React.createElement(Flex, { vertical: true, gap: 4 },
|
|
39
|
+
typeof label === 'string' ? React.createElement(Text, Object.assign({}, labelProps), label) : label,
|
|
40
|
+
React.createElement(AntdSelect, Object.assign({}, rest))));
|
|
41
|
+
};
|
|
22
42
|
const Select = CustomSelect;
|
|
23
43
|
Select.OptGroup = AntdSelect.OptGroup;
|
|
24
44
|
Select.Option = AntdSelect.Option;
|
|
25
45
|
Select.defaultProps = {
|
|
46
|
+
labelProps: { color: '#66666' },
|
|
26
47
|
suffixIcon: (React.createElement(Icon, { type: "icon-ants-expand-more", style: { fontSize: 16, color: (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.bw10 } })),
|
|
27
48
|
tagRender,
|
|
28
49
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const TreeSelect: (<ValueType = any, OptionType extends import("rc-tree-select/lib/TreeSelect").BaseOptionType | import("rc-tree-select/lib/TreeSelect").DefaultOptionType = import("rc-tree-select/lib/TreeSelect").DefaultOptionType>(props: import("antd").TreeSelectProps<ValueType, OptionType> & {
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
|
-
} & {
|
|
5
|
-
|
|
6
|
-
}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & {
|
|
4
|
+
} & import("react").RefAttributes<import("antd").RefSelectProps>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & {
|
|
5
|
+
displayName?: string | undefined;
|
|
7
6
|
TreeNode: import("react").FC<import("rc-tree-select/lib/TreeNode").TreeNodeProps>;
|
|
8
7
|
SHOW_ALL: "SHOW_ALL";
|
|
9
8
|
SHOW_PARENT: "SHOW_PARENT";
|
|
10
9
|
SHOW_CHILD: "SHOW_CHILD";
|
|
11
|
-
_InternalPanelDoNotUseOrYouWillBeFired:
|
|
10
|
+
_InternalPanelDoNotUseOrYouWillBeFired: (props: import("antd/es/_util/type").AnyObject) => React.JSX.Element;
|
|
12
11
|
};
|
|
@@ -31,7 +31,13 @@ export { FontFamilySelect } from './FontFamilySelect';
|
|
|
31
31
|
export { TextDecorationSelect } from './TextDecorationSelect';
|
|
32
32
|
export { TextTransformSelect } from './TextTransformSelect';
|
|
33
33
|
export { FontSetting, FontSettingEdit } from './FontSetting';
|
|
34
|
+
export { Form } from './Form';
|
|
35
|
+
export { ResizeGrid } from './ResizeGrid';
|
|
36
|
+
export { ModalV2 } from './ModalV2';
|
|
37
|
+
export * from './PreviewModal';
|
|
34
38
|
export type { AdvancedPickerProps, TAdvancedPickerOption, TAdvancedRangePickerTimeRange, } from './DatePicker';
|
|
35
39
|
export type { ColorPickerProps } from './ColorPicker';
|
|
36
40
|
export type { AlignEditProps, AlignSettingProps } from './AlignSetting';
|
|
37
41
|
export type { TFontSettingProps, TFontSettingEditProps } from './FontSetting';
|
|
42
|
+
export type { IResizeGridProps, TCell, TGrid } from './ResizeGrid';
|
|
43
|
+
export type { ModalProps } from './ModalV2';
|
|
@@ -31,3 +31,7 @@ export { FontFamilySelect } from './FontFamilySelect';
|
|
|
31
31
|
export { TextDecorationSelect } from './TextDecorationSelect';
|
|
32
32
|
export { TextTransformSelect } from './TextTransformSelect';
|
|
33
33
|
export { FontSetting, FontSettingEdit } from './FontSetting';
|
|
34
|
+
export { Form } from './Form';
|
|
35
|
+
export { ResizeGrid } from './ResizeGrid';
|
|
36
|
+
export { ModalV2 } from './ModalV2';
|
|
37
|
+
export * from './PreviewModal';
|