Skip to content

Commit

Permalink
Event normalizazion and formik showcase
Browse files Browse the repository at this point in the history
  • Loading branch information
rodriguc committed Aug 17, 2018
1 parent 6e8c767 commit 88da9cd
Show file tree
Hide file tree
Showing 22 changed files with 4,853 additions and 1,441 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
/components
/src/sass/App.css
/src/sass/App.css.map
package-lock.json
package-lock.json
yarn-error.log
30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,36 @@
},
"license": "MIT",
"devDependencies": {
"axios": "^0.15.3",
"babel-cli": "^6.24.0",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-react": "^6.23.0",
"babel-preset-stage-0": "^6.22.0",
"babel-polyfill": "^6.26.0",
"chart.js": "2.7.1",
"classnames": "^2.2.5",
"del": "^2.2.0",
"font-awesome": "^4.7.0",
"fullcalendar": "4.0.0-alpha",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-flatten": "^0.2.0",
"gulp-rename": "^1.2.2",
"gulp-uglify": "^1.5.3",
"gulp-uglifycss": "^1.0.6",
"react-scripts": "1.0.11",
"axios": "^0.15.3",
"chart.js": "2.7.1",
"classnames": "^2.2.5",
"font-awesome": "^4.7.0",
"fullcalendar": "4.0.0-alpha",
"quill": "1.3.3",
"moment": "^2.17.1",
"nanoscroller": "^0.8.7",
"prop-types": "^15.5.0",
"node-sass-chokidar": "^1.3.0",
"npm-run-all": "^4.1.3",
"primeicons": "1.0.0-beta.10",
"prismjs": "1.6.0",
"prop-types": "^15.5.0",
"quill": "1.3.3",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-router-dom": "^4.2.2",
"react-transition-group": "^2.2.1",
"node-sass-chokidar": "^1.3.0",
"npm-run-all": "^4.1.3",
"prismjs": "1.6.0"
"react-scripts": "1.0.11",
"react-transition-group": "^2.2.1"
},
"scripts": {
"build-css": "node-sass-chokidar src/sass/ -o src/sass/ | node-sass-chokidar public/resources/themes/ -o public/resources/themes/",
Expand All @@ -52,5 +52,9 @@
"compile-components": "babel src/components --out-dir components --presets es2015,react,stage-0 --copy-files",
"build-resources": "gulp prepublish",
"build-exports": "gulp build-exports"
},
"dependencies": {
"formik": "^1.0.2",
"yup": "^0.26.2"
}
}
12 changes: 12 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ import { MenuModelDemo } from "./showcase/menumodel/MenuModelDemo";
import { SidebarDemo } from "./showcase/sidebar/SidebarDemo";
import { ProgressSpinnerDemo } from "./showcase/progressspinner/ProgressSpinnerDemo";
import { CardDemo } from "./showcase/card/CardDemo";
import { FormikDemo } from "./showcase/formik/FormikDemo";
import { KeyFilterDemo } from "./showcase/keyfilter/KeyFilterDemo";
import { DataViewDemo } from "./showcase/dataview/DataViewDemo";

