impaktapps-ui-builder 0.0.348 → 0.0.351
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.
- package/dist/impaktapps-ui-builder.es.js +145 -145
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +5 -5
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/builder/services/pageMaster.d.ts +0 -3
- package/dist/src/impaktapps-ui-builder/builder/services/utils.d.ts +10 -0
- package/dist/src/impaktapps-ui-builder/lib/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/services/component.ts +1 -2
- package/src/impaktapps-ui-builder/builder/services/event.ts +1 -2
- package/src/impaktapps-ui-builder/builder/services/pageMaster.ts +1 -50
- package/src/impaktapps-ui-builder/builder/services/utils.ts +109 -0
- package/src/impaktapps-ui-builder/lib/index.ts +1 -1
- package/dist/src/impaktapps-ui-builder/builder/services/clearLocalStorage.d.ts +0 -2
- package/dist/src/impaktapps-ui-builder/builder/services/getNavigationHistory.d.ts +0 -3
- package/dist/src/impaktapps-ui-builder/builder/services/saveHandler.d.ts +0 -2
- package/src/impaktapps-ui-builder/builder/services/clearLocalStorage.ts +0 -3
- package/src/impaktapps-ui-builder/builder/services/getNavigationHistory.ts +0 -27
- package/src/impaktapps-ui-builder/builder/services/saveHandler.ts +0 -29
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export declare function saveHandler(store: any, service: any, submitHandler: any, pageName?: string): Promise<void>;
|
|
2
|
-
export declare const navigateHandler: (store: any, isSubmitted: any, pageName?: string | boolean) => void;
|
|
3
|
-
export declare function okHandler(store: any): void;
|
|
4
1
|
interface funcParamsProps {
|
|
5
2
|
store: any;
|
|
6
3
|
dynamicData: any;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const clearFromLocalStorage: () => void;
|
|
2
|
+
export default clearFromLocalStorage;
|
|
3
|
+
export declare const getNavigationHistory: (config: any, path: string | undefined) => {
|
|
4
|
+
pageName: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const saveFormdataInLocalStorage: (formData: any, path?: string) => any;
|
|
7
|
+
export declare const getFormdataFromLocalStorage: (path?: string) => any;
|
|
8
|
+
export declare function saveHandler(store: any, service: any, submitHandler: any, pageName?: string): Promise<void>;
|
|
9
|
+
export declare const navigateHandler: (store: any, isSubmitted: any, pageName?: string | boolean) => void;
|
|
10
|
+
export declare function okHandler(store: any): void;
|
|
@@ -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
|
|
9
|
+
export { default as clearFromLocalStorage } from "../builder/services/utils";
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
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";
|
|
5
4
|
import { CoreSection } from "../build/uischema/coreSection";
|
|
6
5
|
import { EventSection } from "../build/uischema/eventSection";
|
|
7
6
|
import { buildPropertiesSection } from "../build/uischema/buildPropertiesSection";
|
|
@@ -9,7 +8,7 @@ import { StyleSection } from "../build/uischema/styleSection";
|
|
|
9
8
|
import { TableSection } from "../build/uischema/tableSection";
|
|
10
9
|
import { ValueTab } from "../build/uischema/valueTab";
|
|
11
10
|
import { ValidationSection } from "../build/uischema/validationSections";
|
|
12
|
-
import {
|
|
11
|
+
import { getFormdataFromLocalStorage, okHandler, saveFormdataInLocalStorage, saveHandler } from "./utils";
|
|
13
12
|
const sectionLabels = {
|
|
14
13
|
Select: ["Core", "Properties","Value", "style", "Event","Validation"],
|
|
15
14
|
MultipleSelect: ["Core", "Properties","Value", "style", "Event","Validation"],
|
|
@@ -1,9 +1,8 @@
|
|
|
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 { saveFormdataInLocalStorage } from "./
|
|
4
|
+
import { okHandler, saveFormdataInLocalStorage, saveHandler } from "./utils";
|
|
5
5
|
import { APISection } from "../build/uischema/apiSection";
|
|
6
|
-
import { okHandler, saveHandler } from "./pageMaster";
|
|
7
6
|
import { getSelectField, getTextArea } from "../build/uischema/buildPropertiesSection";
|
|
8
7
|
import { refreshSectionUiSchema } from "../build/uischema/refresh";
|
|
9
8
|
import _ from "lodash";
|
|
@@ -2,57 +2,8 @@ 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 "./
|
|
6
|
-
import { schema } from "../build/buildUiSchema";
|
|
5
|
+
import { getFormdataFromLocalStorage, saveFormdataInLocalStorage, saveHandler } from "./utils";
|
|
7
6
|
|
|
8
|
-
export async function saveHandler(store, service, submitHandler,pageName?:string) {
|
|
9
|
-
const id = store.searchParams?.get("id");
|
|
10
|
-
const path = store.searchParams?.get("path");
|
|
11
|
-
saveFormdataInLocalStorage(store.ctx.core.data, path);
|
|
12
|
-
const config = JSON.parse(localStorage.getItem("pageFormdata"));
|
|
13
|
-
if (_.isEmpty(store.ctx.core.errors)) {
|
|
14
|
-
try {
|
|
15
|
-
const saveReturn = await submitHandler(store, service, config);
|
|
16
|
-
navigateHandler(store,true,pageName?`/${pageName}?id=${id}`:false)
|
|
17
|
-
} catch (err) {
|
|
18
|
-
navigateHandler(store,false)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export const navigateHandler = (store, isSubmitted, pageName?: string | boolean) => {
|
|
23
|
-
if (isSubmitted) {
|
|
24
|
-
localStorage.removeItem("pageFormdata");
|
|
25
|
-
store.navigate(pageName || -1)
|
|
26
|
-
store.setNotify({
|
|
27
|
-
SuccessMessage: "Submit Successfully",
|
|
28
|
-
Success: true,
|
|
29
|
-
});
|
|
30
|
-
} else {
|
|
31
|
-
store.setValidation("ValidateAndShow");
|
|
32
|
-
store.setNotify({
|
|
33
|
-
Fail: true,
|
|
34
|
-
FailMessage: "Errors on Page"
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
export function okHandler (store) {
|
|
39
|
-
const path = store.searchParams?.get("path");
|
|
40
|
-
console.log(store.ctx.core.errors)
|
|
41
|
-
if (_.isEmpty(store.ctx.core.errors)) {
|
|
42
|
-
saveFormdataInLocalStorage(store.ctx.core.data,path)
|
|
43
|
-
store.navigate(-1)
|
|
44
|
-
store.setNotify({
|
|
45
|
-
SuccessMessage: "Save Successfully",
|
|
46
|
-
Success: true,
|
|
47
|
-
});
|
|
48
|
-
} else {
|
|
49
|
-
store.setValidation("ValidateAndShow");
|
|
50
|
-
store.setNotify({
|
|
51
|
-
Fail:true,
|
|
52
|
-
FailMessage:"Errors on Page"
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
7
|
|
|
57
8
|
interface funcParamsProps {
|
|
58
9
|
store: any,
|
|
@@ -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
|
|
10
|
+
export {default as clearFromLocalStorage} from "../builder/services/utils"
|
|
@@ -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
|
-
}
|