impaktapps-ui-builder 0.0.324 → 0.0.326

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,10 +1,11 @@
1
1
  export declare const refreshPage: (type: string, store: any) => void;
2
- declare const _default: (store: any, dynamicData: any) => {
2
+ declare const _default: (store: any, dynamicData: any, submitHandler: any, service: any) => {
3
3
  setPage: () => Promise<void>;
4
4
  refreshPage: (type: string, store: any) => void;
5
5
  getFormdata: () => Promise<any>;
6
6
  getSchema: () => any;
7
7
  saveHandler: () => Promise<void>;
8
+ submitPageHandler: () => Promise<void>;
8
9
  onChange: () => void;
9
10
  editComponents: () => Promise<void>;
10
11
  deleteComponents: () => Promise<void>;
@@ -1,4 +1,4 @@
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
4
  getFormData: () => Promise<any>;
@@ -79,6 +79,7 @@ declare const _default: (store: any, dynamicData: any) => {
79
79
  onChange: () => void;
80
80
  saveHandler: () => Promise<void>;
81
81
  addEvent: () => Promise<void>;
82
+ submitPageHandler: () => Promise<void>;
82
83
  editEvent: () => Promise<void>;
83
84
  deleteEvent: () => Promise<void>;
84
85
  backHandler: () => void;
@@ -1,9 +1,12 @@
1
+ export declare function submitPageHandlerProvider(store: any, service: any, submitHandler: any): {
2
+ submitPageHandler: () => Promise<void>;
3
+ };
1
4
  interface funcParamsProps {
2
5
  store: any;
3
6
  dynamicData: any;
4
- config: any;
5
7
  submitHandler: any;
6
8
  service: any;
9
+ config?: any;
7
10
  }
8
11
  declare const _default: (funcParams: funcParamsProps) => {
9
12
  setPage: () => Promise<void>;
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.326",
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" },
@@ -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: 8, lg: 8 },
226
+ layout: { xs: 11, sm: 11, md: 6, lg: 6 },
227
227
  },
228
228
  options: {
229
229
  widget: "EmptyBox",
@@ -240,8 +240,8 @@ export const componentBasicUiSchema: any = {
240
240
  layout: {
241
241
  xs: 11,
242
242
  sm: 11,
243
- md: 3,
244
- lg: 3,
243
+ md: 2.5,
244
+ lg: 2.5,
245
245
  },
246
246
  main: {
247
247
  name: "Save",
@@ -258,6 +258,35 @@ export const componentBasicUiSchema: any = {
258
258
  },
259
259
  },
260
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: "Submit",
277
+ startIcon: "ApproveIcon",
278
+ variant: "contained",
279
+ color: "info",
280
+ type: "text",
281
+ onClick: "submitPageHandler",
282
+ size: "small",
283
+ },
284
+ style: {
285
+ marginBottom: "8px",
286
+ float: "right",
287
+ },
288
+ },
289
+ },
261
290
  {
262
291
  type: "Control",
263
292
  scope: "#/properties/notify",
@@ -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: 8, lg: 8 },
245
+ layout: { xs: 11, sm: 11, md: 6, lg: 6 },
246
246
  },
247
247
  options: {
248
248
  widget: "EmptyBox",
@@ -259,8 +259,8 @@ export const EventUiSchema: any = {
259
259
  layout: {
260
260
  xs: 11,
261
261
  sm: 11,
262
- md: 3,
263
- lg: 3,
262
+ md: 2.5,
263
+ lg: 2.5,
264
264
  },
265
265
  main: {
266
266
  name: "Save",
@@ -277,6 +277,35 @@ export const EventUiSchema: any = {
277
277
  },
278
278
  },
279
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: "Submit",
296
+ startIcon: "ApproveIcon",
297
+ variant: "contained",
298
+ color: "info",
299
+ type: "text",
300
+ onClick: "submitPageHandler",
301
+ size: "small",
302
+ },
303
+ style: {
304
+ marginBottom: "8px",
305
+ float: "right",
306
+ },
307
+ },
308
+ },
280
309
  {
281
310
  type: "Control",
282
311
  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 { submitPageHandlerProvider } 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: submitPageHandlerProvider(store, service, submitHandler).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 { submitPageHandlerProvider } 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: submitPageHandlerProvider(store, service, submitHandler).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
  },
@@ -5,15 +5,39 @@ import Component from "./component";
5
5
  import { getFormdataFromLocalStorage, saveFormdataInLocalStorage } from "./saveHandler";
6
6
  import { schema } from "../build/buildUiSchema";
7
7
 
8
+ export function submitPageHandlerProvider(store, service, submitHandler) {
9
+ return {
10
+ submitPageHandler: async function () {
11
+ if (_.isEmpty(store.ctx.core.errors)) {
12
+ submitHandler(store, service)
13
+ .then((saveReturn: any) => {
14
+ localStorage.removeItem("pageFormdata")
15
+ store.navigate("/PageMasterRecords")
16
+ store.setNotify({
17
+ SuccessMessage: "Submit Successfully",
18
+ Success: true,
19
+ });
20
+ })
21
+ } else {
22
+ store.setValidation("ValidateAndShow");
23
+ store.setNotify({
24
+ Fail: true,
25
+ FailMessage: "Errors on Page"
26
+ })
27
+ }
28
+ }
29
+ }
30
+ };
8
31
  interface funcParamsProps {
9
32
  store: any,
10
33
  dynamicData: any,
11
- config: any,
34
+
12
35
  submitHandler: any,
13
36
  service: any
37
+ config?: any,
14
38
  }
15
39
  export default (funcParams: funcParamsProps) => {
16
- const { store, dynamicData, config, submitHandler } = funcParams
40
+ const { store, dynamicData, config, submitHandler, service } = funcParams
17
41
  return {
18
42
  setPage: async function () {
19
43
  const formdata = await this.getFormdata();
@@ -52,28 +76,9 @@ export default (funcParams: funcParamsProps) => {
52
76
  `/Component?path=${`elements[${response?.elements.length}]`}&id=${id}`
53
77
  );
54
78
  },
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,
79
+ submitPageHandler: submitPageHandlerProvider(store, service, submitHandler).submitPageHandler,
80
+ Edit_Components: Component(store, dynamicData, submitHandler, service).editComponents,
81
+ Delete_Components: Component(store, dynamicData, submitHandler, service).deleteComponents,
77
82
  eventAddHandler: async function () {
78
83
  const id = store.searchParams?.get("id");
79
84
  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
- }