impaktapps-ui-builder 1.0.46 → 1.0.50-alpha.1

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 buildPhoneInputField: (config: any, componentScope: string) => any;
@@ -0,0 +1,20 @@
1
+ declare const PhoneInput: {
2
+ scope: string;
3
+ type: string;
4
+ options: {
5
+ widget: string;
6
+ };
7
+ config: {
8
+ layout: {
9
+ xs: number;
10
+ sm: number;
11
+ md: number;
12
+ lg: number;
13
+ };
14
+ main: {
15
+ defaultCountry: string;
16
+ label: string;
17
+ };
18
+ };
19
+ };
20
+ export default PhoneInput;
@@ -5,6 +5,7 @@ interface funcParamsProps {
5
5
  userValue: any;
6
6
  pageDataProvider: any;
7
7
  functionsProvider?: Record<string, any>;
8
+ setExternaldata?: any;
8
9
  }
9
10
  export declare const extractEvents: (eventConfig: any) => any;
10
11
  declare const _default: (funcParams: funcParamsProps) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "1.0.46",
3
+ "version": "1.0.50-alpha.1",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -28,25 +28,17 @@ export default (FormData: any) => {
28
28
 
29
29
  export const createLayoutFormat = (config: any[]) => {
30
30
  if (_.isEmpty(config)) {
31
- return {
32
- xs: 12,
33
- sm: 12,
34
- md: 12,
35
- lg: 12,
36
- }
31
+ return { xs: 12, sm: 6, md: 4, lg: 3 }
37
32
  }
38
- let data: any = {
39
- xs: 12,
40
- sm: 12,
41
- md: 6,
42
- lg: 6,
43
- };
33
+ let data: any = { };
34
+
44
35
  config.map((e: any) => {
45
- data[e.key || "xs"] = +e.value || 5.5
36
+ data[e.key || "xs"] = +e.value || 5.5;
37
+
46
38
  })
47
39
  return data;
48
40
  };
49
- export const flatObjectValueInArray = (config: any[]=[]) => {
41
+ export const flatObjectValueInArray = (config: any[] = []) => {
50
42
  if (config.length < 1) {
51
43
  return
52
44
  }
@@ -8,7 +8,7 @@ const FileInput = {
8
8
  widget: "FileInputField",
9
9
  },
10
10
  config: {
11
- layout: { xs: 6, sm: 6, md: 4, lg: 4 },
11
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
12
12
  main: {
13
13
  required: false,
14
14
  onUpload: "onFileUpload",
@@ -0,0 +1,26 @@
1
+ import _ from "lodash";
2
+ import PhoneInput from "./uischema/phoneInput";
3
+ import { createLayoutFormat } from "./buildConfig";
4
+
5
+ export const buildPhoneInputField = (config: any, componentScope: string) => {
6
+ const phonInputField: any = _.cloneDeep(PhoneInput);
7
+ phonInputField.config.main.label = config.label;
8
+ if (config.style) {
9
+ phonInputField.config.style = JSON.parse(config.style)
10
+ }
11
+ // if (config.multiline) {
12
+ // phonInputField.config.main.multiline = config.multiline === "YES" ? true : false;
13
+ // }
14
+ if (config.InputFormatingAndMasking) {
15
+ phonInputField.config.main.formatStrArray = config.InputFormatingAndMasking.map(e => e.formatElement);
16
+ }
17
+ if (config.placeholder) {
18
+ phonInputField.config.main.placeholder = config.placeholder;
19
+ }
20
+ if (config.layout) {
21
+ phonInputField.config.layout = createLayoutFormat(config.layout)
22
+ }
23
+ phonInputField.config.main.errorMessage = `${config.name} is empty or invalid`;
24
+ phonInputField.scope = componentScope;
25
+ return phonInputField;
26
+ }
@@ -1,6 +1,4 @@
1
1
  import _ from "lodash";
2
- import emptyBox from "./uischema/emptyBox";
3
- import cardSlider from "./uischema/cardSlider";
4
2
  import { buildLeaderBoard } from "./buildLeaderboard";
5
3
  import { buildProgressBarCard } from "./buildProgressBarCard";
6
4
  import { buildProgressBar } from "./buildProgressBar";
@@ -40,6 +38,7 @@ import { buildDataGrid } from "./buildDataGrid";
40
38
  import { buildInputSlider } from "./buildInputSlider";
41
39
  import { buildTreeMap } from "./buildTreeMap";
42
40
  import { buildThoughtOfTheDay } from "./buildThoughtOfTheDay";
41
+ import { buildPhoneInputField } from "./buildPhoneInput";
43
42
  export let schema = {
44
43
  type: "object",
45
44
  properties: {},
@@ -307,6 +306,8 @@ const buildUiSchema = (config: any, store?: any) => {
307
306
  case "Thought":
308
307
  elements = buildThoughtOfTheDay(config, componentScope);
309
308
  break;
309
+ case "PhoneInput":
310
+ elements = buildPhoneInputField(config, componentScope);
310
311
  break;
311
312
  default:
312
313
  schema = {
@@ -26,6 +26,66 @@ export const emptyBox = (scope: string, layout?: any) => {
26
26
  },
27
27
  }
28
28
  }
29
+ // const cardLayout = {
30
+ // type: "Control",
31
+ // scope: "#/properties/cardLayout",
32
+ // options: {
33
+ // widget: "Array",
34
+ // },
35
+ // config: {
36
+ // layout: 12,
37
+ // main: {
38
+ // label: "Card Layout",
39
+ // childElementLabel: "Card Layout",
40
+ // },
41
+ // style: {
42
+ // marginLeft: "-24px",
43
+ // marginBottom: "24px !important",
44
+ // labelStyle: {
45
+ // marginLeft: "24px",
46
+ // },
47
+ // detailsStyle: {
48
+ // marginLeft: "24px",
49
+ // }
50
+ // }
51
+ // },
52
+ // elements: [
53
+ // {
54
+ // type: "Control",
55
+ // scope: "#/properties/key",
56
+ // options: {
57
+ // widget: "SelectInputField",
58
+ // },
59
+ // config: {
60
+ // layout: { xs: 6, sm: 6, md: 4, lg: 4 },
61
+ // main: {
62
+ // label: "Screen Size",
63
+
64
+ // },
65
+ // },
66
+ // },
67
+ // {
68
+ // type: "Control",
69
+ // scope: "#/properties/value",
70
+
71
+ // options: {
72
+ // widget: "InputField",
73
+ // },
74
+ // config: {
75
+ // layout: { xs: 6, sm: 6, md: 4, lg: 4 },
76
+ // main: {
77
+ // label: "Value",
78
+ // type: "number",
79
+ // // freeSolo:true,
80
+ // helperText: 'Number should be in range of 0 to 12',
81
+ // errorMessage: "Number Can't be greater than 12 and can't be less than 0.",
82
+
83
+ // },
84
+ // },
85
+ // },
86
+ // emptyBox("cardEmpty")
87
+ // ],
88
+ // };
29
89
  const cardLayout = {
30
90
  type: "Control",
31
91
  scope: "#/properties/cardLayout",
@@ -54,7 +114,7 @@ const cardLayout = {
54
114
  widget: "SelectInputField",
55
115
  },
56
116
  config: {
57
- layout: { xs: 6, sm: 6, md: 4, lg: 4 },
117
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
58
118
  main: {
59
119
  label: "Screen Size",
60
120
 
@@ -0,0 +1,16 @@
1
+ const PhoneInput = {
2
+ scope: "#/properties/testPhone",
3
+ type: "Control",
4
+ options: {
5
+ widget: "PhoneInput"
6
+ },
7
+ config: {
8
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
9
+ main: {
10
+ defaultCountry: "in",
11
+ label: "Phone"
12
+ }
13
+ }
14
+ };
15
+
16
+ export default PhoneInput;
@@ -6,7 +6,7 @@ export default {
6
6
  widget: "SelectInputField",
7
7
  },
8
8
  config: {
9
- layout: { xs: 12, sm: 6, md: 4, lg: 4 },
9
+ layout: { xs: 12, sm: 6, md: 4, lg: 3 },
10
10
  main: {
11
11
  label: "",
12
12
  type: "text",
@@ -41,7 +41,8 @@ export const ComponentSchema: any = {
41
41
  { title: "Upload", const: "UploadFile" },
42
42
  { title: "Tree ", const: "TreeMap" },
43
43
  { title: "Column Group", const: "ColumnGroup" },
44
- { title: "Thought of the day", const: "Thought" }
44
+ { title: "Thought of the day", const: "Thought" },
45
+ { title: "Phone Input", const: "PhoneInput" }
45
46
  ]
46
47
  },
47
48
  elementType: {
@@ -19,7 +19,8 @@ interface funcParamsProps {
19
19
  service: any,
20
20
  userValue: any,
21
21
  pageDataProvider: any,
22
- functionsProvider?: Record<string, any>
22
+ functionsProvider?: Record<string, any>,
23
+ setExternaldata?: any
23
24
  }
24
25
  let pageData: any = false;
25
26
  export const extractEvents = (eventConfig: any) => {
@@ -65,7 +66,7 @@ export default (funcParams: funcParamsProps) => {
65
66
  let executeEventsParameters: handlersProps = {
66
67
  config: {}, componentName: "",
67
68
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
68
- serviceHolder: { downloadFile, download: doDownload, ...funcParams.functionsProvider }, eventGroups,
69
+ serviceHolder: { downloadFile, download: doDownload, ...funcParams.functionsProvider },eventGroups,
69
70
  functionsProvider: funcParams.functionsProvider, formDataHolder
70
71
  };
71
72
  return {
@@ -77,6 +78,9 @@ export default (funcParams: funcParamsProps) => {
77
78
  eventGroups = {};
78
79
  pageData = await funcParams.pageDataProvider();
79
80
  const config = pageData?.config;
81
+
82
+ funcParams?.setExternaldata();
83
+
80
84
  const uiSchema = pageData?.uiSchema;
81
85
  const event = new CustomEvent('pageNameChanged', {
82
86
  detail: { pageName: config.label }
@@ -190,17 +194,19 @@ export default (funcParams: funcParamsProps) => {
190
194
  }
191
195
  );
192
196
  const schema = pageData?.schema ?? { type: "object", properties: {} };
193
- eventGroups = extractEvents(config);
197
+ const newEventGroups = extractEvents(config);
198
+ console.log("newEventGroups", newEventGroups,eventGroups)
199
+ eventGroups = newEventGroups;
194
200
  executeEventsParameters = {
195
201
  config: {}, componentName: "",
196
202
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
197
203
  functionsProvider: funcParams.functionsProvider,
198
- serviceHolder: this, eventGroups, formDataHolder
204
+ serviceHolder: this, eventGroups: newEventGroups, formDataHolder
199
205
  }
200
206
  await executeRefreshHandler({
201
207
  config: {}, componentName: "",
202
208
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
203
- serviceHolder: this, eventGroups, formDataHolder: {}
209
+ serviceHolder: this, eventGroups: newEventGroups, formDataHolder: {}
204
210
  })
205
211
  funcParams.store.setSchema(
206
212
  (pre: any) => {