impaktapps-ui-builder 0.0.292 → 0.0.293

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.
@@ -8908,22 +8908,76 @@ const buildEmptyBox = (config, componentScope) => {
8908
8908
  }
8909
8909
  return EmptyBox2;
8910
8910
  };
8911
+ const ArrayUiSchema = {
8912
+ type: "Control",
8913
+ scope: "#/properties/adjustments",
8914
+ layout: 11.5,
8915
+ options: {
8916
+ detail: {
8917
+ type: "HorizontalLayout",
8918
+ elements: []
8919
+ }
8920
+ }
8921
+ };
8922
+ const buildArray = (config, componentScope) => {
8923
+ const array = _.cloneDeep(ArrayUiSchema);
8924
+ array.scope = componentScope;
8925
+ return array;
8926
+ };
8911
8927
  let schema = {
8912
8928
  type: "object",
8913
8929
  properties: {},
8914
8930
  required: []
8915
8931
  };
8916
- function buildRule(configObj, tableName) {
8932
+ function buildRule(configObj, tableName, arrayHolderName) {
8933
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
8934
+ if (arrayHolderName) {
8935
+ if ((_c = (_b = (_a = schema.properties) == null ? void 0 : _a[tableName]) == null ? void 0 : _b.items) == null ? void 0 : _c.properties) {
8936
+ 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])) {
8937
+ schema.properties[tableName].items.properties[configObj.name] = {};
8938
+ if (configObj.type === "Select" || ((_h = configObj.value) == null ? void 0 : _h.length) > 0) {
8939
+ schema.properties[tableName].items.properties[configObj.name] = {
8940
+ oneOf: configObj.value.map((e) => {
8941
+ return { const: e.value, title: e.label };
8942
+ })
8943
+ };
8944
+ } else if (configObj.type === "MultipleSelect" || ((_i = configObj.value) == null ? void 0 : _i.length) > 0) {
8945
+ schema.properties[tableName].items.properties[configObj.name] = {
8946
+ items: {
8947
+ oneOf: configObj.value.map((e) => {
8948
+ return { const: e.value, title: e.label };
8949
+ })
8950
+ }
8951
+ };
8952
+ }
8953
+ }
8954
+ }
8955
+ }
8917
8956
  if (configObj.validation) {
8918
8957
  configObj.validation.forEach((rule) => {
8919
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
8958
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j, _k, _l;
8920
8959
  if (tableName) {
8921
- if ((_c = (_b = (_a = schema.properties) == null ? void 0 : _a[tableName]) == null ? void 0 : _b.items) == null ? void 0 : _c.properties) {
8922
- 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])) {
8960
+ if ((_c2 = (_b2 = (_a2 = schema.properties) == null ? void 0 : _a2[tableName]) == null ? void 0 : _b2.items) == null ? void 0 : _c2.properties) {
8961
+ if (!((_g2 = (_f2 = (_e2 = (_d2 = schema.properties) == null ? void 0 : _d2[tableName]) == null ? void 0 : _e2.items) == null ? void 0 : _f2.properties) == null ? void 0 : _g2[configObj.name])) {
8923
8962
  schema.properties[tableName].items.properties[configObj.name] = {};
8963
+ if (configObj.type === "Select" || ((_h2 = configObj.value) == null ? void 0 : _h2.length) > 0) {
8964
+ schema.properties[tableName].items.properties[configObj.name] = {
8965
+ oneOf: configObj.value.map((e) => {
8966
+ return { const: e.value, title: e.label };
8967
+ })
8968
+ };
8969
+ } else if (configObj.type === "MultipleSelect" || ((_i2 = configObj.value) == null ? void 0 : _i2.length) > 0) {
8970
+ schema.properties[tableName].items.properties[configObj.name] = {
8971
+ items: {
8972
+ oneOf: configObj.value.map((e) => {
8973
+ return { const: e.value, title: e.label };
8974
+ })
8975
+ }
8976
+ };
8977
+ }
8924
8978
  }
8925
8979
  if (rule.validationType === "required") {
8926
- (_j = (_i = (_h = schema.properties) == null ? void 0 : _h[tableName]) == null ? void 0 : _i.items) == null ? void 0 : _j.required.push(configObj.name);
8980
+ (_l = (_k = (_j = schema.properties) == null ? void 0 : _j[tableName]) == null ? void 0 : _k.items) == null ? void 0 : _l.required.push(configObj.name);
8927
8981
  } else {
8928
8982
  schema.properties[tableName].items.properties[configObj.name]["type"] = "string";
8929
8983
  schema.properties[tableName].items.properties[configObj.name][rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
@@ -8943,10 +8997,10 @@ function buildRule(configObj, tableName) {
8943
8997
  });
8944
8998
  }
8945
8999
  }
8946
- const buildSchema = (config, tableName) => {
8947
- buildRule(config, tableName);
9000
+ const buildSchema = (config, tableName, isArrayType) => {
9001
+ buildRule(config, tableName, isArrayType);
8948
9002
  if (config == null ? void 0 : config.elements) {
8949
- if (config.type == "Table") {
9003
+ if (config.type == "Table" || config.type == "Array") {
8950
9004
  if (!schema.properties[config.name]) {
8951
9005
  schema.properties[config.name] = {
8952
9006
  type: "array",
@@ -8958,7 +9012,7 @@ const buildSchema = (config, tableName) => {
8958
9012
  };
8959
9013
  }
8960
9014
  config.elements.map((e, elemInd) => {
8961
- buildSchema(e, config.name);
9015
+ buildSchema(e, config.name, config.type === "Array" ? true : false);
8962
9016
  });
8963
9017
  } else {
8964
9018
  config.elements.map((e, elemInd) => {
@@ -9002,6 +9056,9 @@ const buildUiSchema = (config) => {
9002
9056
  case "Table":
9003
9057
  elements = buildTable(config, componentScope);
9004
9058
  break;
9059
+ case "Array":
9060
+ elements = buildArray(config, componentScope);
9061
+ break;
9005
9062
  case "LazyLoadingTable":
9006
9063
  elements = buildLazyLoadingTable(config, componentScope);
9007
9064
  break;
@@ -9092,6 +9149,10 @@ const buildUiSchema = (config) => {
9092
9149
  header: e.label || e.name
9093
9150
  };
9094
9151
  });
9152
+ } else if (config.type == "Array") {
9153
+ elements.options.detail.elements = config.elements.map((e, elemInd) => {
9154
+ return buildUiSchema(e);
9155
+ });
9095
9156
  } else {
9096
9157
  elements.elements = config.elements.map((e, elemInd) => {
9097
9158
  return buildUiSchema(e);