dinocollab-core 2.2.2 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lab/data-surface/index.js +1 -1
- package/dist/src/filter-bar/components/filter-input.units.js +1 -1
- package/dist/src/filter-bar/components/filter-input.units.js.map +1 -1
- package/dist/src/filter-bar/components/filter-menu.js +1 -1
- package/dist/src/filter-bar/components/filter-menu.js.map +1 -1
- package/dist/src/filter-bar/components/filter-sort.js +1 -1
- package/dist/src/filter-bar/components/filter-sort.js.map +1 -1
- package/dist/src/filter-bar/helpers.js +1 -1
- package/dist/src/filter-bar/helpers.js.map +1 -1
- package/dist/src/filter-bar/index.create.js +1 -1
- package/dist/src/filter-bar/index.create.js.map +1 -1
- package/dist/src/filter-bar/index.dino.js +1 -1
- package/dist/src/filter-bar/index.dino.js.map +1 -1
- package/dist/src/form/modal-wrapper.js +1 -1
- package/dist/src/form/modal-wrapper.js.map +1 -1
- package/dist/src/lab/data-surface/button-switch.js +1 -1
- package/dist/src/lab/data-surface/button-switch.js.map +1 -1
- package/dist/src/lab/data-surface/helpers.js +2 -0
- package/dist/src/lab/data-surface/helpers.js.map +1 -0
- package/dist/src/lab/data-surface/index.create.js +1 -1
- package/dist/src/lab/data-surface/index.create.js.map +1 -1
- package/dist/src/lab/data-surface/index.dino.js +1 -1
- package/dist/src/lab/data-surface/index.dino.js.map +1 -1
- package/dist/src/lab/data-surface/ui.units.js +1 -1
- package/dist/src/lab/data-surface/ui.units.js.map +1 -1
- package/dist/src/lab/data-surface/view-grid.js +1 -1
- package/dist/src/lab/data-surface/view-grid.js.map +1 -1
- package/dist/src/lab/data-surface/view-grid.units.js +1 -1
- package/dist/src/lab/data-surface/view-grid.units.js.map +1 -1
- package/dist/src/lab/data-surface/view-list.js +1 -1
- package/dist/src/lab/data-surface/view-list.js.map +1 -1
- package/dist/src/lab/data-surface/view-list.types.js.map +1 -1
- package/dist/src/lab/data-surface/view-list.units.js +1 -1
- package/dist/src/lab/data-surface/view-list.units.js.map +1 -1
- package/dist/src/table/create.table.js +1 -1
- package/dist/src/table/create.table.js.map +1 -1
- package/dist/src/table/toolbar-pannel.js +1 -1
- package/dist/src/table/toolbar-pannel.js.map +1 -1
- package/dist/types/filter-bar/components/filter-sort.types.d.ts +1 -0
- package/dist/types/filter-bar/helpers.d.ts +30 -1
- package/dist/types/filter-bar/index.dino.d.ts +5 -0
- package/dist/types/form/modal-wrapper.d.ts +12 -5
- package/dist/types/lab/data-surface/button-switch.d.ts +4 -3
- package/dist/types/lab/data-surface/helpers.d.ts +26 -0
- package/dist/types/lab/data-surface/index.create.d.ts +19 -3
- package/dist/types/lab/data-surface/index.d.ts +1 -0
- package/dist/types/lab/data-surface/index.dino.d.ts +14 -0
- package/dist/types/lab/data-surface/ui.units.d.ts +6 -1
- package/dist/types/lab/data-surface/view-list.d.ts +7 -0
- package/dist/types/lab/data-surface/view-list.types.d.ts +4 -0
- package/dist/types/lab/data-surface/view-list.units.d.ts +19 -0
- package/dist/types/table/toolbar-pannel.d.ts +15 -6
- package/package.json +1 -1
|
@@ -1,14 +1,21 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import { Breakpoint
|
|
1
|
+
import { FC, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { Breakpoint } from '@mui/material';
|
|
3
|
+
import type { BoxProps, IconButtonProps, PaperProps } from '@mui/material';
|
|
3
4
|
export interface IFormModalWrapperProps extends PropsWithChildren {
|
|
4
|
-
title:
|
|
5
|
+
title: ReactNode;
|
|
5
6
|
size?: Breakpoint;
|
|
6
7
|
fullHeight?: boolean;
|
|
7
|
-
onCloseClick?:
|
|
8
|
+
onCloseClick?: IconButtonProps['onClick'];
|
|
9
|
+
onBackClick?: IconButtonProps['onClick'];
|
|
10
|
+
enableCloseButton?: boolean;
|
|
11
|
+
enableBackButton?: boolean;
|
|
8
12
|
slots?: {
|
|
9
13
|
wrapProps?: Partial<PaperProps>;
|
|
10
|
-
|
|
14
|
+
topBarProps?: BoxProps;
|
|
11
15
|
beforeTitle?: JSX.Element;
|
|
16
|
+
iconSize?: 'small' | 'medium' | 'large';
|
|
17
|
+
iconBackProps?: Partial<IconButtonProps>;
|
|
18
|
+
iconCloseProps?: Partial<IconButtonProps>;
|
|
12
19
|
};
|
|
13
20
|
}
|
|
14
21
|
declare const FormModalWrapper: FC<IFormModalWrapperProps>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DataSurfaceViewMode } from './types';
|
|
3
3
|
type Props = {
|
|
4
4
|
value?: DataSurfaceViewMode;
|
|
5
5
|
onChange?: (value: DataSurfaceViewMode) => void;
|
|
6
6
|
size?: 'sm' | 'md';
|
|
7
7
|
className?: string;
|
|
8
8
|
onlyIcon?: boolean;
|
|
9
|
+
reverse?: boolean;
|
|
9
10
|
};
|
|
10
|
-
declare const ButtonSwitch:
|
|
11
|
+
declare const ButtonSwitch: FC<Props>;
|
|
11
12
|
export default ButtonSwitch;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DataSurfaceViewMode, TPagination } from './types';
|
|
2
|
+
export interface IViewDataQueryParams {
|
|
3
|
+
mode?: DataSurfaceViewMode;
|
|
4
|
+
}
|
|
5
|
+
export declare function setViewModeToURL(mode?: DataSurfaceViewMode, defaultMode?: DataSurfaceViewMode): void;
|
|
6
|
+
export declare function getViewModeFromURL(defaultMode?: DataSurfaceViewMode): DataSurfaceViewMode | undefined;
|
|
7
|
+
export interface IPaginationQueryParams {
|
|
8
|
+
page?: string;
|
|
9
|
+
pageSize?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @en Synchronize pagination to URL query parameters. If pagination equals defaultPagination, remove from URL to keep it clean.
|
|
13
|
+
* @vi Dong bo pagination vao URL query parameters. Neu pagination bang defaultPagination, xoa khoi URL de giu URL sach.
|
|
14
|
+
*
|
|
15
|
+
* @param pagination - Current pagination to sync
|
|
16
|
+
* @param defaultPagination - Default pagination (if current equals this, don't save to URL)
|
|
17
|
+
*/
|
|
18
|
+
export declare function setPaginationToURL(pagination?: TPagination, defaultPagination?: TPagination): void;
|
|
19
|
+
/**
|
|
20
|
+
* @en Retrieve pagination from URL query parameters.
|
|
21
|
+
* @vi Lay pagination tu URL query parameters.
|
|
22
|
+
*
|
|
23
|
+
* @param defaultPagination - Default pagination to return if URL has no pagination
|
|
24
|
+
* @returns Pagination from URL or defaultPagination
|
|
25
|
+
*/
|
|
26
|
+
export declare function getPaginationFromURL(defaultPagination?: TPagination): TPagination | undefined;
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import { DataSurfaceViewMode, LoadingModeRule } from './types';
|
|
2
2
|
import type { BoxProps } from '@mui/material';
|
|
3
|
-
import type { ComponentType, FC } from 'react';
|
|
3
|
+
import type { ComponentType, FC, ReactNode } from 'react';
|
|
4
4
|
import type { TPagination, TDataSurfaceState } from './types';
|
|
5
5
|
import type { IViewGridConfig, IViewGridProps } from './view-grid';
|
|
6
6
|
import type { IViewListConfig, IViewListProps } from './view-list';
|
|
7
7
|
export interface IDataSurfaceSlots {
|
|
8
|
+
footer?: {
|
|
9
|
+
status?: string | ((currentStatus: string) => ReactNode);
|
|
10
|
+
range?: string | ((currentRange: string) => ReactNode);
|
|
11
|
+
};
|
|
8
12
|
}
|
|
9
13
|
export interface IDataSurfaceProps<T> {
|
|
10
14
|
value?: T[];
|
|
11
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated No longer used. Use `viewMode` and `loadMode` props directly instead.
|
|
17
|
+
* Controlled state. When provided, DataSurface becomes fully controlled.
|
|
18
|
+
*/
|
|
12
19
|
state?: TDataSurfaceState;
|
|
13
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated No longer used. Component now uses uncontrolled mode with props.
|
|
22
|
+
* Called on any state change (viewMode, loadMode, page, pageSize).
|
|
23
|
+
*/
|
|
14
24
|
onStateChange?: (state: TDataSurfaceState) => void;
|
|
15
25
|
viewMode?: DataSurfaceViewMode;
|
|
16
26
|
/** Pagination metadata shared by both modes. */
|
|
@@ -28,6 +38,12 @@ export interface IDataSurfaceProps<T> {
|
|
|
28
38
|
loadMode?: LoadingModeRule;
|
|
29
39
|
sx?: BoxProps['sx'];
|
|
30
40
|
slots?: IDataSurfaceSlots;
|
|
41
|
+
/** Enable row selection with checkboxes (List view only). */
|
|
42
|
+
selectable?: boolean;
|
|
43
|
+
/** Array of selected row IDs (controlled). */
|
|
44
|
+
selectedIds?: (string | number)[];
|
|
45
|
+
/** Callback when selection changes. */
|
|
46
|
+
onSelectionChange?: (selectedIds: (string | number)[]) => void;
|
|
31
47
|
}
|
|
32
48
|
export interface IDataSurfaceConfig<T> {
|
|
33
49
|
defaultViewMode?: DataSurfaceViewMode;
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { setViewModeToURL, getViewModeFromURL, setPaginationToURL, getPaginationFromURL } from './helpers';
|
|
2
3
|
import createViewGrid from './view-grid';
|
|
3
4
|
import createDataSurface from './index.create';
|
|
4
5
|
export declare class DinoDataSurFace {
|
|
5
6
|
createDataSurface: typeof createDataSurface;
|
|
6
7
|
createViewGrid: typeof createViewGrid;
|
|
8
|
+
ButtonSwitch: import("react").FC<{
|
|
9
|
+
value?: "grid" | "list" | undefined;
|
|
10
|
+
onChange?: ((value: "grid" | "list") => void) | undefined;
|
|
11
|
+
size?: "sm" | "md" | undefined;
|
|
12
|
+
className?: string | undefined;
|
|
13
|
+
onlyIcon?: boolean | undefined;
|
|
14
|
+
reverse?: boolean | undefined;
|
|
15
|
+
}>;
|
|
7
16
|
createButtonSwitch: () => import("react").FC<{
|
|
8
17
|
value?: "grid" | "list" | undefined;
|
|
9
18
|
onChange?: ((value: "grid" | "list") => void) | undefined;
|
|
10
19
|
size?: "sm" | "md" | undefined;
|
|
11
20
|
className?: string | undefined;
|
|
12
21
|
onlyIcon?: boolean | undefined;
|
|
22
|
+
reverse?: boolean | undefined;
|
|
13
23
|
}>;
|
|
24
|
+
setViewModeToURL: typeof setViewModeToURL;
|
|
25
|
+
getViewModeFromURL: typeof getViewModeFromURL;
|
|
26
|
+
setPaginationToURL: typeof setPaginationToURL;
|
|
27
|
+
getPaginationFromURL: typeof getPaginationFromURL;
|
|
14
28
|
}
|
|
15
29
|
export declare const dinoDataSurface: DinoDataSurFace;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
2
|
import type { BoxProps } from '@mui/material';
|
|
3
3
|
export declare const PanelLoading: FC<BoxProps>;
|
|
4
4
|
export declare const PanelError: FC<{
|
|
@@ -8,11 +8,16 @@ export declare const PanelNoData: FC;
|
|
|
8
8
|
export declare const PanelWaiting: FC;
|
|
9
9
|
export declare const PanelMissingConfig: FC;
|
|
10
10
|
export declare const PanelLoadMore: FC;
|
|
11
|
+
export interface IPanelInfiniteScrollFooterSlots {
|
|
12
|
+
statusText?: string | ((currentStatus: string) => ReactNode);
|
|
13
|
+
rangeText?: string | ((currentRange: string) => ReactNode);
|
|
14
|
+
}
|
|
11
15
|
export interface IPanelInfiniteScrollFooterProps {
|
|
12
16
|
loading?: boolean;
|
|
13
17
|
hasNext?: boolean;
|
|
14
18
|
currentCount: number;
|
|
15
19
|
total?: number;
|
|
20
|
+
slots?: IPanelInfiniteScrollFooterSlots;
|
|
16
21
|
}
|
|
17
22
|
export declare const PanelInfiniteScrollFooter: FC<IPanelInfiniteScrollFooterProps>;
|
|
18
23
|
export interface IPanelPaginationFooterProps {
|
|
@@ -15,6 +15,12 @@ export interface IViewListBase<T> {
|
|
|
15
15
|
virtualizedConfig?: TVirtualizedConfig;
|
|
16
16
|
/** Called when user scrolls near the bottom of the list. Use this to trigger pagination or infinity load. */
|
|
17
17
|
onNearEnd?: () => void;
|
|
18
|
+
/** Enable row selection with checkboxes. */
|
|
19
|
+
selectable?: boolean;
|
|
20
|
+
/** Array of selected row IDs (controlled). */
|
|
21
|
+
selectedIds?: (string | number)[];
|
|
22
|
+
/** Callback when selection changes. */
|
|
23
|
+
onSelectionChange?: (selectedIds: (string | number)[]) => void;
|
|
18
24
|
}
|
|
19
25
|
export interface IViewListConfig<T> extends IViewListBase<T> {
|
|
20
26
|
getterId: TGetterId<T>;
|
|
@@ -34,6 +40,7 @@ export declare function createViewListLoading<T>(ListComponent: ComponentType<IV
|
|
|
34
40
|
export default createViewList;
|
|
35
41
|
export declare const viewListClasses: {
|
|
36
42
|
root: string;
|
|
43
|
+
virtualized: string;
|
|
37
44
|
scrollContainer: string;
|
|
38
45
|
table: string;
|
|
39
46
|
tableHeader: string;
|
|
@@ -8,6 +8,8 @@ export interface IViewListItemProps<T> {
|
|
|
8
8
|
value: T;
|
|
9
9
|
/** Zero-based position of this item in the data array. */
|
|
10
10
|
index: number;
|
|
11
|
+
/** Whether this row is currently selected. */
|
|
12
|
+
selected?: boolean;
|
|
11
13
|
}
|
|
12
14
|
/** Horizontal alignment for list cell content. */
|
|
13
15
|
export type TListAlign = 'left' | 'right' | 'center';
|
|
@@ -38,6 +40,8 @@ export interface TListColumn<T> {
|
|
|
38
40
|
width?: number | string;
|
|
39
41
|
/** Minimum column width in pixels. */
|
|
40
42
|
minWidth?: number;
|
|
43
|
+
/** Maximum column width in pixels. */
|
|
44
|
+
maxWidth?: number;
|
|
41
45
|
/** Flex grow ratio used when no explicit width is set. */
|
|
42
46
|
flex?: number;
|
|
43
47
|
/** Horizontal alignment of the cell content. */
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { ListDensity } from './view-list.types';
|
|
2
|
+
import type { TGetterId } from './types';
|
|
2
3
|
export declare const LIST_HEADER_HEIGHT = 48;
|
|
3
4
|
export declare const LIST_ROW_HEIGHT_BY_DENSITY: Record<ListDensity, number>;
|
|
4
5
|
export declare const LIST_CELL_PADDING_BY_DENSITY: Record<ListDensity, string>;
|
|
6
|
+
/**
|
|
7
|
+
* Custom hook to manage list row selection logic.
|
|
8
|
+
* Handles select all, individual row selection, and indeterminate state.
|
|
9
|
+
*
|
|
10
|
+
* @param value - The array of data items
|
|
11
|
+
* @param getterId - Function to extract unique ID from each row
|
|
12
|
+
* @param selectable - Whether selection is enabled
|
|
13
|
+
* @param selectedIds - Controlled array of selected row IDs
|
|
14
|
+
* @param onSelectionChange - Callback when selection changes
|
|
15
|
+
* @returns Selection state and handlers
|
|
16
|
+
*/
|
|
17
|
+
export declare function useListSelection<T>(value: T[], getterId: TGetterId<T>, selectable: boolean, selectedIds?: (string | number)[], onSelectionChange?: (selectedIds: (string | number)[]) => void): {
|
|
18
|
+
selectedIds: (string | number)[];
|
|
19
|
+
isAllSelected: boolean;
|
|
20
|
+
isSomeSelected: boolean;
|
|
21
|
+
handleToggleAll: () => void;
|
|
22
|
+
handleToggleRow: (rowId: string | number) => void;
|
|
23
|
+
};
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { BoxProps } from '@mui/material';
|
|
3
3
|
import { IBreadcrumbConfig } from '../components';
|
|
4
|
-
export interface
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export interface IToolbarPannelToolbarConfig {
|
|
5
|
+
columns?: boolean;
|
|
6
|
+
filters?: boolean;
|
|
7
|
+
density?: boolean;
|
|
8
|
+
export?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export interface IToolbarPannelProps
|
|
10
|
+
export interface IToolbarPannelProps {
|
|
11
11
|
title?: React.ReactNode;
|
|
12
12
|
titleProps?: BoxProps;
|
|
13
13
|
icon?: React.ReactNode;
|
|
14
14
|
afterTitle?: React.ReactNode;
|
|
15
|
+
searchInclude?: string[];
|
|
16
|
+
visibilityToolbar?: IToolbarPannelToolbarConfig;
|
|
17
|
+
formCreate?: React.ReactNode;
|
|
18
|
+
breadcrumbs?: IBreadcrumbConfig[];
|
|
19
|
+
afterAction?: React.ReactNode;
|
|
20
|
+
belowAction?: React.ReactNode;
|
|
21
|
+
aboveAction?: React.ReactNode;
|
|
22
|
+
actionWrapProps?: BoxProps;
|
|
23
|
+
sx?: BoxProps['sx'];
|
|
15
24
|
}
|
|
16
25
|
declare class ToolbarPannel extends Component<React.PropsWithChildren<IToolbarPannelProps>> {
|
|
17
26
|
render(): import("react/jsx-runtime").JSX.Element;
|