impaktapps-ui-builder 0.0.352 → 0.0.354

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 (38) hide show
  1. package/README.md +92 -0
  2. package/dist/impaktapps-ui-builder.es.js +393 -248
  3. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  4. package/dist/impaktapps-ui-builder.umd.js +15 -15
  5. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  6. package/dist/src/impaktapps-ui-builder/builder/build/buildPop.d.ts +1 -0
  7. package/dist/src/impaktapps-ui-builder/builder/build/buildStepper.d.ts +1 -0
  8. package/dist/src/impaktapps-ui-builder/builder/services/component.d.ts +9 -8
  9. package/dist/src/impaktapps-ui-builder/builder/services/event.d.ts +10 -9
  10. package/dist/src/impaktapps-ui-builder/builder/services/pageMaster.d.ts +10 -10
  11. package/dist/src/impaktapps-ui-builder/builder/services/utils.d.ts +10 -0
  12. package/dist/src/impaktapps-ui-builder/lib/index.d.ts +1 -1
  13. package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +4 -0
  14. package/package.json +2 -1
  15. package/src/impaktapps-ui-builder/builder/build/buildFileInput.ts +1 -1
  16. package/src/impaktapps-ui-builder/builder/build/buildPop.ts +43 -0
  17. package/src/impaktapps-ui-builder/builder/build/buildStepper.ts +53 -0
  18. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +7 -3
  19. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +20 -5
  20. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +14 -1
  21. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +33 -4
  22. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +2 -2
  23. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +7 -3
  24. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +33 -4
  25. package/src/impaktapps-ui-builder/builder/services/component.ts +21 -34
  26. package/src/impaktapps-ui-builder/builder/services/event.ts +22 -20
  27. package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +18 -36
  28. package/src/impaktapps-ui-builder/builder/services/utils.ts +109 -0
  29. package/src/impaktapps-ui-builder/lib/index.ts +1 -1
  30. package/src/impaktapps-ui-builder/runtime/services/service.ts +33 -32
  31. package/dist/src/impaktapps-ui-builder/builder/build/buildInputSlider.d.ts +0 -1
  32. package/dist/src/impaktapps-ui-builder/builder/services/clearLocalStorage.d.ts +0 -2
  33. package/dist/src/impaktapps-ui-builder/builder/services/getNavigationHistory.d.ts +0 -3
  34. package/dist/src/impaktapps-ui-builder/builder/services/saveHandler.d.ts +0 -2
  35. package/src/impaktapps-ui-builder/builder/build/buildInputSlider.ts +0 -46
  36. package/src/impaktapps-ui-builder/builder/services/clearLocalStorage.ts +0 -3
  37. package/src/impaktapps-ui-builder/builder/services/getNavigationHistory.ts +0 -27
  38. package/src/impaktapps-ui-builder/builder/services/saveHandler.ts +0 -29
@@ -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 { saveFormdataInLocalStorage } from "./saveHandler";
4
+ import { okHandler, saveFormdataInLocalStorage, saveHandler } from "./utils";
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,7 +9,9 @@ import _ from "lodash";
9
9
 
