Skip to content

Commit c60aa7f

Browse files
author
Administrator
committed
sample update
1 parent e7dddcc commit c60aa7f

File tree

4 files changed

+45
-35
lines changed

4 files changed

+45
-35
lines changed

src/CascadeForms/CascadeForms.stories.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// Generated with util/create-component.js
22
import "@blueprintjs/icons/lib/css/blueprint-icons.css";
33
import "@blueprintjs/core/lib/css/blueprint.css";
4+
import "./story.css";
45

5-
import React,{ useEffect,createRef } from "react";
6+
import React,{ createRef } from "react";
67
import { ComponentStory, ComponentMeta } from "@storybook/react";
78
import _ from "lodash";
89

@@ -68,14 +69,12 @@ export default {
6869

6970
const Template : ComponentStory<typeof CascadeForms> = (args:CascadeFormProps) => <CascadeFormsTest {...args} />;
7071

71-
export const FolderTree = Template.bind({});
72+
export const CascadeFormSample = Template.bind({});
7273

73-
FolderTree.args = {
74+
CascadeFormSample.args = {
7475
form:FORM,
7576
};
7677

77-
export const PropertyGridCommon = Template.bind({});
78-
7978

8079
/*
8180
export const FolderTree = Template.bind({});

src/CascadeForms/CascadeForms.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const Render = ({ parent, items,formState,onUpdate,onRender } : RenderProps) =>
5555
<div className={parent?.className}>
5656
{items.filter(entry => isVisible(entry,formState)).map((entry:FormItem,idx:number) => {
5757
return (
58-
<div className="innerRender" key={`render_${idx}_${entry.id}`}>
58+
<div className={entry.className} key={`render_${idx}_${entry.id}`}>
5959
<Entry key={`entry_${idx}_${entry.id}`} onRender={onRender} item={entry} formState={formState} onUpdate={onUpdate} />
6060
{entry.items?.length && <Render parent={entry} formState={formState} items={entry.items} onRender={onRender} onUpdate={onUpdate} />}
6161
</div>

src/CascadeForms/form1.json

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
11
[
22
{
33
"type":"view",
4-
"className":"formView",
5-
"title":"The Form 2",
6-
"id":"form2",
4+
"title":"Sample view",
5+
"id":"sample1",
6+
"visible":{ "state":"htitle","expect":true },
77
"items":[
88
{
9-
"id":"not",
9+
"className":"sampleForm",
10+
"id":"header1",
1011
"type":"text",
11-
"title":"The Title",
12-
"visible":{ "state":"female","expect":true }
12+
"title":"Surpise !",
13+
"visible":{ "state":"agree","expect":true }
1314
}
1415
]
1516
},
1617
{
1718
"type":"view",
1819
"className":"formView",
19-
"title":"The Form",
20-
"id":"form1",
20+
"title":"Common Form",
21+
"id":"main",
2122
"items":[
2223
{
2324
"id":"name",
2425
"title":"Name",
2526
"type":"input",
26-
"validator":{ "type":"string","max":5 },
27-
"visible":{ "state":"male","expect":true }
27+
"validator":{ "type":"string","max":5 }
2828
},
2929
{
30-
"title":"Select people",
30+
"title":"More details",
3131
"type":"checkbox",
32-
"id":"color",
32+
"id":"details",
3333
"items":[
3434
{
35-
"visible":{ "state":"color","expect":true },
36-
"title":"White people",
35+
"title":"Only first name",
3736
"type":"input",
38-
"id":"white",
37+
"id":"first_name",
38+
"visible":{ "state":"details","expect":false },
3939
"items":[
4040
{
41-
"title":"Gender",
41+
"title":"More opts...",
4242
"type":"checkbox",
43-
"id":"gender",
43+
"id":"opts",
4444
"items":[
4545
{
46-
"title":"Select one",
46+
"title":"Hide title",
4747
"type":"radio",
48-
"id":"male",
49-
"visible":{ "state":"gender","expect":true }
48+
"id":"htitle",
49+
"visible":{ "state":"opts","expect":true }
5050
},
5151
{
52-
"title":"Select Two",
52+
"title":"Hide Agreement",
5353
"type":"radio",
54-
"id":"female",
55-
"visible":{ "state":"gender","expect":true }
54+
"id":"hagree",
55+
"visible":{ "state":"opts","expect":true }
5656
}
5757
]
5858
}
@@ -61,18 +61,18 @@
6161
{
6262
"type":"view",
6363
"id":"pform",
64-
"visible":{ "state":"color","expect":false },
65-
"className":"peopleForm",
64+
"visible":{ "state":"details","expect":true },
65+
"className":"rowForm",
6666
"items":[
6767
{
68-
"title":"Black people name include",
68+
"title":"First name",
6969
"type":"input",
70-
"id":"black"
70+
"id":"first_name1"
7171
},
7272
{
73-
"title":"Black people exclude",
73+
"title":"Last name",
7474
"type":"input",
75-
"id":"info"
75+
"id":"last_name1"
7676
}
7777
]
7878
}
@@ -82,6 +82,7 @@
8282
"title":"Agreenment",
8383
"type":"checkbox",
8484
"id":"agree",
85+
"visible":{ "state":"hagree","expect":true },
8586
"items":[
8687
{
8788
"title":"I'll accept all",

src/CascadeForms/story.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
.sampleForm {
3+
margin: 10px;
4+
background-color: rgb(241, 149, 11);
5+
}
6+
7+
.rowForm {
8+
display: flex;
9+
flex-direction: row;
10+
}

0 commit comments

Comments
 (0)