impaktapps-ui-builder 0.0.350 → 0.0.352

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.
Files changed (31) hide show
  1. package/dist/impaktapps-ui-builder.es.js +237 -255
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +16 -16
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/buildInputSlider.d.ts +1 -0
  6. package/dist/src/impaktapps-ui-builder/builder/services/clearLocalStorage.d.ts +2 -0
  7. package/dist/src/impaktapps-ui-builder/builder/services/component.d.ts +8 -9
  8. package/dist/src/impaktapps-ui-builder/builder/services/event.d.ts +9 -10
  9. package/dist/src/impaktapps-ui-builder/builder/services/getNavigationHistory.d.ts +3 -0
  10. package/dist/src/impaktapps-ui-builder/builder/services/pageMaster.d.ts +10 -10
  11. package/dist/src/impaktapps-ui-builder/builder/services/saveHandler.d.ts +2 -0
  12. package/dist/src/impaktapps-ui-builder/lib/index.d.ts +1 -1
  13. package/package.json +1 -2
  14. package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +2 -2
  15. package/src/impaktapps-ui-builder/builder/build/buildInputSlider.ts +46 -0
  16. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +4 -0
  17. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +8 -0
  18. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +1 -0
  19. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +4 -33
  20. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +2 -2
  21. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +4 -33
  22. package/src/impaktapps-ui-builder/builder/services/clearLocalStorage.ts +3 -0
  23. package/src/impaktapps-ui-builder/builder/services/component.ts +34 -19
  24. package/src/impaktapps-ui-builder/builder/services/event.ts +20 -22
  25. package/src/impaktapps-ui-builder/builder/services/getNavigationHistory.ts +27 -0
  26. package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +36 -18
  27. package/src/impaktapps-ui-builder/builder/services/saveHandler.ts +29 -0
  28. package/src/impaktapps-ui-builder/lib/index.ts +1 -1
  29. package/README.md +0 -92
  30. package/dist/src/impaktapps-ui-builder/builder/services/utils.d.ts +0 -10
  31. package/src/impaktapps-ui-builder/builder/services/utils.ts +0 -109
@@ -0,0 +1 @@
1
+ export declare const buildInputSlider: (config: any, componentScope: any) => any;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => void;
2
+ export default _default;
@@ -1,18 +1,17 @@
1
1
  export declare const refreshPage: (type: string, store: any) => void;
