@1urso/generic-editor 0.1.25 → 0.1.26
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/editor/components/Canvas.d.ts +4 -1
- package/dist/editor/components/DraggableElement.d.ts +1 -1
- package/dist/editor/components/ElementContextMenu.d.ts +1 -1
- package/dist/editor/context.d.ts +56 -2
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/types.d.ts +2 -56
- package/dist/editor/utils/helpers.d.ts +3 -3
- package/dist/editor/utils/htmlGenerator.d.ts +2 -2
- package/dist/generic-editor.css +1 -1
- package/dist/generic-editor.js +1403 -1682
- package/dist/generic-editor.umd.cjs +26 -134
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/editor/components/CanvasContextMenu.d.ts +0 -4
package/dist/editor/context.d.ts
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
import { default as React, ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
export interface IElementCondition {
|
|
3
|
+
id: string;
|
|
4
|
+
property: string;
|
|
5
|
+
operator: 'equals' | 'notEquals' | 'contains' | 'greaterThan' | 'lessThan' | 'truthy' | 'falsy';
|
|
6
|
+
value: string;
|
|
7
|
+
style: React.CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
export interface IElementFormatting {
|
|
10
|
+
type: 'text' | 'number' | 'date' | 'boolean' | 'map';
|
|
11
|
+
dateFormat?: string;
|
|
12
|
+
numberFormat?: 'decimal' | 'currency' | 'percent';
|
|
13
|
+
currencySymbol?: string;
|
|
14
|
+
decimalPlaces?: number;
|
|
15
|
+
trueLabel?: string;
|
|
16
|
+
falseLabel?: string;
|
|
17
|
+
mapping?: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
export interface IElement {
|
|
20
|
+
id: string;
|
|
21
|
+
type: 'text' | 'image' | 'box';
|
|
22
|
+
content: string;
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
rotation?: number;
|
|
28
|
+
style?: React.CSSProperties;
|
|
29
|
+
dataBinding?: string;
|
|
30
|
+
formatting?: IElementFormatting;
|
|
31
|
+
conditions?: IElementCondition[];
|
|
32
|
+
autoGrow?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface IListSettings {
|
|
35
|
+
sortProp?: string;
|
|
36
|
+
sortOrder: 'asc' | 'desc';
|
|
37
|
+
newestPosition?: 'top' | 'bottom';
|
|
38
|
+
scrollDirection?: 'up' | 'down';
|
|
39
|
+
containerHeight?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface IProp {
|
|
42
|
+
name: string;
|
|
43
|
+
dataName: string;
|
|
44
|
+
}
|
|
45
|
+
interface IEditorState {
|
|
46
|
+
elements: IElement[];
|
|
47
|
+
selectedElementId: string | null;
|
|
48
|
+
isList: boolean;
|
|
49
|
+
mockData: any[];
|
|
50
|
+
singleMockData: Record<string, any>;
|
|
51
|
+
listSettings: IListSettings;
|
|
52
|
+
canvasHeight?: number;
|
|
53
|
+
availableProps: IProp[];
|
|
54
|
+
availableFonts: string[];
|
|
55
|
+
theme: 'light' | 'dark';
|
|
56
|
+
}
|
|
3
57
|
interface IEditorContext {
|
|
4
58
|
state: IEditorState;
|
|
5
59
|
addElement: (element: Omit<IElement, 'id' | 'x' | 'y' | 'width' | 'height'> & Partial<Pick<IElement, 'x' | 'y' | 'width' | 'height'>>) => void;
|
|
@@ -7,7 +61,7 @@ interface IEditorContext {
|
|
|
7
61
|
selectElement: (id: string | null) => void;
|
|
8
62
|
moveElement: (dragIndex: number, hoverIndex: number) => void;
|
|
9
63
|
updateElement: (id: string, updates: Partial<IElement>) => void;
|
|
10
|
-
setMockData: (data:
|
|
64
|
+
setMockData: (data: any[], singleData: Record<string, any>) => void;
|
|
11
65
|
updateListSettings: (settings: Partial<IListSettings>) => void;
|
|
12
66
|
setCanvasHeight: (height: number) => void;
|
|
13
67
|
loadState: (savedState: Partial<IEditorState>) => void;
|
package/dist/editor/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ILayout } from './types';
|
|
3
3
|
interface EditorProps {
|
|
4
4
|
layout: ILayout;
|
|
5
|
-
initialState?:
|
|
5
|
+
initialState?: any;
|
|
6
6
|
onSave?: (json: string) => void;
|
|
7
7
|
theme?: 'light' | 'dark';
|
|
8
8
|
}
|
package/dist/editor/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export interface IProp {
|
|
1
|
+
interface IProp {
|
|
3
2
|
name: string;
|
|
4
3
|
dataName: string;
|
|
5
4
|
}
|
|
@@ -8,57 +7,4 @@ export interface ILayout {
|
|
|
8
7
|
props: IProp[];
|
|
9
8
|
isList?: boolean;
|
|
10
9
|
}
|
|
11
|
-
export
|
|
12
|
-
id: string;
|
|
13
|
-
property: string;
|
|
14
|
-
operator: 'equals' | 'notEquals' | 'contains' | 'greaterThan' | 'lessThan' | 'truthy' | 'falsy';
|
|
15
|
-
value: string;
|
|
16
|
-
style: React.CSSProperties;
|
|
17
|
-
}
|
|
18
|
-
export interface IElementFormatting {
|
|
19
|
-
type: 'text' | 'number' | 'date' | 'boolean' | 'map';
|
|
20
|
-
dateFormat?: string;
|
|
21
|
-
numberFormat?: 'decimal' | 'currency' | 'percent';
|
|
22
|
-
currencySymbol?: string;
|
|
23
|
-
decimalPlaces?: number;
|
|
24
|
-
trueLabel?: string;
|
|
25
|
-
falseLabel?: string;
|
|
26
|
-
mapping?: Record<string, string>;
|
|
27
|
-
}
|
|
28
|
-
export interface IElement {
|
|
29
|
-
id: string;
|
|
30
|
-
type: 'text' | 'image' | 'box';
|
|
31
|
-
content: string;
|
|
32
|
-
x: number;
|
|
33
|
-
y: number;
|
|
34
|
-
width: number;
|
|
35
|
-
height: number;
|
|
36
|
-
rotation?: number;
|
|
37
|
-
style?: React.CSSProperties;
|
|
38
|
-
dataBinding?: string;
|
|
39
|
-
formatting?: IElementFormatting;
|
|
40
|
-
conditions?: IElementCondition[];
|
|
41
|
-
autoGrow?: boolean;
|
|
42
|
-
parentId?: string;
|
|
43
|
-
autoGrowContainer?: boolean;
|
|
44
|
-
}
|
|
45
|
-
export interface IListSettings {
|
|
46
|
-
sortProp?: string;
|
|
47
|
-
sortOrder: 'asc' | 'desc';
|
|
48
|
-
newestPosition?: 'top' | 'bottom';
|
|
49
|
-
scrollDirection?: 'up' | 'down';
|
|
50
|
-
containerHeight?: number;
|
|
51
|
-
entryAnimation?: 'slideIn' | 'fadeIn' | 'scaleIn' | 'none';
|
|
52
|
-
}
|
|
53
|
-
export interface IEditorState {
|
|
54
|
-
elements: IElement[];
|
|
55
|
-
selectedElementId: string | null;
|
|
56
|
-
isList: boolean;
|
|
57
|
-
mockData: Record<string, unknown>[];
|
|
58
|
-
singleMockData: Record<string, unknown>;
|
|
59
|
-
listSettings: IListSettings;
|
|
60
|
-
canvasHeight?: number;
|
|
61
|
-
availableProps: IProp[];
|
|
62
|
-
availableFonts: string[];
|
|
63
|
-
theme: 'light' | 'dark';
|
|
64
|
-
}
|
|
10
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IElementFormatting } from '../
|
|
2
|
-
export declare const formatValue: (value:
|
|
3
|
-
export declare const checkCondition: (propValue:
|
|
1
|
+
import { IElementFormatting } from '../context';
|
|
2
|
+
export declare const formatValue: (value: any, formatting: IElementFormatting) => string;
|
|
3
|
+
export declare const checkCondition: (propValue: any, operator: string, ruleValue: string) => boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IElement, IListSettings } from '../
|
|
1
|
+
import { IElement, IListSettings } from '../context';
|
|
2
2
|
interface RenderOptions {
|
|
3
3
|
isList?: boolean;
|
|
4
4
|
listSettings?: IListSettings;
|
|
5
5
|
canvasHeight?: number;
|
|
6
6
|
}
|
|
7
|
-
export declare const generateHTML: (elements: IElement[], data:
|
|
7
|
+
export declare const generateHTML: (elements: IElement[], data: any, options?: RenderOptions) => string;
|
|
8
8
|
export declare const getRendererCode: () => string;
|
|
9
9
|
export {};
|