mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 05:10:45 +00:00
Add tableSection.isHidden; table.capabilities; adornmentType.CODE_EDITOR
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
import {AdornmentType} from "@kingsrook/qqq-frontend-core/lib/model/metaData/AdornmentType";
|
||||
import {Capability} from "@kingsrook/qqq-frontend-core/lib/model/metaData/Capability";
|
||||
import {QFieldType} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QFieldType";
|
||||
import {QProcessMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QProcessMetaData";
|
||||
import {QTableMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QTableMetaData";
|
||||
@ -584,9 +585,10 @@ function EntityList({table, launchProcess}: Props): JSX.Element
|
||||
const row: any = {};
|
||||
fields.forEach((field) =>
|
||||
{
|
||||
const value = QValueUtils.getDisplayValue(field, record);
|
||||
const value = QValueUtils.getDisplayValue(field, record, "query");
|
||||
if (typeof value !== "string")
|
||||
{
|
||||
console.log(`Need to render [${field.name}]`);
|
||||
columnsToRender[field.name] = true;
|
||||
}
|
||||
row[field.name] = value;
|
||||
@ -1146,18 +1148,27 @@ function EntityList({table, launchProcess}: Props): JSX.Element
|
||||
onClose={closeActionsMenu}
|
||||
keepMounted
|
||||
>
|
||||
<MenuItem onClick={bulkLoadClicked}>
|
||||
<ListItemIcon><Icon>library_add</Icon></ListItemIcon>
|
||||
Bulk Load
|
||||
</MenuItem>
|
||||
<MenuItem onClick={bulkEditClicked}>
|
||||
<ListItemIcon><Icon>edit</Icon></ListItemIcon>
|
||||
Bulk Edit
|
||||
</MenuItem>
|
||||
<MenuItem onClick={bulkDeleteClicked}>
|
||||
<ListItemIcon><Icon>delete</Icon></ListItemIcon>
|
||||
Bulk Delete
|
||||
</MenuItem>
|
||||
{
|
||||
table.capabilities.has(Capability.TABLE_INSERT) &&
|
||||
<MenuItem onClick={bulkLoadClicked}>
|
||||
<ListItemIcon><Icon>library_add</Icon></ListItemIcon>
|
||||
Bulk Load
|
||||
</MenuItem>
|
||||
}
|
||||
{
|
||||
table.capabilities.has(Capability.TABLE_UPDATE) &&
|
||||
<MenuItem onClick={bulkEditClicked}>
|
||||
<ListItemIcon><Icon>edit</Icon></ListItemIcon>
|
||||
Bulk Edit
|
||||
</MenuItem>
|
||||
}
|
||||
{
|
||||
table.capabilities.has(Capability.TABLE_DELETE) &&
|
||||
<MenuItem onClick={bulkDeleteClicked}>
|
||||
<ListItemIcon><Icon>delete</Icon></ListItemIcon>
|
||||
Bulk Delete
|
||||
</MenuItem>
|
||||
}
|
||||
{tableProcesses.length > 0 && <Divider />}
|
||||
{tableProcesses.map((process) => (
|
||||
<MenuItem key={process.name} onClick={() => processClicked(process)}>
|
||||
@ -1165,6 +1176,13 @@ function EntityList({table, launchProcess}: Props): JSX.Element
|
||||
{process.label}
|
||||
</MenuItem>
|
||||
))}
|
||||
{
|
||||
tableProcesses.length == 0 && !table.capabilities.has(Capability.TABLE_INSERT) && !table.capabilities.has(Capability.TABLE_UPDATE) && !table.capabilities.has(Capability.TABLE_DELETE) &&
|
||||
<MenuItem disabled>
|
||||
<ListItemIcon><Icon>block</Icon></ListItemIcon>
|
||||
<i>No actions available</i>
|
||||
</MenuItem>
|
||||
}
|
||||
</Menu>
|
||||
);
|
||||
|
||||
@ -1226,7 +1244,10 @@ function EntityList({table, launchProcess}: Props): JSX.Element
|
||||
{renderActionsMenu}
|
||||
</MDBox>
|
||||
|
||||
<QCreateNewButton />
|
||||
{
|
||||
table.capabilities.has(Capability.TABLE_INSERT) &&
|
||||
<QCreateNewButton />
|
||||
}
|
||||
|
||||
</MDBox>
|
||||
<Card>
|
||||
@ -1244,6 +1265,7 @@ function EntityList({table, launchProcess}: Props): JSX.Element
|
||||
disableSelectionOnClick
|
||||
autoHeight
|
||||
rows={rows}
|
||||
// getRowHeight={() => "auto"} // maybe nice? wraps values in cells...
|
||||
columns={columnsModel}
|
||||
rowBuffer={10}
|
||||
rowCount={totalRecords === null ? 0 : totalRecords}
|
||||
|
@ -423,7 +423,7 @@ function EntityDeveloperView({table}: Props): JSX.Element
|
||||
</Card>
|
||||
|
||||
{
|
||||
associatedScripts.map((object) =>
|
||||
associatedScripts && associatedScripts.map((object) =>
|
||||
{
|
||||
let fieldName = object.associatedScript?.fieldName;
|
||||
let field = tableMetaData.fields.get(fieldName);
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
import {QException} from "@kingsrook/qqq-frontend-core/lib/exceptions/QException";
|
||||
import {Capability} from "@kingsrook/qqq-frontend-core/lib/model/metaData/Capability";
|
||||
import {QProcessMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QProcessMetaData";
|
||||
import {QTableMetaData} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QTableMetaData";
|
||||
import {QTableSection} from "@kingsrook/qqq-frontend-core/lib/model/metaData/QTableSection";
|
||||
@ -234,6 +235,11 @@ function EntityView({table, launchProcess}: Props): JSX.Element
|
||||
for (let i = 0; i < tableSections.length; i++)
|
||||
{
|
||||
const section = tableSections[i];
|
||||
if(section.isHidden)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sectionFieldElements.set(
|
||||
section.name,
|
||||
<MDBox key={section.name} display="flex" flexDirection="column" py={1} pr={2}>
|
||||
@ -244,7 +250,7 @@ function EntityView({table, launchProcess}: Props): JSX.Element
|
||||
{tableMetaData.fields.get(fieldName).label}:
|
||||
</MDTypography>
|
||||
<MDTypography variant="button" fontWeight="regular" color="text">
|
||||
{QValueUtils.getDisplayValue(tableMetaData.fields.get(fieldName), record)}
|
||||
{QValueUtils.getDisplayValue(tableMetaData.fields.get(fieldName), record, "view")}
|
||||
</MDTypography>
|
||||
</MDBox>
|
||||
))
|
||||
@ -313,27 +319,33 @@ function EntityView({table, launchProcess}: Props): JSX.Element
|
||||
onClose={closeActionsMenu}
|
||||
keepMounted
|
||||
>
|
||||
<MenuItem onClick={() => navigate("edit")}>
|
||||
<ListItemIcon><Icon>edit</Icon></ListItemIcon>
|
||||
Edit
|
||||
</MenuItem>
|
||||
<MenuItem onClick={() =>
|
||||
{
|
||||
setActionsMenu(null);
|
||||
handleClickDeleteButton();
|
||||
}}
|
||||
>
|
||||
<ListItemIcon><Icon>delete</Icon></ListItemIcon>
|
||||
Delete
|
||||
</MenuItem>
|
||||
{tableProcesses.length > 0 && <Divider />}
|
||||
table.capabilities.has(Capability.TABLE_UPDATE) &&
|
||||
<MenuItem onClick={() => navigate("edit")}>
|
||||
<ListItemIcon><Icon>edit</Icon></ListItemIcon>
|
||||
Edit
|
||||
</MenuItem>
|
||||
}
|
||||
{
|
||||
table.capabilities.has(Capability.TABLE_DELETE) &&
|
||||
<MenuItem onClick={() =>
|
||||
{
|
||||
setActionsMenu(null);
|
||||
handleClickDeleteButton();
|
||||
}}
|
||||
>
|
||||
<ListItemIcon><Icon>delete</Icon></ListItemIcon>
|
||||
Delete
|
||||
</MenuItem>
|
||||
}
|
||||
{tableProcesses.length > 0 && (table.capabilities.has(Capability.TABLE_UPDATE) || table.capabilities.has(Capability.TABLE_DELETE)) && <Divider />}
|
||||
{tableProcesses.map((process) => (
|
||||
<MenuItem key={process.name} onClick={() => processClicked(process)}>
|
||||
<ListItemIcon><Icon>{process.iconName ?? "arrow_forward"}</Icon></ListItemIcon>
|
||||
{process.label}
|
||||
</MenuItem>
|
||||
))}
|
||||
<Divider />
|
||||
{tableProcesses.length > 0 && <Divider />}
|
||||
<MenuItem onClick={() => navigate("dev")}>
|
||||
<ListItemIcon><Icon>data_object</Icon></ListItemIcon>
|
||||
Developer Mode
|
||||
@ -433,8 +445,12 @@ function EntityView({table, launchProcess}: Props): JSX.Element
|
||||
)) : null}
|
||||
<MDBox component="form" p={3}>
|
||||
<Grid container justifyContent="flex-end" spacing={3}>
|
||||
<QDeleteButton onClickHandler={handleClickDeleteButton} />
|
||||
<QEditButton />
|
||||
{
|
||||
table.capabilities.has(Capability.TABLE_DELETE) && <QDeleteButton onClickHandler={handleClickDeleteButton} />
|
||||
}
|
||||
{
|
||||
table.capabilities.has(Capability.TABLE_UPDATE) && <QEditButton />
|
||||
}
|
||||
</Grid>
|
||||
</MDBox>
|
||||
|
||||
|
@ -253,7 +253,7 @@ function QValidationReview({
|
||||
{" "}
|
||||
|
||||
{" "}
|
||||
{QValueUtils.getDisplayValue(field, previewRecords[previewRecordIndex])}
|
||||
{QValueUtils.getDisplayValue(field, previewRecords[previewRecordIndex], "view")}
|
||||
</MDBox>
|
||||
))
|
||||
}
|
||||
|
@ -362,8 +362,11 @@ function ProcessRun({process, defaultProcessValues, isModal, recordIds, closeMod
|
||||
{localTableSections.map((section: QTableSection, index: number) =>
|
||||
{
|
||||
const name = section.name
|
||||
console.log(formData);
|
||||
console.log(section.fieldNames);
|
||||
|
||||
if(section.isHidden)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
const sectionFormFields = {};
|
||||
for(let i = 0; i<section.fieldNames.length; i++)
|
||||
@ -424,7 +427,7 @@ function ProcessRun({process, defaultProcessValues, isModal, recordIds, closeMod
|
||||
:
|
||||
</MDTypography>
|
||||
<MDTypography variant="button" fontWeight="regular" color="text">
|
||||
{QValueUtils.getValueForDisplay(field, processValues[field.name])}
|
||||
{QValueUtils.getValueForDisplay(field, processValues[field.name], "view")}
|
||||
</MDTypography>
|
||||
</MDBox>
|
||||
))}
|
||||
|
Reference in New Issue
Block a user