impaktapps-ui-builder 1.0.118 → 1.0.120

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.
@@ -1488,7 +1488,7 @@ var lodash = { exports: {} };
1488
1488
  var reIsNative = RegExp2(
1489
1489
  "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1490
1490
  );
1491
- var Buffer = moduleExports ? context.Buffer : undefined$1, Symbol = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined$1, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined$1, symIterator = Symbol ? Symbol.iterator : undefined$1, symToStringTag = Symbol ? Symbol.toStringTag : undefined$1;
1491
+ var Buffer = moduleExports ? context.Buffer : undefined$1, Symbol = context.Symbol, Uint8Array = context.Uint8Array, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined$1, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined$1, symIterator = Symbol ? Symbol.iterator : undefined$1, symToStringTag = Symbol ? Symbol.toStringTag : undefined$1;
1492
1492
  var defineProperty = function() {
1493
1493
  try {
1494
1494
  var func = getNative(Object2, "defineProperty");
@@ -2750,7 +2750,7 @@ var lodash = { exports: {} };
2750
2750
  }
2751
2751
  function cloneArrayBuffer(arrayBuffer) {
2752
2752
  var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
2753
- new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
2753
+ new Uint8Array(result2).set(new Uint8Array(arrayBuffer));
2754
2754
  return result2;
2755
2755
  }
2756
2756
  function cloneDataView(dataView, isDeep) {
@@ -3354,7 +3354,7 @@ var lodash = { exports: {} };
3354
3354
  object = object.buffer;
3355
3355
  other = other.buffer;
3356
3356
  case arrayBufferTag:
3357
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
3357
+ if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
3358
3358
  return false;
3359
3359
  }
3360
3360
  return true;
@@ -6310,6 +6310,14 @@ const ComponentSchema = {
6310
6310
  { title: "500", const: 500 }
6311
6311
  ]
6312
6312
  },
