@antscorp/antsomi-ui 1.3.3-beta.2 → 1.3.3-beta.20
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/es/assets/images/stars_slider.png +0 -0
- 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 +11 -3
- package/es/components/atoms/Input/Input.js +3 -0
- 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/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/Spin/Spin.d.ts +2 -1
- package/es/components/atoms/index.d.ts +3 -0
- package/es/components/atoms/index.js +3 -0
- package/es/components/common/ConfigProvider/GlobalStyle.js +38 -1
- package/es/components/icons/ArrowGrowIcon.d.ts +2 -1
- package/es/components/icons/AudioRecordIcon.d.ts +2 -1
- package/es/components/icons/BugIcon.d.ts +2 -1
- package/es/components/icons/CameraIcon.d.ts +2 -1
- package/es/components/icons/CaptureIcon.d.ts +2 -1
- package/es/components/icons/CheckSlimIcon.d.ts +2 -1
- package/es/components/icons/CloseIcon.d.ts +2 -1
- package/es/components/icons/CommentIcon.d.ts +2 -1
- package/es/components/icons/EventIcon.d.ts +2 -1
- package/es/components/icons/FreeDrawIcon.d.ts +2 -1
- package/es/components/icons/GPTIcon.d.ts +2 -1
- package/es/components/icons/GPTIconV2.d.ts +2 -1
- package/es/components/icons/GPTIconV3.d.ts +2 -1
- package/es/components/icons/HighlightIcon.d.ts +2 -1
- package/es/components/icons/IdeaIcon.d.ts +2 -1
- package/es/components/icons/InvisibleIcon.d.ts +2 -1
- package/es/components/icons/MuteIcon.d.ts +2 -1
- package/es/components/icons/OpenUrlIcon.d.ts +2 -1
- package/es/components/icons/PauseIcon.d.ts +2 -1
- package/es/components/icons/PlaneIcon.d.ts +2 -1
- package/es/components/icons/RequestIcon.d.ts +2 -1
- package/es/components/icons/StopRecordIcon.d.ts +2 -1
- package/es/components/icons/UserIcon.d.ts +2 -1
- package/es/components/icons/VerticalDotsIcon.d.ts +2 -1
- package/es/components/icons/WarningIcon.d.ts +2 -1
- package/es/components/molecules/CaptureScreen/CaptureScreen.d.ts +2 -1
- package/es/components/molecules/CaptureScreen/components/CommentBox/CommentBox.d.ts +2 -1
- package/es/components/molecules/CaptureScreen/components/Cursor/Cursor.d.ts +2 -1
- package/es/components/molecules/Collapse/Collapse.d.ts +3 -3
- package/es/components/molecules/Collapse/Collapse.js +9 -0
- package/es/components/molecules/FontFamilySelect/constants.d.ts +307 -0
- package/es/components/molecules/FontFamilySelect/constants.js +257 -0
- package/es/components/molecules/FontFamilySelect/index.d.ts +17 -0
- package/es/components/molecules/FontFamilySelect/index.js +53 -0
- 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 +24 -0
- package/es/components/molecules/FontSetting/index.js +54 -0
- package/es/components/molecules/FontSetting/types.d.ts +22 -0
- package/es/components/molecules/FontSetting/types.js +1 -0
- package/es/components/molecules/FontWeightSelect/constants.d.ts +28 -0
- package/es/components/molecules/FontWeightSelect/constants.js +11 -0
- package/es/components/molecules/FontWeightSelect/index.d.ts +9 -0
- package/es/components/molecules/FontWeightSelect/index.js +39 -0
- 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/Modal/styled.d.ts +1 -1
- package/es/components/molecules/ResizeGrid/ResizeGrid.d.ts +3 -0
- package/es/components/molecules/ResizeGrid/ResizeGrid.js +353 -0
- package/es/components/molecules/ResizeGrid/components/Cell/Cell.d.ts +3 -0
- package/es/components/molecules/ResizeGrid/components/Cell/Cell.js +67 -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 +62 -0
- package/es/components/molecules/ResizeGrid/constant.d.ts +34 -0
- package/es/components/molecules/ResizeGrid/constant.js +108 -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 +3 -0
- package/es/components/molecules/ResizeGrid/styled.js +20 -0
- package/es/components/molecules/ResizeGrid/types.d.ts +128 -0
- package/es/components/molecules/ResizeGrid/types.js +1 -0
- package/es/components/molecules/Select/Select.d.ts +3 -0
- package/es/components/molecules/Select/Select.js +23 -2
- package/es/components/molecules/Select/Test.d.ts +2 -1
- package/es/components/molecules/SettingWrapper/index.d.ts +1 -2
- package/es/components/molecules/SettingWrapperPopover/index.d.ts +16 -0
- package/es/components/molecules/SettingWrapperPopover/index.js +17 -0
- package/es/components/molecules/TextDecorationSelect/constants.d.ts +19 -0
- package/es/components/molecules/TextDecorationSelect/constants.js +26 -0
- package/es/components/molecules/TextDecorationSelect/index.d.ts +15 -0
- package/es/components/molecules/TextDecorationSelect/index.js +45 -0
- package/es/components/molecules/TextTransformSelect/constants.d.ts +13 -0
- package/es/components/molecules/TextTransformSelect/constants.js +19 -0
- package/es/components/molecules/TextTransformSelect/index.d.ts +9 -0
- package/es/components/molecules/TextTransformSelect/index.js +39 -0
- package/es/components/molecules/TreeSelect/TreeSelect.d.ts +1 -1
- package/es/components/molecules/UploadImage/MediaIcon.d.ts +2 -1
- package/es/components/molecules/index.d.ts +10 -0
- package/es/components/molecules/index.js +8 -0
- package/es/constants/storybook.d.ts +2 -1
- package/es/constants/theme.js +25 -3
- package/es/hooks/useDeepCompareEffect.d.ts +1 -0
- package/es/hooks/useDeepCompareEffect.js +21 -0
- package/es/test.d.ts +2 -1
- package/es/test.js +8 -1
- package/package.json +6 -5
- package/dist/0173b5993573afa04880.woff +0 -0
- package/dist/0dfb9214dfd945cd7290.png +0 -1
- package/dist/2883cad25a2b4e87ce5f.eot +0 -0
- package/dist/4f54a37971347e3d7122.png +0 -1
- package/dist/574b7bee0563a9fe9a29.png +0 -1
- package/dist/6b586356e837581204dc.svg +0 -1
- package/dist/72eec5c1c786b45a667f.ttf +0 -0
- package/dist/bc6bf11c6f5e6743aa4c.png +0 -1
- package/dist/dbc405edd6e0806efbc9.svg +0 -1
- package/dist/e32f09119052a55cce3c.png +0 -1
- package/dist/e3851b9384a984c6fdb5.png +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.LICENSE.txt +0 -69
- package/dist/main.css +0 -69
- package/dist/public/icons/2d496b55d85a9545d7311c073af442bb.png +0 -0
- package/dist/public/icons/2fbb4e0927d18e3f8e5c6511ab88d5b3.png +0 -0
- package/dist/public/icons/725a52bd91a3ce534b10833df510e5fa.png +0 -0
- package/dist/public/icons/7d037e0b378e87a82804443636cd0e13.svg +0 -346
- package/dist/public/icons/90553767e0a05b9585a54797cfd9ce51.png +0 -0
- package/dist/public/icons/bb64e23a1ff390a416d765ee556096ab.svg +0 -87
- package/dist/public/icons/d327b24e9c5d8f486f08d253aab58ce6.png +0 -0
- package/dist/public/icons/f1cf266d0a0a53ce07f2dbb859869b7a.png +0 -0
- package/dist/public/icons/placeholder-image.png +0 -0
- package/dist/public/icons/transparent.svg +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
position: relative;
|
|
8
|
+
user-select: none;
|
|
9
|
+
|
|
10
|
+
.resize-top,
|
|
11
|
+
.resize-right,
|
|
12
|
+
.resize-bottom,
|
|
13
|
+
.resize-left {
|
|
14
|
+
position: absolute;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.resize-top,
|
|
18
|
+
.resize-bottom {
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 2px;
|
|
21
|
+
left: -1px;
|
|
22
|
+
cursor: row-resize;
|
|
23
|
+
}
|
|
24
|
+
.resize-left,
|
|
25
|
+
.resize-right {
|
|
26
|
+
width: 2px;
|
|
27
|
+
height: 100%;
|
|
28
|
+
top: -1px;
|
|
29
|
+
cursor: col-resize;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.resize-top {
|
|
33
|
+
// background: red;
|
|
34
|
+
top: -1px;
|
|
35
|
+
}
|
|
36
|
+
.resize-right {
|
|
37
|
+
// background: green;
|
|
38
|
+
right: -1px;
|
|
39
|
+
}
|
|
40
|
+
.resize-bottom {
|
|
41
|
+
// background: blue;
|
|
42
|
+
bottom: -1px;
|
|
43
|
+
}
|
|
44
|
+
.resize-left {
|
|
45
|
+
// background: yellow;
|
|
46
|
+
left: -1px;
|
|
47
|
+
}
|
|
48
|
+
.imageWrapper {
|
|
49
|
+
height: 100%;
|
|
50
|
+
max-width: 100%;
|
|
51
|
+
max-height: 100%;
|
|
52
|
+
img {
|
|
53
|
+
display: block;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
max-width: 100%;
|
|
57
|
+
max-height: 100%;
|
|
58
|
+
object-fit: contain;
|
|
59
|
+
-webkit-user-drag: none;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
@@ -0,0 +1,34 @@
|
|
|
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: (grid: 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 getSafety: (fn: any, defaultValue?: string) => any;
|
|
@@ -0,0 +1,108 @@
|
|
|
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 = (grid) => {
|
|
40
|
+
let childs = [];
|
|
41
|
+
let buildCol = !grid.gridTemplateColumns || !grid.gridTemplateColumns.length;
|
|
42
|
+
const buildRow = !grid.gridTemplateRows || !grid.gridTemplateRows.length;
|
|
43
|
+
const buildChild = !grid.childs || !grid.childs.length;
|
|
44
|
+
const gridTemplateColumns = grid.gridTemplateColumns || [];
|
|
45
|
+
const gridTemplateRows = grid.gridTemplateRows || [];
|
|
46
|
+
if (!buildChild && grid.childs) {
|
|
47
|
+
childs = grid.childs.map(buildCell);
|
|
48
|
+
}
|
|
49
|
+
if (buildChild || buildRow || buildCol) {
|
|
50
|
+
Array(grid.rows)
|
|
51
|
+
.fill(1)
|
|
52
|
+
.forEach((_, row) => {
|
|
53
|
+
if (buildRow && grid.rows) {
|
|
54
|
+
gridTemplateRows.push(100 / grid.rows);
|
|
55
|
+
}
|
|
56
|
+
Array(grid.cols)
|
|
57
|
+
.fill(1)
|
|
58
|
+
.forEach((__, col) => {
|
|
59
|
+
if (buildChild) {
|
|
60
|
+
childs.push({
|
|
61
|
+
rowStart: row + 1,
|
|
62
|
+
rowEnd: row + 2,
|
|
63
|
+
colStart: col + 1,
|
|
64
|
+
colEnd: col + 2,
|
|
65
|
+
// image: {
|
|
66
|
+
// imageStyles: {},
|
|
67
|
+
// imageSettings: {},
|
|
68
|
+
// imageUrl: 'https://source.unsplash.com/random/300×300'
|
|
69
|
+
// },
|
|
70
|
+
objectFit: 'contain',
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (buildCol && grid.cols) {
|
|
74
|
+
gridTemplateColumns.push(100 / grid.cols);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
buildCol = false;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return Object.assign(Object.assign({ rows: grid.rows || 1, cols: grid.rows || 1 }, grid), { gridTemplateColumns,
|
|
81
|
+
gridTemplateRows,
|
|
82
|
+
childs });
|
|
83
|
+
};
|
|
84
|
+
export const buildGridArea = box =>
|
|
85
|
+
// console.log('area', box, `${box.rowStart} / ${box.colStart} / ${box.rowEnd} / ${box.colEnd}`)
|
|
86
|
+
`${box.rowStart} / ${box.colStart} / ${box.rowEnd} / ${box.colEnd}`;
|
|
87
|
+
export const buildTranform = box => {
|
|
88
|
+
const { transformX, transformY } = box;
|
|
89
|
+
if (transformX && transformY) {
|
|
90
|
+
return `translate(${transformX}px, ${transformY}px)`;
|
|
91
|
+
}
|
|
92
|
+
if (transformX) {
|
|
93
|
+
return `translateX(${transformX}px)`;
|
|
94
|
+
}
|
|
95
|
+
if (transformY) {
|
|
96
|
+
return `translateY(${transformY}px)`;
|
|
97
|
+
}
|
|
98
|
+
return 'unset';
|
|
99
|
+
};
|
|
100
|
+
export const MIN_SIZE = 32;
|
|
101
|
+
export const getSafety = (fn, defaultValue = '') => {
|
|
102
|
+
try {
|
|
103
|
+
return fn();
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
return defaultValue;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ResizeGrid } from './ResizeGrid';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const StyledGrid = styled.div `
|
|
4
|
+
width: 100%;
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
|
|
7
|
+
* {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.grid-container {
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
display: grid;
|
|
15
|
+
background-repeat: no-repeat;
|
|
16
|
+
background-position: top left;
|
|
17
|
+
background-size: 100% 100%;
|
|
18
|
+
aspect-ratio: ${props => (props.isCompact ? '3 / 1' : '3 / 2')};
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
rowStart: number;
|
|
48
|
+
rowEnd: number;
|
|
49
|
+
colStart: number;
|
|
50
|
+
colEnd: number;
|
|
51
|
+
width?: number;
|
|
52
|
+
height?: number;
|
|
53
|
+
transformX?: number;
|
|
54
|
+
transformY?: number;
|
|
55
|
+
movedTop?: boolean;
|
|
56
|
+
movedRight?: boolean;
|
|
57
|
+
movedBottom?: boolean;
|
|
58
|
+
movedLeft?: boolean;
|
|
59
|
+
image?: TImage;
|
|
60
|
+
objectFit?: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down';
|
|
61
|
+
active?: boolean;
|
|
62
|
+
};
|
|
63
|
+
export interface CellProps {
|
|
64
|
+
cell: TCell;
|
|
65
|
+
idx: number;
|
|
66
|
+
down: Function;
|
|
67
|
+
downCell: Function;
|
|
68
|
+
up: Function;
|
|
69
|
+
setRef: Function;
|
|
70
|
+
downSelect: Function;
|
|
71
|
+
upSelect: Function;
|
|
72
|
+
hoverSelect: Function;
|
|
73
|
+
unMerge: Function;
|
|
74
|
+
renderCell?: Function;
|
|
75
|
+
borderStyle?: string;
|
|
76
|
+
style?: React.CSSProperties;
|
|
77
|
+
activeStyle?: React.CSSProperties;
|
|
78
|
+
isPreviewMode?: boolean;
|
|
79
|
+
}
|
|
80
|
+
export type TGrid = {
|
|
81
|
+
rows: number;
|
|
82
|
+
cols: number;
|
|
83
|
+
gridTemplateColumns: number[];
|
|
84
|
+
gridTemplateRows: number[];
|
|
85
|
+
childs: TCell[];
|
|
86
|
+
};
|
|
87
|
+
export type TStartRef = {
|
|
88
|
+
clientX: number;
|
|
89
|
+
clientY: number;
|
|
90
|
+
type: 'row' | 'column';
|
|
91
|
+
line: number;
|
|
92
|
+
};
|
|
93
|
+
export type TCellExtend = TCell & {
|
|
94
|
+
cellRef: React.RefObject<HTMLElement>;
|
|
95
|
+
idx: number;
|
|
96
|
+
};
|
|
97
|
+
export type TStartCellRef = {
|
|
98
|
+
clientX: number;
|
|
99
|
+
clientY: number;
|
|
100
|
+
idx: number;
|
|
101
|
+
direction: 'top' | 'right' | 'bottom' | 'left';
|
|
102
|
+
isRevert: boolean;
|
|
103
|
+
cell: TCellExtend;
|
|
104
|
+
nextCell: TCellExtend;
|
|
105
|
+
};
|
|
106
|
+
export type TSelected = {
|
|
107
|
+
idx: number;
|
|
108
|
+
cell: TCell;
|
|
109
|
+
};
|
|
110
|
+
export type TSelectedEnd = {
|
|
111
|
+
cell: TCell;
|
|
112
|
+
idx: number;
|
|
113
|
+
hCells: number[];
|
|
114
|
+
};
|
|
115
|
+
export interface IResizeGridProps {
|
|
116
|
+
grid?: Partial<TGrid>;
|
|
117
|
+
renderCell?: Function;
|
|
118
|
+
onChangeGrid?: Function;
|
|
119
|
+
image?: string;
|
|
120
|
+
imageSize?: string;
|
|
121
|
+
imagePosition?: string;
|
|
122
|
+
cellStyle?: React.CSSProperties;
|
|
123
|
+
isPreviewMode?: boolean;
|
|
124
|
+
cellBorderStyle?: string;
|
|
125
|
+
cellActiveStyle?: React.CSSProperties;
|
|
126
|
+
containerStyle?: React.CSSProperties;
|
|
127
|
+
isCompact?: boolean;
|
|
128
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
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;
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
|
-
interface SettingWrapperProps {
|
|
2
|
+
export interface SettingWrapperProps {
|
|
3
3
|
label: string;
|
|
4
4
|
className?: string;
|
|
5
5
|
labelColor?: string;
|
|
@@ -10,4 +10,3 @@ interface SettingWrapperProps {
|
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
}
|
|
12
12
|
export declare const SettingWrapper: React.FC<SettingWrapperProps>;
|
|
13
|
-
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SettingWrapperProps } from '../SettingWrapper';
|
|
3
|
+
import { PopoverProps } from 'antd';
|
|
4
|
+
export type SettingWrapperPopoverProps = {
|
|
5
|
+
label: string;
|
|
6
|
+
wrapperProps?: Omit<SettingWrapperProps, 'label'>;
|
|
7
|
+
popoverProps?: Omit<PopoverProps, 'content'>;
|
|
8
|
+
iconPopover?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Renders a popover wrapper for a setting.
|
|
12
|
+
*
|
|
13
|
+
* @param {React.PropsWithChildren<SettingWrapperPopoverProps>} props - The props object containing the label, children, wrapperProps and popoverProps.
|
|
14
|
+
* @returns {React.ReactElement} The rendered popover wrapper.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SettingWrapperPopover: React.FC<React.PropsWithChildren<SettingWrapperPopoverProps>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SettingWrapper } from '../SettingWrapper';
|
|
3
|
+
import { Button, Icon, Popover } from '../../atoms';
|
|
4
|
+
/**
|
|
5
|
+
* Renders a popover wrapper for a setting.
|
|
6
|
+
*
|
|
7
|
+
* @param {React.PropsWithChildren<SettingWrapperPopoverProps>} props - The props object containing the label, children, wrapperProps and popoverProps.
|
|
8
|
+
* @returns {React.ReactElement} The rendered popover wrapper.
|
|
9
|
+
*/
|
|
10
|
+
export const SettingWrapperPopover = ({ label, children, wrapperProps, popoverProps, iconPopover, }) => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
return (React.createElement(SettingWrapper, Object.assign({ label: label, labelStyle: Object.assign({ fontWeight: 'bold' }, ((_a = wrapperProps === null || wrapperProps === void 0 ? void 0 : wrapperProps.labelStyle) !== null && _a !== void 0 ? _a : {})) }, (wrapperProps !== null && wrapperProps !== void 0 ? wrapperProps : {})),
|
|
13
|
+
React.createElement(Popover, Object.assign({ content: children, trigger: ['click'], overlayInnerStyle: Object.assign({ padding: '12px 16px', minWidth: 288, maxHeight: '90vh', overflow: 'auto' }, ((_b = popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.overlayInnerStyle) !== null && _b !== void 0 ? _b : {})) }, (popoverProps !== null && popoverProps !== void 0 ? popoverProps : {})), iconPopover)));
|
|
14
|
+
};
|
|
15
|
+
SettingWrapperPopover.defaultProps = {
|
|
16
|
+
iconPopover: React.createElement(Button, { icon: React.createElement(Icon, { type: "icon-ants-edit-2" }), type: "text" }),
|
|
17
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const OPTION_TEXT_DECORATION: readonly [{
|
|
2
|
+
readonly label: "None";
|
|
3
|
+
readonly value: "none";
|
|
4
|
+
}, {
|
|
5
|
+
readonly label: "Underline";
|
|
6
|
+
readonly value: "underline";
|
|
7
|
+
}, {
|
|
8
|
+
readonly label: "Overline";
|
|
9
|
+
readonly value: "overline";
|
|
10
|
+
}, {
|
|
11
|
+
readonly label: "Line Through";
|
|
12
|
+
readonly value: "line-through";
|
|
13
|
+
}, {
|
|
14
|
+
readonly label: "Underline - Overline";
|
|
15
|
+
readonly value: "underline overline";
|
|
16
|
+
}, {
|
|
17
|
+
readonly label: "Underline - Line Through";
|
|
18
|
+
readonly value: "underline line-through";
|
|
19
|
+
}];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const OPTION_TEXT_DECORATION = [
|
|
2
|
+
{
|
|
3
|
+
label: 'None',
|
|
4
|
+
value: 'none',
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
label: 'Underline',
|
|
8
|
+
value: 'underline',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: 'Overline',
|
|
12
|
+
value: 'overline',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: 'Line Through',
|
|
16
|
+
value: 'line-through',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: 'Underline - Overline',
|
|
20
|
+
value: 'underline overline',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: 'Underline - Line Through',
|
|
24
|
+
value: 'underline line-through',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectProps } from '../Select';
|
|
3
|
+
import { OPTION_TEXT_DECORATION } from './constants';
|
|
4
|
+
export type TextDecorationSelectProps = Omit<SelectProps, 'onChange'> & {
|
|
5
|
+
label?: string;
|
|
6
|
+
showOptions?: (typeof OPTION_TEXT_DECORATION)[number]['label'][];
|
|
7
|
+
onChange?: (textTransform: (typeof OPTION_TEXT_DECORATION)[number]['value']) => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Generates a function comment for the given function body.
|
|
11
|
+
*
|
|
12
|
+
* @param {TextDecorationSelectProps} props - the props for the TextDecorationSelect component
|
|
13
|
+
* @return {React.FC<TextDecorationSelectProps>} the TextDecorationSelect component
|
|
14
|
+
*/
|
|
15
|
+
export declare const TextDecorationSelect: React.FC<TextDecorationSelectProps>;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
};
|
|
12
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import { Select } from '../Select';
|
|
14
|
+
import { OPTION_TEXT_DECORATION } from './constants';
|
|
15
|
+
import { SettingWrapper } from '../SettingWrapper';
|
|
16
|
+
/**
|
|
17
|
+
* Generates a function comment for the given function body.
|
|
18
|
+
*
|
|
19
|
+
* @param {TextDecorationSelectProps} props - the props for the TextDecorationSelect component
|
|
20
|
+
* @return {React.FC<TextDecorationSelectProps>} the TextDecorationSelect component
|
|
21
|
+
*/
|
|
22
|
+
export const TextDecorationSelect = (props) => {
|
|
23
|
+
const { defaultValue, label, value, showOptions, onChange } = props, selectProps = __rest(props, ["defaultValue", "label", "value", "showOptions", "onChange"]);
|
|
24
|
+
const [selected, setSelected] = useState(defaultValue || value);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setSelected(value === null || value === void 0 ? void 0 : value.toString());
|
|
27
|
+
}, [value]);
|
|
28
|
+
const textDecorationOptions = useMemo(() => {
|
|
29
|
+
let draftFontFamily = [...OPTION_TEXT_DECORATION];
|
|
30
|
+
if (showOptions === null || showOptions === void 0 ? void 0 : showOptions.length) {
|
|
31
|
+
draftFontFamily = OPTION_TEXT_DECORATION.filter(({ label }) => showOptions.some(font => font === label));
|
|
32
|
+
}
|
|
33
|
+
return draftFontFamily;
|
|
34
|
+
}, [showOptions]);
|
|
35
|
+
const handleChange = (value) => {
|
|
36
|
+
if (onChange && typeof onChange === 'function') {
|
|
37
|
+
onChange(value);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return (React.createElement(SettingWrapper, { label: label !== null && label !== void 0 ? label : '', containerStyle: { width: '100%' }, vertical: true },
|
|
41
|
+
React.createElement(Select, Object.assign({ value: selected, options: [...textDecorationOptions], style: { width: '100%' }, onChange: select => {
|
|
42
|
+
setSelected(select);
|
|
43
|
+
handleChange(select);
|
|
44
|
+
}, showSearch: true }, selectProps))));
|
|
45
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const OPTION_TEXT_TRANSFORM: readonly [{
|
|
2
|
+
readonly label: "None";
|
|
3
|
+
readonly value: "none";
|
|
4
|
+
}, {
|
|
5
|
+
readonly label: "Capitalize";
|
|
6
|
+
readonly value: "capitalize";
|
|
7
|
+
}, {
|
|
8
|
+
readonly label: "Uppercase";
|
|
9
|
+
readonly value: "uppercase";
|
|
10
|
+
}, {
|
|
11
|
+
readonly label: "Lowercase";
|
|
12
|
+
readonly value: "lowercase";
|
|
13
|
+
}];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// export const LABEL_TEXT_TRANSFORM = 'None' || 'Capitalize' || 'Uppercase' || 'Lowercase';
|
|
2
|
+
export const OPTION_TEXT_TRANSFORM = [
|
|
3
|
+
{
|
|
4
|
+
label: 'None',
|
|
5
|
+
value: 'none',
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
label: 'Capitalize',
|
|
9
|
+
value: 'capitalize',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: 'Uppercase',
|
|
13
|
+
value: 'uppercase',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: 'Lowercase',
|
|
17
|
+
value: 'lowercase',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectProps } from '../Select';
|
|
3
|
+
import { OPTION_TEXT_TRANSFORM } from './constants';
|
|
4
|
+
export type TextTransformSelectProps = Omit<SelectProps, 'onChange'> & {
|
|
5
|
+
label?: string;
|
|
6
|
+
showOptions?: (typeof OPTION_TEXT_TRANSFORM)[number]['label'][];
|
|
7
|
+
onChange?: (textTransform: (typeof OPTION_TEXT_TRANSFORM)[number]['value']) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const TextTransformSelect: React.FC<TextTransformSelectProps>;
|