cec-nuxt-lib 0.7.1 → 0.7.3
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/module.json
CHANGED
|
@@ -9,7 +9,7 @@ const getCanvas = (data: Block[]) => renderer({ data });
|
|
|
9
9
|
const baseUrl = useState('baseUrl');
|
|
10
10
|
const listItems = useState('listItems');
|
|
11
11
|
const path = useState('path');
|
|
12
|
-
const questions = useState('questions'
|
|
12
|
+
const questions = useState('questions');
|
|
13
13
|
const title = useState('title');
|
|
14
14
|
let canvasHtml;
|
|
15
15
|
|
|
@@ -405,7 +405,9 @@ const makeQuestions = (data, id) => {
|
|
|
405
405
|
);
|
|
406
406
|
qu.select += '</select>';
|
|
407
407
|
}
|
|
408
|
-
questions.value.
|
|
408
|
+
if (!questions.value.some((e) => e.id === id)) {
|
|
409
|
+
questions.value.push({ id: id, question: data.question, stack: [0] });
|
|
410
|
+
}
|
|
409
411
|
});
|
|
410
412
|
|
|
411
413
|
let inner = data.question[0].select
|
|
@@ -419,13 +421,15 @@ const makeQuestions = (data, id) => {
|
|
|
419
421
|
return `
|
|
420
422
|
<div class="mt-3 questions">
|
|
421
423
|
<fieldset class="p-1 mb-3">
|
|
422
|
-
|
|
424
|
+
|
|
425
|
+
<div><ol id="${id}_breadcrumb" class="breadcrumb "><li class="breadcrumb-item">${data.question[0].question}</li></ol></div>
|
|
426
|
+
<legend class="hidden">${data.entryTitle}</legend>
|
|
423
427
|
<div class="ps-2 question align-items-middle row g-0">
|
|
424
|
-
<div class="mb-3" id="${id}_display"
|
|
428
|
+
<div class="mb-3" id="${id}_display">
|
|
425
429
|
</div>
|
|
426
430
|
${inner}
|
|
427
431
|
</div>
|
|
428
|
-
<button
|
|
432
|
+
<!-- <button
|
|
429
433
|
type="button"
|
|
430
434
|
class="mt-4 btn btn-light previous"
|
|
431
435
|
id="${id}_prev"
|
|
@@ -438,7 +442,7 @@ const makeQuestions = (data, id) => {
|
|
|
438
442
|
id="${id}_reset"
|
|
439
443
|
>
|
|
440
444
|
Restart
|
|
441
|
-
</button>
|
|
445
|
+
</button> -->
|
|
442
446
|
</fieldset>
|
|
443
447
|
</div>`;
|
|
444
448
|
};
|
|
@@ -4,6 +4,7 @@ import { useState } from '#app';
|
|
|
4
4
|
|
|
5
5
|
const searchTerm = useState('searchTerm', () => 'Enter keywords:');
|
|
6
6
|
const showSiteSearch = useState('showSiteSearch');
|
|
7
|
+
const questions = useState('questions');
|
|
7
8
|
|
|
8
9
|
const regex =
|
|
9
10
|
/^https:\/\/digital-core\.cheshireeast\.gov\.uk(?!.*(?:&pagePath|&pageTitle|login)).*$/;
|
|
@@ -246,21 +247,44 @@ onMounted(() => {
|
|
|
246
247
|
});
|
|
247
248
|
};
|
|
248
249
|
|
|
250
|
+
const makeBreadcrumb = (id, qTop) => {
|
|
251
|
+
let display = document.getElementById(id + '_display');
|
|
252
|
+
let breadcrumb = document.getElementById(`${id}_breadcrumb`);
|
|
253
|
+
breadcrumb.innerHTML = '';
|
|
254
|
+
qTop.stack.forEach((el, i) => {
|
|
255
|
+
let li = document.createElement('LI');
|
|
256
|
+
li.classList.add('breadcrumb-item');
|
|
257
|
+
li.innerHTML = qTop.question[el].question;
|
|
258
|
+
if (i !== qTop.stack.length - 1 || display.innerText.length) {
|
|
259
|
+
li.classList.add('fakeLink');
|
|
260
|
+
li.onclick = () => goto(id, i, false);
|
|
261
|
+
}
|
|
262
|
+
breadcrumb.appendChild(li);
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
|
|
249
266
|
const goto = (id, index, addToStack = true) => {
|
|
250
267
|
let qTop = questions.value.find((e) => e.id === id);
|
|
268
|
+
if (!index) {
|
|
269
|
+
qTop.stack = [0];
|
|
270
|
+
}
|
|
251
271
|
if (addToStack) {
|
|
252
272
|
qTop.stack.push(index);
|
|
253
273
|
}
|
|
254
274
|
let q = qTop.question[index];
|
|
255
|
-
document.getElementById(id + '_display').innerHTML =
|
|
275
|
+
document.getElementById(id + '_display').innerHTML = '';
|
|
256
276
|
document.getElementById(id + '_buttons').innerHTML = q.buttons || q.select;
|
|
277
|
+
makeBreadcrumb(id, qTop);
|
|
257
278
|
setUpListeners();
|
|
258
279
|
};
|
|
259
280
|
|
|
260
281
|
const display = (id, display) => {
|
|
261
|
-
console.log();
|
|
262
282
|
document.getElementById(id + '_display').innerHTML = display;
|
|
263
283
|
document.getElementById(id + '_buttons').innerHTML = '';
|
|
284
|
+
makeBreadcrumb(
|
|
285
|
+
id,
|
|
286
|
+
questions.value.find((e) => e.id === id)
|
|
287
|
+
);
|
|
264
288
|
};
|
|
265
289
|
|
|
266
290
|
const prev = (id) => {
|
package/package.json
CHANGED