impaktapps-ui-builder 1.0.71 → 1.0.72-flickering.2

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.
@@ -0,0 +1 @@
1
+ export declare const buildImage: (config: any, componentScope: any) => any;
@@ -0,0 +1 @@
1
+ export declare const buildUploadFileIcon: (config: any, componentScope: any) => any;
@@ -44,3 +44,27 @@ export declare const downloadFile: {
44
44
  widget: string;
45
45
  };
46
46
  };
47
+ export declare const uploadFileIcon: {
48
+ type: string;
49
+ scope: string;
50
+ config: {
51
+ main: {
52
+ label: string;
53
+ onUpload: string;
54
+ required: boolean;
55
+ errorMessage: string;
56
+ };
57
+ style: {
58
+ backgroundColor: string;
59
+ };
60
+ layout: {
61
+ xs: number;
62
+ sm: number;
63
+ md: number;
64
+ lg: number;
65
+ };
66
+ };
67
+ options: {
68
+ widget: string;
69
+ };
70
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "1.0.71",
3
+ "version": "1.0.72-flickering.2",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -0,0 +1,35 @@
1
+ import _ from "lodash";
2
+ import { createLayoutFormat } from "./buildConfig";
3
+
4
+ const imageUiSchema = {
5
+ type: "Control",
6
+ scope: "#/properties/Logo",
7
+
8
+ options: {
9
+ widget: "Image",
10
+ },
11
+ config: {
12
+ layout: 3,
13
+ main: {
14
+ url: "",
15
+ },
16
+ style: {
17
+ },
18
+ },
19
+ };
20
+
21
+ export const buildImage = (config, componentScope) => {
22
+ const image: any = _.cloneDeep(imageUiSchema);
23
+ image.scope = componentScope;
24
+ image.config.main.url = config.imageUrl;
25
+ if (config.layout) {
26
+ image.config.layout = createLayoutFormat(config.layout);
27
+ }
28
+ if (config.style) {
29
+ image.config.style = JSON.parse(config.style);
30
+ }
31
+ if (config.height) {
32
+ image.config.style.imageStyle = {...image.config.style.imageStyle, height: config.height}
33
+ }
34
+ return image;
35
+ };
@@ -41,6 +41,8 @@ import { buildInputSlider } from "./buildInputSlider";
41
41
  import { buildTreeMap } from "./buildTreeMap";
42
42
  import { buildThoughtOfTheDay } from "./buildThoughtOfTheDay";
43
43
  import { buildHorizontalLayout } from "./buildHorizontalLayout";
44
+ import { buildImage } from "./buildImage";
45
+ import { buildUploadFileIcon } from "./buildUploadFileIcon";
44
46
  export let schema = {
45
47
  type: "object",
46
48
  properties: {},
@@ -311,7 +313,11 @@ const buildUiSchema = (config: any, store?: any) => {
311
313
  case "Thought":
312
314
  elements = buildThoughtOfTheDay(config, componentScope);
313
315
  break;
316
+ case "Image":
317
+ elements = buildImage(config, componentScope);
314
318
  break;
319
+ case "UploadFileIcon":
320
+ elements = buildUploadFileIcon(config, componentScope);
315
321
  default:
316
322
  schema = {
317
323
  type: "object",
@@ -0,0 +1,21 @@
1
+ import { uploadFileIcon } from "./uischema/file";
2
+ import _ from "lodash";
3
+ import { createLayoutFormat } from "./buildConfig";
4
+
5
+ export const buildUploadFileIcon = (config, componentScope) => {
6
+ const UploadFileIcon: any = _.cloneDeep(uploadFileIcon);
7
+
8
+ UploadFileIcon.scope = componentScope;
9
+ UploadFileIcon.config.main.label = config.label;
10
+ if (config.layout) {
11
+ UploadFileIcon.config.layout = createLayoutFormat(config.layout)
12
+ }
13
+ if (config.style) {
14
+ UploadFileIcon.config.style = config.style;
15
+ }
16
+ if (config.required) {
17
+ UploadFileIcon.config.main.required = true;
18
+ }
19
+ UploadFileIcon.config.main.errorMessage = config.errorMessage;
20
+ return UploadFileIcon;
21
+ }
@@ -539,6 +539,13 @@ export const buildPropertiesSection = function (type: String) {
539
539
  getTextArea("thought", "Today's thought", false),
540
540
  ]
541
541
  break;
542
+ case "Image":
543
+ uiSchema.elements = [
544
+ getInputField("imageUrl", "Image URL"),
545
+ getInputField("height", "Image Height"),
546
+ emptyBox("imageEmpty", { xs: 0, sm: 0, md: 4, lg: 6 }),
547
+ ]
548
+ break;
542
549
  }
543
550
  return uiSchema;
544
551
  };
@@ -35,4 +35,27 @@ export const downloadFile = {
35
35
  "options": {
36
36
  "widget": "DownloadFile"
37
37
  }
38
- };
38
+ };
39
+
40
+
41
+ export const uploadFileIcon = {
42
+ "type": "Control",
43
+ "scope": "#/properties/uploadFileIcon",
44
+ "config": {
45
+ "main": {
46
+ "label": "AttachmentFile",
47
+ // "onClick": "onClick",
48
+ "onUpload": "onFileUpload",
49
+ // "onDownload":"onFileDownload",
50
+ "required": true,
51
+ "errorMessage": "Attachment File is not uploaded"
52
+ },
53
+ "style": {
54
+ "backgroundColor": "none"
55
+ },
56
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 }
57
+ },
58
+ "options": {
59
+ "widget": "UploadFileIcon"
60
+ }
61
+ };
@@ -18,6 +18,7 @@ export const ComponentSchema: any = {
18
18
  { title: "Empty Box", const: "EmptyBox" },
19
19
  { title: "File Handler", const: "FileInput" },
20
20
  { title: "Graph", const: "Graph" },
21
+ { title: "Image", const: "Image" },
21
22
  { title: "Input Slider", const: "InputSlider" },
22
23
  { title: "Label", const: "Box" },
23
24
  { title: "Leaderboard", const: "LeaderBoard" },
@@ -42,7 +43,9 @@ export const ComponentSchema: any = {
42
43
  { title: "Upload", const: "UploadFile" },
43
44
  { title: "Tree ", const: "TreeMap" },
44
45
  { title: "Column Group", const: "ColumnGroup" },
45
- { title: "Thought of the day", const: "Thought" }
46
+ { title: "Thought of the day", const: "Thought" },
47
+ { title: "Upload File Icon", const: "UploadFileIcon" }
48
+
46
49
  ]
47
50
  },
