Skip to content

Commit 3c2191f

Browse files
Merge branch 'main' into tshepo/en/file-component
2 parents a4161ce + 1f4a79c commit 3c2191f

File tree

26 files changed

+1821
-1642
lines changed

26 files changed

+1821
-1642
lines changed

.github/workflows/npm-build-test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: shesha-reactjs-build-test
1+
name: shesha-reactjs-build
2+
description: Attempt to build the shesha-reactjs project to ensure the branch is not broken
23

34
on:
45
pull_request:
@@ -10,7 +11,7 @@ permissions:
1011
contents: read
1112

1213
jobs:
13-
build-and-test:
14+
build-attempt:
1415
runs-on: ubuntu-latest
1516
defaults:
1617
run:

shesha-reactjs/src/components/buttonGroupConfigurator/buttonGroupItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ export const ButtonGroupItem: FC<IButtonGroupItemProps> = ({ item, actionConfigu
107107
...(['dashed', 'default'].includes(item.buttonType) && backgroundStyles),
108108
...(['primary', 'default'].includes(item.buttonType) && shadowStyles),
109109
...jsStyle,
110-
...stylingBoxAsCSS
110+
...stylingBoxAsCSS,
111+
justifyContent: font?.align,
111112
};
112113

113114
return (
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import { DesignerToolbarSettings } from "@/index";
2+
import { nanoid } from "@/utils/uuid";
3+
import { FormLayout } from "antd/lib/form/Form";
4+
5+
export const getGroupSettings = (data: any) => {
6+
const searchableTabsId = nanoid();
7+
const commonTabId = nanoid();
8+
const securityTabId = nanoid();
9+
10+
return {
11+
components: new DesignerToolbarSettings(data)
12+
.addSearchableTabs({
13+
id: searchableTabsId,
14+
propertyName: 'settingsTabs',
15+
parentId: 'root',
16+
label: 'Settings',
17+
hideLabel: true,
18+
labelAlign: 'right',
19+
size: 'small',
20+
tabs: [
21+
{
22+
key: 'common',
23+
title: 'Common',
24+
id: commonTabId,
25+
components: [
26+
...new DesignerToolbarSettings()
27+
.addSettingsInput({
28+
id: nanoid(),
29+
inputType: "textField",
30+
propertyName: "title",
31+
parentId: commonTabId,
32+
label: "Title",
33+
jsSetting: true,
34+
validate: {
35+
required: true
36+
},
37+
})
38+
.addSettingsInput({
39+
id: nanoid(),
40+
inputType: "textArea",
41+
propertyName: "tooltip",
42+
parentId: commonTabId,
43+
label: "Tooltip",
44+
jsSetting: true,
45+
})
46+
.addSettingsInput({
47+
id: nanoid(),
48+
inputType: "iconPicker",
49+
propertyName: "icon",
50+
parentId: commonTabId,
51+
label: "Icon",
52+
jsSetting: true,
53+
})
54+
.addSettingsInput({
55+
id: nanoid(),
56+
inputType: "switch",
57+
propertyName: "hidden",
58+
parentId: commonTabId,
59+
label: "Hide",
60+
jsSetting: true,
61+
})
62+
.toJson()
63+
]
64+
},
65+
{
66+
key: 'security',
67+
title: 'Security',
68+
id: securityTabId,
69+
components: [...new DesignerToolbarSettings()
70+
.addSettingsInput({
71+
readOnly: { _code: 'return getSettingValue(data?.readOnly);', _mode: 'code', _value: false } as any,
72+
id: nanoid(),
73+
inputType: 'permissions',
74+
propertyName: 'requiredPermissions',
75+
label: 'Permissions',
76+
size: 'small',
77+
parentId: securityTabId,
78+
jsSetting: true,
79+
})
80+
.toJson()
81+
]
82+
}
83+
]
84+
})
85+
.toJson(),
86+
formSettings: {
87+
colon: false,
88+
layout: 'vertical' as FormLayout,
89+
labelCol: { span: 24 },
90+
wrapperCol: { span: 24 },
91+
isSettingsForm: true
92+
}
93+
};
94+
};

shesha-reactjs/src/components/configurableSidebarMenu/configurator/itemProperties.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import groupSettingsJson from './groupSettings.json';
2-
import itemSettingsJson from './itemSettings.json';
31
import React, {
42
FC,
53
useMemo,
@@ -11,6 +9,8 @@ import { ISidebarMenuItem, isSidebarGroup } from '@/interfaces/sidebar';
119
import { SourceFilesFolderProvider } from '@/providers/sourceFileManager/sourcesFolderProvider';
1210
import { sheshaStyles } from '@/styles';
1311
import { ConfigurableForm } from '@/components';
12+
import { getGroupSettings } from './groupSettings';
13+
import { getItemSettings } from './itemSettings';
1414

1515
export interface ISidebarItemPropertiesProps {
1616
item?: ISidebarMenuItem;
@@ -33,8 +33,8 @@ export const SidebarItemProperties: FC<ISidebarItemPropertiesProps> = ({ item, o
3333
if (!item) return emptyEditor;
3434

3535
const markup = isSidebarGroup(item)
36-
? (groupSettingsJson as FormMarkup)
37-
: (itemSettingsJson as FormMarkup);
36+
? getGroupSettings(item) as FormMarkup
37+
: (getItemSettings(item) as FormMarkup);
3838

3939
return (
4040
<SourceFilesFolderProvider folder={`button-${item.id}`}>
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
import { DesignerToolbarSettings } from "@/index";
2+
import { nanoid } from "@/utils/uuid";
3+
import { FormLayout } from "antd/lib/form/Form";
4+
5+
export const getItemSettings = (data: any) => {
6+
const searchableTabsId = nanoid();
7+
const commonTabId = nanoid();
8+
const securityTabId = nanoid();
9+
10+
return {
11+
components: new DesignerToolbarSettings(data)
12+
.addSearchableTabs({
13+
id: searchableTabsId,
14+
propertyName: 'settingsTabs',
15+
parentId: 'root',
16+
label: 'Settings',
17+
hideLabel: true,
18+
labelAlign: 'right',
19+
size: 'small',
20+
tabs: [
21+
{
22+
key: 'common',
23+
title: 'Common',
24+
id: commonTabId,
25+
components: [
26+
...new DesignerToolbarSettings()
27+
.addSettingsInput({
28+
id: nanoid(),
29+
inputType: "dropdown",
30+
propertyName: "itemType",
31+
parentId: commonTabId,
32+
label: "Item Type",
33+
size: "small",
34+
dropdownOptions: [
35+
{
36+
label: "Button",
37+
value: "button"
38+
},
39+
{
40+
label: "Divider",
41+
value: "divider"
42+
}
43+
],
44+
validate: {
45+
required: true
46+
},
47+
jsSetting: true,
48+
})
49+
.addSettingsInput({
50+
id: nanoid(),
51+
inputType: "textField",
52+
propertyName: "title",
53+
parentId: commonTabId,
54+
label: "Title",
55+
jsSetting: true,
56+
validate: {
57+
required: true
58+
},
59+
})
60+
.addContainer({
61+
id: nanoid(),
62+
parentId: commonTabId,
63+
propertyName: "cntButton",
64+
label: "Container2",
65+
hidden: {
66+
_code: "return getSettingValue(data?.itemType) !== 'button';",
67+
_mode: "code",
68+
_value: false
69+
},
70+
justifyContent: "left",
71+
direction: "vertical",
72+
components: [
73+
...new DesignerToolbarSettings()
74+
.addSettingsInput({
75+
id: nanoid(),
76+
inputType: "textArea",
77+
propertyName: "tooltip",
78+
parentId: commonTabId,
79+
label: "Tooltip",
80+
jsSetting: true,
81+
})
82+
.addSettingsInput({
83+
id: nanoid(),
84+
inputType: "iconPicker",
85+
propertyName: "icon",
86+
parentId: commonTabId,
87+
label: "Icon",
88+
jsSetting: true,
89+
})
90+
.addConfigurableActionConfigurator({
91+
id: nanoid(),
92+
propertyName: "actionConfiguration",
93+
parentId: commonTabId,
94+
label: "Action",
95+
allowedActions: ["shesha.common"],
96+
jsSetting: false
97+
})
98+
.toJson()
99+
]
100+
})
101+
.addSettingsInput({
102+
id: nanoid(),
103+
inputType: "switch",
104+
propertyName: "hidden",
105+
parentId: commonTabId,
106+
label: "Hide",
107+
jsSetting: true,
108+
})
109+
.toJson()
110+
]
111+
},
112+
{
113+
key: 'security',
114+
title: 'Security',
115+
id: securityTabId,
116+
components: [...new DesignerToolbarSettings()
117+
.addSettingsInput({
118+
readOnly: { _code: 'return getSettingValue(data?.readOnly);', _mode: 'code', _value: false } as any,
119+
id: nanoid(),
120+
inputType: 'permissions',
121+
propertyName: 'requiredPermissions',
122+
label: 'Permissions',
123+
size: 'small',
124+
parentId: securityTabId,
125+
jsSetting: true,
126+
})
127+
.toJson()
128+
]
129+
}
130+
]
131+
})
132+
.toJson(),
133+
formSettings: {
134+
colon: false,
135+
layout: 'vertical' as FormLayout,
136+
labelCol: { span: 24 },
137+
wrapperCol: { span: 24 },
138+
isSettingsForm: true
139+
}
140+
};
141+
};

0 commit comments

Comments
 (0)