@motifx-community/ui 0.1.0-beta.12 → 0.1.0-beta.14
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/CHANGELOG.md +414 -0
- package/README.md +2 -0
- package/dist/components/chart/Chart.d.ts +6 -4
- package/dist/components/chart/ChartPlot.d.ts +2 -1
- package/dist/components/chart/plot-view.d.ts +10 -2
- package/dist/components/chat/Chat.d.ts +276 -0
- package/dist/components/chat/ChatComposer.d.ts +172 -0
- package/dist/components/chat/ChatReply.d.ts +53 -0
- package/dist/components/chat/ChatWriter.d.ts +119 -0
- package/dist/components/chat/chat-ask-form.d.ts +64 -0
- package/dist/components/chat/chat-asked-entry.d.ts +21 -0
- package/dist/components/chat/chat-attachment-entry.d.ts +18 -0
- package/dist/components/chat/chat-choices-view.d.ts +40 -0
- package/dist/components/chat/chat-command.d.ts +7 -0
- package/dist/components/chat/chat-compaction-entry.d.ts +19 -0
- package/dist/components/chat/chat-composer-props.d.ts +63 -0
- package/dist/components/chat/chat-context-changed-event-args.d.ts +8 -0
- package/dist/components/chat/chat-context-item.d.ts +14 -0
- package/dist/components/chat/chat-copy-button.d.ts +11 -0
- package/dist/components/chat/chat-entry.d.ts +20 -0
- package/dist/components/chat/chat-flow-view.d.ts +32 -0
- package/dist/components/chat/chat-form-entry.d.ts +24 -0
- package/dist/components/chat/chat-form-view.d.ts +48 -0
- package/dist/components/chat/chat-history-event-args.d.ts +31 -0
- package/dist/components/chat/chat-load-older-event-args.d.ts +17 -0
- package/dist/components/chat/chat-look.d.ts +33 -0
- package/dist/components/chat/chat-mention.d.ts +21 -0
- package/dist/components/chat/chat-message-status.d.ts +2 -0
- package/dist/components/chat/chat-message.d.ts +23 -0
- package/dist/components/chat/chat-notice-entry.d.ts +20 -0
- package/dist/components/chat/chat-option.d.ts +7 -0
- package/dist/components/chat/chat-part.d.ts +110 -0
- package/dist/components/chat/chat-plan-entry.d.ts +25 -0
- package/dist/components/chat/chat-props.d.ts +70 -0
- package/dist/components/chat/chat-question-view.d.ts +41 -0
- package/dist/components/chat/chat-request.d.ts +173 -0
- package/dist/components/chat/chat-role.d.ts +2 -0
- package/dist/components/chat/chat-search-bar.d.ts +27 -0
- package/dist/components/chat/chat-search.d.ts +33 -0
- package/dist/components/chat/chat-send-event-args.d.ts +12 -0
- package/dist/components/chat/chat-sources-entry.d.ts +22 -0
- package/dist/components/chat/chat-text-entry.d.ts +20 -0
- package/dist/components/chat/chat-text-part.d.ts +5 -0
- package/dist/components/chat/chat-thinking-entry.d.ts +32 -0
- package/dist/components/chat/chat-todo-entry.d.ts +15 -0
- package/dist/components/chat/chat-tool-entry.d.ts +66 -0
- package/dist/components/chat/chat-tool-init.d.ts +18 -0
- package/dist/components/chat/chat-turn-view.d.ts +53 -0
- package/dist/components/chat/chat-turn.d.ts +8 -0
- package/dist/components/chat/chat-value-changed-event-args.d.ts +6 -0
- package/dist/components/chat/index.d.ts +22 -0
- package/dist/components/contextmenu/ContextMenu.d.ts +4 -0
- package/dist/components/contextmenu/context-menu-props.d.ts +6 -0
- package/dist/components/datagrid/DataGrid.d.ts +0 -12
- package/dist/components/datagrid/column-type.d.ts +2 -1
- package/dist/components/datagrid/grid-column.d.ts +4 -1
- package/dist/components/datagrid/grid-date-interval.d.ts +2 -1
- package/dist/components/datagrid/grid-filter-value.d.ts +2 -7
- package/dist/components/datagrid/grid-header-filter-interval.d.ts +2 -2
- package/dist/components/datagrid/grid-settings.d.ts +6 -3
- package/dist/components/datagrid/grid-sheet-cell.d.ts +3 -6
- package/dist/components/datagrid/grid-sheet-column.d.ts +2 -9
- package/dist/components/datagrid/grid-sheet-merge.d.ts +2 -7
- package/dist/components/datagrid/grid-sheet-row.d.ts +2 -5
- package/dist/components/datagrid/grid-sheet.d.ts +3 -2
- package/dist/components/datagrid/grid-summary-item.d.ts +5 -2
- package/dist/components/datagrid/grid-summary-texts.d.ts +2 -0
- package/dist/components/datagrid/grid-summary-type.d.ts +5 -2
- package/dist/components/datagrid/grid-summary.d.ts +3 -2
- package/dist/components/datagrid/list-option.d.ts +2 -4
- package/dist/components/datagrid/model/ColumnModel.d.ts +21 -3
- package/dist/components/datagrid/model/FilterValues.d.ts +15 -7
- package/dist/components/datagrid/model/GridExport.d.ts +1 -1
- package/dist/components/datagrid/model/GridModel.d.ts +2 -2
- package/dist/components/datagrid/model/LookupTexts.d.ts +1 -1
- package/dist/components/datagrid/view/CellEditor.d.ts +1 -1
- package/dist/components/datagrid/view/ColumnStyles.d.ts +4 -2
- package/dist/components/datagrid/view/GridBody.d.ts +1 -1
- package/dist/components/datagrid/view/HeaderRow.d.ts +3 -1
- package/dist/components/draggable/Draggable.d.ts +14 -3
- package/dist/components/dropdown/drop-down-props.d.ts +5 -2
- package/dist/components/form/MxForm.d.ts +1 -1
- package/dist/components/listbox/item-template.d.ts +4 -0
- package/dist/components/markdown/Markdown.d.ts +87 -0
- package/dist/components/markdown/code-block.d.ts +57 -0
- package/dist/components/markdown/code-colorer.d.ts +11 -0
- package/dist/components/markdown/code-highlighter.d.ts +9 -0
- package/dist/components/markdown/code-run.d.ts +6 -0
- package/dist/components/markdown/diagram-renderer.d.ts +21 -0
- package/dist/components/markdown/entities.d.ts +2 -0
- package/dist/components/markdown/index.d.ts +8 -0
- package/dist/components/markdown/inline-writer.d.ts +85 -0
- package/dist/components/markdown/markdown-context.d.ts +53 -0
- package/dist/components/markdown/markdown-link-click-event-args.d.ts +9 -0
- package/dist/components/markdown/markdown-props.d.ts +40 -0
- package/dist/components/markdown/markdown-writer.d.ts +95 -0
- package/dist/components/markdown/math-block.d.ts +22 -0
- package/dist/components/markdown/math-renderer.d.ts +18 -0
- package/dist/components/markdown/safe-href.d.ts +5 -0
- package/dist/components/markdown/text-run.d.ts +7 -0
- package/dist/components/menubar/MenuBar.d.ts +4 -0
- package/dist/components/menubar/menu-bar-props.d.ts +6 -0
- package/dist/components/pivotgrid/PivotGrid.d.ts +415 -0
- package/dist/components/pivotgrid/index.d.ts +44 -0
- package/dist/components/pivotgrid/model/PivotArrangement.d.ts +29 -0
- package/dist/components/pivotgrid/model/PivotAxisWindow.d.ts +169 -0
- package/dist/components/pivotgrid/model/PivotCellRanges.d.ts +63 -0
- package/dist/components/pivotgrid/model/PivotCellWindow.d.ts +47 -0
- package/dist/components/pivotgrid/model/PivotChart.d.ts +49 -0
- package/dist/components/pivotgrid/model/PivotDisplay.d.ts +61 -0
- package/dist/components/pivotgrid/model/PivotDrill.d.ts +19 -0
- package/dist/components/pivotgrid/model/PivotExpansion.d.ts +44 -0
- package/dist/components/pivotgrid/model/PivotFields.d.ts +55 -0
- package/dist/components/pivotgrid/model/PivotFilterValues.d.ts +36 -0
- package/dist/components/pivotgrid/model/PivotLayout.d.ts +75 -0
- package/dist/components/pivotgrid/model/PivotLoader.d.ts +29 -0
- package/dist/components/pivotgrid/model/PivotSheet.d.ts +44 -0
- package/dist/components/pivotgrid/model/PivotStateStore.d.ts +19 -0
- package/dist/components/pivotgrid/model/PivotTable.d.ts +78 -0
- package/dist/components/pivotgrid/model/PivotTexts.d.ts +47 -0
- package/dist/components/pivotgrid/model/PivotWindows.d.ts +120 -0
- package/dist/components/pivotgrid/model/pivot-copy.d.ts +26 -0
- package/dist/components/pivotgrid/model/pivot-csv.d.ts +9 -0
- package/dist/components/pivotgrid/model/pivot-header-cell.d.ts +19 -0
- package/dist/components/pivotgrid/model/pivot-line-key.d.ts +17 -0
- package/dist/components/pivotgrid/model/pivot-line.d.ts +14 -0
- package/dist/components/pivotgrid/pivot-grid-area.d.ts +2 -0
- package/dist/components/pivotgrid/pivot-grid-cell-click-event-args.d.ts +5 -0
- package/dist/components/pivotgrid/pivot-grid-cell-context.d.ts +19 -0
- package/dist/components/pivotgrid/pivot-grid-cell-dbl-click-event-args.d.ts +5 -0
- package/dist/components/pivotgrid/pivot-grid-cell-range.d.ts +16 -0
- package/dist/components/pivotgrid/pivot-grid-cell-selection-changed-event-args.d.ts +6 -0
- package/dist/components/pivotgrid/pivot-grid-chart-data.d.ts +15 -0
- package/dist/components/pivotgrid/pivot-grid-chart-options.d.ts +19 -0
- package/dist/components/pivotgrid/pivot-grid-column-resized-event-args.d.ts +8 -0
- package/dist/components/pivotgrid/pivot-grid-column-resizing.d.ts +15 -0
- package/dist/components/pivotgrid/pivot-grid-column.d.ts +19 -0
- package/dist/components/pivotgrid/pivot-grid-content-ready-event-args.d.ts +6 -0
- package/dist/components/pivotgrid/pivot-grid-context-menu-preparing-event-args.d.ts +22 -0
- package/dist/components/pivotgrid/pivot-grid-copying-event-args.d.ts +10 -0
- package/dist/components/pivotgrid/pivot-grid-custom-summary-info.d.ts +15 -0
- package/dist/components/pivotgrid/pivot-grid-data-error-event-args.d.ts +5 -0
- package/dist/components/pivotgrid/pivot-grid-drill-down.d.ts +14 -0
- package/dist/components/pivotgrid/pivot-grid-expanded-event-args.d.ts +6 -0
- package/dist/components/pivotgrid/pivot-grid-expanding-event-args.d.ts +9 -0
- package/dist/components/pivotgrid/pivot-grid-export-cell.d.ts +21 -0
- package/dist/components/pivotgrid/pivot-grid-export-options.d.ts +16 -0
- package/dist/components/pivotgrid/pivot-grid-export.d.ts +17 -0
- package/dist/components/pivotgrid/pivot-grid-exported-event-args.d.ts +9 -0
- package/dist/components/pivotgrid/pivot-grid-exporting-event-args.d.ts +17 -0
- package/dist/components/pivotgrid/pivot-grid-field-chooser.d.ts +20 -0
- package/dist/components/pivotgrid/pivot-grid-field-panel.d.ts +16 -0
- package/dist/components/pivotgrid/pivot-grid-field.d.ts +110 -0
- package/dist/components/pivotgrid/pivot-grid-fields-changed-event-args.d.ts +8 -0
- package/dist/components/pivotgrid/pivot-grid-filter-value.d.ts +4 -0
- package/dist/components/pivotgrid/pivot-grid-group-interval.d.ts +7 -0
- package/dist/components/pivotgrid/pivot-grid-header-filter-items-request.d.ts +9 -0
- package/dist/components/pivotgrid/pivot-grid-header-filter-items.d.ts +7 -0
- package/dist/components/pivotgrid/pivot-grid-load-panel.d.ts +11 -0
- package/dist/components/pivotgrid/pivot-grid-props.d.ts +121 -0
- package/dist/components/pivotgrid/pivot-grid-sheet-options.d.ts +14 -0
- package/dist/components/pivotgrid/pivot-grid-sheet.d.ts +19 -0
- package/dist/components/pivotgrid/pivot-grid-state.d.ts +54 -0
- package/dist/components/pivotgrid/pivot-grid-summary-cell.d.ts +29 -0
- package/dist/components/pivotgrid/pivot-grid-summary-display-mode.d.ts +5 -0
- package/dist/components/pivotgrid/pivot-grid-summary-type.d.ts +5 -0
- package/dist/components/pivotgrid/view/PivotFieldChooser.d.ts +71 -0
- package/dist/components/pivotgrid/view/PivotFieldPanel.d.ts +92 -0
- package/dist/components/pivotgrid/view/PivotView.d.ts +263 -0
- package/dist/components/resizable/Resizable.d.ts +2 -0
- package/dist/components/ribbonmenu/RibbonKeyHints.d.ts +4 -0
- package/dist/components/ribbonmenu/RibbonMenu.d.ts +4 -1
- package/dist/components/ribbonmenu/ribbon-menu-custom-menu-opening-event-args.d.ts +8 -4
- package/dist/components/ribbonmenu/ribbon-menu-props.d.ts +6 -0
- package/dist/components/scheduler/view/TimeView.d.ts +2 -0
- package/dist/components/scrollview/ScrollView.d.ts +48 -1
- package/dist/components/scrollview/index.d.ts +1 -0
- package/dist/components/scrollview/scroll-end-changed-event-args.d.ts +7 -0
- package/dist/components/scrollview/scroll-view-props.d.ts +9 -0
- package/dist/components/splitter/Splitter.d.ts +1 -3
- package/dist/components/tabdocs/DocumentTab.d.ts +0 -1
- package/dist/components/tabdocs/PhoneBar.d.ts +0 -1
- package/dist/components/tabdocs/TabDocumentManager.d.ts +3 -2
- package/dist/components/textarea/TextArea.d.ts +11 -0
- package/dist/components/textarea/text-area-props.d.ts +12 -1
- package/dist/components/textbox/TextBox.d.ts +3 -0
- package/dist/components/textbox/text-box-props.d.ts +3 -0
- package/dist/components/toolbar/Toolbar.d.ts +70 -1
- package/dist/components/toolbar/index.d.ts +5 -0
- package/dist/components/toolbar/toolbar-added-item.d.ts +9 -0
- package/dist/components/toolbar/toolbar-custom-menu-opening-event-args.d.ts +23 -0
- package/dist/components/toolbar/toolbar-customization.d.ts +18 -0
- package/dist/components/toolbar/toolbar-customized-event-args.d.ts +7 -0
- package/dist/components/toolbar/toolbar-item-display.d.ts +2 -0
- package/dist/components/toolbar/toolbar-item.d.ts +11 -1
- package/dist/components/toolbar/toolbar-props.d.ts +26 -0
- package/dist/components/toolbar/toolbar-targets.d.ts +22 -0
- package/dist/components/treeview/TreeView.d.ts +8 -4
- package/dist/components/treeview/tree-view-item-template.d.ts +4 -0
- package/dist/core/clipboard.d.ts +11 -0
- package/dist/core/enter-key-hint.d.ts +2 -0
- package/dist/core/look-watch.d.ts +2 -2
- package/dist/core/measure/look.d.ts +1 -1
- package/dist/core/measure/on-layout.d.ts +1 -1
- package/dist/core/measure/scroll.d.ts +3 -1
- package/dist/core/save-text.d.ts +2 -0
- package/dist/core/show-icon.d.ts +3 -3
- package/dist/core/ui-strings.d.ts +190 -0
- package/dist/excel/excel-pivot-customize-cell-args.d.ts +8 -0
- package/dist/excel/excel-pivot-export-options.d.ts +44 -0
- package/dist/excel/excel-pivot-export-result.d.ts +6 -0
- package/dist/excel/export-pivot-grid.d.ts +35 -0
- package/dist/excel/index.d.ts +4 -0
- package/dist/excel/index.js +190 -56
- package/dist/excel/index.js.map +1 -1
- package/dist/excel/write-sheet.d.ts +16 -0
- package/dist/{formula-guard-NYlpoA-t.js → formula-guard-Bx48S0u3.js} +2 -2
- package/dist/formula-guard-Bx48S0u3.js.map +1 -0
- package/dist/generated/tokens.d.ts +7527 -4097
- package/dist/index.d.ts +6 -0
- package/dist/index.js +66924 -50915
- package/dist/index.js.map +1 -1
- package/dist/locales/en.json +179 -1
- package/dist/locales/tr.json +179 -1
- package/dist/parts/customizer/Customizer.d.ts +12 -6
- package/dist/parts/customizer/customizer-display.d.ts +2 -0
- package/dist/parts/customizer/customizer-node.d.ts +5 -0
- package/dist/parts/customizer/customizer-source.d.ts +15 -3
- package/dist/parts/item-layout/layout-added-item.d.ts +2 -2
- package/dist/parts/list/OptionList.d.ts +4 -3
- package/dist/parts/list/option-parts.d.ts +1 -1
- package/dist/parts/menu/MenuList.d.ts +5 -0
- package/dist/parts/popup/Popup.d.ts +2 -0
- package/dist/{components/datagrid/model → parts/table}/CellFormatter.d.ts +8 -8
- package/dist/{components/datagrid/view → parts/table}/HeaderFilter.d.ts +16 -11
- package/dist/parts/table/OffsetList.d.ts +21 -0
- package/dist/parts/table/ScaledOffsets.d.ts +32 -0
- package/dist/{components/datagrid/model → parts/table}/ValueIntervals.d.ts +12 -5
- package/dist/{components/datagrid/model → parts/table}/ValueListAdapter.d.ts +4 -4
- package/dist/parts/table/date-interval.d.ts +2 -0
- package/dist/parts/table/date-type.d.ts +3 -0
- package/dist/{components/datagrid/model → parts/table}/filter-tree-node.d.ts +3 -1
- package/dist/parts/table/filter-value.d.ts +9 -0
- package/dist/parts/table/format-column.d.ts +14 -0
- package/dist/parts/table/header-filter-host.d.ts +27 -0
- package/dist/parts/table/option-of.d.ts +6 -0
- package/dist/parts/table/slice-sheet.d.ts +8 -0
- package/dist/parts/table/table-sheet-cell.d.ts +13 -0
- package/dist/parts/table/table-sheet-column.d.ts +11 -0
- package/dist/parts/table/table-sheet-merge.d.ts +9 -0
- package/dist/parts/table/table-sheet-row.d.ts +8 -0
- package/dist/parts/table/table-sheet.d.ts +24 -0
- package/dist/parts/table/value-interval.d.ts +6 -0
- package/dist/{components/datagrid/model → parts/table}/value-list.d.ts +7 -2
- package/dist/parts/table/value-loader.d.ts +8 -0
- package/dist/parts/table/value-option.d.ts +5 -0
- package/dist/parts/table/value-type.d.ts +5 -0
- package/dist/parts/table/values-result.d.ts +6 -0
- package/dist/parts/window/follow-pointer.d.ts +9 -3
- package/dist/parts/window-list/WindowList.d.ts +105 -0
- package/dist/parts/window-list/window-list-source.d.ts +10 -0
- package/dist/pdf/export-pivot-grid.d.ts +21 -0
- package/dist/pdf/index.d.ts +3 -0
- package/dist/pdf/index.js +143 -16
- package/dist/pdf/index.js.map +1 -1
- package/dist/pdf/pdf-customize-cell-args.d.ts +1 -1
- package/dist/pdf/pdf-pivot-cell-args.d.ts +25 -0
- package/dist/pdf/pdf-pivot-export-options.d.ts +61 -0
- package/dist/pdf/pdf-table.d.ts +38 -6
- package/dist/slice-sheet-C116M42H.js +43 -0
- package/dist/slice-sheet-C116M42H.js.map +1 -0
- package/dist/styles.css +4527 -201
- package/dist/tokens/index.d.ts +7527 -4097
- package/dist/tokens/index.js +7527 -4097
- package/dist/tokens/index.js.map +1 -1
- package/dist/{tr-BvKE8jSF.js → tr-BGbF9uCs.js} +359 -3
- package/dist/tr-BGbF9uCs.js.map +1 -0
- package/docs/accordion.md +1 -1
- package/docs/actionsheet.md +1 -1
- package/docs/appbar.md +1 -1
- package/docs/appmenu-api.md +1 -1
- package/docs/appmenu-programmatic.md +1 -1
- package/docs/appmenu-search.md +1 -1
- package/docs/appmenu.md +1 -1
- package/docs/avatar.md +1 -1
- package/docs/badge.md +1 -1
- package/docs/bar-gauge-angles.md +1 -1
- package/docs/bar-gauge-data.md +1 -1
- package/docs/bar-gauge-labels.md +1 -1
- package/docs/bar-gauge.md +1 -1
- package/docs/barcode.md +1 -1
- package/docs/bottomnavigation.md +1 -1
- package/docs/bottomsheet.md +1 -1
- package/docs/breadcrumb.md +1 -1
- package/docs/button.md +1 -1
- package/docs/buttongroup.md +1 -1
- package/docs/buttons.md +1 -1
- package/docs/calendar.md +1 -1
- package/docs/card.md +1 -1
- package/docs/chart-bars.md +1 -1
- package/docs/chart-candles.md +1 -1
- package/docs/chart-funnel.md +1 -1
- package/docs/chart-heatmap.md +1 -1
- package/docs/chart-lines.md +1 -1
- package/docs/chart-live.md +1 -1
- package/docs/chart-pie.md +1 -1
- package/docs/chart-radar.md +1 -1
- package/docs/chart-ranges.md +1 -1
- package/docs/chart-references.md +1 -1
- package/docs/chart-scatter.md +1 -1
- package/docs/chart-waterfall.md +1 -1
- package/docs/chart-zoom.md +1 -1
- package/docs/chart.md +1 -1
- package/docs/chat.md +1512 -0
- package/docs/checkbox.md +1 -1
- package/docs/chip.md +2 -2
- package/docs/choice.md +1 -1
- package/docs/colorbox.md +1 -1
- package/docs/combobox.md +2 -1
- package/docs/commands.md +1 -1
- package/docs/control.md +1 -1
- package/docs/data.md +1 -1
- package/docs/datagrid-api.md +3 -3
- package/docs/datagrid-bands.md +1 -1
- package/docs/datagrid-drag-select.md +1 -1
- package/docs/datagrid-drag.md +1 -1
- package/docs/datagrid-editing.md +1 -1
- package/docs/datagrid-filtering.md +2 -2
- package/docs/datagrid-forms.md +1 -1
- package/docs/datagrid-grouping.md +7 -7
- package/docs/datagrid-layout.md +2 -2
- package/docs/datagrid-lookups.md +4 -1
- package/docs/datagrid-master-detail.md +1 -1
- package/docs/datagrid-scrolling.md +1 -1
- package/docs/datagrid-selection.md +1 -1
- package/docs/datagrid.md +1 -1
- package/docs/datebox.md +1 -1
- package/docs/daterangebox.md +1 -1
- package/docs/display.md +1 -1
- package/docs/draggable.md +2 -2
- package/docs/drawer.md +1 -1
- package/docs/dropdown.md +4 -3
- package/docs/editors.md +1 -1
- package/docs/feedback.md +1 -1
- package/docs/fileuploader.md +1 -1
- package/docs/filterbuilder.md +1 -1
- package/docs/formlayout.md +1 -1
- package/docs/foundations.md +1 -1
- package/docs/gallery.md +1 -1
- package/docs/gauge-base.md +1 -1
- package/docs/gauge-circular.md +1 -1
- package/docs/gauge-dashboards.md +1 -1
- package/docs/gauge-linear.md +1 -1
- package/docs/gauge-markers.md +1 -1
- package/docs/gauge-marks.md +1 -1
- package/docs/gauge-ranges.md +1 -1
- package/docs/gauge-scales.md +1 -1
- package/docs/gauge.md +1 -1
- package/docs/home.md +1 -1
- package/docs/keyboard.md +1 -1
- package/docs/language.md +1 -1
- package/docs/layout.md +1 -1
- package/docs/listbox.md +4 -3
- package/docs/loadpanel.md +1 -1
- package/docs/lookup.md +1 -1
- package/docs/markdown.md +343 -0
- package/docs/menus-api.md +3 -1
- package/docs/menus-context.md +2 -1
- package/docs/menus-customization.md +5 -1
- package/docs/menus-merging.md +1 -1
- package/docs/menus-programmatic.md +1 -1
- package/docs/menus.md +1 -1
- package/docs/multiview.md +1 -1
- package/docs/navigation.md +1 -1
- package/docs/numberbox.md +1 -1
- package/docs/otpinput.md +1 -1
- package/docs/pagination.md +1 -1
- package/docs/pivotgrid-api.md +180 -0
- package/docs/pivotgrid-chart.md +132 -0
- package/docs/pivotgrid-drilldown.md +142 -0
- package/docs/pivotgrid-export.md +207 -0
- package/docs/pivotgrid-fields.md +245 -0
- package/docs/pivotgrid-keyboard.md +223 -0
- package/docs/pivotgrid-layout.md +663 -0
- package/docs/pivotgrid-panel.md +223 -0
- package/docs/pivotgrid-remote.md +397 -0
- package/docs/pivotgrid-sorting.md +379 -0
- package/docs/pivotgrid-state.md +245 -0
- package/docs/pivotgrid-summaries.md +330 -0
- package/docs/pivotgrid.md +295 -0
- package/docs/popover.md +1 -1
- package/docs/progress.md +1 -1
- package/docs/qrcode.md +1 -1
- package/docs/radiogroup.md +1 -1
- package/docs/rating.md +1 -1
- package/docs/resizable.md +1 -1
- package/docs/ribbonmenu-api.md +2 -1
- package/docs/ribbonmenu-commands.md +1 -1
- package/docs/ribbonmenu-customization.md +3 -2
- package/docs/ribbonmenu-display.md +3 -3
- package/docs/ribbonmenu-layouts.md +1 -1
- package/docs/ribbonmenu-programmatic.md +1 -1
- package/docs/ribbonmenu.md +3 -1
- package/docs/scheduler-agenda.md +1 -1
- package/docs/scheduler-big-data.md +1 -1
- package/docs/scheduler-editing.md +1 -1
- package/docs/scheduler-form.md +1 -1
- package/docs/scheduler-icalendar.md +1 -1
- package/docs/scheduler-mobile.md +1 -1
- package/docs/scheduler-recurrence.md +1 -1
- package/docs/scheduler-resources.md +1 -1
- package/docs/scheduler-timeline.md +1 -1
- package/docs/scheduler.md +1 -1
- package/docs/scrollview.md +1 -1
- package/docs/shortcuteditor.md +1 -1
- package/docs/showcase-home.md +1 -1
- package/docs/showcase-mail.md +39 -0
- package/docs/showcase.md +1 -1
- package/docs/signature.md +1 -1
- package/docs/skeleton.md +1 -1
- package/docs/slider.md +1 -1
- package/docs/sortable.md +3 -6
- package/docs/sparkline.md +1 -1
- package/docs/speeddial.md +1 -1
- package/docs/splitter.md +1 -1
- package/docs/stepper.md +1 -1
- package/docs/switch.md +1 -1
- package/docs/tabdocs-dock.md +1 -1
- package/docs/tabdocs-drag.md +1 -1
- package/docs/tabdocs-menus.md +1 -1
- package/docs/tabdocs-mobile.md +1 -1
- package/docs/tabdocs-tabs.md +1 -1
- package/docs/tabdocs-windows.md +1 -1
- package/docs/tabdocs-workspace.md +1 -1
- package/docs/tabdocs.md +1 -1
- package/docs/tabs.md +1 -1
- package/docs/tagbox.md +4 -3
- package/docs/textarea.md +4 -1
- package/docs/textbox.md +2 -1
- package/docs/tileview.md +1 -1
- package/docs/timeline.md +1 -1
- package/docs/toast.md +1 -1
- package/docs/tokens.md +687 -1
- package/docs/toolbar-api.md +80 -0
- package/docs/toolbar-customization.md +261 -0
- package/docs/toolbar.md +4 -52
- package/docs/tooltip.md +1 -1
- package/docs/treeview.md +3 -3
- package/docs/validationsummary.md +1 -1
- package/docs/window.md +1 -1
- package/docs/wizard.md +1 -1
- package/llms-full.txt +19005 -12353
- package/llms.txt +29 -2
- package/package.json +5 -5
- package/dist/components/datagrid/model/date-type.d.ts +0 -3
- package/dist/components/datagrid/model/option-of.d.ts +0 -6
- package/dist/components/datagrid/model/value-loader.d.ts +0 -8
- package/dist/formula-guard-NYlpoA-t.js.map +0 -1
- package/dist/tr-BvKE8jSF.js.map +0 -1
- /package/dist/{components/datagrid/model → core}/text-ranges.d.ts +0 -0
- /package/dist/{components/datagrid/model → parts/table}/ExtraHeights.d.ts +0 -0
- /package/dist/{components/datagrid/model → parts/table}/ScrollGeometry.d.ts +0 -0
- /package/dist/{components/datagrid/model → parts/table}/cell-list.d.ts +0 -0
- /package/dist/{components/datagrid/model → parts/table}/date-like.d.ts +0 -0
- /package/dist/{components/datagrid/view → parts/table}/editor-value.d.ts +0 -0
- /package/dist/{components/datagrid/model → parts/table}/formula-guard.d.ts +0 -0
- /package/dist/{components/datagrid/model → parts/table}/parse-date-text.d.ts +0 -0
- /package/dist/{components/datagrid/model → parts/table}/same-value.d.ts +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# PivotGrid: Export
|
|
2
|
+
|
|
3
|
+
> PivotGrid · @motifx-community/ui 0.1.0-beta.14
|
|
4
|
+
|
|
5
|
+
A pivot exports what it shows, whole: the line of every open member, read in full where the pivot is read in parts. It writes CSV itself; Excel and PDF are written by the kit's `excel` and `pdf` entries, with the ExcelJS and jsPDF your application brings.
|
|
6
|
+
|
|
7
|
+
## Export
|
|
8
|
+
|
|
9
|
+
`export={{ formats }}` puts an export button at the end of the field panel and “Export” in the table's menu: with one format it runs at once, with several it offers each. `exportTo(format)` does the same from code. The pivot saves `'csv'` itself (`exportCsv`); any other format raises `onExporting`, where the file is written. `onExported` follows.
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
export type Sale = { id: number; region: string; city: string; product: string; date: string; amount: number; units: number };
|
|
13
|
+
|
|
14
|
+
const PLACES: [string, string][] = [
|
|
15
|
+
['Marmara', 'İstanbul'],
|
|
16
|
+
['Marmara', 'Bursa'],
|
|
17
|
+
['Central Anatolia', 'Ankara'],
|
|
18
|
+
['Central Anatolia', 'Konya'],
|
|
19
|
+
['Aegean', 'İzmir'],
|
|
20
|
+
['Aegean', 'Muğla'],
|
|
21
|
+
['Black Sea', 'Trabzon'],
|
|
22
|
+
['Mediterranean', 'Antalya'],
|
|
23
|
+
];
|
|
24
|
+
const PRODUCTS = ['Tea', 'Coffee', 'Hazelnuts', 'Figs', 'Olive oil'];
|
|
25
|
+
|
|
26
|
+
/** Sales spread over the places, the products and the days of 2024 and 2025; the same rows every time. */
|
|
27
|
+
export function makeSales(count: number): Sale[] {
|
|
28
|
+
return Array.from({ length: count }, (_, i) => {
|
|
29
|
+
const [region, city] = PLACES[(i * 7) % PLACES.length];
|
|
30
|
+
const day = new Date(2024, 0, 1 + ((i * 13) % 731));
|
|
31
|
+
return {
|
|
32
|
+
id: i + 1,
|
|
33
|
+
region,
|
|
34
|
+
city,
|
|
35
|
+
product: PRODUCTS[(i * 3) % PRODUCTS.length],
|
|
36
|
+
date: `${day.getFullYear()}-${String(day.getMonth() + 1).padStart(2, '0')}-${String(day.getDate()).padStart(2, '0')}`,
|
|
37
|
+
amount: ((i * 7919) % 50000) / 100,
|
|
38
|
+
units: 1 + ((i * 31) % 12),
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Excel
|
|
45
|
+
|
|
46
|
+
`exportPivotGrid` of `@motifx-community/ui/excel` writes the pivot to an ExcelJS worksheet: the column headers merged over the columns they cover and the row headers down the lines they cover, numbers kept numbers with the format their cells show them with, totals bold, the headers kept in view. In the tree layout a member is indented by its level, and the rows of an open member fold under it.
|
|
47
|
+
|
|
48
|
+
A table larger than a worksheet (1,048,576 rows, 16,384 columns) goes on in worksheets added after it, “Sales (2)” and on, each with the rows of column headers and the columns of row headers again; `worksheets` lists them all.
|
|
49
|
+
|
|
50
|
+
## PDF
|
|
51
|
+
|
|
52
|
+
`exportPivotGrid` of `@motifx-community/ui/pdf` draws the pivot on a jsPDF document. Rows that do not fit go on to the next page under the column headers again; columns that do not fit go on to the next pages after the row headers again (`splitColumns: false` narrows them instead). jsPDF's own fonts write Latin-1 only: add a font that has the letters you need.
|
|
53
|
+
|
|
54
|
+
## Read in parts
|
|
55
|
+
|
|
56
|
+
A pivot [read in parts](pivotgrid-remote.md#parts) is read whole first, a run of rows at a time with their values, while the load panel over the table tells the rows read and offers to stop (`loadPanel`, `onProgress`, `signal`; a stopped export rejects with an `AbortError`). A member opened or closed meanwhile stops it too: what it wrote would not be one table.
|
|
57
|
+
|
|
58
|
+
A run is as many rows as 20,000 cells across every column, and the next run is read while one is written. The million orders of the [Remote data](pivotgrid-remote.md#parts) example, their 100,017 rows of regions and customers by year, export to CSV in about nine seconds in Chrome on a desktop machine, in 32 requests: the example's server, which answers one request at a time, takes about seven seconds of them, and the pivot about two.
|
|
59
|
+
|
|
60
|
+
## A writer of your own
|
|
61
|
+
|
|
62
|
+
`exportSheet(options, write)` gives a writer the pivot as rows of cells: the rows of column headers and the corner (`headerRows`), the columns of row headers (`headerColumns`), the merges, and each cell's value, text and number format with the cell of the pivot it stands for (`pivotCell`: its area, kind, paths and data field). The Excel and PDF functions are written on it.
|
|
63
|
+
|
|
64
|
+
## Feedback
|
|
65
|
+
|
|
66
|
+
Loading issues…
|
|
67
|
+
|
|
68
|
+
## Example files
|
|
69
|
+
|
|
70
|
+
`PivotExport.tsx`
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { reactive } from '@motifx/core';
|
|
74
|
+
import { PivotGrid, type PivotGridExportingEventArgs, type PivotGridField } from '@motifx-community/ui';
|
|
75
|
+
import { exportPivotGrid as exportToExcel } from '@motifx-community/ui/excel';
|
|
76
|
+
import { exportPivotGrid as exportToPdf } from '@motifx-community/ui/pdf';
|
|
77
|
+
import { useNotoSans } from './pdf-font';
|
|
78
|
+
import { makeSales, type Sale } from './sales';
|
|
79
|
+
|
|
80
|
+
const sales = makeSales(20000);
|
|
81
|
+
|
|
82
|
+
const fields: PivotGridField<Sale>[] = [
|
|
83
|
+
{ field: 'region', title: 'Region', area: 'row' },
|
|
84
|
+
{ field: 'city', title: 'City', area: 'row' },
|
|
85
|
+
{ field: 'date', title: 'Date', type: 'date', area: 'column', groupInterval: ['year', 'quarter'] },
|
|
86
|
+
{ field: 'amount', title: 'Amount', type: 'number', area: 'data', summaryType: 'sum', format: { style: 'currency', currency: 'TRY', maximumFractionDigits: 0 } },
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
/** Saves a file through a link the browser downloads. */
|
|
90
|
+
function saveFile(blob: Blob, name: string) {
|
|
91
|
+
const url = URL.createObjectURL(blob);
|
|
92
|
+
const link = document.createElement('a');
|
|
93
|
+
link.href = url;
|
|
94
|
+
link.download = name;
|
|
95
|
+
link.click();
|
|
96
|
+
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** The export button at the end of the field panel, and "Export" in the menu: CSV by the pivot, Excel and PDF written in `onExporting`. */
|
|
100
|
+
export default function PivotExport() {
|
|
101
|
+
const s = reactive({ saved: '' });
|
|
102
|
+
|
|
103
|
+
// The pivot raises onExporting for 'xlsx' and 'pdf'; the file is written here. ExcelJS and jsPDF load the first time
|
|
104
|
+
// someone exports, so the page does not carry them until then.
|
|
105
|
+
const onExporting = async (e: PivotGridExportingEventArgs) => {
|
|
106
|
+
if (e.format === 'xlsx') {
|
|
107
|
+
const { default: ExcelJS } = await import('exceljs');
|
|
108
|
+
const workbook = new ExcelJS.Workbook();
|
|
109
|
+
const result = await exportToExcel({ component: e.component, worksheet: workbook.addWorksheet('Sales') });
|
|
110
|
+
const buffer = await workbook.xlsx.writeBuffer();
|
|
111
|
+
saveFile(new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }), 'Sales.xlsx');
|
|
112
|
+
s.saved = `Sales.xlsx: ${result.to.row} rows, ${result.to.column} columns`;
|
|
113
|
+
} else if (e.format === 'pdf') {
|
|
114
|
+
const { jsPDF } = await import('jspdf');
|
|
115
|
+
const doc = new jsPDF();
|
|
116
|
+
await useNotoSans(doc);
|
|
117
|
+
await exportToPdf({ jsPDFDocument: doc, component: e.component, margin: 14 });
|
|
118
|
+
doc.save('Sales.pdf');
|
|
119
|
+
s.saved = `Sales.pdf: ${doc.getNumberOfPages()} pages`;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<>
|
|
125
|
+
<PivotGrid
|
|
126
|
+
class="pg-export"
|
|
127
|
+
style="block-size: 20rem"
|
|
128
|
+
data={sales}
|
|
129
|
+
fields={fields}
|
|
130
|
+
label="Sales by region and quarter"
|
|
131
|
+
fieldPanel={{ visible: true }}
|
|
132
|
+
export={{ formats: ['xlsx', 'pdf', 'csv'], fileName: 'Sales' }}
|
|
133
|
+
onExporting={onExporting}
|
|
134
|
+
onExported={(e) => e.format === 'csv' && (s.saved = `Sales.csv: ${e.rows} rows`)}
|
|
135
|
+
/>
|
|
136
|
+
<output class="pg-export-saved">{() => s.saved}</output>
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`pdf-font.ts`
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
import type { jsPDF } from 'jspdf';
|
|
146
|
+
|
|
147
|
+
// jsPDF's own fonts write Latin-1 only: "İzmir" and "Muğla" need a font that has their letters.
|
|
148
|
+
const FONT = 'https://cdn.jsdelivr.net/npm/@expo-google-fonts/noto-sans@0.2.3/';
|
|
149
|
+
let font: Promise<{ regular: string; bold: string }> | null = null;
|
|
150
|
+
|
|
151
|
+
async function base64(url: string): Promise<string> {
|
|
152
|
+
const bytes = new Uint8Array(await (await fetch(url)).arrayBuffer());
|
|
153
|
+
let text = '';
|
|
154
|
+
for (let i = 0; i < bytes.length; i += 0x8000) text += String.fromCharCode(...bytes.subarray(i, i + 0x8000));
|
|
155
|
+
return btoa(text);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** Noto Sans in the document, fetched once; without the network the document keeps jsPDF's own font. */
|
|
159
|
+
export async function useNotoSans(doc: jsPDF) {
|
|
160
|
+
font ??= Promise.all([base64(`${FONT}NotoSans_400Regular.ttf`), base64(`${FONT}NotoSans_700Bold.ttf`)]).then(([regular, bold]) => ({ regular, bold }));
|
|
161
|
+
try {
|
|
162
|
+
const { regular, bold } = await font;
|
|
163
|
+
doc.addFileToVFS('NotoSans-Regular.ttf', regular);
|
|
164
|
+
doc.addFont('NotoSans-Regular.ttf', 'NotoSans', 'normal');
|
|
165
|
+
doc.addFileToVFS('NotoSans-Bold.ttf', bold);
|
|
166
|
+
doc.addFont('NotoSans-Bold.ttf', 'NotoSans', 'bold');
|
|
167
|
+
doc.setFont('NotoSans', 'normal');
|
|
168
|
+
} catch {
|
|
169
|
+
font = null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
`sales.ts`
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
export type Sale = { id: number; region: string; city: string; product: string; date: string; amount: number; units: number };
|
|
178
|
+
|
|
179
|
+
const PLACES: [string, string][] = [
|
|
180
|
+
['Marmara', 'İstanbul'],
|
|
181
|
+
['Marmara', 'Bursa'],
|
|
182
|
+
['Central Anatolia', 'Ankara'],
|
|
183
|
+
['Central Anatolia', 'Konya'],
|
|
184
|
+
['Aegean', 'İzmir'],
|
|
185
|
+
['Aegean', 'Muğla'],
|
|
186
|
+
['Black Sea', 'Trabzon'],
|
|
187
|
+
['Mediterranean', 'Antalya'],
|
|
188
|
+
];
|
|
189
|
+
const PRODUCTS = ['Tea', 'Coffee', 'Hazelnuts', 'Figs', 'Olive oil'];
|
|
190
|
+
|
|
191
|
+
/** Sales spread over the places, the products and the days of 2024 and 2025; the same rows every time. */
|
|
192
|
+
export function makeSales(count: number): Sale[] {
|
|
193
|
+
return Array.from({ length: count }, (_, i) => {
|
|
194
|
+
const [region, city] = PLACES[(i * 7) % PLACES.length];
|
|
195
|
+
const day = new Date(2024, 0, 1 + ((i * 13) % 731));
|
|
196
|
+
return {
|
|
197
|
+
id: i + 1,
|
|
198
|
+
region,
|
|
199
|
+
city,
|
|
200
|
+
product: PRODUCTS[(i * 3) % PRODUCTS.length],
|
|
201
|
+
date: `${day.getFullYear()}-${String(day.getMonth() + 1).padStart(2, '0')}-${String(day.getDate()).padStart(2, '0')}`,
|
|
202
|
+
amount: ((i * 7919) % 50000) / 100,
|
|
203
|
+
units: 1 + ((i * 31) % 12),
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
```
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# PivotGrid: Fields and areas
|
|
2
|
+
|
|
3
|
+
> PivotGrid · @motifx-community/ui 0.1.0-beta.14
|
|
4
|
+
|
|
5
|
+
A field is a value of the rows placed in an area. Its place, its levels, the order and filter of its members, and how a data field sums up its rows are all set on the field; the summaries and what a data field shows of them are on [Summaries and display](pivotgrid-summaries.md).
|
|
6
|
+
|
|
7
|
+
## Areas of the pivot
|
|
8
|
+
|
|
9
|
+
`area` is `row`, `column`, `data` or `filter`; a field without one takes no part, and neither does one with `visible: false`. Within an area, fields stand in the order of `fields`, or by `areaIndex` where they have one. A `filter` field shows nowhere: it only keeps rows by its `filterValues`. `fields` is a value or a tracked function, and a new list loads the pivot again.
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
export type Sale = { id: number; region: string; city: string; product: string; date: string; amount: number; units: number };
|
|
13
|
+
|
|
14
|
+
const PLACES: [string, string][] = [
|
|
15
|
+
['Marmara', 'İstanbul'],
|
|
16
|
+
['Marmara', 'Bursa'],
|
|
17
|
+
['Central Anatolia', 'Ankara'],
|
|
18
|
+
['Central Anatolia', 'Konya'],
|
|
19
|
+
['Aegean', 'İzmir'],
|
|
20
|
+
['Aegean', 'Muğla'],
|
|
21
|
+
['Black Sea', 'Trabzon'],
|
|
22
|
+
['Mediterranean', 'Antalya'],
|
|
23
|
+
];
|
|
24
|
+
const PRODUCTS = ['Tea', 'Coffee', 'Hazelnuts', 'Figs', 'Olive oil'];
|
|
25
|
+
|
|
26
|
+
/** Sales spread over the places, the products and the days of 2024 and 2025; the same rows every time. */
|
|
27
|
+
export function makeSales(count: number): Sale[] {
|
|
28
|
+
return Array.from({ length: count }, (_, i) => {
|
|
29
|
+
const [region, city] = PLACES[(i * 7) % PLACES.length];
|
|
30
|
+
const day = new Date(2024, 0, 1 + ((i * 13) % 731));
|
|
31
|
+
return {
|
|
32
|
+
id: i + 1,
|
|
33
|
+
region,
|
|
34
|
+
city,
|
|
35
|
+
product: PRODUCTS[(i * 3) % PRODUCTS.length],
|
|
36
|
+
date: `${day.getFullYear()}-${String(day.getMonth() + 1).padStart(2, '0')}-${String(day.getDate()).padStart(2, '0')}`,
|
|
37
|
+
amount: ((i * 7919) % 50000) / 100,
|
|
38
|
+
units: 1 + ((i * 31) % 12),
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Dates and number ranges
|
|
45
|
+
|
|
46
|
+
`groupInterval` groups a row or column field's values. A date field takes a part: `year`, `quarter`, `month`, `day` (of the month), `dayOfWeek` or `date` (the day itself); a number field takes the width of its ranges (“0 – 100”). A list makes a level per entry, the largest first: `['year', 'quarter', 'month']` opens a year into its quarters and a quarter into its months. An OData service that takes `compute` computes every part but the day of the week in `$apply`; otherwise the rows are grouped in the browser.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
export type Sale = { id: number; region: string; city: string; product: string; date: string; amount: number; units: number };
|
|
50
|
+
|
|
51
|
+
const PLACES: [string, string][] = [
|
|
52
|
+
['Marmara', 'İstanbul'],
|
|
53
|
+
['Marmara', 'Bursa'],
|
|
54
|
+
['Central Anatolia', 'Ankara'],
|
|
55
|
+
['Central Anatolia', 'Konya'],
|
|
56
|
+
['Aegean', 'İzmir'],
|
|
57
|
+
['Aegean', 'Muğla'],
|
|
58
|
+
['Black Sea', 'Trabzon'],
|
|
59
|
+
['Mediterranean', 'Antalya'],
|
|
60
|
+
];
|
|
61
|
+
const PRODUCTS = ['Tea', 'Coffee', 'Hazelnuts', 'Figs', 'Olive oil'];
|
|
62
|
+
|
|
63
|
+
/** Sales spread over the places, the products and the days of 2024 and 2025; the same rows every time. */
|
|
64
|
+
export function makeSales(count: number): Sale[] {
|
|
65
|
+
return Array.from({ length: count }, (_, i) => {
|
|
66
|
+
const [region, city] = PLACES[(i * 7) % PLACES.length];
|
|
67
|
+
const day = new Date(2024, 0, 1 + ((i * 13) % 731));
|
|
68
|
+
return {
|
|
69
|
+
id: i + 1,
|
|
70
|
+
region,
|
|
71
|
+
city,
|
|
72
|
+
product: PRODUCTS[(i * 3) % PRODUCTS.length],
|
|
73
|
+
date: `${day.getFullYear()}-${String(day.getMonth() + 1).padStart(2, '0')}-${String(day.getDate()).padStart(2, '0')}`,
|
|
74
|
+
amount: ((i * 7919) % 50000) / 100,
|
|
75
|
+
units: 1 + ((i * 31) % 12),
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Values read by a function
|
|
82
|
+
|
|
83
|
+
`value` reads a field's value from the row in place of `field`, and `format` as a function shows a member or a value as you write it. A field read with `value` is grouped and summed in memory.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
export type Sale = { id: number; region: string; city: string; product: string; date: string; amount: number; units: number };
|
|
87
|
+
|
|
88
|
+
const PLACES: [string, string][] = [
|
|
89
|
+
['Marmara', 'İstanbul'],
|
|
90
|
+
['Marmara', 'Bursa'],
|
|
91
|
+
['Central Anatolia', 'Ankara'],
|
|
92
|
+
['Central Anatolia', 'Konya'],
|
|
93
|
+
['Aegean', 'İzmir'],
|
|
94
|
+
['Aegean', 'Muğla'],
|
|
95
|
+
['Black Sea', 'Trabzon'],
|
|
96
|
+
['Mediterranean', 'Antalya'],
|
|
97
|
+
];
|
|
98
|
+
const PRODUCTS = ['Tea', 'Coffee', 'Hazelnuts', 'Figs', 'Olive oil'];
|
|
99
|
+
|
|
100
|
+
/** Sales spread over the places, the products and the days of 2024 and 2025; the same rows every time. */
|
|
101
|
+
export function makeSales(count: number): Sale[] {
|
|
102
|
+
return Array.from({ length: count }, (_, i) => {
|
|
103
|
+
const [region, city] = PLACES[(i * 7) % PLACES.length];
|
|
104
|
+
const day = new Date(2024, 0, 1 + ((i * 13) % 731));
|
|
105
|
+
return {
|
|
106
|
+
id: i + 1,
|
|
107
|
+
region,
|
|
108
|
+
city,
|
|
109
|
+
product: PRODUCTS[(i * 3) % PRODUCTS.length],
|
|
110
|
+
date: `${day.getFullYear()}-${String(day.getMonth() + 1).padStart(2, '0')}-${String(day.getDate()).padStart(2, '0')}`,
|
|
111
|
+
amount: ((i * 7919) % 50000) / 100,
|
|
112
|
+
units: 1 + ((i * 31) % 12),
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Feedback
|
|
119
|
+
|
|
120
|
+
Loading issues…
|
|
121
|
+
|
|
122
|
+
## Example files
|
|
123
|
+
|
|
124
|
+
`Areas.tsx`
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import { reactive } from '@motifx/core';
|
|
128
|
+
import { Button, CheckBox, PivotGrid, Stack, type PivotGridField } from '@motifx-community/ui';
|
|
129
|
+
import { makeSales, type Sale } from './sales';
|
|
130
|
+
|
|
131
|
+
const sales = makeSales(20000);
|
|
132
|
+
|
|
133
|
+
/** Fields moved between the areas at run time, a field taken out, and a filter field that only filters. */
|
|
134
|
+
export default function Areas() {
|
|
135
|
+
const s = reactive({ swapped: false, product: true });
|
|
136
|
+
// A function is tracked: a new list of fields loads the pivot again.
|
|
137
|
+
const fields = (): PivotGridField<Sale>[] => [
|
|
138
|
+
{ field: 'region', title: 'Region', area: s.swapped ? 'column' : 'row' },
|
|
139
|
+
{ field: 'product', title: 'Product', area: s.swapped ? 'row' : 'column', visible: s.product },
|
|
140
|
+
{ field: 'city', title: 'City', area: 'filter', filterValues: ['İstanbul', 'Bursa', 'Ankara', 'İzmir'] },
|
|
141
|
+
{ field: 'amount', title: 'Amount', type: 'number', area: 'data', summaryType: 'sum', format: { maximumFractionDigits: 0 } },
|
|
142
|
+
];
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<>
|
|
146
|
+
<PivotGrid class="pg-areas" style="block-size: 18rem" data={sales} fields={fields} label="Sales of four cities by region and product" />
|
|
147
|
+
<Stack orientation="horizontal" wrap align="center">
|
|
148
|
+
<Button text="Swap rows and columns" variant="outline" onclick={() => (s.swapped = !s.swapped)} />
|
|
149
|
+
<CheckBox label="Product field" x-model={() => s.product} />
|
|
150
|
+
</Stack>
|
|
151
|
+
</>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
`sales.ts`
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
export type Sale = { id: number; region: string; city: string; product: string; date: string; amount: number; units: number };
|
|
160
|
+
|
|
161
|
+
const PLACES: [string, string][] = [
|
|
162
|
+
['Marmara', 'İstanbul'],
|
|
163
|
+
['Marmara', 'Bursa'],
|
|
164
|
+
['Central Anatolia', 'Ankara'],
|
|
165
|
+
['Central Anatolia', 'Konya'],
|
|
166
|
+
['Aegean', 'İzmir'],
|
|
167
|
+
['Aegean', 'Muğla'],
|
|
168
|
+
['Black Sea', 'Trabzon'],
|
|
169
|
+
['Mediterranean', 'Antalya'],
|
|
170
|
+
];
|
|
171
|
+
const PRODUCTS = ['Tea', 'Coffee', 'Hazelnuts', 'Figs', 'Olive oil'];
|
|
172
|
+
|
|
173
|
+
/** Sales spread over the places, the products and the days of 2024 and 2025; the same rows every time. */
|
|
174
|
+
export function makeSales(count: number): Sale[] {
|
|
175
|
+
return Array.from({ length: count }, (_, i) => {
|
|
176
|
+
const [region, city] = PLACES[(i * 7) % PLACES.length];
|
|
177
|
+
const day = new Date(2024, 0, 1 + ((i * 13) % 731));
|
|
178
|
+
return {
|
|
179
|
+
id: i + 1,
|
|
180
|
+
region,
|
|
181
|
+
city,
|
|
182
|
+
product: PRODUCTS[(i * 3) % PRODUCTS.length],
|
|
183
|
+
date: `${day.getFullYear()}-${String(day.getMonth() + 1).padStart(2, '0')}-${String(day.getDate()).padStart(2, '0')}`,
|
|
184
|
+
amount: ((i * 7919) % 50000) / 100,
|
|
185
|
+
units: 1 + ((i * 31) % 12),
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
`Intervals.tsx`
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import { reactive } from '@motifx/core';
|
|
195
|
+
import { ButtonGroup, PivotGrid, type PivotGridField, type PivotGridGroupInterval } from '@motifx-community/ui';
|
|
196
|
+
import { makeSales, type Sale } from './sales';
|
|
197
|
+
|
|
198
|
+
const sales = makeSales(20000);
|
|
199
|
+
|
|
200
|
+
const INTERVALS: { value: string; text: string; interval: PivotGridGroupInterval }[] = [
|
|
201
|
+
{ value: 'tree', text: 'Year, quarter, month', interval: ['year', 'quarter', 'month'] },
|
|
202
|
+
{ value: 'month', text: 'Month', interval: 'month' },
|
|
203
|
+
{ value: 'weekday', text: 'Day of the week', interval: 'dayOfWeek' },
|
|
204
|
+
];
|
|
205
|
+
|
|
206
|
+
/** Dates grouped by their parts, and amounts by ranges of 100. */
|
|
207
|
+
export default function Intervals() {
|
|
208
|
+
const s = reactive({ by: 'tree' });
|
|
209
|
+
const fields = (): PivotGridField<Sale>[] => [
|
|
210
|
+
{ field: 'date', title: 'Date', type: 'date', area: 'row', groupInterval: INTERVALS.find((i) => i.value === s.by)!.interval },
|
|
211
|
+
{ field: 'amount', title: 'Amount', type: 'number', area: 'column', groupInterval: 100, format: { maximumFractionDigits: 0 } },
|
|
212
|
+
{ field: 'id', title: 'Sales', area: 'data', summaryType: 'count' },
|
|
213
|
+
];
|
|
214
|
+
|
|
215
|
+
return (
|
|
216
|
+
<>
|
|
217
|
+
<ButtonGroup label="Dates by" items={INTERVALS} x-model={() => s.by} />
|
|
218
|
+
<PivotGrid class="pg-intervals" style="block-size: 22rem" data={sales} fields={fields} label="Sales by date and amount" />
|
|
219
|
+
</>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
`Computed.tsx`
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
import { PivotGrid, type PivotGridField } from '@motifx-community/ui';
|
|
228
|
+
import { makeSales, type Sale } from './sales';
|
|
229
|
+
|
|
230
|
+
const sales = makeSales(20000);
|
|
231
|
+
|
|
232
|
+
const SEASONS = ['Winter', 'Spring', 'Summer', 'Autumn'];
|
|
233
|
+
|
|
234
|
+
const fields: PivotGridField<Sale>[] = [
|
|
235
|
+
{ title: 'Size', area: 'row', value: (sale) => (sale.amount >= 250 ? 'Large' : 'Small') },
|
|
236
|
+
// The season's number orders the members, its name shows.
|
|
237
|
+
{ title: 'Season', area: 'column', type: 'number', value: (sale) => Math.floor((Number(sale.date.slice(5, 7)) % 12) / 3), format: (season) => SEASONS[Number(season)] },
|
|
238
|
+
{ field: 'units', title: 'Units', type: 'number', area: 'data', summaryType: 'sum', format: (units) => `${units} pcs` },
|
|
239
|
+
];
|
|
240
|
+
|
|
241
|
+
/** Members read from the rows by functions, and members and values shown by functions. */
|
|
242
|
+
export default function Computed() {
|
|
243
|
+
return <PivotGrid class="pg-computed" style="block-size: 14rem" data={sales} fields={fields} label="Units by sale size and season" />;
|
|
244
|
+
}
|
|
245
|
+
```
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# PivotGrid: Keyboard and accessibility
|
|
2
|
+
|
|
3
|
+
> PivotGrid · @motifx-community/ui 0.1.0-beta.14
|
|
4
|
+
|
|
5
|
+
The pivot is one Tab stop; the arrow keys move between its cells and headers, and Enter opens a member. Each cell has a name a screen reader reads in full, and every string comes from the kit's language.
|
|
6
|
+
|
|
7
|
+
## Keyboard
|
|
8
|
+
|
|
9
|
+
| Key | Description |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `Tab` | Moves into the pivot, to the cell that was active last (at first, the corner), and out of it: the pivot is one Tab stop. |
|
|
12
|
+
| `Arrow keys` | Move between cells, the headers and the corner included. A header over several rows or columns is one stop. On a right-to-left page, Left and Right are swapped. |
|
|
13
|
+
| `Home / End` | Move to the first or the last cell of the row. |
|
|
14
|
+
| `Ctrl + Home / End` | Move to the corner, or to the last cell of the last row. |
|
|
15
|
+
| `PageUp / PageDown` | Move a screen of rows up or down; PageUp stops at the first row of values. |
|
|
16
|
+
| `Enter, Space` | On the header of a member that opens, open or close it. The header keeps the focus. |
|
|
17
|
+
| `Enter on a data cell` | Raise `onCellDblClick`, as a double click does: where drilling down into the cell starts. |
|
|
18
|
+
| `Shift + arrow keys, Home / End, PageUp / PageDown` | With `cellSelection`, run the last cell range among the data cells to where the key moves, or start one at the active cell; Home goes to the first data column, Ctrl + Shift + Home to the first data cell. |
|
|
19
|
+
| `Ctrl + A, Escape` | With `cellSelection`, select every data cell, or clear the ranges. A move without Shift clears them too. |
|
|
20
|
+
| `Ctrl + C` | Copy the cell ranges with the names of their rows and columns, or the active cell's text without them. |
|
|
21
|
+
| `Shift + F10, the menu key` | Open the menu of the active header, title or cell, at it, with the focus on its first item: open and close, the whole level, sorting by its row or column, hiding its field, the field chooser. Escape gives the focus back to the cell. |
|
|
22
|
+
| `Left / Right after “Width” in a menu` | Resize the column of the header or title the menu opened on, by `columnResizing.step` pixels, with Shift by `fineStep`; Enter or Tab keeps the width, Escape takes it back. Each step is announced (“Amount: 130 pixels”). |
|
|
23
|
+
| `Arrow keys, Home / End on a chip` | In the field panel, which is one Tab stop of its own, move from chip to chip across the areas, or to the first and the last. |
|
|
24
|
+
| `Enter, Space on a chip` | Turn the order of a row or column field's members around. |
|
|
25
|
+
| `Shift + Left / Right, Delete on a chip` | Move the chip along its area, or take the field out of the areas. |
|
|
26
|
+
| `Alt + Down, Shift + F10, the menu key on a chip` | Open the chip's menu: sort, the header filter, the moves to the other areas, earlier, later and out. Escape gives the focus back to the chip. |
|
|
27
|
+
| `Space in the field chooser's list, Escape` | Check a field into its area or out of every area; close the chooser (with `onDemand`, as Cancel). Its areas take the keys of the field panel's chips. |
|
|
28
|
+
|
|
29
|
+
## Accessibility
|
|
30
|
+
|
|
31
|
+
| Topic | Details |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `Pattern` | The scrolling area has `role="grid"` and is named by `label`. Its column headers and its rows are two row groups; every line is a `row`, with `aria-rowindex`, and every cell has `aria-colindex`. `aria-rowcount` and `aria-colcount` count every line, also those not drawn. |
|
|
34
|
+
| `Headers` | Column members, totals and data field titles are `columnheader`s, row members and totals `rowheader`s, with `aria-colspan` and `aria-rowspan` where they cover several lines. The corner names the row fields (“Region · City”). |
|
|
35
|
+
| `Open members` | The header of a member that opens has `aria-expanded`. The whole header opens it, so there is no separate button to reach. |
|
|
36
|
+
| `Cell names` | A data cell is named by its row, its column, its data field and its value: “Marmara › İstanbul, 2024 › Q1, Amount: 31,200”. A cell no row falls in reads “no value”, whatever `emptyText` shows. |
|
|
37
|
+
| `One Tab stop` | Only the active cell is in the Tab order. It stays drawn while it scrolls out of view, so the focus is never lost, and the keys scroll it back. |
|
|
38
|
+
| `Loading` | The table is a grid once it has rows, and has `aria-busy` while it loads. A load that lasts shows the kit's load panel over the table. A failed load is told under the table with `role="alert"` and a Retry button. |
|
|
39
|
+
| `Selection` | With `cellSelection`, the grid is `aria-multiselectable` and every data cell has `aria-selected`; a range's look does not rely on color alone, and with forced colors its cells are framed. Each copy is announced through a polite live region (“6 cells copied”). |
|
|
40
|
+
| `Menu` | The kit's context menu, named by the header or title it opens on (“Marmara menu”), else “Cell menu”. Its sort items are check items, checked while the field is sorted that way; with several data fields each opens a submenu of them. |
|
|
41
|
+
| `Field panel` | A `group` named “Fields”, each area a `group` named by its visible name. A chip is a button named by its field, the order of its members and whether it is filtered (“Region, ascending, filtered”), and described by the keys it takes. Every drag has its keys, and every move is announced through a polite live region. |
|
|
42
|
+
|
|
43
|
+
## Localization
|
|
44
|
+
|
|
45
|
+
The pivot's strings come from `uiLocale.strings` (`pivotGrandTotal`, `pivotTotal`, `pivotEmpty`, `pivotQuarter`, `pivotRange`, `pivotCellLabel`, `pivotNoValue`, and `retry`), or from its own `texts`. `locale` sets the numbers, the dates, the names of months and days, and the order of texts; by default it is the kit's language.
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
export type Sale = { id: number; region: string; city: string; product: string; date: string; amount: number; units: number };
|
|
49
|
+
|
|
50
|
+
const PLACES: [string, string][] = [
|
|
51
|
+
['Marmara', 'İstanbul'],
|
|
52
|
+
['Marmara', 'Bursa'],
|
|
53
|
+
['Central Anatolia', 'Ankara'],
|
|
54
|
+
['Central Anatolia', 'Konya'],
|
|
55
|
+
['Aegean', 'İzmir'],
|
|
56
|
+
['Aegean', 'Muğla'],
|
|
57
|
+
['Black Sea', 'Trabzon'],
|
|
58
|
+
['Mediterranean', 'Antalya'],
|
|
59
|
+
];
|
|
60
|
+
const PRODUCTS = ['Tea', 'Coffee', 'Hazelnuts', 'Figs', 'Olive oil'];
|
|
61
|
+
|
|
62
|
+
/** Sales spread over the places, the products and the days of 2024 and 2025; the same rows every time. */
|
|
63
|
+
export function makeSales(count: number): Sale[] {
|
|
64
|
+
return Array.from({ length: count }, (_, i) => {
|
|
65
|
+
const [region, city] = PLACES[(i * 7) % PLACES.length];
|
|
66
|
+
const day = new Date(2024, 0, 1 + ((i * 13) % 731));
|
|
67
|
+
return {
|
|
68
|
+
id: i + 1,
|
|
69
|
+
region,
|
|
70
|
+
city,
|
|
71
|
+
product: PRODUCTS[(i * 3) % PRODUCTS.length],
|
|
72
|
+
date: `${day.getFullYear()}-${String(day.getMonth() + 1).padStart(2, '0')}-${String(day.getDate()).padStart(2, '0')}`,
|
|
73
|
+
amount: ((i * 7919) % 50000) / 100,
|
|
74
|
+
units: 1 + ((i * 31) % 12),
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Right to left
|
|
81
|
+
|
|
82
|
+
On a right-to-left page or inside an element with `dir="rtl"`, the row headers stand at the right and stay there while the cells scroll, and Left and Right move the other way.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
export type Sale = { id: number; region: string; city: string; product: string; date: string; amount: number; units: number };
|
|
86
|
+
|
|
87
|
+
const PLACES: [string, string][] = [
|
|
88
|
+
['Marmara', 'İstanbul'],
|
|
89
|
+
['Marmara', 'Bursa'],
|
|
90
|
+
['Central Anatolia', 'Ankara'],
|
|
91
|
+
['Central Anatolia', 'Konya'],
|
|
92
|
+
['Aegean', 'İzmir'],
|
|
93
|
+
['Aegean', 'Muğla'],
|
|
94
|
+
['Black Sea', 'Trabzon'],
|
|
95
|
+
['Mediterranean', 'Antalya'],
|
|
96
|
+
];
|
|
97
|
+
const PRODUCTS = ['Tea', 'Coffee', 'Hazelnuts', 'Figs', 'Olive oil'];
|
|
98
|
+
|
|
99
|
+
/** Sales spread over the places, the products and the days of 2024 and 2025; the same rows every time. */
|
|
100
|
+
export function makeSales(count: number): Sale[] {
|
|
101
|
+
return Array.from({ length: count }, (_, i) => {
|
|
102
|
+
const [region, city] = PLACES[(i * 7) % PLACES.length];
|
|
103
|
+
const day = new Date(2024, 0, 1 + ((i * 13) % 731));
|
|
104
|
+
return {
|
|
105
|
+
id: i + 1,
|
|
106
|
+
region,
|
|
107
|
+
city,
|
|
108
|
+
product: PRODUCTS[(i * 3) % PRODUCTS.length],
|
|
109
|
+
date: `${day.getFullYear()}-${String(day.getMonth() + 1).padStart(2, '0')}-${String(day.getDate()).padStart(2, '0')}`,
|
|
110
|
+
amount: ((i * 7919) % 50000) / 100,
|
|
111
|
+
units: 1 + ((i * 31) % 12),
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Feedback
|
|
118
|
+
|
|
119
|
+
Loading issues…
|
|
120
|
+
|
|
121
|
+
## Example files
|
|
122
|
+
|
|
123
|
+
`Localization.tsx`
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import { reactive } from '@motifx/core';
|
|
127
|
+
import { ButtonGroup, PivotGrid, type PivotGridField } from '@motifx-community/ui';
|
|
128
|
+
import { makeSales, type Sale } from './sales';
|
|
129
|
+
|
|
130
|
+
const sales = makeSales(20000);
|
|
131
|
+
|
|
132
|
+
const fields: PivotGridField<Sale>[] = [
|
|
133
|
+
{ field: 'region', title: 'Region', area: 'row' },
|
|
134
|
+
{ field: 'date', title: 'Date', type: 'date', area: 'column', groupInterval: ['year', 'quarter', 'month'], expanded: true },
|
|
135
|
+
{ field: 'amount', title: 'Amount', type: 'number', area: 'data', summaryType: 'sum', format: { maximumFractionDigits: 0 } },
|
|
136
|
+
];
|
|
137
|
+
|
|
138
|
+
const LOCALES = [
|
|
139
|
+
{ value: 'en-US', text: 'English' },
|
|
140
|
+
{ value: 'tr-TR', text: 'Türkçe' },
|
|
141
|
+
{ value: 'de-DE', text: 'Deutsch' },
|
|
142
|
+
];
|
|
143
|
+
|
|
144
|
+
/** The locale of the numbers and the month names, and strings of this pivot's own. */
|
|
145
|
+
export default function Localization() {
|
|
146
|
+
const s = reactive({ locale: 'en-US' });
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<>
|
|
150
|
+
<ButtonGroup label="Locale" items={LOCALES} x-model={() => s.locale} />
|
|
151
|
+
<PivotGrid
|
|
152
|
+
class="pg-localization"
|
|
153
|
+
style="block-size: 16rem"
|
|
154
|
+
data={sales}
|
|
155
|
+
fields={fields}
|
|
156
|
+
locale={() => s.locale}
|
|
157
|
+
texts={{ pivotQuarter: 'Quarter {quarter}', pivotTotal: 'All of {member}', pivotGrandTotal: 'Every region' }}
|
|
158
|
+
label="Sales by region and month"
|
|
159
|
+
/>
|
|
160
|
+
</>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
`sales.ts`
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
export type Sale = { id: number; region: string; city: string; product: string; date: string; amount: number; units: number };
|
|
169
|
+
|
|
170
|
+
const PLACES: [string, string][] = [
|
|
171
|
+
['Marmara', 'İstanbul'],
|
|
172
|
+
['Marmara', 'Bursa'],
|
|
173
|
+
['Central Anatolia', 'Ankara'],
|
|
174
|
+
['Central Anatolia', 'Konya'],
|
|
175
|
+
['Aegean', 'İzmir'],
|
|
176
|
+
['Aegean', 'Muğla'],
|
|
177
|
+
['Black Sea', 'Trabzon'],
|
|
178
|
+
['Mediterranean', 'Antalya'],
|
|
179
|
+
];
|
|
180
|
+
const PRODUCTS = ['Tea', 'Coffee', 'Hazelnuts', 'Figs', 'Olive oil'];
|
|
181
|
+
|
|
182
|
+
/** Sales spread over the places, the products and the days of 2024 and 2025; the same rows every time. */
|
|
183
|
+
export function makeSales(count: number): Sale[] {
|
|
184
|
+
return Array.from({ length: count }, (_, i) => {
|
|
185
|
+
const [region, city] = PLACES[(i * 7) % PLACES.length];
|
|
186
|
+
const day = new Date(2024, 0, 1 + ((i * 13) % 731));
|
|
187
|
+
return {
|
|
188
|
+
id: i + 1,
|
|
189
|
+
region,
|
|
190
|
+
city,
|
|
191
|
+
product: PRODUCTS[(i * 3) % PRODUCTS.length],
|
|
192
|
+
date: `${day.getFullYear()}-${String(day.getMonth() + 1).padStart(2, '0')}-${String(day.getDate()).padStart(2, '0')}`,
|
|
193
|
+
amount: ((i * 7919) % 50000) / 100,
|
|
194
|
+
units: 1 + ((i * 31) % 12),
|
|
195
|
+
};
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
`RightToLeft.tsx`
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
import { PivotGrid, type PivotGridField } from '@motifx-community/ui';
|
|
204
|
+
import { makeSales, type Sale } from './sales';
|
|
205
|
+
|
|
206
|
+
const sales = makeSales(20000);
|
|
207
|
+
|
|
208
|
+
const fields: PivotGridField<Sale>[] = [
|
|
209
|
+
{ field: 'region', title: 'Region', area: 'row', expanded: true },
|
|
210
|
+
{ field: 'city', title: 'City', area: 'row' },
|
|
211
|
+
{ field: 'date', title: 'Date', type: 'date', area: 'column', groupInterval: ['year', 'quarter'], expanded: true },
|
|
212
|
+
{ field: 'amount', title: 'Amount', type: 'number', area: 'data', summaryType: 'sum', format: { maximumFractionDigits: 0 } },
|
|
213
|
+
];
|
|
214
|
+
|
|
215
|
+
/** A pivot on a right-to-left page: the row headers stand at the right, and Left and Right are swapped. */
|
|
216
|
+
export default function RightToLeft() {
|
|
217
|
+
return (
|
|
218
|
+
<div dir="rtl" style="inline-size: 100%">
|
|
219
|
+
<PivotGrid class="pg-rtl" style="block-size: 20rem" data={sales} fields={fields} label="Sales by region and quarter, right to left" />
|
|
220
|
+
</div>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
```
|