mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-22 07:08:44 +00:00
Compare commits
5 Commits
snapshot-f
...
snapshot-f
Author | SHA1 | Date | |
---|---|---|---|
37a18bbe0d | |||
98cc2ceb00 | |||
e351883d73 | |||
25599d0ca6 | |||
01d18902d7 |
@ -6,7 +6,7 @@
|
|||||||
"@auth0/auth0-react": "1.10.2",
|
"@auth0/auth0-react": "1.10.2",
|
||||||
"@emotion/react": "11.7.1",
|
"@emotion/react": "11.7.1",
|
||||||
"@emotion/styled": "11.6.0",
|
"@emotion/styled": "11.6.0",
|
||||||
"@kingsrook/qqq-frontend-core": "1.0.80",
|
"@kingsrook/qqq-frontend-core": "1.0.82",
|
||||||
"@mui/icons-material": "5.4.1",
|
"@mui/icons-material": "5.4.1",
|
||||||
"@mui/material": "5.11.1",
|
"@mui/material": "5.11.1",
|
||||||
"@mui/styles": "5.11.1",
|
"@mui/styles": "5.11.1",
|
||||||
@ -56,9 +56,7 @@
|
|||||||
"npm-install": "npm install --legacy-peer-deps",
|
"npm-install": "npm install --legacy-peer-deps",
|
||||||
"prepublishOnly": "tsc -p ./ --outDir lib/",
|
"prepublishOnly": "tsc -p ./ --outDir lib/",
|
||||||
"start": "BROWSER=none react-scripts --max-http-header-size=65535 start",
|
"start": "BROWSER=none react-scripts --max-http-header-size=65535 start",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test"
|
||||||
"cypress:open": "cypress open",
|
|
||||||
"cypress:run": "cypress run"
|
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
@ -86,8 +84,6 @@
|
|||||||
"@types/react-table": "7.7.9",
|
"@types/react-table": "7.7.9",
|
||||||
"@typescript-eslint/eslint-plugin": "5.10.2",
|
"@typescript-eslint/eslint-plugin": "5.10.2",
|
||||||
"@typescript-eslint/parser": "5.10.2",
|
"@typescript-eslint/parser": "5.10.2",
|
||||||
"cypress": "11.0.1",
|
|
||||||
"cypress-wait-for-stable-dom": "0.1.0",
|
|
||||||
"eslint": "8.8.0",
|
"eslint": "8.8.0",
|
||||||
"eslint-import-resolver-typescript": "2.5.0",
|
"eslint-import-resolver-typescript": "2.5.0",
|
||||||
"eslint-plugin-import": "2.25.4",
|
"eslint-plugin-import": "2.25.4",
|
||||||
|
@ -62,10 +62,12 @@ import {GoogleDriveFolderPickerWrapper} from "qqq/components/processes/GoogleDri
|
|||||||
import ProcessSummaryResults from "qqq/components/processes/ProcessSummaryResults";
|
import ProcessSummaryResults from "qqq/components/processes/ProcessSummaryResults";
|
||||||
import ValidationReview from "qqq/components/processes/ValidationReview";
|
import ValidationReview from "qqq/components/processes/ValidationReview";
|
||||||
import BaseLayout from "qqq/layouts/BaseLayout";
|
import BaseLayout from "qqq/layouts/BaseLayout";
|
||||||
|
import {TABLE_VARIANT_LOCAL_STORAGE_KEY_ROOT} from "qqq/pages/records/query/RecordQuery";
|
||||||
import Client from "qqq/utils/qqq/Client";
|
import Client from "qqq/utils/qqq/Client";
|
||||||
import TableUtils from "qqq/utils/qqq/TableUtils";
|
import TableUtils from "qqq/utils/qqq/TableUtils";
|
||||||
import ValueUtils from "qqq/utils/qqq/ValueUtils";
|
import ValueUtils from "qqq/utils/qqq/ValueUtils";
|
||||||
|
|
||||||
|
|
||||||
interface Props
|
interface Props
|
||||||
{
|
{
|
||||||
process?: QProcessMetaData;
|
process?: QProcessMetaData;
|
||||||
@ -74,7 +76,7 @@ interface Props
|
|||||||
isModal?: boolean;
|
isModal?: boolean;
|
||||||
isWidget?: boolean;
|
isWidget?: boolean;
|
||||||
isReport?: boolean;
|
isReport?: boolean;
|
||||||
recordIds?: string | QQueryFilter;
|
recordIds?: string[] | QQueryFilter;
|
||||||
closeModalHandler?: (event: object, reason: string) => void;
|
closeModalHandler?: (event: object, reason: string) => void;
|
||||||
forceReInit?: number;
|
forceReInit?: number;
|
||||||
overrideLabel?: string;
|
overrideLabel?: string;
|
||||||
@ -88,6 +90,11 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
|
|||||||
{
|
{
|
||||||
const processNameParam = useParams().processName;
|
const processNameParam = useParams().processName;
|
||||||
const processName = process === null ? processNameParam : process.name;
|
const processName = process === null ? processNameParam : process.name;
|
||||||
|
let tableVariantLocalStorageKey: string | null = null;
|
||||||
|
if(table)
|
||||||
|
{
|
||||||
|
tableVariantLocalStorageKey = `${TABLE_VARIANT_LOCAL_STORAGE_KEY_ROOT}.${table.name}`;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
// process state //
|
// process state //
|
||||||
@ -368,15 +375,15 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
|
|||||||
// but our first use case, they're the same, so... this needs fixed. //
|
// but our first use case, they're the same, so... this needs fixed. //
|
||||||
// they also need to know the 'otherValues' in this process - e.g., for filtering //
|
// they also need to know the 'otherValues' in this process - e.g., for filtering //
|
||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
if(formFields && processValues)
|
if (formFields && processValues)
|
||||||
{
|
{
|
||||||
Object.keys(formFields).forEach((key) =>
|
Object.keys(formFields).forEach((key) =>
|
||||||
{
|
{
|
||||||
if(formFields[key].possibleValueProps)
|
if (formFields[key].possibleValueProps)
|
||||||
{
|
{
|
||||||
if(processValues[key])
|
if (processValues[key])
|
||||||
{
|
{
|
||||||
formFields[key].possibleValueProps.initialDisplayValue = processValues[key]
|
formFields[key].possibleValueProps.initialDisplayValue = processValues[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
formFields[key].possibleValueProps.otherValues = formFields[key].possibleValueProps.otherValues ?? new Map<string, any>();
|
formFields[key].possibleValueProps.otherValues = formFields[key].possibleValueProps.otherValues ?? new Map<string, any>();
|
||||||
@ -385,7 +392,7 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
|
|||||||
formFields[key].possibleValueProps.otherValues.set(otherKey, processValues[otherKey]);
|
formFields[key].possibleValueProps.otherValues.set(otherKey, processValues[otherKey]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -741,7 +748,7 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
|
|||||||
formValidations[fieldName] = validation;
|
formValidations[fieldName] = validation;
|
||||||
};
|
};
|
||||||
|
|
||||||
if(tableMetaData)
|
if (tableMetaData)
|
||||||
{
|
{
|
||||||
console.log("Adding table name field... ?", tableMetaData.name);
|
console.log("Adding table name field... ?", tableMetaData.name);
|
||||||
addField("tableName", {type: "hidden", omitFromQDynamicForm: true}, tableMetaData.name, null);
|
addField("tableName", {type: "hidden", omitFromQDynamicForm: true}, tableMetaData.name, null);
|
||||||
@ -794,15 +801,15 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
|
|||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
Object.keys(dynamicFormFields).forEach((key: any) =>
|
Object.keys(dynamicFormFields).forEach((key: any) =>
|
||||||
{
|
{
|
||||||
if(dynamicFormFields[key].possibleValueProps)
|
if (dynamicFormFields[key].possibleValueProps)
|
||||||
{
|
{
|
||||||
dynamicFormFields[key].possibleValueProps.otherValues = dynamicFormFields[key].possibleValueProps.otherValues ?? new Map<string, any>();
|
dynamicFormFields[key].possibleValueProps.otherValues = dynamicFormFields[key].possibleValueProps.otherValues ?? new Map<string, any>();
|
||||||
Object.keys(initialValues).forEach((ivKey: any) =>
|
Object.keys(initialValues).forEach((ivKey: any) =>
|
||||||
{
|
{
|
||||||
dynamicFormFields[key].possibleValueProps.otherValues.set(ivKey, initialValues[ivKey]);
|
dynamicFormFields[key].possibleValueProps.otherValues.set(ivKey, initialValues[ivKey]);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
// disable all fields if this is a bulk edit form //
|
// disable all fields if this is a bulk edit form //
|
||||||
@ -1075,8 +1082,10 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
|
|||||||
let queryStringPairsForInit = [];
|
let queryStringPairsForInit = [];
|
||||||
if (urlSearchParams.get("recordIds"))
|
if (urlSearchParams.get("recordIds"))
|
||||||
{
|
{
|
||||||
|
const recordIdsFromQueryString = urlSearchParams.get("recordIds").split(",");
|
||||||
|
const encodedRecordIds = recordIdsFromQueryString.map(r => encodeURIComponent(r)).join(",");
|
||||||
queryStringPairsForInit.push("recordsParam=recordIds");
|
queryStringPairsForInit.push("recordsParam=recordIds");
|
||||||
queryStringPairsForInit.push(`recordIds=${urlSearchParams.get("recordIds")}`);
|
queryStringPairsForInit.push(`recordIds=${encodedRecordIds}`);
|
||||||
}
|
}
|
||||||
else if (urlSearchParams.get("filterJSON"))
|
else if (urlSearchParams.get("filterJSON"))
|
||||||
{
|
{
|
||||||
@ -1090,16 +1099,23 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
|
|||||||
// }
|
// }
|
||||||
else if (recordIds)
|
else if (recordIds)
|
||||||
{
|
{
|
||||||
if (typeof recordIds === "string")
|
if (recordIds instanceof QQueryFilter)
|
||||||
{
|
|
||||||
queryStringPairsForInit.push("recordsParam=recordIds");
|
|
||||||
queryStringPairsForInit.push(`recordIds=${recordIds}`);
|
|
||||||
}
|
|
||||||
else if (recordIds instanceof QQueryFilter)
|
|
||||||
{
|
{
|
||||||
queryStringPairsForInit.push("recordsParam=filterJSON");
|
queryStringPairsForInit.push("recordsParam=filterJSON");
|
||||||
queryStringPairsForInit.push(`filterJSON=${JSON.stringify(recordIds)}`);
|
queryStringPairsForInit.push(`filterJSON=${JSON.stringify(recordIds)}`);
|
||||||
}
|
}
|
||||||
|
else if (typeof recordIds === "object" && recordIds.length)
|
||||||
|
{
|
||||||
|
const encodedRecordIds = recordIds.map(r => encodeURIComponent(r)).join(",");
|
||||||
|
queryStringPairsForInit.push("recordsParam=recordIds");
|
||||||
|
queryStringPairsForInit.push(`recordIds=${encodedRecordIds}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tableVariantLocalStorageKey && localStorage.getItem(tableVariantLocalStorageKey))
|
||||||
|
{
|
||||||
|
let tableVariant = JSON.parse(localStorage.getItem(tableVariantLocalStorageKey));
|
||||||
|
queryStringPairsForInit.push(`tableVariant=${JSON.stringify(tableVariant)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -1147,9 +1163,9 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tableMetaData)
|
if (tableMetaData)
|
||||||
{
|
{
|
||||||
queryStringPairsForInit.push(`tableName=${tableMetaData.name}`)
|
queryStringPairsForInit.push(`tableName=${encodeURIComponent(tableMetaData.name)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -1187,6 +1203,12 @@ function ProcessRun({process, table, defaultProcessValues, isModal, isWidget, is
|
|||||||
formData.append(key, values[key]);
|
formData.append(key, values[key]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (tableVariantLocalStorageKey && localStorage.getItem(tableVariantLocalStorageKey))
|
||||||
|
{
|
||||||
|
let tableVariant = JSON.parse(localStorage.getItem(tableVariantLocalStorageKey));
|
||||||
|
formData.append("tableVariant", JSON.stringify(tableVariant));
|
||||||
|
}
|
||||||
|
|
||||||
if (doesStepHaveComponent(activeStep, QComponentType.BULK_EDIT_FORM))
|
if (doesStepHaveComponent(activeStep, QComponentType.BULK_EDIT_FORM))
|
||||||
{
|
{
|
||||||
const bulkEditEnabledFields: string[] = [];
|
const bulkEditEnabledFields: string[] = [];
|
||||||
|
@ -82,7 +82,8 @@ const ROWS_PER_PAGE_LOCAL_STORAGE_KEY_ROOT = "qqq.rowsPerPage";
|
|||||||
const PINNED_COLUMNS_LOCAL_STORAGE_KEY_ROOT = "qqq.pinnedColumns";
|
const PINNED_COLUMNS_LOCAL_STORAGE_KEY_ROOT = "qqq.pinnedColumns";
|
||||||
const SEEN_JOIN_TABLES_LOCAL_STORAGE_KEY_ROOT = "qqq.seenJoinTables";
|
const SEEN_JOIN_TABLES_LOCAL_STORAGE_KEY_ROOT = "qqq.seenJoinTables";
|
||||||
const DENSITY_LOCAL_STORAGE_KEY_ROOT = "qqq.density";
|
const DENSITY_LOCAL_STORAGE_KEY_ROOT = "qqq.density";
|
||||||
const TABLE_VARIANT_LOCAL_STORAGE_KEY_ROOT = "qqq.tableVariant";
|
|
||||||
|
export const TABLE_VARIANT_LOCAL_STORAGE_KEY_ROOT = "qqq.tableVariant";
|
||||||
|
|
||||||
interface Props
|
interface Props
|
||||||
{
|
{
|
||||||
@ -233,7 +234,7 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
|
|
||||||
const [activeModalProcess, setActiveModalProcess] = useState(null as QProcessMetaData);
|
const [activeModalProcess, setActiveModalProcess] = useState(null as QProcessMetaData);
|
||||||
const [launchingProcess, setLaunchingProcess] = useState(launchProcess);
|
const [launchingProcess, setLaunchingProcess] = useState(launchProcess);
|
||||||
const [recordIdsForProcess, setRecordIdsForProcess] = useState(null as string | QQueryFilter);
|
const [recordIdsForProcess, setRecordIdsForProcess] = useState([] as string[] | QQueryFilter);
|
||||||
const [columnStatsFieldName, setColumnStatsFieldName] = useState(null as string);
|
const [columnStatsFieldName, setColumnStatsFieldName] = useState(null as string);
|
||||||
const [columnStatsField, setColumnStatsField] = useState(null as QFieldMetaData);
|
const [columnStatsField, setColumnStatsField] = useState(null as QFieldMetaData);
|
||||||
const [columnStatsFieldTableName, setColumnStatsFieldTableName] = useState(null as string)
|
const [columnStatsFieldTableName, setColumnStatsFieldTableName] = useState(null as string)
|
||||||
@ -925,11 +926,11 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
{
|
{
|
||||||
if (table.primaryKeyField !== "id")
|
if (table.primaryKeyField !== "id")
|
||||||
{
|
{
|
||||||
navigate(`${metaData.getTablePathByName(tableName)}/${params.row[tableMetaData.primaryKeyField]}`);
|
navigate(`${metaData.getTablePathByName(tableName)}/${encodeURIComponent(params.row[tableMetaData.primaryKeyField])}`);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
navigate(`${metaData.getTablePathByName(tableName)}/${params.id}`);
|
navigate(`${metaData.getTablePathByName(tableName)}/${encodeURIComponent(params.id)}`);
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
@ -1188,17 +1189,17 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
{
|
{
|
||||||
if (selectFullFilterState === "filter")
|
if (selectFullFilterState === "filter")
|
||||||
{
|
{
|
||||||
return `?recordsParam=filterJSON&filterJSON=${JSON.stringify(buildQFilter(tableMetaData, filterModel))}`;
|
return `?recordsParam=filterJSON&filterJSON=${encodeURIComponent(JSON.stringify(buildQFilter(tableMetaData, filterModel)))}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectFullFilterState === "filterSubset")
|
if (selectFullFilterState === "filterSubset")
|
||||||
{
|
{
|
||||||
return `?recordsParam=filterJSON&filterJSON=${JSON.stringify(buildQFilter(tableMetaData, filterModel, selectionSubsetSize))}`;
|
return `?recordsParam=filterJSON&filterJSON=${encodeURIComponent(JSON.stringify(buildQFilter(tableMetaData, filterModel, selectionSubsetSize)))}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedIds.length > 0)
|
if (selectedIds.length > 0)
|
||||||
{
|
{
|
||||||
return `?recordsParam=recordIds&recordIds=${selectedIds.join(",")}`;
|
return `?recordsParam=recordIds&recordIds=${selectedIds.map(r => encodeURIComponent(r)).join(",")}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
@ -1216,11 +1217,11 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
|
|||||||
}
|
}
|
||||||
else if (selectedIds.length > 0)
|
else if (selectedIds.length > 0)
|
||||||
{
|
{
|
||||||
setRecordIdsForProcess(selectedIds.join(","));
|
setRecordIdsForProcess(selectedIds);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setRecordIdsForProcess("");
|
setRecordIdsForProcess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
navigate(`${metaData?.getTablePathByName(tableName)}/${process.name}${getRecordsQueryString()}`);
|
navigate(`${metaData?.getTablePathByName(tableName)}/${process.name}${getRecordsQueryString()}`);
|
||||||
|
@ -931,7 +931,7 @@ function RecordView({table, launchProcess}: Props): JSX.Element
|
|||||||
activeModalProcess &&
|
activeModalProcess &&
|
||||||
<Modal open={activeModalProcess !== null} onClose={(event, reason) => closeModalProcess(event, reason)}>
|
<Modal open={activeModalProcess !== null} onClose={(event, reason) => closeModalProcess(event, reason)}>
|
||||||
<div className="modalProcess">
|
<div className="modalProcess">
|
||||||
<ProcessRun process={activeModalProcess} isModal={true} table={tableMetaData} recordIds={id} closeModalHandler={closeModalProcess} />
|
<ProcessRun process={activeModalProcess} isModal={true} table={tableMetaData} recordIds={[id]} closeModalHandler={closeModalProcess} />
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ export default class DataGridUtils
|
|||||||
if (key === tableMetaData.primaryKeyField && linkBase)
|
if (key === tableMetaData.primaryKeyField && linkBase)
|
||||||
{
|
{
|
||||||
column.renderCell = (cellValues: any) => (
|
column.renderCell = (cellValues: any) => (
|
||||||
<Link to={`${linkBase}${cellValues.value}`} onClick={(e) => e.stopPropagation()}>{cellValues.value}</Link>
|
<Link to={`${linkBase}${encodeURIComponent(cellValues.value)}`} onClick={(e) => e.stopPropagation()}>{cellValues.value}</Link>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user