@alfadocs/ui-kit-debug 1.130.2 → 1.132.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{address-autocomplete-D2uNpxcE.js → address-autocomplete-yDLqg43e.js} +2 -2
- package/dist/_chunks/{address-autocomplete-D2uNpxcE.js.map → address-autocomplete-yDLqg43e.js.map} +1 -1
- package/dist/_chunks/{address-fields-BU65pA-V.js → address-fields-DvSWdeR0.js} +2 -2
- package/dist/_chunks/{address-fields-BU65pA-V.js.map → address-fields-DvSWdeR0.js.map} +1 -1
- package/dist/_chunks/bill-line-table-DHKb_O7c.js +2000 -0
- package/dist/_chunks/bill-line-table-DHKb_O7c.js.map +1 -0
- package/dist/_chunks/{data-grid-C9xlUMLt.js → data-grid-B2oaI7Lt.js} +2345 -2328
- package/dist/_chunks/data-grid-B2oaI7Lt.js.map +1 -0
- package/dist/_chunks/{default-tabs-BryvhiHv.js → default-tabs-DbebYO04.js} +3 -3
- package/dist/_chunks/{default-tabs-BryvhiHv.js.map → default-tabs-DbebYO04.js.map} +1 -1
- package/dist/_chunks/{invoice-upload-list-868v1oDe.js → invoice-upload-list-B5aMffTy.js} +21 -21
- package/dist/_chunks/{invoice-upload-list-868v1oDe.js.map → invoice-upload-list-B5aMffTy.js.map} +1 -1
- package/dist/_chunks/map-view-Cm69dCnY.js +1794 -0
- package/dist/_chunks/map-view-Cm69dCnY.js.map +1 -0
- package/dist/_chunks/{maps-core-gate-DKx96CC_.js → maps-core-gate-CP8SEHH1.js} +97 -93
- package/dist/_chunks/{maps-core-gate-DKx96CC_.js.map → maps-core-gate-CP8SEHH1.js.map} +1 -1
- package/dist/_chunks/{practice-results-M5A9-X9y.js → practice-results-DaxGw9_f.js} +762 -748
- package/dist/_chunks/practice-results-DaxGw9_f.js.map +1 -0
- package/dist/_chunks/{reserved.agent-BBuWWtYb.js → reserved.agent-W8mR179D.js} +2 -2
- package/dist/_chunks/{reserved.agent-BBuWWtYb.js.map → reserved.agent-W8mR179D.js.map} +1 -1
- package/dist/_chunks/{toolbar-BK6S9PhI.js → toolbar-CfdoJzMV.js} +2 -2
- package/dist/_chunks/{toolbar-BK6S9PhI.js.map → toolbar-CfdoJzMV.js.map} +1 -1
- package/dist/_chunks/{warehouse-load-summary-DkAKXcw0.js → warehouse-load-summary-CMMYzTDv.js} +75 -66
- package/dist/_chunks/warehouse-load-summary-CMMYzTDv.js.map +1 -0
- package/dist/agent-catalog.json +34 -11
- package/dist/agent-i18n/en.json +6 -4
- package/dist/browser-support.js +1 -1
- package/dist/components/_shared/decimal.d.ts +2 -0
- package/dist/components/_shared/decimal.d.ts.map +1 -1
- package/dist/components/address-autocomplete/index.js +1 -1
- package/dist/components/address-fields/index.js +1 -1
- package/dist/components/bill-line-table/bill-line-table.agent.d.ts.map +1 -1
- package/dist/components/bill-line-table/bill-line-table.columns.d.ts +4 -0
- package/dist/components/bill-line-table/bill-line-table.columns.d.ts.map +1 -1
- package/dist/components/bill-line-table/bill-line-table.d.ts.map +1 -1
- package/dist/components/bill-line-table/bill-line-table.header.d.ts +6 -0
- package/dist/components/bill-line-table/bill-line-table.header.d.ts.map +1 -1
- package/dist/components/bill-line-table/bill-line-table.invoice-cell.d.ts +6 -0
- package/dist/components/bill-line-table/bill-line-table.invoice-cell.d.ts.map +1 -0
- package/dist/components/bill-line-table/bill-line-table.model.d.ts +23 -10
- package/dist/components/bill-line-table/bill-line-table.model.d.ts.map +1 -1
- package/dist/components/bill-line-table/bill-line-table.scope.d.ts +56 -0
- package/dist/components/bill-line-table/bill-line-table.scope.d.ts.map +1 -0
- package/dist/components/bill-line-table/bill-line-table.types.d.ts +90 -10
- package/dist/components/bill-line-table/bill-line-table.types.d.ts.map +1 -1
- package/dist/components/bill-line-table/bill-line-table.variants.d.ts +2 -0
- package/dist/components/bill-line-table/bill-line-table.variants.d.ts.map +1 -1
- package/dist/components/bill-line-table/index.d.ts +3 -2
- package/dist/components/bill-line-table/index.d.ts.map +1 -1
- package/dist/components/bill-line-table/index.js +20 -18
- package/dist/components/bill-table/index.js +1 -1
- package/dist/components/booking/index.js +1 -1
- package/dist/components/data-grid/body.d.ts.map +1 -1
- package/dist/components/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/data-grid/data-grid.variants.d.ts.map +1 -1
- package/dist/components/data-grid/index.js +2 -2
- package/dist/components/data-grid/types.d.ts +6 -0
- package/dist/components/data-grid/types.d.ts.map +1 -1
- package/dist/components/data-grid/use-data-grid-engine.d.ts.map +1 -1
- package/dist/components/invoice-upload-list/index.js +1 -1
- package/dist/components/invoice-upload-list/invoice-upload-list.d.ts.map +1 -1
- package/dist/components/map-view/index.d.ts +1 -1
- package/dist/components/map-view/index.d.ts.map +1 -1
- package/dist/components/map-view/index.js +1 -1
- package/dist/components/map-view/map-view.agent.d.ts.map +1 -1
- package/dist/components/map-view/map-view.d.ts +42 -1
- package/dist/components/map-view/map-view.d.ts.map +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/components/practice-results/practice-results.d.ts +12 -1
- package/dist/components/practice-results/practice-results.d.ts.map +1 -1
- package/dist/components/warehouse-load-summary/index.js +1 -1
- package/dist/components/warehouse-load-summary/warehouse-load-summary.d.ts.map +1 -1
- package/dist/core.css +1 -1
- package/dist/decimal/index.js +32 -28
- package/dist/decimal/index.js.map +1 -1
- package/dist/host-compat.css +7 -1
- package/dist/i18n/locales/ar.d.ts +2 -0
- package/dist/i18n/locales/ar.d.ts.map +1 -1
- package/dist/i18n/locales/ar.js +3 -1
- package/dist/i18n/locales/ar.js.map +1 -1
- package/dist/i18n/locales/de.d.ts +2 -0
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/de.js +3 -1
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/el.d.ts +2 -0
- package/dist/i18n/locales/el.d.ts.map +1 -1
- package/dist/i18n/locales/el.js +3 -1
- package/dist/i18n/locales/el.js.map +1 -1
- package/dist/i18n/locales/en.d.ts +2 -0
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/en.js +3 -1
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +2 -0
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/es.js +3 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +2 -0
- package/dist/i18n/locales/fr.d.ts.map +1 -1
- package/dist/i18n/locales/fr.js +3 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hi.d.ts +2 -0
- package/dist/i18n/locales/hi.d.ts.map +1 -1
- package/dist/i18n/locales/hi.js +3 -1
- package/dist/i18n/locales/hi.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +2 -0
- package/dist/i18n/locales/it.d.ts.map +1 -1
- package/dist/i18n/locales/it.js +3 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/ja.d.ts +2 -0
- package/dist/i18n/locales/ja.d.ts.map +1 -1
- package/dist/i18n/locales/ja.js +3 -1
- package/dist/i18n/locales/ja.js.map +1 -1
- package/dist/i18n/locales/nl.d.ts +2 -0
- package/dist/i18n/locales/nl.d.ts.map +1 -1
- package/dist/i18n/locales/nl.js +3 -1
- package/dist/i18n/locales/nl.js.map +1 -1
- package/dist/i18n/locales/pl.d.ts +2 -0
- package/dist/i18n/locales/pl.d.ts.map +1 -1
- package/dist/i18n/locales/pl.js +3 -1
- package/dist/i18n/locales/pl.js.map +1 -1
- package/dist/i18n/locales/pt.d.ts +2 -0
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/pt.js +3 -1
- package/dist/i18n/locales/pt.js.map +1 -1
- package/dist/i18n/locales/ro.d.ts +2 -0
- package/dist/i18n/locales/ro.d.ts.map +1 -1
- package/dist/i18n/locales/ro.js +3 -1
- package/dist/i18n/locales/ro.js.map +1 -1
- package/dist/i18n/locales/ru.d.ts +2 -0
- package/dist/i18n/locales/ru.d.ts.map +1 -1
- package/dist/i18n/locales/ru.js +3 -1
- package/dist/i18n/locales/ru.js.map +1 -1
- package/dist/i18n/locales/sq.d.ts +2 -0
- package/dist/i18n/locales/sq.d.ts.map +1 -1
- package/dist/i18n/locales/sq.js +3 -1
- package/dist/i18n/locales/sq.js.map +1 -1
- package/dist/i18n/locales/sv.d.ts +2 -0
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/i18n/locales/sv.js +3 -1
- package/dist/i18n/locales/sv.js.map +1 -1
- package/dist/i18n/locales/tr.d.ts +2 -0
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/locales/tr.js +3 -1
- package/dist/i18n/locales/tr.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +2 -0
- package/dist/i18n/locales/zh.d.ts.map +1 -1
- package/dist/i18n/locales/zh.js +3 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.js +1062 -1060
- package/dist/locales/ar.json +3 -1
- package/dist/locales/de.json +3 -1
- package/dist/locales/el.json +3 -1
- package/dist/locales/en.json +3 -1
- package/dist/locales/es.json +3 -1
- package/dist/locales/fr.json +3 -1
- package/dist/locales/hi.json +3 -1
- package/dist/locales/it.json +3 -1
- package/dist/locales/ja.json +3 -1
- package/dist/locales/nl.json +3 -1
- package/dist/locales/pl.json +3 -1
- package/dist/locales/pt.json +3 -1
- package/dist/locales/ro.json +3 -1
- package/dist/locales/ru.json +3 -1
- package/dist/locales/sq.json +3 -1
- package/dist/locales/sv.json +3 -1
- package/dist/locales/tr.json +3 -1
- package/dist/locales/zh.json +3 -1
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/bill-line-table-CzYzg-Qh.js +0 -1757
- package/dist/_chunks/bill-line-table-CzYzg-Qh.js.map +0 -1
- package/dist/_chunks/data-grid-C9xlUMLt.js.map +0 -1
- package/dist/_chunks/map-view-DkL58SRp.js +0 -1613
- package/dist/_chunks/map-view-DkL58SRp.js.map +0 -1
- package/dist/_chunks/practice-results-M5A9-X9y.js.map +0 -1
- package/dist/_chunks/warehouse-load-summary-DkAKXcw0.js.map +0 -1
|
@@ -5,7 +5,7 @@ import { T as v, c as N, a as R } from "./parts-BOnDDU3E.js";
|
|
|
5
5
|
import { e as k, s as P, w as A, a as B } from "./export-files-BByoK9Cg.js";
|
|
6
6
|
import { i as O } from "./is-development-CLUAnsU7.js";
|
|
7
7
|
import { d as j, g as Q, u as _ } from "./grid-context-jn9y8tNE.js";
|
|
8
|
-
import { g as U } from "./data-grid-
|
|
8
|
+
import { g as U } from "./data-grid-B2oaI7Lt.js";
|
|
9
9
|
function S() {
|
|
10
10
|
var t;
|
|
11
11
|
return ((t = _()) == null ? void 0 : t.toolbarSeam) ?? null;
|
|
@@ -156,4 +156,4 @@ export {
|
|
|
156
156
|
Z as D,
|
|
157
157
|
Y as a
|
|
158
158
|
};
|
|
159
|
-
//# sourceMappingURL=toolbar-
|
|
159
|
+
//# sourceMappingURL=toolbar-CfdoJzMV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar-BK6S9PhI.js","sources":["../../src/components/data-grid/toolbar.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* DataGridToolbar: the shared table toolbar parts over DataGrid. */\n/* */\n/* The parts live in `_shared/table-toolbar/` and reach the grid only */\n/* through its `TableToolbarSeam` (`./toolbar-seam.ts`). Inside the */\n/* grid's `toolbar` slot they find it through `DataGridContext`; a */\n/* toolbar lifted into a page header uses `DataGridToolbarProvider`. */\n/* Callbacks get a `ToolbarActionContext` (ids and an export snapshot), */\n/* never an engine API. No AG Grid, no DataTable import. */\n/* -------------------------------------------------------------------- */\n\nimport { forwardRef, useCallback, useEffect, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { TableToolbarProvider } from '../_shared/table-toolbar/context';\nimport {\n exportFileName,\n snapshotToTable,\n writeTablePdf,\n writeTableXlsx,\n} from '../_shared/table-toolbar/export-files';\nimport {\n actionContextOf,\n createTableToolbarParts,\n} from '../_shared/table-toolbar/parts';\nimport type { TableToolbarSeam } from '../_shared/table-toolbar/seam';\nimport { isDevelopment } from '../_shared/is-development';\nimport {\n dataGridMountSignal,\n getDataGridToolbarSeam,\n useDataGridContext,\n} from './grid-context';\nimport { dataGridSeamCaption } from './toolbar-seam';\nimport type {\n DataGridExportFormat,\n DataGridHandle,\n DataGridToolbarBulkActionProps,\n DataGridToolbarColumnToggleProps,\n DataGridToolbarExportMenuItemProps,\n DataGridToolbarExportMenuProps,\n DataGridToolbarFacetFilterProps,\n DataGridToolbarFilterChipsProps,\n DataGridToolbarPrintProps,\n DataGridToolbarProviderProps,\n DataGridToolbarQuickSearchProps,\n DataGridToolbarRefreshProps,\n DataGridToolbarRootProps,\n} from './types';\n\n/** The grid's own seam when the part sits in its `toolbar` slot. */\nfunction useSlotSeam(): TableToolbarSeam | null {\n return useDataGridContext()?.toolbarSeam ?? null;\n}\n\n/* ------------------------------------------------------------------ */\n/* Lifted toolbar: DataGridToolbarProvider */\n/* ------------------------------------------------------------------ */\n\n/** A seam with nothing behind it, for a lifted toolbar whose grid has not\n * mounted yet: reads are empty, writes do nothing, `isReady()` is false. */\nconst UNBOUND_SEAM: TableToolbarSeam = {\n features: {\n syncsFilterInputs: true,\n exportsAllRows: false,\n keyboardReorder: true,\n },\n isReady: () => false,\n subscribe: () => () => {},\n getColumns: () => [],\n setColumnVisible: () => {},\n moveColumn: () => {},\n getQuickFilter: () => '',\n setQuickFilter: () => {},\n getFilterModel: () => ({}),\n setColumnFilter: () => {},\n clearAllFilters: () => {},\n setFacet: () => {},\n getFacet: () => null,\n getSelectionCount: () => 0,\n getSelectedRowIds: () => [],\n getExportSnapshot: () => undefined,\n exportCsv: () => {},\n print: () => {},\n};\n\ninterface Bound {\n handle: DataGridHandle | null;\n seam: TableToolbarSeam | null;\n}\n\n/**\n * For a toolbar outside the grid (a page header). Binds to whatever\n * `getGrid()` returns, once after mount and again whenever any DataGrid\n * mounts or unmounts (`dataGridMountSignal`): no polling. Until a grid is\n * bound the parts are inert.\n */\nexport function DataGridToolbarProvider({\n getGrid,\n children,\n}: DataGridToolbarProviderProps) {\n const [bound, setBound] = useState<Bound>({ handle: null, seam: null });\n useEffect(() => {\n const resolve = () => {\n const handle = getGrid() ?? null;\n const seam = getDataGridToolbarSeam(handle);\n setBound((prev) =>\n prev.handle === handle && prev.seam === seam ? prev : { handle, seam },\n );\n };\n resolve();\n return dataGridMountSignal.subscribe(resolve);\n }, [getGrid]);\n return (\n <TableToolbarProvider seam={bound.seam ?? UNBOUND_SEAM}>\n {children}\n </TableToolbarProvider>\n );\n}\n\n/**\n * Builds the toolbar and its parts. One call, at module level, marked pure:\n * a bundler drops it (and every shared part, DropdownMenu, Tag and Kbd with\n * it) from an app that imports `DataGrid` without `DataGridToolbar`.\n */\nfunction createDataGridToolbar() {\n const parts = createTableToolbarParts({\n prefix: 'DataGrid.Toolbar',\n missingProvider: (caller) =>\n `${caller} must be rendered in a DataGrid's \\`toolbar\\` slot or inside <DataGridToolbarProvider>.`,\n useEngineSeam: useSlotSeam,\n });\n\n /* ---- Root ---- */\n\n const Root = forwardRef<HTMLDivElement, DataGridToolbarRootProps>(\n (props, ref) => {\n const slotSeam = useSlotSeam();\n const root = (\n <parts.Root ref={ref} data-component=\"data-grid-toolbar\" {...props} />\n );\n // In the grid's slot, the grid's own seam is the nearest one, even\n // under a lifted provider for another grid.\n return slotSeam ? (\n <TableToolbarProvider seam={slotSeam}>{root}</TableToolbarProvider>\n ) : (\n root\n );\n },\n );\n Root.displayName = 'DataGrid.Toolbar';\n\n /* ---- Parts with DataGrid-shaped props ---- */\n\n const QuickSearch = (props: DataGridToolbarQuickSearchProps) => (\n <parts.QuickSearch {...props} />\n );\n QuickSearch.displayName = 'DataGrid.Toolbar.QuickSearch';\n\n const FilterChips = (_props: DataGridToolbarFilterChipsProps) => (\n <parts.FilterChips />\n );\n FilterChips.displayName = 'DataGrid.Toolbar.FilterChips';\n\n /**\n * Pills for one `select` column (or, in server mode, a host key). Any other\n * field renders nothing and warns in development: v9 would evaluate a set\n * model with the column's own (wrong) filter fn.\n */\n const FacetFilter = ({\n field,\n options,\n label,\n }: DataGridToolbarFacetFilterProps) => {\n const seam = parts.useSeam('FacetFilter');\n const column = seam.getColumns().find((c) => c.id === field);\n // A DataGrid seam exports every row exactly in client mode, so a host key\n // (no column) is allowed when it does not.\n const allowed = !seam.isReady()\n ? true\n : column\n ? column.filterKind === 'select' && !column.masked\n : !seam.features.exportsAllRows;\n useEffect(() => {\n if (!allowed && isDevelopment()) {\n console.warn(\n `DataGridToolbar.FacetFilter: \"${field}\" is not a column with filter { kind: 'select' }` +\n ' (or a host key in server mode); the pills are not rendered.',\n );\n }\n }, [allowed, field]);\n if (!allowed) return null;\n return <parts.FacetFilter field={field} options={options} label={label} />;\n };\n FacetFilter.displayName = 'DataGrid.Toolbar.FacetFilter';\n\n const ColumnToggle = forwardRef<\n HTMLButtonElement,\n DataGridToolbarColumnToggleProps\n >((props, ref) => <parts.ColumnToggle ref={ref} {...props} />);\n ColumnToggle.displayName = 'DataGrid.Toolbar.ColumnToggle';\n\n const Print = forwardRef<HTMLButtonElement, DataGridToolbarPrintProps>(\n (props, ref) => <parts.Print ref={ref} {...props} />,\n );\n Print.displayName = 'DataGrid.Toolbar.Print';\n\n const Refresh = forwardRef<HTMLButtonElement, DataGridToolbarRefreshProps>(\n (props, ref) => <parts.Refresh ref={ref} {...props} />,\n );\n Refresh.displayName = 'DataGrid.Toolbar.Refresh';\n\n const BulkAction = forwardRef<\n HTMLButtonElement,\n DataGridToolbarBulkActionProps\n >((props, ref) => <parts.BulkAction ref={ref} {...props} />);\n BulkAction.displayName = 'DataGrid.Toolbar.BulkAction';\n\n const DEFAULT_EXPORT_ITEMS: Exclude<DataGridExportFormat, 'custom'>[] = [\n 'csv',\n 'xlsx',\n 'pdf',\n ];\n\n /**\n * One export item. Built-ins write every filtered row (client mode); in\n * server mode the grid holds one page, so they render disabled with the\n * reason. `custom` always runs and gets the action context.\n */\n const ExportMenuItem = (props: DataGridToolbarExportMenuItemProps) => {\n const { t } = useTranslation('ui');\n const seam = parts.useSeam('ExportMenu.Item');\n const builtIn = props.format !== 'custom';\n const disabled = builtIn && !seam.features.exportsAllRows;\n const handleSelect = useCallback(() => {\n if (props.format === 'custom') {\n props.onExport(actionContextOf(seam));\n return;\n }\n const snapshot = seam.getExportSnapshot();\n if (!snapshot) return;\n const fileName =\n props.fileName ??\n exportFileName(dataGridSeamCaption(seam), props.format);\n if (props.format === 'csv') {\n seam.exportCsv(fileName);\n return;\n }\n const table = snapshotToTable(snapshot);\n if (props.format === 'xlsx') void writeTableXlsx(table, { fileName });\n else void writeTablePdf(table, { fileName });\n }, [props, seam]);\n return (\n <parts.ExportMenuItemBase\n format={props.format}\n label={props.label}\n onSelect={handleSelect}\n disabled={disabled}\n description={\n disabled ? t('dataGrid.toolbar.exportPageOnly') : undefined\n }\n />\n );\n };\n ExportMenuItem.displayName = 'DataGrid.Toolbar.ExportMenu.Item';\n\n const ExportMenu = forwardRef<\n HTMLButtonElement,\n DataGridToolbarExportMenuProps\n >(({ children, ...rest }, ref) => (\n <parts.ExportMenu ref={ref} {...rest}>\n {children ??\n DEFAULT_EXPORT_ITEMS.map((f) => <ExportMenuItem key={f} format={f} />)}\n </parts.ExportMenu>\n ));\n ExportMenu.displayName = 'DataGrid.Toolbar.ExportMenu';\n\n // These leaves render a single DS <IconButton> trigger, so IconButtonGroup\n // accepts them as direct children (see its rendersIconButton DEV check).\n for (const leaf of [ColumnToggle, Print, Refresh, ExportMenu]) {\n (leaf as { rendersIconButton?: boolean }).rendersIconButton = true;\n }\n // Folded into a group's \"More\" menu, Print and Refresh render the shared\n // part's menu item (their action is not an onClick prop).\n Object.assign(Print, { overflowMenuItem: parts.Print.overflowMenuItem });\n Object.assign(Refresh, { overflowMenuItem: parts.Refresh.overflowMenuItem });\n\n const FilterBar = parts.FilterBar;\n const Actions = parts.Actions;\n\n return Object.assign(Root, {\n FilterBar,\n Actions,\n QuickSearch,\n FilterChips,\n FacetFilter,\n ColumnToggle,\n ExportMenu: Object.assign(ExportMenu, { Item: ExportMenuItem }),\n Print,\n Refresh,\n BulkAction,\n });\n}\n\n/**\n * The DataGrid toolbar. Put it in the grid's `toolbar` prop, or lift it into\n * a page header under `DataGridToolbarProvider`.\n */\nexport const DataGridToolbar = /* @__PURE__ */ createDataGridToolbar();\n"],"names":["useSlotSeam","_a","useDataGridContext","UNBOUND_SEAM","DataGridToolbarProvider","getGrid","children","bound","setBound","useState","useEffect","resolve","handle","seam","getDataGridToolbarSeam","prev","dataGridMountSignal","TableToolbarProvider","createDataGridToolbar","parts","createTableToolbarParts","caller","Root","forwardRef","props","ref","slotSeam","root","jsx","QuickSearch","FilterChips","_props","FacetFilter","field","options","label","column","c","allowed","isDevelopment","ColumnToggle","Print","Refresh","BulkAction","DEFAULT_EXPORT_ITEMS","ExportMenuItem","t","useTranslation","disabled","handleSelect","useCallback","actionContextOf","snapshot","fileName","exportFileName","dataGridSeamCaption","table","snapshotToTable","writeTableXlsx","writeTablePdf","ExportMenu","rest","f","leaf","FilterBar","Actions","DataGridToolbar"],"mappings":";;;;;;;;AAiDA,SAASA,IAAuC;;AAC9C,WAAOC,IAAAC,EAAA,MAAA,gBAAAD,EAAsB,gBAAe;AAC9C;AAQA,MAAME,IAAiC;AAAA,EACrC,UAAU;AAAA,IACR,mBAAmB;AAAA,IACnB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,EAAA;AAAA,EAEnB,SAAS,MAAM;AAAA,EACf,WAAW,MAAM,MAAM;AAAA,EAAC;AAAA,EACxB,YAAY,MAAM,CAAA;AAAA,EAClB,kBAAkB,MAAM;AAAA,EAAC;AAAA,EACzB,YAAY,MAAM;AAAA,EAAC;AAAA,EACnB,gBAAgB,MAAM;AAAA,EACtB,gBAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,gBAAgB,OAAO,CAAA;AAAA,EACvB,iBAAi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CAAC,EAAE,UAAAjB,GAAU,GAAGuD,EAAA,GAAQpC,MACxB,gBAAAG,EAACT,EAAM,YAAN,EAAiB,KAAAM,GAAW,GAAGoC,GAC7B,UAAAvD,KACCsC,EAAqB,IAAI,CAACkB,MAAM,gBAAAlC,EAACiB,GAAA,EAAuB,QAAQiB,EAAA,GAAXA,CAAc,CAAE,EAAA,CACzE,CACD;AACD,EAAAF,EAAW,cAAc;AAIzB,aAAWG,KAAQ,CAACvB,GAAcC,GAAOC,GAASkB,CAAU;AACzD,IAAAG,EAAyC,oBAAoB;AAIhE,SAAO,OAAOtB,GAAO,EAAE,kBAAkBtB,EAAM,MAAM,kBAAkB,GACvE,OAAO,OAAOuB,GAAS,EAAE,kBAAkBvB,EAAM,QAAQ,kBAAkB;AAE3E,QAAM6C,IAAY7C,EAAM,WAClB8C,IAAU9C,EAAM;AAEtB,SAAO,OAAO,OAAOG,GAAM;AAAA,IACzB,WAAA0C;AAAA,IACA,SAAAC;AAAA,IACA,aAAApC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAE;AAAA,IACA,cAAAQ;AAAA,IACA,YAAY,OAAO,OAAOoB,GAAY,EAAE,MAAMf,GAAgB;AAAA,IAC9D,OAAAJ;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,EAAA,CACD;AACH;AAMO,MAAMuB,IAAkC,gBAAAhD,EAAA;"}
|
|
1
|
+
{"version":3,"file":"toolbar-CfdoJzMV.js","sources":["../../src/components/data-grid/toolbar.tsx"],"sourcesContent":["/* -------------------------------------------------------------------- */\n/* DataGridToolbar: the shared table toolbar parts over DataGrid. */\n/* */\n/* The parts live in `_shared/table-toolbar/` and reach the grid only */\n/* through its `TableToolbarSeam` (`./toolbar-seam.ts`). Inside the */\n/* grid's `toolbar` slot they find it through `DataGridContext`; a */\n/* toolbar lifted into a page header uses `DataGridToolbarProvider`. */\n/* Callbacks get a `ToolbarActionContext` (ids and an export snapshot), */\n/* never an engine API. No AG Grid, no DataTable import. */\n/* -------------------------------------------------------------------- */\n\nimport { forwardRef, useCallback, useEffect, useState } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { TableToolbarProvider } from '../_shared/table-toolbar/context';\nimport {\n exportFileName,\n snapshotToTable,\n writeTablePdf,\n writeTableXlsx,\n} from '../_shared/table-toolbar/export-files';\nimport {\n actionContextOf,\n createTableToolbarParts,\n} from '../_shared/table-toolbar/parts';\nimport type { TableToolbarSeam } from '../_shared/table-toolbar/seam';\nimport { isDevelopment } from '../_shared/is-development';\nimport {\n dataGridMountSignal,\n getDataGridToolbarSeam,\n useDataGridContext,\n} from './grid-context';\nimport { dataGridSeamCaption } from './toolbar-seam';\nimport type {\n DataGridExportFormat,\n DataGridHandle,\n DataGridToolbarBulkActionProps,\n DataGridToolbarColumnToggleProps,\n DataGridToolbarExportMenuItemProps,\n DataGridToolbarExportMenuProps,\n DataGridToolbarFacetFilterProps,\n DataGridToolbarFilterChipsProps,\n DataGridToolbarPrintProps,\n DataGridToolbarProviderProps,\n DataGridToolbarQuickSearchProps,\n DataGridToolbarRefreshProps,\n DataGridToolbarRootProps,\n} from './types';\n\n/** The grid's own seam when the part sits in its `toolbar` slot. */\nfunction useSlotSeam(): TableToolbarSeam | null {\n return useDataGridContext()?.toolbarSeam ?? null;\n}\n\n/* ------------------------------------------------------------------ */\n/* Lifted toolbar: DataGridToolbarProvider */\n/* ------------------------------------------------------------------ */\n\n/** A seam with nothing behind it, for a lifted toolbar whose grid has not\n * mounted yet: reads are empty, writes do nothing, `isReady()` is false. */\nconst UNBOUND_SEAM: TableToolbarSeam = {\n features: {\n syncsFilterInputs: true,\n exportsAllRows: false,\n keyboardReorder: true,\n },\n isReady: () => false,\n subscribe: () => () => {},\n getColumns: () => [],\n setColumnVisible: () => {},\n moveColumn: () => {},\n getQuickFilter: () => '',\n setQuickFilter: () => {},\n getFilterModel: () => ({}),\n setColumnFilter: () => {},\n clearAllFilters: () => {},\n setFacet: () => {},\n getFacet: () => null,\n getSelectionCount: () => 0,\n getSelectedRowIds: () => [],\n getExportSnapshot: () => undefined,\n exportCsv: () => {},\n print: () => {},\n};\n\ninterface Bound {\n handle: DataGridHandle | null;\n seam: TableToolbarSeam | null;\n}\n\n/**\n * For a toolbar outside the grid (a page header). Binds to whatever\n * `getGrid()` returns, once after mount and again whenever any DataGrid\n * mounts or unmounts (`dataGridMountSignal`): no polling. Until a grid is\n * bound the parts are inert.\n */\nexport function DataGridToolbarProvider({\n getGrid,\n children,\n}: DataGridToolbarProviderProps) {\n const [bound, setBound] = useState<Bound>({ handle: null, seam: null });\n useEffect(() => {\n const resolve = () => {\n const handle = getGrid() ?? null;\n const seam = getDataGridToolbarSeam(handle);\n setBound((prev) =>\n prev.handle === handle && prev.seam === seam ? prev : { handle, seam },\n );\n };\n resolve();\n return dataGridMountSignal.subscribe(resolve);\n }, [getGrid]);\n return (\n <TableToolbarProvider seam={bound.seam ?? UNBOUND_SEAM}>\n {children}\n </TableToolbarProvider>\n );\n}\n\n/**\n * Builds the toolbar and its parts. One call, at module level, marked pure:\n * a bundler drops it (and every shared part, DropdownMenu, Tag and Kbd with\n * it) from an app that imports `DataGrid` without `DataGridToolbar`.\n */\nfunction createDataGridToolbar() {\n const parts = createTableToolbarParts({\n prefix: 'DataGrid.Toolbar',\n missingProvider: (caller) =>\n `${caller} must be rendered in a DataGrid's \\`toolbar\\` slot or inside <DataGridToolbarProvider>.`,\n useEngineSeam: useSlotSeam,\n });\n\n /* ---- Root ---- */\n\n const Root = forwardRef<HTMLDivElement, DataGridToolbarRootProps>(\n (props, ref) => {\n const slotSeam = useSlotSeam();\n const root = (\n <parts.Root ref={ref} data-component=\"data-grid-toolbar\" {...props} />\n );\n // In the grid's slot, the grid's own seam is the nearest one, even\n // under a lifted provider for another grid.\n return slotSeam ? (\n <TableToolbarProvider seam={slotSeam}>{root}</TableToolbarProvider>\n ) : (\n root\n );\n },\n );\n Root.displayName = 'DataGrid.Toolbar';\n\n /* ---- Parts with DataGrid-shaped props ---- */\n\n const QuickSearch = (props: DataGridToolbarQuickSearchProps) => (\n <parts.QuickSearch {...props} />\n );\n QuickSearch.displayName = 'DataGrid.Toolbar.QuickSearch';\n\n const FilterChips = (_props: DataGridToolbarFilterChipsProps) => (\n <parts.FilterChips />\n );\n FilterChips.displayName = 'DataGrid.Toolbar.FilterChips';\n\n /**\n * Pills for one `select` column (or, in server mode, a host key). Any other\n * field renders nothing and warns in development: v9 would evaluate a set\n * model with the column's own (wrong) filter fn.\n */\n const FacetFilter = ({\n field,\n options,\n label,\n }: DataGridToolbarFacetFilterProps) => {\n const seam = parts.useSeam('FacetFilter');\n const column = seam.getColumns().find((c) => c.id === field);\n // A DataGrid seam exports every row exactly in client mode, so a host key\n // (no column) is allowed when it does not.\n const allowed = !seam.isReady()\n ? true\n : column\n ? column.filterKind === 'select' && !column.masked\n : !seam.features.exportsAllRows;\n useEffect(() => {\n if (!allowed && isDevelopment()) {\n console.warn(\n `DataGridToolbar.FacetFilter: \"${field}\" is not a column with filter { kind: 'select' }` +\n ' (or a host key in server mode); the pills are not rendered.',\n );\n }\n }, [allowed, field]);\n if (!allowed) return null;\n return <parts.FacetFilter field={field} options={options} label={label} />;\n };\n FacetFilter.displayName = 'DataGrid.Toolbar.FacetFilter';\n\n const ColumnToggle = forwardRef<\n HTMLButtonElement,\n DataGridToolbarColumnToggleProps\n >((props, ref) => <parts.ColumnToggle ref={ref} {...props} />);\n ColumnToggle.displayName = 'DataGrid.Toolbar.ColumnToggle';\n\n const Print = forwardRef<HTMLButtonElement, DataGridToolbarPrintProps>(\n (props, ref) => <parts.Print ref={ref} {...props} />,\n );\n Print.displayName = 'DataGrid.Toolbar.Print';\n\n const Refresh = forwardRef<HTMLButtonElement, DataGridToolbarRefreshProps>(\n (props, ref) => <parts.Refresh ref={ref} {...props} />,\n );\n Refresh.displayName = 'DataGrid.Toolbar.Refresh';\n\n const BulkAction = forwardRef<\n HTMLButtonElement,\n DataGridToolbarBulkActionProps\n >((props, ref) => <parts.BulkAction ref={ref} {...props} />);\n BulkAction.displayName = 'DataGrid.Toolbar.BulkAction';\n\n const DEFAULT_EXPORT_ITEMS: Exclude<DataGridExportFormat, 'custom'>[] = [\n 'csv',\n 'xlsx',\n 'pdf',\n ];\n\n /**\n * One export item. Built-ins write every filtered row (client mode); in\n * server mode the grid holds one page, so they render disabled with the\n * reason. `custom` always runs and gets the action context.\n */\n const ExportMenuItem = (props: DataGridToolbarExportMenuItemProps) => {\n const { t } = useTranslation('ui');\n const seam = parts.useSeam('ExportMenu.Item');\n const builtIn = props.format !== 'custom';\n const disabled = builtIn && !seam.features.exportsAllRows;\n const handleSelect = useCallback(() => {\n if (props.format === 'custom') {\n props.onExport(actionContextOf(seam));\n return;\n }\n const snapshot = seam.getExportSnapshot();\n if (!snapshot) return;\n const fileName =\n props.fileName ??\n exportFileName(dataGridSeamCaption(seam), props.format);\n if (props.format === 'csv') {\n seam.exportCsv(fileName);\n return;\n }\n const table = snapshotToTable(snapshot);\n if (props.format === 'xlsx') void writeTableXlsx(table, { fileName });\n else void writeTablePdf(table, { fileName });\n }, [props, seam]);\n return (\n <parts.ExportMenuItemBase\n format={props.format}\n label={props.label}\n onSelect={handleSelect}\n disabled={disabled}\n description={\n disabled ? t('dataGrid.toolbar.exportPageOnly') : undefined\n }\n />\n );\n };\n ExportMenuItem.displayName = 'DataGrid.Toolbar.ExportMenu.Item';\n\n const ExportMenu = forwardRef<\n HTMLButtonElement,\n DataGridToolbarExportMenuProps\n >(({ children, ...rest }, ref) => (\n <parts.ExportMenu ref={ref} {...rest}>\n {children ??\n DEFAULT_EXPORT_ITEMS.map((f) => <ExportMenuItem key={f} format={f} />)}\n </parts.ExportMenu>\n ));\n ExportMenu.displayName = 'DataGrid.Toolbar.ExportMenu';\n\n // These leaves render a single DS <IconButton> trigger, so IconButtonGroup\n // accepts them as direct children (see its rendersIconButton DEV check).\n for (const leaf of [ColumnToggle, Print, Refresh, ExportMenu]) {\n (leaf as { rendersIconButton?: boolean }).rendersIconButton = true;\n }\n // Folded into a group's \"More\" menu, Print and Refresh render the shared\n // part's menu item (their action is not an onClick prop).\n Object.assign(Print, { overflowMenuItem: parts.Print.overflowMenuItem });\n Object.assign(Refresh, { overflowMenuItem: parts.Refresh.overflowMenuItem });\n\n const FilterBar = parts.FilterBar;\n const Actions = parts.Actions;\n\n return Object.assign(Root, {\n FilterBar,\n Actions,\n QuickSearch,\n FilterChips,\n FacetFilter,\n ColumnToggle,\n ExportMenu: Object.assign(ExportMenu, { Item: ExportMenuItem }),\n Print,\n Refresh,\n BulkAction,\n });\n}\n\n/**\n * The DataGrid toolbar. Put it in the grid's `toolbar` prop, or lift it into\n * a page header under `DataGridToolbarProvider`.\n */\nexport const DataGridToolbar = /* @__PURE__ */ createDataGridToolbar();\n"],"names":["useSlotSeam","_a","useDataGridContext","UNBOUND_SEAM","DataGridToolbarProvider","getGrid","children","bound","setBound","useState","useEffect","resolve","handle","seam","getDataGridToolbarSeam","prev","dataGridMountSignal","TableToolbarProvider","createDataGridToolbar","parts","createTableToolbarParts","caller","Root","forwardRef","props","ref","slotSeam","root","jsx","QuickSearch","FilterChips","_props","FacetFilter","field","options","label","column","c","allowed","isDevelopment","ColumnToggle","Print","Refresh","BulkAction","DEFAULT_EXPORT_ITEMS","ExportMenuItem","t","useTranslation","disabled","handleSelect","useCallback","actionContextOf","snapshot","fileName","exportFileName","dataGridSeamCaption","table","snapshotToTable","writeTableXlsx","writeTablePdf","ExportMenu","rest","f","leaf","FilterBar","Actions","DataGridToolbar"],"mappings":";;;;;;;;AAiDA,SAASA,IAAuC;;AAC9C,WAAOC,IAAAC,EAAA,MAAA,gBAAAD,EAAsB,gBAAe;AAC9C;AAQA,MAAME,IAAiC;AAAA,EACrC,UAAU;AAAA,IACR,mBAAmB;AAAA,IACnB,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,EAAA;AAAA,EAEnB,SAAS,MAAM;AAAA,EACf,WAAW,MAAM,MAAM;AAAA,EAAC;AAAA,EACxB,YAAY,MAAM,CAA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A,QACd,OAAOA,EAAM;AAAA,QACb,UAAUyB;AAAA,QACV,UAAAD;AAAA,QACA,aACEA,IAAWF,EAAE,iCAAiC,IAAI;AAAA,MAAA;AAAA,IAAA;AAAA,EAI1D;AACA,EAAAD,EAAe,cAAc;AAE7B,QAAMe,IAAarC,EAGjB,CAAC,EAAE,UAAAjB,GAAU,GAAGuD,EAAA,GAAQpC,MACxB,gBAAAG,EAACT,EAAM,YAAN,EAAiB,KAAAM,GAAW,GAAGoC,GAC7B,UAAAvD,KACCsC,EAAqB,IAAI,CAACkB,MAAM,gBAAAlC,EAACiB,GAAA,EAAuB,QAAQiB,EAAA,GAAXA,CAAc,CAAE,EAAA,CACzE,CACD;AACD,EAAAF,EAAW,cAAc;AAIzB,aAAWG,KAAQ,CAACvB,GAAcC,GAAOC,GAASkB,CAAU;AACzD,IAAAG,EAAyC,oBAAoB;AAIhE,SAAO,OAAOtB,GAAO,EAAE,kBAAkBtB,EAAM,MAAM,kBAAkB,GACvE,OAAO,OAAOuB,GAAS,EAAE,kBAAkBvB,EAAM,QAAQ,kBAAkB;AAE3E,QAAM6C,IAAY7C,EAAM,WAClB8C,IAAU9C,EAAM;AAEtB,SAAO,OAAO,OAAOG,GAAM;AAAA,IACzB,WAAA0C;AAAA,IACA,SAAAC;AAAA,IACA,aAAApC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAE;AAAA,IACA,cAAAQ;AAAA,IACA,YAAY,OAAO,OAAOoB,GAAY,EAAE,MAAMf,GAAgB;AAAA,IAC9D,OAAAJ;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,EAAA,CACD;AACH;AAMO,MAAMuB,IAAkC,gBAAAhD,EAAA;"}
|
package/dist/_chunks/{warehouse-load-summary-DkAKXcw0.js → warehouse-load-summary-CMMYzTDv.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useId as W, useRef as C, useEffect as j, useMemo as
|
|
1
|
+
import { jsx as r, jsxs as i, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useId as W, useRef as C, useEffect as j, useMemo as N } from "react";
|
|
3
3
|
import { useTranslation as R } from "react-i18next";
|
|
4
4
|
import { u as U } from "./registry-DvAUVLHh.js";
|
|
5
5
|
import { A as m } from "./alert-C4WKViaS.js";
|
|
@@ -13,23 +13,23 @@ const V = /* @__PURE__ */ new Set([
|
|
|
13
13
|
"invoicesLoaded",
|
|
14
14
|
"filesWithErrors"
|
|
15
15
|
]);
|
|
16
|
-
function
|
|
16
|
+
function w(a) {
|
|
17
17
|
return typeof a == "number" && Number.isFinite(a) && a >= 0;
|
|
18
18
|
}
|
|
19
19
|
function B(a, s) {
|
|
20
20
|
const o = [];
|
|
21
|
-
for (const
|
|
22
|
-
if (s === "invoice" && O.has(
|
|
23
|
-
const d = a[
|
|
24
|
-
if (!
|
|
21
|
+
for (const t of $) {
|
|
22
|
+
if (s === "invoice" && O.has(t)) continue;
|
|
23
|
+
const d = a[t];
|
|
24
|
+
if (!w(d)) continue;
|
|
25
25
|
const n = Math.trunc(d);
|
|
26
|
-
n === 0 && V.has(
|
|
26
|
+
n === 0 && V.has(t) || o.push({ key: t, count: n });
|
|
27
27
|
}
|
|
28
28
|
return o;
|
|
29
29
|
}
|
|
30
30
|
function Y(a, s, o) {
|
|
31
31
|
if (a) return a;
|
|
32
|
-
const d = (s.filesWithErrors ?? 0) > 0 || o.length > 0, n =
|
|
32
|
+
const d = (s.filesWithErrors ?? 0) > 0 || o.length > 0, n = w(s.invoicesLoaded) && s.invoicesLoaded >= 1 || w(s.linesLoaded) && s.linesLoaded >= 1;
|
|
33
33
|
return d ? n ? "partial" : "error" : n ? "success" : "unchanged";
|
|
34
34
|
}
|
|
35
35
|
const z = {
|
|
@@ -64,7 +64,7 @@ const z = {
|
|
|
64
64
|
description: "Each failed file row emits its id as data-file-id."
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
},
|
|
67
|
+
}, I = {
|
|
68
68
|
success: "success",
|
|
69
69
|
partial: "warning",
|
|
70
70
|
error: "error",
|
|
@@ -72,103 +72,112 @@ const z = {
|
|
|
72
72
|
}, G = [], S = {
|
|
73
73
|
filesWithErrors: "destructive"
|
|
74
74
|
};
|
|
75
|
-
function
|
|
75
|
+
function te({
|
|
76
76
|
counts: a,
|
|
77
77
|
scope: s = "batch",
|
|
78
78
|
outcome: o,
|
|
79
|
-
failedFiles:
|
|
79
|
+
failedFiles: t = G,
|
|
80
80
|
headingLevel: d = 2,
|
|
81
81
|
focusOnMount: n = !0,
|
|
82
|
-
actions:
|
|
82
|
+
actions: p,
|
|
83
83
|
variant: E = "full",
|
|
84
84
|
id: h,
|
|
85
|
-
className:
|
|
85
|
+
className: x
|
|
86
86
|
}) {
|
|
87
|
-
const { t: c, i18n: T } = R("ui"), g = T.language,
|
|
87
|
+
const { t: c, i18n: T } = R("ui"), g = T.language, L = W(), v = C(null);
|
|
88
88
|
j(() => {
|
|
89
89
|
var e;
|
|
90
90
|
n && ((e = v.current) == null || e.focus({ preventScroll: !0 }));
|
|
91
91
|
}, [n]);
|
|
92
|
-
const u =
|
|
92
|
+
const u = N(() => B(a, s), [a, s]), l = Y(o, a, t), A = N(
|
|
93
93
|
() => ({
|
|
94
94
|
getCounts: () => Object.fromEntries(u.map((e) => [e.key, e.count])),
|
|
95
|
-
getFailedFileIds: () =>
|
|
95
|
+
getFailedFileIds: () => t.map((e) => e.id)
|
|
96
96
|
}),
|
|
97
|
-
[u,
|
|
97
|
+
[u, t]
|
|
98
98
|
);
|
|
99
99
|
U(z, A, h);
|
|
100
|
-
const
|
|
101
|
-
defaultValue: K[s][
|
|
102
|
-
}), F = u.filter((e) => e.count > 0).map((e) => D(c, g, e.key, e.count)),
|
|
103
|
-
return E === "banner" ? /* @__PURE__ */
|
|
100
|
+
const b = c(`warehouseLoadSummary.title.${s}.${l}`, {
|
|
101
|
+
defaultValue: K[s][l]
|
|
102
|
+
}), F = u.filter((e) => e.count > 0).map((e) => D(c, g, e.key, e.count)), f = P(F, g);
|
|
103
|
+
return E === "banner" ? /* @__PURE__ */ r(
|
|
104
104
|
"div",
|
|
105
105
|
{
|
|
106
106
|
"data-component": "warehouse-load-summary",
|
|
107
107
|
"data-component-id": h,
|
|
108
|
-
"data-outcome":
|
|
108
|
+
"data-outcome": l,
|
|
109
109
|
"data-variant": "banner",
|
|
110
|
-
className:
|
|
111
|
-
children: /* @__PURE__ */
|
|
110
|
+
className: x,
|
|
111
|
+
children: /* @__PURE__ */ r(
|
|
112
112
|
m,
|
|
113
113
|
{
|
|
114
|
-
variant:
|
|
114
|
+
variant: I[l],
|
|
115
115
|
announce: n ? "off" : "polite",
|
|
116
|
-
children: /* @__PURE__ */
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
116
|
+
children: /* @__PURE__ */ i("div", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] ds:gap-y-[var(--spacing-xs)]", children: [
|
|
117
|
+
/* @__PURE__ */ i("div", { className: "ds:min-w-0", children: [
|
|
118
|
+
/* @__PURE__ */ r(
|
|
119
|
+
m.Title,
|
|
120
|
+
{
|
|
121
|
+
ref: v,
|
|
122
|
+
tabIndex: -1,
|
|
123
|
+
className: "ds:inline ds:outline-none",
|
|
124
|
+
as: `h${d}`,
|
|
125
|
+
children: b
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
f ? /* @__PURE__ */ i(_, { children: [
|
|
129
|
+
/* @__PURE__ */ r(
|
|
130
|
+
"span",
|
|
131
|
+
{
|
|
132
|
+
"aria-hidden": "true",
|
|
133
|
+
className: "ds:mx-[var(--spacing-xs)]",
|
|
134
|
+
children: "·"
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ r("p", { className: "type-body-sm ds:m-0 ds:inline", children: f })
|
|
138
|
+
] }) : null
|
|
139
|
+
] }),
|
|
140
|
+
p ? /* @__PURE__ */ r("div", { className: "ds:ms-auto ds:flex ds:flex-wrap ds:justify-end ds:gap-[var(--spacing-sm)]", children: p }) : null
|
|
132
141
|
] })
|
|
133
142
|
}
|
|
134
143
|
)
|
|
135
144
|
}
|
|
136
|
-
) : /* @__PURE__ */
|
|
145
|
+
) : /* @__PURE__ */ i(
|
|
137
146
|
"div",
|
|
138
147
|
{
|
|
139
148
|
"data-component": "warehouse-load-summary",
|
|
140
149
|
"data-component-id": h,
|
|
141
|
-
"data-outcome":
|
|
142
|
-
className: ["ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
|
|
150
|
+
"data-outcome": l,
|
|
151
|
+
className: ["ds:flex ds:flex-col ds:gap-[var(--spacing-md)]", x].filter(Boolean).join(" "),
|
|
143
152
|
children: [
|
|
144
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ i(
|
|
145
154
|
m,
|
|
146
155
|
{
|
|
147
|
-
variant:
|
|
156
|
+
variant: I[l],
|
|
148
157
|
announce: n ? "off" : "polite",
|
|
149
158
|
children: [
|
|
150
|
-
/* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ r(
|
|
151
160
|
m.Title,
|
|
152
161
|
{
|
|
153
162
|
ref: v,
|
|
154
163
|
tabIndex: -1,
|
|
155
164
|
className: "ds:outline-none",
|
|
156
165
|
as: `h${d}`,
|
|
157
|
-
children:
|
|
166
|
+
children: b
|
|
158
167
|
}
|
|
159
168
|
),
|
|
160
|
-
|
|
169
|
+
f ? /* @__PURE__ */ r(m.Description, { children: f }) : null
|
|
161
170
|
]
|
|
162
171
|
}
|
|
163
172
|
),
|
|
164
|
-
u.length > 0 ? /* @__PURE__ */
|
|
173
|
+
u.length > 0 ? /* @__PURE__ */ r(
|
|
165
174
|
H,
|
|
166
175
|
{
|
|
167
176
|
"aria-label": c("warehouseLoadSummary.counts", {
|
|
168
177
|
defaultValue: "Load counts"
|
|
169
178
|
}),
|
|
170
179
|
maxColumns: 4,
|
|
171
|
-
children: u.map(({ key: e, count:
|
|
180
|
+
children: u.map(({ key: e, count: y }) => /* @__PURE__ */ r(
|
|
172
181
|
k,
|
|
173
182
|
{
|
|
174
183
|
variant: "outlined",
|
|
@@ -176,43 +185,43 @@ function re({
|
|
|
176
185
|
label: c(`warehouseLoadSummary.stat.${e}`, {
|
|
177
186
|
defaultValue: M[e]
|
|
178
187
|
}),
|
|
179
|
-
value:
|
|
188
|
+
value: y,
|
|
180
189
|
locale: g,
|
|
181
|
-
intent:
|
|
190
|
+
intent: y > 0 && e in S ? S[e] : "foreground"
|
|
182
191
|
},
|
|
183
192
|
e
|
|
184
193
|
))
|
|
185
194
|
}
|
|
186
195
|
) : null,
|
|
187
|
-
|
|
196
|
+
t.length > 0 ? /* @__PURE__ */ i(
|
|
188
197
|
"div",
|
|
189
198
|
{
|
|
190
199
|
role: "group",
|
|
191
|
-
"aria-labelledby":
|
|
200
|
+
"aria-labelledby": L,
|
|
192
201
|
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
|
|
193
202
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ r(
|
|
195
204
|
Z,
|
|
196
205
|
{
|
|
197
206
|
as: `h${Math.min(d + 1, 6)}`,
|
|
198
|
-
id:
|
|
207
|
+
id: L,
|
|
199
208
|
children: c("warehouseLoadSummary.failedFiles", {
|
|
200
209
|
defaultValue: "Files that could not be loaded"
|
|
201
210
|
})
|
|
202
211
|
}
|
|
203
212
|
),
|
|
204
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ r(
|
|
205
214
|
"ul",
|
|
206
215
|
{
|
|
207
216
|
role: "list",
|
|
208
217
|
className: "ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-xs)] ds:p-0",
|
|
209
|
-
children:
|
|
218
|
+
children: t.map((e) => /* @__PURE__ */ i(
|
|
210
219
|
"li",
|
|
211
220
|
{
|
|
212
221
|
"data-file-id": e.id,
|
|
213
222
|
className: "ds:flex ds:flex-col ds:break-words ds:border-s-[length:var(--border-width-md)] ds:border-s-[color:var(--destructive)] ds:ps-[var(--spacing-sm)]",
|
|
214
223
|
children: [
|
|
215
|
-
/* @__PURE__ */
|
|
224
|
+
/* @__PURE__ */ r(
|
|
216
225
|
"span",
|
|
217
226
|
{
|
|
218
227
|
dir: "auto",
|
|
@@ -220,7 +229,7 @@ function re({
|
|
|
220
229
|
children: e.fileName
|
|
221
230
|
}
|
|
222
231
|
),
|
|
223
|
-
/* @__PURE__ */
|
|
232
|
+
/* @__PURE__ */ r(
|
|
224
233
|
"span",
|
|
225
234
|
{
|
|
226
235
|
dir: "auto",
|
|
@@ -237,7 +246,7 @@ function re({
|
|
|
237
246
|
]
|
|
238
247
|
}
|
|
239
248
|
) : null,
|
|
240
|
-
|
|
249
|
+
p ? /* @__PURE__ */ r("div", { className: "ds:flex ds:flex-wrap ds:justify-end ds:gap-[var(--spacing-sm)]", children: p }) : null
|
|
241
250
|
]
|
|
242
251
|
}
|
|
243
252
|
);
|
|
@@ -280,10 +289,10 @@ function Z({
|
|
|
280
289
|
id: s,
|
|
281
290
|
children: o
|
|
282
291
|
}) {
|
|
283
|
-
return /* @__PURE__ */
|
|
292
|
+
return /* @__PURE__ */ r(a, { id: s, className: "type-label ds:m-0 ds:text-[var(--foreground)]", children: o });
|
|
284
293
|
}
|
|
285
294
|
export {
|
|
286
|
-
|
|
295
|
+
te as W,
|
|
287
296
|
z as w
|
|
288
297
|
};
|
|
289
|
-
//# sourceMappingURL=warehouse-load-summary-
|
|
298
|
+
//# sourceMappingURL=warehouse-load-summary-CMMYzTDv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warehouse-load-summary-CMMYzTDv.js","sources":["../../src/components/warehouse-load-summary/model.ts","../../src/components/warehouse-load-summary/warehouse-load-summary.agent.ts","../../src/components/warehouse-load-summary/warehouse-load-summary.tsx"],"sourcesContent":["import { WAREHOUSE_COUNT_KEYS } from '../_shared/warehouse-load';\nimport type {\n WarehouseCountKey,\n WarehouseLoadCounts,\n WarehouseLoadFailedFile,\n WarehouseLoadOutcome,\n WarehouseLoadScope,\n} from './types';\n\n/** Counts that hide at zero (nothing to report). */\nconst HIDE_AT_ZERO: ReadonlySet<WarehouseCountKey> = new Set([\n 'itemsUpdated',\n 'filesWithErrors',\n]);\n/** Counts a single-invoice summary leaves out. */\nconst BATCH_ONLY: ReadonlySet<WarehouseCountKey> = new Set([\n 'invoicesLoaded',\n 'filesWithErrors',\n]);\n\nfunction usable(value: number | undefined): value is number {\n return typeof value === 'number' && Number.isFinite(value) && value >= 0;\n}\n\n/** The counts to show, in vocabulary order. */\nexport function visibleCounts(\n counts: WarehouseLoadCounts,\n scope: WarehouseLoadScope,\n): Array<{ key: WarehouseCountKey; count: number }> {\n const out: Array<{ key: WarehouseCountKey; count: number }> = [];\n for (const key of WAREHOUSE_COUNT_KEYS) {\n if (scope === 'invoice' && BATCH_ONLY.has(key)) continue;\n const value = counts[key];\n if (!usable(value)) continue;\n const count = Math.trunc(value);\n if (count === 0 && HIDE_AT_ZERO.has(key)) continue;\n out.push({ key, count });\n }\n return out;\n}\n\nexport function resolveOutcome(\n outcome: WarehouseLoadOutcome | undefined,\n counts: WarehouseLoadCounts,\n failedFiles: ReadonlyArray<WarehouseLoadFailedFile>,\n): WarehouseLoadOutcome {\n if (outcome) return outcome;\n const errors = counts.filesWithErrors ?? 0;\n const failed = errors > 0 || failedFiles.length > 0;\n const loaded =\n (usable(counts.invoicesLoaded) && counts.invoicesLoaded >= 1) ||\n (usable(counts.linesLoaded) && counts.linesLoaded >= 1);\n if (failed) return loaded ? 'partial' : 'error';\n return loaded ? 'success' : 'unchanged';\n}\n","/* -------------------------------------------------------------------- */\n/* Agent adapter: WarehouseLoadSummary. */\n/* Read-only display. State is counts and ids; no actions, because the */\n/* host's `actions` slot owns every button. */\n/* -------------------------------------------------------------------- */\n\nimport type { AgentAdapter } from '../../agent/types';\nimport type { WarehouseLoadSummaryHandle } from './types';\n\nexport const warehouseLoadSummaryAgent: AgentAdapter<WarehouseLoadSummaryHandle> =\n {\n id: 'warehouse-load-summary',\n capabilities: [],\n state: {\n counts: {\n type: 'Record<string, number>',\n description:\n 'The counts shown, by key (invoicesLoaded, itemsCreated, itemsUpdated, linesLoaded, linesAlreadyLoaded, linesSkipped, filesWithErrors). Hidden counts are absent.',\n read: (handle) => handle.getCounts(),\n },\n failedFileIds: {\n type: 'string[]',\n description:\n 'Ids of the failed files listed. File names and error texts are not read.',\n read: (handle) => handle.getFailedFileIds(),\n },\n },\n actions: {},\n domHooks: {\n root: {\n attr: 'data-component',\n value: 'warehouse-load-summary',\n description: 'Marks the summary root.',\n },\n instanceId: {\n attr: 'data-component-id',\n sourceProp: 'id',\n description: 'Sourced from the id prop.',\n },\n item: {\n attr: 'data-file-id',\n description: 'Each failed file row emits its id as data-file-id.',\n },\n },\n };\n","import { useEffect, useId, useMemo, useRef, type ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport { useAgentRegistration } from '../../agent';\nimport { Alert } from '../alert';\nimport { Stat } from '../stat';\nimport { StatGroup } from '../stat-group';\nimport { warehouseCountLabel } from '../_shared/warehouse-load';\nimport { visibleCounts, resolveOutcome } from './model';\nimport { warehouseLoadSummaryAgent } from './warehouse-load-summary.agent';\nimport type {\n WarehouseCountKey,\n WarehouseLoadFailedFile,\n WarehouseLoadOutcome,\n WarehouseLoadSummaryHandle,\n WarehouseLoadSummaryProps,\n} from './types';\n\nconst ALERT_VARIANT = {\n success: 'success',\n partial: 'warning',\n error: 'error',\n unchanged: 'info',\n} as const satisfies Record<WarehouseLoadOutcome, string>;\n\nconst NO_FAILED_FILES: ReadonlyArray<WarehouseLoadFailedFile> = [];\n\nconst STAT_INTENT = {\n filesWithErrors: 'destructive',\n} as const satisfies Partial<Record<WarehouseCountKey, string>>;\n\n/**\n * What a warehouse load produced: a heading by outcome, one tile per count\n * and the files that failed. Displays only; the platform counts.\n */\nexport function WarehouseLoadSummary({\n counts,\n scope = 'batch',\n outcome,\n failedFiles = NO_FAILED_FILES,\n headingLevel = 2,\n focusOnMount = true,\n actions,\n variant = 'full',\n id,\n className,\n}: WarehouseLoadSummaryProps) {\n const { t, i18n } = useTranslation('ui');\n const language = i18n.language;\n const headingId = useId();\n const titleRef = useRef<HTMLHeadingElement>(null);\n\n // The summary replaces the review step, so focus would drop to <body>.\n // Focusing the heading makes screen readers read the result (WCAG 2.4.3,\n // 4.1.3); the Alert then stays silent so it is not read twice.\n useEffect(() => {\n if (focusOnMount) titleRef.current?.focus({ preventScroll: true });\n }, [focusOnMount]);\n\n const shown = useMemo(() => visibleCounts(counts, scope), [counts, scope]);\n const resolved = resolveOutcome(outcome, counts, failedFiles);\n\n const handle = useMemo<WarehouseLoadSummaryHandle>(\n () => ({\n getCounts: () => Object.fromEntries(shown.map((c) => [c.key, c.count])),\n getFailedFileIds: () => failedFiles.map((f) => f.id),\n }),\n [shown, failedFiles],\n );\n useAgentRegistration(warehouseLoadSummaryAgent, handle, id);\n\n const title = t(`warehouseLoadSummary.title.${scope}.${resolved}`, {\n defaultValue: DEFAULT_TITLES[scope][resolved],\n });\n const sentence = shown\n .filter((c) => c.count > 0)\n .map((c) => warehouseCountLabel(t, language, c.key, c.count));\n const description = formatList(sentence, language);\n\n if (variant === 'banner') {\n // One line above a table: heading, a neutral dot, the sentence, then the\n // host actions. No cards, no failed-files list. The dot is punctuation\n // that reads the same in every language, so no new string is needed.\n return (\n <div\n data-component=\"warehouse-load-summary\"\n data-component-id={id}\n data-outcome={resolved}\n data-variant=\"banner\"\n className={className}\n >\n <Alert\n variant={ALERT_VARIANT[resolved]}\n announce={focusOnMount ? 'off' : 'polite'}\n >\n <div className=\"ds:flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] ds:gap-y-[var(--spacing-xs)]\">\n {/* One run of text: when it is too long for the line it wraps\n like a sentence, and the dot never ends a line on its own. */}\n <div className=\"ds:min-w-0\">\n <Alert.Title\n ref={titleRef}\n tabIndex={-1}\n className=\"ds:inline ds:outline-none\"\n as={`h${headingLevel}` as const}\n >\n {title}\n </Alert.Title>\n {description ? (\n <>\n <span\n aria-hidden=\"true\"\n className=\"ds:mx-[var(--spacing-xs)]\"\n >\n ·\n </span>\n <p className=\"type-body-sm ds:m-0 ds:inline\">{description}</p>\n </>\n ) : null}\n </div>\n {actions ? (\n <div className=\"ds:ms-auto ds:flex ds:flex-wrap ds:justify-end ds:gap-[var(--spacing-sm)]\">\n {actions}\n </div>\n ) : null}\n </div>\n </Alert>\n </div>\n );\n }\n\n return (\n <div\n data-component=\"warehouse-load-summary\"\n data-component-id={id}\n data-outcome={resolved}\n className={['ds:flex ds:flex-col ds:gap-[var(--spacing-md)]', className]\n .filter(Boolean)\n .join(' ')}\n >\n <Alert\n variant={ALERT_VARIANT[resolved]}\n announce={focusOnMount ? 'off' : 'polite'}\n >\n <Alert.Title\n ref={titleRef}\n tabIndex={-1}\n className=\"ds:outline-none\"\n as={`h${headingLevel}` as const}\n >\n {title}\n </Alert.Title>\n {description ? (\n <Alert.Description>{description}</Alert.Description>\n ) : null}\n </Alert>\n\n {shown.length > 0 ? (\n <StatGroup\n aria-label={t('warehouseLoadSummary.counts', {\n defaultValue: 'Load counts',\n })}\n maxColumns={4}\n >\n {shown.map(({ key, count }) => (\n <Stat\n key={key}\n variant=\"outlined\"\n size=\"sm\"\n label={t(`warehouseLoadSummary.stat.${key}`, {\n defaultValue: DEFAULT_STAT_LABELS[key],\n })}\n value={count}\n locale={language}\n intent={\n count > 0 && key in STAT_INTENT\n ? STAT_INTENT[key as keyof typeof STAT_INTENT]\n : 'foreground'\n }\n />\n ))}\n </StatGroup>\n ) : null}\n\n {failedFiles.length > 0 ? (\n <div\n role=\"group\"\n aria-labelledby={headingId}\n className=\"ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]\"\n >\n <SubHeading\n as={`h${Math.min(headingLevel + 1, 6)}` as 'h3'}\n id={headingId}\n >\n {t('warehouseLoadSummary.failedFiles', {\n defaultValue: 'Files that could not be loaded',\n })}\n </SubHeading>\n {/* eslint-disable-next-line jsx-a11y/no-redundant-roles -- Safari drops list semantics under list-none */}\n <ul\n role=\"list\"\n className=\"ds:m-0 ds:flex ds:list-none ds:flex-col ds:gap-[var(--spacing-xs)] ds:p-0\"\n >\n {failedFiles.map((file) => (\n <li\n key={file.id}\n data-file-id={file.id}\n className=\"ds:flex ds:flex-col ds:break-words ds:border-s-[length:var(--border-width-md)] ds:border-s-[color:var(--destructive)] ds:ps-[var(--spacing-sm)]\"\n >\n <span\n dir=\"auto\"\n className=\"type-label ds:text-[var(--foreground)]\"\n >\n {file.fileName}\n </span>\n <span\n dir=\"auto\"\n className=\"type-meta ds:text-[var(--muted-foreground)]\"\n >\n {file.error}\n </span>\n </li>\n ))}\n </ul>\n </div>\n ) : null}\n\n {actions ? (\n <div className=\"ds:flex ds:flex-wrap ds:justify-end ds:gap-[var(--spacing-sm)]\">\n {actions}\n </div>\n ) : null}\n </div>\n );\n}\n\nconst DEFAULT_TITLES = {\n invoice: {\n success: 'Invoice loaded',\n partial: 'Invoice loaded with warnings',\n error: 'The invoice could not be loaded',\n unchanged: 'Nothing new to load',\n },\n batch: {\n success: 'Invoices loaded',\n partial: 'Invoices loaded, some files failed',\n error: 'No invoices were loaded',\n unchanged: 'Nothing new to load',\n },\n} as const;\n\nconst DEFAULT_STAT_LABELS = {\n invoicesLoaded: 'Invoices loaded',\n itemsCreated: 'Items created',\n itemsUpdated: 'Items updated',\n linesLoaded: 'Lines loaded',\n linesAlreadyLoaded: 'Lines already loaded',\n linesSkipped: 'Lines skipped',\n filesWithErrors: 'Files with errors',\n} as const satisfies Record<WarehouseCountKey, string>;\n\nfunction formatList(parts: string[], language: string | undefined): string {\n if (parts.length === 0) return '';\n try {\n return new Intl.ListFormat(language, {\n style: 'long',\n type: 'conjunction',\n }).format(parts);\n } catch {\n return parts.join(', ');\n }\n}\n\nfunction SubHeading({\n as: Tag,\n id,\n children,\n}: {\n as: 'h3' | 'h4' | 'h5' | 'h6';\n id: string;\n children: ReactNode;\n}) {\n return (\n <Tag id={id} className=\"type-label ds:m-0 ds:text-[var(--foreground)]\">\n {children}\n </Tag>\n );\n}\n"],"names":["HIDE_AT_ZERO","BATCH_ONLY","usable","value","visibleCounts","counts","scope","out","key","WAREHOUSE_COUNT_KEYS","count","resolveOutcome","outcome","failedFiles","failed","loaded","warehouseLoadSummaryAgent","handle","ALERT_VARIANT","NO_FAILED_FILES","STAT_INTENT","WarehouseLoadSummary","headingLevel","focusOnMount","actions","variant","id","className","t","i18n","useTranslation","language","headingId","useId","titleRef","useRef","useEffect","_a","shown","useMemo","resolved","c","f","useAgentRegistration","title","DEFAULT_TITLES","sentence","warehouseCountLabel","description","formatList","jsx","Alert","jsxs","Fragment","StatGroup","Stat","DEFAULT_STAT_LABELS","SubHeading","file","parts","Tag","children"],"mappings":";;;;;;;;AAUA,MAAMA,wBAAmD,IAAI;AAAA,EAC3D;AAAA,EACA;AACF,CAAC,GAEKC,wBAAiD,IAAI;AAAA,EACzD;AAAA,EACA;AACF,CAAC;AAED,SAASC,EAAOC,GAA4C;AAC1D,SAAO,OAAOA,KAAU,YAAY,OAAO,SAASA,CAAK,KAAKA,KAAS;AACzE;AAGO,SAASC,EACdC,GACAC,GACkD;AAClD,QAAMC,IAAwD,CAAA;AAC9D,aAAWC,KAAOC,GAAsB;AACtC,QAAIH,MAAU,aAAaL,EAAW,IAAIO,CAAG,EAAG;AAChD,UAAML,IAAQE,EAAOG,CAAG;AACxB,QAAI,CAACN,EAAOC,CAAK,EAAG;AACpB,UAAMO,IAAQ,KAAK,MAAMP,CAAK;AAC9B,IAAIO,MAAU,KAAKV,EAAa,IAAIQ,CAAG,KACvCD,EAAI,KAAK,EAAE,KAAAC,GAAK,OAAAE,EAAA,C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,MAAM;AAAA,IAAA,CACP,EAAE,OAAO4B,CAAK;AAAA,EACjB,QAAQ;AACN,WAAOA,EAAM,KAAK,IAAI;AAAA,EACxB;AACF;AAEA,SAASF,EAAW;AAAA,EAClB,IAAIG;AAAA,EACJ,IAAAlC;AAAA,EACA,UAAAmC;AACF,GAIG;AACD,SACE,gBAAAX,EAACU,GAAA,EAAI,IAAAlC,GAAQ,WAAU,iDACpB,UAAAmC,GACH;AAEJ;"}
|
package/dist/agent-catalog.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"packageVersion": "1.
|
|
3
|
+
"packageVersion": "1.132.0",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
6
6
|
"kind": "component",
|
|
@@ -1179,20 +1179,20 @@
|
|
|
1179
1179
|
"state": [
|
|
1180
1180
|
{
|
|
1181
1181
|
"name": "lines",
|
|
1182
|
-
"type": "Array<{ id, lineNumber, matchState, selected, selectable, readOnly, quantityLocked, itemKind, itemId, quantity, removesStock, warningCodes, invalid }>",
|
|
1183
|
-
"description": "Every invoice line in invoice order, with what Confirm will do with it. matchState is one of matched, newItem, itemToUpdate (a matched line whose price, VAT or discount will change; counted inside matchedCount), skip or alreadyLoaded. Quantities are exact decimal text as shown, unsigned; there are no descriptions or names.",
|
|
1182
|
+
"type": "Array<{ id, invoiceId, sourceLineId, lineNumber, matchState, selected, selectable, readOnly, quantityLocked, itemKind, itemId, quantity, removesStock, warningCodes, invalid }>",
|
|
1183
|
+
"description": "Every invoice line in invoice order, with what Confirm will do with it. matchState is one of matched, newItem, itemToUpdate (a matched line whose price, VAT or discount will change; counted inside matchedCount), skip or alreadyLoaded. Quantities are exact decimal text as shown, unsigned; there are no descriptions or names. With several invoices (the invoices prop) id is the row key built from invoiceId and the line id, invoiceId names the invoice and sourceLineId is the host's own line id; every lineId argument below is a row key.",
|
|
1184
1184
|
"descriptionKey": "ui.agent.billLineTable.state.lines"
|
|
1185
1185
|
},
|
|
1186
1186
|
{
|
|
1187
1187
|
"name": "selection",
|
|
1188
1188
|
"type": "string[]",
|
|
1189
|
-
"description": "Ids of the ticked lines: the lines Confirm will load.",
|
|
1189
|
+
"description": "Ids (row keys with several invoices) of the ticked lines: the lines Confirm will load.",
|
|
1190
1190
|
"descriptionKey": "ui.agent.billLineTable.state.selection"
|
|
1191
1191
|
},
|
|
1192
1192
|
{
|
|
1193
1193
|
"name": "summary",
|
|
1194
|
-
"type": "{ lineCount, selectedCount, matchedCount, newItemCount, itemUpdateCount, skippedCount, alreadyLoadedCount, warningLineCount, invoiceLoaded, invalidCount, net, vat, gross, canConfirm, dirty }",
|
|
1195
|
-
"description": "Counts and totals of the ticked lines. net, vat and gross are exact decimal text with 2 places (\"14.58\"). canConfirm is false while no line is ticked, a ticked line cannot load, or
|
|
1194
|
+
"type": "{ lineCount, invoiceCount, selectedInvoiceCount, selectedCount, matchedCount, newItemCount, itemUpdateCount, skippedCount, alreadyLoadedCount, warningLineCount, invoiceLoaded, invalidCount, net, vat, gross, canConfirm, dirty }",
|
|
1195
|
+
"description": "Counts and totals of the ticked lines. net, vat and gross are exact decimal text with 2 places (\"14.58\"). canConfirm is false while no line is ticked, a ticked line cannot load, or every invoice is already loaded (invoiceLoaded). With several invoices the counts cover the invoices still open, and a credit note counts against net, vat and gross.",
|
|
1196
1196
|
"descriptionKey": "ui.agent.billLineTable.state.summary"
|
|
1197
1197
|
},
|
|
1198
1198
|
{
|
|
@@ -1297,7 +1297,7 @@
|
|
|
1297
1297
|
],
|
|
1298
1298
|
"additionalProperties": false
|
|
1299
1299
|
},
|
|
1300
|
-
"returns": "{ id, lineNumber, matchState, selected, selectable, readOnly, quantityLocked, itemKind, itemId, quantity, removesStock, warningCodes, invalid }",
|
|
1300
|
+
"returns": "{ id, invoiceId, sourceLineId, lineNumber, matchState, selected, selectable, readOnly, quantityLocked, itemKind, itemId, quantity, removesStock, warningCodes, invalid }",
|
|
1301
1301
|
"idempotent": true,
|
|
1302
1302
|
"errors": [
|
|
1303
1303
|
"UNKNOWN_LINE",
|
|
@@ -1345,7 +1345,7 @@
|
|
|
1345
1345
|
],
|
|
1346
1346
|
"additionalProperties": false
|
|
1347
1347
|
},
|
|
1348
|
-
"returns": "{ id, lineNumber, matchState, selected, selectable, readOnly, quantityLocked, itemKind, itemId, quantity, removesStock, warningCodes, invalid }",
|
|
1348
|
+
"returns": "{ id, invoiceId, sourceLineId, lineNumber, matchState, selected, selectable, readOnly, quantityLocked, itemKind, itemId, quantity, removesStock, warningCodes, invalid }",
|
|
1349
1349
|
"idempotent": true,
|
|
1350
1350
|
"errors": [
|
|
1351
1351
|
"UNKNOWN_LINE",
|
|
@@ -1378,7 +1378,7 @@
|
|
|
1378
1378
|
],
|
|
1379
1379
|
"additionalProperties": false
|
|
1380
1380
|
},
|
|
1381
|
-
"returns": "{ id, lineNumber, matchState, selected, selectable, readOnly, quantityLocked, itemKind, itemId, quantity, removesStock, warningCodes, invalid }",
|
|
1381
|
+
"returns": "{ id, invoiceId, sourceLineId, lineNumber, matchState, selected, selectable, readOnly, quantityLocked, itemKind, itemId, quantity, removesStock, warningCodes, invalid }",
|
|
1382
1382
|
"idempotent": true,
|
|
1383
1383
|
"errors": [
|
|
1384
1384
|
"UNKNOWN_LINE",
|
|
@@ -1436,7 +1436,7 @@
|
|
|
1436
1436
|
"item": {
|
|
1437
1437
|
"attr": "data-row-id",
|
|
1438
1438
|
"sourceProp": "lines[].id",
|
|
1439
|
-
"description": "BillLine.id on each body row (written by DataGrid). The only line datum in the DOM."
|
|
1439
|
+
"description": "BillLine.id on each body row (written by DataGrid), or the row key with several invoices. The only line datum in the DOM."
|
|
1440
1440
|
}
|
|
1441
1441
|
}
|
|
1442
1442
|
},
|
|
@@ -9741,7 +9741,8 @@
|
|
|
9741
9741
|
"capabilities": [
|
|
9742
9742
|
"scroll",
|
|
9743
9743
|
"set_value",
|
|
9744
|
-
"pick"
|
|
9744
|
+
"pick",
|
|
9745
|
+
"open"
|
|
9745
9746
|
],
|
|
9746
9747
|
"state": [
|
|
9747
9748
|
{
|
|
@@ -9773,9 +9774,31 @@
|
|
|
9773
9774
|
"type": "number | null",
|
|
9774
9775
|
"description": "Live zoom level, or null until the map has loaded. Google clamps zoom to the map type's range, so this is not necessarily the value last passed to `set_zoom`.",
|
|
9775
9776
|
"descriptionKey": "ui.agent.mapView.state.zoom"
|
|
9777
|
+
},
|
|
9778
|
+
{
|
|
9779
|
+
"name": "loadError",
|
|
9780
|
+
"type": "'script' | 'auth' | 'import' | 'timeout' | null",
|
|
9781
|
+
"description": "Why the interactive map could not be shown, or null while it is loading or loaded. When set, the map is gone and the page shows \"The map is not available right now\" with a retry button: `pan_to`, `set_zoom` and `select_marker` do nothing until `retry_load` succeeds and `center` is no longer null. `script` and `timeout` are usually network, `auth` is the host's key or referrer, `import` is a library or render failure.",
|
|
9782
|
+
"descriptionKey": "ui.agent.mapView.state.loadError"
|
|
9776
9783
|
}
|
|
9777
9784
|
],
|
|
9778
9785
|
"actions": [
|
|
9786
|
+
{
|
|
9787
|
+
"name": "retry_load",
|
|
9788
|
+
"safety": "read",
|
|
9789
|
+
"argsType": "{}",
|
|
9790
|
+
"argsSchema": {
|
|
9791
|
+
"type": "object",
|
|
9792
|
+
"properties": {}
|
|
9793
|
+
},
|
|
9794
|
+
"idempotent": true,
|
|
9795
|
+
"errors": [
|
|
9796
|
+
"Silent no-op while `loadError` is null (nothing failed, or consent has not been granted).",
|
|
9797
|
+
"A hung request cannot be cancelled: after `timeout` the retry waits for the same request to finish."
|
|
9798
|
+
],
|
|
9799
|
+
"description": "Try loading the interactive map again after a failure. Read `loadError` first: it is the only time this does anything. Read `loadError` and `center` back afterwards; a retry that fails again sets `loadError` once more. A retry after `auth` only repeats the same rejected request until the host fixes its key.",
|
|
9800
|
+
"descriptionKey": "ui.agent.mapView.actions.retryLoad"
|
|
9801
|
+
},
|
|
9779
9802
|
{
|
|
9780
9803
|
"name": "pan_to",
|
|
9781
9804
|
"safety": "read",
|
package/dist/agent-i18n/en.json
CHANGED
|
@@ -128,9 +128,9 @@
|
|
|
128
128
|
},
|
|
129
129
|
"billLineTable": {
|
|
130
130
|
"state": {
|
|
131
|
-
"lines": "Every invoice line in invoice order, with what Confirm will do with it. matchState is one of matched, newItem, itemToUpdate (a matched line whose price, VAT or discount will change; counted inside matchedCount), skip or alreadyLoaded. Quantities are exact decimal text as shown, unsigned; there are no descriptions or names.",
|
|
132
|
-
"selection": "Ids of the ticked lines: the lines Confirm will load.",
|
|
133
|
-
"summary": "Counts and totals of the ticked lines. net, vat and gross are exact decimal text with 2 places (\"14.58\"). canConfirm is false while no line is ticked, a ticked line cannot load, or
|
|
131
|
+
"lines": "Every invoice line in invoice order, with what Confirm will do with it. matchState is one of matched, newItem, itemToUpdate (a matched line whose price, VAT or discount will change; counted inside matchedCount), skip or alreadyLoaded. Quantities are exact decimal text as shown, unsigned; there are no descriptions or names. With several invoices (the invoices prop) id is the row key built from invoiceId and the line id, invoiceId names the invoice and sourceLineId is the host's own line id; every lineId argument below is a row key.",
|
|
132
|
+
"selection": "Ids (row keys with several invoices) of the ticked lines: the lines Confirm will load.",
|
|
133
|
+
"summary": "Counts and totals of the ticked lines. net, vat and gross are exact decimal text with 2 places (\"14.58\"). canConfirm is false while no line is ticked, a ticked line cannot load, or every invoice is already loaded (invoiceLoaded). With several invoices the counts cover the invoices still open, and a credit note counts against net, vat and gross.",
|
|
134
134
|
"invalidLineIds": "Ticked lines that cannot load as they are: an empty or zero quantity, an item no longer in the warehouse, or an error from the server."
|
|
135
135
|
},
|
|
136
136
|
"actions": {
|
|
@@ -913,9 +913,11 @@
|
|
|
913
913
|
"markerCount": "Number of markers the consumer passed. Zero means there is nothing for `select_marker` to select. A count only — no ids, labels or positions.",
|
|
914
914
|
"selectedMarkerId": "Id of the marker the host currently holds as selected, or null. Selection is fully controlled by the consumer, so `select_marker` only proposes — this slot is the only way to see whether the proposal was accepted.",
|
|
915
915
|
"center": "Live map centre in lat/lng, or null until the map has loaded (consent not granted, or Google Maps still loading). The read-back for `pan_to`, and the sign that the map is ready.",
|
|
916
|
-
"zoom": "Live zoom level, or null until the map has loaded. Google clamps zoom to the map type's range, so this is not necessarily the value last passed to `set_zoom`."
|
|
916
|
+
"zoom": "Live zoom level, or null until the map has loaded. Google clamps zoom to the map type's range, so this is not necessarily the value last passed to `set_zoom`.",
|
|
917
|
+
"loadError": "Why the interactive map could not be shown, or null while it is loading or loaded. When set, the map is gone and the page shows \"The map is not available right now\" with a retry button: `pan_to`, `set_zoom` and `select_marker` do nothing until `retry_load` succeeds and `center` is no longer null. `script` and `timeout` are usually network, `auth` is the host's key or referrer, `import` is a library or render failure."
|
|
917
918
|
},
|
|
918
919
|
"actions": {
|
|
920
|
+
"retryLoad": "Try loading the interactive map again after a failure. Read `loadError` first: it is the only time this does anything. Read `loadError` and `center` back afterwards; a retry that fails again sets `loadError` once more. A retry after `auth` only repeats the same rejected request until the host fixes its key.",
|
|
919
921
|
"panTo": "Pan the map to a new centre without changing zoom. Read the `center` slot back to confirm — Google animates the pan, so the applied centre settles after the call.",
|
|
920
922
|
"setZoom": "Set the map zoom level (typical range 1–20). Read the `zoom` slot back — Google clamps the request to the map type’s supported range, so requested and applied can differ.",
|
|
921
923
|
"selectMarker": "Propose a marker selection by id, or pass null to clear it. Fires the host's `onMarkerClick`; selection is controlled by the host, so read the `selectedMarkerId` slot back to see whether it accepted."
|