@llmnative/react 0.1.1 → 1.1.0
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/README.md +397 -364
- package/bin/cli.js +117 -98
- package/dist/index.css +1 -1
- package/dist/index.js +21 -823
- package/dist/index.mjs +14984 -9345
- package/dist/style.css +1 -0
- package/dist/types/src/App.d.ts +75 -14
- package/dist/types/src/Config.d.ts +28 -5
- package/dist/types/src/Global.d.ts +2 -2
- package/dist/types/src/I18n.d.ts +186 -0
- package/dist/types/src/Theme.d.ts +153 -81
- package/dist/types/src/auth.d.ts +13 -1
- package/dist/types/src/components/Component.d.ts +13 -27
- package/dist/types/src/components/ErrorBoundary.d.ts +30 -0
- package/dist/types/src/components/blocks/Brand.d.ts +9 -4
- package/dist/types/src/components/blocks/Breadcrumbs.d.ts +50 -4
- package/dist/types/src/components/blocks/Carousel.d.ts +7 -5
- package/dist/types/src/components/blocks/Dropdown.d.ts +38 -20
- package/dist/types/src/components/blocks/ListCard.d.ts +38 -0
- package/dist/types/src/components/blocks/Menu.d.ts +15 -16
- package/dist/types/src/components/blocks/Notifications.d.ts +11 -3
- package/dist/types/src/components/blocks/ProviderSwitcher.d.ts +65 -0
- package/dist/types/src/components/blocks/Search.d.ts +3 -2
- package/dist/types/src/components/blocks/SideNav.d.ts +45 -0
- package/dist/types/src/components/blocks/ThemeSwitcher.d.ts +28 -0
- package/dist/types/src/components/blocks/Toolbar.d.ts +23 -0
- package/dist/types/src/components/index.d.ts +28 -7
- package/dist/types/src/components/types.d.ts +10 -3
- package/dist/types/src/components/ui/Alert.d.ts +20 -4
- package/dist/types/src/components/ui/Badge.d.ts +12 -5
- package/dist/types/src/components/ui/Buttons.d.ts +16 -12
- package/dist/types/src/components/ui/Card.d.ts +11 -7
- package/dist/types/src/components/ui/Code.d.ts +5 -1
- package/dist/types/src/components/ui/Gallery.d.ts +16 -16
- package/dist/types/src/components/ui/GridSystem.d.ts +5 -2
- package/dist/types/src/components/ui/Icon.d.ts +6 -1
- package/dist/types/src/components/ui/Image.d.ts +7 -1
- package/dist/types/src/components/ui/ImageAvatar.d.ts +4 -1
- package/dist/types/src/components/ui/Loader.d.ts +3 -1
- package/dist/types/src/components/ui/LocaleSwitcher.d.ts +14 -0
- package/dist/types/src/components/ui/Modal.d.ts +46 -15
- package/dist/types/src/components/ui/Pagination.d.ts +16 -3
- package/dist/types/src/components/ui/Percentage.d.ts +14 -5
- package/dist/types/src/components/ui/Repeat.d.ts +14 -6
- package/dist/types/src/components/ui/Tab.d.ts +29 -2
- package/dist/types/src/components/ui/TabDynamic.d.ts +4 -3
- package/dist/types/src/components/ui/Table.d.ts +18 -14
- package/dist/types/src/components/ui/fields/CodeEditor.d.ts +46 -0
- package/dist/types/src/components/ui/fields/ContextMenu.d.ts +87 -0
- package/dist/types/src/components/ui/fields/Crop.d.ts +4 -2
- package/dist/types/src/components/ui/fields/ImageField.d.ts +31 -0
- package/dist/types/src/components/ui/fields/Input.d.ts +43 -14
- package/dist/types/src/components/ui/fields/Prompt.d.ts +2 -31
- package/dist/types/src/components/ui/fields/RichText.d.ts +89 -0
- package/dist/types/src/components/ui/fields/Select.d.ts +13 -10
- package/dist/types/src/components/ui/fields/Upload.d.ts +50 -2
- package/dist/types/src/components/ui/fields/UploadCSV.d.ts +2 -0
- package/dist/types/src/components/ui/useRecordSelection.d.ts +1 -2
- package/dist/types/src/components/widgets/Form.d.ts +80 -43
- package/dist/types/src/components/widgets/ImageEditor.d.ts +4 -5
- package/dist/types/src/components/widgets/MarkdownReader.d.ts +4 -4
- package/dist/types/src/components/widgets/Prompt.d.ts +90 -22
- package/dist/types/src/components/widgets/TabDynamic.d.ts +4 -3
- package/dist/types/src/components/widgets/form-controller.d.ts +42 -0
- package/dist/types/src/components/widgets/grid-core/GridCore.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/GridDB.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/GridGalleryView.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/GridTableView.d.ts +1 -1
- package/dist/types/src/components/widgets/grid-core/types.d.ts +77 -27
- package/dist/types/src/components/widgets/grid-core/useGridActions.d.ts +4 -8
- package/dist/types/src/components/widgets/grid-core/useGridColumns.d.ts +2 -2
- package/dist/types/src/components/widgets/grid-core/useGridDBRecords.d.ts +1 -2
- package/dist/types/src/components/widgets/grid-core/useGridPreparedRecords.d.ts +2 -2
- package/dist/types/src/components/widgets/grid-core/useGridSelection.d.ts +4 -5
- package/dist/types/src/components/widgets/grid-core/utils.d.ts +11 -3
- package/dist/types/src/conf/Prompt.d.ts +1 -1
- package/dist/types/src/conf/i18n/ar.d.ts +2 -0
- package/dist/types/src/conf/i18n/de.d.ts +2 -0
- package/dist/types/src/conf/i18n/en.d.ts +2 -0
- package/dist/types/src/conf/i18n/index.d.ts +6 -0
- package/dist/types/src/conf/i18n/it.d.ts +2 -0
- package/dist/types/src/conf/i18n/ru.d.ts +2 -0
- package/dist/types/src/conf/i18n/zh.d.ts +2 -0
- package/dist/types/src/constant.d.ts +1 -1
- package/dist/types/src/index.d.ts +48 -13
- package/dist/types/src/libs/converter.d.ts +4 -4
- package/dist/types/src/libs/editorHeight.d.ts +12 -0
- package/dist/types/src/libs/fetch.d.ts +4 -4
- package/dist/types/src/libs/imageBuilder.d.ts +63 -14
- package/dist/types/src/libs/imageVariants.d.ts +35 -0
- package/dist/types/src/libs/index.d.ts +1 -4
- package/dist/types/src/libs/promptUtils.d.ts +24 -0
- package/dist/types/src/libs/sanitizer.d.ts +2 -2
- package/dist/types/src/libs/utils.d.ts +9 -10
- package/dist/types/src/pages/index.d.ts +0 -2
- package/dist/types/src/providers/ProviderConfiguration.d.ts +6 -0
- package/dist/types/src/providers/ProviderDescriptor.d.ts +18 -0
- package/dist/types/src/providers/ProviderRegistryContext.d.ts +51 -0
- package/dist/types/src/providers/ProviderSession.d.ts +68 -0
- package/dist/types/src/providers/ai/AIProvider.d.ts +57 -0
- package/dist/types/src/providers/ai/AIProviderContext.d.ts +13 -0
- package/dist/types/src/providers/ai/anthropic.d.ts +2 -0
- package/dist/types/src/providers/ai/deepseek.d.ts +1 -0
- package/dist/types/src/providers/ai/gemini.d.ts +2 -0
- package/dist/types/src/providers/ai/glm.d.ts +1 -0
- package/dist/types/src/providers/ai/index.d.ts +20 -134
- package/dist/types/src/providers/ai/mistral.d.ts +1 -0
- package/dist/types/src/providers/ai/openai.d.ts +1 -0
- package/dist/types/src/providers/ai/openaiCompatible.d.ts +19 -0
- package/dist/types/src/providers/ai/opencode.d.ts +2 -0
- package/dist/types/src/providers/ai/openrouter.d.ts +1 -0
- package/dist/types/src/providers/ai/shared.d.ts +55 -0
- package/dist/types/src/providers/api/ApiProvider.d.ts +43 -0
- package/dist/types/src/providers/api/direct.d.ts +14 -0
- package/dist/types/src/providers/api/firebase.d.ts +14 -0
- package/dist/types/src/providers/api/mock.d.ts +7 -0
- package/dist/types/src/providers/api/supabase.d.ts +14 -0
- package/dist/types/src/providers/auth/AuthProvider.d.ts +10 -2
- package/dist/types/src/providers/auth/firebase/FirebaseAuthProvider.d.ts +49 -0
- package/dist/types/src/providers/auth/google/GoogleAuth.d.ts +2 -2
- package/dist/types/src/providers/auth/supabase/SupabaseAuthProvider.d.ts +48 -0
- package/dist/types/src/providers/credentials/CredentialsProvider.d.ts +3 -0
- package/dist/types/src/providers/credentials/CredentialsProviderContext.d.ts +12 -0
- package/dist/types/src/providers/credentials/google/GoogleServiceAccountProvider.d.ts +8 -0
- package/dist/types/src/providers/data/DataProvider.d.ts +27 -1
- package/dist/types/src/providers/data/firebase.d.ts +5 -4
- package/dist/types/src/providers/data/firestore.d.ts +45 -0
- package/dist/types/src/providers/data/mock.d.ts +8 -1
- package/dist/types/src/providers/data/supabase.d.ts +36 -10
- package/dist/types/src/providers/email/definitions.d.ts +3 -0
- package/dist/types/src/providers/firebase-init.d.ts +24 -7
- package/dist/types/src/providers/icon/PhosphorIconProvider.d.ts +1 -1
- package/dist/types/src/providers/manifest.d.ts +20 -14
- package/dist/types/src/providers/proxy/index.d.ts +7 -0
- package/dist/types/src/providers/proxy/vite.d.ts +3 -0
- package/dist/types/src/providers/publish/PublishProvider.d.ts +29 -0
- package/dist/types/src/providers/publish/definitions.d.ts +3 -0
- package/dist/types/src/providers/scrape/index.d.ts +2 -1
- package/dist/types/src/providers/seo/google/keyword.d.ts +6 -1
- package/dist/types/src/providers/storage/StorageProvider.d.ts +155 -4
- package/dist/types/src/providers/storage/dropbox.d.ts +3 -3
- package/dist/types/src/providers/storage/firebase.d.ts +44 -7
- package/dist/types/src/providers/storage/supabase.d.ts +47 -7
- package/dist/types/src/providers/supabase-init.d.ts +35 -0
- package/dist/types/src/types/FormFields.d.ts +4 -2
- package/dist/types/src/types/FormSchema.d.ts +29 -0
- package/dist/types/themes/tokyo-night-light.d.ts +3 -0
- package/dist/types/themes/tokyo-night.d.ts +3 -0
- package/dist/types/themes/vscode-dark-plus.d.ts +3 -0
- package/dist/types/themes/vscode-light-plus.d.ts +3 -0
- package/dist/vite.js +1 -0
- package/dist/vite.mjs +54 -0
- package/package.json +46 -8
- package/scripts/cli/proxy-templates/cloudflare.ts +34 -0
- package/scripts/cli/proxy-templates/express.ts +77 -0
- package/scripts/cli/proxy-templates/nextjs-app.ts +42 -0
- package/scripts/cli/proxy-templates/nextjs-pages.ts +41 -0
- package/scripts/cli/proxy-templates/scaffold.json +33 -0
- package/scripts/cli/setup-devtools.js +155 -85
- package/scripts/cli/setup-project.js +618 -484
- package/themes/cyber.ts +469 -405
- package/themes/default.ts +469 -405
- package/themes/flat.ts +469 -405
- package/themes/tokyo-night-light.ts +38 -0
- package/themes/tokyo-night.ts +38 -0
- package/themes/vscode-dark-plus.ts +29 -0
- package/themes/vscode-light-plus.ts +29 -0
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/types/src/components/FormEnhancer.d.ts +0 -26
- package/dist/types/src/components/Template.d.ts +0 -18
- package/dist/types/src/components/ui/fields/AssistantAI.d.ts +0 -23
- package/dist/types/src/components/ui/fields/Command.d.ts +0 -15
- package/dist/types/src/components/ui/fields/ImageUrl.d.ts +0 -7
- package/dist/types/src/libs/cache.d.ts +0 -9
- package/dist/types/src/libs/database.d.ts +0 -3
- package/dist/types/src/libs/log.d.ts +0 -2
- package/dist/types/src/libs/seo.d.ts +0 -8
- package/dist/types/src/libs/storage.d.ts +0 -2
- package/dist/types/src/pages/Blog.d.ts +0 -3
- package/dist/types/src/pages/BlogPost.d.ts +0 -16
- package/dist/types/src/pages/Helper.d.ts +0 -8
- package/dist/types/src/providers/auth/google/apis/auth.d.ts +0 -4
- package/dist/types/src/types/Block.d.ts +0 -4
- package/dist/types/src/types/Section.d.ts +0 -4
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RecordProps } from "../../providers/data/DataProvider";
|
|
2
|
+
import { FieldValue, RecordProps } from "../../providers/data/DataProvider";
|
|
3
3
|
import { FormTree, ModelProps } from "../Component";
|
|
4
4
|
import { UIProps } from '../';
|
|
5
|
-
|
|
5
|
+
import { type FormController } from './form-controller';
|
|
6
|
+
export type ChangeHandler = React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement> | {
|
|
6
7
|
target: {
|
|
7
8
|
name: string;
|
|
8
|
-
value?:
|
|
9
|
+
value?: FieldValue;
|
|
9
10
|
};
|
|
10
11
|
};
|
|
11
12
|
type FormHandleChange = (event: ChangeHandler) => void;
|
|
12
13
|
export type FieldOnChange = (params: {
|
|
13
14
|
event: ChangeHandler;
|
|
14
15
|
name: string;
|
|
15
|
-
value:
|
|
16
|
+
value: FieldValue;
|
|
16
17
|
record: RecordProps;
|
|
17
18
|
onChange: FormHandleChange;
|
|
18
19
|
}) => void;
|
|
19
20
|
export type InputType = "text" | "number" | "email" | "password" | "color" | "date" | "time" | "datetime-local" | "week" | "month" | "range" | "checkbox" | "radio" | "url";
|
|
21
|
+
export type LabelMode = "default" | "floating";
|
|
20
22
|
interface FormContextProps {
|
|
21
23
|
name: string;
|
|
22
24
|
onChange?: FieldOnChange;
|
|
23
|
-
|
|
25
|
+
wrapperClassName?: string;
|
|
24
26
|
inputType?: InputType;
|
|
25
|
-
defaultValue?:
|
|
27
|
+
defaultValue?: FieldValue;
|
|
28
|
+
inheritWrapperClassName?: boolean;
|
|
26
29
|
}
|
|
27
30
|
interface FormContextResult {
|
|
28
|
-
value:
|
|
31
|
+
value: FieldValue;
|
|
29
32
|
handleChange: FormHandleChange;
|
|
30
33
|
formWrapClass?: string;
|
|
31
34
|
record: RecordProps;
|
|
@@ -33,29 +36,44 @@ interface FormContextResult {
|
|
|
33
36
|
export interface FormFieldProps extends UIProps {
|
|
34
37
|
name: string;
|
|
35
38
|
label?: string;
|
|
36
|
-
|
|
39
|
+
labelMode?: LabelMode;
|
|
40
|
+
value?: FieldValue;
|
|
37
41
|
required?: boolean;
|
|
38
42
|
onChange?: FieldOnChange;
|
|
39
|
-
defaultValue?:
|
|
43
|
+
defaultValue?: FieldValue;
|
|
44
|
+
inheritWrapperClassName?: boolean;
|
|
40
45
|
}
|
|
41
46
|
interface SetFormFieldsNameProps {
|
|
42
47
|
children: React.ReactNode;
|
|
43
48
|
parentName: string;
|
|
44
49
|
parentKey?: string;
|
|
45
|
-
|
|
50
|
+
wrapperClassName?: string;
|
|
46
51
|
}
|
|
47
|
-
|
|
52
|
+
interface FieldValidationConstraints {
|
|
53
|
+
required?: boolean;
|
|
54
|
+
label?: string;
|
|
55
|
+
validator?: (value: FieldValue) => string | undefined | Promise<string | undefined>;
|
|
56
|
+
}
|
|
57
|
+
interface FormValidationContextValue {
|
|
58
|
+
registerField: (name: string, ref: React.MutableRefObject<FieldValidationConstraints>) => void;
|
|
59
|
+
unregisterField: (name: string) => void;
|
|
60
|
+
clearFieldError: (name: string) => void;
|
|
61
|
+
errors: Record<string, string>;
|
|
62
|
+
}
|
|
63
|
+
export declare const FormValidationContext: React.Context<FormValidationContextValue | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Hook for field components to register themselves for validation and receive
|
|
66
|
+
* their error message. Call it in every field that supports `required`.
|
|
67
|
+
*/
|
|
68
|
+
export declare const useFieldValidation: (name: string, constraints: FieldValidationConstraints) => string | undefined;
|
|
69
|
+
export declare const useFormContext: ({ name, onChange, wrapperClassName, inputType, defaultValue, inheritWrapperClassName }: FormContextProps) => FormContextResult;
|
|
48
70
|
type UseHandleDropProps = {
|
|
49
71
|
name: string;
|
|
50
|
-
value:
|
|
72
|
+
value: FieldValue;
|
|
51
73
|
handleChange?: FormHandleChange;
|
|
52
74
|
};
|
|
53
75
|
export declare const useHandleDrop: ({ name, value, handleChange }: UseHandleDropProps) => (e: React.DragEvent<HTMLTextAreaElement | HTMLInputElement>) => void;
|
|
54
|
-
export declare const setFormFieldsName: ({ children, parentName, parentKey,
|
|
55
|
-
export type SavePathProps = {
|
|
56
|
-
record: RecordProps;
|
|
57
|
-
storagePath?: string;
|
|
58
|
-
};
|
|
76
|
+
export declare const setFormFieldsName: ({ children, parentName, parentKey, wrapperClassName }: SetFormFieldsNameProps) => React.ReactNode;
|
|
59
77
|
export type FormSaveArgs = {
|
|
60
78
|
record?: RecordProps;
|
|
61
79
|
prevRecord?: RecordProps;
|
|
@@ -72,26 +90,49 @@ export type FormFinallyArgs = {
|
|
|
72
90
|
export type FormSaveHandler = (args: FormSaveArgs) => Promise<string | undefined>;
|
|
73
91
|
export type FormDeleteHandler = (args: FormDeleteArgs) => Promise<string | undefined>;
|
|
74
92
|
export type FormFinallyHandler = (args: FormFinallyArgs) => Promise<boolean>;
|
|
93
|
+
/** Core props shared by all Form variants. */
|
|
75
94
|
interface BaseFormProps {
|
|
76
|
-
|
|
95
|
+
/** Visual wrapper: `"card"` adds a card shell; `"empty"` renders bare. */
|
|
96
|
+
appearance?: "card" | "empty";
|
|
97
|
+
/** Shared controller for external actions, custom save buttons and draft state. */
|
|
98
|
+
controller?: FormController;
|
|
99
|
+
/** Custom content rendered in the form header area. */
|
|
77
100
|
header?: React.ReactNode;
|
|
101
|
+
/** Custom content rendered in the form footer area. */
|
|
78
102
|
footer?: React.ReactNode;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
103
|
+
/** Provider path for data load and save. Omit for a pure local form. */
|
|
104
|
+
path?: string;
|
|
105
|
+
/** Generate a custom primary key for new records instead of auto-push. */
|
|
106
|
+
keyGenerator?: (record: RecordProps) => string;
|
|
107
|
+
/** Transform the record after loading from the provider. */
|
|
83
108
|
onLoad?: (record: RecordProps) => void;
|
|
84
|
-
|
|
109
|
+
/** Called on every field change with the current record state. */
|
|
110
|
+
onRecordChange?: (record: RecordProps) => void;
|
|
111
|
+
/** Transform the record before saving. Return the final record or a custom path. */
|
|
85
112
|
onSave?: FormSaveHandler;
|
|
113
|
+
/** Called before deletion. Return a path override or `undefined`. */
|
|
86
114
|
onDelete?: FormDeleteHandler;
|
|
87
|
-
|
|
115
|
+
/** Called after save or delete. Return `false` to suppress default navigation. */
|
|
116
|
+
onComplete?: FormFinallyHandler;
|
|
117
|
+
/** Log field-change events to the console (dev helper). */
|
|
88
118
|
log?: boolean;
|
|
119
|
+
/** Show the inline save/delete notice banner. Defaults to `true`. */
|
|
89
120
|
showNotice?: boolean;
|
|
121
|
+
/** Persist unsaved changes locally and offer restore/discard on re-entry. Defaults to `false`. */
|
|
122
|
+
persistDraft?: boolean;
|
|
123
|
+
/** When provided, the save/delete notice is rendered sticky at the top of this container
|
|
124
|
+
* instead of inline in the form footer. Ideal for full-page forms outside a modal. */
|
|
125
|
+
noticeAnchorRef?: React.RefObject<HTMLElement>;
|
|
126
|
+
/** Render a Back navigation button in the footer. */
|
|
90
127
|
showBack?: boolean;
|
|
91
|
-
|
|
92
|
-
|
|
128
|
+
/** CSS classes on the outermost wrapper element. */
|
|
129
|
+
wrapperClassName?: string;
|
|
130
|
+
/** CSS classes on the header container. */
|
|
131
|
+
headerClassName?: string;
|
|
132
|
+
/** CSS classes on the form body element. */
|
|
93
133
|
className?: string;
|
|
94
|
-
|
|
134
|
+
/** CSS classes on the footer container. */
|
|
135
|
+
footerClassName?: string;
|
|
95
136
|
}
|
|
96
137
|
interface FormDefaultProps extends BaseFormProps {
|
|
97
138
|
children: React.ReactNode | ((fields: FormTree) => React.ReactNode) | ((args: {
|
|
@@ -100,30 +141,26 @@ interface FormDefaultProps extends BaseFormProps {
|
|
|
100
141
|
defaultValues?: RecordProps;
|
|
101
142
|
}
|
|
102
143
|
interface FormDatabaseProps extends FormDefaultProps {
|
|
103
|
-
|
|
144
|
+
path: string;
|
|
104
145
|
}
|
|
105
146
|
interface FormModelProps extends BaseFormProps {
|
|
106
147
|
model: ModelProps;
|
|
107
148
|
children?: ((fields: FormTree) => React.ReactNode);
|
|
108
149
|
}
|
|
109
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Public props for `<Form>`.
|
|
152
|
+
* When `path` points to an existing record the form loads its data automatically.
|
|
153
|
+
* When `keyGenerator` or `defaultValues` is set the form operates in create-only mode.
|
|
154
|
+
*/
|
|
155
|
+
export interface FormProps extends BaseFormProps {
|
|
156
|
+
/** Field elements, a render-prop receiving the field tree, or a record-aware function. */
|
|
110
157
|
children?: React.ReactNode | ((fields: FormTree) => React.ReactNode) | ((args: {
|
|
111
158
|
record?: RecordProps;
|
|
112
159
|
}) => React.ReactNode);
|
|
160
|
+
/** Initial field values for a new record. */
|
|
113
161
|
defaultValues?: RecordProps;
|
|
114
162
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
handleDelete: (e: React.MouseEvent<HTMLButtonElement>) => Promise<boolean>;
|
|
118
|
-
getHeader: () => React.ReactNode;
|
|
119
|
-
getRecord: () => {
|
|
120
|
-
record: RecordProps;
|
|
121
|
-
isNewRecord: boolean;
|
|
122
|
-
};
|
|
123
|
-
getFooter: () => React.ReactNode;
|
|
124
|
-
}
|
|
125
|
-
type FormHandlers = Partial<FormRef>;
|
|
126
|
-
export declare const FormDatabase: React.ForwardRefExoticComponent<FormDatabaseProps & React.RefAttributes<FormRef>>;
|
|
163
|
+
declare function Form(props: FormProps): React.JSX.Element;
|
|
164
|
+
export declare const FormDatabase: (props: FormDatabaseProps) => React.JSX.Element;
|
|
127
165
|
export declare function FormModel({ model, children, ...formProps }: FormModelProps): React.JSX.Element | null;
|
|
128
|
-
|
|
129
|
-
export default _default;
|
|
166
|
+
export default Form;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
imageUrl: string;
|
|
2
|
+
export type ImageEditorProps = {
|
|
3
|
+
src: string;
|
|
5
4
|
title?: string;
|
|
6
5
|
width?: number;
|
|
7
6
|
height?: number;
|
|
8
|
-
|
|
7
|
+
mode?: "modal" | "inline";
|
|
9
8
|
onImageLoad?: () => void;
|
|
10
9
|
onClose?: () => void;
|
|
11
10
|
onSave?: (dataUrl: string) => void;
|
|
12
11
|
};
|
|
13
|
-
declare const ImageEditor: ({
|
|
12
|
+
declare const ImageEditor: ({ src, title, width, height, mode, onImageLoad, onClose, onSave }: ImageEditorProps) => React.JSX.Element;
|
|
14
13
|
export default ImageEditor;
|
|
@@ -6,9 +6,9 @@ export interface MarkdownReaderProps {
|
|
|
6
6
|
content: string;
|
|
7
7
|
components?: MarkdownComponents;
|
|
8
8
|
className?: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
wrapperClassName?: string;
|
|
10
|
+
metadata?: PageMetadataState;
|
|
11
|
+
onInternalLinkClick?: (href: string, event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
12
12
|
}
|
|
13
|
-
export default function MarkdownReader({ content, components, className,
|
|
13
|
+
export default function MarkdownReader({ content, components, className, wrapperClassName, metadata, onInternalLinkClick, }: MarkdownReaderProps): React.JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -1,31 +1,99 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AIFetchConfig } from '../../providers/ai';
|
|
3
2
|
import { PromptVariables } from '../../conf/Prompt';
|
|
3
|
+
import { type AIProviderAdapter, type AIRequestOptions, type AIAttachment } from '../../providers/ai/AIProvider';
|
|
4
|
+
import { RecordProps } from '../../providers/data/DataProvider';
|
|
5
|
+
import { type EditorCommand } from '../ui/fields/ContextMenu';
|
|
4
6
|
import { FormFieldProps } from './Form';
|
|
5
7
|
export declare enum PromptMode {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
EDIT = "edit",
|
|
9
|
+
RUN = "run"
|
|
8
10
|
}
|
|
9
|
-
type
|
|
11
|
+
export type PromptAction = {
|
|
12
|
+
key: string;
|
|
13
|
+
icon: string;
|
|
14
|
+
label?: string;
|
|
15
|
+
content?: React.ReactNode;
|
|
16
|
+
};
|
|
17
|
+
export type PromptStatusItem = 'tokensIn' | 'tokensOut' | 'contextPercent' | 'model' | 'duration' | {
|
|
18
|
+
key: string;
|
|
19
|
+
render: (stats: PromptRunStats) => React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export type PromptRunStats = {
|
|
22
|
+
tokensIn: number;
|
|
23
|
+
tokensOut: number;
|
|
24
|
+
contextPercent: number | null;
|
|
25
|
+
model: string;
|
|
26
|
+
durationMs: number;
|
|
27
|
+
estimatedCost: number | null;
|
|
28
|
+
};
|
|
29
|
+
type PromptOptions = AIRequestOptions & {
|
|
10
30
|
value: string;
|
|
11
31
|
};
|
|
12
|
-
type
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
32
|
+
type PromptConfig = Partial<PromptOptions> & {
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
};
|
|
35
|
+
type OnRunPrompt = (prompt: string, options: AIRequestOptions, data?: PromptVariables) => Promise<string>;
|
|
36
|
+
type PromptDefaultValue = {
|
|
37
|
+
value?: string;
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
role?: string;
|
|
40
|
+
language?: string;
|
|
41
|
+
voice?: string;
|
|
42
|
+
style?: string;
|
|
43
|
+
model?: string;
|
|
44
|
+
temperature?: number;
|
|
45
|
+
};
|
|
46
|
+
type RenderPlainFallback = (props: Omit<FormFieldProps, "defaultValue">) => React.ReactNode;
|
|
47
|
+
type RenderAIUnavailable = (props: {
|
|
48
|
+
mode: PromptMode;
|
|
49
|
+
providerId?: string | null;
|
|
50
|
+
reason?: string;
|
|
51
|
+
configured: boolean;
|
|
52
|
+
}) => React.ReactNode;
|
|
53
|
+
interface PromptFieldBase {
|
|
54
|
+
name: string;
|
|
55
|
+
label?: string;
|
|
56
|
+
required?: boolean;
|
|
57
|
+
onChange?: FormFieldProps["onChange"];
|
|
58
|
+
before?: React.ReactNode;
|
|
59
|
+
after?: React.ReactNode;
|
|
60
|
+
wrapperClassName?: string;
|
|
61
|
+
className?: string;
|
|
62
|
+
minHeight?: number;
|
|
63
|
+
maxHeight?: number;
|
|
64
|
+
}
|
|
65
|
+
interface PromptWithAI extends PromptFieldBase {
|
|
66
|
+
defaultValue?: PromptDefaultValue;
|
|
67
|
+
renderAIUnavailable?: RenderAIUnavailable;
|
|
68
|
+
}
|
|
69
|
+
interface PromptEditorProps extends PromptWithAI {
|
|
70
|
+
value?: RecordProps & {
|
|
71
|
+
prompt?: PromptConfig;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
interface PromptRunProps extends PromptWithAI {
|
|
75
|
+
value?: RecordProps & {
|
|
76
|
+
prompt?: PromptConfig;
|
|
27
77
|
};
|
|
78
|
+
variables?: PromptVariables;
|
|
79
|
+
onRunPrompt?: OnRunPrompt;
|
|
80
|
+
renderFallback?: RenderPlainFallback;
|
|
81
|
+
commands?: EditorCommand[];
|
|
82
|
+
commandsTrigger?: string;
|
|
83
|
+
attachments?: boolean;
|
|
84
|
+
actions?: PromptAction[];
|
|
85
|
+
statusItems?: PromptStatusItem[];
|
|
28
86
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
87
|
+
type PromptEditBranch = PromptEditorProps & {
|
|
88
|
+
mode?: PromptMode.EDIT;
|
|
89
|
+
};
|
|
90
|
+
type PromptRunBranch = PromptRunProps & {
|
|
91
|
+
mode: PromptMode.RUN;
|
|
92
|
+
};
|
|
93
|
+
export type PromptProps = PromptEditBranch | PromptRunBranch;
|
|
94
|
+
export declare const Prompt: ({ mode, ...props }: PromptProps) => React.JSX.Element;
|
|
95
|
+
export declare const runPrompt: (options: PromptOptions, data?: PromptVariables, onRunPrompt?: OnRunPrompt, provider?: AIProviderAdapter, attachments?: AIAttachment[], messages?: {
|
|
96
|
+
noProvider?: string;
|
|
97
|
+
noResponse?: string;
|
|
98
|
+
}) => Promise<string>;
|
|
99
|
+
export default Prompt;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TabPosition } from '../ui/Tab';
|
|
3
3
|
import { FieldOnChange } from './Form';
|
|
4
|
+
import { RecordProps } from '../../providers/data/DataProvider';
|
|
4
5
|
interface TabDynamicProps {
|
|
5
|
-
children: React.ReactNode | ((record:
|
|
6
|
+
children: React.ReactNode | ((record: RecordProps) => React.ReactNode);
|
|
6
7
|
name: string;
|
|
7
8
|
onChange?: FieldOnChange;
|
|
8
|
-
onAdd?: (value:
|
|
9
|
+
onAdd?: (value: RecordProps[]) => void;
|
|
9
10
|
onRemove?: (index: number) => void;
|
|
10
|
-
value?:
|
|
11
|
+
value?: RecordProps[];
|
|
11
12
|
label?: string;
|
|
12
13
|
min?: number;
|
|
13
14
|
max?: number;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RecordProps } from '../../providers/data/DataProvider';
|
|
3
|
+
export type FormDraftStatus = 'restore' | 'restored' | null;
|
|
4
|
+
export type FormActionEvent = {
|
|
5
|
+
preventDefault?: () => void;
|
|
6
|
+
};
|
|
7
|
+
export type FormControllerState = {
|
|
8
|
+
record?: RecordProps;
|
|
9
|
+
isNewRecord: boolean;
|
|
10
|
+
isDirty: boolean;
|
|
11
|
+
canSave: boolean;
|
|
12
|
+
canDelete: boolean;
|
|
13
|
+
isSaving: boolean;
|
|
14
|
+
isDeleting: boolean;
|
|
15
|
+
saveDisabled: boolean;
|
|
16
|
+
deleteDisabled: boolean;
|
|
17
|
+
hasDraft: boolean;
|
|
18
|
+
draftStatus: FormDraftStatus;
|
|
19
|
+
errors: Record<string, string>;
|
|
20
|
+
hasErrors: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type FormControllerActions = {
|
|
23
|
+
save: (event?: FormActionEvent) => Promise<boolean>;
|
|
24
|
+
delete: (event?: FormActionEvent) => Promise<boolean>;
|
|
25
|
+
reset: () => void;
|
|
26
|
+
restoreDraft: () => void;
|
|
27
|
+
discardDraft: () => void;
|
|
28
|
+
};
|
|
29
|
+
export type FormController = FormControllerState & FormControllerActions;
|
|
30
|
+
type FormControllerStore = {
|
|
31
|
+
bindActions: (actions: Partial<FormControllerActions>) => void;
|
|
32
|
+
getControllerSnapshot: () => FormController;
|
|
33
|
+
getState: () => FormControllerState;
|
|
34
|
+
setState: (nextState: Partial<FormControllerState>) => void;
|
|
35
|
+
subscribe: (listener: () => void) => () => void;
|
|
36
|
+
};
|
|
37
|
+
export declare function getFormControllerStore(controller: FormController): FormControllerStore;
|
|
38
|
+
export declare function resetFormController(controller: FormController): void;
|
|
39
|
+
export declare const FormControllerContext: React.Context<FormController | null>;
|
|
40
|
+
export declare function useFormController(controller?: FormController): FormController;
|
|
41
|
+
export declare function useFormActions(): FormController;
|
|
42
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type RecordProps } from "../../../providers/data/DataProvider";
|
|
3
3
|
import { type GridCoreProps } from "./types";
|
|
4
|
-
declare function GridCore<TRecord extends RecordProps>({ records, recordId, sourcePath, columns, actions, form,
|
|
4
|
+
declare function GridCore<TRecord extends RecordProps>({ records, recordId, sourcePath, columns, actions, form, editDeepLink, header, footer, view, sticky, wrapperClassName, loading, title, before, after, sortable, pagination, selection, onRowClick, reorderable, onReorder, groupBy, onSave, onDelete, onComplete, audit, onLoad, }: GridCoreProps<TRecord>): React.JSX.Element;
|
|
5
5
|
export default GridCore;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type RecordProps } from "../../../providers/data/DataProvider";
|
|
3
3
|
import { type GridDBProps } from "./types";
|
|
4
|
-
declare function GridDB<TRecord extends RecordProps = RecordProps>({ path, where, order, fieldMap,
|
|
4
|
+
declare function GridDB<TRecord extends RecordProps = RecordProps>({ path, fromUrl, where, order, fieldMap, recordId, ...rest }: GridDBProps<TRecord>): React.JSX.Element;
|
|
5
5
|
export default GridDB;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type RecordProps } from "../../../providers/data/DataProvider";
|
|
3
3
|
import { type GridGalleryViewProps } from "./types";
|
|
4
|
-
declare function GridGalleryView<TRecord extends RecordProps>({ records, recordId, sortable, pagination, selection, selectedKeys, onSelectionChange,
|
|
4
|
+
declare function GridGalleryView<TRecord extends RecordProps>({ records, recordId, sortable, pagination, selection, selectedKeys, onSelectionChange, onRowClick, groupBy, wrapperClassName, before, after, }: GridGalleryViewProps<TRecord>): React.JSX.Element;
|
|
5
5
|
export default GridGalleryView;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type RecordProps } from "../../../providers/data/DataProvider";
|
|
3
3
|
import { type GridTableViewProps } from "./types";
|
|
4
|
-
declare function GridTableView<TRecord extends RecordProps>({ records, recordId, columns, runAction, sortable, pagination, selection, selectedKeys, onSelectionChange,
|
|
4
|
+
declare function GridTableView<TRecord extends RecordProps>({ records, recordId, columns, runAction, sortable, pagination, selection, selectedKeys, onSelectionChange, onRowClick, reorderable, onReorder, activeKey, groupBy, wrapperClassName, before, after, }: GridTableViewProps<TRecord>): React.JSX.Element;
|
|
5
5
|
export default GridTableView;
|
|
@@ -14,11 +14,21 @@ export type GridCellContext<TRecord> = {
|
|
|
14
14
|
rowIndex: number;
|
|
15
15
|
runAction: (actionKey: string) => void;
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Column definition for `<Grid>` / `<Table>`.
|
|
19
|
+
* `render` accepts a built-in format string ("date", "badge", …) or a custom
|
|
20
|
+
* render function that receives the full cell context.
|
|
21
|
+
*/
|
|
17
22
|
export type GridColumn<TRecord> = {
|
|
23
|
+
/** Record field to read. Accepts dot-notation strings for nested fields. */
|
|
18
24
|
key: keyof TRecord | string;
|
|
25
|
+
/** Column header label. */
|
|
19
26
|
label: string;
|
|
27
|
+
/** Enable click-to-sort on this column. */
|
|
20
28
|
sortable?: boolean;
|
|
29
|
+
/** Extra CSS classes on the `<td>` / cell wrapper. */
|
|
21
30
|
className?: string;
|
|
31
|
+
/** Built-in format name or custom render function. */
|
|
22
32
|
render?: GridFormat | ((ctx: GridCellContext<TRecord>) => React.ReactNode);
|
|
23
33
|
};
|
|
24
34
|
export type GridSelectionState<TRecord> = {
|
|
@@ -28,6 +38,11 @@ export type GridSelectionState<TRecord> = {
|
|
|
28
38
|
clear: () => void;
|
|
29
39
|
};
|
|
30
40
|
export type GridSelectionChangeHandler<TRecord> = (selection: GridSelectionState<TRecord>) => void;
|
|
41
|
+
export type GridSelectionConfig<TRecord> = {
|
|
42
|
+
mode: "single" | "multiple";
|
|
43
|
+
defaultKeys?: string[];
|
|
44
|
+
onChange?: GridSelectionChangeHandler<TRecord>;
|
|
45
|
+
};
|
|
31
46
|
export type GridReorderMeta<TRecord> = {
|
|
32
47
|
fromIndex: number;
|
|
33
48
|
toIndex: number;
|
|
@@ -60,7 +75,7 @@ export type GridModalAction<TRecord> = {
|
|
|
60
75
|
title?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
|
|
61
76
|
size?: "sm" | "md" | "lg" | "xl" | "fullscreen";
|
|
62
77
|
position?: "center" | "top" | "left" | "right" | "bottom";
|
|
63
|
-
|
|
78
|
+
allowFullscreen?: boolean;
|
|
64
79
|
header?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
|
|
65
80
|
body?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
|
|
66
81
|
footer?: React.ReactNode | false | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
|
|
@@ -98,7 +113,7 @@ export type GridDeleteAction<TRecord> = {
|
|
|
98
113
|
title?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
|
|
99
114
|
size?: "sm" | "md" | "lg" | "xl" | "fullscreen";
|
|
100
115
|
position?: "center" | "top" | "left" | "right" | "bottom";
|
|
101
|
-
|
|
116
|
+
allowFullscreen?: boolean;
|
|
102
117
|
header?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
|
|
103
118
|
body?: React.ReactNode | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
|
|
104
119
|
footer?: React.ReactNode | false | ((ctx: GridModalActionContext<TRecord>) => React.ReactNode);
|
|
@@ -134,44 +149,69 @@ export type GridAfterActionArgs<TRecord> = {
|
|
|
134
149
|
action: "create" | "update" | "delete";
|
|
135
150
|
};
|
|
136
151
|
export type GridAfterActionHandler<TRecord> = (args: GridAfterActionArgs<TRecord>) => Promise<boolean>;
|
|
137
|
-
|
|
138
|
-
edit?: boolean;
|
|
139
|
-
};
|
|
152
|
+
/** Visual / layout props for `<Grid>`. */
|
|
140
153
|
export type GridPresentation = {
|
|
141
|
-
layout
|
|
154
|
+
/** Display mode: `"table"` (default) or `"gallery"` card layout. */
|
|
155
|
+
view?: GridLayout;
|
|
156
|
+
/** Stick the header (`"top"`) or footer (`"bottom"`) while scrolling. */
|
|
142
157
|
sticky?: GridSticky;
|
|
143
|
-
|
|
158
|
+
/** CSS classes on the outermost wrapper element. */
|
|
159
|
+
wrapperClassName?: string;
|
|
160
|
+
/** Show a loading skeleton instead of rows. */
|
|
144
161
|
loading?: boolean;
|
|
162
|
+
/** Title rendered in the Grid header area. */
|
|
145
163
|
title?: React.ReactNode;
|
|
164
|
+
/** Content rendered before the Grid. */
|
|
165
|
+
before?: React.ReactNode;
|
|
166
|
+
/** Content rendered after the Grid. */
|
|
167
|
+
after?: React.ReactNode;
|
|
146
168
|
};
|
|
169
|
+
/** Interaction / behaviour props for `<Grid>`. */
|
|
147
170
|
export type GridBehavior<TRecord> = {
|
|
171
|
+
/** Enable global sorting. Pass an `OrderConfig` to set a default sort. */
|
|
148
172
|
sortable?: boolean | OrderConfig;
|
|
173
|
+
/** Pagination config. `{ limit: 20 }` is the common form. */
|
|
149
174
|
pagination?: PaginationParams;
|
|
150
|
-
selection
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
175
|
+
/** Row selection: `false` (off), `"single"`, `"multiple"`, or a full `GridSelectionConfig`. */
|
|
176
|
+
selection?: false | "single" | "multiple" | GridSelectionConfig<TRecord>;
|
|
177
|
+
/** Called when the user clicks a row (outside an action button). */
|
|
178
|
+
onRowClick?: (record: TRecord) => void;
|
|
179
|
+
/** Allow drag-and-drop row reordering. */
|
|
155
180
|
reorderable?: boolean;
|
|
181
|
+
/** Called after a drag reorder with the new record order and move metadata. */
|
|
156
182
|
onReorder?: GridReorderHandler<TRecord>;
|
|
183
|
+
/** Group rows by a field or array of fields. */
|
|
157
184
|
groupBy?: keyof TRecord | string | Array<keyof TRecord | string>;
|
|
158
185
|
};
|
|
186
|
+
/** Data-mutation hooks for `<Grid>`. */
|
|
159
187
|
export type GridPersistence<TRecord> = {
|
|
188
|
+
/** Called before saving a record. Return a custom storage path or `undefined`. */
|
|
160
189
|
onSave?: GridMutationSaveHandler<TRecord>;
|
|
190
|
+
/** Called before deleting a record. Return a path override or `undefined`. */
|
|
161
191
|
onDelete?: GridMutationDeleteHandler<TRecord>;
|
|
162
|
-
|
|
163
|
-
|
|
192
|
+
/** Called after create/update/delete. Return `false` to suppress default navigation. */
|
|
193
|
+
onComplete?: GridAfterActionHandler<TRecord>;
|
|
194
|
+
/** Automatically write `createdAt` / `updatedAt` timestamps on every mutation. */
|
|
164
195
|
audit?: boolean;
|
|
165
196
|
};
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Full prop surface shared by all `<Grid>` variants.
|
|
199
|
+
* Combines presentation, behaviour, and persistence with a few top-level hooks.
|
|
200
|
+
*/
|
|
201
|
+
export type GridBaseProps<TRecord> = GridPresentation & GridBehavior<TRecord> & GridPersistence<TRecord> & {
|
|
202
|
+
/** Transform the record array after loading (filter, sort, enrich). */
|
|
203
|
+
onLoad?: (records: TRecord[]) => TRecord[] | Promise<TRecord[]>;
|
|
204
|
+
/** Column definitions. Omit to auto-generate from record keys. */
|
|
170
205
|
columns?: GridColumn<TRecord>[];
|
|
206
|
+
/** Enable built-in `"add"/"edit"/"delete"` shortcuts, or provide custom `GridAction` objects. */
|
|
171
207
|
actions?: GridActions<TRecord>;
|
|
208
|
+
/** Form element or factory rendered inside the add/edit modal. */
|
|
172
209
|
form?: React.ReactElement | ((ctx: GridFormContext<TRecord>) => React.ReactNode);
|
|
173
|
-
|
|
210
|
+
/** Sync the edit modal state to the URL hash (enables direct links). */
|
|
211
|
+
editDeepLink?: boolean;
|
|
212
|
+
/** Content rendered in the Grid header bar. Receives selection context. */
|
|
174
213
|
header?: React.ReactNode | ((ctx: GridHeaderContext<TRecord>) => React.ReactNode);
|
|
214
|
+
/** Content rendered in the Grid footer bar. Receives selection context. */
|
|
175
215
|
footer?: React.ReactNode | ((ctx: GridFooterContext<TRecord>) => React.ReactNode);
|
|
176
216
|
};
|
|
177
217
|
export type GridCoreProps<TRecord extends RecordProps> = GridBaseProps<TRecord> & {
|
|
@@ -183,12 +223,17 @@ export type GridArrayProps<TRecord extends RecordProps> = GridBaseProps<TRecord>
|
|
|
183
223
|
records: TRecord[];
|
|
184
224
|
recordId: GridRecordKey<TRecord>;
|
|
185
225
|
};
|
|
186
|
-
export type GridDBQuery = Pick<DatabaseOptions, "where" | "order" | "fieldMap"
|
|
187
|
-
export type GridDBPath = string
|
|
188
|
-
export type GridDBProps<TRecord extends RecordProps = RecordProps> = GridBaseProps<TRecord> & GridDBQuery & {
|
|
226
|
+
export type GridDBQuery = Pick<DatabaseOptions, "where" | "order" | "fieldMap">;
|
|
227
|
+
export type GridDBPath = string;
|
|
228
|
+
export type GridDBProps<TRecord extends RecordProps = RecordProps> = GridBaseProps<TRecord> & GridDBQuery & ({
|
|
229
|
+
fromUrl: true;
|
|
230
|
+
path?: never;
|
|
231
|
+
recordId?: GridRecordKey<TRecord>;
|
|
232
|
+
} | {
|
|
233
|
+
fromUrl?: false;
|
|
189
234
|
path: GridDBPath;
|
|
190
235
|
recordId?: GridRecordKey<TRecord>;
|
|
191
|
-
};
|
|
236
|
+
});
|
|
192
237
|
export type GridGatewayArrayProps<TRecord extends RecordProps> = GridArrayProps<TRecord> & {
|
|
193
238
|
path?: never;
|
|
194
239
|
};
|
|
@@ -206,11 +251,14 @@ export type GridTableViewProps<TRecord extends RecordProps> = {
|
|
|
206
251
|
selection?: GridSelectionMode;
|
|
207
252
|
selectedKeys?: string[];
|
|
208
253
|
onSelectionChange?: GridSelectionChangeHandler<TRecord>;
|
|
209
|
-
|
|
254
|
+
onRowClick?: (record: TRecord) => void;
|
|
210
255
|
reorderable?: boolean;
|
|
211
256
|
onReorder?: GridReorderHandler<TRecord>;
|
|
212
257
|
activeKey?: string | null;
|
|
213
|
-
|
|
258
|
+
groupBy?: keyof TRecord | string | Array<keyof TRecord | string>;
|
|
259
|
+
wrapperClassName?: string;
|
|
260
|
+
before?: React.ReactNode;
|
|
261
|
+
after?: React.ReactNode;
|
|
214
262
|
};
|
|
215
263
|
export type GridGalleryViewProps<TRecord extends RecordProps> = {
|
|
216
264
|
records: TRecord[];
|
|
@@ -220,8 +268,10 @@ export type GridGalleryViewProps<TRecord extends RecordProps> = {
|
|
|
220
268
|
selection?: GridSelectionMode;
|
|
221
269
|
selectedKeys?: string[];
|
|
222
270
|
onSelectionChange?: GridSelectionChangeHandler<TRecord>;
|
|
223
|
-
|
|
271
|
+
onRowClick?: (record: TRecord) => void;
|
|
224
272
|
groupBy?: keyof TRecord | string | Array<keyof TRecord | string>;
|
|
225
|
-
|
|
273
|
+
wrapperClassName?: string;
|
|
274
|
+
before?: React.ReactNode;
|
|
275
|
+
after?: React.ReactNode;
|
|
226
276
|
};
|
|
227
277
|
export {};
|