dinocollab-core 2.2.57 → 2.2.58
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/components/index.js +1 -1
- package/dist/filter-bar/index.js +1 -1
- package/dist/form/index.js +1 -1
- package/dist/src/components/confirm-button.js +1 -1
- package/dist/src/components/confirm-button.js.map +1 -1
- package/dist/src/components/copy-to-clipboard.js +1 -1
- package/dist/src/components/copy-to-clipboard.js.map +1 -1
- package/dist/src/components/image-with-fallback.js +1 -1
- package/dist/src/components/image-with-fallback.js.map +1 -1
- package/dist/src/data-surface/index.create.js +1 -1
- package/dist/src/data-surface/index.create.js.map +1 -1
- package/dist/src/data-surface/types.js.map +1 -1
- package/dist/src/data-surface/ui.units.js +1 -1
- package/dist/src/data-surface/ui.units.js.map +1 -1
- package/dist/src/data-surface/view-grid/index.js +1 -1
- package/dist/src/data-surface/view-grid/index.js.map +1 -1
- package/dist/src/data-surface/view-list/column-selector.js +1 -1
- package/dist/src/data-surface/view-list/column-selector.js.map +1 -1
- package/dist/src/data-surface/view-list/helpers.js +1 -1
- package/dist/src/data-surface/view-list/helpers.js.map +1 -1
- package/dist/src/data-surface/view-list/hooks.js +1 -1
- package/dist/src/data-surface/view-list/hooks.js.map +1 -1
- package/dist/src/data-surface/view-list/index.js +1 -1
- package/dist/src/data-surface/view-list/index.js.map +1 -1
- package/dist/src/data-surface/view-list/types.js.map +1 -1
- package/dist/src/filter-bar/filter-input.js +1 -1
- package/dist/src/filter-bar/filter-input.js.map +1 -1
- package/dist/src/filter-bar/filter-input.types.js.map +1 -1
- package/dist/src/filter-bar/filter-input.units.js +1 -1
- package/dist/src/filter-bar/filter-input.units.js.map +1 -1
- package/dist/src/filter-bar/filter-menu.helpers.js +1 -1
- package/dist/src/filter-bar/filter-menu.helpers.js.map +1 -1
- package/dist/src/filter-bar/filter-menu.js +1 -1
- package/dist/src/filter-bar/filter-menu.js.map +1 -1
- package/dist/src/filter-bar/filter-summary.js +1 -1
- package/dist/src/filter-bar/filter-summary.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-boolean.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-boolean.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-number.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-number.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select-with-api.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select-with-api.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select.fallback.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select.fallback.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-select.js.map +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-string.js +1 -1
- package/dist/src/filter-bar/form-field/create-form-field-string.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/filter-bar/types.js.map +1 -1
- package/dist/src/form/create.form-base.js +1 -1
- package/dist/src/form/create.form-base.js.map +1 -1
- package/dist/src/form/create.form-confirm.js +2 -0
- package/dist/src/form/create.form-confirm.js.map +1 -0
- package/dist/src/form/create.input.object.js +1 -1
- package/dist/src/form/create.input.object.js.map +1 -1
- package/dist/src/form/create.input.object.styled.js +1 -1
- package/dist/src/form/create.input.object.styled.js.map +1 -1
- package/dist/src/form/create.input.object.units.js +2 -0
- package/dist/src/form/create.input.object.units.js.map +1 -0
- package/dist/src/form/decorator.form.js +1 -1
- package/dist/src/form/decorator.form.js.map +1 -1
- package/dist/src/form/decorator.units.js +1 -1
- package/dist/src/form/decorator.units.js.map +1 -1
- package/dist/src/form/dino-form.js +1 -1
- package/dist/src/form/dino-form.js.map +1 -1
- package/dist/src/form/error-handler.js +1 -1
- package/dist/src/form/error-handler.js.map +1 -1
- package/dist/src/form/v2/create.date-picker.js +1 -1
- package/dist/src/form/v2/create.date-picker.js.map +1 -1
- package/dist/src/form/v2/create.input.js +1 -1
- package/dist/src/form/v2/create.input.js.map +1 -1
- package/dist/src/form/v2/create.select-simple.js +1 -1
- package/dist/src/form/v2/create.select-simple.js.map +1 -1
- package/dist/src/form/validator.js +1 -1
- package/dist/src/form/validator.js.map +1 -1
- package/dist/src/form/validator.units.js +2 -0
- package/dist/src/form/validator.units.js.map +1 -0
- package/dist/types/components/confirm-button.d.ts +7 -0
- package/dist/types/components/copy-to-clipboard.d.ts +2 -1
- package/dist/types/data-surface/index.create.d.ts +21 -6
- package/dist/types/data-surface/types.d.ts +1 -1
- package/dist/types/data-surface/ui.units.d.ts +2 -2
- package/dist/types/data-surface/view-list/column-selector.d.ts +2 -2
- package/dist/types/data-surface/view-list/helpers.d.ts +9 -4
- package/dist/types/data-surface/view-list/types.d.ts +32 -14
- package/dist/types/filter-bar/filter-input.types.d.ts +2 -2
- package/dist/types/filter-bar/filter-input.units.d.ts +6 -2
- package/dist/types/filter-bar/filter-menu.types.d.ts +2 -2
- package/dist/types/filter-bar/filter-summary.types.d.ts +2 -2
- package/dist/types/filter-bar/form-field/create-form-field-boolean.d.ts +1 -1
- package/dist/types/filter-bar/form-field/create-form-field-number.d.ts +1 -1
- package/dist/types/filter-bar/form-field/create-form-field-select-with-api.d.ts +1 -1
- package/dist/types/filter-bar/form-field/create-form-field-select.d.ts +1 -1
- package/dist/types/filter-bar/form-field/create-form-field-string.d.ts +1 -1
- package/dist/types/filter-bar/index.dino.d.ts +6 -6
- package/dist/types/filter-bar/types.d.ts +4 -2
- package/dist/types/form/create.form-confirm.d.ts +33 -0
- package/dist/types/form/create.input.object.d.ts +15 -57
- package/dist/types/form/create.input.object.styled.d.ts +5 -0
- package/dist/types/form/create.input.object.units.d.ts +88 -0
- package/dist/types/form/decorator.units.d.ts +3 -1
- package/dist/types/form/dino-form.d.ts +2 -2
- package/dist/types/form/error-handler.d.ts +26 -4
- package/dist/types/form/index.d.ts +1 -0
- package/dist/types/form/v2/create.date-picker.d.ts +3 -3
- package/dist/types/form/v2/create.input.d.ts +42 -3
- package/dist/types/form/v2/create.select-simple.d.ts +1 -1
- package/dist/types/form/validator.d.ts +3 -52
- package/dist/types/form/validator.units.d.ts +65 -0
- package/package.json +1 -1
- package/dist/src/form/create.form-comfirm.js +0 -2
- package/dist/src/form/create.form-comfirm.js.map +0 -1
- package/dist/types/form/create.form-comfirm.d.ts +0 -20
|
@@ -54,13 +54,20 @@ export interface TListColumn<T> {
|
|
|
54
54
|
valueGetter?: (value: string, row: T, index: number) => any;
|
|
55
55
|
/** Allow sorting on this column */
|
|
56
56
|
sortable?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Highest priority visibility override.
|
|
59
|
+
* - `true`: Forces the column to always be visible, cannot be hidden, overrides colVisibleable (omitted from selector menu).
|
|
60
|
+
* - `false`: Forces the column to always be hidden, overrides colVisibleable (omitted from selector menu and hidden from table).
|
|
61
|
+
* - `undefined`: Normal behavior governed by `colVisibleable` and `visible` with ColumnSelector.
|
|
62
|
+
*/
|
|
63
|
+
forceVisible?: boolean;
|
|
57
64
|
/** If true, the column is visible in the list @default true */
|
|
58
65
|
visible?: boolean;
|
|
59
|
-
/** Allow toggling visibility of this column via ColumnSelector */
|
|
66
|
+
/** Allow toggling visibility of this column via ColumnSelector @default false */
|
|
60
67
|
colVisibleable?: boolean;
|
|
61
68
|
}
|
|
62
|
-
/** Columns configuration for List view. */
|
|
63
|
-
export type
|
|
69
|
+
/** Columns configuration record for List view. */
|
|
70
|
+
export type TColumnsConfig<T> = Partial<Record<keyof T, Omit<TListColumn<T>, 'field'>>>;
|
|
64
71
|
/**
|
|
65
72
|
* Row density preset for List view.
|
|
66
73
|
* Controls the row height and cell padding.
|
|
@@ -81,8 +88,10 @@ export interface IViewListVirtualizedOptions {
|
|
|
81
88
|
}
|
|
82
89
|
/** Base configuration for List view. */
|
|
83
90
|
export interface IViewListBase<T> {
|
|
84
|
-
/**
|
|
85
|
-
columns?:
|
|
91
|
+
/** Column definitions config for list rows. If not provided, default columns will be derived from data. */
|
|
92
|
+
columns?: TColumnsConfig<T>;
|
|
93
|
+
/** Dynamic runtime state of columns (visibility, priority). */
|
|
94
|
+
columnsState?: TColumnsState<T>;
|
|
86
95
|
/** Row height preset or an explicit row height in pixels. @default 'standard' */
|
|
87
96
|
density?: number | ListDensity;
|
|
88
97
|
/** Spacing between rows in pixels. @default 4 */
|
|
@@ -106,32 +115,41 @@ export interface IViewListBase<T> {
|
|
|
106
115
|
sort?: TFieldSort<T>;
|
|
107
116
|
/** Callback triggered when sorting changes */
|
|
108
117
|
onSortChange?: (sort?: TFieldSort<T>) => void;
|
|
109
|
-
/** Map specifying which managed columns are visible (true) or hidden (false) */
|
|
110
|
-
columnVisibility?: TColumnVisibility<T>;
|
|
111
118
|
}
|
|
112
|
-
/**
|
|
113
|
-
export
|
|
119
|
+
/** Runtime state item for an individual column. */
|
|
120
|
+
export interface IColumnStateItem {
|
|
121
|
+
/** When true, the column is hidden from view. */
|
|
122
|
+
hidden?: boolean;
|
|
123
|
+
/** When true, the column is prioritized and placed at the top. */
|
|
124
|
+
priority?: boolean;
|
|
125
|
+
}
|
|
126
|
+
/** Table-level runtime column state mapping column fields to their state. */
|
|
127
|
+
export type TColumnsState<T> = Partial<Record<keyof T, IColumnStateItem>>;
|
|
114
128
|
/** Factory configuration for ColumnSelector */
|
|
115
129
|
export interface IColumnSelectorConfig<T> {
|
|
116
130
|
/** Unique table key for namespacing localStorage data (required) */
|
|
117
131
|
persistenceKey: string;
|
|
118
|
-
/** Global storage key in localStorage @default 'dino-view-list-column
|
|
132
|
+
/** Global storage key in localStorage @default 'dino-view-list-column' */
|
|
119
133
|
storageKey?: string;
|
|
120
134
|
/** Target listConfig (e.g. DataSurfaceIns.listConfig) */
|
|
121
135
|
config?: IViewListConfig<T>;
|
|
122
136
|
/** Whether the column selector should be hidden */
|
|
123
137
|
hide?: boolean;
|
|
138
|
+
/** Whether column prioritization (starring/pinning to top) is enabled @default false */
|
|
139
|
+
prioritizable?: boolean;
|
|
124
140
|
}
|
|
125
141
|
/** Props for ColumnSelector component */
|
|
126
142
|
export interface IColumnSelectorProps<T> {
|
|
127
|
-
/**
|
|
128
|
-
|
|
129
|
-
/** Callback when column
|
|
130
|
-
onChange?: (model:
|
|
143
|
+
/** Dynamic runtime state of columns (visibility, priority). */
|
|
144
|
+
columnsState?: TColumnsState<T>;
|
|
145
|
+
/** Callback when custom column settings change */
|
|
146
|
+
onChange?: (model: TColumnsState<T>) => void;
|
|
131
147
|
/** Size of IconButton @default 'small' */
|
|
132
148
|
size?: 'small' | 'medium';
|
|
133
149
|
/** Whether the column selector should be hidden */
|
|
134
150
|
hide?: boolean;
|
|
151
|
+
/** Whether column prioritization (starring/pinning to top) is enabled @default false */
|
|
152
|
+
prioritizable?: boolean;
|
|
135
153
|
}
|
|
136
154
|
/** Configuration for List view. */
|
|
137
155
|
export interface IViewListConfig<T> extends IViewListBase<T> {
|
|
@@ -31,8 +31,8 @@ export interface IFilterInputBase {
|
|
|
31
31
|
fullWidth?: boolean;
|
|
32
32
|
}
|
|
33
33
|
export interface IFilterInputConfig<T> extends IFilterInputBase, IFilterInputLayoutSlots {
|
|
34
|
-
/** Enable or disable quick search, @default false */
|
|
35
|
-
enableQuickSearch?: boolean
|
|
34
|
+
/** Enable or disable quick search, or specify default search field @default false */
|
|
35
|
+
enableQuickSearch?: boolean | TFieldType<T>;
|
|
36
36
|
/** Placeholder text for input field */
|
|
37
37
|
placeholder?: string;
|
|
38
38
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
import type { IconButtonProps } from '@mui/material';
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import type { BoxProps, IconButtonProps } from '@mui/material';
|
|
3
3
|
import type { TFieldType, TFilterFieldConfig, TFilterFieldConfigs } from './types';
|
|
4
|
+
export interface IDefaultChipProps extends BoxProps {
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const DefaultChip: import("@emotion/styled").StyledComponent<IDefaultChipProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
4
8
|
export type TInputMatchedField<T> = TFilterFieldConfig<T> & {
|
|
5
9
|
field: TFieldType<T>;
|
|
6
10
|
};
|
|
@@ -36,8 +36,8 @@ export interface IFilterMenuParam<T> extends IFilterMenuSlots {
|
|
|
36
36
|
fields?: TFilterFieldConfigs<T>;
|
|
37
37
|
validation?: IFormValidatorConfig<Partial<TFieldModelValid<T>>>;
|
|
38
38
|
quickSearchHint?: string | ((currentHint: string) => string);
|
|
39
|
-
/** Option to enable or disable quick search @default false */
|
|
40
|
-
enableQuickSearch?: boolean
|
|
39
|
+
/** Option to enable or disable quick search, or specify default search field @default false */
|
|
40
|
+
enableQuickSearch?: boolean | TFieldType<T>;
|
|
41
41
|
/** Option to close the menu after submitting a value @default true */
|
|
42
42
|
closeAfterSubmit?: boolean;
|
|
43
43
|
/** Option to close the menu after clearing a value @default true */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { BoxProps } from '@mui/material';
|
|
2
|
-
import type { TFilterFieldConfigs } from './types';
|
|
2
|
+
import type { TFieldType, TFilterFieldConfigs } from './types';
|
|
3
3
|
/** Configuration parameters passed to `createFilterSummary(config)` factory function */
|
|
4
4
|
export interface IFilterSummaryConfig<T> {
|
|
5
5
|
/** Field configuration schema map */
|
|
6
6
|
fields?: TFilterFieldConfigs<T>;
|
|
7
7
|
/** Option to enable or disable quick search chip in summary @default true */
|
|
8
|
-
enableQuickSearch?: boolean
|
|
8
|
+
enableQuickSearch?: boolean | TFieldType<T>;
|
|
9
9
|
}
|
|
10
10
|
/** Props passed to the generated `FilterSummary` component */
|
|
11
11
|
export interface IFilterSummaryProps<T> {
|
|
@@ -31,7 +31,7 @@ export interface IFormFieldBooleanParam<T> {
|
|
|
31
31
|
* @param params - Static configuration (optional label overrides, optional field config override)
|
|
32
32
|
* @returns A React FC ready to be used as a boolean filter-menu field component
|
|
33
33
|
*/
|
|
34
|
-
declare function createFormFieldBoolean<T>(params?: IFormFieldBooleanParam<T>): FC<IFormFieldBooleanProps<T>>;
|
|
34
|
+
export declare function createFormFieldBoolean<T>(params?: IFormFieldBooleanParam<T>): FC<IFormFieldBooleanProps<T>>;
|
|
35
35
|
export default createFormFieldBoolean;
|
|
36
36
|
/**
|
|
37
37
|
* Creates a `labelFormatter` for use in `summaryConfig`.
|
|
@@ -44,7 +44,7 @@ export interface IFormFieldNumberParam<T> {
|
|
|
44
44
|
* @param params - Static configuration (optional field config override, default operator, step, min, max)
|
|
45
45
|
* @returns A React FC ready to be used as a number filter-menu field component
|
|
46
46
|
*/
|
|
47
|
-
declare function createFormFieldNumber<T>(params?: IFormFieldNumberParam<T>): FC<IFormFieldNumberProps<T>>;
|
|
47
|
+
export declare function createFormFieldNumber<T>(params?: IFormFieldNumberParam<T>): FC<IFormFieldNumberProps<T>>;
|
|
48
48
|
export default createFormFieldNumber;
|
|
49
49
|
/**
|
|
50
50
|
* Creates a labelFormatter for use in summaryConfig.
|
|
@@ -41,6 +41,6 @@ export interface IFormFieldSelectWithApiParam<T> {
|
|
|
41
41
|
* @param params - Static configuration (fetchOptions, debounce settings, etc.)
|
|
42
42
|
* @returns A React FC ready to be used as a filter-menu field component
|
|
43
43
|
*/
|
|
44
|
-
declare function createFormFieldSelectWithApi<T>(params: IFormFieldSelectWithApiParam<T>): FC<IFormFieldSelectWithApiProps<T>>;
|
|
44
|
+
export declare function createFormFieldSelectWithApi<T>(params: IFormFieldSelectWithApiParam<T>): FC<IFormFieldSelectWithApiProps<T>>;
|
|
45
45
|
export default createFormFieldSelectWithApi;
|
|
46
46
|
export declare function formatterSelectWithApi<T = any>(field: TFieldType<T>, storageKey?: string): (param: TValueFormatterParam<T>) => string;
|
|
@@ -46,7 +46,7 @@ export interface IFormFieldSelectParam<T> {
|
|
|
46
46
|
* @param params - Static configuration (option list, optional field config override)
|
|
47
47
|
* @returns A React FC ready to be used as a filter-menu field component
|
|
48
48
|
*/
|
|
49
|
-
declare function createFormFieldSelect<T>(params: IFormFieldSelectParam<T>): FC<IFormFieldSelectProps<T>>;
|
|
49
|
+
export declare function createFormFieldSelect<T>(params: IFormFieldSelectParam<T>): FC<IFormFieldSelectProps<T>>;
|
|
50
50
|
/**
|
|
51
51
|
* Creates a labelFormatter for use in summaryConfig / menuConfig.
|
|
52
52
|
* Formats select field values to their human-readable labels from local storage.
|
|
@@ -25,5 +25,5 @@ export interface IFormFieldStringParam<T> {
|
|
|
25
25
|
* @param params - Static configuration (optional field config override)
|
|
26
26
|
* @returns A React FC ready to be used as a free-text filter-menu field component
|
|
27
27
|
*/
|
|
28
|
-
declare function createFormFieldString<T>(params?: IFormFieldStringParam<T>): FC<IFormFieldStringProps<T>>;
|
|
28
|
+
export declare function createFormFieldString<T>(params?: IFormFieldStringParam<T>): FC<IFormFieldStringProps<T>>;
|
|
29
29
|
export default createFormFieldString;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createFilterBar } from './index.create';
|
|
2
2
|
import { getFilterFromURL, isEmptyFilterState, isFilterStateEqual, removeNullValues, setFilterToURL } from './helpers';
|
|
3
|
+
import { createFormFieldString } from './form-field/create-form-field-string';
|
|
4
|
+
import { createFormFieldNumber, formatterNumber } from './form-field/create-form-field-number';
|
|
5
|
+
import { createFormFieldSelect, formatterSelect } from './form-field/create-form-field-select';
|
|
6
|
+
import { createFormFieldBoolean, formatterBoolean } from './form-field/create-form-field-boolean';
|
|
3
7
|
import { createFormFieldSelectWithFallback } from './form-field/create-form-field-select.fallback';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import createFormFieldSelect, { formatterSelect } from './form-field/create-form-field-select';
|
|
7
|
-
import createFormFieldBoolean, { formatterBoolean } from './form-field/create-form-field-boolean';
|
|
8
|
-
import createFormFieldSelectWithApi, { formatterSelectWithApi } from './form-field/create-form-field-select-with-api';
|
|
9
|
-
import createFormFieldString from './form-field/create-form-field-string';
|
|
8
|
+
import { createFormFieldDateTime, formatterDateTime } from './form-field/create-form-field-datetime';
|
|
9
|
+
import { createFormFieldSelectWithApi, formatterSelectWithApi } from './form-field/create-form-field-select-with-api';
|
|
10
10
|
export declare class DinoFilterBar {
|
|
11
11
|
createFilterBar: typeof createFilterBar;
|
|
12
12
|
createConvertToGraphQL: <TSource extends Record<string, any>, TTarget extends object, U extends object = {}>(state: import("./types").TFilterState<TSource>) => import("./convert-to-graphql").TableFileterConverter<TSource, TTarget, U>;
|
|
@@ -118,10 +118,12 @@ export type TFilterBarConfigs<T> = {
|
|
|
118
118
|
menuConfig?: Omit<IFilterMenuParam<T>, 'fields'>;
|
|
119
119
|
/** Toggle active summary chips bar below the filter bar @default true */
|
|
120
120
|
enableSummary?: boolean;
|
|
121
|
-
/** Toggle quick search pseudo-field in filter menu @default false */
|
|
122
|
-
enableQuickSearch?: boolean
|
|
121
|
+
/** Toggle quick search pseudo-field in filter menu or specify default search field @default false */
|
|
122
|
+
enableQuickSearch?: boolean | TFieldType<T>;
|
|
123
123
|
/** Specific options for Field Sorting behavior */
|
|
124
124
|
sortConfig?: ISortFieldConfig;
|
|
125
|
+
/** Toggle Sort functionality in FilterBar @default true */
|
|
126
|
+
enableSort?: boolean;
|
|
125
127
|
};
|
|
126
128
|
/**
|
|
127
129
|
* Sorting direction for fields ('asc' | 'desc').
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IErrorCommonGetter } from './error-handler';
|
|
2
|
+
import type { ButtonProps } from '@mui/material';
|
|
3
|
+
import type { ComponentType, PropsWithChildren, ReactNode } from 'react';
|
|
4
|
+
export interface IFormConfirmBaseHandlers<T = any> {
|
|
5
|
+
/** Custom extractor for common error messages */
|
|
6
|
+
errorCommonGetter?: IErrorCommonGetter;
|
|
7
|
+
/** Automatically push error message to global alert when submit fails. @default true */
|
|
8
|
+
autoAlertError?: boolean;
|
|
9
|
+
/** Default error message if error cannot be extracted. @default 'An error has occurred, please try again' */
|
|
10
|
+
defaultErrorMessage?: string;
|
|
11
|
+
/** Callback triggered after `onSubmit` successfully completes */
|
|
12
|
+
onSuccess?: (value?: T) => void;
|
|
13
|
+
/** Callback triggered when an error occurs during form submit */
|
|
14
|
+
onError?: (error: any) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface IFormConfirmParam<T = any> extends IFormConfirmBaseHandlers<T> {
|
|
17
|
+
title?: ReactNode;
|
|
18
|
+
content?: (value?: T) => ReactNode;
|
|
19
|
+
colors?: {
|
|
20
|
+
[key in 'yes' | 'no']?: ButtonProps['color'];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface IFormConfirmProps<T = any> extends PropsWithChildren, IFormConfirmBaseHandlers<T> {
|
|
24
|
+
data?: T;
|
|
25
|
+
title?: ReactNode;
|
|
26
|
+
onSubmit: (value?: T) => Promise<void>;
|
|
27
|
+
onCancel?: () => void;
|
|
28
|
+
}
|
|
29
|
+
export interface IFormComfirmState {
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function createFormConfirm<T = any>(param?: IFormConfirmParam<T>): ComponentType<IFormConfirmProps<T>>;
|
|
33
|
+
export default createFormConfirm;
|
|
@@ -2,64 +2,9 @@ import { ComponentType, ReactNode } from 'react';
|
|
|
2
2
|
import { BoxProps } from '@mui/material';
|
|
3
3
|
import { IFormInputBase } from './types';
|
|
4
4
|
import { inputObjectClasses } from './create.input.object.styled';
|
|
5
|
+
import type { IInputObjectFields } from './create.input.object.units';
|
|
5
6
|
export { inputObjectClasses };
|
|
6
|
-
|
|
7
|
-
export interface ISelectOption {
|
|
8
|
-
value: string | number;
|
|
9
|
-
/** Display label for the option. Defaults to value if omitted. */
|
|
10
|
-
label?: string;
|
|
11
|
-
}
|
|
12
|
-
interface INumberInputOptions {
|
|
13
|
-
min?: number;
|
|
14
|
-
max?: number;
|
|
15
|
-
step?: number;
|
|
16
|
-
}
|
|
17
|
-
/** Configuration for an individual field column in an object row. */
|
|
18
|
-
export interface IInputObjectField<J = any> {
|
|
19
|
-
label?: string;
|
|
20
|
-
placeholder?: string;
|
|
21
|
-
/** @default 'string' */
|
|
22
|
-
inputType?: 'string' | 'number' | 'select';
|
|
23
|
-
/** @default [] */
|
|
24
|
-
selectItems?: ISelectOption[] | ((item: Partial<J>) => ISelectOption[]);
|
|
25
|
-
numberOptions?: INumberInputOptions | ((item: Partial<J>) => INumberInputOptions);
|
|
26
|
-
/** @default '' */
|
|
27
|
-
defaultValue?: any;
|
|
28
|
-
/**
|
|
29
|
-
* Determine the flex layout space the field occupies.
|
|
30
|
-
* Can be a number, string, or a function evaluating the current row item values.
|
|
31
|
-
* @default 1
|
|
32
|
-
*/
|
|
33
|
-
flex?: number | string | ((item: Partial<J>) => number | string);
|
|
34
|
-
/**
|
|
35
|
-
* Determine if the field should be disabled.
|
|
36
|
-
* Can be a boolean or a function evaluating the current row item values.
|
|
37
|
-
* @default false
|
|
38
|
-
*/
|
|
39
|
-
disabled?: boolean | ((item: Partial<J>) => boolean);
|
|
40
|
-
/**
|
|
41
|
-
* Determine if the field should be visible.
|
|
42
|
-
* Can be a boolean or a function evaluating the current row item values.
|
|
43
|
-
* If false, the field will not be rendered (returns null).
|
|
44
|
-
* @default true
|
|
45
|
-
*/
|
|
46
|
-
visible?: boolean | ((item: Partial<J>) => boolean);
|
|
47
|
-
/**
|
|
48
|
-
* End icon for the input.
|
|
49
|
-
* Can be a ReactNode or a function evaluating the current row item values.
|
|
50
|
-
* @default undefined
|
|
51
|
-
*/
|
|
52
|
-
endIcon?: ReactNode | ((item: Partial<J>) => ReactNode);
|
|
53
|
-
}
|
|
54
|
-
/** Field configuration map for row item model J. */
|
|
55
|
-
export type IInputObjectFields<J = any> = {
|
|
56
|
-
[key in keyof J]?: IInputObjectField<J>;
|
|
57
|
-
};
|
|
58
|
-
/** Internal row item state wrapper. */
|
|
59
|
-
export interface IInputObjectItem<J = any> {
|
|
60
|
-
id: string;
|
|
61
|
-
values: Partial<J>;
|
|
62
|
-
}
|
|
7
|
+
export type { ISelectOption, INumberInputOptions, IInputObjectField, IInputObjectFields, IInputObjectItem } from './create.input.object.units';
|
|
63
8
|
/** Customizable slots and options for InputObject component. */
|
|
64
9
|
export interface IInputObjectSlots<J = any> {
|
|
65
10
|
/** @default 'Object Registry' */
|
|
@@ -78,6 +23,11 @@ export interface IInputObjectSlots<J = any> {
|
|
|
78
23
|
fields?: IInputObjectFields<J>;
|
|
79
24
|
/** Optional maximum number of object row items allowed. */
|
|
80
25
|
maxItems?: number;
|
|
26
|
+
/**
|
|
27
|
+
* Determine whether to display the column header row above item entries.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
showHeader?: boolean;
|
|
81
31
|
}
|
|
82
32
|
/** Parameters passed to createInputObject factory function. */
|
|
83
33
|
export interface IInputObjectParams<J = any> extends IInputObjectSlots<J> {
|
|
@@ -88,6 +38,14 @@ export interface IInputObjectProps<T = any, J = any> extends IFormInputBase<T, I
|
|
|
88
38
|
onChange?: (value: string) => void;
|
|
89
39
|
fields?: IInputObjectFields<J>;
|
|
90
40
|
maxItems?: number;
|
|
41
|
+
showHeader?: boolean;
|
|
91
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Factory function creating a dynamic Object Form Input Component matching key-value styling.
|
|
45
|
+
* @template T Form Data Model interface.
|
|
46
|
+
* @template J Row Item Model interface.
|
|
47
|
+
* @param params Component configuration parameters and default field definitions.
|
|
48
|
+
* @returns React Component for rendering dynamic object list inputs.
|
|
49
|
+
*/
|
|
92
50
|
export declare function createInputObject<T = any, J = any>(params?: IInputObjectParams<J>): ComponentType<IInputObjectProps<T, J>>;
|
|
93
51
|
export default createInputObject;
|
|
@@ -11,7 +11,12 @@ export declare const inputObjectClasses: {
|
|
|
11
11
|
createBtn: string;
|
|
12
12
|
rowList: string;
|
|
13
13
|
row: string;
|
|
14
|
+
rowAction: string;
|
|
14
15
|
field: string;
|
|
16
|
+
fieldHidden: string;
|
|
17
|
+
columnHeader: string;
|
|
18
|
+
columnHeaderItem: string;
|
|
19
|
+
columnHeaderAction: string;
|
|
15
20
|
deleteBtn: string;
|
|
16
21
|
noDataPanel: string;
|
|
17
22
|
noDataIcon: string;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** Option entry for select input dropdown. */
|
|
3
|
+
export interface ISelectOption {
|
|
4
|
+
value: string | number;
|
|
5
|
+
/** Display label for the option. Defaults to value if omitted. */
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface INumberInputOptions {
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
step?: number;
|
|
12
|
+
}
|
|
13
|
+
/** Configuration for an individual field column in an object row. */
|
|
14
|
+
export interface IInputObjectField<J = any> {
|
|
15
|
+
label?: string;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
/** @default 'string' */
|
|
18
|
+
inputType?: 'string' | 'number' | 'select';
|
|
19
|
+
/** @default [] */
|
|
20
|
+
selectItems?: ISelectOption[] | ((item: Partial<J>) => ISelectOption[]);
|
|
21
|
+
numberOptions?: INumberInputOptions | ((item: Partial<J>) => INumberInputOptions);
|
|
22
|
+
/** @default '' */
|
|
23
|
+
defaultValue?: any;
|
|
24
|
+
/**
|
|
25
|
+
* Determine the flex layout space the field occupies.
|
|
26
|
+
* Can be a number, string, or a function evaluating the current row item values.
|
|
27
|
+
* @default 1
|
|
28
|
+
*/
|
|
29
|
+
flex?: number | string | ((item: Partial<J>) => number | string);
|
|
30
|
+
/**
|
|
31
|
+
* Determine if the field should be disabled.
|
|
32
|
+
* Can be a boolean or a function evaluating the current row item values.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
disabled?: boolean | ((item: Partial<J>) => boolean);
|
|
36
|
+
/**
|
|
37
|
+
* Determine if the field should be visible.
|
|
38
|
+
* Can be a boolean or a function evaluating the current row item values.
|
|
39
|
+
* If false, the field will retain its slot width with hidden visibility.
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
visible?: boolean | ((item: Partial<J>) => boolean);
|
|
43
|
+
/**
|
|
44
|
+
* End icon for the input.
|
|
45
|
+
* Can be a ReactNode or a function evaluating the current row item values.
|
|
46
|
+
* @default undefined
|
|
47
|
+
*/
|
|
48
|
+
endIcon?: ReactNode | ((item: Partial<J>) => ReactNode);
|
|
49
|
+
}
|
|
50
|
+
/** Field configuration map for row item model J. */
|
|
51
|
+
export type IInputObjectFields<J = any> = {
|
|
52
|
+
[key in keyof J]?: IInputObjectField<J>;
|
|
53
|
+
};
|
|
54
|
+
/** Internal row item state wrapper. */
|
|
55
|
+
export interface IInputObjectItem<J = any> {
|
|
56
|
+
id: string;
|
|
57
|
+
values: Partial<J>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Generates a short unique string ID.
|
|
61
|
+
* @returns Unique string ID.
|
|
62
|
+
*/
|
|
63
|
+
export declare const generateUniqueId: () => string;
|
|
64
|
+
/**
|
|
65
|
+
* Constructs an initial default value object for a new row item based on field configurations.
|
|
66
|
+
* @param fields Field configuration map.
|
|
67
|
+
* @returns Initial default value mapping for item model J.
|
|
68
|
+
*/
|
|
69
|
+
export declare function createDefaultItem<J>(fields?: IInputObjectFields<J>): Partial<J>;
|
|
70
|
+
/**
|
|
71
|
+
* Determines whether a row item has no valid user inputs filled out.
|
|
72
|
+
* @param item Row item state wrapper.
|
|
73
|
+
* @returns True if all values are empty strings, null, or undefined.
|
|
74
|
+
*/
|
|
75
|
+
export declare function isRowEmpty<J>(item?: IInputObjectItem<J>): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Safely parses raw input data (JSON string or array of objects) into an item state array.
|
|
78
|
+
* Preserves existing item IDs when available to prevent React component unmounting and focus loss.
|
|
79
|
+
* @param raw Raw input data from form model or default props.
|
|
80
|
+
* @param existingItems Current item state array to preserve stable IDs.
|
|
81
|
+
* @returns Array of parsed row items with stable unique IDs.
|
|
82
|
+
*/
|
|
83
|
+
export declare function parseObjectData<J>(raw: any, existingItems?: IInputObjectItem<J>[]): IInputObjectItem<J>[];
|
|
84
|
+
/**
|
|
85
|
+
* Serializes an array of row items back into a JSON string format, filtering out empty entries.
|
|
86
|
+
* Converts string values to numbers if the field config specifies inputType 'number'.
|
|
87
|
+
*/
|
|
88
|
+
export declare function serializeObjectData<J>(items: IInputObjectItem<J>[], fields?: IInputObjectFields<J>): string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { BoxProps, ButtonProps } from '@mui/material';
|
|
3
3
|
import { IFormBaseContext } from './types';
|
|
4
|
+
import { extractErrorMessages, formatDisplayErrorMessage } from './error-handler';
|
|
5
|
+
export { extractErrorMessages, formatDisplayErrorMessage };
|
|
4
6
|
export interface IFormFooterSlots {
|
|
5
7
|
after?: React.ReactNode;
|
|
6
8
|
before?: React.ReactNode;
|
|
@@ -13,7 +15,7 @@ export interface IFormFooterProps<T = any> extends Omit<BoxProps, 'slots'> {
|
|
|
13
15
|
interface IInternalFormFooterProps<T = any> extends IFormFooterProps<T> {
|
|
14
16
|
slots?: IFormFooterSlots;
|
|
15
17
|
errorMessage?: string;
|
|
18
|
+
remainingErrorCount?: number;
|
|
16
19
|
onCancel?: ButtonProps['onClick'];
|
|
17
20
|
}
|
|
18
21
|
export declare const FormFooter: FC<IInternalFormFooterProps<any>>;
|
|
19
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import FormValidator from './validator';
|
|
3
|
-
import
|
|
3
|
+
import createFormConfirm from './create.form-confirm';
|
|
4
4
|
import createCheckbox from './create.checkbox';
|
|
5
5
|
import createInputFile from './create.input.file';
|
|
6
6
|
import createDatePickerV2 from './v2/create.date-picker';
|
|
@@ -23,7 +23,7 @@ export declare class DinoForm {
|
|
|
23
23
|
FormValidator: typeof FormValidator;
|
|
24
24
|
validator: <T>(configs: import("./validator").IFormValidatorConfig<T>) => FormValidator<T>;
|
|
25
25
|
createFormBase: <T>(config?: import("./create.form-base").IFormBaseConfig<T> | undefined) => import("./create.form-base").IFormBaseResult<T>;
|
|
26
|
-
|
|
26
|
+
createFormConfirm: typeof createFormConfirm;
|
|
27
27
|
createFormGridLayout: <T>(params: import("./create.form-grid-layout").IFormGridLayoutParams<T>) => import("react").ComponentType<import("./create.form-grid-layout").IFormGridLayoutProps<T>>;
|
|
28
28
|
createDecoratorForm: <T>(configClass?: any, config?: Partial<Omit<import("./decorator.form").IDecoratorFormProps<T>, "configClass">> | undefined) => import("react").ComponentType<import("./decorator.form").IDecoratorFormProps<T>>;
|
|
29
29
|
createColorPicker: typeof createColorPicker;
|
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
import { IPartialError } from './validator';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Unpacks a raw error message string into a list of human-readable messages.
|
|
4
|
+
* If the string is a serialized JSON object/array (e.g. `{"duration":"Duration is required."}`),
|
|
5
|
+
* all string values inside are extracted as individual error messages.
|
|
6
|
+
*/
|
|
7
|
+
export declare const extractErrorMessages: (message?: string) => string[];
|
|
8
|
+
/**
|
|
9
|
+
* Safely extracts a clean human-readable error string (1st message only).
|
|
10
|
+
*/
|
|
11
|
+
export declare const formatDisplayErrorMessage: (message?: string) => string;
|
|
12
|
+
export interface IFormDisplayError {
|
|
13
|
+
firstMessage: string;
|
|
14
|
+
remainingCount: number;
|
|
15
|
+
allMessages: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Extracts and flattens all error messages from IPartialError into a structured summary for form display.
|
|
19
|
+
* Unpacks any serialized JSON object strings into individual errors.
|
|
20
|
+
*/
|
|
21
|
+
export declare const extractFormDisplayErrors: <T = any>(messageErrors?: IPartialError<T> | undefined) => IFormDisplayError;
|
|
22
|
+
export type IErrorGetter<T> = (error: any, currentErrors?: {
|
|
23
|
+
[key in keyof T]?: string | string[];
|
|
24
|
+
}, modelRender?: Partial<T>) => {
|
|
3
25
|
[key in keyof T]?: string | string[];
|
|
4
26
|
} | undefined;
|
|
5
|
-
export type IErrorCommonGetter = (error: any) => string | string[] | undefined;
|
|
27
|
+
export type IErrorCommonGetter = (error: any, currentError?: string | string[]) => string | string[] | undefined;
|
|
6
28
|
export declare class ErrorHandler<T> {
|
|
7
|
-
getError:
|
|
29
|
+
getError: (error: any, modelRender?: Partial<T>) => { [key in keyof T]?: string | undefined; };
|
|
8
30
|
errorToPartialError: (errors: { [key in keyof T]?: string | string[] | undefined; }) => IPartialError<T>;
|
|
9
|
-
getErrorCommon:
|
|
31
|
+
getErrorCommon: (error: any) => string[];
|
|
10
32
|
}
|
|
@@ -9,6 +9,7 @@ export type { InputBaseImage } from './create.input';
|
|
|
9
9
|
export type { ISelectSimpleOption } from './create.select-simple';
|
|
10
10
|
export * from './decorator';
|
|
11
11
|
export * from './decorator.form';
|
|
12
|
+
export * from './create.form-confirm';
|
|
12
13
|
export { default as createColorPickerV2 } from './v2/create.color-picker';
|
|
13
14
|
export * from './v2/create.color-picker';
|
|
14
15
|
export { default as createDatePickerV2 } from './v2/create.date-picker';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
1
|
import { Dayjs } from 'dayjs';
|
|
3
|
-
import { BoxProps } from '@mui/material';
|
|
4
|
-
import { DatePickerProps } from '@mui/x-date-pickers';
|
|
5
2
|
import { IFormInputBase } from '../types';
|
|
3
|
+
import type { ComponentType } from 'react';
|
|
4
|
+
import type { BoxProps } from '@mui/material';
|
|
5
|
+
import type { DatePickerProps } from '@mui/x-date-pickers';
|
|
6
6
|
export interface IDatePickerSlots {
|
|
7
7
|
defaultValue?: string;
|
|
8
8
|
minDate?: Dayjs;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import React, { ComponentType } from 'react';
|
|
2
|
-
import { TextFieldProps } from '@mui/material';
|
|
1
|
+
import React, { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { BoxProps, TextFieldProps } from '@mui/material';
|
|
3
|
+
import { SwitchProps } from '@mui/material';
|
|
3
4
|
import { IFormInputBase } from './../types';
|
|
4
5
|
import { IImageWithFallbackPropsOwner } from '../../components/image-with-fallback';
|
|
5
6
|
import { IRichTooltipPanelConfig } from '../../components/rich-tooltip';
|
|
6
7
|
export interface InputBaseImage<T> extends Omit<Partial<IImageWithFallbackPropsOwner>, 'src'> {
|
|
7
|
-
src?: string | ((value: any, model?: Partial<T>) => string | undefined);
|
|
8
|
+
src?: string | ((value: any, model?: Partial<T>, modelState?: Partial<T>) => string | undefined);
|
|
8
9
|
element?: React.ComponentType<{
|
|
9
10
|
value: any;
|
|
10
11
|
model?: Partial<T>;
|
|
12
|
+
modelState?: Partial<T>;
|
|
11
13
|
}>;
|
|
12
14
|
mirror?: boolean;
|
|
15
|
+
wrapProps?: BoxProps;
|
|
13
16
|
}
|
|
14
17
|
export interface IInputSlots<T> {
|
|
15
18
|
maxLength?: number;
|
|
@@ -19,11 +22,43 @@ export interface IInputSlots<T> {
|
|
|
19
22
|
imageLeft?: InputBaseImage<T>;
|
|
20
23
|
imageRight?: InputBaseImage<T>;
|
|
21
24
|
tooltip?: IRichTooltipPanelConfig;
|
|
25
|
+
/** Custom end input slot that remains active even when the input is disabled */
|
|
26
|
+
endInput?: ReactNode | ((context: {
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
value?: string;
|
|
29
|
+
}) => ReactNode);
|
|
30
|
+
/** Enable switch to toggle input active state @default false */
|
|
31
|
+
switchable?: boolean;
|
|
32
|
+
/** Controlled initial state of the switch */
|
|
33
|
+
switchChecked?: boolean;
|
|
34
|
+
/** Custom getter to derive switch checked state from data model */
|
|
35
|
+
switchCheckedGetter?: (value: any, model?: Partial<T>) => boolean;
|
|
36
|
+
/** Custom props passed to MUI Switch */
|
|
37
|
+
switchProps?: SwitchProps;
|
|
38
|
+
/** Custom label for switch toggle @default { on: 'Enabled', off: 'Disabled' } */
|
|
39
|
+
switchLabel?: string | {
|
|
40
|
+
on?: string;
|
|
41
|
+
off?: string;
|
|
42
|
+
};
|
|
22
43
|
}
|
|
23
44
|
export interface IInputProps<T> extends IFormInputBase<T, IInputSlots<T>> {
|
|
45
|
+
onChange?: (value: string) => void;
|
|
46
|
+
endInput?: ReactNode | ((context: {
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
value?: string;
|
|
49
|
+
}) => ReactNode);
|
|
50
|
+
switchable?: boolean;
|
|
51
|
+
switchChecked?: boolean;
|
|
52
|
+
switchCheckedGetter?: (value: any, model?: Partial<T>) => boolean;
|
|
53
|
+
switchProps?: SwitchProps;
|
|
54
|
+
switchLabel?: string | {
|
|
55
|
+
on?: string;
|
|
56
|
+
off?: string;
|
|
57
|
+
};
|
|
24
58
|
}
|
|
25
59
|
export interface IInputState {
|
|
26
60
|
value?: string;
|
|
61
|
+
switchChecked: boolean;
|
|
27
62
|
}
|
|
28
63
|
export interface IInputParams<T> extends IInputSlots<T> {
|
|
29
64
|
}
|
|
@@ -31,6 +66,10 @@ declare const createInput: <T>(params?: IInputParams<T> | undefined) => React.Co
|
|
|
31
66
|
export default createInput;
|
|
32
67
|
export declare const inputClasses: {
|
|
33
68
|
root: string;
|
|
69
|
+
labelWrapper: string;
|
|
34
70
|
label: string;
|
|
71
|
+
control: string;
|
|
72
|
+
labelSwitch: string;
|
|
73
|
+
switch: string;
|
|
35
74
|
input: string;
|
|
36
75
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BoxProps, SelectProps } from '@mui/material';
|
|
2
1
|
import type { ComponentType } from 'react';
|
|
2
|
+
import type { BoxProps, SelectProps } from '@mui/material';
|
|
3
3
|
import type { IFormInputBase } from '../types';
|
|
4
4
|
import type { IRichTooltipPanelConfig } from '../../components/rich-tooltip';
|
|
5
5
|
export interface ISelectSimpleOption<T = any> {
|