Skip to content

Commit

Permalink
Update:
Browse files Browse the repository at this point in the history
    细节调整
  • Loading branch information
SleepyAries authored and zenjava committed Jun 22, 2020
1 parent d7624e7 commit df6c5af
Show file tree
Hide file tree
Showing 22 changed files with 487 additions and 343 deletions.
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"version": "1.0.1",
"private": true,
"dependencies": {
"@lugia/lugia-web": "^1.2.3",
"@lugia/lugiax": "^1.1.7",
"@lugia/lugiax-router": "1.0.16",
"@lugia/lugia-web": "^1.2.4",
"@lugia/lugiax": "^1.1.9",
"@lugia/lugiax-router": "^1.1.12",
"clipboard": "^2.0.4",
"highlight.js": "^9.13.1",
"history": "^4.7.2",
Expand All @@ -28,7 +28,10 @@
"reset-flow-typed": "npx shx rm -rf flow-typed/npm && flow-typed install --overwrite || true"
},
"devDependencies": {
"@lugia/mega-scripts": "^1.4.21",
"@lugia/dict": "^1.0.4",
"@lugia/mega-scripts": "^1.5.0",
"@lugia/theme-config": "^1.1.5",
"@lugia/theme-core": "^1.1.9",
"ali-oss": "^6.1.1",
"babel-jest": "23.4.2",
"babel-plugin-import": "^1.11.0",
Expand Down
84 changes: 55 additions & 29 deletions src/widgets/checkbox/ButtonLimitedDemo.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,63 @@
import React from 'react';
import {Checkbox} from '@lugia/lugia-web';
import React from "react";
import { Checkbox, Theme } from "@lugia/lugia-web";
import Widget from "@lugia/lugia-web/dist/consts";

const CheckboxGroup = Checkbox.Group;
const options = [
{ label: 'check1', value: '11', name: '1' },
{ label: 'check2', value: '22', name: '2' },
{ label: 'check3', value: '33', name: '3' },
{ label: "check1", value: "11", name: "1" },
{ label: "check2", value: "22", name: "2" },
{ label: "check3", value: "33", name: "3" }
];

export default class CheckBoxDemo extends React.Component {
constructor(props) {
super(props);
this.state = {
newValue: ['11', '44'],
newDisplayValue: ['check4', 'check5'],
};
const checkboxView = {
[Widget.CheckboxGroup]: {
CheckButton: {
CheckButtonChecked: {
normal: {
width: 80,
padding: { left: 10, right: 10 }
}
},
CheckboxEdgeCancel: {
normal: {
width: 80,
padding: { left: 10, right: 10 }
}
},
CheckButtonUnChecked: {
normal: {
width: 80,
padding: { left: 10, right: 10 }
}
}
}
handleChange = ({ newValue, newDisplayValue }: any): any => {
console.info(newValue, newDisplayValue);
this.setState({ newValue, newDisplayValue });
}
};

export default class CheckBoxDemo extends React.Component {
constructor(props) {
super(props);
this.state = {
newValue: ["11", "44"],
newDisplayValue: ["check4", "check5"]
};
render() {
return (
<div>
<CheckboxGroup
onChange={this.handleChange}
data={options}
value={this.state.newValue}
displayValue={['check4', 'check5']}
displayField="label"
childType="button"
/>
</div>
);
}
}
handleChange = ({ newValue, newDisplayValue }: any): any => {
console.info(newValue, newDisplayValue);
this.setState({ newValue, newDisplayValue });
};
render() {
return (
<Theme config={checkboxView}>
<CheckboxGroup
onChange={this.handleChange}
data={options}
value={this.state.newValue}
displayValue={["check4", "check5"]}
displayField="label"
childType="button"
/>
</Theme>
);
}
}
68 changes: 46 additions & 22 deletions src/widgets/checkbox/ButtonPropsDemo.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,53 @@
import React from 'react';
import {Checkbox} from '@lugia/lugia-web';
import React from "react";
import { Checkbox, Theme } from "@lugia/lugia-web";
import Widget from "@lugia/lugia-web/dist/consts";

const CheckboxGroup = Checkbox.Group;
const CheckBoxButton = Checkbox.Button;

export default class CheckBoxDemo extends React.Component {
constructor(props) {
super(props);
this.state = {
newValue: ['11', '44'],
newDisplayValue: ['check4', 'check5'],
};
const checkboxView = {
[Widget.CheckboxGroup]: {
CheckButton: {
CheckButtonChecked: {
normal: {
width: 100,
padding: { left: 10, right: 10 }
}
},
CheckButtonUnChecked: {
normal: {
width: 100,
padding: { left: 10, right: 10 }
}
}
}
handleChange = obj => {
console.info(obj);
}
};

export default class CheckBoxDemo extends React.Component {
constructor(props) {
super(props);
this.state = {
newValue: ["11", "44"],
newDisplayValue: ["check4", "check5"]
};
render() {
return (
<div>
<CheckboxGroup childType="button" onChange={this.handleChange} defaultValue={['1', '2']}>
<CheckBoxButton value="1">CheckBox1</CheckBoxButton>
<CheckBoxButton value="2">CheckBox2</CheckBoxButton>
<CheckBoxButton value="3">CheckBox3</CheckBoxButton>
</CheckboxGroup>
</div>
);
}
}
handleChange = obj => {
console.info(obj);
};
render() {
return (
<Theme config={checkboxView}>
<CheckboxGroup
childType="button"
onChange={this.handleChange}
defaultValue={["1", "2"]}
>
<CheckBoxButton value="1">CheckBox1</CheckBoxButton>
<CheckBoxButton value="2">CheckBox2</CheckBoxButton>
<CheckBoxButton value="3">CheckBox3</CheckBoxButton>
</CheckboxGroup>
</Theme>
);
}
}
62 changes: 43 additions & 19 deletions src/widgets/checkbox/DisplayValueGroup.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,50 @@
import React from 'react';
import {Checkbox} from '@lugia/lugia-web';
import React from "react";
import { Checkbox, Theme } from "@lugia/lugia-web";
import Widget from "@lugia/lugia-web/dist/consts";

const CheckboxGroup = Checkbox.Group;
const options = [
{ label: 'check1', value: '11', name: '1' },
{ label: 'check2', value: '22', name: '2' },
{ label: 'check3', value: '33', name: '3' },
{ label: "check1", value: "11", name: "1" },
{ label: "check2", value: "22", name: "2" },
{ label: "check3", value: "33", name: "3" }
];
const checkboxView = {
[Widget.CheckboxGroup]: {
CheckButton: {
CheckButtonChecked: {
normal: {
width: 80,
padding: { left: 10, right: 10 }
}
},
CheckboxEdgeCancel: {
normal: {
width: 80,
padding: { left: 10, right: 10 }
}
},
CheckButtonUnChecked: {
normal: {
width: 80,
padding: { left: 10, right: 10 }
}
}
}
}
};

export default class CheckBoxDemo extends React.Component {

render() {
return (
<div>
<CheckboxGroup
data={options}
childType={'button'}
defaultValue={['11', '44']}
defaultDisplayValue={['check4', 'check5']}
displayField="label"
/>
</div>
);
}
render() {
return (
<Theme config={checkboxView}>
<CheckboxGroup
data={options}
childType={"button"}
defaultValue={["11", "44"]}
defaultDisplayValue={["check4", "check5"]}
displayField="label"
/>
</Theme>
);
}
}
6 changes: 3 additions & 3 deletions src/widgets/checkbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default PageNavHoC(
title={"按钮Checkbox组"}
titleID={"checkbox-8"}
code={
<code>{`import React from \'react\';\nimport {Checkbox} from \'@lugia/lugia-web\';\n\nconst CheckboxGroup = Checkbox.Group;\nconst CheckBoxButton = Checkbox.Button;\n\nexport default class CheckBoxDemo extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n newValue: [\'11\', \'44\'],\n newDisplayValue: [\'check4\', \'check5\'],\n };\n }\n handleChange = obj => {\n console.info(obj);\n };\n render() {\n return (\n <div>\n <CheckboxGroup childType=\"button\" onChange={this.handleChange} defaultValue={[\'1\', \'2\']}>\n <CheckBoxButton value=\"1\">CheckBox1</CheckBoxButton>\n <CheckBoxButton value=\"2\">CheckBox2</CheckBoxButton>\n <CheckBoxButton value=\"3\">CheckBox3</CheckBoxButton>\n </CheckboxGroup>\n </div>\n );\n }\n}\n`}</code>
<code>{`import React from \"react\";\nimport { Checkbox, Theme } from \"@lugia/lugia-web\";\nimport Widget from \"@lugia/lugia-web/dist/consts\";\n\nconst CheckboxGroup = Checkbox.Group;\nconst CheckBoxButton = Checkbox.Button;\n\nconst checkboxView = {\n [Widget.CheckboxGroup]: {\n CheckButton: {\n CheckButtonChecked: {\n normal: {\n width: 100,\n padding: { left: 10, right: 10 }\n }\n },\n CheckButtonUnChecked: {\n normal: {\n width: 100,\n padding: { left: 10, right: 10 }\n }\n }\n }\n }\n};\n\nexport default class CheckBoxDemo extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n newValue: [\"11\", \"44\"],\n newDisplayValue: [\"check4\", \"check5\"]\n };\n }\n handleChange = obj => {\n console.info(obj);\n };\n render() {\n return (\n <Theme config={checkboxView}>\n <CheckboxGroup\n childType=\"button\"\n onChange={this.handleChange}\n defaultValue={[\"1\", \"2\"]}\n >\n <CheckBoxButton value=\"1\">CheckBox1</CheckBoxButton>\n <CheckBoxButton value=\"2\">CheckBox2</CheckBoxButton>\n <CheckBoxButton value=\"3\">CheckBox3</CheckBoxButton>\n </CheckboxGroup>\n </Theme>\n );\n }\n}\n`}</code>
}
desc={"按钮形状的多选框"}
demo={<ButtonPropsDemo />}
Expand All @@ -133,7 +133,7 @@ export default PageNavHoC(
title={"受限按钮Checkbox组"}
titleID={"checkbox-9"}
code={
<code>{`import React from \'react\';\nimport {Checkbox} from \'@lugia/lugia-web\';\n\nconst CheckboxGroup = Checkbox.Group;\nconst options = [\n { label: \'check1\', value: \'11\', name: \'1\' },\n { label: \'check2\', value: \'22\', name: \'2\' },\n { label: \'check3\', value: \'33\', name: \'3\' },\n];\n\nexport default class CheckBoxDemo extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n newValue: [\'11\', \'44\'],\n newDisplayValue: [\'check4\', \'check5\'],\n };\n }\n handleChange = ({ newValue, newDisplayValue }: any): any => {\n console.info(newValue, newDisplayValue);\n this.setState({ newValue, newDisplayValue });\n };\n render() {\n return (\n <div>\n <CheckboxGroup\n onChange={this.handleChange}\n data={options}\n value={this.state.newValue}\n displayValue={[\'check4\', \'check5\']}\n displayField=\"label\"\n childType=\"button\"\n />\n </div>\n );\n }\n}\n`}</code>
<code>{`import React from \"react\";\nimport { Checkbox, Theme } from \"@lugia/lugia-web\";\nimport Widget from \"@lugia/lugia-web/dist/consts\";\n\nconst CheckboxGroup = Checkbox.Group;\nconst options = [\n { label: \"check1\", value: \"11\", name: \"1\" },\n { label: \"check2\", value: \"22\", name: \"2\" },\n { label: \"check3\", value: \"33\", name: \"3\" }\n];\n\nconst checkboxView = {\n [Widget.CheckboxGroup]: {\n CheckButton: {\n CheckButtonChecked: {\n normal: {\n width: 80,\n padding: { left: 10, right: 10 }\n }\n },\n CheckboxEdgeCancel: {\n normal: {\n width: 80,\n padding: { left: 10, right: 10 }\n }\n },\n CheckButtonUnChecked: {\n normal: {\n width: 80,\n padding: { left: 10, right: 10 }\n }\n }\n }\n }\n};\n\nexport default class CheckBoxDemo extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n newValue: [\"11\", \"44\"],\n newDisplayValue: [\"check4\", \"check5\"]\n };\n }\n handleChange = ({ newValue, newDisplayValue }: any): any => {\n console.info(newValue, newDisplayValue);\n this.setState({ newValue, newDisplayValue });\n };\n render() {\n return (\n <Theme config={checkboxView}>\n <CheckboxGroup\n onChange={this.handleChange}\n data={options}\n value={this.state.newValue}\n displayValue={[\"check4\", \"check5\"]}\n displayField=\"label\"\n childType=\"button\"\n />\n </Theme>\n );\n }\n}\n`}</code>
}
desc={"受限的按钮Checkbox组"}
demo={<ButtonLimitedDemo />}
Expand All @@ -142,7 +142,7 @@ export default PageNavHoC(
title={"按钮Checkbox组取消项"}
titleID={"checkbox-10"}
code={
<code>{`import React from \'react\';\nimport {Checkbox} from \'@lugia/lugia-web\';\n\nconst CheckboxGroup = Checkbox.Group;\nconst options = [\n { label: \'check1\', value: \'11\', name: \'1\' },\n { label: \'check2\', value: \'22\', name: \'2\' },\n { label: \'check3\', value: \'33\', name: \'3\' },\n];\n\nexport default class CheckBoxDemo extends React.Component {\n\n render() {\n return (\n <div>\n <CheckboxGroup\n data={options}\n childType={\'button\'}\n defaultValue={[\'11\', \'44\']}\n defaultDisplayValue={[\'check4\', \'check5\']}\n displayField=\"label\"\n />\n </div>\n );\n }\n}\n`}</code>
<code>{`import React from \"react\";\nimport { Checkbox, Theme } from \"@lugia/lugia-web\";\nimport Widget from \"@lugia/lugia-web/dist/consts\";\n\nconst CheckboxGroup = Checkbox.Group;\nconst options = [\n { label: \"check1\", value: \"11\", name: \"1\" },\n { label: \"check2\", value: \"22\", name: \"2\" },\n { label: \"check3\", value: \"33\", name: \"3\" }\n];\nconst checkboxView = {\n [Widget.CheckboxGroup]: {\n CheckButton: {\n CheckButtonChecked: {\n normal: {\n width: 80,\n padding: { left: 10, right: 10 }\n }\n },\n CheckboxEdgeCancel: {\n normal: {\n width: 80,\n padding: { left: 10, right: 10 }\n }\n },\n CheckButtonUnChecked: {\n normal: {\n width: 80,\n padding: { left: 10, right: 10 }\n }\n }\n }\n }\n};\n\nexport default class CheckBoxDemo extends React.Component {\n render() {\n return (\n <Theme config={checkboxView}>\n <CheckboxGroup\n data={options}\n childType={\"button\"}\n defaultValue={[\"11\", \"44\"]}\n defaultDisplayValue={[\"check4\", \"check5\"]}\n displayField=\"label\"\n />\n </Theme>\n );\n }\n}\n`}</code>
}
desc={"按钮Checkbox组的取消项展示"}
demo={<DisplayValueGroup />}
Expand Down
62 changes: 45 additions & 17 deletions src/widgets/radio/ButtonDemo.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,50 @@
import React from 'react';
import {Radio} from '@lugia/lugia-web';
import React from "react";
import { Radio, Theme } from "@lugia/lugia-web";
import Widget from "@lugia/lugia-web/dist/consts";

const RadioButton = Radio.Button;
const RadioGroup = Radio.Group;

export default class RadioDemo extends React.Component {
onChange = obj => {
console.info('obj-demo', obj);
};
render() {
return (
<div>
<RadioGroup childType="button" onChange={this.onChange} defaultValue="1">
<RadioButton value="1">Radio1</RadioButton>
<RadioButton value="2">Radio2</RadioButton>
<RadioButton value="3">Radio3</RadioButton>
</RadioGroup>
</div>
);
const view = {
[Widget.RadioGroup]: {
CheckButton: {
CheckButtonChecked: {
normal: {
width: 100,
padding: { left: 10, right: 10 }
}
},
CheckButtonCancel: {
normal: {
width: 100,
padding: { left: 10, right: 10 }
}
},
CheckButtonUnChecked: {
normal: {
width: 100,
padding: { left: 10, right: 10 }
}
}
}
}
};
export default class RadioDemo extends React.Component {
onChange = obj => {
console.info("obj-demo", obj);
};
render() {
return (
<Theme config={view}>
<RadioGroup
childType="button"
onChange={this.onChange}
defaultValue="1"
>
<RadioButton value="1">Radio1</RadioButton>
<RadioButton value="2">Radio2</RadioButton>
<RadioButton value="3">Radio3</RadioButton>
</RadioGroup>
</Theme>
);
}
}
Loading

0 comments on commit df6c5af

Please sign in to comment.