@acvl/frontend-components 0.0.30 → 0.0.31

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/esm/index.js CHANGED
@@ -27975,32 +27975,38 @@ function ContentLayout({ children, button, badge }) {
27975
27975
  }
27976
27976
 
27977
27977
  const LinkField = ({ url, value, text }) => {
27978
- return (jsx(Link, { href: `${url}/${value}`, children: text }));
27978
+ return jsx(Link, { href: `${url}/${value}`, children: text });
27979
27979
  };
27980
27980
  const DetailField = (props) => {
27981
27981
  const hasLinkToViewPermission = useHasPermission(`${props.navigation?.permission}.view`);
27982
27982
  const value = useCallback(() => {
27983
- if (typeof (props.fieldData) == 'boolean') {
27983
+ if (typeof props.fieldData == "boolean") {
27984
27984
  if (props.fieldData)
27985
- return 'Si';
27986
- return 'No';
27985
+ return "Si";
27986
+ return "No";
27987
27987
  }
27988
- else if (typeof (props.fieldData) == 'number') {
27988
+ else if (typeof props.fieldData == "number") {
27989
27989
  return props.fieldData.toString();
27990
27990
  }
27991
- else if (props.type.displayName == 'ControlledSelect') {
27991
+ else if (props.type.displayName == "ControlledSelect") {
27992
27992
  if (props.fieldData)
27993
- return map(props.fieldData, function (item) { return item.label; }).join(', ');
27993
+ return map(props.fieldData, function (item) {
27994
+ return item.label;
27995
+ }).join(", ");
27994
27996
  }
27995
- else if (props.type.displayName == 'ControlledDate') {
27997
+ else if (props.type.displayName == "ControlledDate") {
27996
27998
  if (props.fieldData) {
27997
- if (props.extraProps.type == 'datetime')
27998
- return dayjs(props.fieldData).format('YYYY-MM-DD HH:mm');
27999
+ switch (props.extraProps.type) {
28000
+ case "date":
28001
+ return dayjs(props.fieldData).format("YYYY-MM-DD");
28002
+ case "datetime":
28003
+ return dayjs(props.fieldData).format("YYYY-MM-DD HH:mm");
28004
+ }
27999
28005
  }
28000
28006
  }
28001
- else if (props.type.displayName == 'ControlledPhotoField') {
28007
+ else if (props.type.displayName == "ControlledPhotoField") {
28002
28008
  if (props.fieldData)
28003
- return 'Imagen';
28009
+ return "Imagen";
28004
28010
  }
28005
28011
  else {
28006
28012
  if (props.fieldData) {
@@ -28010,24 +28016,27 @@ const DetailField = (props) => {
28010
28016
  return props.fieldData;
28011
28017
  }
28012
28018
  }
28013
- return 'N/A';
28019
+ return "N/A";
28014
28020
  }, [props.detail_name, props.fieldData, props.type.displayName]);
28015
- const content = `${props.detailFieldProps?.preValue ? props.detailFieldProps.preValue : ''} ${value()} ${props.detailFieldProps?.postValue ? props.detailFieldProps.postValue : ''}`;
28016
- if (props.navigation && hasLinkToViewPermission && props.fieldData && typeof props.fieldData == 'object') {
28021
+ const content = `${props.detailFieldProps?.preValue ? props.detailFieldProps.preValue : ""} ${value()} ${props.detailFieldProps?.postValue ? props.detailFieldProps.postValue : ""}`;
28022
+ if (props.navigation &&
28023
+ hasLinkToViewPermission &&
28024
+ props.fieldData &&
28025
+ typeof props.fieldData == "object") {
28017
28026
  if (Array.isArray(props.fieldData)) {
28018
- return (props.fieldData.map((item, index) => (jsx(LinkField, { url: props.navigation?.url, value: get(item, 'value'), text: `${get(item, 'label')}${index < props.fieldData.length - 1 ? ', ' : ''}` }, `${props.name}-link-${index}`))));
28027
+ return props.fieldData.map((item, index) => (jsx(LinkField, { url: props.navigation?.url, value: get(item, "value"), text: `${get(item, "label")}${index < props.fieldData.length - 1 ? ", " : ""}` }, `${props.name}-link-${index}`)));
28019
28028
  }
28020
- return (jsx(LinkField, { url: props.navigation.url, value: get(props.fieldData, 'value'), text: content }));
28029
+ return (jsx(LinkField, { url: props.navigation.url, value: get(props.fieldData, "value"), text: content }));
28021
28030
  }
28022
- else if (props.type.displayName == 'ControlledPhotoField') {
28031
+ else if (props.type.displayName == "ControlledPhotoField") {
28023
28032
  return (jsx(Link, { href: props.fieldData, download: "filename.pdf", children: content }));
28024
28033
  }
28025
28034
  else {
28026
28035
  if (Array.isArray(props.fieldData)) {
28027
- return (props.fieldData.map((item, index) => (jsx(Typography$1, { children: `${get(item, 'label')}${index < props.fieldData.length - 1 ? ', ' : ''}` }, `${props.name}-link-${index}`))));
28036
+ return props.fieldData.map((item, index) => (jsx(Typography$1, { children: `${get(item, "label")}${index < props.fieldData.length - 1 ? ", " : ""}` }, `${props.name}-link-${index}`)));
28028
28037
  }
28029
28038
  else {
28030
- return (jsx(Typography$1, { children: content }));
28039
+ return jsx(Typography$1, { children: content });
28031
28040
  }
28032
28041
  }
28033
28042
  };
@@ -28065,12 +28074,13 @@ const EditField = (props) => {
28065
28074
  };
28066
28075
 
28067
28076
  const Field = (props) => {
28077
+ const formData = props.form.watch();
28068
28078
  const show = useMemo(() => {
28069
28079
  if (props.dependantOn) {
28070
- return props.dependantOn.method(get(props.data, props.dependantOn.fieldName), props.dependantOn.value);
28080
+ return props.dependantOn.method(get(props.data || formData, props.dependantOn.fieldName), props.dependantOn.value);
28071
28081
  }
28072
28082
  return true;
28073
- }, [props.data, props.dependantOn]);
28083
+ }, [props.data, formData, props.dependantOn]);
28074
28084
  const renderField = useCallback(() => {
28075
28085
  if (!props.pageType || props.pageType == "list")
28076
28086
  return;