frayerjj-frontend 0.7.2 → 0.7.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/package.json +1 -1
- package/src/ckeupload.js +45 -13
- package/src/init.js +5 -2
- package/src/scss/_wizard.scss +20 -0
- package/src/scss/styles.scss +2 -0
- package/src/wizard.js +60 -0
package/package.json
CHANGED
package/src/ckeupload.js
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
ClassicEditor,
|
|
3
|
+
Essentials,
|
|
4
|
+
Autoformat,
|
|
5
|
+
Bold,
|
|
6
|
+
Italic,
|
|
7
|
+
BlockQuote,
|
|
8
|
+
GeneralHtmlSupport,
|
|
9
|
+
Heading,
|
|
10
|
+
Image,
|
|
11
|
+
ImageUpload,
|
|
12
|
+
List,
|
|
13
|
+
Paragraph,
|
|
14
|
+
Table,
|
|
15
|
+
TableToolbar,
|
|
16
|
+
Link,
|
|
17
|
+
Undo
|
|
18
|
+
} from 'ckeditor5';
|
|
19
|
+
|
|
2
20
|
import { msg } from "./msg";
|
|
3
21
|
|
|
4
22
|
export const ckeupload = {
|
|
5
|
-
adapter: editor => {
|
|
6
|
-
editor.plugins.get('FileRepository').createUploadAdapter = loader => {
|
|
7
|
-
return new CkeUploadAdapter(loader, editor.config._config.extraParams.uri, editor.config._config.extraParams.token);
|
|
8
|
-
};
|
|
9
|
-
},
|
|
10
23
|
init: () => {
|
|
11
24
|
class CkeUploadAdapter {
|
|
12
25
|
constructor(loader, uri, token) {
|
|
@@ -57,7 +70,19 @@ export const ckeupload = {
|
|
|
57
70
|
this.xhr.send(data);
|
|
58
71
|
}
|
|
59
72
|
};
|
|
73
|
+
|
|
74
|
+
function CustomUploadAdapterPlugin(editor) {
|
|
75
|
+
editor.plugins.get('FileRepository').createUploadAdapter = (loader) => {
|
|
76
|
+
const uri = document.querySelector('meta[name="asset-upload"]').getAttribute('content');
|
|
77
|
+
const token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
|
|
78
|
+
return new CkeUploadAdapter(loader, uri, token);
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const ckeLicenseKey = document.querySelector('meta[name="cke-license-key"]')?.getAttribute('content') || 'GPL';
|
|
83
|
+
|
|
60
84
|
window.editors = [];
|
|
85
|
+
|
|
61
86
|
document.querySelectorAll('.wysiwyg').forEach(el => {
|
|
62
87
|
if (el.getAttribute('data-bs-toggle') === 'tooltip') {
|
|
63
88
|
let placement = el.getAttribute('data-bs-placement'),
|
|
@@ -70,7 +95,19 @@ export const ckeupload = {
|
|
|
70
95
|
el.removeAttribute('title');
|
|
71
96
|
}
|
|
72
97
|
ClassicEditor.create(el, {
|
|
73
|
-
|
|
98
|
+
plugins: [
|
|
99
|
+
Essentials, Autoformat, Bold, Italic, BlockQuote, Heading, Image,
|
|
100
|
+
ImageUpload, List, Paragraph, Table, TableToolbar, Link, Undo,
|
|
101
|
+
GeneralHtmlSupport, CustomUploadAdapterPlugin
|
|
102
|
+
],
|
|
103
|
+
toolbar: [
|
|
104
|
+
'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList',
|
|
105
|
+
'|', 'outdent', 'indent', '|', 'imageUpload', 'blockQuote', 'insertTable', 'undo', 'redo'
|
|
106
|
+
],
|
|
107
|
+
table: {
|
|
108
|
+
contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
|
|
109
|
+
},
|
|
110
|
+
licenseKey: ckeLicenseKey,
|
|
74
111
|
htmlSupport: {
|
|
75
112
|
allow: [{
|
|
76
113
|
name: /.*/,
|
|
@@ -78,12 +115,7 @@ export const ckeupload = {
|
|
|
78
115
|
classes: true,
|
|
79
116
|
styles: true
|
|
80
117
|
}]
|
|
81
|
-
}
|
|
82
|
-
extraParams: {
|
|
83
|
-
uri: document.querySelector('meta[name="asset-upload"]').getAttribute('content'),
|
|
84
|
-
token: document.querySelector('meta[name="csrf-token"]').getAttribute('content')
|
|
85
|
-
},
|
|
86
|
-
extraPlugins: [ CkeUploadAdapter ]
|
|
118
|
+
}
|
|
87
119
|
}).then(editor => {
|
|
88
120
|
window.editors[el.id] = editor;
|
|
89
121
|
msg.verbose('CKEditor Initialized');
|
package/src/init.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as bootstrap from 'bootstrap';
|
|
2
|
-
import { ClassicEditor } from '
|
|
2
|
+
import { ClassicEditor } from 'ckeditor5';
|
|
3
3
|
import { createPopper } from '@popperjs/core';
|
|
4
4
|
import { avatarCropper } from './avatarCropper';
|
|
5
5
|
import { ckeupload } from './ckeupload';
|
|
@@ -8,6 +8,7 @@ import { hasMany } from './hasMany';
|
|
|
8
8
|
import { loading } from './loading';
|
|
9
9
|
import { msg } from './msg';
|
|
10
10
|
import { modal } from './modal';
|
|
11
|
+
import { wizard } from './wizard';
|
|
11
12
|
import { phoneInput } from './phoneInput';
|
|
12
13
|
import { session } from './session';
|
|
13
14
|
import { validate } from './validate';
|
|
@@ -21,6 +22,7 @@ export const init = (args) => {
|
|
|
21
22
|
window.session = session;
|
|
22
23
|
window.validate = validate;
|
|
23
24
|
window.loading = loading;
|
|
25
|
+
window.wizard = wizard;
|
|
24
26
|
window.ClassicEditor = ClassicEditor;
|
|
25
27
|
loading.init(args?.loadingAnimationStyle ?? 'default');
|
|
26
28
|
|
|
@@ -34,6 +36,7 @@ export const init = (args) => {
|
|
|
34
36
|
modal.ajax.init();
|
|
35
37
|
phoneInput.init();
|
|
36
38
|
validate.init();
|
|
39
|
+
wizard.init();
|
|
37
40
|
|
|
38
41
|
//Dynamic height for container-fixed
|
|
39
42
|
let container = document.querySelectorAll('.container-fixed');
|
|
@@ -58,7 +61,7 @@ export const init = (args) => {
|
|
|
58
61
|
document.querySelectorAll('.dt-localize').forEach(el => {
|
|
59
62
|
msg.verbose('Localizing Date/Time');
|
|
60
63
|
const date = new Date(el.dataset.utc);
|
|
61
|
-
el.innerText = date.toLocaleString();
|
|
64
|
+
el.innerText = date.toLocaleString(undefined, options);
|
|
62
65
|
});
|
|
63
66
|
|
|
64
67
|
// Updates the id in the form action inside a modal. Used for delete confirm and edit modals.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.wizard {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
position: relative;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.wizard-step {
|
|
7
|
+
display: none;
|
|
8
|
+
width: 100%;
|
|
9
|
+
transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.wizard-step.active {
|
|
13
|
+
display: block;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.slide-in-right { transform: translateX(100%); opacity: 0; }
|
|
17
|
+
.slide-in-left { transform: translateX(-100%); opacity: 0; }
|
|
18
|
+
.slide-out-right { transform: translateX(100%); opacity: 0; }
|
|
19
|
+
.slide-out-left { transform: translateX(-100%); opacity: 0; }
|
|
20
|
+
.slide-center { transform: translateX(0); opacity: 1; }
|
package/src/scss/styles.scss
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@import 'bootstrap/scss/bootstrap';
|
|
2
2
|
@import 'flag-icons/css/flag-icons.min.css';
|
|
3
|
+
@import 'ckeditor5/ckeditor5.css';
|
|
3
4
|
@import url(//cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css);
|
|
4
5
|
@import url(//use.typekit.net/oox8pkj.css);
|
|
5
6
|
@import 'fonts';
|
|
@@ -11,3 +12,4 @@
|
|
|
11
12
|
@import 'footer';
|
|
12
13
|
@import 'loading';
|
|
13
14
|
@import 'forms';
|
|
15
|
+
@import 'wizard';
|
package/src/wizard.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { msg } from './msg.js';
|
|
2
|
+
import { validate } from './validate.js';
|
|
3
|
+
|
|
4
|
+
export const wizard = {
|
|
5
|
+
init: () => {
|
|
6
|
+
msg.verbose('Initializing Wizard');
|
|
7
|
+
document.querySelectorAll('.wizard').forEach(wizard => {
|
|
8
|
+
const animated = wizard.getAttribute('wizard-animated') !== 'false';
|
|
9
|
+
const animationSpeed = parseInt(wizard.getAttribute('wizard-animation-speed')) || 300;
|
|
10
|
+
const steps = wizard.querySelectorAll('.wizard-step');
|
|
11
|
+
let currentStep = 0;
|
|
12
|
+
|
|
13
|
+
steps[currentStep].classList.add('active');
|
|
14
|
+
steps[currentStep].style.opacity = 1;
|
|
15
|
+
|
|
16
|
+
wizard.querySelectorAll('.wizard-next').forEach(button => {
|
|
17
|
+
button.addEventListener('click', () => {
|
|
18
|
+
if (!validate.check(steps[currentStep])) {
|
|
19
|
+
msg.warn('Form failed validation. Please fix the errors before proceeding.');
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
wizard.transition(steps[currentStep], steps[currentStep + 1], 'next', animated, animationSpeed);
|
|
23
|
+
currentStep++;
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
wizard.querySelectorAll('.wizard-back').forEach(button => {
|
|
27
|
+
button.addEventListener('click', () => {
|
|
28
|
+
wizard.transition(steps[currentStep], steps[currentStep - 1], 'back', animated, animationSpeed);
|
|
29
|
+
currentStep--;
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
transition: (from, to, direction, animated, speed) => {
|
|
35
|
+
if (!animated) {
|
|
36
|
+
from.classList.remove('active');
|
|
37
|
+
to.classList.add('active');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const outClass = direction === 'next' ? 'slide-out-left' : 'slide-out-right';
|
|
42
|
+
const inClass = direction === 'next' ? 'slide-in-right' : 'slide-in-left';
|
|
43
|
+
|
|
44
|
+
to.style.transition = 'none';
|
|
45
|
+
to.classList.add('active', inClass);
|
|
46
|
+
to.offsetHeight; // Trigger reflow
|
|
47
|
+
from.style.transition = `transform ${speed}ms, opacity ${speed}ms`;
|
|
48
|
+
to.style.transition = `transform ${speed}ms, opacity ${speed}ms`;
|
|
49
|
+
from.classList.add(outClass);
|
|
50
|
+
to.classList.remove(inClass);
|
|
51
|
+
to.classList.add('slide-center');
|
|
52
|
+
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
from.classList.remove('active', outClass);
|
|
55
|
+
to.classList.remove(inClass, 'slide-center');
|
|
56
|
+
from.style.transition = '';
|
|
57
|
+
to.style.transition = '';
|
|
58
|
+
}, speed);
|
|
59
|
+
}
|
|
60
|
+
};
|