Compare commits

..

3 Commits

7 changed files with 2509 additions and 18076 deletions

20520
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<properties> <properties>
<revision>0.23.0</revision> <revision>0.23.0-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

View File

@ -818,9 +818,9 @@ function EntityForm(props: Props): JSX.Element
{ {
actions.setSubmitting(true); actions.setSubmitting(true);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// if there's a callback (e.g., for a modal nested on another create/edit screen), then just pass our data back there and return. // // if there's a callback (e.g., for a modal nested on another create/edit screen), then just pass our data back there anre return. //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (props.onSubmitCallback) if (props.onSubmitCallback)
{ {
props.onSubmitCallback(values); props.onSubmitCallback(values);
@ -1290,7 +1290,7 @@ function EntityForm(props: Props): JSX.Element
table={showEditChildForm.table} table={showEditChildForm.table}
defaultValues={showEditChildForm.defaultValues} defaultValues={showEditChildForm.defaultValues}
disabledFields={showEditChildForm.disabledFields} disabledFields={showEditChildForm.disabledFields}
onSubmitCallback={props.onSubmitCallback ? props.onSubmitCallback : submitEditChildForm} onSubmitCallback={submitEditChildForm}
overrideHeading={`${showEditChildForm.rowIndex != null ? "Editing" : "Creating New"} ${showEditChildForm.table.label}`} overrideHeading={`${showEditChildForm.rowIndex != null ? "Editing" : "Creating New"} ${showEditChildForm.table.label}`}
/> />
</div> </div>

View File

@ -107,6 +107,7 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, reco
// modal form controls // // modal form controls //
///////////////////////// /////////////////////////
const [showEditChildForm, setShowEditChildForm] = useState(null as any); const [showEditChildForm, setShowEditChildForm] = useState(null as any);
const [modalTable, setModalTable] = useState(null as QTableMetaData);
let initialSelectedTab = 0; let initialSelectedTab = 0;
let selectedTabKey: string = null; let selectedTabKey: string = null;
@ -339,15 +340,13 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, reco
*******************************************************************************/ *******************************************************************************/
function openAddChildRecord(name: string, widgetData: any) function openAddChildRecord(name: string, widgetData: any)
{ {
let defaultValues = widgetData.defaultValuesForNewChildRecords;
let disabledFields = widgetData.disabledFieldsForNewChildRecords; let disabledFields = widgetData.disabledFieldsForNewChildRecords;
if (!disabledFields) if (!disabledFields)
{ {
disabledFields = widgetData.defaultValuesForNewChildRecords; disabledFields = widgetData.defaultValuesForNewChildRecords;
} }
doOpenEditChildForm(name, widgetData.childTableMetaData, null, defaultValues, disabledFields); doOpenEditChildForm(name, widgetData.childTableMetaData, null, null, disabledFields);
} }
@ -715,7 +714,7 @@ function DashboardWidgets({widgetMetaDataList, tableName, entityPrimaryKey, reco
allowRecordDelete={widgetData[i]?.allowRecordDelete} allowRecordDelete={widgetData[i]?.allowRecordDelete}
deleteRecordCallback={(rowIndex) => deleteChildRecord(widgetMetaData.name, i, rowIndex)} deleteRecordCallback={(rowIndex) => deleteChildRecord(widgetMetaData.name, i, rowIndex)}
editRecordCallback={(rowIndex) => openEditChildRecord(widgetMetaData.name, widgetData[i], rowIndex)} editRecordCallback={(rowIndex) => openEditChildRecord(widgetMetaData.name, widgetData[i], rowIndex)}
addNewRecordCallback={widgetData[i]?.isInProcess ? () => openAddChildRecord(widgetMetaData.name, widgetData[i]) : null} addNewRecordCallback={() => openAddChildRecord(widgetMetaData.name, widgetData[i])}
widgetMetaData={widgetMetaData} widgetMetaData={widgetMetaData}
data={widgetData[i]} data={widgetData[i]}
/> />

View File

@ -295,12 +295,6 @@ function RecordGridWidget({widgetMetaData, data, addNewRecordCallback, disableRo
return (<GridToolbarContainer />); return (<GridToolbarContainer />);
} }
let containerPadding = -3;
if (data?.isInProcess)
{
containerPadding = 0;
}
return ( return (
<Widget <Widget
@ -310,7 +304,7 @@ function RecordGridWidget({widgetMetaData, data, addNewRecordCallback, disableRo
labelAdditionalComponentsRight={labelAdditionalComponentsRight} labelAdditionalComponentsRight={labelAdditionalComponentsRight}
labelBoxAdditionalSx={{position: "relative", top: "-0.375rem"}} labelBoxAdditionalSx={{position: "relative", top: "-0.375rem"}}
> >
<Box mx={containerPadding} mb={containerPadding}> <Box>
<Box> <Box>
<DataGridPro <DataGridPro
autoHeight autoHeight

View File

@ -91,7 +91,7 @@ const TABLE_VARIANT_LOCAL_STORAGE_KEY_ROOT = "qqq.tableVariant";
/******************************************************************************* /*******************************************************************************
** **
*******************************************************************************/ *******************************************************************************/
export function renderSectionOfFields(key: string, fieldNames: string[], tableMetaData: QTableMetaData, helpHelpActive: boolean, record: QRecord, fieldMap?: { [name: string]: QFieldMetaData }) export function renderSectionOfFields(key: string, fieldNames: string[], tableMetaData: QTableMetaData, helpHelpActive: boolean, record: QRecord, fieldMap?: {[name: string]: QFieldMetaData} )
{ {
return <Box key={key} display="flex" flexDirection="column" py={1} pr={2}> return <Box key={key} display="flex" flexDirection="column" py={1} pr={2}>
{ {
@ -130,8 +130,8 @@ export function renderSectionOfFields(key: string, fieldNames: string[], tableMe
/*************************************************************************** /***************************************************************************
** **
***************************************************************************/ ***************************************************************************/
export function getVisibleJoinTables(tableMetaData: QTableMetaData): Set<string> export function getVisibleJoinTables(tableMetaData: QTableMetaData): Set<string>
{ {
const visibleJoinTables = new Set<string>(); const visibleJoinTables = new Set<string>();
@ -205,8 +205,6 @@ function RecordView({table, record: overrideRecord, launchProcess}: Props): JSX.
const {accentColor, setPageHeader, tableMetaData, setTableMetaData, tableProcesses, setTableProcesses, dotMenuOpen, keyboardHelpOpen, helpHelpActive, recordAnalytics, userId: currentUserId} = useContext(QContext); const {accentColor, setPageHeader, tableMetaData, setTableMetaData, tableProcesses, setTableProcesses, dotMenuOpen, keyboardHelpOpen, helpHelpActive, recordAnalytics, userId: currentUserId} = useContext(QContext);
const CREATE_CHILD_KEY = "createChild";
if (localStorage.getItem(tableVariantLocalStorageKey)) if (localStorage.getItem(tableVariantLocalStorageKey))
{ {
tableVariant = JSON.parse(localStorage.getItem(tableVariantLocalStorageKey)); tableVariant = JSON.parse(localStorage.getItem(tableVariantLocalStorageKey));
@ -309,19 +307,12 @@ function RecordView({table, record: overrideRecord, launchProcess}: Props): JSX.
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
// the path for a process looks like: .../table/id/process // // the path for a process looks like: .../table/id/process //
// the path for creating a child record looks like: .../table/id/createChild/:childTableName // // the path for creating a child record looks like: .../table/id/createChild/:childTableName //
// the path for creating a child record in a process looks like: //
// .../table/id/processName#/createChild=... //
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
let hasChildRecordKey = pathParts.some(p => p.includes(CREATE_CHILD_KEY));
if (!hasChildRecordKey)
{
hasChildRecordKey = hashParts.some(h => h.includes(CREATE_CHILD_KEY));
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// if our tableName is in the -3 index, and there is no token for updating child records, try to open process // // if our tableName is in the -3 index, try to open process //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
if (!hasChildRecordKey && pathParts[pathParts.length - 3] === tableName) if (pathParts[pathParts.length - 3] === tableName)
{ {
const processName = pathParts[pathParts.length - 1]; const processName = pathParts[pathParts.length - 1];
const processList = allTableProcesses.filter(p => p.name.endsWith(processName)); const processList = allTableProcesses.filter(p => p.name.endsWith(processName));
@ -358,7 +349,7 @@ function RecordView({table, record: overrideRecord, launchProcess}: Props): JSX.
// if our table is in the -4 index, and there's `createChild` in the -2 index, try to open a createChild form // // if our table is in the -4 index, and there's `createChild` in the -2 index, try to open a createChild form //
// e.g., person/42/createChild/address (to create an address under person 42) // // e.g., person/42/createChild/address (to create an address under person 42) //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (pathParts[pathParts.length - 4] === tableName && pathParts[pathParts.length - 2] == CREATE_CHILD_KEY) if (pathParts[pathParts.length - 4] === tableName && pathParts[pathParts.length - 2] == "createChild")
{ {
(async () => (async () =>
{ {
@ -377,7 +368,7 @@ function RecordView({table, record: overrideRecord, launchProcess}: Props): JSX.
for (let i = 0; i < hashParts.length; i++) for (let i = 0; i < hashParts.length; i++)
{ {
const parts = hashParts[i].split("="); const parts = hashParts[i].split("=");
if (parts.length > 1 && parts[0] == CREATE_CHILD_KEY) if (parts.length > 1 && parts[0] == "createChild")
{ {
(async () => (async () =>
{ {
@ -499,7 +490,7 @@ function RecordView({table, record: overrideRecord, launchProcess}: Props): JSX.
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// if the component took in a record object, then we don't need to GET it // // if the component took in a record object, then we don't need to GET it //
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
if (overrideRecord) if(overrideRecord)
{ {
record = overrideRecord; record = overrideRecord;
} }
@ -835,12 +826,12 @@ function RecordView({table, record: overrideRecord, launchProcess}: Props): JSX.
{ {
let shareDisabled = true; let shareDisabled = true;
let disabledTooltipText = ""; let disabledTooltipText = "";
if (tableMetaData.shareableTableMetaData.thisTableOwnerIdFieldName && record) if(tableMetaData.shareableTableMetaData.thisTableOwnerIdFieldName && record)
{ {
const ownerId = record.values.get(tableMetaData.shareableTableMetaData.thisTableOwnerIdFieldName); const ownerId = record.values.get(tableMetaData.shareableTableMetaData.thisTableOwnerIdFieldName);
if (ownerId != currentUserId) if(ownerId != currentUserId)
{ {
disabledTooltipText = `Only the owner of a ${tableMetaData.label} may share it.`; disabledTooltipText = `Only the owner of a ${tableMetaData.label} may share it.`
shareDisabled = true; shareDisabled = true;
} }
else else

View File

@ -75,8 +75,7 @@ export default class HtmlUtils
{ {
if (url.startsWith("http")) if (url.startsWith("http"))
{ {
const separator = url.includes("?") ? "&" : "?"; url += encodeURIComponent(`?response-content-disposition=attachment; ${filename}`);
url += encodeURIComponent(`${separator}response-content-disposition=attachment; ${filename}`);
} }
const link = document.createElement("a"); const link = document.createElement("a");