impaktapps-ui-builder 1.0.114-test.1 → 1.0.116

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, 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;
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;
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 Uint8Array(result2).set(new Uint8Array(arrayBuffer));
2753
+ new Uint8Array2(result2).set(new Uint8Array2(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 Uint8Array(object), new Uint8Array(other))) {
3357
+ if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
3358
3358
  return false;
3359
3359
  }
3360
3360
  return true;
@@ -6310,14 +6310,6 @@ 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
- },
6321
6313
  layout: {
6322
6314
  type: "array",
6323
6315
  items: {
@@ -6495,7 +6487,8 @@ const ComponentSchema = {
6495
6487
  { const: "required", title: "Required" },
6496
6488
  { const: "minLength", title: "Minimum Length" },
6497
6489
  { const: "maxLength", title: "Maximum Length" },
6498
- { const: "pattern", title: "Pattern" }
6490
+ { const: "pattern", title: "Pattern" },
6491
+ { const: "readOnly", title: "Read Only" }
6499
6492
  ]
6500
6493
  },
6501
6494
  validationValue: {
@@ -7879,14 +7872,14 @@ const buildPropertiesSection = function(type) {
7879
7872
  getInputField("selectKey", "Selection Key"),
7880
7873
  getMultiSelectField("filteringOptions", "Filtering Options"),
7881
7874
  getSelectField("maxPageSize", "Max Page Size"),
7882
- getSelectField("initialDensity", "Initial Toggle Density"),
7883
7875
  buildWrapper("Tree Table Properties", [
7884
7876
  getRadioInputField("enableRowMovement", "Row Rearrangement", ["YES", "NO"]),
7885
7877
  getRadioInputField("enableExpanding", "Row Expanding", ["YES", "NO"]),
7886
7878
  getRadioInputField("paginateExpandedRows", "Multi Page Expansion", ["YES", "NO"]),
7887
7879
  getRadioInputField("treeStructure", "Flat Tree Structure", ["YES", "NO"]),
7888
7880
  getRadioInputField("filterFromLeafRows", "Filter from tree rows", ["YES", "NO"]),
7889
- emptyBox$1("LazyLoadingTableEmpty2"),
7881
+ getInputField("defaultColumnSize", "Default Column Size"),
7882
+ ,
7890
7883
  emptyBox$1("LazyLoadingTableEmpty3")
7891
7884
  ]),
7892
7885
  getArrayControl("Table_Download_Keys_Name", "KeyName", "Table Key Name"),
@@ -8440,7 +8433,7 @@ const sectionLabels = {
8440
8433
  Timer: ["Core", "Events", "Style", "Validation"],
8441
8434
  Rank: ["Core", "Events", "Style", "Validation"],
8442
8435
  Button: ["Core", "Properties", "Events", "Style", "Validation"],
8443
- Array: ["Core", "Components", "Properties", "Validation"],
8436
+ Array: ["Core", "Components", "Properties", "Events", "Validation"],
8444
8437
  Radio: ["Core", "Properties", "Events", "Style", "Validation"],
8445
8438
  Text: ["Core", "Properties", "Events", "Style", "Validation"],
8446
8439
  TextArea: ["Core", "Properties", "Events", "Style", "Validation"],
@@ -8832,7 +8825,7 @@ var pageMaster = (funcParams) => {
8832
8825
  return formData;
8833
8826
  }
8834
8827
  saveFormdataInSessionStorage(config2);
8835
- return config2;
8828
+ return { ...config2, type: "page" };
8836
8829
  },
8837
8830
  getUiSchema: function() {
8838
8831
  const UiSchema = _.cloneDeep(PageMasterUiSchema(store2.theme.myTheme));
@@ -8991,7 +8984,7 @@ const EventSchema = {
8991
8984
  oneOf: [
8992
8985
  { title: "RankProvider", const: "RankProvider" },
8993
8986
  { title: "Download File", const: "downloadFile" },
8994
- { title: "Download", const: "download" }
8987
+ { title: "downloadFileFromUrl", const: "downloadFileFromUrl" }
8995
8988
  ]
8996
8989
  },
8997
8990
  body: {
@@ -9928,22 +9921,33 @@ var event = (store2, dynamicData2, submitHandler, service2, functionsName) => {
9928
9921
  }
9929
9922
  };
9930
9923
  };
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();
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();
9943
9948
  URL.revokeObjectURL(url);
9944
- document.body.removeChild(link);
9945
- };
9946
- const doDownload = (response, service2) => {
9949
+ }
9950
+ const downloadFileFromUrl = (response, service2) => {
9947
9951
  let url = `${service2.defaults.baseURL}/${response.path}`;
9948
9952
  if (response == null ? void 0 : response.params) {
9949
9953
  const keysArray = Object.keys(response == null ? void 0 : response.params);
@@ -10022,7 +10026,6 @@ function executeEventsHandler(params2) {
10022
10026
  params2.componentName,
10023
10027
  params2.config,
10024
10028
  params2.store,
10025
- params2.service,
10026
10029
  params2.formDataHolder
10027
10030
  );
10028
10031
  } else if (params2.config.Handler === "onBackHandler") {
@@ -10094,7 +10097,7 @@ function executeCustomHandler(params) {
10094
10097
  return response;
10095
10098
  }
10096
10099
  }
10097
- function mergeFormdata(handlerResponse, componentName, eventConfig, store2, service2, formDataHolder) {
10100
+ function mergeFormdata(handlerResponse, componentName, eventConfig, store2, formDataHolder) {
10098
10101
  var _a, _b, _c;
10099
10102
  if (eventConfig.type === "Select" && (handlerResponse == null ? void 0 : handlerResponse.data)) {
10100
10103
  if (!_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data)) {
@@ -10132,29 +10135,24 @@ function mergeFormdata(handlerResponse, componentName, eventConfig, store2, serv
10132
10135
  });
10133
10136
  }
10134
10137
  } else if (eventConfig.type === "page") {
10135
- if (!(_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data) && (handlerResponse == null ? void 0 : handlerResponse.data))) {
10138
+ if (!(_.isEmpty(handlerResponse == null ? void 0 : handlerResponse.data) && (handlerResponse == null ? void 0 : handlerResponse.data) && lodash.exports.isObject(handlerResponse.data))) {
10136
10139
  store2.newData = {
10137
10140
  ...store2.newData,
10138
10141
  ...handlerResponse == null ? void 0 : handlerResponse.data
10139
10142
  };
10140
- store2.setFormdata((pre) => {
10141
- return { ...pre, ...handlerResponse == null ? void 0 : handlerResponse.data };
10143
+ const keys = Object.keys(handlerResponse.data);
10144
+ keys.map((e) => {
10145
+ formDataHolder[e] = handlerResponse.data[e];
10142
10146
  });
10143
10147
  }
10144
10148
  } else if (eventConfig.type === "Table" && eventConfig.lazyLoading) {
10145
10149
  if (handlerResponse && (handlerResponse == null ? void 0 : handlerResponse.data)) {
10146
10150
  formDataHolder[componentName] = (_a = handlerResponse.data) == null ? void 0 : _a.data;
10147
10151
  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
10152
  }
10152
10153
  } else {
10153
10154
  if (handlerResponse) {
10154
10155
  formDataHolder[componentName] = handlerResponse.data;
10155
- store2.setFormdata((pre) => {
10156
- return { ...pre, ...formDataHolder };
10157
- });
10158
10156
  }
10159
10157
  }
10160
10158
  }
@@ -10292,7 +10290,7 @@ var service = (funcParams) => {
10292
10290
  dynamicData: funcParams.dynamicData,
10293
10291
  userValue: funcParams.userValue,
10294
10292
  service: funcParams.service,
10295
- serviceHolder: { downloadFile: downloadFile$1, download: doDownload, ...funcParams.functionsProvider },
10293
+ serviceHolder: { downloadFile: downloadFile$1, download: downloadFileFromUrl, ...funcParams.functionsProvider },
10296
10294
  eventGroups,
10297
10295
  functionsProvider: funcParams.functionsProvider,
10298
10296
  formDataHolder
@@ -10301,10 +10299,7 @@ var service = (funcParams) => {
10301
10299
  setPage: async function() {
10302
10300
  var _a, _b, _c;
10303
10301
  funcParams.store.setAdditionalErrors([]);
10304
- funcParams.store.setFormdata((pre) => ({
10305
- ...pre,
10306
- ...funcParams == null ? void 0 : funcParams.initFormData()
10307
- }));
10302
+ funcParams.store.setFormdata((funcParams == null ? void 0 : funcParams.initFormData()) || {});
10308
10303
  funcParams.store.setSchema({ type: "object", properties: {} });
10309
10304
  funcParams.store.newData = {};
10310
10305
  eventGroups = {};
@@ -10339,7 +10334,7 @@ var service = (funcParams) => {
10339
10334
  };
10340
10335
  }
10341
10336
  );
10342
- await executeRefreshHandler({
10337
+ executeRefreshHandler({
10343
10338
  config: {},
10344
10339
  componentName: "",
10345
10340
  store: funcParams.store,
@@ -10348,25 +10343,30 @@ var service = (funcParams) => {
10348
10343
  service: funcParams.service,
10349
10344
  serviceHolder: this,
10350
10345
  eventGroups,
10351
- formDataHolder: {}
10346
+ formDataHolder
10347
+ }).then((e) => {
10348
+ funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
10349
+ uiSchema.elements.push(notifyUiSchema);
10350
+ funcParams.store.setUiSchema(uiSchema);
10352
10351
  });
10353
- uiSchema.elements.push(notifyUiSchema);
10354
- funcParams.store.setUiSchema(uiSchema);
10355
10352
  },
10356
10353
  onCellRenderer: (cellParams) => {
10357
- var _a, _b, _c, _d;
10358
- if (eventGroups.onCellRenderer) {
10354
+ var _a, _b, _c, _d, _e;
10355
+ const cloneEventGroup = _.cloneDeep(eventGroups);
10356
+ if (cloneEventGroup.onCellRenderer) {
10359
10357
  let finalResponse = {};
10360
10358
  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]);
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
- });
10359
+ if ((_d = cloneEventGroup == null ? void 0 : cloneEventGroup.onCellRenderer) == null ? void 0 : _d[path]) {
10360
+ for (const eventConfig of (_e = cloneEventGroup == null ? void 0 : cloneEventGroup.onCellRenderer) == null ? void 0 : _e[path]) {
10361
+ executeEventsParameters.store.functionParameters = cellParams;
10362
+ finalResponse = executeEvents({
10363
+ ...executeEventsParameters,
10364
+ config: eventConfig,
10365
+ componentName: path
10366
+ });
10367
+ }
10368
+ return finalResponse;
10368
10369
  }
10369
- return finalResponse;
10370
10370
  }
10371
10371
  return {};
10372
10372
  },
@@ -10434,8 +10434,12 @@ var service = (funcParams) => {
10434
10434
  await executeEvents({
10435
10435
  ...executeEventsParameters,
10436
10436
  config: eventConfig,
10437
- componentName
10437
+ componentName,
10438
+ formDataHolder
10438
10439
  });
10440
+ if (eventConfig.Handler === "refresh") {
10441
+ funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
10442
+ }
10439
10443
  }
10440
10444
  }
10441
10445
  }));
