sera-components 1.0.0 → 1.1.1
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/package.json +1 -1
- package/dist/components/src/basic/CountryFlag.d.ts +0 -75
- package/dist/components/src/basic/Language.d.ts +0 -48
- package/dist/components/src/basic/Menu.d.ts +0 -62
- package/dist/components/src/basic/Transition.d.ts +0 -18
- package/dist/components/src/basic/index.d.ts +0 -4
- package/dist/components/src/data/display/ForeignKeyDisplay.d.ts +0 -7
- package/dist/components/src/data/display/TextDisplay.d.ts +0 -2
- package/dist/components/src/data/display/index.d.ts +0 -13
- package/dist/components/src/data/index.d.ts +0 -2
- package/dist/components/src/data/inputs/BooleanInput.d.ts +0 -2
- package/dist/components/src/data/inputs/ForeignKeyInput.d.ts +0 -22
- package/dist/components/src/data/inputs/NumberInput.d.ts +0 -2
- package/dist/components/src/data/inputs/PhoneNumberInput.d.ts +0 -13
- package/dist/components/src/data/inputs/TextInput.d.ts +0 -2
- package/dist/components/src/data/inputs/index.d.ts +0 -21
- package/dist/components/src/form/Form.d.ts +0 -61
- package/dist/components/src/form/FormItem.d.ts +0 -31
- package/dist/components/src/form/FormItemLabel.d.ts +0 -9
- package/dist/components/src/form/index.d.ts +0 -3
- package/dist/components/src/index.d.ts +0 -5
- package/dist/components/src/misc/index.d.ts +0 -2
- package/dist/components/src/misc/trie.d.ts +0 -36
- package/dist/components/src/misc/utils.d.ts +0 -9
- package/dist/components/src/table/EmbeddedTable.d.ts +0 -13
- package/dist/components/src/table/Table.d.ts +0 -16
- package/dist/components/src/table/TableAction.d.ts +0 -16
- package/dist/components/src/table/TableContent.d.ts +0 -9
- package/dist/components/src/table/TablePagination.d.ts +0 -14
- package/dist/components/src/table/index.d.ts +0 -4
- package/dist/components/src/table/makeColumns.d.ts +0 -28
- package/dist/components/src/view/MultiTabView.d.ts +0 -1
- package/dist/components/src/view/View.d.ts +0 -25
- package/dist/components/src/view/ViewItem.d.ts +0 -15
- package/dist/components/src/view/ViewNestedPropertyItem.d.ts +0 -46
- package/dist/components/src/view/ViewTab.d.ts +0 -18
- package/dist/components/src/view/index.d.ts +0 -2
- package/dist/index.css +0 -1
- package/dist/index.js +0 -3344
- package/dist/index.umd.cjs +0 -33
package/package.json
CHANGED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export interface CountryFlag {
|
|
2
|
-
svgFlag: string;
|
|
3
|
-
emojiFlag: string;
|
|
4
|
-
}
|
|
5
|
-
export declare const countryFlags: {
|
|
6
|
-
UK: {
|
|
7
|
-
svgFlag: string;
|
|
8
|
-
emojiFlag: string;
|
|
9
|
-
};
|
|
10
|
-
VN: {
|
|
11
|
-
svgFlag: string;
|
|
12
|
-
emojiFlag: string;
|
|
13
|
-
};
|
|
14
|
-
US: {
|
|
15
|
-
svgFlag: string;
|
|
16
|
-
emojiFlag: string;
|
|
17
|
-
};
|
|
18
|
-
CA: {
|
|
19
|
-
svgFlag: string;
|
|
20
|
-
emojiFlag: string;
|
|
21
|
-
};
|
|
22
|
-
BR: {
|
|
23
|
-
svgFlag: string;
|
|
24
|
-
emojiFlag: string;
|
|
25
|
-
};
|
|
26
|
-
ES: {
|
|
27
|
-
svgFlag: string;
|
|
28
|
-
emojiFlag: string;
|
|
29
|
-
};
|
|
30
|
-
IT: {
|
|
31
|
-
svgFlag: string;
|
|
32
|
-
emojiFlag: string;
|
|
33
|
-
};
|
|
34
|
-
NZ: {
|
|
35
|
-
svgFlag: string;
|
|
36
|
-
emojiFlag: string;
|
|
37
|
-
};
|
|
38
|
-
MX: {
|
|
39
|
-
svgFlag: string;
|
|
40
|
-
emojiFlag: string;
|
|
41
|
-
};
|
|
42
|
-
CN: {
|
|
43
|
-
svgFlag: string;
|
|
44
|
-
emojiFlag: string;
|
|
45
|
-
};
|
|
46
|
-
AU: {
|
|
47
|
-
svgFlag: string;
|
|
48
|
-
emojiFlag: string;
|
|
49
|
-
};
|
|
50
|
-
JP: {
|
|
51
|
-
svgFlag: string;
|
|
52
|
-
emojiFlag: string;
|
|
53
|
-
};
|
|
54
|
-
FR: {
|
|
55
|
-
svgFlag: string;
|
|
56
|
-
emojiFlag: string;
|
|
57
|
-
};
|
|
58
|
-
DE: {
|
|
59
|
-
svgFlag: string;
|
|
60
|
-
emojiFlag: string;
|
|
61
|
-
};
|
|
62
|
-
IN: {
|
|
63
|
-
svgFlag: string;
|
|
64
|
-
emojiFlag: string;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
export declare const SVGCountryFlag: ({ flag }: {
|
|
68
|
-
flag: CountryFlag;
|
|
69
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
70
|
-
export declare const EmojiCountryFlag: ({ flag }: {
|
|
71
|
-
flag: CountryFlag;
|
|
72
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
73
|
-
export declare const CountryFlagComponent: ({ flag }: {
|
|
74
|
-
flag: CountryFlag;
|
|
75
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { MultiLingualString as MLS } from '../../../db/src/index.ts';
|
|
2
|
-
/**
|
|
3
|
-
* A dropdown menu component for selecting application language/locale.
|
|
4
|
-
*
|
|
5
|
-
* Displays the current language with its flag and provides a dropdown menu
|
|
6
|
-
* with all available languages. Each menu item shows the language name,
|
|
7
|
-
* country flag, and a checkmark for the currently selected language.
|
|
8
|
-
*
|
|
9
|
-
* @param locale - The currently selected locale object
|
|
10
|
-
* @param setLocale - Callback function to update the selected locale
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* <LanguageSelector
|
|
15
|
-
* locale={currentLocale}
|
|
16
|
-
* setLocale={setCurrentLocale}
|
|
17
|
-
* />
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare const LanguageSelector: ({ locale, setLocale, }: {
|
|
21
|
-
locale: Intl.Locale;
|
|
22
|
-
setLocale: (locale: Intl.Locale) => void;
|
|
23
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export declare const LocaleContext: import('react').Context<Intl.Locale>;
|
|
25
|
-
/**
|
|
26
|
-
* A component that returns a multilingual string based on the current locale context.
|
|
27
|
-
*
|
|
28
|
-
* @param props - The component props
|
|
29
|
-
* @param props.value - The multilingual string object containing language-to-value mappings
|
|
30
|
-
* @returns The localized string value for the current locale, or falls back to the default language if the current locale is not available
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```tsx
|
|
34
|
-
* const multilingualText = {
|
|
35
|
-
* lang: 'en',
|
|
36
|
-
* lang2value: {
|
|
37
|
-
* 'en': 'Hello',
|
|
38
|
-
* 'es': 'Hola',
|
|
39
|
-
* 'fr': 'Bonjour'
|
|
40
|
-
* }
|
|
41
|
-
* };
|
|
42
|
-
*
|
|
43
|
-
* <MultiLingualString value={multilingualText} />
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export declare const MultiLingualString: ({ value }: {
|
|
47
|
-
value: MLS;
|
|
48
|
-
}) => string;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { NoArgsPathDef } from '../../../route/src/index.ts';
|
|
2
|
-
import { Trie } from '../misc';
|
|
3
|
-
type MenuKey = string;
|
|
4
|
-
export declare enum Permission {
|
|
5
|
-
Allow = 0,
|
|
6
|
-
Denied = 1,
|
|
7
|
-
Pending = 2
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Specialized Trie data structure for efficient menu route matching and navigation.
|
|
11
|
-
*
|
|
12
|
-
* Provides O(m) lookup time for finding the best matching menu item based on URL paths,
|
|
13
|
-
* where m is the length of the path.
|
|
14
|
-
*/
|
|
15
|
-
export declare class MenuTrie extends Trie {
|
|
16
|
-
private pathToKey;
|
|
17
|
-
/**
|
|
18
|
-
* Normalizes a URL path by removing trailing slashes
|
|
19
|
-
*
|
|
20
|
-
* @param path - The path which is an URL string to normalize
|
|
21
|
-
* @returns The normalized path without trailing slash, except for root "/"
|
|
22
|
-
*/
|
|
23
|
-
private normalizePath;
|
|
24
|
-
/**
|
|
25
|
-
* Inserts an url path into the trie and associates it with a menu key.
|
|
26
|
-
*
|
|
27
|
-
* @param path - The URL path to store (e.g., "/admin/users")
|
|
28
|
-
* @param menuKey - The menu key to associate with this path
|
|
29
|
-
*/
|
|
30
|
-
insertRoute(path: string, menuKey: string): void;
|
|
31
|
-
/**
|
|
32
|
-
* Finds the menu key associated with the longest matching route prefix
|
|
33
|
-
*
|
|
34
|
-
* @param route - The URL to match against stored menu url paths
|
|
35
|
-
* @returns The menu key if a valid prefix match is found, undefined otherwise
|
|
36
|
-
*/
|
|
37
|
-
findMatchingKey(route: string): string | undefined;
|
|
38
|
-
}
|
|
39
|
-
export interface MenuRoute<R> {
|
|
40
|
-
path: NoArgsPathDef<any>;
|
|
41
|
-
role: R;
|
|
42
|
-
}
|
|
43
|
-
export interface SeraMenuItem<R> {
|
|
44
|
-
key: MenuKey;
|
|
45
|
-
label: React.ReactElement | string;
|
|
46
|
-
icon?: React.ReactElement;
|
|
47
|
-
route?: MenuRoute<R>;
|
|
48
|
-
children?: SeraMenuItem<R>[];
|
|
49
|
-
}
|
|
50
|
-
export declare function buildMenuItemIndex<R>(items: SeraMenuItem<R>[]): {
|
|
51
|
-
key2item: Record<MenuKey, SeraMenuItem<R>>;
|
|
52
|
-
key2fullpath: Record<MenuKey, MenuKey[]>;
|
|
53
|
-
key2route: {
|
|
54
|
-
[key: MenuKey]: MenuRoute<R>;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export declare function filterAllowedItems<R>(items: SeraMenuItem<R>[], checkPermission: (role: R) => Permission): SeraMenuItem<R>[];
|
|
58
|
-
export declare const SeraVerticalMenu: <R>(props: {
|
|
59
|
-
items: SeraMenuItem<R>[];
|
|
60
|
-
checkPermission: (role: R) => Permission;
|
|
61
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
62
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const NotFound: ({ message }: {
|
|
2
|
-
message?: string;
|
|
3
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare const NotFoundSubPage: ({ message }: {
|
|
5
|
-
message?: string;
|
|
6
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export declare const NotFoundInline: ({ message }: {
|
|
8
|
-
message?: string;
|
|
9
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare const Loading: ({ tip }: {
|
|
11
|
-
tip?: string;
|
|
12
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export declare const LoadingInline: ({ tip }: {
|
|
14
|
-
tip?: string;
|
|
15
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export declare const NotAuthorized: ({ message }: {
|
|
17
|
-
message?: string;
|
|
18
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { DisplayInterface } from '.';
|
|
2
|
-
export declare const SingleForeignKeyDisplay: (<ID extends string | number>({ db, property, value, entityRoutes, }: DisplayInterface<ID>) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
|
-
displayName: string;
|
|
4
|
-
};
|
|
5
|
-
export declare const MultiForeignKeyDisplay: (<ID extends string | number>({ db, property, value, entityRoutes, }: DisplayInterface<ID[]>) => import("react/jsx-runtime").JSX.Element) & {
|
|
6
|
-
displayName: string;
|
|
7
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ClassName, DataProperty, DataType, DB, ObjectProperty } from '../../../../db/src/index.ts';
|
|
2
|
-
import { NoQueryArgsPathDef } from '../../../../route/src/index.ts';
|
|
3
|
-
export { SingleForeignKeyDisplay, MultiForeignKeyDisplay } from './ForeignKeyDisplay';
|
|
4
|
-
export type DisplayInterface<T> = {
|
|
5
|
-
db: DB;
|
|
6
|
-
property: DataProperty | ObjectProperty;
|
|
7
|
-
nestedProperty?: DataProperty | ObjectProperty;
|
|
8
|
-
value: T;
|
|
9
|
-
entityRoutes: Record<ClassName, NoQueryArgsPathDef<{
|
|
10
|
-
id: "string";
|
|
11
|
-
}, any>>;
|
|
12
|
-
};
|
|
13
|
-
export declare const DataType2DisplayComponent: Partial<Record<DataType, React.ComponentType<DisplayInterface<any>>>>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { InputInterface } from '.';
|
|
2
|
-
import { Record } from '../../../../db/src/index.ts';
|
|
3
|
-
export declare const SingleForeignKeyInput: (<T>(_props: InputInterface<T>) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
|
-
displayName: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const MultiForeignKeyInput: (<ID extends string | number>({ db, property, value: recordIds, onChange, }: InputInterface<ID[]>) => import("react/jsx-runtime").JSX.Element) & {
|
|
7
|
-
displayName: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const SearchInput: <ID extends string | number, R extends Record<ID>>({ name, data, onSelect, renderOption, isIdInteger, query, setQuery, }: {
|
|
10
|
-
name?: string;
|
|
11
|
-
query: string;
|
|
12
|
-
setQuery: (query: string) => void;
|
|
13
|
-
onSelect: (id: ID) => void;
|
|
14
|
-
data: R[];
|
|
15
|
-
renderOption: (record: R) => React.ReactNode;
|
|
16
|
-
isIdInteger?: boolean;
|
|
17
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export declare const CardList: <R>({ items, onDelete, render, }: {
|
|
19
|
-
items: R[];
|
|
20
|
-
onDelete: (value: R) => void;
|
|
21
|
-
render: (value: R) => React.ReactNode;
|
|
22
|
-
}) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
export interface PhoneNumberInputProps {
|
|
3
|
-
id: string;
|
|
4
|
-
value: string;
|
|
5
|
-
type: string;
|
|
6
|
-
onChange: (e: {
|
|
7
|
-
target: {
|
|
8
|
-
value: string;
|
|
9
|
-
};
|
|
10
|
-
}) => void;
|
|
11
|
-
error?: boolean | React.ReactNode;
|
|
12
|
-
}
|
|
13
|
-
export declare const PhoneNumberInput: React.FC<PhoneNumberInputProps>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { DataProperty, DataType, DB, ObjectProperty } from '../../../../db/src/index.ts';
|
|
2
|
-
/**
|
|
3
|
-
* Interface for input components in forms
|
|
4
|
-
* @interface InputInterface
|
|
5
|
-
* @template T - The type of the input value
|
|
6
|
-
* @property {DataProperty | ObjectProperty} property - The property being edited
|
|
7
|
-
* @property {any} value - The current value of the input
|
|
8
|
-
* @property {function} onChange - Callback function triggered when input value changes
|
|
9
|
-
* @property {boolean | string} [error] - If the type is boolean it will be error, if there is a string message it should display that message
|
|
10
|
-
*/
|
|
11
|
-
export type InputInterface<T> = {
|
|
12
|
-
db: DB;
|
|
13
|
-
property: DataProperty | ObjectProperty;
|
|
14
|
-
value: T;
|
|
15
|
-
onChange: (value: T) => void;
|
|
16
|
-
error?: boolean | string;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Mapping of data types to their corresponding input components
|
|
20
|
-
*/
|
|
21
|
-
export declare const DataType2Component: Partial<Record<DataType, React.FC<InputInterface<any>>>>;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { DraftRecord, GenericRecord, MultiLingualString, Schema, SchemaType, Table } from '../../../db/src/index.ts';
|
|
2
|
-
import { FormItemLayout } from './FormItem';
|
|
3
|
-
export interface CustomField {
|
|
4
|
-
name: string;
|
|
5
|
-
label: MultiLingualString;
|
|
6
|
-
description?: MultiLingualString;
|
|
7
|
-
}
|
|
8
|
-
export interface FieldGroup<ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>, PF extends keyof R, F extends keyof DR, ST extends SchemaType<ID, R, DR, PF, F>> {
|
|
9
|
-
name?: string;
|
|
10
|
-
fields: ST["allProperties"][][];
|
|
11
|
-
}
|
|
12
|
-
export interface SeraFormProps<ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>, PF extends keyof R, F extends keyof DR, ST extends SchemaType<ID, R, DR, PF, F>> {
|
|
13
|
-
schema: Schema<ID, R, DR, PF, F, ST>;
|
|
14
|
-
store: Table<ST["id"], ST["cls"], ST["draftCls"]>;
|
|
15
|
-
fieldGroups: FieldGroup<ID, R, DR, PF, F, ST>[];
|
|
16
|
-
layout?: FormItemLayout;
|
|
17
|
-
actions: {
|
|
18
|
-
variant: "filled" | "light" | "outline";
|
|
19
|
-
label?: React.ReactNode;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
onClick?: () => void;
|
|
22
|
-
}[];
|
|
23
|
-
record: ST["cls"] | ST["draftCls"];
|
|
24
|
-
styles?: React.CSSProperties;
|
|
25
|
-
className?: string;
|
|
26
|
-
onSubmit?: (record: ST["draftCls"]) => void;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* A form component that renders form items based on a schema from sera-db.
|
|
30
|
-
*
|
|
31
|
-
* This component provides a structured way to render form fields based on a schema definition,
|
|
32
|
-
* with support for grouping fields, custom layouts, and form actions.
|
|
33
|
-
*
|
|
34
|
-
* @template ID - The type of ID used for records
|
|
35
|
-
* @template R - The record type that extends GenericRecord
|
|
36
|
-
* @template DR - The draft record type that extends DraftRecord
|
|
37
|
-
* @template PF - The type of public fields in R
|
|
38
|
-
* @template F - The type of fields in DR
|
|
39
|
-
* @template ST - The schema type that extends SchemaType
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```tsx
|
|
43
|
-
* <SeraForm
|
|
44
|
-
* schema={userSchema}
|
|
45
|
-
* store={userStore}
|
|
46
|
-
* fieldGroups={[
|
|
47
|
-
* {
|
|
48
|
-
* name: "Basic Info",
|
|
49
|
-
* fields: [["firstName", "lastName"], ["email"]]
|
|
50
|
-
* }
|
|
51
|
-
* ]}
|
|
52
|
-
* layout={{ type: "horizontal", labelCol: 3, itemCol: 9 }}
|
|
53
|
-
* actions={[
|
|
54
|
-
* { variant: "filled", label: "Save", onClick: handleSave },
|
|
55
|
-
* { variant: "outline", label: "Cancel", onClick: handleCancel }
|
|
56
|
-
* ]}
|
|
57
|
-
* record={userRecord}
|
|
58
|
-
* />
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export declare const SeraForm: <ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>, PF extends keyof R, F extends keyof DR, ST extends SchemaType<ID, R, DR, PF, F>>(props: SeraFormProps<ID, R, DR, PF, F, ST>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { DataProperty, DraftRecord, GenericRecord, ObjectProperty, Table, validators } from '../../../db/src/index.ts';
|
|
2
|
-
import { InputInterface } from '../data/inputs';
|
|
3
|
-
interface FormItemHorizontalLayout {
|
|
4
|
-
type: "horizontal";
|
|
5
|
-
labelCol: number;
|
|
6
|
-
itemCol: number;
|
|
7
|
-
align?: "left" | "right";
|
|
8
|
-
}
|
|
9
|
-
interface FormItemVerticalLayout {
|
|
10
|
-
type: "vertical";
|
|
11
|
-
helpAlwaysVisible?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export type FormItemLayout = FormItemHorizontalLayout | FormItemVerticalLayout;
|
|
14
|
-
export interface FormItemProps<ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>> {
|
|
15
|
-
store: Table<ID, R, DR>;
|
|
16
|
-
record: R | DR;
|
|
17
|
-
property: DataProperty | ObjectProperty;
|
|
18
|
-
InputComponent: React.FC<InputInterface<any>> | React.ComponentType<InputInterface<any>>;
|
|
19
|
-
validator: validators.ValueValidator;
|
|
20
|
-
layout?: FormItemLayout;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* FormItem component for creating form elements with labels, tooltips and layout options.
|
|
24
|
-
*
|
|
25
|
-
* Supports both horizontal and vertical layouts. In horizontal layout, the label and input are placed side by side in a grid.
|
|
26
|
-
* In vertical layout, the label is positioned above the input using Mantine's Input.Wrapper.
|
|
27
|
-
*/
|
|
28
|
-
export declare const FormItem: (<ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>>({ store, record, property, layout, InputComponent, validator, }: FormItemProps<ID, R, DR>) => import("react/jsx-runtime").JSX.Element) & {
|
|
29
|
-
displayName: string;
|
|
30
|
-
};
|
|
31
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
export declare const FormItemLabel: ({ label, name, required, tooltip, style, align, }: {
|
|
3
|
-
label: React.ReactNode;
|
|
4
|
-
tooltip?: React.ReactNode;
|
|
5
|
-
required?: boolean;
|
|
6
|
-
name?: string;
|
|
7
|
-
style?: React.CSSProperties;
|
|
8
|
-
align?: "left" | "right";
|
|
9
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TrieNode and Trie classes for managing a prefix tree structure
|
|
3
|
-
* to efficiently store and retrieve words based on their prefixes.
|
|
4
|
-
*/
|
|
5
|
-
export declare class TrieNode {
|
|
6
|
-
children: Map<string, TrieNode>;
|
|
7
|
-
isEndOfWord: boolean;
|
|
8
|
-
value: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Trie (prefix tree) data structure for efficient string storage and retrieval.
|
|
12
|
-
*
|
|
13
|
-
* Provides O(m) insertion and O(m) lookup operations where m is the length of the string.
|
|
14
|
-
* Optimized for prefix-based operations like longest prefix matching.
|
|
15
|
-
*/
|
|
16
|
-
export declare class Trie {
|
|
17
|
-
root: TrieNode;
|
|
18
|
-
/**
|
|
19
|
-
* Inserts a word into the trie structure.
|
|
20
|
-
* Creates new nodes as needed along the path of characters.
|
|
21
|
-
*
|
|
22
|
-
* @param word - The string to insert into the trie
|
|
23
|
-
*/
|
|
24
|
-
insert(word: string): void;
|
|
25
|
-
/**
|
|
26
|
-
* Finds the longest prefix match for the given text.
|
|
27
|
-
* Returns the longest stored word that is a prefix of the input text.
|
|
28
|
-
*
|
|
29
|
-
* @param text - The input string to find prefix matches for
|
|
30
|
-
* @returns Object containing the longest matching prefix and remaining text
|
|
31
|
-
*/
|
|
32
|
-
findLongestPrefix(text: string): {
|
|
33
|
-
match: string;
|
|
34
|
-
remaining: string;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare function groupBy<R>(items: R[], key: (item: R) => string | number): Record<string | number, R[]>;
|
|
2
|
-
export declare function groupByAsList<R>(items: R[], key: (item: R) => string | number | undefined): R[][];
|
|
3
|
-
export declare function uniqueList<R>(items: R[], key: (item: R) => string | number): R[];
|
|
4
|
-
export declare class OrderedUniqueList<R> {
|
|
5
|
-
private items;
|
|
6
|
-
private seen;
|
|
7
|
-
add(item: R, keyFn: (item: R) => string | number): void;
|
|
8
|
-
toArray(): R[];
|
|
9
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SeraColumn } from './makeColumns';
|
|
2
|
-
import { SeraActionConfig } from './TableAction';
|
|
3
|
-
export interface SeraEmbeddedTableProps<R> {
|
|
4
|
-
pagination?: {
|
|
5
|
-
positions?: Set<"topRight" | "bottomLeft" | "bottomCenter" | "bottomRight">;
|
|
6
|
-
showSizeChanger?: boolean;
|
|
7
|
-
};
|
|
8
|
-
columns: SeraColumn[];
|
|
9
|
-
data: R[];
|
|
10
|
-
actions?: SeraActionConfig<number>;
|
|
11
|
-
}
|
|
12
|
-
export declare const DEFAULT_PAGINATION_POSITIONS: Set<"topRight" | "bottomLeft" | "bottomRight">;
|
|
13
|
-
export declare const SeraEmbeddedTable: <R>(props: SeraEmbeddedTableProps<R>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { DraftRecord, FetchResult, GenericRecord, ObservableQuery, Query, Schema, SchemaType } from '../../../db/src/index.ts';
|
|
2
|
-
import { SeraColumn } from './makeColumns';
|
|
3
|
-
import { SeraActionConfig } from './TableAction';
|
|
4
|
-
export interface SeraTableProps<ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>, PF extends keyof R, F extends keyof DR, ST extends SchemaType<ID, R, DR, PF, F>> {
|
|
5
|
-
pagination?: {
|
|
6
|
-
positions?: Set<"topRight" | "bottomLeft" | "bottomCenter" | "bottomRight">;
|
|
7
|
-
showSizeChanger?: boolean;
|
|
8
|
-
};
|
|
9
|
-
schema: Schema<ID, R, DR, PF, F, ST>;
|
|
10
|
-
columns: SeraColumn[];
|
|
11
|
-
query: ObservableQuery<ST["cls"]>;
|
|
12
|
-
getData: (query: Query<ST["cls"]>) => Promise<FetchResult<ST["cls"]>>;
|
|
13
|
-
actions?: SeraActionConfig<ST["id"]>;
|
|
14
|
-
}
|
|
15
|
-
export declare const DEFAULT_PAGINATION_POSITIONS: Set<"topRight" | "bottomLeft" | "bottomRight">;
|
|
16
|
-
export declare const SeraTable: <ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>, PF extends keyof R, F extends keyof DR, ST extends SchemaType<ID, R, DR, PF, F>>(props: SeraTableProps<ID, R, DR, PF, F, ST>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { MantineSize } from '@mantine/core';
|
|
2
|
-
export interface SeraActionConfig<ID extends string | number> {
|
|
3
|
-
add?: () => void;
|
|
4
|
-
edit?: (id: ID) => void;
|
|
5
|
-
delete?: () => void;
|
|
6
|
-
export?: () => void;
|
|
7
|
-
reload?: boolean;
|
|
8
|
-
import?: () => void;
|
|
9
|
-
}
|
|
10
|
-
export declare const SeraTableAction: <ID extends string | number>({ actions, reloadData, selectedRowKeys, size, }: {
|
|
11
|
-
size?: MantineSize;
|
|
12
|
-
actions?: SeraActionConfig<ID>;
|
|
13
|
-
reloadData?: () => void;
|
|
14
|
-
selectedRowKeys: ID[];
|
|
15
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export declare const hasAction: <ID extends string | number>(actions?: SeraActionConfig<ID>) => boolean;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Table as ReactTable } from '@tanstack/react-table';
|
|
2
|
-
export declare const COL_SELECT_ID = "__selectcol__";
|
|
3
|
-
export declare const SeraTableContent: <R>(props: {
|
|
4
|
-
selectedRowKeys: Record<string, boolean>;
|
|
5
|
-
table: ReactTable<R>;
|
|
6
|
-
bordered?: boolean;
|
|
7
|
-
hasTopSection?: boolean;
|
|
8
|
-
hasBottomSection?: boolean;
|
|
9
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MantineSize } from '@mantine/core';
|
|
2
|
-
export declare const TablePagination: ({ total, pageIndex, pageSize, allowPageSizeChange, onUpdatePagination, }: {
|
|
3
|
-
total: number;
|
|
4
|
-
pageIndex: number;
|
|
5
|
-
pageSize: number;
|
|
6
|
-
allowPageSizeChange?: boolean;
|
|
7
|
-
onUpdatePagination: (pageIndex: number, pageSize: number) => void;
|
|
8
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare function DataTablePageSizeSelector({ size, values, value, onChange, }: {
|
|
10
|
-
size: MantineSize;
|
|
11
|
-
values: string[];
|
|
12
|
-
value: string;
|
|
13
|
-
onChange: (value: string) => void;
|
|
14
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { DataProperty, DB, DraftEmbeddedRecord, DraftRecord, EmbeddedSchema, GenericEmbeddedRecord, GenericRecord, ObjectProperty, Schema, SchemaType } from '../../../db/src/index.ts';
|
|
2
|
-
import { NoQueryArgsPathDef } from '../../../route/src/index.ts';
|
|
3
|
-
type DOP = DataProperty | ObjectProperty;
|
|
4
|
-
/**
|
|
5
|
-
* Represents a column configuration for a table component.
|
|
6
|
-
*/
|
|
7
|
-
export interface SeraColumn {
|
|
8
|
-
key: string;
|
|
9
|
-
title: React.ReactNode;
|
|
10
|
-
accessorFn: (record: any) => any;
|
|
11
|
-
render: (record: any) => React.ReactNode;
|
|
12
|
-
}
|
|
13
|
-
export declare function makeTableColumn(db: DB, property: DOP, entityRoutes: Record<string, NoQueryArgsPathDef<{
|
|
14
|
-
id: "string";
|
|
15
|
-
}, any>>): SeraColumn;
|
|
16
|
-
export declare function makeTableColumnFromNestedProperty(db: DB, property: DOP, nestedProperty: DOP, entityRoutes: Record<string, NoQueryArgsPathDef<{
|
|
17
|
-
id: "string";
|
|
18
|
-
}, any>>, { title }?: {
|
|
19
|
-
title?: React.ReactNode;
|
|
20
|
-
}): SeraColumn;
|
|
21
|
-
export declare function makeTableColumns<ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>, PF extends keyof R, F extends keyof DR, ST extends SchemaType<ID, R, DR, PF, F>>(db: DB, schema: Schema<ID, R, DR, PF, F, ST> | EmbeddedSchema<R, DR, PF, F>, selectedColumns: (PF | SeraColumn)[], entityRoutes: Record<string, NoQueryArgsPathDef<{
|
|
22
|
-
id: "string";
|
|
23
|
-
}, any>>): SeraColumn[];
|
|
24
|
-
export declare function makeEmbeddedTableColumns<R extends GenericEmbeddedRecord<DR>, DR extends DraftEmbeddedRecord, PF extends keyof R, F extends keyof DR>(db: DB, schema: EmbeddedSchema<R, DR, PF, F>, selectedColumns: (PF | SeraColumn)[], entityRoutes: Record<string, NoQueryArgsPathDef<{
|
|
25
|
-
id: "string";
|
|
26
|
-
}, any>>): SeraColumn[];
|
|
27
|
-
export declare function isSeraColumn(column: SeraColumn | any): column is SeraColumn;
|
|
28
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ClassName, DataProperty, DraftRecord, GenericRecord, ObjectProperty, Schema, SchemaType, Table } from '../../../db/src/index.ts';
|
|
2
|
-
import { DisplayInterface } from '../data/display';
|
|
3
|
-
import { NoQueryArgsPathDef } from '../../../route/src/index.ts';
|
|
4
|
-
export interface FieldGroup<ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>, PF extends keyof R, F extends keyof DR, ST extends SchemaType<ID, R, DR, PF, F>> {
|
|
5
|
-
name?: string;
|
|
6
|
-
fields: (ST["allProperties"] | {
|
|
7
|
-
prop: ST["allProperties"];
|
|
8
|
-
display: React.ComponentType<DisplayInterface<any>>;
|
|
9
|
-
} | ((store: Table<ID, R, DR>, record: R) => React.ReactNode))[][];
|
|
10
|
-
}
|
|
11
|
-
export interface SeraViewProps<ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>, PF extends keyof R, F extends keyof DR, ST extends SchemaType<ID, R, DR, PF, F>> {
|
|
12
|
-
schema: Schema<ID, R, DR, PF, F, ST>;
|
|
13
|
-
store: Table<ID, R, DR>;
|
|
14
|
-
fieldGroups: FieldGroup<ID, R, DR, PF, F, ST>[];
|
|
15
|
-
record: R;
|
|
16
|
-
styles?: React.CSSProperties;
|
|
17
|
-
className?: string;
|
|
18
|
-
entityRoutes: Record<ClassName, NoQueryArgsPathDef<{
|
|
19
|
-
id: "string";
|
|
20
|
-
}, any>>;
|
|
21
|
-
}
|
|
22
|
-
export declare const SeraView: <ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>, PF extends keyof R, F extends keyof DR, ST extends SchemaType<ID, R, DR, PF, F>>(props: SeraViewProps<ID, R, DR, PF, F, ST>) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export declare function makeFieldDisplay<ID extends string | number, R extends GenericRecord<ID, DR>, DR extends DraftRecord<ID>>(props: (DataProperty | ObjectProperty)[], entityRoutes: Record<ClassName, NoQueryArgsPathDef<{
|
|
24
|
-
id: "string";
|
|
25
|
-
}, any>>, display?: React.ComponentType<DisplayInterface<any>>): (store: Table<ID, R, DR>, record: R) => React.ReactNode;
|