-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
222 changed files
with
28,559 additions
and
1,388 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
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
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,2 @@ | ||
{{> ../layouts/head.html }} | ||
{{> ../layouts/footer.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 @@ | ||
import IdsContainer from '../../src/ids-container/ids-container'; |
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 |
---|---|---|
@@ -1,104 +1,143 @@ | ||
// Example for populating the DataGrid | ||
const dataGrid = document.querySelector('#data-grid-1'); | ||
const container = document.querySelector('ids-container'); | ||
|
||
// Do an ajax request | ||
const xmlhttp = new XMLHttpRequest(); | ||
const url = '/api/books'; | ||
const columns = []; | ||
(async function init() { | ||
// Set Locale and wait for it to load | ||
await container.setLocale('en-US'); | ||
|
||
// Set up columns | ||
columns.push({ | ||
id: 'selectionCheckbox', | ||
sortable: false, | ||
resizable: false, | ||
formatter: dataGrid.formatters.text, | ||
align: 'center', | ||
width: 20 | ||
}); | ||
columns.push({ | ||
id: 'book', | ||
name: 'Book', | ||
field: 'book', | ||
formatter: dataGrid.formatters.text, | ||
sortable: true, | ||
width: 65 | ||
}); | ||
columns.push({ | ||
id: 'description', | ||
name: 'Description', | ||
field: 'description', | ||
sortable: true, | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'ledger', | ||
name: 'Ledger', | ||
field: 'ledger', | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'bookCurrency', | ||
name: 'Book Currency', | ||
field: 'bookCurrency', | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'transactionCurrency', | ||
name: 'Transaction Currency', | ||
field: 'transactionCurrency', | ||
formatter: dataGrid.formatters.text, | ||
}); | ||
columns.push({ | ||
id: 'postHistory', | ||
name: 'Post History', | ||
field: 'postHistory', | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'active', | ||
name: 'Active', | ||
field: 'active', | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'convention', | ||
name: 'Convention', | ||
field: 'convention', | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'methodSwitch', | ||
name: 'Method Switch', | ||
field: 'methodSwitch', | ||
formatter: dataGrid.formatters.text, | ||
filterType: 'select' | ||
}); | ||
columns.push({ | ||
id: 'trackDeprecationHistory', | ||
name: 'Track Deprecation History', | ||
field: 'trackDeprecationHistory', | ||
formatter: dataGrid.formatters.dropdown | ||
}); | ||
columns.push({ | ||
id: 'useForEmployee', | ||
name: 'Use For Employee', | ||
field: 'useForEmployee', | ||
formatter: dataGrid.formatters.dropdown | ||
}); | ||
columns.push({ | ||
id: 'deprecationHistory', | ||
name: 'Deprecation History', | ||
field: 'deprecationHistory', | ||
formatter: dataGrid.formatters.dropdown | ||
}); | ||
// Do an ajax request | ||
const xmlhttp = new XMLHttpRequest(); | ||
const url = '/api/books'; | ||
const columns = []; | ||
|
||
xmlhttp.onreadystatechange = function onreadystatechange() { | ||
if (this.readyState === 4 && this.status === 200) { | ||
dataGrid.data = JSON.parse(this.responseText); | ||
dataGrid.columns = columns; | ||
} | ||
}; | ||
// Set up columns | ||
columns.push({ | ||
id: 'selectionCheckbox', | ||
sortable: false, | ||
resizable: false, | ||
formatter: dataGrid.formatters.text, | ||
align: 'center', | ||
width: 20 | ||
}); | ||
columns.push({ | ||
id: 'rowNumber', | ||
name: '#', | ||
formatter: dataGrid.formatters.rowNumber, | ||
sortable: false, | ||
readonly: true, | ||
width: 65 | ||
}); | ||
columns.push({ | ||
id: 'description', | ||
name: 'Description', | ||
field: 'description', | ||
sortable: true, | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'ledger', | ||
name: 'Ledger', | ||
field: 'ledger', | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'publishDate', | ||
name: 'Pub. Date', | ||
field: 'publishDate', | ||
formatter: dataGrid.formatters.date | ||
}); | ||
columns.push({ | ||
id: 'publishTime', | ||
name: 'Pub. Time', | ||
field: 'publishDate', | ||
formatter: dataGrid.formatters.time | ||
}); | ||
columns.push({ | ||
id: 'price', | ||
name: 'Price', | ||
field: 'price', | ||
formatter: dataGrid.formatters.decimal, | ||
formatOptions: { locale: 'en-US' } // Data Values are in en-US | ||
}); | ||
columns.push({ | ||
id: 'bookCurrency', | ||
name: 'Currency', | ||
field: 'bookCurrency', | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'transactionCurrency', | ||
name: 'Transaction Currency', | ||
field: 'transactionCurrency', | ||
formatter: dataGrid.formatters.text, | ||
}); | ||
columns.push({ | ||
id: 'integer', | ||
name: 'Price (Int)', | ||
field: 'price', | ||
formatter: dataGrid.formatters.integer, | ||
formatOptions: { locale: 'en-US' } // Data Values are in en-US | ||
}); | ||
columns.push({ | ||
id: 'location', | ||
name: 'Location', | ||
field: 'location', | ||
formatter: dataGrid.formatters.hyperlink, | ||
href: '#' | ||
}); | ||
columns.push({ | ||
id: 'postHistory', | ||
name: 'Post History', | ||
field: 'postHistory', | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'active', | ||
name: 'Active', | ||
field: 'active', | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'convention', | ||
name: 'Convention', | ||
field: 'convention', | ||
formatter: dataGrid.formatters.text | ||
}); | ||
columns.push({ | ||
id: 'methodSwitch', | ||
name: 'Method Switch', | ||
field: 'methodSwitch', | ||
formatter: dataGrid.formatters.text, | ||
filterType: 'select' | ||
}); | ||
columns.push({ | ||
id: 'trackDeprecationHistory', | ||
name: 'Track Deprecation History', | ||
field: 'trackDeprecationHistory', | ||
formatter: dataGrid.formatters.dropdown | ||
}); | ||
columns.push({ | ||
id: 'useForEmployee', | ||
name: 'Use For Employee', | ||
field: 'useForEmployee', | ||
formatter: dataGrid.formatters.password | ||
}); | ||
columns.push({ | ||
id: 'deprecationHistory', | ||
name: 'Deprecation History', | ||
field: 'deprecationHistory', | ||
formatter: dataGrid.formatters.text | ||
}); | ||
|
||
// Execute the request | ||
xmlhttp.open('GET', url, true); | ||
xmlhttp.send(); | ||
xmlhttp.onreadystatechange = function onreadystatechange() { | ||
if (this.readyState === 4 && this.status === 200) { | ||
dataGrid.columns = columns; | ||
dataGrid.data = JSON.parse(this.responseText); | ||
} | ||
}; | ||
|
||
// Execute the request | ||
xmlhttp.open('GET', url, true); | ||
xmlhttp.send(); | ||
}()); |
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 @@ | ||
<ids-layout-grid> | ||
<ids-text font-size="12" type="h1">Locale (Translated Strings)</ids-text> | ||
<ids-layout-grid cols="4" gap="sm" id="translation-container"> | ||
</ids-layout-grid> | ||
</ids-layout-grid> |
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,22 @@ | ||
// Use the container to set the language | ||
const container = document.querySelector('ids-container'); | ||
|
||
// Asyncronously load a language and display the strings | ||
(async function loadMessages() { | ||
let html = ''; | ||
// Set language and wait for it to load | ||
const initialLocale = 'zh'; | ||
await container.setLanguage(initialLocale); | ||
|
||
// Show them in the page | ||
const keys = Object.keys(container.language.messages); | ||
for (let i = 0; i < keys.length; i++) { | ||
html += `<ids-layout-grid-cell col-span="1"> | ||
<ids-text font-weight="bold">${keys[i]}</ids-text> | ||
</ids-layout-grid-cell> | ||
<ids-layout-grid-cell col-span="3"> | ||
<ids-text translate-text="true" language="${initialLocale}">${keys[i]}</ids-text> | ||
</ids-layout-grid-cell>`; | ||
} | ||
document.querySelector('#translation-container').innerHTML = html; | ||
}()); |
Oops, something went wrong.