d3plus-priestley
Advanced tools
Comparing version 0.3.4 to 0.3.5
/* | ||
d3plus-priestley v0.3.4 | ||
d3plus-priestley v0.3.5 | ||
A reusable Priestley timeline built on D3. | ||
Copyright (c) 2019 D3plus - https://d3plus.org | ||
Copyright (c) 2020 D3plus - https://d3plus.org | ||
@license MIT | ||
*/ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-collection'), require('d3-scale'), require('d3plus-axis'), require('d3plus-common'), require('d3plus-shape'), require('d3plus-viz')) : | ||
typeof define === 'function' && define.amd ? define('d3plus-priestley', ['exports', 'd3-array', 'd3-collection', 'd3-scale', 'd3plus-axis', 'd3plus-common', 'd3plus-shape', 'd3plus-viz'], factory) : | ||
(global = global || self, factory(global.d3plus = {}, global.d3Array, global.d3Collection, global.d3Scale, global.d3plusAxis, global.d3plusCommon, global.d3plusShape, global.d3plusViz)); | ||
}(this, function (exports, d3Array, d3Collection, d3Scale, d3plusAxis, d3plusCommon, d3plusShape, d3plusViz) { 'use strict'; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
} | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
return o.__proto__ || Object.getPrototypeOf(o); | ||
}; | ||
return _getPrototypeOf(o); | ||
} | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return self; | ||
} | ||
function _possibleConstructorReturn(self, call) { | ||
if (call && (typeof call === "object" || typeof call === "function")) { | ||
return call; | ||
} | ||
return _assertThisInitialized(self); | ||
} | ||
function _superPropBase(object, property) { | ||
while (!Object.prototype.hasOwnProperty.call(object, property)) { | ||
object = _getPrototypeOf(object); | ||
if (object === null) break; | ||
} | ||
return object; | ||
} | ||
function _get(target, property, receiver) { | ||
if (typeof Reflect !== "undefined" && Reflect.get) { | ||
_get = Reflect.get; | ||
} else { | ||
_get = function _get(target, property, receiver) { | ||
var base = _superPropBase(target, property); | ||
if (!base) return; | ||
var desc = Object.getOwnPropertyDescriptor(base, property); | ||
if (desc.get) { | ||
return desc.get.call(receiver); | ||
} | ||
return desc.value; | ||
}; | ||
} | ||
return _get(target, property, receiver || target); | ||
} | ||
/** | ||
@class Priestley | ||
@extends external:Viz | ||
@desc Creates a priestley timeline based on an array of data. | ||
*/ | ||
var Priestley = | ||
/*#__PURE__*/ | ||
function (_Viz) { | ||
_inherits(Priestley, _Viz); | ||
/** | ||
@memberof Priestley | ||
@desc Invoked when creating a new class instance, and sets any default parameters. | ||
@private | ||
*/ | ||
function Priestley() { | ||
var _this; | ||
_classCallCheck(this, Priestley); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Priestley).call(this)); | ||
_this._axis = new d3plusAxis.Axis().align("end").orient("bottom"); | ||
_this._axisConfig = { | ||
scale: "time" | ||
}; | ||
_this._axisTest = new d3plusAxis.Axis().align("end").gridSize(0).orient("bottom"); | ||
_this.end("end"); | ||
_this._shapeConfig = d3plusCommon.assign({}, _this._shapeConfig, { | ||
ariaLabel: function ariaLabel(d, i) { | ||
return "".concat(_this._drawLabel(d, i), ", ").concat(_this._start(d, i), " - ").concat(_this._end(d, i), "."); | ||
} | ||
}); | ||
_this.start("start"); | ||
return _this; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc Extends the render behavior of the abstract Viz class. | ||
@private | ||
*/ | ||
_createClass(Priestley, [{ | ||
key: "render", | ||
value: function render(callback) { | ||
var _this2 = this; | ||
_get(_getPrototypeOf(Priestley.prototype), "render", this).call(this, callback); | ||
if (!this._filteredData) return this; | ||
var data = this._filteredData.map(function (data, i) { | ||
return { | ||
__d3plus__: true, | ||
data: data, | ||
end: _this2._axisConfig.scale === "time" ? d3plusAxis.date(_this2._end(data, i)) : _this2._end(data, i), | ||
i: i, | ||
id: _this2._id(data, i), | ||
start: _this2._axisConfig.scale === "time" ? d3plusAxis.date(_this2._start(data, i)) : _this2._start(data, i) | ||
}; | ||
}).filter(function (d) { | ||
return d.end - d.start > 0; | ||
}).sort(function (a, b) { | ||
return a.start - b.start; | ||
}); | ||
var nestedData; | ||
if (this._groupBy.length > 1 && this._drawDepth > 0) { | ||
var dataNest = d3Collection.nest(); | ||
var _loop = function _loop(i) { | ||
dataNest.key(function (d) { | ||
return _this2._groupBy[i](d.data, d.i); | ||
}); | ||
}; | ||
for (var i = 0; i < this._drawDepth; i++) { | ||
_loop(i); | ||
} | ||
nestedData = dataNest.entries(data); | ||
} else nestedData = [{ | ||
values: data | ||
}]; | ||
var maxLane = 0; | ||
nestedData.forEach(function (g) { | ||
var track = []; | ||
g.values.forEach(function (d) { | ||
track = track.map(function (t) { | ||
return t <= d.start ? false : t; | ||
}); | ||
var i = track.indexOf(false); | ||
if (i < 0) { | ||
d.lane = maxLane + track.length; | ||
track.push(d.end); | ||
} else { | ||
track[i] = d.end; | ||
d.lane = maxLane + i; | ||
} | ||
}); | ||
maxLane += track.length; | ||
}); | ||
var axisConfig = { | ||
domain: [d3Array.min(data, function (d) { | ||
return d.start; | ||
}) || 0, d3Array.max(data, function (d) { | ||
return d.end; | ||
}) || 0], | ||
height: this._height - this._margin.top - this._margin.bottom, | ||
width: this._width - this._margin.left - this._margin.right | ||
}; | ||
var transform = "translate(".concat(this._margin.left, ", ").concat(this._margin.top, ")"); | ||
this._axisTest.config(axisConfig).config(this._axisConfig).select(d3plusCommon.elem("g.d3plus-priestley-axis-test", { | ||
parent: this._select, | ||
enter: { | ||
opacity: 0 | ||
} | ||
}).node()).render(); | ||
this._axis.config(axisConfig).config(this._axisConfig).select(d3plusCommon.elem("g.d3plus-priestley-axis", { | ||
parent: this._select, | ||
enter: { | ||
transform: transform | ||
}, | ||
update: { | ||
transform: transform | ||
} | ||
}).node()).render(); | ||
var axisPad = this._axisTest._padding; | ||
var xScale = this._axis._d3Scale; | ||
var yScale = d3Scale.scalePoint().domain(d3Array.range(0, maxLane, 1)).padding(0.5).rangeRound([this._height - this._margin.bottom - this._axisTest.outerBounds().height - axisPad, this._margin.top + axisPad]); | ||
var step = yScale.step(); | ||
this._shapes.push(new d3plusShape.Rect().data(data).duration(this._duration).height(step >= this._padding * 2 ? step - this._padding : step > 2 ? step - 2 : step).label(function (d, i) { | ||
return _this2._drawLabel(d.data, i); | ||
}).select(d3plusCommon.elem("g.d3plus-priestley-shapes", { | ||
parent: this._select | ||
}).node()).width(function (d) { | ||
var w = Math.abs(xScale(d.end) - xScale(d.start)); | ||
return w > 2 ? w - 2 : w; | ||
}).x(function (d) { | ||
return xScale(d.start) + (xScale(d.end) - xScale(d.start)) / 2; | ||
}).y(function (d) { | ||
return yScale(d.lane); | ||
}).config(d3plusCommon.configPrep.bind(this)(this._shapeConfig, "shape", "Rect")).render()); | ||
return this; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc If *value* is specified, sets the config method for the axis and returns the current class instance. If *value* is not specified, returns the current axis configuration. | ||
@param {Object} [*value*] | ||
@chainable | ||
*/ | ||
}, { | ||
key: "axisConfig", | ||
value: function axisConfig(_) { | ||
return arguments.length ? (this._axisConfig = d3plusCommon.assign(this._axisConfig, _), this) : this._axisConfig; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc If *value* is specified, sets the end accessor to the specified function or key and returns the current class instance. If *value* is not specified, returns the current end accessor. | ||
@param {Function|String} [*value*] | ||
@chainable | ||
*/ | ||
}, { | ||
key: "end", | ||
value: function end(_) { | ||
if (arguments.length) { | ||
if (typeof _ === "function") this._end = _;else { | ||
this._end = d3plusCommon.accessor(_); | ||
if (!this._aggs[_]) this._aggs[_] = function (a) { | ||
return d3Array.max(a); | ||
}; | ||
} | ||
return this; | ||
} else return this._end; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc If *value* is specified, sets the start accessor to the specified function or key and returns the current class instance. If *value* is not specified, returns the current start accessor. | ||
@param {Function|String} [*value*] | ||
@chainable | ||
*/ | ||
}, { | ||
key: "start", | ||
value: function start(_) { | ||
if (arguments.length) { | ||
if (typeof _ === "function") this._start = _;else { | ||
this._start = d3plusCommon.accessor(_); | ||
if (!this._aggs[_]) this._aggs[_] = function (a) { | ||
return d3Array.min(a); | ||
}; | ||
} | ||
return this; | ||
} else return this._start; | ||
} | ||
}]); | ||
return Priestley; | ||
}(d3plusViz.Viz); | ||
exports.Priestley = Priestley; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
})); | ||
(function (factory) { | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
factory(); | ||
}(function () { 'use strict'; | ||
}((function () { 'use strict'; | ||
@@ -344,3 +19,2 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
var O = 'object'; | ||
var check = function (it) { | ||
@@ -353,6 +27,6 @@ return it && it.Math == Math && it; | ||
// eslint-disable-next-line no-undef | ||
check(typeof globalThis == O && globalThis) || | ||
check(typeof window == O && window) || | ||
check(typeof self == O && self) || | ||
check(typeof commonjsGlobal == O && commonjsGlobal) || | ||
check(typeof globalThis == 'object' && globalThis) || | ||
check(typeof window == 'object' && window) || | ||
check(typeof self == 'object' && self) || | ||
check(typeof commonjsGlobal == 'object' && commonjsGlobal) || | ||
// eslint-disable-next-line no-new-func | ||
@@ -371,3 +45,3 @@ Function('return this')(); | ||
var descriptors = !fails(function () { | ||
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; | ||
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7; | ||
}); | ||
@@ -456,8 +130,8 @@ | ||
var document = global_1.document; | ||
var document$1 = global_1.document; | ||
// typeof document.createElement is 'object' in old IE | ||
var EXISTS = isObject(document) && isObject(document.createElement); | ||
var EXISTS = isObject(document$1) && isObject(document$1.createElement); | ||
var documentCreateElement = function (it) { | ||
return EXISTS ? document.createElement(it) : {}; | ||
return EXISTS ? document$1.createElement(it) : {}; | ||
}; | ||
@@ -515,3 +189,3 @@ | ||
var hide = descriptors ? function (object, key, value) { | ||
var createNonEnumerableProperty = descriptors ? function (object, key, value) { | ||
return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value)); | ||
@@ -525,3 +199,3 @@ } : function (object, key, value) { | ||
try { | ||
hide(global_1, key, value); | ||
createNonEnumerableProperty(global_1, key, value); | ||
} catch (error) { | ||
@@ -532,21 +206,32 @@ global_1[key] = value; | ||
var shared = createCommonjsModule(function (module) { | ||
var SHARED = '__core-js_shared__'; | ||
var store = global_1[SHARED] || setGlobal(SHARED, {}); | ||
var sharedStore = store; | ||
var functionToString = Function.toString; | ||
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper | ||
if (typeof sharedStore.inspectSource != 'function') { | ||
sharedStore.inspectSource = function (it) { | ||
return functionToString.call(it); | ||
}; | ||
} | ||
var inspectSource = sharedStore.inspectSource; | ||
var WeakMap = global_1.WeakMap; | ||
var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap)); | ||
var shared = createCommonjsModule(function (module) { | ||
(module.exports = function (key, value) { | ||
return store[key] || (store[key] = value !== undefined ? value : {}); | ||
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {}); | ||
})('versions', []).push({ | ||
version: '3.1.3', | ||
version: '3.6.4', | ||
mode: 'global', | ||
copyright: '© 2019 Denis Pushkarev (zloirock.ru)' | ||
copyright: '© 2020 Denis Pushkarev (zloirock.ru)' | ||
}); | ||
}); | ||
var functionToString = shared('native-function-to-string', Function.toString); | ||
var WeakMap = global_1.WeakMap; | ||
var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap)); | ||
var id = 0; | ||
@@ -584,15 +269,15 @@ var postfix = Math.random(); | ||
if (nativeWeakMap) { | ||
var store = new WeakMap$1(); | ||
var wmget = store.get; | ||
var wmhas = store.has; | ||
var wmset = store.set; | ||
var store$1 = new WeakMap$1(); | ||
var wmget = store$1.get; | ||
var wmhas = store$1.has; | ||
var wmset = store$1.set; | ||
set = function (it, metadata) { | ||
wmset.call(store, it, metadata); | ||
wmset.call(store$1, it, metadata); | ||
return metadata; | ||
}; | ||
get = function (it) { | ||
return wmget.call(store, it) || {}; | ||
return wmget.call(store$1, it) || {}; | ||
}; | ||
has$1 = function (it) { | ||
return wmhas.call(store, it); | ||
return wmhas.call(store$1, it); | ||
}; | ||
@@ -603,3 +288,3 @@ } else { | ||
set = function (it, metadata) { | ||
hide(it, STATE, metadata); | ||
createNonEnumerableProperty(it, STATE, metadata); | ||
return metadata; | ||
@@ -626,8 +311,4 @@ }; | ||
var enforceInternalState = internalState.enforce; | ||
var TEMPLATE = String(functionToString).split('toString'); | ||
var TEMPLATE = String(String).split('String'); | ||
shared('inspectSource', function (it) { | ||
return functionToString.call(it); | ||
}); | ||
(module.exports = function (O, key, value, options) { | ||
@@ -638,3 +319,3 @@ var unsafe = options ? !!options.unsafe : false; | ||
if (typeof value == 'function') { | ||
if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key); | ||
if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key); | ||
enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : ''); | ||
@@ -652,6 +333,6 @@ } | ||
if (simple) O[key] = value; | ||
else hide(O, key, value); | ||
else createNonEnumerableProperty(O, key, value); | ||
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative | ||
})(Function.prototype, 'toString', function toString() { | ||
return typeof this == 'function' && getInternalState(this).source || functionToString.call(this); | ||
return typeof this == 'function' && getInternalState(this).source || inspectSource(this); | ||
}); | ||
@@ -693,3 +374,3 @@ }); | ||
// Let integer be ? ToInteger(index). | ||
// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length). | ||
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). | ||
var toAbsoluteIndex = function (index, length) { | ||
@@ -858,3 +539,3 @@ var integer = toInteger(index); | ||
if (options.sham || (targetProperty && targetProperty.sham)) { | ||
hide(sourceProperty, 'sham', true); | ||
createNonEnumerableProperty(sourceProperty, 'sham', true); | ||
} | ||
@@ -873,3 +554,3 @@ // extend global | ||
// optional / simple context binding | ||
var bindContext = function (fn, that, length) { | ||
var functionBindContext = function (fn, that, length) { | ||
aFunction$1(fn); | ||
@@ -914,8 +595,17 @@ if (that === undefined) return fn; | ||
var useSymbolAsUid = nativeSymbol | ||
// eslint-disable-next-line no-undef | ||
&& !Symbol.sham | ||
// eslint-disable-next-line no-undef | ||
&& typeof Symbol.iterator == 'symbol'; | ||
var WellKnownSymbolsStore = shared('wks'); | ||
var Symbol$1 = global_1.Symbol; | ||
var store$1 = shared('wks'); | ||
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid; | ||
var wellKnownSymbol = function (name) { | ||
return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name] | ||
|| (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name)); | ||
if (!has(WellKnownSymbolsStore, name)) { | ||
if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name]; | ||
else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); | ||
} return WellKnownSymbolsStore[name]; | ||
}; | ||
@@ -953,3 +643,3 @@ | ||
var self = indexedObject(O); | ||
var boundFunction = bindContext(callbackfn, that, 3); | ||
var boundFunction = functionBindContext(callbackfn, that, 3); | ||
var length = toLength(self.length); | ||
@@ -1021,29 +711,59 @@ var index = 0; | ||
var GT = '>'; | ||
var LT = '<'; | ||
var PROTOTYPE = 'prototype'; | ||
var SCRIPT = 'script'; | ||
var IE_PROTO = sharedKey('IE_PROTO'); | ||
var PROTOTYPE = 'prototype'; | ||
var Empty = function () { /* empty */ }; | ||
var EmptyConstructor = function () { /* empty */ }; | ||
var scriptTag = function (content) { | ||
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; | ||
}; | ||
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype | ||
var NullProtoObjectViaActiveX = function (activeXDocument) { | ||
activeXDocument.write(scriptTag('')); | ||
activeXDocument.close(); | ||
var temp = activeXDocument.parentWindow.Object; | ||
activeXDocument = null; // avoid memory leak | ||
return temp; | ||
}; | ||
// Create object with fake `null` prototype: use iframe Object with cleared prototype | ||
var createDict = function () { | ||
var NullProtoObjectViaIFrame = function () { | ||
// Thrash, waste and sodomy: IE GC bug | ||
var iframe = documentCreateElement('iframe'); | ||
var length = enumBugKeys.length; | ||
var lt = '<'; | ||
var script = 'script'; | ||
var gt = '>'; | ||
var js = 'java' + script + ':'; | ||
var JS = 'java' + SCRIPT + ':'; | ||
var iframeDocument; | ||
iframe.style.display = 'none'; | ||
html.appendChild(iframe); | ||
iframe.src = String(js); | ||
// https://github.com/zloirock/core-js/issues/475 | ||
iframe.src = String(JS); | ||
iframeDocument = iframe.contentWindow.document; | ||
iframeDocument.open(); | ||
iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt); | ||
iframeDocument.write(scriptTag('document.F=Object')); | ||
iframeDocument.close(); | ||
createDict = iframeDocument.F; | ||
while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]]; | ||
return createDict(); | ||
return iframeDocument.F; | ||
}; | ||
// Check for document.domain and active x support | ||
// No need to use active x approach when document.domain is not set | ||
// see https://github.com/es-shims/es5-shim/issues/150 | ||
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 | ||
// avoid IE GC bug | ||
var activeXDocument; | ||
var NullProtoObject = function () { | ||
try { | ||
/* global ActiveXObject */ | ||
activeXDocument = document.domain && new ActiveXObject('htmlfile'); | ||
} catch (error) { /* ignore */ } | ||
NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame(); | ||
var length = enumBugKeys.length; | ||
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; | ||
return NullProtoObject(); | ||
}; | ||
hiddenKeys[IE_PROTO] = true; | ||
// `Object.create` method | ||
@@ -1054,13 +774,11 @@ // https://tc39.github.io/ecma262/#sec-object.create | ||
if (O !== null) { | ||
Empty[PROTOTYPE] = anObject(O); | ||
result = new Empty(); | ||
Empty[PROTOTYPE] = null; | ||
EmptyConstructor[PROTOTYPE] = anObject(O); | ||
result = new EmptyConstructor(); | ||
EmptyConstructor[PROTOTYPE] = null; | ||
// add "__proto__" for Object.getPrototypeOf polyfill | ||
result[IE_PROTO] = O; | ||
} else result = createDict(); | ||
} else result = NullProtoObject(); | ||
return Properties === undefined ? result : objectDefineProperties(result, Properties); | ||
}; | ||
hiddenKeys[IE_PROTO] = true; | ||
var UNSCOPABLES = wellKnownSymbol('unscopables'); | ||
@@ -1072,3 +790,6 @@ var ArrayPrototype = Array.prototype; | ||
if (ArrayPrototype[UNSCOPABLES] == undefined) { | ||
hide(ArrayPrototype, UNSCOPABLES, objectCreate(null)); | ||
objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, { | ||
configurable: true, | ||
value: objectCreate(null) | ||
}); | ||
} | ||
@@ -1081,8 +802,35 @@ | ||
var defineProperty = Object.defineProperty; | ||
var cache = {}; | ||
var thrower = function (it) { throw it; }; | ||
var arrayMethodUsesToLength = function (METHOD_NAME, options) { | ||
if (has(cache, METHOD_NAME)) return cache[METHOD_NAME]; | ||
if (!options) options = {}; | ||
var method = [][METHOD_NAME]; | ||
var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false; | ||
var argument0 = has(options, 0) ? options[0] : thrower; | ||
var argument1 = has(options, 1) ? options[1] : undefined; | ||
return cache[METHOD_NAME] = !!method && !fails(function () { | ||
if (ACCESSORS && !descriptors) return true; | ||
var O = { length: -1 }; | ||
if (ACCESSORS) defineProperty(O, 1, { enumerable: true, get: thrower }); | ||
else O[1] = 1; | ||
method.call(O, argument0, argument1); | ||
}); | ||
}; | ||
var $find = arrayIteration.find; | ||
var FIND = 'find'; | ||
var SKIPS_HOLES = true; | ||
var USES_TO_LENGTH = arrayMethodUsesToLength(FIND); | ||
// Shouldn't skip holes | ||
@@ -1093,3 +841,3 @@ if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; }); | ||
// https://tc39.github.io/ecma262/#sec-array.prototype.find | ||
_export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, { | ||
_export({ target: 'Array', proto: true, forced: SKIPS_HOLES || !USES_TO_LENGTH }, { | ||
find: function find(callbackfn /* , that = undefined */) { | ||
@@ -1106,5 +854,8 @@ return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
var USES_TO_LENGTH$1 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 }); | ||
// `Array.prototype.includes` method | ||
// https://tc39.github.io/ecma262/#sec-array.prototype.includes | ||
_export({ target: 'Array', proto: true }, { | ||
_export({ target: 'Array', proto: true, forced: !USES_TO_LENGTH$1 }, { | ||
includes: function includes(el /* , fromIndex = 0 */) { | ||
@@ -1119,7 +870,18 @@ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); | ||
var nativeAssign = Object.assign; | ||
var defineProperty$1 = Object.defineProperty; | ||
// `Object.assign` method | ||
// https://tc39.github.io/ecma262/#sec-object.assign | ||
// should work with symbols and should have deterministic property order (V8 bug) | ||
var objectAssign = !nativeAssign || fails(function () { | ||
// should have correct order of operations (Edge bug) | ||
if (descriptors && nativeAssign({ b: 1 }, nativeAssign(defineProperty$1({}, 'a', { | ||
enumerable: true, | ||
get: function () { | ||
defineProperty$1(this, 'b', { | ||
value: 3, | ||
enumerable: false | ||
}); | ||
} | ||
}), { b: 2 })).b !== 1) return true; | ||
// should work with symbols and should have deterministic property order (V8 bug) | ||
var A = {}; | ||
@@ -1187,8 +949,31 @@ var B = {}; | ||
// `String.prototype.includes` method | ||
// https://tc39.github.io/ecma262/#sec-string.prototype.includes | ||
_export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, { | ||
includes: function includes(searchString /* , position = 0 */) { | ||
return !!~String(requireObjectCoercible(this)) | ||
.indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined); | ||
} | ||
}); | ||
var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f; | ||
var nativeStartsWith = ''.startsWith; | ||
var min$2 = Math.min; | ||
var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('startsWith'); | ||
// https://github.com/zloirock/core-js/pull/702 | ||
var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () { | ||
var descriptor = getOwnPropertyDescriptor$2(String.prototype, 'startsWith'); | ||
return descriptor && !descriptor.writable; | ||
}(); | ||
// `String.prototype.startsWith` method | ||
// https://tc39.github.io/ecma262/#sec-string.prototype.startswith | ||
_export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('startsWith') }, { | ||
_export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, { | ||
startsWith: function startsWith(searchString /* , position = 0 */) { | ||
@@ -1274,3 +1059,353 @@ var that = String(requireObjectCoercible(this)); | ||
})); | ||
}))); | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-collection'), require('d3-scale'), require('d3plus-axis'), require('d3plus-common'), require('d3plus-shape'), require('d3plus-viz')) : | ||
typeof define === 'function' && define.amd ? define('d3plus-priestley', ['exports', 'd3-array', 'd3-collection', 'd3-scale', 'd3plus-axis', 'd3plus-common', 'd3plus-shape', 'd3plus-viz'], factory) : | ||
(global = global || self, factory(global.d3plus = {}, global.d3Array, global.d3Collection, global.d3Scale, global.d3plusAxis, global.d3plusCommon, global.d3plusShape, global.d3plusViz)); | ||
}(this, (function (exports, d3Array, d3Collection, d3Scale, d3plusAxis, d3plusCommon, d3plusShape, d3plusViz) { 'use strict'; | ||
function _classCallCheck(instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
} | ||
function _defineProperties(target, props) { | ||
for (var i = 0; i < props.length; i++) { | ||
var descriptor = props[i]; | ||
descriptor.enumerable = descriptor.enumerable || false; | ||
descriptor.configurable = true; | ||
if ("value" in descriptor) descriptor.writable = true; | ||
Object.defineProperty(target, descriptor.key, descriptor); | ||
} | ||
} | ||
function _createClass(Constructor, protoProps, staticProps) { | ||
if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
return Constructor; | ||
} | ||
function _inherits(subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function"); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
} | ||
function _getPrototypeOf(o) { | ||
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
return o.__proto__ || Object.getPrototypeOf(o); | ||
}; | ||
return _getPrototypeOf(o); | ||
} | ||
function _setPrototypeOf(o, p) { | ||
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
o.__proto__ = p; | ||
return o; | ||
}; | ||
return _setPrototypeOf(o, p); | ||
} | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return self; | ||
} | ||
function _possibleConstructorReturn(self, call) { | ||
if (call && (typeof call === "object" || typeof call === "function")) { | ||
return call; | ||
} | ||
return _assertThisInitialized(self); | ||
} | ||
function _superPropBase(object, property) { | ||
while (!Object.prototype.hasOwnProperty.call(object, property)) { | ||
object = _getPrototypeOf(object); | ||
if (object === null) break; | ||
} | ||
return object; | ||
} | ||
function _get(target, property, receiver) { | ||
if (typeof Reflect !== "undefined" && Reflect.get) { | ||
_get = Reflect.get; | ||
} else { | ||
_get = function _get(target, property, receiver) { | ||
var base = _superPropBase(target, property); | ||
if (!base) return; | ||
var desc = Object.getOwnPropertyDescriptor(base, property); | ||
if (desc.get) { | ||
return desc.get.call(receiver); | ||
} | ||
return desc.value; | ||
}; | ||
} | ||
return _get(target, property, receiver || target); | ||
} | ||
/** | ||
@class Priestley | ||
@extends external:Viz | ||
@desc Creates a priestley timeline based on an array of data. | ||
*/ | ||
var Priestley = /*#__PURE__*/function (_Viz) { | ||
_inherits(Priestley, _Viz); | ||
/** | ||
@memberof Priestley | ||
@desc Invoked when creating a new class instance, and sets any default parameters. | ||
@private | ||
*/ | ||
function Priestley() { | ||
var _this; | ||
_classCallCheck(this, Priestley); | ||
_this = _possibleConstructorReturn(this, _getPrototypeOf(Priestley).call(this)); | ||
_this._axis = new d3plusAxis.Axis().align("end").orient("bottom"); | ||
_this._axisConfig = { | ||
scale: "time" | ||
}; | ||
_this._axisTest = new d3plusAxis.Axis().align("end").gridSize(0).orient("bottom"); | ||
_this.end("end"); | ||
_this._paddingInner = 0.05; | ||
_this._paddingOuter = 0.05; | ||
_this._shapeConfig = d3plusCommon.assign({}, _this._shapeConfig, { | ||
ariaLabel: function ariaLabel(d, i) { | ||
return "".concat(_this._drawLabel(d, i), ", ").concat(_this._start(d, i), " - ").concat(_this._end(d, i), "."); | ||
} | ||
}); | ||
_this.start("start"); | ||
return _this; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc Extends the render behavior of the abstract Viz class. | ||
@private | ||
*/ | ||
_createClass(Priestley, [{ | ||
key: "_draw", | ||
value: function _draw(callback) { | ||
var _this2 = this; | ||
_get(_getPrototypeOf(Priestley.prototype), "_draw", this).call(this, callback); | ||
if (!this._filteredData) return this; | ||
var data = this._filteredData.map(function (data, i) { | ||
return { | ||
__d3plus__: true, | ||
data: data, | ||
end: _this2._axisConfig.scale === "time" ? d3plusAxis.date(_this2._end(data, i)) : _this2._end(data, i), | ||
i: i, | ||
id: _this2._id(data, i), | ||
start: _this2._axisConfig.scale === "time" ? d3plusAxis.date(_this2._start(data, i)) : _this2._start(data, i) | ||
}; | ||
}).filter(function (d) { | ||
return d.end - d.start > 0; | ||
}).sort(function (a, b) { | ||
return a.start - b.start; | ||
}); | ||
var nestedData; | ||
if (this._groupBy.length > 1 && this._drawDepth > 0) { | ||
var dataNest = d3Collection.nest(); | ||
var _loop = function _loop(i) { | ||
dataNest.key(function (d) { | ||
return _this2._groupBy[i](d.data, d.i); | ||
}); | ||
}; | ||
for (var i = 0; i < this._drawDepth; i++) { | ||
_loop(i); | ||
} | ||
nestedData = dataNest.entries(data); | ||
} else nestedData = [{ | ||
values: data | ||
}]; | ||
var maxLane = 0; | ||
nestedData.forEach(function (g) { | ||
var track = []; | ||
g.values.forEach(function (d) { | ||
track = track.map(function (t) { | ||
return t <= d.start ? false : t; | ||
}); | ||
var i = track.indexOf(false); | ||
if (i < 0) { | ||
d.lane = maxLane + track.length; | ||
track.push(d.end); | ||
} else { | ||
track[i] = d.end; | ||
d.lane = maxLane + i; | ||
} | ||
}); | ||
maxLane += track.length; | ||
}); | ||
var axisConfig = { | ||
domain: [d3Array.min(data, function (d) { | ||
return d.start; | ||
}) || 0, d3Array.max(data, function (d) { | ||
return d.end; | ||
}) || 0], | ||
height: this._height - this._margin.top - this._margin.bottom, | ||
width: this._width - this._margin.left - this._margin.right | ||
}; | ||
var transform = "translate(".concat(this._margin.left, ", ").concat(this._margin.top, ")"); | ||
this._axisTest.config(axisConfig).config(this._axisConfig).select(d3plusCommon.elem("g.d3plus-priestley-axis-test", { | ||
parent: this._select, | ||
enter: { | ||
opacity: 0 | ||
} | ||
}).node()).render(); | ||
this._axis.config(axisConfig).config(this._axisConfig).select(d3plusCommon.elem("g.d3plus-priestley-axis", { | ||
parent: this._select, | ||
enter: { | ||
transform: transform | ||
}, | ||
update: { | ||
transform: transform | ||
} | ||
}).node()).render(); | ||
var axisPad = this._axisTest._padding; | ||
var xScale = this._axis._d3Scale; | ||
var yScale = d3Scale.scaleBand().domain(d3Array.range(0, maxLane, 1)).paddingInner(this._paddingInner).paddingOuter(this._paddingOuter).rangeRound([this._height - this._margin.bottom - this._axisTest.outerBounds().height - axisPad, this._margin.top + axisPad]); | ||
var bandWidth = yScale.bandwidth(); | ||
this._shapes.push(new d3plusShape.Rect().data(data).duration(this._duration).height(bandWidth).label(function (d, i) { | ||
return _this2._drawLabel(d.data, i); | ||
}).select(d3plusCommon.elem("g.d3plus-priestley-shapes", { | ||
parent: this._select | ||
}).node()).width(function (d) { | ||
var w = Math.abs(xScale(d.end) - xScale(d.start)); | ||
return w > 2 ? w - 2 : w; | ||
}).x(function (d) { | ||
return xScale(d.start) + (xScale(d.end) - xScale(d.start)) / 2; | ||
}).y(function (d) { | ||
return yScale(d.lane) + bandWidth / 2; | ||
}).config(d3plusCommon.configPrep.bind(this)(this._shapeConfig, "shape", "Rect")).render()); | ||
return this; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc If *value* is specified, sets the config method for the axis and returns the current class instance. If *value* is not specified, returns the current axis configuration. | ||
@param {Object} [*value*] | ||
@chainable | ||
*/ | ||
}, { | ||
key: "axisConfig", | ||
value: function axisConfig(_) { | ||
return arguments.length ? (this._axisConfig = d3plusCommon.assign(this._axisConfig, _), this) : this._axisConfig; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc If *value* is specified, sets the end accessor to the specified function or key and returns the current class instance. If *value* is not specified, returns the current end accessor. | ||
@param {Function|String} [*value*] | ||
@chainable | ||
*/ | ||
}, { | ||
key: "end", | ||
value: function end(_) { | ||
if (arguments.length) { | ||
if (typeof _ === "function") this._end = _;else { | ||
this._end = d3plusCommon.accessor(_); | ||
if (!this._aggs[_]) this._aggs[_] = function (a) { | ||
return d3Array.max(a); | ||
}; | ||
} | ||
return this; | ||
} else return this._end; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc Sets the [paddingInner](https://github.com/d3/d3-scale#band_paddingInner) value of the underlining [Band Scale](https://github.com/d3/d3-scale#band-scales) used to determine the height of each bar. Values should be a ratio between 0 and 1 representing the space in between each rectangle. | ||
@param {Number} [*value* = 0.05] | ||
@chainable | ||
*/ | ||
}, { | ||
key: "paddingInner", | ||
value: function paddingInner(_) { | ||
return arguments.length ? (this._paddingInner = _, this) : this._paddingInner; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc Sets the [paddingOuter](https://github.com/d3/d3-scale#band_paddingOuter) value of the underlining [Band Scale](https://github.com/d3/d3-scale#band-scales) used to determine the height of each bar. Values should be a ratio between 0 and 1 representing the space around the outer rectangles. | ||
@param {Number} [*value* = 0.05] | ||
@chainable | ||
*/ | ||
}, { | ||
key: "paddingOuter", | ||
value: function paddingOuter(_) { | ||
return arguments.length ? (this._paddingOuter = _, this) : this._paddingOuter; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc If *value* is specified, sets the start accessor to the specified function or key and returns the current class instance. If *value* is not specified, returns the current start accessor. | ||
@param {Function|String} [*value*] | ||
@chainable | ||
*/ | ||
}, { | ||
key: "start", | ||
value: function start(_) { | ||
if (arguments.length) { | ||
if (typeof _ === "function") this._start = _;else { | ||
this._start = d3plusCommon.accessor(_); | ||
if (!this._aggs[_]) this._aggs[_] = function (a) { | ||
return d3Array.min(a); | ||
}; | ||
} | ||
return this; | ||
} else return this._start; | ||
} | ||
}]); | ||
return Priestley; | ||
}(d3plusViz.Viz); | ||
exports.Priestley = Priestley; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
//# sourceMappingURL=d3plus-priestley.js.map |
/* | ||
d3plus-priestley v0.3.4 | ||
d3plus-priestley v0.3.5 | ||
A reusable Priestley timeline built on D3. | ||
Copyright (c) 2019 D3plus - https://d3plus.org | ||
Copyright (c) 2020 D3plus - https://d3plus.org | ||
@license MIT | ||
*/ | ||
(function(t,r){typeof exports==="object"&&typeof module!=="undefined"?r(exports,require("d3-array"),require("d3-collection"),require("d3-scale"),require("d3plus-axis"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-viz")):typeof define==="function"&&define.amd?define("d3plus-priestley",["exports","d3-array","d3-collection","d3-scale","d3plus-axis","d3plus-common","d3plus-shape","d3plus-viz"],r):(t=t||self,r(t.d3plus={},t.d3Array,t.d3Collection,t.d3Scale,t.d3plusAxis,t.d3plusCommon,t.d3plusShape,t.d3plusViz))})(this,function(t,g,y,m,b,_,w,r){"use strict";function e(t,r){if(!(t instanceof r)){throw new TypeError("Cannot call a class as a function")}}function n(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(t,n.key,n)}}function i(t,r,e){if(r)n(t.prototype,r);if(e)n(t,e);return t}function a(t,r){if(typeof r!=="function"&&r!==null){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:true,configurable:true}});if(r)o(t,r)}function x(t){x=Object.setPrototypeOf?Object.getPrototypeOf:function t(r){return r.__proto__||Object.getPrototypeOf(r)};return x(t)}function o(t,r){o=Object.setPrototypeOf||function t(r,e){r.__proto__=e;return r};return o(t,r)}function u(t){if(t===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function f(t,r){if(r&&(typeof r==="object"||typeof r==="function")){return r}return u(t)}function s(t,r){while(!Object.prototype.hasOwnProperty.call(t,r)){t=x(t);if(t===null)break}return t}function O(t,r,e){if(typeof Reflect!=="undefined"&&Reflect.get){O=Reflect.get}else{O=function t(r,e,n){var i=s(r,e);if(!i)return;var a=Object.getOwnPropertyDescriptor(i,e);if(a.get){return a.get.call(n)}return a.value}}return O(t,r,e||t)}var c=function(t){a(d,t);function d(){var n;e(this,d);n=f(this,x(d).call(this));n._axis=(new b.Axis).align("end").orient("bottom");n._axisConfig={scale:"time"};n._axisTest=(new b.Axis).align("end").gridSize(0).orient("bottom");n.end("end");n._shapeConfig=_.assign({},n._shapeConfig,{ariaLabel:function t(r,e){return"".concat(n._drawLabel(r,e),", ").concat(n._start(r,e)," - ").concat(n._end(r,e),".")}});n.start("start");return n}i(d,[{key:"render",value:function t(r){var e=this;O(x(d.prototype),"render",this).call(this,r);if(!this._filteredData)return this;var n=this._filteredData.map(function(t,r){return{__d3plus__:true,data:t,end:e._axisConfig.scale==="time"?b.date(e._end(t,r)):e._end(t,r),i:r,id:e._id(t,r),start:e._axisConfig.scale==="time"?b.date(e._start(t,r)):e._start(t,r)}}).filter(function(t){return t.end-t.start>0}).sort(function(t,r){return t.start-r.start});var i;if(this._groupBy.length>1&&this._drawDepth>0){var a=y.nest();var o=function t(r){a.key(function(t){return e._groupBy[r](t.data,t.i)})};for(var u=0;u<this._drawDepth;u++){o(u)}i=a.entries(n)}else i=[{values:n}];var f=0;i.forEach(function(t){var e=[];t.values.forEach(function(r){e=e.map(function(t){return t<=r.start?false:t});var t=e.indexOf(false);if(t<0){r.lane=f+e.length;e.push(r.end)}else{e[t]=r.end;r.lane=f+t}});f+=e.length});var s={domain:[g.min(n,function(t){return t.start})||0,g.max(n,function(t){return t.end})||0],height:this._height-this._margin.top-this._margin.bottom,width:this._width-this._margin.left-this._margin.right};var c="translate(".concat(this._margin.left,", ").concat(this._margin.top,")");this._axisTest.config(s).config(this._axisConfig).select(_.elem("g.d3plus-priestley-axis-test",{parent:this._select,enter:{opacity:0}}).node()).render();this._axis.config(s).config(this._axisConfig).select(_.elem("g.d3plus-priestley-axis",{parent:this._select,enter:{transform:c},update:{transform:c}}).node()).render();var l=this._axisTest._padding;var v=this._axis._d3Scale;var p=m.scalePoint().domain(g.range(0,f,1)).padding(.5).rangeRound([this._height-this._margin.bottom-this._axisTest.outerBounds().height-l,this._margin.top+l]);var h=p.step();this._shapes.push((new w.Rect).data(n).duration(this._duration).height(h>=this._padding*2?h-this._padding:h>2?h-2:h).label(function(t,r){return e._drawLabel(t.data,r)}).select(_.elem("g.d3plus-priestley-shapes",{parent:this._select}).node()).width(function(t){var r=Math.abs(v(t.end)-v(t.start));return r>2?r-2:r}).x(function(t){return v(t.start)+(v(t.end)-v(t.start))/2}).y(function(t){return p(t.lane)}).config(_.configPrep.bind(this)(this._shapeConfig,"shape","Rect")).render());return this}},{key:"axisConfig",value:function t(r){return arguments.length?(this._axisConfig=_.assign(this._axisConfig,r),this):this._axisConfig}},{key:"end",value:function t(r){if(arguments.length){if(typeof r==="function")this._end=r;else{this._end=_.accessor(r);if(!this._aggs[r])this._aggs[r]=function(t){return g.max(t)}}return this}else return this._end}},{key:"start",value:function t(r){if(arguments.length){if(typeof r==="function")this._start=r;else{this._start=_.accessor(r);if(!this._aggs[r])this._aggs[r]=function(t){return g.min(t)}}return this}else return this._start}}]);return d}(r.Viz);t.Priestley=c;Object.defineProperty(t,"__esModule",{value:true})});(function(t){typeof define==="function"&&define.amd?define(t):t()})(function(){"use strict";var t=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function r(t,r){return r={exports:{}},t(r,r.exports),r.exports}var e="object";var n=function(t){return t&&t.Math==Math&&t};var l=n(typeof globalThis==e&&globalThis)||n(typeof window==e&&window)||n(typeof self==e&&self)||n(typeof t==e&&t)||Function("return this")();var i=function(t){try{return!!t()}catch(t){return true}};var p=!i(function(){return Object.defineProperty({},"a",{get:function(){return 7}}).a!=7});var a={}.propertyIsEnumerable;var o=Object.getOwnPropertyDescriptor;var u=o&&!a.call({1:2},1);var f=u?function t(r){var e=o(this,r);return!!e&&e.enumerable}:a;var h={f:f};var s=function(t,r){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:r}};var c={}.toString;var v=function(t){return c.call(t).slice(8,-1)};var d="".split;var _=i(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return v(t)=="String"?d.call(t,""):Object(t)}:Object;var g=function(t){if(t==undefined)throw TypeError("Can't call method on "+t);return t};var y=function(t){return _(g(t))};var m=function(t){return typeof t==="object"?t!==null:typeof t==="function"};var b=function(t,r){if(!m(t))return t;var e,n;if(r&&typeof(e=t.toString)=="function"&&!m(n=e.call(t)))return n;if(typeof(e=t.valueOf)=="function"&&!m(n=e.call(t)))return n;if(!r&&typeof(e=t.toString)=="function"&&!m(n=e.call(t)))return n;throw TypeError("Can't convert object to primitive value")};var w={}.hasOwnProperty;var x=function(t,r){return w.call(t,r)};var O=l.document;var j=m(O)&&m(O.createElement);var S=function(t){return j?O.createElement(t):{}};var P=!p&&!i(function(){return Object.defineProperty(S("div"),"a",{get:function(){return 7}}).a!=7});var E=Object.getOwnPropertyDescriptor;var C=p?E:function t(r,e){r=y(r);e=b(e,true);if(P)try{return E(r,e)}catch(t){}if(x(r,e))return s(!h.f.call(r,e),r[e])};var T={f:C};var k=function(t){if(!m(t)){throw TypeError(String(t)+" is not an object")}return t};var M=Object.defineProperty;var A=p?M:function t(r,e,n){k(r);e=b(e,true);k(n);if(P)try{return M(r,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");if("value"in n)r[e]=n.value;return r};var L={f:A};var D=p?function(t,r,e){return L.f(t,r,s(1,e))}:function(t,r,e){t[r]=e;return t};var N=function(r,e){try{D(l,r,e)}catch(t){l[r]=e}return e};var R=r(function(t){var r="__core-js_shared__";var e=l[r]||N(r,{});(t.exports=function(t,r){return e[t]||(e[t]=r!==undefined?r:{})})("versions",[]).push({version:"3.1.3",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})});var q=R("native-function-to-string",Function.toString);var z=l.WeakMap;var F=typeof z==="function"&&/native code/.test(q.call(z));var I=0;var V=Math.random();var W=function(t){return"Symbol("+String(t===undefined?"":t)+")_"+(++I+V).toString(36)};var G=R("keys");var B=function(t){return G[t]||(G[t]=W(t))};var H={};var K=l.WeakMap;var Y,J,Q;var U=function(t){return Q(t)?J(t):Y(t,{})};var X=function(e){return function(t){var r;if(!m(t)||(r=J(t)).type!==e){throw TypeError("Incompatible receiver, "+e+" required")}return r}};if(F){var Z=new K;var $=Z.get;var tt=Z.has;var rt=Z.set;Y=function(t,r){rt.call(Z,t,r);return r};J=function(t){return $.call(Z,t)||{}};Q=function(t){return tt.call(Z,t)}}else{var et=B("state");H[et]=true;Y=function(t,r){D(t,et,r);return r};J=function(t){return x(t,et)?t[et]:{}};Q=function(t){return x(t,et)}}var nt={set:Y,get:J,has:Q,enforce:U,getterFor:X};var it=r(function(t){var r=nt.get;var u=nt.enforce;var f=String(q).split("toString");R("inspectSource",function(t){return q.call(t)});(t.exports=function(t,r,e,n){var i=n?!!n.unsafe:false;var a=n?!!n.enumerable:false;var o=n?!!n.noTargetGet:false;if(typeof e=="function"){if(typeof r=="string"&&!x(e,"name"))D(e,"name",r);u(e).source=f.join(typeof r=="string"?r:"")}if(t===l){if(a)t[r]=e;else N(r,e);return}else if(!i){delete t[r]}else if(!o&&t[r]){a=true}if(a)t[r]=e;else D(t,r,e)})(Function.prototype,"toString",function t(){return typeof this=="function"&&r(this).source||q.call(this)})});var at=l;var ot=function(t){return typeof t=="function"?t:undefined};var ut=function(t,r){return arguments.length<2?ot(at[t])||ot(l[t]):at[t]&&at[t][r]||l[t]&&l[t][r]};var ft=Math.ceil;var st=Math.floor;var ct=function(t){return isNaN(t=+t)?0:(t>0?st:ft)(t)};var lt=Math.min;var vt=function(t){return t>0?lt(ct(t),9007199254740991):0};var pt=Math.max;var ht=Math.min;var dt=function(t,r){var e=ct(t);return e<0?pt(e+r,0):ht(e,r)};var gt=function(u){return function(t,r,e){var n=y(t);var i=vt(n.length);var a=dt(e,i);var o;if(u&&r!=r)while(i>a){o=n[a++];if(o!=o)return true}else for(;i>a;a++){if((u||a in n)&&n[a]===r)return u||a||0}return!u&&-1}};var yt={includes:gt(true),indexOf:gt(false)};var mt=yt.indexOf;var bt=function(t,r){var e=y(t);var n=0;var i=[];var a;for(a in e)!x(H,a)&&x(e,a)&&i.push(a);while(r.length>n)if(x(e,a=r[n++])){~mt(i,a)||i.push(a)}return i};var _t=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];var wt=_t.concat("length","prototype");var xt=Object.getOwnPropertyNames||function t(r){return bt(r,wt)};var Ot={f:xt};var jt=Object.getOwnPropertySymbols;var St={f:jt};var Pt=ut("Reflect","ownKeys")||function t(r){var e=Ot.f(k(r));var n=St.f;return n?e.concat(n(r)):e};var Et=function(t,r){var e=Pt(r);var n=L.f;var i=T.f;for(var a=0;a<e.length;a++){var o=e[a];if(!x(t,o))n(t,o,i(r,o))}};var Ct=/#|\.prototype\./;var Tt=function(t,r){var e=Mt[kt(t)];return e==Lt?true:e==At?false:typeof r=="function"?i(r):!!r};var kt=Tt.normalize=function(t){return String(t).replace(Ct,".").toLowerCase()};var Mt=Tt.data={};var At=Tt.NATIVE="N";var Lt=Tt.POLYFILL="P";var Dt=Tt;var Nt=T.f;var Rt=function(t,r){var e=t.target;var n=t.global;var i=t.stat;var a,o,u,f,s,c;if(n){o=l}else if(i){o=l[e]||N(e,{})}else{o=(l[e]||{}).prototype}if(o)for(u in r){s=r[u];if(t.noTargetGet){c=Nt(o,u);f=c&&c.value}else f=o[u];a=Dt(n?u:e+(i?".":"#")+u,t.forced);if(!a&&f!==undefined){if(typeof s===typeof f)continue;Et(s,f)}if(t.sham||f&&f.sham){D(s,"sham",true)}it(o,u,s,t)}};var qt=function(t){if(typeof t!="function"){throw TypeError(String(t)+" is not a function")}return t};var zt=function(n,i,t){qt(n);if(i===undefined)return n;switch(t){case 0:return function(){return n.call(i)};case 1:return function(t){return n.call(i,t)};case 2:return function(t,r){return n.call(i,t,r)};case 3:return function(t,r,e){return n.call(i,t,r,e)}}return function(){return n.apply(i,arguments)}};var Ft=function(t){return Object(g(t))};var It=Array.isArray||function t(r){return v(r)=="Array"};var Vt=!!Object.getOwnPropertySymbols&&!i(function(){return!String(Symbol())});var Wt=l.Symbol;var Gt=R("wks");var Bt=function(t){return Gt[t]||(Gt[t]=Vt&&Wt[t]||(Vt?Wt:W)("Symbol."+t))};var Ht=Bt("species");var Kt=function(t,r){var e;if(It(t)){e=t.constructor;if(typeof e=="function"&&(e===Array||It(e.prototype)))e=undefined;else if(m(e)){e=e[Ht];if(e===null)e=undefined}}return new(e===undefined?Array:e)(r===0?0:r)};var Yt=[].push;var Jt=function(p){var h=p==1;var d=p==2;var g=p==3;var y=p==4;var m=p==6;var b=p==5||m;return function(t,r,e,n){var i=Ft(t);var a=_(i);var o=zt(r,e,3);var u=vt(a.length);var f=0;var s=n||Kt;var c=h?s(t,u):d?s(t,0):undefined;var l,v;for(;u>f;f++)if(b||f in a){l=a[f];v=o(l,f,i);if(p){if(h)c[f]=v;else if(v)switch(p){case 3:return true;case 5:return l;case 6:return f;case 2:Yt.call(c,l)}else if(y)return false}}return m?-1:g||y?y:c}};var Qt={forEach:Jt(0),map:Jt(1),filter:Jt(2),some:Jt(3),every:Jt(4),find:Jt(5),findIndex:Jt(6)};var Ut=Object.keys||function t(r){return bt(r,_t)};var Xt=p?Object.defineProperties:function t(r,e){k(r);var n=Ut(e);var i=n.length;var a=0;var o;while(i>a)L.f(r,o=n[a++],e[o]);return r};var Zt=ut("document","documentElement");var $t=B("IE_PROTO");var tr="prototype";var rr=function(){};var er=function(){var t=S("iframe");var r=_t.length;var e="<";var n="script";var i=">";var a="java"+n+":";var o;t.style.display="none";Zt.appendChild(t);t.src=String(a);o=t.contentWindow.document;o.open();o.write(e+n+i+"document.F=Object"+e+"/"+n+i);o.close();er=o.F;while(r--)delete er[tr][_t[r]];return er()};var nr=Object.create||function t(r,e){var n;if(r!==null){rr[tr]=k(r);n=new rr;rr[tr]=null;n[$t]=r}else n=er();return e===undefined?n:Xt(n,e)};H[$t]=true;var ir=Bt("unscopables");var ar=Array.prototype;if(ar[ir]==undefined){D(ar,ir,nr(null))}var or=function(t){ar[ir][t]=true};var ur=Qt.find;var fr="find";var sr=true;if(fr in[])Array(1)[fr](function(){sr=false});Rt({target:"Array",proto:true,forced:sr},{find:function t(r){return ur(this,r,arguments.length>1?arguments[1]:undefined)}});or(fr);var cr=yt.includes;Rt({target:"Array",proto:true},{includes:function t(r){return cr(this,r,arguments.length>1?arguments[1]:undefined)}});or("includes");var lr=Object.assign;var vr=!lr||i(function(){var t={};var r={};var e=Symbol();var n="abcdefghijklmnopqrst";t[e]=7;n.split("").forEach(function(t){r[t]=t});return lr({},t)[e]!=7||Ut(lr({},r)).join("")!=n})?function t(r,e){var n=Ft(r);var i=arguments.length;var a=1;var o=St.f;var u=h.f;while(i>a){var f=_(arguments[a++]);var s=o?Ut(f).concat(o(f)):Ut(f);var c=s.length;var l=0;var v;while(c>l){v=s[l++];if(!p||u.call(f,v))n[v]=f[v]}}return n}:lr;Rt({target:"Object",stat:true,forced:Object.assign!==vr},{assign:vr});var pr=Bt("match");var hr=function(t){var r;return m(t)&&((r=t[pr])!==undefined?!!r:v(t)=="RegExp")};var dr=function(t){if(hr(t)){throw TypeError("The method doesn't accept regular expressions")}return t};var gr=Bt("match");var yr=function(r){var e=/./;try{"/./"[r](e)}catch(t){try{e[gr]=false;return"/./"[r](e)}catch(t){}}return false};var mr="".startsWith;var br=Math.min;Rt({target:"String",proto:true,forced:!yr("startsWith")},{startsWith:function t(r){var e=String(g(this));dr(r);var n=vt(br(arguments.length>1?arguments[1]:undefined,e.length));var i=String(r);return mr?mr.call(e,i,n):e.slice(n,n+i.length)===i}});if(typeof window!=="undefined"){(function(){var n=function(t,r){var e=t.nodeType;if(e===3){r.push(t.textContent.replace(/&/,"&").replace(/</,"<").replace(">",">"))}else if(e===1){r.push("<",t.tagName);if(t.hasAttributes()){[].forEach.call(t.attributes,function(t){r.push(" ",t.item.name,"='",t.item.value,"'")})}if(t.hasChildNodes()){r.push(">");[].forEach.call(t.childNodes,function(t){n(t,r)});r.push("</",t.tagName,">")}else{r.push("/>")}}else if(e==8){r.push("\x3c!--",t.nodeValue,"--\x3e")}};Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var t=[];var r=this.firstChild;while(r){n(r,t);r=r.nextSibling}return t.join("")},set:function(t){while(this.firstChild){this.removeChild(this.firstChild)}try{var r=new DOMParser;r.async=false;var e="<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+t+"</svg>";var n=r.parseFromString(e,"text/xml").documentElement;var i=n.firstChild;while(i){this.appendChild(this.ownerDocument.importNode(i,true));i=i.nextSibling}}catch(t){}}});Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(t){this.innerHTML=t}})})()}}); | ||
(function(t){typeof define==="function"&&define.amd?define(t):t()})(function(){"use strict";var t=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function r(t,r){return r={exports:{}},t(r,r.exports),r.exports}var e=function(t){return t&&t.Math==Math&&t};var l=e(typeof globalThis=="object"&&globalThis)||e(typeof window=="object"&&window)||e(typeof self=="object"&&self)||e(typeof t=="object"&&t)||Function("return this")();var o=function(t){try{return!!t()}catch(t){return true}};var d=!o(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7});var n={}.propertyIsEnumerable;var i=Object.getOwnPropertyDescriptor;var a=i&&!n.call({1:2},1);var u=a?function t(r){var e=i(this,r);return!!e&&e.enumerable}:n;var p={f:u};var f=function(t,r){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:r}};var s={}.toString;var c=function(t){return s.call(t).slice(8,-1)};var v="".split;var _=o(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return c(t)=="String"?v.call(t,""):Object(t)}:Object;var h=function(t){if(t==undefined)throw TypeError("Can't call method on "+t);return t};var g=function(t){return _(h(t))};var y=function(t){return typeof t==="object"?t!==null:typeof t==="function"};var m=function(t,r){if(!y(t))return t;var e,n;if(r&&typeof(e=t.toString)=="function"&&!y(n=e.call(t)))return n;if(typeof(e=t.valueOf)=="function"&&!y(n=e.call(t)))return n;if(!r&&typeof(e=t.toString)=="function"&&!y(n=e.call(t)))return n;throw TypeError("Can't convert object to primitive value")};var b={}.hasOwnProperty;var w=function(t,r){return b.call(t,r)};var O=l.document;var S=y(O)&&y(O.createElement);var x=function(t){return S?O.createElement(t):{}};var j=!d&&!o(function(){return Object.defineProperty(x("div"),"a",{get:function(){return 7}}).a!=7});var C=Object.getOwnPropertyDescriptor;var E=d?C:function t(r,e){r=g(r);e=m(e,true);if(j)try{return C(r,e)}catch(t){}if(w(r,e))return f(!p.f.call(r,e),r[e])};var P={f:E};var T=function(t){if(!y(t)){throw TypeError(String(t)+" is not an object")}return t};var A=Object.defineProperty;var k=d?A:function t(r,e,n){T(r);e=m(e,true);T(n);if(j)try{return A(r,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");if("value"in n)r[e]=n.value;return r};var M={f:k};var I=d?function(t,r,e){return M.f(t,r,f(1,e))}:function(t,r,e){t[r]=e;return t};var R=function(r,e){try{I(l,r,e)}catch(t){l[r]=e}return e};var L="__core-js_shared__";var D=l[L]||R(L,{});var N=D;var q=Function.toString;if(typeof N.inspectSource!="function"){N.inspectSource=function(t){return q.call(t)}}var z=N.inspectSource;var F=l.WeakMap;var W=typeof F==="function"&&/native code/.test(z(F));var V=r(function(t){(t.exports=function(t,r){return N[t]||(N[t]=r!==undefined?r:{})})("versions",[]).push({version:"3.6.4",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})});var G=0;var B=Math.random();var H=function(t){return"Symbol("+String(t===undefined?"":t)+")_"+(++G+B).toString(36)};var K=V("keys");var X=function(t){return K[t]||(K[t]=H(t))};var Y={};var J=l.WeakMap;var Q,U,Z;var $=function(t){return Z(t)?U(t):Q(t,{})};var tt=function(e){return function(t){var r;if(!y(t)||(r=U(t)).type!==e){throw TypeError("Incompatible receiver, "+e+" required")}return r}};if(W){var rt=new J;var et=rt.get;var nt=rt.has;var it=rt.set;Q=function(t,r){it.call(rt,t,r);return r};U=function(t){return et.call(rt,t)||{}};Z=function(t){return nt.call(rt,t)}}else{var at=X("state");Y[at]=true;Q=function(t,r){I(t,at,r);return r};U=function(t){return w(t,at)?t[at]:{}};Z=function(t){return w(t,at)}}var ot={set:Q,get:U,has:Z,enforce:$,getterFor:tt};var ut=r(function(t){var r=ot.get;var u=ot.enforce;var f=String(String).split("String");(t.exports=function(t,r,e,n){var i=n?!!n.unsafe:false;var a=n?!!n.enumerable:false;var o=n?!!n.noTargetGet:false;if(typeof e=="function"){if(typeof r=="string"&&!w(e,"name"))I(e,"name",r);u(e).source=f.join(typeof r=="string"?r:"")}if(t===l){if(a)t[r]=e;else R(r,e);return}else if(!i){delete t[r]}else if(!o&&t[r]){a=true}if(a)t[r]=e;else I(t,r,e)})(Function.prototype,"toString",function t(){return typeof this=="function"&&r(this).source||z(this)})});var ft=l;var st=function(t){return typeof t=="function"?t:undefined};var ct=function(t,r){return arguments.length<2?st(ft[t])||st(l[t]):ft[t]&&ft[t][r]||l[t]&&l[t][r]};var lt=Math.ceil;var vt=Math.floor;var dt=function(t){return isNaN(t=+t)?0:(t>0?vt:lt)(t)};var pt=Math.min;var ht=function(t){return t>0?pt(dt(t),9007199254740991):0};var gt=Math.max;var yt=Math.min;var mt=function(t,r){var e=dt(t);return e<0?gt(e+r,0):yt(e,r)};var bt=function(u){return function(t,r,e){var n=g(t);var i=ht(n.length);var a=mt(e,i);var o;if(u&&r!=r)while(i>a){o=n[a++];if(o!=o)return true}else for(;i>a;a++){if((u||a in n)&&n[a]===r)return u||a||0}return!u&&-1}};var _t={includes:bt(true),indexOf:bt(false)};var wt=_t.indexOf;var Ot=function(t,r){var e=g(t);var n=0;var i=[];var a;for(a in e)!w(Y,a)&&w(e,a)&&i.push(a);while(r.length>n)if(w(e,a=r[n++])){~wt(i,a)||i.push(a)}return i};var St=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"];var xt=St.concat("length","prototype");var jt=Object.getOwnPropertyNames||function t(r){return Ot(r,xt)};var Ct={f:jt};var Et=Object.getOwnPropertySymbols;var Pt={f:Et};var Tt=ct("Reflect","ownKeys")||function t(r){var e=Ct.f(T(r));var n=Pt.f;return n?e.concat(n(r)):e};var At=function(t,r){var e=Tt(r);var n=M.f;var i=P.f;for(var a=0;a<e.length;a++){var o=e[a];if(!w(t,o))n(t,o,i(r,o))}};var kt=/#|\.prototype\./;var Mt=function(t,r){var e=Rt[It(t)];return e==Dt?true:e==Lt?false:typeof r=="function"?o(r):!!r};var It=Mt.normalize=function(t){return String(t).replace(kt,".").toLowerCase()};var Rt=Mt.data={};var Lt=Mt.NATIVE="N";var Dt=Mt.POLYFILL="P";var Nt=Mt;var qt=P.f;var zt=function(t,r){var e=t.target;var n=t.global;var i=t.stat;var a,o,u,f,s,c;if(n){o=l}else if(i){o=l[e]||R(e,{})}else{o=(l[e]||{}).prototype}if(o)for(u in r){s=r[u];if(t.noTargetGet){c=qt(o,u);f=c&&c.value}else f=o[u];a=Nt(n?u:e+(i?".":"#")+u,t.forced);if(!a&&f!==undefined){if(typeof s===typeof f)continue;At(s,f)}if(t.sham||f&&f.sham){I(s,"sham",true)}ut(o,u,s,t)}};var Ft=function(t){if(typeof t!="function"){throw TypeError(String(t)+" is not a function")}return t};var Wt=function(n,i,t){Ft(n);if(i===undefined)return n;switch(t){case 0:return function(){return n.call(i)};case 1:return function(t){return n.call(i,t)};case 2:return function(t,r){return n.call(i,t,r)};case 3:return function(t,r,e){return n.call(i,t,r,e)}}return function(){return n.apply(i,arguments)}};var Vt=function(t){return Object(h(t))};var Gt=Array.isArray||function t(r){return c(r)=="Array"};var Bt=!!Object.getOwnPropertySymbols&&!o(function(){return!String(Symbol())});var Ht=Bt&&!Symbol.sham&&typeof Symbol.iterator=="symbol";var Kt=V("wks");var Xt=l.Symbol;var Yt=Ht?Xt:Xt&&Xt.withoutSetter||H;var Jt=function(t){if(!w(Kt,t)){if(Bt&&w(Xt,t))Kt[t]=Xt[t];else Kt[t]=Yt("Symbol."+t)}return Kt[t]};var Qt=Jt("species");var Ut=function(t,r){var e;if(Gt(t)){e=t.constructor;if(typeof e=="function"&&(e===Array||Gt(e.prototype)))e=undefined;else if(y(e)){e=e[Qt];if(e===null)e=undefined}}return new(e===undefined?Array:e)(r===0?0:r)};var Zt=[].push;var $t=function(d){var p=d==1;var h=d==2;var g=d==3;var y=d==4;var m=d==6;var b=d==5||m;return function(t,r,e,n){var i=Vt(t);var a=_(i);var o=Wt(r,e,3);var u=ht(a.length);var f=0;var s=n||Ut;var c=p?s(t,u):h?s(t,0):undefined;var l,v;for(;u>f;f++)if(b||f in a){l=a[f];v=o(l,f,i);if(d){if(p)c[f]=v;else if(v)switch(d){case 3:return true;case 5:return l;case 6:return f;case 2:Zt.call(c,l)}else if(y)return false}}return m?-1:g||y?y:c}};var tr={forEach:$t(0),map:$t(1),filter:$t(2),some:$t(3),every:$t(4),find:$t(5),findIndex:$t(6)};var rr=Object.keys||function t(r){return Ot(r,St)};var er=d?Object.defineProperties:function t(r,e){T(r);var n=rr(e);var i=n.length;var a=0;var o;while(i>a)M.f(r,o=n[a++],e[o]);return r};var nr=ct("document","documentElement");var ir=">";var ar="<";var or="prototype";var ur="script";var fr=X("IE_PROTO");var sr=function(){};var cr=function(t){return ar+ur+ir+t+ar+"/"+ur+ir};var lr=function(t){t.write(cr(""));t.close();var r=t.parentWindow.Object;t=null;return r};var vr=function(){var t=x("iframe");var r="java"+ur+":";var e;t.style.display="none";nr.appendChild(t);t.src=String(r);e=t.contentWindow.document;e.open();e.write(cr("document.F=Object"));e.close();return e.F};var dr;var pr=function(){try{dr=document.domain&&new ActiveXObject("htmlfile")}catch(t){}pr=dr?lr(dr):vr();var t=St.length;while(t--)delete pr[or][St[t]];return pr()};Y[fr]=true;var hr=Object.create||function t(r,e){var n;if(r!==null){sr[or]=T(r);n=new sr;sr[or]=null;n[fr]=r}else n=pr();return e===undefined?n:er(n,e)};var gr=Jt("unscopables");var yr=Array.prototype;if(yr[gr]==undefined){M.f(yr,gr,{configurable:true,value:hr(null)})}var mr=function(t){yr[gr][t]=true};var br=Object.defineProperty;var _r={};var wr=function(t){throw t};var Or=function(t,r){if(w(_r,t))return _r[t];if(!r)r={};var e=[][t];var n=w(r,"ACCESSORS")?r.ACCESSORS:false;var i=w(r,0)?r[0]:wr;var a=w(r,1)?r[1]:undefined;return _r[t]=!!e&&!o(function(){if(n&&!d)return true;var t={length:-1};if(n)br(t,1,{enumerable:true,get:wr});else t[1]=1;e.call(t,i,a)})};var Sr=tr.find;var xr="find";var jr=true;var Cr=Or(xr);if(xr in[])Array(1)[xr](function(){jr=false});zt({target:"Array",proto:true,forced:jr||!Cr},{find:function t(r){return Sr(this,r,arguments.length>1?arguments[1]:undefined)}});mr(xr);var Er=_t.includes;var Pr=Or("indexOf",{ACCESSORS:true,1:0});zt({target:"Array",proto:true,forced:!Pr},{includes:function t(r){return Er(this,r,arguments.length>1?arguments[1]:undefined)}});mr("includes");var Tr=Object.assign;var Ar=Object.defineProperty;var kr=!Tr||o(function(){if(d&&Tr({b:1},Tr(Ar({},"a",{enumerable:true,get:function(){Ar(this,"b",{value:3,enumerable:false})}}),{b:2})).b!==1)return true;var t={};var r={};var e=Symbol();var n="abcdefghijklmnopqrst";t[e]=7;n.split("").forEach(function(t){r[t]=t});return Tr({},t)[e]!=7||rr(Tr({},r)).join("")!=n})?function t(r,e){var n=Vt(r);var i=arguments.length;var a=1;var o=Pt.f;var u=p.f;while(i>a){var f=_(arguments[a++]);var s=o?rr(f).concat(o(f)):rr(f);var c=s.length;var l=0;var v;while(c>l){v=s[l++];if(!d||u.call(f,v))n[v]=f[v]}}return n}:Tr;zt({target:"Object",stat:true,forced:Object.assign!==kr},{assign:kr});var Mr=Jt("match");var Ir=function(t){var r;return y(t)&&((r=t[Mr])!==undefined?!!r:c(t)=="RegExp")};var Rr=function(t){if(Ir(t)){throw TypeError("The method doesn't accept regular expressions")}return t};var Lr=Jt("match");var Dr=function(r){var e=/./;try{"/./"[r](e)}catch(t){try{e[Lr]=false;return"/./"[r](e)}catch(t){}}return false};zt({target:"String",proto:true,forced:!Dr("includes")},{includes:function t(r){return!!~String(h(this)).indexOf(Rr(r),arguments.length>1?arguments[1]:undefined)}});var Nr=P.f;var qr="".startsWith;var zr=Math.min;var Fr=Dr("startsWith");var Wr=!Fr&&!!function(){var t=Nr(String.prototype,"startsWith");return t&&!t.writable}();zt({target:"String",proto:true,forced:!Wr&&!Fr},{startsWith:function t(r){var e=String(h(this));Rr(r);var n=ht(zr(arguments.length>1?arguments[1]:undefined,e.length));var i=String(r);return qr?qr.call(e,i,n):e.slice(n,n+i.length)===i}});if(typeof window!=="undefined"){(function(){var n=function(t,r){var e=t.nodeType;if(e===3){r.push(t.textContent.replace(/&/,"&").replace(/</,"<").replace(">",">"))}else if(e===1){r.push("<",t.tagName);if(t.hasAttributes()){[].forEach.call(t.attributes,function(t){r.push(" ",t.item.name,"='",t.item.value,"'")})}if(t.hasChildNodes()){r.push(">");[].forEach.call(t.childNodes,function(t){n(t,r)});r.push("</",t.tagName,">")}else{r.push("/>")}}else if(e==8){r.push("\x3c!--",t.nodeValue,"--\x3e")}};Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var t=[];var r=this.firstChild;while(r){n(r,t);r=r.nextSibling}return t.join("")},set:function(t){while(this.firstChild){this.removeChild(this.firstChild)}try{var r=new DOMParser;r.async=false;var e="<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+t+"</svg>";var n=r.parseFromString(e,"text/xml").documentElement;var i=n.firstChild;while(i){this.appendChild(this.ownerDocument.importNode(i,true));i=i.nextSibling}}catch(t){}}});Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(t){this.innerHTML=t}})})()}});(function(t,r){typeof exports==="object"&&typeof module!=="undefined"?r(exports,require("d3-array"),require("d3-collection"),require("d3-scale"),require("d3plus-axis"),require("d3plus-common"),require("d3plus-shape"),require("d3plus-viz")):typeof define==="function"&&define.amd?define("d3plus-priestley",["exports","d3-array","d3-collection","d3-scale","d3plus-axis","d3plus-common","d3plus-shape","d3plus-viz"],r):(t=t||self,r(t.d3plus={},t.d3Array,t.d3Collection,t.d3Scale,t.d3plusAxis,t.d3plusCommon,t.d3plusShape,t.d3plusViz))})(this,function(t,g,y,m,b,_,w,r){"use strict";function e(t,r){if(!(t instanceof r)){throw new TypeError("Cannot call a class as a function")}}function n(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(t,n.key,n)}}function i(t,r,e){if(r)n(t.prototype,r);if(e)n(t,e);return t}function a(t,r){if(typeof r!=="function"&&r!==null){throw new TypeError("Super expression must either be null or a function")}t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:true,configurable:true}});if(r)o(t,r)}function O(t){O=Object.setPrototypeOf?Object.getPrototypeOf:function t(r){return r.__proto__||Object.getPrototypeOf(r)};return O(t)}function o(t,r){o=Object.setPrototypeOf||function t(r,e){r.__proto__=e;return r};return o(t,r)}function u(t){if(t===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function f(t,r){if(r&&(typeof r==="object"||typeof r==="function")){return r}return u(t)}function s(t,r){while(!Object.prototype.hasOwnProperty.call(t,r)){t=O(t);if(t===null)break}return t}function S(t,r,e){if(typeof Reflect!=="undefined"&&Reflect.get){S=Reflect.get}else{S=function t(r,e,n){var i=s(r,e);if(!i)return;var a=Object.getOwnPropertyDescriptor(i,e);if(a.get){return a.get.call(n)}return a.value}}return S(t,r,e||t)}var c=function(t){a(h,t);function h(){var n;e(this,h);n=f(this,O(h).call(this));n._axis=(new b.Axis).align("end").orient("bottom");n._axisConfig={scale:"time"};n._axisTest=(new b.Axis).align("end").gridSize(0).orient("bottom");n.end("end");n._paddingInner=.05;n._paddingOuter=.05;n._shapeConfig=_.assign({},n._shapeConfig,{ariaLabel:function t(r,e){return"".concat(n._drawLabel(r,e),", ").concat(n._start(r,e)," - ").concat(n._end(r,e),".")}});n.start("start");return n}i(h,[{key:"_draw",value:function t(r){var e=this;S(O(h.prototype),"_draw",this).call(this,r);if(!this._filteredData)return this;var n=this._filteredData.map(function(t,r){return{__d3plus__:true,data:t,end:e._axisConfig.scale==="time"?b.date(e._end(t,r)):e._end(t,r),i:r,id:e._id(t,r),start:e._axisConfig.scale==="time"?b.date(e._start(t,r)):e._start(t,r)}}).filter(function(t){return t.end-t.start>0}).sort(function(t,r){return t.start-r.start});var i;if(this._groupBy.length>1&&this._drawDepth>0){var a=y.nest();var o=function t(r){a.key(function(t){return e._groupBy[r](t.data,t.i)})};for(var u=0;u<this._drawDepth;u++){o(u)}i=a.entries(n)}else i=[{values:n}];var f=0;i.forEach(function(t){var e=[];t.values.forEach(function(r){e=e.map(function(t){return t<=r.start?false:t});var t=e.indexOf(false);if(t<0){r.lane=f+e.length;e.push(r.end)}else{e[t]=r.end;r.lane=f+t}});f+=e.length});var s={domain:[g.min(n,function(t){return t.start})||0,g.max(n,function(t){return t.end})||0],height:this._height-this._margin.top-this._margin.bottom,width:this._width-this._margin.left-this._margin.right};var c="translate(".concat(this._margin.left,", ").concat(this._margin.top,")");this._axisTest.config(s).config(this._axisConfig).select(_.elem("g.d3plus-priestley-axis-test",{parent:this._select,enter:{opacity:0}}).node()).render();this._axis.config(s).config(this._axisConfig).select(_.elem("g.d3plus-priestley-axis",{parent:this._select,enter:{transform:c},update:{transform:c}}).node()).render();var l=this._axisTest._padding;var v=this._axis._d3Scale;var d=m.scaleBand().domain(g.range(0,f,1)).paddingInner(this._paddingInner).paddingOuter(this._paddingOuter).rangeRound([this._height-this._margin.bottom-this._axisTest.outerBounds().height-l,this._margin.top+l]);var p=d.bandwidth();this._shapes.push((new w.Rect).data(n).duration(this._duration).height(p).label(function(t,r){return e._drawLabel(t.data,r)}).select(_.elem("g.d3plus-priestley-shapes",{parent:this._select}).node()).width(function(t){var r=Math.abs(v(t.end)-v(t.start));return r>2?r-2:r}).x(function(t){return v(t.start)+(v(t.end)-v(t.start))/2}).y(function(t){return d(t.lane)+p/2}).config(_.configPrep.bind(this)(this._shapeConfig,"shape","Rect")).render());return this}},{key:"axisConfig",value:function t(r){return arguments.length?(this._axisConfig=_.assign(this._axisConfig,r),this):this._axisConfig}},{key:"end",value:function t(r){if(arguments.length){if(typeof r==="function")this._end=r;else{this._end=_.accessor(r);if(!this._aggs[r])this._aggs[r]=function(t){return g.max(t)}}return this}else return this._end}},{key:"paddingInner",value:function t(r){return arguments.length?(this._paddingInner=r,this):this._paddingInner}},{key:"paddingOuter",value:function t(r){return arguments.length?(this._paddingOuter=r,this):this._paddingOuter}},{key:"start",value:function t(r){if(arguments.length){if(typeof r==="function")this._start=r;else{this._start=_.accessor(r);if(!this._aggs[r])this._aggs[r]=function(t){return g.min(t)}}return this}else return this._start}}]);return h}(r.Viz);t.Priestley=c;Object.defineProperty(t,"__esModule",{value:true})}); |
@@ -1,2 +0,2 @@ | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
@@ -29,3 +29,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import { nest } from "d3-collection"; | ||
import { scalePoint } from "d3-scale"; | ||
import { scaleBand } from "d3-scale"; | ||
import { Axis, date } from "d3plus-axis"; | ||
@@ -41,5 +41,3 @@ import { accessor, assign, configPrep, elem } from "d3plus-common"; | ||
var Priestley = | ||
/*#__PURE__*/ | ||
function (_Viz) { | ||
var Priestley = /*#__PURE__*/function (_Viz) { | ||
_inherits(Priestley, _Viz); | ||
@@ -66,2 +64,4 @@ | ||
_this._paddingInner = 0.05; | ||
_this._paddingOuter = 0.05; | ||
_this._shapeConfig = assign({}, _this._shapeConfig, { | ||
@@ -85,7 +85,7 @@ ariaLabel: function ariaLabel(d, i) { | ||
_createClass(Priestley, [{ | ||
key: "render", | ||
value: function render(callback) { | ||
key: "_draw", | ||
value: function _draw(callback) { | ||
var _this2 = this; | ||
_get(_getPrototypeOf(Priestley.prototype), "render", this).call(this, callback); | ||
_get(_getPrototypeOf(Priestley.prototype), "_draw", this).call(this, callback); | ||
@@ -178,6 +178,6 @@ if (!this._filteredData) return this; | ||
var xScale = this._axis._d3Scale; | ||
var yScale = scalePoint().domain(range(0, maxLane, 1)).padding(0.5).rangeRound([this._height - this._margin.bottom - this._axisTest.outerBounds().height - axisPad, this._margin.top + axisPad]); | ||
var step = yScale.step(); | ||
var yScale = scaleBand().domain(range(0, maxLane, 1)).paddingInner(this._paddingInner).paddingOuter(this._paddingOuter).rangeRound([this._height - this._margin.bottom - this._axisTest.outerBounds().height - axisPad, this._margin.top + axisPad]); | ||
var bandWidth = yScale.bandwidth(); | ||
this._shapes.push(new Rect().data(data).duration(this._duration).height(step >= this._padding * 2 ? step - this._padding : step > 2 ? step - 2 : step).label(function (d, i) { | ||
this._shapes.push(new Rect().data(data).duration(this._duration).height(bandWidth).label(function (d, i) { | ||
return _this2._drawLabel(d.data, i); | ||
@@ -192,3 +192,3 @@ }).select(elem("g.d3plus-priestley-shapes", { | ||
}).y(function (d) { | ||
return yScale(d.lane); | ||
return yScale(d.lane) + bandWidth / 2; | ||
}).config(configPrep.bind(this)(this._shapeConfig, "shape", "Rect")).render()); | ||
@@ -232,2 +232,26 @@ | ||
@memberof Priestley | ||
@desc Sets the [paddingInner](https://github.com/d3/d3-scale#band_paddingInner) value of the underlining [Band Scale](https://github.com/d3/d3-scale#band-scales) used to determine the height of each bar. Values should be a ratio between 0 and 1 representing the space in between each rectangle. | ||
@param {Number} [*value* = 0.05] | ||
@chainable | ||
*/ | ||
}, { | ||
key: "paddingInner", | ||
value: function paddingInner(_) { | ||
return arguments.length ? (this._paddingInner = _, this) : this._paddingInner; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc Sets the [paddingOuter](https://github.com/d3/d3-scale#band_paddingOuter) value of the underlining [Band Scale](https://github.com/d3/d3-scale#band-scales) used to determine the height of each bar. Values should be a ratio between 0 and 1 representing the space around the outer rectangles. | ||
@param {Number} [*value* = 0.05] | ||
@chainable | ||
*/ | ||
}, { | ||
key: "paddingOuter", | ||
value: function paddingOuter(_) { | ||
return arguments.length ? (this._paddingOuter = _, this) : this._paddingOuter; | ||
} | ||
/** | ||
@memberof Priestley | ||
@desc If *value* is specified, sets the start accessor to the specified function or key and returns the current class instance. If *value* is not specified, returns the current start accessor. | ||
@@ -234,0 +258,0 @@ @param {Function|String} [*value*] |
{ | ||
"name": "d3plus-priestley", | ||
"version": "0.3.4", | ||
"version": "0.3.5", | ||
"description": "A reusable Priestley timeline built on D3.", | ||
@@ -30,6 +30,6 @@ "main": "build/d3plus-priestley.js", | ||
"d3-scale": "^2.1.2", | ||
"d3plus-axis": "^0.4.10", | ||
"d3plus-common": "^0.6.51", | ||
"d3plus-shape": "^0.16.10", | ||
"d3plus-viz": "^0.12.35" | ||
"d3plus-axis": "^0.4.18", | ||
"d3plus-common": "^0.6.60", | ||
"d3plus-shape": "^0.16.13", | ||
"d3plus-viz": "^0.12.50" | ||
}, | ||
@@ -46,3 +46,3 @@ "scripts": { | ||
"devDependencies": { | ||
"d3plus-dev": "^0.7.2" | ||
"d3plus-dev": "^0.7.4" | ||
}, | ||
@@ -49,0 +49,0 @@ "module": "es/index", |
@@ -64,2 +64,4 @@ # d3plus-priestley | ||
* [.end([*value*])](#Priestley.end) ↩︎ | ||
* [.paddingInner([*value*])](#Priestley.paddingInner) ↩︎ | ||
* [.paddingOuter([*value*])](#Priestley.paddingOuter) ↩︎ | ||
* [.start([*value*])](#Priestley.start) ↩︎ | ||
@@ -76,3 +78,3 @@ | ||
<a name="Priestley.axisConfig" href="#Priestley.axisConfig">#</a> Priestley.**axisConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-priestley/blob/master/src/Priestley.js#L144) | ||
<a name="Priestley.axisConfig" href="#Priestley.axisConfig">#</a> Priestley.**axisConfig**([*value*]) [<>](https://github.com/d3plus/d3plus-priestley/blob/master/src/Priestley.js#L147) | ||
@@ -85,3 +87,3 @@ If *value* is specified, sets the config method for the axis and returns the current class instance. If *value* is not specified, returns the current axis configuration. | ||
<a name="Priestley.end" href="#Priestley.end">#</a> Priestley.**end**([*value*]) [<>](https://github.com/d3plus/d3plus-priestley/blob/master/src/Priestley.js#L154) | ||
<a name="Priestley.end" href="#Priestley.end">#</a> Priestley.**end**([*value*]) [<>](https://github.com/d3plus/d3plus-priestley/blob/master/src/Priestley.js#L157) | ||
@@ -94,4 +96,20 @@ If *value* is specified, sets the end accessor to the specified function or key and returns the current class instance. If *value* is not specified, returns the current end accessor. | ||
<a name="Priestley.start" href="#Priestley.start">#</a> Priestley.**start**([*value*]) [<>](https://github.com/d3plus/d3plus-priestley/blob/master/src/Priestley.js#L172) | ||
<a name="Priestley.paddingInner" href="#Priestley.paddingInner">#</a> Priestley.**paddingInner**([*value*]) [<>](https://github.com/d3plus/d3plus-priestley/blob/master/src/Priestley.js#L175) | ||
Sets the [paddingInner](https://github.com/d3/d3-scale#band_paddingInner) value of the underlining [Band Scale](https://github.com/d3/d3-scale#band-scales) used to determine the height of each bar. Values should be a ratio between 0 and 1 representing the space in between each rectangle. | ||
This is a static method of [<code>Priestley</code>](#Priestley), and is chainable with other methods of this Class. | ||
<a name="Priestley.paddingOuter" href="#Priestley.paddingOuter">#</a> Priestley.**paddingOuter**([*value*]) [<>](https://github.com/d3plus/d3plus-priestley/blob/master/src/Priestley.js#L185) | ||
Sets the [paddingOuter](https://github.com/d3/d3-scale#band_paddingOuter) value of the underlining [Band Scale](https://github.com/d3/d3-scale#band-scales) used to determine the height of each bar. Values should be a ratio between 0 and 1 representing the space around the outer rectangles. | ||
This is a static method of [<code>Priestley</code>](#Priestley), and is chainable with other methods of this Class. | ||
<a name="Priestley.start" href="#Priestley.start">#</a> Priestley.**start**([*value*]) [<>](https://github.com/d3plus/d3plus-priestley/blob/master/src/Priestley.js#L195) | ||
If *value* is specified, sets the start accessor to the specified function or key and returns the current class instance. If *value* is not specified, returns the current start accessor. | ||
@@ -106,2 +124,2 @@ | ||
###### <sub>Documentation generated on Thu, 11 Jul 2019 13:27:46 GMT</sub> | ||
###### <sub>Documentation generated on Tue, 03 Mar 2020 17:19:17 GMT</sub> |
Sorry, the diff of this file is not supported yet
99313
1409
121
Updatedd3plus-axis@^0.4.18
Updatedd3plus-common@^0.6.60
Updatedd3plus-shape@^0.16.13
Updatedd3plus-viz@^0.12.50