-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathshape-size.mapper.ts
172 lines (168 loc) · 6.61 KB
/
shape-size.mapper.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// src/common/shape-utils/shapeSizeMap.ts
import { ShapeType, ShapeSizeRestrictions } from '@/core/model';
import {
getButtonShapeSizeRestrictions,
getCheckboxShapeSizeRestrictions,
getComboBoxShapeSizeRestrictions,
getDatepickerInputShapeSizeRestrictions,
getHorizontalScrollBarShapeSizeRestrictions,
getIconShapeSizeRestrictions,
getInputShapeSizeRestrictions,
getLabelSizeRestrictions,
getListboxShapeSizeRestrictions,
getProgressBarShapeSizeRestrictions,
getRadioButtonShapeSizeRestrictions,
// import all other necessary functions
getSliderShapeSizeRestrictions,
getTextAreaSizeRestrictions,
getTimepickerInputShapeSizeRestrictions,
getToggleSwitchShapeSizeRestrictions,
getTooltipShapeSizeRestrictions,
getVerticalScrollBarShapeSizeRestrictions,
getChipShapeSizeRestrictions,
} from '@/common/components/mock-components/front-components';
import {
getBrowserWindowShapeSizeRestrictions,
getMobilePhoneShapeSizeRestrictions,
getModalDialogShapeSizeRestrictions,
getTabletShapeSizeRestrictions,
// other imports
} from '@/common/components/mock-components/front-containers';
import {
getTriangleShapeSizeRestrictions,
getCircleShapeSizeRestrictions,
getDiamondShapeSizeRestrictions,
getImageShapeSizeRestrictions,
getLargeArrowShapeSizeRestrictions,
getHorizontalLineShapeRestrictions,
getVerticalLineShapeRestrictions,
getPostItShapeSizeRestrictions,
getRectangleShapeSizeRestrictions,
getStarShapeSizeRestrictions,
getModalCoverShapeSizeRestrictions,
getCilinderShapeSizeRestrictions,
// other imports
} from '@/common/components/mock-components/front-basic-shapes';
import {
getAccordionShapeSizeRestrictions,
getAppBarShapeSizeRestrictions,
getAudioPlayerShapeSizeRestrictions,
getBarChartShapeSizeRestrictions,
getBreadcrumbShapeSizeRestrictions,
getButtonBarShapeSizeRestrictions,
getCalendarShapeSizeRestrictions,
getHorizontalMenuShapeSizeRestrictions,
getLineChartShapeSizeRestrictions,
getLoadIndicatorSizeRestrictions,
getMapChartShapeSizeRestrictions,
getModalShapeSizeRestrictions,
getPieChartShapeSizeRestrictions,
getTableSizeRestrictions,
getTabsBarShapeSizeRestrictions,
getToggleLightDarkShapeSizeRestrictions,
getVerticalMenuShapeSizeRestrictions,
getVideoPlayerShapeSizeRestrictions,
getVideoconferenceShapeSizeRestrictions,
getGaugeShapeSizeRestrictions,
// other imports
} from '@/common/components/mock-components/front-rich-components';
import {
getHeading1SizeRestrictions,
getHeading2SizeRestrictions,
getHeading3SizeRestrictions,
getLinkSizeRestrictions,
getNormaltextSizeRestrictions,
getParagraphSizeRestrictions,
getSmalltextSizeRestrictions,
getRichTextSizeRestrictions,
// other imports
} from '@/common/components/mock-components/front-text-components';
import {
getHorizontalLineLowShapeRestrictions,
getImagePlaceholderShapeSizeRestrictions,
getVerticalLineLowShapeRestrictions,
getRectangleLowShapeRestrictions,
getEllipseLowShapeRestrictions,
getCircleLowShapeSizeRestrictions,
} from '@/common/components/mock-components/front-low-wireframes-components';
const getMultipleNodeSizeRestrictions = (): ShapeSizeRestrictions => ({
minWidth: 0,
minHeight: 0,
maxWidth: -1,
maxHeight: -1,
defaultWidth: 0,
defaultHeight: 0,
});
// Map associating each ShapeType with its size restriction function
const shapeSizeMap: Record<ShapeType, () => ShapeSizeRestrictions> = {
multiple: getMultipleNodeSizeRestrictions,
label: getLabelSizeRestrictions,
combobox: getComboBoxShapeSizeRestrictions,
input: getInputShapeSizeRestrictions,
toggleswitch: getToggleSwitchShapeSizeRestrictions,
toggleLightDark: getToggleLightDarkShapeSizeRestrictions,
textarea: getTextAreaSizeRestrictions,
datepickerinput: getDatepickerInputShapeSizeRestrictions,
button: getButtonShapeSizeRestrictions,
progressbar: getProgressBarShapeSizeRestrictions,
listbox: getListboxShapeSizeRestrictions,
browser: getBrowserWindowShapeSizeRestrictions,
mobilePhone: getMobilePhoneShapeSizeRestrictions,
tablet: getTabletShapeSizeRestrictions,
modalDialog: getModalDialogShapeSizeRestrictions,
timepickerinput: getTimepickerInputShapeSizeRestrictions,
rectangle: getRectangleShapeSizeRestrictions,
videoPlayer: getVideoPlayerShapeSizeRestrictions,
diamond: getDiamondShapeSizeRestrictions,
horizontalLine: getHorizontalLineShapeRestrictions,
verticalLine: getVerticalLineShapeRestrictions,
accordion: getAccordionShapeSizeRestrictions,
triangle: getTriangleShapeSizeRestrictions,
postit: getPostItShapeSizeRestrictions,
pie: getPieChartShapeSizeRestrictions,
'horizontal-menu': getHorizontalMenuShapeSizeRestrictions,
'vertical-menu': getVerticalMenuShapeSizeRestrictions,
breadcrumb: getBreadcrumbShapeSizeRestrictions,
map: getMapChartShapeSizeRestrictions,
circle: getCircleShapeSizeRestrictions,
star: getStarShapeSizeRestrictions,
linechart: getLineChartShapeSizeRestrictions,
heading1: getHeading1SizeRestrictions,
heading2: getHeading2SizeRestrictions,
heading3: getHeading3SizeRestrictions,
normaltext: getNormaltextSizeRestrictions,
smalltext: getSmalltextSizeRestrictions,
paragraph: getParagraphSizeRestrictions,
richtext: getRichTextSizeRestrictions,
link: getLinkSizeRestrictions,
largeArrow: getLargeArrowShapeSizeRestrictions,
radiobutton: getRadioButtonShapeSizeRestrictions,
checkbox: getCheckboxShapeSizeRestrictions,
icon: getIconShapeSizeRestrictions,
bar: getBarChartShapeSizeRestrictions,
image: getImageShapeSizeRestrictions,
table: getTableSizeRestrictions,
horizontalScrollBar: getHorizontalScrollBarShapeSizeRestrictions,
calendar: getCalendarShapeSizeRestrictions,
verticalScrollBar: getVerticalScrollBarShapeSizeRestrictions,
modal: getModalShapeSizeRestrictions,
modalCover: getModalCoverShapeSizeRestrictions,
tabsBar: getTabsBarShapeSizeRestrictions,
appBar: getAppBarShapeSizeRestrictions,
buttonBar: getButtonBarShapeSizeRestrictions,
tooltip: getTooltipShapeSizeRestrictions,
slider: getSliderShapeSizeRestrictions,
audioPlayer: getAudioPlayerShapeSizeRestrictions,
cilinder: getCilinderShapeSizeRestrictions,
'loading-indicator': getLoadIndicatorSizeRestrictions,
videoconference: getVideoconferenceShapeSizeRestrictions,
gauge: getGaugeShapeSizeRestrictions,
imagePlaceholder: getImagePlaceholderShapeSizeRestrictions,
chip: getChipShapeSizeRestrictions,
horizontalLineLow: getHorizontalLineLowShapeRestrictions,
verticalLineLow: getVerticalLineLowShapeRestrictions,
ellipseLow: getEllipseLowShapeRestrictions,
rectangleLow: getRectangleLowShapeRestrictions,
circleLow: getCircleLowShapeSizeRestrictions,
};
export default shapeSizeMap;