impaktapps-ui-builder 1.0.102 → 1.0.104

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;
@@ -6487,7 +6487,8 @@ const ComponentSchema = {
6487
6487
  { const: "required", title: "Required" },
6488
6488
  { const: "minLength", title: "Minimum Length" },
6489
6489
  { const: "maxLength", title: "Maximum Length" },
6490
- { const: "pattern", title: "Pattern" }
6490
+ { const: "pattern", title: "Pattern" },
6491
+ { const: "readOnly", title: "Read Only" }
6491
6492
  ]
6492
6493
  },
6493
6494
  validationValue: {
@@ -7877,7 +7878,8 @@ const buildPropertiesSection = function(type) {
7877
7878
  getRadioInputField("paginateExpandedRows", "Multi Page Expansion", ["YES", "NO"]),
7878
7879
  getRadioInputField("treeStructure", "Flat Tree Structure", ["YES", "NO"]),
7879
7880
  getRadioInputField("filterFromLeafRows", "Filter from tree rows", ["YES", "NO"]),
7880
- emptyBox$1("LazyLoadingTableEmpty2"),
7881
+ getInputField("defaultColumnSize", "Default Column Size"),
7882
+ ,
7881
7883
  emptyBox$1("LazyLoadingTableEmpty3")
7882
7884
  ]),
7883
7885
  getArrayControl("Table_Download_Keys_Name", "KeyName", "Table Key Name"),
