1658034000
React-based list (table) components that support events, callback functions, and custom styles.
🔧 Install
npm install react-tabllist --save
<script src="https://cdn.bootcss.com/react/16.8.6/umd/react.development.js"></script>
<script src="https://cdn.bootcss.com/react-dom/16.8.6/umd/react-dom.development.js"></script>
<script src="https://cdn.bootcss.com/babel-standalone/7.0.0-beta.3/babel.min.js"></script>
<script src='https://cdn.bootcss.com/lodash.js/4.17.11/lodash.core.js'></script>
<script src='./react-tabllist.min.js'></script>
<div id='example'></div>
<script type='text/javascript'>
var option = {
data: [],
property: {}
}
ReactDOM.render(
React.createElement(ReactTabllist, option),
document.getElementById('example')
)
</script>
import ReactTabllist from 'react-tabllist';
// Use default configuration
ReactDOM.render(<ReactTabllist />, mountNode);
// Custom data and configuration items
const props = {
className: 'demo',
property: {},
data: [
['1st column', '2nd column', '3rd column'],
['1st cell', '2nd cell', '3rd cell']
]
}
ReactDOM.render(<ReactTabllist {...props} />, mountNode);
/**
* Event callback function
* @param {SyntheticEvent} event
* @param {Exposes} exposes An object containing exposed properties and methods
*/
function handleScroll(event, exposes) {
// some code
}
// Use React native events
ReactDOM.render(<ReactTabllist {...props} onScroll={handleScroll} />, mountNode);
// Use custom events built into components
ReactDOM.render(<ReactTabllist {...props} custom_onScrollToEnd={handleScroll} />, mountNode);
If you want to join the development to improve this component, please fork and start with the following command:
$ git clone git@github.com:oceanxy/react-tabllist.git
$ cd react-tabllist
$ npm install
$ npm start
Open your browser and visit http://localhost:3001
.
props | description | details |
---|---|---|
data {[Array, Array, Array,...]} | Render table data | props.data |
className {string} | Table outermost container style sheet name | '' |
property {Object} | Wrapper table properties | props.property |
You can customize the style through the props.classname
attribute.
Data Format
The data
data format is very similar to a two-dimensional array。
[
[cell, cell, cell], // row
[
cell, // cell
cell,
cell
],
[cell, cell, cell],
...
]
type='row'
and cells=[]
, which respectively identify the object as a row and the cells contained in the row:[
{ // The rows are displayed as objects, and the in-row cells are contained in the cells field as an array.
type: 'row',
cells: [cell, cell, cell],
...
},
[ // Display rows as an array, each element representing a cell
{type: 'button', ...}, // Generate a button in the cell
cell, // cell
cell
],
[
cell,
cell,
[
{type: 'radio'}, {type: 'radio'}, ... // Generate two or more radios in the same cell
]
],
...
]
Object Unit
The data format that cells can parse is divided into the following four categories:
<button className='test-button' onclick='()=>{return null}'>click</button>
type | description |
---|---|
row | Generate a unit row, unit row object can only be written in the body, invalid elsewhere |
img | Generate an img tag inside the cell |
button | Generate a button in the cell |
link | Generate a link in the cell (a tag) |
radio | Generate a radio in the cell |
checkbox | Generate a checkbox in the cell |
select ^1.4.1 | Generate a select in the cell |
text ^1.5.0 | Generate a plain text inside the cell. You can also replace the object unit with a string. If you don't plan to add events to this cell, you can do that. |
input ^1.6.0 | Generate a text box in a cell. |
Here are some examples:
row { type: 'row', cells: [cell, cell, cell], data: 'row.id', value: 'row.typeID', event: 'onClick', callback: (data, cellData, event) => {}, className: '', key: '' } button { type: 'button', value: 'click me', className: 'test-btn', data: '123', event: 'onClick', callback: data => alert('hello react-tabllist', data) // hello react-tabllist, 123, key: '' } img { type: 'img', src: 'http://www.xieyangogo.cn/pic.png', alt: '', text: 'IMG description', className: 'test-img', key: '', value:'' } link (Choose one of the two) { type: 'link', text: 'I am a link, I use the href attribute', className: 'test-link', key: '', href: 'https://github.com/oceanxy/react-tabllist', value:'' } { type: 'link', text: 'I am a link, I use event and callback to implement custom functions', className: 'test-link', key: '', data: {}, event: 'onClick', callback: (data, cellData, event) => {}, value:'' } radio { type: 'radio', name: 'group2', text: 'radio group 2-1', className: 'test-radio', callback: (data, cellData, event) => {}, key: '', value:'' } checkbox { type: 'checkbox', name: 'checkbox1', text: 'checkbox', className: 'test-checkbox', callback: (data, cellData, event) => {}, key: '', value:'' } select { type: 'select', text: 'please choose:', value: '', data: '', className: '', callback: (data, cellData, event) => {}, option: [ { id: '1', label: 'item 1', value: 1 } ] } text { type: 'text', text: 'I am a normal text', callback: (data, cellData, event) => {} } input { type: 'input', text: 'username:', placeholder: 'enter username', defaultValue: 'oceanxy' // This attribute is not a standard HTML tag attribute, but it is a property of the React element (the purpose is to set the default value of the text box). As you can see, you can also use React's officially defined properties in object cells. }
Object Unit Attribute
Attribute {type} | Description | row | button | link | img | radio | checkbox | input | select | text |
---|---|---|---|---|---|---|---|---|---|---|
{string} Available before version 1.2.2 | Deprecated A unique identifier for a cell that can be used to save ids, and so on. This field function is similar to the key, and can also be replaced with a data field in conjunction with a callback function, so it is decided to discard this field in version 1.2.2. | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
type {string} | The type of HTML tag to be generated in the cell | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
text {string} | The text of the rendered HTML tag | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
event {string} | The way to trigger an event needs to be used with callback | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
callback {function} | The callback function after the trigger event, see the callback for details. | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
cells {object[]} | Can only be used with the row type, see the data for details. | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
data {*} | Custom attributes can theoretically pass any value. This value is not used inside the component, you can get this value in the first parameter of the callback | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
option {object[]} | Can only be used with the select type, see the option for details. | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ |
HTML Attribute
The usage of these attributes is the same as that of native HTML tags. They are listed to indicate the points to be aware of when using them.
Attribute {type} | Description |
---|---|
name {string} | The attributes that the radio and checkbox must set, the same as the name attribute of the HTML-like tag. |
value {number|string} | The value attribute of the generated HTML tag, **All object cell can be used starting with version 1.4.1** |
src {string} | Image link, such as: 'http(s)://xxx' or 'data:image/xxx' |
alt {string} | The alt attribute of the image |
href {string} | The hyperlink type of the link type (the same as the href of the HTML a tag), or you can use this combination of event and callback to customize the event callback without passing this attribute. |
For more tag attributes please visit w3schools.
React Element Attribute
Attribute {type} | Description |
---|---|
key {string} | Jsx loop or array need to use the key attribute, Please ensure the uniqueness of the key |
className {string} | Custom style sheet name |
defaultValue {string|number} | The default value of labels such as text boxes, different from value |
For more attributes, see the
type definition file
(d.ts) of the react library.
Callback
v1.5.0 and earlier
callback(data:Array[], objectUnit:object, event:SyntheticEvent)
Custom event callback function, can be used with event
. If the event is undefined, the default click event is triggered after the callback.
v1.5.1 - v1.6.1
callback(instance:object, objectUnit:object, event:SyntheticEvent)
Custom event callback function, can be used with event
. If the event is undefined, the default click event is triggered after the callback.
v1.7.0 and later
callback(exposes:object, objectUnit:object, event:SyntheticEvent)
Custom event callback function, can be used with event
. If the event is undefined, the default click event is triggered after the callback.
Option
{type='select'}
Object unit unique attribute.
key {type} | description |
---|---|
id | option id |
label | option text |
value | option value |
props.property {type} | default | description |
---|---|---|
border {cssProperties border} | {...} | The border configuration of the table, including the row and cell inside the component (if the row or cell does not have a border style, this global configuration is used by default) |
style {cssProperties} | {...} | The style of the outermost container of the component |
{boolean} ⚠ | true | Whether to enable component scrolling (valid when the height of all rows exceeds the height of the component's viewable area) ⚠ This property is deprecated in version 1.4.0, please use scroll.enable instead |
{number} ⚠ | 50 | The scrolling speed of the component list when scrolling is enabled ⚠ This property is deprecated in version 1.4.0, please use scroll.speed instead |
scroll ^1.4.0 {object} | {...} | Component scrolling related settings. speed milliseconds scrolling distance distance. |
scroll.enable ^1.4.0 {boolean} | true | Whether to enable component scrolling (valid when the height of all rows exceeds the height of the component's viewable area) |
scroll.speed ^1.4.0 {number} | 50 | The interval at which the component scrolls once, in milliseconds. Tip: Set a small time interval to achieve continuous scrolling animation.If combined with scroll.distance , you can achieve an interval scrolling effect, and you can scroll N rows at a time. |
scroll.distance ^1.4.0 {number} | 1 | The distance at which the component scrolls each time. If the value is a positive integer, the unit is pixel ; if 0 , it means stop scrolling, the same as scroll.enable: false ; if it is a negative integer, it scrolls in the unit of row , and the number of rows equals the absolute value of the value. If it is a non-numeric, take 0 ; if it is a positive decimal, take an integral upward. If it is a negative decimal, it is rounded down |
header {object} | {...} | Header related settings |
header.show {boolean} | true | Whether to display the header. When true, the first subarray of data is the header data |
header.style {cssProperties} | {...} | Header style |
header.cellStyle {cssProperties} | {...} | The style of the cell inside the header. Note : The width value in this style will be invalid, because the header cell width of this component is automatically adapted according to the cell width in the body |
body {object} | {...} | Body related configuration |
body.style 1.5.0 {cssProperties} | {...} | You can define partial styles for the body that usually do not affect the layout of the list. For example, you can use "backgroundColor", "backgroundImage" or "opacity", etc., but you can't use attributes such as "width", "height", "padding", and "margin" that change the size or position of the body |
body.row {object} | {...} | Row configuration in the body |
()=>{} ⚠ | null | Deprecated Row click event, ⚠ This property is only available in version 1.2.0 |
body.row.transition {boolean} | true | Whether to enable the loading animation of the row inside the body |
body.row.spacing {boolean} | 0 | Row spacing |
{boolean} ⚠ | false | Deprecated Whether to enable row selection ⚠ This property is deprecated in version 1.2.2, please use body.row.rowCheckbox instead |
{boolean} ⚠ | false | Deprecated Whether to enable row selection ⚠ The value of this property was changed from Boolean to an object in version 1.5.0, as detailed in the next line |
body.row.rowCheckbox ^1.5.0 {object} | {...} | Body row selection function related settings |
body.row.rowCheckbox.show ^1.5.0 {boolean} | false | Whether to enable row selection |
body.row.rowCheckbox.column ^1.5.0 {number} | 1 | Which column of the list (table) is inserted into the column. Note that this value has a priority less than row.serialNumber.column , ie if the two values are the same, then this column will be ranked later |
body.row.rowCheckbox.style ^1.5.0 {cssProperties} | {...} | The style of the label of the wrapped row selection box, not the style of the cell in which the row selection box is located |
body.row.rowCheckbox.specialStyle ^1.5.0 {cssProperties} | [] | According to the array index, set the style of the label of the parcel row selection box. If you want to skip an index, you can use a comma placeholder |
body.row.style {cssProperties} | {...} | The style of the row inside the body |
body.row.specialStyle {[cssProperties, cssProperties, ...]} | [] | Set the style of each row according to the array index. If you want to skip an index, you can use a comma placeholder |
body.row.visual {object} | {...} | Improve the visual of the line: set another line style every N lines |
body.row.visual.show {boolean} | true | Whether to turn on visual enhancement |
body.row.visual.interval {number} | 1 | Alternate every N lines |
body.row.visual.style {cssProperties} | {...} | Alternate row style configuration |
body.row.silent {object} | {...} | Whether to respond to mouse interaction |
body.row.silent.show {boolean} | false | Whether row does not respond to mouse events, such as hover events. The default is false, that is, respond to mouse events |
body.row.silent.style {cssProperties} | {...} | Style when responding to mouse events |
body.row.serialNumber {object} | {...} | Line number related configuration |
body.row.serialNumber.show {boolean} | false | Whether to display the line number |
body.row.serialNumber.columnName ^1.5.0 {string} | 'SN' | The column name of the column |
body.row.serialNumber.formatter {string} | '{index}.' | Line number formatting. {index} resolves to a number that increments from 0 |
body.row.serialNumber.column ^1.5.0 {number} | 1 | Which column of the list (table) is inserted into the column. Note that this value has a priority greater than row.rowCheckbox.column , ie if the two values are the same, then this column will be in front |
body.row.serialNumber.style `{cssProperties} | {...} | The style of the label that wraps the line number, not the style of the cell in which the line number is located |
body.row.serialNumber.specialStyle {[cssProperties, ...]} | [] | According to the array index, set the style of the label of the package line number. If you want to skip an index, you can use a comma placeholder |
body.cellOfColumn {object} | {...} | Configure cell styles by column |
body.cellOfColumn.style {[cssProperties, ...]} | [] | According to the array index, set the style of all the cells in each column. If you want to skip an index, you can use a comma placeholder |
body.cell {object} | {...} | Cell related configuration |
body.cell.style {cssProperties} | {...} | Cell style |
body.cell.style.width {string|Array|number} | 'auto' | width is one of the properties of style, here you need to pay special attention: its usage is different from the width of css, see cellWidth |
{cssProperties} | {...} | Deprecated The icon style inside the cell needs to match the img of the object cell. In fact, you only need to use className instead of it in the object cell. ⚠ it looks a lot more, so it will be completely removed in a later version |
cellWidth
Optional value for cellWidth:
Note:
- Regardless of the method, if the final rendered cell width value is less than
style.minWidth
, thestyle.minWidth
value is used.- The total width of the component cannot be less than the sum of the widths of each column, otherwise the columns that exceed the width portion will be hidden.
- When customizing the width values of multiple columns, if each column defines a specific value, you should ensure that the sum of these values is equal to the width value of the component, otherwise the actual width of the column after rendering may not be the expected value. Under normal circumstances, we should ensure that the width of at least one column is automatically adapted, that is, no value is set or skipped with a comma.
- The priority order of the cell styles.
v1.7.0
and later versions support React native events, and remove the event binding written inside the code in the previous version.
Added 3 custom scroll events:
scroll.distance < 0
) or after calling the public scroll to function.For all events, including react native events and custom scroll events, there are two callback parameters:
{SyntheticEvent}
: Event callback parameter of event handle.{object}
: An object that contains exposed properties and methods.The default value of the component is based on this configuration table.
{
className: '',
data: [
['1st column', '2nd column', '3rd column'],
['1st cell', '2nd cell', '3rd cell']
],
property: {
border: {
borderWidth: 1,
borderStyle: 'solid',
borderColor: '#f4f4f4'
},
style: {
width: '100%',
margin: '0 auto',
height: 300
},
scroll: {
enable: true,
speed: 50,
distance: 1
},
header: {
show: true,
style: {
height: 40
},
cellStyle: {
color: '#000000',
border: ''
}
},
body: {
style: {
backgroundImage: '',
backgroundColor: ''
},
row: {
transition: true,
spacing: 0,
style: {
height: 30
},
serialNumber: {
show: false,
columnName: 'SN',
formatter: '{index}.',
column: 1,
style: {
width: '100%',
height: '100%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '',
backgroundImage: '',
color: '#ffffff'
},
specialStyle: []
},
rowCheckbox: {
show: false,
column: 1,
style: {},
specialStyle: []
},
visual: {
show: false,
interval: 1,
style: {
backgroundColor: '#e8f4fc'
}
},
specialStyle: [],
silent: {
show: false, // false代表开启
style: {
opacity: 0.8
}
}
},
cellOfColumn: {
style: []
},
cell: {
style: {
fontSize: 16,
minWidth: 50,
color: '#000000',
textAlign: 'center',
border: '',
width: 'auto'
},
iconStyle: {
width: 24,
height: 'auto'
}
}
}
}
}
The react-tabllist
project can continue to serve everyone free of charge. One of the reasons is the free development tools provided by jetbrains. Thank them here!
Q: Thanks to AimLuo for the question: Is it better to write object units
in data
or JSX syntax
?
A: answer
Author: oceanxy
Source code: https://github.com/oceanxy/react-tabllist
License: MIT license
1598839687
If you are undertaking a mobile app development for your start-up or enterprise, you are likely wondering whether to use React Native. As a popular development framework, React Native helps you to develop near-native mobile apps. However, you are probably also wondering how close you can get to a native app by using React Native. How native is React Native?
In the article, we discuss the similarities between native mobile development and development using React Native. We also touch upon where they differ and how to bridge the gaps. Read on.
Let’s briefly set the context first. We will briefly touch upon what React Native is and how it differs from earlier hybrid frameworks.
React Native is a popular JavaScript framework that Facebook has created. You can use this open-source framework to code natively rendering Android and iOS mobile apps. You can use it to develop web apps too.
Facebook has developed React Native based on React, its JavaScript library. The first release of React Native came in March 2015. At the time of writing this article, the latest stable release of React Native is 0.62.0, and it was released in March 2020.
Although relatively new, React Native has acquired a high degree of popularity. The “Stack Overflow Developer Survey 2019” report identifies it as the 8th most loved framework. Facebook, Walmart, and Bloomberg are some of the top companies that use React Native.
The popularity of React Native comes from its advantages. Some of its advantages are as follows:
Are you wondering whether React Native is just another of those hybrid frameworks like Ionic or Cordova? It’s not! React Native is fundamentally different from these earlier hybrid frameworks.
React Native is very close to native. Consider the following aspects as described on the React Native website:
Due to these factors, React Native offers many more advantages compared to those earlier hybrid frameworks. We now review them.
#android app #frontend #ios app #mobile app development #benefits of react native #is react native good for mobile app development #native vs #pros and cons of react native #react mobile development #react native development #react native experience #react native framework #react native ios vs android #react native pros and cons #react native vs android #react native vs native #react native vs native performance #react vs native #why react native #why use react native
1591207740
To keep things simple and concise, we’ll start fresh with npx create-react-app dark-toggle . While we’re in our command line, let’s get the npm packages out of the way as well:
npm install styled-components styled-theming redux react-redux
styled-components: we’ll use this library to create isolated components that encapsulate their own styling
styled-theming: this library offers a very clean API to work with multiple themes in your styled components
redux and react-redux will do the heavy lifting regarding state management
#styled-components #react #react-hook #dark-theme #redux #react-native
1658034000
React-based list (table) components that support events, callback functions, and custom styles.
🔧 Install
npm install react-tabllist --save
<script src="https://cdn.bootcss.com/react/16.8.6/umd/react.development.js"></script>
<script src="https://cdn.bootcss.com/react-dom/16.8.6/umd/react-dom.development.js"></script>
<script src="https://cdn.bootcss.com/babel-standalone/7.0.0-beta.3/babel.min.js"></script>
<script src='https://cdn.bootcss.com/lodash.js/4.17.11/lodash.core.js'></script>
<script src='./react-tabllist.min.js'></script>
<div id='example'></div>
<script type='text/javascript'>
var option = {
data: [],
property: {}
}
ReactDOM.render(
React.createElement(ReactTabllist, option),
document.getElementById('example')
)
</script>
import ReactTabllist from 'react-tabllist';
// Use default configuration
ReactDOM.render(<ReactTabllist />, mountNode);
// Custom data and configuration items
const props = {
className: 'demo',
property: {},
data: [
['1st column', '2nd column', '3rd column'],
['1st cell', '2nd cell', '3rd cell']
]
}
ReactDOM.render(<ReactTabllist {...props} />, mountNode);
/**
* Event callback function
* @param {SyntheticEvent} event
* @param {Exposes} exposes An object containing exposed properties and methods
*/
function handleScroll(event, exposes) {
// some code
}
// Use React native events
ReactDOM.render(<ReactTabllist {...props} onScroll={handleScroll} />, mountNode);
// Use custom events built into components
ReactDOM.render(<ReactTabllist {...props} custom_onScrollToEnd={handleScroll} />, mountNode);
If you want to join the development to improve this component, please fork and start with the following command:
$ git clone git@github.com:oceanxy/react-tabllist.git
$ cd react-tabllist
$ npm install
$ npm start
Open your browser and visit http://localhost:3001
.
props | description | details |
---|---|---|
data {[Array, Array, Array,...]} | Render table data | props.data |
className {string} | Table outermost container style sheet name | '' |
property {Object} | Wrapper table properties | props.property |
You can customize the style through the props.classname
attribute.
Data Format
The data
data format is very similar to a two-dimensional array。
[
[cell, cell, cell], // row
[
cell, // cell
cell,
cell
],
[cell, cell, cell],
...
]
type='row'
and cells=[]
, which respectively identify the object as a row and the cells contained in the row:[
{ // The rows are displayed as objects, and the in-row cells are contained in the cells field as an array.
type: 'row',
cells: [cell, cell, cell],
...
},
[ // Display rows as an array, each element representing a cell
{type: 'button', ...}, // Generate a button in the cell
cell, // cell
cell
],
[
cell,
cell,
[
{type: 'radio'}, {type: 'radio'}, ... // Generate two or more radios in the same cell
]
],
...
]
Object Unit
The data format that cells can parse is divided into the following four categories:
<button className='test-button' onclick='()=>{return null}'>click</button>
type | description |
---|---|
row | Generate a unit row, unit row object can only be written in the body, invalid elsewhere |
img | Generate an img tag inside the cell |
button | Generate a button in the cell |
link | Generate a link in the cell (a tag) |
radio | Generate a radio in the cell |
checkbox | Generate a checkbox in the cell |
select ^1.4.1 | Generate a select in the cell |
text ^1.5.0 | Generate a plain text inside the cell. You can also replace the object unit with a string. If you don't plan to add events to this cell, you can do that. |
input ^1.6.0 | Generate a text box in a cell. |
Here are some examples:
row { type: 'row', cells: [cell, cell, cell], data: 'row.id', value: 'row.typeID', event: 'onClick', callback: (data, cellData, event) => {}, className: '', key: '' } button { type: 'button', value: 'click me', className: 'test-btn', data: '123', event: 'onClick', callback: data => alert('hello react-tabllist', data) // hello react-tabllist, 123, key: '' } img { type: 'img', src: 'http://www.xieyangogo.cn/pic.png', alt: '', text: 'IMG description', className: 'test-img', key: '', value:'' } link (Choose one of the two) { type: 'link', text: 'I am a link, I use the href attribute', className: 'test-link', key: '', href: 'https://github.com/oceanxy/react-tabllist', value:'' } { type: 'link', text: 'I am a link, I use event and callback to implement custom functions', className: 'test-link', key: '', data: {}, event: 'onClick', callback: (data, cellData, event) => {}, value:'' } radio { type: 'radio', name: 'group2', text: 'radio group 2-1', className: 'test-radio', callback: (data, cellData, event) => {}, key: '', value:'' } checkbox { type: 'checkbox', name: 'checkbox1', text: 'checkbox', className: 'test-checkbox', callback: (data, cellData, event) => {}, key: '', value:'' } select { type: 'select', text: 'please choose:', value: '', data: '', className: '', callback: (data, cellData, event) => {}, option: [ { id: '1', label: 'item 1', value: 1 } ] } text { type: 'text', text: 'I am a normal text', callback: (data, cellData, event) => {} } input { type: 'input', text: 'username:', placeholder: 'enter username', defaultValue: 'oceanxy' // This attribute is not a standard HTML tag attribute, but it is a property of the React element (the purpose is to set the default value of the text box). As you can see, you can also use React's officially defined properties in object cells. }
Object Unit Attribute
Attribute {type} | Description | row | button | link | img | radio | checkbox | input | select | text |
---|---|---|---|---|---|---|---|---|---|---|
{string} Available before version 1.2.2 | Deprecated A unique identifier for a cell that can be used to save ids, and so on. This field function is similar to the key, and can also be replaced with a data field in conjunction with a callback function, so it is decided to discard this field in version 1.2.2. | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ |
type {string} | The type of HTML tag to be generated in the cell | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
text {string} | The text of the rendered HTML tag | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
event {string} | The way to trigger an event needs to be used with callback | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
callback {function} | The callback function after the trigger event, see the callback for details. | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ | ✅ |
cells {object[]} | Can only be used with the row type, see the data for details. | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
data {*} | Custom attributes can theoretically pass any value. This value is not used inside the component, you can get this value in the first parameter of the callback | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
option {object[]} | Can only be used with the select type, see the option for details. | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ |
HTML Attribute
The usage of these attributes is the same as that of native HTML tags. They are listed to indicate the points to be aware of when using them.
Attribute {type} | Description |
---|---|
name {string} | The attributes that the radio and checkbox must set, the same as the name attribute of the HTML-like tag. |
value {number|string} | The value attribute of the generated HTML tag, **All object cell can be used starting with version 1.4.1** |
src {string} | Image link, such as: 'http(s)://xxx' or 'data:image/xxx' |
alt {string} | The alt attribute of the image |
href {string} | The hyperlink type of the link type (the same as the href of the HTML a tag), or you can use this combination of event and callback to customize the event callback without passing this attribute. |
For more tag attributes please visit w3schools.
React Element Attribute
Attribute {type} | Description |
---|---|
key {string} | Jsx loop or array need to use the key attribute, Please ensure the uniqueness of the key |
className {string} | Custom style sheet name |
defaultValue {string|number} | The default value of labels such as text boxes, different from value |
For more attributes, see the
type definition file
(d.ts) of the react library.
Callback
v1.5.0 and earlier
callback(data:Array[], objectUnit:object, event:SyntheticEvent)
Custom event callback function, can be used with event
. If the event is undefined, the default click event is triggered after the callback.
v1.5.1 - v1.6.1
callback(instance:object, objectUnit:object, event:SyntheticEvent)
Custom event callback function, can be used with event
. If the event is undefined, the default click event is triggered after the callback.
v1.7.0 and later
callback(exposes:object, objectUnit:object, event:SyntheticEvent)
Custom event callback function, can be used with event
. If the event is undefined, the default click event is triggered after the callback.
Option
{type='select'}
Object unit unique attribute.
key {type} | description |
---|---|
id | option id |
label | option text |
value | option value |
props.property {type} | default | description |
---|---|---|
border {cssProperties border} | {...} | The border configuration of the table, including the row and cell inside the component (if the row or cell does not have a border style, this global configuration is used by default) |
style {cssProperties} | {...} | The style of the outermost container of the component |
{boolean} ⚠ | true | Whether to enable component scrolling (valid when the height of all rows exceeds the height of the component's viewable area) ⚠ This property is deprecated in version 1.4.0, please use scroll.enable instead |
{number} ⚠ | 50 | The scrolling speed of the component list when scrolling is enabled ⚠ This property is deprecated in version 1.4.0, please use scroll.speed instead |
scroll ^1.4.0 {object} | {...} | Component scrolling related settings. speed milliseconds scrolling distance distance. |
scroll.enable ^1.4.0 {boolean} | true | Whether to enable component scrolling (valid when the height of all rows exceeds the height of the component's viewable area) |
scroll.speed ^1.4.0 {number} | 50 | The interval at which the component scrolls once, in milliseconds. Tip: Set a small time interval to achieve continuous scrolling animation.If combined with scroll.distance , you can achieve an interval scrolling effect, and you can scroll N rows at a time. |
scroll.distance ^1.4.0 {number} | 1 | The distance at which the component scrolls each time. If the value is a positive integer, the unit is pixel ; if 0 , it means stop scrolling, the same as scroll.enable: false ; if it is a negative integer, it scrolls in the unit of row , and the number of rows equals the absolute value of the value. If it is a non-numeric, take 0 ; if it is a positive decimal, take an integral upward. If it is a negative decimal, it is rounded down |
header {object} | {...} | Header related settings |
header.show {boolean} | true | Whether to display the header. When true, the first subarray of data is the header data |
header.style {cssProperties} | {...} | Header style |
header.cellStyle {cssProperties} | {...} | The style of the cell inside the header. Note : The width value in this style will be invalid, because the header cell width of this component is automatically adapted according to the cell width in the body |
body {object} | {...} | Body related configuration |
body.style 1.5.0 {cssProperties} | {...} | You can define partial styles for the body that usually do not affect the layout of the list. For example, you can use "backgroundColor", "backgroundImage" or "opacity", etc., but you can't use attributes such as "width", "height", "padding", and "margin" that change the size or position of the body |
body.row {object} | {...} | Row configuration in the body |
()=>{} ⚠ | null | Deprecated Row click event, ⚠ This property is only available in version 1.2.0 |
body.row.transition {boolean} | true | Whether to enable the loading animation of the row inside the body |
body.row.spacing {boolean} | 0 | Row spacing |
{boolean} ⚠ | false | Deprecated Whether to enable row selection ⚠ This property is deprecated in version 1.2.2, please use body.row.rowCheckbox instead |
{boolean} ⚠ | false | Deprecated Whether to enable row selection ⚠ The value of this property was changed from Boolean to an object in version 1.5.0, as detailed in the next line |
body.row.rowCheckbox ^1.5.0 {object} | {...} | Body row selection function related settings |
body.row.rowCheckbox.show ^1.5.0 {boolean} | false | Whether to enable row selection |
body.row.rowCheckbox.column ^1.5.0 {number} | 1 | Which column of the list (table) is inserted into the column. Note that this value has a priority less than row.serialNumber.column , ie if the two values are the same, then this column will be ranked later |
body.row.rowCheckbox.style ^1.5.0 {cssProperties} | {...} | The style of the label of the wrapped row selection box, not the style of the cell in which the row selection box is located |
body.row.rowCheckbox.specialStyle ^1.5.0 {cssProperties} | [] | According to the array index, set the style of the label of the parcel row selection box. If you want to skip an index, you can use a comma placeholder |
body.row.style {cssProperties} | {...} | The style of the row inside the body |
body.row.specialStyle {[cssProperties, cssProperties, ...]} | [] | Set the style of each row according to the array index. If you want to skip an index, you can use a comma placeholder |
body.row.visual {object} | {...} | Improve the visual of the line: set another line style every N lines |
body.row.visual.show {boolean} | true | Whether to turn on visual enhancement |
body.row.visual.interval {number} | 1 | Alternate every N lines |
body.row.visual.style {cssProperties} | {...} | Alternate row style configuration |
body.row.silent {object} | {...} | Whether to respond to mouse interaction |
body.row.silent.show {boolean} | false | Whether row does not respond to mouse events, such as hover events. The default is false, that is, respond to mouse events |
body.row.silent.style {cssProperties} | {...} | Style when responding to mouse events |
body.row.serialNumber {object} | {...} | Line number related configuration |
body.row.serialNumber.show {boolean} | false | Whether to display the line number |
body.row.serialNumber.columnName ^1.5.0 {string} | 'SN' | The column name of the column |
body.row.serialNumber.formatter {string} | '{index}.' | Line number formatting. {index} resolves to a number that increments from 0 |
body.row.serialNumber.column ^1.5.0 {number} | 1 | Which column of the list (table) is inserted into the column. Note that this value has a priority greater than row.rowCheckbox.column , ie if the two values are the same, then this column will be in front |
body.row.serialNumber.style `{cssProperties} | {...} | The style of the label that wraps the line number, not the style of the cell in which the line number is located |
body.row.serialNumber.specialStyle {[cssProperties, ...]} | [] | According to the array index, set the style of the label of the package line number. If you want to skip an index, you can use a comma placeholder |
body.cellOfColumn {object} | {...} | Configure cell styles by column |
body.cellOfColumn.style {[cssProperties, ...]} | [] | According to the array index, set the style of all the cells in each column. If you want to skip an index, you can use a comma placeholder |
body.cell {object} | {...} | Cell related configuration |
body.cell.style {cssProperties} | {...} | Cell style |
body.cell.style.width {string|Array|number} | 'auto' | width is one of the properties of style, here you need to pay special attention: its usage is different from the width of css, see cellWidth |
{cssProperties} | {...} | Deprecated The icon style inside the cell needs to match the img of the object cell. In fact, you only need to use className instead of it in the object cell. ⚠ it looks a lot more, so it will be completely removed in a later version |
cellWidth
Optional value for cellWidth:
Note:
- Regardless of the method, if the final rendered cell width value is less than
style.minWidth
, thestyle.minWidth
value is used.- The total width of the component cannot be less than the sum of the widths of each column, otherwise the columns that exceed the width portion will be hidden.
- When customizing the width values of multiple columns, if each column defines a specific value, you should ensure that the sum of these values is equal to the width value of the component, otherwise the actual width of the column after rendering may not be the expected value. Under normal circumstances, we should ensure that the width of at least one column is automatically adapted, that is, no value is set or skipped with a comma.
- The priority order of the cell styles.
v1.7.0
and later versions support React native events, and remove the event binding written inside the code in the previous version.
Added 3 custom scroll events:
scroll.distance < 0
) or after calling the public scroll to function.For all events, including react native events and custom scroll events, there are two callback parameters:
{SyntheticEvent}
: Event callback parameter of event handle.{object}
: An object that contains exposed properties and methods.The default value of the component is based on this configuration table.
{
className: '',
data: [
['1st column', '2nd column', '3rd column'],
['1st cell', '2nd cell', '3rd cell']
],
property: {
border: {
borderWidth: 1,
borderStyle: 'solid',
borderColor: '#f4f4f4'
},
style: {
width: '100%',
margin: '0 auto',
height: 300
},
scroll: {
enable: true,
speed: 50,
distance: 1
},
header: {
show: true,
style: {
height: 40
},
cellStyle: {
color: '#000000',
border: ''
}
},
body: {
style: {
backgroundImage: '',
backgroundColor: ''
},
row: {
transition: true,
spacing: 0,
style: {
height: 30
},
serialNumber: {
show: false,
columnName: 'SN',
formatter: '{index}.',
column: 1,
style: {
width: '100%',
height: '100%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '',
backgroundImage: '',
color: '#ffffff'
},
specialStyle: []
},
rowCheckbox: {
show: false,
column: 1,
style: {},
specialStyle: []
},
visual: {
show: false,
interval: 1,
style: {
backgroundColor: '#e8f4fc'
}
},
specialStyle: [],
silent: {
show: false, // false代表开启
style: {
opacity: 0.8
}
}
},
cellOfColumn: {
style: []
},
cell: {
style: {
fontSize: 16,
minWidth: 50,
color: '#000000',
textAlign: 'center',
border: '',
width: 'auto'
},
iconStyle: {
width: 24,
height: 'auto'
}
}
}
}
}
The react-tabllist
project can continue to serve everyone free of charge. One of the reasons is the free development tools provided by jetbrains. Thank them here!
Q: Thanks to AimLuo for the question: Is it better to write object units
in data
or JSX syntax
?
A: answer
Author: oceanxy
Source code: https://github.com/oceanxy/react-tabllist
License: MIT license
1615544450
Since March 2020 reached 556 million monthly downloads have increased, It shows that React JS has been steadily growing. React.js also provides a desirable amount of pliancy and efficiency for developing innovative solutions with interactive user interfaces. It’s no surprise that an increasing number of businesses are adopting this technology. How do you select and recruit React.js developers who will propel your project forward? How much does a React developer make? We’ll bring you here all the details you need.
Facebook built and maintains React.js, an open-source JavaScript library for designing development tools. React.js is used to create single-page applications (SPAs) that can be used in conjunction with React Native to develop native cross-platform apps.
In the United States, the average React developer salary is $94,205 a year, or $30-$48 per hour, This is one of the highest among JavaScript developers. The starting salary for junior React.js developers is $60,510 per year, rising to $112,480 for senior roles.
In context of software developer wage rates, the United States continues to lead. In high-tech cities like San Francisco and New York, average React developer salaries will hit $98K and $114per year, overall.
However, the need for React.js and React Native developer is outpacing local labour markets. As a result, many businesses have difficulty locating and recruiting them locally.
It’s no surprise that for US and European companies looking for professional and budget engineers, offshore regions like India are becoming especially interesting. This area has a large number of app development companies, a good rate with quality, and a good pool of React.js front-end developers.
As per Linkedin, the country’s IT industry employs over a million React specialists. Furthermore, for the same or less money than hiring a React.js programmer locally, you may recruit someone with much expertise and a broader technical stack.
React is a very strong framework. React.js makes use of a powerful synchronization method known as Virtual DOM, which compares the current page architecture to the expected page architecture and updates the appropriate components as long as the user input.
React is scalable. it utilises a single language, For server-client side, and mobile platform.
React is steady.React.js is completely adaptable, which means it seldom, if ever, updates the user interface. This enables legacy projects to be updated to the most new edition of React.js without having to change the codebase or make a few small changes.
React is adaptable. It can be conveniently paired with various state administrators (e.g., Redux, Flux, Alt or Reflux) and can be used to implement a number of architectural patterns.
Is there a market for React.js programmers?
The need for React.js developers is rising at an unparalleled rate. React.js is currently used by over one million websites around the world. React is used by Fortune 400+ businesses and popular companies such as Facebook, Twitter, Glassdoor and Cloudflare.
As you’ve seen, locating and Hire React js Developer and Hire React Native developer is a difficult challenge. You will have less challenges selecting the correct fit for your projects if you identify growing offshore locations (e.g. India) and take into consideration the details above.
If you want to make this process easier, You can visit our website for more, or else to write a email, we’ll help you to finding top rated React.js and React Native developers easier and with strives to create this operation
#hire-react-js-developer #hire-react-native-developer #react #react-native #react-js #hire-react-js-programmer
1651604400
React Starter Kit is an opinionated boilerplate for web development built on top of Node.js, Express, GraphQL and React, containing modern web development tools such as Webpack, Babel and Browsersync. Helping you to stay productive following the best practices. A solid starting point for both professionals and newcomers to the industry.
See getting started guide, demo, docs, roadmap | Join #react-starter-kit chat room on Gitter | Visit our sponsors:
The master
branch of React Starter Kit doesn't include a Flux implementation or any other advanced integrations. Nevertheless, we have some integrations available to you in feature branches that you can use either as a reference or merge into your project:
master
)feature/redux
)feature/apollo
)master
)You can see status of most reasonable merge combination as PRs labeled as TRACKING
If you think that any of these features should be on master
, or vice versa, some features should removed from the master
branch, please let us know. We love your feedback!
React Starter Kit
| React Static Boilerplate
| ASP.NET Core Starter Kit
| |
---|---|---|---|
App type | Isomorphic (universal) | Single-page application | Single-page application |
Frontend | |||
Language | JavaScript (ES2015+, JSX) | JavaScript (ES2015+, JSX) | JavaScript (ES2015+, JSX) |
Libraries | React, History, Universal Router | React, History, Redux | React, History, Redux |
Routes | Imperative (functional) | Declarative | Declarative, cross-stack |
Backend | |||
Language | JavaScript (ES2015+, JSX) | n/a | C#, F# |
Libraries | Node.js, Express, Sequelize, GraphQL | n/a | ASP.NET Core, EF Core, ASP.NET Identity |
SSR | Yes | n/a | n/a |
Data API | GraphQL | n/a | Web API |
♥ React Starter Kit? Help us keep it alive by donating funds to cover project expenses via OpenCollective or Bountysource!
Anyone and everyone is welcome to contribute to this project. The best way to start is by checking our open issues, submit a new issue or feature request, participate in discussions, upvote or downvote the issues you like or dislike, send pull requests.
Copyright © 2014-present Kriasoft, LLC. This source code is licensed under the MIT license found in the LICENSE.txt file. The documentation to the project is licensed under the CC BY-SA 4.0 license.
Author: kriasoft
Source Code: https://github.com/kriasoft/react-starter-kit
License: MIT License