From d137728e604b5db41655dfc59040c5cf1d9d0d63 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 10 Jul 2025 06:54:53 +1000 Subject: [PATCH] Refactor more UI components out into lib directory (#9994) * Refactor table column types * Offloading more component type definitions * Remove unused funcs * Move conversion functions * ActionButton * Refactor YesNoButton * ProgressBar * make row actions available * search input * ButtonMenu * Bump UI version * Tweak function defs --- .../components}/ActionButton.tsx | 2 +- .../buttons => lib/components}/ButtonMenu.tsx | 0 .../items => lib/components}/ProgressBar.tsx | 2 +- .../tables => lib/components}/RowActions.tsx | 29 +--- .../components/SearchInput.tsx} | 13 +- .../components}/YesNoButton.tsx | 2 +- .../functions/Conversion.tsx} | 0 src/frontend/lib/functions/Formatting.tsx | 88 +++++++++++ src/frontend/lib/index.ts | 22 +++ src/frontend/lib/types/Tables.tsx | 149 +++++++++++++++++- src/frontend/package.json | 2 +- .../src/components/buttons/AddItemButton.tsx | 5 +- .../src/components/buttons/AdminButton.tsx | 2 +- .../components/buttons/RemoveRowButton.tsx | 2 +- .../src/components/buttons/SplitButton.tsx | 2 +- .../buttons/StarredToggleButton.tsx | 2 +- .../src/components/calendar/Calendar.tsx | 6 +- .../src/components/details/Details.tsx | 4 +- .../src/components/details/DetailsImage.tsx | 2 +- .../src/components/forms/InstanceOptions.tsx | 2 +- .../components/forms/fields/ApiFormField.tsx | 2 +- .../components/forms/fields/TableField.tsx | 2 +- .../importer/ImportDataSelector.tsx | 18 +-- .../src/components/items/ActionDropdown.tsx | 2 +- .../src/components/items/InfoItem.tsx | 2 +- .../src/components/nav/BreadcrumbList.tsx | 2 +- .../src/components/panels/PanelGroup.tsx | 2 +- .../components/plugins/LocateItemButton.tsx | 2 +- .../components/plugins/RemoteComponent.tsx | 2 +- .../src/components/render/StatusRenderer.tsx | 2 +- .../components/wizards/OrderPartsWizard.tsx | 2 +- src/frontend/src/defaults/formatters.tsx | 110 +++---------- src/frontend/src/forms/BuildForms.tsx | 2 +- src/frontend/src/forms/PurchaseOrderForms.tsx | 4 +- src/frontend/src/forms/SalesOrderForms.tsx | 2 +- src/frontend/src/forms/StockForms.tsx | 2 +- src/frontend/src/functions/uid.tsx | 15 -- src/frontend/src/hooks/UseDashboardItems.tsx | 2 +- src/frontend/src/hooks/UseDataOutput.tsx | 2 +- src/frontend/src/hooks/UseFilter.tsx | 2 +- .../AccountSettings/AccountDetailPanel.tsx | 4 +- .../AdminCenter/CurrencyManagementPanel.tsx | 2 +- .../AdminCenter/ReportTemplatePanel.tsx | 2 +- src/frontend/src/pages/Notifications.tsx | 2 +- .../src/pages/part/PartStocktakeDetail.tsx | 4 +- .../pages/part/pricing/BomPricingPanel.tsx | 2 +- .../pages/part/pricing/PriceBreakPanel.tsx | 12 +- .../part/pricing/PurchaseHistoryPanel.tsx | 2 +- .../pages/part/pricing/SaleHistoryPanel.tsx | 2 +- .../part/pricing/SupplierPricingPanel.tsx | 2 +- .../part/pricing/VariantPricingPanel.tsx | 2 +- src/frontend/src/pages/stock/StockDetail.tsx | 2 +- src/frontend/src/states/SettingsStates.tsx | 2 +- src/frontend/src/tables/Column.tsx | 56 ------- src/frontend/src/tables/ColumnRenderers.tsx | 8 +- src/frontend/src/tables/InvenTreeTable.tsx | 88 ++--------- .../src/tables/InvenTreeTableHeader.tsx | 12 +- src/frontend/src/tables/bom/BomTable.tsx | 18 ++- src/frontend/src/tables/bom/UsedInTable.tsx | 2 +- .../tables/build/BuildAllocatedStockTable.tsx | 8 +- .../src/tables/build/BuildLineTable.tsx | 20 +-- .../src/tables/build/BuildOrderTable.tsx | 2 +- .../src/tables/build/BuildOrderTestTable.tsx | 4 +- .../src/tables/build/BuildOutputTable.tsx | 12 +- .../src/tables/company/AddressTable.tsx | 10 +- .../src/tables/company/CompanyTable.tsx | 2 +- .../src/tables/company/ContactTable.tsx | 8 +- .../src/tables/general/AttachmentTable.tsx | 12 +- .../src/tables/general/BarcodeScanTable.tsx | 6 +- .../src/tables/general/ExtraLineItemTable.tsx | 14 +- .../src/tables/machine/MachineListTable.tsx | 7 +- .../src/tables/machine/MachineTypeTable.tsx | 5 +- .../notifications/NotificationTable.tsx | 4 +- .../src/tables/part/ParametricPartTable.tsx | 4 +- .../tables/part/PartBuildAllocationsTable.tsx | 6 +- .../src/tables/part/PartCategoryTable.tsx | 6 +- .../tables/part/PartCategoryTemplateTable.tsx | 8 +- .../src/tables/part/PartParameterTable.tsx | 10 +- .../part/PartParameterTemplateTable.tsx | 8 +- .../tables/part/PartPurchaseOrdersTable.tsx | 4 +- .../tables/part/PartSalesAllocationsTable.tsx | 6 +- src/frontend/src/tables/part/PartTable.tsx | 7 +- .../src/tables/part/PartTestTemplateTable.tsx | 14 +- .../src/tables/part/RelatedPartTable.tsx | 8 +- .../src/tables/part/SelectionListTable.tsx | 8 +- .../src/tables/plugin/PluginErrorTable.tsx | 2 +- .../src/tables/plugin/PluginListTable.tsx | 6 +- .../ManufacturerPartParameterTable.tsx | 8 +- .../purchasing/ManufacturerPartTable.tsx | 8 +- .../purchasing/PurchaseOrderLineItemTable.tsx | 20 +-- .../tables/purchasing/SupplierPartTable.tsx | 8 +- .../purchasing/SupplierPriceBreakTable.tsx | 8 +- .../tables/sales/ReturnOrderLineItemTable.tsx | 10 +- .../sales/SalesOrderAllocationTable.tsx | 10 +- .../tables/sales/SalesOrderLineItemTable.tsx | 20 +-- .../tables/sales/SalesOrderShipmentTable.tsx | 16 +- .../src/tables/sales/SalesOrderTable.tsx | 2 +- .../src/tables/settings/ApiTokenTable.tsx | 2 +- .../settings/BarcodeScanHistoryTable.tsx | 6 +- .../src/tables/settings/CustomStateTable.tsx | 14 +- .../src/tables/settings/CustomUnitsTable.tsx | 8 +- .../src/tables/settings/EmailTable.tsx | 2 +- .../src/tables/settings/ErrorTable.tsx | 4 +- .../tables/settings/ExportSessionTable.tsx | 4 +- .../src/tables/settings/FailedTasksTable.tsx | 2 +- .../src/tables/settings/GroupTable.tsx | 8 +- .../tables/settings/ImportSessionTable.tsx | 6 +- .../src/tables/settings/PendingTasksTable.tsx | 4 +- .../src/tables/settings/ProjectCodeTable.tsx | 8 +- .../tables/settings/ScheduledTasksTable.tsx | 2 +- .../tables/settings/StocktakeReportTable.tsx | 4 +- .../src/tables/settings/TemplateTable.tsx | 10 +- .../src/tables/settings/UserTable.tsx | 8 +- .../src/tables/stock/InstalledItemsTable.tsx | 2 +- .../src/tables/stock/LocationTypesTable.tsx | 8 +- .../src/tables/stock/StockItemTable.tsx | 4 +- .../tables/stock/StockItemTestResultTable.tsx | 16 +- .../src/tables/stock/StockLocationTable.tsx | 4 +- .../src/tables/stock/StockTrackingTable.tsx | 2 +- 119 files changed, 664 insertions(+), 524 deletions(-) rename src/frontend/{src/components/buttons => lib/components}/ActionButton.tsx (95%) rename src/frontend/{src/components/buttons => lib/components}/ButtonMenu.tsx (100%) rename src/frontend/{src/components/items => lib/components}/ProgressBar.tsx (95%) rename src/frontend/{src/tables => lib/components}/RowActions.tsx (84%) rename src/frontend/{src/tables/Search.tsx => lib/components/SearchInput.tsx} (77%) rename src/frontend/{src/components/buttons => lib/components}/YesNoButton.tsx (94%) rename src/frontend/{src/functions/conversion.tsx => lib/functions/Conversion.tsx} (100%) create mode 100644 src/frontend/lib/functions/Formatting.tsx delete mode 100644 src/frontend/src/functions/uid.tsx delete mode 100644 src/frontend/src/tables/Column.tsx diff --git a/src/frontend/src/components/buttons/ActionButton.tsx b/src/frontend/lib/components/ActionButton.tsx similarity index 95% rename from src/frontend/src/components/buttons/ActionButton.tsx rename to src/frontend/lib/components/ActionButton.tsx index 57583cfb9b..2c79eddfd0 100644 --- a/src/frontend/src/components/buttons/ActionButton.tsx +++ b/src/frontend/lib/components/ActionButton.tsx @@ -6,7 +6,7 @@ import { } from '@mantine/core'; import type { ReactNode } from 'react'; -import { identifierString } from '../../functions/conversion'; +import { identifierString } from '../functions/Conversion'; export type ActionButtonProps = { icon?: ReactNode; diff --git a/src/frontend/src/components/buttons/ButtonMenu.tsx b/src/frontend/lib/components/ButtonMenu.tsx similarity index 100% rename from src/frontend/src/components/buttons/ButtonMenu.tsx rename to src/frontend/lib/components/ButtonMenu.tsx diff --git a/src/frontend/src/components/items/ProgressBar.tsx b/src/frontend/lib/components/ProgressBar.tsx similarity index 95% rename from src/frontend/src/components/items/ProgressBar.tsx rename to src/frontend/lib/components/ProgressBar.tsx index d27f592f2b..929c8c38fe 100644 --- a/src/frontend/src/components/items/ProgressBar.tsx +++ b/src/frontend/lib/components/ProgressBar.tsx @@ -1,6 +1,6 @@ import { Progress, Stack, Text } from '@mantine/core'; import { useMemo } from 'react'; -import { formatDecimal } from '../../defaults/formatters'; +import { formatDecimal } from '../functions/Formatting'; export type ProgressBarProps = { value: number; diff --git a/src/frontend/src/tables/RowActions.tsx b/src/frontend/lib/components/RowActions.tsx similarity index 84% rename from src/frontend/src/tables/RowActions.tsx rename to src/frontend/lib/components/RowActions.tsx index 9890b6d000..464744277c 100644 --- a/src/frontend/src/tables/RowActions.tsx +++ b/src/frontend/lib/components/RowActions.tsx @@ -9,31 +9,12 @@ import { IconTrash } from '@tabler/icons-react'; import { type ReactNode, useMemo, useState } from 'react'; -import type { NavigateFunction } from 'react-router-dom'; +import { cancelEvent } from '../functions/Events'; +import { getDetailUrl } from '../functions/Navigation'; +import { navigateToLink } from '../functions/Navigation'; +import type { RowAction, RowViewProps } from '../types/Tables'; -import type { ModelType } from '@lib/enums/ModelType'; -import { cancelEvent } from '@lib/functions/Events'; -import { getDetailUrl } from '@lib/functions/Navigation'; -import { navigateToLink } from '@lib/functions/Navigation'; - -// Type definition for a table row action -export type RowAction = { - title?: string; - tooltip?: string; - color?: string; - icon?: ReactNode; - onClick?: (event: any) => void; - hidden?: boolean; - disabled?: boolean; -}; - -type RowModelProps = { - modelType: ModelType; - modelId: number; - navigate: NavigateFunction; -}; - -export type RowViewProps = RowAction & RowModelProps; +export type { RowAction, RowViewProps } from '../types/Tables'; // Component for viewing a row in a table export function RowViewAction(props: RowViewProps): RowAction { diff --git a/src/frontend/src/tables/Search.tsx b/src/frontend/lib/components/SearchInput.tsx similarity index 77% rename from src/frontend/src/tables/Search.tsx rename to src/frontend/lib/components/SearchInput.tsx index 84379a793b..740c763719 100644 --- a/src/frontend/src/tables/Search.tsx +++ b/src/frontend/lib/components/SearchInput.tsx @@ -4,15 +4,22 @@ import { useDebouncedValue } from '@mantine/hooks'; import { IconSearch } from '@tabler/icons-react'; import { useEffect, useState } from 'react'; -export function TableSearchInput({ +/** + * A search input component that debounces user input + */ +export function SearchInput({ disabled, + debounce, + placeholder, searchCallback }: Readonly<{ disabled?: boolean; + debounce?: number; + placeholder?: string; searchCallback: (searchTerm: string) => void; }>) { const [value, setValue] = useState(''); - const [searchText] = useDebouncedValue(value, 500); + const [searchText] = useDebouncedValue(value, debounce ?? 500); useEffect(() => { searchCallback(searchText); @@ -24,7 +31,7 @@ export function TableSearchInput({ disabled={disabled} aria-label='table-search-input' leftSection={} - placeholder={t`Search`} + placeholder={placeholder ?? t`Search`} onChange={(event) => setValue(event.target.value)} rightSection={ value.length > 0 ? ( diff --git a/src/frontend/src/components/buttons/YesNoButton.tsx b/src/frontend/lib/components/YesNoButton.tsx similarity index 94% rename from src/frontend/src/components/buttons/YesNoButton.tsx rename to src/frontend/lib/components/YesNoButton.tsx index 6893821062..ee52e2af2c 100644 --- a/src/frontend/src/components/buttons/YesNoButton.tsx +++ b/src/frontend/lib/components/YesNoButton.tsx @@ -1,7 +1,7 @@ import { t } from '@lingui/core/macro'; import { Badge, Skeleton } from '@mantine/core'; -import { isTrue } from '../../functions/conversion'; +import { isTrue } from '../functions/Conversion'; export function PassFailButton({ value, diff --git a/src/frontend/src/functions/conversion.tsx b/src/frontend/lib/functions/Conversion.tsx similarity index 100% rename from src/frontend/src/functions/conversion.tsx rename to src/frontend/lib/functions/Conversion.tsx diff --git a/src/frontend/lib/functions/Formatting.tsx b/src/frontend/lib/functions/Formatting.tsx new file mode 100644 index 0000000000..6c81dd4698 --- /dev/null +++ b/src/frontend/lib/functions/Formatting.tsx @@ -0,0 +1,88 @@ +export interface FormatDecmimalOptionsInterface { + digits?: number; + minDigits?: number; + locale?: string; +} + +export interface FormatCurrencyOptionsInterface { + digits?: number; + minDigits?: number; + currency?: string; + locale?: string; + multiplier?: number; +} + +export function formatDecimal( + value: number | null | undefined, + options: FormatDecmimalOptionsInterface = {} +) { + const locale = options.locale || navigator.language || 'en-US'; + + if (value === null || value === undefined) { + return value; + } + + const formatter = new Intl.NumberFormat(locale, { + style: 'decimal', + maximumFractionDigits: options.digits ?? 6, + minimumFractionDigits: options.minDigits ?? 0 + }); + + return formatter.format(value); +} + +/* + * format currency (money) value based on current settings + * + * Options: + * - currency: Currency code (uses default value if none provided) + * - locale: Locale specified (uses default value if none provided) + * - digits: Maximum number of significant digits (default = 10) + */ +export function formatCurrencyValue( + value: number | string | null | undefined, + options: FormatCurrencyOptionsInterface = {} +) { + if (value == null || value == undefined) { + return null; + } + + value = Number.parseFloat(value.toString()); + + if (Number.isNaN(value) || !Number.isFinite(value)) { + return null; + } + + value *= options.multiplier ?? 1; + + // Extract locale information + const locale = options.locale || navigator.language || 'en-US'; + + const minDigits = options.minDigits ?? 0; + const maxDigits = options.digits ?? 6; + + const formatter = new Intl.NumberFormat(locale, { + style: 'currency', + currency: options.currency, + maximumFractionDigits: Math.max(minDigits, maxDigits), + minimumFractionDigits: Math.min(minDigits, maxDigits) + }); + + return formatter.format(value); +} + +/* + * Format a file size (in bytes) into a human-readable format + */ +export function formatFileSize(size: number) { + const suffixes: string[] = ['B', 'KB', 'MB', 'GB']; + + let idx = 0; + + while (size > 1024 && idx < suffixes.length) { + size /= 1024; + idx++; + } + + return `${size.toFixed(2)} ${suffixes[idx]}`; +} diff --git a/src/frontend/lib/index.ts b/src/frontend/lib/index.ts index 23b72da45d..fe825f12e0 100644 --- a/src/frontend/lib/index.ts +++ b/src/frontend/lib/index.ts @@ -13,6 +13,7 @@ export type { ModelDict } from './enums/ModelInformation'; export { UserRoles, UserPermissions } from './enums/Roles'; export type { InvenTreePluginContext } from './types/Plugins'; +export type { RowAction, RowViewProps } from './types/Tables'; // Common utility functions export { apiUrl } from './functions/Api'; @@ -22,3 +23,24 @@ export { navigateToLink } from './functions/Navigation'; export { checkPluginVersion } from './functions/Plugins'; + +export { + formatCurrencyValue, + formatDecimal, + formatFileSize +} from './functions/Formatting'; + +// Common UI components +export { ActionButton } from './components/ActionButton'; +export { ButtonMenu } from './components/ButtonMenu'; +export { ProgressBar } from './components/ProgressBar'; +export { PassFailButton, YesNoButton } from './components/YesNoButton'; +export { SearchInput } from './components/SearchInput'; +export { + RowViewAction, + RowDuplicateAction, + RowEditAction, + RowDeleteAction, + RowCancelAction, + RowActions +} from './components/RowActions'; diff --git a/src/frontend/lib/types/Tables.tsx b/src/frontend/lib/types/Tables.tsx index 8b92fc5410..c27dfa40a9 100644 --- a/src/frontend/lib/types/Tables.tsx +++ b/src/frontend/lib/types/Tables.tsx @@ -1,5 +1,13 @@ -import type { SetURLSearchParams } from 'react-router-dom'; -import type { FilterSetState } from './Filters'; +import type { MantineStyleProp } from '@mantine/core'; +import type { + DataTableCellClickHandler, + DataTableRowExpansionProps +} from 'mantine-datatable'; +import type { ReactNode } from 'react'; +import type { NavigateFunction, SetURLSearchParams } from 'react-router-dom'; +import type { ModelType } from '../enums/ModelType'; +import type { FilterSetState, TableFilter } from './Filters'; +import type { ApiFormFieldType } from './Forms'; /* * Type definition for representing the state of a table: @@ -65,3 +73,140 @@ export type TableState = { setHiddenColumns: (columns: string[]) => void; idAccessor?: string; }; + +/** + * Table column properties + * + * @param T - The type of the record + * @param accessor - The key in the record to access + * @param title - The title of the column - Note: this may be supplied by the API, and is not required, but it can be overridden if required + * @param ordering - The key in the record to sort by (defaults to accessor) + * @param sortable - Whether the column is sortable + * @param switchable - Whether the column is switchable + * @param defaultVisible - Whether the column is visible by default (defaults to true) + * @param hidden - Whether the column is hidden (forced hidden, cannot be toggled by the user)) + * @param editable - Whether the value of this column can be edited + * @param definition - Optional field definition for the column + * @param render - A custom render function + * @param filter - A custom filter function + * @param filtering - Whether the column is filterable + * @param width - The width of the column + * @param resizable - Whether the column is resizable (defaults to true) + * @param noWrap - Whether the column should wrap + * @param ellipsis - Whether the column should be ellipsized + * @param textAlign - The text alignment of the column + * @param cellsStyle - The style of the cells in the column + * @param extra - Extra data to pass to the render function + * @param noContext - Disable context menu for this column + */ +export type TableColumnProps = { + accessor?: string; + title?: string; + ordering?: string; + sortable?: boolean; + switchable?: boolean; + hidden?: boolean; + defaultVisible?: boolean; + editable?: boolean; + definition?: ApiFormFieldType; + render?: (record: T, index?: number) => any; + filter?: any; + filtering?: boolean; + width?: number; + resizable?: boolean; + noWrap?: boolean; + ellipsis?: boolean; + textAlign?: 'left' | 'center' | 'right'; + cellsStyle?: any; + extra?: any; + noContext?: boolean; +}; + +/** + * Interface for the table column definition + */ +export type TableColumn = { + accessor: string; // The key in the record to access +} & TableColumnProps; + +// Type definition for a table row action +export type RowAction = { + title?: string; + tooltip?: string; + color?: string; + icon?: ReactNode; + onClick?: (event: any) => void; + hidden?: boolean; + disabled?: boolean; +}; + +type RowModelProps = { + modelType: ModelType; + modelId: number; + navigate: NavigateFunction; +}; + +export type RowViewProps = RowAction & RowModelProps; + +/** + * Set of optional properties which can be passed to an InvenTreeTable component + * + * @param params : any - Base query parameters + * @param tableState : TableState - State manager for the table + * @param defaultSortColumn : string - Default column to sort by + * @param noRecordsText : string - Text to display when no records are found + * @param enableBulkDelete : boolean - Enable bulk deletion of records + * @param enableDownload : boolean - Enable download actions + * @param enableFilters : boolean - Enable filter actions + * @param enableSelection : boolean - Enable row selection + * @param enableSearch : boolean - Enable search actions + * @param enableLabels : boolean - Enable printing of labels against selected items + * @param enableReports : boolean - Enable printing of reports against selected items + * @param printingAccessor : string - Accessor for label and report printing (default = 'pk') + * @param enablePagination : boolean - Enable pagination + * @param enableRefresh : boolean - Enable refresh actions + * @param enableColumnSwitching : boolean - Enable column switching + * @param enableColumnCaching : boolean - Enable caching of column names via API + * @param barcodeActions : any[] - List of barcode actions + * @param tableFilters : TableFilter[] - List of custom filters + * @param tableActions : any[] - List of custom action groups + * @param dataFormatter : (data: any) => any - Callback function to reformat data returned by server (if not in default format) + * @param rowActions : (record: any) => RowAction[] - Callback function to generate row actions + * @param onRowClick : (record: any, index: number, event: any) => void - Callback function when a row is clicked + * @param onCellClick : (event: any, record: any, index: number, column: any, columnIndex: number) => void - Callback function when a cell is clicked + * @param modelType: ModelType - The model type for the table + * @param minHeight: number - Minimum height of the table (default 300px) + * @param noHeader: boolean - Hide the table header + */ +export type InvenTreeTableProps = { + params?: any; + defaultSortColumn?: string; + noRecordsText?: string; + enableBulkDelete?: boolean; + enableDownload?: boolean; + enableFilters?: boolean; + enableSelection?: boolean; + enableSearch?: boolean; + enablePagination?: boolean; + enableRefresh?: boolean; + enableColumnSwitching?: boolean; + enableColumnCaching?: boolean; + enableLabels?: boolean; + enableReports?: boolean; + printingAccessor?: string; + afterBulkDelete?: () => void; + barcodeActions?: React.ReactNode[]; + tableFilters?: TableFilter[]; + tableActions?: React.ReactNode[]; + rowExpansion?: DataTableRowExpansionProps; + dataFormatter?: (data: any) => any; + rowActions?: (record: T) => RowAction[]; + onRowClick?: (record: T, index: number, event: any) => void; + onCellClick?: DataTableCellClickHandler; + modelType?: ModelType; + rowStyle?: (record: T, index: number) => MantineStyleProp | undefined; + modelField?: string; + onCellContextMenu?: (record: T, event: any) => void; + minHeight?: number; + noHeader?: boolean; +}; diff --git a/src/frontend/package.json b/src/frontend/package.json index a8cf935080..fd82a82b76 100644 --- a/src/frontend/package.json +++ b/src/frontend/package.json @@ -1,7 +1,7 @@ { "name": "@inventreedb/ui", "description": "UI components for the InvenTree project", - "version": "0.2.3", + "version": "0.3.0", "private": false, "type": "module", "license": "MIT", diff --git a/src/frontend/src/components/buttons/AddItemButton.tsx b/src/frontend/src/components/buttons/AddItemButton.tsx index 397fc2ed6e..f1600e5b83 100644 --- a/src/frontend/src/components/buttons/AddItemButton.tsx +++ b/src/frontend/src/components/buttons/AddItemButton.tsx @@ -1,6 +1,9 @@ import { IconPlus } from '@tabler/icons-react'; -import { ActionButton, type ActionButtonProps } from './ActionButton'; +import { + ActionButton, + type ActionButtonProps +} from '@lib/components/ActionButton'; /** * A generic icon button which is used to add or create a new item diff --git a/src/frontend/src/components/buttons/AdminButton.tsx b/src/frontend/src/components/buttons/AdminButton.tsx index d56811d6fc..edc5c8dd72 100644 --- a/src/frontend/src/components/buttons/AdminButton.tsx +++ b/src/frontend/src/components/buttons/AdminButton.tsx @@ -2,13 +2,13 @@ import { t } from '@lingui/core/macro'; import { IconUserStar } from '@tabler/icons-react'; import { useCallback, useMemo } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; import { ModelInformationDict } from '@lib/enums/ModelInformation'; import type { ModelType } from '@lib/enums/ModelType'; import { eventModified } from '@lib/functions/Navigation'; import { generateUrl } from '../../functions/urls'; import { useServerApiState } from '../../states/ServerApiState'; import { useUserState } from '../../states/UserState'; -import { ActionButton } from './ActionButton'; export type AdminButtonProps = { model: ModelType; diff --git a/src/frontend/src/components/buttons/RemoveRowButton.tsx b/src/frontend/src/components/buttons/RemoveRowButton.tsx index b8595cf38c..69bf48130d 100644 --- a/src/frontend/src/components/buttons/RemoveRowButton.tsx +++ b/src/frontend/src/components/buttons/RemoveRowButton.tsx @@ -1,7 +1,7 @@ import { t } from '@lingui/core/macro'; +import { ActionButton } from '@lib/components/ActionButton'; import { InvenTreeIcon } from '../../functions/icons'; -import { ActionButton } from './ActionButton'; export default function RemoveRowButton({ onClick, diff --git a/src/frontend/src/components/buttons/SplitButton.tsx b/src/frontend/src/components/buttons/SplitButton.tsx index 45734aeece..d16e49e330 100644 --- a/src/frontend/src/components/buttons/SplitButton.tsx +++ b/src/frontend/src/components/buttons/SplitButton.tsx @@ -10,8 +10,8 @@ import { import { IconChevronDown } from '@tabler/icons-react'; import { useEffect, useMemo, useState } from 'react'; +import { identifierString } from '@lib/functions/Conversion'; import type { TablerIconType } from '@lib/types/Icons'; -import { identifierString } from '../../functions/conversion'; import * as classes from './SplitButton.css'; interface SplitButtonOption { diff --git a/src/frontend/src/components/buttons/StarredToggleButton.tsx b/src/frontend/src/components/buttons/StarredToggleButton.tsx index 73d241d92c..f9c6fc036a 100644 --- a/src/frontend/src/components/buttons/StarredToggleButton.tsx +++ b/src/frontend/src/components/buttons/StarredToggleButton.tsx @@ -1,3 +1,4 @@ +import { ActionButton } from '@lib/components/ActionButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { apiUrl } from '@lib/functions/Api'; @@ -6,7 +7,6 @@ import { showNotification } from '@mantine/notifications'; import { IconBell } from '@tabler/icons-react'; import type { JSX } from 'react'; import { useApi } from '../../contexts/ApiContext'; -import { ActionButton } from './ActionButton'; export default function StarredToggleButton({ instance, diff --git a/src/frontend/src/components/calendar/Calendar.tsx b/src/frontend/src/components/calendar/Calendar.tsx index 7917fd645b..57f04c8d34 100644 --- a/src/frontend/src/components/calendar/Calendar.tsx +++ b/src/frontend/src/components/calendar/Calendar.tsx @@ -4,6 +4,8 @@ import dayGridPlugin from '@fullcalendar/daygrid'; import interactionPlugin from '@fullcalendar/interaction'; import FullCalendar from '@fullcalendar/react'; +import { ActionButton } from '@lib/components/ActionButton'; +import { SearchInput } from '@lib/components/SearchInput'; import type { TableFilter } from '@lib/types/Filters'; import { t } from '@lingui/core/macro'; import { @@ -30,9 +32,7 @@ import { useShallow } from 'zustand/react/shallow'; import type { CalendarState } from '../../hooks/UseCalendar'; import { useLocalState } from '../../states/LocalState'; import { FilterSelectDrawer } from '../../tables/FilterSelectDrawer'; -import { TableSearchInput } from '../../tables/Search'; import { Boundary } from '../Boundary'; -import { ActionButton } from '../buttons/ActionButton'; import { StylishText } from '../items/StylishText'; export interface InvenTreeCalendarProps extends CalendarOptions { @@ -147,7 +147,7 @@ export default function Calendar({ {enableSearch && ( - + )} {enableFilters && filters && filters.length > 0 && ( 1024 && idx < suffixes.length) { - size /= 1024; - idx++; - } - - return `${size.toFixed(2)} ${suffixes[idx]}`; -} - interface FormatDateOptionsInterface { showTime?: boolean; showSeconds?: boolean; diff --git a/src/frontend/src/forms/BuildForms.tsx b/src/frontend/src/forms/BuildForms.tsx index d6d1c68fda..e0ccb48cd9 100644 --- a/src/frontend/src/forms/BuildForms.tsx +++ b/src/frontend/src/forms/BuildForms.tsx @@ -16,13 +16,13 @@ import { ModelType } from '@lib/enums/ModelType'; import RemoveRowButton from '../components/buttons/RemoveRowButton'; import { StandaloneField } from '../components/forms/StandaloneField'; +import { ProgressBar } from '@lib/components/ProgressBar'; import { apiUrl } from '@lib/functions/Api'; import type { ApiFormFieldSet, ApiFormFieldType } from '@lib/types/Forms'; import { TableFieldErrorWrapper, type TableFieldRowProps } from '../components/forms/fields/TableField'; -import { ProgressBar } from '../components/items/ProgressBar'; import { StatusRenderer } from '../components/render/StatusRenderer'; import { useCreateApiFormModal } from '../hooks/UseForm'; import { diff --git a/src/frontend/src/forms/PurchaseOrderForms.tsx b/src/frontend/src/forms/PurchaseOrderForms.tsx index 2a5beccd12..2e0311f4a0 100644 --- a/src/frontend/src/forms/PurchaseOrderForms.tsx +++ b/src/frontend/src/forms/PurchaseOrderForms.tsx @@ -24,14 +24,15 @@ import { } from '@tabler/icons-react'; import { useEffect, useMemo, useState } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { IconCalendarExclamation } from '@tabler/icons-react'; import dayjs from 'dayjs'; -import { ActionButton } from '../components/buttons/ActionButton'; import RemoveRowButton from '../components/buttons/RemoveRowButton'; import { StandaloneField } from '../components/forms/StandaloneField'; +import { ProgressBar } from '@lib/components/ProgressBar'; import { apiUrl } from '@lib/functions/Api'; import type { ApiFormAdjustFilterType, @@ -42,7 +43,6 @@ import { type TableFieldRowProps } from '../components/forms/fields/TableField'; import { Thumbnail } from '../components/images/Thumbnail'; -import { ProgressBar } from '../components/items/ProgressBar'; import { StylishText } from '../components/items/StylishText'; import { getStatusCodeOptions } from '../components/render/StatusRenderer'; import { InvenTreeIcon } from '../functions/icons'; diff --git a/src/frontend/src/forms/SalesOrderForms.tsx b/src/frontend/src/forms/SalesOrderForms.tsx index b8b6e8bb9d..98f2587183 100644 --- a/src/frontend/src/forms/SalesOrderForms.tsx +++ b/src/frontend/src/forms/SalesOrderForms.tsx @@ -13,6 +13,7 @@ import { ModelType } from '@lib/enums/ModelType'; import RemoveRowButton from '../components/buttons/RemoveRowButton'; import { StandaloneField } from '../components/forms/StandaloneField'; +import { ProgressBar } from '@lib/components/ProgressBar'; import { apiUrl } from '@lib/functions/Api'; import type { ApiFormAdjustFilterType, @@ -20,7 +21,6 @@ import type { ApiFormFieldType } from '@lib/types/Forms'; import type { TableFieldRowProps } from '../components/forms/fields/TableField'; -import { ProgressBar } from '../components/items/ProgressBar'; import { useCreateApiFormModal } from '../hooks/UseForm'; import { useGlobalSettingsState } from '../states/SettingsStates'; import { PartColumn } from '../tables/ColumnRenderers'; diff --git a/src/frontend/src/forms/StockForms.tsx b/src/frontend/src/forms/StockForms.tsx index 5e7abe5fc3..f94ecc6184 100644 --- a/src/frontend/src/forms/StockForms.tsx +++ b/src/frontend/src/forms/StockForms.tsx @@ -22,12 +22,12 @@ import { import { useQuery, useSuspenseQuery } from '@tanstack/react-query'; import { type JSX, Suspense, useEffect, useMemo, useState } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import dayjs from 'dayjs'; import { useNavigate } from 'react-router-dom'; import { api } from '../App'; -import { ActionButton } from '../components/buttons/ActionButton'; import RemoveRowButton from '../components/buttons/RemoveRowButton'; import { StandaloneField } from '../components/forms/StandaloneField'; diff --git a/src/frontend/src/functions/uid.tsx b/src/frontend/src/functions/uid.tsx deleted file mode 100644 index 3311809f83..0000000000 --- a/src/frontend/src/functions/uid.tsx +++ /dev/null @@ -1,15 +0,0 @@ -// dec2hex :: Integer -> String -// i.e. 0-255 -> '00'-'ff' -function dec2hex(dec: number) { - return dec.toString(16).padStart(2, '0'); -} - -/** - * Generate a unique ID string with the specified number of values - */ -export function generateUniqueId(length = 8): string { - const arr = new Uint8Array(length / 2); - window.crypto.getRandomValues(arr); - - return Array.from(arr, dec2hex).join(''); -} diff --git a/src/frontend/src/hooks/UseDashboardItems.tsx b/src/frontend/src/hooks/UseDashboardItems.tsx index f7f7e34c94..4d91c6bf20 100644 --- a/src/frontend/src/hooks/UseDashboardItems.tsx +++ b/src/frontend/src/hooks/UseDashboardItems.tsx @@ -3,6 +3,7 @@ import { useMemo } from 'react'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; +import { identifierString } from '@lib/functions/Conversion'; import { api } from '../App'; import type { DashboardWidgetProps } from '../components/dashboard/DashboardWidget'; import DashboardWidgetLibrary from '../components/dashboard/DashboardWidgetLibrary'; @@ -12,7 +13,6 @@ import { PluginUIFeatureType } from '../components/plugins/PluginUIFeature'; import RemoteComponent from '../components/plugins/RemoteComponent'; -import { identifierString } from '../functions/conversion'; import { useGlobalSettingsState } from '../states/SettingsStates'; import { useUserState } from '../states/UserState'; diff --git a/src/frontend/src/hooks/UseDataOutput.tsx b/src/frontend/src/hooks/UseDataOutput.tsx index 484df8a979..7844e899c0 100644 --- a/src/frontend/src/hooks/UseDataOutput.tsx +++ b/src/frontend/src/hooks/UseDataOutput.tsx @@ -1,3 +1,4 @@ +import { ProgressBar } from '@lib/components/ProgressBar'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; import { t } from '@lingui/core/macro'; @@ -6,7 +7,6 @@ import { notifications, showNotification } from '@mantine/notifications'; import { IconCircleCheck, IconExclamationCircle } from '@tabler/icons-react'; import { useQuery } from '@tanstack/react-query'; import { useEffect, useState } from 'react'; -import { ProgressBar } from '../components/items/ProgressBar'; import { useApi } from '../contexts/ApiContext'; import { generateUrl } from '../functions/urls'; diff --git a/src/frontend/src/hooks/UseFilter.tsx b/src/frontend/src/hooks/UseFilter.tsx index b4b5693f74..88781f9d8d 100644 --- a/src/frontend/src/hooks/UseFilter.tsx +++ b/src/frontend/src/hooks/UseFilter.tsx @@ -5,9 +5,9 @@ import { useQuery } from '@tanstack/react-query'; import { useCallback, useMemo } from 'react'; +import { resolveItem } from '@lib/functions/Conversion'; import type { TableFilterChoice } from '@lib/types/Filters'; import { useApi } from '../contexts/ApiContext'; -import { resolveItem } from '../functions/conversion'; type UseFilterProps = { url: string; diff --git a/src/frontend/src/pages/Index/Settings/AccountSettings/AccountDetailPanel.tsx b/src/frontend/src/pages/Index/Settings/AccountSettings/AccountDetailPanel.tsx index fb4356b036..f879e77906 100644 --- a/src/frontend/src/pages/Index/Settings/AccountSettings/AccountDetailPanel.tsx +++ b/src/frontend/src/pages/Index/Settings/AccountSettings/AccountDetailPanel.tsx @@ -4,12 +4,12 @@ import { Badge, Group, Stack, Table } from '@mantine/core'; import { IconEdit, IconKey, IconUser } from '@tabler/icons-react'; import { useMemo } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; +import { YesNoUndefinedButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import type { ApiFormFieldSet } from '@lib/types/Forms'; import { useNavigate } from 'react-router-dom'; import { useShallow } from 'zustand/react/shallow'; -import { ActionButton } from '../../../../components/buttons/ActionButton'; -import { YesNoUndefinedButton } from '../../../../components/buttons/YesNoButton'; import { ActionDropdown } from '../../../../components/items/ActionDropdown'; import { StylishText } from '../../../../components/items/StylishText'; import { useEditApiFormModal } from '../../../../hooks/UseForm'; diff --git a/src/frontend/src/pages/Index/Settings/AdminCenter/CurrencyManagementPanel.tsx b/src/frontend/src/pages/Index/Settings/AdminCenter/CurrencyManagementPanel.tsx index c2c47d9787..a0972b445c 100644 --- a/src/frontend/src/pages/Index/Settings/AdminCenter/CurrencyManagementPanel.tsx +++ b/src/frontend/src/pages/Index/Settings/AdminCenter/CurrencyManagementPanel.tsx @@ -4,10 +4,10 @@ import { showNotification } from '@mantine/notifications'; import { IconReload } from '@tabler/icons-react'; import { useCallback, useMemo, useState } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; import { api } from '../../../../App'; -import { ActionButton } from '../../../../components/buttons/ActionButton'; import { FactCollection } from '../../../../components/settings/FactCollection'; import { GlobalSettingList } from '../../../../components/settings/SettingList'; import { showApiErrorMessage } from '../../../../functions/notifications'; diff --git a/src/frontend/src/pages/Index/Settings/AdminCenter/ReportTemplatePanel.tsx b/src/frontend/src/pages/Index/Settings/AdminCenter/ReportTemplatePanel.tsx index 6daf4f0b83..fb6a7222c6 100644 --- a/src/frontend/src/pages/Index/Settings/AdminCenter/ReportTemplatePanel.tsx +++ b/src/frontend/src/pages/Index/Settings/AdminCenter/ReportTemplatePanel.tsx @@ -1,7 +1,7 @@ +import { YesNoButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { t } from '@lingui/core/macro'; -import { YesNoButton } from '../../../../components/buttons/YesNoButton'; import { TemplateTable } from '../../../../tables/settings/TemplateTable'; function ReportTemplateTable() { diff --git a/src/frontend/src/pages/Notifications.tsx b/src/frontend/src/pages/Notifications.tsx index f978a5a753..0de7c798eb 100644 --- a/src/frontend/src/pages/Notifications.tsx +++ b/src/frontend/src/pages/Notifications.tsx @@ -10,9 +10,9 @@ import { } from '@tabler/icons-react'; import { useCallback, useMemo } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; -import { ActionButton } from '../components/buttons/ActionButton'; import { PageDetail } from '../components/nav/PageDetail'; import { PanelGroup } from '../components/panels/PanelGroup'; import { useApi } from '../contexts/ApiContext'; diff --git a/src/frontend/src/pages/part/PartStocktakeDetail.tsx b/src/frontend/src/pages/part/PartStocktakeDetail.tsx index b1c969996a..80c39eee8c 100644 --- a/src/frontend/src/pages/part/PartStocktakeDetail.tsx +++ b/src/frontend/src/pages/part/PartStocktakeDetail.tsx @@ -10,9 +10,11 @@ import { } from '@mantine/core'; import { useCallback, useMemo, useState } from 'react'; +import { RowDeleteAction, RowEditAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import dayjs from 'dayjs'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { formatDate, formatPriceRange } from '../../defaults/formatters'; @@ -27,9 +29,7 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../../tables/Column'; import { InvenTreeTable } from '../../tables/InvenTreeTable'; -import { RowDeleteAction, RowEditAction } from '../../tables/RowActions'; /* * Render a tooltip for the chart, with correct date information diff --git a/src/frontend/src/pages/part/pricing/BomPricingPanel.tsx b/src/frontend/src/pages/part/pricing/BomPricingPanel.tsx index 978998aa24..13e7e69506 100644 --- a/src/frontend/src/pages/part/pricing/BomPricingPanel.tsx +++ b/src/frontend/src/pages/part/pricing/BomPricingPanel.tsx @@ -14,6 +14,7 @@ import { type ReactNode, useMemo, useState } from 'react'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { CHART_COLORS } from '../../../components/charts/colors'; import { tooltipFormatter } from '../../../components/charts/tooltipFormatter'; import { @@ -22,7 +23,6 @@ import { formatPriceRange } from '../../../defaults/formatters'; import { useTable } from '../../../hooks/UseTable'; -import type { TableColumn } from '../../../tables/Column'; import { DateColumn, PartColumn } from '../../../tables/ColumnRenderers'; import { InvenTreeTable } from '../../../tables/InvenTreeTable'; import { LoadingPricingData, NoPricingData } from './PricingPanel'; diff --git a/src/frontend/src/pages/part/pricing/PriceBreakPanel.tsx b/src/frontend/src/pages/part/pricing/PriceBreakPanel.tsx index e73870a483..51c2165f3b 100644 --- a/src/frontend/src/pages/part/pricing/PriceBreakPanel.tsx +++ b/src/frontend/src/pages/part/pricing/PriceBreakPanel.tsx @@ -3,10 +3,16 @@ import { BarChart } from '@mantine/charts'; import { SimpleGrid } from '@mantine/core'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import type { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../../components/buttons/AddItemButton'; import { tooltipFormatter } from '../../../components/charts/tooltipFormatter'; import { formatCurrency } from '../../../defaults/formatters'; @@ -17,13 +23,7 @@ import { } from '../../../hooks/UseForm'; import { useTable } from '../../../hooks/UseTable'; import { useUserState } from '../../../states/UserState'; -import type { TableColumn } from '../../../tables/Column'; import { InvenTreeTable } from '../../../tables/InvenTreeTable'; -import { - type RowAction, - RowDeleteAction, - RowEditAction -} from '../../../tables/RowActions'; import { NoPricingData } from './PricingPanel'; export default function PriceBreakPanel({ diff --git a/src/frontend/src/pages/part/pricing/PurchaseHistoryPanel.tsx b/src/frontend/src/pages/part/pricing/PurchaseHistoryPanel.tsx index bf6bc7a4a2..53f71388be 100644 --- a/src/frontend/src/pages/part/pricing/PurchaseHistoryPanel.tsx +++ b/src/frontend/src/pages/part/pricing/PurchaseHistoryPanel.tsx @@ -5,9 +5,9 @@ import { type ReactNode, useCallback, useMemo } from 'react'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { formatCurrency, formatDate } from '../../../defaults/formatters'; import { useTable } from '../../../hooks/UseTable'; -import type { TableColumn } from '../../../tables/Column'; import { InvenTreeTable } from '../../../tables/InvenTreeTable'; import { NoPricingData } from './PricingPanel'; diff --git a/src/frontend/src/pages/part/pricing/SaleHistoryPanel.tsx b/src/frontend/src/pages/part/pricing/SaleHistoryPanel.tsx index 6606f889fa..1f38d460c1 100644 --- a/src/frontend/src/pages/part/pricing/SaleHistoryPanel.tsx +++ b/src/frontend/src/pages/part/pricing/SaleHistoryPanel.tsx @@ -5,9 +5,9 @@ import { type ReactNode, useMemo } from 'react'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { formatCurrency } from '../../../defaults/formatters'; import { useTable } from '../../../hooks/UseTable'; -import type { TableColumn } from '../../../tables/Column'; import { DateColumn } from '../../../tables/ColumnRenderers'; import { InvenTreeTable } from '../../../tables/InvenTreeTable'; import { NoPricingData } from './PricingPanel'; diff --git a/src/frontend/src/pages/part/pricing/SupplierPricingPanel.tsx b/src/frontend/src/pages/part/pricing/SupplierPricingPanel.tsx index 2d02646542..e807d84a4c 100644 --- a/src/frontend/src/pages/part/pricing/SupplierPricingPanel.tsx +++ b/src/frontend/src/pages/part/pricing/SupplierPricingPanel.tsx @@ -5,9 +5,9 @@ import { useMemo } from 'react'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { tooltipFormatter } from '../../../components/charts/tooltipFormatter'; import { useTable } from '../../../hooks/UseTable'; -import type { TableColumn } from '../../../tables/Column'; import { InvenTreeTable } from '../../../tables/InvenTreeTable'; import { SupplierPriceBreakColumns, diff --git a/src/frontend/src/pages/part/pricing/VariantPricingPanel.tsx b/src/frontend/src/pages/part/pricing/VariantPricingPanel.tsx index 52f261dbfc..2d5b3066ce 100644 --- a/src/frontend/src/pages/part/pricing/VariantPricingPanel.tsx +++ b/src/frontend/src/pages/part/pricing/VariantPricingPanel.tsx @@ -6,10 +6,10 @@ import { type ReactNode, useMemo } from 'react'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { tooltipFormatter } from '../../../components/charts/tooltipFormatter'; import { formatCurrency } from '../../../defaults/formatters'; import { useTable } from '../../../hooks/UseTable'; -import type { TableColumn } from '../../../tables/Column'; import { DateColumn, PartColumn } from '../../../tables/ColumnRenderers'; import { InvenTreeTable } from '../../../tables/InvenTreeTable'; import { NoPricingData } from './PricingPanel'; diff --git a/src/frontend/src/pages/stock/StockDetail.tsx b/src/frontend/src/pages/stock/StockDetail.tsx index cc09e1a5b5..98f7c4573f 100644 --- a/src/frontend/src/pages/stock/StockDetail.tsx +++ b/src/frontend/src/pages/stock/StockDetail.tsx @@ -28,6 +28,7 @@ import { useQuery } from '@tanstack/react-query'; import { type ReactNode, useMemo, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; +import { ActionButton } from '@lib/components/ActionButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; @@ -35,7 +36,6 @@ import { apiUrl } from '@lib/functions/Api'; import { getDetailUrl } from '@lib/functions/Navigation'; import { notifications } from '@mantine/notifications'; import { useBarcodeScanDialog } from '../../components/barcodes/BarcodeScanDialog'; -import { ActionButton } from '../../components/buttons/ActionButton'; import AdminButton from '../../components/buttons/AdminButton'; import { PrintingActions } from '../../components/buttons/PrintingActions'; import { diff --git a/src/frontend/src/states/SettingsStates.tsx b/src/frontend/src/states/SettingsStates.tsx index c9442f745b..0a93cc235d 100644 --- a/src/frontend/src/states/SettingsStates.tsx +++ b/src/frontend/src/states/SettingsStates.tsx @@ -5,6 +5,7 @@ import { create, createStore } from 'zustand'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; +import { isTrue } from '@lib/functions/Conversion'; import type { PathParams } from '@lib/types/Core'; import type { Setting, @@ -13,7 +14,6 @@ import type { } from '@lib/types/Settings'; import { useEffect } from 'react'; import { api } from '../App'; -import { isTrue } from '../functions/conversion'; import { useUserState } from './UserState'; /** diff --git a/src/frontend/src/tables/Column.tsx b/src/frontend/src/tables/Column.tsx deleted file mode 100644 index f4634b9b09..0000000000 --- a/src/frontend/src/tables/Column.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import type { ApiFormFieldType } from '@lib/types/Forms'; - -/** - * Table column properties - * - * @param T - The type of the record - * @param accessor - The key in the record to access - * @param title - The title of the column - Note: this may be supplied by the API, and is not required, but it can be overridden if required - * @param ordering - The key in the record to sort by (defaults to accessor) - * @param sortable - Whether the column is sortable - * @param switchable - Whether the column is switchable - * @param defaultVisible - Whether the column is visible by default (defaults to true) - * @param hidden - Whether the column is hidden (forced hidden, cannot be toggled by the user)) - * @param editable - Whether the value of this column can be edited - * @param definition - Optional field definition for the column - * @param render - A custom render function - * @param filter - A custom filter function - * @param filtering - Whether the column is filterable - * @param width - The width of the column - * @param resizable - Whether the column is resizable (defaults to true) - * @param noWrap - Whether the column should wrap - * @param ellipsis - Whether the column should be ellipsized - * @param textAlign - The text alignment of the column - * @param cellsStyle - The style of the cells in the column - * @param extra - Extra data to pass to the render function - * @param noContext - Disable context menu for this column - */ -export type TableColumnProps = { - accessor?: string; - title?: string; - ordering?: string; - sortable?: boolean; - switchable?: boolean; - hidden?: boolean; - defaultVisible?: boolean; - editable?: boolean; - definition?: ApiFormFieldType; - render?: (record: T, index?: number) => any; - filter?: any; - filtering?: boolean; - width?: number; - resizable?: boolean; - noWrap?: boolean; - ellipsis?: boolean; - textAlign?: 'left' | 'center' | 'right'; - cellsStyle?: any; - extra?: any; - noContext?: boolean; -}; - -/** - * Interface for the table column definition - */ -export type TableColumn = { - accessor: string; // The key in the record to access -} & TableColumnProps; diff --git a/src/frontend/src/tables/ColumnRenderers.tsx b/src/frontend/src/tables/ColumnRenderers.tsx index 800d754c90..ef004dcb61 100644 --- a/src/frontend/src/tables/ColumnRenderers.tsx +++ b/src/frontend/src/tables/ColumnRenderers.tsx @@ -10,20 +10,20 @@ import { IconLock } from '@tabler/icons-react'; +import { ProgressBar } from '@lib/components/ProgressBar'; +import { YesNoButton } from '@lib/components/YesNoButton'; import type { ModelType } from '@lib/enums/ModelType'; +import { resolveItem } from '@lib/functions/Conversion'; import { cancelEvent } from '@lib/functions/Events'; -import { YesNoButton } from '../components/buttons/YesNoButton'; +import type { TableColumn, TableColumnProps } from '@lib/types/Tables'; import { Thumbnail } from '../components/images/Thumbnail'; -import { ProgressBar } from '../components/items/ProgressBar'; import { TableStatusRenderer } from '../components/render/StatusRenderer'; import { RenderOwner, RenderUser } from '../components/render/User'; import { formatCurrency, formatDate } from '../defaults/formatters'; -import { resolveItem } from '../functions/conversion'; import { useGlobalSettingsState, useUserSettingsState } from '../states/SettingsStates'; -import type { TableColumn, TableColumnProps } from './Column'; import { ProjectCodeHoverCard, TableHoverCard } from './TableHoverCard'; // Render a Part instance within a table diff --git a/src/frontend/src/tables/InvenTreeTable.tsx b/src/frontend/src/tables/InvenTreeTable.tsx index 571f03d070..996e07d1a0 100644 --- a/src/frontend/src/tables/InvenTreeTable.tsx +++ b/src/frontend/src/tables/InvenTreeTable.tsx @@ -1,5 +1,15 @@ +import { RowActions } from '@lib/components/RowActions'; +import { resolveItem } from '@lib/functions/Conversion'; +import { cancelEvent } from '@lib/functions/Events'; +import { getDetailUrl } from '@lib/functions/Navigation'; +import { navigateToLink } from '@lib/functions/Navigation'; +import type { TableFilter } from '@lib/types/Filters'; +import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { InvenTreeTableProps, TableState } from '@lib/types/Tables'; +import type { TableColumn } from '@lib/types/Tables'; import { t } from '@lingui/core/macro'; -import { Box, type MantineStyleProp, Stack } from '@mantine/core'; +import { Box, Stack } from '@mantine/core'; +import { IconArrowRight } from '@tabler/icons-react'; import { useQuery } from '@tanstack/react-query'; import { type ContextMenuItemOptions, @@ -7,7 +17,6 @@ import { } from 'mantine-contextmenu'; import { DataTable, - type DataTableCellClickHandler, type DataTableRowExpansionProps, type DataTableSortStatus, useDataTableColumns @@ -15,92 +24,17 @@ import { import type React from 'react'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; - -import type { ModelType } from '@lib/enums/ModelType'; -import { cancelEvent } from '@lib/functions/Events'; -import { getDetailUrl } from '@lib/functions/Navigation'; -import { navigateToLink } from '@lib/functions/Navigation'; -import type { TableFilter } from '@lib/types/Filters'; -import type { ApiFormFieldSet } from '@lib/types/Forms'; -import type { TableState } from '@lib/types/Tables'; -import { IconArrowRight } from '@tabler/icons-react'; import { Boundary } from '../components/Boundary'; import { useApi } from '../contexts/ApiContext'; -import { resolveItem } from '../functions/conversion'; import { extractAvailableFields, mapFields } from '../functions/forms'; import { showApiErrorMessage } from '../functions/notifications'; import { useLocalState } from '../states/LocalState'; import { useStoredTableState } from '../states/StoredTableState'; -import type { TableColumn } from './Column'; import InvenTreeTableHeader from './InvenTreeTableHeader'; -import { type RowAction, RowActions } from './RowActions'; const ACTIONS_COLUMN_ACCESSOR: string = '--actions--'; const PAGE_SIZES = [10, 15, 20, 25, 50, 100, 500]; -/** - * Set of optional properties which can be passed to an InvenTreeTable component - * - * @param params : any - Base query parameters - * @param tableState : TableState - State manager for the table - * @param defaultSortColumn : string - Default column to sort by - * @param noRecordsText : string - Text to display when no records are found - * @param enableBulkDelete : boolean - Enable bulk deletion of records - * @param enableDownload : boolean - Enable download actions - * @param enableFilters : boolean - Enable filter actions - * @param enableSelection : boolean - Enable row selection - * @param enableSearch : boolean - Enable search actions - * @param enableLabels : boolean - Enable printing of labels against selected items - * @param enableReports : boolean - Enable printing of reports against selected items - * @param printingAccessor : string - Accessor for label and report printing (default = 'pk') - * @param enablePagination : boolean - Enable pagination - * @param enableRefresh : boolean - Enable refresh actions - * @param enableColumnSwitching : boolean - Enable column switching - * @param enableColumnCaching : boolean - Enable caching of column names via API - * @param barcodeActions : any[] - List of barcode actions - * @param tableFilters : TableFilter[] - List of custom filters - * @param tableActions : any[] - List of custom action groups - * @param dataFormatter : (data: any) => any - Callback function to reformat data returned by server (if not in default format) - * @param rowActions : (record: any) => RowAction[] - Callback function to generate row actions - * @param onRowClick : (record: any, index: number, event: any) => void - Callback function when a row is clicked - * @param onCellClick : (event: any, record: any, index: number, column: any, columnIndex: number) => void - Callback function when a cell is clicked - * @param modelType: ModelType - The model type for the table - * @param minHeight: number - Minimum height of the table (default 300px) - * @param noHeader: boolean - Hide the table header - */ -export type InvenTreeTableProps = { - params?: any; - defaultSortColumn?: string; - noRecordsText?: string; - enableBulkDelete?: boolean; - enableDownload?: boolean; - enableFilters?: boolean; - enableSelection?: boolean; - enableSearch?: boolean; - enablePagination?: boolean; - enableRefresh?: boolean; - enableColumnSwitching?: boolean; - enableColumnCaching?: boolean; - enableLabels?: boolean; - enableReports?: boolean; - printingAccessor?: string; - afterBulkDelete?: () => void; - barcodeActions?: React.ReactNode[]; - tableFilters?: TableFilter[]; - tableActions?: React.ReactNode[]; - rowExpansion?: DataTableRowExpansionProps; - dataFormatter?: (data: any) => any; - rowActions?: (record: T) => RowAction[]; - onRowClick?: (record: T, index: number, event: any) => void; - onCellClick?: DataTableCellClickHandler; - modelType?: ModelType; - rowStyle?: (record: T, index: number) => MantineStyleProp | undefined; - modelField?: string; - onCellContextMenu?: (record: T, event: any) => void; - minHeight?: number; - noHeader?: boolean; -}; - /** * Default table properties (used if not specified) */ diff --git a/src/frontend/src/tables/InvenTreeTableHeader.tsx b/src/frontend/src/tables/InvenTreeTableHeader.tsx index 2542b9b8d6..d778b048ee 100644 --- a/src/frontend/src/tables/InvenTreeTableHeader.tsx +++ b/src/frontend/src/tables/InvenTreeTableHeader.tsx @@ -18,20 +18,20 @@ import { import { useMemo, useState } from 'react'; import { Fragment } from 'react/jsx-runtime'; +import { ActionButton } from '@lib/components/ActionButton'; +import { ButtonMenu } from '@lib/components/ButtonMenu'; +import { SearchInput } from '@lib/components/SearchInput'; +import { resolveItem } from '@lib/functions/Conversion'; import type { TableFilter } from '@lib/types/Filters'; import type { TableState } from '@lib/types/Tables'; +import type { InvenTreeTableProps } from '@lib/types/Tables'; import { showNotification } from '@mantine/notifications'; import { Boundary } from '../components/Boundary'; -import { ActionButton } from '../components/buttons/ActionButton'; -import { ButtonMenu } from '../components/buttons/ButtonMenu'; import { PrintingActions } from '../components/buttons/PrintingActions'; -import { resolveItem } from '../functions/conversion'; import useDataExport from '../hooks/UseDataExport'; import { useDeleteApiFormModal } from '../hooks/UseForm'; import { TableColumnSelect } from './ColumnSelect'; import { FilterSelectDrawer } from './FilterSelectDrawer'; -import type { InvenTreeTableProps } from './InvenTreeTable'; -import { TableSearchInput } from './Search'; /** * Render a composite header for an InvenTree table @@ -207,7 +207,7 @@ export default function InvenTreeTableHeader({ {tableProps.enableSearch && ( - tableState.setSearchTerm(term)} /> diff --git a/src/frontend/src/tables/bom/BomTable.tsx b/src/frontend/src/tables/bom/BomTable.tsx index 46f0600a7d..624c855b08 100644 --- a/src/frontend/src/tables/bom/BomTable.tsx +++ b/src/frontend/src/tables/bom/BomTable.tsx @@ -11,15 +11,21 @@ import { import { type ReactNode, useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { ActionButton } from '@lib/components/ActionButton'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; +import { YesNoButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import { navigateToLink } from '@lib/functions/Navigation'; import type { TableFilter } from '@lib/types/Filters'; -import { ActionButton } from '../../components/buttons/ActionButton'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; -import { YesNoButton } from '../../components/buttons/YesNoButton'; import { Thumbnail } from '../../components/images/Thumbnail'; import ImporterDrawer from '../../components/importer/ImporterDrawer'; import { RenderPart } from '../../components/render/Part'; @@ -35,7 +41,6 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { BooleanColumn, DescriptionColumn, @@ -44,7 +49,6 @@ import { } from '../ColumnRenderers'; import { PartCategoryFilter } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; import { TableHoverCard } from '../TableHoverCard'; // Calculate the total stock quantity available for a given BomItem @@ -89,7 +93,7 @@ export function BomTable({ accessor: 'sub_part', switchable: false, sortable: true, - render: (record) => { + render: (record: any) => { const part = record.sub_part_detail; const extra = []; @@ -147,7 +151,7 @@ export function BomTable({ { accessor: 'substitutes', defaultVisible: false, - render: (row) => { + render: (row: any) => { const substitutes = row.substitutes ?? []; return substitutes.length > 0 ? ( @@ -205,7 +209,7 @@ export function BomTable({ { accessor: 'available_stock', sortable: true, - render: (record) => { + render: (record: any) => { const extra: ReactNode[] = []; const available_stock: number = availableStockQuantity(record); diff --git a/src/frontend/src/tables/bom/UsedInTable.tsx b/src/frontend/src/tables/bom/UsedInTable.tsx index fbec1a325b..45a5b4cd56 100644 --- a/src/frontend/src/tables/bom/UsedInTable.tsx +++ b/src/frontend/src/tables/bom/UsedInTable.tsx @@ -6,9 +6,9 @@ import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { formatDecimal } from '../../defaults/formatters'; import { useTable } from '../../hooks/UseTable'; -import type { TableColumn } from '../Column'; import { DescriptionColumn, PartColumn, diff --git a/src/frontend/src/tables/build/BuildAllocatedStockTable.tsx b/src/frontend/src/tables/build/BuildAllocatedStockTable.tsx index 44797ca1d1..55c8fd1f81 100644 --- a/src/frontend/src/tables/build/BuildAllocatedStockTable.tsx +++ b/src/frontend/src/tables/build/BuildAllocatedStockTable.tsx @@ -1,11 +1,17 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import type { StockOperationProps } from '../../forms/StockForms'; import { useDeleteApiFormModal, @@ -14,7 +20,6 @@ import { import { useStockAdjustActions } from '../../hooks/UseStockAdjustActions'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { LocationColumn, PartColumn, @@ -23,7 +28,6 @@ import { } from '../ColumnRenderers'; import { StockLocationFilter } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; /** * Render a table of allocated stock for a build. diff --git a/src/frontend/src/tables/build/BuildLineTable.tsx b/src/frontend/src/tables/build/BuildLineTable.tsx index b8c9595fb8..2bc691c935 100644 --- a/src/frontend/src/tables/build/BuildLineTable.tsx +++ b/src/frontend/src/tables/build/BuildLineTable.tsx @@ -11,13 +11,21 @@ import { DataTable, type DataTableRowExpansionProps } from 'mantine-datatable'; import { useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { ActionButton } from '@lib/components/ActionButton'; +import { ProgressBar } from '@lib/components/ProgressBar'; +import { + type RowAction, + RowActions, + RowDeleteAction, + RowEditAction, + RowViewAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; -import { ActionButton } from '../../components/buttons/ActionButton'; -import { ProgressBar } from '../../components/items/ProgressBar'; +import type { TableColumn } from '@lib/types/Tables'; import OrderPartsWizard from '../../components/wizards/OrderPartsWizard'; import { useAllocateStockToBuildForm, @@ -31,7 +39,6 @@ import { import useStatusCodes from '../../hooks/UseStatusCodes'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { BooleanColumn, DescriptionColumn, @@ -39,13 +46,6 @@ import { PartColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { - type RowAction, - RowActions, - RowDeleteAction, - RowEditAction, - RowViewAction -} from '../RowActions'; import RowExpansionIcon from '../RowExpansionIcon'; import { TableHoverCard } from '../TableHoverCard'; diff --git a/src/frontend/src/tables/build/BuildOrderTable.tsx b/src/frontend/src/tables/build/BuildOrderTable.tsx index 1ca2893962..1009f60bf8 100644 --- a/src/frontend/src/tables/build/BuildOrderTable.tsx +++ b/src/frontend/src/tables/build/BuildOrderTable.tsx @@ -1,13 +1,13 @@ import { t } from '@lingui/core/macro'; import { useMemo } from 'react'; +import { ProgressBar } from '@lib/components/ProgressBar'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; import { AddItemButton } from '../../components/buttons/AddItemButton'; -import { ProgressBar } from '../../components/items/ProgressBar'; import { RenderUser } from '../../components/render/User'; import { useBuildOrderFields } from '../../forms/BuildForms'; import { useCreateApiFormModal } from '../../hooks/UseForm'; diff --git a/src/frontend/src/tables/build/BuildOrderTestTable.tsx b/src/frontend/src/tables/build/BuildOrderTestTable.tsx index 2a41b1d19d..cdb5560307 100644 --- a/src/frontend/src/tables/build/BuildOrderTestTable.tsx +++ b/src/frontend/src/tables/build/BuildOrderTestTable.tsx @@ -4,20 +4,20 @@ import { IconCirclePlus } from '@tabler/icons-react'; import { useQuery } from '@tanstack/react-query'; import { type ReactNode, useEffect, useMemo, useState } from 'react'; +import { PassFailButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { apiUrl } from '@lib/functions/Api'; import { cancelEvent } from '@lib/functions/Events'; import type { TableFilter } from '@lib/types/Filters'; import type { ApiFormFieldSet } from '@lib/types/Forms'; -import { PassFailButton } from '../../components/buttons/YesNoButton'; +import type { TableColumn } from '@lib/types/Tables'; import { RenderUser } from '../../components/render/User'; import { useApi } from '../../contexts/ApiContext'; import { formatDate } from '../../defaults/formatters'; import { useTestResultFields } from '../../forms/StockForms'; import { useCreateApiFormModal } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; -import type { TableColumn } from '../Column'; import { LocationColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; import { TableHoverCard } from '../TableHoverCard'; diff --git a/src/frontend/src/tables/build/BuildOutputTable.tsx b/src/frontend/src/tables/build/BuildOutputTable.tsx index a331855fdf..b16ec79467 100644 --- a/src/frontend/src/tables/build/BuildOutputTable.tsx +++ b/src/frontend/src/tables/build/BuildOutputTable.tsx @@ -20,14 +20,20 @@ import { useQuery } from '@tanstack/react-query'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { ActionButton } from '@lib/components/ActionButton'; +import { ProgressBar } from '@lib/components/ProgressBar'; +import { + type RowAction, + RowEditAction, + RowViewAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; -import { ActionButton } from '../../components/buttons/ActionButton'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; -import { ProgressBar } from '../../components/items/ProgressBar'; import { StylishText } from '../../components/items/StylishText'; import { useApi } from '../../contexts/ApiContext'; import { @@ -50,7 +56,6 @@ import useStatusCodes from '../../hooks/UseStatusCodes'; import { useStockAdjustActions } from '../../hooks/UseStockAdjustActions'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { LocationColumn, PartColumn, StatusColumn } from '../ColumnRenderers'; import { BatchFilter, @@ -63,7 +68,6 @@ import { StockLocationFilter } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowEditAction, RowViewAction } from '../RowActions'; import { TableHoverCard } from '../TableHoverCard'; import BuildLineTable from './BuildLineTable'; diff --git a/src/frontend/src/tables/company/AddressTable.tsx b/src/frontend/src/tables/company/AddressTable.tsx index e9d066a0a2..79d01057b0 100644 --- a/src/frontend/src/tables/company/AddressTable.tsx +++ b/src/frontend/src/tables/company/AddressTable.tsx @@ -1,12 +1,18 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; +import { YesNoButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; -import { YesNoButton } from '../../components/buttons/YesNoButton'; import { useCreateApiFormModal, useDeleteApiFormModal, @@ -14,10 +20,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { LinkColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; export function AddressTable({ companyId, diff --git a/src/frontend/src/tables/company/CompanyTable.tsx b/src/frontend/src/tables/company/CompanyTable.tsx index cd49026c58..3b6536508f 100644 --- a/src/frontend/src/tables/company/CompanyTable.tsx +++ b/src/frontend/src/tables/company/CompanyTable.tsx @@ -2,6 +2,7 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { type RowAction, RowEditAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; @@ -22,7 +23,6 @@ import { DescriptionColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowEditAction } from '../RowActions'; /** * A table which displays a list of company records, diff --git a/src/frontend/src/tables/company/ContactTable.tsx b/src/frontend/src/tables/company/ContactTable.tsx index b4257d0d56..9dc87b7831 100644 --- a/src/frontend/src/tables/company/ContactTable.tsx +++ b/src/frontend/src/tables/company/ContactTable.tsx @@ -1,12 +1,18 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import { getDetailUrl } from '@lib/functions/Navigation'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { useNavigate } from 'react-router-dom'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { RenderInlineModel } from '../../components/render/Instance'; @@ -17,9 +23,7 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; export function ContactTable({ companyId, diff --git a/src/frontend/src/tables/general/AttachmentTable.tsx b/src/frontend/src/tables/general/AttachmentTable.tsx index c28668e4e0..5b5e2ff58a 100644 --- a/src/frontend/src/tables/general/AttachmentTable.tsx +++ b/src/frontend/src/tables/general/AttachmentTable.tsx @@ -12,14 +12,20 @@ import { } from '@tabler/icons-react'; import { type ReactNode, useCallback, useMemo, useState } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; +import { ProgressBar } from '@lib/components/ProgressBar'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import type { ModelType } from '@lib/enums/ModelType'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; import type { ApiFormFieldSet } from '@lib/types/Forms'; -import { ActionButton } from '../../components/buttons/ActionButton'; +import type { TableColumn } from '@lib/types/Tables'; import { AttachmentLink } from '../../components/items/AttachmentLink'; -import { ProgressBar } from '../../components/items/ProgressBar'; import { useApi } from '../../contexts/ApiContext'; import { formatFileSize } from '../../defaults/formatters'; import { @@ -29,9 +35,7 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; /** * Define set of columns to display for the attachment table diff --git a/src/frontend/src/tables/general/BarcodeScanTable.tsx b/src/frontend/src/tables/general/BarcodeScanTable.tsx index 4cad3e9a9f..d13b5ec5f4 100644 --- a/src/frontend/src/tables/general/BarcodeScanTable.tsx +++ b/src/frontend/src/tables/general/BarcodeScanTable.tsx @@ -1,15 +1,15 @@ +import { ActionButton } from '@lib/components/ActionButton'; +import { type RowAction, RowViewAction } from '@lib/components/RowActions'; +import type { TableColumn } from '@lib/types/Tables'; import { t } from '@lingui/core/macro'; import { IconTrash } from '@tabler/icons-react'; import { useCallback, useEffect, useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; import type { BarcodeScanItem } from '../../components/barcodes/BarcodeScanItem'; -import { ActionButton } from '../../components/buttons/ActionButton'; import { RenderInstance } from '../../components/render/Instance'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowViewAction } from '../RowActions'; /** * A table for showing barcode scan history data on the scan index page diff --git a/src/frontend/src/tables/general/ExtraLineItemTable.tsx b/src/frontend/src/tables/general/ExtraLineItemTable.tsx index 5a355abb3d..d9a28793ed 100644 --- a/src/frontend/src/tables/general/ExtraLineItemTable.tsx +++ b/src/frontend/src/tables/general/ExtraLineItemTable.tsx @@ -1,9 +1,16 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowDuplicateAction, + RowEditAction +} from '@lib/components/RowActions'; import type { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import type { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { formatCurrency } from '../../defaults/formatters'; import { extraLineItemFields } from '../../forms/CommonForms'; @@ -14,15 +21,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DescriptionColumn, LinkColumn, NoteColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { - type RowAction, - RowDeleteAction, - RowDuplicateAction, - RowEditAction -} from '../RowActions'; export default function ExtraLineItemTable({ endpoint, diff --git a/src/frontend/src/tables/machine/MachineListTable.tsx b/src/frontend/src/tables/machine/MachineListTable.tsx index ade53c0962..ec134b02a7 100644 --- a/src/frontend/src/tables/machine/MachineListTable.tsx +++ b/src/frontend/src/tables/machine/MachineListTable.tsx @@ -19,11 +19,13 @@ import { useQuery } from '@tanstack/react-query'; import { useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { YesNoButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; +import type { InvenTreeTableProps } from '@lib/types/Tables'; import { Trans } from '@lingui/react/macro'; import { AddItemButton } from '../../components/buttons/AddItemButton'; -import { YesNoButton } from '../../components/buttons/YesNoButton'; import { DeleteItemAction, EditItemAction, @@ -48,9 +50,8 @@ import { useEditApiFormModal } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; -import type { TableColumn } from '../Column'; import { BooleanColumn } from '../ColumnRenderers'; -import { InvenTreeTable, type InvenTreeTableProps } from '../InvenTreeTable'; +import { InvenTreeTable } from '../InvenTreeTable'; import type { MachineDriverI, MachineTypeI } from './MachineTypeTable'; interface MachineI { diff --git a/src/frontend/src/tables/machine/MachineTypeTable.tsx b/src/frontend/src/tables/machine/MachineTypeTable.tsx index bf4c23cb6b..59e14ec8f4 100644 --- a/src/frontend/src/tables/machine/MachineTypeTable.tsx +++ b/src/frontend/src/tables/machine/MachineTypeTable.tsx @@ -20,13 +20,14 @@ import { useNavigate } from 'react-router-dom'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; +import type { InvenTreeTableProps } from '@lib/types/Tables'; import { InfoItem } from '../../components/items/InfoItem'; import { StylishText } from '../../components/items/StylishText'; import { DetailDrawer } from '../../components/nav/DetailDrawer'; import { useTable } from '../../hooks/UseTable'; -import type { TableColumn } from '../Column'; import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers'; -import { InvenTreeTable, type InvenTreeTableProps } from '../InvenTreeTable'; +import { InvenTreeTable } from '../InvenTreeTable'; import { MachineListTable, useMachineTypeDriver } from './MachineListTable'; export interface MachineTypeI { diff --git a/src/frontend/src/tables/notifications/NotificationTable.tsx b/src/frontend/src/tables/notifications/NotificationTable.tsx index 49b650ae9c..40dd0b0aef 100644 --- a/src/frontend/src/tables/notifications/NotificationTable.tsx +++ b/src/frontend/src/tables/notifications/NotificationTable.tsx @@ -1,12 +1,12 @@ import { t } from '@lingui/core/macro'; import { useMemo } from 'react'; +import type { RowAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; import type { TableState } from '@lib/types/Tables'; -import type { TableColumn } from '../Column'; +import type { TableColumn } from '@lib/types/Tables'; import { InvenTreeTable } from '../InvenTreeTable'; -import type { RowAction } from '../RowActions'; export function NotificationTable({ params, diff --git a/src/frontend/src/tables/part/ParametricPartTable.tsx b/src/frontend/src/tables/part/ParametricPartTable.tsx index 01e0f1321f..13ba119dbb 100644 --- a/src/frontend/src/tables/part/ParametricPartTable.tsx +++ b/src/frontend/src/tables/part/ParametricPartTable.tsx @@ -5,6 +5,7 @@ import { useQuery } from '@tanstack/react-query'; import { type ReactNode, useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { YesNoButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; @@ -14,7 +15,7 @@ import { getDetailUrl } from '@lib/functions/Navigation'; import { navigateToLink } from '@lib/functions/Navigation'; import type { TableFilter } from '@lib/types/Filters'; import type { ApiFormFieldSet } from '@lib/types/Forms'; -import { YesNoButton } from '../../components/buttons/YesNoButton'; +import type { TableColumn } from '@lib/types/Tables'; import { useApi } from '../../contexts/ApiContext'; import { formatDecimal } from '../../defaults/formatters'; import { usePartParameterFields } from '../../forms/PartForms'; @@ -24,7 +25,6 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DescriptionColumn, PartColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; import { TableHoverCard } from '../TableHoverCard'; diff --git a/src/frontend/src/tables/part/PartBuildAllocationsTable.tsx b/src/frontend/src/tables/part/PartBuildAllocationsTable.tsx index a0ea5a95c8..57aba5a152 100644 --- a/src/frontend/src/tables/part/PartBuildAllocationsTable.tsx +++ b/src/frontend/src/tables/part/PartBuildAllocationsTable.tsx @@ -4,14 +4,15 @@ import type { DataTableRowExpansionProps } from 'mantine-datatable'; import { useCallback, useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; +import { ProgressBar } from '@lib/components/ProgressBar'; +import { RowViewAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; -import { ProgressBar } from '../../components/items/ProgressBar'; +import type { TableColumn } from '@lib/types/Tables'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DescriptionColumn, PartColumn, @@ -19,7 +20,6 @@ import { StatusColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { RowViewAction } from '../RowActions'; import RowExpansionIcon from '../RowExpansionIcon'; import { BuildLineSubTable } from '../build/BuildLineTable'; diff --git a/src/frontend/src/tables/part/PartCategoryTable.tsx b/src/frontend/src/tables/part/PartCategoryTable.tsx index 52ea0d2c19..40fff09649 100644 --- a/src/frontend/src/tables/part/PartCategoryTable.tsx +++ b/src/frontend/src/tables/part/PartCategoryTable.tsx @@ -3,13 +3,15 @@ import { Group, Tooltip } from '@mantine/core'; import { IconBell } from '@tabler/icons-react'; import { useCallback, useMemo, useState } from 'react'; +import { type RowAction, RowEditAction } from '@lib/components/RowActions'; +import { YesNoButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; -import { YesNoButton } from '../../components/buttons/YesNoButton'; import { ActionDropdown } from '../../components/items/ActionDropdown'; import { ApiIcon } from '../../components/items/ApiIcon'; import { partCategoryFields } from '../../forms/PartForms'; @@ -21,10 +23,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DescriptionColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowEditAction } from '../RowActions'; /** * PartCategoryTable - Displays a table of part categories diff --git a/src/frontend/src/tables/part/PartCategoryTemplateTable.tsx b/src/frontend/src/tables/part/PartCategoryTemplateTable.tsx index e26ca84c75..680f55558b 100644 --- a/src/frontend/src/tables/part/PartCategoryTemplateTable.tsx +++ b/src/frontend/src/tables/part/PartCategoryTemplateTable.tsx @@ -2,11 +2,17 @@ import { t } from '@lingui/core/macro'; import { Group, Text } from '@mantine/core'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { useCreateApiFormModal, @@ -15,9 +21,7 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; export default function PartCategoryTemplateTable() { const table = useTable('part-category-parameter-templates'); diff --git a/src/frontend/src/tables/part/PartParameterTable.tsx b/src/frontend/src/tables/part/PartParameterTable.tsx index 3df7fdfc73..e2e3b1364e 100644 --- a/src/frontend/src/tables/part/PartParameterTable.tsx +++ b/src/frontend/src/tables/part/PartParameterTable.tsx @@ -3,12 +3,18 @@ import { Alert, Stack, Text } from '@mantine/core'; import { IconLock } from '@tabler/icons-react'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; +import { YesNoButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; -import { YesNoButton } from '../../components/buttons/YesNoButton'; import { formatDecimal } from '../../defaults/formatters'; import { usePartParameterFields } from '../../forms/PartForms'; import { @@ -18,10 +24,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DescriptionColumn, PartColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; import { TableHoverCard } from '../TableHoverCard'; /** diff --git a/src/frontend/src/tables/part/PartParameterTemplateTable.tsx b/src/frontend/src/tables/part/PartParameterTemplateTable.tsx index da2bf8393d..24d995715c 100644 --- a/src/frontend/src/tables/part/PartParameterTemplateTable.tsx +++ b/src/frontend/src/tables/part/PartParameterTemplateTable.tsx @@ -1,11 +1,17 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { useCreateApiFormModal, @@ -14,10 +20,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; export default function PartParameterTemplateTable() { const table = useTable('part-parameter-templates'); diff --git a/src/frontend/src/tables/part/PartPurchaseOrdersTable.tsx b/src/frontend/src/tables/part/PartPurchaseOrdersTable.tsx index 0b54819004..c487f5e49f 100644 --- a/src/frontend/src/tables/part/PartPurchaseOrdersTable.tsx +++ b/src/frontend/src/tables/part/PartPurchaseOrdersTable.tsx @@ -2,14 +2,14 @@ import { t } from '@lingui/core/macro'; import { Text } from '@mantine/core'; import { useMemo } from 'react'; +import { ProgressBar } from '@lib/components/ProgressBar'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; -import { ProgressBar } from '../../components/items/ProgressBar'; +import type { TableColumn } from '@lib/types/Tables'; import { formatCurrency } from '../../defaults/formatters'; import { useTable } from '../../hooks/UseTable'; -import type { TableColumn } from '../Column'; import { DateColumn, ReferenceColumn, StatusColumn } from '../ColumnRenderers'; import { StatusFilterOptions } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable'; diff --git a/src/frontend/src/tables/part/PartSalesAllocationsTable.tsx b/src/frontend/src/tables/part/PartSalesAllocationsTable.tsx index 2ec3edc7f8..01c3b64389 100644 --- a/src/frontend/src/tables/part/PartSalesAllocationsTable.tsx +++ b/src/frontend/src/tables/part/PartSalesAllocationsTable.tsx @@ -4,21 +4,21 @@ import type { DataTableRowExpansionProps } from 'mantine-datatable'; import { useCallback, useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; +import { ProgressBar } from '@lib/components/ProgressBar'; +import { RowViewAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; -import { ProgressBar } from '../../components/items/ProgressBar'; +import type { TableColumn } from '@lib/types/Tables'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DescriptionColumn, ProjectCodeColumn, StatusColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { RowViewAction } from '../RowActions'; import RowExpansionIcon from '../RowExpansionIcon'; import SalesOrderAllocationTable from '../sales/SalesOrderAllocationTable'; diff --git a/src/frontend/src/tables/part/PartTable.tsx b/src/frontend/src/tables/part/PartTable.tsx index c67c05b26b..af5e951d6a 100644 --- a/src/frontend/src/tables/part/PartTable.tsx +++ b/src/frontend/src/tables/part/PartTable.tsx @@ -3,11 +3,14 @@ import { Group, Text } from '@mantine/core'; import { IconShoppingCart } from '@tabler/icons-react'; import { type ReactNode, useCallback, useMemo, useState } from 'react'; +import { type RowAction, RowEditAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; +import type { InvenTreeTableProps } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { ActionDropdown } from '../../components/items/ActionDropdown'; import OrderPartsWizard from '../../components/wizards/OrderPartsWizard'; @@ -21,7 +24,6 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { CategoryColumn, DefaultLocationColumn, @@ -29,8 +31,7 @@ import { LinkColumn, PartColumn } from '../ColumnRenderers'; -import { InvenTreeTable, type InvenTreeTableProps } from '../InvenTreeTable'; -import { type RowAction, RowEditAction } from '../RowActions'; +import { InvenTreeTable } from '../InvenTreeTable'; import { TableHoverCard } from '../TableHoverCard'; /** diff --git a/src/frontend/src/tables/part/PartTestTemplateTable.tsx b/src/frontend/src/tables/part/PartTestTemplateTable.tsx index 10e776618e..b699678892 100644 --- a/src/frontend/src/tables/part/PartTestTemplateTable.tsx +++ b/src/frontend/src/tables/part/PartTestTemplateTable.tsx @@ -5,6 +5,12 @@ import { IconLock } from '@tabler/icons-react'; import { type ReactNode, useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { + type RowAction, + RowDeleteAction, + RowEditAction, + RowViewAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; @@ -12,6 +18,7 @@ import { apiUrl } from '@lib/functions/Api'; import { getDetailUrl } from '@lib/functions/Navigation'; import type { TableFilter } from '@lib/types/Filters'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { useCreateApiFormModal, @@ -20,15 +27,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { - type RowAction, - RowDeleteAction, - RowEditAction, - RowViewAction -} from '../RowActions'; import { TableHoverCard } from '../TableHoverCard'; export default function PartTestTemplateTable({ diff --git a/src/frontend/src/tables/part/RelatedPartTable.tsx b/src/frontend/src/tables/part/RelatedPartTable.tsx index 6b96946a46..cd717076ea 100644 --- a/src/frontend/src/tables/part/RelatedPartTable.tsx +++ b/src/frontend/src/tables/part/RelatedPartTable.tsx @@ -3,10 +3,16 @@ import { Group, Text } from '@mantine/core'; import { type ReactNode, useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { Thumbnail } from '../../components/images/Thumbnail'; import { @@ -16,10 +22,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { NoteColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; /** * Construct a table listing related parts for a given part diff --git a/src/frontend/src/tables/part/SelectionListTable.tsx b/src/frontend/src/tables/part/SelectionListTable.tsx index d30a6e3f11..1883a782e9 100644 --- a/src/frontend/src/tables/part/SelectionListTable.tsx +++ b/src/frontend/src/tables/part/SelectionListTable.tsx @@ -1,9 +1,15 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { selectionListFields } from '../../forms/selectionListFields'; import { @@ -13,10 +19,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; /** * Table for displaying list of selectionlist items diff --git a/src/frontend/src/tables/plugin/PluginErrorTable.tsx b/src/frontend/src/tables/plugin/PluginErrorTable.tsx index 3354e12e27..a7172f7071 100644 --- a/src/frontend/src/tables/plugin/PluginErrorTable.tsx +++ b/src/frontend/src/tables/plugin/PluginErrorTable.tsx @@ -4,8 +4,8 @@ import { useMemo } from 'react'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { useTable } from '../../hooks/UseTable'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; export interface PluginRegistryErrorI { diff --git a/src/frontend/src/tables/plugin/PluginListTable.tsx b/src/frontend/src/tables/plugin/PluginListTable.tsx index 0502a2e7c1..81fb8ee9de 100644 --- a/src/frontend/src/tables/plugin/PluginListTable.tsx +++ b/src/frontend/src/tables/plugin/PluginListTable.tsx @@ -13,9 +13,11 @@ import { import { useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { ActionButton } from '@lib/components/ActionButton'; +import type { RowAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; -import { ActionButton } from '../../components/buttons/ActionButton'; +import type { TableColumn } from '@lib/types/Tables'; import { DetailDrawer } from '../../components/nav/DetailDrawer'; import PluginDrawer from '../../components/plugins/PluginDrawer'; import type { PluginInterface } from '../../components/plugins/PluginInterface'; @@ -28,10 +30,8 @@ import { import { useTable } from '../../hooks/UseTable'; import { useServerApiState } from '../../states/ServerApiState'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { BooleanColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import type { RowAction } from '../RowActions'; /** * Construct an indicator icon for a single plugin diff --git a/src/frontend/src/tables/purchasing/ManufacturerPartParameterTable.tsx b/src/frontend/src/tables/purchasing/ManufacturerPartParameterTable.tsx index 2d58f20fde..8189b88968 100644 --- a/src/frontend/src/tables/purchasing/ManufacturerPartParameterTable.tsx +++ b/src/frontend/src/tables/purchasing/ManufacturerPartParameterTable.tsx @@ -1,9 +1,15 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { useManufacturerPartParameterFields } from '../../forms/CompanyForms'; import { @@ -13,9 +19,7 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; export default function ManufacturerPartParameterTable({ params diff --git a/src/frontend/src/tables/purchasing/ManufacturerPartTable.tsx b/src/frontend/src/tables/purchasing/ManufacturerPartTable.tsx index 89bd8e0c37..5d3dbf23ac 100644 --- a/src/frontend/src/tables/purchasing/ManufacturerPartTable.tsx +++ b/src/frontend/src/tables/purchasing/ManufacturerPartTable.tsx @@ -1,10 +1,16 @@ import { t } from '@lingui/core/macro'; import { type ReactNode, useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { useManufacturerPartFields } from '../../forms/CompanyForms'; import { @@ -14,7 +20,6 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { CompanyColumn, DescriptionColumn, @@ -22,7 +27,6 @@ import { PartColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; /* * Construct a table listing manufacturer parts diff --git a/src/frontend/src/tables/purchasing/PurchaseOrderLineItemTable.tsx b/src/frontend/src/tables/purchasing/PurchaseOrderLineItemTable.tsx index 9e53e9cb1b..cfb9ee926f 100644 --- a/src/frontend/src/tables/purchasing/PurchaseOrderLineItemTable.tsx +++ b/src/frontend/src/tables/purchasing/PurchaseOrderLineItemTable.tsx @@ -3,16 +3,24 @@ import { Text } from '@mantine/core'; import { IconFileArrowLeft, IconSquareArrowRight } from '@tabler/icons-react'; import { useCallback, useMemo, useState } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; +import { ProgressBar } from '@lib/components/ProgressBar'; +import { + type RowAction, + RowDeleteAction, + RowDuplicateAction, + RowEditAction, + RowViewAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { useNavigate } from 'react-router-dom'; -import { ActionButton } from '../../components/buttons/ActionButton'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import ImporterDrawer from '../../components/importer/ImporterDrawer'; -import { ProgressBar } from '../../components/items/ProgressBar'; import { RenderInstance } from '../../components/render/Instance'; import { RenderStockLocation } from '../../components/render/Stock'; import { dataImporterSessionFields } from '../../forms/ImporterForms'; @@ -28,7 +36,6 @@ import { import useStatusCodes from '../../hooks/UseStatusCodes'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { CurrencyColumn, DescriptionColumn, @@ -39,13 +46,6 @@ import { TargetDateColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { - type RowAction, - RowDeleteAction, - RowDuplicateAction, - RowEditAction, - RowViewAction -} from '../RowActions'; import { TableHoverCard } from '../TableHoverCard'; /* diff --git a/src/frontend/src/tables/purchasing/SupplierPartTable.tsx b/src/frontend/src/tables/purchasing/SupplierPartTable.tsx index 305c45a99c..9c98a79116 100644 --- a/src/frontend/src/tables/purchasing/SupplierPartTable.tsx +++ b/src/frontend/src/tables/purchasing/SupplierPartTable.tsx @@ -2,11 +2,17 @@ import { t } from '@lingui/core/macro'; import { Text } from '@mantine/core'; import { type ReactNode, useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { useSupplierPartFields } from '../../forms/CompanyForms'; import { @@ -16,7 +22,6 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { BooleanColumn, CompanyColumn, @@ -26,7 +31,6 @@ import { PartColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; import { TableHoverCard } from '../TableHoverCard'; /* diff --git a/src/frontend/src/tables/purchasing/SupplierPriceBreakTable.tsx b/src/frontend/src/tables/purchasing/SupplierPriceBreakTable.tsx index 47e3984428..5f62c9b46d 100644 --- a/src/frontend/src/tables/purchasing/SupplierPriceBreakTable.tsx +++ b/src/frontend/src/tables/purchasing/SupplierPriceBreakTable.tsx @@ -2,12 +2,18 @@ import { t } from '@lingui/core/macro'; import { Anchor, Group, Text } from '@mantine/core'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import { getDetailUrl } from '@lib/functions/Navigation'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { formatCurrency } from '../../defaults/formatters'; import { @@ -17,10 +23,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { CompanyColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; export function calculateSupplierPartUnitPrice(record: any) { const pack_quantity = record?.part_detail?.pack_quantity_native ?? 1; diff --git a/src/frontend/src/tables/sales/ReturnOrderLineItemTable.tsx b/src/frontend/src/tables/sales/ReturnOrderLineItemTable.tsx index 4925fd0638..75bb3002df 100644 --- a/src/frontend/src/tables/sales/ReturnOrderLineItemTable.tsx +++ b/src/frontend/src/tables/sales/ReturnOrderLineItemTable.tsx @@ -2,12 +2,18 @@ import { t } from '@lingui/core/macro'; import { IconSquareArrowRight } from '@tabler/icons-react'; import { useCallback, useMemo, useState } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; -import { ActionButton } from '../../components/buttons/ActionButton'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { formatCurrency } from '../../defaults/formatters'; import { @@ -22,7 +28,6 @@ import { import useStatusCodes from '../../hooks/UseStatusCodes'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DateColumn, DescriptionColumn, @@ -34,7 +39,6 @@ import { } from '../ColumnRenderers'; import { StatusFilterOptions } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; export default function ReturnOrderLineItemTable({ orderId, diff --git a/src/frontend/src/tables/sales/SalesOrderAllocationTable.tsx b/src/frontend/src/tables/sales/SalesOrderAllocationTable.tsx index cbce42a1be..3b911740a9 100644 --- a/src/frontend/src/tables/sales/SalesOrderAllocationTable.tsx +++ b/src/frontend/src/tables/sales/SalesOrderAllocationTable.tsx @@ -1,13 +1,19 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { IconTruckDelivery } from '@tabler/icons-react'; -import { ActionButton } from '../../components/buttons/ActionButton'; import { formatDate } from '../../defaults/formatters'; import { useSalesOrderAllocationFields } from '../../forms/SalesOrderForms'; import type { StockOperationProps } from '../../forms/StockForms'; @@ -19,7 +25,6 @@ import { import { useStockAdjustActions } from '../../hooks/UseStockAdjustActions'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DescriptionColumn, LocationColumn, @@ -29,7 +34,6 @@ import { } from '../ColumnRenderers'; import { StockLocationFilter } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; export default function SalesOrderAllocationTable({ partId, diff --git a/src/frontend/src/tables/sales/SalesOrderLineItemTable.tsx b/src/frontend/src/tables/sales/SalesOrderLineItemTable.tsx index b726b7653f..b33fc90c8c 100644 --- a/src/frontend/src/tables/sales/SalesOrderLineItemTable.tsx +++ b/src/frontend/src/tables/sales/SalesOrderLineItemTable.tsx @@ -11,14 +11,22 @@ import type { DataTableRowExpansionProps } from 'mantine-datatable'; import { type ReactNode, useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { ActionButton } from '@lib/components/ActionButton'; +import { ProgressBar } from '@lib/components/ProgressBar'; +import { + type RowAction, + RowDeleteAction, + RowDuplicateAction, + RowEditAction, + RowViewAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; -import { ActionButton } from '../../components/buttons/ActionButton'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; -import { ProgressBar } from '../../components/items/ProgressBar'; import { RenderPart } from '../../components/render/Part'; import OrderPartsWizard from '../../components/wizards/OrderPartsWizard'; import { formatCurrency } from '../../defaults/formatters'; @@ -35,7 +43,6 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DateColumn, DescriptionColumn, @@ -43,13 +50,6 @@ import { PartColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { - type RowAction, - RowDeleteAction, - RowDuplicateAction, - RowEditAction, - RowViewAction -} from '../RowActions'; import RowExpansionIcon from '../RowExpansionIcon'; import { TableHoverCard } from '../TableHoverCard'; import SalesOrderAllocationTable from './SalesOrderAllocationTable'; diff --git a/src/frontend/src/tables/sales/SalesOrderShipmentTable.tsx b/src/frontend/src/tables/sales/SalesOrderShipmentTable.tsx index 838f313d01..5236af7093 100644 --- a/src/frontend/src/tables/sales/SalesOrderShipmentTable.tsx +++ b/src/frontend/src/tables/sales/SalesOrderShipmentTable.tsx @@ -3,14 +3,21 @@ import { IconTruckDelivery } from '@tabler/icons-react'; import { useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { + type RowAction, + RowCancelAction, + RowEditAction, + RowViewAction +} from '@lib/components/RowActions'; +import { YesNoButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import dayjs from 'dayjs'; import { AddItemButton } from '../../components/buttons/AddItemButton'; -import { YesNoButton } from '../../components/buttons/YesNoButton'; import { useSalesOrderShipmentCompleteFields, useSalesOrderShipmentFields @@ -22,15 +29,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DateColumn, LinkColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { - type RowAction, - RowCancelAction, - RowEditAction, - RowViewAction -} from '../RowActions'; export default function SalesOrderShipmentTable({ orderId diff --git a/src/frontend/src/tables/sales/SalesOrderTable.tsx b/src/frontend/src/tables/sales/SalesOrderTable.tsx index 073664a8e9..f82c6eb113 100644 --- a/src/frontend/src/tables/sales/SalesOrderTable.tsx +++ b/src/frontend/src/tables/sales/SalesOrderTable.tsx @@ -1,13 +1,13 @@ import { t } from '@lingui/core/macro'; import { useMemo } from 'react'; +import { ProgressBar } from '@lib/components/ProgressBar'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; import { AddItemButton } from '../../components/buttons/AddItemButton'; -import { ProgressBar } from '../../components/items/ProgressBar'; import { formatCurrency } from '../../defaults/formatters'; import { useSalesOrderFields } from '../../forms/SalesOrderForms'; import { useCreateApiFormModal } from '../../hooks/UseForm'; diff --git a/src/frontend/src/tables/settings/ApiTokenTable.tsx b/src/frontend/src/tables/settings/ApiTokenTable.tsx index d5d7cd6a0c..bcf438f790 100644 --- a/src/frontend/src/tables/settings/ApiTokenTable.tsx +++ b/src/frontend/src/tables/settings/ApiTokenTable.tsx @@ -1,3 +1,4 @@ +import type { RowAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; @@ -15,7 +16,6 @@ import { RenderUser } from '../../components/render/User'; import { showApiErrorMessage } from '../../functions/notifications'; import { useCreateApiFormModal } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; -import type { RowAction } from '../../tables/RowActions'; import { BooleanColumn } from '../ColumnRenderers'; import { UserFilter } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable'; diff --git a/src/frontend/src/tables/settings/BarcodeScanHistoryTable.tsx b/src/frontend/src/tables/settings/BarcodeScanHistoryTable.tsx index 499d019b4d..e7266b640d 100644 --- a/src/frontend/src/tables/settings/BarcodeScanHistoryTable.tsx +++ b/src/frontend/src/tables/settings/BarcodeScanHistoryTable.tsx @@ -14,12 +14,14 @@ import { useDisclosure } from '@mantine/hooks'; import { IconExclamationCircle } from '@tabler/icons-react'; import { useCallback, useMemo, useState } from 'react'; +import { RowDeleteAction } from '@lib/components/RowActions'; +import { PassFailButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { CopyButton } from '../../components/buttons/CopyButton'; -import { PassFailButton } from '../../components/buttons/YesNoButton'; import { StylishText } from '../../components/items/StylishText'; import { RenderUser } from '../../components/render/User'; import { shortenString } from '../../functions/tables'; @@ -27,10 +29,8 @@ import { useDeleteApiFormModal } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useGlobalSettingsState } from '../../states/SettingsStates'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { UserFilter } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable'; -import { RowDeleteAction } from '../RowActions'; /* * Render detail information for a particular barcode scan result. diff --git a/src/frontend/src/tables/settings/CustomStateTable.tsx b/src/frontend/src/tables/settings/CustomStateTable.tsx index af6793ed55..8c7c49adee 100644 --- a/src/frontend/src/tables/settings/CustomStateTable.tsx +++ b/src/frontend/src/tables/settings/CustomStateTable.tsx @@ -2,10 +2,17 @@ import { t } from '@lingui/core/macro'; import { Badge } from '@mantine/core'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowDuplicateAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import type { StatusCodeInterface, @@ -21,14 +28,7 @@ import { import { useTable } from '../../hooks/UseTable'; import { useGlobalStatusState } from '../../states/GlobalStatusState'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; -import { - type RowAction, - RowDeleteAction, - RowDuplicateAction, - RowEditAction -} from '../RowActions'; /** * Table for displaying list of custom states diff --git a/src/frontend/src/tables/settings/CustomUnitsTable.tsx b/src/frontend/src/tables/settings/CustomUnitsTable.tsx index d9e392286c..f4daa1f92e 100644 --- a/src/frontend/src/tables/settings/CustomUnitsTable.tsx +++ b/src/frontend/src/tables/settings/CustomUnitsTable.tsx @@ -1,9 +1,15 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { customUnitsFields } from '../../forms/CommonForms'; import { @@ -13,9 +19,7 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; /** * Table for displaying list of custom physical units diff --git a/src/frontend/src/tables/settings/EmailTable.tsx b/src/frontend/src/tables/settings/EmailTable.tsx index 82eeaf0a72..cfa1caaea9 100644 --- a/src/frontend/src/tables/settings/EmailTable.tsx +++ b/src/frontend/src/tables/settings/EmailTable.tsx @@ -1,9 +1,9 @@ +import { ActionButton } from '@lib/components/ActionButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; import { t } from '@lingui/core/macro'; import { IconTestPipe } from '@tabler/icons-react'; import { useMemo } from 'react'; -import { ActionButton } from '../../components/buttons/ActionButton'; import { useCreateApiFormModal } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { DateColumn } from '../ColumnRenderers'; diff --git a/src/frontend/src/tables/settings/ErrorTable.tsx b/src/frontend/src/tables/settings/ErrorTable.tsx index d9a16c21bc..293b4b043f 100644 --- a/src/frontend/src/tables/settings/ErrorTable.tsx +++ b/src/frontend/src/tables/settings/ErrorTable.tsx @@ -3,17 +3,17 @@ import { Group, Loader, Stack, Table, Text } from '@mantine/core'; import { useCallback, useMemo, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; +import { type RowAction, RowDeleteAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { CopyButton } from '../../components/buttons/CopyButton'; import { DetailDrawer } from '../../components/nav/DetailDrawer'; import { useDeleteApiFormModal } from '../../hooks/UseForm'; import { useInstance } from '../../hooks/UseInstance'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction } from '../RowActions'; function ErrorDetail({ errorId }: Readonly<{ errorId?: number }>) { const { id } = useParams(); diff --git a/src/frontend/src/tables/settings/ExportSessionTable.tsx b/src/frontend/src/tables/settings/ExportSessionTable.tsx index ce3d218da8..862cfa40b4 100644 --- a/src/frontend/src/tables/settings/ExportSessionTable.tsx +++ b/src/frontend/src/tables/settings/ExportSessionTable.tsx @@ -1,17 +1,17 @@ +import { type RowAction, RowDeleteAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; import { AttachmentLink } from '../../components/items/AttachmentLink'; import { RenderUser } from '../../components/render/User'; import { useDeleteApiFormModal } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; -import type { TableColumn } from '../Column'; import { DateColumn } from '../ColumnRenderers'; import { UserFilter } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction } from '../RowActions'; export default function ExportSessionTable() { const table = useTable('exportsession'); diff --git a/src/frontend/src/tables/settings/FailedTasksTable.tsx b/src/frontend/src/tables/settings/FailedTasksTable.tsx index bea63ae16d..ab8a3e5613 100644 --- a/src/frontend/src/tables/settings/FailedTasksTable.tsx +++ b/src/frontend/src/tables/settings/FailedTasksTable.tsx @@ -7,10 +7,10 @@ import { useMemo, useState } from 'react'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { StylishText } from '../../components/items/StylishText'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; export default function FailedTasksTable({ diff --git a/src/frontend/src/tables/settings/GroupTable.tsx b/src/frontend/src/tables/settings/GroupTable.tsx index 110ac32f86..6728fb57b3 100644 --- a/src/frontend/src/tables/settings/GroupTable.tsx +++ b/src/frontend/src/tables/settings/GroupTable.tsx @@ -3,11 +3,17 @@ import { Trans } from '@lingui/react/macro'; import { Accordion, LoadingOverlay, Stack, Text } from '@mantine/core'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import { getDetailUrl } from '@lib/index'; +import type { TableColumn } from '@lib/types/Tables'; import { IconUsersGroup } from '@tabler/icons-react'; import { useNavigate } from 'react-router-dom'; import { AddItemButton } from '../../components/buttons/AddItemButton'; @@ -22,9 +28,7 @@ import { import { useInstance } from '../../hooks/UseInstance'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; export interface GroupDetailI { pk: number; diff --git a/src/frontend/src/tables/settings/ImportSessionTable.tsx b/src/frontend/src/tables/settings/ImportSessionTable.tsx index def3d7e6f9..a6f3f376f4 100644 --- a/src/frontend/src/tables/settings/ImportSessionTable.tsx +++ b/src/frontend/src/tables/settings/ImportSessionTable.tsx @@ -1,14 +1,16 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { ProgressBar } from '@lib/components/ProgressBar'; +import { type RowAction, RowDeleteAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import ImporterDrawer from '../../components/importer/ImporterDrawer'; import { AttachmentLink } from '../../components/items/AttachmentLink'; -import { ProgressBar } from '../../components/items/ProgressBar'; import { RenderUser } from '../../components/render/User'; import { dataImporterSessionFields } from '../../forms/ImporterForms'; import { useFilters } from '../../hooks/UseFilter'; @@ -17,11 +19,9 @@ import { useDeleteApiFormModal } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; -import type { TableColumn } from '../Column'; import { DateColumn, StatusColumn } from '../ColumnRenderers'; import { StatusFilterOptions, UserFilter } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction } from '../RowActions'; export default function ImportSessionTable() { const table = useTable('importsession'); diff --git a/src/frontend/src/tables/settings/PendingTasksTable.tsx b/src/frontend/src/tables/settings/PendingTasksTable.tsx index b276bc054b..329a13465b 100644 --- a/src/frontend/src/tables/settings/PendingTasksTable.tsx +++ b/src/frontend/src/tables/settings/PendingTasksTable.tsx @@ -1,16 +1,16 @@ import { t } from '@lingui/core/macro'; import { useMemo } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { notifications, showNotification } from '@mantine/notifications'; import { IconTrashXFilled, IconX } from '@tabler/icons-react'; import { api } from '../../App'; -import { ActionButton } from '../../components/buttons/ActionButton'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; export default function PendingTasksTable({ diff --git a/src/frontend/src/tables/settings/ProjectCodeTable.tsx b/src/frontend/src/tables/settings/ProjectCodeTable.tsx index 25b4b0ab46..40ab4b48a4 100644 --- a/src/frontend/src/tables/settings/ProjectCodeTable.tsx +++ b/src/frontend/src/tables/settings/ProjectCodeTable.tsx @@ -1,9 +1,15 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { projectCodeFields } from '../../forms/CommonForms'; import { @@ -13,10 +19,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DescriptionColumn, ResponsibleColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; /** * Table for displaying list of project codes diff --git a/src/frontend/src/tables/settings/ScheduledTasksTable.tsx b/src/frontend/src/tables/settings/ScheduledTasksTable.tsx index 18609cb49a..1e0ae129b2 100644 --- a/src/frontend/src/tables/settings/ScheduledTasksTable.tsx +++ b/src/frontend/src/tables/settings/ScheduledTasksTable.tsx @@ -5,8 +5,8 @@ import { useMemo } from 'react'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { useTable } from '../../hooks/UseTable'; -import type { TableColumn } from '../Column'; import { InvenTreeTable } from '../InvenTreeTable'; export default function ScheduledTasksTable() { diff --git a/src/frontend/src/tables/settings/StocktakeReportTable.tsx b/src/frontend/src/tables/settings/StocktakeReportTable.tsx index 1943261ad2..62632379df 100644 --- a/src/frontend/src/tables/settings/StocktakeReportTable.tsx +++ b/src/frontend/src/tables/settings/StocktakeReportTable.tsx @@ -1,9 +1,11 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { type RowAction, RowDeleteAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { apiUrl } from '@lib/functions/Api'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { AttachmentLink } from '../../components/items/AttachmentLink'; import { RenderUser } from '../../components/render/User'; @@ -13,10 +15,8 @@ import { useDeleteApiFormModal } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; -import type { TableColumn } from '../Column'; import { DateColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction } from '../RowActions'; export default function StocktakeReportTable() { const table = useTable('stocktake-report'); diff --git a/src/frontend/src/tables/settings/TemplateTable.tsx b/src/frontend/src/tables/settings/TemplateTable.tsx index 3d82f460a1..6da215c0a3 100644 --- a/src/frontend/src/tables/settings/TemplateTable.tsx +++ b/src/frontend/src/tables/settings/TemplateTable.tsx @@ -5,11 +5,18 @@ import { IconFileCode } from '@tabler/icons-react'; import { type ReactNode, useCallback, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import type { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import type { ModelType } from '@lib/enums/ModelType'; import { apiUrl } from '@lib/functions/Api'; +import { identifierString } from '@lib/functions/Conversion'; import type { TableFilter } from '@lib/types/Filters'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { CodeEditor, @@ -31,7 +38,6 @@ import type { TemplateEditorUIFeature, TemplatePreviewUIFeature } from '../../components/plugins/PluginUIFeatureTypes'; -import { identifierString } from '../../functions/conversion'; import { useFilters } from '../../hooks/UseFilter'; import { useCreateApiFormModal, @@ -42,10 +48,8 @@ import { useInstance } from '../../hooks/UseInstance'; import { usePluginUIFeature } from '../../hooks/UsePluginUIFeature'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; export type TemplateI = { pk: number; diff --git a/src/frontend/src/tables/settings/UserTable.tsx b/src/frontend/src/tables/settings/UserTable.tsx index e5a3cc146b..12281987a6 100644 --- a/src/frontend/src/tables/settings/UserTable.tsx +++ b/src/frontend/src/tables/settings/UserTable.tsx @@ -10,12 +10,18 @@ import { } from '@tabler/icons-react'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import { getDetailUrl } from '@lib/index'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { showNotification } from '@mantine/notifications'; import { useNavigate } from 'react-router-dom'; import { useShallow } from 'zustand/react/shallow'; @@ -37,10 +43,8 @@ import { import { useInstance } from '../../hooks/UseInstance'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { BooleanColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; import type { GroupDetailI } from './GroupTable'; export interface UserDetailI { diff --git a/src/frontend/src/tables/stock/InstalledItemsTable.tsx b/src/frontend/src/tables/stock/InstalledItemsTable.tsx index 54a0b4a938..fd2b77d478 100644 --- a/src/frontend/src/tables/stock/InstalledItemsTable.tsx +++ b/src/frontend/src/tables/stock/InstalledItemsTable.tsx @@ -7,6 +7,7 @@ import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { useStockItemInstallFields, @@ -15,7 +16,6 @@ import { import { useCreateApiFormModal } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { PartColumn, StatusColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; diff --git a/src/frontend/src/tables/stock/LocationTypesTable.tsx b/src/frontend/src/tables/stock/LocationTypesTable.tsx index 9f76168aeb..2dba9177be 100644 --- a/src/frontend/src/tables/stock/LocationTypesTable.tsx +++ b/src/frontend/src/tables/stock/LocationTypesTable.tsx @@ -1,10 +1,16 @@ import { t } from '@lingui/core/macro'; import { useCallback, useMemo, useState } from 'react'; +import { + type RowAction, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { ApiIcon } from '../../components/items/ApiIcon'; import { @@ -14,10 +20,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DescriptionColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowDeleteAction, RowEditAction } from '../RowActions'; export default function LocationTypesTable() { const table = useTable('location-types'); diff --git a/src/frontend/src/tables/stock/StockItemTable.tsx b/src/frontend/src/tables/stock/StockItemTable.tsx index 6113f7578b..998a0c909c 100644 --- a/src/frontend/src/tables/stock/StockItemTable.tsx +++ b/src/frontend/src/tables/stock/StockItemTable.tsx @@ -2,12 +2,13 @@ import { t } from '@lingui/core/macro'; import { Group, Text } from '@mantine/core'; import { type ReactNode, useMemo, useState } from 'react'; +import { ActionButton } from '@lib/components/ActionButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; -import { ActionButton } from '../../components/buttons/ActionButton'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import OrderPartsWizard from '../../components/wizards/OrderPartsWizard'; import { formatCurrency, formatPriceRange } from '../../defaults/formatters'; @@ -21,7 +22,6 @@ import { useStockAdjustActions } from '../../hooks/UseStockAdjustActions'; import { useTable } from '../../hooks/UseTable'; import { useGlobalSettingsState } from '../../states/SettingsStates'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DateColumn, DescriptionColumn, diff --git a/src/frontend/src/tables/stock/StockItemTestResultTable.tsx b/src/frontend/src/tables/stock/StockItemTestResultTable.tsx index e5ab81a3da..3f0a1a28d8 100644 --- a/src/frontend/src/tables/stock/StockItemTestResultTable.tsx +++ b/src/frontend/src/tables/stock/StockItemTestResultTable.tsx @@ -10,13 +10,20 @@ import { useQuery } from '@tanstack/react-query'; import { DataTable, type DataTableRowExpansionProps } from 'mantine-datatable'; import { useCallback, useEffect, useMemo, useState } from 'react'; +import { + type RowAction, + RowActions, + RowDeleteAction, + RowEditAction +} from '@lib/components/RowActions'; +import { PassFailButton } from '@lib/components/YesNoButton'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; import type { ApiFormFieldSet } from '@lib/types/Forms'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; -import { PassFailButton } from '../../components/buttons/YesNoButton'; import { AttachmentLink } from '../../components/items/AttachmentLink'; import { RenderUser } from '../../components/render/User'; import { useApi } from '../../contexts/ApiContext'; @@ -30,15 +37,8 @@ import { import { useTable } from '../../hooks/UseTable'; import { useGlobalSettingsState } from '../../states/SettingsStates'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { DateColumn, DescriptionColumn, NoteColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { - type RowAction, - RowActions, - RowDeleteAction, - RowEditAction -} from '../RowActions'; import RowExpansionIcon from '../RowExpansionIcon'; export default function StockItemTestResultTable({ diff --git a/src/frontend/src/tables/stock/StockLocationTable.tsx b/src/frontend/src/tables/stock/StockLocationTable.tsx index ee303bd6d0..8325fc4200 100644 --- a/src/frontend/src/tables/stock/StockLocationTable.tsx +++ b/src/frontend/src/tables/stock/StockLocationTable.tsx @@ -2,11 +2,13 @@ import { t } from '@lingui/core/macro'; import { Group } from '@mantine/core'; import { useCallback, useMemo, useState } from 'react'; +import { type RowAction, RowEditAction } from '@lib/components/RowActions'; import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { UserRoles } from '@lib/enums/Roles'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { AddItemButton } from '../../components/buttons/AddItemButton'; import { ActionDropdown } from '../../components/items/ActionDropdown'; import { ApiIcon } from '../../components/items/ApiIcon'; @@ -19,10 +21,8 @@ import { } from '../../hooks/UseForm'; import { useTable } from '../../hooks/UseTable'; import { useUserState } from '../../states/UserState'; -import type { TableColumn } from '../Column'; import { BooleanColumn, DescriptionColumn } from '../ColumnRenderers'; import { InvenTreeTable } from '../InvenTreeTable'; -import { type RowAction, RowEditAction } from '../RowActions'; /** * Stock location table diff --git a/src/frontend/src/tables/stock/StockTrackingTable.tsx b/src/frontend/src/tables/stock/StockTrackingTable.tsx index 41c85e7405..da4813f64a 100644 --- a/src/frontend/src/tables/stock/StockTrackingTable.tsx +++ b/src/frontend/src/tables/stock/StockTrackingTable.tsx @@ -7,6 +7,7 @@ import { ApiEndpoints } from '@lib/enums/ApiEndpoints'; import { ModelType } from '@lib/enums/ModelType'; import { apiUrl } from '@lib/functions/Api'; import type { TableFilter } from '@lib/types/Filters'; +import type { TableColumn } from '@lib/types/Tables'; import { RenderBuildOrder } from '../../components/render/Build'; import { RenderCompany } from '../../components/render/Company'; import { @@ -22,7 +23,6 @@ import { } from '../../components/render/Stock'; import { RenderUser } from '../../components/render/User'; import { useTable } from '../../hooks/UseTable'; -import type { TableColumn } from '../Column'; import { DateColumn, DescriptionColumn } from '../ColumnRenderers'; import { UserFilter } from '../Filter'; import { InvenTreeTable } from '../InvenTreeTable';