impaktapps-ui-builder 0.0.280 → 0.0.282

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 (22) hide show
  1. package/dist/impaktapps-ui-builder.es.js +149 -59
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +15 -15
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/buildTable.d.ts +1 -0
  6. package/dist/src/impaktapps-ui-builder/builder/build/buildUiSchema.d.ts +5 -0
  7. package/dist/src/impaktapps-ui-builder/builder/build/uischema/lazyLoadingTable.d.ts +14 -0
  8. package/dist/src/impaktapps-ui-builder/lib/index.d.ts +1 -1
  9. package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +1 -0
  10. package/package.json +1 -1
  11. package/src/impaktapps-ui-builder/builder/build/buildTable.ts +36 -8
  12. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +65 -25
  13. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +8 -0
  14. package/src/impaktapps-ui-builder/builder/build/uischema/coreSection.ts +1 -0
  15. package/src/impaktapps-ui-builder/builder/build/uischema/lazyLoadingTable.ts +14 -0
  16. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +1 -0
  17. package/src/impaktapps-ui-builder/builder/services/component.ts +2 -2
  18. package/src/impaktapps-ui-builder/builder/services/event.ts +2 -0
  19. package/src/impaktapps-ui-builder/lib/index.ts +1 -1
  20. package/src/impaktapps-ui-builder/runtime/services/events.ts +15 -12
  21. package/src/impaktapps-ui-builder/runtime/services/service.ts +21 -0
  22. package/dist/src/impaktapps-ui-builder/builder/build/buildSchema.d.ts +0 -6
