@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.
@@ -1,2 +1,5 @@
1
1
  import { default as React } from 'react';
2
- export declare const Canvas: React.FC;
2
+ interface CanvasProps {
3
+ }
4
+ export declare const Canvas: React.FC<CanvasProps>;
5
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { IElement } from '../types';
2
+ import { IElement } from '../context';
3
3
  interface DraggableElementProps {
4
4
  element: IElement;
5
5
  isSelected: boolean;
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { IElement } from '../types';
2
+ import { IElement } from '../context';
3
3
  export declare const ElementContextMenu: React.FC<{
4
4
  children: React.ReactNode;
5
5
  element: IElement;
@@ -1,5 +1,59 @@
1
1
  import { default as React, ReactNode } from 'react';
2
- import { IEditorState, IElement, IListSettings, IProp } from './types';
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: Record<string, unknown>[], singleData: Record<string, unknown>) => void;
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;
@@ -1,8 +1,8 @@
1
1
  import { default as React } from 'react';
2
- import { IEditorState, IElement, ILayout } from './types';
2
+ import { ILayout } from './types';
3
3
  interface EditorProps {
4
4
  layout: ILayout;
5
- initialState?: string | IElement[] | Partial<IEditorState>;
5
+ initialState?: any;
6
6
  onSave?: (json: string) => void;
7
7
  theme?: 'light' | 'dark';
8
8
  }
@@ -1,5 +1,4 @@
1
- import { default as React } from 'react';
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 interface IElementCondition {
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 '../types';
2
- export declare const formatValue: (value: unknown, formatting: IElementFormatting) => string;
3
- export declare const checkCondition: (propValue: unknown, operator: string, ruleValue: string) => boolean;
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 '../types';
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: unknown, options?: RenderOptions) => string;
7
+ export declare const generateHTML: (elements: IElement[], data: any, options?: RenderOptions) => string;
8
8
  export declare const getRendererCode: () => string;
9
9
  export {};