Skip to content

Commit 7cb105f

Browse files
authored
Merge pull request #1141 from merico-dev/1140-show-size-info-when-resizing-a-panel
1140 able to type in width & height for a panel
2 parents 6c56726 + 860cc7c commit 7cb105f

File tree

9 files changed

+46
-13
lines changed

9 files changed

+46
-13
lines changed

api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtable/api",
3-
"version": "10.22.0",
3+
"version": "10.23.0",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtable/dashboard",
3-
"version": "10.22.0",
3+
"version": "10.23.0",
44
"license": "Apache-2.0",
55
"publishConfig": {
66
"access": "public",

dashboard/src/components/view/layout/index.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
padding: 0;
66
}
77
.react-grid-item.react-grid-placeholder {
8-
/* background: none !important; */
8+
background: black !important;
9+
opacity: 0.3 !important;
910
}
1011
.panel-grid-item {
1112
padding: 5px;
Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Switch } from '@mantine/core';
1+
import { Divider, Group, NumberInput, Stack, Switch, Text } from '@mantine/core';
22
import { observer } from 'mobx-react-lite';
33
import { useEditPanelContext } from '~/contexts/panel-context';
44

@@ -8,11 +8,38 @@ export const EditStyle = observer(() => {
88

99
return (
1010
<>
11-
<Switch
12-
label="Border"
13-
checked={style.border.enabled}
14-
onChange={(event) => style.border.setEnabled(event.currentTarget.checked)}
15-
/>
11+
<Divider mb={-10} label="Style" labelPosition="center" variant="dashed" />
12+
<Stack spacing={20}>
13+
<Group grow align="top">
14+
<NumberInput
15+
label="Width"
16+
min={1}
17+
max={36}
18+
step={1}
19+
precision={0}
20+
rightSection={<Text size={12}>of 36 columns</Text>}
21+
styles={{ rightSection: { width: '110px' } }}
22+
value={panel.layout.w}
23+
onChange={(v) => {
24+
v && panel.layout.setWidth(v);
25+
}}
26+
/>
27+
<NumberInput
28+
label="Height"
29+
rightSection={<Text size={12}>px</Text>}
30+
styles={{ rightSection: { width: '40px' } }}
31+
value={panel.layout.h}
32+
onChange={(v) => {
33+
v && panel.layout.setHeight(v);
34+
}}
35+
/>
36+
</Group>
37+
<Switch
38+
label="Border"
39+
checked={style.border.enabled}
40+
onChange={(event) => style.border.setEnabled(event.currentTarget.checked)}
41+
/>
42+
</Stack>
1643
</>
1744
);
1845
});

dashboard/src/dashboard-editor/ui/settings/content/edit-panel/panel-config/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { EditTitle } from './title';
66
export function PanelConfig() {
77
return (
88
<Stack sx={{ height: '100%' }}>
9-
<Divider label="Style" labelPosition="center" variant="dashed" />
109
<EditStyle />
1110
<Divider label="Info" labelPosition="center" variant="dashed" />
1211
<EditTitle />

dashboard/src/model/meta-model/dashboard/content/panel/layout.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,10 @@ export const PanelLayoutMeta = types
3333
self.moved = !!moved;
3434
self.static = !!layout.static;
3535
},
36+
setWidth(w: number) {
37+
self.w = w;
38+
},
39+
setHeight(h: number) {
40+
self.h = h;
41+
},
3642
}));

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtable/root",
3-
"version": "10.22.0",
3+
"version": "10.23.0",
44
"private": true,
55
"workspaces": [
66
"api",

settings-form/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtable/settings-form",
3-
"version": "10.22.0",
3+
"version": "10.23.0",
44
"license": "Apache-2.0",
55
"publishConfig": {
66
"access": "public",

website/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@devtable/website",
33
"private": true,
44
"license": "Apache-2.0",
5-
"version": "10.22.0",
5+
"version": "10.23.0",
66
"scripts": {
77
"dev": "vite",
88
"preview": "vite preview"

0 commit comments

Comments
 (0)