Skip to content

Commit 2c7b146

Browse files
committed
Improve demo data
1 parent 8497e66 commit 2c7b146

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

demo/src/demoData/dataDefinitions.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export const demoData: Record<string, DemoData> = {
9090
</Box>
9191
</Flex>
9292
),
93+
rootName: 'data',
9394
collapse: 2,
9495
data: data.intro,
9596
customNodeDefinitions: [dateNodeDefinition],
@@ -123,6 +124,7 @@ export const demoData: Record<string, DemoData> = {
123124
</Text>
124125
</Flex>
125126
),
127+
rootName: 'Star Wars data',
126128
restrictEdit: ({ value }) => typeof value === 'object' && value !== null,
127129
restrictDelete: ({ value }) => typeof value === 'object' && value !== null,
128130
restrictAdd: ({ value }) => !Array.isArray(value),
@@ -149,7 +151,7 @@ export const demoData: Record<string, DemoData> = {
149151
<span className="code">restrictEdit</span> function
150152
</Link>{' '}
151153
has been included which targets the <span className="code">id</span> field specifically.
152-
You also can't add additional fields to the main "Person" objects.
154+
You also can't add or delete fields to the main "Person" objects.
153155
</Text>
154156
<Text>
155157
Also, notice that when you add a new item in the top level array, a correctly structured{' '}
@@ -176,9 +178,10 @@ export const demoData: Record<string, DemoData> = {
176178
</Text>
177179
</Flex>
178180
),
181+
rootName: 'Clients',
179182
restrictEdit: ({ key, level }) => key === 'id' || level === 0 || level === 1,
180183
restrictAdd: ({ level }) => level === 1,
181-
restrictDelete: ({ key }) => key === 'id',
184+
restrictDelete: ({ level }) => level !== 1,
182185
collapse: 2,
183186
searchFilter: ({ path, fullData }, searchText) => {
184187
if (path?.length >= 2) {
@@ -248,6 +251,7 @@ export const demoData: Record<string, DemoData> = {
248251
</Text>
249252
</Flex>
250253
),
254+
rootName: 'settings',
251255
collapse: 2,
252256
data: data.vsCode,
253257
onUpdate: ({ newValue }) => {

0 commit comments

Comments
 (0)