@abpjs/ui 0.2.0-next.40 → 0.2.0-next.42

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 CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0-next.42
4
+
5
+ A prerelease under npm's `next` tag.
6
+
7
+ - `ColumnMatcher`, matching a file's columns to fields before an import: one row per column with its header and first
8
+ values, then where it goes (a field there already, a new field named in place with its type, or nowhere) and the
9
+ host's own controls (`renderExtra`); a line counts them ("5 columns: 1 new, 3 matched, 1 skipped") and says what must
10
+ be fixed (a field picked twice, a new field without a name, two new fields with one name). Controlled; words through
11
+ `labels`. A column turned into a new field starts on the type its values suggest (`typeOf`).
12
+ - Helpers: `guessType(values)` (integer, decimal, boolean, date, timestamp, uuid or text), `guessTargets(headers,
13
+ samples, fields?)` (a header to the field of that name or label, ignoring case and spacing, else a new field),
14
+ `columnCounts` and `columnProblems`; `ColumnTarget` is `{kind: 'skip'}`, `{kind: 'field', name}` or
15
+ `{kind: 'new', name, type}`.
16
+
17
+ ## 0.2.0-next.41
18
+
19
+ A prerelease under npm's `next` tag.
20
+
21
+ - `Field`: `optionalText` ("Optional") reads apart from its label: a space before it, quieter and not bold. It ran into
22
+ the label ("MessageOptional").
23
+
3
24
  ## 0.2.0-next.40
4
25
 
5
26
  A prerelease under npm's `next` tag.
package/dist/index.d.ts CHANGED
@@ -1775,6 +1775,111 @@ declare function readTable(file: File): Promise<{
1775
1775
  sheet?: Pick<XlsxSheet, 'sheet' | 'sheets'>;
1776
1776
  }>;
1777
1777
 
1778
+ /** What a column of an imported file becomes: left out, one of the fields there already, or a new field. */
1779
+ type ColumnTarget = {
1780
+ kind: 'skip';
1781
+ } | {
1782
+ kind: 'field';
1783
+ name: string;
1784
+ } | {
1785
+ kind: 'new';
1786
+ name: string;
1787
+ type: string;
1788
+ };
1789
+ /** A field a column can go into. */
1790
+ interface ColumnField {
1791
+ name: string;
1792
+ type?: string;
1793
+ label?: string;
1794
+ }
1795
+ /** The kind of value a column holds, as guessed from its values. */
1796
+ type ValueKind = 'integer' | 'decimal' | 'boolean' | 'date' | 'timestamp' | 'uuid' | 'text';
1797
+ /**
1798
+ * The kind of a column's values: the first of integer, decimal, boolean, date (yyyy-MM-dd), timestamp or uuid that every
1799
+ * non-empty value fits, an integer column with a decimal in it being decimal; text otherwise, or when there's nothing.
1800
+ */
1801
+ declare function guessType(values: string[]): ValueKind;
1802
+ /** A header as a key to compare: lower case, without spaces, dashes or underscores. */
1803
+ declare const headerKey: (text: string) => string;
1804
+ /**
1805
+ * Each column's likely target: the field whose name or label is the header (ignoring case and spacing), each field used
1806
+ * once; else, when new fields are allowed, a new field named after the header with the type its values suggest
1807
+ * (`typeOf` maps a guessed kind to the host's type); else skipped.
1808
+ */
1809
+ declare function guessTargets(headers: string[], samples: string[][], fields?: ColumnField[], options?: {
1810
+ allowNew?: boolean;
1811
+ typeOf?: (kind: ValueKind) => string;
1812
+ nameOf?: (header: string, index: number) => string;
1813
+ }): ColumnTarget[];
1814
+ /** How many columns become new fields, go into fields there already, and are left out. */
1815
+ declare function columnCounts(targets: ColumnTarget[]): {
1816
+ total: number;
1817
+ created: number;
1818
+ matched: number;
1819
+ skipped: number;
1820
+ };
1821
+ /** Problems a host should refuse before importing: a field chosen twice, a new field without a name, or two new fields with one name. */
1822
+ declare function columnProblems(targets: ColumnTarget[]): {
1823
+ twice: string[];
1824
+ unnamed: number[];
1825
+ sameName: string[];
1826
+ };
1827
+
1828
+ interface ColumnMatcherLabels {
1829
+ /** The table's name. */
1830
+ title: string;
1831
+ column: string;
1832
+ samples: string;
1833
+ target: string;
1834
+ /** "Field for {column}". */
1835
+ targetFor: string;
1836
+ newField: string;
1837
+ skip: string;
1838
+ newName: string;
1839
+ newType: string;
1840
+ /** Under the table: "{total} columns: {created} new, {matched} matched, {skipped} skipped" (ICU plurals). */
1841
+ summary: string;
1842
+ /** A field picked for two columns: "{field} is picked twice". */
1843
+ twice: string;
1844
+ /** A new field without a name. */
1845
+ unnamed: string;
1846
+ /** Two new fields with one name: "Two new fields are called {name}". */
1847
+ sameName: string;
1848
+ }
1849
+ interface ColumnMatcherProps {
1850
+ /** The file's header row. */
1851
+ headers: string[];
1852
+ /** Its first rows, as `readTable` gives them; two or three values of each column are shown. */
1853
+ samples: string[][];
1854
+ /** The fields there already (an existing table's, or a record's own); absent, every column is new or skipped. */
1855
+ fields?: ColumnField[];
1856
+ /** Whether a column may become a new field (default: when there are no fields). */
1857
+ allowNew?: boolean;
1858
+ /** The types a new field can have, in the host's words. */
1859
+ types: {
1860
+ value: string;
1861
+ label: string;
1862
+ }[];
1863
+ /** The host's type for a kind of value (`guessType`), for a column turned into a new field; the first type when absent or unknown. */
1864
+ typeOf?: (kind: ValueKind) => string;
1865
+ /** Each column's target, in the headers' order (`guessTargets` makes a first guess). */
1866
+ value: ColumnTarget[];
1867
+ onChange: (value: ColumnTarget[]) => void;
1868
+ /** The host's own controls for a column, at the end of its row ("key", "sensitive"). */
1869
+ renderExtra?: (index: number, target: ColumnTarget) => ReactNode;
1870
+ /** The extra column's heading, when `renderExtra` is given. */
1871
+ extraHeader?: ReactNode;
1872
+ disabled?: boolean;
1873
+ labels?: Partial<ColumnMatcherLabels>;
1874
+ }
1875
+ /**
1876
+ * Matching a file's columns to fields before an import: one row per column with its header and first values, then
1877
+ * where it goes (a field there already, a new field named in place with its type, or nowhere), then the host's own
1878
+ * controls; a line under it counts them and says what must be fixed (a field picked twice, a new field without a name,
1879
+ * two new fields with one name). Controlled: the host keeps the targets and refuses an import with problems.
1880
+ */
1881
+ declare function ColumnMatcher({ headers, samples, fields, allowNew, types, typeOf, value, onChange, renderExtra, extraHeader, disabled, labels: given }: ColumnMatcherProps): react.JSX.Element;
1882
+
1778
1883
  declare const TRACKS = 60;
