impaktapps-ui-builder 0.0.279 → 0.0.281

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.
@@ -7111,10 +7111,10 @@ const ValidationSection = {
7111
7111
  main: {
7112
7112
  label: "Validation Type",
7113
7113
  options: [
7114
- { title: "required", const: "Required" },
7115
- { title: "minLength", const: "Minimum Length" },
7116
- { title: "maxLength", const: "Maximum Length" },
7117
- { title: "pattern", const: "Pattern" }
7114
+ { const: "required", title: "Required" },
7115
+ { const: "minLength", title: "Minimum Length" },
7116
+ { const: "maxLength", title: "Maximum Length" },
7117
+ { const: "pattern", title: "Pattern" }
7118
7118
  ]
7119
7119
  }
7120
7120
  }
@@ -8803,26 +8803,66 @@ const buildEmptyBox = (config, componentScope) => {
8803
8803
  }
8804
8804
  return EmptyBox2;
8805
8805
  };
8806
- let schema$1 = {
8806
+ let schema = {
8807
8807
  type: "object",
8808
8808
  properties: {},
8809
8809
  required: []
8810
8810
  };
8811
- function buildRule(configObj) {
8811
+ function buildRule(configObj, tableName) {
8812
8812
  if (configObj.validation) {
8813
8813
  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);
8814
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8815
+ if (tableName) {
8816
+ if ((_c = (_b = (_a = schema.properties) == null ? void 0 : _a[tableName]) == null ? void 0 : _b.items) == null ? void 0 : _c.properties) {
8817
+ 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])) {
8818
+ schema.properties[tableName].items.properties[configObj.name] = {};
8819
+ }
8820
+ if (rule.validationType === "required") {
8821
+ (_j = (_i = (_h = schema.properties) == null ? void 0 : _h[tableName]) == null ? void 0 : _i.items) == null ? void 0 : _j.required.push(configObj.name);
8822
+ } else {
8823
+ schema.properties[tableName].items.properties[configObj.name]["type"] = "string";
8824
+ schema.properties[tableName].items.properties[configObj.name][rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
8825
+ }
8826
+ }
8819
8827
  } 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);
8828
+ if (!schema.properties[configObj.name]) {
8829
+ schema.properties[configObj.name] = {};
8830
+ }
8831
+ if (rule.validationType === "required") {
8832
+ schema.required.push(configObj.name);
8833
+ } else {
8834
+ schema.properties[configObj.name]["type"] = "string";
8835
+ schema.properties[configObj.name][rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
8836
+ }
8822
8837
  }
8823
8838
  });
8824
8839
  }
8825
8840
  }
8841
+ const buildSchema = (config, tableName) => {
8842
+ buildRule(config, tableName);
8843
+ if (config == null ? void 0 : config.elements) {
8844
+ if (config.type == "Table") {
8845
+ if (!schema.properties[config.name]) {
8846
+ schema.properties[config.name] = {
8847
+ type: "array",
8848
+ items: {
8849
+ type: "object",
8850
+ properties: {},
8851
+ required: []
8852
+ }
8853
+ };
8854
+ }
8855
+ config.elements.map((e, elemInd) => {
8856
+ buildSchema(e, config.name);
8857
+ });
8858
+ } else {
8859
+ config.elements.map((e, elemInd) => {
8860
+ buildSchema(e);
8861
+ });
8862
+ }
8863
+ }
8864
+ return schema;
8865
+ };
8826
8866
  const buildUiSchema = (config) => {
8827
8867
  let elements = {};
8828
8868
  const componentScope = `#/properties/${config.name}`;
@@ -8838,47 +8878,36 @@ const buildUiSchema = (config) => {
8838
8878
  break;
8839
8879
  case "Text":
8840
8880
  elements = buildTextField(config, componentScope);
8841
- buildRule(config);
8842
8881
  break;
8843
8882
  case "TextArea":
8844
8883
  elements = buildTextArea(config, componentScope);
8845
- buildRule(config);
8846
8884
  break;
8847
8885
  case "Date":
8848
8886
  elements = buildDate(config, componentScope);
8849
- buildRule(config);
8850
8887
  break;
8851
8888
  case "Select":
8852
8889
  elements = buildSelect(config, componentScope);
8853
- buildRule(config);
8854
8890
  break;
8855
8891
  case "Radio":
8856
8892
  elements = buildRadio(config, componentScope);
8857
- buildRule(config);
8858
8893
  break;
8859
8894
  case "Button":
8860
8895
  elements = buildButton(config, componentScope);
8861
- buildRule(config);
8862
8896
  break;
8863
8897
  case "Table":
8864
8898
  elements = buildTable(config, componentScope);
8865
- buildRule(config);
8866
8899
  break;
8867
8900
  case "Box":
8868
8901
  elements = buildLabel(config, componentScope);
8869
- buildRule(config);
8870
8902
  break;
8871
8903
  case "CheckBox":
8872
8904
  elements = buildCheckbox(config, componentScope);
8873
- buildRule(config);
8874
8905
  break;
8875
8906
  case "UploadFile":
8876
8907
  elements = buildUploadFile(config, componentScope);
8877
- buildRule(config);
8878
8908
  break;
8879
8909
  case "DownloadFile":
8880
8910
  elements = buildDownloadFile(config, componentScope);
8881
- buildRule(config);
8882
8911
  break;
8883
8912
  case "EmptyBox":
8884
8913
  elements = buildEmptyBox(config);
@@ -8926,13 +8955,12 @@ const buildUiSchema = (config) => {
8926
8955
  break;
8927
8956
  case "MultipleSelect":
8928
8957
  elements = buildMultiSelect(config, componentScope);
8929
- buildRule(config);
8930
8958
  break;
8931
8959
  case "LeaderBoard":
8932
8960
  elements = buildLeaderBoard(config);
8933
8961
  break;
8934
8962
  default:
8935
- schema$1 = {
8963
+ schema = {
8936
8964
  type: "object",
8937
8965
  properties: {},
8938
8966
  required: []
@@ -8962,7 +8990,6 @@ const buildUiSchema = (config) => {
8962
8990
  });
8963
8991
  }
8964
8992
  }
8965
- localStorage.setItem("libSchema", JSON.stringify(schema$1 || {}));
8966
8993
  return elements;
8967
8994
  };
8968
8995
  var pageMaster = (funcParams) => {
@@ -9008,7 +9035,7 @@ var pageMaster = (funcParams) => {
9008
9035
  );
9009
9036
  },
9010
9037
  submitPageHandler: async function() {
9011
- console.log(schema$1);
9038
+ console.log(schema);
9012
9039
  submitHandler(store2, funcParams.service).then((saveReturn) => {
9013
9040
  localStorage.removeItem("pageFormdata");
9014
9041
  store2.navigate(-1);
@@ -10002,34 +10029,8 @@ var service = (funcParams) => {
10002
10029
  downloadFile
10003
10030
  };
10004
10031
  };
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
10032
  var clearLocalStorage = () => {
10032
10033
  localStorage.removeItem("pageFormdata");
10033
10034
  };
10034
- export { buildConfig, buildSchema, buildUiSchema, clearLocalStorage as clearPreviousCache, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema$1 as schema };
10035
+ export { buildConfig, buildSchema, buildUiSchema, clearLocalStorage as clearPreviousCache, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
10035
10036
  //# sourceMappingURL=impaktapps-ui-builder.es.js.map