impaktapps-ui-builder 0.0.101-alpha.61 → 0.0.101-alpha.63

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.
@@ -71,6 +71,9 @@ export declare const EventSchema: {
71
71
  RemoveItemButton: {
72
72
  disabled: boolean;
73
73
  };
74
+ pageName: {
75
+ path: any[];
76
+ };
74
77
  };
75
78
  required: string[];
76
79
  };
@@ -79,6 +79,9 @@ declare const _default: (store: any, dynamicData: any, submitHandler: any, servi
79
79
  RemoveItemButton: {
80
80
  disabled: boolean;
81
81
  };
82
+ pageName: {
83
+ path: any[];
84
+ };
82
85
  };
83
86
  required: string[];
84
87
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.101-alpha.61",
3
+ "version": "0.0.101-alpha.63",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -87,6 +87,9 @@ export const EventSchema = {
87
87
  RemoveItemButton:{
88
88
  disabled: true,
89
89
  },
90
+ pageName: {
91
+ path: []
92
+ },
90
93
  },
91
94
  required:["eventType","Handler"]
92
95
  }
@@ -503,21 +503,18 @@ export const EventUiSchema: any = (theme) => {
503
503
  scope: "#/properties/pageName",
504
504
 
505
505
  options: {
506
- widget: "Box",
506
+ widget: "Breadcrumb",
507
507
  },
508
508
  config: {
509
509
  layout: 12,
510
510
  main: {
511
- heading: "",
512
511
  },
513
512
  style: {
514
513
  paddingLeft: theme.spacing(3),
515
- width:"100%",
516
- fontSize:"10px",
517
514
  color:theme.palette.grey[600],
515
+ fontSize:"10px",
518
516
  position: "fixed",
519
517
  bottom: "24px",
520
- backgroundColor: theme.palette.background.default,
521
518
  borderBottom: `1px solid ${theme.palette.common.black}29`,
522
519
  borderTop: `1px solid ${theme.palette.common.black}29`,
523
520
  },
@@ -161,7 +161,6 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
161
161
  let pathArray = [];
162
162
 
163
163
  if (path) {
164
- // let urlRoutes: string = config.name;
165
164
  const pathArrayAll = path.split(".");
166
165
  const arr: any = []
167
166
  pathArrayAll.map((e: string, i: number) => {
@@ -182,8 +181,6 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
182
181
  })
183
182
  }
184
183
 
185
- console.log("pathArray>>",pathArray)
186
-
187
184
  schema.properties.pageName.path = pathArray
188
185
  return schema;
189
186
  },
@@ -1,9 +1,19 @@
1
1
  import { EventSchema } from "../elements/UiSchema/event/schema";
2
2
  import { EventUiSchema } from "../elements/UiSchema/event/uiSchema";
3
3
  import Component from "./component";
4
- import { okHandler, saveFormdataInSessionStorage, saveHandler, getFormdataFromSessionStorage } from "./utils";
4
+ import {
5
+ okHandler,
6
+ saveFormdataInSessionStorage,
7
+ saveHandler,
8
+ getFormdataFromSessionStorage,
9
+ } from "./utils";
5
10
  import { APISection } from "../build/uischema/apiSection";
6
- import { emptyBox, getRadioInputField, getSelectField, getTextArea } from "../build/uischema/buildPropertiesSection";
11
+ import {
12
+ emptyBox,
13
+ getRadioInputField,
14
+ getSelectField,
15
+ getTextArea,
16
+ } from "../build/uischema/buildPropertiesSection";
7
17
  import { refreshSectionUiSchema } from "../build/uischema/refresh";
8
18
  import _ from "lodash";
9
19
 
@@ -12,7 +22,7 @@ export default (
12
22
  dynamicData: any,
13
23
  submitHandler: any,
14
24
  service: any,
15
- functionsName?: { const: string, title: string }[]
25
+ functionsName?: { const: string; title: string }[]
16
26
  ) => {
17
27
  return {
18
28
  setPage: async function () {
@@ -20,87 +30,142 @@ export default (
20
30
  store.setFormdata(formdata);
21
31
  const schema = await this.getSchema();
22
32
  store.setSchema(schema);
23
- this.refreshPage(formdata.Handler, store)
33
+ this.refreshPage(formdata.Handler, store);
24
34
  },
25
35
  refreshPage: (handlerType: any, store: any) => {
26
36
  const uiSchema = _.cloneDeep(EventUiSchema(store.theme.myTheme));
27
- const schema: any = _.cloneDeep(EventSchema)
37
+ const schema: any = _.cloneDeep(EventSchema);
28
38
  if (handlerType) {
29
39
  if (handlerType === "custom") {
30
- uiSchema.elements[0].elements[0].elements[2] = getRadioInputField("isSync","Run in Sync",["Yes","No"])
40
+ uiSchema.elements[0].elements[0].elements[2] = getRadioInputField(
41
+ "isSync",
42
+ "Run in Sync",
43
+ ["Yes", "No"]
44
+ );
31
45
  uiSchema.elements[0].elements[0].elements[3] = {
32
46
  type: "Control",
33
47
  scope: "#/properties/emptyBox",
34
48
  options: {
35
49
  widget: "EmptyBox",
36
50
  },
37
-
51
+
38
52
  config: {
39
53
  layout: { xs: 6, sm: 6, md: 0, lg: 3 },
40
54
  main: {},
41
- style:{}
55
+ style: {},
42
56
  },
43
57
  };
44
- uiSchema.elements[0].elements[0].elements[4] = getTextArea("eventCode", "Write Custom Code", false)
45
- schema.required = ["eventType", "Handler", "eventCode"]
46
-
58
+ uiSchema.elements[0].elements[0].elements[4] = getTextArea(
59
+ "eventCode",
60
+ "Write Custom Code",
61
+ false
62
+ );
63
+ schema.required = ["eventType", "Handler", "eventCode"];
47
64
  } else if (handlerType === "api") {
48
- uiSchema.elements[0].elements[0].elements[2] = emptyBox("emptyBox", {xs: 0,sm: 0,md: 4,lg: 6});
65
+ uiSchema.elements[0].elements[0].elements[2] = emptyBox("emptyBox", {
66
+ xs: 0,
67
+ sm: 0,
68
+ md: 4,
69
+ lg: 6,
70
+ });
49
71
  uiSchema.elements[0].elements[0].elements[3] = APISection;
50
- schema.required = ["eventType", "Handler", "method", "path"]
72
+ schema.required = ["eventType", "Handler", "method", "path"];
51
73
  } else if (handlerType === "inBuiltFunction") {
52
-
53
- uiSchema.elements[0].elements[0].elements[2] = getSelectField("inBuiltFunctionType", "Function Name", [
54
- { label: "RankProvider", value: "RankProvider" },
55
- { label: "Download File", value: "downloadFile" },
56
- { label: "Download Blob File", value: "downloadBlobFile" }
57
- ])
74
+ uiSchema.elements[0].elements[0].elements[2] = getSelectField(
75
+ "inBuiltFunctionType",
76
+ "Function Name",
77
+ [
78
+ { label: "RankProvider", value: "RankProvider" },
79
+ { label: "Download File", value: "downloadFile" },
80
+ { label: "Download Blob File", value: "downloadBlobFile" },
81
+ ]
82
+ );
58
83
  uiSchema.elements[0].elements[0].elements[3] = {
59
84
  type: "Control",
60
85
  scope: "#/properties/emptyBox",
61
86
  options: {
62
87
  widget: "EmptyBox",
63
88
  },
64
-
89
+
65
90
  config: {
66
91
  layout: { xs: 6, sm: 6, md: 0, lg: 3 },
67
92
  main: {},
68
- style:{}
93
+ style: {},
69
94
  },
70
95
  };
71
- uiSchema.elements[0].elements[0].elements[4] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true);
72
- schema.required = ["eventType", "Handler", "inBuiltFunctionType"]
96
+ uiSchema.elements[0].elements[0].elements[4] = getTextArea(
97
+ "funcParametersCode",
98
+ "Write Custom Code for Functions Parameter",
99
+ true
100
+ );
101
+ schema.required = ["eventType", "Handler", "inBuiltFunctionType"];
73
102
  } else if (handlerType === "refresh") {
74
- uiSchema.elements[0].elements[0].elements[2] = emptyBox("emptyBox", {xs: 0,sm: 0,md: 4,lg: 6});
103
+ uiSchema.elements[0].elements[0].elements[2] = emptyBox("emptyBox", {
104
+ xs: 0,
105
+ sm: 0,
106
+ md: 4,
107
+ lg: 6,
108
+ });
75
109
  uiSchema.elements[0].elements[0].elements[3] = refreshSectionUiSchema;
76
- schema.properties.refreshElements.required = ["value"]
77
- schema.properties.refreshElements.items.required = ["value"]
78
- schema.required = ["eventType", "Handler", "refreshElements"]
110
+ schema.properties.refreshElements.required = ["value"];
111
+ schema.properties.refreshElements.items.required = ["value"];
112
+ schema.required = ["eventType", "Handler", "refreshElements"];
79
113
  }
80
114
  }
81
115
  if (functionsName) {
82
116
  schema.properties.inBuiltFunctionType.oneOf = [
83
117
  ...schema.properties.inBuiltFunctionType.oneOf,
84
- ...functionsName
85
- ]
118
+ ...functionsName,
119
+ ];
86
120
  }
87
- if (sessionStorage.getItem("copiedConfig") ) {
88
- Component(store, dynamicData, submitHandler, service).ElementPathSetter(uiSchema);
121
+ if (sessionStorage.getItem("copiedConfig")) {
122
+ Component(store, dynamicData, submitHandler, service).ElementPathSetter(
123
+ uiSchema
124
+ );
89
125
  schema.properties.RemoveItemButton.disabled = false;
90
126
  }
91
- store.setSchema(schema)
92
- store.setUiSchema(uiSchema)
127
+ store.setSchema(schema);
128
+ store.setUiSchema(uiSchema);
93
129
  },
94
130
 
95
- getFormData: Component(store, dynamicData, submitHandler, service).getFormdata,
131
+ getFormData: Component(store, dynamicData, submitHandler, service)
132
+ .getFormdata,
96
133
  getUiSchema: function () {
97
134
  return EventUiSchema;
98
135
  },
99
136
  getSchema: () => {
100
137
  const schema = _.cloneDeep(EventSchema);
101
- if (sessionStorage.getItem("copiedConfig") ) {
138
+ if (sessionStorage.getItem("copiedConfig")) {
102
139
  schema.properties.RemoveItemButton.disabled = false;
103
140
  }
141
+
142
+ const config = JSON.parse(sessionStorage.getItem("pageFormdata"));
143
+ const path = store.searchParams?.get("path");
144
+ const id = store.searchParams?.get("id");
145
+
146
+ let pathArray = [];
147
+
148
+ if (path) {
149
+ const pathArrayAll = path.split(".");
150
+ const arr: any = [];
151
+ pathArrayAll.map((e: string, i: number) => {
152
+ if (i === 0) {
153
+ arr.push(e);
154
+ return;
155
+ }
156
+ arr.push(`${arr[i - 1]}.${e}`);
157
+ });
158
+
159
+ arr.map((e) => {
160
+ const data = _.get(config, e);
161
+ pathArray.push({
162
+ label: data?.name || data?.eventType || "NewComponent",
163
+ path: `/Component?path=${e}&id=${id}`,
164
+ });
165
+ });
166
+ }
167
+ console.log("pathArray>>",pathArray)
168
+ schema.properties.pageName.path = pathArray;
104
169
  return schema;
105
170
  },
106
171
  okHandler: () => okHandler(store),
@@ -110,48 +175,56 @@ export default (
110
175
  store?.formData?.Handler !== store?.newData?.Handler &&
111
176
  store?.newData?.Handler !== undefined
112
177
  ) {
113
- this.refreshPage(store.newData.Handler || store.formdata.Handler, store)
178
+ this.refreshPage(
179
+ store.newData.Handler || store.formdata.Handler,
180
+ store
181
+ );
114
182
  }
115
183
  },
116
184
  addEvent: function () {
117
185
  const path = store.searchParams?.get("path");
118
186
  if (!Array.isArray(store.formData.events)) {
119
- store.formData.events = []
187
+ store.formData.events = [];
120
188
  }
121
- saveFormdataInSessionStorage(store.ctx.core.data, path)
122
- const finalPath = `${path}.events[${store.formData?.events?.length}]`
123
- store.searchParams.set("path", finalPath)
124
- store.setSearchParams(store.searchParams)
125
- this.setPage()
189
+ saveFormdataInSessionStorage(store.ctx.core.data, path);
190
+ const finalPath = `${path}.events[${store.formData?.events?.length}]`;
191
+ store.searchParams.set("path", finalPath);
192
+ store.setSearchParams(store.searchParams);
193
+ this.setPage();
126
194
  },
127
195
  editEvent: function () {
128
196
  const rowId = dynamicData.path.split(".")[1];
129
197
  const path = store.searchParams?.get("path");
130
- saveFormdataInSessionStorage(store.ctx.core.data, path)
131
- const finalPath = `${path}.events[${rowId}]`
132
- store.searchParams.set("path", finalPath)
133
- store.setSearchParams(store.searchParams)
134
- this.setPage()
135
-
198
+ saveFormdataInSessionStorage(store.ctx.core.data, path);
199
+ const finalPath = `${path}.events[${rowId}]`;
200
+ store.searchParams.set("path", finalPath);
201
+ store.setSearchParams(store.searchParams);
202
+ this.setPage();
136
203
  },
137
204
  deleteEvent: async function () {
138
- await Component(store, dynamicData, submitHandler, service).deleteEvent(false);
205
+ await Component(store, dynamicData, submitHandler, service).deleteEvent(
206
+ false
207
+ );
139
208
  store.updateDialog("popUpEvent");
140
209
  },
141
210
  backHandler: function () {
142
- store.navigate(-1)
211
+ store.navigate(-1);
143
212
  },
144
- deletePopUpEvent: function(){
213
+ deletePopUpEvent: function () {
145
214
  const rowId = dynamicData.path.split(".")[1];
146
- sessionStorage.setItem('rowId',rowId);
215
+ sessionStorage.setItem("rowId", rowId);
147
216
  store.updateDialog("popUpEvent");
148
217
  },
149
- copyPasteElement: function(){
150
- Component(store, dynamicData, submitHandler, service).copyPasteElement(store,this.setPage.bind(this));
218
+ copyPasteElement: function () {
219
+ Component(store, dynamicData, submitHandler, service).copyPasteElement(
220
+ store,
221
+ this.setPage.bind(this)
222
+ );
151
223
  },
152
- RemoveItemButton: function(){
153
- Component(store, dynamicData, submitHandler, service).RemoveItemButton(store)
224
+ RemoveItemButton: function () {
225
+ Component(store, dynamicData, submitHandler, service).RemoveItemButton(
226
+ store
227
+ );
154
228
  },
155
-
156
- }
229
+ };
157
230
  };