impaktapps-ui-builder 0.0.376 → 0.0.378

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,2 +1,2 @@
1
1
  export declare const downloadFile: (obj: any) => void;
2
- export declare const download: (response: any) => void;
2
+ export declare const clickDownloadLink: (response: any, service: any) => void;
@@ -22,6 +22,6 @@ declare const _default: (funcParams: funcParamsProps) => {
22
22
  onReset: (functionParameters: any) => Promise<void>;
23
23
  callHandler: (eventType: string, functionParameters?: any) => Promise<void>;
24
24
  downloadFile: (obj: any) => void;
25
- download: (response: any) => void;
25
+ download: (response: any, service: any) => void;
26
26
  };
27
27
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.376",
3
+ "version": "0.0.378",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -10,7 +10,7 @@ const Stepper = {
10
10
 
11
11
  config: {
12
12
  main: {
13
- steps:[{label:"First"}, {label:"Second"},{label: "Third"}],
13
+ steps: [{ label: "First" }, { label: "Second" }, { label: "Third" }],
14
14
  resetButton: false,
15
15
  resetText: "Reset",
16
16
  orientation: "vertical"
@@ -24,11 +24,14 @@ export const buildStepper = (config, componentScope) => {
24
24
  const stepper: any = _.cloneDeep(Stepper);
25
25
  stepper.scope = componentScope;
26
26
  stepper.config.main.resetButton = config.resetButton === "YES" ? true : false;
27
+ if (config.defaultButtonAvailable) {
28
+ stepper.config.main.defaultButtonAvailable = config.defaultButtonAvailable === "YES" ? true : false;
29
+ }
27
30
  stepper.config.main.resetText = config.resetText || "ResetData";
28
31
  stepper.config.main.completeText = config.completeText || "Complete Text";
29
32
  stepper.config.main.orientation = config.orientation || "horizontal";
30
33
  if (config.sectionLabels) {
31
- stepper.config.main.label = config.sectionLabels.map((e, i: number) => {
34
+ stepper.config.main.steps = config.sectionLabels.map((e, i: number) => {
32
35
  return { label: e.label, id: i }
33
36
  });
34
37
  }
@@ -16,7 +16,7 @@ export const buildTable = (config: any, componentScope: string) => {
16
16
  table.config.main.Selection = config.SelectionAvailable === "YES" ? true : false
17
17
  };
18
18
  if (config.ColumnResizingAvailable) {
19
- table.config.main.disableColumnResizing = config.ColumnResizingAvailable === "YES" ? true : false
19
+ table.config.main.disableColumnResizing = config.ColumnResizingAvailable === "YES" ? false : true
20
20
  };
21
21
  if (config.DragAvailable) {
22
22
  table.config.main.enableDrag = config.DragAvailable === "YES" ? true : false
@@ -67,14 +67,14 @@ function buildRule(configObj: any, tableName?: string, arrayHolderName?: boolean
67
67
  }
68
68
  }
69
69
  } else if ((configObj.type === "Select" || configObj.type === "MultipleSelect") && configObj.value?.length > 0) {
70
- if (configObj.type === "Select" ) {
70
+ if (configObj.type === "Select") {
71
71
  schema.properties[configObj.name] = {
72
72
  oneOf: configObj.value.map((e) => {
73
73
  return { const: e.value, title: e.label }
74
74
  })
75
75
  }
76
76
  }
77
- else if (configObj.type === "MultipleSelect" ) {
77
+ else if (configObj.type === "MultipleSelect") {
78
78
  schema.properties[configObj.name] = {
79
79
  items: {
80
80
  oneOf: configObj.value.map((e) => {
@@ -182,15 +182,15 @@ const buildUiSchema = (config: any) => {
182
182
  case "AadharcardText":
183
183
  elements = buildAdhaarField(config, componentScope);
184
184
  break;
185
- case "PanCardText":
185
+ case "PanCardText":
186
186
  elements = buildPanField(config, componentScope);
187
187
  break;
188
- case "TabSection":
189
- elements = buildTabSection(config, componentScope);
190
- break;
188
+ case "TabSection":
189
+ elements = buildTabSection(config, componentScope);
190
+ break;
191
191
  case "RunnerBoyProgressBar":
192
192
  elements = RunnerBoyProgressbar(config, componentScope);
193
- break;
193
+ break;
194
194
  case "WrapperSection":
195
195
  elements = buildWrapperSection(config, componentScope);
196
196
  break;
@@ -299,17 +299,25 @@ const buildUiSchema = (config: any) => {
299
299
  return elements;
300
300
  }
301
301
  else if (config.type == "Table") {
302
+ const sizeMap = {}
303
+ if (config.sizeHolder) {
304
+ config.sizeHolder.map((e, i) => {
305
+ sizeMap[e.keyName] = e.value
306
+ });
307
+ }
302
308
  elements.elements = config.elements.map((e, elemInd) => {
303
309
  if (e.type) {
304
310
  return {
305
311
  accessorKey: e.name,
306
312
  header: e.label || e.name,
313
+ size: sizeMap[e.name]|| 180,
307
314
  widget: buildUiSchema(e)
308
315
  }
309
316
  }
310
317
  return {
311
318
  accessorKey: e.name,
312
- header: e.label || e.name
319
+ header: e.label || e.name,
320
+ size: sizeMap[e.name]|| 180
313
321
  }
314
322
  })
315
323
  }
@@ -1,3 +1,4 @@
1
+ import { createLayoutFormat } from "./buildConfig";
1
2
  import WrapperSection from "./uischema/wrapperSection";
2
3
  import _ from "lodash";
3
4
 
@@ -8,5 +9,8 @@ export const buildWrapperSection = (config,componentScope) =>{
8
9
  if (config.style) {
9
10
  wrapper.config.style = JSON.parse(config.style)
10
11
  }
12
+ if (config.layout) {
13
+ wrapper.config.layout = createLayoutFormat(config.layout)
14
+ }
11
15
  return wrapper;
12
16
  }
@@ -1,3 +1,4 @@
1
+
1
2
  import _ from "lodash";
2
3
  const EmptyBox = {
3
4
  type: "Control",
@@ -246,13 +247,14 @@ export const buildPropertiesSection = function (type: String) {
246
247
  case "Stepper":
247
248
  uiSchema.elements = [
248
249
  getRadioInputField("resetButton", "Reset Button", ["YES", "NO"]),
250
+ getRadioInputField("defaultButtonAvailable", "Use Default Buttons ", ["YES", "NO"]),
249
251
  getInputField("resetText", "Reset Text"),
250
252
  getInputField("completeText", "Complete Text"),
251
253
  getSelectField("orientation", "Orientation Type", [
252
254
  { label: "Horizontal", value: "horizontal" },
253
255
  { label: "Vertical", value: "vertical" },
254
256
  ]),
255
- EmptyBox,
257
+
256
258
  getArrayControl("sectionLabels", "label")
257
259
 
258
260
  ]
@@ -374,6 +376,7 @@ export const buildPropertiesSection = function (type: String) {
374
376
  getRadioInputField("downloadAllData", "Download All Data", ["YES", "NO"]),
375
377
  getInputField("selectKey", "Selection Key"),
376
378
  getArrayControl("Table_Download_Keys_Name", "KeyName", "Table Key Name"),
379
+ sizeHolder
377
380
  ]
378
381
  break;
379
382
  case "Radio":
@@ -163,6 +163,20 @@ export const ComponentSchema: any = {
163
163
  },
164
164
  },
165
165
  },
166
+ sizeHolder: {
167
+ type: "array",
168
+ items: {
169
+ type: "object",
170
+ properties: {
171
+ keyName: {
172
+ type: "string",
173
+ },
174
+ value:{
175
+ type:"string"
176
+ }
177
+ },
178
+ },
179
+ },
166
180
  legendLabels: {
167
181
  type: "array",
168
182
  items: {
@@ -65,7 +65,7 @@ export const EventSchema = {
65
65
  oneOf: [
66
66
  { title: "RankProvider", const: "RankProvider" },
67
67
  { title: "Download File", const: "downloadFile" },
68
- { title: "Download", const: "download" },
68
+ { title: "Download", const: "download" }
69
69
  ]
70
70
  },
71
71
  body: {
@@ -35,6 +35,7 @@ const sectionLabels = {
35
35
  TextArea:["Core","Properties","style", "Event","Validation"],
36
36
  PopUp: ["Core", "Components","Properties", "style"],
37
37
  Stepper: ["Core", "Components","Properties","Event", "style"],
38
+ DataGrid: ["Core", "Components","Properties","Event", "style"],
38
39
  }
39
40
 
40
41
 
@@ -36,6 +36,7 @@ export default (
36
36
  uiSchema.elements[1].elements[0].elements[2] = getSelectField("inBuiltFunctionType", "Function Name", [
37
37
  { label: "RankProvider", value: "RankProvider" },
38
38
  { label: "Download File", value: "downloadFile" },
39
+ { label: "Download Blob File", value: "downloadBlobFile" }
39
40
  ])
40
41
  uiSchema.elements[1].elements[0].elements[3] = getTextArea("funcParametersCode", "Write Custom Code for Functions Parameter", true, { xs: 12, sm: 12, md: 6 });
41
42
  schema.required = ["eventType", "Handler", "inBuiltFunctionType"]
@@ -1,27 +1,37 @@
1
- export const downloadFile = (obj: any) => {
1
+ export const downloadFile = (obj: any) => {
2
2
  const typeArr = obj.name.split(".");
3
3
  const data = obj.data;
4
4
  const finalData = window.atob(data);
5
- let file ;
6
- file = new File([finalData], typeArr[typeArr.length - 1] );
7
-
5
+ let file;
6
+ file = new File([finalData], typeArr[typeArr.length - 1]);
7
+
8
8
  const url = URL.createObjectURL(file);
9
9
  const link = document.createElement("a");
10
- link.href = typeArr[typeArr.length - 1] === 'pdf' ?'data:application/octet-stream;base64,' + data: url;
10
+ link.href = typeArr[typeArr.length - 1] === 'pdf' ? 'data:application/octet-stream;base64,' + data : url;
11
11
  link.download = `${obj.name}`;
12
12
  document.body.appendChild(link);
13
13
  link.click();
14
-
14
+
15
15
  URL.revokeObjectURL(url);
16
16
  document.body.removeChild(link);
17
- };
17
+ };
18
+
19
+ export const clickDownloadLink = (response: any, service) => {
20
+ let url = `${service.defaults.baseURL}/${response.path}`;
21
+ if (response?.params) {
22
+ const keysArray = Object.keys(response?.params);
23
+ keysArray.map((e, i) => {
24
+ if (i === 0) {
25
+ url = url + `?${e}=${response?.params[e]}`
26
+ } else {
27
+ url = url + `&${e}=${response?.params[e]}`
28
+ }
18
29
 
19
- export const download = (response: any) => {
20
- const url = window.URL.createObjectURL(new Blob([response.data]));
21
- const link = document.createElement('a');
22
- link.href = url;
23
- link.setAttribute('download', `${response.headers.filename}`);
24
- document.body.appendChild(link);
25
- link.click();
26
- link.parentNode.removeChild(link);
27
- };
30
+ })
31
+ }
32
+ const link = document.createElement('a');
33
+ link.href = url;
34
+ document.body.appendChild(link);
35
+ link.click();
36
+ link.parentNode.removeChild(link);
37
+ };
@@ -87,7 +87,7 @@ async function executeInBuiltFunctionHandler(params: handlersProps) {
87
87
  const makeFunc = eval(params.config.funcParametersCode)
88
88
  parameter = makeFunc(params.store, params.dynamicData, params.userValue, params.parentEventOutput, params.service);
89
89
  }
90
- params.serviceHolder[params.config.inBuiltFunctionType](parameter)
90
+ params.serviceHolder[params.config.inBuiltFunctionType](parameter,params.service)
91
91
  }
92
92
 
93
93
  async function executeCustomHandler(params: handlersProps) {
@@ -1,5 +1,5 @@
1
1
  import _, { isEmpty } from "lodash";
2
- import { download, downloadFile } from "./downloadFile";
2
+ import { clickDownloadLink, downloadFile } from "./downloadFile";
3
3
  import { executeEvents, executeRefreshHandler } from "./events";
4
4
  import { handlersProps } from "./interface";
5
5
  let compType: string;
@@ -62,7 +62,7 @@ export default (funcParams: funcParamsProps) => {
62
62
  let executeEventsParameters: handlersProps = {
63
63
  config: {}, componentName: "",
64
64
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
65
- serviceHolder: { downloadFile,download }, eventGroups
65
+ serviceHolder: { downloadFile ,download:clickDownloadLink}, eventGroups
66
66
  };
67
67
  return {
68
68
  setPage: async function () {
@@ -192,7 +192,7 @@ export default (funcParams: funcParamsProps) => {
192
192
  }
193
193
  },
194
194
  downloadFile: downloadFile,
195
- download:download
195
+ download:clickDownloadLink,
196
196
  };
197
197
  };
198
198