impaktapps-ui-builder 1.0.102 → 1.0.103
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.
- package/dist/impaktapps-ui-builder.es.js +118 -110
- package/dist/impaktapps-ui-builder.es.js.map +1 -1
- package/dist/impaktapps-ui-builder.umd.js +13 -13
- package/dist/impaktapps-ui-builder.umd.js.map +1 -1
- package/dist/src/impaktapps-ui-builder/builder/build/buildUiSchema.d.ts +1 -5
- package/dist/src/impaktapps-ui-builder/lib/index.d.ts +1 -0
- package/dist/src/impaktapps-ui-builder/runtime/services/downloadFile.d.ts +5 -1
- package/dist/src/impaktapps-ui-builder/runtime/services/service.d.ts +3 -1
- package/package.json +1 -1
- package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +98 -109
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +7 -6
- package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/schema.ts +4 -1
- package/src/impaktapps-ui-builder/builder/services/component.ts +1 -1
- package/src/impaktapps-ui-builder/lib/index.ts +10 -9
- package/src/impaktapps-ui-builder/runtime/services/downloadFile.ts +34 -2
- package/src/impaktapps-ui-builder/runtime/services/service.ts +6 -5
|
@@ -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,
|
|
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
|
|
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
|
|
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: {
|
|
@@ -8431,7 +8432,7 @@ const sectionLabels = {
|
|
|
8431
8432
|
Timer: ["Core", "Events", "Style", "Validation"],
|
|
8432
8433
|
Rank: ["Core", "Events", "Style", "Validation"],
|
|
8433
8434
|
Button: ["Core", "Properties", "Events", "Style", "Validation"],
|
|
8434
|
-
Array: ["Core", "Components", "Properties", "Validation"],
|
|
8435
|
+
Array: ["Core", "Components", "Properties", "Events", "Validation"],
|
|
8435
8436
|
Radio: ["Core", "Properties", "Events", "Style", "Validation"],
|
|
8436
8437
|
Text: ["Core", "Properties", "Events", "Style", "Validation"],
|
|
8437
8438
|
TextArea: ["Core", "Properties", "Events", "Style", "Validation"],
|
|
@@ -8982,7 +8983,8 @@ const EventSchema = {
|
|
|
8982
8983
|
oneOf: [
|
|
8983
8984
|
{ title: "RankProvider", const: "RankProvider" },
|
|
8984
8985
|
{ title: "Download File", const: "downloadFile" },
|
|
8985
|
-
{ title: "
|
|
8986
|
+
{ title: "downloadFileFromUrl", const: "downloadFileFromUrl" },
|
|
8987
|
+
{ title: "downloadFileFromBase64", const: "downloadFileFromBase64" }
|
|
8986
8988
|
]
|
|
8987
8989
|
},
|
|
8988
8990
|
body: {
|
|
@@ -9934,7 +9936,33 @@ const downloadFile$1 = (obj) => {
|
|
|
9934
9936
|
URL.revokeObjectURL(url);
|
|
9935
9937
|
document.body.removeChild(link);
|
|
9936
9938
|
};
|
|
9937
|
-
|
|
9939
|
+
function downloadFileFromBase64({ data, name }) {
|
|
9940
|
+
var _a;
|
|
9941
|
+
const binary = window.atob(data);
|
|
9942
|
+
const bytes = new Uint8Array(binary.length);
|
|
9943
|
+
for (let i = 0; i < binary.length; i++) {
|
|
9944
|
+
bytes[i] = binary.charCodeAt(i);
|
|
9945
|
+
}
|
|
9946
|
+
const extension = (_a = name.split(".").pop()) == null ? void 0 : _a.toLowerCase();
|
|
9947
|
+
const mimeMap = {
|
|
9948
|
+
pdf: "application/pdf",
|
|
9949
|
+
png: "image/png",
|
|
9950
|
+
jpg: "image/jpeg",
|
|
9951
|
+
jpeg: "image/jpeg",
|
|
9952
|
+
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
9953
|
+
csv: "text/csv"
|
|
9954
|
+
};
|
|
9955
|
+
const blob = new Blob([bytes], {
|
|
9956
|
+
type: mimeMap[extension] || "application/octet-stream"
|
|
9957
|
+
});
|
|
9958
|
+
const url = URL.createObjectURL(blob);
|
|
9959
|
+
const a = document.createElement("a");
|
|
9960
|
+
a.href = url;
|
|
9961
|
+
a.download = name;
|
|
9962
|
+
a.click();
|
|
9963
|
+
URL.revokeObjectURL(url);
|
|
9964
|
+
}
|
|
9965
|
+
const downloadFileFromUrl = (response, service2) => {
|
|
9938
9966
|
let url = `${service2.defaults.baseURL}/${response.path}`;
|
|
9939
9967
|
if (response == null ? void 0 : response.params) {
|
|
9940
9968
|
const keysArray = Object.keys(response == null ? void 0 : response.params);
|
|
@@ -10283,7 +10311,7 @@ var service = (funcParams) => {
|
|
|
10283
10311
|
dynamicData: funcParams.dynamicData,
|
|
10284
10312
|
userValue: funcParams.userValue,
|
|
10285
10313
|
service: funcParams.service,
|
|
10286
|
-
serviceHolder: { downloadFile: downloadFile$1, download:
|
|
10314
|
+
serviceHolder: { downloadFile: downloadFile$1, download: downloadFileFromUrl, downloadFileFromBase64, ...funcParams.functionsProvider },
|
|
10287
10315
|
eventGroups,
|
|
10288
10316
|
functionsProvider: funcParams.functionsProvider,
|
|
10289
10317
|
formDataHolder
|
|
@@ -10493,7 +10521,8 @@ var service = (funcParams) => {
|
|
|
10493
10521
|
}
|
|
10494
10522
|
},
|
|
10495
10523
|
downloadFile: downloadFile$1,
|
|
10496
|
-
|
|
10524
|
+
downloadFileFromUrl,
|
|
10525
|
+
downloadFileFromBase64,
|
|
10497
10526
|
...funcParams.functionsProvider
|
|
10498
10527
|
};
|
|
10499
10528
|
};
|
|
@@ -12299,115 +12328,94 @@ let schema = {
|
|
|
12299
12328
|
properties: {},
|
|
12300
12329
|
required: []
|
|
12301
12330
|
};
|
|
12302
|
-
function
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
items: {
|
|
12317
|
-
oneOf: configObj.value.map((e) => {
|
|
12318
|
-
return { const: e.value, title: e.label };
|
|
12319
|
-
})
|
|
12320
|
-
}
|
|
12321
|
-
};
|
|
12322
|
-
}
|
|
12331
|
+
function buildOneOf(values) {
|
|
12332
|
+
return values.map((e) => ({
|
|
12333
|
+
const: e.value,
|
|
12334
|
+
title: e.label
|
|
12335
|
+
}));
|
|
12336
|
+
}
|
|
12337
|
+
function applyValidations(schemaNode, validations = [], requiredArr, fieldName) {
|
|
12338
|
+
validations.forEach((rule) => {
|
|
12339
|
+
if (rule.validationType === "readOnly") {
|
|
12340
|
+
schemaNode.disabled = true;
|
|
12341
|
+
}
|
|
12342
|
+
if (rule.validationType === "required") {
|
|
12343
|
+
if (requiredArr && fieldName) {
|
|
12344
|
+
requiredArr.push(fieldName);
|
|
12323
12345
|
}
|
|
12346
|
+
} else {
|
|
12347
|
+
schemaNode.type = "string";
|
|
12348
|
+
schemaNode[rule.validationType] = isNaN(rule.validationValue) ? rule.validationValue : Number(rule.validationValue);
|
|
12324
12349
|
}
|
|
12325
|
-
}
|
|
12326
|
-
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12350
|
+
});
|
|
12351
|
+
}
|
|
12352
|
+
function buildNode(config2) {
|
|
12353
|
+
var _a, _b, _c;
|
|
12354
|
+
if (config2.type === "Array") {
|
|
12355
|
+
const arraySchema = {
|
|
12356
|
+
type: "array",
|
|
12357
|
+
items: {
|
|
12358
|
+
type: "object",
|
|
12359
|
+
properties: {},
|
|
12360
|
+
required: []
|
|
12361
|
+
}
|
|
12362
|
+
};
|
|
12363
|
+
(_a = config2.elements) == null ? void 0 : _a.forEach((child) => {
|
|
12364
|
+
var _a2;
|
|
12365
|
+
const childNode = buildNode(child);
|
|
12366
|
+
if (!childNode)
|
|
12367
|
+
return;
|
|
12368
|
+
arraySchema.items.properties[child.name] = childNode.schema;
|
|
12369
|
+
if ((_a2 = childNode.required) == null ? void 0 : _a2.length) {
|
|
12370
|
+
arraySchema.items.required.push(child.name);
|
|
12371
|
+
}
|
|
12372
|
+
});
|
|
12373
|
+
return { schema: arraySchema };
|
|
12374
|
+
}
|
|
12375
|
+
let fieldSchema = {};
|
|
12376
|
+
if ((config2.type === "Select" || config2.type === "MultipleSelect") && ((_b = config2.value) == null ? void 0 : _b.length) > 0) {
|
|
12377
|
+
if (config2.type === "Select") {
|
|
12378
|
+
fieldSchema.oneOf = buildOneOf(config2.value);
|
|
12379
|
+
} else {
|
|
12380
|
+
fieldSchema.type = "array";
|
|
12381
|
+
fieldSchema.items = {
|
|
12382
|
+
oneOf: buildOneOf(config2.value)
|
|
12339
12383
|
};
|
|
12340
12384
|
}
|
|
12341
12385
|
}
|
|
12342
|
-
if (
|
|
12343
|
-
|
|
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
|
-
});
|
|
12386
|
+
if (config2.validation) {
|
|
12387
|
+
applyValidations(fieldSchema, config2.validation);
|
|
12384
12388
|
}
|
|
12389
|
+
const required = ((_c = config2.validation) == null ? void 0 : _c.some(
|
|
12390
|
+
(v) => v.validationType === "required"
|
|
12391
|
+
)) ? [config2.name] : [];
|
|
12392
|
+
return {
|
|
12393
|
+
schema: fieldSchema,
|
|
12394
|
+
required
|
|
12395
|
+
};
|
|
12385
12396
|
}
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
|
|
12390
|
-
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
buildSchema(e, config2.name, config2.type === "Array" ? true : false);
|
|
12402
|
-
});
|
|
12403
|
-
} else {
|
|
12404
|
-
config2.elements.map((e, elemInd) => {
|
|
12405
|
-
buildSchema(e);
|
|
12406
|
-
});
|
|
12397
|
+
function buildSchema(config2) {
|
|
12398
|
+
var _a;
|
|
12399
|
+
const schema2 = {
|
|
12400
|
+
type: "object",
|
|
12401
|
+
properties: {},
|
|
12402
|
+
required: []
|
|
12403
|
+
};
|
|
12404
|
+
(_a = config2.elements) == null ? void 0 : _a.forEach((element) => {
|
|
12405
|
+
var _a2;
|
|
12406
|
+
const node = buildNode(element);
|
|
12407
|
+
if (!node)
|
|
12408
|
+
return;
|
|
12409
|
+
schema2.properties[element.name] = node.schema;
|
|
12410
|
+
if ((_a2 = node.required) == null ? void 0 : _a2.length) {
|
|
12411
|
+
schema2.required.push(element.name);
|
|
12407
12412
|
}
|
|
12413
|
+
});
|
|
12414
|
+
if (schema2.required.length === 0) {
|
|
12415
|
+
delete schema2.required;
|
|
12408
12416
|
}
|
|
12409
|
-
return
|
|
12410
|
-
}
|
|
12417
|
+
return schema2;
|
|
12418
|
+
}
|
|
12411
12419
|
const buildUiSchema = (config2, store2) => {
|
|
12412
12420
|
let elements = {};
|
|
12413
12421
|
const componentScope2 = `#/properties/${config2.name}`;
|
|
@@ -12647,5 +12655,5 @@ const buildUiSchema = (config2, store2) => {
|
|
|
12647
12655
|
}
|
|
12648
12656
|
return elements;
|
|
12649
12657
|
};
|
|
12650
|
-
export { buildConfig, buildSchema, buildUiSchema, clearFromSessionStorage, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
|
|
12658
|
+
export { buildConfig, buildSchema, buildUiSchema, clearFromSessionStorage, downloadFileFromBase64, downloadFileFromUrl, pageMaster, Component as pageMasterComponents, event as pageMasterEvents, service as pageService, schema };
|
|
12651
12659
|
//# sourceMappingURL=impaktapps-ui-builder.es.js.map
|