2
- declare const _default: (store: any, dynamicData: any, submitHandler: any, service: any) => {
2
+ declare const _default: (store: any, dynamicData: any) => {
3
3
  setPage: () => Promise<void>;
4
4
  refreshPage: (type: string, store: any) => void;
5
- getFormdata: () => any;
5
+ getFormdata: () => Promise<any>;
6
6
  getSchema: () => any;
7
- okHandler: () => void;
8
7
  saveHandler: () => Promise<void>;
9
8
  onChange: () => void;
10
- editComponents: () => void;
11
- deleteComponents: () => void;
12
- deleteEvent: () => void;
13
- widgetAddClickHandler: () => void;
14
- eventEditHandler: () => void;
15
- eventAddHandler: () => void;
9
+ editComponents: () => Promise<void>;
10
+ deleteComponents: () => Promise<void>;
11
+ deleteEvent: () => Promise<void>;
12
+ widgetAddClickHandler: () => Promise<void>;
13
+ eventEditHandler: () => Promise<void>;
14
+ eventAddHandler: () => Promise<void>;
16
15
  backHandler: () => void;
17
16
  };
18
17
  export default _default;
@@ -1,9 +1,9 @@
1
- declare const _default: (store: any, dynamicData: any, submitHandler: any, service: any) => {
1
+ declare const _default: (store: any, dynamicData: any) => {
2
2
  setPage: () => Promise<void>;
3
3
  refreshPage: (handlerType: any, store: any) => void;
4
- getFormData: () => any;
5
- getUiSchema: () => any;
6
- getSchema: () => {
4
+ getFormData: () => Promise<any>;
5
+ getUiSchema: () => Promise<any>;
6
+ getSchema: () => Promise<{
7
7
  type: string;
8
8
  properties: {
9
9
  headers: {
@@ -75,13 +75,12 @@ declare const _default: (store: any, dynamicData: any, submitHandler: any, servi
75
75
  };
76
76
  };
77
77
  required: string[];
78
- };
79
- okHandler: () => void;
80
- saveHandler: () => Promise<void>;
78
+ }>;
81
79
  onChange: () => void;
82
- addEvent: () => void;
83
- editEvent: () => void;
84
- deleteEvent: () => void;
80
+ saveHandler: () => Promise<void>;
81
+ addEvent: () => Promise<void>;
82
+ editEvent: () => Promise<void>;
83
+ deleteEvent: () => Promise<void>;
85
84
  backHandler: () => void;
86
85
  };
87
86
  export default _default;
@@ -0,0 +1,3 @@
1
+ export declare const getNavigationHistory: (config: any, path: string | undefined) => {
2
+ pageName: string;
3
+ };
@@ -1,14 +1,14 @@
1
1
  interface funcParamsProps {
2
2
  store: any;
3
3
  dynamicData: any;
4
+ config: any;
4
5
  submitHandler: any;
5
6
  service: any;
6
- config?: any;
7
7
  }
8
8
  declare const _default: (funcParams: funcParamsProps) => {
9
9
  setPage: () => Promise<void>;
10
- getFormdata: () => any;
11
- getUiSchema: () => any;
10
+ getFormdata: () => Promise<any>;
11
+ getUiSchema: () => Promise<any>;
12
12
  getSchema: () => {
13
13
  type: string;
14
14
  properties: {
@@ -48,12 +48,12 @@ declare const _default: (funcParams: funcParamsProps) => {
48
48
  required: string[];
49
49
  };
50
50
  backHandler: () => void;
51
- onAddClickHandler: () => void;
52
- saveHandler: () => Promise<void>;
53
- Edit_Components: () => void;
54
- Delete_Components: () => void;
55
- eventAddHandler: () => void;
56
- editEvent: () => void;
57
- deleteEvent: () => void;
51
+ onAddClickHandler: () => Promise<void>;
52
+ submitPageHandler: () => Promise<void>;
53
+ Edit_Components: () => Promise<void>;
54
+ Delete_Components: () => Promise<void>;
55
+ eventAddHandler: () => Promise<void>;
56
+ editEvent: () => Promise<void>;
57
+ deleteEvent: () => Promise<void>;
58
58
  };
59
59
  export default _default;
@@ -0,0 +1,2 @@
1
+ export declare const saveFormdataInLocalStorage: (formData: any, path?: string) => any;
2
+ export declare const getFormdataFromLocalStorage: (path?: string) => any;
@@ -6,4 +6,4 @@ export { schema } from "../builder/build/buildUiSchema";
6
6
  export { default as buildConfig } from "../builder/build/buildConfig";
7
7
  export { default as buildUiSchema } from "../builder/build/buildUiSchema";
8
8
  export { buildSchema } from "../builder/build/buildUiSchema";
9
- export { default as clearFromLocalStorage } from "../builder/services/utils";
9
+ export { default as clearPreviousCache } from "../builder/services/clearLocalStorage";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.350",
3
+ "version": "0.0.352",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -13,7 +13,6 @@
13
13
  "@vitejs/plugin-react": "^1.1.4",
14
14
  "acorn-jsx": "^5.3.2",
15
15
  "babel-loader": "^8.2.3",
16
- "lodash": "^4.17.21",
17
16
  "react": "^18.2.0",
18
17
  "react-ace": "^10.1.0",
19
18
  "react-dom": "^18.2.0",
@@ -13,7 +13,7 @@ const FileInput = {
13
13
  required: false,
14
14
  onUpload: "onFileUpload",
15
15
  onDownload:"onFileDownload",
16
- label:"Aggrement Copy"
16
+ label:"label"
17
17
  // iconStyleDefault:true,
18
18
  },
19
19
  style: {
@@ -24,7 +24,7 @@ const FileInput = {
24
24
  export const buildFileInput = (config,componentScope) => {
25
25
  const box: any = _.cloneDeep(FileInput);
26
26
  box.scope = componentScope;
27
- box.config.main.heading = config.label
27
+ box.config.main.label = config.label
28
28
  if(config.layout){
29
29
  box.config.layout = createLayoutFormat(config.layout)
30
30
  }
@@ -0,0 +1,46 @@
1
+
2
+ import _ from "lodash";
3
+ import { createLayoutFormat } from "./buildConfig";
4
+ const InputSlider = {
5
+ type: "Control",
6
+ scope: "#/properties/inputSlider",
7
+ options: {
8
+ widget: "InputSlider",
9
+ },
10
+
11
+ config: {
12
+ layout: 12,
13
+ main: {
14
+ limitToMax: false,
15
+ max: 10000,
16
+ step: 1000,
17
+ min: 0,
18
+ label: "Slider"
19
+ },
20
+
21
+ },
22
+ };
23
+ export const buildInputSlider = (config, componentScope) => {
24
+ const inputSlider: any = _.cloneDeep(InputSlider);
25
+ inputSlider.scope = componentScope;
26
+ inputSlider.config.main.label = config.label
27
+ if (config.layout) {
28
+ inputSlider.config.layout = createLayoutFormat(config.layout)
29
+ }
30
+ if (config.limitToMax) {
31
+ inputSlider.config.main.limitToMax = config.limitToMax === "YES" ? true : false;
32
+ }
33
+ if (config.max) {
34
+ inputSlider.config.main.max = config.max
35
+ }
36
+ if (config.step) {
37
+ inputSlider.config.main.step = config.step;
38
+ }
39
+ if (config.min) {
40
+ inputSlider.config.main.min = config.min;
41
+ }
42
+ if (config.style) {
43
+ inputSlider.config.main.defaultStyle = JSON.parse(config.style)
44
+ }
45
+ return inputSlider;
46
+ }
@@ -34,6 +34,7 @@ import { buildEmptyBox } from "./buildEmptyBox";
34
34
  import { buildArray } from "./buildArray";
35
35
  import { buildAdhaarField, buildPanField } from "./buildAadharCard";
36
36
  import { buildFileInput } from "./buildFileInput";
37
+ import { buildInputSlider } from "./buildInputSlider";
37
38
  export let schema = {
38
39
  type: "object",
39
40
  properties: {},
@@ -164,6 +165,9 @@ const buildUiSchema = (config: any) => {
164
165
  let elements: any = {};
165
166
  const componentScope = `#/properties/${config.name}`;
166
167
  switch (config.type) {
168
+ case "InputSlider":
169
+ elements = buildInputSlider(config, componentScope);
170
+ break;
167
171
  case "FileInput":
168
172
  elements = buildFileInput(config, componentScope);
169
173
  break;
@@ -160,6 +160,14 @@ const GraphSection = {
160
160
  export const buildPropertiesSection = function (type: String) {
161
161
  let uiSchema = _.cloneDeep(GraphSection);
162
162
  switch (type) {
163
+ case "InputSlider":
164
+ uiSchema.elements = [
165
+ getInputField("max", "Max Limit"),
166
+ getInputField("step", "Step"),
167
+ getInputField("min", "Min Limit"),
168
+ getRadioInputField("limitToMax", "Applly Max. Limit", ["YES", "NO"]),
169
+ ]
170
+ break;
163
171
  case "Text":
164
172
  uiSchema.elements = [
165
173
  getInputField("placeholder", "Placeholder"),
@@ -15,6 +15,7 @@ export const ComponentSchema: any = {
15
15
  { title: "Empty Box", const: "EmptyBox" },
16
16
  { title: "File", const: "FileInput" },
17
17
  { title: "Graph", const: "Graph" },
18
+ { title: "Input Slider", const: "InputSlider" },
18
19
  { title: "Label", const: "Box" },
19
20
  { title: "LeaderBoard", const: "LeaderBoard" },
20
21
  { title: "MultipleSelect", const: "MultipleSelect" },
@@ -223,7 +223,7 @@ export const componentBasicUiSchema: any = {
223
223
  type: "Control",
224
224
  scope: "#/properties/proc",
225
225
  config: {
226
- layout: { xs: 11, sm: 11, md: 6, lg: 6 },
226
+ layout: { xs: 11, sm: 11, md: 8, lg: 8 },
227
227
  },
228
228
  options: {
229
229
  widget: "EmptyBox",
@@ -240,40 +240,11 @@ export const componentBasicUiSchema: any = {
240
240
  layout: {
241
241
  xs: 11,
242
242
  sm: 11,
243
- md: 2.5,
244
- lg: 2.5,
243
+ md: 3,
244
+ lg: 3,
245
245
  },
246
246
  main: {
247
- name: "Ok",
248
- startIcon: "ApproveIcon",
249
- variant: "contained",
250
- color: "info",
251
- type: "text",
252
- onClick: "okHandler",
253
- size: "small",
254
- },
255
- style: {
256
- marginBottom: "8px",
257
- float: "right",
258
- },
259
- },
260
- },
261
- {
262
- type: "Control",
263
- scope: "#/properties/btnSubmit",
264
- options: {
265
- widget: "Button",
266
- },
267
-
268
- config: {
269
- layout: {
270
- xs: 11,
271
- sm: 11,
272
- md: 2.5,
273
- lg: 2.5,
274
- },
275
- main: {
276
- name: "Save & Exit",
247
+ name: "Save",
277
248
  startIcon: "ApproveIcon",
278
249
  variant: "contained",
279
250
  color: "info",
@@ -370,12 +370,12 @@ export const PageMasterUiSchema: any = {
370
370
  config: {
371
371
  layout: 11.7,
372
372
  main: {
373
- name: "Save",
373
+ name: "Submit Page",
374
374
  startIcon: "ApproveIcon",
375
375
  variant: "contained",
376
376
  color: "info",
377
377
  type: "text",
378
- onClick: "saveHandler",
378
+ onClick: "submitPageHandler",
379
379
  size: "small",
380
380
  },
381
381
  style: {
@@ -242,7 +242,7 @@ export const EventUiSchema: any = {
242
242
  type: "Control",
243
243
  scope: "#/properties/proc",
244
244
  config: {
245
- layout: { xs: 11, sm: 11, md: 6, lg: 6 },
245
+ layout: { xs: 11, sm: 11, md: 8, lg: 8 },
246
246
  },
247
247
  options: {
248
248
  widget: "EmptyBox",
@@ -259,40 +259,11 @@ export const EventUiSchema: any = {
259
259
  layout: {
260
260
  xs: 11,
261
261
  sm: 11,
262
- md: 2.5,
263
- lg: 2.5,
262
+ md: 3,
263
+ lg: 3,
264
264
  },
265
265
  main: {
266
- name: "Ok",
267
- startIcon: "ApproveIcon",
268
- variant: "contained",
269
- color: "info",
270
- type: "text",
271
- onClick: "okHandler",
272
- size: "small",
273
- },
274
- style: {
275
- marginBottom: "8px",
276
- float: "right",
277
- },
278
- },
279
- },
280
- {
281
- type: "Control",
282
- scope: "#/properties/btnSubmit",
283
- options: {
284
- widget: "Button",
285
- },
286
-
287
- config: {
288
- layout: {
289
- xs: 11,
290
- sm: 11,
291
- md: 2.5,
292
- lg: 2.5,
293
- },
294
- main: {
295
- name: "Save & Exit",
266
+ name: "Save",
296
267
  startIcon: "ApproveIcon",
297
268
  variant: "contained",
298
269
  color: "info",
@@ -0,0 +1,3 @@
1
+ export default () => {
2
+ localStorage.removeItem("pageFormdata")
3
+ }
@@ -1,6 +1,7 @@
1
1
  import _ from "lodash";
2
2
  import { ComponentSchema } from "../elements/UiSchema/Component/schema";
3
3
  import { componentBasicUiSchema } from "../elements/UiSchema/Component/uiSchema";
4
+ import { getFormdataFromLocalStorage, saveFormdataInLocalStorage } from "./saveHandler";
4
5
  import { CoreSection } from "../build/uischema/coreSection";
5
6
  import { EventSection } from "../build/uischema/eventSection";
6
7
  import { buildPropertiesSection } from "../build/uischema/buildPropertiesSection";
@@ -8,7 +9,6 @@ import { StyleSection } from "../build/uischema/styleSection";
8
9
  import { TableSection } from "../build/uischema/tableSection";
9
10
  import { ValueTab } from "../build/uischema/valueTab";
10
11
  import { ValidationSection } from "../build/uischema/validationSections";
11
- import { getFormdataFromLocalStorage, okHandler, saveFormdataInLocalStorage, saveHandler } from "./utils";
12
12
  const sectionLabels = {
13
13
  Select: ["Core", "Properties","Value", "style", "Event","Validation"],
14
14
  MultipleSelect: ["Core", "Properties","Value", "style", "Event","Validation"],
@@ -33,10 +33,9 @@ const sectionLabels = {
33
33
  Radio:["Core", "Properties", "style", "Event","Validation"],
34
34
  Text:["Core","Properties","style", "Event","Validation"],
35
35
  TextArea:["Core","Properties","style", "Event","Validation"],
36
+ InputSlider:["Core","Properties","style", "Event","Validation"],
36
37
  }
37
38
 
38
-
39
-
40
39
  export const refreshPage = (type:string,store:any) => {
41
40
  const UiSchema = _.cloneDeep(componentBasicUiSchema)
42
41
  if(type){
@@ -58,7 +57,7 @@ export const refreshPage = (type:string,store:any) => {
58
57
  store.setUiSchema(UiSchema);
59
58
  }
60
59
 
61
- export default (store: any, dynamicData: any, submitHandler: any, service: any) => {
60
+ export default (store: any, dynamicData: any) => {
62
61
  return {
63
62
  setPage: async function () {
64
63
  const formdata = await this.getFormdata();
@@ -69,15 +68,31 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
69
68
 
70
69
  },
71
70
  refreshPage:refreshPage,
72
- getFormdata: function () {
71
+ getFormdata: async function () {
73
72
  const path = store.searchParams?.get("path");
74
73
  return getFormdataFromLocalStorage(path)
75
74
  },
76
75
  getSchema: function () {
77
76
  return ComponentSchema;
78
77
  },
79
- okHandler:()=>okHandler(store),
80
- saveHandler: async ()=> await saveHandler(store,service,submitHandler,"PageMaster"),
78
+ saveHandler: async function () {
79
+ const path = store.searchParams?.get("path");
80
+ console.log(store.ctx.core.errors)
81
+ if (_.isEmpty(store.ctx.core.errors)) {
82
+ saveFormdataInLocalStorage(store.formData,path)
83
+ store.navigate(-1)
84
+ store.setNotify({
85
+ SuccessMessage: "Save Successfully",
86
+ Success: true,
87
+ });
88
+ } else {
89
+ store.setValidation("ValidateAndShow");
90
+ store.setNotify({
91
+ Fail:true,
92
+ FailMessage:"Errors on Page"
93
+ })
94
+ }
95
+ },
81
96
  onChange: function () {
82
97
  if (
83
98
  store?.formData?.type !== store?.newData?.type &&
@@ -86,11 +101,11 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
86
101
  this.refreshPage(store?.newData?.type,store);
87
102
  }
88
103
  },
89
- editComponents: function () {
104
+ editComponents: async function () {
90
105
  const rowId = dynamicData.path.split(".")[1];
91
106
  const path = store.searchParams?.get("path");
92
107
  const id = store.searchParams?.get("id");
93
- saveFormdataInLocalStorage(store.ctx.core.data, path)
108
+ saveFormdataInLocalStorage(store.formData, path)
94
109
  if (path) {
95
110
  const path = store.searchParams?.get("path");
96
111
  const finalPath = `${path}.elements[${rowId}]`
@@ -101,48 +116,48 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
101
116
  store.navigate(`/Component?path=${`elements[${rowId}]`}&id=${id}`)
102
117
  }
103
118
  },
104
- deleteComponents: function () {
119
+ deleteComponents: async function () {
105
120
  const path = store.searchParams?.get("path");
106
121
  const rowId = dynamicData.path.split(".")[1];
107
122
  store.formData.elements.splice(rowId, 1);
108
- const response = saveFormdataInLocalStorage(store.ctx.core.data, path)
123
+ const response = saveFormdataInLocalStorage(store.formData, path)
109
124
  const data = path ? _.get(response, path) : response;
110
125
  store.setFormdata(data);
111
126
  },
112
- deleteEvent: function () {
127
+ deleteEvent: async function () {
113
128
  const path = store.searchParams?.get("path");
114
129
  const rowId = dynamicData.path.split(".")[1];
115
130
  store.formData.events.splice(rowId, 1);
116
- const response = saveFormdataInLocalStorage(store.ctx.core.data, path)
131
+ const response = saveFormdataInLocalStorage(store.formData, path)
117
132
  store.setFormdata(_.get(response, path));
118
133
  },
119
- widgetAddClickHandler: function () {
134
+ widgetAddClickHandler: async function () {
120
135
  if (!Array.isArray(store.formData.elements)) {
121
136
  store.formData.elements = []
122
137
  }
123
138
  const path = store.searchParams?.get("path");
124
- saveFormdataInLocalStorage(store.ctx.core.data, path)
139
+ saveFormdataInLocalStorage(store.formData, path)
125
140
  const finalPath = `${path}.elements[${store.formData.elements.length}]`
126
141
  store.searchParams.set("path", finalPath)
127
142
  store.setSearchParams(store.searchParams)
128
143
  this.setPage()
129
144
 
130
145
  },
131
- eventEditHandler: function () {
146
+ eventEditHandler: async function () {
132
147
  const rowId = dynamicData.path.split(".")[1];
133
148
  const path = store.searchParams?.get("path");
134
149
  const id = store.searchParams?.get("id");
135
- saveFormdataInLocalStorage(store.ctx.core.data, path)
150
+ saveFormdataInLocalStorage(store.formData, path)
136
151
  const finalPath = `${path}.events[${rowId}]`
137
152
  store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
138
153
  },
139
- eventAddHandler: function () {
154
+ eventAddHandler: async function () {
140
155
  const path = store.searchParams?.get("path");
141
156
  const id = store.searchParams?.get("id");
142
157
  if (!Array.isArray(store.formData.events)) {
143
158
  store.formData.events = []
144
159
  }
145
- saveFormdataInLocalStorage(store.ctx.core.data, path)
160
+ saveFormdataInLocalStorage(store.formData, path)
146
161
  const finalPath = `${path}.events[${store.formData.events.length}]`
147
162
  store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
148
163
  },
@@ -1,7 +1,7 @@
1
- import { EventSchema } from "../elements/UiSchema/event/schema";
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, saveFormdataInLocalStorage, saveHandler } from "./utils";
4
+ import { saveFormdataInLocalStorage } from "./saveHandler";
5
5
  import { APISection } from "../build/uischema/apiSection";
6
6
  import { getSelectField, getTextArea } from "../build/uischema/buildPropertiesSection";
7
7
  import { refreshSectionUiSchema } from "../build/uischema/refresh";
@@ -9,9 +9,7 @@ import _ from "lodash";
9
9
 
10
10
  export default (
11
11
  store: any,
12
- dynamicData: any,
13
- submitHandler: any,
14
- service: any
12
+ dynamicData: any
15
13
  ) => {
16
14
  return {
17
15
  setPage: async function () {
@@ -19,76 +17,76 @@ export default (
19
17
  store.setFormdata(formdata);
20
18
  const schema = await this.getSchema();
21
19
  store.setSchema(schema);
22
- this.refreshPage(formdata.Handler, store)
20
+ this.refreshPage(formdata.Handler,store)
23
21
  },
24
22
  refreshPage: (handlerType: any, store: any) => {
25
23
  const uiSchema = _.cloneDeep(EventUiSchema);
26
- const schema: any = _.cloneDeep(EventSchema)
24
+ const schema:any = _.cloneDeep(EventSchema)
27
25
  if (handlerType) {
28
26
  if (handlerType === "custom") {
29
27
  uiSchema.elements[1].elements[0].elements[2] = getTextArea("eventCode", "Write Custom Code", false)
30
- schema.required = ["eventType", "Handler", "eventCode"]
28
+ schema.required = ["eventType","Handler","eventCode"]
31
29
 
32
30
  } else if (handlerType === "api") {
33
31
  uiSchema.elements[1].elements[0].elements[2] = APISection;
34
- schema.required = ["eventType", "Handler", "method", "path"]
32
+ schema.required = ["eventType","Handler","method","path"]
35
33
  } else if (handlerType === "inBuiltFunction") {
36
34
  uiSchema.elements[1].elements[0].elements[2] = getSelectField("inBuiltFunctionType", "Function Name", [
37
35
  { label: "RankProvider", value: "RankProvider" },
38
36
  { label: "Download File", value: "downloadFile" },
39
37
  ])
40
38
  uiSchema.elements[1].elements[0].elements[3] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true, { xs: 12, sm: 12, md: 6 });
41
- schema.required = ["eventType", "Handler", "inBuiltFunctionType"]
39
+ schema.required = ["eventType","Handler","inBuiltFunctionType"]
42
40
  } else if (handlerType === "refresh") {
43
41
  uiSchema.elements[1].elements[0].elements[2] = refreshSectionUiSchema;
44
42
  schema.properties.refreshElements.required = ["value"]
45
43
  schema.properties.refreshElements.items.required = ["value"]
46
- schema.required = ["eventType", "Handler", "refreshElements"]
44
+ schema.required = ["eventType","Handler","refreshElements"]
47
45
  }
48
46
  }
49
47
  store.setSchema(schema)
50
48
  store.setUiSchema(uiSchema)
51
49
  },
52
50
 
53
- getFormData: Component(store, dynamicData, submitHandler, service).getFormdata,
54
- getUiSchema: function () {
51
+ getFormData: Component(store, dynamicData).getFormdata,
52
+ getUiSchema: async function () {
55
53
  return EventUiSchema;
56
54
  },
57
- getSchema: () => {
55
+ getSchema: async () => {
58
56
  return EventSchema;
59
57
  },
60
- okHandler: () => okHandler(store),
61
- saveHandler: async () => await saveHandler(store, service, submitHandler,"PageMaster"),
62
58
  onChange: function () {
63
59
  if (
64
60
  store?.formData?.Handler !== store?.newData?.Handler &&
65
61
  store?.newData?.Handler !== undefined
66
62
  ) {
67
- this.refreshPage(store.newData.Handler || store.formdata.Handler, store)
63
+ this.refreshPage(store.newData.Handler||store.formdata.Handler,store)
68
64
  }
69
65
  },
70
- addEvent: function () {
66
+
67
+ saveHandler: Component(store, dynamicData).saveHandler,
68
+ addEvent: async function () {
71
69
  const path = store.searchParams?.get("path");
72
70
  if (!Array.isArray(store.formData.events)) {
73
71
  store.formData.events = []
74
72
  }
75
- saveFormdataInLocalStorage(store.ctx.core.data, path)
73
+ saveFormdataInLocalStorage(store.formData, path)
76
74
  const finalPath = `${path}.events[${store.formData?.events?.length}]`
77
75
  store.searchParams.set("path", finalPath)
78
76
  store.setSearchParams(store.searchParams)
79
77
  this.setPage()
80
78
  },
81
- editEvent: function () {
79
+ editEvent: async function () {
82
80
  const rowId = dynamicData.path.split(".")[1];
83
81
  const path = store.searchParams?.get("path");
84
- saveFormdataInLocalStorage(store.ctx.core.data, path)
82
+ saveFormdataInLocalStorage(store.formData, path)
85
83
  const finalPath = `${path}.events[${rowId}]`
86
84
  store.searchParams.set("path", finalPath)
87
85
  store.setSearchParams(store.searchParams)
88
86
  this.setPage()
89
87
 
90
88
  },
91
- deleteEvent: Component(store, dynamicData, submitHandler, service).deleteEvent,
89
+ deleteEvent: Component(store, dynamicData).deleteEvent,
92
90
  backHandler: function () {
93
91
  store.navigate(-1)
94
92
  },
@@ -0,0 +1,27 @@
1
+ import _ from "lodash";
2
+
3
+ export const getNavigationHistory = (config: any, path: string|undefined) => {
4
+ if (path) {
5
+ let urlRoutes: string = config.name;
6
+ const pathArrayAll = path.split(".");
7
+ const arr:any = []
8
+ pathArrayAll.map((e: string, i: number) => {
9
+ if (i === 0) {
10
+ arr.push(e)
11
+ return;
12
+ }
13
+ arr.push(`${arr[i - 1]}.${e}`)
14
+ })
15
+ arr.map((e) => {
16
+ const data = _.get(config, e)
17
+ if(data){
18
+ urlRoutes = urlRoutes + ` > ${data?.name || data?.eventType}`
19
+ }else{
20
+ urlRoutes = urlRoutes + " > NewComponent";
21
+ }
22
+
23
+ })
24
+ return { pageName: urlRoutes }
25
+ }
26
+ return undefined;
27
+ }