uxcore-kuma
Advanced tools
Comparing version 1.2.3 to 1.2.4
{ | ||
"name": "uxcore-kuma", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "style for uxcore based on kuma", | ||
@@ -5,0 +5,0 @@ "author": "shane.wuq", |
@@ -34,2 +34,3 @@ #KUMA | ||
- components/uxcore-totop/src/Totop.less | ||
- components/uxcore-alert/src/Alert.less | ||
- hovercard.less | ||
@@ -36,0 +37,0 @@ - employee.less |
@@ -5,2 +5,6 @@ # History | ||
## 0.2.6 | ||
`CHANGED` Change buttonSize in confirm mode. | ||
`NEW` add confirm options buttonSize. | ||
## 0.2.5 | ||
@@ -7,0 +11,0 @@ `UPGRADE` upgrade to rc-dialog@5.2.1 |
{ | ||
"name": "uxcore-dialog", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "uxcore-dialog ui componment for react", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -66,2 +66,3 @@ # uxcore-dialog | ||
| width | 宽度 | String or Number | 416 | | ||
| buttonSize | 按钮的尺寸,'small', 'medium', 'large' 三种可选 | String | 'medium'| | ||
| iconClassName | 图标样式名 | String | kuma-icon-caution | |
@@ -77,8 +77,8 @@ import Button from 'uxcore-button'; | ||
footer = <div className="kuma-confirm-action"> | ||
<Button size="small" onClick={onOk}>确 定</Button> | ||
<Button type="secondary" size="small" onClick={onCancel}>取 消</Button> | ||
<Button size={props.buttonSize || "medium"} onClick={onOk}>确 定</Button> | ||
<Button type="secondary" size={props.buttonSize || "medium"} onClick={onCancel}>取 消</Button> | ||
</div>; | ||
} else { | ||
footer = <div className="kuma-confirm-action"> | ||
<Button size="small" onClick={onOk}>知道了</Button> | ||
<Button size={props.buttonSize || "medium"} onClick={onOk}>知道了</Button> | ||
</div>; | ||
@@ -85,0 +85,0 @@ } |
@@ -12,2 +12,3 @@ /** | ||
let Layout = require('uxcore-layout'); | ||
let Select = require('uxcore-select2'); | ||
console.log(Layout); | ||
@@ -52,3 +53,3 @@ | ||
fruit: "apple", | ||
number: 0, | ||
number: 1, | ||
// city: "nj", | ||
@@ -253,6 +254,11 @@ // textArea: "我是多行文本", | ||
{ dataKey: 'email',title:"Email",width: 200,type:"text"}, | ||
{ dataKey: 'action1', title:'操作1', width:100, type:"action",items:[ | ||
{title:'增加', type:"addRow", cb: function(rowData){console.info(rowData)}}, | ||
{title:'删除', type:"delRow", cb: function(rowData){console.info(rowData)}} | ||
]} | ||
{ dataKey: 'action1', title:'操作1', width:100, type:"action",actions:{ | ||
"增加": function(rowData) { | ||
me.refs.grid.addEmptyRow(); | ||
}, | ||
"删除": function(rowData) { | ||
me.refs.grid.delRow(rowData); | ||
} | ||
} | ||
} | ||
]; | ||
@@ -319,9 +325,2 @@ | ||
disabled={false} | ||
afterFetch={(obj) => { | ||
let data = {}; | ||
obj.result.forEach((item, index) => { | ||
data[item[1]] = item[0]; | ||
}); | ||
return data; | ||
}} | ||
jsxdata={me.state.jsxdata}/> | ||
@@ -369,5 +368,5 @@ <DateFormField format="yyyy-MM-dd HH:mm:ss" jsxname="date" jsxlabel="日期"/> | ||
jsxlabel="传 option"> | ||
<Option value="1">1</Option> | ||
<Option value="2">2</Option> | ||
<Option value="3">3</Option> | ||
<Option value="1">第一个选项</Option> | ||
<Option value="2">第二个选项</Option> | ||
<Option value="3">第三个选项</Option> | ||
</SelectFormField> | ||
@@ -391,3 +390,3 @@ <FormRow> | ||
<TableFormField jsxname="dicts" jsxlabel="薪酬字典" {...renderProps} jsxrules={{validator:() => {return false}, errMsg: "测试"}}> | ||
<TableFormField jsxname="dicts" jsxlabel="薪酬字典" {...renderProps} > | ||
</TableFormField> | ||
@@ -394,0 +393,0 @@ <ButtonGroupFormField> |
@@ -0,1 +1,6 @@ | ||
## 1.2.3 | ||
`FIX` fix issue #35 #38 #42 #44 | ||
`CHANED` small style change with uxcore-select2 | ||
## 1.2.2 | ||
@@ -2,0 +7,0 @@ |
{ | ||
"name": "uxcore-form", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "form component for uxcore", | ||
@@ -38,3 +38,3 @@ "repository": "https://github.com/uxcore/uxcore-form.git", | ||
"deepcopy": "~0.5.0", | ||
"object-assign": "^2.0.0", | ||
"object-assign": "~4.0.0", | ||
"uxcore-button": "~0.3.0", | ||
@@ -55,2 +55,2 @@ "uxcore-calendar": "~0.1.5", | ||
"license": "MIT" | ||
} | ||
} |
@@ -163,18 +163,9 @@ --- | ||
|jsxdata|object|optional|-|传入用于生成列表的数据,格式为{value: text}| | ||
|jsxfetchUrl|string|optional|-|如果 Select 是通过搜索异步获取选项,则需要填入此项,目前指支持 jsonp。| | ||
|jsxfetchUrl|string|optional|-|如果 Select 是通过搜索异步获取选项,则需要填入此项| | ||
|jsxstyle|obj|optional|-|与 react 传入 style 的方式相同,修改选择框的样式| | ||
|beforeFetch|func|optional|-|会传入 {q: value}, value 为搜索框中变化的值,在发出 ajax 请求之前,将数据处理为应该发送的格式,并需返回该数据。| | ||
|afterFetch|func|optional|-|会传入返回的数据, 将其处理为 jsxdata 的格式并返回| | ||
|showSearch|func|optional|true|是否显示搜索栏| | ||
|tags|bool|optional|false|是否启用 tag 模式| | ||
|multiple|bool|optional|false|是否启用 multiple 模式| | ||
|allowClear|bool|optional|false|是否显示清除按钮| | ||
|searchPlaceholder|string|optional|""|搜索框默认文字| | ||
|combobox|bool|optional|false|标准搜索模式,在该模式下没有下拉框,通过输入产生提示| | ||
|placeholder|string|optional|"请下拉选择"|占位符| | ||
|disabled|boolean|optional|false|disable 状态| | ||
|optionLabelProp|string|optional|'children'|选择 Option 的哪个 prop 作为选择框中的显示。| | ||
|optionFilterProp|string|optional|-|输入项过滤对应的 option 属性| | ||
|dataType|string|optional|'json'|发送 ajax 请求的类型| | ||
see datails in [uxcore-select2](https://www.npmjs.com/package/uxcore-select2) | ||
此外,SelectFormField 还支持 [uxcore-select2](https://www.npmjs.com/package/uxcore-select2) 除 onSelect/onDeselect 外的全部属性。 | ||
@@ -181,0 +172,0 @@ ### CheckboxGroupFormField |
@@ -72,3 +72,2 @@ /** | ||
} | ||
// console.log(me.data); | ||
} | ||
@@ -75,0 +74,0 @@ |
@@ -9,2 +9,3 @@ /** | ||
let {Option} = Select; | ||
let selectOptions = ['multiple', 'filterOption', 'allowClear', 'combobox', 'searchPlaceholder', 'tags', 'disabled', 'showSearch', 'placeholder', 'optionLabelProp', 'maxTagTextLength', 'dropdownMatchSelectWidth', 'dropdownClassName', 'notFoundContent']; | ||
@@ -39,2 +40,37 @@ class SelectFormField extends FormField { | ||
componentDidMount() { | ||
let me = this; | ||
me.props.attachFormField(me); | ||
me.props.handleDataChange(me, { | ||
value: me.props.value, | ||
pass: true | ||
}, true); | ||
me.hasDeprecatedProps(); | ||
} | ||
handleDataChange(value, fromReset, label) { | ||
let me = this; | ||
me.setState({ | ||
value: value, | ||
label: label || [], | ||
formatValue: me.formatValue(value), | ||
error: !!fromReset ? false: me.state.error, | ||
/* | ||
* why set state fromReset? some field like editor cannot be reset in the common way | ||
* so set this state to tell the field that you need to reset by yourself. | ||
*/ | ||
fromReset: fromReset | ||
}, () => { | ||
let pass = true | ||
if (!fromReset) { | ||
pass = me.doValidate(); | ||
} | ||
me.props.handleDataChange(me, { | ||
value: value, | ||
pass: pass | ||
}); | ||
}); | ||
} | ||
fetchData(value) { | ||
@@ -44,7 +80,11 @@ let me = this; | ||
url: me.props.jsxfetchUrl, | ||
dataType: me.props.dataType || 'json', | ||
dataType: me.props.dataType, | ||
data: me.props.beforeFetch({q: value}), | ||
success: (data) => { | ||
let fetchData = me.props.afterFetch(data); | ||
if (!!me.props.jsxdata) { | ||
fetchData = assign({}, fetchData, me.props.jsxdata); | ||
} | ||
me.setState({ | ||
data: me.props.afterFetch(data) | ||
data: fetchData | ||
}); | ||
@@ -62,7 +102,7 @@ }, | ||
handleChange(value) { | ||
handleChange(value, label) { | ||
let me = this; | ||
me.handleDataChange(value); | ||
me.handleDataChange(value, false, label); | ||
} | ||
handleSearch(value, label) { | ||
handleSearch(value) { | ||
let me = this; | ||
@@ -72,2 +112,5 @@ if (me.props.jsxfetchUrl) { | ||
} | ||
else { | ||
me.props.onSearch(value); | ||
} | ||
} | ||
@@ -86,3 +129,3 @@ _processData() { | ||
let arr = values.map(function(value, index) { | ||
return <Option key={value}>{me.state.data[value]}</Option> | ||
return <Option key={value} title={me.state.data[value]}>{me.state.data[value]}</Option> | ||
}); | ||
@@ -112,3 +155,3 @@ return arr; | ||
if (hasDeprecated) { | ||
// console.warn("SelectFormField: props same as uxcore-select2 can be passed without prefix 'jsx' now (exclude style). we will remove the support of the props mentioned above with prefix 'jsx' at uxcore-form@1.3.0 ."); | ||
console.warn("SelectFormField: props same as uxcore-select2 can be passed without prefix 'jsx' now (exclude style). we will remove the support of the props mentioned above with prefix 'jsx' at uxcore-form@1.3.0 ."); | ||
} | ||
@@ -121,3 +164,3 @@ } | ||
let mode = me.props.jsxmode || me.props.mode; | ||
me.hasDeprecatedProps(); | ||
if (mode == Constants.MODE.EDIT) { | ||
@@ -128,2 +171,3 @@ let options = { | ||
optionLabelProp: "children", | ||
label: me.state.label || [], | ||
style: me.props.jsxstyle, | ||
@@ -144,3 +188,3 @@ multiple: me.props.jsxmultiple, | ||
['multiple', 'filterOption', 'allowClear', 'combobox', 'searchPlaceholder', 'tags', 'disabled', 'showSearch', 'placeholder', 'optionLabelProp'].forEach((item, index) => { | ||
selectOptions.forEach((item, index) => { | ||
if (item in me.props) { | ||
@@ -151,3 +195,3 @@ options[item] = me.props[item]; | ||
if (!me.props.jsxmultiple && !me.props.multiple || me.state.fromReset) { | ||
if (!me.props.combobox || me.state.fromReset) { | ||
options.value = me.state.value || []; | ||
@@ -185,3 +229,4 @@ } | ||
jsxsearchPlaceholder: React.PropTypes.string, | ||
optionFilterProp: React.PropTypes.string | ||
optionFilterProp: React.PropTypes.string, | ||
dataType: React.PropTypes.string | ||
}); | ||
@@ -200,5 +245,6 @@ SelectFormField.defaultProps = assign({}, FormField.defaultProps, { | ||
jsxsearchPlaceholder: "", | ||
optionFilterProp: "children" | ||
optionFilterProp: "children", | ||
dataType: 'json' | ||
}); | ||
module.exports = SelectFormField; |
@@ -46,3 +46,3 @@ /** | ||
let arr = [],renderTableProp={ | ||
mode: this.props.mode, | ||
// mode: this.props.mode, | ||
jsxdata: this.state.value | ||
@@ -54,7 +54,8 @@ }; | ||
$.extend(renderTableProp, passedProps); | ||
if (mode == Constants.MODE.EDIT) { | ||
arr.push(<div key="table" onBlur={this.onBlur.bind(this)}><Table {...renderTableProp} ref="table" /></div>); | ||
}else if (mode == Constants.MODE.VIEW) { | ||
arr.push(<Table key="table" {...renderTableProp} />); | ||
} | ||
// if (mode == Constants.MODE.EDIT) { | ||
// arr.push(<div key="table" onBlur={this.onBlur.bind(this)}><Table {...renderTableProp} ref="table" /></div>); | ||
// }else if (mode == Constants.MODE.VIEW) { | ||
// arr.push(<Table key="table" {...renderTableProp} />); | ||
// } | ||
arr.push(<Table key="table" {...renderTableProp} />); | ||
return arr; | ||
@@ -61,0 +62,0 @@ } |
@@ -38,3 +38,3 @@ { | ||
"react-dom": "~0.14.0", | ||
"uxcore-kuma": "^1.1.0", | ||
"uxcore-kuma": "~1.2.0", | ||
"webpack": "^1.10.5" | ||
@@ -41,0 +41,0 @@ }, |
{ | ||
"name": "uxcore-select2", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "select ui component for react", | ||
@@ -39,3 +39,3 @@ "main": "src/index.js", | ||
"react-dom": "~0.14.0", | ||
"uxcore-kuma": "^1.1.0", | ||
"uxcore-kuma": "~1.2.0", | ||
"webpack": "^1.12.6" | ||
@@ -46,3 +46,3 @@ }, | ||
"object-assign": "^2.0.0", | ||
"rc-select": "~4.9.1" | ||
"rc-select": "~5.1.2" | ||
}, | ||
@@ -49,0 +49,0 @@ "author": "", |
@@ -67,3 +67,4 @@ /** | ||
showIcon: true, | ||
steps: steps | ||
steps: steps, | ||
show: true | ||
}; | ||
@@ -92,8 +93,11 @@ } | ||
description: '这里是多信息的描述啊' | ||
}, { | ||
title: '进行中', | ||
description: '这里是多信息的耶哦耶哦哦耶哦耶' | ||
}, { | ||
},{ | ||
title: '又一个待运行', | ||
description: '描述啊描述啊' | ||
},{ | ||
title: '已完成', | ||
description: '这里是多信息的描述啊' | ||
},{ | ||
title: '已完成', | ||
description: '这里是多信息的描述啊' | ||
}] | ||
@@ -113,2 +117,9 @@ }) | ||
unmountComp() { | ||
let me = this; | ||
me.setState({ | ||
show: false | ||
}) | ||
} | ||
render() { | ||
@@ -119,4 +130,5 @@ return ( | ||
<button className='kuma-button kuma-button-sm' onClick={this.changeItem.bind(this)}>动态改变块的数量</button> | ||
<button className='kuma-button kuma-button-sm' onClick={this.unmountComp.bind(this)}>销毁组件</button> | ||
<p>基本用法</p> | ||
<Steps current={1} showIcon={this.state.showIcon}> | ||
{this.state.show ? <Steps current={1} showIcon={this.state.showIcon} ref="steps"> | ||
{ | ||
@@ -129,3 +141,3 @@ this.state.steps.map(function(s, i) { | ||
} | ||
</Steps> | ||
</Steps> : null} | ||
{/*<p>迷你版</p> | ||
@@ -132,0 +144,0 @@ <Steps size="small" current={1} showIcon={this.state.showIcon}>{steps}</Steps> |
# History | ||
## 1.0.4 | ||
`FIXED` fix issue #3, remove useless code which cause error. | ||
## 1.0.3 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "uxcore-steps", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "uxcore-steps component for uxcore.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/uxcore/uxcore-steps.git", |
@@ -34,3 +34,2 @@ /** | ||
for (i = 0; i <= len - 1; i++) { | ||
const $item = $dom.children[i].children; | ||
this._itemsWidth[i] = nextProps.maxDescriptionWidth; | ||
@@ -56,3 +55,2 @@ } | ||
for (i = 0; i <= len - 1; i++) { | ||
const $item = $dom.children[i].children; | ||
this._itemsWidth[i] = this.props.maxDescriptionWidth; | ||
@@ -79,6 +77,8 @@ } | ||
this._resizeBind = this._resize.bind(this) | ||
if (window.attachEvent) { | ||
window.attachEvent('onresize', this._resize.bind(this)); | ||
window.attachEvent('onresize', this._resizeBind); | ||
} else { | ||
window.addEventListener('resize', this._resize.bind(this)); | ||
window.addEventListener('resize', this._resizeBind); | ||
} | ||
@@ -107,6 +107,6 @@ } | ||
if (window.attachEvent) { | ||
window.detachEvent('onresize', this._resize); | ||
window.detachEvent('onresize', this._resizeBind); | ||
} | ||
else { | ||
window.removeEventListener('resize', this._resize); | ||
window.removeEventListener('resize', this._resizeBind); | ||
} | ||
@@ -113,0 +113,0 @@ } |
@@ -12,2 +12,3 @@ /** | ||
let Button = require('uxcore-button'); | ||
let urlPrefix = 'http://10.1.159.52:3000/'; | ||
let mockData = { | ||
@@ -62,2 +63,6 @@ "datas": [ | ||
hanldeFetchData() { | ||
this.refs.grid.fetchData(); | ||
} | ||
render () { | ||
@@ -134,2 +139,3 @@ | ||
width: 1000, | ||
height: 400, | ||
actionBar: { | ||
@@ -142,10 +148,12 @@ '新增': function(type, actions) { console.info(actions); alert(type) }, | ||
// jsxdata: mockData, | ||
//fetchUrl:"http://demo.nwux.taobao.net/file/getGridJson.jsonp", | ||
fetchUrl: "http://10.1.157.111:3000/demo/data.json", | ||
fetchUrl:"http://demo.nwux.taobao.net/file/getGridJson.jsonp", | ||
// fetchUrl: urlPrefix + "demo/data.json", | ||
jsxcolumns:columns, | ||
//subComp:(<Grid {...renderSubProps} ref="subGrid"/>), | ||
subComp:(<Grid {...renderSubProps} ref="subGrid"/>), | ||
rowSelection: rowSelection, | ||
addRowClassName: (rowData) => {}, | ||
beforeFetch: (sendData, from) => { return sendData;}, | ||
processData: (data) => {return data;} | ||
processData: (data) => { | ||
return data; | ||
} | ||
}; | ||
@@ -156,2 +164,3 @@ return ( | ||
<Button onClick={me.handleClick.bind(me)}>页面重新渲染</Button> | ||
<Button onClick={me.hanldeFetchData.bind(me)}>手动 fetchData</Button> | ||
</div> | ||
@@ -158,0 +167,0 @@ ); |
@@ -13,3 +13,2 @@ /** | ||
let Grid = require('../src'); | ||
console.log(Grid.Constants); | ||
let mockData = { | ||
@@ -52,9 +51,2 @@ "datas": [ | ||
onModifyRow(value,dataKey,record) { | ||
//doValidate | ||
//debugger; | ||
//return false; | ||
return true; | ||
} | ||
handleClick() { | ||
@@ -96,48 +88,22 @@ this.setState({ | ||
let doAction= function(rowData,e) { | ||
let el=$(e.target); | ||
if(el.hasClass('action')) { | ||
if( el.data('type') =='edit') { | ||
console.info(rowData,el.data('type')); | ||
}else if(el.data('type') =='del') { | ||
console.info(rowData,el.data('type')); | ||
} | ||
} | ||
} | ||
// title, width, type, hidden,dataKey | ||
// let columns = [ | ||
// { dataKey: 'jsxid',title:"jsxid",width: 40 }, | ||
// { dataKey: 'city',title:'城市很长很长很长很长很长很长很长很长很长很长', width: 220,type:'select' ,options:{ | ||
// 'hz':'杭州', | ||
// 'bj':'北京', | ||
// 'sh':'上海', | ||
// 'ah':'安徽' | ||
// }}, | ||
// { dataKey: 'name',title:"姓名",width: 200,type:"text"}, | ||
// { dataKey: 'email',title:"Email",width: 200,type:"text"}, | ||
// { dataKey: 'action1', title:'操作1', width:100, type:"action",actions:{ | ||
// "增加": function(rowData) { | ||
// me.refs.grid.addEmptyRow(); | ||
// }, | ||
// "删除": function(rowData) { | ||
// me.refs.grid.delRow(rowData); | ||
// } | ||
// } | ||
// } | ||
// ]; | ||
// Edit mode but no inline edit | ||
let columns = [ | ||
{ dataKey: 'check', title: '复选框', type: 'checkbox'}, | ||
{ dataKey: 'id', title: 'ID', width: 50,hidden:true}, | ||
{ dataKey: 'country', title:'国家国家国家国家', width: 200,ordered:true, type: "money", delimiter: ',', align: 'right'}, | ||
{ dataKey: 'country', title:'国家国家国家国家', width: 200,ordered:true, type: "money", delimiter: ','}, | ||
{ dataKey: 'country', title:'国家国家国家国家', width: 200,ordered:true, type: "money", delimiter: ','}, | ||
{ dataKey: 'country', title:'国家国家国家国家', width: 200,ordered:true, type: "money", delimiter: ','}, | ||
{ dataKey: 'country', title:'国家国家国家国家', width: 200,ordered:true, type: "money", delimiter: ','}, | ||
{ dataKey: 'country', title:'国家国家国家国家', width: 200,ordered:true, type: "money", delimiter: ','}, | ||
{ dataKey: 'country', title:'国家国家国家国家', width: 200,ordered:true, type: "money", delimiter: ','}, | ||
{ dataKey: 'country', title:'国家国家国家国家', width: 200,ordered:true, type: "money", delimiter: ','}, | ||
{ dataKey: 'country', title:'国家国家国家国家', width: 200,ordered:true, type: "money", delimiter: ','}, | ||
{ dataKey: 'country', title:'国家国家国家国家', width: 200,ordered:true, type: "money", delimiter: ','} | ||
{ dataKey: 'jsxid',title:"jsxid",width: 80 }, | ||
{ dataKey: 'city',title:'城市很长很长很长很长很长很长很长很长很长很长', width: 200,type:'select' ,options:{ | ||
'hz':'杭州', | ||
'bj':'北京', | ||
'sh':'上海', | ||
'ah':'安徽' | ||
}}, | ||
{ dataKey: 'name',title:"姓名",width: 200,type:"text"}, | ||
{ dataKey: 'email',title:"Email",width: 200,type:"text"}, | ||
{ dataKey: 'action1', title:'操作1', width:100, type:"action",actions:{ | ||
"增加": function(rowData) { | ||
me.refs.grid.addEmptyRow(); | ||
}, | ||
"删除": function(rowData) { | ||
me.refs.grid.delRow(rowData); | ||
} | ||
} | ||
} | ||
]; | ||
@@ -156,3 +122,3 @@ | ||
// jsxdata: me.state.data, | ||
fetchUrl:"http://demo.nwux.taobao.net/file/getGridJson.jsonp", | ||
// fetchUrl:"http://demo.nwux.taobao.net/file/getGridJson.jsonp", | ||
// fetchUrl: "http://10.1.159.52:3002/demo/data.json", | ||
@@ -159,0 +125,0 @@ jsxcolumns:columns, |
@@ -12,2 +12,3 @@ /** | ||
let Button = require('uxcore-button'); | ||
let urlPrefix = 'http://10.1.159.52:3000/'; | ||
let mockData = { | ||
@@ -133,3 +134,3 @@ "datas": [ | ||
height: 400, | ||
width: 1200, | ||
width: 1000, | ||
actionBar: { | ||
@@ -144,3 +145,3 @@ '新增': function(type, actions) { console.info(actions); alert(type) }, | ||
//fetchUrl:"http://demo.nwux.taobao.net/file/getGridJson.jsonp", | ||
fetchUrl: "http://10.1.157.111:3000/demo/data.json", | ||
fetchUrl: urlPrefix + "demo/data.json", | ||
jsxcolumns:columns, | ||
@@ -147,0 +148,0 @@ //subComp:(<Grid {...renderSubProps} ref="subGrid"/>), |
@@ -9,11 +9,11 @@ /** | ||
// var Demo = require('./GridDemo'); | ||
var Demo = require('./GridDemo'); | ||
var Demo2 = require('./GridEditDemo'); | ||
//var Demo3 = require('./TreeGridDemo'); | ||
// var Demo4 = require('./GridViewModeDemo'); | ||
var Demo3 = require('./TreeGridDemo'); | ||
var Demo4 = require('./GridViewModeDemo'); | ||
// ReactDOM.render(<Demo />, document.getElementById('UXCoreDemo')); | ||
ReactDOM.render(<Demo />, document.getElementById('UXCoreDemo')); | ||
ReactDOM.render(<Demo2 />, document.getElementById('UXCoreDemo2')); | ||
//ReactDOM.render(<Demo3/>, document.getElementById('UXCoreDemo3')); | ||
// ReactDOM.render(<Demo4/>, document.getElementById('UXCoreDemo4')); | ||
ReactDOM.render(<Demo3/>, document.getElementById('UXCoreDemo3')); | ||
ReactDOM.render(<Demo4/>, document.getElementById('UXCoreDemo4')); |
@@ -11,2 +11,3 @@ /** | ||
let Grid = require('../src'); | ||
let urlPrefix = 'http://10.1.159.52:3000/'; | ||
@@ -98,3 +99,3 @@ | ||
height: 400, | ||
width: 500, | ||
width: 800, | ||
actionBar: { | ||
@@ -107,3 +108,3 @@ '新增': function(type, actions) { console.info(actions); alert(type) }, | ||
// fetchUrl:"http://demo.nwux.taobao.net/file/getGridJson.jsonp", | ||
fetchUrl: "http://10.1.157.111:3000/demo/data.json", | ||
fetchUrl: urlPrefix + "demo/data.json", | ||
jsxcolumns:columns, | ||
@@ -110,0 +111,0 @@ renderModel:'tree', |
@@ -5,2 +5,6 @@ # History | ||
# 1.1.5 | ||
`FIXED` fix issue #60 #64 #65 #66 #68 #69 #70 #71 | ||
# 1.1.4 | ||
@@ -7,0 +11,0 @@ |
{ | ||
"name": "uxcore-table", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "table ui component for react", | ||
@@ -35,6 +35,6 @@ "repository": "https://github.com/uxcore/uxcore-table.git", | ||
"gulp-sourcemaps": "~1.5.2", | ||
"webpack": "^1.10.5", | ||
"jquery": "~2.1.4", | ||
"react": "^0.14.0", | ||
"uxcore-kuma": "~1.2.1", | ||
"react": "^0.14.0" | ||
"webpack": "^1.10.5" | ||
}, | ||
@@ -50,6 +50,6 @@ "dependencies": { | ||
"uxcore-validator": "~0.1.0", | ||
"uxcore-const":"~0.0.1" | ||
"uxcore-const": "~0.0.1" | ||
}, | ||
"contributors": [], | ||
"license": "MIT" | ||
} | ||
} |
@@ -194,3 +194,3 @@ /** | ||
} | ||
_v=<SelectField {...renderProps} /> | ||
_v = <SelectField {...renderProps} /> | ||
} | ||
@@ -197,0 +197,0 @@ else if (_column.type == 'money' || _column.type == "card" || _column.type == "cnmobile") { |
var util={ | ||
formatValue: (value, type, delimiter) => { | ||
delimiter = delimiter || " "; | ||
if (value === null || value === undefined) { | ||
return value; | ||
} | ||
value = value + ""; | ||
if (type == "money") { | ||
@@ -5,0 +9,0 @@ return value.replace(/(\d{3})(?![$|\.|\(])/g, "$1" + delimiter); |
/** | ||
* Grid Component for uxcore | ||
* Table Component for uxcore | ||
* @author zhouquan.yezq | ||
@@ -18,3 +18,3 @@ * | ||
class Grid extends React.Component { | ||
class Table extends React.Component { | ||
@@ -30,8 +30,8 @@ constructor(props) { | ||
currentPage: props.currentPage, // pagination 相关 | ||
activeColumn:null, | ||
searchTxt:"", | ||
passedData:null, | ||
params:null, | ||
activeColumn: null, | ||
searchTxt: "", | ||
passedData: null, | ||
params: null, | ||
selected: [], | ||
expanded:false | ||
expanded: false | ||
}; | ||
@@ -47,6 +47,2 @@ } | ||
me.el = ReactDOM.findDOMNode(me); | ||
// $(me.el).find(".kuma-uxtable-body-wrapper").on("scroll", function(e) { | ||
// let scrollLeft = this.scrollLeft; | ||
// $(me.el).find(".kuma-uxtable-header-wrapper")[0].scrollLeft = scrollLeft; | ||
// }) | ||
} | ||
@@ -169,8 +165,12 @@ | ||
success: function(result) { | ||
let _data = result.content; | ||
if(result.success) { | ||
if(result.success || !result.hasError) { | ||
let _data = result.content; | ||
let processedData = me.addJSXIdsForSD(me.props.processData(deepcopy(_data))); | ||
let updateObj= { | ||
data: me.addJSXIdsForSD(me.props.processData(deepcopy(_data))), | ||
data: processedData, | ||
showMask: false | ||
}; | ||
if (processedData.currentPage !== undefined) { | ||
updateObj.currentPage = processedData.currentPage; | ||
} | ||
me.setState(updateObj) | ||
@@ -220,3 +220,3 @@ } | ||
"data": { | ||
datas: [{ | ||
data: [{ | ||
jsxid:me.uid++ | ||
@@ -303,7 +303,8 @@ }], | ||
let me = this; | ||
let data = deepcopy(this.state.data); | ||
let _content = deepcopy(this.state.data); | ||
let _data = _content.datas || _content.data; | ||
data.datas.map(function(item,index) { | ||
if(item.jsxid==rowIndex) { | ||
item[me.checkboxColumnKey]=checked; | ||
_data.map((item,index) => { | ||
if (item.jsxid == rowIndex) { | ||
item[me.checkboxColumnKey] = checked; | ||
return item; | ||
@@ -315,10 +316,10 @@ } | ||
me.setState({ | ||
data: data | ||
data: _content | ||
}, () => { | ||
if (!fromMount) { | ||
let datas = me.state.data.datas; | ||
let selectedRows = datas.filter((item, index) => { | ||
let data = me.state.data.datas || me.state.data.data; | ||
let selectedRows = data.filter((item, index) => { | ||
return item[me.checkboxColumnKey] == true | ||
}); | ||
!!me.props.rowSelection && !!me.props.rowSelection.onSelect && me.props.rowSelection.onSelect(checked, datas[rowIndex], selectedRows) | ||
!!me.props.rowSelection && !!me.props.rowSelection.onSelect && me.props.rowSelection.onSelect(checked, data[rowIndex], selectedRows) | ||
} | ||
@@ -331,6 +332,7 @@ }) | ||
let me = this; | ||
let _data = deepcopy(me.state.data); | ||
let _content = deepcopy(me.state.data); | ||
let _data = _content.datas || _content.data; | ||
let rowSelection = me.props.rowSelection; | ||
_data.datas = _data.datas.map(function(item,index){ | ||
_data = _data.map((item,index) => { | ||
item[me.checkboxColumnKey] = checked; | ||
@@ -341,6 +343,6 @@ return item; | ||
if(!!rowSelection && !!rowSelection.onSelectAll) { | ||
rowSelection.onSelectAll.apply(null,[checked,_data]) | ||
rowSelection.onSelectAll.apply(null,[checked,_content]) | ||
} | ||
me.setState({ | ||
data: _data | ||
data: _content | ||
}) | ||
@@ -481,3 +483,3 @@ } | ||
columns: this.state.columns, | ||
data: this.state.data ? this.state.data.datas : [], | ||
data: this.state.data ? this.state.data.datas || this.state.data.data : [], | ||
onModifyRow: props.onModifyRow ? props.onModifyRow : function(){}, | ||
@@ -587,5 +589,6 @@ rowSelection: props.rowSelection, | ||
addJSXIdsForSD(objAux) { | ||
if ( !objAux || !objAux.datas) return; | ||
if ( !objAux || (!objAux.datas && !objAux.data)) return; | ||
var me = this; | ||
objAux.datas.forEach(function(node) { | ||
var data = objAux.datas || objAux.data; | ||
data.forEach(function(node) { | ||
node.jsxid = me.uid++; | ||
@@ -609,9 +612,14 @@ //_this.props.nodes.push(node); | ||
insertRecords(objAux) { | ||
let _data=$.extend(true,{},this.state.data); | ||
if(Object.prototype.toString.call(objAux)!=="[object Array]") { | ||
objAux=[objAux]; | ||
let _data = deepcopy(this.state.data); | ||
if (Object.prototype.toString.call(objAux) !== "[object Array]") { | ||
objAux = [objAux]; | ||
} | ||
objAux= this.addJSXIdsForRecord(objAux); | ||
_data.datas= objAux.concat(_data.datas); | ||
objAux = this.addJSXIdsForRecord(objAux); | ||
if (!!_data.datas) { | ||
_data.datas = objAux.concat(_data.datas); | ||
} | ||
else if (!!_data.data) { | ||
_data.data = objAux.concat(_data.data); | ||
} | ||
_data.totalCount++; | ||
@@ -626,11 +634,27 @@ this.setState({ | ||
*/ | ||
updataRecord(objAux) { | ||
let _data= this.state.data; | ||
if(_data && _data.datas) { | ||
_data.datas=_data.datas.map(item=> { if(item.jsxid==objAux.jsxid){ | ||
return objAux; | ||
}else { | ||
return item; | ||
}}) | ||
updateRecord(objAux) { | ||
let _data = this.state.data; | ||
if (!_data) { | ||
return; | ||
} | ||
if (_data.data || _data.datas) { | ||
let data = _data.data || data.datas | ||
data = data.map((item) => { | ||
if (item.jsxid == objAux.jsxid) { | ||
return objAux; | ||
} | ||
else { | ||
return item; | ||
} | ||
}); | ||
if (!!_data.data) { | ||
_data.data = data | ||
} | ||
else if (!!_data.datas) { | ||
_data.datas = data; | ||
} | ||
} | ||
this.setState({ | ||
@@ -643,16 +667,22 @@ data: _data | ||
//at least one record | ||
if(this.state.data.datas.length==1){ | ||
return ; | ||
} | ||
let _data=$.extend(true,{},this.state.data),_newArr; | ||
//at least one record | ||
let content = this.state.data | ||
let data = content.data || content._data; | ||
if(Object.prototype.toString.call(objAux)!=="[object Array]") { | ||
objAux=[objAux]; | ||
} | ||
if (data.length == 1){ | ||
return; | ||
} | ||
// deepcopy protect | ||
let _content = deepcopy(content), | ||
_data = _content.data || _content.datas, | ||
_newArr; | ||
if (Object.prototype.toString.call(objAux) !== "[object Array]") { | ||
objAux = [objAux]; | ||
} | ||
objAux.map(function(item) { | ||
_data.datas.forEach(function(element, index, array) { | ||
if(element.jsxid==item.jsxid) { | ||
_data.datas.splice(index,1); | ||
_data.forEach(function(element, index, array) { | ||
if (element.jsxid == item.jsxid) { | ||
_data.splice(index, 1); | ||
} | ||
@@ -663,3 +693,3 @@ }) | ||
this.setState({ | ||
data: _data | ||
data: _content | ||
}); | ||
@@ -672,3 +702,3 @@ | ||
addEmptyRow() { | ||
this.insertRecords({}); | ||
this.insertRecords({}); | ||
} | ||
@@ -689,13 +719,18 @@ | ||
toggleSubComp(rowData) { | ||
let _data= this.state.data; | ||
if(_data && _data.datas) { | ||
_data.datas=_data.datas.map(item=> { if(item.jsxid==rowData.jsxid){ | ||
item.showSubComp= !item.showSubComp; | ||
return item; | ||
}else { | ||
return item; | ||
}}) | ||
let _content = deepcopy(this.state.data); | ||
let _data = _content.datas || _content.datas; | ||
if(_data) { | ||
_data = _data.map((item) => { | ||
if (item.jsxid == rowData.jsxid) { | ||
item.showSubComp= !item.showSubComp; | ||
return item; | ||
} | ||
else { | ||
return item; | ||
} | ||
}); | ||
} | ||
this.setState({ | ||
data: _data | ||
data: _content | ||
}) | ||
@@ -706,3 +741,3 @@ } | ||
Grid.defaultProps = { | ||
Table.defaultProps = { | ||
jsxprefixCls: "kuma-uxtable", | ||
@@ -732,3 +767,3 @@ showHeader:true, | ||
// http://facebook.github.io/react/docs/reusable-components.html | ||
Grid.propTypes = { | ||
Table.propTypes = { | ||
processData: React.PropTypes.func, | ||
@@ -739,5 +774,5 @@ beforeFetch: React.PropTypes.func, | ||
Grid.displayName = Grid; | ||
Grid.Constants = Const; | ||
Table.displayName = Table; | ||
Table.Constants = Const; | ||
module.exports = Grid; | ||
module.exports = Table; |
@@ -34,4 +34,7 @@ /** | ||
// merge classname scroll/no/fixed | ||
if (this.props.fixedColumn=='no') { | ||
$('.kuma-uxtable-header-no').animate({scrollLeft: $('.kuma-uxtable-body-no').scrollLeft()}, 0) | ||
this.el = ReactDOM.findDOMNode(this); | ||
let $tableEl = $(this.el).parents(".kuma-uxtable"); | ||
if (this.props.fixedColumn == 'no') { | ||
$tableEl.find('.kuma-uxtable-header-no').animate({scrollLeft: $tableEl.find('.kuma-uxtable-body-no').scrollLeft()}, 0) | ||
return; | ||
@@ -42,6 +45,7 @@ } | ||
if(target.hasClass('kuma-uxtable-body-scroll')) { | ||
$('.kuma-uxtable-body-fixed').animate({scrollTop: $('.kuma-uxtable-body-scroll').scrollTop()}, 0) | ||
$('.kuma-uxtable-header-scroll').animate({scrollLeft: $('.kuma-uxtable-body-scroll').scrollLeft()}, 0) | ||
$tableEl.find('.kuma-uxtable-body-fixed').animate({scrollTop: $tableEl.find('.kuma-uxtable-body-scroll').scrollTop()}, 0) | ||
$tableEl.find('.kuma-uxtable-header-scroll').animate({scrollLeft: $tableEl.find('.kuma-uxtable-body-scroll').scrollLeft()}, 0) | ||
}else { | ||
$('.kuma-uxtable-body-scroll').animate({scrollTop: $('.kuma-uxtable-body-fixed').scrollTop()}, 0) | ||
$tableEl.find('.kuma-uxtable-body-scroll').animate({scrollTop: $tableEl.find('.kuma-uxtable-body-fixed').scrollTop()}, 0) | ||
} | ||
@@ -48,0 +52,0 @@ |
@@ -0,1 +1,6 @@ | ||
# 0.2.3 | ||
`NEW` add API `reset` | ||
`CHANGE` update style | ||
# 0.2.2 | ||
@@ -7,6 +12,6 @@ | ||
`FIX` fix bug when reset prop data. | ||
`FIX` fix bug when reset prop data. | ||
# 0.2.0 | ||
`NEW` add searchBar & disable mode | ||
`NEW` add searchBar & disable mode |
{ | ||
"name": "uxcore-transfer", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "transfer ui component for react", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -79,2 +79,3 @@ # uxcore-transfer | ||
* arr `Array` 一个由 value 组成的数组。 | ||
* reset(): 使 Transfer 回到与 data 对应的状态。 | ||
@@ -81,0 +82,0 @@ ## Props |
@@ -54,2 +54,6 @@ let classnames = require('classnames'); | ||
/** | ||
* 重置,取消所有的用户操作 | ||
*/ | ||
reset() { | ||
@@ -119,3 +123,3 @@ let me = this; | ||
value = leftSearch.value; | ||
} | ||
} | ||
else { | ||
@@ -136,3 +140,3 @@ value = rightSearch.value; | ||
item.chosen = !item.chosen; | ||
return item; | ||
return item; | ||
}).concat(arr2); | ||
@@ -195,3 +199,3 @@ | ||
<a className={classnames({ | ||
"selected": !!item.selected | ||
"selected": !!item.selected | ||
})} href="javascript:;" title={item.description}>{item.name}</a> | ||
@@ -240,3 +244,3 @@ </li> | ||
<tr> | ||
<th className="fn-clear"> | ||
<th className="fn-clear left-head"> | ||
<span className="title">{me.props.leftTitle}</span> | ||
@@ -246,3 +250,3 @@ {me._renderSearch("unChosen")} | ||
<th> </th> | ||
<th className="fn-clear"> | ||
<th className="fn-clear right-head"> | ||
<span className="title">{me.props.rightTitle}</span> | ||
@@ -255,3 +259,3 @@ {me._renderSearch("chosen")} | ||
<tr> | ||
<td> | ||
<td className="left-block"> | ||
<ul ref="leftBlock" className={classnames({ | ||
@@ -276,3 +280,3 @@ "kuma-uxtransfer-block": true | ||
</td> | ||
<td> | ||
<td className="right-block"> | ||
<ul ref="rightBlock" className={classnames({ | ||
@@ -296,4 +300,4 @@ "kuma-uxtransfer-block": true | ||
data: [], | ||
leftTitle: '未选中的', | ||
rightTitle: '已选中的', | ||
leftTitle: '未选中', | ||
rightTitle: '已选中', | ||
disabled: false, | ||
@@ -313,2 +317,2 @@ showSearch: true, | ||
module.exports = Transfer; | ||
module.exports = Transfer; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4376912
604
46999
58
49