@@ -10469,7 +10473,7 @@ var service = (funcParams) => {
10469
10473
  onBack: async function(functionParameters) {
10470
10474
  var _a, _b;
10471
10475
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
10472
- await this.callHandler("onBack", functionParameters);
10476
+ this.callHandler("onBack", functionParameters);
10473
10477
  if (((_b = eventGroups == null ? void 0 : eventGroups["onBack"]) == null ? void 0 : _b[path]) === void 0) {
10474
10478
  functionParameters == null ? void 0 : functionParameters.handleBack();
10475
10479
  }
@@ -10477,7 +10481,7 @@ var service = (funcParams) => {
10477
10481
  onNext: async function(functionParameters) {
10478
10482
  var _a, _b;
10479
10483
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
10480
- await this.callHandler("onNext", functionParameters);
10484
+ this.callHandler("onNext", functionParameters);
10481
10485
  if (((_b = eventGroups == null ? void 0 : eventGroups["onNext"]) == null ? void 0 : _b[path]) === void 0) {
10482
10486
  functionParameters == null ? void 0 : functionParameters.handleNext();
10483
10487
  }
@@ -10485,27 +10489,38 @@ var service = (funcParams) => {
10485
10489
  onReset: async function(functionParameters) {
10486
10490
  var _a, _b;
10487
10491
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[0];
10488
- await this.callHandler("onReset", functionParameters);
10492
+ this.callHandler("onReset", functionParameters);
10489
10493
  if (((_b = eventGroups == null ? void 0 : eventGroups["onReset"]) == null ? void 0 : _b[path]) === void 0) {
10490
10494
  functionParameters == null ? void 0 : functionParameters.handleReset();
10491
10495
  }
10492
10496
  },
10493
- callHandler: async function(eventType, functionParameters) {
10497
+ callHandler: function(eventType, functionParameters) {
10494
10498
  var _a, _b, _c;
10495
10499
  const path = ((_a = funcParams.dynamicData) == null ? void 0 : _a.tableButtonPath) || funcParams.dynamicData.path.split(".")[funcParams.dynamicData.path.split(".").length - 1];
10496
10500
  if (((_b = eventGroups == null ? void 0 : eventGroups[eventType]) == null ? void 0 : _b[path]) !== void 0) {
10497
- Promise.all((_c = eventGroups == null ? void 0 : eventGroups[eventType]) == null ? void 0 : _c[path].map((eventConfig) => {
10501
+ (_c = eventGroups == null ? void 0 : eventGroups[eventType]) == null ? void 0 : _c[path].map((eventConfig) => {
10498
10502
  executeEventsParameters.store.functionParameters = functionParameters;
10499
- executeEvents({
10500
- ...executeEventsParameters,
10501
- config: eventConfig,
10502
- componentName: path
10503
- });
10504
- }));
10503
+ if (eventConfig.Handler === "refresh") {
10504
+ executeEvents({
10505
+ ...executeEventsParameters,
10506
+ config: eventConfig,
10507
+ componentName: path,
10508
+ formDataHolder
10509
+ }).then((res) => {
10510
+ funcParams.store.setFormdata((pre) => ({ ...pre, ...formDataHolder }));
10511
+ });
10512
+ } else {
10513
+ executeEvents({
10514
+ ...executeEventsParameters,
10515
+ config: eventConfig,
10516
+ componentName: path
10517
+ });
10518
+ }
10519
+ });
10505
10520
  }
10506
10521
  },
10507
10522
  downloadFile: downloadFile$1,
10508
- download: doDownload,
10523
+ downloadFileFromUrl,
10509
10524
  ...funcParams.functionsProvider
10510
10525
  };
10511
10526
  };
@@ -11118,6 +11133,9 @@ const buildTable = (config2, componentScope2) => {
11118
11133
  if (config2.lazyLoading) {
11119
11134
  table.config.main.lazyLoading = config2.lazyLoading === "YES" ? true : false;
11120
11135
  }
11136
+ if (config2.defaultColumnSize) {
11137
+ table.config.main.defaultColumnSize = config2.defaultColumnSize;
11138
+ }
11121
11139
  if (config2.enableRowMovement) {
11122
11140
  table.config.main.enableRowMovement = config2.enableRowMovement === "YES" ? true : false;
11123
11141
  }
@@ -11181,9 +11199,6 @@ const buildTable = (config2, componentScope2) => {
11181
11199
  if (config2.maxPageSize) {
11182
11200
  table.config.main.maxPageSize = config2.maxPageSize;
11183
11201
  }
11184
- if (config2.initialDensity) {
11185
- table.config.main.initialDensity = config2.initialDensity;
11186
- }
11187
11202
  return table;
11188
11203
  };
11189
11204
  const Box = {
@@ -12314,113 +12329,65 @@ let schema = {
12314
12329
  properties: {},
12315
12330
  required: []
12316
12331
  };
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] = {
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",
12349
12339
  items: {
12350
- oneOf: configObj.value.map((e) => {
12351
- return { const: e.value, title: e.label };
12352
- })
12340
+ type: "object",
12341
+ properties: {},
12342
+ required: []
12353
12343
  }
12354
12344
  };
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
- 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
- });
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;
12418
12368
  } else {
12419
- config2.elements.map((e, elemInd) => {
12420
- buildSchema(e);
12421
- });
12369
+ fieldSchema.type = "string";
12370
+ fieldSchema[v.validationType] = isNaN(v.validationValue) ? v.validationValue : Number(v.validationValue);
12422
12371
  }
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
+ };
12423
12387
  }
12388
+ }
12389
+ const buildSchema = (config2) => {
12390
+ buildSchemaFromConfig(config2, schema);
12424
12391
  return schema;
12425
12392
  };
12426
12393
  const buildUiSchema = (config2, store2) => {
@@ -12662,5 +12629,5 @@ const buildUiSchema = (config2, store2) => {
12662
12629
  }
12663
12630
  return elements;
12664
12631
  };
12665
- export { buildConfig, buildSchema, buildUiSchema, clearFromSessionStorage, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
12632
+ export { buildConfig, buildSchema, buildUiSchema, clearFromSessionStorage, downloadFile$1 as downloadFile, downloadFileFromUrl, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
12666
12633
  //# sourceMappingURL=impaktapps-ui-builder.es.js.map