1779
1884
  /** Width presets in tracks: half, two-thirds, full. */
1780
1885
  declare const PRESETS: {
@@ -3462,4 +3567,4 @@ interface TooltipProps extends Omit<Tooltip$1.RootProps, 'children'> {
3462
3567
  */
3463
3568
  declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLDivElement>>;
3464
3569
 
3465
- export { ABP_UI_VERSION, AbpApiError, type AbpBrand, type AbpHost, type AbpLabels, type AbpLabelsInput, type AbpListOptions, AbpProvider, type AbpProviderProps, type AbpSystemOptions, AddButton, type AddButtonProps, type ApiQuery, AppLink, type AppLinkProps, AppShell, type AppShellBrand, type AppShellNavItem, type AppShellNavSection, type AppShellPlace, type AppShellProps, type AppShellSidebar, type AreaTexts, type Arrival, ArriveOnChange, type ArriveOnChangeProps, AttentionChip, type AttentionChipProps, type AvatarPerson, AvatarStack, type AvatarStackProps, type BoardItem, Bone, type BoneProps, type BreadcrumbItem, Breadcrumbs, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CalendarGrid, type CalendarGridProps, type CalendarItem, type CardDates, CategoryProgress, type CategoryProgressProps, type CelebrateTarget, Chart, type ChartProps, type ChartSeries, CheckboxField, type CheckboxFieldProps, Collapse, type CollapseProps, type ColorMode, ColorModeProvider, ColorModeToggle, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmOptions, ConfirmProvider, CountBadge, type CountBadgeProps, Counter, type CounterProps, DEFAULT_PAGE_SIZE, DashboardGrid, type DashboardGridProps, DataTable, type DataTableColumn, type DataTableProps, type DataTableSelection, type DataTableSort, type Direction, DirectionalIcon, DropHint, type DropHintProps, type DropZoneOptions, type DropZoneState, type DroppedFile, EMPTY_VALUE, EmotionRegistry, type EmptyArt, EmptyArtDrawing, type EmptyIllustration, EmptyState, type EmptyStateProps, FadeIn, type FadeInProps, Field, type FieldProps, FileDropArea, type FileDropAreaProps, FormDialog, type FormDialogProps, FormField, type GridItem, GroupPicker, Highlight, HighlightText, type HostEventHandler, type HostEvents, type HostFile, type HostLanguage, HostProvider, type HostRequest, type HostRequestInit, type HostRequestOptions, type HostScope, HostSlot, IconButton, type IconButtonProps, IconTile, type IconTileProps, Indicator, type IndicatorProps, InlineAlert, type InlineAlertProps, KanbanBoard, type KanbanBoardProps, type KanbanColumn, type KanbanItem, type KanbanLane, type KanbanMove, type LinkComponent, ListFooter, type ListPage, type ListQuery, type ListSource, type ListState, Loading, type LoadingProps, LoadingState, MotionProvider, type MotionSetting, type MotionState, type NameSuggestion, type NamesValue, Nudge, type NudgeProps, PageHeader, type PageHeaderProps, PageIllustration, PageTitleProvider, Pagination, type PaginationForm, type PaginationProps, Panel, type PanelProps, PanelTone, type Particle, PathChips, type PathChipsProps, PersonChip, type PersonChipProps, PersonPicker, type PickerGroup, type PickerLabels, type PickerPerson, type PlacedCard, PluginTextsProvider, type Pose, Presence, PresenceItem, type PresenceItemProps, PresenceList, type PresenceListProps, type PresenceProps, Pressable, type PressableProps, PreviewCard, type PreviewCardProps, PriorityMark, type PriorityMarkProps, type PropertyItem, PropertyList, type PropertyListProps, type QueryConditionJson, type QueryExportFormat, type QueryExportOptions, type QueryExportSeparator, type QueryField, type QueryGroup, type QueryJson, type QueryListLabels, type QueryNodeJson, type QueryRow, type QuerySuggestion, type QuerySuggestions, type QueryValueEditor, QueryableList, type QueryableListError, type QueryableListExport, type QueryableListProps, type QueryableListState, type QueryableListView, type QueueProgress, RecordKey, type RecordKeyProps, type RegisterSlotSave, Reveal, RevealItem, type RevealItemProps, type RevealProps, RowMenu, type RowMenuEntry, type RowMenuItem, type RowMenuProps, SHOWN, STEP_UP_REQUIRED, STRONG_FACTOR_REQUIRED, SaveBar, type SaveBarProps, type Scale, SearchInput, type SearchInputProps, SearchPicker, type SearchPickerMessages, type SearchPickerProps, type SectionMove, SegmentedControl, type SegmentedControlProps, type SegmentedItem, SelectField, type SelectFieldProps, type SelectOption, type ServerInsertedHTML, type SettingsArea, SettingsLayout, type SettingsLayoutProps, type SettingsPage, type SettingsSection, SlideItem, type SlideItemProps, SlideList, type SlideListProps, type SlotSave, type SortDirection, type SortableSection, SortableSections, type SortableSectionsProps, type StatusCategory, StatusPill, type StatusPillProps, type StatusTone, StepUpDialog, type StepUpHandler, type StepUpNeed, Swap, type SwapProps, SwitchField, type SwitchFieldProps, TITLE_SEPARATOR, TextBone, type TextBoneProps, TextSlot, type TextSlotProps, type TimelineCardItem, TimelineCards, type TimelineCardsProps, TimelineChart, type TimelineChartProps, type TimelineItem, type TimelineRow, type TimelineScale, type TitleParts, Toaster, Tooltip, type TooltipProps, TranslatedInput, type TranslatedInputProps, type TranslationsLabels, UPLOADS_AT_ONCE, type UploadJob, UploadList, type UploadListProps, type UploadRow, type UploadState, TRACKS as WIDGET_TRACKS, PRESETS as WIDGET_WIDTHS, WidgetBoard, type WidgetBoardLabels, type WidgetBoardProps, XLSX_TYPE, XlsxError, type XlsxProblem, type XlsxSheet, abpConfig, abpListParams, abpListSource, appendAt, arriveCss, asMotionSetting, avatarPalette, basicConditions, boneWidth, burst, compactLayout, compareOrdinal, composeTitle, covers, createAbpSystem, createAreaTexts, createHostEvents, createHostRequest, createPasskey, curves, defaultBrand, defaultLabels, defaultPickerLabels, defaultQueryListLabels, defaultTranslationsLabels, directionOf, droppedFiles, emptyQuery, errorText, fileNameOf, findSettingsPage, folderOf, foldersFor, formatDateTime, formatMessage, formatNumber, fromTwelve, getPasskey, ghostCss, groupKey, guessSeparator, heavierFirst, hiddenPose, inSections, isStepUp, looksLikeCode, durations as motionDurations, needsStepUp, notify, pageCount, pageList, pagesShown, parseCsv, partsOf, passkeysSupported, pastedName, personLabel, placeCards, placeItem, priorityLevel, progressOf, readAbpError, readEvents, readTable, readXlsx, refusal, remapCsv, renumber, requestStepUp, setStepUpHandler, settingsArea, shineCss, springs, staggerDelay, stepUpNeedOf, tableKind, targetOf, toStart, toaster, useAbpLabels, useAbpLocale, useAbpTimeZone, useApiAction, useApiDownload, useApiQuery, useAreaEvents, useAreaListSource, useAreaRequest, useArriving, useCan, useCelebrate, useColorMode, useConfirm, useDropZone, useFilesOverPage, useFormatters, useHost, useHostLanguages, useLinkComponent, useListState, useLoading, useMe, useMotionSetting, useNames, useNavigate, useOptionalHost, usePageDrop, usePageTitle, usePageTitleParts, usePageTitleSite, usePastedFiles, usePluginTexts, useProductName, useSettledValue, useSlotSaves, useTokenVar, writeCsv };
3570
+ export { ABP_UI_VERSION, AbpApiError, type AbpBrand, type AbpHost, type AbpLabels, type AbpLabelsInput, type AbpListOptions, AbpProvider, type AbpProviderProps, type AbpSystemOptions, AddButton, type AddButtonProps, type ApiQuery, AppLink, type AppLinkProps, AppShell, type AppShellBrand, type AppShellNavItem, type AppShellNavSection, type AppShellPlace, type AppShellProps, type AppShellSidebar, type AreaTexts, type Arrival, ArriveOnChange, type ArriveOnChangeProps, AttentionChip, type AttentionChipProps, type AvatarPerson, AvatarStack, type AvatarStackProps, type BoardItem, Bone, type BoneProps, type BreadcrumbItem, Breadcrumbs, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CalendarGrid, type CalendarGridProps, type CalendarItem, type CardDates, CategoryProgress, type CategoryProgressProps, type CelebrateTarget, Chart, type ChartProps, type ChartSeries, CheckboxField, type CheckboxFieldProps, Collapse, type CollapseProps, type ColorMode, ColorModeProvider, ColorModeToggle, type ColumnField, ColumnMatcher, type ColumnMatcherLabels, type ColumnMatcherProps, type ColumnTarget, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmOptions, ConfirmProvider, CountBadge, type CountBadgeProps, Counter, type CounterProps, DEFAULT_PAGE_SIZE, DashboardGrid, type DashboardGridProps, DataTable, type DataTableColumn, type DataTableProps, type DataTableSelection, type DataTableSort, type Direction, DirectionalIcon, DropHint, type DropHintProps, type DropZoneOptions, type DropZoneState, type DroppedFile, EMPTY_VALUE, EmotionRegistry, type EmptyArt, EmptyArtDrawing, type EmptyIllustration, EmptyState, type EmptyStateProps, FadeIn, type FadeInProps, Field, type FieldProps, FileDropArea, type FileDropAreaProps, FormDialog, type FormDialogProps, FormField, type GridItem, GroupPicker, Highlight, HighlightText, type HostEventHandler, type HostEvents, type HostFile, type HostLanguage, HostProvider, type HostRequest, type HostRequestInit, type HostRequestOptions, type HostScope, HostSlot, IconButton, type IconButtonProps, IconTile, type IconTileProps, Indicator, type IndicatorProps, InlineAlert, type InlineAlertProps, KanbanBoard, type KanbanBoardProps, type KanbanColumn, type KanbanItem, type KanbanLane, type KanbanMove, type LinkComponent, ListFooter, type ListPage, type ListQuery, type ListSource, type ListState, Loading, type LoadingProps, LoadingState, MotionProvider, type MotionSetting, type MotionState, type NameSuggestion, type NamesValue, Nudge, type NudgeProps, PageHeader, type PageHeaderProps, PageIllustration, PageTitleProvider, Pagination, type PaginationForm, type PaginationProps, Panel, type PanelProps, PanelTone, type Particle, PathChips, type PathChipsProps, PersonChip, type PersonChipProps, PersonPicker, type PickerGroup, type PickerLabels, type PickerPerson, type PlacedCard, PluginTextsProvider, type Pose, Presence, PresenceItem, type PresenceItemProps, PresenceList, type PresenceListProps, type PresenceProps, Pressable, type PressableProps, PreviewCard, type PreviewCardProps, PriorityMark, type PriorityMarkProps, type PropertyItem, PropertyList, type PropertyListProps, type QueryConditionJson, type QueryExportFormat, type QueryExportOptions, type QueryExportSeparator, type QueryField, type QueryGroup, type QueryJson, type QueryListLabels, type QueryNodeJson, type QueryRow, type QuerySuggestion, type QuerySuggestions, type QueryValueEditor, QueryableList, type QueryableListError, type QueryableListExport, type QueryableListProps, type QueryableListState, type QueryableListView, type QueueProgress, RecordKey, type RecordKeyProps, type RegisterSlotSave, Reveal, RevealItem, type RevealItemProps, type RevealProps, RowMenu, type RowMenuEntry, type RowMenuItem, type RowMenuProps, SHOWN, STEP_UP_REQUIRED, STRONG_FACTOR_REQUIRED, SaveBar, type SaveBarProps, type Scale, SearchInput, type SearchInputProps, SearchPicker, type SearchPickerMessages, type SearchPickerProps, type SectionMove, SegmentedControl, type SegmentedControlProps, type SegmentedItem, SelectField, type SelectFieldProps, type SelectOption, type ServerInsertedHTML, type SettingsArea, SettingsLayout, type SettingsLayoutProps, type SettingsPage, type SettingsSection, SlideItem, type SlideItemProps, SlideList, type SlideListProps, type SlotSave, type SortDirection, type SortableSection, SortableSections, type SortableSectionsProps, type StatusCategory, StatusPill, type StatusPillProps, type StatusTone, StepUpDialog, type StepUpHandler, type StepUpNeed, Swap, type SwapProps, SwitchField, type SwitchFieldProps, TITLE_SEPARATOR, TextBone, type TextBoneProps, TextSlot, type TextSlotProps, type TimelineCardItem, TimelineCards, type TimelineCardsProps, TimelineChart, type TimelineChartProps, type TimelineItem, type TimelineRow, type TimelineScale, type TitleParts, Toaster, Tooltip, type TooltipProps, TranslatedInput, type TranslatedInputProps, type TranslationsLabels, UPLOADS_AT_ONCE, type UploadJob, UploadList, type UploadListProps, type UploadRow, type UploadState, type ValueKind, TRACKS as WIDGET_TRACKS, PRESETS as WIDGET_WIDTHS, WidgetBoard, type WidgetBoardLabels, type WidgetBoardProps, XLSX_TYPE, XlsxError, type XlsxProblem, type XlsxSheet, abpConfig, abpListParams, abpListSource, appendAt, arriveCss, asMotionSetting, avatarPalette, basicConditions, boneWidth, burst, columnCounts, columnProblems, compactLayout, compareOrdinal, composeTitle, covers, createAbpSystem, createAreaTexts, createHostEvents, createHostRequest, createPasskey, curves, defaultBrand, defaultLabels, defaultPickerLabels, defaultQueryListLabels, defaultTranslationsLabels, directionOf, droppedFiles, emptyQuery, errorText, fileNameOf, findSettingsPage, folderOf, foldersFor, formatDateTime, formatMessage, formatNumber, fromTwelve, getPasskey, ghostCss, groupKey, guessSeparator, guessTargets, guessType, headerKey, heavierFirst, hiddenPose, inSections, isStepUp, looksLikeCode, durations as motionDurations, needsStepUp, notify, pageCount, pageList, pagesShown, parseCsv, partsOf, passkeysSupported, pastedName, personLabel, placeCards, placeItem, priorityLevel, progressOf, readAbpError, readEvents, readTable, readXlsx, refusal, remapCsv, renumber, requestStepUp, setStepUpHandler, settingsArea, shineCss, springs, staggerDelay, stepUpNeedOf, tableKind, targetOf, toStart, toaster, useAbpLabels, useAbpLocale, useAbpTimeZone, useApiAction, useApiDownload, useApiQuery, useAreaEvents, useAreaListSource, useAreaRequest, useArriving, useCan, useCelebrate, useColorMode, useConfirm, useDropZone, useFilesOverPage, useFormatters, useHost, useHostLanguages, useLinkComponent, useListState, useLoading, useMe, useMotionSetting, useNames, useNavigate, useOptionalHost, usePageDrop, usePageTitle, usePageTitleParts, usePageTitleSite, usePastedFiles, usePluginTexts, useProductName, useSettledValue, useSlotSaves, useTokenVar, writeCsv };