@@ -6089,6 +6089,7 @@ const componentBasicUiSchema = {
6089
6089
  { title: "Date", const: "Date" },
6090
6090
  { title: "CheckBox", const: "CheckBox" },
6091
6091
  { title: "Table", const: "Table" },
6092
+ { title: "Lazy Loading Table", const: "LazyLoadingTable" },
6092
6093
  { title: "Array", const: "Array" },
6093
6094
  { title: "Container", const: "WrapperSection" },
6094
6095
  { title: "Tabs", const: "TabSection" },
@@ -6382,6 +6383,7 @@ const CoreSection = {
6382
6383
  { title: "Date", const: "Date" },
6383
6384
  { title: "CheckBox", const: "CheckBox" },
6384
6385
  { title: "Table", const: "Table" },
6386
+ { title: "Lazy Loading Table", const: "LazyLoadingTable" },
6385
6387
  { title: "Array", const: "Array" },
6386
6388
  { title: "Container", const: "WrapperSection" },
6387
6389
  { title: "Tabs", const: "TabSection" },
@@ -6918,6 +6920,13 @@ const buildPropertiesSection = function(type) {
6918
6920
  uiSchema.elements = [
6919
6921
  getArrayControl("sectionLabels", "label")
6920
6922
  ];
6923
+ } else if (type === "Table" || type === "LazyLoadingTable") {
6924
+ uiSchema.elements = [
6925
+ getRadioInputField("SelectionAvailable", "Selection Available", ["YES", "NO"]),
6926
+ getRadioInputField("ColumnResizingAvailable", "ColumnResizing Available", ["YES", "NO"]),
6927
+ getRadioInputField("DragAvailable", "Drag Available", ["YES", "NO"]),
6928
+ EmptyBox
6929
+ ];
6921
6930
  } else if (type === "Radio") {
6922
6931
  uiSchema.elements = [
6923
6932
  getArrayControl("sectionLabels", "label", "Options Of Radio")
@@ -7146,7 +7155,8 @@ const ValidationSection = {
7146
7155
  const sectionLabels = {
7147
7156
  Select: ["Core", "Value", "style", "Event", "Validation"],
7148
7157
  MultipleSelect: ["Core", "Value", "style", "Event", "Validation"],
7149
- Table: ["Core", "Components", "style", "Event", "Validation"],
7158
+ Table: ["Core", "Components", "Properties", "style", "Event", "Validation"],
7159
+ LazyLoadingTable: ["Core", "Components", "Properties", "style", "Event", "Validation"],
7150
7160
  LeaderBoard: ["Core", "Components", "Properties", "style", "Event", "Validation"],
7151
7161
  WrapperSection: ["Core", "Components", "Properties", "style", "Validation"],
7152
7162
  TabSection: ["Core", "Components", "Properties", "style", "Validation"],
@@ -8249,12 +8259,51 @@ var Table = {
8249
8259
  }
8250
8260
  }
8251
8261
  };
8262
+ var lazyLoadingTable = {
8263
+ type: "Control",
8264
+ scope: "#/properties/LazyLoadingTable",
8265
+ options: {
8266
+ widget: "LazyLoadingTable"
8267
+ },
8268
+ elements: [],
8269
+ config: {
8270
+ main: {
8271
+ columns: {}
8272
+ }
8273
+ }
8274
+ };
8252
8275
  const buildTable = (config, componentScope) => {
8253
8276
  const table = _.cloneDeep(Table);
8254
8277
  table.scope = componentScope;
8255
8278
  if (config.style) {
8256
8279
  table.config.style = JSON.parse(config.style);
8257
8280
  }
8281
+ if (config.SelectionAvailable) {
8282
+ table.config.main.Selection = config.SelectionAvailable === "YES" ? true : false;
8283
+ }
8284
+ if (config.ColumnResizingAvailable) {
8285
+ table.config.main.disableColumnResizing = config.ColumnResizingAvailable === "YES" ? true : false;
8286
+ }
8287
+ if (config.DragAvailable) {
8288
+ table.config.main.enableDrag = config.DragAvailable === "YES" ? true : false;
8289
+ }
8290
+ return table;
8291
+ };
8292
+ const buildLazyLoadingTable = (config, componentScope) => {
8293
+ const table = _.cloneDeep(lazyLoadingTable);
8294
+ table.scope = componentScope;
8295
+ if (config.style) {
8296
+ table.config.style = JSON.parse(config.style);
8297
+ }
8298
+ if (config.SelectionAvailable) {
8299
+ table.config.main.Selection = config.SelectionAvailable === "YES" ? true : false;
8300
+ }
8301
+ if (config.ColumnResizingAvailable) {
8302
+ table.config.main.disableColumnResizing = config.ColumnResizingAvailable === "YES" ? false : true;
8303
+ }
8304
+ if (config.DragAvailable) {
8305
+ table.config.main.enableDrag = config.DragAvailable === "YES" ? true : false;
8306
+ }
8258
8307
  table.config.main.label = config.label;
8259
8308
  return table;
8260
8309
  };
@@ -8803,26 +8852,66 @@ const buildEmptyBox = (config, componentScope) => {
8803
8852
  }
8804
8853
  return EmptyBox2;
8805
8854
  };
8806
- let schema$1 = {
8855
+ let schema = {
8807
8856
  type: "object",
8808
8857
  properties: {},
8809
8858
  required: []
8810
8859
  };
8811
- function buildRule(configObj) {
8860
+ function buildRule(configObj, tableName) {
8812
8861
  if (configObj.validation) {
8813
8862
  configObj.validation.forEach((rule) => {
8814
- if (!schema$1.properties[configObj.name]) {
8815
- schema$1.properties[configObj.name] = {};
8816
- }
8817
- if (rule.validationType === "required") {
8818
- schema$1.required.push(configObj.name);
8863
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8864
+ if (tableName) {
8865
+ if ((_c = (_b = (_a = schema.properties) == null ? void 0 : _a[tableName]) == null ? void 0 : _b.items) == null ? void 0 : _c.properties) {
8866
+ if (!((_g = (_f = (_e = (_d = schema.properties) == null ? void 0 : _d[tableName]) == null ? void 0 : _e.items) == null ? void 0 : _f.properties) == null ? void 0 : _g[configObj.name])) {
8867
+ schema.properties[tableName].items.properties[configObj.name] = {};
8868
+ }
8869
+ if (rule.validationType === "required") {
8870
+ (_j = (_i = (_h = schema.properties) == null ? void 0 : _h[tableName]) == null ? void 0 : _i.items) == null ? void 0 : _j.required.push(configObj.name);
8871
+ } else {
8872
+ schema.properties[tableName].items.properties[configObj.name]["type"] = "string";
8873
+ schema.properties[tableName].items.properties[configObj.name][rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
8874
+ }
8875
+ }
8819
8876
  } else {
8820
- schema$1.properties[configObj.name]["type"] = "string";
8821
- schema$1.properties[configObj.name][rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
8877
+ if (!schema.properties[configObj.name]) {
8878
+ schema.properties[configObj.name] = {};
8879
+ }
8880
+ if (rule.validationType === "required") {
8881
+ schema.required.push(configObj.name);
8882
+ } else {
8883
+ schema.properties[configObj.name]["type"] = "string";
8884
+ schema.properties[configObj.name][rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
8885
+ }
8822
8886
  }
8823
8887
  });
8824
8888
  }
8825
8889
  }
8890
+ const buildSchema = (config, tableName) => {
8891
+ buildRule(config, tableName);
8892
+ if (config == null ? void 0 : config.elements) {
8893
+ if (config.type == "Table") {
8894
+ if (!schema.properties[config.name]) {
8895
+ schema.properties[config.name] = {
8896
+ type: "array",
8897
+ items: {
8898
+ type: "object",
8899
+ properties: {},
8900
+ required: []
8901
+ }
8902
+ };
8903
+ }
8904
+ config.elements.map((e, elemInd) => {
8905
+ buildSchema(e, config.name);
8906
+ });
8907
+ } else {
8908
+ config.elements.map((e, elemInd) => {
8909
+ buildSchema(e);
8910
+ });
8911
+ }
8912
+ }
8913
+ return schema;
8914
+ };
8826
8915
  const buildUiSchema = (config) => {
8827
8916
  let elements = {};
8828
8917
  const componentScope = `#/properties/${config.name}`;
@@ -8838,47 +8927,39 @@ const buildUiSchema = (config) => {
8838
8927
  break;
8839
8928
  case "Text":
8840
8929
  elements = buildTextField(config, componentScope);
8841
- buildRule(config);
8842
8930
  break;
8843
8931
  case "TextArea":
8844
8932
  elements = buildTextArea(config, componentScope);
8845
- buildRule(config);
8846
8933
  break;
8847
8934
  case "Date":
8848
8935
  elements = buildDate(config, componentScope);
8849
- buildRule(config);
8850
8936
  break;
8851
8937
  case "Select":
8852
8938
  elements = buildSelect(config, componentScope);
8853
- buildRule(config);
8854
8939
  break;
8855
8940
  case "Radio":
8856
8941
  elements = buildRadio(config, componentScope);
8857
- buildRule(config);
8858
8942
  break;
8859
8943
  case "Button":
8860
8944
  elements = buildButton(config, componentScope);
8861
- buildRule(config);
8862
8945
  break;
8863
8946
  case "Table":
8864
8947
  elements = buildTable(config, componentScope);
8865
- buildRule(config);
8948
+ break;
8949
+ case "LazyLoadingTable":
8950
+ elements = buildLazyLoadingTable(config, componentScope);
8866
8951
  break;
8867
8952
  case "Box":
8868
8953
  elements = buildLabel(config, componentScope);
8869
- buildRule(config);
8870
8954
  break;
8871
8955
  case "CheckBox":
8872
8956
  elements = buildCheckbox(config, componentScope);
8873
- buildRule(config);
8874
8957
  break;
8875
8958
  case "UploadFile":
8876
8959
  elements = buildUploadFile(config, componentScope);
8877
- buildRule(config);
8878
8960
  break;
8879
8961
  case "DownloadFile":
8880
8962
  elements = buildDownloadFile(config, componentScope);
8881
- buildRule(config);
8882
8963
  break;
8883
8964
  case "EmptyBox":
8884
8965
  elements = buildEmptyBox(config);
@@ -8926,13 +9007,12 @@ const buildUiSchema = (config) => {
8926
9007
  break;
8927
9008
  case "MultipleSelect":
8928
9009
  elements = buildMultiSelect(config, componentScope);
8929
- buildRule(config);
8930
9010
  break;
8931
9011
  case "LeaderBoard":
8932
9012
  elements = buildLeaderBoard(config);
8933
9013
  break;
8934
9014
  default:
8935
- schema$1 = {
9015
+ schema = {
8936
9016
  type: "object",
8937
9017
  properties: {},
8938
9018
  required: []
@@ -8962,7 +9042,6 @@ const buildUiSchema = (config) => {
8962
9042
  });
8963
9043
  }
8964
9044
  }
8965
- localStorage.setItem("libSchema", JSON.stringify(schema$1 || {}));
8966
9045
  return elements;
8967
9046
  };
8968
9047
  var pageMaster = (funcParams) => {
@@ -9008,7 +9087,7 @@ var pageMaster = (funcParams) => {
9008
9087
  );
9009
9088
  },
9010
9089
  submitPageHandler: async function() {
9011
- console.log(schema$1);
9090
+ console.log(schema);
9012
9091
  submitHandler(store2, funcParams.service).then((saveReturn) => {
9013
9092
  localStorage.removeItem("pageFormdata");
9014
9093
  store2.navigate(-1);
@@ -9816,6 +9895,10 @@ async function mergeFormdata(handlerResponse, componentName2, eventConfig, store
9816
9895
  }
9817
9896
  };
9818
9897
  });
9898
+ } else if (eventConfig.type === "LazyLoadingTable") {
9899
+ store2.setFormdata((pre) => {
9900
+ return { ...pre, [`${componentName2}Backend`]: handlerResponse };
9901
+ });
9819
9902
  } else if (eventConfig.type === "page") {
9820
9903
  store2.setFormdata((pre) => {
9821
9904
  return { ...pre, ...handlerResponse == null ? void 0 : handlerResponse.data };
@@ -9831,14 +9914,18 @@ const buildBodyFormat = (body2, formData, userValue2) => {
9831
9914
  const finalBody = { ...userValue2 == null ? void 0 : userValue2.payload };
9832
9915
  body2.map((elem) => {
9833
9916
  var _a, _b;
9834
- if ((_a = elem == null ? void 0 : elem.value) == null ? void 0 : _a.startsWith("$userValue")) {
9835
- const finalpath = elem.value.substring(11);
9836
- finalBody[elem.key] = _.get(userValue2, finalpath);
9837
- } else if ((_b = elem == null ? void 0 : elem.value) == null ? void 0 : _b.startsWith("$")) {
9838
- const finalpath = elem.value.substring(1);
9839
- finalBody[elem.key] = _.get(formData, finalpath);
9840
- } else {
9917
+ if ((elem == null ? void 0 : elem.value) !== "string") {
9841
9918
  finalBody[elem.key] = elem.value;
9919
+ } else {
9920
+ if ((_a = elem == null ? void 0 : elem.value) == null ? void 0 : _a.startsWith("$userValue")) {
9921
+ const finalpath = elem.value.substring(11);
9922
+ finalBody[elem.key] = _.get(userValue2, finalpath);
9923
+ } else if ((_b = elem == null ? void 0 : elem.value) == null ? void 0 : _b.startsWith("$")) {
9924
+ const finalpath = elem.value.substring(1);
9925
+ finalBody[elem.key] = _.get(formData, finalpath);
9926
+ } else {
9927
+ finalBody[elem.key] = elem.value;
9928
+ }
9842
9929
  }
9843
9930
  });
9844
9931
  return finalBody;
@@ -9977,6 +10064,35 @@ var service = (funcParams) => {
9977
10064
  );
9978
10065
  }
9979
10066
  },
10067
+ onPaginationChange: async (paginationValues) => {
10068
+ var _a;
10069
+ for (const eventConfig of eventGroups == null ? void 0 : eventGroups.onLoad[paginationValues.path]) {
10070
+ const bodyValues = [
10071
+ { key: "size", value: paginationValues.pagination.pageSize },
10072
+ { key: "start", value: paginationValues.pagination.pageIndex * paginationValues.pagination.pageSize },
10073
+ { key: "filters", value: paginationValues.columnFilters || [] },
10074
+ { key: "globalFilter", value: (_a = paginationValues.globalFilter) != null ? _a : "" }
10075
+ ];
10076
+ if (eventConfig.body) {
10077
+ eventConfig.body = [
10078
+ ...eventConfig.body,
10079
+ ...bodyValues
10080
+ ];
10081
+ } else {
10082
+ eventConfig.body = bodyValues;
10083
+ }
10084
+ await executeEvents(
10085
+ eventConfig,
10086
+ paginationValues.path,
10087
+ funcParams.store,
10088
+ funcParams.dynamicData,
10089
+ funcParams.userValue,
10090
+ funcParams.service,
10091
+ void 0,
10092
+ eventGroups
10093
+ );
10094
+ }
10095
+ },
9980
10096
  onChange: async function() {
9981
10097
  if (eventGroups.onChange) {
9982
10098
  const ChangeEventsKeysArray = Object.keys(eventGroups.onChange);
@@ -10002,34 +10118,8 @@ var service = (funcParams) => {
10002
10118
  downloadFile
10003
10119
  };
10004
10120
  };
10005
- const schema = {
10006
- type: "object",
10007
- properties: {},
10008
- required: []
10009
- };
10010
- const buildSchema = (config) => {
10011
- function buildRule2(configObj) {
10012
- if (configObj.validation) {
10013
- configObj.validation.forEach((rule) => {
10014
- if (!schema.properties[configObj.name]) {
10015
- schema.properties[configObj.name] = {};
10016
- }
10017
- if (rule.validationType === "required") {
10018
- schema.required.push(configObj.name);
10019
- } else {
10020
- schema.properties[configObj.name]["type"] = "string";
10021
- schema.properties[configObj.name][rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
10022
- }
10023
- });
10024
- }
10025
- }
10026
- buildRule2(config);
10027
- console.log(schema);
10028
- window.localStorage.setItem("schemaDemo", JSON.stringify(schema));
10029
- return schema;
10030
- };
10031
10121
  var clearLocalStorage = () => {
10032
10122
  localStorage.removeItem("pageFormdata");
10033
10123
  };
10034
- export { buildConfig, buildSchema, buildUiSchema, clearLocalStorage as clearPreviousCache, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema$1 as schema };
10124
+ export { buildConfig, buildSchema, buildUiSchema, clearLocalStorage as clearPreviousCache, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
10035
10125
  //# sourceMappingURL=impaktapps-ui-builder.es.js.map