Expand Down Expand Up @@ -333,6 +334,16 @@ class AppMenu extends Component {
<Link to="/progressspinner">&#9679; ProgressSpinner</Link>
</div>
</div>
<a id="3rd_party_integration" onClick={(event) => this.openMenu(event, 12)} className={classNames({ 'active-menuitem': this.state.activeMenu === 12 })}>
<img alt="misc" className="layout-menu-icon-inactive" src="showcase/resources/images/mono/misc.svg"></img>
<img alt="misc" className="layout-menu-icon-active" src="showcase/resources/images/mono/misc-active.svg"></img>
<span>3rd party integration</span>
</a>
<div className={classNames({ 'submenuhide': this.state.activeMenu !== 12, 'submenushow': this.state.activeMenu === 12 })}>
<div>
<Link to="/formik">&#9679; Formik</Link>
</div>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -545,6 +556,7 @@ class App extends Component {
<Route path="/keyfilter" component={KeyFilterDemo}/>
<Route path="/dataview" component={DataViewDemo}/>
<Route path="/inplace" component={InplaceDemo}/>
<Route path="/formik" component={FormikDemo}/>

<div className="content-section layout-footer clearfix">
<span>Released under the MIT License, Copyright © 2018 <a href="http://www.primetek.com.tr" target="_blank" rel="noopener noreferrer">PrimeTek</a></span>
Expand Down
8 changes: 7 additions & 1 deletion src/components/autocomplete/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,16 @@ export class AutoComplete extends Component {
}

updateModel(event, value) {
const resolvedFieldData = this.props.field ? ObjectUtils.resolveFieldData(value, this.props.field) : undefined;
if(this.props.onChange) {
this.props.onChange({
originalEvent: event,
value: value
value: value,
target: {
name: this.props.name,
id : this.props.id,
value: resolvedFieldData ? resolvedFieldData: value
}
});
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/components/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,12 @@ export class Calendar extends Component {
if (this.props.onChange) {
this.props.onChange({
originalEvent: event,
value: value
value: value,
target: {
name: this.props.name,
id : this.props.id,
value
}
});
}
}
Expand Down
9 changes: 8 additions & 1 deletion src/components/checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ export class Checkbox extends Component {
this.props.onChange({
originalEvent: e,
value: this.props.value,
checked: !this.props.checked
checked: !this.props.checked,
target: {
type: 'checkbox',
name: this.props.name,
id : this.props.id,
value: this.props.value,
checked: !this.props.checked,
}
});

this.input.checked = !this.props.checked;
Expand Down
14 changes: 12 additions & 2 deletions src/components/chips/Chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ export class Chips extends Component {
if (this.props.onChange) {
this.props.onChange({
originalEvent: event,
value: values
value: values,
target: {
name: this.props.name,
id : this.props.id,
value : values
}
});
}
}
Expand Down Expand Up @@ -100,7 +105,12 @@ export class Chips extends Component {
if (this.props.onChange) {
this.props.onChange({
originalEvent: event,
value: values
value: values,
target: {
name: this.props.name,
id : this.props.id,
value : values
}
});
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/components/colorpicker/ColorPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ export class ColorPicker extends Component {
onChange(value) {
if(this.props.onChange) {
this.props.onChange({
value: value
value: value,
target: {
name: this.props.name,
id : this.props.id,
value
}
})
}
}
Expand Down
23 changes: 20 additions & 3 deletions src/components/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,12 @@ export class Dropdown extends Component {
onEditableInputChange(event) {
this.props.onChange({
originalEvent: event.originalEvent,
value: event.target.value
value: event.target.value,
target: {
name: this.props.name,
id : this.props.id,
value : event.target.value,
}
});
}

Expand Down Expand Up @@ -267,7 +272,13 @@ export class Dropdown extends Component {
clear(event) {
this.props.onChange({
originalEvent: event,
value: null
value: null,
target: {
type: 'text',
name: this.props.name,
id : this.props.id,
value : null
}
});
this.updateEditableLabel();
}
Expand All @@ -279,7 +290,13 @@ export class Dropdown extends Component {
this.updateEditableLabel(event.option);
this.props.onChange({
originalEvent: event.originalEvent,
value: this.props.optionLabel ? event.option : event.option.value
value: this.props.optionLabel ? event.option : event.option.value,
target: {
type: 'text',
name: this.props.name,
id : this.props.id,
value : this.props.optionLabel ? event.option : event.option.value,
}
});
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/components/inputmask/InputMask.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,12 @@ export class InputMask extends Component {
var val = this.props.unmask ? this.getUnmaskedValue() : e.target.value;
this.props.onChange({
originalEvent: e,
value: (this.defaultBuffer !== val) ? val : ''
value: (this.defaultBuffer !== val) ? val : '',
target: {
name: this.props.name,
id : this.props.id,
value : (this.defaultBuffer !== val) ? val : '',
}
})
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/components/inputswitch/InputSwitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ export class InputSwitch extends Component {
if (this.props.onChange) {
this.props.onChange({
originalEvent: event,
value: !this.props.checked
value: !this.props.checked,
target: {
type: 'checkbox',
name: this.props.name,
id : this.props.id,
checked: !this.props.checked,
}
});
}
}
Expand Down
15 changes: 13 additions & 2 deletions src/components/listbox/ListBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,12 @@ export class ListBox extends Component {
if(valueChanged) {
this.props.onChange({
originalEvent: event,
value: value
value: value,
target: {
name: this.props.name,
id : this.props.id,
value
}
});
}
}
Expand All @@ -149,7 +154,13 @@ export class ListBox extends Component {
if(this.props.onChange) {
this.props.onChange({
originalEvent: event,
value: value
value: value,
target: {
type: 'text',
name: this.props.name,
id : this.props.id,
value
}
});
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/components/multiselect/MultiSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ export class MultiSelect extends Component {
if(this.props.onChange) {
this.props.onChange({
originalEvent: event,
value: value
value: value,
target: {
name: this.props.name,
id : this.props.id,
value
}
});
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/components/radiobutton/RadioButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ export class RadioButton extends Component {
this.props.onChange({
originalEvent: e,
value: this.props.value,
checked: !this.props.checked
checked: !this.props.checked,
target: {
name: this.props.name,
id : this.props.id,
value: this.props.value,
}
});

this.input.checked = !this.props.checked;
}
}
Expand Down
14 changes: 12 additions & 2 deletions src/components/rating/Rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ export class Rating extends Component {
if (!this.props.readonly && !this.props.disabled && this.props.onChange) {
this.props.onChange({
originalEvent: event,
value: i
value: i,
target: {
name: this.props.name,
id : this.props.id,
value: i
}
});
}

Expand All @@ -48,7 +53,12 @@ export class Rating extends Component {
if (!this.props.readonly && !this.props.disabled && this.props.onChange) {
this.props.onChange({
originalEvent: event,
value: null
value: null,
target: {
name: this.props.name,
id : this.props.id,
value:null
}
});
}

Expand Down
7 changes: 6 additions & 1 deletion src/components/selectbutton/SelectButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ export class SelectButton extends Component {
if(this.props.onChange) {
this.props.onChange({
originalEvent: event.originalEvent,
value: newValue
value: newValue,
target: {
name: this.props.name,
id : this.props.id,
value: newValue,
}
});
}
}
Expand Down
14 changes: 12 additions & 2 deletions src/components/slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@ export class Slider extends Component {
if (this.props.onChange) {
this.props.onChange({
originalEvent: event,
value: this.values
value: this.values,
target: {
name: this.props.name,
id : this.props.id,
value: this.values,
}
})
}
}
Expand All @@ -219,7 +224,12 @@ export class Slider extends Component {
if (this.props.onChange) {
this.props.onChange({
originalEvent: event,
value: this.value
value: this.value,
target: {
name: this.props.name,
id : this.props.id,
value: this.value,
}
})
}
}
Expand Down
Loading

0 comments on commit 88da9cd

Please sign in to comment.