{"version":3,"file":"656.js","sources":["webpack://frontend/./src/utils/ag_grid_utils/agGridConstants.tsx","webpack://frontend/./src/utils/ag_grid_utils/agGridLicense.ts","webpack://frontend/./src/utils/ag_grid_utils/agGridUtils.tsx"],"sourcesContent":["// ag-grid table component column definition\r\nexport const wcDefaultColDef = (extraColDefOptions?: {\r\n [key: string]: unknown\r\n}) => {\r\n let defaultColDef = {\r\n flex: 1,\r\n minWidth: 120,\r\n sortable: true,\r\n resizable: true,\r\n suppressMenu: true,\r\n cellStyle: { lineHeight: '46px' }, // rowHeight in wcGridOptions - 2px\r\n cellClass: 'h-full',\r\n suppressFillHandle: true\r\n // cellStyle: {minHeight:\"100%\", alignItems:\"center\"},\r\n }\r\n return extraColDefOptions\r\n ? { ...defaultColDef, ...extraColDefOptions }\r\n : defaultColDef\r\n}\r\n// ag-grid grid options\r\nexport const wcGripOptions = (extraGripOptions?: {\r\n [key: string]: unknown\r\n}) => {\r\n let defaultGridOptions = {\r\n animateRows: true,\r\n // enableRangeSelection:true,\r\n // enableFillHandle:true,\r\n enableCellChangeFlash: true,\r\n rowSelection: 'multiple',\r\n suppressContextMenu: true,\r\n suppressMovableColumns: true,\r\n suppressMultiSort: true,\r\n suppressRowClickSelection: true,\r\n unSortIcon: true,\r\n singleClickEdit: true,\r\n undoRedoCellEditing: true,\r\n rowHeight: 48,\r\n headerHeight: 42\r\n // rowClass:[\"flex\", \"items-center\"],\r\n // enableCellTextSelection:true,\r\n }\r\n return extraGripOptions\r\n ? { ...defaultGridOptions, ...extraGripOptions }\r\n : defaultGridOptions\r\n}\r\n","//AgGrid Enterprise License\r\n\r\n// Purchased 30 Jan 2023\r\n\r\n// Allows One Licensed Developer to use ag-Grid in One Application in perpetuity. Includes a 1-year subscription to New Versions, Support and Maintenance.\r\n// Allows Licensed Developers to sub-license ag-Grid for One Application on One Production Environment in perpetuity. Includes a 1-year subscription to New Versions, Support and Maintenance.\r\n\r\nexport const agGridLicense =\r\n 'Using_this_{AG_Grid}_Enterprise_key_{AG-072365}_in_excess_of_the_licence_granted_is_not_permitted___Please_report_misuse_to_legal@ag-grid.com___For_help_with_changing_this_key_please_contact_info@ag-grid.com___{Water_Corporation}_is_granted_a_{Single_Application}_Developer_License_for_the_application_{Water_Corporation}_only_for_{2}_Front-End_JavaScript_developers___All_Front-End_JavaScript_developers_working_on_{Water_Corporation}_need_to_be_licensed___{Water_Corporation}_has_been_granted_a_Deployment_License_Add-on_for_{1}_Production_Environment___This_key_works_with_{AG_Grid}_Enterprise_versions_released_before_{29_January_2026}____[v3]_[01]_MTc2OTY0NDgwMDAwMA==59c0d1028d3fb1251cbe54fdc494b2a3'\r\n","import { useState, useEffect, useRef } from 'react'\r\nimport { renderToString } from 'react-dom/server'\r\nimport { convertToMoney, isABNValid } from 'utils'\r\nimport { Icon } from 'utils/Icon'\r\n\r\n/**\r\n *\r\n * @param value - the value to be formatted\r\n * @param delay number in ms to wait\r\n * @returns value\r\n */\r\nexport const useDebounce = (value: string, delay: number) => {\r\n // State and setters for debounced value\r\n const [debouncedValue, setDebouncedValue] = useState(value)\r\n\r\n useEffect(\r\n () => {\r\n // Update debounced value after delay\r\n const handler = setTimeout(() => {\r\n setDebouncedValue(value)\r\n }, delay)\r\n // Cancel the timeout if value changes (also on delay change or unmount)\r\n // This is how we prevent debounced value from updating if value is changed ...\r\n // .. within the delay period. Timeout gets cleared and restarted.\r\n return () => {\r\n clearTimeout(handler)\r\n }\r\n },\r\n [value, delay] // Only re-call effect if value or delay changes\r\n )\r\n return debouncedValue\r\n}\r\n\r\n/* useComponentWillMount:\r\n1. useRef is a hook that returns a mutable ref object whose .current property is initialized to the passed argument (initialValue).\r\n2. useEffect is a hook that calls a provided function (func) after the component renders for the first time.\r\n3. useEffect will only call func if willMount.current is true.\r\n4. willMount.current is set to false after the first render.\r\n5. func is called.\r\n6. The return value of useEffect is a cleanup function that is used to undo any work that was done in the effect.\r\n7. The cleanup function is not called until the component is unmounted. */\r\nexport const useComponentWillMount = (func: () => void) => {\r\n const willMount = useRef(true)\r\n if (willMount.current) {\r\n func()\r\n }\r\n willMount.current = false\r\n}\r\n\r\n/**\r\n *\r\n * @param dateString - the date string to be formatted\r\n * @returns date - a new date object with the date described in the dateString parameter\r\n */\r\nexport const dateFromWatercorpDate = (dateString: string): Date => {\r\n let year = +dateString.substring(0, 4)\r\n let month = +dateString.substring(4, 6) - 1\r\n let day = +dateString.substring(6, 8)\r\n let date = new Date(year, month, day)\r\n return date\r\n}\r\n\r\n// Returns a date object from a string in the format dd/mm/yyyy\r\nexport const simpleDateRenderer = (props: any) => {\r\n let formattedDate = new Date(props.value).toLocaleDateString('en-AU', {\r\n day: '2-digit',\r\n month: '2-digit',\r\n year: '2-digit'\r\n })\r\n if (!props?.value || formattedDate?.includes('1970')) {\r\n return ''\r\n }\r\n return {formattedDate}\r\n}\r\n\r\n// Returns formated date with link and pdf icon eg pdf icon 02 Feb 2022\r\nexport const pdfLinkDate = (props: any) => {\r\n let formattedDateNumericYear = new Date(props.value)\r\n .toLocaleDateString(undefined, {\r\n month: 'short',\r\n day: '2-digit',\r\n year: 'numeric'\r\n })\r\n .replace(',', '')\r\n\r\n if (!props?.value || formattedDateNumericYear?.includes('1970')) {\r\n return ''\r\n }\r\n\r\n return (\r\n \r\n \r\n {formattedDateNumericYear}\r\n \r\n )\r\n}\r\n\r\n// Returns formated date in dd/MMM/YYYY e.g. 02 Feb 2022\r\nexport const billDateFormat = (props: any) => {\r\n let formattedDateNumericYear = new Date(props.value)\r\n .toLocaleDateString(undefined, {\r\n month: 'short',\r\n day: '2-digit',\r\n year: 'numeric'\r\n })\r\n .replace(',', '')\r\n\r\n if (!props?.value || formattedDateNumericYear?.includes('1970')) {\r\n return ''\r\n }\r\n\r\n return {formattedDateNumericYear}\r\n}\r\n\r\n/**\r\n *\r\n * @param d - the date to be formatted\r\n * @returns - a string of the date in the Watercorp specific format\r\n */\r\nexport const toWatercorpDateFormat = (d: Date): string => {\r\n let date =\r\n Object.prototype.toString.call(d) == '[object Date]' ? d : new Date(d)\r\n let dString = date.toLocaleDateString('en-US', {\r\n year: 'numeric',\r\n month: '2-digit',\r\n day: '2-digit'\r\n })\r\n return `${dString.slice(-4)}${dString.slice(0, 2)}${dString.slice(-7, -5)}`\r\n}\r\n\r\n/**\r\n *\r\n * @param params - the params to be formatted\r\n * @returns - a string of the params in the Australian specific date format\r\n */\r\nexport const dateValueFormatter = (params: any): string => {\r\n if (!params.value) {\r\n return 'N/A'\r\n }\r\n let dString = new Date(params.value).toLocaleDateString('en-AU', {\r\n year: 'numeric',\r\n month: '2-digit',\r\n day: '2-digit'\r\n })\r\n return dString\r\n}\r\n\r\n/**\r\n *\r\n * @returns - a template string of a right aligned header cell\r\n */\r\nexport function rightAlignedColumnHeader() {\r\n return {\r\n template: `\r\n