10
10
  export default (
11
11
  store: any,
12
- dynamicData: any
12
+ dynamicData: any,
13
+ submitHandler: any,
14
+ service: any
13
15
  ) => {
14
16
  return {
15
17
  setPage: async function () {
@@ -17,76 +19,76 @@ export default (
17
19
  store.setFormdata(formdata);
18
20
  const schema = await this.getSchema();
19
21
  store.setSchema(schema);
20
- this.refreshPage(formdata.Handler,store)
22
+ this.refreshPage(formdata.Handler, store)
21
23
  },
22
24
  refreshPage: (handlerType: any, store: any) => {
23
25
  const uiSchema = _.cloneDeep(EventUiSchema);
24
- const schema:any = _.cloneDeep(EventSchema)
26
+ const schema: any = _.cloneDeep(EventSchema)
25
27
  if (handlerType) {
26
28
  if (handlerType === "custom") {
27
29
  uiSchema.elements[1].elements[0].elements[2] = getTextArea("eventCode", "Write Custom Code", false)
28
- schema.required = ["eventType","Handler","eventCode"]
30
+ schema.required = ["eventType", "Handler", "eventCode"]
29
31
 
30
32
  } else if (handlerType === "api") {
31
33
  uiSchema.elements[1].elements[0].elements[2] = APISection;
32
- schema.required = ["eventType","Handler","method","path"]
34
+ schema.required = ["eventType", "Handler", "method", "path"]
33
35
  } else if (handlerType === "inBuiltFunction") {
34
36
  uiSchema.elements[1].elements[0].elements[2] = getSelectField("inBuiltFunctionType", "Function Name", [
35
37
  { label: "RankProvider", value: "RankProvider" },
36
38
  { label: "Download File", value: "downloadFile" },
37
39
  ])
38
40
  uiSchema.elements[1].elements[0].elements[3] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true, { xs: 12, sm: 12, md: 6 });
39
- schema.required = ["eventType","Handler","inBuiltFunctionType"]
41
+ schema.required = ["eventType", "Handler", "inBuiltFunctionType"]
40
42
  } else if (handlerType === "refresh") {
41
43
  uiSchema.elements[1].elements[0].elements[2] = refreshSectionUiSchema;
42
44
  schema.properties.refreshElements.required = ["value"]
43
45
  schema.properties.refreshElements.items.required = ["value"]
44
- schema.required = ["eventType","Handler","refreshElements"]
46
+ schema.required = ["eventType", "Handler", "refreshElements"]
45
47
  }
46
48
  }
47
49
  store.setSchema(schema)
48
50
  store.setUiSchema(uiSchema)
49
51
  },
50
52
 
51
- getFormData: Component(store, dynamicData).getFormdata,
52
- getUiSchema: async function () {
53
+ getFormData: Component(store, dynamicData, submitHandler, service).getFormdata,
54
+ getUiSchema: function () {
53
55
  return EventUiSchema;
54
56
  },
55
- getSchema: async () => {
57
+ getSchema: () => {
56
58
  return EventSchema;
57
59
  },
60
+ okHandler: () => okHandler(store),
61
+ saveHandler: async () => await saveHandler(store, service, submitHandler,"PageMaster"),
58
62
  onChange: function () {
59
63
  if (
60
64
  store?.formData?.Handler !== store?.newData?.Handler &&
61
65
  store?.newData?.Handler !== undefined
62
66
  ) {
63
- this.refreshPage(store.newData.Handler||store.formdata.Handler,store)
67
+ this.refreshPage(store.newData.Handler || store.formdata.Handler, store)
64
68
  }
65
69
  },
66
-
67
- saveHandler: Component(store, dynamicData).saveHandler,
68
- addEvent: async function () {
70
+ addEvent: function () {
69
71
  const path = store.searchParams?.get("path");
70
72
  if (!Array.isArray(store.formData.events)) {
71
73
  store.formData.events = []
72
74
  }
73
- saveFormdataInLocalStorage(store.formData, path)
75
+ saveFormdataInLocalStorage(store.ctx.core.data, path)
74
76
  const finalPath = `${path}.events[${store.formData?.events?.length}]`
75
77
  store.searchParams.set("path", finalPath)
76
78
  store.setSearchParams(store.searchParams)
77
79
  this.setPage()
78
80
  },
79
- editEvent: async function () {
81
+ editEvent: function () {
80
82
  const rowId = dynamicData.path.split(".")[1];
81
83
  const path = store.searchParams?.get("path");
82
- saveFormdataInLocalStorage(store.formData, path)
84
+ saveFormdataInLocalStorage(store.ctx.core.data, path)
83
85
  const finalPath = `${path}.events[${rowId}]`
84
86
  store.searchParams.set("path", finalPath)
85
87
  store.setSearchParams(store.searchParams)
86
88
  this.setPage()
87
89
 
88
90
  },
89
- deleteEvent: Component(store, dynamicData).deleteEvent,
91
+ deleteEvent: Component(store, dynamicData, submitHandler, service).deleteEvent,
90
92
  backHandler: function () {
91
93
  store.navigate(-1)
92
94
  },
@@ -2,18 +2,19 @@ import { PageMasterSchema } from "../elements/UiSchema/PageMaster/schema";
2
2
  import { PageMasterUiSchema } from "../elements/UiSchema/PageMaster/uiSchema";
3
3
  import _ from "lodash";
4
4
  import Component from "./component";
5
- import { getFormdataFromLocalStorage, saveFormdataInLocalStorage } from "./saveHandler";
6
- import { schema } from "../build/buildUiSchema";
5
+ import { getFormdataFromLocalStorage, saveFormdataInLocalStorage, saveHandler } from "./utils";
6
+
7
7
 
8
8
  interface funcParamsProps {
9
9
  store: any,
10
10
  dynamicData: any,
11
- config: any,
11
+
12
12
  submitHandler: any,
13
13
  service: any
14
+ config?: any
14
15
  }
15
16
  export default (funcParams: funcParamsProps) => {
16
- const { store, dynamicData, config, submitHandler } = funcParams
17
+ const { store, dynamicData, config, submitHandler, service } = funcParams
17
18
  return {
18
19
  setPage: async function () {
19
20
  const formdata = await this.getFormdata();
@@ -23,7 +24,7 @@ export default (funcParams: funcParamsProps) => {
23
24
  store.setSchema(schema);
24
25
  store.setUiSchema(uiSchema);
25
26
  },
26
- getFormdata: async function () {
27
+ getFormdata: function () {
27
28
  const id = store.searchParams?.get("id");
28
29
  const formData = getFormdataFromLocalStorage()
29
30
  if (formData) {
@@ -32,7 +33,7 @@ export default (funcParams: funcParamsProps) => {
32
33
  saveFormdataInLocalStorage(config)
33
34
  return config
34
35
  },
35
- getUiSchema: async function () {
36
+ getUiSchema: function () {
36
37
  return PageMasterUiSchema;
37
38
  },
38
39
  getSchema: () => {
@@ -42,58 +43,39 @@ export default (funcParams: funcParamsProps) => {
42
43
  localStorage.removeItem("pageFormdata")
43
44
  store.navigate("/PageMasterRecords");
44
45
  },
45
- onAddClickHandler: async function () {
46
+ onAddClickHandler: function () {
46
47
  const id = store.searchParams?.get("id");
47
48
  if (!Array.isArray(store.formData.elements)) {
48
49
  store.formData.elements = []
49
50
  }
50
- const response = saveFormdataInLocalStorage(store.formData)
51
+ const response = saveFormdataInLocalStorage(store.ctx.core.data)
51
52
  store.navigate(
52
53
  `/Component?path=${`elements[${response?.elements.length}]`}&id=${id}`
53
54
  );
54
55
  },
55
- submitPageHandler: async function () {
56
- console.log()
57
- if (_.isEmpty(funcParams.store.ctx.core.errors)) {
58
- submitHandler(store, funcParams.service)
59
- .then((saveReturn: any) => {
60
- localStorage.removeItem("pageFormdata")
61
- store.navigate(-1)
62
- store.setNotify({
63
- SuccessMessage: "Submit Successfully",
64
- Success: true,
65
- });
66
- })
67
- } else {
68
- funcParams.store.setValidation("ValidateAndShow");
69
- funcParams.store.setNotify({
70
- Fail:true,
71
- FailMessage:"Errors on Page"
72
- })
73
- }
74
- },
75
- Edit_Components: Component(store, dynamicData).editComponents,
76
- Delete_Components: Component(store, dynamicData).deleteComponents,
77
- eventAddHandler: async function () {
56
+ saveHandler: async ()=> await saveHandler(store,service,submitHandler),
57
+ Edit_Components: Component(store, dynamicData, submitHandler, service).editComponents,
58
+ Delete_Components: Component(store, dynamicData, submitHandler, service).deleteComponents,
59
+ eventAddHandler: function () {
78
60
  const id = store.searchParams?.get("id");
79
61
  if (!Array.isArray(store.formData.events)) {
80
62
  store.formData.events = []
81
63
  }
82
- saveFormdataInLocalStorage(store.formData)
64
+ saveFormdataInLocalStorage(store.ctx.core.data)
83
65
  const finalPath = `events[${store.formData.events.length}]`
84
66
  store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
85
67
  },
86
- editEvent: async function () {
68
+ editEvent: function () {
87
69
  const rowId = dynamicData.path.split(".")[1];
88
70
  const id = store.searchParams?.get("id");
89
- saveFormdataInLocalStorage(store.formData)
71
+ saveFormdataInLocalStorage(store.ctx.core.data)
90
72
  const finalPath = `events[${rowId}]`
91
73
  store.navigate(`/ComponentEvents?path=${finalPath}&id=${id}`)
92
74
  },
93
- deleteEvent: async function () {
75
+ deleteEvent: function () {
94
76
  const rowId = dynamicData.path.split(".")[1];
95
77
  store.formData.events.splice(rowId, 1);
96
- const response = saveFormdataInLocalStorage(store.formData)
78
+ const response = saveFormdataInLocalStorage(store.ctx.core.data)
97
79
  store.setFormdata(response);
98
80
  },
99
81
  }
@@ -0,0 +1,109 @@
1
+ import buildConfig from "../build/buildConfig";
2
+ import _ from "lodash";
3
+
4
+ const clearFromLocalStorage = () => {
5
+ localStorage.removeItem("pageFormdata")
6
+ }
7
+ export default clearFromLocalStorage;
8
+ export const getNavigationHistory = (config: any, path: string | undefined) => {
9
+ if (path) {
10
+ let urlRoutes: string = config.name;
11
+ const pathArrayAll = path.split(".");
12
+ const arr: any = []
13
+ pathArrayAll.map((e: string, i: number) => {
14
+ if (i === 0) {
15
+ arr.push(e)
16
+ return;
17
+ }
18
+ arr.push(`${arr[i - 1]}.${e}`)
19
+ })
20
+ arr.map((e) => {
21
+ const data = _.get(config, e)
22
+ if (data) {
23
+ urlRoutes = urlRoutes + ` > ${data?.name || data?.eventType}`
24
+ } else {
25
+ urlRoutes = urlRoutes + " > NewComponent";
26
+ }
27
+
28
+ })
29
+ return { pageName: urlRoutes }
30
+ }
31
+ return undefined;
32
+ }
33
+
34
+ export const saveFormdataInLocalStorage = (formData: any, path?: string) => {
35
+ let updatedFormdata: any;
36
+ if (path) {
37
+ const pageFormdata = getFormdataFromLocalStorage()
38
+ updatedFormdata = _.set(pageFormdata, path, buildConfig(formData));
39
+ } else {
40
+ updatedFormdata = buildConfig(formData)
41
+ }
42
+ localStorage.setItem("pageFormdata", JSON.stringify(updatedFormdata))
43
+ return updatedFormdata;
44
+ }
45
+
46
+ export const getFormdataFromLocalStorage = (path?: string) => {
47
+ const pageFormdata = localStorage.getItem("pageFormdata") ? JSON.parse(localStorage.getItem("pageFormdata")) : undefined;
48
+ let returnValue: any;
49
+ if (path) {
50
+ returnValue = _.get(pageFormdata, path)
51
+ returnValue = { ...returnValue, ...getNavigationHistory(pageFormdata, path) }
52
+ }
53
+ if (!returnValue) {
54
+ returnValue = getNavigationHistory(pageFormdata, path)
55
+ }
56
+ return returnValue || pageFormdata;
57
+
58
+ }
59
+
60
+ export async function saveHandler(store, service, submitHandler, pageName?: string) {
61
+ const id = store.searchParams?.get("id");
62
+ const path = store.searchParams?.get("path");
63
+ saveFormdataInLocalStorage(store.ctx.core.data, path);
64
+ const config = JSON.parse(localStorage.getItem("pageFormdata"));
65
+ if (_.isEmpty(store.ctx.core.errors)) {
66
+ try {
67
+ const saveReturn = await submitHandler(store, service, config);
68
+ navigateHandler(store, true, pageName ? `/${pageName}?id=${id}` : "/PageMasterRecords")
69
+ } catch (err) {
70
+ navigateHandler(store, false)
71
+ }
72
+ }
73
+ }
74
+
75
+ export const navigateHandler = (store, isSubmitted, pageName?: string | boolean) => {
76
+ if (isSubmitted) {
77
+ localStorage.removeItem("pageFormdata");
78
+ store.navigate(pageName || -1)
79
+ store.setNotify({
80
+ SuccessMessage: "Submit Successfully",
81
+ Success: true,
82
+ });
83
+ } else {
84
+ store.setValidation("ValidateAndShow");
85
+ store.setNotify({
86
+ Fail: true,
87
+ FailMessage: "Errors on Page"
88
+ });
89
+ }
90
+ };
91
+
92
+ export function okHandler(store) {
93
+ const path = store.searchParams?.get("path");
94
+ console.log(store.ctx.core.errors)
95
+ if (_.isEmpty(store.ctx.core.errors)) {
96
+ saveFormdataInLocalStorage(store.ctx.core.data, path)
97
+ store.navigate(-1)
98
+ store.setNotify({
99
+ SuccessMessage: "Save Successfully",
100
+ Success: true,
101
+ });
102
+ } else {
103
+ store.setValidation("ValidateAndShow");
104
+ store.setNotify({
105
+ Fail: true,
106
+ FailMessage: "Errors on Page"
107
+ })
108
+ }
109
+ }
@@ -7,4 +7,4 @@ export { schema} from "../builder/build/buildUiSchema"
7
7
  export {default as buildConfig} from "../builder/build/buildConfig"
8
8
  export {default as buildUiSchema} from "../builder/build/buildUiSchema"
9
9
  export {buildSchema} from "../builder/build/buildUiSchema"
10
- export {default as clearPreviousCache} from "../builder/services/clearLocalStorage"
10
+ export {default as clearFromLocalStorage} from "../builder/services/utils"
@@ -30,7 +30,7 @@ export const extractEvents = (eventConfig: any) => {
30
30
  return elem.eventType === "Success"
31
31
  })
32
32
  if (!(!!SuccessEvent) && event.eventType === "onLoad") {
33
- event.events.push({ Handler: "mergeFormdata", eventType: "Success", type: compType,lazyLoading:eventConfig.lazyLoading==="YES"?true:false })
33
+ event.events.push({ Handler: "mergeFormdata", eventType: "Success", type: compType, lazyLoading: eventConfig.lazyLoading === "YES" ? true : false })
34
34
  }
35
35
  eventGroups[event.eventType][eventConfigObj.name].push({ ...event, type: compType })
36
36
  });
@@ -59,7 +59,7 @@ export default (funcParams: funcParamsProps) => {
59
59
  let executeEventsParameters: handlersProps = {
60
60
  config: {}, componentName: "",
61
61
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
62
- serviceHolder: {downloadFile}, eventGroups
62
+ serviceHolder: { downloadFile }, eventGroups
63
63
  };
64
64
  return {
65
65
  setPage: async function () {
@@ -76,54 +76,33 @@ export default (funcParams: funcParamsProps) => {
76
76
  { ...funcParams.schema.properties, ...pre.properties, }
77
77
  }
78
78
  }
79
- )
79
+ )
80
80
  funcParams.uiSchema.elements.push(notifyUiSchema);
81
81
  funcParams.store.setUiSchema(funcParams.uiSchema);
82
- await executeRefreshHandler( {
82
+ await executeRefreshHandler({
83
83
  config: {}, componentName: "",
84
84
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
85
85
  serviceHolder: this, eventGroups
86
86
  })
87
87
  },
88
88
  onClick: async function () {
89
- const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
90
- for (const eventConfig of eventGroups?.onClick[path]) {
91
- await executeEvents({
92
- ...executeEventsParameters,
93
- config: eventConfig,
94
- componentName: path
95
- })
96
- }
89
+ await this.callHandler("onClick")
97
90
  },
98
- onFileDownload:async () =>{
99
- const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
100
- for (const eventConfig of eventGroups?.onDownload[path]) {
101
- await executeEvents({
102
- ...executeEventsParameters,
103
- config: eventConfig,
104
- componentName: path
105
- })
106
- }
91
+ onFileDownload: async function () {
92
+ await this.callHandler("onDownload")
107
93
  },
108
- onFileUpload:async () =>{
109
- const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
110
- for (const eventConfig of eventGroups?.onUpload[path]) {
111
- await executeEvents({
112
- ...executeEventsParameters,
113
- config: eventConfig,
114
- componentName: path
115
- })
116
- }
94
+ onFileUpload: async function () {
95
+ await this.callHandler("onUpload")
117
96
  },
118
97
  onPaginationChange: async function (paginationValues) {
119
98
  const apiBody = [
120
99
  { key: "size", value: paginationValues.pagination.pageSize },
121
- { key: "pageIndex", value: paginationValues.pagination.pageIndex },
100
+ { key: "pageIndex", value: paginationValues.pagination.pageIndex },
122
101
  { key: "sorting", value: paginationValues.sorting || [] },
123
102
  { key: "filters", value: paginationValues.columnFilters || [] },
124
103
  { key: "globalFilter", value: paginationValues.globalFilter ?? '' }
125
104
  ]
126
- const response = await this.updateConfigApiBody(paginationValues, apiBody);
105
+ const response = await this.updateConfigApiBody(paginationValues, apiBody);
127
106
  return response?.data;
128
107
  },
129
108
  getSelectOptions: async function (param) {
@@ -175,6 +154,28 @@ export default (funcParams: funcParamsProps) => {
175
154
  }
176
155
  return LastCallResponse
177
156
  },
157
+ StepperBackHandler: async function (param) {
158
+ await this.callHandler("onStepperBack")
159
+ param.handleBack()
160
+ },
161
+ StepperSkipHandler: async function (param) {
162
+ await this.callHandler("onStepperSkip")
163
+ param.handleSkip()
164
+ },
165
+ StepperNextHandler: async function (param) {
166
+ await this.callHandler("onStepperNext")
167
+ param.handleNext()
168
+ },
169
+ callHandler: async function (eventType: string) {
170
+ const path = funcParams.dynamicData?.tableButtonPath || funcParams.dynamicData.path.split(".")[0];
171
+ for (const eventConfig of eventGroups?.[eventType]?.[path]) {
172
+ await executeEvents({
173
+ ...executeEventsParameters,
174
+ config: eventConfig,
175
+ componentName: path
176
+ })
177
+ }
178
+ },
178
179
  downloadFile: downloadFile
179
180
  };
180
181
  };
@@ -1 +0,0 @@
1
- export declare const buildInputSlider: (config: any, componentScope: any) => any;
@@ -1,2 +0,0 @@
1
- declare const _default: () => void;
2
- export default _default;
@@ -1,3 +0,0 @@
1
- export declare const getNavigationHistory: (config: any, path: string | undefined) => {
2
- pageName: string;
3
- };
@@ -1,2 +0,0 @@
1
- export declare const saveFormdataInLocalStorage: (formData: any, path?: string) => any;
2
- export declare const getFormdataFromLocalStorage: (path?: string) => any;
@@ -1,46 +0,0 @@
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
- }
@@ -1,3 +0,0 @@
1
- export default () => {
2
- localStorage.removeItem("pageFormdata")
3
- }
@@ -1,27 +0,0 @@
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
- }
@@ -1,29 +0,0 @@
1
- import buildConfig from "../build/buildConfig";
2
- import _ from "lodash";
3
- import { getNavigationHistory } from "./getNavigationHistory";
4
-
5
- export const saveFormdataInLocalStorage = (formData: any, path?: string) => {
6
- let updatedFormdata:any;
7
- if (path) {
8
- const pageFormdata = getFormdataFromLocalStorage()
9
- updatedFormdata = _.set(pageFormdata, path, buildConfig(formData));
10
- } else {
11
- updatedFormdata = buildConfig(formData)
12
- }
13
- localStorage.setItem("pageFormdata", JSON.stringify(updatedFormdata))
14
- return updatedFormdata;
15
- }
16
-
17
- export const getFormdataFromLocalStorage = (path?: string) => {
18
- const pageFormdata = localStorage.getItem("pageFormdata")?JSON.parse(localStorage.getItem("pageFormdata")):undefined;
19
- let returnValue: any;
20
- if (path) {
21
- returnValue = _.get(pageFormdata, path)
22
- returnValue = { ...returnValue, ...getNavigationHistory(pageFormdata, path) }
23
- }
24
- if (!returnValue) {
25
- returnValue = getNavigationHistory(pageFormdata, path)
26
- }
27
- return returnValue || pageFormdata;
28
-
29
- }