Skip to content

Commit 54a588e

Browse files
committed
Add build event to copy assets from Web project.
1 parent a58b44c commit 54a588e

File tree

4 files changed

+402
-2
lines changed

4 files changed

+402
-2
lines changed

assets/reportviewer.net.css

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
html {
2+
font-size: 14px;
3+
}
4+
5+
@media (min-width: 768px) {
6+
html {
7+
font-size: 16px;
8+
}
9+
}
10+
11+
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
12+
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
13+
}
14+
15+
html {
16+
position: relative;
17+
min-height: 100%;
18+
}
19+
20+
body {
21+
margin-bottom: 60px;
22+
}
23+
24+
25+
26+
.reportparameters-container {
27+
display: flex;
28+
flex-direction: row;
29+
flex-wrap: wrap;
30+
position: relative;
31+
}
32+
33+
.reportparam {
34+
margin-bottom: 2rem;
35+
}
36+
37+
.reportparam-list {
38+
min-width: 300px;
39+
max-width: 300px;
40+
max-height: 200px;
41+
overflow: auto;
42+
margin-left: 0.5rem;
43+
}
44+
45+
.reportparam-date, .reportparam-string, .reportparam-boolean {
46+
display: inline-flex;
47+
max-height: 35px;
48+
margin-left: 0.5rem;
49+
}
50+
51+
.reportparam-date input, .reportparam-string input {
52+
width: auto;
53+
margin-left: 0.5rem;
54+
}
55+
56+
.report-viewer {
57+
position: relative;
58+
}
59+
60+
.reportoutput-container {
61+
position: relative;
62+
overflow: auto;
63+
margin-top: 0.75rem;
64+
}
65+
66+
.report-row > div:not(.sub-report-start) {
67+
display: block;
68+
position: sticky;
69+
}
70+
71+
.report-row div p {
72+
width: 100%;
73+
}
74+
75+
.sub-report-start {
76+
display: block;
77+
width: 100%;
78+
}
79+
80+
.report-row div p, .report-row div span {
81+
font-size: 10pt;
82+
font-weight: 400;
83+
}
84+
85+
.report-row p {
86+
margin-bottom: 0;
87+
}
88+
89+
.report-row {
90+
display: flex;
91+
flex-direction: row;
92+
width: 100%;
93+
margin-bottom: 0.75rem;
94+
overflow: hidden;
95+
}
96+
97+
.report-row td div:not(.report-row) {
98+
min-height: 100%;
99+
}
100+
101+
.reportitem-expand {
102+
display: inline-flex;
103+
align-items: center;
104+
height: 20px;
105+
width: 20px;
106+
margin-right: 0.25rem;
107+
float: left;
108+
}
109+
110+
.reportviewer-image {
111+
position: sticky;
112+
}
113+
114+
.reportviewer-table {
115+
position: sticky;
116+
}
117+
118+
.reportviewer-table tbody td {
119+
padding: 0;
120+
height: 1px; /* Fix for div height in table cell */
121+
}
122+
123+
.report-rectangle {
124+
flex-wrap: wrap;
125+
}
126+
127+
.reportviewer-table-pager {
128+
margin-bottom: 1rem;
129+
}
130+
131+
.custom-checkbox .custom-control-label::before {
132+
border-radius: .25rem;
133+
}
134+
135+
.custom-control-label::before, .custom-file-label, .custom-select {
136+
transition: background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
137+
}
138+
139+
.custom-control {
140+
position: relative;
141+
z-index: 1;
142+
display: block;
143+
min-height: 1.5rem;
144+
padding-left: 1.5rem;
145+
-webkit-print-color-adjust: exact;
146+
color-adjust: exact;
147+
print-color-adjust: exact;
148+
line-height: normal;
149+
margin-bottom: 0.5rem;
150+
}
151+
152+
.custom-control-input {
153+
position: absolute;
154+
left: 0;
155+
z-index: -1;
156+
width: 1rem;
157+
height: 1.25rem;
158+
opacity: 0;
159+
}
160+
161+
.custom-control-label {
162+
position: relative;
163+
margin-bottom: 0;
164+
vertical-align: top;
165+
}
166+
167+
.custom-control-label::before {
168+
position: absolute;
169+
top: .25rem;
170+
left: -1.5rem;
171+
display: block;
172+
width: 1rem;
173+
height: 1rem;
174+
pointer-events: none;
175+
content: "";
176+
background-color: #fff;
177+
border: 1px solid #adb5bd;
178+
}
179+
180+
.custom-control-label::after {
181+
position: absolute;
182+
top: .25rem;
183+
left: -1.5rem;
184+
display: block;
185+
width: 1rem;
186+
height: 1rem;
187+
content: "";
188+
background: 50%/50% 50% no-repeat;
189+
}
190+
191+
.custom-checkbox .custom-control-input:checked ~ .custom-control-label::after {
192+
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z'/%3e%3c/svg%3e");
193+
}
194+
195+
.custom-control-label {
196+
font-size: 16px;
197+
padding-left: 0.25rem;
198+
/*padding-bottom: 0.5rem;*/
199+
padding-top: 0.15rem;
200+
}
201+
202+
.custom-control-label::before,
203+
.custom-control-label::after {
204+
width: 1.25rem;
205+
height: 1.25rem;
206+
}
207+
208+
.custom-checkbox .custom-control-input:checked ~ .custom-control-label::after {
209+
background-color: #007bff;
210+
}

