@qhealth-design-system/core 1.16.3 → 1.16.4
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/CHANGELOG.md +2 -0
- package/package.json +1 -10
- package/src/components/_global/css/admin/component.scss +19 -23
- package/src/components/_global/css/tags/component.scss +0 -4
- package/src/components/_global/html/scripts.html +9 -16
- package/src/components/_global/js/select_boxes/global.js +36 -0
- package/src/components/a-z_listing/js/global.js +60 -48
- package/src/components/card_no_action/css/component.scss +128 -158
- package/src/components/promo_panel/js/global.js +19 -18
- package/src/data/current.json +0 -6
- package/src/index.js +1 -13
- package/src/styles/global.scss +4 -10
- package/src/components/_global/css/slick/component.scss +0 -25
- package/src/components/_global/js/forms/global.js +0 -335
- package/src/components/_global/js/slick/global.js +0 -153
- package/src/components/_global/js/user_location/global.js +0 -116
- package/src/components/data_table/css/component.scss +0 -832
- package/src/components/data_table/html/component.hbs +0 -20
- package/src/components/data_table/js/global.js +0 -387
- package/src/components/data_table/js/manifest.json +0 -112
- package/src/externals/dsComponentLoader.js +0 -410
- package/src/externals/fb-typeahead.bundle.min.js +0 -6
- package/src/externals/funnelback.autocompletion-2.6.0.js +0 -678
- package/src/html/component-data_table.html +0 -85
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{#with component.data}}
|
|
3
|
-
<section class="qld__body {{metadata.body_background.value}}">
|
|
4
|
-
<div class="container-fluid">
|
|
5
|
-
<div class="qld__data-table {{metadata.table_data_source.value}} {{metadata.table_styling.value}}" id="{{#if metadata.id_field.value}}{{metadata.id_field.value}}{{else}}qld-data-table-{{assetid}}{{/if}}">
|
|
6
|
-
<div class="qld__data-table__header">
|
|
7
|
-
<span class="qld__display-md">{{metadata.table_title.value}}</span>
|
|
8
|
-
<span class="qld__caption">
|
|
9
|
-
{{metadata.table_caption.value}}
|
|
10
|
-
</span>
|
|
11
|
-
</div>
|
|
12
|
-
<div id="qld_data-table_html" class="qld__data-table-content" aria-describedby="" style="display: none">
|
|
13
|
-
{{{metadata.table_in_html.value}}}
|
|
14
|
-
</div>
|
|
15
|
-
<table id="qld_data-table_csv" class="qld__data-table-content" aria-describedby="" data-csv-source="./?a={{metadata.table_data_csv.value}}" style="display: none">
|
|
16
|
-
</table>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</section>
|
|
20
|
-
{{/with}}
|
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
(function () {
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @module dataTable
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
var dataTable = {};
|
|
9
|
-
|
|
10
|
-
function readCSVFile(url, callback) {
|
|
11
|
-
fetch(url)
|
|
12
|
-
.then((response) => {
|
|
13
|
-
if (!response.ok) {
|
|
14
|
-
throw new Error("Error fetching CSV file.");
|
|
15
|
-
}
|
|
16
|
-
return response.text();
|
|
17
|
-
})
|
|
18
|
-
.then((data) => {
|
|
19
|
-
const tableLines = data.split("\n");
|
|
20
|
-
callback(null, tableLines);
|
|
21
|
-
})
|
|
22
|
-
.catch((error) => {
|
|
23
|
-
callback(error);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function getTableHeaderAndFooter(tableLines = []) {
|
|
28
|
-
let tableColumnHeads = [];
|
|
29
|
-
let tableFooterData = [];
|
|
30
|
-
|
|
31
|
-
if (tableLines.length > 0) {
|
|
32
|
-
tableColumnHeads = tableLines.shift().split(","); //whatever is the first element is the header.
|
|
33
|
-
// if (tableLines?.length > 0) { //This allows us to have a separate footer to the header.
|
|
34
|
-
// //If anything left then goes to the footer.
|
|
35
|
-
// tableFooterData = tableLines.pop().split(",");
|
|
36
|
-
// if (tableLines?.length > 0 && !tableFooterData[0]) {
|
|
37
|
-
// tableFooterData = tableLines.pop().split(",");
|
|
38
|
-
// }
|
|
39
|
-
// }
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
header: tableColumnHeads,
|
|
44
|
-
// footer: tableFooterData,
|
|
45
|
-
footer: tableColumnHeads
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function getTableData(tableLines = [], tableColumnHeads) {
|
|
50
|
-
let returnArray = [];
|
|
51
|
-
|
|
52
|
-
let tableLength = tableLines.length - 1;
|
|
53
|
-
|
|
54
|
-
for (let i = 0; i < tableLength; i++) {
|
|
55
|
-
let unprocessedLine = tableLines.shift();
|
|
56
|
-
|
|
57
|
-
let line = unprocessedLine.match(/(".*?"|[^",]+)(?=\s*,|\s*$)/g).map(cell => {
|
|
58
|
-
// Remove surrounding quotes if present
|
|
59
|
-
return cell.replace(/^"(.+(?="$))"$/, '$1');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
let obj = {};
|
|
63
|
-
for (let j = 0; j < line.length; j++) {
|
|
64
|
-
obj[tableColumnHeads[j]] = line[j].replace(/\r/g, "");
|
|
65
|
-
}
|
|
66
|
-
returnArray.push(obj);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return [...returnArray];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function dataTableCsv(tableDiv) {
|
|
73
|
-
|
|
74
|
-
let tableDivId = tableDiv.attr("id");
|
|
75
|
-
tableDivId = '#' + tableDivId;
|
|
76
|
-
|
|
77
|
-
const csvTable = tableDiv.children("#qld_data-table_csv");
|
|
78
|
-
csvTable.css("display", "table");
|
|
79
|
-
|
|
80
|
-
const csvFileURL = csvTable.attr('data-csv-source');
|
|
81
|
-
|
|
82
|
-
readCSVFile(csvFileURL, (err, tableLines) => {
|
|
83
|
-
if (err) { //the file reader is prone to throwing errors - CORS errors etc.
|
|
84
|
-
console.log("Error: ", err);
|
|
85
|
-
csvTable.css("display", "none");
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
let tableHeaderAndFooter = getTableHeaderAndFooter(tableLines);
|
|
89
|
-
|
|
90
|
-
let tableColumnHeads = tableHeaderAndFooter.header;
|
|
91
|
-
let tableFooterData = tableHeaderAndFooter.footer;
|
|
92
|
-
var tableData = getTableData(tableLines, tableColumnHeads); //this name needs to be changed
|
|
93
|
-
|
|
94
|
-
// Defining variblers that are included in the table using the processed data from the functions.
|
|
95
|
-
let tableColumns = tableColumnHeads.map((column) => {
|
|
96
|
-
return { data: column, title: column };
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
let footerHasContent = false;
|
|
100
|
-
|
|
101
|
-
const QLD_DataTable = $(csvTable).DataTable({
|
|
102
|
-
"sScrollX": "100%",
|
|
103
|
-
"sScrollXInner": "100%",
|
|
104
|
-
"bScrollCollapse": true,
|
|
105
|
-
data: tableData ? tableData : [],
|
|
106
|
-
columns: tableColumns ? tableColumns : [],
|
|
107
|
-
dom: '<"top"if>rt<"bottom"lp><"clear">',
|
|
108
|
-
pagingType: "simple_numbers",
|
|
109
|
-
pagingTag: "li",
|
|
110
|
-
language: {
|
|
111
|
-
paginate: {
|
|
112
|
-
previous: `<button rel="prev"
|
|
113
|
-
aria-label="Next page of results" class="qld__search-pagination_link">
|
|
114
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true" focusable="false"
|
|
115
|
-
width="16" height="16" role="img">
|
|
116
|
-
<path fill="currentColor"
|
|
117
|
-
d="M448 256C448 264.8 440.6 272 431.4 272H54.11l140.7 149.3c6.157 6.531 5.655 16.66-1.118 22.59C190.5 446.6 186.5 448 182.5 448c-4.505 0-9.009-1.75-12.28-5.25l-165.9-176c-5.752-6.094-5.752-15.41 0-21.5l165.9-176c6.19-6.562 16.69-7 23.45-1.094c6.773 5.938 7.275 16.06 1.118 22.59L54.11 240h377.3C440.6 240 448 247.2 448 256z">
|
|
118
|
-
</path>
|
|
119
|
-
</svg><span>Back</span>
|
|
120
|
-
</button>`,
|
|
121
|
-
next: `<button rel="next" aria-label="Next page of results" class="qld__search-pagination_link">
|
|
122
|
-
<span>Next</span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true" focusable="false" width="16" height="16" role="img"><path fill="currentColor" d="M443.7 266.8l-165.9 176C274.5 446.3 269.1 448 265.5 448c-3.986 0-7.988-1.375-11.16-4.156c-6.773-5.938-7.275-16.06-1.118-22.59L393.9 272H16.59c-9.171 0-16.59-7.155-16.59-15.1S7.421 240 16.59 240h377.3l-140.7-149.3c-6.157-6.531-5.655-16.66 1.118-22.59c6.789-5.906 17.27-5.469 23.45 1.094l165.9 176C449.4 251.3 449.4 260.7 443.7 266.8z"></path></svg>
|
|
123
|
-
</button>`,
|
|
124
|
-
},
|
|
125
|
-
sEmptyTable: "No data available in table",
|
|
126
|
-
sInfo: "<span class='qld__data-table-item-numbers'><span class='qld__data-table-item-numbers-heading'>Showing:</span> _START_-_END_ of <span class='qld__data-table-item-numbers-total'>_TOTAL_ entries</span></span>",
|
|
127
|
-
sInfoEmpty:
|
|
128
|
-
"<span class='qld__data-table-item-numbers'><span class='qld__data-table-item-numbers-heading'>Showing:</span> 0-0 of <span class='qld__data-table-item-numbers-total'>0 entries</span></span>",
|
|
129
|
-
sInfoFiltered: "(filtered from _MAX_ total entries)",
|
|
130
|
-
sInfoPostFix: "",
|
|
131
|
-
sDecimal: "",
|
|
132
|
-
sThousands: ",",
|
|
133
|
-
sLengthMenu: "<span>Items per page</span> _MENU_",
|
|
134
|
-
sLoadingRecords: "Loading...",
|
|
135
|
-
sProcessing: "",
|
|
136
|
-
sSearch: `Search:<input type="search" id="qld__data-table__search-field" name="query" class="qld__text-input" autocomplete="off" value=""></input>`,
|
|
137
|
-
sSearchPlaceholder: "",
|
|
138
|
-
sUrl: "",
|
|
139
|
-
sZeroRecords: "No matching records found",
|
|
140
|
-
},
|
|
141
|
-
columnDefs: [
|
|
142
|
-
{
|
|
143
|
-
targets: -1,
|
|
144
|
-
className: "dt-body-right",
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
oClasses: {
|
|
148
|
-
sFilterInput: "qld__text-input",
|
|
149
|
-
sPageButton: "qld__search-pagination_link ",
|
|
150
|
-
sPageButtonActive: "active",
|
|
151
|
-
sPageButtonDisabled: "disabled",
|
|
152
|
-
sPaging: "dataTables_paginate paging_ qld__search-pagination "
|
|
153
|
-
},
|
|
154
|
-
drawCallback: function (settings) {
|
|
155
|
-
var parentDiv = $(tableDivId + " div.qld__search-pagination");
|
|
156
|
-
var ulElement = $(
|
|
157
|
-
'<ul class="qld__search-pagination__list"></ul>'
|
|
158
|
-
);
|
|
159
|
-
parentDiv.children().appendTo(ulElement);
|
|
160
|
-
ulElement.appendTo(parentDiv);
|
|
161
|
-
|
|
162
|
-
$(".qld__search-pagination_link").each(function () {
|
|
163
|
-
var $this = $(this);
|
|
164
|
-
if (
|
|
165
|
-
$this.children("a").length === 0 &&
|
|
166
|
-
$this.children("button").length === 0 &&
|
|
167
|
-
$this.children("span").length === 0 &&
|
|
168
|
-
$this.children("svg").length === 0
|
|
169
|
-
) {
|
|
170
|
-
var textContent = $this.text();
|
|
171
|
-
$this.html(
|
|
172
|
-
'<button type="button" class="num">' + textContent + "</button>"
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
$(".qld__search-pagination__list span:not([class])").each(
|
|
178
|
-
function () {
|
|
179
|
-
var $span = $(this);
|
|
180
|
-
|
|
181
|
-
// Move the nested <li> elements outside of the <span>
|
|
182
|
-
$span.before($span.contents());
|
|
183
|
-
|
|
184
|
-
// Remove the empty <span>
|
|
185
|
-
$span.remove();
|
|
186
|
-
}
|
|
187
|
-
);
|
|
188
|
-
$("li.previous").addClass("prev"); //adding the appropriate class
|
|
189
|
-
// Remove role="link" and tabindex="0" from <li> elements in pagination
|
|
190
|
-
$('li.qld__search-pagination_link[role="link"]').removeAttr('role');
|
|
191
|
-
$('li.qld__search-pagination_link').removeAttr('tabindex');
|
|
192
|
-
// Remove the aria-label attribute
|
|
193
|
-
$(tableDivId + " .dataTables_wrapper th").removeAttr('aria-label');
|
|
194
|
-
|
|
195
|
-
// Update sortable <th> elements
|
|
196
|
-
$(tableDivId + " .dataTables_wrapper th[tabindex='0']").each(function () {
|
|
197
|
-
const $this = $(this);
|
|
198
|
-
|
|
199
|
-
// Remove the tabindex attribute
|
|
200
|
-
$this.removeAttr("tabindex");
|
|
201
|
-
|
|
202
|
-
// Replace the content with a button
|
|
203
|
-
const textContent = $this.text().trim(); // Get the current text
|
|
204
|
-
$this.html('<button type="button" class="sortable-header-btn qld__data-table__btn">' + textContent + "</button>");
|
|
205
|
-
});
|
|
206
|
-
},
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
QLD_DataTable.on("order.dt", function () {
|
|
210
|
-
let order = QLD_DataTable.order()[0]; // Get the column index being sorted
|
|
211
|
-
let columns = QLD_DataTable.columns(); // Get all columns in the table
|
|
212
|
-
|
|
213
|
-
$(`${tableDivId} > #qld_data-table_csv tfoot th`).removeClass(
|
|
214
|
-
"sorting_asc sorting_desc sorting sorting_1"
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
$(tableDivId + " > #qld_data-table_csv tfoot th:nth-child(" + (order[0] + 1) + ")"
|
|
218
|
-
).addClass("sorting_1");
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
if (footerHasContent) {
|
|
222
|
-
$(`${tableDivId} > #qld_data-table_csv`)
|
|
223
|
-
.append(
|
|
224
|
-
$("<tfoot class='qld__data-table-footer' />").append(
|
|
225
|
-
tableFooter
|
|
226
|
-
)
|
|
227
|
-
)
|
|
228
|
-
.addClass("qld__table");
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function dataTableHtml(tableDiv) {
|
|
234
|
-
|
|
235
|
-
let tableDivId = tableDiv.attr("id");
|
|
236
|
-
tableDivId = '#' + tableDivId;
|
|
237
|
-
|
|
238
|
-
const htmlTable = tableDiv.children("#qld_data-table_html");
|
|
239
|
-
htmlTable.css("display", "block");
|
|
240
|
-
const tableElement = $(tableDivId + " #qld_data-table_html table");
|
|
241
|
-
|
|
242
|
-
const QLD_DataTable = tableElement.DataTable({
|
|
243
|
-
"sScrollX": "100%",
|
|
244
|
-
"sScrollXInner": "100%",
|
|
245
|
-
"bScrollCollapse": true,
|
|
246
|
-
dom: '<"top"if>rt<"bottom"lp><"clear">',
|
|
247
|
-
pagingType: "simple_numbers",
|
|
248
|
-
pagingTag: "li",
|
|
249
|
-
language: {
|
|
250
|
-
paginate: {
|
|
251
|
-
previous: `<button rel="prev"
|
|
252
|
-
aria-label="Next page of results" class="qld__search-pagination_link">
|
|
253
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true" focusable="false"
|
|
254
|
-
width="16" height="16" role="img">
|
|
255
|
-
<path fill="currentColor"
|
|
256
|
-
d="M448 256C448 264.8 440.6 272 431.4 272H54.11l140.7 149.3c6.157 6.531 5.655 16.66-1.118 22.59C190.5 446.6 186.5 448 182.5 448c-4.505 0-9.009-1.75-12.28-5.25l-165.9-176c-5.752-6.094-5.752-15.41 0-21.5l165.9-176c6.19-6.562 16.69-7 23.45-1.094c6.773 5.938 7.275 16.06 1.118 22.59L54.11 240h377.3C440.6 240 448 247.2 448 256z">
|
|
257
|
-
</path>
|
|
258
|
-
</svg><span>Back</span>
|
|
259
|
-
</button>`,
|
|
260
|
-
next: `<button rel="next" aria-label="Next page of results" class="qld__search-pagination_link">
|
|
261
|
-
<span>Next</span><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" aria-hidden="true" focusable="false" width="16" height="16" role="img"><path fill="currentColor" d="M443.7 266.8l-165.9 176C274.5 446.3 269.1 448 265.5 448c-3.986 0-7.988-1.375-11.16-4.156c-6.773-5.938-7.275-16.06-1.118-22.59L393.9 272H16.59c-9.171 0-16.59-7.155-16.59-15.1S7.421 240 16.59 240h377.3l-140.7-149.3c-6.157-6.531-5.655-16.66 1.118-22.59c6.789-5.906 17.27-5.469 23.45 1.094l165.9 176C449.4 251.3 449.4 260.7 443.7 266.8z"></path></svg>
|
|
262
|
-
</button>`,
|
|
263
|
-
},
|
|
264
|
-
sEmptyTable: "No data available in table",
|
|
265
|
-
sInfo: "<span class='qld__data-table-item-numbers'><span class='qld__data-table-item-numbers-heading'>Showing:</span> _START_-_END_ of <span class='qld__data-table-item-numbers-total'>_TOTAL_ entries</span></span>",
|
|
266
|
-
sInfoEmpty:
|
|
267
|
-
"<span class='qld__data-table-item-numbers'><span class='qld__data-table-item-numbers-heading'>Showing:</span> 0-0 of <span class='qld__data-table-item-numbers-total'>0 entries</span></span>",
|
|
268
|
-
sInfoFiltered: "(filtered from _MAX_ total entries)",
|
|
269
|
-
sInfoPostFix: "",
|
|
270
|
-
sDecimal: "",
|
|
271
|
-
sThousands: ",",
|
|
272
|
-
sLengthMenu: "<span>Items per page</span> _MENU_",
|
|
273
|
-
sLoadingRecords: "Loading...",
|
|
274
|
-
sProcessing: "",
|
|
275
|
-
sSearch: `Search:<input type="search" id="qld__data-table__search-field" name="query" class="qld__text-input" autocomplete="off" value=""></input>`,
|
|
276
|
-
sSearchPlaceholder: "",
|
|
277
|
-
sUrl: "",
|
|
278
|
-
sZeroRecords: "No matching records found",
|
|
279
|
-
},
|
|
280
|
-
columnDefs: [
|
|
281
|
-
{
|
|
282
|
-
targets: -1,
|
|
283
|
-
className: "dt-body-right",
|
|
284
|
-
},
|
|
285
|
-
],
|
|
286
|
-
oClasses: {
|
|
287
|
-
sFilterInput: "qld__text-input",
|
|
288
|
-
sPageButton: "qld__search-pagination_link ",
|
|
289
|
-
sPageButtonActive: "active",
|
|
290
|
-
sPageButtonDisabled: "disabled",
|
|
291
|
-
sPaging: "dataTables_paginate paging_ qld__search-pagination ",
|
|
292
|
-
|
|
293
|
-
},
|
|
294
|
-
drawCallback: function (settings) {
|
|
295
|
-
var parentDiv = $(tableDivId + " div.qld__search-pagination");
|
|
296
|
-
var ulElement = $(
|
|
297
|
-
'<ul class="qld__search-pagination__list"></ul>'
|
|
298
|
-
);
|
|
299
|
-
parentDiv.children().appendTo(ulElement);
|
|
300
|
-
ulElement.appendTo(parentDiv);
|
|
301
|
-
|
|
302
|
-
$(".qld__search-pagination_link").each(function () {
|
|
303
|
-
var $this = $(this);
|
|
304
|
-
if (
|
|
305
|
-
$this.children("a").length === 0 &&
|
|
306
|
-
$this.children("button").length === 0 &&
|
|
307
|
-
$this.children("span").length === 0 &&
|
|
308
|
-
$this.children("svg").length === 0
|
|
309
|
-
) {
|
|
310
|
-
var textContent = $this.text();
|
|
311
|
-
$this.html('<button class="num">' + textContent + "</button>");
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
|
|
315
|
-
$(".qld__search-pagination__list span:not([class])").each(
|
|
316
|
-
function () {
|
|
317
|
-
var $span = $(this);
|
|
318
|
-
|
|
319
|
-
// Move the nested <li> elements outside of the <span>
|
|
320
|
-
$span.before($span.contents());
|
|
321
|
-
|
|
322
|
-
// Remove the empty <span>
|
|
323
|
-
$span.remove();
|
|
324
|
-
}
|
|
325
|
-
);
|
|
326
|
-
$("li.previous").addClass("prev"); //adding the appropriate class
|
|
327
|
-
// Remove role="link" and tabindex="0" from <li> elements in pagination
|
|
328
|
-
$('li.qld__search-pagination_link[role="link"]').removeAttr('role');
|
|
329
|
-
$('li.qld__search-pagination_link').removeAttr('tabindex');
|
|
330
|
-
// Remove the aria-label attribute
|
|
331
|
-
$(tableDivId + " .dataTables_wrapper th").removeAttr('aria-label');
|
|
332
|
-
|
|
333
|
-
// Update sortable <th> elements
|
|
334
|
-
$(tableDivId + " .dataTables_wrapper th[tabindex='0']").each(function () {
|
|
335
|
-
const $this = $(this);
|
|
336
|
-
|
|
337
|
-
// Remove the tabindex attribute
|
|
338
|
-
$this.removeAttr("tabindex");
|
|
339
|
-
|
|
340
|
-
// Replace the content with a button
|
|
341
|
-
const textContent = $this.text().trim(); // Get the current text
|
|
342
|
-
$this.html('<button type="button" class="sortable-header-btn qld__data-table__btn">' + textContent + "</button>");
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
},
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
$( // this line enforces the correct sorting class to the html table's first column's footer.
|
|
349
|
-
tableDivId + " #qld_table_html tfoot tr th:first-child"
|
|
350
|
-
).addClass("sorting_1");
|
|
351
|
-
|
|
352
|
-
QLD_DataTable.on("order.dt", function () {
|
|
353
|
-
let order = QLD_DataTable.order()[0]; // Get the column index being sorted
|
|
354
|
-
|
|
355
|
-
$(tableDivId + " #qld_table_html tfoot tr th").removeClass(
|
|
356
|
-
"sorting_asc sorting_desc sorting sorting_1"
|
|
357
|
-
);
|
|
358
|
-
|
|
359
|
-
$(
|
|
360
|
-
tableDivId + " #qld_table_html tfoot tr th:nth-child(" + (order[0] + 1) + ")"
|
|
361
|
-
).addClass("sorting_1");
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function triggerFunctionBasedOnClass(tableDiv) {
|
|
366
|
-
|
|
367
|
-
if (tableDiv.hasClass("qld__data-table--csv")) {
|
|
368
|
-
dataTableCsv(tableDiv);
|
|
369
|
-
} else if (tableDiv.hasClass("qld__data-table--html")) {
|
|
370
|
-
dataTableHtml(tableDiv);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
dataTable.init = function () {
|
|
375
|
-
|
|
376
|
-
const tableDivs = $(".qld__data-table");
|
|
377
|
-
|
|
378
|
-
for(let tableDiv of tableDivs) {
|
|
379
|
-
triggerFunctionBasedOnClass($(tableDiv));
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
QLD.dataTable = dataTable;
|
|
384
|
-
|
|
385
|
-
document.addEventListener("DOMContentLoaded", QLD.dataTable.init);
|
|
386
|
-
|
|
387
|
-
})();
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"component": {
|
|
3
|
-
"name": "data_table",
|
|
4
|
-
"description": "",
|
|
5
|
-
"version": "1.0",
|
|
6
|
-
"status": "In Development",
|
|
7
|
-
"data": {
|
|
8
|
-
"assetid": "123",
|
|
9
|
-
"metadata": {
|
|
10
|
-
"body_background": {
|
|
11
|
-
"type": "metadata_field_select",
|
|
12
|
-
"description": "",
|
|
13
|
-
"friendly_name": "Background colour",
|
|
14
|
-
"value": "",
|
|
15
|
-
"options": {
|
|
16
|
-
"": "White",
|
|
17
|
-
"qld__body--light": "Light",
|
|
18
|
-
"qld__body--dark": "Dark"
|
|
19
|
-
},
|
|
20
|
-
"required": false,
|
|
21
|
-
"editable": true
|
|
22
|
-
},
|
|
23
|
-
"table_styling": {
|
|
24
|
-
"type": "metadata_field_select",
|
|
25
|
-
"description": "",
|
|
26
|
-
"friendly_name": "Table styling",
|
|
27
|
-
"value": "qld__table--striped",
|
|
28
|
-
"options": {
|
|
29
|
-
"": "Default",
|
|
30
|
-
"qld__table--striped": "Striped"
|
|
31
|
-
},
|
|
32
|
-
"required": false,
|
|
33
|
-
"editable": true
|
|
34
|
-
},
|
|
35
|
-
"table_title": {
|
|
36
|
-
"type": "metadata_field_text",
|
|
37
|
-
"description": "A text field",
|
|
38
|
-
"friendly_name": "Table title",
|
|
39
|
-
"value": "Table title",
|
|
40
|
-
"required": false,
|
|
41
|
-
"editable": true
|
|
42
|
-
},
|
|
43
|
-
"table_caption": {
|
|
44
|
-
"type": "metadata_field_text",
|
|
45
|
-
"description": "A text field",
|
|
46
|
-
"friendly_name": "Table caption",
|
|
47
|
-
"value": "Table caption",
|
|
48
|
-
"required": false,
|
|
49
|
-
"editable": true
|
|
50
|
-
},
|
|
51
|
-
"table_data_source": {
|
|
52
|
-
"type": "metadata_field_select",
|
|
53
|
-
"description": "",
|
|
54
|
-
"friendly_name": "Data source",
|
|
55
|
-
"value": "qld__data-table--csv",
|
|
56
|
-
"options": {
|
|
57
|
-
"qld__data-table--csv": "csv",
|
|
58
|
-
"qld__data-table--html": "html"
|
|
59
|
-
},
|
|
60
|
-
"required": false,
|
|
61
|
-
"editable": true
|
|
62
|
-
},
|
|
63
|
-
"table_data_csv": {
|
|
64
|
-
"value": "http://localhost:8080/mysource_files/data-tables-csv-test.csv",
|
|
65
|
-
"fieldid": "",
|
|
66
|
-
"friendly_name": "Table data CSV",
|
|
67
|
-
"type": "metadata_field_related_asset",
|
|
68
|
-
"is_contextable": true,
|
|
69
|
-
"default_value": false,
|
|
70
|
-
"use_default": true,
|
|
71
|
-
"display_if" : {
|
|
72
|
-
"show": true,
|
|
73
|
-
"operator": "AND",
|
|
74
|
-
"rules": [{
|
|
75
|
-
"field": "table_data_source",
|
|
76
|
-
"operator": "equals",
|
|
77
|
-
"value": "qld__data-table--csv"
|
|
78
|
-
}]
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"table_in_html": {
|
|
82
|
-
"type": "metadata_field_wysiwyg",
|
|
83
|
-
"description": "Content to display",
|
|
84
|
-
"friendly_name": "Table in HTML",
|
|
85
|
-
"value": "<table id='qld_table_html' class=''><thead><tr><th>Name</th><th>Position</th><th>Office</th><th>Age</th><th>Start date</th><th>Salary</th></tr></thead><tbody><tr><td>Tiger Nixon</td><td>System Architect</td><td>Edinburgh</td><td>61</td><td>2011-04-25</td><td>$320,800</td></tr><tr><td>Garrett Winters</td><td>Accountant</td><td>Tokyo</td><td>63</td><td>2011-07-25</td><td>$170,750</td></tr><tr><td>Ashton Cox</td><td>Junior Technical Author</td><td>San Francisco</td><td>66</td><td>2009-01-12</td><td>$86,000</td></tr><tr><td>Cedric Kelly</td><td>Senior Javascript Developer</td><td>Edinburgh</td><td>22</td><td>2012-03-29</td><td>$433,060</td></tr><tr><td>Airi Satou</td><td>Accountant</td><td>Tokyo</td><td>33</td><td>2008-11-28</td><td>$162,700</td></tr><tr><td>Brielle Williamson</td><td>Integration Specialist</td><td>New York</td><td>61</td><td>2012-12-02</td><td>$372,000</td></tr><tr><td>Herrod Chandler</td><td>Sales Assistant</td><td>San Francisco</td><td>59</td><td>2012-08-06</td><td>$137,500</td></tr><tr><td>Rhona Davidson</td><td>Integration Specialist</td><td>Tokyo</td><td>55</td><td>2010-10-14</td><td>$327,900</td></tr><tr><td>Colleen Hurst</td><td>Javascript Developer</td><td>San Francisco</td><td>39</td><td>2009-09-15</td><td>$205,500</td></tr><tr><td>Sonya Frost</td><td>Software Engineer</td><td>Edinburgh</td><td>23</td><td>2008-12-13</td><td>$103,600</td></tr><tr><td>Jena Gaines</td><td>Office Manager</td><td>London</td><td>30</td><td>2008-12-19</td><td>$90,560</td></tr><tr><td>Quinn Flynn</td><td>Support Lead</td><td>Edinburgh</td><td>22</td><td>2013-03-03</td><td>$342,000</td></tr><tr><td>Charde Marshall</td><td>Regional Director</td><td>San Francisco</td><td>36</td><td>2008-10-16</td><td>$470,600</td></tr><tr><td>Haley Kennedy</td><td>Senior Marketing Designer</td><td>London</td><td>43</td><td>2012-12-18</td><td>$313,500</td></tr><tr><td>Tatyana Fitzpatrick</td><td>Regional Director</td><td>London</td><td>19</td><td>2010-03-17</td><td>$385,750</td></tr><tr><td>Michael Silva</td><td>Marketing Designer</td><td>London</td><td>66</td><td>2012-11-27</td><td>$198,500</td></tr><tr><td>Paul Byrd</td><td>Chief Financial Officer (CFO)</td><td>New York</td><td>64</td><td>2010-06-09</td><td>$725,000</td></tr><tr><td>Gloria Little</td><td>Systems Administrator</td><td>New York</td><td>59</td><td>2009-04-10</td><td>$237,500</td></tr><tr><td>Bradley Greer</td><td>Software Engineer</td><td>London</td><td>41</td><td>2012-10-13</td><td>$132,000</td></tr><tr><td>Dai Rios</td><td>Personnel Lead</td><td>Edinburgh</td><td>35</td><td>2012-09-26</td><td>$217,500</td></tr><tr><td>Jenette Caldwell</td><td>Development Lead</td><td>New York</td><td>30</td><td>2011-09-03</td><td>$345,000</td></tr><tr><td>Yuri Berry</td><td>Chief Marketing Officer (CMO)</td><td>New York</td><td>40</td><td>2009-06-25</td><td>$675,000</td></tr><tr><td>Caesar Vance</td><td>Pre-Sales Support</td><td>New York</td><td>21</td><td>2011-12-12</td><td>$106,450</td></tr><tr><td>Doris Wilder</td><td>Sales Assistant</td><td>Sydney</td><td>23</td><td>2010-09-20</td><td>$85,600</td></tr><tr><td>Angelica Ramos</td><td>Chief Executive Officer (CEO)</td><td>London</td><td>47</td><td>2009-10-09</td><td>$1,200,000</td></tr><tr><td>Gavin Joyce</td><td>Developer</td><td>Edinburgh</td><td>42</td><td>2010-12-22</td><td>$92,575</td></tr><tr><td>Jennifer Chang</td><td>Regional Director</td><td>Singapore</td><td>28</td><td>2010-11-14</td><td>$357,650</td></tr><tr><td>Brenden Wagner</td><td>Software Engineer</td><td>San Francisco</td><td>28</td><td>2011-06-07</td><td>$206,850</td></tr><tr><td>Fiona Green</td><td>Chief Operating Officer (COO)</td><td>San Francisco</td><td>48</td><td>2010-03-11</td><td>$850,000</td></tr><tr><td>Shou Itou</td><td>Regional Marketing</td><td>Tokyo</td><td>20</td><td>2011-08-14</td><td>$163,000</td></tr><tr><td>Michelle House</td><td>Integration Specialist</td><td>Sydney</td><td>37</td><td>2011-06-02</td><td>$95,400</td></tr><tr><td>Suki Burks</td><td>Developer</td><td>London</td><td>53</td><td>2009-10-22</td><td>$114,500</td></tr><tr><td>Prescott Bartlett</td><td>Technical Author</td><td>London</td><td>27</td><td>2011-05-07</td><td>$145,000</td></tr><tr><td>Gavin Cortez</td><td>Team Leader</td><td>San Francisco</td><td>22</td><td>2008-10-26</td><td>$235,500</td></tr><tr><td>Martena Mccray</td><td>Post-Sales support</td><td>Edinburgh</td><td>46</td><td>2011-03-09</td><td>$324,050</td></tr><tr><td>Unity Butler</td><td>Marketing Designer</td><td>San Francisco</td><td>47</td><td>2009-12-09</td><td>$85,675</td></tr><tr><td>Howard Hatfield</td><td>Office Manager</td><td>San Francisco</td><td>51</td><td>2008-12-16</td><td>$164,500</td></tr><tr><td>Hope Fuentes</td><td>Secretary</td><td>San Francisco</td><td>41</td><td>2010-02-12</td><td>$109,850</td></tr><tr><td>Vivian Harrell</td><td>Financial Controller</td><td>San Francisco</td><td>62</td><td>2009-02-14</td><td>$452,500</td></tr><tr><td>Timothy Mooney</td><td>Office Manager</td><td>London</td><td>37</td><td>2008-12-11</td><td>$136,200</td></tr><tr><td>Jackson Bradshaw</td><td>Director</td><td>New York</td><td>65</td><td>2008-09-26</td><td>$645,750</td></tr><tr><td>Olivia Liang</td><td>Support Engineer</td><td>Singapore</td><td>64</td><td>2011-02-03</td><td>$234,500</td></tr><tr><td>Bruno Nash</td><td>Software Engineer</td><td>London</td><td>38</td><td>2011-05-03</td><td>$163,500</td></tr><tr><td>Sakura Yamamoto</td><td>Support Engineer</td><td>Tokyo</td><td>37</td><td>2009-08-19</td><td>$139,575</td></tr><tr><td>Thor Walton</td><td>Developer</td><td>New York</td><td>61</td><td>2013-08-11</td><td>$98,540</td></tr><tr><td>Finn Camacho</td><td>Support Engineer</td><td>San Francisco</td><td>47</td><td>2009-07-07</td><td>$87,500</td></tr><tr><td>Serge Baldwin</td><td>Data Coordinator</td><td>Singapore</td><td>64</td><td>2012-04-09</td><td>$138,575</td></tr><tr><td>Zenaida Frank</td><td>Software Engineer</td><td>New York</td><td>63</td><td>2010-01-04</td><td>$125,250</td></tr><tr><td>Zorita Serrano</td><td>Software Engineer</td><td>San Francisco</td><td>56</td><td>2012-06-01</td><td>$115,000</td></tr><tr><td>Jennifer Acosta</td><td>Junior Javascript Developer</td><td>Edinburgh</td><td>43</td><td>2013-02-01</td><td>$75,650</td></tr><tr><td>Cara Stevens</td><td>Sales Assistant</td><td>New York</td><td>46</td><td>2011-12-06</td><td>$145,600</td></tr><tr><td>Hermione Butler</td><td>Regional Director</td><td>London</td><td>47</td><td>2011-03-21</td><td>$356,250</td></tr><tr><td>Lael Greer</td><td>Systems Administrator</td><td>London</td><td>21</td><td>2009-02-27</td><td>$103,500</td></tr><tr><td>Jonas Alexander</td><td>Developer</td><td>San Francisco</td><td>30</td><td>2010-07-14</td><td>$86,500</td></tr><tr><td>Shad Decker</td><td>Regional Director</td><td>Edinburgh</td><td>51</td><td>2008-11-13</td><td>$183,000</td></tr><tr><td>Michael Bruce</td><td>Javascript Developer</td><td>Singapore</td><td>29</td><td>2011-06-27</td><td>$183,000</td></tr><tr><td>Donna Snider</td><td>Customer Support</td><td>New York</td><td>27</td><td>2011-01-25</td><td>$112,000</td></tr></tbody><tfoot><tr><th>Name</th><th>Position</th><th>Office</th><th>Age</th><th>Start date</th><th>Salary</th></tr></tfoot></table>",
|
|
86
|
-
"required": false,
|
|
87
|
-
"editable": true,
|
|
88
|
-
"display_if" : {
|
|
89
|
-
"show": true,
|
|
90
|
-
"operator": "AND",
|
|
91
|
-
"rules": [{
|
|
92
|
-
"field": "table_data_source",
|
|
93
|
-
"operator": "equals",
|
|
94
|
-
"value": "qld__data-table--html"
|
|
95
|
-
}]
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
"id_field": {
|
|
99
|
-
"type": "metadata_field_text",
|
|
100
|
-
"description": "",
|
|
101
|
-
"friendly_name": "Id field",
|
|
102
|
-
"value": "",
|
|
103
|
-
"required": false,
|
|
104
|
-
"editable": true
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"children": [],
|
|
109
|
-
"childrenThumbnails": [],
|
|
110
|
-
"assets": []
|
|
111
|
-
}
|
|
112
|
-
}
|