sf-i-reporting 1.0.53 → 1.0.55
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/dataObjects.d.ts +6 -1
- package/dataObjects.d.ts.map +1 -1
- package/dataObjects.js +27 -17
- package/dataObjects.js.map +1 -1
- package/dev/index.html +3 -2
- package/package.json +3 -2
- package/sf-i-reporting.d.ts +2 -0
- package/sf-i-reporting.d.ts.map +1 -1
- package/sf-i-reporting.js +249 -42
- package/sf-i-reporting.js.map +1 -1
- package/src/dataObjects.ts +16 -1
- package/src/sf-i-reporting.ts +236 -37
package/sf-i-reporting.js
CHANGED
|
@@ -153,6 +153,12 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
153
153
|
}
|
|
154
154
|
console.log('selected values form', form.selectedValues(), form.selectedTexts());
|
|
155
155
|
}
|
|
156
|
+
else if (element.type == "sf-i-form-select") {
|
|
157
|
+
valueObj[element.id] = element.value;
|
|
158
|
+
for (let field of element.selectfields) {
|
|
159
|
+
valueObj[field] = element.value[field];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
156
162
|
else if (element.type == "sf-i-bricks") {
|
|
157
163
|
let bricks = this._SfReportingContainer.querySelector('#' + element.id);
|
|
158
164
|
if (element.savenameseparate == "yes") {
|
|
@@ -384,6 +390,7 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
384
390
|
console.log('dataModel', this.dataModel);
|
|
385
391
|
};
|
|
386
392
|
this.populateView = (scrollTopTarget = 0) => {
|
|
393
|
+
var _a;
|
|
387
394
|
console.log('populating view');
|
|
388
395
|
let html = "";
|
|
389
396
|
// html += `<div class="d-flex justify-between m-20">
|
|
@@ -462,6 +469,20 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
462
469
|
</div>
|
|
463
470
|
</div>`;
|
|
464
471
|
}
|
|
472
|
+
if (this.flow != "details") {
|
|
473
|
+
html += `
|
|
474
|
+
<div class="sf-i-form-modal-container d-flex flex-col hide p-10" part="sf-i-form-modal-container" id="sf-i-form-modal-container">
|
|
475
|
+
<div class="d-flex w-100-m-0 justify-between align-center">
|
|
476
|
+
<button id="button-back" part="button-icon" class="button-icon-click invisible"><span class="material-icons">keyboard_backspace</span></button>
|
|
477
|
+
<button id="button-close-form" part="button-icon" class="button-icon-click"><span class="material-icons">cancel</span></button>
|
|
478
|
+
</div>
|
|
479
|
+
<div class="d-flex w-100-m-0" id="sf-i-form-container" part="sf-i-form-container"></div>
|
|
480
|
+
<div class="d-flex w-100-m-0 justify-center align-center">
|
|
481
|
+
<button id="button-save-form" part="button-icon" class="button-icon-click"><span class="material-icons">check</span></button>
|
|
482
|
+
</div>
|
|
483
|
+
</div>
|
|
484
|
+
`;
|
|
485
|
+
}
|
|
465
486
|
this._SfReportingContainer.innerHTML = html;
|
|
466
487
|
this._SfReportingContainer.style.display = 'block';
|
|
467
488
|
this.initSectionListeners();
|
|
@@ -494,7 +515,7 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
494
515
|
}
|
|
495
516
|
// setTimeout(() => {form.loadMode();},1000)
|
|
496
517
|
}
|
|
497
|
-
if (element.type == "sf-i-bricks") {
|
|
518
|
+
else if (element.type == "sf-i-bricks") {
|
|
498
519
|
console.log('bricks element value', element.value, element.id);
|
|
499
520
|
let bricks = this._SfReportingContainer.querySelector('#' + element.id);
|
|
500
521
|
let selectedDependedValues = [];
|
|
@@ -510,11 +531,6 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
510
531
|
bricks.namesjson = JSON.stringify(values[0]);
|
|
511
532
|
bricks.idsjson = JSON.stringify(values[1]);
|
|
512
533
|
if (element.value != '') {
|
|
513
|
-
// let ids = []
|
|
514
|
-
// for(let val of element.value){
|
|
515
|
-
// console.log('bricks spliting values', val, element.id)
|
|
516
|
-
// ids.push(val.split(';')[1])
|
|
517
|
-
// }
|
|
518
534
|
bricks.prepopulateValJson = JSON.stringify(element.value);
|
|
519
535
|
}
|
|
520
536
|
else {
|
|
@@ -527,7 +543,61 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
527
543
|
else {
|
|
528
544
|
bricks.flow = "edit";
|
|
529
545
|
}
|
|
530
|
-
|
|
546
|
+
}
|
|
547
|
+
else if (element.type == "sf-i-uploader") {
|
|
548
|
+
let uploader = this._SfReportingContainer.querySelector('#' + element.id);
|
|
549
|
+
uploader.prepopulatedInputArr = JSON.stringify((_a = element.value) !== null && _a !== void 0 ? _a : []);
|
|
550
|
+
uploader.readOnly = (this.flow == "details");
|
|
551
|
+
uploader.loadMode();
|
|
552
|
+
}
|
|
553
|
+
else if (element.type == "sf-i-form-select") {
|
|
554
|
+
let buttonEditForm = this._SfReportingContainer.querySelector('#button-edit-form-' + element.id);
|
|
555
|
+
buttonEditForm === null || buttonEditForm === void 0 ? void 0 : buttonEditForm.addEventListener('click', () => {
|
|
556
|
+
var _a;
|
|
557
|
+
let formHtml = `
|
|
558
|
+
<div part="date-container" class="d-flex flex-col flex-grow">
|
|
559
|
+
<label id="${element.id}-label" part="date-label">${element.label}</label>
|
|
560
|
+
<div part="td-body-2"><sf-i-elastic-text text="${element.hint}" minLength="50"></sf-i-elastic-text></div>
|
|
561
|
+
<sf-i-form exportparts="td-action:form-td-action, td-body" id="${element.id}" class="reporting-sf-i-form" part="input-sf-i-form" name="${element.name}" label="" apiId="${element.apiid}" mode="${element.mode}" searchPhrase="${(element.mode == "multiselect-dropdown" ? (this.projectname + "&") : "") + element.searchstring}" selectProjection="${element.selectprojection}" ignoreProjections="${element.ignoredprojections}" ${parseInt(element.maxselect) == 0 ? "" : `maxselect="${element.maxselect}"`} ${element.mandatory != null ? "mandatory=\"\"" : ""}></sf-i-form>
|
|
562
|
+
</div>
|
|
563
|
+
`;
|
|
564
|
+
let formContainer = this._SfReportingContainer.querySelector('#sf-i-form-container');
|
|
565
|
+
formContainer.innerHTML = formHtml;
|
|
566
|
+
let formModalContainer = this._SfReportingContainer.querySelector('#sf-i-form-modal-container');
|
|
567
|
+
formModalContainer.style.display = 'block';
|
|
568
|
+
let formCloseButton = this._SfReportingContainer.querySelector('#button-close-form');
|
|
569
|
+
formCloseButton.addEventListener('click', () => {
|
|
570
|
+
formModalContainer.style.display = 'none';
|
|
571
|
+
});
|
|
572
|
+
let formSaveButton = this._SfReportingContainer.querySelector('#button-save-form');
|
|
573
|
+
let formObj = formContainer.querySelector('#' + element.id);
|
|
574
|
+
console.log('selectedsearchid', element.value);
|
|
575
|
+
if (((_a = element.value.id) !== null && _a !== void 0 ? _a : '') != '') {
|
|
576
|
+
formObj.selectedSearchId = element.value.id;
|
|
577
|
+
console.log('form selectedsearchid', formObj.selectedSearchId);
|
|
578
|
+
}
|
|
579
|
+
formSaveButton.addEventListener('click', () => {
|
|
580
|
+
var _a, _b, _c, _d;
|
|
581
|
+
formModalContainer.style.display = 'none';
|
|
582
|
+
let formObj = formContainer.querySelector('#' + element.id);
|
|
583
|
+
console.log("selected", formObj, element.id);
|
|
584
|
+
for (let dataElement of this.dataModel) {
|
|
585
|
+
if (dataElement.id == element.id) {
|
|
586
|
+
let valObj = {};
|
|
587
|
+
let selectedObj = formObj.selectedEntireValues();
|
|
588
|
+
valObj.id = selectedObj.id;
|
|
589
|
+
let cols = JSON.parse((_b = (_a = selectedObj.fields) === null || _a === void 0 ? void 0 : _a.cols) !== null && _b !== void 0 ? _b : '[]');
|
|
590
|
+
let data = JSON.parse((_d = (_c = selectedObj.fields) === null || _c === void 0 ? void 0 : _c.data) !== null && _d !== void 0 ? _d : '[]');
|
|
591
|
+
for (let [i, col] of cols.entries()) {
|
|
592
|
+
valObj[col] = data[i];
|
|
593
|
+
}
|
|
594
|
+
dataElement.value = valObj;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
this.populateView();
|
|
598
|
+
});
|
|
599
|
+
this.updateShortlistedSearchPhrases(element.id);
|
|
600
|
+
});
|
|
531
601
|
}
|
|
532
602
|
}
|
|
533
603
|
let checkboxPublish = this._SfReportingContainer.querySelector('#input-publish-checkbox');
|
|
@@ -563,7 +633,7 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
563
633
|
let buttonDeleteCancel = this._SfReportingContainer.querySelector('#button-delete-cancel');
|
|
564
634
|
buttonDeleteCancel === null || buttonDeleteCancel === void 0 ? void 0 : buttonDeleteCancel.addEventListener('click', this.deleteCancelClick);
|
|
565
635
|
let buttonDeleteConfirm = this._SfReportingContainer.querySelector('#button-delete-confirm');
|
|
566
|
-
buttonDeleteConfirm === null || buttonDeleteConfirm === void 0 ? void 0 : buttonDeleteConfirm.addEventListener('click', this.
|
|
636
|
+
buttonDeleteConfirm === null || buttonDeleteConfirm === void 0 ? void 0 : buttonDeleteConfirm.addEventListener('click', this.submitDelete);
|
|
567
637
|
let buttonEditCancel = this._SfReportingContainer.querySelector('#button-edit-cancel');
|
|
568
638
|
buttonEditCancel === null || buttonEditCancel === void 0 ? void 0 : buttonEditCancel.addEventListener('click', this.editCancelClick);
|
|
569
639
|
setTimeout(() => {
|
|
@@ -572,7 +642,7 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
572
642
|
}, 500);
|
|
573
643
|
};
|
|
574
644
|
this.prepopulateValues = () => {
|
|
575
|
-
var _a, _b, _c, _d, _e, _f;
|
|
645
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
576
646
|
console.log('prepopulating', this.getPrepopulateJson());
|
|
577
647
|
for (let [i, element] of this.dataModel.entries()) {
|
|
578
648
|
if (isAddButtonObject(element)) {
|
|
@@ -603,19 +673,22 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
603
673
|
else if (element.type == "date") {
|
|
604
674
|
this.dataModel[i].value = (_c = this.getPrepopulateJson()[element.id]) !== null && _c !== void 0 ? _c : '';
|
|
605
675
|
}
|
|
676
|
+
else if (element.type == "sf-i-form-select") {
|
|
677
|
+
this.dataModel[i].value = (_d = this.getPrepopulateJson()[element.id]) !== null && _d !== void 0 ? _d : '';
|
|
678
|
+
}
|
|
606
679
|
else if (element.type == "sf-i-form") {
|
|
607
680
|
if (element.savenameseparate == "yes") {
|
|
608
681
|
this.dataModel[i].value = [this.getPrepopulateJson()[element.id + 'id']];
|
|
609
682
|
// this.dataModel[i].value = (this.getPrepopulateJson()[element.id + 'name'].trim() ?? '') + ';' + (this.getPrepopulateJson()[element.id + 'id'] ?? '')
|
|
610
683
|
}
|
|
611
|
-
else if (((
|
|
684
|
+
else if (((_e = parseInt(element.maxselect)) !== null && _e !== void 0 ? _e : 0) >= 1) {
|
|
612
685
|
if (this.getPrepopulateJson()[element.id + 'id'] != null) {
|
|
613
|
-
this.dataModel[i].value = [(
|
|
686
|
+
this.dataModel[i].value = [(_f = this.getPrepopulateJson()[element.id + 'id']) !== null && _f !== void 0 ? _f : ''];
|
|
614
687
|
}
|
|
615
688
|
else {
|
|
616
689
|
let tempArr = [];
|
|
617
690
|
for (let val of this.getPrepopulateJson()[element.id]) {
|
|
618
|
-
tempArr.push((
|
|
691
|
+
tempArr.push((_g = val.split(';')[1]) !== null && _g !== void 0 ? _g : '');
|
|
619
692
|
}
|
|
620
693
|
this.dataModel[i].value = tempArr;
|
|
621
694
|
}
|
|
@@ -630,6 +703,9 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
630
703
|
this.dataModel[i].value = this.getPrepopulateJson()[element.id];
|
|
631
704
|
}
|
|
632
705
|
}
|
|
706
|
+
else if (element.type == "sf-i-uploader") {
|
|
707
|
+
this.dataModel[i].value = this.getPrepopulateJson()[element.id];
|
|
708
|
+
}
|
|
633
709
|
}
|
|
634
710
|
}
|
|
635
711
|
}
|
|
@@ -700,6 +776,13 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
700
776
|
sectionChildFilledCount++;
|
|
701
777
|
}
|
|
702
778
|
}
|
|
779
|
+
else if (element.type == "sf-i-form-select") {
|
|
780
|
+
console.log('evalshowprogress sf-i-form-select value', element.value, Object.keys(element.value).length, element.mandatory);
|
|
781
|
+
if (Object.keys(element.value).length > 0) {
|
|
782
|
+
filled++;
|
|
783
|
+
sectionChildFilledCount++;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
703
786
|
else if (element.type == "sf-i-bricks") {
|
|
704
787
|
console.log('evalshowprogress sf-i-bricks value', element.value, element.value.length, element.mandatory, element.mandatory != null);
|
|
705
788
|
if (element.value.length > 0) {
|
|
@@ -707,6 +790,13 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
707
790
|
sectionChildFilledCount++;
|
|
708
791
|
}
|
|
709
792
|
}
|
|
793
|
+
else if (element.type == "sf-i-uploader") {
|
|
794
|
+
console.log('evalshowprogress sf-i-uploader value', element.value, element.value.length, element.mandatory, element.mandatory != null);
|
|
795
|
+
if (element.value.length > 0) {
|
|
796
|
+
filled++;
|
|
797
|
+
sectionChildFilledCount++;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
710
800
|
if (element.mandatory != null && flagEval) {
|
|
711
801
|
if (element.value == "" || element.value.length < 1) {
|
|
712
802
|
flagEval = false;
|
|
@@ -914,6 +1004,7 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
914
1004
|
}
|
|
915
1005
|
}
|
|
916
1006
|
}
|
|
1007
|
+
this.checkDependencies(target.id);
|
|
917
1008
|
if (this.evalTimeout != null) {
|
|
918
1009
|
clearTimeout(this.evalTimeout);
|
|
919
1010
|
}
|
|
@@ -980,30 +1071,37 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
980
1071
|
}
|
|
981
1072
|
}
|
|
982
1073
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1074
|
+
this.checkDependencies(target.id);
|
|
1075
|
+
if (this.evalTimeout != null) {
|
|
1076
|
+
clearTimeout(this.evalTimeout);
|
|
1077
|
+
}
|
|
1078
|
+
this.evalTimeout = setTimeout(() => {
|
|
1079
|
+
this.evalShowProgress();
|
|
1080
|
+
}, 2000);
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
let uploaders = this._SfReportingContainer.querySelectorAll('.reporting-sf-i-uploader');
|
|
1084
|
+
for (let uploader of uploaders) {
|
|
1085
|
+
uploader.addEventListener('uploadValid', async (ev) => {
|
|
1086
|
+
let target = ev.target;
|
|
1087
|
+
let genId = target.id.slice(0, target.id.lastIndexOf('-'));
|
|
1088
|
+
console.log('bricks value changed', target.id);
|
|
1089
|
+
for (let [i, element] of this.dataModel.entries()) {
|
|
1090
|
+
if (!isAddButtonObject(element)) {
|
|
1091
|
+
if (element.id == target.id) {
|
|
1092
|
+
this.dataModel[i].value = target.selectedValues();
|
|
1001
1093
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1094
|
+
}
|
|
1095
|
+
else {
|
|
1096
|
+
if (element.schema.indexOf(genId) >= 0) {
|
|
1097
|
+
for (let [j, childElementArr] of element.children.entries()) {
|
|
1098
|
+
for (let [k, childElement] of childElementArr.entries()) {
|
|
1099
|
+
if (childElement.id == target.id) {
|
|
1100
|
+
this.dataModel[i].children[j][k].value = target.selectedValues();
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1004
1104
|
}
|
|
1005
|
-
dependantBricks.loadMode();
|
|
1006
|
-
await Util.delay(500);
|
|
1007
1105
|
}
|
|
1008
1106
|
}
|
|
1009
1107
|
if (this.evalTimeout != null) {
|
|
@@ -1015,6 +1113,90 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1015
1113
|
});
|
|
1016
1114
|
}
|
|
1017
1115
|
};
|
|
1116
|
+
this.checkDependencies = async (id) => {
|
|
1117
|
+
for (let element of this.dataModel) {
|
|
1118
|
+
if (element.dependencies.indexOf(id) >= 0) {
|
|
1119
|
+
let dependantElement = this._SfReportingContainer.querySelector('#' + element.id);
|
|
1120
|
+
console.log('dependant element', dependantElement === null || dependantElement === void 0 ? void 0 : dependantElement.tagName, dependantElement === null || dependantElement === void 0 ? void 0 : dependantElement.id, id);
|
|
1121
|
+
if ((dependantElement === null || dependantElement === void 0 ? void 0 : dependantElement.tagName.toLowerCase()) == "sf-i-bricks") {
|
|
1122
|
+
let dependantBricks = dependantElement;
|
|
1123
|
+
let selectedDependedValues = [];
|
|
1124
|
+
for (let dependency of element.dependencies) {
|
|
1125
|
+
let dependedBricks = this._SfReportingContainer.querySelector('#' + dependency);
|
|
1126
|
+
selectedDependedValues.push(dependedBricks.selectedValueTexts()[0]);
|
|
1127
|
+
}
|
|
1128
|
+
let values = this.getBricksValues(element, selectedDependedValues);
|
|
1129
|
+
console.log('bricks selecteddependantvalues', selectedDependedValues, element.value.length, values[1], element.id);
|
|
1130
|
+
dependantBricks.namesjson = JSON.stringify(values[0]);
|
|
1131
|
+
dependantBricks.idsjson = JSON.stringify(values[1]);
|
|
1132
|
+
if (element.value != '' && element.value.length > 0) {
|
|
1133
|
+
dependantBricks.prepopulateValJson = JSON.stringify(element.value);
|
|
1134
|
+
}
|
|
1135
|
+
else {
|
|
1136
|
+
dependantBricks.prepopulateValJson = JSON.stringify([]);
|
|
1137
|
+
}
|
|
1138
|
+
dependantBricks.loadMode();
|
|
1139
|
+
await Util.delay(500);
|
|
1140
|
+
}
|
|
1141
|
+
else if ((dependantElement === null || dependantElement === void 0 ? void 0 : dependantElement.tagName.toLowerCase()) == "sf-i-form") {
|
|
1142
|
+
let dependantForm = dependantElement;
|
|
1143
|
+
if (dependantForm.mode == "select") {
|
|
1144
|
+
this.updateShortlistedSearchPhrases(dependantForm.id);
|
|
1145
|
+
dependantForm.loadMode();
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
else if ((dependantElement === null || dependantElement === void 0 ? void 0 : dependantElement.tagName.toLowerCase()) == "sf-i-form-select") {
|
|
1149
|
+
let dependantForm = dependantElement;
|
|
1150
|
+
if (dependantForm.mode == "select") {
|
|
1151
|
+
this.updateShortlistedSearchPhrases(dependantForm.id);
|
|
1152
|
+
dependantForm.loadMode();
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
};
|
|
1158
|
+
this.updateShortlistedSearchPhrases = (id) => {
|
|
1159
|
+
for (let dataObj of this.dataModel) {
|
|
1160
|
+
if (dataObj.id == id) {
|
|
1161
|
+
let element = dataObj;
|
|
1162
|
+
let elementForm = this._SfReportingContainer.querySelector('#' + element.id);
|
|
1163
|
+
let tempSearchPhrases = [];
|
|
1164
|
+
for (let dependency of element.dependencies) {
|
|
1165
|
+
console.log('checking dependency', dependency);
|
|
1166
|
+
let dependencyElement = this._SfReportingContainer.querySelector('#' + dependency);
|
|
1167
|
+
if ((dependencyElement === null || dependencyElement === void 0 ? void 0 : dependencyElement.tagName.toLowerCase()) == "sf-i-bricks") {
|
|
1168
|
+
console.log('dependencyelement', dependencyElement.id, dependencyElement.selectedTexts());
|
|
1169
|
+
for (let selectedText of dependencyElement.selectedTexts()) {
|
|
1170
|
+
if (selectedText == '') {
|
|
1171
|
+
continue;
|
|
1172
|
+
}
|
|
1173
|
+
tempSearchPhrases.push(selectedText.replace(/ *\([^)]*\) */g, ""));
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
else if ((dependencyElement === null || dependencyElement === void 0 ? void 0 : dependencyElement.tagName.toLowerCase()) == "sf-i-form") {
|
|
1177
|
+
console.log('dependencyelement', dependencyElement.id, dependencyElement.selectedTexts());
|
|
1178
|
+
for (let selectedText of dependencyElement.selectedTexts()) {
|
|
1179
|
+
if (selectedText == '') {
|
|
1180
|
+
continue;
|
|
1181
|
+
}
|
|
1182
|
+
tempSearchPhrases.push(selectedText.replace(/ *\([^)]*\) */g, ""));
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
else if ((dependencyElement === null || dependencyElement === void 0 ? void 0 : dependencyElement.tagName.toLowerCase()) == "sf-i-form-select") {
|
|
1186
|
+
console.log('dependencyelement', dependencyElement.id, dependencyElement.selectedTexts());
|
|
1187
|
+
for (let selectedText of dependencyElement.selectedTexts()) {
|
|
1188
|
+
if (selectedText == '') {
|
|
1189
|
+
continue;
|
|
1190
|
+
}
|
|
1191
|
+
tempSearchPhrases.push(selectedText.replace(/ *\([^)]*\) */g, ""));
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
elementForm.searchPhrase = tempSearchPhrases.join('&');
|
|
1196
|
+
console.log('shortlistedSearchPhrases', tempSearchPhrases, elementForm.searchPhrase);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1018
1200
|
this.initSectionListeners = () => {
|
|
1019
1201
|
let sectionHeads = (this._SfReportingContainer.querySelectorAll('.section-head'));
|
|
1020
1202
|
for (let sectionHead of sectionHeads) {
|
|
@@ -1048,7 +1230,7 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1048
1230
|
return elementHtml;
|
|
1049
1231
|
};
|
|
1050
1232
|
this.renderElement = (dataObj) => {
|
|
1051
|
-
var _a;
|
|
1233
|
+
var _a, _b, _c;
|
|
1052
1234
|
let elementHtml = "";
|
|
1053
1235
|
console.log('rendering obj', dataObj.type);
|
|
1054
1236
|
if (dataObj.type == "section") {
|
|
@@ -1087,14 +1269,21 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1087
1269
|
elementHtml += `<div part="date-container" class="d-flex flex-col flex-grow">
|
|
1088
1270
|
<label id="${dataObj.id}-label" part="date-label">${dataObj.label}</label>
|
|
1089
1271
|
<div part="td-body-2"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
|
|
1090
|
-
<sf-i-form exportparts="td-action:form-td-action, td-body" id="${dataObj.id}" class="reporting-sf-i-form" part="input-sf-i-form" name="${dataObj.name}" label="" apiId="${dataObj.apiid}" mode="${dataObj.mode}" searchPhrase="${this.projectname + "&" + dataObj.searchstring}" selectProjection="${dataObj.selectprojection}" ignoreProjections="${dataObj.ignoredprojections}" ${parseInt(dataObj.maxselect) == 0 ? "" : `maxselect="${dataObj.maxselect}"`} ${dataObj.mandatory != null ? "mandatory=\"\"" : ""}></sf-i-form>
|
|
1272
|
+
<sf-i-form exportparts="td-action:form-td-action, td-body" id="${dataObj.id}" class="reporting-sf-i-form" part="input-sf-i-form" name="${dataObj.name}" label="" apiId="${dataObj.apiid}" mode="${dataObj.mode}" searchPhrase="${(dataObj.mode == "multiselect-dropdown" ? (this.projectname + "&") : "") + dataObj.searchstring}" selectProjection="${dataObj.selectprojection}" ignoreProjections="${dataObj.ignoredprojections}" ${parseInt(dataObj.maxselect) == 0 ? "" : `maxselect="${dataObj.maxselect}"`} ${dataObj.mandatory != null ? "mandatory=\"\"" : ""}></sf-i-form>
|
|
1273
|
+
</div>`;
|
|
1274
|
+
}
|
|
1275
|
+
else if (dataObj.type == "sf-i-form-select") {
|
|
1276
|
+
elementHtml += `<div part="date-container" class="d-flex flex-col flex-grow">
|
|
1277
|
+
<label id="${dataObj.id}-label" part="date-label">${dataObj.label}</label>
|
|
1278
|
+
<div part="td-body-2"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
|
|
1279
|
+
<div class="d-flex flex-col align-start" part="form-select-container">
|
|
1280
|
+
<div class"d-flex align-center" part="form-selected-value">
|
|
1281
|
+
${(_b = dataObj.value.name) !== null && _b !== void 0 ? _b : ((_c = dataObj.value.reference) !== null && _c !== void 0 ? _c : "")}
|
|
1282
|
+
</div>
|
|
1283
|
+
${(this.flow == "details") ? '' :
|
|
1284
|
+
`<button id="button-edit-form-${dataObj.id}" part="button-icon" class="material-icons button-edit-form button-icon-click">edit</button>`}
|
|
1285
|
+
</div>
|
|
1091
1286
|
</div>`;
|
|
1092
|
-
// elementHtml += `<div part="date-container" class="d-flex flex-col flex-grow">
|
|
1093
|
-
// <label id="${dataObj.id}-label" part="date-label">${dataObj.label}</label>
|
|
1094
|
-
// <div part="td-body"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
|
|
1095
|
-
// <sf-i-form id="${dataObj.id}" class="reporting-sf-i-form" name="${dataObj.name}" label="" apiId="${dataObj.apiid}" mode="${dataObj.mode}" searchPhrase="${this.projectname + "&" + dataObj.searchstring}" selectProjection="${dataObj.selectprojection}" ignoreProjections="${dataObj.ignoredprojections}" ${parseInt(dataObj.maxselect) == 0 ? "" : `maxselect="${dataObj.maxselect}"`} ${dataObj.mandatory != null ? "mandatory=\"\"" : ""}></sf-i-form>
|
|
1096
|
-
// </div>`
|
|
1097
|
-
//${dataObj.value != "" ? (dataObj.mode == "select" ? "" : ("selectedSearchId=\"" + JSON.stringify(dataObj.value).replace(/"/g,""") + "\"")) : ""}
|
|
1098
1287
|
}
|
|
1099
1288
|
else if (dataObj.type == "sf-i-bricks") {
|
|
1100
1289
|
elementHtml += `<div part="date-container" class="d-flex flex-col flex-grow">
|
|
@@ -1103,6 +1292,13 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1103
1292
|
<sf-i-bricks exportparts="input-select-single, selected-container, selected-option, input-select-multi-option, select-option-label, selected-option-label" id="${dataObj.id}" mode="${dataObj.mode}" class="reporting-sf-i-bricks" part="input-sf-i-bricks" name="${dataObj.name}" ${parseInt(dataObj.maxselect) == 0 ? "" : `maxselect="${dataObj.maxselect}"`} ${dataObj.mandatory != null ? "mandatory=\"\"" : ""}></sf-i-bricks>
|
|
1104
1293
|
</div>`;
|
|
1105
1294
|
}
|
|
1295
|
+
else if (dataObj.type == "sf-i-uploader") {
|
|
1296
|
+
elementHtml += `<div part="uploader-container" class="d-flex flex-col flex-grow">
|
|
1297
|
+
<label id="${dataObj.id}-label" part="date-label">${dataObj.label}</label>
|
|
1298
|
+
<div part="td-body-2"><sf-i-elastic-text text="${dataObj.hint}" minLength="50"></sf-i-elastic-text></div>
|
|
1299
|
+
<sf-i-uploader class="reporting-sf-i-uploader" part="input-sf-i-uploader" id="${dataObj.id}" max="${dataObj.maxselect}" apiid="${dataObj.apiid}" allowedextensions="${dataObj.allowedextensions}" extract="${dataObj.extract}" projectid="${this.projectid}" maxsize="${dataObj.maxsize}" allowdownload="${dataObj.allowdownload}"></sf-i-uploader>
|
|
1300
|
+
</div>`;
|
|
1301
|
+
}
|
|
1106
1302
|
return elementHtml;
|
|
1107
1303
|
};
|
|
1108
1304
|
this.populateViewShort = () => {
|
|
@@ -1388,6 +1584,7 @@ let SfIReporting = class SfIReporting extends LitElement {
|
|
|
1388
1584
|
console.log('adding', this.selectedValues());
|
|
1389
1585
|
let url = "https://" + this.apiId + "/add";
|
|
1390
1586
|
let body = { projectid: this.projectid, object: this.selectedValues(), schema: this.getConfigJson(), published: this.published };
|
|
1587
|
+
// console.log('adding', body);
|
|
1391
1588
|
const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
|
|
1392
1589
|
const xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization));
|
|
1393
1590
|
this._SfLoader.innerHTML = '';
|
|
@@ -1987,6 +2184,16 @@ SfIReporting.styles = css `
|
|
|
1987
2184
|
pointer-events: none
|
|
1988
2185
|
}
|
|
1989
2186
|
|
|
2187
|
+
.sf-i-form-modal-container {
|
|
2188
|
+
position: fixed;
|
|
2189
|
+
width: 80%;
|
|
2190
|
+
height: 80%;
|
|
2191
|
+
top: 10%;
|
|
2192
|
+
right: 10%;
|
|
2193
|
+
background-color: white;
|
|
2194
|
+
border: 1px solid #888;
|
|
2195
|
+
overflow: scroll;
|
|
2196
|
+
}
|
|
1990
2197
|
`;
|
|
1991
2198
|
__decorate([
|
|
1992
2199
|
property()
|