@1urso/generic-editor 0.1.10 → 0.1.13
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 +8 -5
- package/dist/editor/context.d.ts +4 -0
- package/dist/editor/utils/htmlGenerator.d.ts +1 -0
- package/dist/generic-editor.js +6019 -4978
- package/dist/generic-editor.umd.cjs +42 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,10 +88,8 @@ At the top of the left sidebar, the **Settings** button (gear icon) allows you t
|
|
|
88
88
|
- **List Configuration Tab**:
|
|
89
89
|
- _Sort Property_: Defines which field will be used to sort the list (e.g., `price`, `name`).
|
|
90
90
|
- _Order_: Ascending or Descending.
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
- _Single Data_: A JSON object `{...}` to test single mode.
|
|
94
|
-
> Edit these JSONs to see the layout react in real-time to your variables.
|
|
91
|
+
- _Newest Position_: Defines where the newest item appears ('top' or 'bottom').
|
|
92
|
+
- _Scroll Behavior_: Defines the scroll direction ('down' - default, or 'up' - chat-like).
|
|
95
93
|
|
|
96
94
|
### Working with Text and Fonts
|
|
97
95
|
|
|
@@ -104,6 +102,7 @@ When right-clicking on a **Text** element:
|
|
|
104
102
|
- **Text Color**: Pre-defined color palette.
|
|
105
103
|
- **Weight**: Normal or Bold.
|
|
106
104
|
- **Alignment**: Left, Center, or Right.
|
|
105
|
+
- **Vertical Alignment**: Top, Center, or Bottom.
|
|
107
106
|
|
|
108
107
|
### Working with Images
|
|
109
108
|
|
|
@@ -179,6 +178,7 @@ The `isList` property drastically changes how the editor and HTML generator beha
|
|
|
179
178
|
- The user designs the "Template Item".
|
|
180
179
|
- The editor repeats this model vertically for each item in the mock data array.
|
|
181
180
|
- Allows visualization of how the list behaves with multiple items.
|
|
181
|
+
- **Height Limit**: Elements are constrained within the defined item height (canvas height).
|
|
182
182
|
|
|
183
183
|
### JSON Structure
|
|
184
184
|
|
|
@@ -208,7 +208,9 @@ The output of `onSave` is a JSON ready to be stored.
|
|
|
208
208
|
],
|
|
209
209
|
"listSettings": {
|
|
210
210
|
"sortProp": "nome",
|
|
211
|
-
"sortOrder": "asc"
|
|
211
|
+
"sortOrder": "asc",
|
|
212
|
+
"newestPosition": "bottom",
|
|
213
|
+
"scrollDirection": "down"
|
|
212
214
|
}
|
|
213
215
|
}
|
|
214
216
|
```
|
|
@@ -228,6 +230,7 @@ const dados = db.getFuncionarios(); // Array or Object
|
|
|
228
230
|
const htmlString = generateHTML(layout.elements, dados, {
|
|
229
231
|
isList: layout.isList, // Important to pass the correct mode
|
|
230
232
|
listSettings: layout.listSettings,
|
|
233
|
+
canvasHeight: layout.canvasHeight, // Optional: Force item height
|
|
231
234
|
});
|
|
232
235
|
|
|
233
236
|
// 3. Inject where needed
|
package/dist/editor/context.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface IElement {
|
|
|
14
14
|
export interface IListSettings {
|
|
15
15
|
sortProp?: string;
|
|
16
16
|
sortOrder: 'asc' | 'desc';
|
|
17
|
+
newestPosition?: 'top' | 'bottom';
|
|
18
|
+
scrollDirection?: 'up' | 'down';
|
|
17
19
|
}
|
|
18
20
|
export interface IProp {
|
|
19
21
|
name: string;
|
|
@@ -26,6 +28,7 @@ interface IEditorState {
|
|
|
26
28
|
mockData: any[];
|
|
27
29
|
singleMockData: Record<string, any>;
|
|
28
30
|
listSettings: IListSettings;
|
|
31
|
+
canvasHeight?: number;
|
|
29
32
|
availableProps: IProp[];
|
|
30
33
|
availableFonts: string[];
|
|
31
34
|
theme: 'light' | 'dark';
|
|
@@ -39,6 +42,7 @@ interface IEditorContext {
|
|
|
39
42
|
updateElement: (id: string, updates: Partial<IElement>) => void;
|
|
40
43
|
setMockData: (data: any[], singleData: Record<string, any>) => void;
|
|
41
44
|
updateListSettings: (settings: Partial<IListSettings>) => void;
|
|
45
|
+
setCanvasHeight: (height: number) => void;
|
|
42
46
|
loadState: (savedState: Partial<IEditorState>) => void;
|
|
43
47
|
}
|
|
44
48
|
export declare const EditorProvider: React.FC<{
|
|
@@ -2,6 +2,7 @@ import { IElement, IListSettings } from '../context';
|
|
|
2
2
|
interface RenderOptions {
|
|
3
3
|
isList?: boolean;
|
|
4
4
|
listSettings?: IListSettings;
|
|
5
|
+
canvasHeight?: number;
|
|
5
6
|
}
|
|
6
7
|
export declare const generateHTML: (elements: IElement[], data: any, options?: RenderOptions) => string;
|
|
7
8
|
export declare const getRendererCode: () => string;
|