@rhc-shared-components/packages-table 0.1.0 → 0.1.1
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/index.d.ts +0 -1
- package/dist/index.js +46 -3090
- package/dist/index.modern.js +41 -2719
- package/package.json +2 -5
package/dist/index.js
CHANGED
|
@@ -35,3056 +35,7 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
35
35
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
36
36
|
var mergeWith__default = /*#__PURE__*/_interopDefaultLegacy(mergeWith);
|
|
37
37
|
|
|
38
|
-
var css_248z = ".
|
|
39
|
-
|
|
40
|
-
function _defineProperties(target, props) {
|
|
41
|
-
for (var i = 0; i < props.length; i++) {
|
|
42
|
-
var descriptor = props[i];
|
|
43
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
44
|
-
descriptor.configurable = true;
|
|
45
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
46
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
51
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
52
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
53
|
-
return Constructor;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function _extends() {
|
|
57
|
-
_extends = Object.assign || function (target) {
|
|
58
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
59
|
-
var source = arguments[i];
|
|
60
|
-
|
|
61
|
-
for (var key in source) {
|
|
62
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
63
|
-
target[key] = source[key];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return target;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return _extends.apply(this, arguments);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function _inheritsLoose(subClass, superClass) {
|
|
75
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
76
|
-
subClass.prototype.constructor = subClass;
|
|
77
|
-
|
|
78
|
-
_setPrototypeOf(subClass, superClass);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function _getPrototypeOf(o) {
|
|
82
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
83
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
84
|
-
};
|
|
85
|
-
return _getPrototypeOf(o);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function _setPrototypeOf(o, p) {
|
|
89
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
90
|
-
o.__proto__ = p;
|
|
91
|
-
return o;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
return _setPrototypeOf(o, p);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function _isNativeReflectConstruct() {
|
|
98
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
99
|
-
if (Reflect.construct.sham) return false;
|
|
100
|
-
if (typeof Proxy === "function") return true;
|
|
101
|
-
|
|
102
|
-
try {
|
|
103
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
104
|
-
return true;
|
|
105
|
-
} catch (e) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function _construct(Parent, args, Class) {
|
|
111
|
-
if (_isNativeReflectConstruct()) {
|
|
112
|
-
_construct = Reflect.construct;
|
|
113
|
-
} else {
|
|
114
|
-
_construct = function _construct(Parent, args, Class) {
|
|
115
|
-
var a = [null];
|
|
116
|
-
a.push.apply(a, args);
|
|
117
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
118
|
-
var instance = new Constructor();
|
|
119
|
-
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
120
|
-
return instance;
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return _construct.apply(null, arguments);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function _isNativeFunction(fn) {
|
|
128
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function _wrapNativeSuper(Class) {
|
|
132
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
133
|
-
|
|
134
|
-
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
135
|
-
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
136
|
-
|
|
137
|
-
if (typeof Class !== "function") {
|
|
138
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (typeof _cache !== "undefined") {
|
|
142
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
143
|
-
|
|
144
|
-
_cache.set(Class, Wrapper);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function Wrapper() {
|
|
148
|
-
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
152
|
-
constructor: {
|
|
153
|
-
value: Wrapper,
|
|
154
|
-
enumerable: false,
|
|
155
|
-
writable: true,
|
|
156
|
-
configurable: true
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
return _setPrototypeOf(Wrapper, Class);
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
return _wrapNativeSuper(Class);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function _assertThisInitialized(self) {
|
|
166
|
-
if (self === void 0) {
|
|
167
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return self;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
174
|
-
if (!o) return;
|
|
175
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
176
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
177
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
178
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
179
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function _arrayLikeToArray(arr, len) {
|
|
183
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
184
|
-
|
|
185
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
186
|
-
|
|
187
|
-
return arr2;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
191
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
192
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
193
|
-
|
|
194
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
195
|
-
if (it) o = it;
|
|
196
|
-
var i = 0;
|
|
197
|
-
return function () {
|
|
198
|
-
if (i >= o.length) return {
|
|
199
|
-
done: true
|
|
200
|
-
};
|
|
201
|
-
return {
|
|
202
|
-
done: false,
|
|
203
|
-
value: o[i++]
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
var logger = function logger() {
|
|
212
|
-
return null;
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
* Reveal web components when loading is complete by removing the unresolved attribute
|
|
216
|
-
* from the body tag; log the event.
|
|
217
|
-
* @throws debugging log indicating the reveal event
|
|
218
|
-
*/
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
function reveal() {
|
|
222
|
-
logger("[reveal] elements ready, revealing the body");
|
|
223
|
-
window.document.body.removeAttribute("unresolved");
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Auto-reveal functionality prevents a flash of unstyled content before components
|
|
227
|
-
* have finished loading.
|
|
228
|
-
* @param {function} logFunction
|
|
229
|
-
* @see https://github.com/github/webcomponentsjs#webcomponents-loaderjs
|
|
230
|
-
*/
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
function autoReveal(logFunction) {
|
|
234
|
-
logger = logFunction; // If Web Components are already ready, run the handler right away. If they
|
|
235
|
-
// are not yet ready, wait.
|
|
236
|
-
//
|
|
237
|
-
// see https://github.com/github/webcomponentsjs#webcomponents-loaderjs for
|
|
238
|
-
// info about web component readiness events
|
|
239
|
-
|
|
240
|
-
var polyfillPresent = window.WebComponents;
|
|
241
|
-
var polyfillReady = polyfillPresent && window.WebComponents.ready;
|
|
242
|
-
|
|
243
|
-
if (!polyfillPresent || polyfillReady) {
|
|
244
|
-
handleWebComponentsReady();
|
|
245
|
-
} else {
|
|
246
|
-
window.addEventListener("WebComponentsReady", handleWebComponentsReady);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Reveal web components when loading is complete and log event.
|
|
251
|
-
* @throws debugging log indicating the web components are ready
|
|
252
|
-
*/
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
function handleWebComponentsReady() {
|
|
256
|
-
logger("[reveal] web components ready");
|
|
257
|
-
reveal();
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Verify that a property definition's `type` field contains one of the allowed
|
|
261
|
-
* types. If the definition type resolves to falsy, assumes String type.
|
|
262
|
-
* @param {constructor} definition
|
|
263
|
-
* @default String
|
|
264
|
-
* @return {Boolean} True if the definition type is one of String, Number, or Boolean
|
|
265
|
-
*/
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
function isAllowedType(definition) {
|
|
269
|
-
return [String, Number, Boolean].includes(definition.type || String);
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Verify that a property definition's `default` value is of the correct type.
|
|
273
|
-
*
|
|
274
|
-
* A `default` value is valid if it's of the same type as the `type`
|
|
275
|
-
* definition. Or, if there is no `type` definition, then it must be a String
|
|
276
|
-
* (the default value for `type`).
|
|
277
|
-
* @param {type} definition
|
|
278
|
-
* @return {Boolean} True if the default value matches the type of the definition object.
|
|
279
|
-
*/
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
function isValidDefaultType(definition) {
|
|
283
|
-
return definition.hasOwnProperty("default") && definition["default"].constructor === definition.type;
|
|
284
|
-
} // @POLYFILL Array.includes
|
|
285
|
-
|
|
286
|
-
/** @see https://tc39.github.io/ecma262/#sec-array.prototype.includes */
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
if (!Array.prototype.includes) {
|
|
290
|
-
Object.defineProperty(Array.prototype, "includes", {
|
|
291
|
-
value: function value(valueToFind, fromIndex) {
|
|
292
|
-
if (this == null) {
|
|
293
|
-
throw new TypeError('"this" is null or not defined');
|
|
294
|
-
} // 1. Let O be ? ToObject(this value).
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
var o = Object(this); // 2. Let len be ? ToLength(? Get(O, "length")).
|
|
298
|
-
|
|
299
|
-
var len = o.length >>> 0; // 3. If len is 0, return false.
|
|
300
|
-
|
|
301
|
-
if (len === 0) {
|
|
302
|
-
return false;
|
|
303
|
-
} // 4. Let n be ? ToInteger(fromIndex).
|
|
304
|
-
// (If fromIndex is undefined, this step produces the value 0.)
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
var n = fromIndex | 0; // 5. If n ≥ 0, then
|
|
308
|
-
// a. Let k be n.
|
|
309
|
-
// 6. Else n < 0,
|
|
310
|
-
// a. Let k be len + n.
|
|
311
|
-
// b. If k < 0, let k be 0.
|
|
312
|
-
|
|
313
|
-
var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
|
|
314
|
-
|
|
315
|
-
function sameValueZero(x, y) {
|
|
316
|
-
return x === y || typeof x === "number" && typeof y === "number" && isNaN(x) && isNaN(y);
|
|
317
|
-
} // 7. Repeat, while k < len
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
while (k < len) {
|
|
321
|
-
// a. Let elementK be the result of ? Get(O, ! ToString(k)).
|
|
322
|
-
// b. If SameValueZero(valueToFind, elementK) is true, return true.
|
|
323
|
-
if (sameValueZero(o[k], valueToFind)) {
|
|
324
|
-
return true;
|
|
325
|
-
} // c. Increase k by 1.
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
k++;
|
|
329
|
-
} // 8. Return false
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
return false;
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
} // @POLYFILL Object.entries
|
|
336
|
-
|
|
337
|
-
/** @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries */
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
if (!Object.entries) {
|
|
341
|
-
Object.entries = function (obj) {
|
|
342
|
-
var ownProps = Object.keys(obj),
|
|
343
|
-
i = ownProps.length,
|
|
344
|
-
resArray = new Array(i); // preallocate the Array
|
|
345
|
-
|
|
346
|
-
while (i--) {
|
|
347
|
-
resArray[i] = [ownProps[i], obj[ownProps[i]]];
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
return resArray;
|
|
351
|
-
};
|
|
352
|
-
} // @POLYFILL String.startsWith
|
|
353
|
-
|
|
354
|
-
/** @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith#polyfill */
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
if (!String.prototype.startsWith) {
|
|
358
|
-
Object.defineProperty(String.prototype, "startsWith", {
|
|
359
|
-
value: function value(search, rawPos) {
|
|
360
|
-
var pos = rawPos > 0 ? rawPos | 0 : 0;
|
|
361
|
-
return this.substring(pos, pos + search.length) === search;
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
} // @POLYFILL Element.closest
|
|
365
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
if (!Element.prototype.closest) {
|
|
369
|
-
Element.prototype.closest = function (s) {
|
|
370
|
-
var el = this;
|
|
371
|
-
|
|
372
|
-
do {
|
|
373
|
-
if (el.matches(s)) return el;
|
|
374
|
-
el = el.parentElement || el.parentNode;
|
|
375
|
-
} while (el !== null && el.nodeType === 1);
|
|
376
|
-
|
|
377
|
-
return null;
|
|
378
|
-
};
|
|
379
|
-
} // @POLYFILL Element.matches
|
|
380
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
if (!Element.prototype.matches) {
|
|
384
|
-
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
385
|
-
} // @POLYFILL Array.prototype.find
|
|
386
|
-
// https://tc39.github.io/ecma262/#sec-array.prototype.find
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
if (!Array.prototype.find) {
|
|
390
|
-
Object.defineProperty(Array.prototype, "find", {
|
|
391
|
-
value: function value(predicate) {
|
|
392
|
-
// 1. Let O be ? ToObject(this value).
|
|
393
|
-
if (this == null) {
|
|
394
|
-
throw new TypeError('"this" is null or not defined');
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
var o = Object(this); // 2. Let len be ? ToLength(? Get(O, "length")).
|
|
398
|
-
|
|
399
|
-
var len = o.length >>> 0; // 3. If IsCallable(predicate) is false, throw a TypeError exception.
|
|
400
|
-
|
|
401
|
-
if (typeof predicate !== "function") {
|
|
402
|
-
throw new TypeError("predicate must be a function");
|
|
403
|
-
} // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
var thisArg = arguments[1]; // 5. Let k be 0.
|
|
407
|
-
|
|
408
|
-
var k = 0; // 6. Repeat, while k < len
|
|
409
|
-
|
|
410
|
-
while (k < len) {
|
|
411
|
-
// a. Let Pk be ! ToString(k).
|
|
412
|
-
// b. Let kValue be ? Get(O, Pk).
|
|
413
|
-
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
|
|
414
|
-
// d. If testResult is true, return kValue.
|
|
415
|
-
var kValue = o[k];
|
|
416
|
-
|
|
417
|
-
if (predicate.call(thisArg, kValue, k, o)) {
|
|
418
|
-
return kValue;
|
|
419
|
-
} // e. Increase k by 1.
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
k++;
|
|
423
|
-
} // 7. Return undefined.
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
return undefined;
|
|
427
|
-
},
|
|
428
|
-
configurable: true,
|
|
429
|
-
writable: true
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
/*!
|
|
433
|
-
* PatternFly Elements: PFElement 1.12.3
|
|
434
|
-
* @license
|
|
435
|
-
* Copyright 2021 Red Hat, Inc.
|
|
436
|
-
*
|
|
437
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
438
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
439
|
-
* in the Software without restriction, including without limitation the rights
|
|
440
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
441
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
442
|
-
* furnished to do so, subject to the following conditions:
|
|
443
|
-
*
|
|
444
|
-
* The above copyright notice and this permission notice shall be included in
|
|
445
|
-
* all copies or substantial portions of the Software.
|
|
446
|
-
*
|
|
447
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
448
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
449
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
450
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
451
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
452
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
453
|
-
* SOFTWARE.
|
|
454
|
-
*
|
|
455
|
-
*/
|
|
456
|
-
// /**
|
|
457
|
-
// * Global prefix used for all components in the project.
|
|
458
|
-
// * @constant {String}
|
|
459
|
-
// * */
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
var prefix = "pfe";
|
|
463
|
-
/**
|
|
464
|
-
* @class PFElement
|
|
465
|
-
* @extends HTMLElement
|
|
466
|
-
* @version 1.12.3
|
|
467
|
-
* @classdesc Serves as the baseline for all PatternFly Element components.
|
|
468
|
-
*/
|
|
469
|
-
|
|
470
|
-
var PFElement = /*#__PURE__*/function (_HTMLElement) {
|
|
471
|
-
_inheritsLoose(PFElement, _HTMLElement);
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
* A boolean value that indicates if the logging should be printed to the console; used for debugging.
|
|
475
|
-
* For use in a JS file or script tag; can also be added in the constructor of a component during development.
|
|
476
|
-
* @example PFElement.debugLog(true);
|
|
477
|
-
* @tags debug
|
|
478
|
-
*/
|
|
479
|
-
PFElement.debugLog = function debugLog(preference) {
|
|
480
|
-
if (preference === void 0) {
|
|
481
|
-
preference = null;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
if (preference !== null) {
|
|
485
|
-
// wrap localStorage references in a try/catch; merely referencing it can
|
|
486
|
-
// throw errors in some locked down environments
|
|
487
|
-
try {
|
|
488
|
-
localStorage.pfeLog = !!preference;
|
|
489
|
-
} catch (e) {
|
|
490
|
-
// if localStorage fails, fall back to PFElement._debugLog
|
|
491
|
-
PFElement._debugLog = !!preference;
|
|
492
|
-
return PFElement._debugLog;
|
|
493
|
-
}
|
|
494
|
-
} // @TODO the reference to _debugLog is for backwards compatibiilty and will be removed in 2.0
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
return localStorage.pfeLog === "true" || PFElement._debugLog;
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
|
-
* A boolean value that indicates if the performance should be tracked.
|
|
501
|
-
* For use in a JS file or script tag; can also be added in the constructor of a component during development.
|
|
502
|
-
* @example PFElement._trackPerformance = true;
|
|
503
|
-
*/
|
|
504
|
-
;
|
|
505
|
-
|
|
506
|
-
PFElement.trackPerformance = function trackPerformance(preference) {
|
|
507
|
-
if (preference === void 0) {
|
|
508
|
-
preference = null;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
if (preference !== null) {
|
|
512
|
-
PFElement._trackPerformance = !!preference;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
return PFElement._trackPerformance;
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* A object that contains configuration set outside of pfe.
|
|
519
|
-
*
|
|
520
|
-
* @example const config = PFElement.config;
|
|
521
|
-
*/
|
|
522
|
-
;
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* A logging wrapper which checks the debugLog boolean and prints to the console if true.
|
|
526
|
-
*
|
|
527
|
-
* @example PFElement.log("Hello");
|
|
528
|
-
*/
|
|
529
|
-
PFElement.log = function log() {
|
|
530
|
-
if (PFElement.debugLog()) {
|
|
531
|
-
var _console;
|
|
532
|
-
|
|
533
|
-
(_console = console).log.apply(_console, [].slice.call(arguments));
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Local logging that outputs the tag name as a prefix automatically
|
|
538
|
-
*
|
|
539
|
-
* @example this.log("Hello");
|
|
540
|
-
*/
|
|
541
|
-
;
|
|
542
|
-
|
|
543
|
-
var _proto = PFElement.prototype;
|
|
544
|
-
|
|
545
|
-
_proto.log = function log() {
|
|
546
|
-
PFElement.log.apply(PFElement, ["[" + this.tag + (this.id ? "#" + this.id : "") + "]"].concat([].slice.call(arguments)));
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* A console warning wrapper which formats your output with useful debugging information.
|
|
550
|
-
*
|
|
551
|
-
* @example PFElement.warn("Hello");
|
|
552
|
-
*/
|
|
553
|
-
;
|
|
554
|
-
|
|
555
|
-
PFElement.warn = function warn() {
|
|
556
|
-
var _console2;
|
|
557
|
-
|
|
558
|
-
(_console2 = console).warn.apply(_console2, [].slice.call(arguments));
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Local warning wrapper that outputs the tag name as a prefix automatically.
|
|
562
|
-
* For use inside a component's function.
|
|
563
|
-
* @example this.warn("Hello");
|
|
564
|
-
*/
|
|
565
|
-
;
|
|
566
|
-
|
|
567
|
-
_proto.warn = function warn() {
|
|
568
|
-
PFElement.warn.apply(PFElement, ["[" + this.tag + (this.id ? "#" + this.id : "") + "]"].concat([].slice.call(arguments)));
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* A console error wrapper which formats your output with useful debugging information.
|
|
572
|
-
* For use inside a component's function.
|
|
573
|
-
* @example PFElement.error("Hello");
|
|
574
|
-
*/
|
|
575
|
-
;
|
|
576
|
-
|
|
577
|
-
PFElement.error = function error() {
|
|
578
|
-
throw new Error([].concat([].slice.call(arguments)).join(" "));
|
|
579
|
-
}
|
|
580
|
-
/**
|
|
581
|
-
* Local error wrapper that outputs the tag name as a prefix automatically.
|
|
582
|
-
* For use inside a component's function.
|
|
583
|
-
* @example this.error("Hello");
|
|
584
|
-
*/
|
|
585
|
-
;
|
|
586
|
-
|
|
587
|
-
_proto.error = function error() {
|
|
588
|
-
PFElement.error.apply(PFElement, ["[" + this.tag + (this.id ? "#" + this.id : "") + "]"].concat([].slice.call(arguments)));
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* A global definition of component types (a general way of defining the purpose of a
|
|
592
|
-
* component and how it is put together).
|
|
593
|
-
*/
|
|
594
|
-
;
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* Returns a boolean statement of whether or not this component contains any light DOM.
|
|
598
|
-
* @returns {boolean}
|
|
599
|
-
* @example if(this.hasLightDOM()) this._init();
|
|
600
|
-
*/
|
|
601
|
-
_proto.hasLightDOM = function hasLightDOM() {
|
|
602
|
-
return this.children.length || this.textContent.trim().length;
|
|
603
|
-
}
|
|
604
|
-
/**
|
|
605
|
-
* Returns a boolean statement of whether or not that slot exists in the light DOM.
|
|
606
|
-
*
|
|
607
|
-
* @param {String|Array} name The slot name.
|
|
608
|
-
* @example this.hasSlot("header");
|
|
609
|
-
*/
|
|
610
|
-
;
|
|
611
|
-
|
|
612
|
-
_proto.hasSlot = function hasSlot(name) {
|
|
613
|
-
var _this2 = this;
|
|
614
|
-
|
|
615
|
-
if (!name) {
|
|
616
|
-
this.warn("Please provide at least one slot name for which to search.");
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
if (typeof name === "string") {
|
|
621
|
-
return [].concat(this.children).filter(function (child) {
|
|
622
|
-
return child.hasAttribute("slot") && child.getAttribute("slot") === name;
|
|
623
|
-
}).length > 0;
|
|
624
|
-
} else if (Array.isArray(name)) {
|
|
625
|
-
return name.reduce(function (n) {
|
|
626
|
-
return [].concat(_this2.children).filter(function (child) {
|
|
627
|
-
return child.hasAttribute("slot") && child.getAttribute("slot") === n;
|
|
628
|
-
}).length > 0;
|
|
629
|
-
});
|
|
630
|
-
} else {
|
|
631
|
-
this.warn("Expected hasSlot argument to be a string or an array, but it was given: " + typeof name + ".");
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
/**
|
|
636
|
-
* Given a slot name, returns elements assigned to the slot as an arry.
|
|
637
|
-
* If no value is provided (i.e., `this.getSlot()`), it returns all children not assigned to a slot (without a slot attribute).
|
|
638
|
-
*
|
|
639
|
-
* @example: `this.getSlot("header")`
|
|
640
|
-
*/
|
|
641
|
-
;
|
|
642
|
-
|
|
643
|
-
_proto.getSlot = function getSlot(name) {
|
|
644
|
-
if (name === void 0) {
|
|
645
|
-
name = "unassigned";
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
if (name !== "unassigned") {
|
|
649
|
-
return [].concat(this.children).filter(function (child) {
|
|
650
|
-
return child.hasAttribute("slot") && child.getAttribute("slot") === name;
|
|
651
|
-
});
|
|
652
|
-
} else {
|
|
653
|
-
return [].concat(this.children).filter(function (child) {
|
|
654
|
-
return !child.hasAttribute("slot");
|
|
655
|
-
});
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
|
|
659
|
-
_proto.cssVariable = function cssVariable(name, value, element) {
|
|
660
|
-
if (element === void 0) {
|
|
661
|
-
element = this;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
name = name.substr(0, 2) !== "--" ? "--" + name : name;
|
|
665
|
-
|
|
666
|
-
if (value) {
|
|
667
|
-
element.style.setProperty(name, value);
|
|
668
|
-
return value;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
return window.getComputedStyle(element).getPropertyValue(name).trim() || null;
|
|
672
|
-
}
|
|
673
|
-
/**
|
|
674
|
-
* This alerts nested components to a change in the context
|
|
675
|
-
*/
|
|
676
|
-
;
|
|
677
|
-
|
|
678
|
-
_proto.contextUpdate = function contextUpdate() {
|
|
679
|
-
var _this3 = this;
|
|
680
|
-
|
|
681
|
-
// Loop over light DOM elements, find direct descendants that are components
|
|
682
|
-
var lightEls = [].concat(this.querySelectorAll("*")).filter(function (item) {
|
|
683
|
-
return item.tagName.toLowerCase().slice(0, 4) === prefix + "-";
|
|
684
|
-
}) // Closest will return itself or it's ancestor matching that selector
|
|
685
|
-
.filter(function (item) {
|
|
686
|
-
// If there is no parent element, return null
|
|
687
|
-
if (!item.parentElement) return; // Otherwise, find the closest component that's this one
|
|
688
|
-
else return item.parentElement.closest("[" + _this3._pfeClass._getCache("prop2attr").pfelement + "]") === _this3;
|
|
689
|
-
}); // Loop over shadow elements, find direct descendants that are components
|
|
690
|
-
|
|
691
|
-
var shadowEls = [].concat(this.shadowRoot.querySelectorAll("*")).filter(function (item) {
|
|
692
|
-
return item.tagName.toLowerCase().slice(0, 4) === prefix + "-";
|
|
693
|
-
}) // Closest will return itself or it's ancestor matching that selector
|
|
694
|
-
.filter(function (item) {
|
|
695
|
-
// If there is a parent element and we can find another web component in the ancestor tree
|
|
696
|
-
if (item.parentElement && item.parentElement.closest("[" + _this3._pfeClass._getCache("prop2attr").pfelement + "]")) {
|
|
697
|
-
return item.parentElement.closest("[" + _this3._pfeClass._getCache("prop2attr").pfelement + "]") === _this3;
|
|
698
|
-
} // Otherwise, check if the host matches this context
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
if (item.getRootNode().host === _this3) return true; // If neither state is true, return false
|
|
702
|
-
|
|
703
|
-
return false;
|
|
704
|
-
});
|
|
705
|
-
var nestedEls = lightEls.concat(shadowEls); // If nested elements don't exist, return without processing
|
|
706
|
-
|
|
707
|
-
if (nestedEls.length === 0) return; // Loop over the nested elements and reset their context
|
|
708
|
-
|
|
709
|
-
nestedEls.map(function (child) {
|
|
710
|
-
if (child.resetContext) {
|
|
711
|
-
_this3.log("Update context of " + child.tagName.toLowerCase()); // Ask the component to recheck it's context in case it changed
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
child.resetContext(_this3.on);
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
};
|
|
718
|
-
|
|
719
|
-
_proto.resetContext = function resetContext(fallback) {
|
|
720
|
-
if (this.isIE11) return; // Priority order for context values to be pulled from:
|
|
721
|
-
//--> 1. context (OLD: pfe-theme)
|
|
722
|
-
//--> 2. --context (OLD: --theme)
|
|
723
|
-
|
|
724
|
-
var value = this.context || this.contextVariable || fallback; // Validate that the current context (this.on) and the new context (value) are the same OR
|
|
725
|
-
// no context is set and there isn't a new context being set
|
|
726
|
-
|
|
727
|
-
if (this.on === value || !this.on && !value) return;
|
|
728
|
-
this.log("Resetting context from " + this.on + " to " + (value || "null"));
|
|
729
|
-
this.on = value;
|
|
730
|
-
};
|
|
731
|
-
|
|
732
|
-
function PFElement(pfeClass, _temp) {
|
|
733
|
-
var _this;
|
|
734
|
-
|
|
735
|
-
var _ref = _temp === void 0 ? {} : _temp,
|
|
736
|
-
_ref$type = _ref.type,
|
|
737
|
-
type = _ref$type === void 0 ? null : _ref$type,
|
|
738
|
-
_ref$delayRender = _ref.delayRender,
|
|
739
|
-
delayRender = _ref$delayRender === void 0 ? false : _ref$delayRender;
|
|
740
|
-
|
|
741
|
-
_this = _HTMLElement.call(this) || this;
|
|
742
|
-
_this._pfeClass = pfeClass;
|
|
743
|
-
_this.tag = pfeClass.tag;
|
|
744
|
-
_this._parseObserver = _this._parseObserver.bind(_assertThisInitialized(_this));
|
|
745
|
-
_this.isIE11 = /MSIE|Trident|Edge\//.test(window.navigator.userAgent); // Initialize the array of jump links pointers
|
|
746
|
-
// Expects items in the array to be NodeItems
|
|
747
|
-
|
|
748
|
-
if (!_this._pfeClass.instances || !(_this._pfeClass.instances.length >= 0)) _this._pfeClass.instances = []; // Set up the mark ID based on existing ID on component if it exists
|
|
749
|
-
|
|
750
|
-
if (!_this.id) {
|
|
751
|
-
_this._markId = _this.randomId.replace("pfe", _this.tag);
|
|
752
|
-
} else if (_this.id.startsWith("pfe-") && !_this.id.startsWith(_this.tag)) {
|
|
753
|
-
_this._markId = _this.id.replace("pfe", _this.tag);
|
|
754
|
-
} else {
|
|
755
|
-
_this._markId = _this.tag + "-" + _this.id;
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
_this._markCount = 0; // TODO: Deprecated for 1.0 release
|
|
759
|
-
|
|
760
|
-
_this.schemaProps = pfeClass.schemaProperties; // TODO: Migrate this out of schema for 1.0
|
|
761
|
-
|
|
762
|
-
_this.slots = pfeClass.slots;
|
|
763
|
-
_this.template = document.createElement("template"); // Set the default value to the passed in type
|
|
764
|
-
|
|
765
|
-
if (type && _this._pfeClass.allProperties.type) _this._pfeClass.allProperties.type["default"] = type; // Initalize the properties and attributes from the property getter
|
|
766
|
-
|
|
767
|
-
_this._initializeProperties();
|
|
768
|
-
|
|
769
|
-
_this.attachShadow({
|
|
770
|
-
mode: "open"
|
|
771
|
-
}); // Tracks if the component has been initially rendered. Useful if for debouncing
|
|
772
|
-
// template updates.
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
_this._rendered = false;
|
|
776
|
-
if (!delayRender) _this.render();
|
|
777
|
-
return _this;
|
|
778
|
-
}
|
|
779
|
-
/**
|
|
780
|
-
* Standard connected callback; fires when the component is added to the DOM.
|
|
781
|
-
*/
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
_proto.connectedCallback = function connectedCallback() {
|
|
785
|
-
var _this4 = this;
|
|
786
|
-
|
|
787
|
-
this._initializeAttributeDefaults();
|
|
788
|
-
|
|
789
|
-
if (window.ShadyCSS) window.ShadyCSS.styleElement(this); // Register this instance with the pointer for the scoped class and the global context
|
|
790
|
-
|
|
791
|
-
this._pfeClass.instances.push(this);
|
|
792
|
-
|
|
793
|
-
PFElement.allInstances.push(this); // If the slot definition exists, set up an observer
|
|
794
|
-
|
|
795
|
-
if (typeof this.slots === "object") {
|
|
796
|
-
this._slotsObserver = new MutationObserver(function () {
|
|
797
|
-
return _this4._initializeSlots(_this4.tag, _this4.slots);
|
|
798
|
-
});
|
|
799
|
-
|
|
800
|
-
this._initializeSlots(this.tag, this.slots);
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
/**
|
|
804
|
-
* Standard disconnected callback; fires when a componet is removed from the DOM.
|
|
805
|
-
* Add your removeEventListeners here.
|
|
806
|
-
*/
|
|
807
|
-
;
|
|
808
|
-
|
|
809
|
-
_proto.disconnectedCallback = function disconnectedCallback() {
|
|
810
|
-
var _this5 = this;
|
|
811
|
-
|
|
812
|
-
if (this._cascadeObserver) this._cascadeObserver.disconnect();
|
|
813
|
-
if (this._slotsObserver) this._slotsObserver.disconnect(); // Remove this instance from the pointer
|
|
814
|
-
|
|
815
|
-
var classIdx = this._pfeClass.instances.find(function (item) {
|
|
816
|
-
return item !== _this5;
|
|
817
|
-
});
|
|
818
|
-
|
|
819
|
-
delete this._pfeClass.instances[classIdx];
|
|
820
|
-
var globalIdx = PFElement.allInstances.find(function (item) {
|
|
821
|
-
return item !== _this5;
|
|
822
|
-
});
|
|
823
|
-
delete PFElement.allInstances[globalIdx];
|
|
824
|
-
}
|
|
825
|
-
/**
|
|
826
|
-
* Attribute changed callback fires when attributes are updated.
|
|
827
|
-
* This combines the global and the component-specific logic.
|
|
828
|
-
*/
|
|
829
|
-
;
|
|
830
|
-
|
|
831
|
-
_proto.attributeChangedCallback = function attributeChangedCallback(attr, oldVal, newVal) {
|
|
832
|
-
if (!this._pfeClass.allProperties) return;
|
|
833
|
-
|
|
834
|
-
var propName = this._pfeClass._attr2prop(attr);
|
|
835
|
-
|
|
836
|
-
var propDef = this._pfeClass.allProperties[propName]; // If the attribute that changed derives from a property definition
|
|
837
|
-
|
|
838
|
-
if (propDef) {
|
|
839
|
-
// If the property/attribute pair has an alias, copy the new value to the alias target
|
|
840
|
-
if (propDef.alias) {
|
|
841
|
-
var aliasedPropDef = this._pfeClass.allProperties[propDef.alias];
|
|
842
|
-
|
|
843
|
-
var aliasedAttr = this._pfeClass._prop2attr(propDef.alias);
|
|
844
|
-
|
|
845
|
-
var aliasedAttrVal = this.getAttribute(aliasedAttr);
|
|
846
|
-
|
|
847
|
-
if (aliasedAttrVal !== newVal) {
|
|
848
|
-
this[propDef.alias] = this._castPropertyValue(aliasedPropDef, newVal);
|
|
849
|
-
}
|
|
850
|
-
} // If the property/attribute pair has an observer, fire it
|
|
851
|
-
// Observers receive the oldValue and the newValue from the attribute changed callback
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
if (propDef.observer) {
|
|
855
|
-
this[propDef.observer](this._castPropertyValue(propDef, oldVal), this._castPropertyValue(propDef, newVal));
|
|
856
|
-
} // If the property/attribute pair has a cascade target, copy the attribute to the matching elements
|
|
857
|
-
// Note: this handles the cascading of new/updated attributes
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
if (propDef.cascade) {
|
|
861
|
-
this._cascadeAttribute(attr, this._pfeClass._convertSelectorsToArray(propDef.cascade));
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
}
|
|
865
|
-
/**
|
|
866
|
-
* Standard render function.
|
|
867
|
-
*/
|
|
868
|
-
;
|
|
869
|
-
|
|
870
|
-
_proto.render = function render() {
|
|
871
|
-
this.shadowRoot.innerHTML = "";
|
|
872
|
-
this.template.innerHTML = this.html;
|
|
873
|
-
|
|
874
|
-
if (window.ShadyCSS) {
|
|
875
|
-
window.ShadyCSS.prepareTemplate(this.template, this.tag);
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
this.shadowRoot.appendChild(this.template.content.cloneNode(true));
|
|
879
|
-
this.log("render"); // Cascade properties to the rendered template
|
|
880
|
-
|
|
881
|
-
this.cascadeProperties(); // Update the display context
|
|
882
|
-
|
|
883
|
-
this.contextUpdate();
|
|
884
|
-
|
|
885
|
-
if (PFElement.trackPerformance()) {
|
|
886
|
-
try {
|
|
887
|
-
performance.mark(this._markId + "-rendered");
|
|
888
|
-
|
|
889
|
-
if (this._markCount < 1) {
|
|
890
|
-
this._markCount = this._markCount + 1; // Navigation start, i.e., the browser first sees that the user has navigated to the page
|
|
891
|
-
|
|
892
|
-
performance.measure(this._markId + "-from-navigation-to-first-render", undefined, this._markId + "-rendered"); // Render is run before connection unless delayRender is used
|
|
893
|
-
|
|
894
|
-
performance.measure(this._markId + "-from-defined-to-first-render", this._markId + "-defined", this._markId + "-rendered");
|
|
895
|
-
}
|
|
896
|
-
} catch (err) {
|
|
897
|
-
this.log("Performance marks are not supported by this browser.");
|
|
898
|
-
}
|
|
899
|
-
} // If the slot definition exists, set up an observer
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
if (typeof this.slots === "object" && this._slotsObserver) {
|
|
903
|
-
this._slotsObserver.observe(this, {
|
|
904
|
-
childList: true
|
|
905
|
-
});
|
|
906
|
-
} // If an observer was defined, set it to begin observing here
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
if (this._cascadeObserver) {
|
|
910
|
-
this._cascadeObserver.observe(this, {
|
|
911
|
-
attributes: true,
|
|
912
|
-
childList: true,
|
|
913
|
-
subtree: true
|
|
914
|
-
});
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
this._rendered = true;
|
|
918
|
-
}
|
|
919
|
-
/**
|
|
920
|
-
* A wrapper around an event dispatch to standardize formatting.
|
|
921
|
-
*/
|
|
922
|
-
;
|
|
923
|
-
|
|
924
|
-
_proto.emitEvent = function emitEvent(name, _temp2) {
|
|
925
|
-
var _ref2 = _temp2 === void 0 ? {} : _temp2,
|
|
926
|
-
_ref2$bubbles = _ref2.bubbles,
|
|
927
|
-
bubbles = _ref2$bubbles === void 0 ? true : _ref2$bubbles,
|
|
928
|
-
_ref2$cancelable = _ref2.cancelable,
|
|
929
|
-
cancelable = _ref2$cancelable === void 0 ? false : _ref2$cancelable,
|
|
930
|
-
_ref2$composed = _ref2.composed,
|
|
931
|
-
composed = _ref2$composed === void 0 ? true : _ref2$composed,
|
|
932
|
-
_ref2$detail = _ref2.detail,
|
|
933
|
-
detail = _ref2$detail === void 0 ? {} : _ref2$detail;
|
|
934
|
-
|
|
935
|
-
if (detail) this.log("Custom event: " + name, detail);else this.log("Custom event: " + name);
|
|
936
|
-
this.dispatchEvent(new CustomEvent(name, {
|
|
937
|
-
bubbles: bubbles,
|
|
938
|
-
cancelable: cancelable,
|
|
939
|
-
composed: composed,
|
|
940
|
-
detail: detail
|
|
941
|
-
}));
|
|
942
|
-
}
|
|
943
|
-
/**
|
|
944
|
-
* Handles the cascading of properties to nested components when new elements are added
|
|
945
|
-
* Attribute updates/additions are handled by the attribute callback
|
|
946
|
-
*/
|
|
947
|
-
;
|
|
948
|
-
|
|
949
|
-
_proto.cascadeProperties = function cascadeProperties(nodeList) {
|
|
950
|
-
var _this6 = this;
|
|
951
|
-
|
|
952
|
-
var cascade = this._pfeClass._getCache("cascadingProperties");
|
|
953
|
-
|
|
954
|
-
if (cascade) {
|
|
955
|
-
if (this._cascadeObserver) this._cascadeObserver.disconnect();
|
|
956
|
-
var selectors = Object.keys(cascade); // Find out if anything in the nodeList matches any of the observed selectors for cacading properties
|
|
957
|
-
|
|
958
|
-
if (selectors) {
|
|
959
|
-
if (nodeList) {
|
|
960
|
-
[].concat(nodeList).forEach(function (nodeItem) {
|
|
961
|
-
selectors.forEach(function (selector) {
|
|
962
|
-
// if this node has a match function (i.e., it's an HTMLElement, not
|
|
963
|
-
// a text node), see if it matches the selector, otherwise drop it (like it's hot).
|
|
964
|
-
if (nodeItem.matches && nodeItem.matches(selector)) {
|
|
965
|
-
var attrNames = cascade[selector]; // each selector can match multiple properties/attributes, so
|
|
966
|
-
// copy each of them
|
|
967
|
-
|
|
968
|
-
attrNames.forEach(function (attrName) {
|
|
969
|
-
return _this6._copyAttribute(attrName, nodeItem);
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
|
-
});
|
|
973
|
-
});
|
|
974
|
-
} else {
|
|
975
|
-
// If a match was found, cascade each attribute to the element
|
|
976
|
-
var components = selectors.filter(function (item) {
|
|
977
|
-
return item.slice(0, prefix.length + 1) === prefix + "-";
|
|
978
|
-
}).map(function (name) {
|
|
979
|
-
return customElements.whenDefined(name);
|
|
980
|
-
});
|
|
981
|
-
if (components) Promise.all(components).then(function () {
|
|
982
|
-
_this6._cascadeAttributes(selectors, cascade);
|
|
983
|
-
});else this._cascadeAttributes(selectors, cascade);
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
if (this._rendered && this._cascadeObserver) this._cascadeObserver.observe(this, {
|
|
988
|
-
attributes: true,
|
|
989
|
-
childList: true,
|
|
990
|
-
subtree: true
|
|
991
|
-
});
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
/* --- Observers for global properties --- */
|
|
995
|
-
|
|
996
|
-
/**
|
|
997
|
-
* This responds to changes in the pfelement attribute; indicates if the component upgraded
|
|
998
|
-
* @TODO maybe we should use just the attribute instead of the class?
|
|
999
|
-
* https://github.com/angular/angular/issues/15399#issuecomment-318785677
|
|
1000
|
-
*/
|
|
1001
|
-
;
|
|
1002
|
-
|
|
1003
|
-
_proto._upgradeObserver = function _upgradeObserver() {
|
|
1004
|
-
this.classList.add("PFElement");
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* This responds to changes in the context attribute; manual override tool
|
|
1008
|
-
*/
|
|
1009
|
-
;
|
|
1010
|
-
|
|
1011
|
-
_proto._contextObserver = function _contextObserver(oldValue, newValue) {
|
|
1012
|
-
if (newValue && (oldValue && oldValue !== newValue || !oldValue)) {
|
|
1013
|
-
this.log("Running the context observer");
|
|
1014
|
-
this.on = newValue;
|
|
1015
|
-
this.cssVariable("context", newValue);
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
/**
|
|
1019
|
-
* This responds to changes in the context; source of truth for components
|
|
1020
|
-
*/
|
|
1021
|
-
;
|
|
1022
|
-
|
|
1023
|
-
_proto._onObserver = function _onObserver(oldValue, newValue) {
|
|
1024
|
-
if (oldValue && oldValue !== newValue || newValue && !oldValue) {
|
|
1025
|
-
this.log("Context update"); // Fire an event for child components
|
|
1026
|
-
|
|
1027
|
-
this.contextUpdate();
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
/**
|
|
1031
|
-
* This responds to inline style changes and greps for context or theme updates.
|
|
1032
|
-
* @TODO: --theme will be deprecated in 2.0
|
|
1033
|
-
*/
|
|
1034
|
-
;
|
|
1035
|
-
|
|
1036
|
-
_proto._inlineStyleObserver = function _inlineStyleObserver(oldValue, newValue) {
|
|
1037
|
-
if (oldValue === newValue) return; // If there are no inline styles, a context might have been deleted, so call resetContext
|
|
1038
|
-
|
|
1039
|
-
if (!newValue) this.resetContext();else {
|
|
1040
|
-
this.log("Style observer activated on " + this.tag, "" + (newValue || "null")); // Grep for context/theme
|
|
1041
|
-
|
|
1042
|
-
var regex = /--[\w|-]*(?:context|theme):\s*(?:\"*(light|dark|saturated)\"*)/gi;
|
|
1043
|
-
var match = regex.exec(newValue); // If no match is returned, exit the observer
|
|
1044
|
-
|
|
1045
|
-
if (!match) return;
|
|
1046
|
-
var newContext = match[1]; // If the new context value differs from the on value, update
|
|
1047
|
-
|
|
1048
|
-
if (newContext !== this.on && !this.context) this.on = newContext;
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
/**
|
|
1052
|
-
* This is connected with a mutation observer that watches for updates to the light DOM
|
|
1053
|
-
* and pushes down the cascading values
|
|
1054
|
-
*/
|
|
1055
|
-
;
|
|
1056
|
-
|
|
1057
|
-
_proto._parseObserver = function _parseObserver(mutationsList) {
|
|
1058
|
-
// Iterate over the mutation list, look for cascade updates
|
|
1059
|
-
for (var _iterator = _createForOfIteratorHelperLoose(mutationsList), _step; !(_step = _iterator()).done;) {
|
|
1060
|
-
var mutation = _step.value;
|
|
1061
|
-
|
|
1062
|
-
// If a new node is added, attempt to cascade attributes to it
|
|
1063
|
-
if (mutation.type === "childList" && mutation.addedNodes.length) {
|
|
1064
|
-
var nonTextNodes = [].concat(mutation.addedNodes).filter(function (n) {
|
|
1065
|
-
return n.nodeType !== HTMLElement.TEXT_NODE;
|
|
1066
|
-
});
|
|
1067
|
-
this.cascadeProperties(nonTextNodes);
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
/* --- End observers --- */
|
|
1072
|
-
|
|
1073
|
-
/**
|
|
1074
|
-
* Validate that the property meets the requirements for type and naming.
|
|
1075
|
-
*/
|
|
1076
|
-
;
|
|
1077
|
-
|
|
1078
|
-
PFElement._validateProperties = function _validateProperties() {
|
|
1079
|
-
for (var propName in this.allProperties) {
|
|
1080
|
-
var propDef = this.allProperties[propName]; // Verify that properties conform to the allowed data types
|
|
1081
|
-
|
|
1082
|
-
if (!isAllowedType(propDef)) {
|
|
1083
|
-
this.error("Property \"" + propName + "\" on " + this.name + " must have type String, Number, or Boolean.");
|
|
1084
|
-
} // Verify the property name conforms to our naming rules
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
if (!/^[a-z_]/.test(propName)) {
|
|
1088
|
-
this.error("Property " + this.name + "." + propName + " defined, but prop names must begin with a lower-case letter or an underscore");
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
var isFunction = typeof propDef["default"] === "function"; // If the default value is not the same type as defined by the property
|
|
1092
|
-
// and it's not a function (we can't validate the output of the function
|
|
1093
|
-
// on the class level), throw a warning
|
|
1094
|
-
|
|
1095
|
-
if (propDef["default"] && !isValidDefaultType(propDef) && !isFunction) this.error("[" + this.name + "] The default value `" + propDef["default"] + "` does not match the assigned type " + propDef.type.name + " for the '" + propName + "' property");
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
/**
|
|
1099
|
-
* Convert provided property value to the correct type as defined in the properties method.
|
|
1100
|
-
*/
|
|
1101
|
-
;
|
|
1102
|
-
|
|
1103
|
-
_proto._castPropertyValue = function _castPropertyValue(propDef, attrValue) {
|
|
1104
|
-
var _attrValue$null$NaN$u, _attrValue$undefined$;
|
|
1105
|
-
|
|
1106
|
-
switch (propDef.type) {
|
|
1107
|
-
case Number:
|
|
1108
|
-
// map various attribute string values to their respective
|
|
1109
|
-
// desired property values
|
|
1110
|
-
return (_attrValue$null$NaN$u = {}, _attrValue$null$NaN$u[attrValue] = Number(attrValue), _attrValue$null$NaN$u["null"] = null, _attrValue$null$NaN$u.NaN = NaN, _attrValue$null$NaN$u.undefined = undefined, _attrValue$null$NaN$u)[attrValue];
|
|
1111
|
-
|
|
1112
|
-
case Boolean:
|
|
1113
|
-
return attrValue !== null;
|
|
1114
|
-
|
|
1115
|
-
case String:
|
|
1116
|
-
return (_attrValue$undefined$ = {}, _attrValue$undefined$[attrValue] = attrValue, _attrValue$undefined$.undefined = undefined, _attrValue$undefined$)[attrValue];
|
|
1117
|
-
|
|
1118
|
-
default:
|
|
1119
|
-
return attrValue;
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
/**
|
|
1123
|
-
* Map provided value to the attribute name on the component.
|
|
1124
|
-
*/
|
|
1125
|
-
;
|
|
1126
|
-
|
|
1127
|
-
_proto._assignValueToAttribute = function _assignValueToAttribute(obj, attr, value) {
|
|
1128
|
-
// If the default is false and the property is boolean, we don't need to do anything
|
|
1129
|
-
var isBooleanFalse = obj.type === Boolean && !value;
|
|
1130
|
-
var isNull = value === null;
|
|
1131
|
-
var isUndefined = typeof value === "undefined"; // If the attribute is not defined, set the default value
|
|
1132
|
-
|
|
1133
|
-
if (isBooleanFalse || isNull || isUndefined) {
|
|
1134
|
-
this.removeAttribute(attr);
|
|
1135
|
-
} else {
|
|
1136
|
-
// Boolean values get an empty string: https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes
|
|
1137
|
-
if (obj.type === Boolean && typeof value === "boolean") {
|
|
1138
|
-
this.setAttribute(attr, "");
|
|
1139
|
-
} else {
|
|
1140
|
-
// Validate against the provided values
|
|
1141
|
-
if (obj.values) {
|
|
1142
|
-
this._validateAttributeValue(obj, attr, value);
|
|
1143
|
-
} // Still accept the value provided even if it's not valid
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
this.setAttribute(attr, value);
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
/**
|
|
1151
|
-
* Maps the defined slots into an object that is easier to query
|
|
1152
|
-
*/
|
|
1153
|
-
;
|
|
1154
|
-
|
|
1155
|
-
_proto._initializeSlots = function _initializeSlots(tag, slots) {
|
|
1156
|
-
var _this7 = this;
|
|
1157
|
-
|
|
1158
|
-
this.log("Validate slots...");
|
|
1159
|
-
if (this._slotsObserver) this._slotsObserver.disconnect(); // Loop over the properties provided by the schema
|
|
1160
|
-
|
|
1161
|
-
Object.keys(slots).forEach(function (slot) {
|
|
1162
|
-
var slotObj = slots[slot]; // Only attach the information if the data provided is a schema object
|
|
1163
|
-
|
|
1164
|
-
if (typeof slotObj === "object") {
|
|
1165
|
-
var slotExists = false;
|
|
1166
|
-
var result = []; // If it's a named slot, look for that slot definition
|
|
1167
|
-
|
|
1168
|
-
if (slotObj.namedSlot) {
|
|
1169
|
-
// Check prefixed slots
|
|
1170
|
-
result = _this7.getSlot(tag + "--" + slot);
|
|
1171
|
-
|
|
1172
|
-
if (result.length > 0) {
|
|
1173
|
-
slotObj.nodes = result;
|
|
1174
|
-
slotExists = true;
|
|
1175
|
-
} // Check for unprefixed slots
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
result = _this7.getSlot("" + slot);
|
|
1179
|
-
|
|
1180
|
-
if (result.length > 0) {
|
|
1181
|
-
slotObj.nodes = result;
|
|
1182
|
-
slotExists = true;
|
|
1183
|
-
} // If it's the default slot, look for direct children not assigned to a slot
|
|
1184
|
-
|
|
1185
|
-
} else {
|
|
1186
|
-
result = [].concat(_this7.children).filter(function (child) {
|
|
1187
|
-
return !child.hasAttribute("slot");
|
|
1188
|
-
});
|
|
1189
|
-
|
|
1190
|
-
if (result.length > 0) {
|
|
1191
|
-
slotObj.nodes = result;
|
|
1192
|
-
slotExists = true;
|
|
1193
|
-
}
|
|
1194
|
-
} // If the slot exists, attach an attribute to the parent to indicate that
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
if (slotExists) {
|
|
1198
|
-
_this7.setAttribute("has_" + slot, "");
|
|
1199
|
-
} else {
|
|
1200
|
-
_this7.removeAttribute("has_" + slot);
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
});
|
|
1204
|
-
this.log("Slots validated.");
|
|
1205
|
-
if (this._slotsObserver) this._slotsObserver.observe(this, {
|
|
1206
|
-
childList: true
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
/**
|
|
1210
|
-
* Sets up the property definitions based on the properties method.
|
|
1211
|
-
*/
|
|
1212
|
-
;
|
|
1213
|
-
|
|
1214
|
-
_proto._initializeProperties = function _initializeProperties() {
|
|
1215
|
-
var _this8 = this;
|
|
1216
|
-
|
|
1217
|
-
var properties = this._pfeClass.allProperties;
|
|
1218
|
-
var hasCascade = false;
|
|
1219
|
-
if (Object.keys(properties).length > 0) this.log("Initialize properties");
|
|
1220
|
-
|
|
1221
|
-
var _loop = function _loop(propName) {
|
|
1222
|
-
var propDef = properties[propName]; // Check if the property exists, throw a warning if it does.
|
|
1223
|
-
// HTMLElements have a LOT of properties; it wouldn't be hard
|
|
1224
|
-
// to overwrite one accidentally.
|
|
1225
|
-
|
|
1226
|
-
if (typeof _this8[propName] !== "undefined") {
|
|
1227
|
-
_this8.log("Property \"" + propName + "\" on " + _this8.constructor.name + " cannot be defined because the property name is reserved");
|
|
1228
|
-
} else {
|
|
1229
|
-
var attrName = _this8._pfeClass._prop2attr(propName);
|
|
1230
|
-
|
|
1231
|
-
if (propDef.cascade) hasCascade = true;
|
|
1232
|
-
Object.defineProperty(_this8, propName, {
|
|
1233
|
-
get: function get() {
|
|
1234
|
-
var attrValue = _this8.getAttribute(attrName);
|
|
1235
|
-
|
|
1236
|
-
return _this8._castPropertyValue(propDef, attrValue);
|
|
1237
|
-
},
|
|
1238
|
-
set: function set(rawNewVal) {
|
|
1239
|
-
// Assign the value to the attribute
|
|
1240
|
-
_this8._assignValueToAttribute(propDef, attrName, rawNewVal);
|
|
1241
|
-
|
|
1242
|
-
return rawNewVal;
|
|
1243
|
-
},
|
|
1244
|
-
writeable: true,
|
|
1245
|
-
enumerable: true,
|
|
1246
|
-
configurable: false
|
|
1247
|
-
});
|
|
1248
|
-
}
|
|
1249
|
-
};
|
|
1250
|
-
|
|
1251
|
-
for (var propName in properties) {
|
|
1252
|
-
_loop(propName);
|
|
1253
|
-
} // If any of the properties has cascade, attach a new mutation observer to the component
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
if (hasCascade) {
|
|
1257
|
-
this._cascadeObserver = new MutationObserver(this._parseObserver);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
/**
|
|
1261
|
-
* Intialize the default value for an attribute.
|
|
1262
|
-
*/
|
|
1263
|
-
;
|
|
1264
|
-
|
|
1265
|
-
_proto._initializeAttributeDefaults = function _initializeAttributeDefaults() {
|
|
1266
|
-
var properties = this._pfeClass.allProperties;
|
|
1267
|
-
|
|
1268
|
-
for (var propName in properties) {
|
|
1269
|
-
var propDef = properties[propName];
|
|
1270
|
-
|
|
1271
|
-
var attrName = this._pfeClass._prop2attr(propName);
|
|
1272
|
-
|
|
1273
|
-
if (propDef.hasOwnProperty("default")) {
|
|
1274
|
-
var value = propDef["default"]; // Check if default is a function
|
|
1275
|
-
|
|
1276
|
-
if (typeof propDef["default"] === "function") {
|
|
1277
|
-
value = propDef["default"](this);
|
|
1278
|
-
} // If the attribute has not already been set, assign the default value
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
if (!this.hasAttribute(attrName)) {
|
|
1282
|
-
// Assign the value to the attribute
|
|
1283
|
-
this._assignValueToAttribute(propDef, attrName, value);
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
/**
|
|
1289
|
-
* Validate the value against provided values.
|
|
1290
|
-
*/
|
|
1291
|
-
// @TODO add support for a validation function
|
|
1292
|
-
;
|
|
1293
|
-
|
|
1294
|
-
_proto._validateAttributeValue = function _validateAttributeValue(propDef, attr, value) {
|
|
1295
|
-
if (Array.isArray(propDef.values) && propDef.values.length > 0 && !propDef.values.includes(value) // ||
|
|
1296
|
-
// (typeof propDef.values === "string" && propDef.values !== value) ||
|
|
1297
|
-
// (typeof propDef.values === "function" && !propDef.values(value))
|
|
1298
|
-
) {
|
|
1299
|
-
this.warn(value + " is not a valid value for " + attr + ". Please provide one of the following values: " + propDef.values.join(", "));
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
return value;
|
|
1303
|
-
}
|
|
1304
|
-
/**
|
|
1305
|
-
* Look up an attribute name linked to a given property name.
|
|
1306
|
-
*/
|
|
1307
|
-
;
|
|
1308
|
-
|
|
1309
|
-
PFElement._prop2attr = function _prop2attr(propName) {
|
|
1310
|
-
return this._getCache("prop2attr")[propName];
|
|
1311
|
-
}
|
|
1312
|
-
/**
|
|
1313
|
-
* Look up an property name linked to a given attribute name.
|
|
1314
|
-
*/
|
|
1315
|
-
;
|
|
1316
|
-
|
|
1317
|
-
PFElement._attr2prop = function _attr2prop(attrName) {
|
|
1318
|
-
return this._getCache("attr2prop")[attrName];
|
|
1319
|
-
}
|
|
1320
|
-
/**
|
|
1321
|
-
* Convert a property name to an attribute name.
|
|
1322
|
-
*/
|
|
1323
|
-
;
|
|
1324
|
-
|
|
1325
|
-
PFElement._convertPropNameToAttrName = function _convertPropNameToAttrName(propName) {
|
|
1326
|
-
var propDef = this.allProperties[propName];
|
|
1327
|
-
|
|
1328
|
-
if (propDef.attr) {
|
|
1329
|
-
return propDef.attr;
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
return propName.replace(/^_/, "").replace(/^[A-Z]/, function (l) {
|
|
1333
|
-
return l.toLowerCase();
|
|
1334
|
-
}).replace(/[A-Z]/g, function (l) {
|
|
1335
|
-
return "-" + l.toLowerCase();
|
|
1336
|
-
});
|
|
1337
|
-
}
|
|
1338
|
-
/**
|
|
1339
|
-
* Convert an attribute name to a property name.
|
|
1340
|
-
*/
|
|
1341
|
-
;
|
|
1342
|
-
|
|
1343
|
-
PFElement._convertAttrNameToPropName = function _convertAttrNameToPropName(attrName) {
|
|
1344
|
-
for (var prop in this.allProperties) {
|
|
1345
|
-
if (this.allProperties[prop].attr === attrName) {
|
|
1346
|
-
return prop;
|
|
1347
|
-
}
|
|
1348
|
-
} // Convert the property name to kebab case
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
var propName = attrName.replace(/-([A-Za-z])/g, function (l) {
|
|
1352
|
-
return l[1].toUpperCase();
|
|
1353
|
-
});
|
|
1354
|
-
return propName;
|
|
1355
|
-
};
|
|
1356
|
-
|
|
1357
|
-
_proto._cascadeAttributes = function _cascadeAttributes(selectors, set) {
|
|
1358
|
-
var _this9 = this;
|
|
1359
|
-
|
|
1360
|
-
selectors.forEach(function (selector) {
|
|
1361
|
-
set[selector].forEach(function (attr) {
|
|
1362
|
-
_this9._cascadeAttribute(attr, selector);
|
|
1363
|
-
});
|
|
1364
|
-
});
|
|
1365
|
-
}
|
|
1366
|
-
/**
|
|
1367
|
-
* Trigger a cascade of the named attribute to any child elements that match
|
|
1368
|
-
* the `to` selector. The selector can match elements in the light DOM and
|
|
1369
|
-
* shadow DOM.
|
|
1370
|
-
* @param {String} name The name of the attribute to cascade (not necessarily the same as the property name).
|
|
1371
|
-
* @param {String} to A CSS selector that matches the elements that should received the cascaded attribute. The selector will be applied within `this` element's light and shadow DOM trees.
|
|
1372
|
-
*/
|
|
1373
|
-
;
|
|
1374
|
-
|
|
1375
|
-
_proto._cascadeAttribute = function _cascadeAttribute(name, to) {
|
|
1376
|
-
var recipients = [].concat(this.querySelectorAll(to), this.shadowRoot.querySelectorAll(to));
|
|
1377
|
-
|
|
1378
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(recipients), _step2; !(_step2 = _iterator2()).done;) {
|
|
1379
|
-
var node = _step2.value;
|
|
1380
|
-
|
|
1381
|
-
this._copyAttribute(name, node);
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
/**
|
|
1385
|
-
* Copy the named attribute to a target element.
|
|
1386
|
-
*/
|
|
1387
|
-
;
|
|
1388
|
-
|
|
1389
|
-
_proto._copyAttribute = function _copyAttribute(name, el) {
|
|
1390
|
-
this.log("copying " + name + " to " + el);
|
|
1391
|
-
var value = this.getAttribute(name);
|
|
1392
|
-
var fname = value == null ? "removeAttribute" : "setAttribute";
|
|
1393
|
-
el[fname](name, value);
|
|
1394
|
-
};
|
|
1395
|
-
|
|
1396
|
-
PFElement._convertSelectorsToArray = function _convertSelectorsToArray(selectors) {
|
|
1397
|
-
if (selectors) {
|
|
1398
|
-
if (typeof selectors === "string") return selectors.split(",");else if (typeof selectors === "object") return selectors;else {
|
|
1399
|
-
this.warn("selectors should be provided as a string, array, or object; received: " + typeof selectors + ".");
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
return;
|
|
1404
|
-
};
|
|
1405
|
-
|
|
1406
|
-
PFElement._parsePropertiesForCascade = function _parsePropertiesForCascade(mergedProperties) {
|
|
1407
|
-
var _this10 = this;
|
|
1408
|
-
|
|
1409
|
-
var cascadingProperties = {}; // Parse the properties to pull out attributes that cascade
|
|
1410
|
-
|
|
1411
|
-
var _loop2 = function _loop2() {
|
|
1412
|
-
var _Object$entries$_i = _Object$entries[_i],
|
|
1413
|
-
propName = _Object$entries$_i[0],
|
|
1414
|
-
config = _Object$entries$_i[1];
|
|
1415
|
-
|
|
1416
|
-
var cascadeTo = _this10._convertSelectorsToArray(config.cascade); // Iterate over each node in the cascade list for this property
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
if (cascadeTo) cascadeTo.map(function (nodeItem) {
|
|
1420
|
-
var attr = _this10._prop2attr(propName); // Create an object with the node as the key and an array of attributes
|
|
1421
|
-
// that are to be cascaded down to it
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
if (!cascadingProperties[nodeItem]) cascadingProperties[nodeItem] = [attr];else cascadingProperties[nodeItem].push(attr);
|
|
1425
|
-
});
|
|
1426
|
-
};
|
|
1427
|
-
|
|
1428
|
-
for (var _i = 0, _Object$entries = Object.entries(mergedProperties); _i < _Object$entries.length; _i++) {
|
|
1429
|
-
_loop2();
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
return cascadingProperties;
|
|
1433
|
-
}
|
|
1434
|
-
/**
|
|
1435
|
-
* Caching the attributes and properties data for efficiency
|
|
1436
|
-
*/
|
|
1437
|
-
;
|
|
1438
|
-
|
|
1439
|
-
PFElement.create = function create(pfe) {
|
|
1440
|
-
pfe._createCache();
|
|
1441
|
-
|
|
1442
|
-
pfe._populateCache(pfe);
|
|
1443
|
-
|
|
1444
|
-
pfe._validateProperties();
|
|
1445
|
-
|
|
1446
|
-
try {
|
|
1447
|
-
window.customElements.define(pfe.tag, pfe);
|
|
1448
|
-
} catch (err) {
|
|
1449
|
-
// Capture the class currently using this tag in the registry
|
|
1450
|
-
var prevDefinition = window.customElements.get(pfe.tag); // Check if the previous definition's version matches this one
|
|
1451
|
-
|
|
1452
|
-
if (prevDefinition && prevDefinition.version !== pfe.version) {
|
|
1453
|
-
this.warn(pfe.tag + " was registered at version " + prevDefinition.version + "; cannot register version " + pfe.version + ".");
|
|
1454
|
-
} // @TODO Should this error be reported to the console?
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
if (err && err.message) this.log(err.message);
|
|
1458
|
-
}
|
|
1459
|
-
|
|
1460
|
-
if (PFElement.trackPerformance()) {
|
|
1461
|
-
try {
|
|
1462
|
-
performance.mark(this._markId + "-defined");
|
|
1463
|
-
} catch (err) {
|
|
1464
|
-
this.log("Performance marks are not supported by this browser.");
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
};
|
|
1468
|
-
|
|
1469
|
-
PFElement._createCache = function _createCache() {
|
|
1470
|
-
this._cache = {
|
|
1471
|
-
properties: {},
|
|
1472
|
-
globalProperties: {},
|
|
1473
|
-
componentProperties: {},
|
|
1474
|
-
cascadingProperties: {},
|
|
1475
|
-
attr2prop: {},
|
|
1476
|
-
prop2attr: {}
|
|
1477
|
-
};
|
|
1478
|
-
}
|
|
1479
|
-
/**
|
|
1480
|
-
* Cache an object in a given cache namespace. This overwrites anything
|
|
1481
|
-
* already in that namespace.
|
|
1482
|
-
*/
|
|
1483
|
-
;
|
|
1484
|
-
|
|
1485
|
-
PFElement._setCache = function _setCache(namespace, object) {
|
|
1486
|
-
this._cache[namespace] = object;
|
|
1487
|
-
}
|
|
1488
|
-
/**
|
|
1489
|
-
* Get a cached object by namespace, or get all cached objects.
|
|
1490
|
-
*/
|
|
1491
|
-
;
|
|
1492
|
-
|
|
1493
|
-
PFElement._getCache = function _getCache(namespace) {
|
|
1494
|
-
return namespace ? this._cache[namespace] : this._cache;
|
|
1495
|
-
}
|
|
1496
|
-
/**
|
|
1497
|
-
* Populate initial values for properties cache.
|
|
1498
|
-
*/
|
|
1499
|
-
;
|
|
1500
|
-
|
|
1501
|
-
PFElement._populateCache = function _populateCache(pfe) {
|
|
1502
|
-
// @TODO add a warning when a component property conflicts with a global property.
|
|
1503
|
-
var mergedProperties = _extends({}, pfe.properties, PFElement.properties);
|
|
1504
|
-
|
|
1505
|
-
pfe._setCache("componentProperties", pfe.properties);
|
|
1506
|
-
|
|
1507
|
-
pfe._setCache("globalProperties", PFElement.properties);
|
|
1508
|
-
|
|
1509
|
-
pfe._setCache("properties", mergedProperties); // create mapping objects to go from prop name to attrname and back
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
var prop2attr = {};
|
|
1513
|
-
var attr2prop = {};
|
|
1514
|
-
|
|
1515
|
-
for (var propName in mergedProperties) {
|
|
1516
|
-
var attrName = this._convertPropNameToAttrName(propName);
|
|
1517
|
-
|
|
1518
|
-
prop2attr[propName] = attrName;
|
|
1519
|
-
attr2prop[attrName] = propName;
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
pfe._setCache("attr2prop", attr2prop);
|
|
1523
|
-
|
|
1524
|
-
pfe._setCache("prop2attr", prop2attr);
|
|
1525
|
-
|
|
1526
|
-
var cascadingProperties = this._parsePropertiesForCascade(mergedProperties);
|
|
1527
|
-
|
|
1528
|
-
if (Object.keys(cascadingProperties)) pfe._setCache("cascadingProperties", cascadingProperties);
|
|
1529
|
-
}
|
|
1530
|
-
/**
|
|
1531
|
-
* allProperties returns an object containing PFElement's global properties
|
|
1532
|
-
* and the descendents' (such as PfeCard, etc) component properties. The two
|
|
1533
|
-
* objects are merged together and in the case of a property name conflict,
|
|
1534
|
-
* PFElement's properties override the component's properties.
|
|
1535
|
-
*/
|
|
1536
|
-
;
|
|
1537
|
-
|
|
1538
|
-
_createClass(PFElement, [{
|
|
1539
|
-
key: "version",
|
|
1540
|
-
get:
|
|
1541
|
-
/**
|
|
1542
|
-
* A local alias to the static version.
|
|
1543
|
-
* For use in the console to validate version being loaded.
|
|
1544
|
-
* @example PfeAccordion.version
|
|
1545
|
-
*/
|
|
1546
|
-
function get() {
|
|
1547
|
-
return this._pfeClass.version;
|
|
1548
|
-
}
|
|
1549
|
-
/**
|
|
1550
|
-
* Global property definitions: properties managed by the base class that apply to all components.
|
|
1551
|
-
*/
|
|
1552
|
-
|
|
1553
|
-
}, {
|
|
1554
|
-
key: "randomId",
|
|
1555
|
-
get:
|
|
1556
|
-
/**
|
|
1557
|
-
* A quick way to fetch a random ID value.
|
|
1558
|
-
* _Note:_ All values are prefixes with `pfe` automatically to ensure an ID-safe value is returned.
|
|
1559
|
-
*
|
|
1560
|
-
* @example this.id = this.randomID;
|
|
1561
|
-
*/
|
|
1562
|
-
function get() {
|
|
1563
|
-
return prefix + "-" + Math.random().toString(36).substr(2, 9);
|
|
1564
|
-
}
|
|
1565
|
-
/**
|
|
1566
|
-
* Set the --context variable with the provided value in this component.
|
|
1567
|
-
*/
|
|
1568
|
-
|
|
1569
|
-
}, {
|
|
1570
|
-
key: "contextVariable",
|
|
1571
|
-
get:
|
|
1572
|
-
/**
|
|
1573
|
-
* Get the current value of the --context variable in this component.
|
|
1574
|
-
* @return {string} [dark|light|saturated]
|
|
1575
|
-
*/
|
|
1576
|
-
function get() {
|
|
1577
|
-
/* @DEPRECATED --theme in 1.0, to be removed in 2.0 */
|
|
1578
|
-
return this.cssVariable("context") || this.cssVariable("theme");
|
|
1579
|
-
},
|
|
1580
|
-
set: function set(value) {
|
|
1581
|
-
this.cssVariable("context", value);
|
|
1582
|
-
}
|
|
1583
|
-
}], [{
|
|
1584
|
-
key: "config",
|
|
1585
|
-
get: function get() {
|
|
1586
|
-
// @TODO: Add config validation in the future.
|
|
1587
|
-
return window.PfeConfig || {};
|
|
1588
|
-
}
|
|
1589
|
-
}, {
|
|
1590
|
-
key: "PfeTypes",
|
|
1591
|
-
get: function get() {
|
|
1592
|
-
return {
|
|
1593
|
-
Container: "container",
|
|
1594
|
-
Content: "content",
|
|
1595
|
-
Combo: "combo"
|
|
1596
|
-
};
|
|
1597
|
-
}
|
|
1598
|
-
/**
|
|
1599
|
-
* The current version of a component; set by the compiler using the package.json data.
|
|
1600
|
-
*/
|
|
1601
|
-
|
|
1602
|
-
}, {
|
|
1603
|
-
key: "version",
|
|
1604
|
-
get: function get() {
|
|
1605
|
-
return "1.12.3";
|
|
1606
|
-
}
|
|
1607
|
-
}, {
|
|
1608
|
-
key: "properties",
|
|
1609
|
-
get: function get() {
|
|
1610
|
-
return {
|
|
1611
|
-
pfelement: {
|
|
1612
|
-
title: "Upgraded flag",
|
|
1613
|
-
type: Boolean,
|
|
1614
|
-
"default": true,
|
|
1615
|
-
observer: "_upgradeObserver"
|
|
1616
|
-
},
|
|
1617
|
-
on: {
|
|
1618
|
-
title: "Context",
|
|
1619
|
-
description: "Describes the visual context (backgrounds).",
|
|
1620
|
-
type: String,
|
|
1621
|
-
values: ["light", "dark", "saturated"],
|
|
1622
|
-
"default": function _default(el) {
|
|
1623
|
-
return el.contextVariable;
|
|
1624
|
-
},
|
|
1625
|
-
observer: "_onObserver"
|
|
1626
|
-
},
|
|
1627
|
-
context: {
|
|
1628
|
-
title: "Context hook",
|
|
1629
|
-
description: "Lets you override the system-set context.",
|
|
1630
|
-
type: String,
|
|
1631
|
-
values: ["light", "dark", "saturated"],
|
|
1632
|
-
observer: "_contextObserver"
|
|
1633
|
-
},
|
|
1634
|
-
// @TODO: Deprecated with 1.0
|
|
1635
|
-
oldTheme: {
|
|
1636
|
-
type: String,
|
|
1637
|
-
values: ["light", "dark", "saturated"],
|
|
1638
|
-
alias: "context",
|
|
1639
|
-
attr: "pfe-theme"
|
|
1640
|
-
},
|
|
1641
|
-
_style: {
|
|
1642
|
-
title: "Custom styles",
|
|
1643
|
-
type: String,
|
|
1644
|
-
attr: "style",
|
|
1645
|
-
observer: "_inlineStyleObserver"
|
|
1646
|
-
},
|
|
1647
|
-
type: {
|
|
1648
|
-
title: "Component type",
|
|
1649
|
-
type: String,
|
|
1650
|
-
values: ["container", "content", "combo"]
|
|
1651
|
-
}
|
|
1652
|
-
};
|
|
1653
|
-
}
|
|
1654
|
-
}, {
|
|
1655
|
-
key: "observedAttributes",
|
|
1656
|
-
get: function get() {
|
|
1657
|
-
var _this11 = this;
|
|
1658
|
-
|
|
1659
|
-
var properties = this.allProperties;
|
|
1660
|
-
|
|
1661
|
-
if (properties) {
|
|
1662
|
-
var oa = Object.keys(properties).filter(function (prop) {
|
|
1663
|
-
return properties[prop].observer || properties[prop].cascade || properties[prop].alias;
|
|
1664
|
-
}).map(function (p) {
|
|
1665
|
-
return _this11._convertPropNameToAttrName(p);
|
|
1666
|
-
});
|
|
1667
|
-
return [].concat(oa);
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
}, {
|
|
1671
|
-
key: "allProperties",
|
|
1672
|
-
get: function get() {
|
|
1673
|
-
return this._getCache("properties");
|
|
1674
|
-
}
|
|
1675
|
-
/**
|
|
1676
|
-
* cascadingProperties returns an object containing PFElement's global properties
|
|
1677
|
-
* and the descendents' (such as PfeCard, etc) component properties. The two
|
|
1678
|
-
* objects are merged together and in the case of a property name conflict,
|
|
1679
|
-
* PFElement's properties override the component's properties.
|
|
1680
|
-
*/
|
|
1681
|
-
|
|
1682
|
-
}, {
|
|
1683
|
-
key: "cascadingProperties",
|
|
1684
|
-
get: function get() {
|
|
1685
|
-
return this._getCache("cascadingProperties");
|
|
1686
|
-
}
|
|
1687
|
-
/**
|
|
1688
|
-
* Breakpoint object mapping human-readable size names to viewport sizes
|
|
1689
|
-
* To overwrite this at the component-level, include `static get breakpoint` in your component's class definition
|
|
1690
|
-
* @returns {Object} keys are t-shirt sizes and values map to screen-sizes (sourced from PF4)
|
|
1691
|
-
*/
|
|
1692
|
-
|
|
1693
|
-
}, {
|
|
1694
|
-
key: "breakpoint",
|
|
1695
|
-
get: function get() {
|
|
1696
|
-
return {
|
|
1697
|
-
xs: "0px",
|
|
1698
|
-
// $pf-global--breakpoint--xs: 0 !default;
|
|
1699
|
-
sm: "576px",
|
|
1700
|
-
// $pf-global--breakpoint--sm: 576px !default;
|
|
1701
|
-
md: "768px",
|
|
1702
|
-
// $pf-global--breakpoint--md: 768px !default;
|
|
1703
|
-
lg: "992px",
|
|
1704
|
-
// $pf-global--breakpoint--lg: 992px !default;
|
|
1705
|
-
xl: "1200px",
|
|
1706
|
-
// $pf-global--breakpoint--xl: 1200px !default;
|
|
1707
|
-
"2xl": "1450px" // $pf-global--breakpoint--2xl: 1450px !default;
|
|
1708
|
-
|
|
1709
|
-
};
|
|
1710
|
-
}
|
|
1711
|
-
}]);
|
|
1712
|
-
|
|
1713
|
-
return PFElement;
|
|
1714
|
-
}( /*#__PURE__*/_wrapNativeSuper(HTMLElement)); // Initialize the global instances
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
PFElement.allInstances = [];
|
|
1718
|
-
autoReveal(PFElement.log);
|
|
1719
|
-
|
|
1720
|
-
// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
|
|
1721
|
-
|
|
1722
|
-
if (!Array.prototype.findIndex) {
|
|
1723
|
-
Object.defineProperty(Array.prototype, "findIndex", {
|
|
1724
|
-
value: function value(predicate) {
|
|
1725
|
-
// 1. Let O be ? ToObject(this value).
|
|
1726
|
-
if (this == null) {
|
|
1727
|
-
throw new TypeError('"this" is null or not defined');
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
var o = Object(this); // 2. Let len be ? ToLength(? Get(O, "length")).
|
|
1731
|
-
|
|
1732
|
-
var len = o.length >>> 0; // 3. If IsCallable(predicate) is false, throw a TypeError exception.
|
|
1733
|
-
|
|
1734
|
-
if (typeof predicate !== "function") {
|
|
1735
|
-
throw new TypeError("predicate must be a function");
|
|
1736
|
-
} // 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
var thisArg = arguments[1]; // 5. Let k be 0.
|
|
1740
|
-
|
|
1741
|
-
var k = 0; // 6. Repeat, while k < len
|
|
1742
|
-
|
|
1743
|
-
while (k < len) {
|
|
1744
|
-
// a. Let Pk be ! ToString(k).
|
|
1745
|
-
// b. Let kValue be ? Get(O, Pk).
|
|
1746
|
-
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
|
|
1747
|
-
// d. If testResult is true, return k.
|
|
1748
|
-
var kValue = o[k];
|
|
1749
|
-
|
|
1750
|
-
if (predicate.call(thisArg, kValue, k, o)) {
|
|
1751
|
-
return k;
|
|
1752
|
-
} // e. Increase k by 1.
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
k++;
|
|
1756
|
-
} // 7. Return -1.
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
return -1;
|
|
1760
|
-
},
|
|
1761
|
-
configurable: true,
|
|
1762
|
-
writable: true
|
|
1763
|
-
});
|
|
1764
|
-
}
|
|
1765
|
-
/*!
|
|
1766
|
-
* PatternFly Elements: PfeTabs 1.12.3
|
|
1767
|
-
* @license
|
|
1768
|
-
* Copyright 2021 Red Hat, Inc.
|
|
1769
|
-
*
|
|
1770
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1771
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
1772
|
-
* in the Software without restriction, including without limitation the rights
|
|
1773
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1774
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
1775
|
-
* furnished to do so, subject to the following conditions:
|
|
1776
|
-
*
|
|
1777
|
-
* The above copyright notice and this permission notice shall be included in
|
|
1778
|
-
* all copies or substantial portions of the Software.
|
|
1779
|
-
*
|
|
1780
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1781
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1782
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1783
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1784
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1785
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1786
|
-
* SOFTWARE.
|
|
1787
|
-
*
|
|
1788
|
-
*/
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
var TAB_CONTENT_MUTATION_CONFIG = {
|
|
1792
|
-
characterData: true,
|
|
1793
|
-
childList: true,
|
|
1794
|
-
subtree: true
|
|
1795
|
-
};
|
|
1796
|
-
|
|
1797
|
-
var PfeTab = /*#__PURE__*/function (_PFElement) {
|
|
1798
|
-
_inheritsLoose(PfeTab, _PFElement);
|
|
1799
|
-
|
|
1800
|
-
function PfeTab() {
|
|
1801
|
-
var _this;
|
|
1802
|
-
|
|
1803
|
-
_this = _PFElement.call(this, PfeTab, {
|
|
1804
|
-
type: PfeTab.PfeType
|
|
1805
|
-
}) || this;
|
|
1806
|
-
_this._init = _this._init.bind(_assertThisInitialized(_this));
|
|
1807
|
-
_this._setTabContent = _this._setTabContent.bind(_assertThisInitialized(_this));
|
|
1808
|
-
_this._getTabElement = _this._getTabElement.bind(_assertThisInitialized(_this));
|
|
1809
|
-
_this._observer = new MutationObserver(_this._init);
|
|
1810
|
-
return _this;
|
|
1811
|
-
}
|
|
1812
|
-
|
|
1813
|
-
var _proto = PfeTab.prototype;
|
|
1814
|
-
|
|
1815
|
-
_proto.connectedCallback = function connectedCallback() {
|
|
1816
|
-
_PFElement.prototype.connectedCallback.call(this);
|
|
1817
|
-
|
|
1818
|
-
this._tabItem = this.shadowRoot.querySelector("#tab");
|
|
1819
|
-
if (this.hasLightDOM()) this._init();
|
|
1820
|
-
|
|
1821
|
-
this._observer.observe(this, TAB_CONTENT_MUTATION_CONFIG);
|
|
1822
|
-
};
|
|
1823
|
-
|
|
1824
|
-
_proto.disconnectedCallback = function disconnectedCallback() {
|
|
1825
|
-
_PFElement.prototype.disconnectedCallback.call(this);
|
|
1826
|
-
|
|
1827
|
-
this._observer.disconnect();
|
|
1828
|
-
};
|
|
1829
|
-
|
|
1830
|
-
_proto._selectedHandler = function _selectedHandler() {
|
|
1831
|
-
if (this.selected === "true") this.tabindex = 0;else this.tabindex = -1;
|
|
1832
|
-
};
|
|
1833
|
-
|
|
1834
|
-
_proto._oldPfeIdChanged = function _oldPfeIdChanged(oldVal, newVal) {
|
|
1835
|
-
if (!this.id) this.id = newVal;
|
|
1836
|
-
};
|
|
1837
|
-
|
|
1838
|
-
_proto._init = function _init() {
|
|
1839
|
-
if (window.ShadyCSS) this._observer.disconnect(); // Force role to be set to tab
|
|
1840
|
-
|
|
1841
|
-
this.role = "tab"; // Copy the tab content into the template
|
|
1842
|
-
|
|
1843
|
-
this._setTabContent(); // If an ID is not defined, generate a random one
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
if (!this.id) this.id = this.randomId;
|
|
1847
|
-
if (window.ShadyCSS) this._observer.observe(this, TAB_CONTENT_MUTATION_CONFIG);
|
|
1848
|
-
};
|
|
1849
|
-
|
|
1850
|
-
_proto._getTabElement = function _getTabElement() {
|
|
1851
|
-
// Check if there is no nested element or nested textNodes
|
|
1852
|
-
if (!this.firstElementChild && !this.firstChild) {
|
|
1853
|
-
this.warn("No tab content provided");
|
|
1854
|
-
return;
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
if (this.firstElementChild && this.firstElementChild.tagName) {
|
|
1858
|
-
// If the first element is a slot, query for it's content
|
|
1859
|
-
if (this.firstElementChild.tagName === "SLOT") {
|
|
1860
|
-
var slotted = this.firstElementChild.assignedNodes(); // If there is no content inside the slot, return empty with a warning
|
|
1861
|
-
|
|
1862
|
-
if (slotted.length === 0) {
|
|
1863
|
-
this.warn("No heading information exists within this slot.");
|
|
1864
|
-
return;
|
|
1865
|
-
} // If there is more than 1 element in the slot, capture the first h-tag
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
if (slotted.length > 1) this.warn("Tab heading currently only supports 1 heading tag.");
|
|
1869
|
-
var htags = slotted.filter(function (slot) {
|
|
1870
|
-
return slot.tagName.match(/^H[1-6]/) || slot.tagName === "P";
|
|
1871
|
-
});
|
|
1872
|
-
if (htags.length > 0) return htags[0];else return;
|
|
1873
|
-
} else if (this.firstElementChild.tagName.match(/^H[1-6]/) || this.firstElementChild.tagName === "P") {
|
|
1874
|
-
return this.firstElementChild;
|
|
1875
|
-
} else {
|
|
1876
|
-
this.warn("Tab heading should contain at least 1 heading tag for correct semantics.");
|
|
1877
|
-
}
|
|
1878
|
-
}
|
|
1879
|
-
|
|
1880
|
-
return;
|
|
1881
|
-
};
|
|
1882
|
-
|
|
1883
|
-
_proto._setTabContent = function _setTabContent() {
|
|
1884
|
-
var label = "";
|
|
1885
|
-
var isTag = false;
|
|
1886
|
-
|
|
1887
|
-
var tabElement = this._getTabElement();
|
|
1888
|
-
|
|
1889
|
-
if (tabElement) {
|
|
1890
|
-
// Copy the tab content into the template
|
|
1891
|
-
label = tabElement.textContent.trim().replace(/\s+/g, " ");
|
|
1892
|
-
isTag = true;
|
|
1893
|
-
}
|
|
1894
|
-
|
|
1895
|
-
if (!tabElement) {
|
|
1896
|
-
// If no element is found, try for a text node
|
|
1897
|
-
if (this.textContent.trim().replace(/\s+/g, " ")) {
|
|
1898
|
-
label = this.textContent.trim().replace(/\s+/g, " ");
|
|
1899
|
-
}
|
|
1900
|
-
}
|
|
1901
|
-
|
|
1902
|
-
if (!label) {
|
|
1903
|
-
this.warn("There does not appear to be any content in the tab region.");
|
|
1904
|
-
return;
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
var semantics = "h3";
|
|
1908
|
-
|
|
1909
|
-
if (isTag) {
|
|
1910
|
-
semantics = tabElement.tagName.toLowerCase();
|
|
1911
|
-
} // Create an h-level tag for the shadow tab, default h3
|
|
1912
|
-
// or use the provided semantics from light DOM
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
var heading = document.createElement(semantics); // Assign the label content to the new heading
|
|
1916
|
-
|
|
1917
|
-
heading.textContent = label; // Attach the heading to the tabItem
|
|
1918
|
-
|
|
1919
|
-
if (this._tabItem) {
|
|
1920
|
-
this._tabItem.innerHTML = "";
|
|
1921
|
-
|
|
1922
|
-
this._tabItem.appendChild(heading);
|
|
1923
|
-
}
|
|
1924
|
-
};
|
|
1925
|
-
|
|
1926
|
-
_createClass(PfeTab, [{
|
|
1927
|
-
key: "html",
|
|
1928
|
-
get: // Injected at build-time
|
|
1929
|
-
function get() {
|
|
1930
|
-
return "\n<style>:host{text-align:left;position:relative;display:block;cursor:pointer;margin:0 0 calc(1px * -1);margin:var(--pfe-tabs__tab--Margin,0 0 calc(var(--pfe-theme--ui--border-width,1px) * -1));padding:1rem calc(1rem * 2) 1rem calc(1rem * 2);padding:var(--pfe-tabs__tab--PaddingTop,var(--pfe-theme--container-padding,1rem)) var(--pfe-tabs__tab--PaddingRight,calc(var(--pfe-theme--container-padding,1rem) * 2)) var(--pfe-tabs__tab--PaddingBottom,var(--pfe-theme--container-padding,1rem)) var(--pfe-tabs__tab--PaddingLeft,calc(var(--pfe-theme--container-padding,1rem) * 2));border-style:solid;border-style:var(--pfe-theme--ui--border-style,solid);border-width:1px;border-width:var(--pfe-theme--ui--border-width,1px);border-color:transparent;border-bottom-width:3px;border-bottom-width:var(--pfe-tabs--BorderWidth,var(--pfe-theme--ui--border-width--active,3px));background-color:none;background-color:var(--pfe-tabs--BackgroundColor--inactive,none);text-align:center;text-align:var(--pfe-tabs__tab--TextAlign,center);text-transform:none;text-transform:var(--pfe-tabs__tab--TextTransform,none);color:#6a6e73;color:var(--pfe-tabs--Color,var(--pfe-theme--color--text--muted,#6a6e73));font-size:1rem;font-size:var(--pfe-tabs__tab--FontSize,var(--pf-global--FontSize--md,1rem));font-family:\"Red Hat Text\",RedHatText,Overpass,Overpass,Arial,sans-serif;font-family:var(--pfe-tabs__tab--LineHeight, var(--pfe-theme--font-family, \"Red Hat Text\", \"RedHatText\", \"Overpass\", Overpass, Arial, sans-serif));line-height:1.5;line-height:var(--pfe-tabs__tab--LineHeight,var(--pfe-theme--line-height,1.5));font-weight:400;font-weight:var(--pfe-tabs__tab--FontWeight,var(--pfe-theme--font-weight--normal,400));--pf-c--FontSize:var(--pfe-tabs--FontSize)}:host #tab{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;height:100%}:host #tab *{font-size:inherit;font-weight:inherit;color:inherit;margin:0}:host([aria-selected=true]){background-color:transparent;background-color:var(--pfe-tabs--BackgroundColor,transparent);border-bottom-color:#06c;border-bottom-color:var(--pfe-tabs--BorderColor,var(--pfe-tabs--highlight,var(--pfe-theme--color--ui-accent,#06c)))}:host([aria-selected=true]) #tab *{color:#151515;color:var(--pfe-tabs--Color--focus,var(--pfe-tabs--focus,var(--pfe-theme--color--text,#151515)))}:host(:active),:host(:hover){background-color:transparent;background-color:var(--pfe-tabs--BackgroundColor,transparent);border-bottom-color:#b8bbbe;border-bottom-color:var(--pfe-tabs--BorderColor--hover,#b8bbbe)}:host(:active) #tab *,:host(:hover) #tab *{color:#151515;color:var(--pfe-tabs--Color--focus,var(--pfe-tabs--focus,var(--pfe-theme--color--text,#151515)))}@media screen and (min-width:768px){:host([vertical]){border-bottom-color:transparent;border-bottom-width:0;border-left-color:#d2d2d2;border-left-color:var(--pfe-theme--color--surface--border,#d2d2d2);border-left-width:1px;border-left-width:var(--pfe-theme--ui--border-width,1px);padding:1rem;padding:var(--pfe-theme--container-padding,1rem);--pfe-tabs--Margin:0 calc(var(--pfe-theme--ui--border-width, 1px) * -1) 0 0}:host([vertical][aria-selected=true]){border-left-color:#06c;border-left-color:var(--pfe-tabs--BorderColor,var(--pfe-tabs--highlight,var(--pfe-theme--color--ui-accent,#06c)));border-left-width:3px}:host([vertical]:not([variant=earth])){border-left:1px solid #d2d2d2;border-left:var(--pfe-theme--ui--border-width,1px) var(--pfe-theme--ui--border-style,solid) var(--pfe-theme--color--surface--border,#d2d2d2);text-align:left!important}:host([vertical]:not([variant=earth])[aria-selected=true]){border-right:3px solid transparent;border-right:var(--pfe-tabs--BorderWidth,var(--pfe-theme--ui--border-width--active,3px)) var(--pfe-theme--ui--border-style,solid) transparent;border-left:3px solid #06c;border-left:var(--pfe-tabs--BorderWidth,var(--pfe-theme--ui--border-width--active,3px)) var(--pfe-theme--ui--border-style,solid) var(--pfe-tabs--BorderColor,var(--pfe-tabs--highlight,var(--pfe-theme--color--ui-accent,#06c)));padding-left:calc(1rem - 2px);padding-left:calc(var(--pfe-theme--container-padding,1rem) - 2px)}:host([vertical]:not([variant=earth])[aria-selected=false]){border-right:3px solid transparent;border-right:var(--pfe-tabs--BorderWidth,var(--pfe-theme--ui--border-width--active,3px)) var(--pfe-theme--ui--border-style,solid) transparent}:host([vertical]:not([variant=earth])[aria-selected=false]:hover){border-right:3px solid transparent;border-right:var(--pfe-tabs--BorderWidth,var(--pfe-theme--ui--border-width--active,3px)) var(--pfe-theme--ui--border-style,solid) transparent;border-bottom:0;border-left:3px solid #b8bbbe;border-left:var(--pfe-tabs--BorderWidth,var(--pfe-theme--ui--border-width--active,3px)) var(--pfe-theme--ui--border-style,solid) var(--pfe-tabs--BorderColor--hover,#b8bbbe);padding-left:calc(1rem - 2px);padding-left:calc(var(--pfe-theme--container-padding,1rem) - 2px)}}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([variant=earth]){background-color:#f0f0f0;color:#6a6e73}}:host(:not([vertical])[variant=earth]:not([aria-selected=true]):first-of-type){border-left-color:transparent}:host(:not([vertical])[variant=earth]:not([aria-selected=true]):last-of-type){border-right-color:transparent}:host([variant=earth][aria-selected=false]){background-color:#f0f0f0;background-color:var(--pfe-tabs--BackgroundColor--inactive,var(--pfe-theme--color--surface--lighter,#f0f0f0));border-color:#d2d2d2;border-color:var(--pfe-theme--color--surface--border,#d2d2d2);border-top-width:3px;border-top-width:var(--pfe-tabs--BorderWidth,var(--pfe-theme--ui--border-width--active,3px));border-top-color:transparent;border-bottom-color:#b8bbbe;border-bottom-color:var(--pfe-tabs--BorderColor--hover,#b8bbbe);border-bottom-width:1px;border-bottom-width:var(--pfe-theme--ui--border-width,1px)}:host([variant=earth][aria-selected=false]:hover){border-top-color:#b8bbbe;border-top-color:var(--pfe-tabs--BorderColor--hover,#b8bbbe)}:host([variant=earth][aria-selected=true]){background-color:#fff;background-color:var(--pfe-tabs--BackgroundColor,var(--pfe-theme--color--surface--lightest,#fff));border-bottom:0;border-left-color:#d2d2d2;border-left-color:var(--pfe-theme--color--surface--border,#d2d2d2);border-right-color:#d2d2d2;border-right-color:var(--pfe-theme--color--surface--border,#d2d2d2);border-top:solid #06c 3px;border-top:solid var(--pfe-tabs--BorderColor,var(--pfe-tabs--highlight,var(--pfe-theme--color--ui-accent,#06c))) var(--pfe-tabs--BorderWidth,var(--pfe-theme--ui--border-width--active,3px))}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([variant=earth][aria-selected=true]){color:#6a6e73;background-color:#fff;border-left:1px solid #d2d2d2;border-top:3px solid #06c;border-top:var(--pfe-tabs--BorderWidth,var(--pfe-theme--ui--border-width--active,3px)) solid var(--pfe-tabs--BorderColor,var(--pfe-tabs--highlight,var(--pfe-theme--color--ui-accent,#06c)));border-bottom:0}}:host([variant=earth][aria-selected=true]:last-of-type){border-right:1px solid #d2d2d2;border-right:var(--pfe-theme--ui--border-width,1px) var(--pfe-theme--ui--border-style,solid) var(--pfe-theme--color--surface--border,#d2d2d2)}@media screen and (min-width:768px){:host([vertical][variant=earth]){border-top:1px solid #d2d2d2;border-top:var(--pfe-theme--ui--border-width,1px) var(--pfe-theme--ui--border-style,solid) var(--pfe-theme--color--surface--border,#d2d2d2);border-bottom:1px solid #d2d2d2;border-bottom:var(--pfe-theme--ui--border-width,1px) var(--pfe-theme--ui--border-style,solid) var(--pfe-theme--color--surface--border,#d2d2d2);border-left-width:3px;border-left-width:var(--pfe-theme--ui--border-width--active,3px);text-align:left}:host([vertical][variant=earth][aria-selected=false]:first-of-type){border-top-color:transparent;border-left:3px solid transparent;border-left:var(--pfe-tabs--BorderWidth,var(--pfe-theme--ui--border-width--active,3px)) var(--pfe-theme--ui--border-style,solid) transparent}:host([vertical][variant=earth][aria-selected=false]:last-of-type){border-bottom-color:transparent}:host([vertical][variant=earth][aria-selected=false]){border-right:0;border-bottom-color:transparent;border-left-color:transparent}:host([vertical][variant=earth][aria-selected=false]:hover){border-left-color:#b8bbbe;border-left-color:var(--pfe-tabs--BorderColor--hover,#b8bbbe);border-top-color:#d2d2d2;border-top-color:var(--pfe-theme--color--surface--border,#d2d2d2)}:host([vertical][variant=earth][aria-selected=false]:first-of-type:hover){border-left-color:#d2d2d2;border-left-color:var(--pfe-theme--color--surface--border,#d2d2d2);border-top-color:transparent}:host([vertical][variant=earth][aria-selected=true]){border-top-color:#d2d2d2;border-top-color:var(--pfe-theme--color--surface--border,#d2d2d2);border-left-color:#06c;border-left-color:var(--pfe-tabs--BorderColor,var(--pfe-tabs--highlight,var(--pfe-theme--color--ui-accent,#06c)));border-right-color:transparent;margin-right:-1px}}:host([on=dark][variant=earth]){--pfe-tabs--Color:var(--pfe-theme--color--text--on-dark, #fff);--pfe-tabs--Color--focus:var(--pfe-theme--color--text--on-dark, #fff);border-right-color:#6a6e73;border-right-color:var(--pfe-theme--color--surface--border--darker,#6a6e73);border-left-color:#6a6e73;border-left-color:var(--pfe-theme--color--surface--border--darker,#6a6e73)}:host([on=dark][variant=earth][aria-selected=false]){--pfe-tabs--Color:var(--pfe-theme--color--text--muted--on-dark, #d2d2d2);--pfe-tabs--BackgroundColor--inactive:var(--pfe-theme--color--surface--darker, #3c3f42)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([on=dark][variant=earth][aria-selected=false]){background-color:#fff!important;background-color:var(--pfe-theme--color--surface--lightest,#fff)!important}:host([on=dark][variant=earth][aria-selected=false]) #tab *{color:#151515!important}}:host([on=dark][variant=earth][aria-selected=true]){--pfe-tabs--Color--focus:var(--pfe-theme--color--text--on-dark, #fff);--pfe-tabs--BackgroundColor:var(--pfe-theme--color--surface--darkest, #151515)}:host([variant=earth][on=saturated][aria-selected=false]){--pfe-tabs--BackgroundColor:var(--pfe-theme--color--surface--lighter, #f0f0f0)}:host([variant=earth][on=saturated][aria-selected=true]){--pfe-tabs--BackgroundColor:var(--pfe-theme--color--surface--lightest, #fff)}:host([on=saturated]:not([variant=earth])){--pfe-tabs--Color:var(--pfe-theme--color--text--on-saturated, #fff);--pfe-tabs--Color--focus:var(--pfe-theme--color--text--on-saturated, #fff)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([on=saturated]:not([variant=earth])){background-color:transparent}:host([on=saturated]:not([variant=earth])) #tab *{color:#151515!important}}:host([on=saturated]:not([variant=earth])[aria-selected=true]){--pfe-tabs--Color--focus:var(--pfe-theme--color--text--on-saturated, #fff);--pfe-tabs--BorderColor:var(--pfe-theme--color--ui-base--on-saturated, #fff)}:host([on=saturated]:not([variant=earth])[aria-selected=false]){--pfe-tabs--Color:var(--pfe-theme--color--text--muted--on-saturated, #d2d2d2)}:host([on=saturated]:not([variant=earth])[aria-selected=false]:hover){--pfe-tabs--BorderColor:var(--pfe-theme--color--surface--border, #d2d2d2)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([on=saturated]:not([variant=earth])[aria-selected=true]:last-of-type){border-left:0!important}}:host([on=dark]:not([variant=earth])){--pfe-tabs--Color:var(--pfe-theme--color--text--on-dark, #fff);--pfe-tabs--Color--focus:var(--pfe-theme--color--text--on-dark, #fff)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([on=dark]:not([variant=earth])) #tab *{color:#151515!important}}:host([on=dark]:not([variant=earth])[aria-selected=false]){--pfe-tabs--Color:var(--pfe-theme--color--text--muted--on-saturated, #d2d2d2)}:host([on=dark]:not([variant=earth])[aria-selected=false]:hover){--pfe-tabs--BorderColor:var(--pfe-theme--color--surface--lightest, #fff);border-bottom-color:#f0f0f0;border-bottom-color:var(--pfe-theme--color--surface--base,#f0f0f0);--pfe-tabs__tab--BorderBottom:var(--pfe-tabs--BorderWidth, var(--pfe-theme--ui--border-width--active, 3px)) var(--pfe-theme--ui--border-style, solid) var(--pfe-theme--color--surface--border, #d2d2d2)}:host([on=dark]:not([variant=earth])[vertical][aria-selected=false]:hover){border-bottom-color:transparent} /*# sourceMappingURL=pfe-tab.min.css.map */</style>\n<span id=\"tab\"></span>";
|
|
1931
|
-
}
|
|
1932
|
-
}, {
|
|
1933
|
-
key: "styleUrl",
|
|
1934
|
-
get: function get() {
|
|
1935
|
-
return "pfe-tab.scss";
|
|
1936
|
-
}
|
|
1937
|
-
}, {
|
|
1938
|
-
key: "templateUrl",
|
|
1939
|
-
get: function get() {
|
|
1940
|
-
return "pfe-tab.html";
|
|
1941
|
-
}
|
|
1942
|
-
}], [{
|
|
1943
|
-
key: "version",
|
|
1944
|
-
get: // Injected at build-time
|
|
1945
|
-
function get() {
|
|
1946
|
-
return "1.12.3";
|
|
1947
|
-
}
|
|
1948
|
-
}, {
|
|
1949
|
-
key: "tag",
|
|
1950
|
-
get: function get() {
|
|
1951
|
-
return "pfe-tab";
|
|
1952
|
-
}
|
|
1953
|
-
}, {
|
|
1954
|
-
key: "properties",
|
|
1955
|
-
get: function get() {
|
|
1956
|
-
return {
|
|
1957
|
-
selected: {
|
|
1958
|
-
title: "Selected tab",
|
|
1959
|
-
type: String,
|
|
1960
|
-
"default": "false",
|
|
1961
|
-
attr: "aria-selected",
|
|
1962
|
-
values: ["true", "false"],
|
|
1963
|
-
observer: "_selectedHandler"
|
|
1964
|
-
},
|
|
1965
|
-
controls: {
|
|
1966
|
-
title: "Connected panel ID",
|
|
1967
|
-
type: String,
|
|
1968
|
-
attr: "aria-controls"
|
|
1969
|
-
},
|
|
1970
|
-
role: {
|
|
1971
|
-
type: String,
|
|
1972
|
-
"default": "tab"
|
|
1973
|
-
},
|
|
1974
|
-
tabindex: {
|
|
1975
|
-
type: Number,
|
|
1976
|
-
"default": -1
|
|
1977
|
-
},
|
|
1978
|
-
variant: {
|
|
1979
|
-
title: "Variant",
|
|
1980
|
-
type: String,
|
|
1981
|
-
"enum": ["wind", "earth"]
|
|
1982
|
-
},
|
|
1983
|
-
// @TODO: Deprecated in 1.0
|
|
1984
|
-
oldPfeId: {
|
|
1985
|
-
type: String,
|
|
1986
|
-
attr: "pfe-id",
|
|
1987
|
-
observer: "_oldPfeIdChanged"
|
|
1988
|
-
}
|
|
1989
|
-
};
|
|
1990
|
-
} // Declare the type of this component
|
|
1991
|
-
|
|
1992
|
-
}, {
|
|
1993
|
-
key: "PfeType",
|
|
1994
|
-
get: function get() {
|
|
1995
|
-
return PFElement.PfeTypes.Content;
|
|
1996
|
-
}
|
|
1997
|
-
}]);
|
|
1998
|
-
|
|
1999
|
-
return PfeTab;
|
|
2000
|
-
}(PFElement);
|
|
2001
|
-
/*!
|
|
2002
|
-
* PatternFly Elements: PfeTabs 1.12.3
|
|
2003
|
-
* @license
|
|
2004
|
-
* Copyright 2021 Red Hat, Inc.
|
|
2005
|
-
*
|
|
2006
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2007
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
2008
|
-
* in the Software without restriction, including without limitation the rights
|
|
2009
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2010
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
2011
|
-
* furnished to do so, subject to the following conditions:
|
|
2012
|
-
*
|
|
2013
|
-
* The above copyright notice and this permission notice shall be included in
|
|
2014
|
-
* all copies or substantial portions of the Software.
|
|
2015
|
-
*
|
|
2016
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2017
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2018
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2019
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2020
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2021
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
2022
|
-
* SOFTWARE.
|
|
2023
|
-
*
|
|
2024
|
-
*/
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
var TAB_PANEL_MUTATION_CONFIG = {
|
|
2028
|
-
childList: true,
|
|
2029
|
-
subtree: true
|
|
2030
|
-
};
|
|
2031
|
-
|
|
2032
|
-
var PfeTabPanel = /*#__PURE__*/function (_PFElement2) {
|
|
2033
|
-
_inheritsLoose(PfeTabPanel, _PFElement2);
|
|
2034
|
-
|
|
2035
|
-
function PfeTabPanel() {
|
|
2036
|
-
var _this2;
|
|
2037
|
-
|
|
2038
|
-
_this2 = _PFElement2.call(this, PfeTabPanel, {
|
|
2039
|
-
type: PfeTabPanel.PfeType
|
|
2040
|
-
}) || this;
|
|
2041
|
-
_this2._init = _this2._init.bind(_assertThisInitialized(_this2));
|
|
2042
|
-
_this2._observer = new MutationObserver(_this2._init);
|
|
2043
|
-
return _this2;
|
|
2044
|
-
}
|
|
2045
|
-
|
|
2046
|
-
var _proto2 = PfeTabPanel.prototype;
|
|
2047
|
-
|
|
2048
|
-
_proto2.connectedCallback = function connectedCallback() {
|
|
2049
|
-
_PFElement2.prototype.connectedCallback.call(this);
|
|
2050
|
-
|
|
2051
|
-
if (this.hasLightDOM()) this._init();
|
|
2052
|
-
|
|
2053
|
-
this._observer.observe(this, TAB_PANEL_MUTATION_CONFIG);
|
|
2054
|
-
};
|
|
2055
|
-
|
|
2056
|
-
_proto2.disconnectedCallback = function disconnectedCallback() {
|
|
2057
|
-
_PFElement2.prototype.disconnectedCallback.call(this);
|
|
2058
|
-
|
|
2059
|
-
this._observer.disconnect();
|
|
2060
|
-
};
|
|
2061
|
-
|
|
2062
|
-
_proto2._init = function _init() {
|
|
2063
|
-
if (window.ShadyCSS) this._observer.disconnect(); // If an ID is not defined, generate a random one
|
|
2064
|
-
|
|
2065
|
-
if (!this.id) this.id = this.randomId; // Force role to be set to tab
|
|
2066
|
-
|
|
2067
|
-
this.role = "tabpanel";
|
|
2068
|
-
|
|
2069
|
-
if (this.previousElementSibling && this.previousElementSibling.selected !== "true") {
|
|
2070
|
-
this.hidden = true;
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
if (window.ShadyCSS) this._observer.observe(this, TAB_PANEL_MUTATION_CONFIG);
|
|
2074
|
-
};
|
|
2075
|
-
|
|
2076
|
-
_proto2._oldPfeIdChanged = function _oldPfeIdChanged(oldVal, newVal) {
|
|
2077
|
-
if (!this.id) this.id = newVal;
|
|
2078
|
-
};
|
|
2079
|
-
|
|
2080
|
-
_createClass(PfeTabPanel, [{
|
|
2081
|
-
key: "html",
|
|
2082
|
-
get: // Injected at build-time
|
|
2083
|
-
function get() {
|
|
2084
|
-
return "\n<style>:host{display:block;color:#3c3f42;color:var(--pfe-broadcasted--text,#3c3f42)}:host(:focus){outline:0}:host [tabindex]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:100%}:host .container{margin:0;width:100%;background-color:transparent;background-color:var(--pfe-tabs__panel--BackgroundColor,transparent);border-top:0;border-top:var(--pfe-tabs__panel--BorderTop,0);border-right:0;border-right:var(--pfe-tabs__panel--BorderRight,0);border-bottom:0;border-bottom:var(--pfe-tabs__panel--BorderBottom,0);border-left:0;border-left:var(--pfe-tabs__panel--BorderLeft,0);padding-top:calc(1rem * 3);padding-top:var(--pfe-tabs__panel--PaddingTop,calc(var(--pfe-theme--container-padding,1rem) * 3))}@media screen and (min-width:1200px){:host .container{padding-top:calc(1rem * 3);padding-top:var(--pfe-tabs__panel--PaddingTop,calc(var(--pfe-theme--container-padding,1rem) * 3));padding-right:0;padding-right:var(--pfe-tabs__panel--PaddingRight,0);padding-bottom:0;padding-bottom:var(--pfe-tabs__panel--PaddingBottom,0);padding-left:0;padding-left:var(--pfe-tabs__panel--PaddingLeft,0)}}:host .container::after{clear:both;content:\"\";display:table}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host .container{padding:1em;background-color:#fff!important;color:#151515!important}}:host([hidden]){display:none}:host([variant=earth]){background-color:#fff;background-color:var(--pfe-tabs__panel--BackgroundColor,var(--pfe-theme--color--surface--lightest,#fff))}:host([variant=earth]) .container{padding-top:calc(1rem * 3);padding-top:var(--pfe-tabs__panel--PaddingTop,calc(var(--pfe-theme--container-padding,1rem) * 3));padding-right:calc(1rem * 3);padding-right:var(--pfe-tabs__panel--PaddingRight,calc(var(--pfe-theme--container-padding,1rem) * 3));padding-bottom:calc(1rem * 3);padding-bottom:var(--pfe-tabs__panel--PaddingBottom,calc(var(--pfe-theme--container-padding,1rem) * 3));padding-left:calc(1rem * 3);padding-left:var(--pfe-tabs__panel--PaddingLeft,calc(var(--pfe-theme--container-padding,1rem) * 3))}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([variant=earth]) .container{background-color:#fff;padding:1em;border-right:1px solid #d2d2d2;border-bottom:1px solid #d2d2d2;border-left:1px solid #d2d2d2}}@media screen and (min-width:768px){:host([variant=wind][vertical]) .container{padding-top:0;padding-top:var(--pfe-tabs__panel--PaddingTop,0);padding-bottom:0;padding-bottom:var(--pfe-tabs__panel--PaddingBottom,0);padding-right:0;padding-right:var(--pfe-tabs__panel--PaddingRight,0);margin:0 calc(1rem - 2px);margin:0 calc(var(--pfe-theme--container-spacer,1rem) - 2px)}}@media screen and (min-width:768px) and (-ms-high-contrast:active),screen and (min-width:768px) and (-ms-high-contrast:none){:host([variant=wind][vertical]) .container{padding:1em 0 1em 2em}}@media screen and (min-width:768px){:host([variant=earth][vertical]){border-top:0;border-top:var(--pfe-tabs--BorderTop,0);border-left:1px solid #d2d2d2;border-left:var(--pfe-tabs--BorderLeft,var(--pfe-theme--ui--border-width,1px) var(--pfe-theme--ui--border-style,solid) var(--pfe-theme--color--surface--border,#d2d2d2));height:100%;background-color:#fff;background-color:var(--pfe-tabs__panel--BackgroundColor,var(--pfe-theme--color--surface--lightest,#fff))}:host([variant=earth][vertical]) .container{padding-left:calc(1rem * 3);padding-left:var(--pfe-tabs__panel--PaddingLeft,calc(var(--pfe-theme--container-padding,1rem) * 3))}}@media screen and (min-width:768px) and (-ms-high-contrast:active),screen and (min-width:768px) and (-ms-high-contrast:none){:host([variant=earth][vertical]) .container{border-top:1px solid #d2d2d2}}:host([variant=earth]) .container{padding-top:calc(1rem * 3);padding-top:var(--pfe-tabs__panel--PaddingTop,calc(var(--pfe-theme--container-padding,1rem) * 3));padding-right:calc(1rem * 3);padding-right:var(--pfe-tabs__panel--PaddingRight,calc(var(--pfe-theme--container-padding,1rem) * 3));padding-bottom:calc(1rem * 3);padding-bottom:var(--pfe-tabs__panel--PaddingBottom,calc(var(--pfe-theme--container-padding,1rem) * 3));padding-left:calc(1rem * 3);padding-left:var(--pfe-tabs__panel--PaddingLeft,calc(var(--pfe-theme--container-padding,1rem) * 3))}:host([on=dark][variant=earth]){background-color:#151515;background-color:var(--pfe-tabs__panel--BackgroundColor,var(--pfe-theme--color--surface--darkest,#151515));--pfe-broadcasted--text:var(--pfe-theme--color--text--on-dark, #fff);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted--on-dark, #d2d2d2);--pfe-broadcasted--link:var(--pfe-theme--color--link--on-dark, #73bcf7);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover--on-dark, #bee1f4);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus--on-dark, #bee1f4);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited--on-dark, #bee1f4);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration--on-dark, none);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover--on-dark, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus--on-dark, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited--on-dark, none)}:host([on=saturated][variant=earth]){background-color:#fff;background-color:var(--pfe-tabs__panel--BackgroundColor,var(--pfe-theme--color--surface--lightest,#fff));--pfe-broadcasted--text:var(--pfe-theme--color--text, #151515);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted, #6a6e73);--pfe-broadcasted--link:var(--pfe-theme--color--link, #06c);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover, #004080);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus, #004080);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited, #6753ac);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration, none);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited, none)}:host([on=saturated]:not([variant=earth])){--pfe-broadcasted--text:var(--pfe-theme--color--text--on-saturated, #fff);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted--on-saturated, #d2d2d2);--pfe-broadcasted--link:var(--pfe-theme--color--link--on-saturated, #fff);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover--on-saturated, #fafafa);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus--on-saturated, #fafafa);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited--on-saturated, #d2d2d2);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration--on-saturated, underline);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover--on-saturated, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus--on-saturated, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited--on-saturated, underline)}:host([on=dark]:not([variant=earth])){--pfe-broadcasted--text:var(--pfe-theme--color--text--on-dark, #fff);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted--on-dark, #d2d2d2);--pfe-broadcasted--link:var(--pfe-theme--color--link--on-dark, #73bcf7);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover--on-dark, #bee1f4);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus--on-dark, #bee1f4);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited--on-dark, #bee1f4);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration--on-dark, none);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover--on-dark, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus--on-dark, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited--on-dark, none)} /*# sourceMappingURL=pfe-tab-panel.min.css.map */</style>\n<div tabindex=\"-1\" role=\"tabpanel\">\n <div class=\"container\">\n <slot></slot>\n </div>\n</div>";
|
|
2085
|
-
}
|
|
2086
|
-
}, {
|
|
2087
|
-
key: "styleUrl",
|
|
2088
|
-
get: function get() {
|
|
2089
|
-
return "pfe-tab-panel.scss";
|
|
2090
|
-
}
|
|
2091
|
-
}, {
|
|
2092
|
-
key: "templateUrl",
|
|
2093
|
-
get: function get() {
|
|
2094
|
-
return "pfe-tab-panel.html";
|
|
2095
|
-
}
|
|
2096
|
-
}], [{
|
|
2097
|
-
key: "version",
|
|
2098
|
-
get: // Injected at build-time
|
|
2099
|
-
function get() {
|
|
2100
|
-
return "1.12.3";
|
|
2101
|
-
}
|
|
2102
|
-
}, {
|
|
2103
|
-
key: "tag",
|
|
2104
|
-
get: function get() {
|
|
2105
|
-
return "pfe-tab-panel";
|
|
2106
|
-
}
|
|
2107
|
-
}, {
|
|
2108
|
-
key: "properties",
|
|
2109
|
-
get: function get() {
|
|
2110
|
-
return {
|
|
2111
|
-
selected: {
|
|
2112
|
-
title: "Selected tab",
|
|
2113
|
-
type: Boolean,
|
|
2114
|
-
"default": false,
|
|
2115
|
-
attr: "aria-selected",
|
|
2116
|
-
observer: "_selectedHandler"
|
|
2117
|
-
},
|
|
2118
|
-
hidden: {
|
|
2119
|
-
title: "Visibility",
|
|
2120
|
-
type: Boolean,
|
|
2121
|
-
"default": false
|
|
2122
|
-
},
|
|
2123
|
-
role: {
|
|
2124
|
-
type: String,
|
|
2125
|
-
"default": "tabpanel"
|
|
2126
|
-
},
|
|
2127
|
-
tabindex: {
|
|
2128
|
-
type: Number,
|
|
2129
|
-
"default": 0
|
|
2130
|
-
},
|
|
2131
|
-
labelledby: {
|
|
2132
|
-
type: String,
|
|
2133
|
-
attr: "aria-labelledby"
|
|
2134
|
-
},
|
|
2135
|
-
variant: {
|
|
2136
|
-
title: "Variant",
|
|
2137
|
-
type: String,
|
|
2138
|
-
"enum": ["wind", "earth"]
|
|
2139
|
-
},
|
|
2140
|
-
// @TODO: Deprecated in 1.0
|
|
2141
|
-
oldPfeId: {
|
|
2142
|
-
type: String,
|
|
2143
|
-
attr: "pfe-id",
|
|
2144
|
-
observer: "_oldPfeIdChanged"
|
|
2145
|
-
}
|
|
2146
|
-
};
|
|
2147
|
-
} // Declare the type of this component
|
|
2148
|
-
|
|
2149
|
-
}, {
|
|
2150
|
-
key: "PfeType",
|
|
2151
|
-
get: function get() {
|
|
2152
|
-
return PFElement.PfeTypes.Container;
|
|
2153
|
-
}
|
|
2154
|
-
}]);
|
|
2155
|
-
|
|
2156
|
-
return PfeTabPanel;
|
|
2157
|
-
}(PFElement);
|
|
2158
|
-
/*!
|
|
2159
|
-
* PatternFly Elements: PfeTabs 1.12.3
|
|
2160
|
-
* @license
|
|
2161
|
-
* Copyright 2021 Red Hat, Inc.
|
|
2162
|
-
*
|
|
2163
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2164
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
2165
|
-
* in the Software without restriction, including without limitation the rights
|
|
2166
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2167
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
2168
|
-
* furnished to do so, subject to the following conditions:
|
|
2169
|
-
*
|
|
2170
|
-
* The above copyright notice and this permission notice shall be included in
|
|
2171
|
-
* all copies or substantial portions of the Software.
|
|
2172
|
-
*
|
|
2173
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2174
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2175
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2176
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2177
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2178
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
2179
|
-
* SOFTWARE.
|
|
2180
|
-
*
|
|
2181
|
-
*/
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
var KEYCODE = {
|
|
2185
|
-
DOWN: 40,
|
|
2186
|
-
LEFT: 37,
|
|
2187
|
-
RIGHT: 39,
|
|
2188
|
-
UP: 38,
|
|
2189
|
-
HOME: 36,
|
|
2190
|
-
END: 35
|
|
2191
|
-
}; // @IE11 doesn't support URLSearchParams
|
|
2192
|
-
// https://caniuse.com/#search=urlsearchparams
|
|
2193
|
-
|
|
2194
|
-
var CAN_USE_URLSEARCHPARAMS = window.URLSearchParams ? true : false;
|
|
2195
|
-
var TABS_MUTATION_CONFIG = {
|
|
2196
|
-
childList: true,
|
|
2197
|
-
subtree: true
|
|
2198
|
-
};
|
|
2199
|
-
|
|
2200
|
-
var PfeTabs = /*#__PURE__*/function (_PFElement3) {
|
|
2201
|
-
_inheritsLoose(PfeTabs, _PFElement3);
|
|
2202
|
-
|
|
2203
|
-
function PfeTabs() {
|
|
2204
|
-
var _this3;
|
|
2205
|
-
|
|
2206
|
-
_this3 = _PFElement3.call(this, PfeTabs, {
|
|
2207
|
-
type: PfeTabs.PfeType
|
|
2208
|
-
}) || this;
|
|
2209
|
-
_this3._linked = false;
|
|
2210
|
-
_this3._init = _this3._init.bind(_assertThisInitialized(_this3));
|
|
2211
|
-
_this3._onClick = _this3._onClick.bind(_assertThisInitialized(_this3));
|
|
2212
|
-
_this3._linkPanels = _this3._linkPanels.bind(_assertThisInitialized(_this3));
|
|
2213
|
-
_this3._popstateEventHandler = _this3._popstateEventHandler.bind(_assertThisInitialized(_this3));
|
|
2214
|
-
_this3._observer = new MutationObserver(_this3._init);
|
|
2215
|
-
_this3._updateHistory = true;
|
|
2216
|
-
return _this3;
|
|
2217
|
-
}
|
|
2218
|
-
|
|
2219
|
-
var _proto3 = PfeTabs.prototype;
|
|
2220
|
-
|
|
2221
|
-
_proto3.connectedCallback = function connectedCallback() {
|
|
2222
|
-
var _this4 = this;
|
|
2223
|
-
|
|
2224
|
-
Promise.all([customElements.whenDefined(PfeTab.tag), customElements.whenDefined(PfeTabPanel.tag)]).then(function () {
|
|
2225
|
-
_PFElement3.prototype.connectedCallback.call(_this4);
|
|
2226
|
-
|
|
2227
|
-
if (_this4.hasLightDOM()) _this4._init();
|
|
2228
|
-
|
|
2229
|
-
_this4._observer.observe(_this4, TABS_MUTATION_CONFIG);
|
|
2230
|
-
|
|
2231
|
-
_this4.addEventListener("keydown", _this4._onKeyDown);
|
|
2232
|
-
|
|
2233
|
-
_this4.addEventListener("click", _this4._onClick);
|
|
2234
|
-
});
|
|
2235
|
-
};
|
|
2236
|
-
|
|
2237
|
-
_proto3.disconnectedCallback = function disconnectedCallback() {
|
|
2238
|
-
var _this5 = this;
|
|
2239
|
-
|
|
2240
|
-
_PFElement3.prototype.disconnectedCallback.call(this);
|
|
2241
|
-
|
|
2242
|
-
this.removeEventListener("keydown", this._onKeyDown);
|
|
2243
|
-
|
|
2244
|
-
this._allTabs().forEach(function (tab) {
|
|
2245
|
-
return tab.removeEventListener("click", _this5._onClick);
|
|
2246
|
-
});
|
|
2247
|
-
|
|
2248
|
-
this._observer.disconnect();
|
|
2249
|
-
|
|
2250
|
-
if (this.tabHistory) window.removeEventListener("popstate", this._popstateEventHandler);
|
|
2251
|
-
};
|
|
2252
|
-
|
|
2253
|
-
_proto3._verticalHandler = function _verticalHandler() {
|
|
2254
|
-
if (this.vertical) this.orientation = "vertical";else this.orientation = "horizontal";
|
|
2255
|
-
};
|
|
2256
|
-
|
|
2257
|
-
_proto3._selectedIndexHandler = function _selectedIndexHandler(oldVal, newVal) {
|
|
2258
|
-
var _this6 = this;
|
|
2259
|
-
|
|
2260
|
-
// Wait until the tab and panels are loaded
|
|
2261
|
-
Promise.all([customElements.whenDefined(PfeTab.tag), customElements.whenDefined(PfeTabPanel.tag)]).then(function () {
|
|
2262
|
-
_this6._linkPanels();
|
|
2263
|
-
|
|
2264
|
-
_this6.selectIndex(newVal);
|
|
2265
|
-
|
|
2266
|
-
_this6._updateHistory = true;
|
|
2267
|
-
});
|
|
2268
|
-
};
|
|
2269
|
-
|
|
2270
|
-
_proto3._tabHistoryHandler = function _tabHistoryHandler() {
|
|
2271
|
-
if (!this.tabHistory) window.removeEventListener("popstate", this._popstateEventHandler);else window.addEventListener("popstate", this._popstateEventHandler);
|
|
2272
|
-
};
|
|
2273
|
-
|
|
2274
|
-
_proto3._oldPfeIdChanged = function _oldPfeIdChanged(oldVal, newVal) {
|
|
2275
|
-
if (!this.id && newVal) this.id = newVal;
|
|
2276
|
-
};
|
|
2277
|
-
|
|
2278
|
-
_proto3.select = function select(newTab) {
|
|
2279
|
-
if (!newTab) return;
|
|
2280
|
-
|
|
2281
|
-
if (newTab.tagName.toLowerCase() !== PfeTab.tag) {
|
|
2282
|
-
this.warn("the tab must be a " + PfeTab.tag + " element");
|
|
2283
|
-
return;
|
|
2284
|
-
}
|
|
2285
|
-
|
|
2286
|
-
this.selectedIndex = this._getTabIndex(newTab);
|
|
2287
|
-
};
|
|
2288
|
-
|
|
2289
|
-
_proto3.selectIndex = function selectIndex(_index) {
|
|
2290
|
-
if (_index === undefined || _index === null) return;
|
|
2291
|
-
var index = parseInt(_index, 10);
|
|
2292
|
-
|
|
2293
|
-
var tabs = this._allTabs();
|
|
2294
|
-
|
|
2295
|
-
var tab = tabs[index];
|
|
2296
|
-
|
|
2297
|
-
if (tabs.length > 0 && !tab) {
|
|
2298
|
-
this.warn("tab " + _index + " does not exist");
|
|
2299
|
-
return;
|
|
2300
|
-
} else if (!tabs && !tab) {
|
|
2301
|
-
// Wait for upgrade?
|
|
2302
|
-
return;
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2305
|
-
if (this.selected && this.tabHistory && this._updateHistory && CAN_USE_URLSEARCHPARAMS) {
|
|
2306
|
-
// @IE11 doesn't support URLSearchParams
|
|
2307
|
-
// https://caniuse.com/#search=urlsearchparams
|
|
2308
|
-
// rebuild the url
|
|
2309
|
-
var pathname = window.location.pathname;
|
|
2310
|
-
var urlParams = new URLSearchParams(window.location.search);
|
|
2311
|
-
var hash = window.location.hash;
|
|
2312
|
-
urlParams.set(this.id, tab.id);
|
|
2313
|
-
history.pushState({}, "", pathname + "?" + urlParams.toString() + hash);
|
|
2314
|
-
}
|
|
2315
|
-
|
|
2316
|
-
this._selectTab(tab);
|
|
2317
|
-
|
|
2318
|
-
return tab;
|
|
2319
|
-
};
|
|
2320
|
-
|
|
2321
|
-
_proto3._init = function _init() {
|
|
2322
|
-
var tabIndexFromURL = this._getTabIndexFromURL();
|
|
2323
|
-
|
|
2324
|
-
this._linked = false;
|
|
2325
|
-
|
|
2326
|
-
this._linkPanels(); // Force role to be set to tablist
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
if (window.ShadyCSS) this._observer.disconnect();
|
|
2330
|
-
this.role = "tablist";
|
|
2331
|
-
|
|
2332
|
-
if (tabIndexFromURL > -1) {
|
|
2333
|
-
this._setFocus = true;
|
|
2334
|
-
this.selectedIndex = tabIndexFromURL;
|
|
2335
|
-
}
|
|
2336
|
-
|
|
2337
|
-
if (this.selectedIndex === null) this.selectedIndex = 0;
|
|
2338
|
-
if (window.ShadyCSS) this._observer.observe(this, TABS_MUTATION_CONFIG);
|
|
2339
|
-
};
|
|
2340
|
-
|
|
2341
|
-
_proto3._linkPanels = function _linkPanels() {
|
|
2342
|
-
var _this7 = this;
|
|
2343
|
-
|
|
2344
|
-
if (this._linked) return;
|
|
2345
|
-
if (window.ShadyCSS) this._observer.disconnect();
|
|
2346
|
-
|
|
2347
|
-
this._allTabs().forEach(function (tab) {
|
|
2348
|
-
var panel = tab.nextElementSibling;
|
|
2349
|
-
|
|
2350
|
-
if (panel.tagName.toLowerCase() !== PfeTabPanel.tag) {
|
|
2351
|
-
_this7.warn("not a sibling of a <" + PfeTabPanel.tag + ">");
|
|
2352
|
-
|
|
2353
|
-
return;
|
|
2354
|
-
} // Connect the 2 items via appropriate aria attributes
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
tab.controls = panel.id;
|
|
2358
|
-
panel.labelledby = tab.id;
|
|
2359
|
-
tab.addEventListener("click", _this7._onClick);
|
|
2360
|
-
});
|
|
2361
|
-
|
|
2362
|
-
this._linked = true;
|
|
2363
|
-
if (window.ShadyCSS) this._observer.observe(this, TABS_MUTATION_CONFIG);
|
|
2364
|
-
};
|
|
2365
|
-
|
|
2366
|
-
_proto3._allPanels = function _allPanels() {
|
|
2367
|
-
return [].concat(this.children).filter(function (child) {
|
|
2368
|
-
return child.matches(PfeTabPanel.tag);
|
|
2369
|
-
});
|
|
2370
|
-
};
|
|
2371
|
-
|
|
2372
|
-
_proto3._allTabs = function _allTabs() {
|
|
2373
|
-
return [].concat(this.children).filter(function (child) {
|
|
2374
|
-
return child.matches(PfeTab.tag);
|
|
2375
|
-
});
|
|
2376
|
-
};
|
|
2377
|
-
|
|
2378
|
-
_proto3._panelForTab = function _panelForTab(tab) {
|
|
2379
|
-
if (!tab || !tab.controls) return;
|
|
2380
|
-
return this.querySelector("#" + tab.controls);
|
|
2381
|
-
};
|
|
2382
|
-
|
|
2383
|
-
_proto3._prevTab = function _prevTab() {
|
|
2384
|
-
var tabs = this._allTabs();
|
|
2385
|
-
|
|
2386
|
-
var newIdx = tabs.findIndex(function (tab) {
|
|
2387
|
-
return tab.selected === "true";
|
|
2388
|
-
}) - 1;
|
|
2389
|
-
return tabs[(newIdx + tabs.length) % tabs.length];
|
|
2390
|
-
};
|
|
2391
|
-
|
|
2392
|
-
_proto3._firstTab = function _firstTab() {
|
|
2393
|
-
var tabs = this._allTabs();
|
|
2394
|
-
|
|
2395
|
-
return tabs[0];
|
|
2396
|
-
};
|
|
2397
|
-
|
|
2398
|
-
_proto3._lastTab = function _lastTab() {
|
|
2399
|
-
var tabs = this._allTabs();
|
|
2400
|
-
|
|
2401
|
-
return tabs[tabs.length - 1];
|
|
2402
|
-
};
|
|
2403
|
-
|
|
2404
|
-
_proto3._nextTab = function _nextTab() {
|
|
2405
|
-
var tabs = this._allTabs();
|
|
2406
|
-
|
|
2407
|
-
var newIdx = tabs.findIndex(function (tab) {
|
|
2408
|
-
return tab.selected === "true";
|
|
2409
|
-
}) + 1;
|
|
2410
|
-
return tabs[newIdx % tabs.length];
|
|
2411
|
-
};
|
|
2412
|
-
|
|
2413
|
-
_proto3._getTabIndex = function _getTabIndex(_tab) {
|
|
2414
|
-
if (_tab) {
|
|
2415
|
-
var tabs = this._allTabs();
|
|
2416
|
-
|
|
2417
|
-
return tabs.findIndex(function (tab) {
|
|
2418
|
-
return tab.id === _tab.id;
|
|
2419
|
-
});
|
|
2420
|
-
} else {
|
|
2421
|
-
this.warn("No tab was provided to _getTabIndex; required to return the index value.");
|
|
2422
|
-
return 0;
|
|
2423
|
-
}
|
|
2424
|
-
};
|
|
2425
|
-
|
|
2426
|
-
_proto3.reset = function reset() {
|
|
2427
|
-
var tabs = this._allTabs();
|
|
2428
|
-
|
|
2429
|
-
var panels = this._allPanels();
|
|
2430
|
-
|
|
2431
|
-
tabs.forEach(function (tab) {
|
|
2432
|
-
return tab.selected = "false";
|
|
2433
|
-
});
|
|
2434
|
-
panels.forEach(function (panel) {
|
|
2435
|
-
return panel.hidden = true;
|
|
2436
|
-
});
|
|
2437
|
-
};
|
|
2438
|
-
|
|
2439
|
-
_proto3._selectTab = function _selectTab(newTab) {
|
|
2440
|
-
if (!newTab) return;
|
|
2441
|
-
this.reset();
|
|
2442
|
-
|
|
2443
|
-
var newPanel = this._panelForTab(newTab);
|
|
2444
|
-
|
|
2445
|
-
var newTabSelected = false;
|
|
2446
|
-
if (!newPanel) this.warn("No panel was found for the selected tab" + (newTab.id ? ": pfe-tab#" + newTab.id : "")); // this.selected on tabs contains a pointer to the selected tab element
|
|
2447
|
-
|
|
2448
|
-
if (this.selected && this.selected !== newTab) {
|
|
2449
|
-
newTabSelected = true;
|
|
2450
|
-
this.emitEvent(PfeTabs.events.hiddenTab, {
|
|
2451
|
-
detail: {
|
|
2452
|
-
tab: this.selected
|
|
2453
|
-
}
|
|
2454
|
-
});
|
|
2455
|
-
}
|
|
2456
|
-
|
|
2457
|
-
newTab.selected = "true";
|
|
2458
|
-
newPanel.hidden = false; // Update the value of the selected pointer to the new tab
|
|
2459
|
-
|
|
2460
|
-
this.selected = newTab;
|
|
2461
|
-
|
|
2462
|
-
if (newTabSelected) {
|
|
2463
|
-
if (this._setFocus) newTab.focus();
|
|
2464
|
-
this.emitEvent(PfeTabs.events.shownTab, {
|
|
2465
|
-
detail: {
|
|
2466
|
-
tab: this.selected
|
|
2467
|
-
}
|
|
2468
|
-
});
|
|
2469
|
-
}
|
|
2470
|
-
|
|
2471
|
-
this._setFocus = false;
|
|
2472
|
-
};
|
|
2473
|
-
|
|
2474
|
-
_proto3._onKeyDown = function _onKeyDown(event) {
|
|
2475
|
-
var tabs = this._allTabs();
|
|
2476
|
-
|
|
2477
|
-
var foundTab = tabs.find(function (tab) {
|
|
2478
|
-
return tab === event.target;
|
|
2479
|
-
});
|
|
2480
|
-
|
|
2481
|
-
if (!foundTab) {
|
|
2482
|
-
return;
|
|
2483
|
-
}
|
|
2484
|
-
|
|
2485
|
-
if (event.altKey) {
|
|
2486
|
-
return;
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
var newTab;
|
|
2490
|
-
|
|
2491
|
-
switch (event.keyCode) {
|
|
2492
|
-
case KEYCODE.LEFT:
|
|
2493
|
-
case KEYCODE.UP:
|
|
2494
|
-
newTab = this._prevTab();
|
|
2495
|
-
break;
|
|
2496
|
-
|
|
2497
|
-
case KEYCODE.RIGHT:
|
|
2498
|
-
case KEYCODE.DOWN:
|
|
2499
|
-
newTab = this._nextTab();
|
|
2500
|
-
break;
|
|
2501
|
-
|
|
2502
|
-
case KEYCODE.HOME:
|
|
2503
|
-
newTab = this._firstTab();
|
|
2504
|
-
break;
|
|
2505
|
-
|
|
2506
|
-
case KEYCODE.END:
|
|
2507
|
-
newTab = this._lastTab();
|
|
2508
|
-
break;
|
|
2509
|
-
|
|
2510
|
-
default:
|
|
2511
|
-
return;
|
|
2512
|
-
}
|
|
2513
|
-
|
|
2514
|
-
event.preventDefault();
|
|
2515
|
-
|
|
2516
|
-
if (newTab) {
|
|
2517
|
-
this.selectedIndex = this._getTabIndex(newTab);
|
|
2518
|
-
this._setFocus = true;
|
|
2519
|
-
} else {
|
|
2520
|
-
this.warn("No new tab could be found.");
|
|
2521
|
-
}
|
|
2522
|
-
};
|
|
2523
|
-
|
|
2524
|
-
_proto3._onClick = function _onClick(event) {
|
|
2525
|
-
// Find the clicked tab
|
|
2526
|
-
var foundTab = this._allTabs().find(function (tab) {
|
|
2527
|
-
return tab === event.currentTarget;
|
|
2528
|
-
}); // If the tab wasn't found in the markup, exit the handler
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
if (!foundTab) return; // Update the selected index to the clicked tab
|
|
2532
|
-
|
|
2533
|
-
this.selectedIndex = this._getTabIndex(event.currentTarget);
|
|
2534
|
-
};
|
|
2535
|
-
|
|
2536
|
-
_proto3._getTabIndexFromURL = function _getTabIndexFromURL() {
|
|
2537
|
-
var urlParams; // @IE11 doesn't support URLSearchParams
|
|
2538
|
-
// https://caniuse.com/#search=urlsearchparams
|
|
2539
|
-
// @Deprecated in 1.0
|
|
2540
|
-
// the "pfe-" prefix has been deprecated but we'll continue to support it
|
|
2541
|
-
// we'll give priority to the urlParams.has(`${this.id}`) attribute first
|
|
2542
|
-
// and fallback to urlParams.has(`pfe-${this.id}`) if it exists. We should
|
|
2543
|
-
// be able to remove the || part of the if statement in the future
|
|
2544
|
-
|
|
2545
|
-
if (CAN_USE_URLSEARCHPARAMS) {
|
|
2546
|
-
urlParams = new URLSearchParams(window.location.search);
|
|
2547
|
-
var tabsetInUrl = urlParams.has("" + this.id) || urlParams.has("pfe-" + this.id); // remove this condition when it's no longer used in production
|
|
2548
|
-
|
|
2549
|
-
if (urlParams && tabsetInUrl) {
|
|
2550
|
-
var id = urlParams.get("" + this.id) || urlParams.get("pfe-" + this.id); // remove this condition when it's no longer used in production
|
|
2551
|
-
|
|
2552
|
-
return this._allTabs().findIndex(function (tab) {
|
|
2553
|
-
return tab.id === id;
|
|
2554
|
-
});
|
|
2555
|
-
}
|
|
2556
|
-
}
|
|
2557
|
-
|
|
2558
|
-
return -1;
|
|
2559
|
-
};
|
|
2560
|
-
|
|
2561
|
-
_proto3._popstateEventHandler = function _popstateEventHandler() {
|
|
2562
|
-
var tabIndexFromURL = this._getTabIndexFromURL();
|
|
2563
|
-
|
|
2564
|
-
this._updateHistory = false;
|
|
2565
|
-
if (tabIndexFromURL > -1) this.selectedIndex = tabIndexFromURL;
|
|
2566
|
-
};
|
|
2567
|
-
|
|
2568
|
-
_createClass(PfeTabs, [{
|
|
2569
|
-
key: "html",
|
|
2570
|
-
get: // Injected at build-time
|
|
2571
|
-
function get() {
|
|
2572
|
-
return "\n<style>@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host{color:#151515!important}}:host{display:block;display:var(--pfe-tabs--Display,block);padding:0;padding:var(--pfe-tabs--Padding,0)}:host .tabs{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;flex-direction:var(--pfe-tabs__tabs--FlexDirection,row);width:auto;width:var(--pfe-tabs__tabs--Width,auto);border-top:0;border-top:var(--pfe-tabs__tabs--BorderTop,0);border-right:0;border-right:var(--pfe-tabs__tabs--BorderRight,0);border-bottom:1px solid #d2d2d2;border-bottom:var(--pfe-tabs__tabs--BorderBottom,var(--pfe-theme--ui--border-width,1px) var(--pfe-theme--ui--border-style,solid) var(--pfe-tabs__tabs--BorderColor,var(--pfe-theme--color--surface--border,#d2d2d2)));border-left:0;border-left:var(--pfe-tabs__tabs--BorderLeft,0);padding:0;padding:var(--pfe-tabs__tabs--Padding,0)}:host .panels{width:auto;width:var(--pfe-tabs__panels--Width,auto)}:host(:not([vertical])[tab-align=center]) .tabs{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}@media screen and (min-width:768px){:host([vertical]){--pfe-tabs--Display:flex;--pfe-tabs__tabs--FlexDirection:column;--pfe-tabs__tabs--Width:20%;--pfe-tabs__tabs--BorderRight:var(--pfe-theme--ui--border-width, 1px) var(--pfe-theme--ui--border-style, solid) var(--pfe-tabs--BorderColor);--pfe-tabs__tabs--BorderBottom:0;--pfe-tabs__panels--Width:80%;--pfe-tabs__panels--PaddingRight:var(--pfe-theme--container-padding, 1rem)}}@media screen and (min-width:768px) and (-ms-high-contrast:active),screen and (min-width:768px) and (-ms-high-contrast:none){:host([vertical]){display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}:host([vertical]) .tabs{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;width:22.22%;border-right:1px solid #d2d2d2;border-right:1px solid var(--pfe-theme--color--surface--border,#d2d2d2);border-bottom:0}:host([vertical]) .panels{width:77.8%;padding-right:1em}}@media screen and (min-width:768px) and (-ms-high-contrast:active),screen and (min-width:768px) and (-ms-high-contrast:none){:host([vertical][variant=earth]) .tabs{padding:1em 0 0 0}}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host(:not([variant=earth])){background-color:#fff;background-color:var(--pfe-theme--color--surface--lightest,#fff);color:#151515;color:var(--pfe-theme--color--text,#151515)}}:host([variant=earth]){--pfe-tabs__tabs--PaddingLeft:var(--pfe-theme--container-padding, 1rem)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([variant=earth]) .tabs{padding-left:1em}}:host([on=dark]){--pfe-broadcasted--text:var(--pfe-theme--color--text--on-dark, #fff);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted--on-dark, #d2d2d2);--pfe-broadcasted--link:var(--pfe-theme--color--link--on-dark, #73bcf7);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover--on-dark, #bee1f4);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus--on-dark, #bee1f4);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited--on-dark, #bee1f4);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration--on-dark, none);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover--on-dark, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus--on-dark, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited--on-dark, none)}:host([on=saturated]){--pfe-broadcasted--text:var(--pfe-theme--color--text--on-saturated, #fff);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted--on-saturated, #d2d2d2);--pfe-broadcasted--link:var(--pfe-theme--color--link--on-saturated, #fff);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover--on-saturated, #fafafa);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus--on-saturated, #fafafa);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited--on-saturated, #d2d2d2);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration--on-saturated, underline);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover--on-saturated, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus--on-saturated, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited--on-saturated, underline)}:host([on=light]){--pfe-broadcasted--text:var(--pfe-theme--color--text, #151515);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted, #6a6e73);--pfe-broadcasted--link:var(--pfe-theme--color--link, #06c);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover, #004080);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus, #004080);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited, #6753ac);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration, none);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited, none)}:host([vertical]) .tabs-prefix,:host([vertical]) .tabs-suffix{left:0;top:0;content:\" \";height:calc(1rem * 2);height:calc(var(--pfe-theme--container-padding,1rem) * 2);width:1px;position:relative}@media screen and (min-width:768px){:host([vertical]:not([variant=earth])) .tabs-prefix,:host([vertical]:not([variant=earth])) .tabs-suffix{background-color:#d2d2d2;background-color:var(--pfe-tabs__tabs--BorderColor,var(--pfe-theme--color--surface--border,#d2d2d2))}}:host(:not([vertical])[variant=earth]) .tabs-prefix{left:0;top:0;content:\" \";height:1px;width:1rem;width:var(--pfe-theme--container-padding,1rem);position:relative}@media screen and (min-width:768px){:host(:not([vertical])[variant=earth]) .tabs-prefix{width:calc(1rem * 2);width:calc(var(--pfe-theme--container-padding,1rem) * 2)}}:host([hidden]){display:none} /*# sourceMappingURL=pfe-tabs.min.css.map */</style>\n<div class=\"tabs\">\n <div class=\"tabs-prefix\"></div>\n <slot name=\"tab\"></slot>\n <div class=\"tabs-suffix\"></div>\n</div>\n<div class=\"panels\">\n <slot name=\"panel\"></slot>\n</div>";
|
|
2573
|
-
}
|
|
2574
|
-
}, {
|
|
2575
|
-
key: "styleUrl",
|
|
2576
|
-
get: function get() {
|
|
2577
|
-
return "pfe-tabs.scss";
|
|
2578
|
-
}
|
|
2579
|
-
}, {
|
|
2580
|
-
key: "templateUrl",
|
|
2581
|
-
get: function get() {
|
|
2582
|
-
return "pfe-tabs.html";
|
|
2583
|
-
} // Each set contains a header and a panel
|
|
2584
|
-
|
|
2585
|
-
}], [{
|
|
2586
|
-
key: "version",
|
|
2587
|
-
get: // Injected at build-time
|
|
2588
|
-
function get() {
|
|
2589
|
-
return "1.12.3";
|
|
2590
|
-
}
|
|
2591
|
-
}, {
|
|
2592
|
-
key: "tag",
|
|
2593
|
-
get: function get() {
|
|
2594
|
-
return "pfe-tabs";
|
|
2595
|
-
}
|
|
2596
|
-
}, {
|
|
2597
|
-
key: "meta",
|
|
2598
|
-
get: function get() {
|
|
2599
|
-
return {
|
|
2600
|
-
title: "Tabs",
|
|
2601
|
-
description: "This element creates a tabbed interface."
|
|
2602
|
-
};
|
|
2603
|
-
}
|
|
2604
|
-
}, {
|
|
2605
|
-
key: "contentTemplate",
|
|
2606
|
-
get: function get() {
|
|
2607
|
-
return "\n <pfe-tab content-type=\"header\" slot=\"tab\"></pfe-tab>\n <pfe-tab-panel content-type=\"panel\" slot=\"panel\"></pfe-tab-panel>\n ";
|
|
2608
|
-
}
|
|
2609
|
-
}, {
|
|
2610
|
-
key: "properties",
|
|
2611
|
-
get: function get() {
|
|
2612
|
-
return {
|
|
2613
|
-
vertical: {
|
|
2614
|
-
title: "Vertical orientation",
|
|
2615
|
-
type: Boolean,
|
|
2616
|
-
"default": false,
|
|
2617
|
-
cascade: "pfe-tab,pfe-tab-panel",
|
|
2618
|
-
observer: "_verticalHandler"
|
|
2619
|
-
},
|
|
2620
|
-
orientation: {
|
|
2621
|
-
title: "Orientation",
|
|
2622
|
-
type: String,
|
|
2623
|
-
attr: "aria-orientation",
|
|
2624
|
-
"default": "horizontal",
|
|
2625
|
-
values: ["horizontal", "vertical"]
|
|
2626
|
-
},
|
|
2627
|
-
// Do not set a default of 0, it causes a the URL history to
|
|
2628
|
-
// be updated on load for every tab; infinite looping goodness
|
|
2629
|
-
// Seriously, don't set a default here unless you do a rewrite
|
|
2630
|
-
selectedIndex: {
|
|
2631
|
-
title: "Index of the selected tab",
|
|
2632
|
-
type: Number,
|
|
2633
|
-
observer: "_selectedIndexHandler"
|
|
2634
|
-
},
|
|
2635
|
-
tabAlign: {
|
|
2636
|
-
title: "Tab alignment",
|
|
2637
|
-
type: String,
|
|
2638
|
-
"enum": ["center"]
|
|
2639
|
-
},
|
|
2640
|
-
controls: {
|
|
2641
|
-
type: String,
|
|
2642
|
-
attr: "aria-controls"
|
|
2643
|
-
},
|
|
2644
|
-
variant: {
|
|
2645
|
-
title: "Variant",
|
|
2646
|
-
type: String,
|
|
2647
|
-
"enum": ["wind", "earth"],
|
|
2648
|
-
"default": "wind",
|
|
2649
|
-
cascade: "pfe-tab,pfe-tab-panel"
|
|
2650
|
-
},
|
|
2651
|
-
tabHistory: {
|
|
2652
|
-
title: "Tab History",
|
|
2653
|
-
type: Boolean,
|
|
2654
|
-
"default": false,
|
|
2655
|
-
observer: "_tabHistoryHandler"
|
|
2656
|
-
},
|
|
2657
|
-
role: {
|
|
2658
|
-
type: String,
|
|
2659
|
-
"default": "tablist"
|
|
2660
|
-
},
|
|
2661
|
-
// @TODO: Deprecated for 1.0
|
|
2662
|
-
oldVariant: {
|
|
2663
|
-
type: String,
|
|
2664
|
-
attr: "pfe-variant",
|
|
2665
|
-
alias: "variant"
|
|
2666
|
-
},
|
|
2667
|
-
// @TODO: Deprecated for 1.0
|
|
2668
|
-
oldTabHistory: {
|
|
2669
|
-
type: Boolean,
|
|
2670
|
-
alias: "tabHistory",
|
|
2671
|
-
attr: "pfe-tab-history"
|
|
2672
|
-
},
|
|
2673
|
-
// @TODO: Deprecated for 1.0
|
|
2674
|
-
oldPfeId: {
|
|
2675
|
-
type: String,
|
|
2676
|
-
attr: "pfe-id",
|
|
2677
|
-
observer: "_oldPfeIdChanged"
|
|
2678
|
-
}
|
|
2679
|
-
};
|
|
2680
|
-
}
|
|
2681
|
-
}, {
|
|
2682
|
-
key: "slots",
|
|
2683
|
-
get: function get() {
|
|
2684
|
-
return {
|
|
2685
|
-
tab: {
|
|
2686
|
-
title: "Tab",
|
|
2687
|
-
type: "array",
|
|
2688
|
-
namedSlot: true,
|
|
2689
|
-
items: {
|
|
2690
|
-
$ref: "pfe-tab"
|
|
2691
|
-
}
|
|
2692
|
-
},
|
|
2693
|
-
panel: {
|
|
2694
|
-
title: "Panel",
|
|
2695
|
-
type: "array",
|
|
2696
|
-
namedSlot: true,
|
|
2697
|
-
items: {
|
|
2698
|
-
$ref: "pfe-tab-panel"
|
|
2699
|
-
}
|
|
2700
|
-
}
|
|
2701
|
-
};
|
|
2702
|
-
}
|
|
2703
|
-
}, {
|
|
2704
|
-
key: "events",
|
|
2705
|
-
get: function get() {
|
|
2706
|
-
return {
|
|
2707
|
-
hiddenTab: this.tag + ":hidden-tab",
|
|
2708
|
-
shownTab: this.tag + ":shown-tab"
|
|
2709
|
-
};
|
|
2710
|
-
} // Declare the type of this component
|
|
2711
|
-
|
|
2712
|
-
}, {
|
|
2713
|
-
key: "PfeType",
|
|
2714
|
-
get: function get() {
|
|
2715
|
-
return PFElement.PfeTypes.Combo;
|
|
2716
|
-
}
|
|
2717
|
-
}]);
|
|
2718
|
-
|
|
2719
|
-
return PfeTabs;
|
|
2720
|
-
}(PFElement);
|
|
2721
|
-
|
|
2722
|
-
PFElement.create(PfeTab);
|
|
2723
|
-
PFElement.create(PfeTabPanel);
|
|
2724
|
-
PFElement.create(PfeTabs);
|
|
2725
|
-
|
|
2726
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
|
|
2727
|
-
|
|
2728
|
-
(function () {
|
|
2729
|
-
if (typeof window.CustomEvent === "function") return false;
|
|
2730
|
-
|
|
2731
|
-
function CustomEvent(event, params) {
|
|
2732
|
-
params = params || {
|
|
2733
|
-
bubbles: false,
|
|
2734
|
-
cancelable: false,
|
|
2735
|
-
detail: null
|
|
2736
|
-
};
|
|
2737
|
-
var evt = document.createEvent("CustomEvent");
|
|
2738
|
-
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
|
2739
|
-
return evt;
|
|
2740
|
-
}
|
|
2741
|
-
|
|
2742
|
-
window.CustomEvent = CustomEvent;
|
|
2743
|
-
})();
|
|
2744
|
-
|
|
2745
|
-
var PfeIconSet = /*#__PURE__*/function () {
|
|
2746
|
-
var _proto = PfeIconSet.prototype;
|
|
2747
|
-
|
|
2748
|
-
/**
|
|
2749
|
-
* Run the icon set's name resolver to turn an icon name into an icon path, id, etc.
|
|
2750
|
-
*/
|
|
2751
|
-
_proto.resolveIconName = function resolveIconName(iconName) {
|
|
2752
|
-
return this._resolveIconName(iconName, this.name, this.path);
|
|
2753
|
-
}
|
|
2754
|
-
/**
|
|
2755
|
-
* Create a new icon set. Icon sets have a name (ie, a namespace). For
|
|
2756
|
-
* example, an icon with a name of "rh-logo" represents a "logo" icon from the
|
|
2757
|
-
* "rh" set. Icon set names are always separated from the rest of the icon
|
|
2758
|
-
* name with a hyphen `-`. This means that set names cannot contain a hyphen.
|
|
2759
|
-
*
|
|
2760
|
-
* @param {String} name the namespace of the icon set
|
|
2761
|
-
* @param {String} path the web-accessible path to the icon set (for instance, a CDN)
|
|
2762
|
-
* @param {Function} resolveIconName an optional function to combine the path and an icon name into a final path. The function will be passed the namespaced icon name (for example, "rh-api" where rh is the namespace and api is the individual icon's name)
|
|
2763
|
-
* @returns {Object} an object with the status of the icon set installation, such as `{ result: true, text: 'icon set installed' }` or `{ result: false, text: 'icon set is already installed' }`
|
|
2764
|
-
*/
|
|
2765
|
-
;
|
|
2766
|
-
|
|
2767
|
-
function PfeIconSet(name, path, resolveIconName) {
|
|
2768
|
-
this.name = name;
|
|
2769
|
-
this.path = path;
|
|
2770
|
-
this._resolveIconName = resolveIconName;
|
|
2771
|
-
}
|
|
2772
|
-
|
|
2773
|
-
return PfeIconSet;
|
|
2774
|
-
}();
|
|
2775
|
-
/**
|
|
2776
|
-
* An 'init' function to add the PFE built-in icon sets to the current page.
|
|
2777
|
-
*/
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
function addBuiltIns(_ref) {
|
|
2781
|
-
var PfeIcon = _ref.PfeIcon,
|
|
2782
|
-
config = _ref.config;
|
|
2783
|
-
|
|
2784
|
-
// If the user wants to completely opt out of default icon sets,
|
|
2785
|
-
// allow them to.
|
|
2786
|
-
if (config.IconSets && config.IconSets.length === 0) {
|
|
2787
|
-
return;
|
|
2788
|
-
} // If the user provides their own icon sets, use them. If not, use our defaults.
|
|
2789
|
-
// @TODO: Switch from access.redhat.com to another icon set.
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
var iconSets = config.IconSets || [{
|
|
2793
|
-
name: "web",
|
|
2794
|
-
path: "https://access.redhat.com/webassets/avalon/j/lib/rh-iconfont-svgs"
|
|
2795
|
-
}, {
|
|
2796
|
-
name: "rh",
|
|
2797
|
-
path: "https://access.redhat.com/webassets/avalon/j/lib/rh-iconfont-svgs"
|
|
2798
|
-
}];
|
|
2799
|
-
|
|
2800
|
-
var resolveDefaultIconName = function resolveDefaultIconName(name, iconSetName, iconSetPath) {
|
|
2801
|
-
var regex = new RegExp("^" + iconSetName + "(-icon)?-(.*)");
|
|
2802
|
-
|
|
2803
|
-
var _regex$exec = regex.exec(name),
|
|
2804
|
-
iconName = _regex$exec[2];
|
|
2805
|
-
|
|
2806
|
-
var iconId = iconSetName + "-icon-" + iconName;
|
|
2807
|
-
var iconPath = iconSetPath + "/" + iconId + ".svg";
|
|
2808
|
-
return iconPath;
|
|
2809
|
-
}; // Register the icon sets.
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
iconSets.forEach(function (set) {
|
|
2813
|
-
// If there's a `resolveIconName` function provided, use it. If not, fall back
|
|
2814
|
-
// to the `resolveDefaultIconName` function.
|
|
2815
|
-
if (set.resolveIconName && typeof set.resolveIconName === "function") {
|
|
2816
|
-
resolveDefaultIconName = set.resolveIconName;
|
|
2817
|
-
}
|
|
2818
|
-
|
|
2819
|
-
PfeIcon.addIconSet(set.name, set.path, resolveDefaultIconName);
|
|
2820
|
-
});
|
|
2821
|
-
}
|
|
2822
|
-
/*!
|
|
2823
|
-
* PatternFly Elements: PfeIcon 1.12.3
|
|
2824
|
-
* @license
|
|
2825
|
-
* Copyright 2021 Red Hat, Inc.
|
|
2826
|
-
*
|
|
2827
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2828
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
2829
|
-
* in the Software without restriction, including without limitation the rights
|
|
2830
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2831
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
2832
|
-
* furnished to do so, subject to the following conditions:
|
|
2833
|
-
*
|
|
2834
|
-
* The above copyright notice and this permission notice shall be included in
|
|
2835
|
-
* all copies or substantial portions of the Software.
|
|
2836
|
-
*
|
|
2837
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2838
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2839
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2840
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2841
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2842
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
2843
|
-
* SOFTWARE.
|
|
2844
|
-
*
|
|
2845
|
-
*/
|
|
2846
|
-
|
|
2847
|
-
/**
|
|
2848
|
-
* Sets the id attribute on the <filter> element and points the CSS `filter` at that id.
|
|
2849
|
-
*/
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
function _setRandomFilterId(el) {
|
|
2853
|
-
var randomId = "filter-" + Math.random().toString().slice(2, 10); // set the CSS filter property to point at the given id
|
|
2854
|
-
|
|
2855
|
-
el.shadowRoot.querySelector("svg image").style.filter = "url(#" + randomId + ")"; // set the id attribute on the SVG filter element to match
|
|
2856
|
-
|
|
2857
|
-
el.shadowRoot.querySelector("svg filter").setAttribute("id", randomId);
|
|
2858
|
-
}
|
|
2859
|
-
|
|
2860
|
-
var PfeIcon = /*#__PURE__*/function (_PFElement) {
|
|
2861
|
-
_inheritsLoose(PfeIcon, _PFElement);
|
|
2862
|
-
|
|
2863
|
-
var _proto2 = PfeIcon.prototype;
|
|
2864
|
-
|
|
2865
|
-
_proto2._iconLoad = function _iconLoad() {
|
|
2866
|
-
this.classList.remove("load-failed");
|
|
2867
|
-
};
|
|
2868
|
-
|
|
2869
|
-
_proto2._iconLoadError = function _iconLoadError(e) {
|
|
2870
|
-
this.classList.add("load-failed");
|
|
2871
|
-
if (this.hasLightDOM()) this.classList.add("has-fallback");
|
|
2872
|
-
};
|
|
2873
|
-
|
|
2874
|
-
_proto2._colorChanged = function _colorChanged() {
|
|
2875
|
-
// Update the context
|
|
2876
|
-
this.resetContext();
|
|
2877
|
-
};
|
|
2878
|
-
|
|
2879
|
-
function PfeIcon() {
|
|
2880
|
-
var _this;
|
|
2881
|
-
|
|
2882
|
-
_this = _PFElement.call(this, PfeIcon, {
|
|
2883
|
-
type: PfeIcon.PfeType
|
|
2884
|
-
}) || this;
|
|
2885
|
-
_this._iconLoad = _this._iconLoad.bind(_assertThisInitialized(_this));
|
|
2886
|
-
_this._iconLoadError = _this._iconLoadError.bind(_assertThisInitialized(_this));
|
|
2887
|
-
_this.image = _this.shadowRoot.querySelector("svg image");
|
|
2888
|
-
|
|
2889
|
-
if (_this.image) {
|
|
2890
|
-
_this.image.addEventListener("load", _this._iconLoad);
|
|
2891
|
-
|
|
2892
|
-
_this.image.addEventListener("error", _this._iconLoadError);
|
|
2893
|
-
} // Attach a listener for the registration of an icon set
|
|
2894
|
-
// Leaving this attached allows for the registered set to be updated
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
document.body.addEventListener(PfeIcon.EVENTS.ADD_ICON_SET, function () {
|
|
2898
|
-
return _this.updateIcon();
|
|
2899
|
-
});
|
|
2900
|
-
return _this;
|
|
2901
|
-
}
|
|
2902
|
-
|
|
2903
|
-
_proto2.disconnectedCallback = function disconnectedCallback() {
|
|
2904
|
-
_PFElement.prototype.disconnectedCallback.call(this);
|
|
2905
|
-
|
|
2906
|
-
if (this.image) {
|
|
2907
|
-
this.image.removeEventListener("load", this._iconLoad);
|
|
2908
|
-
this.image.removeEventListener("error", this._iconLoadError);
|
|
2909
|
-
}
|
|
2910
|
-
};
|
|
2911
|
-
|
|
2912
|
-
_proto2.updateIcon = function updateIcon() {
|
|
2913
|
-
var _PfeIcon$getIconSet = PfeIcon.getIconSet(this.icon),
|
|
2914
|
-
set = _PfeIcon$getIconSet.set;
|
|
2915
|
-
|
|
2916
|
-
if (set) {
|
|
2917
|
-
var iconPath = set.resolveIconName(this.icon);
|
|
2918
|
-
this.image.setAttribute("xlink:href", iconPath);
|
|
2919
|
-
|
|
2920
|
-
_setRandomFilterId(this);
|
|
2921
|
-
}
|
|
2922
|
-
}
|
|
2923
|
-
/**
|
|
2924
|
-
* Get an icon set by providing the set's name, _or_ the name of an icon from that set.
|
|
2925
|
-
*
|
|
2926
|
-
* @param {String} iconName the name of the set, or the name of an icon from that set.
|
|
2927
|
-
* @return {PfeIconSet} the icon set
|
|
2928
|
-
*/
|
|
2929
|
-
;
|
|
2930
|
-
|
|
2931
|
-
PfeIcon.getIconSet = function getIconSet(iconName) {
|
|
2932
|
-
var set;
|
|
2933
|
-
|
|
2934
|
-
if (iconName) {
|
|
2935
|
-
var _iconName$split = iconName.split("-"),
|
|
2936
|
-
setName = _iconName$split[0];
|
|
2937
|
-
|
|
2938
|
-
set = this._iconSets[setName];
|
|
2939
|
-
}
|
|
2940
|
-
|
|
2941
|
-
return {
|
|
2942
|
-
set: set
|
|
2943
|
-
};
|
|
2944
|
-
};
|
|
2945
|
-
|
|
2946
|
-
PfeIcon.addIconSet = function addIconSet(name, path, resolveIconName) {
|
|
2947
|
-
var resolveFunction;
|
|
2948
|
-
|
|
2949
|
-
if (typeof resolveIconName === "function") {
|
|
2950
|
-
resolveFunction = resolveIconName;
|
|
2951
|
-
} else if (typeof resolveIconName === "undefined" && this._iconSets[name] && typeof this._iconSets[name]._resolveIconName === "function") {
|
|
2952
|
-
resolveFunction = this._iconSets[name]._resolveIconName;
|
|
2953
|
-
} else if (typeof resolveIconName !== "function" && typeof resolveIconName !== "undefined") {
|
|
2954
|
-
PfeIcon.warn("[" + this.tag + "]: The third input to addIconSet should be a function that parses and returns the icon's filename.");
|
|
2955
|
-
} else {
|
|
2956
|
-
PfeIcon.warn("[" + this.tag + "]: The set " + name + " needs a resolve function for the icon names.");
|
|
2957
|
-
} // Register the icon set and set up the event indicating the change
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
this._iconSets[name] = new PfeIconSet(name, path, resolveFunction);
|
|
2961
|
-
document.body.dispatchEvent(new CustomEvent(this.EVENTS.ADD_ICON_SET, {
|
|
2962
|
-
bubbles: false,
|
|
2963
|
-
detail: {
|
|
2964
|
-
set: this._iconSets[name]
|
|
2965
|
-
}
|
|
2966
|
-
}));
|
|
2967
|
-
};
|
|
2968
|
-
|
|
2969
|
-
_createClass(PfeIcon, [{
|
|
2970
|
-
key: "html",
|
|
2971
|
-
get: // Injected at build-time
|
|
2972
|
-
function get() {
|
|
2973
|
-
return "\n<style>@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host{color:#151515!important}}:host([on=dark]){--pfe-broadcasted--text:var(--pfe-theme--color--text--on-dark, #fff);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted--on-dark, #d2d2d2);--pfe-broadcasted--link:var(--pfe-theme--color--link--on-dark, #73bcf7);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover--on-dark, #bee1f4);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus--on-dark, #bee1f4);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited--on-dark, #bee1f4);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration--on-dark, none);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover--on-dark, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus--on-dark, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited--on-dark, none)}:host([on=saturated]){--pfe-broadcasted--text:var(--pfe-theme--color--text--on-saturated, #fff);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted--on-saturated, #d2d2d2);--pfe-broadcasted--link:var(--pfe-theme--color--link--on-saturated, #fff);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover--on-saturated, #fafafa);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus--on-saturated, #fafafa);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited--on-saturated, #d2d2d2);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration--on-saturated, underline);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover--on-saturated, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus--on-saturated, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited--on-saturated, underline)}:host([on=light]){--pfe-broadcasted--text:var(--pfe-theme--color--text, #151515);--pfe-broadcasted--text--muted:var(--pfe-theme--color--text--muted, #6a6e73);--pfe-broadcasted--link:var(--pfe-theme--color--link, #06c);--pfe-broadcasted--link--hover:var(--pfe-theme--color--link--hover, #004080);--pfe-broadcasted--link--focus:var(--pfe-theme--color--link--focus, #004080);--pfe-broadcasted--link--visited:var(--pfe-theme--color--link--visited, #6753ac);--pfe-broadcasted--link-decoration:var(--pfe-theme--link-decoration, none);--pfe-broadcasted--link-decoration--hover:var(--pfe-theme--link-decoration--hover, underline);--pfe-broadcasted--link-decoration--focus:var(--pfe-theme--link-decoration--focus, underline);--pfe-broadcasted--link-decoration--visited:var(--pfe-theme--link-decoration--visited, none)}:host{--context:var(--pfe-icon--context, light);position:relative;display:inline-block;-webkit-box-sizing:content-box!important;box-sizing:content-box!important;width:-webkit-fit-content!important;width:-moz-fit-content!important;width:fit-content!important;height:-webkit-fit-content!important;height:-moz-fit-content!important;height:fit-content!important;line-height:0;max-width:1em;max-width:var(--pfe-icon--size,var(--pfe-theme--icon-size,1em));max-height:1em;max-height:var(--pfe-icon--size,var(--pfe-theme--icon-size,1em))}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host{width:1em!important;width:var(--pfe-theme--icon-size,1em)!important;height:1em!important;height:var(--pfe-theme--icon-size,1em)!important}}:host svg{width:1em;width:var(--pfe-icon--size,var(--pfe-theme--icon-size,1em));height:1em;height:var(--pfe-icon--size,var(--pfe-theme--icon-size,1em))}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host svg{width:1em!important;width:var(--pfe-theme--icon-size,1em)!important;height:1em!important;height:var(--pfe-theme--icon-size,1em)!important}}:host([block]){display:block;margin-bottom:1rem;margin-bottom:var(--pfe-icon--spacing,var(--pfe-theme--container-spacer,1rem));margin-top:1rem;margin-top:var(--pfe-icon--spacing,var(--pfe-theme--container-spacer,1rem))}:host([block]):first-child{margin-top:0}:host(:not(.load-failed)){vertical-align:middle;border-radius:50%;background-color:transparent;background-color:var(--pfe-icon--BackgroundColor,transparent);border:1px solid transparent;border:var(--pfe-icon--BorderWidth,var(--pfe-theme--ui--border-width,1px)) var(--pfe-theme--ui--border-style,solid) var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,transparent));padding:0;padding:var(--pfe-icon--Padding,0)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host(:not(.load-failed)){background-color:#fff!important}:host(:not(.load-failed)) svg filter feFlood{flood-color:#000!important}}@supports (-ms-accelerator:true){:host(:not(.load-failed)){background-color:#fff!important}:host(:not(.load-failed)) svg filter feFlood{flood-color:#000!important}}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host(:not(.load-failed)) svg image{-webkit-filter:none;filter:none}}:host(:not(.load-failed)) filter feFlood{flood-color:#3c3f42;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-broadcasted--text,#3c3f42)))}:host(:not(.load-failed)) .pfe-icon--fallback{display:none}:host([size=\"2x\"]){max-width:2em;max-width:var(--pfe-icon--size,2em);max-height:2em;max-height:var(--pfe-icon--size,2em)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=\"2x\"]){width:2em!important;height:2em!important}}:host([size=\"2x\"]) svg{width:2em;width:var(--pfe-icon--size,2em);height:2em;height:var(--pfe-icon--size,2em)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=\"2x\"]) svg{width:2em!important;height:2em!important}}:host([size=\"3x\"]){max-width:3em;max-width:var(--pfe-icon--size,3em);max-height:3em;max-height:var(--pfe-icon--size,3em)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=\"3x\"]){width:3em!important;height:3em!important}}:host([size=\"3x\"]) svg{width:3em;width:var(--pfe-icon--size,3em);height:3em;height:var(--pfe-icon--size,3em)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=\"3x\"]) svg{width:3em!important;height:3em!important}}:host([size=\"4x\"]){max-width:4em;max-width:var(--pfe-icon--size,4em);max-height:4em;max-height:var(--pfe-icon--size,4em)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=\"4x\"]){width:4em!important;height:4em!important}}:host([size=\"4x\"]) svg{width:4em;width:var(--pfe-icon--size,4em);height:4em;height:var(--pfe-icon--size,4em)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=\"4x\"]) svg{width:4em!important;height:4em!important}}:host([size=xl]){max-width:100px;max-width:var(--pfe-icon--size,100px);max-height:100px;max-height:var(--pfe-icon--size,100px)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=xl]){width:100px!important;height:100px!important}}:host([size=xl]) svg{width:100px;width:var(--pfe-icon--size,100px);height:100px;height:var(--pfe-icon--size,100px)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=xl]) svg{width:100px!important;height:100px!important}}:host([size=lg]){max-width:64px;max-width:var(--pfe-icon--size,64px);max-height:64px;max-height:var(--pfe-icon--size,64px)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=lg]){width:64px!important;height:64px!important}}:host([size=lg]) svg{width:64px;width:var(--pfe-icon--size,64px);height:64px;height:var(--pfe-icon--size,64px)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=lg]) svg{width:64px!important;height:64px!important}}:host([size=md]){max-width:32px;max-width:var(--pfe-icon--size,32px);max-height:32px;max-height:var(--pfe-icon--size,32px)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=md]){width:32px!important;height:32px!important}}:host([size=md]) svg{width:32px;width:var(--pfe-icon--size,32px);height:32px;height:var(--pfe-icon--size,32px)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=md]) svg{width:32px!important;height:32px!important}}:host([size=sm]){max-width:14px;max-width:var(--pfe-icon--size,14px);max-height:14px;max-height:var(--pfe-icon--size,14px)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=sm]){width:14px!important;height:14px!important}}:host([size=sm]) svg{width:14px;width:var(--pfe-icon--size,14px);height:14px;height:var(--pfe-icon--size,14px)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host([size=sm]) svg{width:14px!important;height:14px!important}}:host([circled]:not([circled=false])){padding:.5em;padding:var(--pfe-icon--Padding,.5em);background-color:#fff;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--lightest,#fff));border-color:#d2d2d2;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--border,#d2d2d2)))}:host([color=critical]:not([circled])) filter feFlood,:host([color=critical][circled=false]) filter feFlood{flood-color:#a30000;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--feedback--critical,#a30000)))}:host([color=critical][circled]:not([circled=false])){background-color:#a30000;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--critical,#a30000));border-color:#a30000;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--critical,#a30000)));--pfe-icon--context:dark}:host([color=important]:not([circled])) filter feFlood,:host([color=important][circled=false]) filter feFlood{flood-color:#c9190b;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--feedback--important,#c9190b)))}:host([color=important][circled]:not([circled=false])){background-color:#c9190b;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--important,#c9190b));border-color:#c9190b;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--important,#c9190b)));--pfe-icon--context:dark}:host([color=moderate]:not([circled])) filter feFlood,:host([color=moderate][circled=false]) filter feFlood{flood-color:#f0ab00;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--feedback--moderate,#f0ab00)))}:host([color=moderate][circled]:not([circled=false])){background-color:#f0ab00;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--moderate,#f0ab00));border-color:#f0ab00;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--moderate,#f0ab00)))}:host([color=success]:not([circled])) filter feFlood,:host([color=success][circled=false]) filter feFlood{flood-color:#3e8635;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--feedback--success,#3e8635)))}:host([color=success][circled]:not([circled=false])){background-color:#3e8635;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--success,#3e8635));border-color:#3e8635;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--success,#3e8635)));--pfe-icon--context:dark}:host([color=info]:not([circled])) filter feFlood,:host([color=info][circled=false]) filter feFlood{flood-color:#06c;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--feedback--info,#06c)))}:host([color=info][circled]:not([circled=false])){background-color:#06c;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--info,#06c));border-color:#06c;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--info,#06c)));--pfe-icon--context:dark}:host([color=default]:not([circled])) filter feFlood,:host([color=default][circled=false]) filter feFlood{flood-color:#4f5255;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--feedback--default,#4f5255)))}:host([color=default][circled]:not([circled=false])){background-color:#4f5255;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--default,#4f5255));border-color:#4f5255;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--feedback--default,#4f5255)));--pfe-icon--context:dark}:host([color=lightest]:not([circled])) filter feFlood,:host([color=lightest][circled=false]) filter feFlood{flood-color:#fff;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--surface--lightest,#fff)))}:host([color=lightest][circled]:not([circled=false])){--pfe-icon--context:var(--pfe-theme--color--surface--lightest--context, light);background-color:#fff;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--lightest,#fff));border-color:#fff;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--lightest,#fff)))}:host([color=base]:not([circled])) filter feFlood,:host([color=base][circled=false]) filter feFlood{flood-color:#f0f0f0;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--surface--base,#f0f0f0)))}:host([color=base][circled]:not([circled=false])){--pfe-icon--context:var(--pfe-theme--color--surface--base--context, light);background-color:#f0f0f0;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--base,#f0f0f0));border-color:#f0f0f0;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--base,#f0f0f0)))}:host([color=darker]:not([circled])) filter feFlood,:host([color=darker][circled=false]) filter feFlood{flood-color:#3c3f42;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--surface--darker,#3c3f42)))}:host([color=darker][circled]:not([circled=false])){--pfe-icon--context:var(--pfe-theme--color--surface--darker--context, dark);background-color:#3c3f42;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--darker,#3c3f42));border-color:#3c3f42;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--darker,#3c3f42)))}:host([color=darkest]:not([circled])) filter feFlood,:host([color=darkest][circled=false]) filter feFlood{flood-color:#151515;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--surface--darkest,#151515)))}:host([color=darkest][circled]:not([circled=false])){--pfe-icon--context:var(--pfe-theme--color--surface--darkest--context, dark);background-color:#151515;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--darkest,#151515));border-color:#151515;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--darkest,#151515)))}:host([color=complement]:not([circled])) filter feFlood,:host([color=complement][circled=false]) filter feFlood{flood-color:#002952;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--surface--complement,#002952)))}:host([color=complement][circled]:not([circled=false])){--pfe-icon--context:var(--pfe-theme--color--surface--complement--context, saturated);background-color:#002952;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--complement,#002952));border-color:#002952;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--complement,#002952)))}:host([color=accent]:not([circled])) filter feFlood,:host([color=accent][circled=false]) filter feFlood{flood-color:#004080;flood-color:var(--pfe-icon--color,var(--pfe-icon--Color,var(--pfe-theme--color--surface--accent,#004080)))}:host([color=accent][circled]:not([circled=false])){--pfe-icon--context:var(--pfe-theme--color--surface--accent--context, saturated);background-color:#004080;background-color:var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--accent,#004080));border-color:#004080;border-color:var(--pfe-icon--BorderColor,var(--pfe-icon--BackgroundColor,var(--pfe-theme--color--surface--accent,#004080)))}:host(.load-failed) svg image,:host(.load-failed.has-fallback) svg,:host(.load-failed[on-fail=collapse]) svg{display:none}:host(.load-failed[on-fail=collapse]){max-width:0;max-width:var(--pfe-icon--size,0);max-height:0;max-height:var(--pfe-icon--size,0)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host(.load-failed[on-fail=collapse]){width:0!important;height:0!important}}:host(.load-failed[on-fail=collapse]) svg{width:0;width:var(--pfe-icon--size,0);height:0;height:var(--pfe-icon--size,0)}@media screen and (-ms-high-contrast:active),screen and (-ms-high-contrast:none){:host(.load-failed[on-fail=collapse]) svg{width:0!important;height:0!important}} /*# sourceMappingURL=pfe-icon.min.css.map */</style>\n<div class=\"pfe-icon--fallback\">\n <slot></slot>\n</div>\n<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"20\" width=\"20\">\n <filter color-interpolation-filters=\"sRGB\" x=\"0\" y=\"0\" height=\"100%\" width=\"100%\">\n <feFlood result=\"COLOR\" />\n <feComposite operator=\"in\" in=\"COLOR\" in2=\"SourceAlpha\" />\n </filter>\n <image xlink:href=\"\" width=\"100%\" height=\"100%\"></image>\n</svg>";
|
|
2974
|
-
}
|
|
2975
|
-
}, {
|
|
2976
|
-
key: "templateUrl",
|
|
2977
|
-
get: function get() {
|
|
2978
|
-
return "pfe-icon.html";
|
|
2979
|
-
}
|
|
2980
|
-
}, {
|
|
2981
|
-
key: "styleUrl",
|
|
2982
|
-
get: function get() {
|
|
2983
|
-
return "pfe-icon.scss";
|
|
2984
|
-
}
|
|
2985
|
-
}, {
|
|
2986
|
-
key: "schemaUrl",
|
|
2987
|
-
get: function get() {
|
|
2988
|
-
return "pfe-icon.json";
|
|
2989
|
-
} // Declare the type of this component
|
|
2990
|
-
|
|
2991
|
-
}, {
|
|
2992
|
-
key: "upgraded",
|
|
2993
|
-
get: function get() {
|
|
2994
|
-
return this.image.hasAttribute("xlink:href");
|
|
2995
|
-
}
|
|
2996
|
-
}], [{
|
|
2997
|
-
key: "version",
|
|
2998
|
-
get: // Injected at build-time
|
|
2999
|
-
function get() {
|
|
3000
|
-
return "1.12.3";
|
|
3001
|
-
}
|
|
3002
|
-
}, {
|
|
3003
|
-
key: "tag",
|
|
3004
|
-
get: function get() {
|
|
3005
|
-
return "pfe-icon";
|
|
3006
|
-
}
|
|
3007
|
-
}, {
|
|
3008
|
-
key: "PfeType",
|
|
3009
|
-
get: function get() {
|
|
3010
|
-
return PFElement.PfeTypes.Content;
|
|
3011
|
-
}
|
|
3012
|
-
}, {
|
|
3013
|
-
key: "properties",
|
|
3014
|
-
get: function get() {
|
|
3015
|
-
return {
|
|
3016
|
-
icon: {
|
|
3017
|
-
type: String,
|
|
3018
|
-
observer: "updateIcon",
|
|
3019
|
-
prefix: false
|
|
3020
|
-
},
|
|
3021
|
-
size: {
|
|
3022
|
-
type: String,
|
|
3023
|
-
values: ["xl", "lg", "md", "sm", "1x", "2x", "3x", "4x"],
|
|
3024
|
-
"default": "1x"
|
|
3025
|
-
},
|
|
3026
|
-
color: {
|
|
3027
|
-
type: String,
|
|
3028
|
-
values: ["complement", "accent", "lightest", "base", "darker", "darkest", "critical", "important", "moderate", "success", "info"],
|
|
3029
|
-
observer: "_colorChanged"
|
|
3030
|
-
},
|
|
3031
|
-
onFail: {
|
|
3032
|
-
type: String,
|
|
3033
|
-
values: ["collapse"]
|
|
3034
|
-
},
|
|
3035
|
-
circled: {
|
|
3036
|
-
type: Boolean
|
|
3037
|
-
},
|
|
3038
|
-
block: {
|
|
3039
|
-
type: Boolean
|
|
3040
|
-
},
|
|
3041
|
-
// TODO: Deprecated for 1.0
|
|
3042
|
-
oldColor: {
|
|
3043
|
-
type: String,
|
|
3044
|
-
alias: "color",
|
|
3045
|
-
attr: "pfe-color"
|
|
3046
|
-
},
|
|
3047
|
-
// TODO: Deprecated for 1.0
|
|
3048
|
-
oldSize: {
|
|
3049
|
-
type: String,
|
|
3050
|
-
alias: "size",
|
|
3051
|
-
attr: "pfe-size"
|
|
3052
|
-
},
|
|
3053
|
-
// TODO: Deprecated for 1.0
|
|
3054
|
-
oldCircled: {
|
|
3055
|
-
type: Boolean,
|
|
3056
|
-
alias: "circled",
|
|
3057
|
-
attr: "pfe-circled"
|
|
3058
|
-
},
|
|
3059
|
-
// TODO: Deprecated for 1.0
|
|
3060
|
-
oldBlock: {
|
|
3061
|
-
type: Boolean,
|
|
3062
|
-
alias: "block",
|
|
3063
|
-
attr: "data-block"
|
|
3064
|
-
}
|
|
3065
|
-
};
|
|
3066
|
-
}
|
|
3067
|
-
}, {
|
|
3068
|
-
key: "EVENTS",
|
|
3069
|
-
get: function get() {
|
|
3070
|
-
return {
|
|
3071
|
-
ADD_ICON_SET: this.tag + ":add-icon-set"
|
|
3072
|
-
};
|
|
3073
|
-
}
|
|
3074
|
-
}]);
|
|
3075
|
-
|
|
3076
|
-
return PfeIcon;
|
|
3077
|
-
}(PFElement);
|
|
3078
|
-
|
|
3079
|
-
PfeIcon._iconSets = {}; // Allow the user to supply their own icon sets via config.
|
|
3080
|
-
// See more in the pfe-icon README.md.
|
|
3081
|
-
|
|
3082
|
-
var config = PFElement.config;
|
|
3083
|
-
addBuiltIns({
|
|
3084
|
-
PfeIcon: PfeIcon,
|
|
3085
|
-
config: config
|
|
3086
|
-
});
|
|
3087
|
-
PFElement.create(PfeIcon);
|
|
38
|
+
var css_248z = ".vulnerabilities-table .impact-icon {\n font-size: 1.5rem;\n padding-right: 0.5rem; }\n .vulnerabilities-table .impact-icon.color-critical {\n color: #a30000; }\n .vulnerabilities-table .impact-icon.color-important {\n color: #ec7a08; }\n .vulnerabilities-table .impact-icon.color-moderate {\n color: #f5c12e; }\n .vulnerabilities-table .impact-icon.color-low {\n color: #777; }\n\n.vulnerabilities-table__affected-packages-cell {\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap; }\n\n.vulnerabilities-table__impact-cell {\n display: flex;\n align-items: center;\n flex-wrap: nowrap; }\n\n.filterable-table {\n padding-bottom: var(--pf-global--spacer--lg); }\n .filterable-table__bottom-pagination[class] {\n margin-top: 1rem; }\n .filterable-table .pf-c-toolbar {\n padding-top: 0; }\n .filterable-table .pf-c-toolbar__content {\n --pf-c-toolbar__content--PaddingRight: 0;\n --pf-c-toolbar__content--PaddingLeft: 0; }\n .filterable-table .pf-c-input-group__text {\n --pf-c-input-group__text--PaddingRight: 0; }\n .filterable-table .pf-c-pagination.pf-m-bottom {\n --pf-c-pagination--m-bottom--md--PaddingRight: 0; }\n\n.packages-table .pf-c-tabs__item > button {\n padding: 1rem 1.5rem; }\n\n.packages-table__excluded-packages-disclaimer {\n margin: 1rem 0 0 0.5rem; }\n\n.filter-input {\n width: 18rem;\n margin: 1rem 0 1rem 0; }\n";
|
|
3088
39
|
|
|
3089
40
|
/*! *****************************************************************************
|
|
3090
41
|
Copyright (c) Microsoft Corporation.
|
|
@@ -4299,7 +1250,17 @@ const SearchIconConfig = {
|
|
|
4299
1250
|
|
|
4300
1251
|
const SearchIcon = createIcon(SearchIconConfig);
|
|
4301
1252
|
|
|
4302
|
-
|
|
1253
|
+
const SecurityIconConfig = {
|
|
1254
|
+
name: 'SecurityIcon',
|
|
1255
|
+
height: 1024,
|
|
1256
|
+
width: 896,
|
|
1257
|
+
svgPath: 'M861.5,0 L34.5,0 C15.4,0 0,14.3 0,32 L0,452.1 C0,768 387.7,1024 448.5,1024 C509.3,1024 896,768 896,452.2 L896,32 C896,14.3 880.6,0 861.5,0 Z M490.7,768 L405.3,768 C393.5,767.8 384.2,757.5 384,744.7 L384,663.3 C384.2,650.5 393.6,640.3 405.3,640 L490.7,640 C502.5,640.2 511.8,650.5 512,663.3 L512,744.7 L512.1,744.7 C511.8,757.5 502.4,767.8 490.7,768 Z M543.9,162.7 L517.2,514.4 C515.8,530.9 502,544 485.3,544 L410.6,544 C394,544 380.1,531.2 378.7,514.7 L352.1,163 C350.5,144.3 365.3,128.3 384,128.3 L512,128 C530.7,128 545.4,144 543.9,162.7 Z',
|
|
1258
|
+
yOffset: 0,
|
|
1259
|
+
xOffset: 0,
|
|
1260
|
+
};
|
|
1261
|
+
|
|
1262
|
+
const SecurityIcon = createIcon(SecurityIconConfig);
|
|
1263
|
+
|
|
4303
1264
|
var DEFAULT_PAGE = 1;
|
|
4304
1265
|
var DEFAULT_PERPAGE = 10;
|
|
4305
1266
|
function FilterableTable(_ref) {
|
|
@@ -4456,10 +1417,15 @@ function FilterableTable(_ref) {
|
|
|
4456
1417
|
}, renderPagination('top'))));
|
|
4457
1418
|
return React__default["default"].createElement("div", {
|
|
4458
1419
|
className: 'filterable-table'
|
|
4459
|
-
}, isLoading ? React__default["default"].createElement(reactCore.Bullseye,
|
|
4460
|
-
|
|
1420
|
+
}, isLoading ? React__default["default"].createElement(reactCore.Bullseye, {
|
|
1421
|
+
style: {
|
|
1422
|
+
minHeight: '15rem'
|
|
1423
|
+
}
|
|
1424
|
+
}, React__default["default"].createElement("div", null, React__default["default"].createElement(reactCore.Title, {
|
|
1425
|
+
headingLevel: 'h3'
|
|
1426
|
+
}, React__default["default"].createElement(reactCore.Spinner, {
|
|
4461
1427
|
size: 'lg'
|
|
4462
|
-
}))) : React__default["default"].createElement(React__default["default"].Fragment, null, header, React__default["default"].createElement(TableComposable, {
|
|
1428
|
+
})))) : React__default["default"].createElement(React__default["default"].Fragment, null, header, React__default["default"].createElement(TableComposable, {
|
|
4463
1429
|
"aria-label": 'Packages Table'
|
|
4464
1430
|
}, React__default["default"].createElement(Thead, null, React__default["default"].createElement(Tr, null, columns.map(function (col, colIdx) {
|
|
4465
1431
|
return React__default["default"].createElement(Th, Object.assign({
|
|
@@ -4510,9 +1476,8 @@ var FilterInput = function FilterInput(_ref) {
|
|
|
4510
1476
|
|
|
4511
1477
|
return React__default["default"].createElement("div", {
|
|
4512
1478
|
className: 'filter-input'
|
|
4513
|
-
}, React__default["default"].createElement(reactCore.
|
|
1479
|
+
}, React__default["default"].createElement(reactCore.SearchInput, {
|
|
4514
1480
|
value: searchStr,
|
|
4515
|
-
type: 'text',
|
|
4516
1481
|
placeholder: placeholder,
|
|
4517
1482
|
onChange: onChange,
|
|
4518
1483
|
"aria-label": 'Text input filter',
|
|
@@ -4523,16 +1488,10 @@ var FilterInput = function FilterInput(_ref) {
|
|
|
4523
1488
|
onClick: function onClick(event) {
|
|
4524
1489
|
event.stopPropagation();
|
|
4525
1490
|
event.preventDefault();
|
|
1491
|
+
},
|
|
1492
|
+
onClear: function onClear(event) {
|
|
1493
|
+
return onChange("", event);
|
|
4526
1494
|
}
|
|
4527
|
-
}), searchStr && React__default["default"].createElement("pfe-icon", {
|
|
4528
|
-
"class": 'clear-icon action-icon',
|
|
4529
|
-
icon: 'fas-times',
|
|
4530
|
-
onClick: function onClick(event) {
|
|
4531
|
-
return onChange('', event);
|
|
4532
|
-
}
|
|
4533
|
-
}), React__default["default"].createElement("pfe-icon", {
|
|
4534
|
-
"class": 'search-icon action-icon',
|
|
4535
|
-
icon: 'fas-search-solid'
|
|
4536
1495
|
}));
|
|
4537
1496
|
};
|
|
4538
1497
|
|
|
@@ -4675,10 +1634,8 @@ var VulnerabilitiesTable = function VulnerabilitiesTable(_ref) {
|
|
|
4675
1634
|
var severity = _ref2.severity;
|
|
4676
1635
|
return React__default["default"].createElement(React__default["default"].Fragment, null, React__default["default"].createElement("div", {
|
|
4677
1636
|
className: 'vulnerabilities-table__impact-cell'
|
|
4678
|
-
}, React__default["default"].createElement(
|
|
4679
|
-
|
|
4680
|
-
className: "color-" + severity.toLowerCase(),
|
|
4681
|
-
icon: 'fas-shield-fill-exclamation'
|
|
1637
|
+
}, React__default["default"].createElement(SecurityIcon, {
|
|
1638
|
+
className: "impact-icon color-" + severity.toLowerCase()
|
|
4682
1639
|
}), React__default["default"].createElement("span", null, severity)));
|
|
4683
1640
|
};
|
|
4684
1641
|
|
|
@@ -4746,7 +1703,7 @@ var VulnerabilitiesTable = function VulnerabilitiesTable(_ref) {
|
|
|
4746
1703
|
};
|
|
4747
1704
|
|
|
4748
1705
|
var onStatusFilterChange = function onStatusFilterChange(selected, vulnerability) {
|
|
4749
|
-
return selected === 'fixed' ? vulnerability
|
|
1706
|
+
return selected === 'fixed' ? !!(vulnerability != null && vulnerability.advisory_id) : selected === 'unfixed' ? !(vulnerability != null && vulnerability.advisory_id) : true;
|
|
4750
1707
|
};
|
|
4751
1708
|
|
|
4752
1709
|
var onImpactFilterChange = function onImpactFilterChange(selected, vulnerability) {
|
|
@@ -4829,10 +1786,6 @@ var severitySortOrder = {
|
|
|
4829
1786
|
Moderate: 3,
|
|
4830
1787
|
Low: 4
|
|
4831
1788
|
};
|
|
4832
|
-
PfeIcon.addIconSet('fas', './img', function (iconName, _, path) {
|
|
4833
|
-
var name = iconName.replace('fas-', '');
|
|
4834
|
-
return path + "/" + name + ".svg";
|
|
4835
|
-
});
|
|
4836
1789
|
|
|
4837
1790
|
var InsertCss = function InsertCss() {
|
|
4838
1791
|
var styleId = 'example-component-styles';
|
|
@@ -4861,6 +1814,10 @@ var PackagesTable = function PackagesTable(_ref) {
|
|
|
4861
1814
|
uniqueVulnerabilities = _React$useState2[0],
|
|
4862
1815
|
setUniqueVulnerabilities = _React$useState2[1];
|
|
4863
1816
|
|
|
1817
|
+
var _React$useState3 = React__namespace.useState(0),
|
|
1818
|
+
activeKey = _React$useState3[0],
|
|
1819
|
+
setActiveKey = _React$useState3[1];
|
|
1820
|
+
|
|
4864
1821
|
React__namespace.useEffect(function () {
|
|
4865
1822
|
var VALID_REDHAT_GPG_KEYS = ['199e2f91fd431d51', '5326810137017186', '45689c882fa658e0', '219180cddb42a60e', '7514f77d8366b0d9', 'fd372689897da07a', '938a80caf21541eb', '08b871e6a5787476'];
|
|
4866
1823
|
var packages = rpms.filter(function (_ref2) {
|
|
@@ -4900,30 +1857,29 @@ var PackagesTable = function PackagesTable(_ref) {
|
|
|
4900
1857
|
InsertCss();
|
|
4901
1858
|
return React__namespace.createElement(React__namespace.Fragment, null, (uniqueVulnerabilities.length > 0 || excludedPackages.length > 0) && React__namespace.createElement("div", {
|
|
4902
1859
|
className: 'packages-table'
|
|
4903
|
-
}, React__namespace.createElement(
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
1860
|
+
}, React__namespace.createElement(reactCore.Tabs, {
|
|
1861
|
+
activeKey: activeKey,
|
|
1862
|
+
onSelect: function onSelect(_evt, tabKey) {
|
|
1863
|
+
return setActiveKey(tabKey);
|
|
1864
|
+
},
|
|
1865
|
+
variant: 'default',
|
|
1866
|
+
isBox: true,
|
|
1867
|
+
"aria-label": 'vulnerability tab'
|
|
1868
|
+
}, uniqueVulnerabilities.length > 0 && React__namespace.createElement(reactCore.Tab, {
|
|
1869
|
+
eventKey: 0,
|
|
1870
|
+
title: "Vulnerabilities (" + uniqueVulnerabilities.length + ")"
|
|
4912
1871
|
}, React__namespace.createElement(VulnerabilitiesTable, {
|
|
4913
1872
|
vulnerabilities: uniqueVulnerabilities,
|
|
4914
1873
|
isLoading: isLoading
|
|
4915
|
-
}))
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
}, "Excluded Packages ", "(" + excludedPackages.length + ")"), React__namespace.createElement("pfe-tab-panel", {
|
|
4919
|
-
slot: 'panel',
|
|
4920
|
-
role: 'region'
|
|
1874
|
+
})), excludedPackages.length >= 0 && React__namespace.createElement(reactCore.Tab, {
|
|
1875
|
+
eventKey: 1,
|
|
1876
|
+
title: "Excluded Packages (" + excludedPackages.length + ")"
|
|
4921
1877
|
}, React__namespace.createElement("p", {
|
|
4922
1878
|
className: 'packages-table__excluded-packages-disclaimer'
|
|
4923
1879
|
}, "The following packages were found in this image and cannot be scanned or compared to public vulnerability information. This image may include additional packages or content not found or listed below."), React__namespace.createElement(ExcludedPackagesTable, {
|
|
4924
1880
|
excludedPackages: excludedPackages,
|
|
4925
1881
|
isLoading: isLoading
|
|
4926
|
-
})))))
|
|
1882
|
+
})))));
|
|
4927
1883
|
};
|
|
4928
1884
|
|
|
4929
1885
|
exports.PackagesTable = PackagesTable;
|