geico-design-kit 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
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,489 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports["default"] = void 0;
|
7
|
+
var _baseComponent = _interopRequireDefault(require("../../src/baseComponent"));
|
8
|
+
var _UserAgentService = _interopRequireDefault(require("../../src/services/UserAgentService"));
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
10
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
11
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
12
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
13
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
16
|
+
var PromiseIE = require('es6-promise-polyfill').Promise;
|
17
|
+
// get the correct click event
|
18
|
+
var clickEventName = _UserAgentService["default"]._clickEventName();
|
19
|
+
var validateSettings = [{
|
20
|
+
setting: "content",
|
21
|
+
isRequired: true,
|
22
|
+
validate: "type",
|
23
|
+
possibleValues: ["string", "object"],
|
24
|
+
errorMessage: ["GDK Consolidated Summary : Content must be defined and set to a DOM selector or Node"]
|
25
|
+
}, {
|
26
|
+
setting: "autoLoad",
|
27
|
+
isRequired: false,
|
28
|
+
validate: "type",
|
29
|
+
possibleValues: ["boolean"],
|
30
|
+
errorMessage: ["GDK Consolidated Summary : autoLoad must be a boolean"]
|
31
|
+
}, {
|
32
|
+
setting: "loadPlog",
|
33
|
+
isRequired: false,
|
34
|
+
validate: "type",
|
35
|
+
possibleValues: ["function"],
|
36
|
+
errorMessage: ["GDK Consolidated Summary : loadPlog must be a function"]
|
37
|
+
}];
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Consolidated Summary Component: This is integrated informative component for GEICO Counselors. Main purpose is to ease counselors
|
41
|
+
* work by displaying various information on selected policy holder.
|
42
|
+
*/
|
43
|
+
var ConsolidatedSummary = /*#__PURE__*/function () {
|
44
|
+
/**
|
45
|
+
*
|
46
|
+
* @param options
|
47
|
+
*/
|
48
|
+
function ConsolidatedSummary(options) {
|
49
|
+
_classCallCheck(this, ConsolidatedSummary);
|
50
|
+
this._internalVars = {
|
51
|
+
node: null,
|
52
|
+
//used for the current node
|
53
|
+
consolidatedSummary: null //holds reference to the consolidated Summary node;
|
54
|
+
};
|
55
|
+
this._defaults = {
|
56
|
+
initialTabOpen: 1,
|
57
|
+
autoLoad: true,
|
58
|
+
loadPlog: function loadPlog() {
|
59
|
+
//Return an empty promise
|
60
|
+
return new PromiseIE(function (resolve, reject) {
|
61
|
+
resolve();
|
62
|
+
});
|
63
|
+
}
|
64
|
+
};
|
65
|
+
if (options && _typeof(options) === "object") {
|
66
|
+
this._options = _baseComponent["default"].extendDefaults(this._defaults, options);
|
67
|
+
}
|
68
|
+
if (_baseComponent["default"].validateSettings(this._options, validateSettings)) {
|
69
|
+
this._internalVars.contentType = _baseComponent["default"].getContentType(this);
|
70
|
+
setLocalVars.call(this);
|
71
|
+
setEvents.call(this);
|
72
|
+
init.call(this);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
/**
|
77
|
+
* This method cleans up all Consolidated Summary tracks in the DOM, but does NOT destroy
|
78
|
+
* the Consolidated Summary Object.
|
79
|
+
*/
|
80
|
+
return _createClass(ConsolidatedSummary, [{
|
81
|
+
key: "hide",
|
82
|
+
value: function hide() {
|
83
|
+
hideComponent.call(this);
|
84
|
+
}
|
85
|
+
|
86
|
+
/**
|
87
|
+
* This global method displays consolodated summary.
|
88
|
+
* @param initFix
|
89
|
+
*/
|
90
|
+
}, {
|
91
|
+
key: "show",
|
92
|
+
value: function show(initFix) {
|
93
|
+
var node = this._internalVars.node;
|
94
|
+
if (initFix) {
|
95
|
+
this._internalVars.pageWrapper.classList.add('consolidated-summary-enabled');
|
96
|
+
if (this._internalVars.toTop !== null) {
|
97
|
+
this._internalVars.toTop.classList.add('consolidated-summary-enabled');
|
98
|
+
}
|
99
|
+
} else {
|
100
|
+
displayComponent.call(this);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Destroy the Consolidated Summary component.
|
106
|
+
*/
|
107
|
+
}, {
|
108
|
+
key: "destroy",
|
109
|
+
value: function destroy() {
|
110
|
+
removeEvents.call(this);
|
111
|
+
delete this._internalVars;
|
112
|
+
}
|
113
|
+
}]);
|
114
|
+
}();
|
115
|
+
/**
|
116
|
+
* Initializing method
|
117
|
+
*/
|
118
|
+
function init() {
|
119
|
+
// make sure the #wrapper don't have the .pinned-consolidated-summary class;
|
120
|
+
this._internalVars.csWrapper.classList.remove('pinned-consolidated-summary');
|
121
|
+
if (this._options.autoLoad && this._internalVars.node.classList.contains('hidden')) {
|
122
|
+
this.show();
|
123
|
+
} else if (!this._options.autoLoad && !this._internalVars.node.classList.contains('hidden')) {
|
124
|
+
this.hide();
|
125
|
+
} else if (this._options.autoLoad && !this._internalVars.node.classList.contains('hidden')) {
|
126
|
+
this.show(true);
|
127
|
+
}
|
128
|
+
this._internalVars.node.classList.remove('extended');
|
129
|
+
if (this._internalVars.plogComponent && (!this._internalVars.plogComponent.classList || !this._internalVars.plogComponent.classList.contains('extended'))) {
|
130
|
+
this._internalVars.plogComponent.classList.add('hidden');
|
131
|
+
}
|
132
|
+
|
133
|
+
/* Instantiate the tabs */
|
134
|
+
openInitialTab.call(this);
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* method to set events for the component
|
139
|
+
*/
|
140
|
+
function setEvents() {
|
141
|
+
/* Tabs */
|
142
|
+
var tabs = this._internalVars.verticalTabs.querySelectorAll('.tab');
|
143
|
+
var plogBtn, plogResizeBtn, plogMinimizeBtn;
|
144
|
+
|
145
|
+
/* PLOG Controls */
|
146
|
+
if (this._internalVars.plogComponent !== null && this._internalVars.plogBtn !== null) {
|
147
|
+
plogBtn = this._internalVars.plogBtn;
|
148
|
+
/*PLOG Window Controls */
|
149
|
+
plogResizeBtn = this._internalVars.plogComponent.querySelector(".plogResizeBtn");
|
150
|
+
plogMinimizeBtn = this._internalVars.plogComponent.querySelector(".plogMinimizeBtn");
|
151
|
+
}
|
152
|
+
|
153
|
+
// On mouse click behavior
|
154
|
+
this._internalVars.csWrapper.addEventListener(clickEventName, extendCSHandler.bind(this));
|
155
|
+
// this._internalVars.csWrapper.addEventListener(clickEventName, function () {
|
156
|
+
// console.log("opa opa");
|
157
|
+
// });
|
158
|
+
// On mouse leave behavior
|
159
|
+
// this._internalVars.csWrapper.addEventListener("mouseleave", retractCSHandler.call(this));
|
160
|
+
this._internalVars.csWrapper.addEventListener("mouseleave", retractCSHandler.bind(this));
|
161
|
+
|
162
|
+
// implement "pinned" functionality
|
163
|
+
this._internalVars.node.querySelector(".consolidated-summary-pin").addEventListener(clickEventName, pinHandler.bind(this));
|
164
|
+
Array.prototype.map.call(tabs, function (element) {
|
165
|
+
element.addEventListener(clickEventName, tabClickHandler.bind(this));
|
166
|
+
}.bind(this));
|
167
|
+
if (plogBtn) {
|
168
|
+
plogBtn.addEventListener(clickEventName, pLogToggleHandler.bind(this));
|
169
|
+
}
|
170
|
+
if (plogMinimizeBtn) {
|
171
|
+
plogMinimizeBtn.addEventListener(clickEventName, minimizePlogHandler.bind(this));
|
172
|
+
}
|
173
|
+
if (plogResizeBtn) {
|
174
|
+
plogResizeBtn.addEventListener(clickEventName, resizePlogHandler.bind(this));
|
175
|
+
}
|
176
|
+
if (this._internalVars.delete_switch !== null) {
|
177
|
+
this._internalVars.delete_switch.addEventListener(clickEventName, toggleNotesDeleteButtons.bind(this));
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
/**
|
182
|
+
* method to remove events for the component
|
183
|
+
*/
|
184
|
+
function removeEvents() {
|
185
|
+
/* Tabs */
|
186
|
+
var tabs = this._internalVars.verticalTabs.querySelectorAll('.tab');
|
187
|
+
var plogBtn, plogResizeBtn, plogMinimizeBtn;
|
188
|
+
|
189
|
+
/* PLOG Controls */
|
190
|
+
if (this._internalVars.plogComponent !== null && this._internalVars.plogBtn !== null) {
|
191
|
+
plogBtn = this._internalVars.plogBtn;
|
192
|
+
/*PLOG Window Controls */
|
193
|
+
plogResizeBtn = this._internalVars.plogComponent.querySelector(".plogResizeBtn");
|
194
|
+
plogMinimizeBtn = this._internalVars.plogComponent.querySelector(".plogMinimizeBtn");
|
195
|
+
}
|
196
|
+
|
197
|
+
// On mouse click behavior
|
198
|
+
this._internalVars.csWrapper.removeEventListener(clickEventName, extendCSHandler.bind(this));
|
199
|
+
// On mouse leave behavior
|
200
|
+
this._internalVars.csWrapper.removeEventListener("mouseleave", retractCSHandler.bind(this));
|
201
|
+
// implement "pinned" functionality
|
202
|
+
this._internalVars.node.querySelector(".consolidated-summary-pin").removeEventListener(clickEventName, pinHandler.bind(this));
|
203
|
+
Array.prototype.map.call(tabs, function (element) {
|
204
|
+
element.removeEventListener(clickEventName, tabClickHandler.bind(this));
|
205
|
+
}.bind(this));
|
206
|
+
if (plogBtn) {
|
207
|
+
plogBtn.removeEventListener(clickEventName, pLogToggleHandler.bind(this));
|
208
|
+
}
|
209
|
+
if (plogMinimizeBtn) {
|
210
|
+
plogMinimizeBtn.removeEventListener(clickEventName, minimizePlogHandler.bind(this));
|
211
|
+
}
|
212
|
+
if (plogResizeBtn) {
|
213
|
+
plogResizeBtn.removeEventListener(clickEventName, resizePlogHandler.bind(this));
|
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
|
+
function retractCSHandler() {
|
224
|
+
this._internalVars.node.classList.remove("extended");
|
225
|
+
if (this._internalVars.toTop !== null) {
|
226
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-extended');
|
227
|
+
}
|
228
|
+
}
|
229
|
+
function pinHandler() {
|
230
|
+
if (!this._internalVars.node.classList.contains("pinned")) {
|
231
|
+
this._internalVars.pageWrapper.classList.add('pinned-consolidated-summary');
|
232
|
+
if (this._internalVars.toTop !== null) {
|
233
|
+
this._internalVars.toTop.classList.add('consolidated-summary-pinned');
|
234
|
+
}
|
235
|
+
if (this._internalVars.drtMessage !== null) {
|
236
|
+
var dockedMsgArray = document.querySelectorAll('.docked-real-time-message-wrapper');
|
237
|
+
Array.prototype.forEach.call(dockedMsgArray, function (element) {
|
238
|
+
if (!element.classList.contains('con-sum-pinned')) {
|
239
|
+
if (element.hasAttribute('id')) {
|
240
|
+
element.classList.add('con-sum-three-hundred-fix');
|
241
|
+
}
|
242
|
+
element.classList.add('con-sum-pinned');
|
243
|
+
}
|
244
|
+
});
|
245
|
+
}
|
246
|
+
this._internalVars.node.classList.add("pinned");
|
247
|
+
} else {
|
248
|
+
this._internalVars.pageWrapper.classList.remove('pinned-consolidated-summary');
|
249
|
+
if (this._internalVars.toTop !== null) {
|
250
|
+
if (this._internalVars.toTop.classList.contains('consolidated-summary-pinned')) {
|
251
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-pinned');
|
252
|
+
}
|
253
|
+
}
|
254
|
+
if (this._internalVars.drtMessage !== null) {
|
255
|
+
var _dockedMsgArray = document.querySelectorAll('.docked-real-time-message-wrapper');
|
256
|
+
Array.prototype.forEach.call(_dockedMsgArray, function (element) {
|
257
|
+
if (element.classList.contains('con-sum-pinned')) {
|
258
|
+
if (element.hasAttribute('id')) {
|
259
|
+
element.classList.remove('con-sum-three-hundred-fix');
|
260
|
+
}
|
261
|
+
element.classList.remove('con-sum-pinned');
|
262
|
+
}
|
263
|
+
});
|
264
|
+
}
|
265
|
+
this._internalVars.node.classList.remove("pinned");
|
266
|
+
}
|
267
|
+
}
|
268
|
+
function pLogToggleHandler() {
|
269
|
+
this._options.loadPlog().then(plogToggle.call(this));
|
270
|
+
function plogToggle() {
|
271
|
+
// hide Policy Notes
|
272
|
+
if (!this._internalVars.plogComponent.classList.contains("hidden")) {
|
273
|
+
this._internalVars.plogComponent.classList.add("hidden");
|
274
|
+
if (this._internalVars.toTop !== null) {
|
275
|
+
this._internalVars.toTop.classList.remove('plog-enabled');
|
276
|
+
}
|
277
|
+
} else {
|
278
|
+
// Display Policy Notes
|
279
|
+
this._internalVars.plogComponent.classList.remove("hidden");
|
280
|
+
if (this._internalVars.toTop !== null) {
|
281
|
+
this._internalVars.toTop.classList.add('plog-enabled');
|
282
|
+
}
|
283
|
+
}
|
284
|
+
}
|
285
|
+
}
|
286
|
+
function toggleNotesDeleteButtons(e) {
|
287
|
+
e.target.parentElement.parentElement.parentElement.classList.add('admin-on');
|
288
|
+
var notes = this._internalVars.plogComponent.querySelectorAll('.policy-note>.note-details>.delete-note');
|
289
|
+
for (var note in notes) {
|
290
|
+
if (_typeof(notes[note]) === 'object') {
|
291
|
+
notes[note].classList.remove('hidden');
|
292
|
+
}
|
293
|
+
}
|
294
|
+
}
|
295
|
+
function minimizePlogHandler() {
|
296
|
+
if (!this._internalVars.plogComponent.classList.contains("hidden")) {
|
297
|
+
this._internalVars.plogComponent.classList.remove("maximized");
|
298
|
+
if (this._internalVars.toTop !== null) {
|
299
|
+
if (!this._internalVars.node.classList.contains('extended') && this._internalVars.toTop.classList.contains('consolidated-summary-extended')) {
|
300
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-extended');
|
301
|
+
}
|
302
|
+
if (!this._internalVars.node.classList.contains("pinned") && this._internalVars.toTop.classList.contains('consolidated-summary-pinned')) {
|
303
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-pinned');
|
304
|
+
}
|
305
|
+
this._internalVars.toTop.classList.remove('plog-enabled');
|
306
|
+
}
|
307
|
+
this._internalVars.plogComponent.classList.add("hidden");
|
308
|
+
} else {
|
309
|
+
this._internalVars.plogComponent.classList.remove("hidden");
|
310
|
+
}
|
311
|
+
}
|
312
|
+
function resizePlogHandler() {
|
313
|
+
if (!this._internalVars.plogComponent.classList.contains("maximized")) {
|
314
|
+
if (this._internalVars.node.classList && this._internalVars.node.classList.contains("extended")) {
|
315
|
+
this._internalVars.node.classList.remove("extended");
|
316
|
+
}
|
317
|
+
if (this._internalVars.node.classList && this._internalVars.node.classList.contains("pinned")) {
|
318
|
+
this._internalVars.pageWrapper.classList.remove('pinned-consolidated-summary');
|
319
|
+
this._internalVars.node.classList.remove("pinned");
|
320
|
+
}
|
321
|
+
this._internalVars.plogComponent.classList.add("maximized");
|
322
|
+
} else {
|
323
|
+
this._internalVars.plogComponent.classList.remove("maximized");
|
324
|
+
}
|
325
|
+
}
|
326
|
+
|
327
|
+
/* Tabs Methods */
|
328
|
+
|
329
|
+
/**
|
330
|
+
* tabClickHandler()
|
331
|
+
* Opens tab content for clicked tab and hides the rest
|
332
|
+
*/
|
333
|
+
function tabClickHandler(element) {
|
334
|
+
var _this = this;
|
335
|
+
var currentNode = element.currentTarget;
|
336
|
+
//get index of clicked tab
|
337
|
+
var index = [].indexOf.call(this._internalVars.tabs, currentNode);
|
338
|
+
if (this._options.tabClicked) if (this._options.tabClicked(currentNode) === false) return false;
|
339
|
+
Array.prototype.map.call(this._internalVars.tabs, function (element) {
|
340
|
+
if (element === currentNode) {
|
341
|
+
element.classList.add("active");
|
342
|
+
} else {
|
343
|
+
element.classList.remove("active");
|
344
|
+
}
|
345
|
+
});
|
346
|
+
Array.prototype.map.call(this._internalVars.panels, function (element, i) {
|
347
|
+
if (i === index) {
|
348
|
+
openPanel.call(_this, element);
|
349
|
+
} else {
|
350
|
+
closePanel.call(_this, element);
|
351
|
+
}
|
352
|
+
});
|
353
|
+
}
|
354
|
+
|
355
|
+
/**
|
356
|
+
* openInitialTab()
|
357
|
+
* Opens tab content for tab set by initialTabOpen
|
358
|
+
*/
|
359
|
+
function openInitialTab() {
|
360
|
+
var _this2 = this;
|
361
|
+
var tabIndex = this._options.initialTabOpen - 1;
|
362
|
+
Array.prototype.map.call(this._internalVars.tabs, function (element, i) {
|
363
|
+
if (i === tabIndex) {
|
364
|
+
element.classList.add("active");
|
365
|
+
} else {
|
366
|
+
element.classList.remove("active");
|
367
|
+
}
|
368
|
+
});
|
369
|
+
Array.prototype.map.call(this._internalVars.panels, function (element, i) {
|
370
|
+
if (i === tabIndex) {
|
371
|
+
openPanel.call(_this2, element);
|
372
|
+
} else {
|
373
|
+
closePanel.call(_this2, element);
|
374
|
+
}
|
375
|
+
});
|
376
|
+
}
|
377
|
+
|
378
|
+
/**
|
379
|
+
* openPanel()
|
380
|
+
* Opens panel at the same index as the clicked tab and hides the other panels
|
381
|
+
*/
|
382
|
+
function openPanel(element) {
|
383
|
+
element.classList.add("active");
|
384
|
+
}
|
385
|
+
|
386
|
+
/**
|
387
|
+
* closePanel()
|
388
|
+
* closes the past in panel
|
389
|
+
*/
|
390
|
+
function closePanel(element) {
|
391
|
+
element.classList.remove("active");
|
392
|
+
}
|
393
|
+
|
394
|
+
/**
|
395
|
+
* Displays the component (display).
|
396
|
+
*/
|
397
|
+
function displayComponent() {
|
398
|
+
var node = this._internalVars.node;
|
399
|
+
/* con-sum-on */
|
400
|
+
if (this._internalVars.node.classList) {
|
401
|
+
if (this._internalVars.node.classList.contains('hidden')) {
|
402
|
+
this._internalVars.node.classList.remove("hidden");
|
403
|
+
if (!this._internalVars.pageWrapper.classList.contains('consolidated-summary-enabled')) {
|
404
|
+
this._internalVars.pageWrapper.classList.add('consolidated-summary-enabled');
|
405
|
+
}
|
406
|
+
if (this._internalVars.toTop !== null) {
|
407
|
+
if (!this._internalVars.toTop.classList.contains('consolidated-summary-enabled')) {
|
408
|
+
this._internalVars.toTop.classList.add('consolidated-summary-enabled');
|
409
|
+
}
|
410
|
+
}
|
411
|
+
if (this._internalVars.drtMessage !== null) {
|
412
|
+
var dockedMsgArray = document.querySelectorAll('.docked-real-time-message-wrapper');
|
413
|
+
Array.prototype.forEach.call(dockedMsgArray, function (element) {
|
414
|
+
if (!element.classList.contains('con-sum-on')) {
|
415
|
+
if (element.hasAttribute('id')) {
|
416
|
+
element.classList.add('con-sum-fifty-fix');
|
417
|
+
}
|
418
|
+
element.classList.add('con-sum-on');
|
419
|
+
}
|
420
|
+
});
|
421
|
+
}
|
422
|
+
}
|
423
|
+
}
|
424
|
+
}
|
425
|
+
|
426
|
+
/**
|
427
|
+
* Hides the component (hide)
|
428
|
+
*/
|
429
|
+
function hideComponent() {
|
430
|
+
var node = this._internalVars.node;
|
431
|
+
// Hide Consolidated Summary if exists on the DOM
|
432
|
+
if (this._internalVars.node.classList.contains('extended')) {
|
433
|
+
this._internalVars.node.classList.remove('extended');
|
434
|
+
}
|
435
|
+
if (this._internalVars.node.classList.contains('pinned')) {
|
436
|
+
this._internalVars.node.classList.remove('pinned');
|
437
|
+
}
|
438
|
+
if (!this._internalVars.node.classList.contains('hidden')) {
|
439
|
+
this._internalVars.node.classList.add('hidden');
|
440
|
+
}
|
441
|
+
|
442
|
+
// Clean up any Docked Real Time Message classes
|
443
|
+
// const drtMessage = document.querySelector('.docked-real-time-message-wrapper') || null;
|
444
|
+
if (this._internalVars.drtMessage !== null) {
|
445
|
+
var dockedMsgArray = document.querySelectorAll('.docked-real-time-message-wrapper');
|
446
|
+
Array.prototype.forEach.call(dockedMsgArray, function (element) {
|
447
|
+
if (element.classList.contains('con-sum-pinned')) {
|
448
|
+
if (element.hasAttribute('id')) {
|
449
|
+
element.classList.remove('con-sum-three-hundred-fix');
|
450
|
+
}
|
451
|
+
element.classList.remove('con-sum-pinned');
|
452
|
+
}
|
453
|
+
});
|
454
|
+
}
|
455
|
+
// Remove classes of the HTML DOM elements #wrapper and #to-top
|
456
|
+
this._internalVars.pageWrapper.classList.remove('consolidated-summary-enabled');
|
457
|
+
this._internalVars.pageWrapper.classList.remove('pinned-consolidated-summary');
|
458
|
+
this._internalVars.node.classList.remove('pinned');
|
459
|
+
if (this._internalVars.toTop !== null) {
|
460
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-enabled');
|
461
|
+
this._internalVars.toTop.classList.remove('consolidated-summary-pinned');
|
462
|
+
}
|
463
|
+
}
|
464
|
+
|
465
|
+
/**
|
466
|
+
* Method to set local variables.
|
467
|
+
*/
|
468
|
+
function setLocalVars() {
|
469
|
+
if (this._internalVars.contentType === 'string') {
|
470
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
471
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
472
|
+
this._internalVars.node = this._options.content;
|
473
|
+
}
|
474
|
+
this._internalVars.csWrapper = this._internalVars.node.querySelector(".consolidated-summary-wrapper");
|
475
|
+
this._internalVars.verticalTabs = this._internalVars.node.querySelector('.consolidated-summary-content-tabs');
|
476
|
+
this._internalVars.tabs = this._internalVars.verticalTabs.querySelectorAll('.tab');
|
477
|
+
this._internalVars.panels = this._internalVars.verticalTabs.querySelectorAll('.panel');
|
478
|
+
// Check if Policy Log exists, then create local vars;
|
479
|
+
this._internalVars.plogComponent = this._internalVars.node.querySelector(".plog") || null;
|
480
|
+
this._internalVars.plogBtn = this._internalVars.node.querySelector(".plog-btn") || null;
|
481
|
+
this._internalVars.plogForm = this._internalVars.node.querySelector(".policy-note-input-form") || null;
|
482
|
+
this._internalVars.plogSendBtn = this._internalVars.node.querySelector(".plog-input-bar .send-btn") || null;
|
483
|
+
// External DOM Elements
|
484
|
+
this._internalVars.toTop = document.querySelector('#to-top') || null;
|
485
|
+
this._internalVars.pageWrapper = document.querySelector('#wrapper') || null;
|
486
|
+
this._internalVars.drtMessage = document.querySelector('.docked-real-time-message-wrapper') || null;
|
487
|
+
this._internalVars.delete_switch = document.querySelector('.admin-delete-switch') || null;
|
488
|
+
}
|
489
|
+
var _default = exports["default"] = ConsolidatedSummary;
|
@@ -0,0 +1,201 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports["default"] = void 0;
|
7
|
+
var _baseComponent = _interopRequireDefault(require("../../src/baseComponent"));
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
10
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
11
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
12
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
15
|
+
var validateSettings = [{
|
16
|
+
setting: 'content',
|
17
|
+
isRequired: true,
|
18
|
+
validate: 'type',
|
19
|
+
possibleValues: ['string', 'object'],
|
20
|
+
errorMessage: ['GDK Alert : Content must be defined and set to a DOM selector or Node']
|
21
|
+
}];
|
22
|
+
var CoverageGraph = /*#__PURE__*/function () {
|
23
|
+
/**
|
24
|
+
* These are settings for the instantiation. Refer to the design kit section of this component for JS setting examples.
|
25
|
+
* @param {string|Object} content
|
26
|
+
* A reference to the coverage graph node
|
27
|
+
*/
|
28
|
+
function CoverageGraph(options) {
|
29
|
+
_classCallCheck(this, CoverageGraph);
|
30
|
+
this._internalVars = {
|
31
|
+
node: null,
|
32
|
+
//used for current node
|
33
|
+
breakdownNode: null,
|
34
|
+
legendNode: null,
|
35
|
+
labelArray: null,
|
36
|
+
costArray: null,
|
37
|
+
percentArray: [],
|
38
|
+
totalSum: 0,
|
39
|
+
percentSum: 0,
|
40
|
+
centerCircle: null
|
41
|
+
};
|
42
|
+
|
43
|
+
//options with defaults set
|
44
|
+
this._defaults = {};
|
45
|
+
|
46
|
+
// Create options by extending defaults with the passed in arugments
|
47
|
+
if (options && _typeof(options) === "object") {
|
48
|
+
this._options = _baseComponent["default"].extendDefaults(this._defaults, options);
|
49
|
+
}
|
50
|
+
|
51
|
+
//if the required options are valid set up the environment
|
52
|
+
if (_baseComponent["default"].validateSettings(this._options, validateSettings)) {
|
53
|
+
this._internalVars.contentType = _baseComponent["default"].getContentType(this);
|
54
|
+
setLocalVars.call(this);
|
55
|
+
setEvents.call(this);
|
56
|
+
appendCenterCost.call(this);
|
57
|
+
createSlices.call(this);
|
58
|
+
createLegend.call(this);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
//Public Methods
|
63
|
+
|
64
|
+
/**
|
65
|
+
* destroy()
|
66
|
+
* removes the node from the dom and any events attached
|
67
|
+
*/
|
68
|
+
return _createClass(CoverageGraph, [{
|
69
|
+
key: "destroy",
|
70
|
+
value: function destroy() {
|
71
|
+
$(this._internalVars.node).datepicker("destroy");
|
72
|
+
this._internalVars.node.parentNode.removeChild(this._internalVars.node);
|
73
|
+
|
74
|
+
//a little garbage collection
|
75
|
+
for (var variableKey in this) {
|
76
|
+
if (this.hasOwnProperty(variableKey)) {
|
77
|
+
delete this[variableKey];
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}]);
|
82
|
+
}(); // Private Methods
|
83
|
+
function setLocalVars() {
|
84
|
+
if (this._internalVars.contentType === 'string') {
|
85
|
+
this._internalVars.node = document.querySelector(this._options.content);
|
86
|
+
} else if (this._internalVars.contentType === 'domNode') {
|
87
|
+
this._internalVars.node = this._options.content;
|
88
|
+
}
|
89
|
+
this._internalVars.breakdownNode = this._internalVars.node.querySelector('.coverage-graph-breakdown');
|
90
|
+
if (this._internalVars.breakdownNode.dataset !== undefined) {
|
91
|
+
this._internalVars.costArray = this._internalVars.breakdownNode.dataset.costbreakdown.split(" ");
|
92
|
+
this._internalVars.labelArray = this._internalVars.breakdownNode.dataset.labels.split(",");
|
93
|
+
} else {
|
94
|
+
this._internalVars.labelArray = this._internalVars.breakdownNode.getAttribute('data-labels').split(",");
|
95
|
+
this._internalVars.costArray = this._internalVars.breakdownNode.getAttribute('data-costbreakdown').split(" ");
|
96
|
+
}
|
97
|
+
this._internalVars.centerCircle = this._internalVars.breakdownNode.querySelector('.circle');
|
98
|
+
this._internalVars.legendNode = this._internalVars.node.querySelector('.legend');
|
99
|
+
}
|
100
|
+
|
101
|
+
/**
|
102
|
+
* setEvents()
|
103
|
+
* Sets all the events needed for the component
|
104
|
+
*/
|
105
|
+
function setEvents() {}
|
106
|
+
function appendCenterCost() {
|
107
|
+
var monetary = this._internalVars.centerCircle.querySelector('.monetary');
|
108
|
+
var sumText = getCostSum.call(this);
|
109
|
+
var costBreakdownArray = sumText.toString().split(".");
|
110
|
+
var textNodeSum = document.createTextNode(costBreakdownArray[0]);
|
111
|
+
monetary.appendChild(textNodeSum);
|
112
|
+
var supElement = document.createElement('SUP');
|
113
|
+
var textNodeSumDecimal = document.createTextNode("." + costBreakdownArray[1]);
|
114
|
+
supElement.appendChild(textNodeSumDecimal);
|
115
|
+
monetary.appendChild(supElement);
|
116
|
+
}
|
117
|
+
function createSlices() {
|
118
|
+
var percentarray = createPercentageArray.call(this);
|
119
|
+
var sheet = function () {
|
120
|
+
var style = document.createElement('STYLE');
|
121
|
+
style.appendChild(document.createTextNode(""));
|
122
|
+
document.head.appendChild(style);
|
123
|
+
return style.sheet;
|
124
|
+
}();
|
125
|
+
for (var j = 0; j < percentarray.length; j++) {
|
126
|
+
var newDiv = document.createElement('DIV');
|
127
|
+
this._internalVars.breakdownNode.appendChild(newDiv);
|
128
|
+
if (percentarray[j] >= 180) {
|
129
|
+
newDiv.setAttribute('class', 'pie big');
|
130
|
+
} else {
|
131
|
+
newDiv.setAttribute('class', 'pie');
|
132
|
+
}
|
133
|
+
newDiv.setAttribute('data-start', this._internalVars.percentSum.toFixed(1));
|
134
|
+
if (j !== 0) {
|
135
|
+
setPrefixes(newDiv, "Transform", "rotate(" + this._internalVars.percentSum + "deg)");
|
136
|
+
sheet.insertRule(insertDataStartCSS(this._internalVars.percentSum), 0);
|
137
|
+
}
|
138
|
+
this._internalVars.percentSum += parseFloat(percentarray[j]);
|
139
|
+
newDiv.setAttribute('data-value', percentarray[j]);
|
140
|
+
sheet.insertRule(insertDataValueCSS(percentarray[j], percentarray.length, j), 0);
|
141
|
+
}
|
142
|
+
}
|
143
|
+
function insertDataValueCSS(degree, length, index) {
|
144
|
+
degree = parseFloat(degree);
|
145
|
+
var degree1 = degree;
|
146
|
+
if (index != length - 1) {
|
147
|
+
degree1 = parseFloat(degree + 1);
|
148
|
+
}
|
149
|
+
var cssString = ".pie[data-value='" + degree + "']:BEFORE { -moz-transform: rotate(" + degree1 + "deg); -ms-transform: rotate(" + degree1 + "deg); -webkit-transform: rotate(" + degree1 + "deg); -o-transform: rotate(" + degree1 + "deg); transform:rotate(" + degree1 + "deg);}";
|
150
|
+
return cssString;
|
151
|
+
}
|
152
|
+
function insertDataStartCSS(degree) {
|
153
|
+
degree = parseFloat(degree).toFixed(1);
|
154
|
+
var cssString = ".pie[data-start='" + degree + "'] { -moz-transform: rotate(" + degree + "deg); /* Firefox */ -ms-transform: rotate(" + degree + "deg); /* IE */ -webkit-transform: rotate(" + degree + "deg); /* Safari and Chrome */ -o-transform: rotate(" + degree + "deg); /* Opera */transform:rotate(" + degree + "deg);}";
|
155
|
+
return cssString;
|
156
|
+
}
|
157
|
+
function setPrefixes(element, property, value) {
|
158
|
+
element.style["webkit" + property] = value;
|
159
|
+
element.style["moz" + property] = value;
|
160
|
+
element.style["ms" + property] = value;
|
161
|
+
element.style["o" + property] = value;
|
162
|
+
}
|
163
|
+
function getCostSum() {
|
164
|
+
var costArray = this._internalVars.costArray;
|
165
|
+
var sum = this._internalVars.totalSum;
|
166
|
+
for (var i = 0; i < costArray.length; i++) {
|
167
|
+
sum += parseFloat(costArray[i]);
|
168
|
+
}
|
169
|
+
sum = sum.toFixed(2);
|
170
|
+
return sum;
|
171
|
+
}
|
172
|
+
function createLegend() {
|
173
|
+
var costArray = this._internalVars.costArray;
|
174
|
+
var labelArray = this._internalVars.labelArray;
|
175
|
+
for (var i = 0; i < costArray.length; i++) {
|
176
|
+
this._internalVars.legendNode.querySelector('ul').appendChild(createLi(labelArray[i], parseFloat(costArray[i])));
|
177
|
+
}
|
178
|
+
}
|
179
|
+
function createPercentageArray() {
|
180
|
+
var costArray = this._internalVars.costArray;
|
181
|
+
var costSum = getCostSum.call(this);
|
182
|
+
for (var j = 0; j < costArray.length; j++) {
|
183
|
+
this._internalVars.percentArray.push(costToPercentage(costArray[j], costSum));
|
184
|
+
}
|
185
|
+
return this._internalVars.percentArray;
|
186
|
+
}
|
187
|
+
function costToPercentage(cost, sum) {
|
188
|
+
var percent = cost / sum * 360;
|
189
|
+
return percent;
|
190
|
+
}
|
191
|
+
function createLi(item, cost) {
|
192
|
+
var liEl = document.createElement("LI");
|
193
|
+
var divEl = document.createElement("DIV");
|
194
|
+
divEl.setAttribute('class', 'legend-item');
|
195
|
+
liEl.appendChild(divEl);
|
196
|
+
var labelString = item + " ($" + cost.toFixed(2) + ")";
|
197
|
+
var hello = document.createTextNode(labelString);
|
198
|
+
liEl.appendChild(hello);
|
199
|
+
return liEl;
|
200
|
+
}
|
201
|
+
var _default = exports["default"] = CoverageGraph;
|