Skip to content

Commit 950dcb7

Browse files
Merge pull request #4 from iron-tech-space/editable_table
Fix bugs with Form, Table, Modal, Select
2 parents 6d0fbdb + 85ee43e commit 950dcb7

File tree

13 files changed

+52
-32
lines changed

13 files changed

+52
-32
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
## 0.0.72
2+
3+
- Add initFormData in Form dispatch
4+
- Add className and style in Rt Table
5+
- Move Modal dispatch in request
6+
- Fix radical id in Select
7+
18
## 0.0.71
29

3-
- Fix select lose param
10+
- Fix select lose param
411
- Fix modal requestSaveForm
512

613
## 0.0.70

dist/index.es.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.es.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/components/Modal/Modal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ var Modal = function Modal(props) {
132132

133133
dispatchToStore({ dispatch: dispatch, setDateStore: props.setDateStore, value: saveObj });
134134

135-
if (modalProps.requestSaveRow && modalProps.methodSaveForm) {
135+
if (modalProps.requestSaveForm && modalProps.methodSaveForm) {
136136
// console.log("Modal Events => type: ", type, method, row, _modalData);
137-
modalProps.requestSaveRow({
137+
modalProps.requestSaveForm({
138138
method: modalProps.methodSaveForm,
139139
data: saveObj
140140
}).then(function (response) {

lib/components/Select/Select.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { generateUUID, getObjectExcludedProps, notificationError, useMounted } f
1818

1919
import { CheckOutlined } from '@ant-design/icons';
2020

21-
var excludeProps = ['componentType', 'defaultSortBy', 'defaultFilter', 'defaultSearchValue', 'sortBy', 'filter', 'searchValue', 'searchParamName', 'infinityMode', 'requestLoadRows', 'optionConverter', 'options', 'widthControl', 'pageSize'];
21+
var excludeProps = ['componentType', 'defaultSortBy', 'defaultFilter', 'defaultSearchValue', 'sortBy', 'filter', 'searchValue', 'searchParamName', 'lostParamName', 'infinityMode', 'requestLoadRows', 'optionConverter', 'options', 'widthControl', 'pageSize'];
2222

2323
/** Компонент выбора элемента(ов) из списка */
2424
var Select = function Select(props) {
@@ -61,7 +61,7 @@ var Select = function Select(props) {
6161
_options = _useState6[0],
6262
_setOptions = _useState6[1];
6363

64-
var _useState7 = useState({}),
64+
var _useState7 = useState(undefined),
6565
_useState8 = _slicedToArray(_useState7, 2),
6666
tmpOption = _useState8[0],
6767
setTmpOption = _useState8[1];
@@ -149,13 +149,13 @@ var Select = function Select(props) {
149149
}, 0) === options.length) _setIsSelectAll(true);else _setIsSelectAll(false);
150150
onChange(value);
151151
} else {
152-
if (options && options.findIndex(function (option) {
152+
if (value && options && options.findIndex(function (option) {
153153
return option.value === value;
154154
}) === -1) {
155-
// console.log('Load tmpOption');
155+
console.log('Load tmpOption');
156156
_loadTmpOption();
157157
} else {
158-
// console.log('Clear tmpOption');
158+
console.log('Clear tmpOption');
159159
setTmpOption(undefined);
160160
}
161161
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rt-design",
3-
"version": "0.0.71",
3+
"version": "0.0.72",
44
"description": "React technical design library",
55
"author": "Iron tech space",
66
"license": "MIT",

src/components/Form/Form.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ const Form = (props) => {
123123
onFinish={onFinish}
124124
onFinishFailed={onFinishFailed}
125125
onFieldsChange={(changedFields, allFields) => {
126-
const values = antForm.getFieldsValue();
126+
const values = {
127+
...initFormData,
128+
...antForm.getFieldsValue(),
129+
};
127130
// console.log('dispatchToStore => ', dispatch, values);
128131
dispatch && dispatchToStore({ dispatch, setDateStore, value: values })}
129132
}

src/components/Modal/Modal.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ const Modal = props => {
9696
// console.log("Modal Events => before dispatchToStore: ", dispatch);
9797
const saveObj = {..._modalData, ...values};
9898

99-
dispatchToStore({dispatch, setDateStore: props.setDateStore, value: saveObj});
100-
10199
if (modalProps.requestSaveForm && modalProps.methodSaveForm) {
102100
// console.log("Modal Events => type: ", type, method, row, _modalData);
103101
modalProps.requestSaveForm({
@@ -110,16 +108,16 @@ const Modal = props => {
110108
});
111109
modalProps.onOk && modalProps.onOk(saveObj, response.data);
112110
modalProps.onFinish && modalProps.onFinish(saveObj, response.data);
111+
dispatchToStore({dispatch, setDateStore: props.setDateStore, value: saveObj});
113112
_onCloseModal();
114113
})
115114
.catch(error => notificationError(error, 'Ошибка при сохранении'));
116115
} else {
117116
modalProps.onOk && modalProps.onOk(saveObj);
118117
modalProps.onFinish && modalProps.onFinish(saveObj);
118+
dispatchToStore({dispatch, setDateStore: props.setDateStore, value: saveObj});
119119
_onCloseModal();
120120
}
121-
122-
123121
};
124122

125123
const onFinishFailedHandler = (errorInfo) => {

0 commit comments

Comments
 (0)