impaktapps-ui-builder 0.0.324 → 0.0.325

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.
@@ -1,17 +1,3 @@
1
1
  export declare const refreshPage: (type: string, store: any) => void;
2
- declare const _default: (store: any, dynamicData: any) => {
3
- setPage: () => Promise<void>;
4
- refreshPage: (type: string, store: any) => void;
5
- getFormdata: () => Promise<any>;
6
- getSchema: () => any;
7
- saveHandler: () => Promise<void>;
8
- onChange: () => 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>;
15
- backHandler: () => void;
16
- };
2
+ declare const _default: (store: any, dynamicData: any, submitHandler: any, service: any) => any;
17
3
  export default _default;
@@ -1,7 +1,7 @@
1
- declare const _default: (store: any, dynamicData: any) => {
1
+ declare const _default: (store: any, dynamicData: any, submitHandler: any, service: any) => {
2
2
  setPage: () => Promise<void>;
3
3
  refreshPage: (handlerType: any, store: any) => void;
4
- getFormData: () => Promise<any>;
4
+ getFormData: any;
5
5
  getUiSchema: () => Promise<any>;
6
6
  getSchema: () => Promise<{
7
7
  type: string;
@@ -77,10 +77,11 @@ declare const _default: (store: any, dynamicData: any) => {
77
77
  required: string[];
78
78
  }>;
79
79
  onChange: () => void;
80
- saveHandler: () => Promise<void>;
80
+ saveHandler: any;
81
81
  addEvent: () => Promise<void>;
82
+ submitPageHandler: any;
82
83
  editEvent: () => Promise<void>;
83
- deleteEvent: () => Promise<void>;
84
+ deleteEvent: any;
84
85
  backHandler: () => void;
85
86
  };
86
87
  export default _default;
@@ -1,59 +1,9 @@
1
1
  interface funcParamsProps {
2
2
  store: any;
3
3
  dynamicData: any;
4
- config: any;
5
4
  submitHandler: any;
6
5
  service: any;
6
+ config?: any;
7
7
  }
8
- declare const _default: (funcParams: funcParamsProps) => {
9
- setPage: () => Promise<void>;
10
- getFormdata: () => Promise<any>;
11
- getUiSchema: () => Promise<any>;
12
- getSchema: () => {
13
- type: string;
14
- properties: {
15
- name: {
16
- type: string;
17
- minLength: number;
18
- };
19
- label: {
20
- type: string;
21
- };
22
- layout: {
23
- type: string;
24
- items: {
25
- type: string;
26
- properties: {
27
- layout_key: {
28
- type: string;
29
- };
30
- layout_value: {
31
- type: string;
32
- };
33
- };
34
- };
35
- };
36
- sectionLabels: {
37
- type: string;
38
- items: {
39
- type: string;
40
- properties: {
41
- label: {
42
- type: string;
43
- };
44
- };
45
- };
46
- };
47
- };
48
- required: string[];
49
- };
50
- backHandler: () => 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
- };
8
+ declare const _default: (funcParams: funcParamsProps) => any;
59
9
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.324",
3
+ "version": "0.0.325",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -13,6 +13,7 @@
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",
16
17
  "react": "^18.2.0",
17
18
  "react-ace": "^10.1.0",
18
19
  "react-dom": "^18.2.0",
@@ -34,7 +34,6 @@ 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";
38
37
  export let schema = {
39
38
  type: "object",
40
39
  properties: {},
@@ -165,9 +164,6 @@ const buildUiSchema = (config: any) => {
165
164
  let elements: any = {};
166
165
  const componentScope = `#/properties/${config.name}`;
167
166
  switch (config.type) {
168
- case "InputSlider":
169
- elements = buildInputSlider(config, componentScope);
170
- break;
171
167
  case "FileInput":
172
168
  elements = buildFileInput(config, componentScope);
173
169
  break;
@@ -160,14 +160,6 @@ 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;
171
163
  case "Text":
172
164
  uiSchema.elements = [
173
165
  getInputField("placeholder", "Placeholder"),
@@ -15,7 +15,6 @@ 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" },
19
18
  { title: "Label", const: "Box" },
20
19
  { title: "LeaderBoard", const: "LeaderBoard" },
21
20
  { title: "MultipleSelect", const: "MultipleSelect" },
@@ -258,6 +258,37 @@ export const componentBasicUiSchema: any = {
258
258
  },
259
259
  },
260
260
  },
261
+ ///////////////////////////////////
262
+ {
263
+ type: "Control",
264
+ scope: "#/properties/btnSubmit",
265
+ options: {
266
+ widget: "Button",
267
+ },
268
+
269
+ config: {
270
+ layout: {
271
+ xs: 11,
272
+ sm: 11,
273
+ md: 3,
274
+ lg: 3,
275
+ },
276
+ main: {
277
+ name: "Submit",
278
+ startIcon: "ApproveIcon",
279
+ variant: "contained",
280
+ color: "info",
281
+ type: "text",
282
+ onClick: "submitPageHandler",
283
+ size: "small",
284
+ },
285
+ style: {
286
+ marginBottom: "8px",
287
+ float: "right",
288
+ },
289
+ },
290
+ },
291
+ //////////////////////////////////
261
292
  {
262
293
  type: "Control",
263
294
  scope: "#/properties/notify",
@@ -248,9 +248,10 @@ export const EventUiSchema: any = {
248
248
  widget: "EmptyBox",
249
249
  },
250
250
  },
251
+ //////////////////////////////
251
252
  {
252
253
  type: "Control",
253
- scope: "#/properties/btn",
254
+ scope: "#/properties/btnSubmit",
254
255
  options: {
255
256
  widget: "Button",
256
257
  },
@@ -263,12 +264,12 @@ export const EventUiSchema: any = {
263
264
  lg: 3,
264
265
  },
265
266
  main: {
266
- name: "Save",
267
+ name: "Submit",
267
268
  startIcon: "ApproveIcon",
268
269
  variant: "contained",
269
270
  color: "info",
270
271
  type: "text",
271
- onClick: "saveHandler",
272
+ onClick: "submitPageHandler",
272
273
  size: "small",
273
274
  },
274
275
  style: {
@@ -277,6 +278,7 @@ export const EventUiSchema: any = {
277
278
  },
278
279
  },
279
280
  },
281
+ ////////////////////////////////////
280
282
  {
281
283
  type: "Control",
282
284
  scope: "#/properties/notify",
@@ -9,6 +9,7 @@ import { StyleSection } from "../build/uischema/styleSection";
9
9
  import { TableSection } from "../build/uischema/tableSection";
10
10
  import { ValueTab } from "../build/uischema/valueTab";
11
11
  import { ValidationSection } from "../build/uischema/validationSections";
12
+ import pageMaster from "./pageMaster";
12
13
  const sectionLabels = {
13
14
  Select: ["Core", "Properties","Value", "style", "Event","Validation"],
14
15
  MultipleSelect: ["Core", "Properties","Value", "style", "Event","Validation"],
@@ -33,9 +34,10 @@ const sectionLabels = {
33
34
  Radio:["Core", "Properties", "style", "Event","Validation"],
34
35
  Text:["Core","Properties","style", "Event","Validation"],
35
36
  TextArea:["Core","Properties","style", "Event","Validation"],
36
- InputSlider:["Core","Properties","style", "Event","Validation"],
37
37
  }
38
38
 
39
+
40
+
39
41
  export const refreshPage = (type:string,store:any) => {
40
42
  const UiSchema = _.cloneDeep(componentBasicUiSchema)
41
43
  if(type){
@@ -57,7 +59,7 @@ export const refreshPage = (type:string,store:any) => {
57
59
  store.setUiSchema(UiSchema);
58
60
  }
59
61
 
60
- export default (store: any, dynamicData: any) => {
62
+ export default (store: any, dynamicData: any, submitHandler: any, service: any) => {
61
63
  return {
62
64
  setPage: async function () {
63
65
  const formdata = await this.getFormdata();
@@ -93,6 +95,7 @@ export default (store: any, dynamicData: any) => {
93
95
  })
94
96
  }
95
97
  },
98
+ submitPageHandler: pageMaster({store,dynamicData,submitHandler,service}).submitPageHandler,
96
99
  onChange: function () {
97
100
  if (
98
101
  store?.formData?.type !== store?.newData?.type &&
@@ -3,13 +3,16 @@ import { EventUiSchema } from "../elements/UiSchema/event/uiSchema";
3
3
  import Component from "./component";
4
4
  import { saveFormdataInLocalStorage } from "./saveHandler";
5
5
  import { APISection } from "../build/uischema/apiSection";
6
+ import pageMaster from "./pageMaster";
6
7
  import { getSelectField, getTextArea } from "../build/uischema/buildPropertiesSection";
7
8
  import { refreshSectionUiSchema } from "../build/uischema/refresh";
8
9
  import _ from "lodash";
9
10
 
10
11
  export default (
11
12
  store: any,
12
- dynamicData: any
13
+ dynamicData: any,
14
+ submitHandler: any,
15
+ service: any
13
16
  ) => {
14
17
  return {
15
18
  setPage: async function () {
@@ -48,7 +51,7 @@ export default (
48
51
  store.setUiSchema(uiSchema)
49
52
  },
50
53
 
51
- getFormData: Component(store, dynamicData).getFormdata,
54
+ getFormData: Component(store, dynamicData,submitHandler,service).getFormdata,
52
55
  getUiSchema: async function () {
53
56
  return EventUiSchema;
54
57
  },
@@ -64,7 +67,7 @@ export default (
64
67
  }
65
68
  },
66
69
 
67
- saveHandler: Component(store, dynamicData).saveHandler,
70
+ saveHandler: Component(store, dynamicData,submitHandler,service).saveHandler,
68
71
  addEvent: async function () {
69
72
  const path = store.searchParams?.get("path");
70
73
  if (!Array.isArray(store.formData.events)) {
@@ -76,6 +79,7 @@ export default (
76
79
  store.setSearchParams(store.searchParams)
77
80
  this.setPage()
78
81
  },
82
+ submitPageHandler: pageMaster({store,dynamicData,submitHandler,service}).submitPageHandler,
79
83
  editEvent: async function () {
80
84
  const rowId = dynamicData.path.split(".")[1];
81
85
  const path = store.searchParams?.get("path");
@@ -86,7 +90,7 @@ export default (
86
90
  this.setPage()
87
91
 
88
92
  },
89
- deleteEvent: Component(store, dynamicData).deleteEvent,
93
+ deleteEvent: Component(store, dynamicData,submitHandler,service).deleteEvent,
90
94
  backHandler: function () {
91
95
  store.navigate(-1)
92
96
  },
@@ -8,12 +8,13 @@ import { schema } from "../build/buildUiSchema";
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();
@@ -53,12 +54,11 @@ export default (funcParams: funcParamsProps) => {
53
54
  );
54
55
  },
55
56
  submitPageHandler: async function () {
56
- console.log()
57
57
  if (_.isEmpty(funcParams.store.ctx.core.errors)) {
58
58
  submitHandler(store, funcParams.service)
59
59
  .then((saveReturn: any) => {
60
60
  localStorage.removeItem("pageFormdata")
61
- store.navigate(-1)
61
+ store.navigate("/PageMasterRecords")
62
62
  store.setNotify({
63
63
  SuccessMessage: "Submit Successfully",
64
64
  Success: true,
@@ -72,8 +72,8 @@ export default (funcParams: funcParamsProps) => {
72
72
  })
73
73
  }
74
74
  },
75
- Edit_Components: Component(store, dynamicData).editComponents,
76
- Delete_Components: Component(store, dynamicData).deleteComponents,
75
+ Edit_Components: Component(store, dynamicData,submitHandler,service).editComponents,
76
+ Delete_Components: Component(store, dynamicData,submitHandler,service).deleteComponents,
77
77
  eventAddHandler: async function () {
78
78
  const id = store.searchParams?.get("id");
79
79
  if (!Array.isArray(store.formData.events)) {
@@ -1 +0,0 @@
1
- export declare const buildInputSlider: (config: any, componentScope: any) => 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
- }