@acvl/frontend-components 0.0.22 → 0.0.24

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.
package/dist/cjs/index.js CHANGED
@@ -25788,20 +25788,12 @@ const formDataForm = ({ submitData, data, useLabel, props }) => {
25788
25788
  return formData;
25789
25789
  };
25790
25790
  // ==============================|| ERRORS ||============================== //
25791
- const errorLoop = (form, errorObj, key) => {
25792
- if (typeof errorObj == 'object' && !Array.isArray(errorObj)) {
25793
- Object.keys(errorObj).forEach(y => {
25794
- errorLoop(form, errorObj[y], key + '.' + y);
25791
+ const setErrors = (form, error) => {
25792
+ if ('invalid_params' in error.data) {
25793
+ Object.values(error.data.invalid_params).forEach((entry) => {
25794
+ form.setError(entry.name, { message: entry.reason.join(', ') });
25795
25795
  });
25796
25796
  }
25797
- else {
25798
- form.setError(key, { message: errorObj });
25799
- }
25800
- };
25801
- const setErrors = (form, error) => {
25802
- Object.keys(error.data).forEach(x => {
25803
- errorLoop(form, error.data[x], x);
25804
- });
25805
25797
  };
25806
25798
 
25807
25799
  const valueLabel = zod.object({
@@ -27944,7 +27936,7 @@ const DetailField = (props) => {
27944
27936
  }
27945
27937
  }
27946
27938
  return 'N/A';
27947
- }, [props.detail_name, props.fieldData, props.type.name]);
27939
+ }, [props.detail_name, props.fieldData, props.type.displayName]);
27948
27940
  const content = `${props.detailFieldProps?.preValue ? props.detailFieldProps.preValue : ''} ${value()} ${props.detailFieldProps?.postValue ? props.detailFieldProps.postValue : ''}`;
27949
27941
  if (props.navigation && hasLinkToViewPermission && props.fieldData && typeof props.fieldData == 'object') {
27950
27942
  if (Array.isArray(props.fieldData)) {
@@ -27952,7 +27944,7 @@ const DetailField = (props) => {
27952
27944
  }
27953
27945
  return (jsxRuntime.jsx(LinkField, { url: props.navigation.url, value: lodash.get(props.fieldData, 'value'), text: content }));
27954
27946
  }
27955
- else if (props.type.name == 'ControlledPhotoField') {
27947
+ else if (props.type.displayName == 'ControlledPhotoField') {
27956
27948
  return (jsxRuntime.jsx(material.Link, { href: props.fieldData, download: "filename.pdf", children: content }));
27957
27949
  }
27958
27950
  else {
@@ -28329,15 +28321,12 @@ function DetailPage(props) {
28329
28321
  else {
28330
28322
  console.log(error);
28331
28323
  setErrors(form, error);
28332
- notifications.show(('non_field_errors' in error.data ?
28333
- error.data.non_field_errors.join(', ') :
28324
+ notifications.show((error.data.detail ?
28325
+ error.data.detail.join(', ') :
28334
28326
  `Error ${props.pageType == 'edit' ? 'actualizando' : 'creando'} ${props.object.name}!`), { severity: 'error' });
28335
28327
  }
28336
28328
  });
28337
28329
  };
28338
- const onError = (errors) => {
28339
- console.log(errors);
28340
- };
28341
28330
  // ==============================|| RENDER SECTIONS ||============================== //
28342
28331
  const renderContent = () => {
28343
28332
  let displayed_sections = -1;
@@ -28393,7 +28382,7 @@ function DetailPage(props) {
28393
28382
  }
28394
28383
  };
28395
28384
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ContentLayout, { button: renderButton(), badge: props.pageType == 'detail' && badgeInfo &&
28396
- jsxRuntime.jsx(StatusBadge, { title: badgeInfo['label'], severity: badgeInfo['value'] }), children: jsxRuntime.jsx(LoadingComponent, { height: 0.7, isLoading: isLoading || isFetching, children: jsxRuntime.jsx(reactHookForm.FormProvider, { ...form, children: jsxRuntime.jsx(material.Box, { id: 'formulario', component: 'form', autoComplete: "off", noValidate: true, onSubmit: form.handleSubmit(onSubmitHandler, onError), width: '100%', position: 'relative', children: renderContent() }) }) }) }), renderPostAction()] }));
28385
+ jsxRuntime.jsx(StatusBadge, { title: badgeInfo['label'], severity: badgeInfo['value'] }), children: jsxRuntime.jsx(LoadingComponent, { height: 0.7, isLoading: isLoading || isFetching, children: jsxRuntime.jsx(reactHookForm.FormProvider, { ...form, children: jsxRuntime.jsx(material.Box, { id: 'formulario', component: 'form', autoComplete: "off", noValidate: true, onSubmit: form.handleSubmit(onSubmitHandler), width: '100%', position: 'relative', children: renderContent() }) }) }) }), renderPostAction()] }));
28397
28386
  }
28398
28387
 
28399
28388
  const ListPage = (props) => {
@@ -28712,6 +28701,7 @@ exports.DeleteButton = DeleteButton;
28712
28701
  exports.DeleteConfirmationDialog = DeleteConfirmationDialog;
28713
28702
  exports.DetailPage = DetailPage;
28714
28703
  exports.EditButton = EditButton;
28704
+ exports.ExportButton = ExportButton;
28715
28705
  exports.HistorialDrawer = HistorialDrawer;
28716
28706
  exports.ListPage = ListPage;
28717
28707
  exports.Loadable = Loadable;