assets/reportviewer.net.js

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
function ReportViewer() {
2+
3+
var self = this;
4+
5+
self.toggleItemRequests = [];
6+
self.metadata = [];
7+
8+
function constructReportParameters() {
9+
var eles = $('.report-viewer input');
10+
var dtoArr = [];
11+
var keys = [];
12+
13+
for (var i = 0; i < eles.length; i++) {
14+
var ele = $(eles[i]);
15+
16+
var eleId = ele.attr('id');
17+
var eleName = ele.attr('name');
18+
var multiValue = ele.data('multivalue');
19+
var nullable = ele.data('nullable');
20+
var eleType = ele.attr('type');
21+
var dataType = ele.data('datatype');
22+
var dto = null;
23+
24+
if (keys.indexOf(eleName) === -1) {
25+
dto = {
26+
Name: eleName
27+
};
28+
}
29+
else {
30+
var idx = keys.indexOf(eleName);
31+
dto = dtoArr[idx];
32+
}
33+
34+
if (eleType === 'checkbox') {
35+
if (multiValue) {
36+
if (!dto.Values) {
37+
dto.Values = [];
38+
}
39+
40+
if (ele.is(':checked')) {
41+
dto.Values.push(ele.val());
42+
}
43+
}
44+
else {
45+
if (ele.is(':checked')) {
46+
dto.Value = ele.val();
47+
}
48+
else if (dataType && dataType === 'boolean') {
49+
dto.Value = 'false';
50+
}
51+
}
52+
}
53+
else {
54+
dto.Value = ele.val();
55+
}
56+
57+
if (keys.indexOf(eleName) === -1) {
58+
dtoArr.push(dto);
59+
keys.push(eleName);
60+
}
61+
}
62+
63+
return dtoArr;
64+
}
65+
66+
self.postReportParameters = function () {
67+
var dtoArr = constructReportParameters();
68+
var dto = {
69+
Parameters: dtoArr
70+
};
71+
72+
return $.ajax({
73+
method: 'POST',
74+
url: `/Home/ParameterViewer`,
75+
data: JSON.stringify(dto),
76+
contentType: 'application/json; charset=utf-8'
77+
}).done(function (data, textStatus, jqXHR) {
78+
$('.report-viewer').html(data.value);
79+
80+
$('.report-viewer input:not(.custom-control-input)').on("focusout", function () {
81+
if ($(this).data('requiredparam')) {
82+
self.postReportParameters();
83+
}
84+
});
85+
86+
$('.report-viewer .custom-control-input').on("click", function () {
87+
if ($(this).data('requiredparam')) {
88+
self.postReportParameters();
89+
}
90+
});
91+
92+
$('.report-viewer input[type="checkbox"]').on("change", function (event) {
93+
var id = $(this).attr('id');
94+
var list = id.indexOf('-') > -1;
95+
96+
var multivalue = $(this).data('multivalue');
97+
var checked = this.checked;
98+
99+
if (list) {
100+
var idSplit = id.split('-')[0];
101+
var eles = $('input[id*="' + idSplit + '"]');
102+
103+
if (!multivalue || multivalue === 'false') {
104+
$(eles).prop('checked', false);
105+
}
106+
}
107+
108+
$(this).prop('checked', checked);
109+
});
110+
111+
$('.report-viewer #RunReportBtn').on('click', function () {
112+
self.renderReport();
113+
});
114+
}).fail(function (jqXHR, textStatus, errorThrown) {
115+
console.error(errorThrown);
116+
});
117+
}
118+
119+
self.renderReport = function() {
120+
var dtoArr = constructReportParameters();
121+
var dto = {
122+
Parameters: dtoArr,
123+
ToggleItemRequests: self.toggleItemRequests,
124+
Metadata: self.metadata
125+
};
126+
127+
return $.ajax({
128+
method: 'POST',
129+
url: `/Home/ReportViewer`,
130+
data: JSON.stringify(dto),
131+
contentType: 'application/json; charset=utf-8'
132+
}).done(function (data, textStatus, jqXHR) {
133+
$('.reportoutput-container').html(data.value);
134+
135+
$('button[data-toggler="true"]').on('click', function () {
136+
137+
var togglerName = $(this).data('toggler-name').toString();
138+
var nameIdx = self.toggleItemRequests.indexOf(togglerName);
139+
140+
if (nameIdx > -1) {
141+
self.toggleItemRequests.splice(nameIdx, 1);
142+
}
143+
else {
144+
self.toggleItemRequests.push(togglerName);
145+
}
146+
147+
self.renderReport();
148+
});
149+
150+
$('.report-viewer .reportviewer-table-pager button[data-direction="prev"]').on('click', function (event) {
151+
self.changePage($(this).data('tablename'), 'prev');
152+
});
153+
154+
$('.report-viewer .reportviewer-table-pager button[data-direction="next"]').on('click', function (event) {
155+
self.changePage($(this).data('tablename'), 'next');
156+
});
157+
}).fail(function (jqXHR, textStatus, errorThrown) {
158+
console.error(errorThrown);
159+
});
160+
}
161+
162+
self.changePage = function (name, dir) {
163+
const idx = self.metadata.findIndex((obj) => {
164+
return obj.Key === 'key_tablixpage' && obj.ObjectName === name;
165+
});
166+
167+
if (idx > -1) {
168+
self.metadata[idx].Value = dir === 'prev' ? (parseInt(self.metadata[idx].Value) - 1).toString() : (parseInt(self.metadata[idx].Value) + 1).toString()
169+
}
170+
else {
171+
// Table starts at page 1.
172+
self.metadata.push({
173+
Key: 'key_tablixpage',
174+
ObjectName: name,
175+
Value: dir === 'prev' ? '1' : '2'
176+
});
177+
}
178+
179+
self.renderReport();
180+
}
181+
182+
return {
183+
postReportParameters: self.postReportParameters,
184+
renderReport: self.renderReport
185+
}
186+
}

0 commit comments

Comments
 (0)