@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/cjs/index.js +32 -22
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +32 -22
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -27995,32 +27995,38 @@ function ContentLayout({ children, button, badge }) {
|
|
|
27995
27995
|
}
|
|
27996
27996
|
|
|
27997
27997
|
const LinkField = ({ url, value, text }) => {
|
|
27998
|
-
return
|
|
27998
|
+
return jsxRuntime.jsx(material.Link, { href: `${url}/${value}`, children: text });
|
|
27999
27999
|
};
|
|
28000
28000
|
const DetailField = (props) => {
|
|
28001
28001
|
const hasLinkToViewPermission = useHasPermission(`${props.navigation?.permission}.view`);
|
|
28002
28002
|
const value = React.useCallback(() => {
|
|
28003
|
-
if (typeof
|
|
28003
|
+
if (typeof props.fieldData == "boolean") {
|
|
28004
28004
|
if (props.fieldData)
|
|
28005
|
-
return
|
|
28006
|
-
return
|
|
28005
|
+
return "Si";
|
|
28006
|
+
return "No";
|
|
28007
28007
|
}
|
|
28008
|
-
else if (typeof
|
|
28008
|
+
else if (typeof props.fieldData == "number") {
|
|
28009
28009
|
return props.fieldData.toString();
|
|
28010
28010
|
}
|
|
28011
|
-
else if (props.type.displayName ==
|
|
28011
|
+
else if (props.type.displayName == "ControlledSelect") {
|
|
28012
28012
|
if (props.fieldData)
|
|
28013
|
-
return lodash.map(props.fieldData, function (item) {
|
|
28013
|
+
return lodash.map(props.fieldData, function (item) {
|
|
28014
|
+
return item.label;
|
|
28015
|
+
}).join(", ");
|
|
28014
28016
|
}
|
|
28015
|
-
else if (props.type.displayName ==
|
|
28017
|
+
else if (props.type.displayName == "ControlledDate") {
|
|
28016
28018
|
if (props.fieldData) {
|
|
28017
|
-
|
|
28018
|
-
|
|
28019
|
+
switch (props.extraProps.type) {
|
|
28020
|
+
case "date":
|
|
28021
|
+
return dayjs(props.fieldData).format("YYYY-MM-DD");
|
|
28022
|
+
case "datetime":
|
|
28023
|
+
return dayjs(props.fieldData).format("YYYY-MM-DD HH:mm");
|
|
28024
|
+
}
|
|
28019
28025
|
}
|
|
28020
28026
|
}
|
|
28021
|
-
else if (props.type.displayName ==
|
|
28027
|
+
else if (props.type.displayName == "ControlledPhotoField") {
|
|
28022
28028
|
if (props.fieldData)
|
|
28023
|
-
return
|
|
28029
|
+
return "Imagen";
|
|
28024
28030
|
}
|
|
28025
28031
|
else {
|
|
28026
28032
|
if (props.fieldData) {
|
|
@@ -28030,24 +28036,27 @@ const DetailField = (props) => {
|
|
|
28030
28036
|
return props.fieldData;
|
|
28031
28037
|
}
|
|
28032
28038
|
}
|
|
28033
|
-
return
|
|
28039
|
+
return "N/A";
|
|
28034
28040
|
}, [props.detail_name, props.fieldData, props.type.displayName]);
|
|
28035
|
-
const content = `${props.detailFieldProps?.preValue ? props.detailFieldProps.preValue :
|
|
28036
|
-
if (props.navigation &&
|
|
28041
|
+
const content = `${props.detailFieldProps?.preValue ? props.detailFieldProps.preValue : ""} ${value()} ${props.detailFieldProps?.postValue ? props.detailFieldProps.postValue : ""}`;
|
|
28042
|
+
if (props.navigation &&
|
|
28043
|
+
hasLinkToViewPermission &&
|
|
28044
|
+
props.fieldData &&
|
|
28045
|
+
typeof props.fieldData == "object") {
|
|
28037
28046
|
if (Array.isArray(props.fieldData)) {
|
|
28038
|
-
return
|
|
28047
|
+
return props.fieldData.map((item, index) => (jsxRuntime.jsx(LinkField, { url: props.navigation?.url, value: lodash.get(item, "value"), text: `${lodash.get(item, "label")}${index < props.fieldData.length - 1 ? ", " : ""}` }, `${props.name}-link-${index}`)));
|
|
28039
28048
|
}
|
|
28040
|
-
return (jsxRuntime.jsx(LinkField, { url: props.navigation.url, value: lodash.get(props.fieldData,
|
|
28049
|
+
return (jsxRuntime.jsx(LinkField, { url: props.navigation.url, value: lodash.get(props.fieldData, "value"), text: content }));
|
|
28041
28050
|
}
|
|
28042
|
-
else if (props.type.displayName ==
|
|
28051
|
+
else if (props.type.displayName == "ControlledPhotoField") {
|
|
28043
28052
|
return (jsxRuntime.jsx(material.Link, { href: props.fieldData, download: "filename.pdf", children: content }));
|
|
28044
28053
|
}
|
|
28045
28054
|
else {
|
|
28046
28055
|
if (Array.isArray(props.fieldData)) {
|
|
28047
|
-
return
|
|
28056
|
+
return props.fieldData.map((item, index) => (jsxRuntime.jsx(material.Typography, { children: `${lodash.get(item, "label")}${index < props.fieldData.length - 1 ? ", " : ""}` }, `${props.name}-link-${index}`)));
|
|
28048
28057
|
}
|
|
28049
28058
|
else {
|
|
28050
|
-
return
|
|
28059
|
+
return jsxRuntime.jsx(material.Typography, { children: content });
|
|
28051
28060
|
}
|
|
28052
28061
|
}
|
|
28053
28062
|
};
|
|
@@ -28085,12 +28094,13 @@ const EditField = (props) => {
|
|
|
28085
28094
|
};
|
|
28086
28095
|
|
|
28087
28096
|
const Field = (props) => {
|
|
28097
|
+
const formData = props.form.watch();
|
|
28088
28098
|
const show = React.useMemo(() => {
|
|
28089
28099
|
if (props.dependantOn) {
|
|
28090
|
-
return props.dependantOn.method(lodash.get(props.data, props.dependantOn.fieldName), props.dependantOn.value);
|
|
28100
|
+
return props.dependantOn.method(lodash.get(props.data || formData, props.dependantOn.fieldName), props.dependantOn.value);
|
|
28091
28101
|
}
|
|
28092
28102
|
return true;
|
|
28093
|
-
}, [props.data, props.dependantOn]);
|
|
28103
|
+
}, [props.data, formData, props.dependantOn]);
|
|
28094
28104
|
const renderField = React.useCallback(() => {
|
|
28095
28105
|
if (!props.pageType || props.pageType == "list")
|
|
28096
28106
|
return;
|