@portnet/ui 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -104,7 +104,8 @@ const PuiSpecificReferentielField = _ref2 => {
|
|
|
104
104
|
getReturnedValue,
|
|
105
105
|
getRenderedValue,
|
|
106
106
|
onChange,
|
|
107
|
-
onError
|
|
107
|
+
onError,
|
|
108
|
+
customSubmitHandler
|
|
108
109
|
} = _ref2;
|
|
109
110
|
const {
|
|
110
111
|
token,
|
|
@@ -122,7 +123,7 @@ const PuiSpecificReferentielField = _ref2 => {
|
|
|
122
123
|
payload: pageNumber
|
|
123
124
|
});
|
|
124
125
|
};
|
|
125
|
-
const
|
|
126
|
+
const defaultSubmitHandler = async values => {
|
|
126
127
|
try {
|
|
127
128
|
dataFetchingDispatch({
|
|
128
129
|
type: "GET_DATA"
|
|
@@ -152,6 +153,13 @@ const PuiSpecificReferentielField = _ref2 => {
|
|
|
152
153
|
onError(error);
|
|
153
154
|
}
|
|
154
155
|
};
|
|
156
|
+
const submitHandler = async (values, formikBag) => {
|
|
157
|
+
if (customSubmitHandler) {
|
|
158
|
+
return customSubmitHandler(values, formikBag);
|
|
159
|
+
} else {
|
|
160
|
+
return defaultSubmitHandler(values, formikBag);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
155
163
|
React.useEffect(() => {
|
|
156
164
|
if (isMounted) {
|
|
157
165
|
var _formRef$current;
|
|
@@ -307,7 +315,8 @@ PuiSpecificReferentielField.propTypes = {
|
|
|
307
315
|
getRenderedValue: _propTypes.default.func.isRequired,
|
|
308
316
|
getReturnedValue: _propTypes.default.func,
|
|
309
317
|
onChange: _propTypes.default.func,
|
|
310
|
-
onError: _propTypes.default.func
|
|
318
|
+
onError: _propTypes.default.func,
|
|
319
|
+
customSubmitHandler: _propTypes.default.func
|
|
311
320
|
};
|
|
312
321
|
PuiSpecificReferentielField.defaultProps = {
|
|
313
322
|
disabled: false,
|
|
@@ -320,6 +329,7 @@ PuiSpecificReferentielField.defaultProps = {
|
|
|
320
329
|
tableProps: {},
|
|
321
330
|
getReturnedValue: row => row,
|
|
322
331
|
onError: () => {},
|
|
323
|
-
onChange: () => {}
|
|
332
|
+
onChange: () => {},
|
|
333
|
+
customSubmitHandler: null
|
|
324
334
|
};
|
|
325
335
|
var _default = exports.default = PuiSpecificReferentielField;
|
|
@@ -102,9 +102,9 @@ const PuiSearchPage = _ref2 => {
|
|
|
102
102
|
color: "tertiary",
|
|
103
103
|
children: "Effacer"
|
|
104
104
|
})
|
|
105
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
105
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
106
106
|
item: true,
|
|
107
|
-
children:
|
|
107
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
108
108
|
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
109
109
|
type: "rechercher",
|
|
110
110
|
size: "small"
|
|
@@ -112,16 +112,16 @@ const PuiSearchPage = _ref2 => {
|
|
|
112
112
|
onClick: submitForm,
|
|
113
113
|
loadingPosition: "start",
|
|
114
114
|
children: "Rechercher"
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
})
|
|
115
|
+
})
|
|
116
|
+
}), additionalActions && additionalActions.map((actionItem, index) => {
|
|
117
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiGrid.default, {
|
|
118
|
+
item: true,
|
|
119
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiButton.default, {
|
|
120
|
+
startIcon: actionItem.icon,
|
|
121
|
+
onClick: actionItem.action,
|
|
122
|
+
children: actionItem.name
|
|
123
|
+
})
|
|
124
|
+
}, index);
|
|
125
125
|
})]
|
|
126
126
|
}),
|
|
127
127
|
children: _children
|