@sincpro/web-ui 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +184 -2
- package/dist/components/activity/Activity.d.ts +69 -0
- package/dist/components/activity/Activity.js +279 -0
- package/dist/components/activity/Messages.d.ts +66 -0
- package/dist/components/activity/Messages.js +46 -0
- package/dist/components/activity/Timeline.d.ts +21 -0
- package/dist/components/activity/Timeline.js +30 -0
- package/dist/components/activity/index.d.ts +3 -0
- package/dist/components/activity/index.js +4 -0
- package/dist/components/assist/AssistMark.d.ts +64 -0
- package/dist/components/assist/AssistMark.js +108 -0
- package/dist/components/assist/AssistPending.d.ts +24 -0
- package/dist/components/assist/AssistPending.js +26 -0
- package/dist/components/assist/AssistSuggestion.d.ts +42 -0
- package/dist/components/assist/AssistSuggestion.js +55 -0
- package/dist/components/assist/ChangeReview.d.ts +56 -0
- package/dist/components/assist/ChangeReview.js +121 -0
- package/dist/components/assist/assist.d.ts +77 -0
- package/dist/components/assist/assist.js +87 -0
- package/dist/components/assist/index.d.ts +5 -0
- package/dist/components/assist/index.js +7 -0
- package/dist/components/form/Form.d.ts +52 -0
- package/dist/components/form/Form.js +49 -0
- package/dist/components/form/Sheet.d.ts +47 -0
- package/dist/components/form/Sheet.js +90 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +4 -0
- package/dist/components/frame/Chart.d.ts +13 -0
- package/dist/components/frame/Chart.js +24 -0
- package/dist/components/frame/FrameView.d.ts +33 -0
- package/dist/components/frame/FrameView.js +125 -0
- package/dist/components/frame/index.d.ts +3 -0
- package/dist/components/frame/index.js +3 -0
- package/dist/components/frame/model.d.ts +43 -0
- package/dist/components/frame/model.js +101 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +11 -0
- package/dist/components/lines/LineItems.d.ts +111 -0
- package/dist/components/lines/LineItems.js +317 -0
- package/dist/components/lines/index.d.ts +1 -0
- package/dist/components/lines/index.js +2 -0
- package/dist/components/lines/lines.d.ts +23 -0
- package/dist/components/lines/lines.js +26 -0
- package/dist/components/listing/ColumnsMenu.d.ts +20 -0
- package/dist/components/listing/ColumnsMenu.js +46 -0
- package/dist/components/listing/GroupingLevels.d.ts +35 -0
- package/dist/components/listing/GroupingLevels.js +45 -0
- package/dist/components/listing/Listing.d.ts +27 -0
- package/dist/components/listing/Listing.js +86 -0
- package/dist/components/listing/ListingBar.d.ts +112 -0
- package/dist/components/listing/ListingBar.js +144 -0
- package/dist/components/listing/Pagination.d.ts +36 -0
- package/dist/components/listing/Pagination.js +69 -0
- package/dist/components/listing/RecordCard.d.ts +33 -0
- package/dist/components/listing/RecordCard.js +22 -0
- package/dist/components/listing/RecordLink.d.ts +7 -0
- package/dist/components/listing/RecordLink.js +22 -0
- package/dist/components/listing/Row.d.ts +110 -0
- package/dist/components/listing/Row.js +123 -0
- package/dist/components/listing/SortMenu.d.ts +62 -0
- package/dist/components/listing/SortMenu.js +105 -0
- package/dist/components/listing/ViewSwitcher.d.ts +24 -0
- package/dist/components/listing/ViewSwitcher.js +16 -0
- package/dist/components/listing/columns.d.ts +47 -0
- package/dist/components/listing/columns.js +72 -0
- package/dist/components/listing/grouping.d.ts +35 -0
- package/dist/components/listing/grouping.js +47 -0
- package/dist/components/listing/index.d.ts +17 -0
- package/dist/components/listing/index.js +20 -0
- package/dist/components/listing/modelColumns.d.ts +50 -0
- package/dist/components/listing/modelColumns.js +103 -0
- package/dist/components/listing/pages.d.ts +78 -0
- package/dist/components/listing/pages.js +135 -0
- package/dist/components/listing/selection.d.ts +21 -0
- package/dist/components/listing/selection.js +43 -0
- package/dist/components/listing/set.d.ts +48 -0
- package/dist/components/listing/set.js +24 -0
- package/dist/components/listing/tree.d.ts +28 -0
- package/dist/components/listing/tree.js +23 -0
- package/dist/components/navigation/CommandPalette.d.ts +40 -0
- package/dist/components/navigation/CommandPalette.js +114 -0
- package/dist/components/navigation/NavigationTree.d.ts +31 -0
- package/dist/components/navigation/NavigationTree.js +79 -0
- package/dist/components/navigation/commands.d.ts +30 -0
- package/dist/components/navigation/commands.js +30 -0
- package/dist/components/navigation/index.d.ts +3 -0
- package/dist/components/navigation/index.js +4 -0
- package/dist/components/record/Breadcrumb.d.ts +42 -0
- package/dist/components/record/Breadcrumb.js +98 -0
- package/dist/components/record/DirtyActions.d.ts +26 -0
- package/dist/components/record/DirtyActions.js +22 -0
- package/dist/components/record/Pager.d.ts +18 -0
- package/dist/components/record/Pager.js +33 -0
- package/dist/components/record/RecordHeader.d.ts +75 -0
- package/dist/components/record/RecordHeader.js +104 -0
- package/dist/components/record/RecordNotices.d.ts +37 -0
- package/dist/components/record/RecordNotices.js +75 -0
- package/dist/components/record/RecordSkeleton.d.ts +3 -0
- package/dist/components/record/RecordSkeleton.js +21 -0
- package/dist/components/record/SmartButtons.d.ts +35 -0
- package/dist/components/record/SmartButtons.js +38 -0
- package/dist/components/record/StatusBar.d.ts +51 -0
- package/dist/components/record/StatusBar.js +168 -0
- package/dist/components/record/ThumbBar.d.ts +36 -0
- package/dist/components/record/ThumbBar.js +86 -0
- package/dist/components/record/index.d.ts +6 -0
- package/dist/components/record/index.js +8 -0
- package/dist/components/search/CriteriaBuilder.d.ts +58 -0
- package/dist/components/search/CriteriaBuilder.js +278 -0
- package/dist/components/search/CriteriaChips.d.ts +22 -0
- package/dist/components/search/CriteriaChips.js +64 -0
- package/dist/components/search/FilterBuilder.d.ts +142 -0
- package/dist/components/search/FilterBuilder.js +421 -0
- package/dist/components/search/JoinWord.d.ts +8 -0
- package/dist/components/search/JoinWord.js +47 -0
- package/dist/components/search/JsonEditor.d.ts +19 -0
- package/dist/components/search/JsonEditor.js +78 -0
- package/dist/components/search/SearchBar.d.ts +78 -0
- package/dist/components/search/SearchBar.js +387 -0
- package/dist/components/search/criteria.d.ts +116 -0
- package/dist/components/search/criteria.js +159 -0
- package/dist/components/search/datePeriods.d.ts +122 -0
- package/dist/components/search/datePeriods.js +134 -0
- package/dist/components/search/dateRanges.d.ts +54 -0
- package/dist/components/search/dateRanges.js +89 -0
- package/dist/components/search/index.d.ts +9 -0
- package/dist/components/search/index.js +20 -0
- package/dist/components/search/model.d.ts +54 -0
- package/dist/components/search/model.js +37 -0
- package/dist/components/search/query.d.ts +166 -0
- package/dist/components/search/query.js +436 -0
- package/dist/components/shell/AppFrame.d.ts +14 -0
- package/dist/components/shell/AppFrame.js +80 -0
- package/dist/components/shell/TopBar.d.ts +73 -0
- package/dist/components/shell/TopBar.js +54 -0
- package/dist/components/shell/headerSlot.d.ts +17 -0
- package/dist/components/shell/headerSlot.js +21 -0
- package/dist/components/shell/index.d.ts +2 -0
- package/dist/components/shell/index.js +3 -0
- package/dist/foundations/aria.d.ts +14 -0
- package/dist/foundations/aria.js +18 -0
- package/dist/foundations/calendar.d.ts +28 -0
- package/dist/foundations/calendar.js +183 -0
- package/dist/foundations/copy.d.ts +703 -0
- package/dist/foundations/copy.es.d.ts +2 -0
- package/dist/foundations/copy.es.js +430 -0
- package/dist/foundations/copy.js +520 -0
- package/dist/foundations/density.d.ts +16 -0
- package/dist/foundations/density.js +21 -0
- package/dist/foundations/grouping.d.ts +281 -0
- package/dist/foundations/grouping.js +0 -0
- package/dist/foundations/index.d.ts +14 -0
- package/dist/foundations/index.js +30 -0
- package/dist/foundations/layout.d.ts +9 -0
- package/dist/foundations/layout.js +9 -0
- package/dist/foundations/pivot.d.ts +222 -0
- package/dist/foundations/pivot.js +198 -0
- package/dist/foundations/pivotSheet.d.ts +61 -0
- package/dist/foundations/pivotSheet.js +0 -0
- package/dist/foundations/slots.d.ts +67 -0
- package/dist/foundations/slots.js +63 -0
- package/dist/foundations/sticky.d.ts +53 -0
- package/dist/foundations/sticky.js +150 -0
- package/dist/foundations/surface.d.ts +9 -0
- package/dist/foundations/surface.js +26 -0
- package/dist/foundations/theme.d.ts +42 -0
- package/dist/foundations/theme.js +88 -0
- package/dist/foundations/types.d.ts +23 -0
- package/dist/foundations/types.js +50 -0
- package/dist/foundations/variants.d.ts +19 -0
- package/dist/foundations/variants.js +48 -0
- package/dist/foundations/xlsx.d.ts +86 -0
- package/dist/foundations/xlsx.js +0 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/primitives/block/Block.d.ts +66 -0
- package/dist/primitives/block/Block.js +34 -0
- package/dist/primitives/block/Line.d.ts +18 -0
- package/dist/primitives/block/Line.js +45 -0
- package/dist/primitives/block/SectionGrid.d.ts +30 -0
- package/dist/primitives/block/SectionGrid.js +29 -0
- package/dist/primitives/block/Steps.d.ts +76 -0
- package/dist/primitives/block/Steps.js +43 -0
- package/dist/primitives/block/index.d.ts +4 -0
- package/dist/primitives/block/index.js +7 -0
- package/dist/primitives/button/Button.d.ts +137 -0
- package/dist/primitives/button/Button.js +234 -0
- package/dist/primitives/button/index.d.ts +1 -0
- package/dist/primitives/button/index.js +2 -0
- package/dist/primitives/cell/CellStack.d.ts +47 -0
- package/dist/primitives/cell/CellStack.js +33 -0
- package/dist/primitives/cell/index.d.ts +1 -0
- package/dist/primitives/cell/index.js +3 -0
- package/dist/primitives/choice/ComboBox.d.ts +19 -0
- package/dist/primitives/choice/ComboBox.js +52 -0
- package/dist/primitives/choice/RadioGroup.d.ts +18 -0
- package/dist/primitives/choice/RadioGroup.js +50 -0
- package/dist/primitives/choice/SearchField.d.ts +33 -0
- package/dist/primitives/choice/SearchField.js +46 -0
- package/dist/primitives/choice/SegmentedControl.d.ts +16 -0
- package/dist/primitives/choice/SegmentedControl.js +69 -0
- package/dist/primitives/choice/Slider.d.ts +16 -0
- package/dist/primitives/choice/Slider.js +46 -0
- package/dist/primitives/choice/Switch.d.ts +14 -0
- package/dist/primitives/choice/Switch.js +65 -0
- package/dist/primitives/choice/ThemeSwitcher.d.ts +10 -0
- package/dist/primitives/choice/ThemeSwitcher.js +25 -0
- package/dist/primitives/choice/index.d.ts +8 -0
- package/dist/primitives/choice/index.js +11 -0
- package/dist/primitives/choice/options.d.ts +28 -0
- package/dist/primitives/choice/options.js +6 -0
- package/dist/primitives/date/Calendar.d.ts +31 -0
- package/dist/primitives/date/Calendar.js +134 -0
- package/dist/primitives/date/DatePicker.d.ts +42 -0
- package/dist/primitives/date/DatePicker.js +103 -0
- package/dist/primitives/date/DateTime.d.ts +35 -0
- package/dist/primitives/date/DateTime.js +100 -0
- package/dist/primitives/date/index.d.ts +3 -0
- package/dist/primitives/date/index.js +6 -0
- package/dist/primitives/dialog/Dialog.d.ts +118 -0
- package/dist/primitives/dialog/Dialog.js +121 -0
- package/dist/primitives/dialog/Drill.d.ts +90 -0
- package/dist/primitives/dialog/Drill.js +172 -0
- package/dist/primitives/dialog/index.d.ts +2 -0
- package/dist/primitives/dialog/index.js +4 -0
- package/dist/primitives/disclosure/Disclosure.d.ts +36 -0
- package/dist/primitives/disclosure/Disclosure.js +52 -0
- package/dist/primitives/disclosure/index.d.ts +1 -0
- package/dist/primitives/disclosure/index.js +2 -0
- package/dist/primitives/field/Checks.d.ts +57 -0
- package/dist/primitives/field/Checks.js +72 -0
- package/dist/primitives/field/DropZone.d.ts +42 -0
- package/dist/primitives/field/DropZone.js +52 -0
- package/dist/primitives/field/Field.d.ts +178 -0
- package/dist/primitives/field/Field.js +251 -0
- package/dist/primitives/field/Suggest.d.ts +48 -0
- package/dist/primitives/field/Suggest.js +43 -0
- package/dist/primitives/field/aria.d.ts +61 -0
- package/dist/primitives/field/aria.js +70 -0
- package/dist/primitives/field/context.d.ts +30 -0
- package/dist/primitives/field/context.js +13 -0
- package/dist/primitives/field/copy.d.ts +16 -0
- package/dist/primitives/field/copy.js +69 -0
- package/dist/primitives/field/index.d.ts +9 -0
- package/dist/primitives/field/index.js +15 -0
- package/dist/primitives/field/layout.d.ts +24 -0
- package/dist/primitives/field/layout.js +10 -0
- package/dist/primitives/field/mode.d.ts +9 -0
- package/dist/primitives/field/mode.js +13 -0
- package/dist/primitives/field/note.d.ts +55 -0
- package/dist/primitives/field/note.js +117 -0
- package/dist/primitives/hint/Hint.d.ts +31 -0
- package/dist/primitives/hint/Hint.js +42 -0
- package/dist/primitives/hint/index.d.ts +1 -0
- package/dist/primitives/hint/index.js +1 -0
- package/dist/primitives/index.d.ts +20 -0
- package/dist/primitives/index.js +21 -0
- package/dist/primitives/menu/Menu.d.ts +128 -0
- package/dist/primitives/menu/Menu.js +89 -0
- package/dist/primitives/menu/index.d.ts +1 -0
- package/dist/primitives/menu/index.js +2 -0
- package/dist/primitives/notice/Callout.d.ts +49 -0
- package/dist/primitives/notice/Callout.js +28 -0
- package/dist/primitives/notice/Flag.d.ts +13 -0
- package/dist/primitives/notice/Flag.js +31 -0
- package/dist/primitives/notice/Notice.d.ts +45 -0
- package/dist/primitives/notice/Notice.js +61 -0
- package/dist/primitives/notice/Toast.d.ts +55 -0
- package/dist/primitives/notice/Toast.js +142 -0
- package/dist/primitives/notice/index.d.ts +4 -0
- package/dist/primitives/notice/index.js +6 -0
- package/dist/primitives/overlay/Popover.d.ts +6 -0
- package/dist/primitives/overlay/Popover.js +27 -0
- package/dist/primitives/overlay/PopoverTrigger.d.ts +55 -0
- package/dist/primitives/overlay/PopoverTrigger.js +38 -0
- package/dist/primitives/overlay/Preview.d.ts +19 -0
- package/dist/primitives/overlay/Preview.js +60 -0
- package/dist/primitives/overlay/Tooltip.d.ts +38 -0
- package/dist/primitives/overlay/Tooltip.js +74 -0
- package/dist/primitives/overlay/index.d.ts +4 -0
- package/dist/primitives/overlay/index.js +7 -0
- package/dist/primitives/picker/Picker.d.ts +89 -0
- package/dist/primitives/picker/Picker.js +204 -0
- package/dist/primitives/picker/index.d.ts +1 -0
- package/dist/primitives/picker/index.js +2 -0
- package/dist/primitives/surface/Peek.d.ts +60 -0
- package/dist/primitives/surface/Peek.js +71 -0
- package/dist/primitives/surface/index.d.ts +1 -0
- package/dist/primitives/surface/index.js +2 -0
- package/dist/primitives/table/CellCopy.d.ts +20 -0
- package/dist/primitives/table/CellCopy.js +23 -0
- package/dist/primitives/table/CellEditor.d.ts +14 -0
- package/dist/primitives/table/CellEditor.js +83 -0
- package/dist/primitives/table/DataTable.d.ts +189 -0
- package/dist/primitives/table/DataTable.js +330 -0
- package/dist/primitives/table/EditableTable.d.ts +191 -0
- package/dist/primitives/table/EditableTable.js +617 -0
- package/dist/primitives/table/PivotTable.d.ts +14 -0
- package/dist/primitives/table/PivotTable.js +0 -0
- package/dist/primitives/table/ReportTable.d.ts +38 -0
- package/dist/primitives/table/ReportTable.js +106 -0
- package/dist/primitives/table/RowActions.d.ts +16 -0
- package/dist/primitives/table/RowActions.js +28 -0
- package/dist/primitives/table/SheetTable.d.ts +73 -0
- package/dist/primitives/table/SheetTable.js +230 -0
- package/dist/primitives/table/Table.d.ts +106 -0
- package/dist/primitives/table/Table.js +116 -0
- package/dist/primitives/table/index.d.ts +7 -0
- package/dist/primitives/table/index.js +9 -0
- package/dist/primitives/tabs/Tabs.d.ts +91 -0
- package/dist/primitives/tabs/Tabs.js +56 -0
- package/dist/primitives/tabs/index.d.ts +1 -0
- package/dist/primitives/tabs/index.js +1 -0
- package/dist/primitives/tag/Tag.d.ts +36 -0
- package/dist/primitives/tag/Tag.js +68 -0
- package/dist/primitives/tag/Tags.d.ts +57 -0
- package/dist/primitives/tag/Tags.js +104 -0
- package/dist/primitives/tag/TagsField.d.ts +35 -0
- package/dist/primitives/tag/TagsField.js +186 -0
- package/dist/primitives/tag/choices.d.ts +38 -0
- package/dist/primitives/tag/choices.js +26 -0
- package/dist/primitives/tag/index.d.ts +4 -0
- package/dist/primitives/tag/index.js +8 -0
- package/dist/primitives/toolbar/Toolbar.d.ts +13 -0
- package/dist/primitives/toolbar/Toolbar.js +36 -0
- package/dist/primitives/toolbar/index.d.ts +1 -0
- package/dist/primitives/toolbar/index.js +2 -0
- package/dist/primitives/tree/Tree.d.ts +56 -0
- package/dist/primitives/tree/Tree.js +74 -0
- package/dist/primitives/tree/index.d.ts +1 -0
- package/dist/primitives/tree/index.js +3 -0
- package/dist/primitives/value/Copyable.d.ts +48 -0
- package/dist/primitives/value/Copyable.js +71 -0
- package/dist/primitives/value/Fecha.d.ts +12 -0
- package/dist/primitives/value/Fecha.js +89 -0
- package/dist/primitives/value/Meter.d.ts +29 -0
- package/dist/primitives/value/Meter.js +46 -0
- package/dist/primitives/value/Metric.d.ts +42 -0
- package/dist/primitives/value/Metric.js +38 -0
- package/dist/primitives/value/Person.d.ts +90 -0
- package/dist/primitives/value/Person.js +208 -0
- package/dist/primitives/value/ProgressBar.d.ts +31 -0
- package/dist/primitives/value/ProgressBar.js +53 -0
- package/dist/primitives/value/Relation.d.ts +74 -0
- package/dist/primitives/value/Relation.js +74 -0
- package/dist/primitives/value/Totals.d.ts +121 -0
- package/dist/primitives/value/Totals.js +54 -0
- package/dist/primitives/value/Value.d.ts +40 -0
- package/dist/primitives/value/Value.js +80 -0
- package/dist/primitives/value/index.d.ts +9 -0
- package/dist/primitives/value/index.js +10 -0
- package/dist/tokens.css +1062 -0
- package/dist/views/index.d.ts +2 -0
- package/dist/views/index.js +3 -0
- package/dist/views/list/List.d.ts +119 -0
- package/dist/views/list/List.js +101 -0
- package/dist/views/list/ListView.d.ts +6 -0
- package/dist/views/list/ListView.js +295 -0
- package/dist/views/list/columns.d.ts +18 -0
- package/dist/views/list/columns.js +27 -0
- package/dist/views/list/derive.d.ts +87 -0
- package/dist/views/list/derive.js +207 -0
- package/dist/views/list/index.d.ts +2 -0
- package/dist/views/list/index.js +4 -0
- package/dist/views/list/presentations.d.ts +39 -0
- package/dist/views/list/presentations.js +105 -0
- package/dist/views/list/types.d.ts +284 -0
- package/dist/views/list/types.js +1 -0
- package/dist/views/list/useNarrowList.d.ts +17 -0
- package/dist/views/list/useNarrowList.js +32 -0
- package/dist/views/record/Record.d.ts +145 -0
- package/dist/views/record/Record.js +211 -0
- package/dist/views/record/index.d.ts +1 -0
- package/dist/views/record/index.js +2 -0
- package/package.json +113 -4
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type Pile } from "../../foundations/grouping.js";
|
|
2
|
+
import { type DataColumn } from "../../primitives/table/DataTable.js";
|
|
3
|
+
import type { ReportColumn, ReportRow } from "../../primitives/table/ReportTable.js";
|
|
4
|
+
import type { SheetColumn } from "../../primitives/table/SheetTable.js";
|
|
5
|
+
import type { ListGroup, ListSheet, RowOf } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Context: what a list DERIVES from its set, as pure functions — the table's group levels,
|
|
8
|
+
* the sheet drawn from the declared columns, the sheet's flattened band/row sequence and
|
|
9
|
+
* the report built from the piles. `ListView` calls them inside `useMemo` with the same
|
|
10
|
+
* dependencies they always had; nothing here knows React.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Los niveles, como los necesita la tabla: uno por NIVEL y no uno por campo.
|
|
14
|
+
*
|
|
15
|
+
* La clave sale de `group.of` —la misma que arman las otras cinco
|
|
16
|
+
* presentaciones— así que los montones de la tabla son los mismos y lo plegado
|
|
17
|
+
* vale para todas. El rótulo sale de la misma regla que el árbol: un nivel no
|
|
18
|
+
* repite lo que el de arriba, del mismo campo, ya dijo.
|
|
19
|
+
*/
|
|
20
|
+
export declare function groupLevelsOf<T extends object>(group: ListGroup<T> | undefined, columns: readonly DataColumn<T>[] | undefined): {
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
keyOf: (item: T) => string;
|
|
24
|
+
labelOf: (key: string) => string;
|
|
25
|
+
}[];
|
|
26
|
+
/**
|
|
27
|
+
* La planilla de un conjunto de REGISTROS sale de las columnas que la lista
|
|
28
|
+
* ya declaró. Sin esto, ofrecer `sheet` obligaba a escribir las columnas dos
|
|
29
|
+
* veces —una como `DataColumn` y otra como `SheetColumn`— y entonces nadie la
|
|
30
|
+
* ofrecía: la presentación existía en el arquetipo y no estaba en ninguna
|
|
31
|
+
* pantalla.
|
|
32
|
+
*
|
|
33
|
+
* `sheet` explícita sigue siendo para los DATOS CRUDOS, donde las columnas
|
|
34
|
+
* salen del archivo y el código no sabe cuáles son.
|
|
35
|
+
*/
|
|
36
|
+
export declare function sheetFromColumns<T extends object>(shownColumns: readonly DataColumn<T>[] | undefined): ListSheet<T> | undefined;
|
|
37
|
+
export type SheetEntry<T> = {
|
|
38
|
+
band?: {
|
|
39
|
+
field: string;
|
|
40
|
+
label: string;
|
|
41
|
+
count: number;
|
|
42
|
+
open: boolean;
|
|
43
|
+
key: string;
|
|
44
|
+
depth: number;
|
|
45
|
+
total?: (column: SheetColumn, columnIndex: number) => string | number | null;
|
|
46
|
+
};
|
|
47
|
+
item?: T;
|
|
48
|
+
n?: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* La planilla, cuando hay montones: una SECUENCIA donde cada índice es una
|
|
52
|
+
* fila o la cabecera del montón que empieza ahí.
|
|
53
|
+
*
|
|
54
|
+
* **Acá decía que la planilla no agrupa y estaba mal razonado.** El argumento
|
|
55
|
+
* —una banda corre la cuadrícula y mirar datos crudos es seguir una fila a lo
|
|
56
|
+
* ancho— vale para los datos crudos, donde las columnas salen del archivo y
|
|
57
|
+
* no hay ningún eje del dominio por el que agrupar. Pero la planilla DERIVADA
|
|
58
|
+
* es el mismo conjunto de registros que la tabla, con los mismos ejes: que
|
|
59
|
+
* agrupe la tabla y no ella es exactamente el drift que este arquetipo existe
|
|
60
|
+
* para impedir — cambiar de presentación perdía la agrupación.
|
|
61
|
+
*
|
|
62
|
+
* La regla queda en manos de la vista, como corresponde: si declara `group`,
|
|
63
|
+
* agrupa; si no, no hay montones que dibujar.
|
|
64
|
+
*/
|
|
65
|
+
export declare function sheetRowsOf<T extends object>(piles: readonly Pile<T>[] | null, isOpen: (pile: Pile<T>) => boolean, columns: readonly DataColumn<T>[] | undefined): SheetEntry<T>[] | null;
|
|
66
|
+
/**
|
|
67
|
+
* El informe armado a partir de los montones, cuando el dominio no declaró
|
|
68
|
+
* líneas.
|
|
69
|
+
*
|
|
70
|
+
* Cada montón es una línea con los agregados de las columnas que declararon
|
|
71
|
+
* uno, y el nivel más profundo cuelga sus filas. Las columnas del informe las
|
|
72
|
+
* pone `report.columns`; los números salen de las `columns` de la lista, que
|
|
73
|
+
* son las mismas que suma el pie de la tabla — para que el informe y la tabla
|
|
74
|
+
* no digan totales distintos del mismo conjunto.
|
|
75
|
+
*/
|
|
76
|
+
export declare function reportRowsOf<T extends object>(piles: readonly Pile<T>[] | null, columns: readonly DataColumn<T>[] | undefined, row: (item: T) => RowOf): readonly ReportRow[];
|
|
77
|
+
/**
|
|
78
|
+
* The columns of a report built from the piles, written like the list's own columns.
|
|
79
|
+
*
|
|
80
|
+
* `reportRowsOf` puts in position `i` the aggregate of the `i`-th column that declared one,
|
|
81
|
+
* so `report.columns[i]` is THAT column's: a report column without its own `format` takes
|
|
82
|
+
* the one the list column declared — otherwise the report wrote «Bs. 78.752,90» in the
|
|
83
|
+
* table's footer and «78.752,90» in its own total line. A format declared on the report
|
|
84
|
+
* column wins: it is the more specific declaration. A `count` column keeps the report's own
|
|
85
|
+
* number format — a count of rows is not an amount.
|
|
86
|
+
*/
|
|
87
|
+
export declare function reportColumnsOf<T extends object>(reportColumns: readonly ReportColumn[], columns: readonly DataColumn<T>[] | undefined): readonly ReportColumn[];
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { levelKey, pathKey, pileItems, pileLabel, } from "../../foundations/grouping.js";
|
|
2
|
+
import { aggregateFormat, aggregateOf, aggregateText, } from "../../primitives/table/DataTable.js";
|
|
3
|
+
/**
|
|
4
|
+
* Context: what a list DERIVES from its set, as pure functions — the table's group levels,
|
|
5
|
+
* the sheet drawn from the declared columns, the sheet's flattened band/row sequence and
|
|
6
|
+
* the report built from the piles. `ListView` calls them inside `useMemo` with the same
|
|
7
|
+
* dependencies they always had; nothing here knows React.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Los niveles, como los necesita la tabla: uno por NIVEL y no uno por campo.
|
|
11
|
+
*
|
|
12
|
+
* La clave sale de `group.of` —la misma que arman las otras cinco
|
|
13
|
+
* presentaciones— así que los montones de la tabla son los mismos y lo plegado
|
|
14
|
+
* vale para todas. El rótulo sale de la misma regla que el árbol: un nivel no
|
|
15
|
+
* repite lo que el de arriba, del mismo campo, ya dijo.
|
|
16
|
+
*/
|
|
17
|
+
export function groupLevelsOf(group, columns) {
|
|
18
|
+
if (group === undefined || group.levels.length === 0)
|
|
19
|
+
return [];
|
|
20
|
+
const above = [];
|
|
21
|
+
const label = group.label ?? pileLabel;
|
|
22
|
+
return group.levels.map((level) => {
|
|
23
|
+
const within = above.flatMap((one) => one.field === level.field && one.grain !== undefined ? [one.grain] : []);
|
|
24
|
+
above.push(level);
|
|
25
|
+
/* Cómo se llama el corte: como lo llama la columna que contesta por ese
|
|
26
|
+
campo, que es el único rótulo humano que esta capa tiene. */
|
|
27
|
+
const column = columns?.find((one) => one.id === level.field || one.field === level.field);
|
|
28
|
+
return {
|
|
29
|
+
id: levelKey(level),
|
|
30
|
+
label: column?.header ?? level.field,
|
|
31
|
+
keyOf: (item) => group.of(item, level),
|
|
32
|
+
labelOf: (key) => label(key, level, within),
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* La planilla de un conjunto de REGISTROS sale de las columnas que la lista
|
|
38
|
+
* ya declaró. Sin esto, ofrecer `sheet` obligaba a escribir las columnas dos
|
|
39
|
+
* veces —una como `DataColumn` y otra como `SheetColumn`— y entonces nadie la
|
|
40
|
+
* ofrecía: la presentación existía en el arquetipo y no estaba en ninguna
|
|
41
|
+
* pantalla.
|
|
42
|
+
*
|
|
43
|
+
* `sheet` explícita sigue siendo para los DATOS CRUDOS, donde las columnas
|
|
44
|
+
* salen del archivo y el código no sabe cuáles son.
|
|
45
|
+
*/
|
|
46
|
+
export function sheetFromColumns(shownColumns) {
|
|
47
|
+
if (shownColumns === undefined || shownColumns.length === 0)
|
|
48
|
+
return undefined;
|
|
49
|
+
const byId = new Map(shownColumns.map((column) => [column.id, column]));
|
|
50
|
+
return {
|
|
51
|
+
columns: shownColumns.map((column) => ({
|
|
52
|
+
id: column.id,
|
|
53
|
+
header: column.header,
|
|
54
|
+
...(column.numeric === true ? { numeric: true } : {}),
|
|
55
|
+
...(column.width === undefined ? {} : { width: column.width }),
|
|
56
|
+
})),
|
|
57
|
+
cell: (item, column) => {
|
|
58
|
+
const declared = byId.get(column.id);
|
|
59
|
+
/* `text` primero: `value` es la clave de ORDEN, no lo que se lee. Sin
|
|
60
|
+
esto la planilla mostraba `computed` donde la tabla muestra
|
|
61
|
+
«calculado». */
|
|
62
|
+
if (declared?.text !== undefined)
|
|
63
|
+
return declared.text(item);
|
|
64
|
+
const raw = declared?.value(item);
|
|
65
|
+
/* Un booleano no es una celda: la cuadrícula dibuja texto o número, y
|
|
66
|
+
`false` se vería como una celda vacía, que significa otra cosa. */
|
|
67
|
+
return typeof raw === "boolean" ? String(raw) : (raw ?? null);
|
|
68
|
+
},
|
|
69
|
+
tone: (item, column) => byId.get(column.id)?.tone?.(item),
|
|
70
|
+
note: (item, column) => byId.get(column.id)?.note?.(item),
|
|
71
|
+
/* Crece con la página en vez de abrir una caja con scroll adentro de otra
|
|
72
|
+
que ya scrollea. La lista ya vino paginada, así que son ochenta filas y
|
|
73
|
+
no ciento ochenta y siete — el caso de un millón es el de los datos
|
|
74
|
+
crudos, y ése declara su propio alto. */
|
|
75
|
+
height: "auto",
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* La planilla, cuando hay montones: una SECUENCIA donde cada índice es una
|
|
80
|
+
* fila o la cabecera del montón que empieza ahí.
|
|
81
|
+
*
|
|
82
|
+
* **Acá decía que la planilla no agrupa y estaba mal razonado.** El argumento
|
|
83
|
+
* —una banda corre la cuadrícula y mirar datos crudos es seguir una fila a lo
|
|
84
|
+
* ancho— vale para los datos crudos, donde las columnas salen del archivo y
|
|
85
|
+
* no hay ningún eje del dominio por el que agrupar. Pero la planilla DERIVADA
|
|
86
|
+
* es el mismo conjunto de registros que la tabla, con los mismos ejes: que
|
|
87
|
+
* agrupe la tabla y no ella es exactamente el drift que este arquetipo existe
|
|
88
|
+
* para impedir — cambiar de presentación perdía la agrupación.
|
|
89
|
+
*
|
|
90
|
+
* La regla queda en manos de la vista, como corresponde: si declara `group`,
|
|
91
|
+
* agrupa; si no, no hay montones que dibujar.
|
|
92
|
+
*/
|
|
93
|
+
export function sheetRowsOf(piles, isOpen, columns) {
|
|
94
|
+
if (piles === null)
|
|
95
|
+
return null;
|
|
96
|
+
const out = [];
|
|
97
|
+
let n = 0;
|
|
98
|
+
/* Aplanar es recursivo porque el árbol lo es. La planilla no puede recibir
|
|
99
|
+
el árbol: está virtualizada por índice, y un índice es una posición en una
|
|
100
|
+
secuencia — así que la jerarquía se expresa en la sangría de cada banda. */
|
|
101
|
+
const walk = (list) => {
|
|
102
|
+
for (const pile of list) {
|
|
103
|
+
const open = isOpen(pile);
|
|
104
|
+
const inside = pile.piles.length === 0 ? pile.items : pileItems(pile.piles);
|
|
105
|
+
out.push({
|
|
106
|
+
band: {
|
|
107
|
+
field: pile.field,
|
|
108
|
+
label: pile.label,
|
|
109
|
+
count: pile.count,
|
|
110
|
+
open,
|
|
111
|
+
key: pathKey(pile.path),
|
|
112
|
+
depth: pile.depth,
|
|
113
|
+
/* El total de cada columna, en la posición de esa columna. Sale de
|
|
114
|
+
las `columns` de la lista —las mismas que suma el pie de la
|
|
115
|
+
tabla— para que la planilla y la tabla no digan números distintos
|
|
116
|
+
del mismo montón. La planilla declara SUS columnas aparte, así que
|
|
117
|
+
se busca por id. Y se ESCRIBE como el pie: con el `format` de la
|
|
118
|
+
columna, para que el montón no diga «78752,9» debajo de «Bs.». */
|
|
119
|
+
total: (column) => {
|
|
120
|
+
const declared = columns?.find((one) => one.id === column.id);
|
|
121
|
+
const value = declared === undefined ? null : aggregateOf(declared, inside);
|
|
122
|
+
return declared === undefined || value === null
|
|
123
|
+
? null
|
|
124
|
+
: aggregateText(declared, value);
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
if (!open)
|
|
129
|
+
continue;
|
|
130
|
+
if (pile.piles.length > 0) {
|
|
131
|
+
walk(pile.piles);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
for (const one of pile.items) {
|
|
135
|
+
n += 1;
|
|
136
|
+
out.push({ item: one, n });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
walk(piles);
|
|
141
|
+
return out;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* El informe armado a partir de los montones, cuando el dominio no declaró
|
|
145
|
+
* líneas.
|
|
146
|
+
*
|
|
147
|
+
* Cada montón es una línea con los agregados de las columnas que declararon
|
|
148
|
+
* uno, y el nivel más profundo cuelga sus filas. Las columnas del informe las
|
|
149
|
+
* pone `report.columns`; los números salen de las `columns` de la lista, que
|
|
150
|
+
* son las mismas que suma el pie de la tabla — para que el informe y la tabla
|
|
151
|
+
* no digan totales distintos del mismo conjunto.
|
|
152
|
+
*/
|
|
153
|
+
export function reportRowsOf(piles, columns, row) {
|
|
154
|
+
if (piles === null || columns === undefined)
|
|
155
|
+
return [];
|
|
156
|
+
const numeric = columns.filter((column) => column.aggregate !== undefined);
|
|
157
|
+
/* A pile is named by the HEADER of the column that answers for its field — the word the
|
|
158
|
+
person reads in the table — not by the field's id: «stage · pedido» showed the
|
|
159
|
+
model's name for it. */
|
|
160
|
+
const fieldName = (field) => columns.find((column) => column.id === field || column.field === field)?.header ?? field;
|
|
161
|
+
const line = (pile) => {
|
|
162
|
+
const inside = pile.piles.length === 0 ? pile.items : pileItems(pile.piles);
|
|
163
|
+
const children = pile.piles.length > 0
|
|
164
|
+
? pile.piles.map(line)
|
|
165
|
+
: pile.items.map((item, index) => ({
|
|
166
|
+
id: `${pathKey(pile.path)}\u0000${index}`,
|
|
167
|
+
label: row(item).name,
|
|
168
|
+
kind: "line",
|
|
169
|
+
level: pile.depth + 1,
|
|
170
|
+
values: numeric.map((column) => {
|
|
171
|
+
const value = column.value(item);
|
|
172
|
+
return typeof value === "number" ? value : null;
|
|
173
|
+
}),
|
|
174
|
+
}));
|
|
175
|
+
return {
|
|
176
|
+
id: pathKey(pile.path),
|
|
177
|
+
label: `${fieldName(pile.field)} · ${pile.label}`,
|
|
178
|
+
kind: pile.depth === 0 ? "section" : "group",
|
|
179
|
+
level: pile.depth,
|
|
180
|
+
values: numeric.map((column) => aggregateOf(column, inside)),
|
|
181
|
+
children,
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
return piles.map(line);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The columns of a report built from the piles, written like the list's own columns.
|
|
188
|
+
*
|
|
189
|
+
* `reportRowsOf` puts in position `i` the aggregate of the `i`-th column that declared one,
|
|
190
|
+
* so `report.columns[i]` is THAT column's: a report column without its own `format` takes
|
|
191
|
+
* the one the list column declared — otherwise the report wrote «Bs. 78.752,90» in the
|
|
192
|
+
* table's footer and «78.752,90» in its own total line. A format declared on the report
|
|
193
|
+
* column wins: it is the more specific declaration. A `count` column keeps the report's own
|
|
194
|
+
* number format — a count of rows is not an amount.
|
|
195
|
+
*/
|
|
196
|
+
export function reportColumnsOf(reportColumns, columns) {
|
|
197
|
+
if (columns === undefined)
|
|
198
|
+
return reportColumns;
|
|
199
|
+
const numeric = columns.filter((column) => column.aggregate !== undefined);
|
|
200
|
+
return reportColumns.map((column, index) => {
|
|
201
|
+
const declared = numeric[index];
|
|
202
|
+
const format = declared === undefined ? undefined : aggregateFormat(declared);
|
|
203
|
+
return column.format !== undefined || format === undefined
|
|
204
|
+
? column
|
|
205
|
+
: { ...column, format };
|
|
206
|
+
});
|
|
207
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type DataColumn, DataTable } from "../../primitives/table/DataTable.js";
|
|
2
|
+
import type { SheetEntry } from "./derive.js";
|
|
3
|
+
import type { ListGroup, ListSheet, ListViewProps } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Context: the two presentations whose body is an adapter between the list's vocabulary
|
|
6
|
+
* (one selection that speaks one id at a time, a grouping tree, an index-addressed sequence)
|
|
7
|
+
* and a primitive's (a Set, levels, indexes). They draw nothing of their own — they are
|
|
8
|
+
* `ListView`'s `table` and `sheet` branches, moved out so that file reads as the decision of
|
|
9
|
+
* WHICH presentation, and these as HOW the two grids are fed.
|
|
10
|
+
*/
|
|
11
|
+
type TableProps<T extends object> = {
|
|
12
|
+
items: readonly T[];
|
|
13
|
+
columns: readonly DataColumn<T>[];
|
|
14
|
+
keyOf: (item: T) => string;
|
|
15
|
+
levels: NonNullable<Parameters<typeof DataTable<T>>[0]["levels"]>;
|
|
16
|
+
group?: ListGroup<T>;
|
|
17
|
+
totals: boolean;
|
|
18
|
+
} & Pick<ListViewProps<T>, "sort" | "onSortChange" | "selection" | "rowActions" | "create" | "onPeek" | "onOpen">;
|
|
19
|
+
/** The table receives EVERYTHING that belongs to the set —sorting, selection, grouping,
|
|
20
|
+
* which columns are on screen— and not a trimmed down version: that was exactly the trap
|
|
21
|
+
* this archetype exists to avoid, that switching presentation loses capabilities. */
|
|
22
|
+
export declare function TablePresentation<T extends object>({ items, columns, keyOf, levels, group, totals, sort, onSortChange, selection, rowActions, create, onPeek, onOpen, }: TableProps<T>): import("react").JSX.Element;
|
|
23
|
+
type SheetProps<T extends object> = {
|
|
24
|
+
spec: ListSheet<T>;
|
|
25
|
+
/** The flattened bands and rows when the set is grouped; `null` when it is not. */
|
|
26
|
+
entries: readonly SheetEntry<T>[] | null;
|
|
27
|
+
ordered: readonly T[];
|
|
28
|
+
group?: ListGroup<T>;
|
|
29
|
+
};
|
|
30
|
+
/** The sheet receives the set by INDEX and not a ready-made matrix: `SheetTable` is
|
|
31
|
+
* virtualized precisely so as not to materialize a million rows, and handing it copies
|
|
32
|
+
* would throw that away.
|
|
33
|
+
*
|
|
34
|
+
* It groups like the other three —grouping belongs to the SET, not to the presentation—
|
|
35
|
+
* and the piles enter as rows of another kind, so virtualization is not lost. What it still
|
|
36
|
+
* lacks is selection: a checkbox per row in a forty-column grid competes with the frozen
|
|
37
|
+
* row-number column, the one that lets you know which row you are on. */
|
|
38
|
+
export declare function SheetPresentation<T extends object>({ spec, entries, ordered, group, }: SheetProps<T>): import("react").JSX.Element;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useUiCopy } from "../../foundations/copy.js";
|
|
4
|
+
import { DataTable } from "../../primitives/table/DataTable.js";
|
|
5
|
+
import { SheetTable } from "../../primitives/table/SheetTable.js";
|
|
6
|
+
/** The table receives EVERYTHING that belongs to the set —sorting, selection, grouping,
|
|
7
|
+
* which columns are on screen— and not a trimmed down version: that was exactly the trap
|
|
8
|
+
* this archetype exists to avoid, that switching presentation loses capabilities. */
|
|
9
|
+
export function TablePresentation({ items, columns, keyOf, levels, group, totals, sort, onSortChange, selection, rowActions, create, onPeek, onOpen, }) {
|
|
10
|
+
return (_jsx(DataTable, { data: items, columns: columns, getRowId: keyOf, ...(sort === undefined ? {} : { sort }), ...(onSortChange === undefined ? {} : { onSortChange }), ...(levels.length === 0 ? {} : { levels: levels }), ...(group?.collapsed === undefined ? {} : { collapsed: group.collapsed }), ...(group?.onToggle === undefined ? {} : { onGroupToggle: group.onToggle }), ...(selection === undefined
|
|
11
|
+
? {}
|
|
12
|
+
: {
|
|
13
|
+
selected: new Set(items.filter((i) => selection.has(keyOf(i))).map(keyOf)),
|
|
14
|
+
onSelectedChange: (next) => {
|
|
15
|
+
/* `DataTable` sends the whole set; the view's selection speaks
|
|
16
|
+
one at a time. It is translated here and not there because the
|
|
17
|
+
one who knows what changed is the one holding the before and
|
|
18
|
+
the after. */
|
|
19
|
+
for (const item of items) {
|
|
20
|
+
const id = keyOf(item);
|
|
21
|
+
if (next.has(id) !== selection.has(id))
|
|
22
|
+
selection.toggle(id);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
}), ...(totals ? { totals: true } : {}), ...(rowActions === undefined ? {} : { rowActions }), ...(create === undefined ? {} : { create }), ...((onPeek ?? onOpen) === undefined ? {} : { onRowClick: onPeek ?? onOpen }) }));
|
|
26
|
+
}
|
|
27
|
+
/** The sheet receives the set by INDEX and not a ready-made matrix: `SheetTable` is
|
|
28
|
+
* virtualized precisely so as not to materialize a million rows, and handing it copies
|
|
29
|
+
* would throw that away.
|
|
30
|
+
*
|
|
31
|
+
* It groups like the other three —grouping belongs to the SET, not to the presentation—
|
|
32
|
+
* and the piles enter as rows of another kind, so virtualization is not lost. What it still
|
|
33
|
+
* lacks is selection: a checkbox per row in a forty-column grid competes with the frozen
|
|
34
|
+
* row-number column, the one that lets you know which row you are on. */
|
|
35
|
+
export function SheetPresentation({ spec, entries, ordered, group, }) {
|
|
36
|
+
const copy = useUiCopy();
|
|
37
|
+
/** Qué ítem hay en este índice de la planilla. Con montones, un índice puede
|
|
38
|
+
* ser una banda y no una fila — y entonces no hay ítem. Una sola vez, porque
|
|
39
|
+
* las seis funciones que la planilla recibe hacen la misma pregunta. */
|
|
40
|
+
const sheetItemAt = (index) => entries === null ? ordered[index] : entries[index]?.item;
|
|
41
|
+
return (_jsx(SheetTable, { columns: spec.columns, rows: entries === null ? ordered.length : entries.length, value: (index, column, columnIndex) => {
|
|
42
|
+
const item = sheetItemAt(index);
|
|
43
|
+
return item === undefined ? null : spec.cell(item, column, columnIndex);
|
|
44
|
+
}, ...(entries === null
|
|
45
|
+
? {}
|
|
46
|
+
: {
|
|
47
|
+
band: (index) => entries[index]?.band,
|
|
48
|
+
...(group?.onToggle === undefined
|
|
49
|
+
? {}
|
|
50
|
+
: {
|
|
51
|
+
onBandToggle: (index) => {
|
|
52
|
+
const key = entries[index]?.band?.key;
|
|
53
|
+
if (key !== undefined)
|
|
54
|
+
group.onToggle?.(key);
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
57
|
+
}), ...(spec.tone === undefined
|
|
58
|
+
? {}
|
|
59
|
+
: {
|
|
60
|
+
tone: (index, column, columnIndex) => {
|
|
61
|
+
const item = sheetItemAt(index);
|
|
62
|
+
return item === undefined ? undefined : spec.tone?.(item, column, columnIndex);
|
|
63
|
+
},
|
|
64
|
+
}), ...(spec.note === undefined
|
|
65
|
+
? {}
|
|
66
|
+
: {
|
|
67
|
+
note: (index, column, columnIndex) => {
|
|
68
|
+
const item = sheetItemAt(index);
|
|
69
|
+
return item === undefined ? undefined : spec.note?.(item, column, columnIndex);
|
|
70
|
+
},
|
|
71
|
+
}), ...(spec.height === undefined ? {} : { height: spec.height }), ...(spec.rowLabel !== undefined
|
|
72
|
+
? {
|
|
73
|
+
rowLabel: (index) => {
|
|
74
|
+
const item = sheetItemAt(index);
|
|
75
|
+
return item === undefined ? "" : (spec.rowLabel?.(item, index) ?? "");
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
: entries === null
|
|
79
|
+
? {}
|
|
80
|
+
: {
|
|
81
|
+
rowLabel: (index) => {
|
|
82
|
+
const n = entries[index]?.n;
|
|
83
|
+
return n === undefined ? "" : n.toLocaleString(copy.locale);
|
|
84
|
+
},
|
|
85
|
+
}), ...(spec.onCommit === undefined
|
|
86
|
+
? {}
|
|
87
|
+
: {
|
|
88
|
+
onCommit: (index, column, columnIndex, next) => {
|
|
89
|
+
const item = sheetItemAt(index);
|
|
90
|
+
if (item !== undefined)
|
|
91
|
+
spec.onCommit?.(item, column, columnIndex, next);
|
|
92
|
+
},
|
|
93
|
+
}), ...(spec.editable === undefined
|
|
94
|
+
? {}
|
|
95
|
+
: {
|
|
96
|
+
editable: (index, column, columnIndex) => {
|
|
97
|
+
const item = sheetItemAt(index);
|
|
98
|
+
return item === undefined
|
|
99
|
+
? false
|
|
100
|
+
: (spec.editable?.(item, column, columnIndex) ?? false);
|
|
101
|
+
},
|
|
102
|
+
}), ...(spec.onAddRow === undefined || entries !== null
|
|
103
|
+
? {}
|
|
104
|
+
: { onAddRow: spec.onAddRow }) }));
|
|
105
|
+
}
|