proje-react-panel 1.8.0 → 1.9.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 +1 -0
- package/dist/__tests__/components/form/FormGroups.test.d.ts +1 -0
- package/dist/__tests__/components/form/RichTextField.test.d.ts +4 -0
- package/dist/__tests__/optionalTiptap.test.d.ts +4 -0
- package/dist/components/form/RichTextField.d.ts +7 -0
- package/dist/decorators/form/Form.d.ts +8 -0
- package/dist/decorators/form/Input.d.ts +5 -1
- package/dist/decorators/form/inputs/RichTextInput.d.ts +13 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +2 -2
- package/how_to.md +150 -32
- package/jest.config.js +1 -0
- package/package.json +13 -1
- package/src/__tests__/components/form/FormGroups.test.tsx +194 -0
- package/src/__tests__/components/form/RichTextField.test.tsx +181 -0
- package/src/__tests__/optionalTiptap.test.tsx +89 -0
- package/src/components/form/FormField.tsx +8 -1
- package/src/components/form/InnerForm.tsx +101 -19
- package/src/components/form/RichTextField.tsx +218 -0
- package/src/decorators/form/Form.ts +11 -0
- package/src/decorators/form/Input.ts +6 -1
- package/src/decorators/form/inputs/RichTextInput.ts +38 -0
- package/src/index.ts +8 -1
- package/src/styles/components/rich-text.scss +115 -0
- package/src/styles/form.scss +48 -0
- package/src/styles/index.scss +1 -0
- package/dist/components/DashboardContainer.d.ts +0 -7
- package/dist/components/DashboardGrid.d.ts +0 -9
- package/dist/components/DashboardItem.d.ts +0 -10
- package/dist/components/ThemeSwitcher.d.ts +0 -7
- package/dist/store/themeStore.d.ts +0 -23
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ The library provides several decorators for enhanced functionality:
|
|
|
27
27
|
|
|
28
28
|
- `@Input`: Form input decorator
|
|
29
29
|
- `@SelectInput`: Select input decorator
|
|
30
|
+
- `@RichTextInput`: Rich text (TipTap) input decorator — needs the optional `@tiptap/react` + `@tiptap/starter-kit` peers
|
|
30
31
|
- `@CustomInput`: Render your own component in place of a field
|
|
31
32
|
- `@Crud`: CRUD operations decorator
|
|
32
33
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InputConfiguration } from '../../decorators/form/Input';
|
|
3
|
+
export interface RichTextFieldProps {
|
|
4
|
+
input: InputConfiguration;
|
|
5
|
+
fieldName: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function RichTextField({ input, fieldName }: RichTextFieldProps): React.JSX.Element;
|
|
@@ -2,12 +2,19 @@ import 'reflect-metadata';
|
|
|
2
2
|
import { AnyClass, AnyClassConstructor } from '../../types/AnyClass';
|
|
3
3
|
import { GetDetailsDataFN } from '../details/Details';
|
|
4
4
|
export type OnSubmitFN<T, L = T> = (data: T | FormData) => Promise<L>;
|
|
5
|
+
export interface FormGroup {
|
|
6
|
+
key: string;
|
|
7
|
+
label: string;
|
|
8
|
+
collapsible?: boolean;
|
|
9
|
+
defaultCollapsed?: boolean;
|
|
10
|
+
}
|
|
5
11
|
interface FormOptions<T extends AnyClass, L = T> {
|
|
6
12
|
onSubmit: OnSubmitFN<T, L>;
|
|
7
13
|
onSubmitSuccess?: (data: L) => void;
|
|
8
14
|
getDetailsData?: GetDetailsDataFN<T>;
|
|
9
15
|
type?: 'json' | 'formData';
|
|
10
16
|
redirectSuccessUrl?: string;
|
|
17
|
+
groups?: FormGroup[];
|
|
11
18
|
}
|
|
12
19
|
export interface FormConfiguration<T extends AnyClass, L = T> {
|
|
13
20
|
onSubmit: OnSubmitFN<T, L>;
|
|
@@ -15,6 +22,7 @@ export interface FormConfiguration<T extends AnyClass, L = T> {
|
|
|
15
22
|
getDetailsData?: GetDetailsDataFN<T>;
|
|
16
23
|
type: 'json' | 'formData';
|
|
17
24
|
redirectSuccessUrl?: string;
|
|
25
|
+
groups?: FormGroup[];
|
|
18
26
|
}
|
|
19
27
|
export declare function Form<T extends AnyClass, L = T>(options?: FormOptions<T, L>): ClassDecorator;
|
|
20
28
|
export declare function getFormConfiguration<T extends AnyClass, K extends AnyClassConstructor<T>, L = T>(entityClass: K): FormConfiguration<T, L>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { AnyClass, AnyClassConstructor } from '../../types/AnyClass';
|
|
3
3
|
export type InputTypes = 'input' | 'textarea' | 'file-upload' | 'checkbox' | 'hidden' | 'nested';
|
|
4
|
-
export type ExtendedInputTypes = InputTypes | 'select' | 'custom';
|
|
4
|
+
export type ExtendedInputTypes = InputTypes | 'select' | 'custom' | 'richtext';
|
|
5
5
|
export interface InputOptions {
|
|
6
6
|
type?: InputTypes;
|
|
7
7
|
inputType?: 'text' | 'email' | 'tel' | 'password' | 'number' | 'date';
|
|
@@ -11,6 +11,8 @@ export interface InputOptions {
|
|
|
11
11
|
defaultValue?: string;
|
|
12
12
|
includeInCSV?: boolean;
|
|
13
13
|
includeInJSON?: boolean;
|
|
14
|
+
group?: string;
|
|
15
|
+
rows?: number;
|
|
14
16
|
}
|
|
15
17
|
export interface ExtendedInputOptions extends Omit<InputOptions, 'type'> {
|
|
16
18
|
type: ExtendedInputTypes;
|
|
@@ -26,6 +28,8 @@ export interface InputConfiguration {
|
|
|
26
28
|
defaultValue?: string;
|
|
27
29
|
includeInCSV: boolean;
|
|
28
30
|
includeInJSON: boolean;
|
|
31
|
+
group?: string;
|
|
32
|
+
rows?: number;
|
|
29
33
|
}
|
|
30
34
|
export declare function Input(options?: InputOptions): PropertyDecorator;
|
|
31
35
|
export declare function ExtendedInput(options?: ExtendedInputOptions): PropertyDecorator;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InputConfiguration, InputOptions } from '../Input';
|
|
2
|
+
export type RichTextToolbarItem = 'bold' | 'italic' | 'heading' | 'bulletList' | 'orderedList' | 'link';
|
|
3
|
+
export declare const DEFAULT_RICH_TEXT_TOOLBAR: RichTextToolbarItem[];
|
|
4
|
+
export interface RichTextInputOptions extends InputOptions {
|
|
5
|
+
toolbar?: RichTextToolbarItem[];
|
|
6
|
+
minHeight?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface RichTextInputConfiguration extends InputConfiguration {
|
|
9
|
+
type: 'richtext';
|
|
10
|
+
toolbar?: RichTextToolbarItem[];
|
|
11
|
+
minHeight?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function RichTextInput(options?: RichTextInputOptions): PropertyDecorator;
|