sz-mx-cabin
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -314,2 +314,17 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
}); | ||
}; //setdata特殊调用 只修改data,如果同时修改data和attrs会导致setattrs不生效 暂未发现问题 -mjh | ||
var handlesetData = function handlesetData(data) { | ||
var _parseHandleData2 = parseHandleData(data, mainGeneratorState.attributes, datePickerConversionConfig, tableSummaryObj), | ||
resultData = _parseHandleData2.resultData, | ||
attrs = _parseHandleData2.attrs; | ||
dispatch({ | ||
type: 'updateData', | ||
payload: { | ||
data: resultData, | ||
attributes: attrs | ||
} | ||
}); | ||
}; //路由跳转 | ||
@@ -345,3 +360,3 @@ | ||
var DLCUtil = { | ||
setData: handleData, | ||
setData: handlesetData, | ||
setAttrs: function setAttrs(attrs) { | ||
@@ -506,3 +521,3 @@ dispatch({ | ||
} | ||
}, [isPageFunctionRevert, esPageFunction, JSON.stringify(mainGeneratorState)]); // 处理函数的接口 input上事件配置onEventHandler | ||
}, [isPageFunctionRevert, esPageFunction, JSON.stringify(mainGeneratorState.pageFunction)]); // 处理函数的接口 input上事件配置onEventHandler | ||
// inputName 。。好多input 用同一个onChange方法的情况 | ||
@@ -603,2 +618,39 @@ | ||
} | ||
} else if (eventName == 'tableSelectionOnSelect') { | ||
// table数据选择模式 的 selectedKeys和selectedRowData受控 | ||
var record = leftParams[0], | ||
selected = leftParams[1], | ||
_selectedRows = leftParams[2], | ||
nativeEvent = leftParams[3], | ||
_selectedRowKeys = leftParams[4]; | ||
cloneAttributes[tableName]['attributes']['selectedKeys'] = _selectedRowKeys; // cloneAttributes[tableName]["attributes"]["selectedRowData"] = selectedRows; | ||
dispatch({ | ||
type: 'updateAttrs', | ||
payload: { | ||
attributes: cloneAttributes | ||
} | ||
}); | ||
if (fnName) { | ||
pageFunctionObj[fnName].apply(pageFunctionObj, [cloneData, cloneAttributes, propOptions, componentName].concat(leftParams)); | ||
} | ||
} else if (eventName == 'tableSelectionOnSelectAll') { | ||
// table数据选择模式 的 selectedKeys和selectedRowData受控 | ||
var _selected = leftParams[0], | ||
_selectedRows2 = leftParams[1], | ||
changeRows = leftParams[2], | ||
_selectedRowKeys2 = leftParams[3]; | ||
cloneAttributes[tableName]['attributes']['selectedKeys'] = _selectedRowKeys2; // cloneAttributes[tableName]["attributes"]["selectedRowData"] = selectedRows; | ||
dispatch({ | ||
type: 'updateAttrs', | ||
payload: { | ||
attributes: cloneAttributes | ||
} | ||
}); | ||
if (fnName) { | ||
pageFunctionObj[fnName].apply(pageFunctionObj, [cloneData, cloneAttributes, propOptions, componentName].concat(leftParams)); | ||
} | ||
} else if (eventName == 'tableOnChange') { | ||
@@ -652,5 +704,5 @@ // table的onChange事件 分页、排序、筛选变化时触发 | ||
var currentValue = leftParams[0]; | ||
var record = leftParams[1]; | ||
var _record = leftParams[1]; | ||
if (currentValue != record[componentName]) { | ||
if (currentValue != _record[componentName]) { | ||
var _parseHandleOnBlurDat = parseHandleOnBlurData(cloneData, cloneAttributes, tableName, componentName, leftParams), | ||
@@ -673,7 +725,7 @@ newData = _parseHandleOnBlurDat.newData, | ||
var _currentValue = leftParams[0]; | ||
var _record = leftParams[1]; | ||
_record[componentName] = _currentValue; | ||
var _record2 = leftParams[1]; | ||
_record2[componentName] = _currentValue; | ||
var rowIndex = leftParams[2]; | ||
var _newData = cloneData; | ||
_newData[tableName][rowIndex] = _record; | ||
_newData[tableName][rowIndex] = _record2; | ||
dispatch({ | ||
@@ -690,3 +742,5 @@ type: 'updateData', | ||
} else { | ||
pageFunctionObj[fnName].apply(pageFunctionObj, [cloneData, cloneAttributes, propOptions, componentName].concat(leftParams)); | ||
if (fnName && pageFunctionObj[fnName]) { | ||
pageFunctionObj[fnName].apply(pageFunctionObj, [cloneData, cloneAttributes, propOptions, componentName].concat(leftParams)); | ||
} | ||
} | ||
@@ -811,3 +865,3 @@ }; | ||
} | ||
}, [pageFunctionObj, JSON.stringify(mainGeneratorState ? mainGeneratorState : {})]); | ||
}, [pageFunctionObj]); | ||
return /*#__PURE__*/React.createElement(React.Fragment, null, props.isDialog ? /*#__PURE__*/React.createElement(Modal, _extends({ | ||
@@ -814,0 +868,0 @@ title: dialogOptions.title, |
@@ -16,3 +16,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
import React, { useEffect, useRef, useState } from 'react'; | ||
import { Table, Typography } from 'dw-mx'; | ||
import { Table, Typography, message } from 'dw-mx'; | ||
var Text = Typography.Text; | ||
@@ -141,12 +141,24 @@ import { getTableColumns } from './TableColumnsUtil'; | ||
selectedRowKeys: attrs[tableName]['attributes']['selectedKeys'], | ||
onChange: function onChange(selectedRowKeys, selectedRows) { | ||
onTableEventHandler({ | ||
fnName: onSelectChange, | ||
eventName: 'tableSelectionOnchange', | ||
tableName: tableName, | ||
componentName: tableName | ||
}, selectedRowKeys, selectedRows); | ||
}, | ||
// onChange: (selectedRowKeys, selectedRows) => { | ||
// onTableEventHandler( | ||
// { | ||
// fnName: onSelectChange, | ||
// eventName: 'tableSelectionOnchange', | ||
// tableName: tableName, | ||
// componentName: tableName, | ||
// }, | ||
// selectedRowKeys, | ||
// selectedRows | ||
// ); | ||
// }, | ||
onSelect: function onSelect(record, selected, selectedRows, nativeEvent) { | ||
if (_onSelect) { | ||
if (attrs[tableName]['attributes']['rowKey'] == '' || attrs[tableName]['attributes']['rowKey'] == null) { | ||
message.error("未配置rowKey,请检查!"); | ||
return; | ||
} | ||
var selectedRowKeys = selectedRows.map(function (item) { | ||
return item[attrs[tableName]['attributes']['rowKey']]; | ||
}); | ||
onTableEventHandler({ | ||
@@ -157,3 +169,3 @@ fnName: _onSelect, | ||
componentName: tableName | ||
}, record, selected, selectedRows, nativeEvent); | ||
}, record, selected, selectedRows, nativeEvent, selectedRowKeys); | ||
} | ||
@@ -163,2 +175,10 @@ }, | ||
if (_onSelectAll) { | ||
if (attrs[tableName]['attributes']['rowKey'] == '' || attrs[tableName]['attributes']['rowKey'] == null) { | ||
message.error("未配置rowKey,请检查!"); | ||
return; | ||
} | ||
var selectedRowKeys = selectedRows.map(function (item) { | ||
return item[attrs[tableName]['attributes']['rowKey']]; | ||
}); | ||
onTableEventHandler({ | ||
@@ -169,3 +189,3 @@ fnName: _onSelectAll, | ||
componentName: tableName | ||
}, selected, selectedRows, changeRows); | ||
}, selected, selectedRows, changeRows, selectedRowKeys); | ||
} | ||
@@ -172,0 +192,0 @@ } |
@@ -342,2 +342,17 @@ "use strict"; | ||
}); | ||
}; //setdata特殊调用 只修改data,如果同时修改data和attrs会导致setattrs不生效 暂未发现问题 -mjh | ||
var handlesetData = function handlesetData(data) { | ||
var _parseHandleData2 = (0, _UIGeneratorUtils.parseHandleData)(data, mainGeneratorState.attributes, datePickerConversionConfig, tableSummaryObj), | ||
resultData = _parseHandleData2.resultData, | ||
attrs = _parseHandleData2.attrs; | ||
dispatch({ | ||
type: 'updateData', | ||
payload: { | ||
data: resultData, | ||
attributes: attrs | ||
} | ||
}); | ||
}; //路由跳转 | ||
@@ -373,3 +388,3 @@ | ||
var DLCUtil = { | ||
setData: handleData, | ||
setData: handlesetData, | ||
setAttrs: function setAttrs(attrs) { | ||
@@ -535,3 +550,3 @@ dispatch({ | ||
} | ||
}, [isPageFunctionRevert, esPageFunction, JSON.stringify(mainGeneratorState)]); // 处理函数的接口 input上事件配置onEventHandler | ||
}, [isPageFunctionRevert, esPageFunction, JSON.stringify(mainGeneratorState.pageFunction)]); // 处理函数的接口 input上事件配置onEventHandler | ||
// inputName 。。好多input 用同一个onChange方法的情况 | ||
@@ -632,2 +647,39 @@ | ||
} | ||
} else if (eventName == 'tableSelectionOnSelect') { | ||
// table数据选择模式 的 selectedKeys和selectedRowData受控 | ||
var record = leftParams[0], | ||
selected = leftParams[1], | ||
_selectedRows = leftParams[2], | ||
nativeEvent = leftParams[3], | ||
_selectedRowKeys = leftParams[4]; | ||
cloneAttributes[tableName]['attributes']['selectedKeys'] = _selectedRowKeys; // cloneAttributes[tableName]["attributes"]["selectedRowData"] = selectedRows; | ||
dispatch({ | ||
type: 'updateAttrs', | ||
payload: { | ||
attributes: cloneAttributes | ||
} | ||
}); | ||
if (fnName) { | ||
pageFunctionObj[fnName].apply(pageFunctionObj, [cloneData, cloneAttributes, propOptions, componentName].concat(leftParams)); | ||
} | ||
} else if (eventName == 'tableSelectionOnSelectAll') { | ||
// table数据选择模式 的 selectedKeys和selectedRowData受控 | ||
var _selected = leftParams[0], | ||
_selectedRows2 = leftParams[1], | ||
changeRows = leftParams[2], | ||
_selectedRowKeys2 = leftParams[3]; | ||
cloneAttributes[tableName]['attributes']['selectedKeys'] = _selectedRowKeys2; // cloneAttributes[tableName]["attributes"]["selectedRowData"] = selectedRows; | ||
dispatch({ | ||
type: 'updateAttrs', | ||
payload: { | ||
attributes: cloneAttributes | ||
} | ||
}); | ||
if (fnName) { | ||
pageFunctionObj[fnName].apply(pageFunctionObj, [cloneData, cloneAttributes, propOptions, componentName].concat(leftParams)); | ||
} | ||
} else if (eventName == 'tableOnChange') { | ||
@@ -681,5 +733,5 @@ // table的onChange事件 分页、排序、筛选变化时触发 | ||
var currentValue = leftParams[0]; | ||
var record = leftParams[1]; | ||
var _record = leftParams[1]; | ||
if (currentValue != record[componentName]) { | ||
if (currentValue != _record[componentName]) { | ||
var _parseHandleOnBlurDat = (0, _UIGeneratorUtils.parseHandleOnBlurData)(cloneData, cloneAttributes, tableName, componentName, leftParams), | ||
@@ -702,7 +754,7 @@ newData = _parseHandleOnBlurDat.newData, | ||
var _currentValue = leftParams[0]; | ||
var _record = leftParams[1]; | ||
_record[componentName] = _currentValue; | ||
var _record2 = leftParams[1]; | ||
_record2[componentName] = _currentValue; | ||
var rowIndex = leftParams[2]; | ||
var _newData = cloneData; | ||
_newData[tableName][rowIndex] = _record; | ||
_newData[tableName][rowIndex] = _record2; | ||
dispatch({ | ||
@@ -719,3 +771,5 @@ type: 'updateData', | ||
} else { | ||
pageFunctionObj[fnName].apply(pageFunctionObj, [cloneData, cloneAttributes, propOptions, componentName].concat(leftParams)); | ||
if (fnName && pageFunctionObj[fnName]) { | ||
pageFunctionObj[fnName].apply(pageFunctionObj, [cloneData, cloneAttributes, propOptions, componentName].concat(leftParams)); | ||
} | ||
} | ||
@@ -840,3 +894,3 @@ }; | ||
} | ||
}, [pageFunctionObj, JSON.stringify(mainGeneratorState ? mainGeneratorState : {})]); | ||
}, [pageFunctionObj]); | ||
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, props.isDialog ? /*#__PURE__*/_react["default"].createElement(_dwMx.Modal, _extends({ | ||
@@ -843,0 +897,0 @@ title: dialogOptions.title, |
@@ -165,12 +165,25 @@ "use strict"; | ||
selectedRowKeys: attrs[tableName]['attributes']['selectedKeys'], | ||
onChange: function onChange(selectedRowKeys, selectedRows) { | ||
onTableEventHandler({ | ||
fnName: onSelectChange, | ||
eventName: 'tableSelectionOnchange', | ||
tableName: tableName, | ||
componentName: tableName | ||
}, selectedRowKeys, selectedRows); | ||
}, | ||
// onChange: (selectedRowKeys, selectedRows) => { | ||
// onTableEventHandler( | ||
// { | ||
// fnName: onSelectChange, | ||
// eventName: 'tableSelectionOnchange', | ||
// tableName: tableName, | ||
// componentName: tableName, | ||
// }, | ||
// selectedRowKeys, | ||
// selectedRows | ||
// ); | ||
// }, | ||
onSelect: function onSelect(record, selected, selectedRows, nativeEvent) { | ||
if (_onSelect) { | ||
if (attrs[tableName]['attributes']['rowKey'] == '' || attrs[tableName]['attributes']['rowKey'] == null) { | ||
_dwMx.message.error("未配置rowKey,请检查!"); | ||
return; | ||
} | ||
var selectedRowKeys = selectedRows.map(function (item) { | ||
return item[attrs[tableName]['attributes']['rowKey']]; | ||
}); | ||
onTableEventHandler({ | ||
@@ -181,3 +194,3 @@ fnName: _onSelect, | ||
componentName: tableName | ||
}, record, selected, selectedRows, nativeEvent); | ||
}, record, selected, selectedRows, nativeEvent, selectedRowKeys); | ||
} | ||
@@ -187,2 +200,11 @@ }, | ||
if (_onSelectAll) { | ||
if (attrs[tableName]['attributes']['rowKey'] == '' || attrs[tableName]['attributes']['rowKey'] == null) { | ||
_dwMx.message.error("未配置rowKey,请检查!"); | ||
return; | ||
} | ||
var selectedRowKeys = selectedRows.map(function (item) { | ||
return item[attrs[tableName]['attributes']['rowKey']]; | ||
}); | ||
onTableEventHandler({ | ||
@@ -193,3 +215,3 @@ fnName: _onSelectAll, | ||
componentName: tableName | ||
}, selected, selectedRows, changeRows); | ||
}, selected, selectedRows, changeRows, selectedRowKeys); | ||
} | ||
@@ -196,0 +218,0 @@ } |
{ | ||
"name": "sz-mx-cabin", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "reactCabin", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1163552
25126