@@ -8431,7 +8433,7 @@ const sectionLabels = {
8431
8433
  Timer: ["Core", "Events", "Style", "Validation"],
8432
8434
  Rank: ["Core", "Events", "Style", "Validation"],
8433
8435
  Button: ["Core", "Properties", "Events", "Style", "Validation"],
8434
- Array: ["Core", "Components", "Properties", "Validation"],
8436
+ Array: ["Core", "Components", "Properties", "Events", "Validation"],
8435
8437
  Radio: ["Core", "Properties", "Events", "Style", "Validation"],
8436
8438
  Text: ["Core", "Properties", "Events", "Style", "Validation"],
8437
8439
  TextArea: ["Core", "Properties", "Events", "Style", "Validation"],
@@ -8982,7 +8984,8 @@ const EventSchema = {
8982
8984
  oneOf: [
8983
8985
  { title: "RankProvider", const: "RankProvider" },
8984
8986
  { title: "Download File", const: "downloadFile" },
8985
- { title: "Download", const: "download" }
8987
+ { title: "downloadFileFromUrl", const: "downloadFileFromUrl" },
8988
+ { title: "downloadFileFromBase64", const: "downloadFileFromBase64" }
8986
8989
  ]
8987
8990
  },
8988
8991
  body: {
@@ -9934,7 +9937,33 @@ const downloadFile$1 = (obj) => {
9934
9937
  URL.revokeObjectURL(url);
9935
9938
  document.body.removeChild(link);
9936
9939
  };
9937
- const doDownload = (response, service2) => {
9940
+ function downloadFileFromBase64({ data, name }) {
9941
+ var _a;
9942
+ const binary = window.atob(data);
9943
+ const bytes = new Uint8Array(binary.length);
9944
+ for (let i = 0; i < binary.length; i++) {
9945
+ bytes[i] = binary.charCodeAt(i);
9946
+ }
9947
+ const extension = (_a = name.split(".").pop()) == null ? void 0 : _a.toLowerCase();
9948
+ const mimeMap = {
9949
+ pdf: "application/pdf",
9950
+ png: "image/png",
9951
+ jpg: "image/jpeg",
9952
+ jpeg: "image/jpeg",
9953
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
9954
+ csv: "text/csv"
9955
+ };
9956
+ const blob = new Blob([bytes], {
9957
+ type: mimeMap[extension] || "application/octet-stream"
9958
+ });
9959
+ const url = URL.createObjectURL(blob);
9960
+ const a = document.createElement("a");
9961
+ a.href = url;
9962
+ a.download = name;
9963
+ a.click();
9964
+ URL.revokeObjectURL(url);
9965
+ }
9966
+ const downloadFileFromUrl = (response, service2) => {
9938
9967
  let url = `${service2.defaults.baseURL}/${response.path}`;
9939
9968
  if (response == null ? void 0 : response.params) {
9940
9969
  const keysArray = Object.keys(response == null ? void 0 : response.params);
@@ -10283,7 +10312,7 @@ var service = (funcParams) => {
10283
10312
  dynamicData: funcParams.dynamicData,
10284
10313
  userValue: funcParams.userValue,
10285
10314
  service: funcParams.service,
10286
- serviceHolder: { downloadFile: downloadFile$1, download: doDownload, ...funcParams.functionsProvider },
10315
+ serviceHolder: { downloadFile: downloadFile$1, download: downloadFileFromUrl, downloadFileFromBase64, ...funcParams.functionsProvider },
10287
10316
  eventGroups,
10288
10317
  functionsProvider: funcParams.functionsProvider,
10289
10318
  formDataHolder
@@ -10342,19 +10371,22 @@ var service = (funcParams) => {
10342
10371
  funcParams.store.setUiSchema(uiSchema);
10343
10372
  },
10344
10373
  onCellRenderer: (cellParams) => {
10345
- var _a, _b, _c, _d;
10346
- if (eventGroups.onCellRenderer) {
10374
+ var _a, _b, _c, _d, _e;
10375
+ const cloneEventGroup = _.cloneDeep(eventGroups);
10376
+ if (cloneEventGroup.onCellRenderer) {
10347
10377
  let finalResponse = {};
10348
10378
  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]);
10349
- for (const eventConfig of (_d = eventGroups == null ? void 0 : eventGroups.onCellRenderer) == null ? void 0 : _d[path]) {
10350
- executeEventsParameters.store.functionParameters = cellParams;
10351
- finalResponse = executeEvents({
10352
- ...executeEventsParameters,
10353
- config: eventConfig,
10354
- componentName: path
10355
- });
10379
+ if ((_d = cloneEventGroup == null ? void 0 : cloneEventGroup.onCellRenderer) == null ? void 0 : _d[path]) {
10380
+ for (const eventConfig of (_e = cloneEventGroup == null ? void 0 : cloneEventGroup.onCellRenderer) == null ? void 0 : _e[path]) {
10381
+ executeEventsParameters.store.functionParameters = cellParams;
10382
+ finalResponse = executeEvents({
10383
+ ...executeEventsParameters,
10384
+ config: eventConfig,
10385
+ componentName: path
10386
+ });
10387
+ }
10388
+ return finalResponse;
10356
10389
  }
10357
- return finalResponse;
10358
10390
  }
10359
10391
  return {};
10360
10392
  },
@@ -10493,7 +10525,8 @@ var service = (funcParams) => {
10493
10525
  }
10494
10526
  },
10495
10527
  downloadFile: downloadFile$1,
10496
- download: doDownload,
10528
+ downloadFileFromUrl,
10529
+ downloadFileFromBase64,
10497
10530
  ...funcParams.functionsProvider
10498
10531
  };
10499
10532
  };
@@ -11106,6 +11139,9 @@ const buildTable = (config2, componentScope2) => {
11106
11139
  if (config2.lazyLoading) {
11107
11140
  table.config.main.lazyLoading = config2.lazyLoading === "YES" ? true : false;
11108
11141
  }
11142
+ if (config2.defaultColumnSize) {
11143
+ table.config.main.enableRowMovement = config2.defaultColumnSize;
11144
+ }
11109
11145
  if (config2.enableRowMovement) {
11110
11146
  table.config.main.enableRowMovement = config2.enableRowMovement === "YES" ? true : false;
11111
11147
  }
@@ -12299,115 +12335,94 @@ let schema = {
12299
12335
  properties: {},
12300
12336
  required: []
12301
12337
  };
12302
- function buildRule(configObj, tableName, arrayHolderName) {
12303
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12304
- if (arrayHolderName) {
12305
- if ((_c = (_b = (_a = schema.properties) == null ? void 0 : _a[tableName]) == null ? void 0 : _b.items) == null ? void 0 : _c.properties) {
12306
- 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])) {
12307
- schema.properties[tableName].items.properties[configObj.name] = {};
12308
- if (configObj.type === "Select" && ((_h = configObj.value) == null ? void 0 : _h.length) > 0) {
12309
- schema.properties[tableName].items.properties[configObj.name] = {
12310
- oneOf: configObj.value.map((e) => {
12311
- return { const: e.value, title: e.label };
12312
- })
12313
- };
12314
- } else if (configObj.type === "MultipleSelect" && ((_i = configObj.value) == null ? void 0 : _i.length) > 0) {
12315
- schema.properties[tableName].items.properties[configObj.name] = {
12316
- items: {
12317
- oneOf: configObj.value.map((e) => {
12318
- return { const: e.value, title: e.label };
12319
- })
12320
- }
12321
- };
12322
- }
12338
+ function buildOneOf(values) {
12339
+ return values.map((e) => ({
12340
+ const: e.value,
12341
+ title: e.label
12342
+ }));
12343
+ }
12344
+ function applyValidations(schemaNode, validations = [], requiredArr, fieldName) {
12345
+ validations.forEach((rule) => {
12346
+ if (rule.validationType === "readOnly") {
12347
+ schemaNode.disabled = true;
12348
+ }
12349
+ if (rule.validationType === "required") {
12350
+ if (requiredArr && fieldName) {
12351
+ requiredArr.push(fieldName);
12323
12352
  }
12353
+ } else {
12354
+ schemaNode.type = "string";
12355
+ schemaNode[rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
12324
12356
  }
12325
- } else if ((configObj.type === "Select" || configObj.type === "MultipleSelect") && ((_j = configObj.value) == null ? void 0 : _j.length) > 0) {
12326
- if (configObj.type === "Select") {
12327
- schema.properties[configObj.name] = {
12328
- oneOf: configObj.value.map((e) => {
12329
- return { const: e.value, title: e.label };
12330
- })
12331
- };
12332
- } else if (configObj.type === "MultipleSelect") {
12333
- schema.properties[configObj.name] = {
12334
- items: {
12335
- oneOf: configObj.value.map((e) => {
12336
- return { const: e.value, title: e.label };
12337
- })
12338
- }
12357
+ });
12358
+ }
12359
+ function buildNode(config2) {
12360
+ var _a, _b, _c;
12361
+ if (config2.type === "Array") {
12362
+ const arraySchema = {
12363
+ type: "array",
12364
+ items: {
12365
+ type: "object",
12366
+ properties: {},
12367
+ required: []
12368
+ }
12369
+ };
12370
+ (_a = config2.elements) == null ? void 0 : _a.forEach((child) => {
12371
+ var _a2;
12372
+ const childNode = buildNode(child);
12373
+ if (!childNode)
12374
+ return;
12375
+ arraySchema.items.properties[child.name] = childNode.schema;
12376
+ if ((_a2 = childNode.required) == null ? void 0 : _a2.length) {
12377
+ arraySchema.items.required.push(child.name);
12378
+ }
12379
+ });
12380
+ return { schema: arraySchema };
12381
+ }
12382
+ let fieldSchema = {};
12383
+ if ((config2.type === "Select" || config2.type === "MultipleSelect") && ((_b = config2.value) == null ? void 0 : _b.length) > 0) {
12384
+ if (config2.type === "Select") {
12385
+ fieldSchema.oneOf = buildOneOf(config2.value);
12386
+ } else {
12387
+ fieldSchema.type = "array";
12388
+ fieldSchema.items = {
12389
+ oneOf: buildOneOf(config2.value)
12339
12390
  };
12340
12391
  }
12341
12392
  }
12342
- if (configObj.validation) {
12343
- configObj.validation.forEach((rule) => {
12344
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k, _l;
12345
- if (tableName) {
12346
- if ((_c2 = (_b2 = (_a2 = schema.properties) == null ? void 0 : _a2[tableName]) == null ? void 0 : _b2.items) == null ? void 0 : _c2.properties) {
12347
- 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])) {
12348
- schema.properties[tableName].items.properties[configObj.name] = {};
12349
- if (configObj.type === "Select" || ((_h2 = configObj.value) == null ? void 0 : _h2.length) > 0) {
12350
- schema.properties[tableName].items.properties[configObj.name] = {
12351
- oneOf: configObj.value.map((e) => {
12352
- return { const: e.value, title: e.label };
12353
- })
12354
- };
12355
- } else if (configObj.type === "MultipleSelect" || ((_i2 = configObj.value) == null ? void 0 : _i2.length) > 0) {
12356
- schema.properties[tableName].items.properties[configObj.name] = {
12357
- items: {
12358
- oneOf: configObj.value.map((e) => {
12359
- return { const: e.value, title: e.label };
12360
- })
12361
- }
12362
- };
12363
- }
12364
- }
12365
- if (rule.validationType === "required") {
12366
- (_l = (_k = (_j2 = schema.properties) == null ? void 0 : _j2[tableName]) == null ? void 0 : _k.items) == null ? void 0 : _l.required.push(configObj.name);
12367
- } else {
12368
- schema.properties[tableName].items.properties[configObj.name]["type"] = "string";
12369
- schema.properties[tableName].items.properties[configObj.name][rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
12370
- }
12371
- }
12372
- } else {
12373
- if (!schema.properties[configObj.name]) {
12374
- schema.properties[configObj.name] = {};
12375
- }
12376
- if (rule.validationType === "required") {
12377
- schema.required.push(configObj.name);
12378
- } else {
12379
- schema.properties[configObj.name]["type"] = "string";
12380
- schema.properties[configObj.name][rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
12381
- }
12382
- }
12383
- });
12393
+ if (config2.validation) {
12394
+ applyValidations(fieldSchema, config2.validation);
12384
12395
  }
12396
+ const required = ((_c = config2.validation) == null ? void 0 : _c.some(
12397
+ (v) => v.validationType === "required"
12398
+ )) ? [config2.name] : [];
12399
+ return {
12400
+ schema: fieldSchema,
12401
+ required
12402
+ };
12385
12403
  }
12386
- const buildSchema = (config2, tableName, isArrayType) => {
12387
- buildRule(config2, tableName, isArrayType);
12388
- if (config2 == null ? void 0 : config2.elements) {
12389
- if (config2.type == "Array") {
12390
- if (!schema.properties[config2.name]) {
12391
- schema.properties[config2.name] = {
12392
- type: "array",
12393
- items: {
12394
- type: "object",
12395
- properties: {},
12396
- required: []
12397
- }
12398
- };
12399
- }
12400
- config2.elements.map((e, elemInd) => {
12401
- buildSchema(e, config2.name, config2.type === "Array" ? true : false);
12402
- });
12403
- } else {
12404
- config2.elements.map((e, elemInd) => {
12405
- buildSchema(e);
12406
- });
12404
+ function buildSchema(config2) {
12405
+ var _a;
12406
+ const schema2 = {
12407
+ type: "object",
12408
+ properties: {},
12409
+ required: []
12410
+ };
12411
+ (_a = config2.elements) == null ? void 0 : _a.forEach((element) => {
12412
+ var _a2;
12413
+ const node = buildNode(element);
12414
+ if (!node)
12415
+ return;
12416
+ schema2.properties[element.name] = node.schema;
12417
+ if ((_a2 = node.required) == null ? void 0 : _a2.length) {
12418
+ schema2.required.push(element.name);
12407
12419
  }
12420
+ });
12421
+ if (schema2.required.length === 0) {
12422
+ delete schema2.required;
12408
12423
  }
12409
- return schema;
12410
- };
12424
+ return schema2;
12425
+ }
12411
12426
  const buildUiSchema = (config2, store2) => {
12412
12427
  let elements = {};
12413
12428
  const componentScope2 = `#/properties/${config2.name}`;
@@ -12647,5 +12662,5 @@ const buildUiSchema = (config2, store2) => {
12647
12662
  }
12648
12663
  return elements;
12649
12664
  };
12650
- export { buildConfig, buildSchema, buildUiSchema, clearFromSessionStorage, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
12665
+ export { buildConfig, buildSchema, buildUiSchema, clearFromSessionStorage, downloadFileFromBase64, downloadFileFromUrl, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
12651
12666
  //# sourceMappingURL=impaktapps-ui-builder.es.js.map