216 lines
117 KiB
JavaScript
216 lines
117 KiB
JavaScript
/*
|
||
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
||
* This devtool is neither made for production nor for readable output files.
|
||
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
||
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
||
* or disable the default devtool with "devtool: false".
|
||
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
||
*/
|
||
/******/ (() => { // webpackBootstrap
|
||
/******/ var __webpack_modules__ = ({
|
||
|
||
/***/ "./node_modules/natural-orderby/esm/natural-orderby.js":
|
||
/*!*************************************************************!*\
|
||
!*** ./node_modules/natural-orderby/esm/natural-orderby.js ***!
|
||
\*************************************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"orderBy\": () => (/* binding */ orderBy),\n/* harmony export */ \"compare\": () => (/* binding */ compare)\n/* harmony export */ });\nvar compareNumbers = function compareNumbers(numberA, numberB) {\n if (numberA < numberB) {\n return -1;\n }\n\n if (numberA > numberB) {\n return 1;\n }\n\n return 0;\n};\n\nvar RE_NUMBERS = /(^0x[\\da-fA-F]+$|^([+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?(?!\\.\\d+)(?=\\D|\\s|$))|\\d+)/g;\nvar RE_LEADING_OR_TRAILING_WHITESPACES = /^\\s+|\\s+$/g; // trim pre-post whitespace\n\nvar RE_WHITESPACES = /\\s+/g; // normalize all whitespace to single ' ' character\n\nvar RE_INT_OR_FLOAT = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/; // identify integers and floats\n\nvar RE_DATE = /(^([\\w ]+,?[\\w ]+)?[\\w ]+,?[\\w ]+\\d+:\\d+(:\\d+)?[\\w ]?|^\\d{1,4}[/-]\\d{1,4}[/-]\\d{1,4}|^\\w+, \\w+ \\d+, \\d{4})/; // identify date strings\n\nvar RE_LEADING_ZERO = /^0+[1-9]{1}[0-9]*$/;\nvar RE_UNICODE_CHARACTERS = /[^\\x00-\\x80]/;\n\nvar compareUnicode = function compareUnicode(stringA, stringB) {\n var result = stringA.localeCompare(stringB);\n return result ? result / Math.abs(result) : 0;\n};\n\nvar stringCompare = function stringCompare(stringA, stringB) {\n if (stringA < stringB) {\n return -1;\n }\n\n if (stringA > stringB) {\n return 1;\n }\n\n return 0;\n};\n\nvar compareChunks = function compareChunks(chunksA, chunksB) {\n var lengthA = chunksA.length;\n var lengthB = chunksB.length;\n var size = Math.min(lengthA, lengthB);\n\n for (var i = 0; i < size; i++) {\n var chunkA = chunksA[i];\n var chunkB = chunksB[i];\n\n if (chunkA.normalizedString !== chunkB.normalizedString) {\n if (chunkA.normalizedString === '' !== (chunkB.normalizedString === '')) {\n // empty strings have lowest value\n return chunkA.normalizedString === '' ? -1 : 1;\n }\n\n if (chunkA.parsedNumber !== undefined && chunkB.parsedNumber !== undefined) {\n // compare numbers\n var result = compareNumbers(chunkA.parsedNumber, chunkB.parsedNumber);\n\n if (result === 0) {\n // compare string value, if parsed numbers are equal\n // Example:\n // chunkA = { parsedNumber: 1, normalizedString: \"001\" }\n // chunkB = { parsedNumber: 1, normalizedString: \"01\" }\n // chunkA.parsedNumber === chunkB.parsedNumber\n // chunkA.normalizedString < chunkB.normalizedString\n return stringCompare(chunkA.normalizedString, chunkB.normalizedString);\n }\n\n return result;\n } else if (chunkA.parsedNumber !== undefined || chunkB.parsedNumber !== undefined) {\n // number < string\n return chunkA.parsedNumber !== undefined ? -1 : 1;\n } else if (RE_UNICODE_CHARACTERS.test(chunkA.normalizedString + chunkB.normalizedString) && chunkA.normalizedString.localeCompare) {\n // use locale comparison only if one of the chunks contains unicode characters\n return compareUnicode(chunkA.normalizedString, chunkB.normalizedString);\n } else {\n // use common string comparison for performance reason\n return stringCompare(chunkA.normalizedString, chunkB.normalizedString);\n }\n }\n } // if the chunks are equal so far, the one which has more chunks is greater than the other one\n\n\n if (lengthA > size || lengthB > size) {\n return lengthA <= size ? -1 : 1;\n }\n\n return 0;\n};\n\nvar compareOtherTypes = function compareOtherTypes(valueA, valueB) {\n if (!valueA.chunks ? valueB.chunks : !valueB.chunks) {\n return !valueA.chunks ? 1 : -1;\n }\n\n if (valueA.isNaN ? !valueB.isNaN : valueB.isNaN) {\n return valueA.isNaN ? -1 : 1;\n }\n\n if (valueA.isSymbol ? !valueB.isSymbol : valueB.isSymbol) {\n return valueA.isSymbol ? -1 : 1;\n }\n\n if (valueA.isObject ? !valueB.isObject : valueB.isObject) {\n return valueA.isObject ? -1 : 1;\n }\n\n if (valueA.isArray ? !valueB.isArray : valueB.isArray) {\n return valueA.isArray ? -1 : 1;\n }\n\n if (valueA.isFunction ? !valueB.isFunction : valueB.isFunction) {\n return valueA.isFunction ? -1 : 1;\n }\n\n if (valueA.isNull ? !valueB.isNull : valueB.isNull) {\n return valueA.isNull ? -1 : 1;\n }\n\n return 0;\n};\n\nvar compareValues = function compareValues(valueA, valueB) {\n if (valueA.value === valueB.value) {\n return 0;\n }\n\n if (valueA.parsedNumber !== undefined && valueB.parsedNumber !== undefined) {\n return compareNumbers(valueA.parsedNumber, valueB.parsedNumber);\n }\n\n if (valueA.chunks && valueB.chunks) {\n return compareChunks(valueA.chunks, valueB.chunks);\n }\n\n return compareOtherTypes(valueA, valueB);\n};\n\nvar compareMultiple = function compareMultiple(recordA, recordB, orders) {\n var indexA = recordA.index,\n valuesA = recordA.values;\n var indexB = recordB.index,\n valuesB = recordB.values;\n var length = valuesA.length;\n var ordersLength = orders.length;\n\n for (var i = 0; i < length; i++) {\n var order = i < ordersLength ? orders[i] : null;\n\n if (order && typeof order === 'function') {\n var result = order(valuesA[i].value, valuesB[i].value);\n\n if (result) {\n return result;\n }\n } else {\n var _result = compareValues(valuesA[i], valuesB[i]);\n\n if (_result) {\n return _result * (order === 'desc' ? -1 : 1);\n }\n }\n }\n\n return indexA - indexB;\n};\n\nvar createIdentifierFn = function createIdentifierFn(identifier) {\n if (typeof identifier === 'function') {\n // identifier is already a lookup function\n return identifier;\n }\n\n return function (value) {\n if (Array.isArray(value)) {\n var index = Number(identifier);\n\n if (Number.isInteger(index)) {\n return value[index];\n }\n } else if (value && typeof value === 'object' && typeof identifier !== 'function') {\n return value[identifier];\n }\n\n return value;\n };\n};\n\nvar stringify = function stringify(value) {\n if (typeof value === 'boolean' || value instanceof Boolean) {\n return Number(value).toString();\n }\n\n if (typeof value === 'number' || value instanceof Number) {\n return value.toString();\n }\n\n if (value instanceof Date) {\n return value.getTime().toString();\n }\n\n if (typeof value === 'string' || value instanceof String) {\n return value.toLowerCase().replace(RE_LEADING_OR_TRAILING_WHITESPACES, '');\n }\n\n return '';\n};\n\nvar parseNumber = function parseNumber(value) {\n if (value.length !== 0) {\n var parsedNumber = Number(value);\n\n if (!Number.isNaN(parsedNumber)) {\n return parsedNumber;\n }\n }\n\n return undefined;\n};\n\nvar parseDate = function parseDate(value) {\n if (RE_DATE.test(value)) {\n var parsedDate = Date.parse(value);\n\n if (!Number.isNaN(parsedDate)) {\n return parsedDate;\n }\n }\n\n return undefined;\n};\n\nvar numberify = function numberify(value) {\n var parsedNumber = parseNumber(value);\n\n if (parsedNumber !== undefined) {\n return parsedNumber;\n }\n\n return parseDate(value);\n};\n\nvar createChunks = function createChunks(value) {\n return value.replace(RE_NUMBERS, '\\0$1\\0').replace(/\\0$/, '').replace(/^\\0/, '').split('\\0');\n};\n\nvar normalizeAlphaChunk = function normalizeAlphaChunk(chunk) {\n return chunk.replace(RE_WHITESPACES, ' ').replace(RE_LEADING_OR_TRAILING_WHITESPACES, '');\n};\n\nvar normalizeNumericChunk = function normalizeNumericChunk(chunk, index, chunks) {\n if (RE_INT_OR_FLOAT.test(chunk)) {\n // don´t parse a number, if there´s a preceding decimal point\n // to keep significance\n // e.g. 1.0020, 1.020\n if (!RE_LEADING_ZERO.test(chunk) || index === 0 || chunks[index - 1] !== '.') {\n return parseNumber(chunk) || 0;\n }\n }\n\n return undefined;\n};\n\nvar createChunkMap = function createChunkMap(chunk, index, chunks) {\n return {\n parsedNumber: normalizeNumericChunk(chunk, index, chunks),\n normalizedString: normalizeAlphaChunk(chunk)\n };\n};\n\nvar createChunkMaps = function createChunkMaps(value) {\n var chunksMaps = createChunks(value).map(createChunkMap);\n return chunksMaps;\n};\n\nvar isFunction = function isFunction(value) {\n return typeof value === 'function';\n};\n\nvar isNaN = function isNaN(value) {\n return Number.isNaN(value) || value instanceof Number && Number.isNaN(value.valueOf());\n};\n\nvar isNull = function isNull(value) {\n return value === null;\n};\n\nvar isObject = function isObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Number) && !(value instanceof String) && !(value instanceof Boolean) && !(value instanceof Date);\n};\n\nvar isSymbol = function isSymbol(value) {\n return typeof value === 'symbol';\n};\n\nvar isUndefined = function isUndefined(value) {\n return value === undefined;\n};\n\nvar getMappedValueRecord = function getMappedValueRecord(value) {\n if (typeof value === 'string' || value instanceof String || (typeof value === 'number' || value instanceof Number) && !isNaN(value) || typeof value === 'boolean' || value instanceof Boolean || value instanceof Date) {\n var stringValue = stringify(value);\n var parsedNumber = numberify(stringValue);\n var chunks = createChunkMaps(parsedNumber ? \"\" + parsedNumber : stringValue);\n return {\n parsedNumber: parsedNumber,\n chunks: chunks,\n value: value\n };\n }\n\n return {\n isArray: Array.isArray(value),\n isFunction: isFunction(value),\n isNaN: isNaN(value),\n isNull: isNull(value),\n isObject: isObject(value),\n isSymbol: isSymbol(value),\n isUndefined: isUndefined(value),\n value: value\n };\n};\n\nvar getValueByIdentifier = function getValueByIdentifier(value, getValue) {\n return getValue(value);\n};\n\nvar getElementByIndex = function getElementByIndex(collection, index) {\n return collection[index];\n};\n\nvar baseOrderBy = function baseOrderBy(collection, identifiers, orders) {\n var identifierFns = identifiers.length ? identifiers.map(createIdentifierFn) : [function (value) {\n return value;\n }]; // temporary array holds elements with position and sort-values\n\n var mappedCollection = collection.map(function (element, index) {\n var values = identifierFns.map(function (identifier) {\n return getValueByIdentifier(element, identifier);\n }).map(getMappedValueRecord);\n return {\n index: index,\n values: values\n };\n }); // iterate over values and compare values until a != b or last value reached\n\n mappedCollection.sort(function (recordA, recordB) {\n return compareMultiple(recordA, recordB, orders);\n });\n return mappedCollection.map(function (element) {\n return getElementByIndex(collection, element.index);\n });\n};\n\nvar getIdentifiers = function getIdentifiers(identifiers) {\n if (!identifiers) {\n return [];\n }\n\n var identifierList = !Array.isArray(identifiers) ? [identifiers] : [].concat(identifiers);\n\n if (identifierList.some(function (identifier) {\n return typeof identifier !== 'string' && typeof identifier !== 'number' && typeof identifier !== 'function';\n })) {\n return [];\n }\n\n return identifierList;\n};\n\nvar getOrders = function getOrders(orders) {\n if (!orders) {\n return [];\n }\n\n var orderList = !Array.isArray(orders) ? [orders] : [].concat(orders);\n\n if (orderList.some(function (order) {\n return order !== 'asc' && order !== 'desc' && typeof order !== 'function';\n })) {\n return [];\n }\n\n return orderList;\n};\n\n/**\n * Creates an array of elements, natural sorted by specified identifiers and\n * the corresponding sort orders. This method implements a stable sort\n * algorithm, which means the original sort order of equal elements is\n * preserved.\n *\n * If `collection` is an array of primitives, `identifiers` may be unspecified.\n * Otherwise, you should specify `identifiers` to sort by or `collection` will\n * be returned unsorted. An identifier can expressed by:\n *\n * - an index position, if `collection` is a nested array,\n * - a property name, if `collection` is an array of objects,\n * - a function which returns a particular value from an element of a nested array or an array of objects. This function will be invoked by passing one element of `collection`.\n *\n * If `orders` is unspecified, all values are sorted in ascending order.\n * Otherwise, specify an order of `'desc'` for descending or `'asc'` for\n * ascending sort order of corresponding values. You may also specify a compare\n * function for an order, which will be invoked by two arguments:\n * `(valueA, valueB)`. It must return a number representing the sort order.\n *\n * @example\n *\n * import { orderBy } from 'natural-orderby';\n *\n * const users = [\n * {\n * username: 'Bamm-Bamm',\n * ip: '192.168.5.2',\n * datetime: 'Fri Jun 15 2018 16:48:00 GMT+0200 (CEST)'\n * },\n * {\n * username: 'Wilma',\n * ip: '192.168.10.1',\n * datetime: '14 Jun 2018 00:00:00 PDT'\n * },\n * {\n * username: 'dino',\n * ip: '192.168.0.2',\n * datetime: 'June 15, 2018 14:48:00'\n * },\n * {\n * username: 'Barney',\n * ip: '192.168.1.1',\n * datetime: 'Thu, 14 Jun 2018 07:00:00 GMT'\n * },\n * {\n * username: 'Pebbles',\n * ip: '192.168.1.21',\n * datetime: '15 June 2018 14:48 UTC'\n * },\n * {\n * username: 'Hoppy',\n * ip: '192.168.5.10',\n * datetime: '2018-06-15T14:48:00.000Z'\n * },\n * ];\n *\n * orderBy(\n * users,\n * [v => v.datetime, v => v.ip],\n * ['desc', 'asc']\n * );\n *\n * // => [\n * // {\n * // username: 'dino',\n * // ip: '192.168.0.2',\n * // datetime: 'June 15, 2018 14:48:00',\n * // },\n * // {\n * // username: 'Pebbles',\n * // ip: '192.168.1.21',\n * // datetime: '15 June 2018 14:48 UTC',\n * // },\n * // {\n * // username: 'Bamm-Bamm',\n * // ip: '192.168.5.2',\n * // datetime: 'Fri Jun 15 2018 16:48:00 GMT+0200 (CEST)',\n * // },\n * // {\n * // username: 'Hoppy',\n * // ip: '192.168.5.10',\n * // datetime: '2018-06-15T14:48:00.000Z',\n * // },\n * // {\n * // username: 'Barney',\n * // ip: '192.168.1.1',\n * // datetime: 'Thu, 14 Jun 2018 07:00:00 GMT',\n * // },\n * // {\n * // username: 'Wilma',\n * // ip: '192.168.10.1',\n * // datetime: '14 Jun 2018 00:00:00 PDT',\n * // },\n * // ]\n */\nfunction orderBy(collection, identifiers, orders) {\n if (!collection || !Array.isArray(collection)) {\n return [];\n }\n\n var validatedIdentifiers = getIdentifiers(identifiers);\n var validatedOrders = getOrders(orders);\n return baseOrderBy(collection, validatedIdentifiers, validatedOrders);\n}\n\nvar baseCompare = function baseCompare(options) {\n return function (valueA, valueB) {\n var a = getMappedValueRecord(valueA);\n var b = getMappedValueRecord(valueB);\n var result = compareValues(a, b);\n return result * (options.order === 'desc' ? -1 : 1);\n };\n};\n\nvar isValidOrder = function isValidOrder(value) {\n return typeof value === 'string' && (value === 'asc' || value === 'desc');\n};\n\nvar getOptions = function getOptions(customOptions) {\n var order = 'asc';\n\n if (typeof customOptions === 'string' && isValidOrder(customOptions)) {\n order = customOptions;\n } else if (customOptions && typeof customOptions === 'object' && customOptions.order && isValidOrder(customOptions.order)) {\n order = customOptions.order;\n }\n\n return {\n order: order\n };\n};\n\n/**\n * Creates a compare function that defines the natural sort order considering\n * the given `options` which may be passed to [`Array.prototype.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort).\n *\n * If `options` or its property `order` is unspecified, values are sorted in\n * ascending sort order. Otherwise, specify an order of `'desc'` for descending\n * or `'asc'` for ascending sort order of values.\n *\n * @example\n *\n * import { compare } from 'natural-orderby';\n *\n * const users = [\n * {\n * username: 'Bamm-Bamm',\n * lastLogin: {\n * ip: '192.168.5.2',\n * datetime: 'Fri Jun 15 2018 16:48:00 GMT+0200 (CEST)'\n * },\n * },\n * {\n * username: 'Wilma',\n * lastLogin: {\n * ip: '192.168.10.1',\n * datetime: '14 Jun 2018 00:00:00 PDT'\n * },\n * },\n * {\n * username: 'dino',\n * lastLogin: {\n * ip: '192.168.0.2',\n * datetime: 'June 15, 2018 14:48:00'\n * },\n * },\n * {\n * username: 'Barney',\n * lastLogin: {\n * ip: '192.168.1.1',\n * datetime: 'Thu, 14 Jun 2018 07:00:00 GMT'\n * },\n * },\n * {\n * username: 'Pebbles',\n * lastLogin: {\n * ip: '192.168.1.21',\n * datetime: '15 June 2018 14:48 UTC'\n * },\n * },\n * {\n * username: 'Hoppy',\n * lastLogin: {\n * ip: '192.168.5.10',\n * datetime: '2018-06-15T14:48:00.000Z'\n * },\n * },\n * ];\n *\n * users.sort((a, b) => compare()(a.ip, b.ip));\n *\n * // => [\n * // {\n * // username: 'dino',\n * // ip: '192.168.0.2',\n * // datetime: 'June 15, 2018 14:48:00'\n * // },\n * // {\n * // username: 'Barney',\n * // ip: '192.168.1.1',\n * // datetime: 'Thu, 14 Jun 2018 07:00:00 GMT'\n * // },\n * // {\n * // username: 'Pebbles',\n * // ip: '192.168.1.21',\n * // datetime: '15 June 2018 14:48 UTC'\n * // },\n * // {\n * // username: 'Bamm-Bamm',\n * // ip: '192.168.5.2',\n * // datetime: 'Fri Jun 15 2018 16:48:00 GMT+0200 (CEST)'\n * // },\n * // {\n * // username: 'Hoppy',\n * // ip: '192.168.5.10',\n * // datetime: '2018-06-15T14:48:00.000Z'\n * // },\n * // {\n * // username: 'Wilma',\n * // ip: '192.168.10.1',\n * // datetime: '14 Jun 2018 00:00:00 PDT'\n * // }\n * // ]\n */\nfunction compare(options) {\n var validatedOptions = getOptions(options);\n return baseCompare(validatedOptions);\n}\n\n/*\n* Javascript natural sort algorithm with unicode support\n* based on chunking idea by Dave Koelle\n*\n* https://github.com/yobacca/natural-sort-order\n* released under MIT License\n*/\n\n\n\n\n//# sourceURL=webpack://freedatas2html/./node_modules/natural-orderby/esm/natural-orderby.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./node_modules/papaparse/papaparse.min.js":
|
||
/*!*************************************************!*\
|
||
!*** ./node_modules/papaparse/papaparse.min.js ***!
|
||
\*************************************************/
|
||
/***/ (function(module, exports) {
|
||
|
||
eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* @license\nPapa Parse\nv5.3.1\nhttps://github.com/mholt/PapaParse\nLicense: MIT\n*/\n!function(e,t){ true?!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (t),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):0}(this,function s(){\"use strict\";var f=\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:void 0!==f?f:{};var n=!f.document&&!!f.postMessage,o=n&&/blob:/i.test((f.location||{}).protocol),a={},h=0,b={parse:function(e,t){var i=(t=t||{}).dynamicTyping||!1;M(i)&&(t.dynamicTypingFunction=i,i={});if(t.dynamicTyping=i,t.transform=!!M(t.transform)&&t.transform,t.worker&&b.WORKERS_SUPPORTED){var r=function(){if(!b.WORKERS_SUPPORTED)return!1;var e=(i=f.URL||f.webkitURL||null,r=s.toString(),b.BLOB_URL||(b.BLOB_URL=i.createObjectURL(new Blob([\"(\",r,\")();\"],{type:\"text/javascript\"})))),t=new f.Worker(e);var i,r;return t.onmessage=_,t.id=h++,a[t.id]=t}();return r.userStep=t.step,r.userChunk=t.chunk,r.userComplete=t.complete,r.userError=t.error,t.step=M(t.step),t.chunk=M(t.chunk),t.complete=M(t.complete),t.error=M(t.error),delete t.worker,void r.postMessage({input:e,config:t,workerId:r.id})}var n=null;b.NODE_STREAM_INPUT,\"string\"==typeof e?n=t.download?new l(t):new p(t):!0===e.readable&&M(e.read)&&M(e.on)?n=new g(t):(f.File&&e instanceof File||e instanceof Object)&&(n=new c(t));return n.stream(e)},unparse:function(e,t){var n=!1,_=!0,m=\",\",y=\"\\r\\n\",s='\"',a=s+s,i=!1,r=null,o=!1;!function(){if(\"object\"!=typeof t)return;\"string\"!=typeof t.delimiter||b.BAD_DELIMITERS.filter(function(e){return-1!==t.delimiter.indexOf(e)}).length||(m=t.delimiter);(\"boolean\"==typeof t.quotes||\"function\"==typeof t.quotes||Array.isArray(t.quotes))&&(n=t.quotes);\"boolean\"!=typeof t.skipEmptyLines&&\"string\"!=typeof t.skipEmptyLines||(i=t.skipEmptyLines);\"string\"==typeof t.newline&&(y=t.newline);\"string\"==typeof t.quoteChar&&(s=t.quoteChar);\"boolean\"==typeof t.header&&(_=t.header);if(Array.isArray(t.columns)){if(0===t.columns.length)throw new Error(\"Option columns is empty\");r=t.columns}void 0!==t.escapeChar&&(a=t.escapeChar+s);\"boolean\"==typeof t.escapeFormulae&&(o=t.escapeFormulae)}();var h=new RegExp(j(s),\"g\");\"string\"==typeof e&&(e=JSON.parse(e));if(Array.isArray(e)){if(!e.length||Array.isArray(e[0]))return u(null,e,i);if(\"object\"==typeof e[0])return u(r||Object.keys(e[0]),e,i)}else if(\"object\"==typeof e)return\"string\"==typeof e.data&&(e.data=JSON.parse(e.data)),Array.isArray(e.data)&&(e.fields||(e.fields=e.meta&&e.meta.fields),e.fields||(e.fields=Array.isArray(e.data[0])?e.fields:\"object\"==typeof e.data[0]?Object.keys(e.data[0]):[]),Array.isArray(e.data[0])||\"object\"==typeof e.data[0]||(e.data=[e.data])),u(e.fields||[],e.data||[],i);throw new Error(\"Unable to serialize unrecognized input\");function u(e,t,i){var r=\"\";\"string\"==typeof e&&(e=JSON.parse(e)),\"string\"==typeof t&&(t=JSON.parse(t));var n=Array.isArray(e)&&0<e.length,s=!Array.isArray(t[0]);if(n&&_){for(var a=0;a<e.length;a++)0<a&&(r+=m),r+=v(e[a],a);0<t.length&&(r+=y)}for(var o=0;o<t.length;o++){var h=n?e.length:t[o].length,u=!1,f=n?0===Object.keys(t[o]).length:0===t[o].length;if(i&&!n&&(u=\"greedy\"===i?\"\"===t[o].join(\"\").trim():1===t[o].length&&0===t[o][0].length),\"greedy\"===i&&n){for(var d=[],l=0;l<h;l++){var c=s?e[l]:l;d.push(t[o][c])}u=\"\"===d.join(\"\").trim()}if(!u){for(var p=0;p<h;p++){0<p&&!f&&(r+=m);var g=n&&s?e[p]:p;r+=v(t[o][g],p)}o<t.length-1&&(!i||0<h&&!f)&&(r+=y)}}return r}function v(e,t){if(null==e)return\"\";if(e.constructor===Date)return JSON.stringify(e).slice(1,25);!0===o&&\"string\"==typeof e&&null!==e.match(/^[=+\\-@].*$/)&&(e=\"'\"+e);var i=e.toString().replace(h,a),r=\"boolean\"==typeof n&&n||\"function\"==typeof n&&n(e,t)||Array.isArray(n)&&n[t]||function(e,t){for(var i=0;i<t.length;i++)if(-1<e.indexOf(t[i]))return!0;return!1}(i,b.BAD_DELIMITERS)||-1<i.indexOf(m)||\" \"===i.charAt(0)||\" \"===i.charAt(i.length-1);return r?s+i+s:i}}};if(b.RECORD_SEP=String.fromCharCode(30),b.UNIT_SEP=String.fromCharCode(31),b.BYTE_ORDER_MARK=\"\\ufeff\",b.BAD_DELIMITERS=[\"\\r\",\"\\n\",'\"',b.BYTE_ORDER_MARK],b.WORKERS_SUPPORTED=!n&&!!f.Worker,b.NODE_STREAM_INPUT=1,b.LocalChunkSize=10485760,b.RemoteChunkSize=5242880,b.DefaultDelimiter=\",\",b.Parser=E,b.ParserHandle=i,b.NetworkStreamer=l,b.FileStreamer=c,b.StringStreamer=p,b.ReadableStreamStreamer=g,f.jQuery){var d=f.jQuery;d.fn.parse=function(o){var i=o.config||{},h=[];return this.each(function(e){if(!(\"INPUT\"===d(this).prop(\"tagName\").toUpperCase()&&\"file\"===d(this).attr(\"type\").toLowerCase()&&f.FileReader)||!this.files||0===this.files.length)return!0;for(var t=0;t<this.files.length;t++)h.push({file:this.files[t],inputElem:this,instanceConfig:d.extend({},i)})}),e(),this;function e(){if(0!==h.length){var e,t,i,r,n=h[0];if(M(o.before)){var s=o.before(n.file,n.inputElem);if(\"object\"==typeof s){if(\"abort\"===s.action)return e=\"AbortError\",t=n.file,i=n.inputElem,r=s.reason,void(M(o.error)&&o.error({name:e},t,i,r));if(\"skip\"===s.action)return void u();\"object\"==typeof s.config&&(n.instanceConfig=d.extend(n.instanceConfig,s.config))}else if(\"skip\"===s)return void u()}var a=n.instanceConfig.complete;n.instanceConfig.complete=function(e){M(a)&&a(e,n.file,n.inputElem),u()},b.parse(n.file,n.instanceConfig)}else M(o.complete)&&o.complete()}function u(){h.splice(0,1),e()}}}function u(e){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine=\"\",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},function(e){var t=w(e);t.chunkSize=parseInt(t.chunkSize),e.step||e.chunk||(t.chunkSize=null);this._handle=new i(t),(this._handle.streamer=this)._config=t}.call(this,e),this.parseChunk=function(e,t){if(this.isFirstChunk&&M(this._config.beforeFirstChunk)){var i=this._config.beforeFirstChunk(e);void 0!==i&&(e=i)}this.isFirstChunk=!1,this._halted=!1;var r=this._partialLine+e;this._partialLine=\"\";var n=this._handle.parse(r,this._baseIndex,!this._finished);if(!this._handle.paused()&&!this._handle.aborted()){var s=n.meta.cursor;this._finished||(this._partialLine=r.substring(s-this._baseIndex),this._baseIndex=s),n&&n.data&&(this._rowCount+=n.data.length);var a=this._finished||this._config.preview&&this._rowCount>=this._config.preview;if(o)f.postMessage({results:n,workerId:b.WORKER_ID,finished:a});else if(M(this._config.chunk)&&!t){if(this._config.chunk(n,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);n=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(n.data),this._completeResults.errors=this._completeResults.errors.concat(n.errors),this._completeResults.meta=n.meta),this._completed||!a||!M(this._config.complete)||n&&n.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),a||n&&n.meta.paused||this._nextChunk(),n}this._halted=!0},this._sendError=function(e){M(this._config.error)?this._config.error(e):o&&this._config.error&&f.postMessage({workerId:b.WORKER_ID,error:e,finished:!1})}}function l(e){var r;(e=e||{}).chunkSize||(e.chunkSize=b.RemoteChunkSize),u.call(this,e),this._nextChunk=n?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(e){this._input=e,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(r=new XMLHttpRequest,this._config.withCredentials&&(r.withCredentials=this._config.withCredentials),n||(r.onload=v(this._chunkLoaded,this),r.onerror=v(this._chunkError,this)),r.open(this._config.downloadRequestBody?\"POST\":\"GET\",this._input,!n),this._config.downloadRequestHeaders){var e=this._config.downloadRequestHeaders;for(var t in e)r.setRequestHeader(t,e[t])}if(this._config.chunkSize){var i=this._start+this._config.chunkSize-1;r.setRequestHeader(\"Range\",\"bytes=\"+this._start+\"-\"+i)}try{r.send(this._config.downloadRequestBody)}catch(e){this._chunkError(e.message)}n&&0===r.status&&this._chunkError()}},this._chunkLoaded=function(){4===r.readyState&&(r.status<200||400<=r.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:r.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(e){var t=e.getResponseHeader(\"Content-Range\");if(null===t)return-1;return parseInt(t.substring(t.lastIndexOf(\"/\")+1))}(r),this.parseChunk(r.responseText)))},this._chunkError=function(e){var t=r.statusText||e;this._sendError(new Error(t))}}function c(e){var r,n;(e=e||{}).chunkSize||(e.chunkSize=b.LocalChunkSize),u.call(this,e);var s=\"undefined\"!=typeof FileReader;this.stream=function(e){this._input=e,n=e.slice||e.webkitSlice||e.mozSlice,s?((r=new FileReader).onload=v(this._chunkLoaded,this),r.onerror=v(this._chunkError,this)):r=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var e=this._input;if(this._config.chunkSize){var t=Math.min(this._start+this._config.chunkSize,this._input.size);e=n.call(e,this._start,t)}var i=r.readAsText(e,this._config.encoding);s||this._chunkLoaded({target:{result:i}})},this._chunkLoaded=function(e){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(e.target.result)},this._chunkError=function(){this._sendError(r.error)}}function p(e){var i;u.call(this,e=e||{}),this.stream=function(e){return i=e,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var e,t=this._config.chunkSize;return t?(e=i.substring(0,t),i=i.substring(t)):(e=i,i=\"\"),this._finished=!i,this.parseChunk(e)}}}function g(e){u.call(this,e=e||{});var t=[],i=!0,r=!1;this.pause=function(){u.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){u.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(e){this._input=e,this._input.on(\"data\",this._streamData),this._input.on(\"end\",this._streamEnd),this._input.on(\"error\",this._streamError)},this._checkIsFinished=function(){r&&1===t.length&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),t.length?this.parseChunk(t.shift()):i=!0},this._streamData=v(function(e){try{t.push(\"string\"==typeof e?e:e.toString(this._config.encoding)),i&&(i=!1,this._checkIsFinished(),this.parseChunk(t.shift()))}catch(e){this._streamError(e)}},this),this._streamError=v(function(e){this._streamCleanUp(),this._sendError(e)},this),this._streamEnd=v(function(){this._streamCleanUp(),r=!0,this._streamData(\"\")},this),this._streamCleanUp=v(function(){this._input.removeListener(\"data\",this._streamData),this._input.removeListener(\"end\",this._streamEnd),this._input.removeListener(\"error\",this._streamError)},this)}function i(m){var a,o,h,r=Math.pow(2,53),n=-r,s=/^\\s*-?(\\d+\\.?|\\.\\d+|\\d+\\.\\d+)([eE][-+]?\\d+)?\\s*$/,u=/^(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))|(\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d([+-][0-2]\\d:[0-5]\\d|Z))$/,t=this,i=0,f=0,d=!1,e=!1,l=[],c={data:[],errors:[],meta:{}};if(M(m.step)){var p=m.step;m.step=function(e){if(c=e,_())g();else{if(g(),0===c.data.length)return;i+=e.data.length,m.preview&&i>m.preview?o.abort():(c.data=c.data[0],p(c,t))}}}function y(e){return\"greedy\"===m.skipEmptyLines?\"\"===e.join(\"\").trim():1===e.length&&0===e[0].length}function g(){if(c&&h&&(k(\"Delimiter\",\"UndetectableDelimiter\",\"Unable to auto-detect delimiting character; defaulted to '\"+b.DefaultDelimiter+\"'\"),h=!1),m.skipEmptyLines)for(var e=0;e<c.data.length;e++)y(c.data[e])&&c.data.splice(e--,1);return _()&&function(){if(!c)return;function e(e,t){M(m.transformHeader)&&(e=m.transformHeader(e,t)),l.push(e)}if(Array.isArray(c.data[0])){for(var t=0;_()&&t<c.data.length;t++)c.data[t].forEach(e);c.data.splice(0,1)}else c.data.forEach(e)}(),function(){if(!c||!m.header&&!m.dynamicTyping&&!m.transform)return c;function e(e,t){var i,r=m.header?{}:[];for(i=0;i<e.length;i++){var n=i,s=e[i];m.header&&(n=i>=l.length?\"__parsed_extra\":l[i]),m.transform&&(s=m.transform(s,n)),s=v(n,s),\"__parsed_extra\"===n?(r[n]=r[n]||[],r[n].push(s)):r[n]=s}return m.header&&(i>l.length?k(\"FieldMismatch\",\"TooManyFields\",\"Too many fields: expected \"+l.length+\" fields but parsed \"+i,f+t):i<l.length&&k(\"FieldMismatch\",\"TooFewFields\",\"Too few fields: expected \"+l.length+\" fields but parsed \"+i,f+t)),r}var t=1;!c.data.length||Array.isArray(c.data[0])?(c.data=c.data.map(e),t=c.data.length):c.data=e(c.data,0);m.header&&c.meta&&(c.meta.fields=l);return f+=t,c}()}function _(){return m.header&&0===l.length}function v(e,t){return i=e,m.dynamicTypingFunction&&void 0===m.dynamicTyping[i]&&(m.dynamicTyping[i]=m.dynamicTypingFunction(i)),!0===(m.dynamicTyping[i]||m.dynamicTyping)?\"true\"===t||\"TRUE\"===t||\"false\"!==t&&\"FALSE\"!==t&&(function(e){if(s.test(e)){var t=parseFloat(e);if(n<t&&t<r)return!0}return!1}(t)?parseFloat(t):u.test(t)?new Date(t):\"\"===t?null:t):t;var i}function k(e,t,i,r){var n={type:e,code:t,message:i};void 0!==r&&(n.row=r),c.errors.push(n)}this.parse=function(e,t,i){var r=m.quoteChar||'\"';if(m.newline||(m.newline=function(e,t){e=e.substring(0,1048576);var i=new RegExp(j(t)+\"([^]*?)\"+j(t),\"gm\"),r=(e=e.replace(i,\"\")).split(\"\\r\"),n=e.split(\"\\n\"),s=1<n.length&&n[0].length<r[0].length;if(1===r.length||s)return\"\\n\";for(var a=0,o=0;o<r.length;o++)\"\\n\"===r[o][0]&&a++;return a>=r.length/2?\"\\r\\n\":\"\\r\"}(e,r)),h=!1,m.delimiter)M(m.delimiter)&&(m.delimiter=m.delimiter(e),c.meta.delimiter=m.delimiter);else{var n=function(e,t,i,r,n){var s,a,o,h;n=n||[\",\",\"\\t\",\"|\",\";\",b.RECORD_SEP,b.UNIT_SEP];for(var u=0;u<n.length;u++){var f=n[u],d=0,l=0,c=0;o=void 0;for(var p=new E({comments:r,delimiter:f,newline:t,preview:10}).parse(e),g=0;g<p.data.length;g++)if(i&&y(p.data[g]))c++;else{var _=p.data[g].length;l+=_,void 0!==o?0<_&&(d+=Math.abs(_-o),o=_):o=_}0<p.data.length&&(l/=p.data.length-c),(void 0===a||d<=a)&&(void 0===h||h<l)&&1.99<l&&(a=d,s=f,h=l)}return{successful:!!(m.delimiter=s),bestDelimiter:s}}(e,m.newline,m.skipEmptyLines,m.comments,m.delimitersToGuess);n.successful?m.delimiter=n.bestDelimiter:(h=!0,m.delimiter=b.DefaultDelimiter),c.meta.delimiter=m.delimiter}var s=w(m);return m.preview&&m.header&&s.preview++,a=e,o=new E(s),c=o.parse(a,t,i),g(),d?{meta:{paused:!0}}:c||{meta:{paused:!1}}},this.paused=function(){return d},this.pause=function(){d=!0,o.abort(),a=M(m.chunk)?\"\":a.substring(o.getCharIndex())},this.resume=function(){t.streamer._halted?(d=!1,t.streamer.parseChunk(a,!0)):setTimeout(t.resume,3)},this.aborted=function(){return e},this.abort=function(){e=!0,o.abort(),c.meta.aborted=!0,M(m.complete)&&m.complete(c),a=\"\"}}function j(e){return e.replace(/[.*+?^${}()|[\\]\\\\]/g,\"\\\\$&\")}function E(e){var S,O=(e=e||{}).delimiter,x=e.newline,I=e.comments,T=e.step,D=e.preview,A=e.fastMode,L=S=void 0===e.quoteChar?'\"':e.quoteChar;if(void 0!==e.escapeChar&&(L=e.escapeChar),(\"string\"!=typeof O||-1<b.BAD_DELIMITERS.indexOf(O))&&(O=\",\"),I===O)throw new Error(\"Comment character same as delimiter\");!0===I?I=\"#\":(\"string\"!=typeof I||-1<b.BAD_DELIMITERS.indexOf(I))&&(I=!1),\"\\n\"!==x&&\"\\r\"!==x&&\"\\r\\n\"!==x&&(x=\"\\n\");var F=0,z=!1;this.parse=function(r,t,i){if(\"string\"!=typeof r)throw new Error(\"Input must be a string\");var n=r.length,e=O.length,s=x.length,a=I.length,o=M(T),h=[],u=[],f=[],d=F=0;if(!r)return C();if(A||!1!==A&&-1===r.indexOf(S)){for(var l=r.split(x),c=0;c<l.length;c++){if(f=l[c],F+=f.length,c!==l.length-1)F+=x.length;else if(i)return C();if(!I||f.substring(0,a)!==I){if(o){if(h=[],k(f.split(O)),R(),z)return C()}else k(f.split(O));if(D&&D<=c)return h=h.slice(0,D),C(!0)}}return C()}for(var p=r.indexOf(O,F),g=r.indexOf(x,F),_=new RegExp(j(L)+j(S),\"g\"),m=r.indexOf(S,F);;)if(r[F]!==S)if(I&&0===f.length&&r.substring(F,F+a)===I){if(-1===g)return C();F=g+s,g=r.indexOf(x,F),p=r.indexOf(O,F)}else if(-1!==p&&(p<g||-1===g))f.push(r.substring(F,p)),F=p+e,p=r.indexOf(O,F);else{if(-1===g)break;if(f.push(r.substring(F,g)),w(g+s),o&&(R(),z))return C();if(D&&h.length>=D)return C(!0)}else for(m=F,F++;;){if(-1===(m=r.indexOf(S,m+1)))return i||u.push({type:\"Quotes\",code:\"MissingQuotes\",message:\"Quoted field unterminated\",row:h.length,index:F}),E();if(m===n-1)return E(r.substring(F,m).replace(_,S));if(S!==L||r[m+1]!==L){if(S===L||0===m||r[m-1]!==L){-1!==p&&p<m+1&&(p=r.indexOf(O,m+1)),-1!==g&&g<m+1&&(g=r.indexOf(x,m+1));var y=b(-1===g?p:Math.min(p,g));if(r[m+1+y]===O){f.push(r.substring(F,m).replace(_,S)),r[F=m+1+y+e]!==S&&(m=r.indexOf(S,F)),p=r.indexOf(O,F),g=r.indexOf(x,F);break}var v=b(g);if(r.substring(m+1+v,m+1+v+s)===x){if(f.push(r.substring(F,m).replace(_,S)),w(m+1+v+s),p=r.indexOf(O,F),m=r.indexOf(S,F),o&&(R(),z))return C();if(D&&h.length>=D)return C(!0);break}u.push({type:\"Quotes\",code:\"InvalidQuotes\",message:\"Trailing quote on quoted field is malformed\",row:h.length,index:F}),m++}}else m++}return E();function k(e){h.push(e),d=F}function b(e){var t=0;if(-1!==e){var i=r.substring(m+1,e);i&&\"\"===i.trim()&&(t=i.length)}return t}function E(e){return i||(void 0===e&&(e=r.substring(F)),f.push(e),F=n,k(f),o&&R()),C()}function w(e){F=e,k(f),f=[],g=r.indexOf(x,F)}function C(e){return{data:h,errors:u,meta:{delimiter:O,linebreak:x,aborted:z,truncated:!!e,cursor:d+(t||0)}}}function R(){T(C()),h=[],u=[]}},this.abort=function(){z=!0},this.getCharIndex=function(){return F}}function _(e){var t=e.data,i=a[t.workerId],r=!1;if(t.error)i.userError(t.error,t.file);else if(t.results&&t.results.data){var n={abort:function(){r=!0,m(t.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:y,resume:y};if(M(i.userStep)){for(var s=0;s<t.results.data.length&&(i.userStep({data:t.results.data[s],errors:t.results.errors,meta:t.results.meta},n),!r);s++);delete t.results}else M(i.userChunk)&&(i.userChunk(t.results,n,t.file),delete t.results)}t.finished&&!r&&m(t.workerId,t.results)}function m(e,t){var i=a[e];M(i.userComplete)&&i.userComplete(t),i.terminate(),delete a[e]}function y(){throw new Error(\"Not implemented.\")}function w(e){if(\"object\"!=typeof e||null===e)return e;var t=Array.isArray(e)?[]:{};for(var i in e)t[i]=w(e[i]);return t}function v(e,t){return function(){e.apply(t,arguments)}}function M(e){return\"function\"==typeof e}return o&&(f.onmessage=function(e){var t=e.data;void 0===b.WORKER_ID&&t&&(b.WORKER_ID=t.workerId);if(\"string\"==typeof t.input)f.postMessage({workerId:b.WORKER_ID,results:b.parse(t.input,t.config),finished:!0});else if(f.File&&t.input instanceof File||t.input instanceof Object){var i=b.parse(t.input,t.config);i&&f.postMessage({workerId:b.WORKER_ID,results:i,finished:!0})}}),(l.prototype=Object.create(u.prototype)).constructor=l,(c.prototype=Object.create(u.prototype)).constructor=c,(p.prototype=Object.create(p.prototype)).constructor=p,(g.prototype=Object.create(u.prototype)).constructor=g,b});\n\n//# sourceURL=webpack://freedatas2html/./node_modules/papaparse/papaparse.min.js?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/exampleWithCSV.ts":
|
||
/*!*******************************!*\
|
||
!*** ./src/exampleWithCSV.ts ***!
|
||
\*******************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./freeDatas2HTML */ \"./src/freeDatas2HTML.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\n\nvar initialise = function () { return __awaiter(void 0, void 0, void 0, function () {\n var mySort, converter, myRender, pagination, filtre1, filtre2, filtre3, sortingField1, sortingField2, sortingField3, sortingField4, e_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 3, , 4]);\n mySort = function (a, b, order) {\n if (order === void 0) { order = \"asc\"; }\n var values = [\"> 100000\", \"> 1 et < 100 000\", \"≤ 1\", \"Traces\", \"Inexistant\"];\n if (order === \"desc\")\n values.reverse();\n if (values.indexOf(a) > values.indexOf(b))\n return -1;\n else if (values.indexOf(a) < values.indexOf(b))\n return 1;\n else\n return 0;\n };\n converter = new _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.FreeDatas2HTML(\"CSV\");\n converter.parser.setRemoteSource({ url: \"http://localhost:8080/datas/elements-chimiques.csv\" });\n converter.datasViewElt = { id: \"datas\" };\n return [4, converter.run()];\n case 1:\n _a.sent();\n myRender = new _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.Render(converter);\n if (window.innerWidth < 800) {\n myRender.settings =\n {\n allBegining: \"<h4>Affichage petits écrans !</h4>\",\n allEnding: \"\",\n linesBegining: \"<ul>\",\n linesEnding: \"</ul>\",\n lineBegining: \"<li><ul>\",\n lineEnding: \"</ul></li>\",\n dataDisplaying: \"<li><b>#FIELDNAME :</b> #VALUE</li>\",\n };\n converter.datasRender = myRender;\n }\n else {\n myRender.settings.allBegining = \"<table class='table-hover'>\";\n converter.datasRender = myRender;\n }\n converter.datasSortingFunctions = [{ datasFieldNb: 4, sort: mySort }];\n pagination = new _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.Pagination(converter, { id: \"pages\" }, \"Page à afficher :\");\n pagination.options = { displayElement: { id: \"paginationOptions\" }, values: [10, 20, 50, 500], name: \"Choix de pagination :\" };\n pagination.selectedValue = 10;\n converter.pagination = pagination;\n pagination.rend2HTML();\n converter.datasCounter = { id: \"compteur\" };\n return [4, converter.run()];\n case 2:\n _a.sent();\n filtre1 = new _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.Selector(converter, 3, { id: \"filtre1\" });\n filtre1.selector2HTML();\n filtre2 = new _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.Selector(converter, 4, { id: \"filtre2\" });\n filtre2.selector2HTML();\n filtre3 = new _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.Selector(converter, 5, { id: \"filtre3\" });\n filtre3.separator = \",\";\n filtre3.selector2HTML();\n converter.datasSelectors = [filtre1, filtre2, filtre3];\n if (window.innerWidth >= 800) {\n sortingField1 = new _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.SortingField(converter, 0);\n sortingField1.field2HTML();\n sortingField2 = new _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.SortingField(converter, 1);\n sortingField2.field2HTML();\n sortingField3 = new _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.SortingField(converter, 2);\n sortingField3.field2HTML();\n sortingField4 = new _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.SortingField(converter, 4);\n sortingField4.field2HTML();\n converter.datasSortingFields = [sortingField1, sortingField2, sortingField3, sortingField4];\n }\n return [3, 4];\n case 3:\n e_1 = _a.sent();\n console.error(e_1);\n if (document.getElementById(\"datas\") !== null)\n document.getElementById(\"datas\").innerHTML = \"<strong>Désolé, mais un problème technique empêche l'affichage des données.</strong>\";\n return [3, 4];\n case 4: return [2];\n }\n });\n}); };\ninitialise();\n\n\n//# sourceURL=webpack://freedatas2html/./src/exampleWithCSV.ts?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/freeDatas2HTML.ts":
|
||
/*!*******************************!*\
|
||
!*** ./src/freeDatas2HTML.ts ***!
|
||
\*******************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"FreeDatas2HTML\": () => (/* binding */ FreeDatas2HTML),\n/* harmony export */ \"Pagination\": () => (/* reexport safe */ _freeDatas2HTMLPagination__WEBPACK_IMPORTED_MODULE_4__.Pagination),\n/* harmony export */ \"Render\": () => (/* reexport safe */ _freeDatas2HTMLRender__WEBPACK_IMPORTED_MODULE_3__.Render),\n/* harmony export */ \"Selector\": () => (/* reexport safe */ _freeDatas2HTMLSelector__WEBPACK_IMPORTED_MODULE_5__.Selector),\n/* harmony export */ \"SortingField\": () => (/* reexport safe */ _freeDatas2HTMLSortingField__WEBPACK_IMPORTED_MODULE_6__.SortingField)\n/* harmony export */ });\n/* harmony import */ var _freeDatas2HTMLParserForCSV__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./freeDatas2HTMLParserForCSV */ \"./src/freeDatas2HTMLParserForCSV.ts\");\n/* harmony import */ var _freeDatas2HTMLParserForHTML__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./freeDatas2HTMLParserForHTML */ \"./src/freeDatas2HTMLParserForHTML.ts\");\n/* harmony import */ var _freeDatas2HTMLParserForJSON__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./freeDatas2HTMLParserForJSON */ \"./src/freeDatas2HTMLParserForJSON.ts\");\n/* harmony import */ var _freeDatas2HTMLRender__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./freeDatas2HTMLRender */ \"./src/freeDatas2HTMLRender.ts\");\n/* harmony import */ var _freeDatas2HTMLPagination__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./freeDatas2HTMLPagination */ \"./src/freeDatas2HTMLPagination.ts\");\n/* harmony import */ var _freeDatas2HTMLSelector__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./freeDatas2HTMLSelector */ \"./src/freeDatas2HTMLSelector.ts\");\n/* harmony import */ var _freeDatas2HTMLSortingField__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./freeDatas2HTMLSortingField */ \"./src/freeDatas2HTMLSortingField.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar compare = __webpack_require__(/*! natural-orderby */ \"./node_modules/natural-orderby/esm/natural-orderby.js\").compare;\nvar errors = __webpack_require__(/*! ./errors.js */ \"./src/errors.js\");\n\n\n\n\nvar FreeDatas2HTML = (function () {\n function FreeDatas2HTML(datasType, datas2Parse, datasRemoteSource) {\n if (datas2Parse === void 0) { datas2Parse = \"\"; }\n this._datasViewElt = undefined;\n this.datasHTML = \"\";\n this.fields = undefined;\n this.datas = [];\n this.stopIfParseErrors = false;\n this._datasSortingFunctions = [];\n this.datasSelectors = [];\n this.datasSortingFields = [];\n this._datasCounter = {};\n this.datasRender = new _freeDatas2HTMLRender__WEBPACK_IMPORTED_MODULE_3__.Render(this);\n switch (datasType) {\n case \"CSV\":\n this.parser = new _freeDatas2HTMLParserForCSV__WEBPACK_IMPORTED_MODULE_0__.ParserForCSV(datasRemoteSource);\n break;\n case \"HTML\":\n this.parser = new _freeDatas2HTMLParserForHTML__WEBPACK_IMPORTED_MODULE_1__.ParserForHTML(datasRemoteSource);\n break;\n case \"JSON\":\n this.parser = new _freeDatas2HTMLParserForJSON__WEBPACK_IMPORTED_MODULE_2__.ParserForJSON(datasRemoteSource);\n break;\n }\n if (datas2Parse !== \"\")\n this.parser.datas2Parse = datas2Parse;\n }\n FreeDatas2HTML.checkInDOMById = function (checkedElt) {\n var searchEltInDOM = document.getElementById(checkedElt.id);\n if (searchEltInDOM === null)\n throw new Error(errors.converterElementNotFound + checkedElt.id);\n else {\n checkedElt.eltDOM = searchEltInDOM;\n return checkedElt;\n }\n };\n FreeDatas2HTML.prototype.checkFieldExist = function (nb) {\n if (this.fields === undefined || this.fields[nb] === undefined)\n return false;\n else\n return true;\n };\n Object.defineProperty(FreeDatas2HTML.prototype, \"datasViewElt\", {\n set: function (elt) {\n this._datasViewElt = FreeDatas2HTML.checkInDOMById(elt);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FreeDatas2HTML.prototype, \"datasSortingFunctions\", {\n set: function (SortingFunctions) {\n this._datasSortingFunctions = [];\n for (var _i = 0, SortingFunctions_1 = SortingFunctions; _i < SortingFunctions_1.length; _i++) {\n var checkedFunction = SortingFunctions_1[_i];\n if (!this.checkFieldExist(checkedFunction.datasFieldNb))\n throw new Error(errors.converterFieldNotFound);\n else\n this._datasSortingFunctions.push(checkedFunction);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(FreeDatas2HTML.prototype, \"datasCounter\", {\n set: function (counterDisplayElement) {\n this._datasCounter = { displayElement: FreeDatas2HTML.checkInDOMById(counterDisplayElement), value: undefined };\n },\n enumerable: false,\n configurable: true\n });\n FreeDatas2HTML.prototype.getDatasCounterValue = function () {\n if (this._datasCounter !== undefined && this._datasCounter.value != undefined)\n return this._datasCounter.value;\n else\n return undefined;\n };\n FreeDatas2HTML.prototype.getSortingFunctionForField = function (datasFieldNb) {\n for (var _i = 0, _a = this._datasSortingFunctions; _i < _a.length; _i++) {\n var checkedFunction = _a[_i];\n if (checkedFunction.datasFieldNb === datasFieldNb)\n return checkedFunction;\n }\n return undefined;\n };\n FreeDatas2HTML.prototype.run = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0: return [4, this.parser.parse()];\n case 1:\n _a.sent();\n if (this.parser.parseResults === undefined)\n throw new Error(errors.parserFail);\n else {\n if (this.parser.parseResults.fields === undefined)\n throw new Error(errors.parserDatasNotFound);\n else if (this.stopIfParseErrors && this.parser.parseResults.errors !== undefined)\n throw new Error(errors.parserMeetErrors);\n else {\n this.fields = this.parser.parseResults.fields;\n this.datas = this.parser.parseResults.datas;\n this.parseErrors = this.parser.parseResults.errors;\n if (this._datasViewElt !== undefined)\n this.refreshView();\n return [2, true];\n }\n }\n return [2];\n }\n });\n });\n };\n FreeDatas2HTML.prototype.refreshView = function () {\n if (this.fields === undefined || this._datasViewElt === undefined || this._datasViewElt.eltDOM === undefined)\n throw new Error(errors.converterRefreshFail);\n else {\n this.datasHTML = this.createDatas2Display(this.fields, this.datas);\n this._datasViewElt.eltDOM.innerHTML = this.datasHTML;\n for (var _i = 0, _a = this.datasSortingFields; _i < _a.length; _i++) {\n var field = _a[_i];\n field.field2HTML();\n }\n }\n };\n FreeDatas2HTML.prototype.createDatas2Display = function (fields, datas) {\n if (this.datasSortedField !== undefined && this.datasSortedField.datasFieldNb !== undefined) {\n var field_1 = fields[this.datasSortedField.datasFieldNb];\n var fieldOrder_1 = this.datasSortedField.order;\n if (this.getSortingFunctionForField(this.datasSortedField.datasFieldNb) !== undefined) {\n var myFunction_1 = this.getSortingFunctionForField(this.datasSortedField.datasFieldNb);\n datas.sort(function (a, b) { return myFunction_1.sort(a[field_1], b[field_1], fieldOrder_1); });\n }\n else\n datas.sort(function (a, b) { return compare({ order: fieldOrder_1 })(a[field_1], b[field_1]); });\n }\n var firstData = 0;\n if (this.pagination !== undefined && this.pagination.selectedValue !== undefined && this.pagination.pages !== undefined && this.pagination.pages.selectedValue !== undefined)\n firstData = this.pagination.selectedValue * (this.pagination.pages.selectedValue - 1);\n var maxData = (this.pagination !== undefined && this.pagination.selectedValue !== undefined) ? this.pagination.selectedValue : datas.length + 1;\n var datas2Display = [];\n var nbVisible = 0, nbTotal = 0;\n for (var row in datas) {\n var visible = true;\n if (this.datasSelectors.length !== 0) {\n var i = 0;\n while (this.datasSelectors[i] !== undefined && visible === true) {\n visible = this.datasSelectors[i].dataIsOk(datas[row]);\n i++;\n }\n }\n if (visible && nbTotal >= firstData && nbVisible < maxData) {\n datas2Display.push(datas[row]);\n nbVisible++;\n nbTotal++;\n }\n else if (visible)\n nbTotal++;\n }\n if (this._datasCounter !== undefined && this._datasCounter.displayElement !== undefined) {\n this._datasCounter.value = nbTotal;\n this._datasCounter.displayElement.eltDOM.innerHTML = \"\" + nbTotal;\n }\n if (this.pagination !== undefined)\n this.pagination.creaPageSelector(nbTotal);\n return this.datasRender.rend2HTML(datas2Display);\n };\n return FreeDatas2HTML;\n}());\n\n\n\n\n\n\n\n//# sourceURL=webpack://freedatas2html/./src/freeDatas2HTML.ts?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/freeDatas2HTMLPagination.ts":
|
||
/*!*****************************************!*\
|
||
!*** ./src/freeDatas2HTMLPagination.ts ***!
|
||
\*****************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Pagination\": () => (/* binding */ Pagination)\n/* harmony export */ });\n/* harmony import */ var _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./freeDatas2HTML */ \"./src/freeDatas2HTML.ts\");\nvar errors = __webpack_require__(/*! ./errors.js */ \"./src/errors.js\");\n\nvar Pagination = (function () {\n function Pagination(converter, pagesElt, pagesName) {\n if (pagesName === void 0) { pagesName = \"Pages\"; }\n if (converter.fields === undefined)\n throw new Error(errors.paginationNeedDatas);\n else {\n this._pages = { displayElement: _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.FreeDatas2HTML.checkInDOMById(pagesElt), name: pagesName };\n this._converter = converter;\n }\n }\n Pagination.isPositiveInteger = function (nb) {\n return (Number.isInteger(nb) === false || nb <= 0) ? false : true;\n };\n Object.defineProperty(Pagination.prototype, \"selectedValue\", {\n get: function () {\n return this._selectedValue;\n },\n set: function (value) {\n if (value === undefined || !Pagination.isPositiveInteger(value))\n throw new Error(errors.needPositiveInteger);\n if (this.options !== undefined && this.options.values.indexOf(value) === -1)\n throw new Error(errors.paginationNeedByfaultValueBeInOptions);\n this._selectedValue = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Pagination.prototype, \"options\", {\n get: function () {\n return this._options;\n },\n set: function (options) {\n if (options !== undefined) {\n options.displayElement = _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.FreeDatas2HTML.checkInDOMById(options.displayElement);\n if (options.values.length === 0)\n throw new Error(errors.paginationNeedOptionsValues);\n for (var _i = 0, _a = options.values; _i < _a.length; _i++) {\n var option = _a[_i];\n if (!Pagination.isPositiveInteger(option))\n throw new Error(errors.needPositiveInteger);\n }\n if (this.selectedValue !== undefined && options.values.indexOf(this.selectedValue) === -1)\n throw new Error(errors.paginationNeedByfaultValueBeInOptions);\n options.name = (options.name === undefined) ? \"Pagination\" : options.name;\n this._options = options;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Pagination.prototype, \"pages\", {\n get: function () {\n return this._pages;\n },\n enumerable: false,\n configurable: true\n });\n Pagination.prototype.rend2HTML = function () {\n if (this._converter === undefined || this._options === undefined)\n throw new Error(errors.pagination2HTMLFail);\n else {\n var selectorsHTML = \"<label for='freeDatas2HTMLPaginationSelector'>\" + this._options.name + \" </label><select name='freeDatas2HTMLPaginationSelector' id='freeDatas2HTMLPaginationSelector'><option value='0'>----</option>\";\n for (var i = 0; i < this._options.values.length; i++)\n selectorsHTML += \"<option value='\" + (i + 1) + \"'>\" + this._options.values[i] + \"</option>\";\n selectorsHTML += \"</select>\";\n this._options.displayElement.eltDOM.innerHTML = selectorsHTML;\n var selectElement_1 = document.getElementById(\"freeDatas2HTMLPaginationSelector\");\n if (this._selectedValue !== undefined) {\n var indexSelectedValue = this._options.values.indexOf(this._selectedValue) + 1;\n selectElement_1.value = \"\" + indexSelectedValue;\n }\n var pagination_1 = this;\n selectElement_1.addEventListener(\"change\", function (e) {\n if (selectElement_1.value === \"0\")\n pagination_1._selectedValue = undefined;\n else\n pagination_1._selectedValue = pagination_1._options.values[Number(selectElement_1.value) - 1];\n pagination_1._converter.refreshView();\n });\n }\n };\n Pagination.prototype.creaPageSelector = function (nbTotal) {\n if (this.selectedValue !== undefined) {\n if (nbTotal > this.selectedValue) {\n var nbPages = Math.ceil(nbTotal / this.selectedValue);\n var selectorsHTML = \"<label for='freeDatas2HTMLPagesSelector'>\" + this.pages.name + \" </label><select name='freeDatas2HTMLPagesSelector' id='freeDatas2HTMLPagesSelector'><option value='1'>1</option>\";\n this.pages.values = [1];\n for (var j = 2; j <= nbPages; j++) {\n selectorsHTML += \"<option value='\" + j + \"'>\" + j + \"</option>\";\n this.pages.values.push(j);\n }\n selectorsHTML += \"</select>\";\n this.pages.displayElement.eltDOM.innerHTML = selectorsHTML;\n var selectElement_2 = document.getElementById(\"freeDatas2HTMLPagesSelector\");\n if (this.pages.selectedValue !== undefined)\n selectElement_2.value = \"\" + this.pages.selectedValue;\n this.pages.selectedValue = 1;\n var pagination_2 = this;\n selectElement_2.addEventListener('change', function (e) {\n pagination_2.pages.selectedValue = Number(selectElement_2.value);\n pagination_2._converter.refreshView();\n });\n }\n else\n this.pages.displayElement.eltDOM.innerHTML = \"\";\n }\n else\n this.pages.displayElement.eltDOM.innerHTML = \"\";\n };\n return Pagination;\n}());\n\n\n\n//# sourceURL=webpack://freedatas2html/./src/freeDatas2HTMLPagination.ts?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/freeDatas2HTMLParserForCSV.ts":
|
||
/*!*******************************************!*\
|
||
!*** ./src/freeDatas2HTMLParserForCSV.ts ***!
|
||
\*******************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ParserForCSV\": () => (/* binding */ ParserForCSV)\n/* harmony export */ });\n/* harmony import */ var _freeDatas2HTMLRemoteSources__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./freeDatas2HTMLRemoteSources */ \"./src/freeDatas2HTMLRemoteSources.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar Papa = __webpack_require__(/*! papaparse */ \"./node_modules/papaparse/papaparse.min.js\");\nvar errors = __webpack_require__(/*! ./errors.js */ \"./src/errors.js\");\n\nvar ParserForCSV = (function () {\n function ParserForCSV(datasRemoteSource) {\n this._datas2Parse = \"\";\n this._parseResults = undefined;\n this.options = {\n delimiter: \"\",\n newline: \"\",\n quoteChar: '\"',\n escapeChar: '\"',\n transformHeader: function (field, index) { return field.trim(); },\n preview: 0,\n comments: \"\",\n fastMode: undefined,\n transform: undefined\n };\n this._privateOptions = {\n header: true,\n download: false,\n downloadRequestHeaders: undefined,\n skipEmptyLines: \"greedy\",\n withCredentials: undefined\n };\n if (datasRemoteSource !== undefined)\n this._datasRemoteSource = datasRemoteSource;\n else\n this._datasRemoteSource = new _freeDatas2HTMLRemoteSources__WEBPACK_IMPORTED_MODULE_0__.RemoteSources({ url: \"\" });\n }\n ParserForCSV.prototype.setRemoteSource = function (source) {\n this._datasRemoteSource = new _freeDatas2HTMLRemoteSources__WEBPACK_IMPORTED_MODULE_0__.RemoteSources(source);\n };\n Object.defineProperty(ParserForCSV.prototype, \"datasRemoteSource\", {\n get: function () {\n return this._datasRemoteSource;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ParserForCSV.prototype, \"datas2Parse\", {\n get: function () {\n return this._datas2Parse;\n },\n set: function (datas) {\n if (datas.trim().length === 0)\n throw new Error(errors.parserNeedDatas);\n else\n this._datas2Parse = datas.trim();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ParserForCSV.prototype, \"parseResults\", {\n get: function () {\n return this._parseResults;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ParserForCSV.prototype, \"privateOptions\", {\n get: function () {\n return this._privateOptions;\n },\n enumerable: false,\n configurable: true\n });\n ParserForCSV.prototype.parse = function () {\n return __awaiter(this, void 0, void 0, function () {\n var parser, options, parseContent, i;\n var _this = this;\n return __generator(this, function (_a) {\n parser = this, options = this.options;\n parseContent = \"\";\n if (parser._datasRemoteSource.url !== \"\") {\n parseContent = parser._datasRemoteSource.url;\n this._privateOptions.download = true;\n this._privateOptions.withCredentials = parser._datasRemoteSource.withCredentials;\n if (parser._datasRemoteSource.headers !== undefined) {\n this._privateOptions.downloadRequestHeaders = {};\n for (i = 0; i < parser._datasRemoteSource.headers.length; i++)\n this._privateOptions.downloadRequestHeaders[parser._datasRemoteSource.headers[i].key] = parser._datasRemoteSource.headers[i].value;\n }\n }\n else if (parser._datas2Parse !== \"\")\n parseContent = parser._datas2Parse;\n else\n throw new Error(errors.parserNeedSource);\n return [2, new Promise(function (resolve, reject) {\n Papa.parse(parseContent, {\n delimiter: options.delimiter,\n newline: options.newline,\n quoteChar: options.quoteChar,\n escapeChar: options.escapeChar,\n header: true,\n transformHeader: options.transformHeader,\n preview: options.preview,\n comments: options.comments,\n complete: function (results) {\n var realFields = [];\n for (var _i = 0, _a = results.meta.fields; _i < _a.length; _i++) {\n var field = _a[_i];\n if (field.trim() !== \"\")\n realFields.push(field);\n }\n if (realFields.length === 0)\n reject(new Error(errors.parserFail));\n else {\n parser._parseResults = {\n datas: results.data,\n errors: results.errors,\n fields: realFields,\n };\n resolve(true);\n }\n },\n download: _this._privateOptions.download,\n downloadRequestHeaders: _this._privateOptions.downloadRequestHeaders,\n skipEmptyLines: \"greedy\",\n fastMode: options.fastMode,\n withCredentials: _this._privateOptions.withCredentials,\n transform: options.transform\n });\n })];\n });\n });\n };\n return ParserForCSV;\n}());\n\n\n\n//# sourceURL=webpack://freedatas2html/./src/freeDatas2HTMLParserForCSV.ts?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/freeDatas2HTMLParserForHTML.ts":
|
||
/*!********************************************!*\
|
||
!*** ./src/freeDatas2HTMLParserForHTML.ts ***!
|
||
\********************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ParserForHTML\": () => (/* binding */ ParserForHTML)\n/* harmony export */ });\n/* harmony import */ var _freeDatas2HTMLRemoteSources__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./freeDatas2HTMLRemoteSources */ \"./src/freeDatas2HTMLRemoteSources.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar errors = __webpack_require__(/*! ./errors.js */ \"./src/errors.js\");\n\nvar ParserForHTML = (function () {\n function ParserForHTML(datasRemoteSource) {\n this._document2Parse = document;\n this._parseResults = undefined;\n this._fieldsSelector = \"table > thead > tr > th\";\n this._rowsSelector = \"table > tbody > tr\";\n this._datasSelector = \"tr > td\";\n if (datasRemoteSource !== undefined)\n this._datasRemoteSource = datasRemoteSource;\n else\n this._datasRemoteSource = new _freeDatas2HTMLRemoteSources__WEBPACK_IMPORTED_MODULE_0__.RemoteSources({ url: \"\" });\n }\n ParserForHTML.prototype.setRemoteSource = function (source) {\n this._datasRemoteSource = new _freeDatas2HTMLRemoteSources__WEBPACK_IMPORTED_MODULE_0__.RemoteSources(source);\n };\n Object.defineProperty(ParserForHTML.prototype, \"datasRemoteSource\", {\n get: function () {\n return this._datasRemoteSource;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ParserForHTML.prototype, \"document2Parse\", {\n get: function () {\n return this._document2Parse;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ParserForHTML.prototype, \"fieldsSelector\", {\n get: function () {\n return this._fieldsSelector;\n },\n set: function (selector) {\n if (selector.trim() === \"\")\n throw new Error(errors.parserSelectorsIsEmpty);\n else\n this._fieldsSelector = selector.trim();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ParserForHTML.prototype, \"rowsSelector\", {\n get: function () {\n return this._rowsSelector;\n },\n set: function (selector) {\n if (selector.trim() === \"\")\n throw new Error(errors.parserSelectorsIsEmpty);\n else\n this._rowsSelector = selector.trim();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ParserForHTML.prototype, \"datasSelector\", {\n get: function () {\n return this._datasSelector;\n },\n set: function (selector) {\n if (selector.trim() === \"\")\n throw new Error(errors.parserSelectorsIsEmpty);\n else\n this._datasSelector = selector.trim();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ParserForHTML.prototype, \"parseResults\", {\n get: function () {\n return this._parseResults;\n },\n enumerable: false,\n configurable: true\n });\n ParserForHTML.prototype.parse = function () {\n return __awaiter(this, void 0, void 0, function () {\n var parser, realFields, datas, parseErrors, settings, response, responseHTML, parserDOM, fields, i, checkField, rows, datasElts, i, dataObject, j;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n parser = this;\n realFields = [], datas = [], parseErrors = [];\n if (!(parser._datasRemoteSource.url !== \"\")) return [3, 3];\n settings = parser._datasRemoteSource.getFetchSettings();\n return [4, fetch(parser._datasRemoteSource.url, settings)];\n case 1:\n response = _a.sent();\n if (!response.ok)\n throw new Error(errors.parserRemoteFail);\n return [4, response.text()];\n case 2:\n responseHTML = _a.sent();\n parserDOM = new DOMParser();\n this._document2Parse = parserDOM.parseFromString(responseHTML, \"text/html\");\n _a.label = 3;\n case 3:\n fields = this._document2Parse.querySelectorAll(this._fieldsSelector);\n if (fields.length === 0)\n throw new Error(errors.parserElementsNotFound + this._fieldsSelector);\n for (i = 0; i < fields.length; i++) {\n checkField = (fields[i].textContent + \"\").trim();\n if (checkField !== \"\" && realFields.indexOf(checkField) === -1)\n realFields.push(checkField);\n else\n console.error(errors.parserFieldNameFail);\n }\n if (realFields.length === 0)\n throw new Error(errors.parserFieldsNotFound);\n rows = this._document2Parse.querySelectorAll(this._rowsSelector);\n for (i = 0; i < rows.length; i++) {\n datasElts = rows[i].querySelectorAll(this._datasSelector);\n if (datasElts.length !== realFields.length)\n parseErrors.push({ row: i, message: errors.parserMeetErrors });\n dataObject = {};\n for (j = 0; j < datasElts.length && j < realFields.length; j++)\n dataObject[realFields[j]] = datasElts[j].textContent + \"\";\n if (Object.keys(dataObject).length !== 0)\n datas.push(dataObject);\n else\n parseErrors.push({ row: i, message: errors.parserMeetErrors });\n }\n parser._parseResults =\n {\n datas: datas,\n errors: parseErrors,\n fields: realFields,\n };\n return [2];\n }\n });\n });\n };\n return ParserForHTML;\n}());\n\n\n\n//# sourceURL=webpack://freedatas2html/./src/freeDatas2HTMLParserForHTML.ts?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/freeDatas2HTMLParserForJSON.ts":
|
||
/*!********************************************!*\
|
||
!*** ./src/freeDatas2HTMLParserForJSON.ts ***!
|
||
\********************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ParserForJSON\": () => (/* binding */ ParserForJSON)\n/* harmony export */ });\n/* harmony import */ var _freeDatas2HTMLRemoteSources__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./freeDatas2HTMLRemoteSources */ \"./src/freeDatas2HTMLRemoteSources.ts\");\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar errors = __webpack_require__(/*! ./errors.js */ \"./src/errors.js\");\n\nvar ParserForJSON = (function () {\n function ParserForJSON(datasRemoteSource) {\n this._datas2Parse = \"\";\n this._parseResults = undefined;\n if (datasRemoteSource !== undefined)\n this._datasRemoteSource = datasRemoteSource;\n else\n this._datasRemoteSource = new _freeDatas2HTMLRemoteSources__WEBPACK_IMPORTED_MODULE_0__.RemoteSources({ url: \"\" });\n }\n ParserForJSON.prototype.setRemoteSource = function (source) {\n this._datasRemoteSource = new _freeDatas2HTMLRemoteSources__WEBPACK_IMPORTED_MODULE_0__.RemoteSources(source);\n };\n Object.defineProperty(ParserForJSON.prototype, \"datasRemoteSource\", {\n get: function () {\n return this._datasRemoteSource;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ParserForJSON.prototype, \"datas2Parse\", {\n get: function () {\n return this._datas2Parse;\n },\n set: function (datas) {\n if (datas.trim().length === 0)\n throw new Error(errors.parserNeedDatas);\n else\n this._datas2Parse = datas.trim();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ParserForJSON.prototype, \"parseResults\", {\n get: function () {\n return this._parseResults;\n },\n enumerable: false,\n configurable: true\n });\n ParserForJSON.trimAllFields = function (fields) {\n var nb = fields.length, goodFields = [];\n for (var i = 0; i < nb; i++) {\n if (typeof fields[i] === \"string\")\n goodFields.push(fields[i].trim());\n }\n return goodFields;\n };\n ParserForJSON.prototype.parse = function () {\n return __awaiter(this, void 0, void 0, function () {\n var parser, parseContent, settings, response, datasParsed, typesOkForValue, fields, datas, parseErrors, nbFields, nbDatas, i, dataObject, nbObjFields, j, i, _i, datasParsed_1, data, dataObject, field;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n parser = this;\n parseContent = \"\";\n if (!(parser._datasRemoteSource.url !== \"\")) return [3, 3];\n settings = parser._datasRemoteSource.getFetchSettings();\n return [4, fetch(parser._datasRemoteSource.url, settings)];\n case 1:\n response = _a.sent();\n if (!response.ok)\n throw new Error(errors.parserRemoteFail);\n return [4, response.text()];\n case 2:\n parseContent = _a.sent();\n return [3, 4];\n case 3:\n if (parser._datas2Parse !== \"\")\n parseContent = parser._datas2Parse;\n else\n throw new Error(errors.parserNeedSource);\n _a.label = 4;\n case 4:\n try {\n datasParsed = JSON.parse(parseContent);\n typesOkForValue = [\"boolean\", \"number\", \"string\"];\n fields = [], datas = [], parseErrors = [];\n if (datasParsed.fields !== undefined && Array.isArray(datasParsed.fields) && datasParsed.datas !== undefined && Array.isArray(datasParsed.datas)) {\n fields = ParserForJSON.trimAllFields(datasParsed.fields);\n nbFields = fields.length, nbDatas = datasParsed.datas.length;\n for (i = 0; i < nbDatas; i++) {\n dataObject = {}, nbObjFields = datasParsed.datas[i].length;\n for (j = 0; j < nbObjFields && j < nbFields; j++) {\n if (typesOkForValue.indexOf(typeof datasParsed.datas[i][j]) === -1)\n parseErrors.push({ row: i, message: errors.parserTypeError + typeof datasParsed.datas[i][j] });\n else\n dataObject[fields[j]] = datasParsed.datas[i][j] + \"\";\n }\n if (Object.keys(dataObject).length !== 0)\n datas.push(dataObject);\n }\n }\n else {\n i = 0;\n for (_i = 0, datasParsed_1 = datasParsed; _i < datasParsed_1.length; _i++) {\n data = datasParsed_1[_i];\n dataObject = {};\n for (field in data) {\n if (typesOkForValue.indexOf(typeof data[field]) !== -1) {\n field = field.trim();\n if (field !== \"\" && fields.indexOf(field) === -1)\n fields.push(field);\n dataObject[field] = data[field] + \"\";\n }\n else\n parseErrors.push({ row: i, message: errors.parserTypeError + typeof data[field] });\n }\n if (Object.keys(dataObject).length !== 0)\n datas.push(dataObject);\n i++;\n }\n }\n if (fields.length === 0)\n throw new Error(errors.parserFail);\n parser._parseResults =\n {\n datas: datas,\n errors: parseErrors,\n fields: fields,\n };\n }\n catch (e) {\n console.error(e);\n throw new Error(errors.parserFail);\n }\n return [2];\n }\n });\n });\n };\n return ParserForJSON;\n}());\n\n\n\n//# sourceURL=webpack://freedatas2html/./src/freeDatas2HTMLParserForJSON.ts?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/freeDatas2HTMLRemoteSources.ts":
|
||
/*!********************************************!*\
|
||
!*** ./src/freeDatas2HTMLRemoteSources.ts ***!
|
||
\********************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"RemoteSources\": () => (/* binding */ RemoteSources)\n/* harmony export */ });\nvar errors = __webpack_require__(/*! ./errors.js */ \"./src/errors.js\");\nvar RemoteSources = (function () {\n function RemoteSources(RemoteSettings) {\n this.allowedUrlProtocol = [\"https:\", \"http:\"];\n this._headers = [];\n this._withCredentials = false;\n this._url = RemoteSettings.url;\n if (RemoteSettings.headers !== undefined)\n this.headers = RemoteSettings.headers;\n if (RemoteSettings.withCredentials !== undefined)\n this.withCredentials = RemoteSettings.withCredentials;\n }\n Object.defineProperty(RemoteSources.prototype, \"url\", {\n get: function () {\n return this._url;\n },\n set: function (url) {\n if (url.trim().length === 0)\n throw new Error(errors.remoteSourceNeedUrl);\n else {\n try {\n var checkUrl = new URL(url);\n if (this.allowedUrlProtocol.indexOf(checkUrl.protocol) === -1)\n throw new Error();\n }\n catch (e) {\n throw new Error(errors.remoteSourceUrlFail);\n }\n this._url = url.trim();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(RemoteSources.prototype, \"headers\", {\n get: function () {\n return this._headers;\n },\n set: function (headers) {\n var forbiddenHeadersNames = [\"Accept-Charset\", \"Accept-Encoding\", \"Access-Control-Request-Headers\", \"Access-Control-Request-Method\", \"Connection\", \"Content-Length\", \"Cookie\", \"Cookie2\", \"Date\", \"DNT\", \"Expect\", \"Host\", \"Keep-Alive\", \"Origin\", \"Referer\", \"TE\", \"Trailer\", \"Transfer-Encoding\", \"Upgrade\", \"Via\"];\n for (var _i = 0, headers_1 = headers; _i < headers_1.length; _i++) {\n var header = headers_1[_i];\n header.key = header.key.trim();\n if (header.key.startsWith(\"Sec-\") || header.key.startsWith(\"Proxy-\") || forbiddenHeadersNames.indexOf(header.key) !== -1)\n console.error(errors.remoteSourceHeaderIsUnallowed);\n else\n this._headers.push({ key: header.key, value: header.value.trim() });\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(RemoteSources.prototype, \"withCredentials\", {\n get: function () {\n return this._withCredentials;\n },\n set: function (credentials) {\n this._withCredentials = credentials;\n },\n enumerable: false,\n configurable: true\n });\n RemoteSources.prototype.getFetchSettings = function () {\n var headers = new Headers();\n if (this._headers !== undefined) {\n for (var _i = 0, _a = this._headers; _i < _a.length; _i++) {\n var header = _a[_i];\n headers.append(header.key, header.value);\n }\n }\n var credentials = (this._withCredentials) ? \"include\" : \"omit\";\n return { method: \"GET\", headers: headers, credentials: credentials };\n };\n return RemoteSources;\n}());\n\n\n\n//# sourceURL=webpack://freedatas2html/./src/freeDatas2HTMLRemoteSources.ts?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/freeDatas2HTMLRender.ts":
|
||
/*!*************************************!*\
|
||
!*** ./src/freeDatas2HTMLRender.ts ***!
|
||
\*************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Render\": () => (/* binding */ Render)\n/* harmony export */ });\nvar errors = __webpack_require__(/*! ./errors.js */ \"./src/errors.js\");\nvar Render = (function () {\n function Render(converter, settings) {\n if (settings === void 0) { settings = Render.defaultSettings; }\n this._converter = converter;\n this.settings = settings;\n }\n Render.prototype.rend2HTML = function (datas) {\n if (this._converter.fields === undefined)\n throw new Error(errors.renderNeedDatas);\n else {\n var datasHTML = this.settings.allBegining;\n if (this.settings.fieldsBegining !== undefined && this.settings.fieldDisplaying !== undefined && this.settings.fieldsEnding !== undefined) {\n datasHTML += this.settings.fieldsBegining;\n for (var _i = 0, _a = this._converter.fields; _i < _a.length; _i++) {\n var field = _a[_i];\n datasHTML += this.settings.fieldDisplaying.replace(\"#FIELDNAME\", field);\n }\n datasHTML += this.settings.fieldsEnding;\n }\n datasHTML += this.settings.linesBegining;\n for (var _b = 0, datas_1 = datas; _b < datas_1.length; _b++) {\n var row = datas_1[_b];\n datasHTML += this.settings.lineBegining;\n for (var _c = 0, _d = this._converter.fields; _c < _d.length; _c++) {\n var field = _d[_c];\n if (row[field] !== undefined)\n datasHTML += this.settings.dataDisplaying.replace(\"#VALUE\", row[field]).replace(\"#FIELDNAME\", field);\n else\n datasHTML += this.settings.dataDisplaying.replace(\"#VALUE\", \"\").replace(\"#FIELDNAME\", field);\n }\n datasHTML += this.settings.lineEnding;\n }\n datasHTML += this.settings.linesEnding + this.settings.allEnding;\n return datasHTML;\n }\n };\n Render.defaultSettings = {\n allBegining: \"<table>\",\n allEnding: \"</table>\",\n fieldsBegining: \"<thead><tr>\",\n fieldsEnding: \"</tr></thead>\",\n fieldDisplaying: \"<th>#FIELDNAME</th>\",\n linesBegining: \"<tbody>\",\n linesEnding: \"</tbody>\",\n lineBegining: \"<tr>\",\n lineEnding: \"</tr>\",\n dataDisplaying: \"<td>#VALUE</td>\",\n };\n return Render;\n}());\n\n\n\n//# sourceURL=webpack://freedatas2html/./src/freeDatas2HTMLRender.ts?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/freeDatas2HTMLSelector.ts":
|
||
/*!***************************************!*\
|
||
!*** ./src/freeDatas2HTMLSelector.ts ***!
|
||
\***************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Selector\": () => (/* binding */ Selector)\n/* harmony export */ });\n/* harmony import */ var _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./freeDatas2HTML */ \"./src/freeDatas2HTML.ts\");\nvar compare = __webpack_require__(/*! natural-orderby */ \"./node_modules/natural-orderby/esm/natural-orderby.js\").compare;\nvar errors = __webpack_require__(/*! ./errors.js */ \"./src/errors.js\");\n\nvar Selector = (function () {\n function Selector(converter, datasFieldNb, elt) {\n this._datasViewElt = { id: \"\", eltDOM: undefined };\n this.name = \"\";\n this.values = [];\n if (converter.fields === undefined || converter.datas.length === 0)\n throw new Error(errors.selectorNeedDatas);\n else if (!converter.checkFieldExist(Number(datasFieldNb)))\n throw new Error(errors.selectorFieldNotFound);\n else {\n this._datasViewElt = _freeDatas2HTML__WEBPACK_IMPORTED_MODULE_0__.FreeDatas2HTML.checkInDOMById(elt);\n this._converter = converter;\n this._datasFieldNb = datasFieldNb;\n }\n }\n Object.defineProperty(Selector.prototype, \"separator\", {\n get: function () {\n return this._separator;\n },\n set: function (separator) {\n if (separator === \"\")\n this._separator = undefined;\n else\n this._separator = separator;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Selector.prototype, \"datasViewElt\", {\n get: function () {\n return this._datasViewElt;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Selector.prototype, \"datasFieldNb\", {\n get: function () {\n return this._datasFieldNb;\n },\n enumerable: false,\n configurable: true\n });\n Selector.prototype.selector2HTML = function () {\n if (this._converter === undefined || this._datasViewElt.eltDOM === undefined || this._datasFieldNb === undefined)\n throw new Error(errors.selector2HTMLFail);\n else {\n this.name = this._converter.fields[this._datasFieldNb];\n for (var _i = 0, _a = this._converter.datas; _i < _a.length; _i++) {\n var row = _a[_i];\n if (this._separator === undefined) {\n if (row[this.name] !== \"\" && this.values.indexOf(row[this.name]) === -1)\n this.values.push(row[this.name]);\n }\n else {\n var checkedValues = row[this.name].split(this._separator);\n for (var _b = 0, checkedValues_1 = checkedValues; _b < checkedValues_1.length; _b++) {\n var value = checkedValues_1[_b];\n if (value !== \"\" && this.values.indexOf(value) === -1)\n this.values.push(value);\n }\n }\n }\n if (this.values.length > 0) {\n if (this._converter.getSortingFunctionForField(this._datasFieldNb) !== undefined)\n this.values.sort(this._converter.getSortingFunctionForField(this._datasFieldNb).sort);\n else\n this.values.sort(compare());\n var selectorsHTML = \"<label for='freeDatas2HTML_\" + this._datasViewElt.id + \"'>\" + this.name + \" : </label><select name='freeDatas2HTML_\" + this._datasViewElt.id + \"' id='freeDatas2HTML_\" + this._datasViewElt.id + \"'><option value='0'>----</option>\";\n for (var i = 0; i < this.values.length; i++)\n selectorsHTML += \"<option value='\" + (i + 1) + \"'>\" + this.values[i] + \"</option>\";\n selectorsHTML += \"</select>\";\n this._datasViewElt.eltDOM.innerHTML = selectorsHTML;\n var selectElement = document.getElementById(\"freeDatas2HTML_\" + this._datasViewElt.id), mySelector_1 = this;\n selectElement.addEventListener(\"change\", function (e) {\n mySelector_1._converter.refreshView();\n });\n }\n }\n };\n Selector.prototype.getSelectionnedId = function () {\n var selectElement = document.getElementById(\"freeDatas2HTML_\" + this._datasViewElt.id);\n if (selectElement === undefined)\n return 0;\n else\n return parseInt(selectElement.value, 10);\n };\n Selector.prototype.dataIsOk = function (data) {\n if (this.name === undefined || this.name === \"\")\n throw new Error(errors.selectorCheckIsOkFail);\n var selectedValue = this.getSelectionnedId();\n if (selectedValue === 0)\n return true;\n else\n selectedValue = selectedValue - 1;\n if (this.values[selectedValue] === undefined)\n throw new Error(errors.selectorSelectedIndexNotFound);\n if (data[this.name] === undefined)\n return false;\n var selectedValueTxt = this.values[selectedValue];\n if (this._separator === undefined) {\n if (data[this.name] !== selectedValueTxt)\n return false;\n else\n return true;\n }\n else {\n var find = false;\n var checkedValues = data[this.name].split(this._separator);\n for (var _i = 0, checkedValues_2 = checkedValues; _i < checkedValues_2.length; _i++) {\n var value = checkedValues_2[_i];\n if (value === selectedValueTxt) {\n find = true;\n break;\n }\n }\n return find;\n }\n };\n return Selector;\n}());\n\n\n\n//# sourceURL=webpack://freedatas2html/./src/freeDatas2HTMLSelector.ts?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/freeDatas2HTMLSortingField.ts":
|
||
/*!*******************************************!*\
|
||
!*** ./src/freeDatas2HTMLSortingField.ts ***!
|
||
\*******************************************/
|
||
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||
|
||
"use strict";
|
||
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"SortingField\": () => (/* binding */ SortingField)\n/* harmony export */ });\nvar compare = __webpack_require__(/*! natural-orderby */ \"./node_modules/natural-orderby/esm/natural-orderby.js\").compare;\nvar errors = __webpack_require__(/*! ./errors.js */ \"./src/errors.js\");\nvar SortingField = (function () {\n function SortingField(converter, datasFieldNb, fieldsDOMSelector) {\n if (fieldsDOMSelector === void 0) { fieldsDOMSelector = \"th\"; }\n this._order = undefined;\n if (converter.fields === undefined)\n throw new Error(errors.sortingFieldNeedDatas);\n else if (!converter.checkFieldExist(Number(datasFieldNb)))\n throw new Error(errors.sortingFieldFieldNotFound);\n else {\n var fields = document.querySelectorAll(fieldsDOMSelector);\n if (fields === undefined)\n throw new Error(errors.sortingFieldsNotInHTML);\n else if (fields.length !== converter.fields.length)\n throw new Error(errors.sortingFieldsNbFail);\n else {\n this._converter = converter;\n this._datasFieldNb = datasFieldNb;\n this._fieldsDOMSelector = fieldsDOMSelector;\n }\n }\n }\n Object.defineProperty(SortingField.prototype, \"fieldsDOMSelector\", {\n get: function () {\n return this._fieldsDOMSelector;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(SortingField.prototype, \"datasFieldNb\", {\n get: function () {\n return this._datasFieldNb;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(SortingField.prototype, \"order\", {\n get: function () {\n return this._order;\n },\n enumerable: false,\n configurable: true\n });\n SortingField.prototype.field2HTML = function () {\n if (this._converter === undefined || this._fieldsDOMSelector === \"\" || this._datasFieldNb === undefined)\n throw new Error(errors.sortingField2HTMLFail);\n else {\n var fields = document.querySelectorAll(this._fieldsDOMSelector);\n var htmlContent = fields[this._datasFieldNb].innerHTML;\n htmlContent = \"<a href='#freeDatas2HTMLSorting\" + this._datasFieldNb + \"' id='freeDatas2HTMLSorting\" + this._datasFieldNb + \"'>\" + htmlContent + \"</a>\";\n fields[this._datasFieldNb].innerHTML = htmlContent;\n var sortingElement = document.getElementById(\"freeDatas2HTMLSorting\" + this._datasFieldNb), field_1 = this;\n sortingElement.addEventListener(\"click\", function (e) {\n e.preventDefault();\n var order = field_1._order;\n if (order === undefined || order === \"desc\")\n field_1._order = \"asc\";\n else\n field_1._order = \"desc\";\n field_1._converter.datasSortedField = field_1;\n field_1._converter.refreshView();\n });\n }\n };\n return SortingField;\n}());\n\n\n\n//# sourceURL=webpack://freedatas2html/./src/freeDatas2HTMLSortingField.ts?");
|
||
|
||
/***/ }),
|
||
|
||
/***/ "./src/errors.js":
|
||
/*!***********************!*\
|
||
!*** ./src/errors.js ***!
|
||
\***********************/
|
||
/***/ ((module) => {
|
||
|
||
eval("module.exports =\n{\n converterElementNotFound : \"Aucun élément HTML n'a été trouvé ayant comme \\\"id\\\" : \",\n converterFieldNotFound : \"Le champ n'existe pas dans les données ou les données n'ont pas encore été chargées.\",\n converterNeedDatasElt: \"Merci de fournir un id valide pour l'élément où afficher les données.\",\n converterRefreshFail: \"Le nom des champs et l'élement du DOM receveur sont nécessaires à l'affichage des données.\",\n pagination2HTMLFail : \"Toutes les donnée nécessaires à la création des sélecteurs de pagination n'ont pas été fournies.\",\n paginationNeedByfaultValueBeInOptions: \"La valeur de pagination par défaut doit faire partie des options proposées.\",\n paginationNeedDatas: \"Il ne peut y avoir de pagination, si les données n'ont pas été récupérées.\",\n paginationNeedOptionsValues: \"Vous n'avez fourni aucune options possibles pour la pagination.\", \n paginationNeedPositiveInteger: \"Merci de fournir un nombre entier supérieur à zéro pour désigner chaque option de pagination.\",\n parserDatasNotFound : \"Aucune donnée n'a été trouvée.\",\n parserElementsNotFound: \"Aucun élément trouvé dans le document pour le sélecteur fourni : \",\n parserFail: \"La lecture des données a échoué.\",\n parserFieldNameFail: \"Les noms de champs fournis doivent être uniques et ne peuvent être vides.\",\n parserFieldsNotFound: \"Aucun nom de champs n'a été trouvé par le parseur.\",\n parserMeetErrors : \"Au moins une erreur a été rencontrée durant le traitement des données.\",\n parserNeedDatas: \"Merci de fournir une chaîne de caractères valide à parser.\",\n parserNeedSource: \"Merci de fournir une chaîne de caractères où une url pour les données à parser.\",\n parserRemoteFail: \"Erreur rencontrée durant l'accès aux données distantes.\",\n parserSelectorsIsEmpty: \"Les sélecteurs CSS ne peuvent pas être une chaîne vide.\",\n parserTypeError: \"Une donnée a été trouvée avec un type imprévu : \",\n remoteSourceHeaderUnallowed: \"Le nom d'une des entêtes passées n'est pas autorisé.\", \n remoteSourceNeedUrl: \"Merci de fournir une url valide pour la source distante de données.\", \n remoteSourceUrlFail: \"L'url fournie ne semble pas valide.\", \n renderNeedDatas: \"Il ne peut y avoir de pagination, si les données n'ont pas été récupérées.\",\n selector2HTMLFail: \"Le création d'un filtre dans le DOM nécessite l'initialisation de l'élément HTML et du numéro du champs à filter.\",\n selectorCheckIsOkFail: \"Le test est lancé sur un filtre incorrectement initialisé ou sur un attribut absent de la donnée à tester.\",\n selectorFieldNotFound: \"Au moins un des champs devant servir à filtrer les données n'existe pas dans le fichier.\",\n selectorNeedDatas: \"Le création d'un filtre nécessite la transmission des données à filtrer.\",\n selectorSelectedIndexNotFound: \"La valeur sélectionnée n'a pas été trouvée dans la liste des champs.\",\n sortingField2HTMLFail: \"Toutes les donnée nécessaires à la création du lien de classement n'ont pas été fournies.\",\n sortingFieldNeedDatas: \"Le création d'un champ de classement nécessite la transmission de la liste des champs.\",\n sortingFieldFieldNotFound: \"Au moins un des champs devant permettre de classer les données n'existe pas dans le fichier.\",\n sortingFieldsNbFail: \"Le nombre de champs trouvés dans le DOM ne correspond pas à celui des données à classer.\",\n sortingFieldsNotInHTML: \"Les champs pouvant servir à classer les données n'ont pas été trouvés dans le DOM.\",\n};\n\n//# sourceURL=webpack://freedatas2html/./src/errors.js?");
|
||
|
||
/***/ })
|
||
|
||
/******/ });
|
||
/************************************************************************/
|
||
/******/ // The module cache
|
||
/******/ var __webpack_module_cache__ = {};
|
||
/******/
|
||
/******/ // The require function
|
||
/******/ function __webpack_require__(moduleId) {
|
||
/******/ // Check if module is in cache
|
||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||
/******/ if (cachedModule !== undefined) {
|
||
/******/ return cachedModule.exports;
|
||
/******/ }
|
||
/******/ // Create a new module (and put it into the cache)
|
||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||
/******/ // no module.id needed
|
||
/******/ // no module.loaded needed
|
||
/******/ exports: {}
|
||
/******/ };
|
||
/******/
|
||
/******/ // Execute the module function
|
||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||
/******/
|
||
/******/ // Return the exports of the module
|
||
/******/ return module.exports;
|
||
/******/ }
|
||
/******/
|
||
/************************************************************************/
|
||
/******/ /* webpack/runtime/define property getters */
|
||
/******/ (() => {
|
||
/******/ // define getter functions for harmony exports
|
||
/******/ __webpack_require__.d = (exports, definition) => {
|
||
/******/ for(var key in definition) {
|
||
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||
/******/ }
|
||
/******/ }
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||
/******/ (() => {
|
||
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
||
/******/ })();
|
||
/******/
|
||
/******/ /* webpack/runtime/make namespace object */
|
||
/******/ (() => {
|
||
/******/ // define __esModule on exports
|
||
/******/ __webpack_require__.r = (exports) => {
|
||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||
/******/ }
|
||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||
/******/ };
|
||
/******/ })();
|
||
/******/
|
||
/************************************************************************/
|
||
/******/
|
||
/******/ // startup
|
||
/******/ // Load entry module and return exports
|
||
/******/ // This entry module can't be inlined because the eval devtool is used.
|
||
/******/ var __webpack_exports__ = __webpack_require__("./src/exampleWithCSV.ts");
|
||
/******/
|
||
/******/ })()
|
||
; |