cec-nuxt-lib 0.7.2 → 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,10 +4,7 @@ import { useState } from '#app';
|
|
|
4
4
|
|
|
5
5
|
const searchTerm = useState('searchTerm', () => 'Enter keywords:');
|
|
6
6
|
const showSiteSearch = useState('showSiteSearch');
|
|
7
|
-
|
|
8
|
-
const baseUrl = useState('baseUrl');
|
|
9
|
-
const path = useState('path');
|
|
10
|
-
const title = useState('title');
|
|
7
|
+
const questions = useState('questions');
|
|
11
8
|
|
|
12
9
|
const regex =
|
|
13
10
|
/^https:\/\/digital-core\.cheshireeast\.gov\.uk(?!.*(?:&pagePath|&pageTitle|login)).*$/;
|
|
@@ -250,21 +247,44 @@ onMounted(() => {
|
|
|
250
247
|
});
|
|
251
248
|
};
|
|
252
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
|
+
|
|
253
266
|
const goto = (id, index, addToStack = true) => {
|
|
254
267
|
let qTop = questions.value.find((e) => e.id === id);
|
|
268
|
+
if (!index) {
|
|
269
|
+
qTop.stack = [0];
|
|
270
|
+
}
|
|
255
271
|
if (addToStack) {
|
|
256
272
|
qTop.stack.push(index);
|
|
257
273
|
}
|
|
258
274
|
let q = qTop.question[index];
|
|
259
|
-
document.getElementById(id + '_display').innerHTML =
|
|
275
|
+
document.getElementById(id + '_display').innerHTML = '';
|
|
260
276
|
document.getElementById(id + '_buttons').innerHTML = q.buttons || q.select;
|
|
277
|
+
makeBreadcrumb(id, qTop);
|
|
261
278
|
setUpListeners();
|
|
262
279
|
};
|
|
263
280
|
|
|
264
281
|
const display = (id, display) => {
|
|
265
|
-
console.log();
|
|
266
282
|
document.getElementById(id + '_display').innerHTML = display;
|
|
267
283
|
document.getElementById(id + '_buttons').innerHTML = '';
|
|
284
|
+
makeBreadcrumb(
|
|
285
|
+
id,
|
|
286
|
+
questions.value.find((e) => e.id === id)
|
|
287
|
+
);
|
|
268
288
|
};
|
|
269
289
|
|
|
270
290
|
const prev = (id) => {
|
package/package.json
CHANGED