48
51
  elementType: {
@@ -20,6 +20,7 @@ const sectionLabels = {
20
20
  SpeedoMeter: ["Core", "Properties", "Events", "Style", "Validation"],
21
21
  card: ["Core", "Properties", "Events", "Style", "Validation"],
22
22
  UploadFile: ["Core", "Events", "Style", "Validation"],
23
+ UploadFileIcon: ["Core", "Events", "Style", "Validation"],
23
24
  Graph: ["Core", "Properties", "Events", "Style", "Validation"],
24
25
  DownloadFile: ["Core", "Events", "Style", "Validation"],
25
26
  Box: ["Core", "Events", "Style", "Validation"],
@@ -42,7 +43,8 @@ const sectionLabels = {
42
43
  ColumnGroup: ["Core", "Components"],
43
44
  Thought: ["Core", "Properties", "Events", "Style", "Validation"],
44
45
  Date: ["Core", "Properties", "Events", "Style", "Validation"],
45
- DateTime: ["Core", "Properties", "Events", "Style", "Validation"]
46
+ DateTime: ["Core", "Properties", "Events", "Style", "Validation"],
47
+ Image: ["Core", "Properties","Style"],
46
48
  }
47
49
 
48
50
  export function refreshPage(type: string, store: any) {
@@ -1,4 +1,5 @@
1
1
  import _ from "lodash";
2
+ import cloneDeep from 'lodash';
2
3
  import { handlersProps } from "./interface";
3
4
  export const executeEvents = (params: handlersProps) => {
4
5
  let nextEvent = [];
@@ -188,9 +189,25 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
188
189
  }
189
190
  else if (eventConfig.type === "Table" && eventConfig.lazyLoading) {
190
191
  if (handlerResponse && handlerResponse?.data) {
191
- formDataHolder[componentName] = handlerResponse.data?.data
192
- formDataHolder[`${componentName}_RowCount`] = handlerResponse.data?.meta?.totalRowCount
193
- store.setFormdata((pre) => { return { ...pre, ...formDataHolder } });
192
+
193
+ const tableData = Array.isArray(handlerResponse.data?.data)
194
+ ? cloneDeep(handlerResponse.data.data)
195
+ : cloneDeep(handlerResponse.data?.data);
196
+
197
+ const rowCount = handlerResponse.data?.meta?.totalRowCount ?? null;
198
+
199
+ const newFormDataHolder = {
200
+ ...formDataHolder,
201
+ [componentName]: tableData,
202
+ [`${componentName}_RowCount`]: rowCount,
203
+ };
204
+ store.setFormdata((prev) => {
205
+ // we merge prev with newFormDataHolder immutably:
206
+ return { ...prev, ...newFormDataHolder }; // CHANGED: no in-place mutation
207
+ });
208
+ // formDataHolder[componentName] = handlerResponse.data?.data
209
+ // formDataHolder[`${componentName}_RowCount`] = handlerResponse.data?.meta?.totalRowCount
210
+ // store.setFormdata((pre) => { return { ...pre, ...formDataHolder } });
194
211
  }
195
212
  }
196
213
  else {