-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Navigation: Transfer demos to TS (#2825)
* Typestat config created + files renamed * Enhance types with typestat * Improve typings + add missing @types/react-dom package * Typings improvments * fix cannot use jsx components in vscode * Types improv + tsconf changes to remove component is not tsx problem * Check tsc version on CI * Revert printing tsc version on CI * Revert TSConfig changes * Generate JS from ts * Revert bad js generation result for DateBox and DateRangeBox * Fix sysemJs index.js import to tsx in index.html * Final TS enhansments * generate js * Exclude Vue from ts config because it's polluting react JSX with wrong typings * Revert excluding vue from ts * Update ts for tabs demos (merge) * Fix minor errors * Missed extension in tabpanel * Drawer: navigationList fix file extension * Fix generate-js * Fix missing merge changes * Fix styles generation * generate js
- Loading branch information
1 parent
ce93399
commit cf0c05f
Showing
242 changed files
with
9,332 additions
and
438 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...vigationRightToLeftSupport/React/index.js → .../Demos/Accordion/Overview/React/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import React from 'react'; | ||
import Accordion from 'devextreme-react/accordion'; | ||
import CheckBox from 'devextreme-react/check-box'; | ||
import TagBox from 'devextreme-react/tag-box'; | ||
import Slider, { Tooltip, Label } from 'devextreme-react/slider'; | ||
import service from './data.js'; | ||
import CustomTitle from './CustomTitle.js'; | ||
import CustomItem from './CustomItem.js'; | ||
|
||
const companyLabel = { 'aria-label': 'Company' }; | ||
const companies = service.getCompanies(); | ||
const App = () => { | ||
const [selectedItems, setSelectedItems] = React.useState([companies[0]]); | ||
const [multiple, setMultiple] = React.useState(false); | ||
const [collapsible, setCollapsible] = React.useState(false); | ||
const [animationDuration, setAnimationDuration] = React.useState(300); | ||
const selectionChanged = React.useCallback( | ||
(e) => { | ||
let newItems = [...selectedItems]; | ||
e.removedItems.forEach((item) => { | ||
const index = newItems.indexOf(item); | ||
if (index >= 0) { | ||
newItems.splice(index, 1); | ||
} | ||
}); | ||
if (e.addedItems.length) { | ||
newItems = [...newItems, ...e.addedItems]; | ||
} | ||
setSelectedItems(newItems); | ||
}, | ||
[selectedItems, setSelectedItems], | ||
); | ||
const selectedItemsChanged = React.useCallback( | ||
(e) => { | ||
setSelectedItems(e.value); | ||
}, | ||
[setSelectedItems], | ||
); | ||
const multipleChanged = React.useCallback( | ||
(e) => { | ||
setMultiple(e.value); | ||
}, | ||
[setMultiple], | ||
); | ||
const collapsibleChanged = React.useCallback( | ||
(e) => { | ||
setCollapsible(e.value); | ||
}, | ||
[setCollapsible], | ||
); | ||
const animationDurationChanged = React.useCallback( | ||
(e) => { | ||
setAnimationDuration(e.value); | ||
}, | ||
[setAnimationDuration], | ||
); | ||
return ( | ||
<div id="accordion"> | ||
<Accordion | ||
dataSource={companies} | ||
collapsible={collapsible} | ||
multiple={multiple} | ||
animationDuration={animationDuration} | ||
selectedItems={selectedItems} | ||
onSelectionChanged={selectionChanged} | ||
itemTitleRender={CustomTitle} | ||
itemRender={CustomItem} | ||
id="accordion-container" | ||
/> | ||
<div className="options"> | ||
<div className="caption">Options</div> | ||
<div className="option"> | ||
<CheckBox | ||
text="Multiple enabled" | ||
value={multiple} | ||
onValueChanged={multipleChanged} | ||
/> | ||
</div> | ||
<div className="option"> | ||
<CheckBox | ||
text="Collapsible enabled" | ||
value={collapsible} | ||
onValueChanged={collapsibleChanged} | ||
/> | ||
</div> | ||
<div className="option"> | ||
<span>Animation duration</span> | ||
<Slider | ||
min={0} | ||
max={1000} | ||
value={animationDuration} | ||
onValueChanged={animationDurationChanged} | ||
> | ||
<Tooltip | ||
enabled={true} | ||
position="bottom" | ||
/> | ||
<Label visible={true} /> | ||
</Slider> | ||
</div> | ||
<div className="option"> | ||
<span className="caption">Selected Items</span> | ||
<TagBox | ||
dataSource={companies} | ||
displayExpr="CompanyName" | ||
value={selectedItems} | ||
inputAttr={companyLabel} | ||
onValueChanged={selectedItemsChanged} | ||
disabled={!multiple} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
|
||
export default function CustomItem(data) { | ||
return ( | ||
<div> | ||
<div> | ||
<p> | ||
<b>{data.City} </b>(<span>{data.State}</span>) | ||
</p> | ||
<p> | ||
<span>{data.Zipcode} </span> | ||
<span>{data.Address}</span> | ||
</p> | ||
</div> | ||
<div> | ||
<p> | ||
Phone: <b>{data.Phone}</b> | ||
</p> | ||
<p> | ||
Fax: <b>{data.Fax}</b> | ||
</p> | ||
<p> | ||
Website:{' '} | ||
<a | ||
href={data.Website} | ||
target="_blank" | ||
> | ||
{data.Website} | ||
</a> | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react'; | ||
|
||
export default function CustomTitle(data) { | ||
return <div className="header">{data.CompanyName}</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const companies = [ | ||
{ | ||
ID: 1, | ||
CompanyName: 'Super Mart of the West', | ||
Address: '702 SW 8th Street', | ||
City: 'Bentonville', | ||
State: 'Arkansas', | ||
Zipcode: 72716, | ||
Phone: '(800) 555-2797', | ||
Fax: '(800) 555-2171', | ||
Website: 'http://www.nowebsitesupermart.com', | ||
}, | ||
{ | ||
ID: 2, | ||
CompanyName: 'Electronics Depot', | ||
Address: '2455 Paces Ferry Road NW', | ||
City: 'Atlanta', | ||
State: 'Georgia', | ||
Zipcode: 30339, | ||
Phone: '(800) 595-3232', | ||
Fax: '(800) 595-3231', | ||
Website: 'http://www.nowebsitedepot.com', | ||
}, | ||
{ | ||
ID: 3, | ||
CompanyName: 'K&S Music', | ||
Address: '1000 Nicllet Mall', | ||
City: 'Minneapolis', | ||
State: 'Minnesota', | ||
Zipcode: 55403, | ||
Phone: '(612) 304-6073', | ||
Fax: '(612) 304-6074', | ||
Website: 'http://www.nowebsitemusic.com', | ||
}, | ||
{ | ||
ID: 4, | ||
CompanyName: "Tom's Club", | ||
Address: '999 Lake Drive', | ||
City: 'Issaquah', | ||
State: 'Washington', | ||
Zipcode: 98027, | ||
Phone: '(800) 955-2292', | ||
Fax: '(800) 955-2293', | ||
Website: 'http://www.nowebsitetomsclub.com', | ||
}, | ||
]; | ||
export default { | ||
getCompanies() { | ||
return companies; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>DevExtreme Demo</title> | ||
<meta | ||
http-equiv="X-UA-Compatible" | ||
content="IE=edge" | ||
/> | ||
<meta | ||
http-equiv="Content-Type" | ||
content="text/html; charset=utf-8" | ||
/> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
type="text/css" | ||
href="../../../../../node_modules/devextreme-dist/css/dx.light.css" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
type="text/css" | ||
href="styles.css" | ||
/> | ||
|
||
<script src="../../../../../node_modules/core-js/client/shim.min.js"></script> | ||
<script src="../../../../../node_modules/systemjs/dist/system.js"></script> | ||
<script | ||
type="text/javascript" | ||
src="config.js" | ||
></script> | ||
<script type="text/javascript"> | ||
System.import("./index.js"); | ||
</script> | ||
</head> | ||
|
||
<body class="dx-viewport"> | ||
<div class="demo-container"> | ||
<div id="app"></div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import App from './App.js'; | ||
|
||
ReactDOM.render(<App />, document.getElementById('app')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#accordion { | ||
height: 700px; | ||
} | ||
|
||
#accordion .header { | ||
font-size: 20px; | ||
} | ||
|
||
#accordion .header, | ||
#accordion p { | ||
margin: 0; | ||
} | ||
|
||
#accordion-container { | ||
margin-right: 400px; | ||
} | ||
|
||
.dx-theme-material #accordion .dx-accordion-item-title { | ||
display: flex; | ||
} | ||
|
||
.dx-theme-material #accordion .header { | ||
align-self: center; | ||
} | ||
|
||
.options { | ||
padding: 20px; | ||
position: absolute; | ||
bottom: 0; | ||
right: 0; | ||
width: 340px; | ||
top: 0; | ||
background-color: rgba(191, 191, 191, 0.15); | ||
} | ||
|
||
.options > .caption { | ||
font-weight: 500; | ||
font-size: 18px; | ||
} | ||
|
||
.option { | ||
margin-top: 10px; | ||
} | ||
|
||
.option > .caption { | ||
margin-top: 10px; | ||
display: inline-block; | ||
} | ||
|
||
.option > .dx-tagbox { | ||
margin-top: 2px; | ||
} |
Oops, something went wrong.