geico-design-kit 7.0.0
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.
Potentially problematic release.
This version of geico-design-kit might be problematic. Click here for more details.
- package/.babelrc +5 -0
- package/LICENSE +0 -0
- package/dist/analytics.js +119 -0
- package/dist/appState.js +56 -0
- package/dist/baseComponent.js +110 -0
- package/dist/components/Accordion.js +312 -0
- package/dist/components/AddressAutoComplete.js +220 -0
- package/dist/components/Alert.js +145 -0
- package/dist/components/BackgroundPattern.js +99 -0
- package/dist/components/BackgroundPatternPortfolio.js +242 -0
- package/dist/components/ButtonSwitch.js +236 -0
- package/dist/components/CardSelections.js +230 -0
- package/dist/components/CommonQuestionsSquares.js +169 -0
- package/dist/components/Confirmation.js +156 -0
- package/dist/components/ConsolidatedSummary.js +489 -0
- package/dist/components/CoverageGraph.js +201 -0
- package/dist/components/CreditCard.js +591 -0
- package/dist/components/CurrencyInput.js +302 -0
- package/dist/components/DatePicker.js +468 -0
- package/dist/components/DockedMessage.js +146 -0
- package/dist/components/DotNavigation.js +200 -0
- package/dist/components/EditComponent.js +128 -0
- package/dist/components/EditableTable.js +113 -0
- package/dist/components/InPageNavigation.js +360 -0
- package/dist/components/Loader.js +232 -0
- package/dist/components/MakePayment.js +361 -0
- package/dist/components/Modal.js +254 -0
- package/dist/components/MoreInfoButton.js +227 -0
- package/dist/components/MultipleSelectBox.js +217 -0
- package/dist/components/NavigationalBox.js +161 -0
- package/dist/components/Navigator.js +294 -0
- package/dist/components/PasswordMeter.js +201 -0
- package/dist/components/PayPlans.js +534 -0
- package/dist/components/SegmentedControl.js +327 -0
- package/dist/components/SortableTable.js +166 -0
- package/dist/components/Tabs.js +1 -0
- package/dist/components/TextAreaCountdown.js +219 -0
- package/dist/components/Timeline.js +498 -0
- package/dist/components/TimelineFilter.js +492 -0
- package/dist/components/ToTopArrow.js +153 -0
- package/dist/components/Tooltip.js +329 -0
- package/dist/components/Upsell.js +168 -0
- package/dist/components/VIN.js +271 -0
- package/dist/components/ValidateForm.js +938 -0
- package/dist/components/ViewMoreLess.js +191 -0
- package/dist/components/ZipCode.js +191 -0
- package/dist/components/portfolio.js +99 -0
- package/dist/geico-design-kit.js +141 -0
- package/dist/global/components.js +98 -0
- package/dist/global/footer.js +26 -0
- package/dist/global/nav.js +1257 -0
- package/dist/services/CharacterTypeService.js +106 -0
- package/dist/services/UserAgentService.js +73 -0
- package/dist/utils.js +79 -0
- package/package.json +32 -0
- package/src/analytics.js +82 -0
- package/src/appState.js +56 -0
- package/src/baseComponent.js +156 -0
- package/src/components/Accordion.js +336 -0
- package/src/components/AddressAutoComplete.js +236 -0
- package/src/components/Alert.js +135 -0
- package/src/components/BackgroundPattern.js +96 -0
- package/src/components/BackgroundPatternPortfolio.js +284 -0
- package/src/components/ButtonSwitch.js +241 -0
- package/src/components/CardSelections.js +240 -0
- package/src/components/CommonQuestionsSquares.js +179 -0
- package/src/components/Confirmation.js +160 -0
- package/src/components/ConsolidatedSummary.js +505 -0
- package/src/components/CoverageGraph.js +203 -0
- package/src/components/CreditCard.js +595 -0
- package/src/components/CurrencyInput.js +321 -0
- package/src/components/DatePicker.js +487 -0
- package/src/components/DockedMessage.js +142 -0
- package/src/components/DotNavigation.js +206 -0
- package/src/components/EditComponent.js +130 -0
- package/src/components/EditableTable.js +106 -0
- package/src/components/InPageNavigation.js +391 -0
- package/src/components/Loader.js +272 -0
- package/src/components/MakePayment.js +397 -0
- package/src/components/Modal.js +279 -0
- package/src/components/MoreInfoButton.js +243 -0
- package/src/components/MultipleSelectBox.js +211 -0
- package/src/components/NavigationalBox.js +163 -0
- package/src/components/Navigator.js +338 -0
- package/src/components/PasswordMeter.js +209 -0
- package/src/components/PayPlans.js +604 -0
- package/src/components/SegmentedControl.js +365 -0
- package/src/components/SortableTable.js +176 -0
- package/src/components/Tabs.js +0 -0
- package/src/components/TextAreaCountdown.js +231 -0
- package/src/components/Timeline.js +532 -0
- package/src/components/TimelineFilter.js +533 -0
- package/src/components/ToTopArrow.js +153 -0
- package/src/components/Tooltip.js +344 -0
- package/src/components/Upsell.js +196 -0
- package/src/components/VIN.js +289 -0
- package/src/components/ValidateForm.js +1030 -0
- package/src/components/ViewMoreLess.js +193 -0
- package/src/components/ZipCode.js +193 -0
- package/src/components/portfolio.js +106 -0
- package/src/geico-design-kit.js +144 -0
- package/src/global/components.js +92 -0
- package/src/global/footer.js +25 -0
- package/src/global/nav.js +1457 -0
- package/src/services/CharacterTypeService.js +107 -0
- package/src/services/UserAgentService.js +59 -0
- package/src/utils.js +82 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import baseComponent from '../../src/baseComponent';
|
|
2
|
+
import appState from "../../src/appState";
|
|
3
|
+
|
|
4
|
+
const validateSettings = [
|
|
5
|
+
{
|
|
6
|
+
setting : "content",
|
|
7
|
+
isRequired : true,
|
|
8
|
+
validate : "type",
|
|
9
|
+
possibleValues : ["string","object"],
|
|
10
|
+
errorMessage : ["GDK Confirmation : Content must be defined and set to a DOM selector or Node"]
|
|
11
|
+
},
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Confirmation{
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* These are settings for the instantiation. Refer to the design kit section of this component for JS setting examples.
|
|
19
|
+
* @param {string|Object} content
|
|
20
|
+
* A reference to the html accordion node
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
constructor(options) {
|
|
24
|
+
|
|
25
|
+
this._internalVars = {
|
|
26
|
+
node: null,//used for content item
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
//options with defaults set
|
|
30
|
+
this._defaults = {
|
|
31
|
+
animateCheckmarkFunction: animateCheckmark.bind(this)
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Create options by extending defaults with the passed in arguments
|
|
35
|
+
if (options && typeof options === "object") {
|
|
36
|
+
this._options = baseComponent.extendDefaults(this._defaults, options);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//if the required options are valid set up the environment
|
|
40
|
+
if( baseComponent.validateSettings(this._options, validateSettings) ){
|
|
41
|
+
this._internalVars.contentType = baseComponent.getContentType(this);
|
|
42
|
+
setLocalVars.call(this);
|
|
43
|
+
setEvents.call(this);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//Public Methods
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* animateCheckmarkConfirmation()
|
|
51
|
+
* animates the check mark icon
|
|
52
|
+
*/
|
|
53
|
+
animateCheckmarkConfirmation(){
|
|
54
|
+
animateCheckmark.call(this)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* destroy()
|
|
60
|
+
* removes the node from the dom and any events attached
|
|
61
|
+
*/
|
|
62
|
+
destroy(){
|
|
63
|
+
removeEvents.call(this);
|
|
64
|
+
this._internalVars.node.parentNode.removeChild(this._internalVars.node);
|
|
65
|
+
|
|
66
|
+
//a little garbage collection
|
|
67
|
+
for (var variableKey in this){
|
|
68
|
+
if (this.hasOwnProperty(variableKey)){
|
|
69
|
+
delete this[variableKey];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* setEvents()
|
|
78
|
+
* Sets all the events needed for the component
|
|
79
|
+
*/
|
|
80
|
+
function setEvents() {
|
|
81
|
+
window.addEventListener("load", this._defaults.animateCheckmarkFunction)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* removeEvents()
|
|
87
|
+
* removes all events from the component
|
|
88
|
+
*/
|
|
89
|
+
function removeEvents() {
|
|
90
|
+
window.removeEventListener("load", this._defaults.animateCheckmarkFunction)
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
function animateCheckmark() {
|
|
96
|
+
if(this._internalVars.animationComplete !== true) {
|
|
97
|
+
setTimeout(svgAnim.bind(this), 2500);
|
|
98
|
+
this._internalVars.animationComplete = true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let tick = 0;
|
|
103
|
+
|
|
104
|
+
function svgAnim() {
|
|
105
|
+
let svgToAnim = this._internalVars.node.querySelector("svg"),
|
|
106
|
+
circleWrapper = this._internalVars.node.querySelector(".confirmation-icon-wrapper"),
|
|
107
|
+
dashArrayComplete = 183,//svg animation settings
|
|
108
|
+
tickSpeed = 3.5,//svg animation settings
|
|
109
|
+
tickSpeedMobile = 5;//svg animation settings
|
|
110
|
+
|
|
111
|
+
if (appState.mode === "desktop") {
|
|
112
|
+
tick += tickSpeed;
|
|
113
|
+
} else {
|
|
114
|
+
tick += tickSpeedMobile;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if(!circleWrapper.classList.contains("circleConfirmation")){
|
|
118
|
+
circleWrapper.classList.add("circleConfirmation")
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let t = tick / 100;
|
|
122
|
+
let offsetStrokeDasharray = easeInQuad(t, 0, dashArrayComplete, 1);
|
|
123
|
+
svgToAnim.style.strokeDasharray = `${offsetStrokeDasharray} , ${dashArrayComplete}`;
|
|
124
|
+
|
|
125
|
+
if (tick < 100) {
|
|
126
|
+
requestAnimationFrame(svgAnim.bind(this));
|
|
127
|
+
} else {
|
|
128
|
+
tick = 0;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* easeInQuad()
|
|
134
|
+
* Quadratic easing
|
|
135
|
+
*/
|
|
136
|
+
function easeInQuad(t, b, c, d) {
|
|
137
|
+
var ts = (t /= d) * t;
|
|
138
|
+
return b + c * (ts);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* setLocalVars()
|
|
144
|
+
* set all the local vars to passed in options
|
|
145
|
+
*/
|
|
146
|
+
function setLocalVars() {
|
|
147
|
+
//determine the type of content passed in
|
|
148
|
+
if(this._internalVars.contentType === 'string'){
|
|
149
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
|
150
|
+
}else if(this._internalVars.contentType === 'domNode'){
|
|
151
|
+
this._internalVars.node = this._options.content;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
this._internalVars.animationComplete = false
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
export default Confirmation;
|
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
import baseComponent from "../../src/baseComponent";
|
|
2
|
+
import UserAgentService from '../../src/services/UserAgentService';
|
|
3
|
+
|
|
4
|
+
let PromiseIE = require('es6-promise-polyfill').Promise;
|
|
5
|
+
// get the correct click event
|
|
6
|
+
const clickEventName = UserAgentService._clickEventName();
|
|
7
|
+
|
|
8
|
+
const validateSettings = [
|
|
9
|
+
{
|
|
10
|
+
setting: "content",
|
|
11
|
+
isRequired: true,
|
|
12
|
+
validate: "type",
|
|
13
|
+
possibleValues: ["string", "object"],
|
|
14
|
+
errorMessage: ["GDK Consolidated Summary : Content must be defined and set to a DOM selector or Node"]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
setting: "autoLoad",
|
|
18
|
+
isRequired: false,
|
|
19
|
+
validate: "type",
|
|
20
|
+
possibleValues: ["boolean"],
|
|
21
|
+
errorMessage: ["GDK Consolidated Summary : autoLoad must be a boolean"]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
setting: "loadPlog",
|
|
25
|
+
isRequired: false,
|
|
26
|
+
validate: "type",
|
|
27
|
+
possibleValues: ["function"],
|
|
28
|
+
errorMessage: ["GDK Consolidated Summary : loadPlog must be a function"]
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Consolidated Summary Component: This is integrated informative component for GEICO Counselors. Main purpose is to ease counselors
|
|
34
|
+
* work by displaying various information on selected policy holder.
|
|
35
|
+
*/
|
|
36
|
+
class ConsolidatedSummary {
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param options
|
|
42
|
+
*/
|
|
43
|
+
constructor(options) {
|
|
44
|
+
|
|
45
|
+
this._internalVars = {
|
|
46
|
+
node: null, //used for the current node
|
|
47
|
+
consolidatedSummary: null //holds reference to the consolidated Summary node;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
this._defaults = {
|
|
51
|
+
initialTabOpen: 1,
|
|
52
|
+
autoLoad: true,
|
|
53
|
+
loadPlog: function () { //Return an empty promise
|
|
54
|
+
return new PromiseIE((resolve, reject) => {
|
|
55
|
+
resolve();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
if (options && typeof options === "object") {
|
|
61
|
+
this._options = baseComponent.extendDefaults(this._defaults, options);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (baseComponent.validateSettings(this._options, validateSettings)) {
|
|
65
|
+
this._internalVars.contentType = baseComponent.getContentType(this);
|
|
66
|
+
setLocalVars.call(this);
|
|
67
|
+
setEvents.call(this);
|
|
68
|
+
init.call(this);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* This method cleans up all Consolidated Summary tracks in the DOM, but does NOT destroy
|
|
74
|
+
* the Consolidated Summary Object.
|
|
75
|
+
*/
|
|
76
|
+
hide() {
|
|
77
|
+
hideComponent.call(this);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* This global method displays consolodated summary.
|
|
82
|
+
* @param initFix
|
|
83
|
+
*/
|
|
84
|
+
show(initFix) {
|
|
85
|
+
const node = this._internalVars.node;
|
|
86
|
+
if (initFix) {
|
|
87
|
+
this._internalVars.pageWrapper.classList.add('consolidated-summary-enabled');
|
|
88
|
+
if (this._internalVars.toTop !== null) {
|
|
89
|
+
this._internalVars.toTop.classList.add('consolidated-summary-enabled');
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
displayComponent.call(this);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Destroy the Consolidated Summary component.
|
|
98
|
+
*/
|
|
99
|
+
destroy() {
|
|
100
|
+
removeEvents.call(this);
|
|
101
|
+
delete this._internalVars;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Initializing method
|
|
107
|
+
*/
|
|
108
|
+
function init() {
|
|
109
|
+
|
|
110
|
+
// make sure the #wrapper don't have the .pinned-consolidated-summary class;
|
|
111
|
+
this._internalVars.csWrapper.classList.remove('pinned-consolidated-summary');
|
|
112
|
+
|
|
113
|
+
if (this._options.autoLoad && this._internalVars.node.classList.contains('hidden')) {
|
|
114
|
+
this.show();
|
|
115
|
+
} else if (!this._options.autoLoad && !this._internalVars.node.classList.contains('hidden')) {
|
|
116
|
+
this.hide();
|
|
117
|
+
} else if (this._options.autoLoad && !this._internalVars.node.classList.contains('hidden')) {
|
|
118
|
+
this.show(true);
|
|
119
|
+
}
|
|
120
|
+
this._internalVars.node.classList.remove('extended');
|
|
121
|
+
if (this._internalVars.plogComponent && (!this._internalVars.plogComponent.classList || !this._internalVars.plogComponent.classList.contains('extended'))) {
|
|
122
|
+
this._internalVars.plogComponent.classList.add('hidden');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* Instantiate the tabs */
|
|
126
|
+
openInitialTab.call(this);
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* method to set events for the component
|
|
132
|
+
*/
|
|
133
|
+
function setEvents() {
|
|
134
|
+
|
|
135
|
+
/* Tabs */
|
|
136
|
+
let tabs = this._internalVars.verticalTabs.querySelectorAll('.tab');
|
|
137
|
+
let plogBtn, plogResizeBtn, plogMinimizeBtn;
|
|
138
|
+
|
|
139
|
+
/* PLOG Controls */
|
|
140
|
+
if (this._internalVars.plogComponent !== null && this._internalVars.plogBtn !== null) {
|
|
141
|
+
plogBtn = this._internalVars.plogBtn;
|
|
142
|
+
/*PLOG Window Controls */
|
|
143
|
+
plogResizeBtn = this._internalVars.plogComponent.querySelector(".plogResizeBtn");
|
|
144
|
+
plogMinimizeBtn = this._internalVars.plogComponent.querySelector(".plogMinimizeBtn");
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// On mouse click behavior
|
|
148
|
+
this._internalVars.csWrapper.addEventListener(clickEventName, extendCSHandler.bind(this));
|
|
149
|
+
// this._internalVars.csWrapper.addEventListener(clickEventName, function () {
|
|
150
|
+
// console.log("opa opa");
|
|
151
|
+
// });
|
|
152
|
+
// On mouse leave behavior
|
|
153
|
+
// this._internalVars.csWrapper.addEventListener("mouseleave", retractCSHandler.call(this));
|
|
154
|
+
this._internalVars.csWrapper.addEventListener("mouseleave", retractCSHandler.bind(this));
|
|
155
|
+
|
|
156
|
+
// implement "pinned" functionality
|
|
157
|
+
this._internalVars.node.querySelector(".consolidated-summary-pin").addEventListener(clickEventName, pinHandler.bind(this));
|
|
158
|
+
|
|
159
|
+
Array.prototype.map.call(tabs, function (element) {
|
|
160
|
+
element.addEventListener(clickEventName, tabClickHandler.bind(this));
|
|
161
|
+
}.bind(this));
|
|
162
|
+
|
|
163
|
+
if (plogBtn) {
|
|
164
|
+
plogBtn.addEventListener(clickEventName, pLogToggleHandler.bind(this));
|
|
165
|
+
}
|
|
166
|
+
if (plogMinimizeBtn) {
|
|
167
|
+
plogMinimizeBtn.addEventListener(clickEventName, minimizePlogHandler.bind(this));
|
|
168
|
+
}
|
|
169
|
+
if (plogResizeBtn) {
|
|
170
|
+
plogResizeBtn.addEventListener(clickEventName, resizePlogHandler.bind(this));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if(this._internalVars.delete_switch !== null) {
|
|
174
|
+
this._internalVars.delete_switch.addEventListener(clickEventName, toggleNotesDeleteButtons.bind(this));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* method to remove events for the component
|
|
180
|
+
*/
|
|
181
|
+
function removeEvents() {
|
|
182
|
+
|
|
183
|
+
/* Tabs */
|
|
184
|
+
let tabs = this._internalVars.verticalTabs.querySelectorAll('.tab');
|
|
185
|
+
let plogBtn, plogResizeBtn, plogMinimizeBtn;
|
|
186
|
+
|
|
187
|
+
/* PLOG Controls */
|
|
188
|
+
if (this._internalVars.plogComponent !== null && this._internalVars.plogBtn !== null) {
|
|
189
|
+
plogBtn = this._internalVars.plogBtn;
|
|
190
|
+
/*PLOG Window Controls */
|
|
191
|
+
plogResizeBtn = this._internalVars.plogComponent.querySelector(".plogResizeBtn");
|
|
192
|
+
plogMinimizeBtn = this._internalVars.plogComponent.querySelector(".plogMinimizeBtn");
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// On mouse click behavior
|
|
196
|
+
this._internalVars.csWrapper.removeEventListener(clickEventName, extendCSHandler.bind(this));
|
|
197
|
+
// On mouse leave behavior
|
|
198
|
+
this._internalVars.csWrapper.removeEventListener("mouseleave", retractCSHandler.bind(this));
|
|
199
|
+
// implement "pinned" functionality
|
|
200
|
+
this._internalVars.node.querySelector(".consolidated-summary-pin").removeEventListener(clickEventName, pinHandler.bind(this));
|
|
201
|
+
|
|
202
|
+
Array.prototype.map.call(tabs, function (element) {
|
|
203
|
+
element.removeEventListener(clickEventName, tabClickHandler.bind(this));
|
|
204
|
+
}.bind(this));
|
|
205
|
+
if (plogBtn) {
|
|
206
|
+
plogBtn.removeEventListener(clickEventName, pLogToggleHandler.bind(this));
|
|
207
|
+
}
|
|
208
|
+
if (plogMinimizeBtn) {
|
|
209
|
+
plogMinimizeBtn.removeEventListener(clickEventName, minimizePlogHandler.bind(this));
|
|
210
|
+
}
|
|
211
|
+
if (plogResizeBtn) {
|
|
212
|
+
plogResizeBtn.removeEventListener(clickEventName, resizePlogHandler.bind(this));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function extendCSHandler() {
|
|
217
|
+
console.log('Wrapper is clicked');
|
|
218
|
+
this._internalVars.node.classList.add("extended");
|
|
219
|
+
if (this._internalVars.toTop !== null) {
|
|
220
|
+
this._internalVars.toTop.classList.add('consolidated-summary-extended');
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function retractCSHandler() {
|
|
225
|
+
this._internalVars.node.classList.remove("extended");
|
|
226
|
+
if (this._internalVars.toTop !== null) {
|
|
227
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-extended');
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function pinHandler() {
|
|
232
|
+
if (!this._internalVars.node.classList.contains("pinned")) {
|
|
233
|
+
this._internalVars.pageWrapper.classList.add('pinned-consolidated-summary');
|
|
234
|
+
if (this._internalVars.toTop !== null) {
|
|
235
|
+
this._internalVars.toTop.classList.add('consolidated-summary-pinned');
|
|
236
|
+
}
|
|
237
|
+
if (this._internalVars.drtMessage !== null) {
|
|
238
|
+
let dockedMsgArray = document.querySelectorAll('.docked-real-time-message-wrapper');
|
|
239
|
+
Array.prototype.forEach.call(dockedMsgArray, (element) => {
|
|
240
|
+
if (!element.classList.contains('con-sum-pinned')) {
|
|
241
|
+
if (element.hasAttribute('id')) {
|
|
242
|
+
element.classList.add('con-sum-three-hundred-fix');
|
|
243
|
+
}
|
|
244
|
+
element.classList.add('con-sum-pinned');
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
}
|
|
249
|
+
this._internalVars.node.classList.add("pinned");
|
|
250
|
+
} else {
|
|
251
|
+
this._internalVars.pageWrapper.classList.remove('pinned-consolidated-summary');
|
|
252
|
+
if (this._internalVars.toTop !== null) {
|
|
253
|
+
if (this._internalVars.toTop.classList.contains('consolidated-summary-pinned')) {
|
|
254
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-pinned');
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (this._internalVars.drtMessage !== null) {
|
|
258
|
+
let dockedMsgArray = document.querySelectorAll('.docked-real-time-message-wrapper');
|
|
259
|
+
Array.prototype.forEach.call(dockedMsgArray, (element) => {
|
|
260
|
+
if (element.classList.contains('con-sum-pinned')) {
|
|
261
|
+
if (element.hasAttribute('id')) {
|
|
262
|
+
element.classList.remove('con-sum-three-hundred-fix');
|
|
263
|
+
}
|
|
264
|
+
element.classList.remove('con-sum-pinned');
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
}
|
|
269
|
+
this._internalVars.node.classList.remove("pinned");
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function pLogToggleHandler() {
|
|
274
|
+
this._options.loadPlog().then(plogToggle.call(this));
|
|
275
|
+
|
|
276
|
+
function plogToggle() {
|
|
277
|
+
// hide Policy Notes
|
|
278
|
+
if (!this._internalVars.plogComponent.classList.contains("hidden")) {
|
|
279
|
+
this._internalVars.plogComponent.classList.add("hidden");
|
|
280
|
+
if (this._internalVars.toTop !== null) {
|
|
281
|
+
this._internalVars.toTop.classList.remove('plog-enabled');
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
// Display Policy Notes
|
|
285
|
+
this._internalVars.plogComponent.classList.remove("hidden");
|
|
286
|
+
if (this._internalVars.toTop !== null) {
|
|
287
|
+
this._internalVars.toTop.classList.add('plog-enabled');
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function toggleNotesDeleteButtons (e) {
|
|
294
|
+
e.target.parentElement.parentElement.parentElement.classList.add('admin-on');
|
|
295
|
+
const notes = this._internalVars.plogComponent.querySelectorAll('.policy-note>.note-details>.delete-note');
|
|
296
|
+
for( let note in notes ) {
|
|
297
|
+
if (typeof notes[note] === 'object') {
|
|
298
|
+
notes[note].classList.remove('hidden');
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function minimizePlogHandler() {
|
|
304
|
+
if (!this._internalVars.plogComponent.classList.contains("hidden")) {
|
|
305
|
+
this._internalVars.plogComponent.classList.remove("maximized");
|
|
306
|
+
if (this._internalVars.toTop !== null) {
|
|
307
|
+
if (!this._internalVars.node.classList.contains('extended') && this._internalVars.toTop.classList.contains('consolidated-summary-extended')) {
|
|
308
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-extended');
|
|
309
|
+
}
|
|
310
|
+
if (!this._internalVars.node.classList.contains("pinned") && this._internalVars.toTop.classList.contains('consolidated-summary-pinned')) {
|
|
311
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-pinned');
|
|
312
|
+
}
|
|
313
|
+
this._internalVars.toTop.classList.remove('plog-enabled');
|
|
314
|
+
}
|
|
315
|
+
this._internalVars.plogComponent.classList.add("hidden");
|
|
316
|
+
} else {
|
|
317
|
+
this._internalVars.plogComponent.classList.remove("hidden");
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function resizePlogHandler() {
|
|
322
|
+
if (!this._internalVars.plogComponent.classList.contains("maximized")) {
|
|
323
|
+
if (this._internalVars.node.classList && this._internalVars.node.classList.contains("extended")) {
|
|
324
|
+
this._internalVars.node.classList.remove("extended");
|
|
325
|
+
}
|
|
326
|
+
if (this._internalVars.node.classList && this._internalVars.node.classList.contains("pinned")) {
|
|
327
|
+
this._internalVars.pageWrapper.classList.remove('pinned-consolidated-summary');
|
|
328
|
+
this._internalVars.node.classList.remove("pinned");
|
|
329
|
+
}
|
|
330
|
+
this._internalVars.plogComponent.classList.add("maximized");
|
|
331
|
+
} else {
|
|
332
|
+
this._internalVars.plogComponent.classList.remove("maximized");
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/* Tabs Methods */
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* tabClickHandler()
|
|
340
|
+
* Opens tab content for clicked tab and hides the rest
|
|
341
|
+
*/
|
|
342
|
+
function tabClickHandler(element) {
|
|
343
|
+
let currentNode = element.currentTarget;
|
|
344
|
+
//get index of clicked tab
|
|
345
|
+
let index = [].indexOf.call(this._internalVars.tabs, currentNode);
|
|
346
|
+
if (this._options.tabClicked)
|
|
347
|
+
if (this._options.tabClicked(currentNode) === false) return false;
|
|
348
|
+
|
|
349
|
+
Array.prototype.map.call(this._internalVars.tabs, (element) => {
|
|
350
|
+
if (element === currentNode) {
|
|
351
|
+
element.classList.add("active");
|
|
352
|
+
} else {
|
|
353
|
+
element.classList.remove("active");
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
Array.prototype.map.call(this._internalVars.panels, (element, i) => {
|
|
358
|
+
if (i === index) {
|
|
359
|
+
openPanel.call(this, element);
|
|
360
|
+
} else {
|
|
361
|
+
closePanel.call(this, element);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* openInitialTab()
|
|
368
|
+
* Opens tab content for tab set by initialTabOpen
|
|
369
|
+
*/
|
|
370
|
+
function openInitialTab() {
|
|
371
|
+
let tabIndex = this._options.initialTabOpen - 1;
|
|
372
|
+
|
|
373
|
+
Array.prototype.map.call(this._internalVars.tabs, (element, i) => {
|
|
374
|
+
if (i === tabIndex) {
|
|
375
|
+
element.classList.add("active");
|
|
376
|
+
} else {
|
|
377
|
+
element.classList.remove("active");
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
Array.prototype.map.call(this._internalVars.panels, (element, i) => {
|
|
382
|
+
if (i === tabIndex) {
|
|
383
|
+
openPanel.call(this, element);
|
|
384
|
+
} else {
|
|
385
|
+
closePanel.call(this, element);
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* openPanel()
|
|
393
|
+
* Opens panel at the same index as the clicked tab and hides the other panels
|
|
394
|
+
*/
|
|
395
|
+
function openPanel(element) {
|
|
396
|
+
element.classList.add("active");
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* closePanel()
|
|
401
|
+
* closes the past in panel
|
|
402
|
+
*/
|
|
403
|
+
function closePanel(element) {
|
|
404
|
+
element.classList.remove("active");
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Displays the component (display).
|
|
409
|
+
*/
|
|
410
|
+
function displayComponent() {
|
|
411
|
+
const node = this._internalVars.node;
|
|
412
|
+
/* con-sum-on */
|
|
413
|
+
if (this._internalVars.node.classList) {
|
|
414
|
+
if (this._internalVars.node.classList.contains('hidden')) {
|
|
415
|
+
this._internalVars.node.classList.remove("hidden");
|
|
416
|
+
if (!this._internalVars.pageWrapper.classList.contains('consolidated-summary-enabled')) {
|
|
417
|
+
this._internalVars.pageWrapper.classList.add('consolidated-summary-enabled');
|
|
418
|
+
}
|
|
419
|
+
if (this._internalVars.toTop !== null) {
|
|
420
|
+
if (!this._internalVars.toTop.classList.contains('consolidated-summary-enabled')) {
|
|
421
|
+
this._internalVars.toTop.classList.add('consolidated-summary-enabled');
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (this._internalVars.drtMessage !== null) {
|
|
425
|
+
let dockedMsgArray = document.querySelectorAll('.docked-real-time-message-wrapper');
|
|
426
|
+
Array.prototype.forEach.call(dockedMsgArray, (element) => {
|
|
427
|
+
if (!element.classList.contains('con-sum-on')) {
|
|
428
|
+
if (element.hasAttribute('id')) {
|
|
429
|
+
element.classList.add('con-sum-fifty-fix');
|
|
430
|
+
}
|
|
431
|
+
element.classList.add('con-sum-on');
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Hides the component (hide)
|
|
441
|
+
*/
|
|
442
|
+
function hideComponent() {
|
|
443
|
+
const node = this._internalVars.node;
|
|
444
|
+
// Hide Consolidated Summary if exists on the DOM
|
|
445
|
+
if (this._internalVars.node.classList.contains('extended')) {
|
|
446
|
+
this._internalVars.node.classList.remove('extended');
|
|
447
|
+
}
|
|
448
|
+
if (this._internalVars.node.classList.contains('pinned')) {
|
|
449
|
+
this._internalVars.node.classList.remove('pinned');
|
|
450
|
+
}
|
|
451
|
+
if (!this._internalVars.node.classList.contains('hidden')) {
|
|
452
|
+
this._internalVars.node.classList.add('hidden');
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
// Clean up any Docked Real Time Message classes
|
|
457
|
+
// const drtMessage = document.querySelector('.docked-real-time-message-wrapper') || null;
|
|
458
|
+
if (this._internalVars.drtMessage !== null) {
|
|
459
|
+
let dockedMsgArray = document.querySelectorAll('.docked-real-time-message-wrapper');
|
|
460
|
+
Array.prototype.forEach.call(dockedMsgArray, (element) => {
|
|
461
|
+
if (element.classList.contains('con-sum-pinned')) {
|
|
462
|
+
if (element.hasAttribute('id')) {
|
|
463
|
+
element.classList.remove('con-sum-three-hundred-fix');
|
|
464
|
+
}
|
|
465
|
+
element.classList.remove('con-sum-pinned');
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
// Remove classes of the HTML DOM elements #wrapper and #to-top
|
|
470
|
+
this._internalVars.pageWrapper.classList.remove('consolidated-summary-enabled');
|
|
471
|
+
this._internalVars.pageWrapper.classList.remove('pinned-consolidated-summary');
|
|
472
|
+
this._internalVars.node.classList.remove('pinned');
|
|
473
|
+
if (this._internalVars.toTop !== null) {
|
|
474
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-enabled');
|
|
475
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-pinned');
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Method to set local variables.
|
|
481
|
+
*/
|
|
482
|
+
function setLocalVars() {
|
|
483
|
+
if (this._internalVars.contentType === 'string') {
|
|
484
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
|
485
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
|
486
|
+
this._internalVars.node = this._options.content;
|
|
487
|
+
}
|
|
488
|
+
this._internalVars.csWrapper = this._internalVars.node.querySelector(".consolidated-summary-wrapper");
|
|
489
|
+
this._internalVars.verticalTabs = this._internalVars.node.querySelector('.consolidated-summary-content-tabs');
|
|
490
|
+
this._internalVars.tabs = this._internalVars.verticalTabs.querySelectorAll('.tab');
|
|
491
|
+
this._internalVars.panels = this._internalVars.verticalTabs.querySelectorAll('.panel');
|
|
492
|
+
// Check if Policy Log exists, then create local vars;
|
|
493
|
+
this._internalVars.plogComponent = this._internalVars.node.querySelector(".plog") || null;
|
|
494
|
+
this._internalVars.plogBtn = this._internalVars.node.querySelector(".plog-btn") || null;
|
|
495
|
+
this._internalVars.plogForm = this._internalVars.node.querySelector(".policy-note-input-form") || null;
|
|
496
|
+
this._internalVars.plogSendBtn = this._internalVars.node.querySelector(".plog-input-bar .send-btn") || null;
|
|
497
|
+
// External DOM Elements
|
|
498
|
+
this._internalVars.toTop = document.querySelector('#to-top') || null;
|
|
499
|
+
this._internalVars.pageWrapper = document.querySelector('#wrapper') || null;
|
|
500
|
+
this._internalVars.drtMessage = document.querySelector('.docked-real-time-message-wrapper') || null;
|
|
501
|
+
this._internalVars.delete_switch = document.querySelector('.admin-delete-switch') || null;
|
|
502
|
+
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export default ConsolidatedSummary;
|