6313
+ initialDensity: {
6314
+ type: "string",
6315
+ oneOf: [
6316
+ { title: "Compact", const: "compact" },
6317
+ { title: "Comfortable", const: "comfortable" },
6318
+ { title: "Spacious", const: "spacious" }
6319
+ ]
6320
+ },
6313
6321
  layout: {
6314
6322
  type: "array",
6315
6323
  items: {
@@ -6487,8 +6495,7 @@ const ComponentSchema = {
6487
6495
  { const: "required", title: "Required" },
6488
6496
  { const: "minLength", title: "Minimum Length" },
6489
6497
  { const: "maxLength", title: "Maximum Length" },
6490
- { const: "pattern", title: "Pattern" },
6491
- { const: "readOnly", title: "Read Only" }
6498
+ { const: "pattern", title: "Pattern" }
6492
6499
  ]
6493
6500
  },
6494
6501
  validationValue: {
@@ -7872,14 +7879,14 @@ const buildPropertiesSection = function(type) {
7872
7879
  getInputField("selectKey", "Selection Key"),
7873
7880
  getMultiSelectField("filteringOptions", "Filtering Options"),
7874
7881
  getSelectField("maxPageSize", "Max Page Size"),
7882
+ getSelectField("initialDensity", "Initial Toggle Density"),
7875
7883
  buildWrapper("Tree Table Properties", [
7876
7884
  getRadioInputField("enableRowMovement", "Row Rearrangement", ["YES", "NO"]),
7877
7885
  getRadioInputField("enableExpanding", "Row Expanding", ["YES", "NO"]),
7878
7886
  getRadioInputField("paginateExpandedRows", "Multi Page Expansion", ["YES", "NO"]),
7879
7887
  getRadioInputField("treeStructure", "Flat Tree Structure", ["YES", "NO"]),
7880
7888
  getRadioInputField("filterFromLeafRows", "Filter from tree rows", ["YES", "NO"]),
7881
- getInputField("defaultColumnSize", "Default Column Size"),
7882
- ,
7889
+ emptyBox$1("LazyLoadingTableEmpty2"),
7883
7890
  emptyBox$1("LazyLoadingTableEmpty3")
7884
7891
  ]),
7885
7892
  getArrayControl("Table_Download_Keys_Name", "KeyName", "Table Key Name"),
@@ -8433,7 +8440,7 @@ const sectionLabels = {
8433
8440
  Timer: ["Core", "Events", "Style", "Validation"],
8434
8441
  Rank: ["Core", "Events", "Style", "Validation"],
8435
8442
  Button: ["Core", "Properties", "Events", "Style", "Validation"],
8436
- Array: ["Core", "Components", "Properties", "Events", "Validation"],
8443
+ Array: ["Core", "Components", "Properties", "Validation"],
8437
8444
  Radio: ["Core", "Properties", "Events", "Style", "Validation"],
8438
8445
  Text: ["Core", "Properties", "Events", "Style", "Validation"],
8439
8446
  TextArea: ["Core", "Properties", "Events", "Style", "Validation"],
@@ -8825,7 +8832,7 @@ var pageMaster = (funcParams) => {
8825
8832
  return formData;
8826
8833
  }
8827
8834
  saveFormdataInSessionStorage(config2);
8828
- return { ...config2, type: "page" };
8835
+ return config2;
8829
8836
  },
8830
8837
  getUiSchema: function() {
8831
8838
  const UiSchema = _.cloneDeep(PageMasterUiSchema(store2.theme.myTheme));
@@ -8984,7 +8991,7 @@ const EventSchema = {
8984
8991
  oneOf: [
8985
8992
  { title: "RankProvider", const: "RankProvider" },
8986
8993
  { title: "Download File", const: "downloadFile" },
8987
- { title: "downloadFileFromUrl", const: "downloadFileFromUrl" }
8994
+ { title: "Download", const: "download" }
8988
8995
  ]
8989
8996
  },
8990
8997
  body: {
@@ -9921,33 +9928,22 @@ var event = (store2, dynamicData2, submitHandler, service2, functionsName) => {
9921
9928
  }
9922
9929
  };
9923
9930
  };
9924
- function downloadFile$1({ data, name }) {
9925
- var _a;
9926
- const binary = window.atob(data);
9927
- const bytes = new Uint8Array(binary.length);
9928
- for (let i = 0; i < binary.length; i++) {
9929
- bytes[i] = binary.charCodeAt(i);
9930
- }
9931
- const extension = (_a = name.split(".").pop()) == null ? void 0 : _a.toLowerCase();
9932
- const mimeMap = {
9933
- pdf: "application/pdf",
9934
- png: "image/png",
9935
- jpg: "image/jpeg",
9936
- jpeg: "image/jpeg",
9937
- xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
9938
- csv: "text/csv"
9939
- };
9940
- const blob = new Blob([bytes], {
9941
- type: mimeMap[extension] || "application/octet-stream"
9942
- });
9943
- const url = URL.createObjectURL(blob);
9944
- const a = document.createElement("a");
9945
- a.href = url;
9946
- a.download = name;
9947
- a.click();
9931
+ const downloadFile$1 = (obj) => {
9932
+ const typeArr = obj.name.split(".");
9933
+ const data = obj.data;
9934
+ const finalData = window.atob(data);
9935
+ let file;
9936
+ file = new File([finalData], typeArr[typeArr.length - 1]);
9937
+ const url = URL.createObjectURL(file);
9938
+ const link = document.createElement("a");
9939
+ link.href = typeArr[typeArr.length - 1] === "pdf" ? "data:application/octet-stream;base64," + data : url;
9940
+ link.download = `${obj.name}`;
9941
+ document.body.appendChild(link);
9942
+ link.click();
9948
9943
  URL.revokeObjectURL(url);
9949
- }
9950
- const downloadFileFromUrl = (response, service2) => {
9944
+ document.body.removeChild(link);
9945
+ };
9946
+ const doDownload = (response, service2) => {
9951
9947
  let url = `${service2.defaults.baseURL}/${response.path}`;
9952
9948
  if (response == null ? void 0 : response.params) {
9953
9949
  const keysArray = Object.keys(response == null ? void 0 : response.params);
@@ -10026,6 +10022,7 @@ function executeEventsHandler(params2) {
10026
10022
  params2.componentName,
10027
10023
  params2.config,
10028
10024
  params2.store,
10025
+ params2.service,
10029
10026
  params2.formDataHolder
10030
10027
  );
10031
10028
  } else if (params2.config.Handler === "onBackHandler") {
@@ -10097,7 +10094,7 @@ function executeCustomHandler(params) {
10097
10094
  return response;
10098
10095
  }
10099
10096
  }
10100
- function mergeFormdata(handlerResponse, componentName, eventConfig, store2, formDataHolder) {
10097
+ function mergeFormdata(handlerResponse, componentName, eventConfig, store2, service2, formDataHolder) {
10101
10098
  var _a, _b, _c;
10102
10099
  if (eventConfig.type === "Select" && (handlerResponse == null ? void 0 : handlerResponse.data)) {
10103
10100
  if (!_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data)) {
@@ -10135,23 +10132,29 @@ function mergeFormdata(handlerResponse, componentName, eventConfig, store2, form
10135
10132
  });
10136
10133
  }
10137
10134
  } else if (eventConfig.type === "page") {
10138
- if (!(_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data) && (handlerResponse == null ? void 0 : handlerResponse.data) && lodash.exports.isObject(handlerResponse.data))) {
10135
+ if (!(_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data) && (handlerResponse == null ? void 0 : handlerResponse.data))) {
10139
10136
  store2.newData = {
10140
10137
  ...store2.newData,
10141
10138
  ...handlerResponse == null ? void 0 : handlerResponse.data
10142
10139
  };
10143
- Object.keys(handlerResponse.data).forEach((e) => {
10144
- formDataHolder[e] = handlerResponse.data[e];
10140
+ store2.setFormdata((pre) => {
10141
+ return { ...pre, ...handlerResponse == null ? void 0 : handlerResponse.data };
10145
10142
  });
10146
10143
  }
10147
10144
  } else if (eventConfig.type === "Table" && eventConfig.lazyLoading) {
10148
10145
  if (handlerResponse && (handlerResponse == null ? void 0 : handlerResponse.data)) {
10149
10146
  formDataHolder[componentName] = (_a = handlerResponse.data) == null ? void 0 : _a.data;
10150
10147
  formDataHolder[`${componentName}_RowCount`] = (_c = (_b = handlerResponse.data) == null ? void 0 : _b.meta) == null ? void 0 : _c.totalRowCount;
10148
+ store2.setFormdata((pre) => {
10149
+ return { ...pre, ...formDataHolder };
10150
+ });
10151
10151
  }
10152
10152
  } else {
10153
- if (handlerResponse == null ? void 0 : handlerResponse.data) {
10153
+ if (handlerResponse) {
10154
10154
  formDataHolder[componentName] = handlerResponse.data;
10155
+ store2.setFormdata((pre) => {
10156
+ return { ...pre, ...formDataHolder };
10157
+ });
10155
10158
  }
10156
10159
  }
10157
10160
  }
@@ -10289,7 +10292,7 @@ var service = (funcParams) => {
10289
10292
  dynamicData: funcParams.dynamicData,
10290
10293
  userValue: funcParams.userValue,
10291
10294
  service: funcParams.service,
10292
- serviceHolder: { downloadFile: downloadFile$1, download: downloadFileFromUrl, ...funcParams.functionsProvider },
10295
+ serviceHolder: { downloadFile: downloadFile$1, download: doDownload, ...funcParams.functionsProvider },
10293
10296
  eventGroups,
10294
10297
  functionsProvider: funcParams.functionsProvider,
10295
10298
  formDataHolder
@@ -10298,7 +10301,10 @@ var service = (funcParams) => {
10298
10301
  setPage: async function() {
10299
10302
  var _a, _b, _c;
10300
10303
  funcParams.store.setAdditionalErrors([]);
10301
- funcParams.store.setFormdata((funcParams == null ? void 0 : funcParams.initFormData()) || {});
10304
+ funcParams.store.setFormdata((pre) => ({
10305
+ ...pre,
10306
+ ...funcParams == null ? void 0 : funcParams.initFormData()
10307
+ }));
10302
10308
  funcParams.store.setSchema({ type: "object", properties: {} });
10303
10309
  funcParams.store.newData = {};
10304
10310
  eventGroups = {};
@@ -10333,7 +10339,7 @@ var service = (funcParams) => {
10333
10339
  };
10334
10340
  }
10335
10341
  );
10336
- executeRefreshHandler({
10342
+ await executeRefreshHandler({
10337
10343
  config: {},
10338
10344
  componentName: "",
10339
10345
  store: funcParams.store,
@@ -10342,30 +10348,25 @@ var service = (funcParams) => {
10342
10348
  service: funcParams.service,
10343
10349
  serviceHolder: this,
10344
10350
  eventGroups,
10345
- formDataHolder
10346
- }).then((e) => {
10347
- funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
10348
- uiSchema.elements.push(notifyUiSchema);
10349
- funcParams.store.setUiSchema(uiSchema);
10351
+ formDataHolder: {}
10350
10352
  });
10353
+ uiSchema.elements.push(notifyUiSchema);
10354
+ funcParams.store.setUiSchema(uiSchema);
10351
10355
  },
10352
10356
  onCellRenderer: (cellParams) => {
10353
- var _a, _b, _c, _d, _e;
10354
- const cloneEventGroup = _.cloneDeep(eventGroups);
10355
- if (cloneEventGroup.onCellRenderer) {
10357
+ var _a, _b, _c, _d;
10358
+ if (eventGroups.onCellRenderer) {
10356
10359
  let finalResponse = {};
10357
10360
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || ((_c = (_b = funcParams == null ? void 0 : funcParams.dynamicData) == null ? void 0 : _b.path) == null ? void 0 : _c.split(".")[0]);
10358
- if ((_d = cloneEventGroup == null ? void 0 : cloneEventGroup.onCellRenderer) == null ? void 0 : _d[path]) {
10359
- for (const eventConfig of (_e = cloneEventGroup == null ? void 0 : cloneEventGroup.onCellRenderer) == null ? void 0 : _e[path]) {
10360
- executeEventsParameters.store.functionParameters = cellParams;
10361
- finalResponse = executeEvents({
10362
- ...executeEventsParameters,
10363
- config: eventConfig,
10364
- componentName: path
10365
- });
10366
- }
10367
- return finalResponse;
10361
+ for (const eventConfig of (_d = eventGroups == null ? void 0 : eventGroups.onCellRenderer) == null ? void 0 : _d[path]) {
10362
+ executeEventsParameters.store.functionParameters = cellParams;
10363
+ finalResponse = executeEvents({
10364
+ ...executeEventsParameters,
10365
+ config: eventConfig,
10366
+ componentName: path
10367
+ });
10368
10368
  }
10369
+ return finalResponse;
10369
10370
  }
10370
10371
  return {};
10371
10372
  },
@@ -10430,23 +10431,11 @@ var service = (funcParams) => {
10430
10431
  var _a, _b;
10431
10432
  if (((_a = funcParams.store) == null ? void 0 : _a.formData[componentName]) !== funcParams.store.newData[componentName] && ((_b = funcParams.store) == null ? void 0 : _b.newData[componentName]) !== void 0) {
10432
10433
  for (const eventConfig of eventGroups.onChange[componentName]) {
10433
- if (eventConfig.Handler === "refresh") {
10434
- await executeEvents({
10435
- ...executeEventsParameters,
10436
- config: eventConfig,
10437
- componentName,
10438
- formDataHolder
10439
- });
10440
- if (!lodash.exports.isEmpty(formDataHolder)) {
10441
- funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
10442
- }
10443
- } else {
10444
- await executeEvents({
10445
- ...executeEventsParameters,
10446
- config: eventConfig,
10447
- componentName
10448
- });
10449
- }
10434
+ await executeEvents({
10435
+ ...executeEventsParameters,
10436
+ config: eventConfig,
10437
+ componentName
10438
+ });
10450
10439
  }
10451
10440
  }
10452
10441
  }));
@@ -10480,7 +10469,7 @@ var service = (funcParams) => {
10480
10469
  onBack: async function(functionParameters) {
10481
10470
  var _a, _b;
10482
10471
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
10483
- this.callHandler("onBack", functionParameters);
10472
+ await this.callHandler("onBack", functionParameters);
10484
10473
  if (((_b = eventGroups == null ? void 0 : eventGroups["onBack"]) == null ? void 0 : _b[path]) === void 0) {
10485
10474
  functionParameters == null ? void 0 : functionParameters.handleBack();
10486
10475
  }
@@ -10488,7 +10477,7 @@ var service = (funcParams) => {
10488
10477
  onNext: async function(functionParameters) {
10489
10478
  var _a, _b;
10490
10479
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
10491
- this.callHandler("onNext", functionParameters);
10480
+ await this.callHandler("onNext", functionParameters);
10492
10481
  if (((_b = eventGroups == null ? void 0 : eventGroups["onNext"]) == null ? void 0 : _b[path]) === void 0) {
10493
10482
  functionParameters == null ? void 0 : functionParameters.handleNext();
10494
10483
  }
@@ -10496,31 +10485,27 @@ var service = (funcParams) => {
10496
10485
  onReset: async function(functionParameters) {
10497
10486
  var _a, _b;
10498
10487
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
10499
- this.callHandler("onReset", functionParameters);
10488
+ await this.callHandler("onReset", functionParameters);
10500
10489
  if (((_b = eventGroups == null ? void 0 : eventGroups["onReset"]) == null ? void 0 : _b[path]) === void 0) {
10501
10490
  functionParameters == null ? void 0 : functionParameters.handleReset();
10502
10491
  }
10503
10492
  },
10504
- callHandler: function(eventType, functionParameters) {
10493
+ callHandler: async function(eventType, functionParameters) {
10505
10494
  var _a, _b, _c;
10506
10495
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[funcParams.dynamicData.path.split(".").length - 1];
10507
10496
  if (((_b = eventGroups == null ? void 0 : eventGroups[eventType]) == null ? void 0 : _b[path]) !== void 0) {
10508
- (_c = eventGroups == null ? void 0 : eventGroups[eventType]) == null ? void 0 : _c[path].map((eventConfig) => {
10497
+ Promise.all((_c = eventGroups == null ? void 0 : eventGroups[eventType]) == null ? void 0 : _c[path].map((eventConfig) => {
10509
10498
  executeEventsParameters.store.functionParameters = functionParameters;
10510
10499
  executeEvents({
10511
10500
  ...executeEventsParameters,
10512
10501
  config: eventConfig,
10513
- componentName: path,
10514
- formDataHolder
10502
+ componentName: path
10515
10503
  });
10516
- if (!lodash.exports.isEmpty(formDataHolder)) {
10517
- funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
10518
- }
10519
- });
10504
+ }));
10520
10505
  }
10521
10506
  },
10522
10507
  downloadFile: downloadFile$1,
10523
- downloadFileFromUrl,
10508
+ download: doDownload,
10524
10509
  ...funcParams.functionsProvider
10525
10510
  };
10526
10511
  };
@@ -11133,9 +11118,6 @@ const buildTable = (config2, componentScope2) => {
11133
11118
  if (config2.lazyLoading) {
11134
11119
  table.config.main.lazyLoading = config2.lazyLoading === "YES" ? true : false;
11135
11120
  }
11136
- if (config2.defaultColumnSize) {
11137
- table.config.main.defaultColumnSize = config2.defaultColumnSize;
11138
- }
11139
11121
  if (config2.enableRowMovement) {
11140
11122
  table.config.main.enableRowMovement = config2.enableRowMovement === "YES" ? true : false;
11141
11123
  }
@@ -11199,6 +11181,9 @@ const buildTable = (config2, componentScope2) => {
11199
11181
  if (config2.maxPageSize) {
11200
11182
  table.config.main.maxPageSize = config2.maxPageSize;
11201
11183
  }
11184
+ if (config2.initialDensity) {
11185
+ table.config.main.initialDensity = config2.initialDensity;
11186
+ }
11202
11187
  return table;
11203
11188
  };
11204
11189
  const Box = {
@@ -12329,65 +12314,113 @@ let schema = {
12329
12314
  properties: {},
12330
12315
  required: []
12331
12316
  };
12332
- function buildSchemaFromConfig(config2, parentSchema) {
12333
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
12334
- if (config2.elements) {
12335
- if (config2.type === "Array") {
12336
- (_a = parentSchema.properties) != null ? _a : parentSchema.properties = {};
12337
- (_d = (_b = parentSchema.properties)[_c = config2.name]) != null ? _d : _b[_c] = {
12338
- type: "array",
12317
+ function buildRule(configObj, tableName, arrayHolderName) {
12318
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12319
+ if (arrayHolderName) {
12320
+ if ((_c = (_b = (_a = schema.properties) == null ? void 0 : _a[tableName]) == null ? void 0 : _b.items) == null ? void 0 : _c.properties) {
12321
+ 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])) {
12322
+ schema.properties[tableName].items.properties[configObj.name] = {};
12323
+ if (configObj.type === "Select" && ((_h = configObj.value) == null ? void 0 : _h.length) > 0) {
12324
+ schema.properties[tableName].items.properties[configObj.name] = {
12325
+ oneOf: configObj.value.map((e) => {
12326
+ return { const: e.value, title: e.label };
12327
+ })
12328
+ };
12329
+ } else if (configObj.type === "MultipleSelect" && ((_i = configObj.value) == null ? void 0 : _i.length) > 0) {
12330
+ schema.properties[tableName].items.properties[configObj.name] = {
12331
+ items: {
12332
+ oneOf: configObj.value.map((e) => {
12333
+ return { const: e.value, title: e.label };
12334
+ })
12335
+ }
12336
+ };
12337
+ }
12338
+ }
12339
+ }
12340
+ } else if ((configObj.type === "Select" || configObj.type === "MultipleSelect") && ((_j = configObj.value) == null ? void 0 : _j.length) > 0) {
12341
+ if (configObj.type === "Select") {
12342
+ schema.properties[configObj.name] = {
12343
+ oneOf: configObj.value.map((e) => {
12344
+ return { const: e.value, title: e.label };
12345
+ })
12346
+ };
12347
+ } else if (configObj.type === "MultipleSelect") {
12348
+ schema.properties[configObj.name] = {
12339
12349
  items: {
12340
- type: "object",
12341
- properties: {},
12342
- required: []
12350
+ oneOf: configObj.value.map((e) => {
12351
+ return { const: e.value, title: e.label };
12352
+ })
12343
12353
  }
12344
12354
  };
12345
- const arrayItemSchema = parentSchema.properties[config2.name].items;
12346
- (_e = config2.elements) == null ? void 0 : _e.forEach(
12347
- (child) => buildSchemaFromConfig(child, arrayItemSchema)
12348
- );
12349
- return;
12350
- } else {
12351
- (_f = config2.elements) == null ? void 0 : _f.forEach(
12352
- (child) => buildSchemaFromConfig(child, parentSchema)
12353
- );
12354
- return;
12355
12355
  }
12356
12356
  }
12357
- (_g = parentSchema.properties) != null ? _g : parentSchema.properties = {};
12358
- (_j = (_h = parentSchema.properties)[_i = config2.name]) != null ? _j : _h[_i] = {};
12359
- const fieldSchema = parentSchema.properties[config2.name];
12360
- (_k = config2.validation) == null ? void 0 : _k.forEach((v) => {
12361
- var _a2;
12362
- if (v.validationType === "required") {
12363
- (_a2 = parentSchema.required) != null ? _a2 : parentSchema.required = [];
12364
- parentSchema.required.push(config2.name);
12365
- } else if (v.validationType === "readOnly") {
12366
- fieldSchema.type = "string";
12367
- fieldSchema.disabled = true;
12357
+ if (configObj.validation) {
12358
+ configObj.validation.forEach((rule) => {
12359
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k, _l;
12360
+ if (tableName) {
12361
+ if ((_c2 = (_b2 = (_a2 = schema.properties) == null ? void 0 : _a2[tableName]) == null ? void 0 : _b2.items) == null ? void 0 : _c2.properties) {
12362
+ 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])) {
12363
+ schema.properties[tableName].items.properties[configObj.name] = {};
12364
+ if (configObj.type === "Select" || ((_h2 = configObj.value) == null ? void 0 : _h2.length) > 0) {
12365
+ schema.properties[tableName].items.properties[configObj.name] = {
12366
+ oneOf: configObj.value.map((e) => {
12367
+ return { const: e.value, title: e.label };
12368
+ })
12369
+ };
12370
+ } else if (configObj.type === "MultipleSelect" || ((_i2 = configObj.value) == null ? void 0 : _i2.length) > 0) {
12371
+ schema.properties[tableName].items.properties[configObj.name] = {
12372
+ items: {
12373
+ oneOf: configObj.value.map((e) => {
12374
+ return { const: e.value, title: e.label };
12375
+ })
12376
+ }
12377
+ };
12378
+ }
12379
+ }
12380
+ if (rule.validationType === "required") {
12381
+ (_l = (_k = (_j2 = schema.properties) == null ? void 0 : _j2[tableName]) == null ? void 0 : _k.items) == null ? void 0 : _l.required.push(configObj.name);
12382
+ } else {
12383
+ schema.properties[tableName].items.properties[configObj.name]["type"] = "string";
12384
+ schema.properties[tableName].items.properties[configObj.name][rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
12385
+ }
12386
+ }
12387
+ } else {
12388
+ if (!schema.properties[configObj.name]) {
12389
+ schema.properties[configObj.name] = {};
12390
+ }
12391
+ if (rule.validationType === "required") {
12392
+ schema.required.push(configObj.name);
12393
+ } else {
12394
+ schema.properties[configObj.name]["type"] = "string";
12395
+ schema.properties[configObj.name][rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
12396
+ }
12397
+ }
12398
+ });
12399
+ }
12400
+ }
12401
+ const buildSchema = (config2, tableName, isArrayType) => {
12402
+ buildRule(config2, tableName, isArrayType);
12403
+ if (config2 == null ? void 0 : config2.elements) {
12404
+ if (config2.type == "Array") {
12405
+ if (!schema.properties[config2.name]) {
12406
+ schema.properties[config2.name] = {
12407
+ type: "array",
12408
+ items: {
12409
+ type: "object",
12410
+ properties: {},
12411
+ required: []
12412
+ }
12413
+ };
12414
+ }
12415
+ config2.elements.map((e, elemInd) => {
12416
+ buildSchema(e, config2.name, config2.type === "Array" ? true : false);
12417
+ });
12368
12418
  } else {
12369
- fieldSchema.type = "string";
12370
- fieldSchema[v.validationType] = isNaN(v.validationValue) ? v.validationValue : Number(v.validationValue);
12419
+ config2.elements.map((e, elemInd) => {
12420
+ buildSchema(e);
12421
+ });
12371
12422
  }
12372
- });
12373
- if (config2.type === "Select" && ((_l = config2.value) == null ? void 0 : _l.length)) {
12374
- fieldSchema.oneOf = config2.value.map((v) => ({
12375
- const: v.value,
12376
- title: v.label
12377
- }));
12378
- }
12379
- if (config2.type === "MultipleSelect" && ((_m = config2.value) == null ? void 0 : _m.length)) {
12380
- fieldSchema.type = "array";
12381
- fieldSchema.items = {
12382
- oneOf: config2.value.map((v) => ({
12383
- const: v.value,
12384
- title: v.label
12385
- }))
12386
- };
12387
12423
  }
12388
- }
12389
- const buildSchema = (config2) => {
12390
- buildSchemaFromConfig(config2, schema);
12391
12424
  return schema;
12392
12425
  };
12393
12426
  const buildUiSchema = (config2, store2) => {
@@ -12629,5 +12662,5 @@ const buildUiSchema = (config2, store2) => {
12629
12662
  }
12630
12663
  return elements;
12631
12664
  };
12632
- export { buildConfig, buildSchema, buildUiSchema, clearFromSessionStorage, downloadFile$1 as downloadFile, downloadFileFromUrl, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
12665
+ export { buildConfig, buildSchema, buildUiSchema, clearFromSessionStorage, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
12633
12666
  //# sourceMappingURL=impaktapps-ui-builder.es.js.map